From 89dca54c74853e72a3ce0fe444c1b07716cd91c8 Mon Sep 17 00:00:00 2001
From: Marcus Larsson <mlarsson@openjdk.org>
Date: Tue, 25 Nov 2014 11:59:55 +0100
Subject: [PATCH 001/299] 8062943: REDO - Parallelize clearing the next mark
 bitmap

Reviewed-by: kbarrett, tschatzl
---
 .../gc_implementation/g1/concurrentMark.cpp   | 28 +++++++++++++++++--
 .../g1/concurrentMarkThread.cpp               |  1 -
 .../gc_implementation/g1/g1CollectedHeap.cpp  |  5 ++--
 .../gc_implementation/g1/g1CollectedHeap.hpp  |  7 +++--
 .../g1/heapRegionManager.cpp                  | 12 ++++++--
 .../g1/heapRegionManager.hpp                  |  2 +-
 6 files changed, 44 insertions(+), 11 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
index eeb110cd015..108a3a5e637 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
@@ -180,9 +180,32 @@ class ClearBitmapHRClosure : public HeapRegionClosure {
   }
 };
 
+class ParClearNextMarkBitmapTask : public AbstractGangTask {
+  ClearBitmapHRClosure* _cl;
+  HeapRegionClaimer     _hrclaimer;
+  bool                  _suspendible; // If the task is suspendible, workers must join the STS.
+
+public:
+  ParClearNextMarkBitmapTask(ClearBitmapHRClosure *cl, uint n_workers, bool suspendible) :
+      _cl(cl), _suspendible(suspendible), AbstractGangTask("Parallel Clear Bitmap Task"), _hrclaimer(n_workers) {}
+
+  void work(uint worker_id) {
+    if (_suspendible) {
+      SuspendibleThreadSet::join();
+    }
+    G1CollectedHeap::heap()->heap_region_par_iterate(_cl, worker_id, &_hrclaimer, true);
+    if (_suspendible) {
+      SuspendibleThreadSet::leave();
+    }
+  }
+};
+
 void CMBitMap::clearAll() {
+  G1CollectedHeap* g1h = G1CollectedHeap::heap();
   ClearBitmapHRClosure cl(NULL, this, false /* may_yield */);
-  G1CollectedHeap::heap()->heap_region_iterate(&cl);
+  uint n_workers = g1h->workers()->active_workers();
+  ParClearNextMarkBitmapTask task(&cl, n_workers, false);
+  g1h->workers()->run_task(&task);
   guarantee(cl.complete(), "Must have completed iteration.");
   return;
 }
@@ -861,7 +884,8 @@ void ConcurrentMark::clearNextBitmap() {
   guarantee(!g1h->mark_in_progress(), "invariant");
 
   ClearBitmapHRClosure cl(this, _nextMarkBitMap, true /* may_yield */);
-  g1h->heap_region_iterate(&cl);
+  ParClearNextMarkBitmapTask task(&cl, parallel_marking_threads(), true);
+  _parallel_workers->run_task(&task);
 
   // Clear the liveness counting data. If the marking has been aborted, the abort()
   // call already did that.
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
index 1f9f0661779..5b51a6f4675 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
@@ -280,7 +280,6 @@ void ConcurrentMarkThread::run() {
       // We may have aborted just before the remark. Do not bother clearing the
       // bitmap then, as it has been done during mark abort.
       if (!cm()->has_aborted()) {
-        SuspendibleThreadSetJoiner sts;
         _cm->clearNextBitmap();
       } else {
         assert(!G1VerifyBitmaps || _cm->nextMarkBitmapIsClear(), "Next mark bitmap must be clear");
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index 8d51bbfcdfd..8e66a94fc54 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -2552,8 +2552,9 @@ void G1CollectedHeap::heap_region_iterate(HeapRegionClosure* cl) const {
 void
 G1CollectedHeap::heap_region_par_iterate(HeapRegionClosure* cl,
                                          uint worker_id,
-                                         HeapRegionClaimer *hrclaimer) const {
-  _hrm.par_iterate(cl, worker_id, hrclaimer);
+                                         HeapRegionClaimer *hrclaimer,
+                                         bool concurrent) const {
+  _hrm.par_iterate(cl, worker_id, hrclaimer, concurrent);
 }
 
 // Clear the cached CSet starting regions and (more importantly)
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
index e7ff5d4b016..444706b671e 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
@@ -1380,10 +1380,13 @@ public:
   // in the range [0..max(ParallelGCThreads-1, 1)]. Applies "blk->doHeapRegion"
   // to each of the regions, by attempting to claim the region using the
   // HeapRegionClaimer and, if successful, applying the closure to the claimed
-  // region.
+  // region. The concurrent argument should be set to true if iteration is
+  // performed concurrently, during which no assumptions are made for consistent
+  // attributes of the heap regions (as they might be modified while iterating).
   void heap_region_par_iterate(HeapRegionClosure* cl,
                                uint worker_id,
-                               HeapRegionClaimer* hrclaimer) const;
+                               HeapRegionClaimer* hrclaimer,
+                               bool concurrent = false) const;
 
   // Clear the cached cset start regions and (more importantly)
   // the time stamps. Called when we reset the GC time stamp.
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
index 5de9dbcce98..e82b4b8db3b 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
@@ -260,7 +260,7 @@ uint HeapRegionManager::find_unavailable_from_idx(uint start_idx, uint* res_idx)
   return num_regions;
 }
 
-void HeapRegionManager::par_iterate(HeapRegionClosure* blk, uint worker_id, HeapRegionClaimer* hrclaimer) const {
+void HeapRegionManager::par_iterate(HeapRegionClosure* blk, uint worker_id, HeapRegionClaimer* hrclaimer, bool concurrent) const {
   const uint start_index = hrclaimer->start_region_for_worker(worker_id);
 
   // Every worker will actually look at all regions, skipping over regions that
@@ -279,7 +279,11 @@ void HeapRegionManager::par_iterate(HeapRegionClosure* blk, uint worker_id, Heap
     // We'll ignore "continues humongous" regions (we'll process them
     // when we come across their corresponding "start humongous"
     // region) and regions already claimed.
-    if (hrclaimer->is_region_claimed(index) || r->is_continues_humongous()) {
+    // However, if the iteration is specified as concurrent, the values for
+    // is_starts_humongous and is_continues_humongous can not be trusted,
+    // and we should just blindly iterate over regions regardless of their
+    // humongous status.
+    if (hrclaimer->is_region_claimed(index) || (!concurrent && r->is_continues_humongous())) {
       continue;
     }
     // OK, try to claim it
@@ -287,7 +291,9 @@ void HeapRegionManager::par_iterate(HeapRegionClosure* blk, uint worker_id, Heap
       continue;
     }
     // Success!
-    if (r->is_starts_humongous()) {
+    // As mentioned above, special treatment of humongous regions can only be
+    // done if we are iterating non-concurrently.
+    if (!concurrent && r->is_starts_humongous()) {
       // If the region is "starts humongous" we'll iterate over its
       // "continues humongous" first; in fact we'll do them
       // first. The order is important. In one case, calling the
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp
index f94d20a5cf4..10fc349bb1f 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.hpp
@@ -222,7 +222,7 @@ public:
   // terminating the iteration early if doHeapRegion() returns true.
   void iterate(HeapRegionClosure* blk) const;
 
-  void par_iterate(HeapRegionClosure* blk, uint worker_id, HeapRegionClaimer* hrclaimer) const;
+  void par_iterate(HeapRegionClosure* blk, uint worker_id, HeapRegionClaimer* hrclaimer, bool concurrent) const;
 
   // Uncommit up to num_regions_to_remove regions that are completely free.
   // Return the actual number of uncommitted regions.

From 0afc5ae6fc6833dc7f9f4d4a53ac61ac733b2119 Mon Sep 17 00:00:00 2001
From: Evgeniya Stepanova <eistepan@openjdk.org>
Date: Tue, 25 Nov 2014 18:16:18 +0400
Subject: [PATCH 002/299] 8065749: [TESTBUG]:
 gc/arguments/TestG1HeapRegionSize.java fails at nightly

Reviewed-by: brutisso
---
 .../test/gc/arguments/TestG1HeapRegionSize.java | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java
index b55dc8b32d6..41c2e1cc095 100644
--- a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java
+++ b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -25,12 +25,11 @@
  * @test TestG1HeapRegionSize
  * @key gc
  * @bug 8021879
- * @requires vm.gc=="G1" | vm.gc=="null"
  * @summary Verify that the flag G1HeapRegionSize is updated properly
  * @run main/othervm -Xmx64m TestG1HeapRegionSize 1048576
- * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m -XX:+UseG1GC TestG1HeapRegionSize 2097152
- * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m -XX:+UseG1GC TestG1HeapRegionSize 2097152
- * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m -XX:+UseG1GC TestG1HeapRegionSize 33554432
+ * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m TestG1HeapRegionSize 2097152
+ * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m TestG1HeapRegionSize 2097152
+ * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m TestG1HeapRegionSize 33554432
  */
 
 import sun.management.ManagementFactoryHelper;
@@ -43,7 +42,13 @@ public class TestG1HeapRegionSize {
     HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
 
     String expectedValue = getExpectedValue(args);
-    VMOption option = diagnostic.getVMOption("G1HeapRegionSize");
+    VMOption option = diagnostic.getVMOption("UseG1GC");
+    if (option.getValue().equals("false")) {
+      System.out.println("Skipping this test. It is only a G1 test.");
+      return;
+    }
+
+    option = diagnostic.getVMOption("G1HeapRegionSize");
     if (!expectedValue.equals(option.getValue())) {
       throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
     }

From f65caabf9cd8de523c2ed87a886736af270901a6 Mon Sep 17 00:00:00 2001
From: Andreas Eriksson <aeriksso@openjdk.org>
Date: Fri, 17 May 2013 17:24:20 +0200
Subject: [PATCH 003/299] 7176220: 'Full GC' events miss date stamp information
 occasionally

Move date stamp logic into GCTraceTime

Reviewed-by: brutisso, tschatzl
---
 .../concurrentMarkSweep/concurrentMarkSweepGeneration.cpp   | 1 -
 .../src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp   | 1 -
 .../src/share/vm/gc_implementation/g1/vm_operations_g1.cpp  | 1 -
 .../vm/gc_implementation/parallelScavenge/psMarkSweep.cpp   | 1 -
 .../parallelScavenge/psParallelCompact.cpp                  | 1 -
 .../vm/gc_implementation/parallelScavenge/psScavenge.cpp    | 1 -
 .../src/share/vm/gc_implementation/shared/gcTraceTime.cpp   | 6 ++----
 hotspot/src/share/vm/memory/genCollectedHeap.cpp            | 1 -
 8 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
index c088c7d130c..94cb93540f1 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
@@ -5945,7 +5945,6 @@ void CMSCollector::reset(bool concurrent) {
 }
 
 void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) {
-  gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
   TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
   GCTraceTime t(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer_cm->gc_id());
   TraceCollectorStats tcs(counters());
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index 8e66a94fc54..742e5cef1c2 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -1222,7 +1222,6 @@ bool G1CollectedHeap::do_collection(bool explicit_gc,
 
     // Timing
     assert(gc_cause() != GCCause::_java_lang_system_gc || explicit_gc, "invariant");
-    gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
     TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
 
     {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
index 80a0f72810e..11e78d07370 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
@@ -230,7 +230,6 @@ void VM_CGC_Operation::release_and_notify_pending_list_lock() {
 }
 
 void VM_CGC_Operation::doit() {
-  gclog_or_tty->date_stamp(G1Log::fine() && PrintGCDateStamps);
   TraceCPUTime tcpu(G1Log::finer(), true, gclog_or_tty);
   GCTraceTime t(_printGCMessage, G1Log::fine(), true, G1CollectedHeap::heap()->gc_timer_cm(), G1CollectedHeap::heap()->concurrent_mark()->concurrent_gc_id());
   SharedHeap* sh = SharedHeap::heap();
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
index a0b2cb96048..09ba270569d 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psMarkSweep.cpp
@@ -168,7 +168,6 @@ bool PSMarkSweep::invoke_no_policy(bool clear_all_softrefs) {
   {
     HandleMark hm;
 
-    gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
     GCTraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer->gc_id());
     TraceCollectorStats tcs(counters());
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
index b4ff553c7e6..b2ef4a192eb 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psParallelCompact.cpp
@@ -2055,7 +2055,6 @@ bool PSParallelCompact::invoke_no_policy(bool maximum_heap_compaction) {
     gc_task_manager()->task_idle_workers();
     heap->set_par_threads(gc_task_manager()->active_workers());
 
-    gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
     GCTraceTime t1(GCCauseString("Full GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer.gc_id());
     TraceCollectorStats tcs(counters());
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
index 7371832d5a3..83fc63b9aa3 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/psScavenge.cpp
@@ -330,7 +330,6 @@ bool PSScavenge::invoke_no_policy() {
     ResourceMark rm;
     HandleMark hm;
 
-    gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
     GCTraceTime t1(GCCauseString("GC", gc_cause), PrintGC, !PrintGCDetails, NULL, _gc_tracer.gc_id());
     TraceCollectorStats tcs(counters());
diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcTraceTime.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcTraceTime.cpp
index 83890611ec5..fff7eea8ca9 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTraceTime.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTraceTime.cpp
@@ -49,10 +49,8 @@ GCTraceTime::GCTraceTime(const char* title, bool doit, bool print_cr, GCTimer* t
   }
 
   if (_doit) {
-    if (PrintGCTimeStamps) {
-      gclog_or_tty->stamp();
-      gclog_or_tty->print(": ");
-    }
+    gclog_or_tty->date_stamp(PrintGCDateStamps);
+    gclog_or_tty->stamp(PrintGCTimeStamps);
     if (PrintGCID) {
       gclog_or_tty->print("#%u: ", gc_id.id());
     }
diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
index bf7a3f7f0a5..1ff0b9266ea 100644
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
@@ -363,7 +363,6 @@ void GenCollectedHeap::do_collection(bool  full,
 
     bool complete = full && (max_level == (n_gens()-1));
     const char* gc_cause_prefix = complete ? "Full GC" : "GC";
-    gclog_or_tty->date_stamp(PrintGC && PrintGCDateStamps);
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
     // The PrintGCDetails logging starts before we have incremented the GC id. We will do that later
     // so we can assume here that the next GC id is what we want.

From 04edcf722cd71a6c807c57449fb81ec337097e1a Mon Sep 17 00:00:00 2001
From: Anton Tarasov <ant@openjdk.org>
Date: Fri, 14 Nov 2014 12:32:43 +0300
Subject: [PATCH 004/299] 8004148: NPE in
 sun.awt.SunToolkit.getWindowDeactivationTime

Reviewed-by: serb
---
 jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java b/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java
index 29f8c297717..6d179aa4f9f 100644
--- a/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java
+++ b/jdk/src/java.desktop/share/classes/sun/awt/SunToolkit.java
@@ -1882,6 +1882,9 @@ public abstract class SunToolkit extends Toolkit
 
     public synchronized void setWindowDeactivationTime(Window w, long time) {
         AppContext ctx = getAppContext(w);
+        if (ctx == null) {
+            return;
+        }
         @SuppressWarnings("unchecked")
         WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
         if (map == null) {
@@ -1893,6 +1896,9 @@ public abstract class SunToolkit extends Toolkit
 
     public synchronized long getWindowDeactivationTime(Window w) {
         AppContext ctx = getAppContext(w);
+        if (ctx == null) {
+            return -1;
+        }
         @SuppressWarnings("unchecked")
         WeakHashMap<Window, Long> map = (WeakHashMap<Window, Long>)ctx.get(DEACTIVATION_TIMES_MAP_KEY);
         if (map == null) {

From ea786e7bc7a2f01a712038083cbfbcfda8a47268 Mon Sep 17 00:00:00 2001
From: Vinnie Ryan <vinnie@openjdk.org>
Date: Fri, 14 Nov 2014 11:41:42 +0000
Subject: [PATCH 005/299] 8034031: [parfait] JNI exception pending in
 jdk/src/macosx/native/apple/security/KeystoreImpl.m

Reviewed-by: alanb
---
 .../macosx/native/libosx/KeystoreImpl.m       | 36 +++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m b/jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m
index 2fe5c4bb79e..179151440da 100644
--- a/jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m
+++ b/jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m
@@ -300,11 +300,21 @@ static void addIdentitiesToKeystore(JNIEnv *env, jobject keyStore)
 
             // Make a java array of certificate data from the chain.
             jclass byteArrayClass = (*env)->FindClass(env, "[B");
+            if (byteArrayClass == NULL) {
+                goto errOut;
+            }
             jobjectArray javaCertArray = (*env)->NewObjectArray(env, certCount, byteArrayClass, NULL);
+            // Cleanup first then check for a NULL return code
             (*env)->DeleteLocalRef(env, byteArrayClass);
+            if (javaCertArray == NULL) {
+                goto errOut;
+            }
 
             // And, make an array of the certificate refs.
             jlongArray certRefArray = (*env)->NewLongArray(env, certCount);
+            if (certRefArray == NULL) {
+                goto errOut;
+            }
 
             SecCertificateRef currCertRef = NULL;
 
@@ -319,6 +329,9 @@ static void addIdentitiesToKeystore(JNIEnv *env, jobject keyStore)
                 bzero(&currCertData, sizeof(CSSM_DATA));
                 err = SecCertificateGetData(currCertRef, &currCertData);
                 jbyteArray encodedCertData = (*env)->NewByteArray(env, currCertData.Length);
+                if (encodedCertData == NULL) {
+                    goto errOut;
+                }
                 (*env)->SetByteArrayRegion(env, encodedCertData, 0, currCertData.Length, (jbyte *)currCertData.Data);
                 (*env)->SetObjectArrayElement(env, javaCertArray, i, encodedCertData);
                 jlong certRefElement = ptr_to_jlong(currCertRef);
@@ -331,6 +344,9 @@ static void addIdentitiesToKeystore(JNIEnv *env, jobject keyStore)
 
             // Find the label.  It's a 'blob', but we interpret as characters.
             jstring alias = getLabelFromItem(env, (SecKeychainItemRef)certificate);
+            if (alias == NULL) {
+                goto errOut;
+            }
 
             // Find the creation date.
             jlong creationDate = getModDateFromItem(env, (SecKeychainItemRef)certificate);
@@ -341,6 +357,7 @@ static void addIdentitiesToKeystore(JNIEnv *env, jobject keyStore)
         }
     } while (searchResult == noErr);
 
+errOut:
     if (identitySearch != NULL) {
         CFRelease(identitySearch);
     }
@@ -363,10 +380,16 @@ static void addCertificatesToKeystore(JNIEnv *env, jobject keyStore)
             CSSM_DATA currCertificate;
             err = SecCertificateGetData(certRef, &currCertificate);
             jbyteArray certData = (*env)->NewByteArray(env, currCertificate.Length);
+            if (certData == NULL) {
+                goto errOut;
+            }
             (*env)->SetByteArrayRegion(env, certData, 0, currCertificate.Length, (jbyte *)currCertificate.Data);
 
             // Find the label.  It's a 'blob', but we interpret as characters.
             jstring alias = getLabelFromItem(env, theItem);
+            if (alias == NULL) {
+                goto errOut;
+            }
 
             // Find the creation date.
             jlong creationDate = getModDateFromItem(env, theItem);
@@ -377,6 +400,7 @@ static void addCertificatesToKeystore(JNIEnv *env, jobject keyStore)
         }
     } while (searchResult == noErr);
 
+errOut:
     if (keychainItemSearch != NULL) {
         CFRelease(keychainItemSearch);
     }
@@ -405,6 +429,9 @@ JNIEXPORT jbyteArray JNICALL Java_apple_security_KeychainStore__1getEncodedKeyDa
 
         if (passwordLen > 0) {
             passwordChars = (*env)->GetCharArrayElements(env, passwordObj, NULL);
+            if (passwordChars == NULL) {
+                goto errOut;
+            }
             passwordStrRef = CFStringCreateWithCharacters(kCFAllocatorDefault, passwordChars, passwordLen);
         }
     }
@@ -424,9 +451,13 @@ JNIEXPORT jbyteArray JNICALL Java_apple_security_KeychainStore__1getEncodedKeyDa
     if (err == noErr) {
         CFIndex size = CFDataGetLength(exportedData);
         returnValue = (*env)->NewByteArray(env, size);
+        if (returnValue == NULL) {
+            goto errOut;
+        }
         (*env)->SetByteArrayRegion(env, returnValue, 0, size, (jbyte *)CFDataGetBytePtr(exportedData));
     }
 
+errOut:
     if (exportedData) CFRelease(exportedData);
     if (passwordStrRef) CFRelease(passwordStrRef);
 
@@ -467,6 +498,9 @@ JNF_COCOA_ENTER(env);
 
     jsize dataSize = (*env)->GetArrayLength(env, rawDataObj);
     jbyte *rawData = (*env)->GetByteArrayElements(env, rawDataObj, NULL);
+    if (rawData == NULL) {
+        goto errOut;
+    }
 
     CFDataRef cfDataToImport = CFDataCreate(kCFAllocatorDefault, (UInt8 *)rawData, dataSize);
     CFArrayRef createdItems = NULL;
@@ -523,6 +557,8 @@ JNF_COCOA_ENTER(env);
         CFRelease(createdItems);
     }
 
+errOut: ;
+
 JNF_COCOA_EXIT(env);
 
     return returnValue;

From 187bacb237a08e66bd2046ae141263b899ac3615 Mon Sep 17 00:00:00 2001
From: Chris Hegarty <chegar@openjdk.org>
Date: Fri, 14 Nov 2014 18:15:52 +0000
Subject: [PATCH 006/299] 8050983: Misplaced parentheses in
 sun.net.www.http.HttpClient break HTTP PUT streaming

Reviewed-by: michaelm
---
 .../classes/sun/net/www/http/HttpClient.java  | 14 ++++++++------
 .../www/http/HttpClient/StreamingRetry.java   | 19 ++++++++++++++-----
 2 files changed, 22 insertions(+), 11 deletions(-)

diff --git a/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java b/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java
index 0e07d3ab65c..fcdd50943ab 100644
--- a/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java
+++ b/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java
@@ -657,9 +657,10 @@ public class HttpClient extends NetworkClient {
             cachedHttpClient = false;
             if (!failedOnce && requests != null) {
                 failedOnce = true;
-                if (getRequestMethod().equals("CONNECT") ||
-                    (httpuc.getRequestMethod().equals("POST") &&
-                    (!retryPostProp || streaming))) {
+                if (getRequestMethod().equals("CONNECT")
+                    || streaming
+                    || (httpuc.getRequestMethod().equals("POST")
+                        && !retryPostProp)) {
                     // do not retry the request
                 }  else {
                     // try once more
@@ -769,9 +770,10 @@ public class HttpClient extends NetworkClient {
             } else if (nread != 8) {
                 if (!failedOnce && requests != null) {
                     failedOnce = true;
-                    if (getRequestMethod().equals("CONNECT") ||
-                        (httpuc.getRequestMethod().equals("POST") &&
-                         (!retryPostProp || streaming))) {
+                    if (getRequestMethod().equals("CONNECT")
+                        || streaming
+                        || (httpuc.getRequestMethod().equals("POST")
+                            && !retryPostProp)) {
                         // do not retry the request
                     } else {
                         closeServer();
diff --git a/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java b/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java
index 03c5b503e8a..35dbc51d2de 100644
--- a/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java
+++ b/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java
@@ -23,8 +23,8 @@
 
 /*
  * @test
- * @bug 6672144
- * @summary HttpURLConnection.getInputStream sends POST request after failed chunked send
+ * @bug 6672144 8050983
+ * @summary Do not retry failed request with a streaming body.
  */
 
 import java.net.HttpURLConnection;
@@ -33,6 +33,7 @@ import java.net.URL;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import static java.lang.System.out;
 
 public class StreamingRetry implements Runnable {
     static final int ACCEPT_TIMEOUT = 20 * 1000; // 20 seconds
@@ -43,11 +44,17 @@ public class StreamingRetry implements Runnable {
     }
 
     void instanceMain() throws IOException {
-        test();
+        out.println("Test with default method");
+        test(null);
+        out.println("Test with POST method");
+        test("POST");
+        out.println("Test with PUT method");
+        test("PUT");
+
         if (failed > 0) throw new RuntimeException("Some tests failed");
     }
 
-    void test() throws IOException {
+    void test(String method) throws IOException {
         ss = new ServerSocket(0);
         ss.setSoTimeout(ACCEPT_TIMEOUT);
         int port = ss.getLocalPort();
@@ -58,6 +65,8 @@ public class StreamingRetry implements Runnable {
             URL url = new URL("http://localhost:" + port + "/");
             HttpURLConnection uc = (HttpURLConnection) url.openConnection();
             uc.setDoOutput(true);
+            if (method != null)
+                uc.setRequestMethod(method);
             uc.setChunkedStreamingMode(4096);
             OutputStream os = uc.getOutputStream();
             os.write("Hello there".getBytes());
@@ -79,7 +88,7 @@ public class StreamingRetry implements Runnable {
             ss.close();
             fail("The server shouldn't accept a second connection");
          } catch (IOException e) {
-            //OK, the clien will close the server socket if successfull
+            //OK, the client will close the server socket if successful
         }
     }
 

From 72f7a2a671cd8ef044cf8e7dd10fb547927260ad Mon Sep 17 00:00:00 2001
From: Martin Buchholz <martin@openjdk.org>
Date: Mon, 27 Oct 2014 16:24:43 -0700
Subject: [PATCH 007/299] 8062194: java.util.jar.Attributes should use
 insertion-ordered iteration

S/HashMap/LinkedHashMap/g

Reviewed-by: alanb, sherman
---
 .../classes/java/util/jar/Attributes.java     |  9 ++-
 .../util/jar/Attributes/IterationOrder.java   | 74 +++++++++++++++++++
 2 files changed, 80 insertions(+), 3 deletions(-)
 create mode 100644 jdk/test/java/util/jar/Attributes/IterationOrder.java

diff --git a/jdk/src/java.base/share/classes/java/util/jar/Attributes.java b/jdk/src/java.base/share/classes/java/util/jar/Attributes.java
index 37efbd47481..1bf9ac170fb 100644
--- a/jdk/src/java.base/share/classes/java/util/jar/Attributes.java
+++ b/jdk/src/java.base/share/classes/java/util/jar/Attributes.java
@@ -28,7 +28,7 @@ package java.util.jar;
 import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.IOException;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Set;
 import java.util.Collection;
@@ -47,6 +47,9 @@ import sun.misc.ASCIICaseInsensitiveComparator;
  * <a href="../../../../technotes/guides/jar/jar.html">JAR File Specification</a>
  * for more information about valid attribute names and values.
  *
+ * <p>This map and its views have a predictable iteration order, namely the
+ * order that keys were inserted into the map, as with {@link LinkedHashMap}.
+ *
  * @author  David Connelly
  * @see     Manifest
  * @since   1.2
@@ -71,7 +74,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
      * @param size the initial number of attributes
      */
     public Attributes(int size) {
-        map = new HashMap<>(size);
+        map = new LinkedHashMap<>(size);
     }
 
     /**
@@ -81,7 +84,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
      * @param attr the specified Attributes
      */
     public Attributes(Attributes attr) {
-        map = new HashMap<>(attr);
+        map = new LinkedHashMap<>(attr);
     }
 
 
diff --git a/jdk/test/java/util/jar/Attributes/IterationOrder.java b/jdk/test/java/util/jar/Attributes/IterationOrder.java
new file mode 100644
index 00000000000..4028d71e7c4
--- /dev/null
+++ b/jdk/test/java/util/jar/Attributes/IterationOrder.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright 2014 Google, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact 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 8062194
+ * @summary Ensure Attribute iteration order is the insertion order.
+ */
+
+import java.util.Arrays;
+import java.util.Map;
+import java.util.jar.Attributes;
+import java.util.jar.Attributes.Name;
+
+public class IterationOrder {
+    static void checkOrder(Attributes.Name k0, String v0,
+                           Attributes.Name k1, String v1,
+                           Attributes.Name k2, String v2) {
+        Attributes x = new Attributes();
+        x.put(k0, v0);
+        x.put(k1, v1);
+        x.put(k2, v2);
+        Map.Entry<?,?>[] entries
+            = x.entrySet().toArray(new Map.Entry<?,?>[3]);
+        if (!(entries.length == 3
+              && entries[0].getKey() == k0
+              && entries[0].getValue() == v0
+              && entries[1].getKey() == k1
+              && entries[1].getValue() == v1
+              && entries[2].getKey() == k2
+              && entries[2].getValue() == v2)) {
+            throw new AssertionError(Arrays.toString(entries));
+        }
+
+        Object[] keys = x.keySet().toArray();
+        if (!(keys.length == 3
+              && keys[0] == k0
+              && keys[1] == k1
+              && keys[2] == k2)) {
+             throw new AssertionError(Arrays.toString(keys));
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        Attributes.Name k0 = Name.MANIFEST_VERSION;
+        Attributes.Name k1 = Name.MAIN_CLASS;
+        Attributes.Name k2 = Name.SEALED;
+        String v0 = "42.0";
+        String v1 = "com.google.Hello";
+        String v2 = "yes";
+        checkOrder(k0, v0, k1, v1, k2, v2);
+        checkOrder(k1, v1, k0, v0, k2, v2);
+        checkOrder(k2, v2, k1, v1, k0, v0);
+    }
+}

From 5e65c0f984aa3ce3478e05427cab863d01a1d152 Mon Sep 17 00:00:00 2001
From: Martin Buchholz <martin@openjdk.org>
Date: Thu, 6 Nov 2014 13:29:36 -0800
Subject: [PATCH 008/299] 8063147: Class.getFields spec should state that
 fields are inherited from superinterfaces

Reviewed-by: psandoz, chegar
---
 .../share/classes/java/lang/Class.java        |   3 +-
 .../java/lang/Class/getFields/Sanity.java     | 168 ++++++++++++++++++
 2 files changed, 170 insertions(+), 1 deletion(-)
 create mode 100644 jdk/test/java/lang/Class/getFields/Sanity.java

diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java
index 5c03b975326..9063450866f 100644
--- a/jdk/src/java.base/share/classes/java/lang/Class.java
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java
@@ -1533,7 +1533,8 @@ public final class Class<T> implements java.io.Serializable,
      * 0.
      *
      * <p> If this {@code Class} object represents a class, then this method
-     * returns the public fields of the class and of all its superclasses.
+     * returns the public fields of the class and of all its superclasses and
+     * superinterfaces.
      *
      * <p> If this {@code Class} object represents an interface, then this
      * method returns the fields of the interface and of all its
diff --git a/jdk/test/java/lang/Class/getFields/Sanity.java b/jdk/test/java/lang/Class/getFields/Sanity.java
new file mode 100644
index 00000000000..e82ac10521d
--- /dev/null
+++ b/jdk/test/java/lang/Class/getFields/Sanity.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright 2014 Google, Inc.  All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact 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 8063147
+ * @summary Tests for Class.getFields().
+ * @run testng Sanity
+ */
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+public class Sanity {
+    public interface EmptyInterface {}
+    class EmptyClass {}
+    interface BI1 {
+        public int i = 1;
+        int j = 2;
+    }
+    interface BI2 {
+        int k = 1;
+    }
+    public interface DI extends BI1, BI2, EmptyInterface {
+        int m = 5;
+    }
+    interface DDI extends DI {
+        int n = 6;
+    }
+
+    public class D extends EmptyClass {
+        public int publicDField;
+        protected int protectedDField;
+        private int privateDField;
+    }
+
+    class DD extends D {
+        public int publicDDField;
+        protected int protectedDDField;
+        private int privateDDField;
+    }
+
+    public class Universe extends DD implements DDI {
+        public int publicUniverseField;
+        protected int protectedUniverseField;
+        private int privateUniverseField;
+    }
+
+    void assertContainsNoFields(Class<?> clazz) {
+        assertEquals(clazz.getFields().length, 0);
+    }
+
+    @Test
+    public void primitiveTypesHaveNoFields() throws Exception {
+        assertContainsNoFields(byte.class);
+        assertContainsNoFields(char.class);
+        assertContainsNoFields(short.class);
+        assertContainsNoFields(int.class);
+        assertContainsNoFields(long.class);
+        assertContainsNoFields(boolean.class);
+        assertContainsNoFields(void.class);
+        assertContainsNoFields(double.class);
+        assertContainsNoFields(float.class);
+    }
+
+    @Test
+    public void arrayTypesHaveNoFields() throws Exception {
+        assertContainsNoFields(byte[].class);
+        assertContainsNoFields(Object[].class);
+        assertContainsNoFields(java.util.Map[].class);
+        assertContainsNoFields(java.util.HashMap[].class);
+    }
+
+    @Test
+    public void emptyInterfacesHaveNoFields() throws Exception {
+        assertContainsNoFields(EmptyInterface.class);
+    }
+
+    @Test
+    public void emptyClassesHaveNoFields() throws Exception {
+        assertContainsNoFields(EmptyClass.class);
+        class EmptyLocalClass {}
+        assertContainsNoFields(EmptyLocalClass.class);
+    }
+
+    void assertContainsFields(Class<?> clazz, int count) {
+         assertEquals(clazz.getFields().length, count);
+    }
+
+    @Test
+    public void checkFieldCounts() throws Exception {
+        assertContainsFields(BI1.class, 2);
+        assertContainsFields(BI2.class, 1);
+        assertContainsFields(DI.class, 4);
+        assertContainsFields(DDI.class, 5);
+        assertContainsFields(D.class, 1);
+        assertContainsFields(DD.class, 2);
+        assertContainsFields(Universe.class, 8);
+    }
+
+    void assertContainsFields(Class<?> derived, Class<?> base) {
+        List<Field> derivedFields = Arrays.asList(derived.getFields());
+        List<Field> baseFields = Arrays.asList(base.getFields());
+        assertTrue(derivedFields.containsAll(baseFields));
+    }
+
+    List<Class<?>> directSupers(Class<?> clazz) {
+        List<Class<?>> directSupers = new ArrayList<>();
+        directSupers.addAll(Arrays.asList(clazz.getInterfaces()));
+        if (clazz.getSuperclass() != null) {
+            directSupers.add(clazz.getSuperclass());
+        }
+        return directSupers;
+    }
+
+    void assertContainsSuperFields(Class<?> clazz) {
+        for (Class<?> directSuper : directSupers(clazz)) {
+            assertContainsFields(clazz, directSuper);
+        }
+    }
+
+    List<Class<?>> testClasses() {
+        List<Class<?>> testClasses = new ArrayList<>();
+        testClasses.add(Sanity.class);
+        testClasses.addAll(Arrays.asList(Sanity.class.getDeclaredClasses()));
+        assertEquals(testClasses.size(), 10);
+        return testClasses;
+    }
+
+    @Test
+    public void fieldsAreInheritedFromSupers() throws Exception {
+        for (Class clazz : testClasses()) {
+            assertContainsSuperFields(clazz);
+        }
+    }
+
+    @Test
+    public void getFieldIsConsistentWithGetFields() throws Exception {
+        for (Class clazz : testClasses()) {
+            for (Field field : clazz.getFields()) {
+                assertEquals(field, clazz.getField(field.getName()));
+            }
+        }
+    }
+}

From 05ed094d99a4cc89ab61d4d8ce09b7f77eaeffb3 Mon Sep 17 00:00:00 2001
From: Mark Sheppard <msheppar@openjdk.org>
Date: Sat, 15 Nov 2014 18:26:29 +0000
Subject: [PATCH 009/299] 8015692: java.net.BindException is thrown on Windows
 XP when HTTP server is started and stopped in the loop

Join the dispatcher thread in the ServerImpl.stop method to ensure Dispatcher is finished prior to exiting stop().

Reviewed-by: chegar
---
 .../sun/net/httpserver/ServerImpl.java        | 13 +++-
 .../net/httpserver/SimpleHttpServerTest.java  | 64 +++++++++++++++++++
 2 files changed, 74 insertions(+), 3 deletions(-)
 create mode 100644 jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java

diff --git a/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java b/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java
index 5b424fb948d..5952c79ee87 100644
--- a/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java
+++ b/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -82,6 +82,7 @@ class ServerImpl implements TimeSource {
 
     private Timer timer, timer1;
     private Logger logger;
+    private Thread dispatcherThread;
 
     ServerImpl (
         HttpServer wrapper, String protocol, InetSocketAddress addr, int backlog
@@ -141,9 +142,9 @@ class ServerImpl implements TimeSource {
         if (executor == null) {
             executor = new DefaultExecutor();
         }
-        Thread t = new Thread (dispatcher);
+        dispatcherThread = new Thread (dispatcher);
         started = true;
-        t.start();
+        dispatcherThread.start();
     }
 
     public void setExecutor (Executor executor) {
@@ -205,6 +206,12 @@ class ServerImpl implements TimeSource {
         if (timer1Enabled) {
             timer1.cancel();
         }
+        try {
+            dispatcherThread.join();
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            logger.log(Level.FINER, "ServerImpl.stop: ", e);
+        }
     }
 
     Dispatcher dispatcher;
diff --git a/jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java b/jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java
new file mode 100644
index 00000000000..c33ded954b4
--- /dev/null
+++ b/jdk/test/com/sun/net/httpserver/SimpleHttpServerTest.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014 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 8015692
+ * @summary  Test HttpServer instantiation, start, and stop repeated in a loop
+ *           Testing for Bind exception on Windows
+ */
+
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+
+import com.sun.net.httpserver.HttpServer;
+
+
+public class SimpleHttpServerTest {
+
+    public static void main(String[] args) throws Exception {
+
+        System.out.println(System.getProperty("java.version"));
+        InetSocketAddress serverAddr = new InetSocketAddress(0);
+        HttpServer server = HttpServer.create(serverAddr, 0);
+        final int serverPort = server.getAddress().getPort();
+        server.start();
+        server.stop(0);
+        serverAddr = new InetSocketAddress(serverPort);
+        int exceptionCount = 0;
+        System.out.println("Using serverPort == " + serverPort);
+        for (int i = 0; i < 100; i++) {
+            try {
+                server = HttpServer.create(serverAddr, 0);
+                server.start();
+                server.stop(0);
+            } catch (Exception ex) {
+                ex.printStackTrace();
+                exceptionCount++;
+            }
+        }
+        if (exceptionCount > 0) {
+           throw new RuntimeException("Test Failed");
+        }
+    }
+}

From 0d4528c45f76fe5ad05f77e625c78306b49a073f Mon Sep 17 00:00:00 2001
From: Anthony Scarpino <ascarpino@openjdk.org>
Date: Sun, 18 May 2014 23:06:51 +0000
Subject: [PATCH 010/299] 8042480: CipherInputStream.close() throws
 AEADBadTagException in some cases

Reviewed-by: xuelei
---
 .../share/classes/javax/crypto/CipherInputStream.java | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java b/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java
index 0930f9d6426..37520a1b5ec 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/CipherInputStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -88,6 +88,8 @@ public class CipherInputStream extends FilterInputStream {
     private int ofinish = 0;
     // stream status
     private boolean closed = false;
+    // The stream has been read from.  False if the stream has never been read.
+    private boolean read = false;
 
     /**
      * private convenience function.
@@ -103,6 +105,7 @@ public class CipherInputStream extends FilterInputStream {
     private int getMoreData() throws IOException {
         if (done) return -1;
         int readin = input.read(ibuffer);
+        read = true;
         if (readin == -1) {
             done = true;
             try {
@@ -306,7 +309,11 @@ public class CipherInputStream extends FilterInputStream {
             }
         }
         catch (BadPaddingException | IllegalBlockSizeException ex) {
-            throw new IOException(ex);
+            /* If no data has been read from the stream to be en/decrypted,
+               we supress any exceptions, and close quietly. */
+            if (read) {
+                throw new IOException(ex);
+            }
         }
         ostart = 0;
         ofinish = 0;

From 9c20c6fd5f29e14ed08fdeece7aa5e3df9a73c46 Mon Sep 17 00:00:00 2001
From: Xue-Lei Andrew Fan <xuelei@openjdk.org>
Date: Thu, 29 May 2014 04:24:10 +0000
Subject: [PATCH 011/299] 8043200: Decrease the preference mode of RC4 in the
 enabled cipher suite list

Reviewed-by: wetmore, ahgross, asmotrak
---
 .../classes/sun/security/ssl/CipherSuite.java | 103 +++++++++---------
 .../ciphersuites/CipherSuitesInOrder.java     |  49 +++++----
 2 files changed, 78 insertions(+), 74 deletions(-)

diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuite.java b/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuite.java
index c29cb69b6f9..6d52cc68435 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuite.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuite.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -968,7 +968,7 @@ final class CipherSuite implements Comparable<CipherSuite> {
          * 1. Prefer Suite B compliant cipher suites, see RFC6460 (To be
          *    changed later, see below).
          * 2. Prefer the stronger bulk cipher, in the order of AES_256(GCM),
-         *    AES_128(GCM), AES_256, AES_128, RC-4, 3DES-EDE.
+         *    AES_128(GCM), AES_256, AES_128, 3DES-EDE, RC-4.
          * 3. Prefer the stronger MAC algorithm, in the order of SHA384,
          *    SHA256, SHA, MD5.
          * 4. Prefer the better performance of key exchange and digital
@@ -1087,18 +1087,6 @@ final class CipherSuite implements Comparable<CipherSuite> {
         add("TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
             0x0032, --p, K_DHE_DSS,     B_AES_128, T);
 
-        // RC-4
-        add("TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
-            0xC007, --p, K_ECDHE_ECDSA, B_RC4_128, N);
-        add("TLS_ECDHE_RSA_WITH_RC4_128_SHA",
-            0xC011, --p, K_ECDHE_RSA,   B_RC4_128, N);
-        add("SSL_RSA_WITH_RC4_128_SHA",
-            0x0005, --p, K_RSA,         B_RC4_128, N);
-        add("TLS_ECDH_ECDSA_WITH_RC4_128_SHA",
-            0xC002, --p, K_ECDH_ECDSA,  B_RC4_128, N);
-        add("TLS_ECDH_RSA_WITH_RC4_128_SHA",
-            0xC00C, --p, K_ECDH_RSA,    B_RC4_128, N);
-
         // 3DES_EDE
         add("TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA",
             0xC008, --p, K_ECDHE_ECDSA, B_3DES,    T);
@@ -1115,6 +1103,17 @@ final class CipherSuite implements Comparable<CipherSuite> {
         add("SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA",
             0x0013, --p, K_DHE_DSS,     B_3DES,    N);
 
+        // RC-4
+        add("TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
+            0xC007, --p, K_ECDHE_ECDSA, B_RC4_128, N);
+        add("TLS_ECDHE_RSA_WITH_RC4_128_SHA",
+            0xC011, --p, K_ECDHE_RSA,   B_RC4_128, N);
+        add("SSL_RSA_WITH_RC4_128_SHA",
+            0x0005, --p, K_RSA,         B_RC4_128, N);
+        add("TLS_ECDH_ECDSA_WITH_RC4_128_SHA",
+            0xC002, --p, K_ECDH_ECDSA,  B_RC4_128, N);
+        add("TLS_ECDH_RSA_WITH_RC4_128_SHA",
+            0xC00C, --p, K_ECDH_RSA,    B_RC4_128, N);
         add("SSL_RSA_WITH_RC4_128_MD5",
             0x0004, --p, K_RSA,         B_RC4_128, N);
 
@@ -1134,7 +1133,7 @@ final class CipherSuite implements Comparable<CipherSuite> {
          * 2. If a cipher suite has been obsoleted, we put it at the end of
          *    the list.
          * 3. Prefer the stronger bulk cipher, in the order of AES_256,
-         *    AES_128, RC-4, 3DES-EDE, DES, RC4_40, DES40, NULL.
+         *    AES_128, 3DES-EDE, RC-4, DES, DES40, RC4_40, NULL.
          * 4. Prefer the stronger MAC algorithm, in the order of SHA384,
          *    SHA256, SHA, MD5.
          * 5. Prefer the better performance of key exchange and digital
@@ -1162,15 +1161,40 @@ final class CipherSuite implements Comparable<CipherSuite> {
         add("TLS_DH_anon_WITH_AES_128_CBC_SHA",
             0x0034, --p, K_DH_ANON,     B_AES_128, N);
 
+        add("TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA",
+            0xC017, --p, K_ECDH_ANON,   B_3DES,    N);
+        add("SSL_DH_anon_WITH_3DES_EDE_CBC_SHA",
+            0x001b, --p, K_DH_ANON,     B_3DES,    N);
+
         add("TLS_ECDH_anon_WITH_RC4_128_SHA",
             0xC016, --p, K_ECDH_ANON,   B_RC4_128, N);
         add("SSL_DH_anon_WITH_RC4_128_MD5",
             0x0018, --p, K_DH_ANON,     B_RC4_128, N);
 
-        add("TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA",
-            0xC017, --p, K_ECDH_ANON,   B_3DES,    N);
-        add("SSL_DH_anon_WITH_3DES_EDE_CBC_SHA",
-            0x001b, --p, K_DH_ANON,     B_3DES,    N);
+        // weak cipher suites obsoleted in TLS 1.2
+        add("SSL_RSA_WITH_DES_CBC_SHA",
+            0x0009, --p, K_RSA,         B_DES,     N, tls12);
+        add("SSL_DHE_RSA_WITH_DES_CBC_SHA",
+            0x0015, --p, K_DHE_RSA,     B_DES,     N, tls12);
+        add("SSL_DHE_DSS_WITH_DES_CBC_SHA",
+            0x0012, --p, K_DHE_DSS,     B_DES,     N, tls12);
+        add("SSL_DH_anon_WITH_DES_CBC_SHA",
+            0x001a, --p, K_DH_ANON,     B_DES,     N, tls12);
+
+        // weak cipher suites obsoleted in TLS 1.1
+        add("SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
+            0x0008, --p, K_RSA_EXPORT,  B_DES_40,  N, tls11);
+        add("SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
+            0x0014, --p, K_DHE_RSA,     B_DES_40,  N, tls11);
+        add("SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA",
+            0x0011, --p, K_DHE_DSS,     B_DES_40,  N, tls11);
+        add("SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA",
+            0x0019, --p, K_DH_ANON,     B_DES_40,  N, tls11);
+
+        add("SSL_RSA_EXPORT_WITH_RC4_40_MD5",
+            0x0003, --p, K_RSA_EXPORT,  B_RC4_40,  N, tls11);
+        add("SSL_DH_anon_EXPORT_WITH_RC4_40_MD5",
+            0x0017, --p, K_DH_ANON,     B_RC4_40,  N, tls11);
 
         add("TLS_RSA_WITH_NULL_SHA256",
             0x003b, --p, K_RSA,         B_NULL,    N, max, tls12, P_SHA256);
@@ -1189,52 +1213,27 @@ final class CipherSuite implements Comparable<CipherSuite> {
         add("SSL_RSA_WITH_NULL_MD5",
             0x0001, --p, K_RSA,         B_NULL,    N);
 
-        // weak cipher suites obsoleted in TLS 1.2
-        add("SSL_RSA_WITH_DES_CBC_SHA",
-            0x0009, --p, K_RSA,         B_DES,     N, tls12);
-        add("SSL_DHE_RSA_WITH_DES_CBC_SHA",
-            0x0015, --p, K_DHE_RSA,     B_DES,     N, tls12);
-        add("SSL_DHE_DSS_WITH_DES_CBC_SHA",
-            0x0012, --p, K_DHE_DSS,     B_DES,     N, tls12);
-        add("SSL_DH_anon_WITH_DES_CBC_SHA",
-            0x001a, --p, K_DH_ANON,     B_DES,     N, tls12);
-
-        // weak cipher suites obsoleted in TLS 1.1
-        add("SSL_RSA_EXPORT_WITH_RC4_40_MD5",
-            0x0003, --p, K_RSA_EXPORT,  B_RC4_40,  N, tls11);
-        add("SSL_DH_anon_EXPORT_WITH_RC4_40_MD5",
-            0x0017, --p, K_DH_ANON,     B_RC4_40,  N, tls11);
-
-        add("SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
-            0x0008, --p, K_RSA_EXPORT,  B_DES_40,  N, tls11);
-        add("SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
-            0x0014, --p, K_DHE_RSA,     B_DES_40,  N, tls11);
-        add("SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA",
-            0x0011, --p, K_DHE_DSS,     B_DES_40,  N, tls11);
-        add("SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA",
-            0x0019, --p, K_DH_ANON,     B_DES_40,  N, tls11);
-
         // Supported Kerberos ciphersuites from RFC2712
-        add("TLS_KRB5_WITH_RC4_128_SHA",
-            0x0020, --p, K_KRB5,        B_RC4_128, N);
-        add("TLS_KRB5_WITH_RC4_128_MD5",
-            0x0024, --p, K_KRB5,        B_RC4_128, N);
         add("TLS_KRB5_WITH_3DES_EDE_CBC_SHA",
             0x001f, --p, K_KRB5,        B_3DES,    N);
         add("TLS_KRB5_WITH_3DES_EDE_CBC_MD5",
             0x0023, --p, K_KRB5,        B_3DES,    N);
+        add("TLS_KRB5_WITH_RC4_128_SHA",
+            0x0020, --p, K_KRB5,        B_RC4_128, N);
+        add("TLS_KRB5_WITH_RC4_128_MD5",
+            0x0024, --p, K_KRB5,        B_RC4_128, N);
         add("TLS_KRB5_WITH_DES_CBC_SHA",
             0x001e, --p, K_KRB5,        B_DES,     N, tls12);
         add("TLS_KRB5_WITH_DES_CBC_MD5",
             0x0022, --p, K_KRB5,        B_DES,     N, tls12);
-        add("TLS_KRB5_EXPORT_WITH_RC4_40_SHA",
-            0x0028, --p, K_KRB5_EXPORT, B_RC4_40,  N, tls11);
-        add("TLS_KRB5_EXPORT_WITH_RC4_40_MD5",
-            0x002b, --p, K_KRB5_EXPORT, B_RC4_40,  N, tls11);
         add("TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA",
             0x0026, --p, K_KRB5_EXPORT, B_DES_40,  N, tls11);
         add("TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5",
             0x0029, --p, K_KRB5_EXPORT, B_DES_40,  N, tls11);
+        add("TLS_KRB5_EXPORT_WITH_RC4_40_SHA",
+            0x0028, --p, K_KRB5_EXPORT, B_RC4_40,  N, tls11);
+        add("TLS_KRB5_EXPORT_WITH_RC4_40_MD5",
+            0x002b, --p, K_KRB5_EXPORT, B_RC4_40,  N, tls11);
 
         /*
          * Other values from the TLS Cipher Suite Registry, as of August 2010.
diff --git a/jdk/test/javax/net/ssl/sanity/ciphersuites/CipherSuitesInOrder.java b/jdk/test/javax/net/ssl/sanity/ciphersuites/CipherSuitesInOrder.java
index 012fe96720e..5e337f117d6 100644
--- a/jdk/test/javax/net/ssl/sanity/ciphersuites/CipherSuitesInOrder.java
+++ b/jdk/test/javax/net/ssl/sanity/ciphersuites/CipherSuitesInOrder.java
@@ -85,11 +85,6 @@ public class CipherSuitesInOrder {
         "TLS_ECDH_RSA_WITH_AES_128_CBC_SHA",
         "TLS_DHE_RSA_WITH_AES_128_CBC_SHA",
         "TLS_DHE_DSS_WITH_AES_128_CBC_SHA",
-        "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
-        "TLS_ECDHE_RSA_WITH_RC4_128_SHA",
-        "SSL_RSA_WITH_RC4_128_SHA",
-        "TLS_ECDH_ECDSA_WITH_RC4_128_SHA",
-        "TLS_ECDH_RSA_WITH_RC4_128_SHA",
 
         "TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA",
         "TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA",
@@ -98,6 +93,12 @@ public class CipherSuitesInOrder {
         "TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA",
         "SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA",
         "SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA",
+
+        "TLS_ECDHE_ECDSA_WITH_RC4_128_SHA",
+        "TLS_ECDHE_RSA_WITH_RC4_128_SHA",
+        "SSL_RSA_WITH_RC4_128_SHA",
+        "TLS_ECDH_ECDSA_WITH_RC4_128_SHA",
+        "TLS_ECDH_RSA_WITH_RC4_128_SHA",
         "SSL_RSA_WITH_RC4_128_MD5",
 
         "TLS_EMPTY_RENEGOTIATION_INFO_SCSV",
@@ -111,10 +112,23 @@ public class CipherSuitesInOrder {
         "TLS_DH_anon_WITH_AES_128_CBC_SHA256",
         "TLS_ECDH_anon_WITH_AES_128_CBC_SHA",
         "TLS_DH_anon_WITH_AES_128_CBC_SHA",
-        "TLS_ECDH_anon_WITH_RC4_128_SHA",
-        "SSL_DH_anon_WITH_RC4_128_MD5",
         "TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA",
         "SSL_DH_anon_WITH_3DES_EDE_CBC_SHA",
+        "TLS_ECDH_anon_WITH_RC4_128_SHA",
+        "SSL_DH_anon_WITH_RC4_128_MD5",
+
+        "SSL_RSA_WITH_DES_CBC_SHA",
+        "SSL_DHE_RSA_WITH_DES_CBC_SHA",
+        "SSL_DHE_DSS_WITH_DES_CBC_SHA",
+        "SSL_DH_anon_WITH_DES_CBC_SHA",
+        "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
+        "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
+        "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA",
+        "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA",
+
+        "SSL_RSA_EXPORT_WITH_RC4_40_MD5",
+        "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5",
+
         "TLS_RSA_WITH_NULL_SHA256",
         "TLS_ECDHE_ECDSA_WITH_NULL_SHA",
         "TLS_ECDHE_RSA_WITH_NULL_SHA",
@@ -123,26 +137,17 @@ public class CipherSuitesInOrder {
         "TLS_ECDH_RSA_WITH_NULL_SHA",
         "TLS_ECDH_anon_WITH_NULL_SHA",
         "SSL_RSA_WITH_NULL_MD5",
-        "SSL_RSA_WITH_DES_CBC_SHA",
-        "SSL_DHE_RSA_WITH_DES_CBC_SHA",
-        "SSL_DHE_DSS_WITH_DES_CBC_SHA",
-        "SSL_DH_anon_WITH_DES_CBC_SHA",
-        "SSL_RSA_EXPORT_WITH_RC4_40_MD5",
-        "SSL_DH_anon_EXPORT_WITH_RC4_40_MD5",
-        "SSL_RSA_EXPORT_WITH_DES40_CBC_SHA",
-        "SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA",
-        "SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA",
-        "SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA",
-        "TLS_KRB5_WITH_RC4_128_SHA",
-        "TLS_KRB5_WITH_RC4_128_MD5",
+
         "TLS_KRB5_WITH_3DES_EDE_CBC_SHA",
         "TLS_KRB5_WITH_3DES_EDE_CBC_MD5",
+        "TLS_KRB5_WITH_RC4_128_SHA",
+        "TLS_KRB5_WITH_RC4_128_MD5",
         "TLS_KRB5_WITH_DES_CBC_SHA",
         "TLS_KRB5_WITH_DES_CBC_MD5",
-        "TLS_KRB5_EXPORT_WITH_RC4_40_SHA",
-        "TLS_KRB5_EXPORT_WITH_RC4_40_MD5",
         "TLS_KRB5_EXPORT_WITH_DES_CBC_40_SHA",
-        "TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5"
+        "TLS_KRB5_EXPORT_WITH_DES_CBC_40_MD5",
+        "TLS_KRB5_EXPORT_WITH_RC4_40_SHA",
+        "TLS_KRB5_EXPORT_WITH_RC4_40_MD5"
     );
 
     private final static String[] protocols = {

From 3cc3d82ad9f2cfbc74a5351f777410e121b2dae8 Mon Sep 17 00:00:00 2001
From: Phil Race <prr@openjdk.org>
Date: Wed, 30 Jul 2014 11:08:41 -0700
Subject: [PATCH 012/299] 8052162: REGRESSION: sun/java2d/cmm/ColorConvertOp
 tests fail since 7u71 b01

Reviewed-by: bae, serb
---
 jdk/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java b/jdk/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java
index 12139f6bbda..a867e453389 100644
--- a/jdk/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java
+++ b/jdk/test/sun/java2d/cmm/ColorConvertOp/ColConvCCMTest.java
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 6476665 7033534 6830714
+ * @bug 6476665 7033534 6830714 8052162
  * @summary Verifies color conversion of Component Color Model based images
  * @run main ColConvCCMTest
  */

From 01ea2212b1e88a5f0a37a7c4ca4bb0b5c3fa9b93 Mon Sep 17 00:00:00 2001
From: Michael McMahon <michaelm@openjdk.org>
Date: Thu, 21 Aug 2014 17:51:29 +0100
Subject: [PATCH 013/299] 8053963: (dc) Use DatagramChannel.receive() instead
 of read() in connect

Reviewed-by: alanb, chegar
---
 .../classes/java/net/DatagramSocket.java      | 27 +++++----
 .../sun/nio/ch/DatagramChannelImpl.java       |  2 +-
 .../libnet/AbstractPlainDatagramSocketImpl.c  | 55 +++++++++++++++----
 3 files changed, 61 insertions(+), 23 deletions(-)

diff --git a/jdk/src/java.base/share/classes/java/net/DatagramSocket.java b/jdk/src/java.base/share/classes/java/net/DatagramSocket.java
index c047b3cf6a4..5d978e596e2 100644
--- a/jdk/src/java.base/share/classes/java/net/DatagramSocket.java
+++ b/jdk/src/java.base/share/classes/java/net/DatagramSocket.java
@@ -771,6 +771,7 @@ class DatagramSocket implements java.io.Closeable {
                     } // end of while
                 }
             }
+            DatagramPacket tmp = null;
             if ((connectState == ST_CONNECTED_NO_IMPL) || explicitFilter) {
                 // We have to do the filtering the old fashioned way since
                 // the native impl doesn't support connect or the connect
@@ -795,11 +796,13 @@ class DatagramSocket implements java.io.Closeable {
                     if ((!connectedAddress.equals(peekAddress)) ||
                         (connectedPort != peekPort)) {
                         // throw the packet away and silently continue
-                        DatagramPacket tmp = new DatagramPacket(
+                        tmp = new DatagramPacket(
                                                 new byte[1024], 1024);
                         getImpl().receive(tmp);
                         if (explicitFilter) {
-                            bytesLeftToFilter -= tmp.getLength();
+                            if (checkFiltering(tmp)) {
+                                stop = true;
+                            }
                         }
                     } else {
                         stop = true;
@@ -809,18 +812,22 @@ class DatagramSocket implements java.io.Closeable {
             // If the security check succeeds, or the datagram is
             // connected then receive the packet
             getImpl().receive(p);
-            if (explicitFilter) {
-                bytesLeftToFilter -= p.getLength();
-                if (bytesLeftToFilter <= 0) {
-                    explicitFilter = false;
-                } else {
-                    // break out of filter, if there is no more data queued
-                    explicitFilter = getImpl().dataAvailable() > 0;
-                }
+            if (explicitFilter && tmp == null) {
+                // packet was not filtered, account for it here
+                checkFiltering(p);
             }
         }
     }
 
+    private boolean checkFiltering(DatagramPacket p) throws SocketException {
+        bytesLeftToFilter -= p.getLength();
+        if (bytesLeftToFilter <= 0 || getImpl().dataAvailable() <= 0) {
+            explicitFilter = false;
+            return true;
+        }
+        return false;
+    }
+
     /**
      * Gets the local address to which the socket is bound.
      *
diff --git a/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java b/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java
index b9fd16eae29..e316facf491 100644
--- a/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/DatagramChannelImpl.java
@@ -752,7 +752,7 @@ class DatagramChannelImpl
                             }
                             do {
                                 tmpBuf.clear();
-                            } while (read(tmpBuf) > 0);
+                            } while (receive(tmpBuf) != null);
                         } finally {
                             if (blocking) {
                                 configureBlocking(true);
diff --git a/jdk/src/java.base/windows/native/libnet/AbstractPlainDatagramSocketImpl.c b/jdk/src/java.base/windows/native/libnet/AbstractPlainDatagramSocketImpl.c
index 7244e664c9e..dd2c7e8a92f 100644
--- a/jdk/src/java.base/windows/native/libnet/AbstractPlainDatagramSocketImpl.c
+++ b/jdk/src/java.base/windows/native/libnet/AbstractPlainDatagramSocketImpl.c
@@ -32,9 +32,11 @@
 
 #include "java_net_AbstractPlainDatagramSocketImpl.h"
 
-static jfieldID IO_fd_fdID;
+static jfieldID IO_fd_fdID = NULL;
+static jfieldID apdsi_fdID = NULL;
 
-static jfieldID apdsi_fdID;
+static jfieldID apdsi_fd1ID = NULL;
+static jclass two_stacks_clazz = NULL;
 
 
 /*
@@ -48,10 +50,21 @@ Java_java_net_AbstractPlainDatagramSocketImpl_init(JNIEnv *env, jclass cls) {
     apdsi_fdID = (*env)->GetFieldID(env, cls, "fd",
                                    "Ljava/io/FileDescriptor;");
     CHECK_NULL(apdsi_fdID);
-
     IO_fd_fdID = NET_GetFileDescriptorID(env);
     CHECK_NULL(IO_fd_fdID);
 
+    two_stacks_clazz = (*env)->FindClass(env, "java/net/TwoStacksPlainDatagramSocketImpl");
+    CHECK_NULL(two_stacks_clazz);
+
+    /* Handle both TwoStacks and DualStack here */
+
+    if (JNU_Equals(env, cls, two_stacks_clazz)) {
+        /* fd1 present only in TwoStack.. */
+        apdsi_fd1ID = (*env)->GetFieldID(env, cls, "fd1",
+                                   "Ljava/io/FileDescriptor;");
+        CHECK_NULL(apdsi_fd1ID);
+    }
+
     JNU_CHECK_EXCEPTION(env);
 }
 
@@ -63,20 +76,38 @@ Java_java_net_AbstractPlainDatagramSocketImpl_init(JNIEnv *env, jclass cls) {
 JNIEXPORT jint JNICALL Java_java_net_AbstractPlainDatagramSocketImpl_dataAvailable
 (JNIEnv *env, jobject this) {
     SOCKET fd;
-    int  retval;
-
+    SOCKET fd1;
+    int  rv = -1, rv1 = -1;
     jobject fdObj = (*env)->GetObjectField(env, this, apdsi_fdID);
 
-    if (IS_NULL(fdObj)) {
-        JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
-                        "Socket closed");
-        return -1;
+    if (!IS_NULL(fdObj)) {
+        int retval = 0;
+        fd = (SOCKET)(*env)->GetIntField(env, fdObj, IO_fd_fdID);
+        rv = ioctlsocket(fd, FIONREAD, &retval);
+        if (retval > 0) {
+            return retval;
+        }
     }
-    fd = (SOCKET)(*env)->GetIntField(env, fdObj, IO_fd_fdID);
 
-    if (ioctlsocket(fd, FIONREAD, &retval) < 0) {
+    if (!IS_NULL(apdsi_fd1ID)) {
+        /* TwoStacks */
+        jobject fd1Obj = (*env)->GetObjectField(env, this, apdsi_fd1ID);
+        if (!IS_NULL(fd1Obj)) {
+            int retval = 0;
+            fd1 = (SOCKET)(*env)->GetIntField(env, fd1Obj, IO_fd_fdID);
+            rv1 = ioctlsocket(fd1, FIONREAD, &retval);
+            if (retval > 0) {
+                return retval;
+            }
+        }
+    }
+
+    if (rv < 0 && rv1 < 0) {
+        JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException",
+                            "Socket closed");
         return -1;
     }
-    return retval;
+
+    return 0;
 }
 

From 692dbfd02d90e7334d1586f11a41038bd0abf09b Mon Sep 17 00:00:00 2001
From: Stefan Karlsson <stefank@openjdk.org>
Date: Wed, 12 Nov 2014 13:55:59 +0100
Subject: [PATCH 014/299] 8062808: Turn on the -Wreturn-type warning

Reviewed-by: mgerdin, tschatzl, coleenp, jrose, kbarrett
---
 hotspot/make/linux/makefiles/gcc.make               | 2 +-
 hotspot/src/cpu/x86/vm/x86_32.ad                    | 1 +
 hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp    | 1 +
 hotspot/src/share/vm/classfile/defaultMethods.cpp   | 4 ++--
 hotspot/src/share/vm/classfile/symbolTable.cpp      | 4 ++--
 hotspot/src/share/vm/classfile/systemDictionary.cpp | 6 +++---
 hotspot/src/share/vm/memory/heapInspection.hpp      | 2 +-
 hotspot/src/share/vm/memory/metaspaceShared.hpp     | 2 +-
 hotspot/src/share/vm/oops/constantPool.hpp          | 4 ++--
 hotspot/src/share/vm/prims/jvm.cpp                  | 2 +-
 hotspot/src/share/vm/runtime/reflection.cpp         | 2 +-
 hotspot/src/share/vm/runtime/sharedRuntime.cpp      | 2 +-
 hotspot/src/share/vm/services/memTracker.hpp        | 2 +-
 13 files changed, 18 insertions(+), 16 deletions(-)

diff --git a/hotspot/make/linux/makefiles/gcc.make b/hotspot/make/linux/makefiles/gcc.make
index 2447c8d3dd6..2c874320eb3 100644
--- a/hotspot/make/linux/makefiles/gcc.make
+++ b/hotspot/make/linux/makefiles/gcc.make
@@ -214,7 +214,7 @@ ifeq ($(USE_CLANG), true)
   WARNINGS_ARE_ERRORS += -Wno-return-type -Wno-empty-body
 endif
 
-WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2
+WARNING_FLAGS = -Wpointer-arith -Wsign-compare -Wundef -Wunused-function -Wunused-value -Wformat=2 -Wreturn-type
 
 ifeq ($(USE_CLANG),)
   # Since GCC 4.3, -Wconversion has changed its meanings to warn these implicit
diff --git a/hotspot/src/cpu/x86/vm/x86_32.ad b/hotspot/src/cpu/x86/vm/x86_32.ad
index c246f2d2deb..940541b6c30 100644
--- a/hotspot/src/cpu/x86/vm/x86_32.ad
+++ b/hotspot/src/cpu/x86/vm/x86_32.ad
@@ -1210,6 +1210,7 @@ uint MachSpillCopyNode::implementation( CodeBuffer *cbuf, PhaseRegAlloc *ra_, bo
 
 
   Unimplemented();
+  return 0; // Mute compiler
 }
 
 #ifndef PRODUCT
diff --git a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
index 136d8066dd4..4089d86cf51 100644
--- a/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
+++ b/hotspot/src/os_cpu/linux_x86/vm/os_linux_x86.cpp
@@ -542,6 +542,7 @@ JVM_handle_linux_signal(int sig,
   err.report_and_die();
 
   ShouldNotReachHere();
+  return true; // Mute compiler
 }
 
 void os::Linux::init_thread_fpu_state(void) {
diff --git a/hotspot/src/share/vm/classfile/defaultMethods.cpp b/hotspot/src/share/vm/classfile/defaultMethods.cpp
index 1b56ff2fba4..2694a02826a 100644
--- a/hotspot/src/share/vm/classfile/defaultMethods.cpp
+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp
@@ -506,7 +506,7 @@ Symbol* MethodFamily::generate_method_message(Symbol *klass_name, Method* method
   ss.write((const char*)name->bytes(), name->utf8_length());
   ss.write((const char*)signature->bytes(), signature->utf8_length());
   ss.print(" is abstract");
-  return SymbolTable::new_symbol(ss.base(), (int)ss.size(), CHECK_NULL);
+  return SymbolTable::new_symbol(ss.base(), (int)ss.size(), THREAD);
 }
 
 Symbol* MethodFamily::generate_conflicts_message(GrowableArray<Method*>* methods, TRAPS) const {
@@ -521,7 +521,7 @@ Symbol* MethodFamily::generate_conflicts_message(GrowableArray<Method*>* methods
     ss.print(".");
     ss.write((const char*)name->bytes(), name->utf8_length());
   }
-  return SymbolTable::new_symbol(ss.base(), (int)ss.size(), CHECK_NULL);
+  return SymbolTable::new_symbol(ss.base(), (int)ss.size(), THREAD);
 }
 
 
diff --git a/hotspot/src/share/vm/classfile/symbolTable.cpp b/hotspot/src/share/vm/classfile/symbolTable.cpp
index 6111af6cb20..8ffb17f8f71 100644
--- a/hotspot/src/share/vm/classfile/symbolTable.cpp
+++ b/hotspot/src/share/vm/classfile/symbolTable.cpp
@@ -235,7 +235,7 @@ Symbol* SymbolTable::lookup(const char* name, int len, TRAPS) {
   MutexLocker ml(SymbolTable_lock, THREAD);
 
   // Otherwise, add to symbol to table
-  return the_table()->basic_add(index, (u1*)name, len, hashValue, true, CHECK_NULL);
+  return the_table()->basic_add(index, (u1*)name, len, hashValue, true, THREAD);
 }
 
 Symbol* SymbolTable::lookup(const Symbol* sym, int begin, int end, TRAPS) {
@@ -274,7 +274,7 @@ Symbol* SymbolTable::lookup(const Symbol* sym, int begin, int end, TRAPS) {
   // Grab SymbolTable_lock first.
   MutexLocker ml(SymbolTable_lock, THREAD);
 
-  return the_table()->basic_add(index, (u1*)buffer, len, hashValue, true, CHECK_NULL);
+  return the_table()->basic_add(index, (u1*)buffer, len, hashValue, true, THREAD);
 }
 
 Symbol* SymbolTable::lookup_only(const char* name, int len,
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp
index 85f90d436c2..fa18ba477c6 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp
@@ -233,15 +233,15 @@ Klass* SystemDictionary::resolve_or_null(Symbol* class_name, Handle class_loader
                  class_name->as_C_string(),
                  class_loader.is_null() ? "null" : class_loader->klass()->name()->as_C_string()));
   if (FieldType::is_array(class_name)) {
-    return resolve_array_class_or_null(class_name, class_loader, protection_domain, CHECK_NULL);
+    return resolve_array_class_or_null(class_name, class_loader, protection_domain, THREAD);
   } else if (FieldType::is_obj(class_name)) {
     ResourceMark rm(THREAD);
     // Ignore wrapping L and ;.
     TempNewSymbol name = SymbolTable::new_symbol(class_name->as_C_string() + 1,
                                    class_name->utf8_length() - 2, CHECK_NULL);
-    return resolve_instance_class_or_null(name, class_loader, protection_domain, CHECK_NULL);
+    return resolve_instance_class_or_null(name, class_loader, protection_domain, THREAD);
   } else {
-    return resolve_instance_class_or_null(class_name, class_loader, protection_domain, CHECK_NULL);
+    return resolve_instance_class_or_null(class_name, class_loader, protection_domain, THREAD);
   }
 }
 
diff --git a/hotspot/src/share/vm/memory/heapInspection.hpp b/hotspot/src/share/vm/memory/heapInspection.hpp
index b305f08fdb3..db782c42505 100644
--- a/hotspot/src/share/vm/memory/heapInspection.hpp
+++ b/hotspot/src/share/vm/memory/heapInspection.hpp
@@ -367,7 +367,7 @@ class HeapInspection : public StackObj {
       _csv_format(csv_format), _print_help(print_help),
       _print_class_stats(print_class_stats), _columns(columns) {}
   void heap_inspection(outputStream* st) NOT_SERVICES_RETURN;
-  size_t populate_table(KlassInfoTable* cit, BoolObjectClosure* filter = NULL) NOT_SERVICES_RETURN;
+  size_t populate_table(KlassInfoTable* cit, BoolObjectClosure* filter = NULL) NOT_SERVICES_RETURN_(0);
   static void find_instances_at_safepoint(Klass* k, GrowableArray<oop>* result) NOT_SERVICES_RETURN;
  private:
   void iterate_over_heap(KlassInfoTable* cit, BoolObjectClosure* filter = NULL);
diff --git a/hotspot/src/share/vm/memory/metaspaceShared.hpp b/hotspot/src/share/vm/memory/metaspaceShared.hpp
index db344359082..cb34465ec69 100644
--- a/hotspot/src/share/vm/memory/metaspaceShared.hpp
+++ b/hotspot/src/share/vm/memory/metaspaceShared.hpp
@@ -92,7 +92,7 @@ class MetaspaceShared : AllStatic {
   static void preload_and_dump(TRAPS) NOT_CDS_RETURN;
   static int preload_and_dump(const char * class_list_path,
                               GrowableArray<Klass*>* class_promote_order,
-                              TRAPS) NOT_CDS_RETURN;
+                              TRAPS) NOT_CDS_RETURN_(0);
 
   static ReservedSpace* shared_rs() {
     CDS_ONLY(return _shared_rs);
diff --git a/hotspot/src/share/vm/oops/constantPool.hpp b/hotspot/src/share/vm/oops/constantPool.hpp
index 18b86aa7ac6..359fa22d522 100644
--- a/hotspot/src/share/vm/oops/constantPool.hpp
+++ b/hotspot/src/share/vm/oops/constantPool.hpp
@@ -336,13 +336,13 @@ class ConstantPool : public Metadata {
 
   Klass* klass_at(int which, TRAPS) {
     constantPoolHandle h_this(THREAD, this);
-    return klass_at_impl(h_this, which, true, CHECK_NULL);
+    return klass_at_impl(h_this, which, true, THREAD);
   }
 
   // Version of klass_at that doesn't save the resolution error, called during deopt
   Klass* klass_at_ignore_error(int which, TRAPS) {
     constantPoolHandle h_this(THREAD, this);
-    return klass_at_impl(h_this, which, false, CHECK_NULL);
+    return klass_at_impl(h_this, which, false, THREAD);
   }
 
   Symbol* klass_name_at(int which);  // Returns the name, w/o resolving.
diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp
index ad58d7bf966..5ea893b24db 100644
--- a/hotspot/src/share/vm/prims/jvm.cpp
+++ b/hotspot/src/share/vm/prims/jvm.cpp
@@ -3537,7 +3537,7 @@ JVM_ENTRY(jlong,JVM_DTraceActivate(
     JVM_DTraceProvider* providers))
   JVMWrapper("JVM_DTraceActivate");
   return DTraceJSDT::activate(
-    version, module_name, providers_count, providers, CHECK_0);
+    version, module_name, providers_count, providers, THREAD);
 JVM_END
 
 JVM_ENTRY(jboolean,JVM_DTraceIsProbeEnabled(JNIEnv* env, jmethodID method))
diff --git a/hotspot/src/share/vm/runtime/reflection.cpp b/hotspot/src/share/vm/runtime/reflection.cpp
index c6cb79ce7a4..36f5990a69a 100644
--- a/hotspot/src/share/vm/runtime/reflection.cpp
+++ b/hotspot/src/share/vm/runtime/reflection.cpp
@@ -1004,7 +1004,7 @@ oop Reflection::invoke(instanceKlassHandle klass, methodHandle reflected_method,
   } else {
     if (rtype == T_BOOLEAN || rtype == T_BYTE || rtype == T_CHAR || rtype == T_SHORT)
       narrow((jvalue*) result.get_value_addr(), rtype, CHECK_NULL);
-    return box((jvalue*) result.get_value_addr(), rtype, CHECK_NULL);
+    return box((jvalue*) result.get_value_addr(), rtype, THREAD);
   }
 }
 
diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
index 344c2a61f3e..058ecda90f1 100644
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
@@ -986,7 +986,7 @@ Handle SharedRuntime::find_callee_info(JavaThread* thread, Bytecodes::Code& bc,
   // last java frame on stack (which includes native call frames)
   vframeStream vfst(thread, true);  // Do not skip and javaCalls
 
-  return find_callee_info_helper(thread, vfst, bc, callinfo, CHECK_(Handle()));
+  return find_callee_info_helper(thread, vfst, bc, callinfo, THREAD);
 }
 
 
diff --git a/hotspot/src/share/vm/services/memTracker.hpp b/hotspot/src/share/vm/services/memTracker.hpp
index 47d0a54ed36..f05d39f3b4c 100644
--- a/hotspot/src/share/vm/services/memTracker.hpp
+++ b/hotspot/src/share/vm/services/memTracker.hpp
@@ -64,7 +64,7 @@ class MemTracker : AllStatic {
     const NativeCallStack& stack, MEMFLAGS flag = mtNone) { }
   static inline void record_virtual_memory_commit(void* addr, size_t size, const NativeCallStack& stack) { }
   static inline Tracker get_virtual_memory_uncommit_tracker() { return Tracker(); }
-  static inline Tracker get_virtual_memory_release_tracker() { }
+  static inline Tracker get_virtual_memory_release_tracker() { return Tracker(); }
   static inline void record_virtual_memory_type(void* addr, MEMFLAGS flag) { }
   static inline void record_thread_stack(void* addr, size_t size) { }
   static inline void release_thread_stack(void* addr, size_t size) { }

From 294a63af5f6aa8068fe19de7b41511a66accfbe0 Mon Sep 17 00:00:00 2001
From: Kim Barrett <kbarrett@openjdk.org>
Date: Tue, 11 Nov 2014 13:39:00 -0500
Subject: [PATCH 015/299] 8062036: ConcurrentMarkThread::slt may be invoked
 before ConcurrentMarkThread::makeSurrogateLockerThread causing intermittent
 crashes

Suppress gc_alot during VM init, improve error for SLT uninitialized.

Reviewed-by: jmasa, brutisso, tschatzl
---
 .../concurrentMarkSweep/vmCMSOperations.cpp               | 8 ++++++--
 .../share/vm/gc_implementation/g1/vm_operations_g1.cpp    | 8 ++++++--
 .../vm/gc_implementation/shared/concurrentGCThread.cpp    | 7 +++++++
 .../vm/gc_implementation/shared/concurrentGCThread.hpp    | 3 +++
 hotspot/src/share/vm/runtime/interfaceSupport.cpp         | 2 +-
 5 files changed, 23 insertions(+), 5 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp
index 7dfbad541bb..9587736f297 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp
@@ -42,8 +42,12 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 void VM_CMS_Operation::acquire_pending_list_lock() {
   // The caller may block while communicating
   // with the SLT thread in order to acquire/release the PLL.
-  ConcurrentMarkSweepThread::slt()->
-    manipulatePLL(SurrogateLockerThread::acquirePLL);
+  SurrogateLockerThread* slt = ConcurrentMarkSweepThread::slt();
+  if (slt != NULL) {
+    slt->manipulatePLL(SurrogateLockerThread::acquirePLL);
+  } else {
+    SurrogateLockerThread::report_missing_slt();
+  }
 }
 
 void VM_CMS_Operation::release_and_notify_pending_list_lock() {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
index 9b50ae6af53..80a0f72810e 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
@@ -213,8 +213,12 @@ void VM_CGC_Operation::acquire_pending_list_lock() {
   assert(_needs_pll, "don't call this otherwise");
   // The caller may block while communicating
   // with the SLT thread in order to acquire/release the PLL.
-  ConcurrentMarkThread::slt()->
-    manipulatePLL(SurrogateLockerThread::acquirePLL);
+  SurrogateLockerThread* slt = ConcurrentMarkThread::slt();
+  if (slt != NULL) {
+    slt->manipulatePLL(SurrogateLockerThread::acquirePLL);
+  } else {
+    SurrogateLockerThread::report_missing_slt();
+  }
 }
 
 void VM_CGC_Operation::release_and_notify_pending_list_lock() {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
index b85be793146..2a27f65c8d1 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.cpp
@@ -138,6 +138,13 @@ SurrogateLockerThread* SurrogateLockerThread::make(TRAPS) {
   return res;
 }
 
+void SurrogateLockerThread::report_missing_slt() {
+  vm_exit_during_initialization(
+    "GC before GC support fully initialized: "
+    "SLT is needed but has not yet been created.");
+  ShouldNotReachHere();
+}
+
 void SurrogateLockerThread::manipulatePLL(SLT_msg_type msg) {
   MutexLockerEx x(&_monitor, Mutex::_no_safepoint_check_flag);
   assert(_buffer == empty, "Should be empty");
diff --git a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp
index 4b82ed629f0..e87228b238c 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/concurrentGCThread.hpp
@@ -93,6 +93,9 @@ class SurrogateLockerThread: public JavaThread {
  public:
   static SurrogateLockerThread* make(TRAPS);
 
+  // Terminate VM with error message that SLT needed but not yet created.
+  static void report_missing_slt();
+
   SurrogateLockerThread();
 
   bool is_hidden_from_external_view() const     { return true; }
diff --git a/hotspot/src/share/vm/runtime/interfaceSupport.cpp b/hotspot/src/share/vm/runtime/interfaceSupport.cpp
index 78a58200f5a..3a6b4817189 100644
--- a/hotspot/src/share/vm/runtime/interfaceSupport.cpp
+++ b/hotspot/src/share/vm/runtime/interfaceSupport.cpp
@@ -87,7 +87,7 @@ void InterfaceSupport::gc_alot() {
   // Short-circuit any possible re-entrant gc-a-lot attempt
   if (thread->skip_gcalot()) return;
 
-  if (is_init_completed()) {
+  if (Threads::is_vm_complete()) {
 
     if (++_fullgc_alot_invocation < FullGCALotStart) {
       return;

From 3b31df26c8f0138dc229d7bcc9d2ebade8d0227f Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier <goetz@openjdk.org>
Date: Thu, 13 Nov 2014 11:14:01 +0100
Subject: [PATCH 016/299] 8064786: Fix debug build after 8062808: Turn on the
 -Wreturn-type warning

Reviewed-by: stefank, tschatzl
---
 hotspot/src/share/vm/prims/jni.cpp | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp
index 7b6974e639a..e0116854741 100644
--- a/hotspot/src/share/vm/prims/jni.cpp
+++ b/hotspot/src/share/vm/prims/jni.cpp
@@ -603,6 +603,7 @@ JNI_ENTRY(jint, jni_Throw(JNIEnv *env, jthrowable obj))
 
   THROW_OOP_(JNIHandles::resolve(obj), JNI_OK);
   ShouldNotReachHere();
+  return 0;  // Mute compiler.
 JNI_END
 
 
@@ -623,6 +624,7 @@ JNI_ENTRY(jint, jni_ThrowNew(JNIEnv *env, jclass clazz, const char *message))
   Handle protection_domain (THREAD, k->protection_domain());
   THROW_MSG_LOADER_(name, (char *)message, class_loader, protection_domain, JNI_OK);
   ShouldNotReachHere();
+  return 0;  // Mute compiler.
 JNI_END
 
 

From 95704b233c89cc43ff872d1a9777509097d30803 Mon Sep 17 00:00:00 2001
From: Stefan Karlsson <stefank@openjdk.org>
Date: Fri, 14 Nov 2014 09:47:09 +0100
Subject: [PATCH 017/299] 8064811: Use THREAD instead of CHECK_NULL in return
 statements

Reviewed-by: coleenp, simonis, dholmes
---
 hotspot/src/os/aix/vm/perfMemory_aix.cpp      |  2 +-
 hotspot/src/os/bsd/vm/perfMemory_bsd.cpp      |  2 +-
 hotspot/src/os/linux/vm/perfMemory_linux.cpp  |  2 +-
 .../src/os/solaris/vm/perfMemory_solaris.cpp  |  2 +-
 hotspot/src/share/vm/ci/ciReplay.cpp          |  2 +-
 .../share/vm/classfile/classLoaderData.cpp    |  2 +-
 .../src/share/vm/classfile/defaultMethods.cpp |  2 +-
 .../src/share/vm/classfile/javaClasses.cpp    | 10 ++++----
 .../share/vm/classfile/systemDictionary.cpp   |  2 +-
 .../share/vm/classfile/verificationType.hpp   |  2 +-
 hotspot/src/share/vm/classfile/verifier.cpp   |  2 +-
 hotspot/src/share/vm/memory/allocation.cpp    |  3 +--
 hotspot/src/share/vm/memory/oopFactory.hpp    | 18 +++++++-------
 hotspot/src/share/vm/oops/constantPool.cpp    |  2 +-
 hotspot/src/share/vm/oops/instanceKlass.cpp   |  4 ++--
 hotspot/src/share/vm/oops/klass.cpp           |  2 +-
 hotspot/src/share/vm/oops/methodData.cpp      |  2 +-
 hotspot/src/share/vm/oops/objArrayKlass.cpp   |  6 ++---
 hotspot/src/share/vm/oops/typeArrayKlass.cpp  |  2 +-
 hotspot/src/share/vm/prims/methodHandles.cpp  |  6 ++---
 .../src/share/vm/runtime/fieldDescriptor.cpp  |  2 +-
 hotspot/src/share/vm/runtime/perfData.hpp     | 24 +++++++++----------
 hotspot/src/share/vm/runtime/reflection.cpp   |  2 +-
 hotspot/src/share/vm/runtime/synchronizer.hpp |  2 +-
 hotspot/src/share/vm/utilities/array.hpp      |  2 +-
 25 files changed, 53 insertions(+), 54 deletions(-)

diff --git a/hotspot/src/os/aix/vm/perfMemory_aix.cpp b/hotspot/src/os/aix/vm/perfMemory_aix.cpp
index 36644f0f679..7e5b250588c 100644
--- a/hotspot/src/os/aix/vm/perfMemory_aix.cpp
+++ b/hotspot/src/os/aix/vm/perfMemory_aix.cpp
@@ -422,7 +422,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
 // return the name of the user that owns the JVM indicated by the given vmid.
 //
 static char* get_user_name(int vmid, TRAPS) {
-  return get_user_name_slow(vmid, CHECK_NULL);
+  return get_user_name_slow(vmid, THREAD);
 }
 
 // return the file name of the backing store file for the named
diff --git a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp
index 631366e2944..7fe1258dbd3 100644
--- a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp
+++ b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp
@@ -422,7 +422,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
 // return the name of the user that owns the JVM indicated by the given vmid.
 //
 static char* get_user_name(int vmid, TRAPS) {
-  return get_user_name_slow(vmid, CHECK_NULL);
+  return get_user_name_slow(vmid, THREAD);
 }
 
 // return the file name of the backing store file for the named
diff --git a/hotspot/src/os/linux/vm/perfMemory_linux.cpp b/hotspot/src/os/linux/vm/perfMemory_linux.cpp
index 6d92575563e..5325b5ff2f7 100644
--- a/hotspot/src/os/linux/vm/perfMemory_linux.cpp
+++ b/hotspot/src/os/linux/vm/perfMemory_linux.cpp
@@ -422,7 +422,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
 // return the name of the user that owns the JVM indicated by the given vmid.
 //
 static char* get_user_name(int vmid, TRAPS) {
-  return get_user_name_slow(vmid, CHECK_NULL);
+  return get_user_name_slow(vmid, THREAD);
 }
 
 // return the file name of the backing store file for the named
diff --git a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
index 7f956338e6b..4dc633fa1e9 100644
--- a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
+++ b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
@@ -461,7 +461,7 @@ static char* get_user_name(int vmid, TRAPS) {
   // since the structured procfs and old procfs interfaces can't be
   // mixed, we attempt to find the file through a directory search.
 
-  return get_user_name_slow(vmid, CHECK_NULL);
+  return get_user_name_slow(vmid, THREAD);
 }
 
 // return the file name of the backing store file for the named
diff --git a/hotspot/src/share/vm/ci/ciReplay.cpp b/hotspot/src/share/vm/ci/ciReplay.cpp
index 99b742d61dd..1830322361f 100644
--- a/hotspot/src/share/vm/ci/ciReplay.cpp
+++ b/hotspot/src/share/vm/ci/ciReplay.cpp
@@ -332,7 +332,7 @@ class CompileReplay : public StackObj {
   // Lookup a klass
   Klass* resolve_klass(const char* klass, TRAPS) {
     Symbol* klass_name = SymbolTable::lookup(klass, (int)strlen(klass), CHECK_NULL);
-    return SystemDictionary::resolve_or_fail(klass_name, _loader, _protection_domain, true, CHECK_NULL);
+    return SystemDictionary::resolve_or_fail(klass_name, _loader, _protection_domain, true, THREAD);
   }
 
   // Parse the standard tuple of <klass> <name> <signature>
diff --git a/hotspot/src/share/vm/classfile/classLoaderData.cpp b/hotspot/src/share/vm/classfile/classLoaderData.cpp
index 380c3dea10c..920b06e9b50 100644
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp
@@ -472,7 +472,7 @@ void ClassLoaderData::free_deallocate_list() {
 // These anonymous class loaders are to contain classes used for JSR292
 ClassLoaderData* ClassLoaderData::anonymous_class_loader_data(oop loader, TRAPS) {
   // Add a new class loader data to the graph.
-  return ClassLoaderDataGraph::add(loader, true, CHECK_NULL);
+  return ClassLoaderDataGraph::add(loader, true, THREAD);
 }
 
 const char* ClassLoaderData::loader_name() {
diff --git a/hotspot/src/share/vm/classfile/defaultMethods.cpp b/hotspot/src/share/vm/classfile/defaultMethods.cpp
index 2694a02826a..65a38fe037c 100644
--- a/hotspot/src/share/vm/classfile/defaultMethods.cpp
+++ b/hotspot/src/share/vm/classfile/defaultMethods.cpp
@@ -493,7 +493,7 @@ class MethodFamily : public ResourceObj {
 };
 
 Symbol* MethodFamily::generate_no_defaults_message(TRAPS) const {
-  return SymbolTable::new_symbol("No qualifying defaults found", CHECK_NULL);
+  return SymbolTable::new_symbol("No qualifying defaults found", THREAD);
 }
 
 Symbol* MethodFamily::generate_method_message(Symbol *klass_name, Method* method, TRAPS) const {
diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp
index 075dea57d81..b05920b9a36 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp
@@ -1952,7 +1952,7 @@ Handle java_lang_reflect_Method::create(TRAPS) {
   // This class is eagerly initialized during VM initialization, since we keep a refence
   // to one of the methods
   assert(InstanceKlass::cast(klass)->is_initialized(), "must be initialized");
-  return InstanceKlass::cast(klass)->allocate_instance_handle(CHECK_NH);
+  return InstanceKlass::cast(klass)->allocate_instance_handle(THREAD);
 }
 
 oop java_lang_reflect_Method::clazz(oop reflect) {
@@ -2130,7 +2130,7 @@ Handle java_lang_reflect_Constructor::create(TRAPS) {
   instanceKlassHandle klass (THREAD, k);
   // Ensure it is initialized
   klass->initialize(CHECK_NH);
-  return klass->allocate_instance_handle(CHECK_NH);
+  return klass->allocate_instance_handle(THREAD);
 }
 
 oop java_lang_reflect_Constructor::clazz(oop reflect) {
@@ -2270,7 +2270,7 @@ Handle java_lang_reflect_Field::create(TRAPS) {
   instanceKlassHandle klass (THREAD, k);
   // Ensure it is initialized
   klass->initialize(CHECK_NH);
-  return klass->allocate_instance_handle(CHECK_NH);
+  return klass->allocate_instance_handle(THREAD);
 }
 
 oop java_lang_reflect_Field::clazz(oop reflect) {
@@ -2397,7 +2397,7 @@ Handle java_lang_reflect_Parameter::create(TRAPS) {
   instanceKlassHandle klass (THREAD, k);
   // Ensure it is initialized
   klass->initialize(CHECK_NH);
-  return klass->allocate_instance_handle(CHECK_NH);
+  return klass->allocate_instance_handle(THREAD);
 }
 
 oop java_lang_reflect_Parameter::name(oop param) {
@@ -2447,7 +2447,7 @@ Handle sun_reflect_ConstantPool::create(TRAPS) {
   instanceKlassHandle klass (THREAD, k);
   // Ensure it is initialized
   klass->initialize(CHECK_NH);
-  return klass->allocate_instance_handle(CHECK_NH);
+  return klass->allocate_instance_handle(THREAD);
 }
 
 
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp
index fa18ba477c6..9c300a9221b 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp
@@ -123,7 +123,7 @@ void SystemDictionary::compute_java_system_loader(TRAPS) {
 
 ClassLoaderData* SystemDictionary::register_loader(Handle class_loader, TRAPS) {
   if (class_loader() == NULL) return ClassLoaderData::the_null_class_loader_data();
-  return ClassLoaderDataGraph::find_or_create(class_loader, CHECK_NULL);
+  return ClassLoaderDataGraph::find_or_create(class_loader, THREAD);
 }
 
 // ----------------------------------------------------------------------------
diff --git a/hotspot/src/share/vm/classfile/verificationType.hpp b/hotspot/src/share/vm/classfile/verificationType.hpp
index 43bd79e21b1..9a7836045f6 100644
--- a/hotspot/src/share/vm/classfile/verificationType.hpp
+++ b/hotspot/src/share/vm/classfile/verificationType.hpp
@@ -289,7 +289,7 @@ class VerificationType VALUE_OBJ_CLASS_SPEC {
           if (is_reference() && from.is_reference()) {
             return is_reference_assignable_from(from, context,
                                                 from_field_is_protected,
-                                                CHECK_false);
+                                                THREAD);
           } else {
             return false;
           }
diff --git a/hotspot/src/share/vm/classfile/verifier.cpp b/hotspot/src/share/vm/classfile/verifier.cpp
index 04cbda3c03d..d5094ae55be 100644
--- a/hotspot/src/share/vm/classfile/verifier.cpp
+++ b/hotspot/src/share/vm/classfile/verifier.cpp
@@ -1927,7 +1927,7 @@ Klass* ClassVerifier::load_class(Symbol* name, TRAPS) {
 
   return SystemDictionary::resolve_or_fail(
     name, Handle(THREAD, loader), Handle(THREAD, protection_domain),
-    true, CHECK_NULL);
+    true, THREAD);
 }
 
 bool ClassVerifier::is_protected_access(instanceKlassHandle this_class,
diff --git a/hotspot/src/share/vm/memory/allocation.cpp b/hotspot/src/share/vm/memory/allocation.cpp
index 0a05e6a7960..2bc6c507175 100644
--- a/hotspot/src/share/vm/memory/allocation.cpp
+++ b/hotspot/src/share/vm/memory/allocation.cpp
@@ -50,8 +50,7 @@ void* MetaspaceObj::operator new(size_t size, ClassLoaderData* loader_data,
                                  size_t word_size, bool read_only,
                                  MetaspaceObj::Type type, TRAPS) throw() {
   // Klass has it's own operator new
-  return Metaspace::allocate(loader_data, word_size, read_only,
-                             type, CHECK_NULL);
+  return Metaspace::allocate(loader_data, word_size, read_only, type, THREAD);
 }
 
 bool MetaspaceObj::is_shared() const {
diff --git a/hotspot/src/share/vm/memory/oopFactory.hpp b/hotspot/src/share/vm/memory/oopFactory.hpp
index 1d14010e278..c8dd27f2df8 100644
--- a/hotspot/src/share/vm/memory/oopFactory.hpp
+++ b/hotspot/src/share/vm/memory/oopFactory.hpp
@@ -41,20 +41,20 @@ class vframeArray;
 class oopFactory: AllStatic {
  public:
   // Basic type leaf array allocation
-  static typeArrayOop    new_boolArray  (int length, TRAPS) { return TypeArrayKlass::cast(Universe::boolArrayKlassObj  ())->allocate(length, CHECK_NULL); }
-  static typeArrayOop    new_charArray  (int length, TRAPS) { return TypeArrayKlass::cast(Universe::charArrayKlassObj  ())->allocate(length, CHECK_NULL); }
-  static typeArrayOop    new_singleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::singleArrayKlassObj())->allocate(length, CHECK_NULL); }
-  static typeArrayOop    new_doubleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::doubleArrayKlassObj())->allocate(length, CHECK_NULL); }
-  static typeArrayOop    new_byteArray  (int length, TRAPS) { return TypeArrayKlass::cast(Universe::byteArrayKlassObj  ())->allocate(length, CHECK_NULL); }
-  static typeArrayOop    new_shortArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::shortArrayKlassObj ())->allocate(length, CHECK_NULL); }
-  static typeArrayOop    new_intArray   (int length, TRAPS) { return TypeArrayKlass::cast(Universe::intArrayKlassObj   ())->allocate(length, CHECK_NULL); }
-  static typeArrayOop    new_longArray  (int length, TRAPS) { return TypeArrayKlass::cast(Universe::longArrayKlassObj  ())->allocate(length, CHECK_NULL); }
+  static typeArrayOop    new_boolArray  (int length, TRAPS) { return TypeArrayKlass::cast(Universe::boolArrayKlassObj  ())->allocate(length, THREAD); }
+  static typeArrayOop    new_charArray  (int length, TRAPS) { return TypeArrayKlass::cast(Universe::charArrayKlassObj  ())->allocate(length, THREAD); }
+  static typeArrayOop    new_singleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::singleArrayKlassObj())->allocate(length, THREAD); }
+  static typeArrayOop    new_doubleArray(int length, TRAPS) { return TypeArrayKlass::cast(Universe::doubleArrayKlassObj())->allocate(length, THREAD); }
+  static typeArrayOop    new_byteArray  (int length, TRAPS) { return TypeArrayKlass::cast(Universe::byteArrayKlassObj  ())->allocate(length, THREAD); }
+  static typeArrayOop    new_shortArray (int length, TRAPS) { return TypeArrayKlass::cast(Universe::shortArrayKlassObj ())->allocate(length, THREAD); }
+  static typeArrayOop    new_intArray   (int length, TRAPS) { return TypeArrayKlass::cast(Universe::intArrayKlassObj   ())->allocate(length, THREAD); }
+  static typeArrayOop    new_longArray  (int length, TRAPS) { return TypeArrayKlass::cast(Universe::longArrayKlassObj  ())->allocate(length, THREAD); }
 
   // create java.lang.Object[]
   static objArrayOop     new_objectArray(int length, TRAPS)  {
     assert(Universe::objectArrayKlassObj() != NULL, "Too early?");
     return ObjArrayKlass::
-      cast(Universe::objectArrayKlassObj())->allocate(length, CHECK_NULL);
+      cast(Universe::objectArrayKlassObj())->allocate(length, THREAD);
   }
 
   static typeArrayOop    new_charArray           (const char* utf8_str,  TRAPS);
diff --git a/hotspot/src/share/vm/oops/constantPool.cpp b/hotspot/src/share/vm/oops/constantPool.cpp
index d547398dfae..98c72156bc3 100644
--- a/hotspot/src/share/vm/oops/constantPool.cpp
+++ b/hotspot/src/share/vm/oops/constantPool.cpp
@@ -461,7 +461,7 @@ int ConstantPool::signature_ref_index_at(int which_nt) {
 
 
 Klass* ConstantPool::klass_ref_at(int which, TRAPS) {
-  return klass_at(klass_ref_index_at(which), CHECK_NULL);
+  return klass_at(klass_ref_index_at(which), THREAD);
 }
 
 
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
index 800971b4df5..968f233adcc 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
@@ -532,7 +532,7 @@ bool InstanceKlass::verify_code(
   // 1) Verify the bytecodes
   Verifier::Mode mode =
     throw_verifyerror ? Verifier::ThrowException : Verifier::NoException;
-  return Verifier::verify(this_k, mode, this_k->should_verify_class(), CHECK_false);
+  return Verifier::verify(this_k, mode, this_k->should_verify_class(), THREAD);
 }
 
 
@@ -1130,7 +1130,7 @@ Klass* InstanceKlass::array_klass_impl(instanceKlassHandle this_k, bool or_null,
   if (or_null) {
     return oak->array_klass_or_null(n);
   }
-  return oak->array_klass(n, CHECK_NULL);
+  return oak->array_klass(n, THREAD);
 }
 
 Klass* InstanceKlass::array_klass_impl(bool or_null, TRAPS) {
diff --git a/hotspot/src/share/vm/oops/klass.cpp b/hotspot/src/share/vm/oops/klass.cpp
index bdd4839be46..56de60fa37b 100644
--- a/hotspot/src/share/vm/oops/klass.cpp
+++ b/hotspot/src/share/vm/oops/klass.cpp
@@ -152,7 +152,7 @@ Method* Klass::uncached_lookup_method(Symbol* name, Symbol* signature, MethodLoo
 
 void* Klass::operator new(size_t size, ClassLoaderData* loader_data, size_t word_size, TRAPS) throw() {
   return Metaspace::allocate(loader_data, word_size, /*read_only*/false,
-                             MetaspaceObj::ClassType, CHECK_NULL);
+                             MetaspaceObj::ClassType, THREAD);
 }
 
 Klass::Klass() {
diff --git a/hotspot/src/share/vm/oops/methodData.cpp b/hotspot/src/share/vm/oops/methodData.cpp
index 95fdb621301..35e615a3416 100644
--- a/hotspot/src/share/vm/oops/methodData.cpp
+++ b/hotspot/src/share/vm/oops/methodData.cpp
@@ -658,7 +658,7 @@ MethodData* MethodData::allocate(ClassLoaderData* loader_data, methodHandle meth
   int size = MethodData::compute_allocation_size_in_words(method);
 
   return new (loader_data, size, false, MetaspaceObj::MethodDataType, THREAD)
-    MethodData(method(), size, CHECK_NULL);
+    MethodData(method(), size, THREAD);
 }
 
 int MethodData::bytecode_cell_count(Bytecodes::Code code) {
diff --git a/hotspot/src/share/vm/oops/objArrayKlass.cpp b/hotspot/src/share/vm/oops/objArrayKlass.cpp
index a4c51d09b1f..ffbdf026f24 100644
--- a/hotspot/src/share/vm/oops/objArrayKlass.cpp
+++ b/hotspot/src/share/vm/oops/objArrayKlass.cpp
@@ -189,7 +189,7 @@ objArrayOop ObjArrayKlass::allocate(int length, TRAPS) {
     if (length <= arrayOopDesc::max_array_length(T_OBJECT)) {
       int size = objArrayOopDesc::object_size(length);
       KlassHandle h_k(THREAD, this);
-      return (objArrayOop)CollectedHeap::array_allocate(h_k, size, length, CHECK_NULL);
+      return (objArrayOop)CollectedHeap::array_allocate(h_k, size, length, THREAD);
     } else {
       report_java_out_of_memory("Requested array size exceeds VM limit");
       JvmtiExport::post_array_size_exhausted();
@@ -362,11 +362,11 @@ Klass* ObjArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
   if (or_null) {
     return ak->array_klass_or_null(n);
   }
-  return ak->array_klass(n, CHECK_NULL);
+  return ak->array_klass(n, THREAD);
 }
 
 Klass* ObjArrayKlass::array_klass_impl(bool or_null, TRAPS) {
-  return array_klass_impl(or_null, dimension() +  1, CHECK_NULL);
+  return array_klass_impl(or_null, dimension() +  1, THREAD);
 }
 
 bool ObjArrayKlass::can_be_primary_super_slow() const {
diff --git a/hotspot/src/share/vm/oops/typeArrayKlass.cpp b/hotspot/src/share/vm/oops/typeArrayKlass.cpp
index 7cc94753a6b..26c9ca55f4c 100644
--- a/hotspot/src/share/vm/oops/typeArrayKlass.cpp
+++ b/hotspot/src/share/vm/oops/typeArrayKlass.cpp
@@ -191,7 +191,7 @@ Klass* TypeArrayKlass::array_klass_impl(bool or_null, int n, TRAPS) {
   if (or_null) {
     return h_ak->array_klass_or_null(n);
   }
-  return h_ak->array_klass(n, CHECK_NULL);
+  return h_ak->array_klass(n, THREAD);
 }
 
 Klass* TypeArrayKlass::array_klass_impl(bool or_null, TRAPS) {
diff --git a/hotspot/src/share/vm/prims/methodHandles.cpp b/hotspot/src/share/vm/prims/methodHandles.cpp
index 8013a1329a8..168028d8c09 100644
--- a/hotspot/src/share/vm/prims/methodHandles.cpp
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp
@@ -399,12 +399,12 @@ vmIntrinsics::ID MethodHandles::signature_polymorphic_name_id(Klass* klass, Symb
 // convert the external string or reflective type to an internal signature
 Symbol* MethodHandles::lookup_signature(oop type_str, bool intern_if_not_found, TRAPS) {
   if (java_lang_invoke_MethodType::is_instance(type_str)) {
-    return java_lang_invoke_MethodType::as_signature(type_str, intern_if_not_found, CHECK_NULL);
+    return java_lang_invoke_MethodType::as_signature(type_str, intern_if_not_found, THREAD);
   } else if (java_lang_Class::is_instance(type_str)) {
-    return java_lang_Class::as_signature(type_str, false, CHECK_NULL);
+    return java_lang_Class::as_signature(type_str, false, THREAD);
   } else if (java_lang_String::is_instance(type_str)) {
     if (intern_if_not_found) {
-      return java_lang_String::as_symbol(type_str, CHECK_NULL);
+      return java_lang_String::as_symbol(type_str, THREAD);
     } else {
       return java_lang_String::as_symbol_or_null(type_str);
     }
diff --git a/hotspot/src/share/vm/runtime/fieldDescriptor.cpp b/hotspot/src/share/vm/runtime/fieldDescriptor.cpp
index 79e3ddcd85d..08758a9a99d 100644
--- a/hotspot/src/share/vm/runtime/fieldDescriptor.cpp
+++ b/hotspot/src/share/vm/runtime/fieldDescriptor.cpp
@@ -94,7 +94,7 @@ jdouble fieldDescriptor::double_initial_value() const {
 }
 
 oop fieldDescriptor::string_initial_value(TRAPS) const {
-  return constants()->uncached_string_at(initial_value_index(), CHECK_0);
+  return constants()->uncached_string_at(initial_value_index(), THREAD);
 }
 
 void fieldDescriptor::reinitialize(InstanceKlass* ik, int index) {
diff --git a/hotspot/src/share/vm/runtime/perfData.hpp b/hotspot/src/share/vm/runtime/perfData.hpp
index f9836ac08ff..d0553431148 100644
--- a/hotspot/src/share/vm/runtime/perfData.hpp
+++ b/hotspot/src/share/vm/runtime/perfData.hpp
@@ -773,7 +773,7 @@ class PerfDataManager : AllStatic {
     static PerfStringVariable* create_string_variable(CounterNS ns,
                                                       const char* name,
                                                       const char *s, TRAPS) {
-      return create_string_variable(ns, name, 0, s, CHECK_NULL);
+      return create_string_variable(ns, name, 0, s, THREAD);
     };
 
     static PerfLongVariable* create_long_variable(CounterNS ns,
@@ -784,7 +784,7 @@ class PerfDataManager : AllStatic {
     static PerfLongVariable* create_long_variable(CounterNS ns,
                                                   const char* name,
                                                   PerfData::Units u, TRAPS) {
-      return create_long_variable(ns, name, u, (jlong)0, CHECK_NULL);
+      return create_long_variable(ns, name, u, (jlong)0, THREAD);
     };
 
     static PerfLongVariable* create_long_variable(CounterNS, const char* name,
@@ -805,7 +805,7 @@ class PerfDataManager : AllStatic {
 
     static PerfLongCounter* create_long_counter(CounterNS ns, const char* name,
                                                 PerfData::Units u, TRAPS) {
-      return create_long_counter(ns, name, u, (jlong)0, CHECK_NULL);
+      return create_long_counter(ns, name, u, (jlong)0, THREAD);
     };
 
     static PerfLongCounter* create_long_counter(CounterNS ns, const char* name,
@@ -823,49 +823,49 @@ class PerfDataManager : AllStatic {
 
     static PerfConstant* create_constant(CounterNS ns, const char* name,
                                          PerfData::Units u, jlong val, TRAPS) {
-      return create_long_constant(ns, name, u, val, CHECK_NULL);
+      return create_long_constant(ns, name, u, val, THREAD);
     }
 
     static PerfVariable* create_variable(CounterNS ns, const char* name,
                                          PerfData::Units u, jlong ival, TRAPS) {
-      return create_long_variable(ns, name, u, ival, CHECK_NULL);
+      return create_long_variable(ns, name, u, ival, THREAD);
     }
 
     static PerfVariable* create_variable(CounterNS ns, const char* name,
                                          PerfData::Units u, TRAPS) {
-      return create_long_variable(ns, name, u, (jlong)0, CHECK_NULL);
+      return create_long_variable(ns, name, u, (jlong)0, THREAD);
     }
 
     static PerfVariable* create_variable(CounterNS ns, const char* name,
                                          PerfData::Units u, jlong* sp, TRAPS) {
-      return create_long_variable(ns, name, u, sp, CHECK_NULL);
+      return create_long_variable(ns, name, u, sp, THREAD);
     }
 
     static PerfVariable* create_variable(CounterNS ns, const char* name,
                                          PerfData::Units u,
                                          PerfSampleHelper* sh, TRAPS) {
-      return create_long_variable(ns, name, u, sh, CHECK_NULL);
+      return create_long_variable(ns, name, u, sh, THREAD);
     }
 
     static PerfCounter* create_counter(CounterNS ns, const char* name,
                                        PerfData::Units u, jlong ival, TRAPS) {
-      return create_long_counter(ns, name, u, ival, CHECK_NULL);
+      return create_long_counter(ns, name, u, ival, THREAD);
     }
 
     static PerfCounter* create_counter(CounterNS ns, const char* name,
                                        PerfData::Units u, TRAPS) {
-      return create_long_counter(ns, name, u, (jlong)0, CHECK_NULL);
+      return create_long_counter(ns, name, u, (jlong)0, THREAD);
     }
 
     static PerfCounter* create_counter(CounterNS ns, const char* name,
                                        PerfData::Units u, jlong* sp, TRAPS) {
-      return create_long_counter(ns, name, u, sp, CHECK_NULL);
+      return create_long_counter(ns, name, u, sp, THREAD);
     }
 
     static PerfCounter* create_counter(CounterNS ns, const char* name,
                                        PerfData::Units u,
                                        PerfSampleHelper* sh, TRAPS) {
-      return create_long_counter(ns, name, u, sh, CHECK_NULL);
+      return create_long_counter(ns, name, u, sh, THREAD);
     }
 
     static void destroy();
diff --git a/hotspot/src/share/vm/runtime/reflection.cpp b/hotspot/src/share/vm/runtime/reflection.cpp
index 36f5990a69a..843aabc0a89 100644
--- a/hotspot/src/share/vm/runtime/reflection.cpp
+++ b/hotspot/src/share/vm/runtime/reflection.cpp
@@ -635,7 +635,7 @@ objArrayHandle Reflection::get_parameter_types(methodHandle method, int paramete
 }
 
 objArrayHandle Reflection::get_exception_types(methodHandle method, TRAPS) {
-  return method->resolved_checked_exceptions(CHECK_(objArrayHandle()));
+  return method->resolved_checked_exceptions(THREAD);
 }
 
 
diff --git a/hotspot/src/share/vm/runtime/synchronizer.hpp b/hotspot/src/share/vm/runtime/synchronizer.hpp
index c0d9f115eab..a823b540ec4 100644
--- a/hotspot/src/share/vm/runtime/synchronizer.hpp
+++ b/hotspot/src/share/vm/runtime/synchronizer.hpp
@@ -169,7 +169,7 @@ class ObjectLocker : public StackObj {
   void waitUninterruptibly(TRAPS) { ObjectSynchronizer::waitUninterruptibly(_obj, 0, CHECK); }
   // complete_exit gives up lock completely, returning recursion count
   // reenter reclaims lock with original recursion count
-  intptr_t complete_exit(TRAPS)  { return ObjectSynchronizer::complete_exit(_obj, CHECK_0); }
+  intptr_t complete_exit(TRAPS)  { return ObjectSynchronizer::complete_exit(_obj, THREAD); }
   void reenter(intptr_t recursion, TRAPS)  { ObjectSynchronizer::reenter(_obj, recursion, CHECK); }
 };
 
diff --git a/hotspot/src/share/vm/utilities/array.hpp b/hotspot/src/share/vm/utilities/array.hpp
index b7ce8e71588..3d575498f05 100644
--- a/hotspot/src/share/vm/utilities/array.hpp
+++ b/hotspot/src/share/vm/utilities/array.hpp
@@ -322,7 +322,7 @@ protected:
   void* operator new(size_t size, ClassLoaderData* loader_data, int length, bool read_only, TRAPS) throw() {
     size_t word_size = Array::size(length);
     return (void*) Metaspace::allocate(loader_data, word_size, read_only,
-                                       MetaspaceObj::array_type(sizeof(T)), CHECK_NULL);
+                                       MetaspaceObj::array_type(sizeof(T)), THREAD);
   }
 
   static size_t byte_sizeof(int length) { return sizeof(Array<T>) + MAX2(length - 1, 0) * sizeof(T); }

From 4feb7b4dab063fd7ca4b6fb9cadb7d38ee4bac82 Mon Sep 17 00:00:00 2001
From: Mikael Gerdin <mgerdin@openjdk.org>
Date: Fri, 14 Nov 2014 14:23:25 +0100
Subject: [PATCH 018/299] 8058209: Race in G1 card scanning could allow
 scanning of memory covered by PLABs

Read _top before _gc_time_stamp in saved_mark_word() with LoadLoad order to ensure we get a consistent view

Reviewed-by: brutisso, dcubed, dholmes, stefank
---
 hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
index 3b49ff164fb..299eec5a3e6 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
@@ -1004,10 +1004,13 @@ HeapWord* G1OffsetTableContigSpace::cross_threshold(HeapWord* start,
 HeapWord* G1OffsetTableContigSpace::saved_mark_word() const {
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
   assert( _gc_time_stamp <= g1h->get_gc_time_stamp(), "invariant" );
-  if (_gc_time_stamp < g1h->get_gc_time_stamp())
-    return top();
-  else
+  HeapWord* local_top = top();
+  OrderAccess::loadload();
+  if (_gc_time_stamp < g1h->get_gc_time_stamp()) {
+    return local_top;
+  } else {
     return Space::saved_mark_word();
+  }
 }
 
 void G1OffsetTableContigSpace::record_top_and_timestamp() {

From 04bdb774e1e1749516250853ef8f1282b470a0cd Mon Sep 17 00:00:00 2001
From: Staffan Friberg <sfriberg@openjdk.org>
Date: Fri, 14 Nov 2014 15:03:39 +0100
Subject: [PATCH 019/299] 8064473: Improved handling of age during object copy
 in G1

Reviewed-by: brutisso, tschatzl
---
 .../gc_implementation/g1/g1CollectedHeap.cpp  |  7 ++--
 .../g1/g1ParScanThreadState.cpp               | 38 ++++++++-----------
 .../g1/g1ParScanThreadState.hpp               |  2 +-
 .../g1/g1ParScanThreadState.inline.hpp        |  7 ++--
 .../vm/gc_implementation/shared/ageTable.hpp  |  5 ++-
 5 files changed, 28 insertions(+), 31 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index ebd77eb0b1e..e2ae3205d51 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -4270,10 +4270,11 @@ void G1ParCopyClosure<barrier, do_mark_object>::do_oop_work(T* p) {
 
   if (state == G1CollectedHeap::InCSet) {
     oop forwardee;
-    if (obj->is_forwarded()) {
-      forwardee = obj->forwardee();
+    markOop m = obj->mark();
+    if (m->is_marked()) {
+      forwardee = (oop) m->decode_pointer();
     } else {
-      forwardee = _par_scan_state->copy_to_survivor_space(obj);
+      forwardee = _par_scan_state->copy_to_survivor_space(obj, m);
     }
     assert(forwardee != NULL, "forwardee should not be NULL");
     oopDesc::encode_store_heap_oop(p, forwardee);
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
index 311b9d00832..9cbc10e78bb 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
@@ -150,7 +150,8 @@ void G1ParScanThreadState::trim_queue() {
   } while (!_refs->is_empty());
 }
 
-oop G1ParScanThreadState::copy_to_survivor_space(oop const old) {
+oop G1ParScanThreadState::copy_to_survivor_space(oop const old,
+                                                 markOop const old_mark) {
   size_t word_sz = old->size();
   HeapRegion* from_region = _g1h->heap_region_containing_raw(old);
   // +1 to make the -1 indexes valid...
@@ -158,9 +159,8 @@ oop G1ParScanThreadState::copy_to_survivor_space(oop const old) {
   assert( (from_region->is_young() && young_index >  0) ||
          (!from_region->is_young() && young_index == 0), "invariant" );
   G1CollectorPolicy* g1p = _g1h->g1_policy();
-  markOop m = old->mark();
-  int age = m->has_displaced_mark_helper() ? m->displaced_mark_helper()->age()
-                                           : m->age();
+  uint age = old_mark->has_displaced_mark_helper() ? old_mark->displaced_mark_helper()->age()
+                                                   : old_mark->age();
   GCAllocPurpose alloc_purpose = g1p->evacuation_destination(from_region, age,
                                                              word_sz);
   AllocationContext_t context = from_region->allocation_context();
@@ -196,30 +196,22 @@ oop G1ParScanThreadState::copy_to_survivor_space(oop const old) {
     alloc_purpose = to_region->is_young() ? GCAllocForSurvived : GCAllocForTenured;
 
     if (g1p->track_object_age(alloc_purpose)) {
-      // We could simply do obj->incr_age(). However, this causes a
-      // performance issue. obj->incr_age() will first check whether
-      // the object has a displaced mark by checking its mark word;
-      // getting the mark word from the new location of the object
-      // stalls. So, given that we already have the mark word and we
-      // are about to install it anyway, it's better to increase the
-      // age on the mark word, when the object does not have a
-      // displaced mark word. We're not expecting many objects to have
-      // a displaced marked word, so that case is not optimized
-      // further (it could be...) and we simply call obj->incr_age().
-
-      if (m->has_displaced_mark_helper()) {
-        // in this case, we have to install the mark word first,
+      if (age < markOopDesc::max_age) {
+        age++;
+      }
+      if (old_mark->has_displaced_mark_helper()) {
+        // In this case, we have to install the mark word first,
         // otherwise obj looks to be forwarded (the old mark word,
         // which contains the forward pointer, was copied)
-        obj->set_mark(m);
-        obj->incr_age();
+        obj->set_mark(old_mark);
+        markOop new_mark = old_mark->displaced_mark_helper()->set_age(age);
+        old_mark->set_displaced_mark_helper(new_mark);
       } else {
-        m = m->incr_age();
-        obj->set_mark(m);
+        obj->set_mark(old_mark->set_age(age));
       }
-      age_table()->add(obj, word_sz);
+      age_table()->add(age, word_sz);
     } else {
-      obj->set_mark(m);
+      obj->set_mark(old_mark);
     }
 
     if (G1StringDedup::is_enabled()) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp
index a9b9283d32e..a7c2f8ea119 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.hpp
@@ -195,7 +195,7 @@ class G1ParScanThreadState : public StackObj {
   inline void dispatch_reference(StarTask ref);
  public:
 
-  oop copy_to_survivor_space(oop const obj);
+  oop copy_to_survivor_space(oop const obj, markOop const old_mark);
 
   void trim_queue();
 
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp
index 3fb1829f20d..8e20df6fe66 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.inline.hpp
@@ -41,10 +41,11 @@ template <class T> void G1ParScanThreadState::do_oop_evac(T* p, HeapRegion* from
   G1CollectedHeap::in_cset_state_t in_cset_state = _g1h->in_cset_state(obj);
   if (in_cset_state == G1CollectedHeap::InCSet) {
     oop forwardee;
-    if (obj->is_forwarded()) {
-      forwardee = obj->forwardee();
+    markOop m = obj->mark();
+    if (m->is_marked()) {
+      forwardee = (oop) m->decode_pointer();
     } else {
-      forwardee = copy_to_survivor_space(obj);
+      forwardee = copy_to_survivor_space(obj, m);
     }
     oopDesc::encode_store_heap_oop(p, forwardee);
   } else if (in_cset_state == G1CollectedHeap::IsHumongous) {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/ageTable.hpp b/hotspot/src/share/vm/gc_implementation/shared/ageTable.hpp
index 9e2ee99997f..44d8e0ace7f 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/ageTable.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/ageTable.hpp
@@ -55,7 +55,10 @@ class ageTable VALUE_OBJ_CLASS_SPEC {
 
   // add entry
   void add(oop p, size_t oop_size) {
-    uint age = p->age();
+    add(p->age(), oop_size);
+  }
+
+  void add(uint age, size_t oop_size) {
     assert(age > 0 && age < table_size, "invalid age of object");
     sizes[age] += oop_size;
   }

From d326162380ef72f8f6afef5978cafc9006a716f8 Mon Sep 17 00:00:00 2001
From: Stefan Karlsson <stefank@openjdk.org>
Date: Tue, 11 Nov 2014 17:05:33 +0100
Subject: [PATCH 020/299] 8064580: Move INCLUDE_CDS include section to the end
 of the include list

Reviewed-by: jwilhelm, brutisso, coleenp, dholmes
---
 hotspot/src/os/linux/vm/os_linux.cpp                |  1 +
 hotspot/src/share/vm/classfile/classFileParser.cpp  |  7 ++++---
 hotspot/src/share/vm/classfile/classLoader.cpp      | 11 ++++++-----
 hotspot/src/share/vm/classfile/classLoader.hpp      |  1 +
 hotspot/src/share/vm/classfile/systemDictionary.cpp |  9 ++++-----
 hotspot/src/share/vm/memory/metaspace.cpp           |  1 +
 hotspot/src/share/vm/memory/universe.cpp            |  6 +++---
 hotspot/src/share/vm/prims/jvm.cpp                  |  9 +++++----
 hotspot/src/share/vm/utilities/ostream.cpp          |  1 +
 9 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index 3e5dc4066d5..fcae0343300 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -68,6 +68,7 @@
 #include "utilities/events.hpp"
 #include "utilities/elfFile.hpp"
 #include "utilities/growableArray.hpp"
+#include "utilities/macros.hpp"
 #include "utilities/vmError.hpp"
 
 // put OS-includes here
diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp
index fe9f2443a80..e643ad9b61b 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp
@@ -31,9 +31,6 @@
 #include "classfile/javaClasses.hpp"
 #include "classfile/symbolTable.hpp"
 #include "classfile/systemDictionary.hpp"
-#if INCLUDE_CDS
-#include "classfile/systemDictionaryShared.hpp"
-#endif
 #include "classfile/verificationType.hpp"
 #include "classfile/verifier.hpp"
 #include "classfile/vmSymbols.hpp"
@@ -63,7 +60,11 @@
 #include "services/threadService.hpp"
 #include "utilities/array.hpp"
 #include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
 #include "utilities/ostream.hpp"
+#if INCLUDE_CDS
+#include "classfile/systemDictionaryShared.hpp"
+#endif
 
 // We generally try to create the oops directly when parsing, rather than
 // allocating temporary data structures and copying the bytes twice. A
diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp
index 780fea1c2a3..aa4685c3032 100644
--- a/hotspot/src/share/vm/classfile/classLoader.cpp
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp
@@ -29,10 +29,6 @@
 #include "classfile/classLoaderExt.hpp"
 #include "classfile/classLoaderData.inline.hpp"
 #include "classfile/javaClasses.hpp"
-#if INCLUDE_CDS
-#include "classfile/sharedPathsMiscInfo.hpp"
-#include "classfile/sharedClassUtil.hpp"
-#endif
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "compiler/compileBroker.hpp"
@@ -64,8 +60,13 @@
 #include "services/management.hpp"
 #include "services/threadService.hpp"
 #include "utilities/events.hpp"
-#include "utilities/hashtable.hpp"
 #include "utilities/hashtable.inline.hpp"
+#include "utilities/macros.hpp"
+#if INCLUDE_CDS
+#include "classfile/sharedPathsMiscInfo.hpp"
+#include "classfile/sharedClassUtil.hpp"
+#endif
+
 
 // Entry points in zip.dll for loading zip/jar file entries
 
diff --git a/hotspot/src/share/vm/classfile/classLoader.hpp b/hotspot/src/share/vm/classfile/classLoader.hpp
index f69de2ec2cd..ba9c02acfdc 100644
--- a/hotspot/src/share/vm/classfile/classLoader.hpp
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp
@@ -27,6 +27,7 @@
 
 #include "classfile/classFileParser.hpp"
 #include "runtime/perfData.hpp"
+#include "utilities/macros.hpp"
 
 // The VM class loader.
 #include <sys/stat.h>
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp
index 9c300a9221b..861f82306da 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp
@@ -31,10 +31,6 @@
 #include "classfile/resolutionErrors.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
-#if INCLUDE_CDS
-#include "classfile/sharedClassUtil.hpp"
-#include "classfile/systemDictionaryShared.hpp"
-#endif
 #include "classfile/vmSymbols.hpp"
 #include "compiler/compileBroker.hpp"
 #include "interpreter/bytecodeStream.hpp"
@@ -65,7 +61,10 @@
 #include "services/threadService.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/ticks.hpp"
-
+#if INCLUDE_CDS
+#include "classfile/sharedClassUtil.hpp"
+#include "classfile/systemDictionaryShared.hpp"
+#endif
 #if INCLUDE_TRACE
  #include "trace/tracing.hpp"
 #endif
diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp
index 2f5d5843ee2..037267e288b 100644
--- a/hotspot/src/share/vm/memory/metaspace.cpp
+++ b/hotspot/src/share/vm/memory/metaspace.cpp
@@ -47,6 +47,7 @@
 #include "services/memoryService.hpp"
 #include "utilities/copy.hpp"
 #include "utilities/debug.hpp"
+#include "utilities/macros.hpp"
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp
index 54a6c759f0d..d2d1837b74f 100644
--- a/hotspot/src/share/vm/memory/universe.cpp
+++ b/hotspot/src/share/vm/memory/universe.cpp
@@ -26,9 +26,6 @@
 #include "classfile/classLoader.hpp"
 #include "classfile/classLoaderData.hpp"
 #include "classfile/javaClasses.hpp"
-#if INCLUDE_CDS
-#include "classfile/sharedClassUtil.hpp"
-#endif
 #include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
@@ -82,6 +79,9 @@
 #include "gc_implementation/g1/g1CollectorPolicy.hpp"
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
 #endif // INCLUDE_ALL_GCS
+#if INCLUDE_CDS
+#include "classfile/sharedClassUtil.hpp"
+#endif
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp
index 5ea893b24db..0c333741364 100644
--- a/hotspot/src/share/vm/prims/jvm.cpp
+++ b/hotspot/src/share/vm/prims/jvm.cpp
@@ -28,10 +28,6 @@
 #include "classfile/javaClasses.hpp"
 #include "classfile/stringTable.hpp"
 #include "classfile/systemDictionary.hpp"
-#if INCLUDE_CDS
-#include "classfile/sharedClassUtil.hpp"
-#include "classfile/systemDictionaryShared.hpp"
-#endif
 #include "classfile/vmSymbols.hpp"
 #include "gc_interface/collectedHeap.inline.hpp"
 #include "interpreter/bytecode.hpp"
@@ -73,8 +69,13 @@
 #include "utilities/dtrace.hpp"
 #include "utilities/events.hpp"
 #include "utilities/histogram.hpp"
+#include "utilities/macros.hpp"
 #include "utilities/top.hpp"
 #include "utilities/utf8.hpp"
+#if INCLUDE_CDS
+#include "classfile/sharedClassUtil.hpp"
+#include "classfile/systemDictionaryShared.hpp"
+#endif
 #ifdef TARGET_OS_FAMILY_linux
 # include "jvm_linux.h"
 #endif
diff --git a/hotspot/src/share/vm/utilities/ostream.cpp b/hotspot/src/share/vm/utilities/ostream.cpp
index ceb5774fe81..0546f99ad34 100644
--- a/hotspot/src/share/vm/utilities/ostream.cpp
+++ b/hotspot/src/share/vm/utilities/ostream.cpp
@@ -30,6 +30,7 @@
 #include "runtime/os.hpp"
 #include "runtime/vm_version.hpp"
 #include "utilities/defaultStream.hpp"
+#include "utilities/macros.hpp"
 #include "utilities/ostream.hpp"
 #include "utilities/top.hpp"
 #include "utilities/xmlstream.hpp"

From eebf2b91266ba7c6f02c6c9433918612ba216ea3 Mon Sep 17 00:00:00 2001
From: Stefan Karlsson <stefank@openjdk.org>
Date: Wed, 12 Nov 2014 12:41:59 +0100
Subject: [PATCH 021/299] 8064581: Move INCLUDE_ALL_GCS include section to the
 end of the include list

Reviewed-by: jwilhelm, brutisso, coleenp, dholmes
---
 hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp |  1 +
 hotspot/src/share/vm/ci/ciObjectFactory.cpp   |  1 +
 .../src/share/vm/classfile/stringTable.cpp    |  1 +
 .../vm/gc_implementation/shared/gcTrace.cpp   |  2 +-
 .../vm/gc_implementation/shared/gcTrace.hpp   |  5 ++---
 .../gc_implementation/shared/gcTraceSend.cpp  |  1 +
 .../share/vm/memory/binaryTreeDictionary.cpp  |  3 +--
 .../share/vm/memory/freeBlockDictionary.cpp   |  7 +++----
 hotspot/src/share/vm/memory/freeList.cpp      |  1 -
 hotspot/src/share/vm/oops/oop.pcgc.inline.hpp |  2 +-
 hotspot/src/share/vm/prims/jni.cpp            |  8 +++----
 hotspot/src/share/vm/prims/unsafe.cpp         |  8 +++----
 hotspot/src/share/vm/prims/whitebox.cpp       | 21 +++++++------------
 hotspot/src/share/vm/runtime/globals.cpp      |  2 +-
 14 files changed, 28 insertions(+), 35 deletions(-)

diff --git a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp
index 5bbea5ada2a..66e33888223 100644
--- a/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp
+++ b/hotspot/src/cpu/ppc/vm/macroAssembler_ppc.hpp
@@ -27,6 +27,7 @@
 #define CPU_PPC_VM_MACROASSEMBLER_PPC_HPP
 
 #include "asm/assembler.hpp"
+#include "utilities/macros.hpp"
 
 // MacroAssembler extends Assembler by a few frequently used macros.
 
diff --git a/hotspot/src/share/vm/ci/ciObjectFactory.cpp b/hotspot/src/share/vm/ci/ciObjectFactory.cpp
index aaa607ff135..bf7b3f6013a 100644
--- a/hotspot/src/share/vm/ci/ciObjectFactory.cpp
+++ b/hotspot/src/share/vm/ci/ciObjectFactory.cpp
@@ -46,6 +46,7 @@
 #include "oops/oop.inline.hpp"
 #include "oops/oop.inline2.hpp"
 #include "runtime/fieldType.hpp"
+#include "utilities/macros.hpp"
 #if INCLUDE_ALL_GCS
 # include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
 #endif
diff --git a/hotspot/src/share/vm/classfile/stringTable.cpp b/hotspot/src/share/vm/classfile/stringTable.cpp
index b12134a1252..334fe7cbd39 100644
--- a/hotspot/src/share/vm/classfile/stringTable.cpp
+++ b/hotspot/src/share/vm/classfile/stringTable.cpp
@@ -36,6 +36,7 @@
 #include "runtime/atomic.inline.hpp"
 #include "runtime/mutexLocker.hpp"
 #include "utilities/hashtable.inline.hpp"
+#include "utilities/macros.hpp"
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
 #include "gc_implementation/g1/g1StringDedup.hpp"
diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp
index ddac9531667..dba0c5f709b 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.cpp
@@ -33,8 +33,8 @@
 #include "memory/referenceProcessorStats.hpp"
 #include "runtime/os.hpp"
 #include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
 #include "utilities/ticks.inline.hpp"
-
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/g1/evacuationInfo.hpp"
 #endif
diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp
index dd13344155f..20342ebc244 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTrace.hpp
@@ -33,12 +33,11 @@
 #include "memory/allocation.hpp"
 #include "memory/metaspace.hpp"
 #include "memory/referenceType.hpp"
+#include "utilities/macros.hpp"
+#include "utilities/ticks.hpp"
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/g1/g1YCTypes.hpp"
 #endif
-#include "utilities/macros.hpp"
-#include "utilities/ticks.hpp"
-
 
 class EvacuationInfo;
 class GCHeapSummary;
diff --git a/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp b/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp
index 5462135a014..97055694fae 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/gcTraceSend.cpp
@@ -31,6 +31,7 @@
 #include "runtime/os.hpp"
 #include "trace/tracing.hpp"
 #include "trace/traceBackend.hpp"
+#include "utilities/macros.hpp"
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/g1/evacuationInfo.hpp"
 #include "gc_implementation/g1/g1YCTypes.hpp"
diff --git a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp
index 60435e63c1d..5988eeef516 100644
--- a/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp
+++ b/hotspot/src/share/vm/memory/binaryTreeDictionary.cpp
@@ -23,8 +23,8 @@
  */
 
 #include "precompiled.hpp"
-#include "utilities/macros.hpp"
 #include "gc_implementation/shared/allocationStats.hpp"
+#include "gc_implementation/shared/spaceDecorator.hpp"
 #include "memory/binaryTreeDictionary.hpp"
 #include "memory/freeList.hpp"
 #include "memory/freeBlockDictionary.hpp"
@@ -32,7 +32,6 @@
 #include "runtime/globals.hpp"
 #include "utilities/ostream.hpp"
 #include "utilities/macros.hpp"
-#include "gc_implementation/shared/spaceDecorator.hpp"
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/concurrentMarkSweep/adaptiveFreeList.hpp"
 #include "gc_implementation/concurrentMarkSweep/freeChunk.hpp"
diff --git a/hotspot/src/share/vm/memory/freeBlockDictionary.cpp b/hotspot/src/share/vm/memory/freeBlockDictionary.cpp
index 1db7dcf75e5..3ac6f88d4ad 100644
--- a/hotspot/src/share/vm/memory/freeBlockDictionary.cpp
+++ b/hotspot/src/share/vm/memory/freeBlockDictionary.cpp
@@ -23,14 +23,13 @@
  */
 
 #include "precompiled.hpp"
-#include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc_implementation/concurrentMarkSweep/freeChunk.hpp"
-#endif // INCLUDE_ALL_GCS
 #include "memory/freeBlockDictionary.hpp"
 #include "memory/metachunk.hpp"
 #include "runtime/thread.inline.hpp"
 #include "utilities/macros.hpp"
+#if INCLUDE_ALL_GCS
+#include "gc_implementation/concurrentMarkSweep/freeChunk.hpp"
+#endif // INCLUDE_ALL_GCS
 
 #ifndef PRODUCT
 template <class Chunk> Mutex* FreeBlockDictionary<Chunk>::par_lock() const {
diff --git a/hotspot/src/share/vm/memory/freeList.cpp b/hotspot/src/share/vm/memory/freeList.cpp
index b1d901b9fc2..2eb74992b89 100644
--- a/hotspot/src/share/vm/memory/freeList.cpp
+++ b/hotspot/src/share/vm/memory/freeList.cpp
@@ -31,7 +31,6 @@
 #include "runtime/mutex.hpp"
 #include "runtime/vmThread.hpp"
 #include "utilities/macros.hpp"
-
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/concurrentMarkSweep/freeChunk.hpp"
 #endif // INCLUDE_ALL_GCS
diff --git a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp
index b613e4ee73f..ddc3f667227 100644
--- a/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp
+++ b/hotspot/src/share/vm/oops/oop.pcgc.inline.hpp
@@ -25,8 +25,8 @@
 #ifndef SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP
 #define SHARE_VM_OOPS_OOP_PCGC_INLINE_HPP
 
-#include "utilities/macros.hpp"
 #include "runtime/atomic.inline.hpp"
+#include "utilities/macros.hpp"
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/parNew/parNewGeneration.hpp"
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
diff --git a/hotspot/src/share/vm/prims/jni.cpp b/hotspot/src/share/vm/prims/jni.cpp
index e0116854741..cd99e787a72 100644
--- a/hotspot/src/share/vm/prims/jni.cpp
+++ b/hotspot/src/share/vm/prims/jni.cpp
@@ -32,10 +32,6 @@
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "interpreter/linkResolver.hpp"
-#include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
-#endif // INCLUDE_ALL_GCS
 #include "memory/allocation.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/gcLocker.inline.hpp"
@@ -81,6 +77,10 @@
 #include "utilities/dtrace.hpp"
 #include "utilities/events.hpp"
 #include "utilities/histogram.hpp"
+#include "utilities/macros.hpp"
+#if INCLUDE_ALL_GCS
+#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
+#endif // INCLUDE_ALL_GCS
 
 static jint CurrentVersion = JNI_VERSION_1_8;
 
diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp
index c0e4f30d2a2..321d3c3c8fc 100644
--- a/hotspot/src/share/vm/prims/unsafe.cpp
+++ b/hotspot/src/share/vm/prims/unsafe.cpp
@@ -24,10 +24,6 @@
 
 #include "precompiled.hpp"
 #include "classfile/vmSymbols.hpp"
-#include "utilities/macros.hpp"
-#if INCLUDE_ALL_GCS
-#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
-#endif // INCLUDE_ALL_GCS
 #include "memory/allocation.inline.hpp"
 #include "prims/jni.h"
 #include "prims/jvm.h"
@@ -43,6 +39,10 @@
 #include "trace/tracing.hpp"
 #include "utilities/copy.hpp"
 #include "utilities/dtrace.hpp"
+#include "utilities/macros.hpp"
+#if INCLUDE_ALL_GCS
+#include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
+#endif // INCLUDE_ALL_GCS
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp
index c4cf7088e69..eea24851f5d 100644
--- a/hotspot/src/share/vm/prims/whitebox.cpp
+++ b/hotspot/src/share/vm/prims/whitebox.cpp
@@ -23,44 +23,37 @@
  */
 
 #include "precompiled.hpp"
-
+#include "classfile/classLoaderData.hpp"
+#include "classfile/stringTable.hpp"
 #include "code/codeCache.hpp"
+#include "compiler/compileBroker.hpp"
 #include "memory/metadataFactory.hpp"
 #include "memory/universe.hpp"
 #include "oops/oop.inline.hpp"
-
-#include "classfile/stringTable.hpp"
-#include "classfile/classLoaderData.hpp"
-
-#include "prims/whitebox.hpp"
 #include "prims/wbtestmethods/parserTests.hpp"
-
-#include "runtime/thread.hpp"
+#include "prims/whitebox.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/compilationPolicy.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/os.hpp"
+#include "runtime/thread.hpp"
 #include "runtime/vm_version.hpp"
-
 #include "utilities/array.hpp"
 #include "utilities/debug.hpp"
-#include "utilities/macros.hpp"
 #include "utilities/exceptions.hpp"
-
+#include "utilities/macros.hpp"
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp"
 #include "gc_implementation/g1/concurrentMark.hpp"
 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
 #include "gc_implementation/g1/heapRegionRemSet.hpp"
 #endif // INCLUDE_ALL_GCS
-
 #if INCLUDE_NMT
 #include "services/mallocSiteTable.hpp"
 #include "services/memTracker.hpp"
 #include "utilities/nativeCallStack.hpp"
 #endif // INCLUDE_NMT
 
-#include "compiler/compileBroker.hpp"
-#include "runtime/compilationPolicy.hpp"
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp
index 81bf15d0f0c..ab301c57ce6 100644
--- a/hotspot/src/share/vm/runtime/globals.cpp
+++ b/hotspot/src/share/vm/runtime/globals.cpp
@@ -28,10 +28,10 @@
 #include "runtime/arguments.hpp"
 #include "runtime/globals.hpp"
 #include "runtime/globals_extension.hpp"
+#include "trace/tracing.hpp"
 #include "utilities/ostream.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/top.hpp"
-#include "trace/tracing.hpp"
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/g1/g1_globals.hpp"
 #endif // INCLUDE_ALL_GCS

From 4b60638d85aa9a20dec9efffcb84dc64a46c4ae3 Mon Sep 17 00:00:00 2001
From: Bengt Rutisson <brutisso@openjdk.org>
Date: Tue, 18 Nov 2014 10:23:26 +0100
Subject: [PATCH 022/299] 8064702: Remove the CMS foreground collector

Reviewed-by: kbarrett, ysr
---
 .../concurrentMarkSweepGeneration.cpp         | 598 ++++--------------
 .../concurrentMarkSweepGeneration.hpp         |  65 +-
 .../concurrentMarkSweepGeneration.inline.hpp  |   3 +-
 .../concurrentMarkSweepThread.cpp             |   2 +-
 hotspot/src/share/vm/runtime/arguments.cpp    |   9 -
 hotspot/src/share/vm/runtime/globals.hpp      |  13 -
 .../CheckAllocateAndSystemGC.java             |  66 --
 .../SystemGCOnForegroundCollector.java        |  67 --
 .../TestCMSForegroundFlags.java               |  52 --
 9 files changed, 160 insertions(+), 715 deletions(-)
 delete mode 100644 hotspot/test/gc/concurrentMarkSweep/CheckAllocateAndSystemGC.java
 delete mode 100644 hotspot/test/gc/concurrentMarkSweep/SystemGCOnForegroundCollector.java
 delete mode 100644 hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java

diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
index aec716c782a..b94bd52a3a9 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
@@ -192,7 +192,7 @@ ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration(
      FreeBlockDictionary<FreeChunk>::DictionaryChoice dictionaryChoice) :
   CardGeneration(rs, initial_byte_size, level, ct),
   _dilatation_factor(((double)MinChunkSize)/((double)(CollectedHeap::min_fill_size()))),
-  _debug_collection_type(Concurrent_collection_type),
+  _debug_concurrent_cycle(true),
   _did_compact(false)
 {
   HeapWord* bottom = (HeapWord*) _virtual_space.low();
@@ -612,8 +612,6 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
   // Clip CMSBootstrapOccupancy between 0 and 100.
   _bootstrap_occupancy = ((double)CMSBootstrapOccupancy)/(double)100;
 
-  _full_gcs_since_conc_gc = 0;
-
   // Now tell CMS generations the identity of their collector
   ConcurrentMarkSweepGeneration::set_collector(this);
 
@@ -1248,16 +1246,10 @@ bool CMSCollector::shouldConcurrentCollect() {
   }
 
   // For debugging purposes, change the type of collection.
-  // If the rotation is not on the concurrent collection
-  // type, don't start a concurrent collection.
+  // Rotate between concurrent and stop-the-world full GCs.
   NOT_PRODUCT(
-    if (RotateCMSCollectionTypes &&
-        (_cmsGen->debug_collection_type() !=
-          ConcurrentMarkSweepGeneration::Concurrent_collection_type)) {
-      assert(_cmsGen->debug_collection_type() !=
-        ConcurrentMarkSweepGeneration::Unknown_collection_type,
-        "Bad cms collection type");
-      return false;
+    if (RotateCMSCollectionTypes) {
+      return _cmsGen->debug_concurrent_cycle();
     }
   )
 
@@ -1441,16 +1433,6 @@ void CMSCollector::collect(bool   full,
                            size_t size,
                            bool   tlab)
 {
-  if (!UseCMSCollectionPassing && _collectorState > Idling) {
-    // For debugging purposes skip the collection if the state
-    // is not currently idle
-    if (TraceCMSState) {
-      gclog_or_tty->print_cr("Thread " INTPTR_FORMAT " skipped full:%d CMS state %d",
-        Thread::current(), full, _collectorState);
-    }
-    return;
-  }
-
   // The following "if" branch is present for defensive reasons.
   // In the current uses of this interface, it can be replaced with:
   // assert(!GC_locker.is_active(), "Can't be called otherwise");
@@ -1466,7 +1448,6 @@ void CMSCollector::collect(bool   full,
     return;
   }
   acquire_control_and_collect(full, clear_all_soft_refs);
-  _full_gcs_since_conc_gc++;
 }
 
 void CMSCollector::request_full_gc(unsigned int full_gc_count, GCCause::Cause cause) {
@@ -1636,66 +1617,52 @@ void CMSCollector::acquire_control_and_collect(bool full,
     gclog_or_tty->print_cr("    gets control with state %d", _collectorState);
   }
 
-  // Check if we need to do a compaction, or if not, whether
-  // we need to start the mark-sweep from scratch.
-  bool should_compact    = false;
-  bool should_start_over = false;
-  decide_foreground_collection_type(clear_all_soft_refs,
-    &should_compact, &should_start_over);
-
-NOT_PRODUCT(
-  if (RotateCMSCollectionTypes) {
-    if (_cmsGen->debug_collection_type() ==
-        ConcurrentMarkSweepGeneration::MSC_foreground_collection_type) {
-      should_compact = true;
-    } else if (_cmsGen->debug_collection_type() ==
-               ConcurrentMarkSweepGeneration::MS_foreground_collection_type) {
-      should_compact = false;
-    }
+  // Inform cms gen if this was due to partial collection failing.
+  // The CMS gen may use this fact to determine its expansion policy.
+  GenCollectedHeap* gch = GenCollectedHeap::heap();
+  if (gch->incremental_collection_will_fail(false /* don't consult_young */)) {
+    assert(!_cmsGen->incremental_collection_failed(),
+           "Should have been noticed, reacted to and cleared");
+    _cmsGen->set_incremental_collection_failed();
   }
-)
 
   if (first_state > Idling) {
     report_concurrent_mode_interruption();
   }
 
-  set_did_compact(should_compact);
-  if (should_compact) {
-    // If the collection is being acquired from the background
-    // collector, there may be references on the discovered
-    // references lists that have NULL referents (being those
-    // that were concurrently cleared by a mutator) or
-    // that are no longer active (having been enqueued concurrently
-    // by the mutator).
-    // Scrub the list of those references because Mark-Sweep-Compact
-    // code assumes referents are not NULL and that all discovered
-    // Reference objects are active.
-    ref_processor()->clean_up_discovered_references();
+  set_did_compact(true);
 
-    if (first_state > Idling) {
-      save_heap_summary();
-    }
+  // If the collection is being acquired from the background
+  // collector, there may be references on the discovered
+  // references lists that have NULL referents (being those
+  // that were concurrently cleared by a mutator) or
+  // that are no longer active (having been enqueued concurrently
+  // by the mutator).
+  // Scrub the list of those references because Mark-Sweep-Compact
+  // code assumes referents are not NULL and that all discovered
+  // Reference objects are active.
+  ref_processor()->clean_up_discovered_references();
 
-    do_compaction_work(clear_all_soft_refs);
-
-    // Has the GC time limit been exceeded?
-    DefNewGeneration* young_gen = _young_gen->as_DefNewGeneration();
-    size_t max_eden_size = young_gen->max_capacity() -
-                           young_gen->to()->capacity() -
-                           young_gen->from()->capacity();
-    GenCollectedHeap* gch = GenCollectedHeap::heap();
-    GCCause::Cause gc_cause = gch->gc_cause();
-    size_policy()->check_gc_overhead_limit(_young_gen->used(),
-                                           young_gen->eden()->used(),
-                                           _cmsGen->max_capacity(),
-                                           max_eden_size,
-                                           full,
-                                           gc_cause,
-                                           gch->collector_policy());
-  } else {
-    do_mark_sweep_work(clear_all_soft_refs, first_state,
-      should_start_over);
+  if (first_state > Idling) {
+    save_heap_summary();
   }
+
+  do_compaction_work(clear_all_soft_refs);
+
+  // Has the GC time limit been exceeded?
+  DefNewGeneration* young_gen = _young_gen->as_DefNewGeneration();
+  size_t max_eden_size = young_gen->max_capacity() -
+                         young_gen->to()->capacity() -
+                         young_gen->from()->capacity();
+  GCCause::Cause gc_cause = gch->gc_cause();
+  size_policy()->check_gc_overhead_limit(_young_gen->used(),
+                                         young_gen->eden()->used(),
+                                         _cmsGen->max_capacity(),
+                                         max_eden_size,
+                                         full,
+                                         gc_cause,
+                                         gch->collector_policy());
+
   // Reset the expansion cause, now that we just completed
   // a collection cycle.
   clear_expansion_cause();
@@ -1713,68 +1680,6 @@ void CMSCollector::compute_new_size() {
   _cmsGen->compute_new_size_free_list();
 }
 
-// A work method used by foreground collection to determine
-// what type of collection (compacting or not, continuing or fresh)
-// it should do.
-// NOTE: the intent is to make UseCMSCompactAtFullCollection
-// and CMSCompactWhenClearAllSoftRefs the default in the future
-// and do away with the flags after a suitable period.
-void CMSCollector::decide_foreground_collection_type(
-  bool clear_all_soft_refs, bool* should_compact,
-  bool* should_start_over) {
-  // Normally, we'll compact only if the UseCMSCompactAtFullCollection
-  // flag is set, and we have either requested a System.gc() or
-  // the number of full gc's since the last concurrent cycle
-  // has exceeded the threshold set by CMSFullGCsBeforeCompaction,
-  // or if an incremental collection has failed
-  GenCollectedHeap* gch = GenCollectedHeap::heap();
-  assert(gch->collector_policy()->is_generation_policy(),
-         "You may want to check the correctness of the following");
-  // Inform cms gen if this was due to partial collection failing.
-  // The CMS gen may use this fact to determine its expansion policy.
-  if (gch->incremental_collection_will_fail(false /* don't consult_young */)) {
-    assert(!_cmsGen->incremental_collection_failed(),
-           "Should have been noticed, reacted to and cleared");
-    _cmsGen->set_incremental_collection_failed();
-  }
-  *should_compact =
-    UseCMSCompactAtFullCollection &&
-    ((_full_gcs_since_conc_gc >= CMSFullGCsBeforeCompaction) ||
-     GCCause::is_user_requested_gc(gch->gc_cause()) ||
-     gch->incremental_collection_will_fail(true /* consult_young */));
-  *should_start_over = false;
-  if (clear_all_soft_refs && !*should_compact) {
-    // We are about to do a last ditch collection attempt
-    // so it would normally make sense to do a compaction
-    // to reclaim as much space as possible.
-    if (CMSCompactWhenClearAllSoftRefs) {
-      // Default: The rationale is that in this case either
-      // we are past the final marking phase, in which case
-      // we'd have to start over, or so little has been done
-      // that there's little point in saving that work. Compaction
-      // appears to be the sensible choice in either case.
-      *should_compact = true;
-    } else {
-      // We have been asked to clear all soft refs, but not to
-      // compact. Make sure that we aren't past the final checkpoint
-      // phase, for that is where we process soft refs. If we are already
-      // past that phase, we'll need to redo the refs discovery phase and
-      // if necessary clear soft refs that weren't previously
-      // cleared. We do so by remembering the phase in which
-      // we came in, and if we are past the refs processing
-      // phase, we'll choose to just redo the mark-sweep
-      // collection from scratch.
-      if (_collectorState > FinalMarking) {
-        // We are past the refs processing phase;
-        // start over and do a fresh synchronous CMS cycle
-        _collectorState = Resetting; // skip to reset to start new cycle
-        reset(false /* == !asynch */);
-        *should_start_over = true;
-      } // else we can continue a possibly ongoing current cycle
-    }
-  }
-}
-
 // A work method used by the foreground collector to do
 // a mark-sweep-compact.
 void CMSCollector::do_compaction_work(bool clear_all_soft_refs) {
@@ -1787,10 +1692,6 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) {
   gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
 
   GCTraceTime t("CMS:MSC ", PrintGCDetails && Verbose, true, NULL, gc_tracer->gc_id());
-  if (PrintGC && Verbose && !(GCCause::is_user_requested_gc(gch->gc_cause()))) {
-    gclog_or_tty->print_cr("Compact ConcurrentMarkSweepGeneration after %d "
-      "collections passed to foreground collector", _full_gcs_since_conc_gc);
-  }
 
   // Temporarily widen the span of the weak reference processing to
   // the entire heap.
@@ -1852,7 +1753,7 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) {
   _collectorState = Resetting;
   assert(_restart_addr == NULL,
          "Should have been NULL'd before baton was passed");
-  reset(false /* == !asynch */);
+  reset(false /* == !concurrent */);
   _cmsGen->reset_after_compaction();
   _concurrent_cycles_since_last_unload = 0;
 
@@ -1875,40 +1776,6 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) {
   // in the heap's do_collection() method.
 }
 
-// A work method used by the foreground collector to do
-// a mark-sweep, after taking over from a possibly on-going
-// concurrent mark-sweep collection.
-void CMSCollector::do_mark_sweep_work(bool clear_all_soft_refs,
-  CollectorState first_state, bool should_start_over) {
-  if (PrintGC && Verbose) {
-    gclog_or_tty->print_cr("Pass concurrent collection to foreground "
-      "collector with count %d",
-      _full_gcs_since_conc_gc);
-  }
-  switch (_collectorState) {
-    case Idling:
-      if (first_state == Idling || should_start_over) {
-        // The background GC was not active, or should
-        // restarted from scratch;  start the cycle.
-        _collectorState = InitialMarking;
-      }
-      // If first_state was not Idling, then a background GC
-      // was in progress and has now finished.  No need to do it
-      // again.  Leave the state as Idling.
-      break;
-    case Precleaning:
-      // In the foreground case don't do the precleaning since
-      // it is not done concurrently and there is extra work
-      // required.
-      _collectorState = FinalMarking;
-  }
-  collect_in_foreground(clear_all_soft_refs, GenCollectedHeap::heap()->gc_cause());
-
-  // For a mark-sweep, compute_new_size() will be called
-  // in the heap's do_collection() method.
-}
-
-
 void CMSCollector::print_eden_and_survivor_chunk_arrays() {
   DefNewGeneration* dng = _young_gen->as_DefNewGeneration();
   ContiguousSpace* eden_space = dng->eden();
@@ -1989,13 +1856,7 @@ class ReleaseForegroundGC: public StackObj {
   }
 };
 
-// There are separate collect_in_background and collect_in_foreground because of
-// the different locking requirements of the background collector and the
-// foreground collector.  There was originally an attempt to share
-// one "collect" method between the background collector and the foreground
-// collector but the if-then-else required made it cleaner to have
-// separate methods.
-void CMSCollector::collect_in_background(bool clear_all_soft_refs, GCCause::Cause cause) {
+void CMSCollector::collect_in_background(GCCause::Cause cause) {
   assert(Thread::current()->is_ConcurrentGC_thread(),
     "A CMS asynchronous collection is only allowed on a CMS thread.");
 
@@ -2036,7 +1897,7 @@ void CMSCollector::collect_in_background(bool clear_all_soft_refs, GCCause::Caus
   // Used for PrintGC
   size_t prev_used;
   if (PrintGC && Verbose) {
-    prev_used = _cmsGen->used(); // XXXPERM
+    prev_used = _cmsGen->used();
   }
 
   // The change of the collection state is normally done at this level;
@@ -2116,7 +1977,7 @@ void CMSCollector::collect_in_background(bool clear_all_soft_refs, GCCause::Caus
         break;
       case Marking:
         // initial marking in checkpointRootsInitialWork has been completed
-        if (markFromRoots(true)) { // we were successful
+        if (markFromRoots()) { // we were successful
           assert(_collectorState == Precleaning, "Collector state should "
             "have changed");
         } else {
@@ -2146,10 +2007,9 @@ void CMSCollector::collect_in_background(bool clear_all_soft_refs, GCCause::Caus
         break;
       case Sweeping:
         // final marking in checkpointRootsFinal has been completed
-        sweep(true);
+        sweep();
         assert(_collectorState == Resizing, "Collector state change "
           "to Resizing must be done under the free_list_lock");
-        _full_gcs_since_conc_gc = 0;
 
       case Resizing: {
         // Sweeping has been completed...
@@ -2222,12 +2082,6 @@ void CMSCollector::collect_in_background(bool clear_all_soft_refs, GCCause::Caus
   }
 }
 
-void CMSCollector::register_foreground_gc_start(GCCause::Cause cause) {
-  if (!_cms_start_registered) {
-    register_gc_start(cause);
-  }
-}
-
 void CMSCollector::register_gc_start(GCCause::Cause cause) {
   _cms_start_registered = true;
   _gc_timer_cm->register_gc_start();
@@ -2255,120 +2109,6 @@ void CMSCollector::report_heap_summary(GCWhen::Type when) {
   _gc_tracer_cm->report_metaspace_summary(when, _last_metaspace_summary);
 }
 
-void CMSCollector::collect_in_foreground(bool clear_all_soft_refs, GCCause::Cause cause) {
-  assert(_foregroundGCIsActive && !_foregroundGCShouldWait,
-         "Foreground collector should be waiting, not executing");
-  assert(Thread::current()->is_VM_thread(), "A foreground collection"
-    "may only be done by the VM Thread with the world stopped");
-  assert(ConcurrentMarkSweepThread::vm_thread_has_cms_token(),
-         "VM thread should have CMS token");
-
-  // The gc id is created in register_foreground_gc_start if this collection is synchronous
-  const GCId gc_id = _collectorState == InitialMarking ? GCId::peek() : _gc_tracer_cm->gc_id();
-  NOT_PRODUCT(GCTraceTime t("CMS:MS (foreground) ", PrintGCDetails && Verbose,
-    true, NULL, gc_id);)
-  COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact);
-
-  HandleMark hm;  // Discard invalid handles created during verification
-
-  if (VerifyBeforeGC &&
-      GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
-    Universe::verify();
-  }
-
-  // Snapshot the soft reference policy to be used in this collection cycle.
-  ref_processor()->setup_policy(clear_all_soft_refs);
-
-  // Decide if class unloading should be done
-  update_should_unload_classes();
-
-  bool init_mark_was_synchronous = false; // until proven otherwise
-  while (_collectorState != Idling) {
-    if (TraceCMSState) {
-      gclog_or_tty->print_cr("Thread " INTPTR_FORMAT " in CMS state %d",
-        Thread::current(), _collectorState);
-    }
-    switch (_collectorState) {
-      case InitialMarking:
-        register_foreground_gc_start(cause);
-        init_mark_was_synchronous = true;  // fact to be exploited in re-mark
-        checkpointRootsInitial(false);
-        assert(_collectorState == Marking, "Collector state should have changed"
-          " within checkpointRootsInitial()");
-        break;
-      case Marking:
-        // initial marking in checkpointRootsInitialWork has been completed
-        if (VerifyDuringGC &&
-            GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
-          Universe::verify("Verify before initial mark: ");
-        }
-        {
-          bool res = markFromRoots(false);
-          assert(res && _collectorState == FinalMarking, "Collector state should "
-            "have changed");
-          break;
-        }
-      case FinalMarking:
-        if (VerifyDuringGC &&
-            GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
-          Universe::verify("Verify before re-mark: ");
-        }
-        checkpointRootsFinal(false, clear_all_soft_refs,
-                             init_mark_was_synchronous);
-        assert(_collectorState == Sweeping, "Collector state should not "
-          "have changed within checkpointRootsFinal()");
-        break;
-      case Sweeping:
-        // final marking in checkpointRootsFinal has been completed
-        if (VerifyDuringGC &&
-            GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
-          Universe::verify("Verify before sweep: ");
-        }
-        sweep(false);
-        assert(_collectorState == Resizing, "Incorrect state");
-        break;
-      case Resizing: {
-        // Sweeping has been completed; the actual resize in this case
-        // is done separately; nothing to be done in this state.
-        _collectorState = Resetting;
-        break;
-      }
-      case Resetting:
-        // The heap has been resized.
-        if (VerifyDuringGC &&
-            GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
-          Universe::verify("Verify before reset: ");
-        }
-        save_heap_summary();
-        reset(false);
-        assert(_collectorState == Idling, "Collector state should "
-          "have changed");
-        break;
-      case Precleaning:
-      case AbortablePreclean:
-        // Elide the preclean phase
-        _collectorState = FinalMarking;
-        break;
-      default:
-        ShouldNotReachHere();
-    }
-    if (TraceCMSState) {
-      gclog_or_tty->print_cr("  Thread " INTPTR_FORMAT " done - next CMS state %d",
-        Thread::current(), _collectorState);
-    }
-  }
-
-  if (VerifyAfterGC &&
-      GenCollectedHeap::heap()->total_collections() >= VerifyGCStartAt) {
-    Universe::verify();
-  }
-  if (TraceCMSState) {
-    gclog_or_tty->print_cr("CMS Thread " INTPTR_FORMAT
-      " exiting collection CMS state %d",
-      Thread::current(), _collectorState);
-  }
-}
-
 bool CMSCollector::waitForForegroundGC() {
   bool res = false;
   assert(ConcurrentMarkSweepThread::cms_thread_has_cms_token(),
@@ -3345,7 +3085,7 @@ class CMSParInitialMarkTask: public CMSParMarkTask {
 // Checkpoint the roots into this generation from outside
 // this generation. [Note this initial checkpoint need only
 // be approximate -- we'll do a catch up phase subsequently.]
-void CMSCollector::checkpointRootsInitial(bool asynch) {
+void CMSCollector::checkpointRootsInitial() {
   assert(_collectorState == InitialMarking, "Wrong collector state");
   check_correct_thread_executing();
   TraceCMSMemoryManagerStats tms(_collectorState,GenCollectedHeap::heap()->gc_cause());
@@ -3356,32 +3096,19 @@ void CMSCollector::checkpointRootsInitial(bool asynch) {
   ReferenceProcessor* rp = ref_processor();
   SpecializationStats::clear();
   assert(_restart_addr == NULL, "Control point invariant");
-  if (asynch) {
+  {
     // acquire locks for subsequent manipulations
     MutexLockerEx x(bitMapLock(),
                     Mutex::_no_safepoint_check_flag);
-    checkpointRootsInitialWork(asynch);
+    checkpointRootsInitialWork();
     // enable ("weak") refs discovery
     rp->enable_discovery(true /*verify_disabled*/, true /*check_no_refs*/);
     _collectorState = Marking;
-  } else {
-    // (Weak) Refs discovery: this is controlled from genCollectedHeap::do_collection
-    // which recognizes if we are a CMS generation, and doesn't try to turn on
-    // discovery; verify that they aren't meddling.
-    assert(!rp->discovery_is_atomic(),
-           "incorrect setting of discovery predicate");
-    assert(!rp->discovery_enabled(), "genCollectedHeap shouldn't control "
-           "ref discovery for this generation kind");
-    // already have locks
-    checkpointRootsInitialWork(asynch);
-    // now enable ("weak") refs discovery
-    rp->enable_discovery(true /*verify_disabled*/, false /*verify_no_refs*/);
-    _collectorState = Marking;
   }
   SpecializationStats::print();
 }
 
-void CMSCollector::checkpointRootsInitialWork(bool asynch) {
+void CMSCollector::checkpointRootsInitialWork() {
   assert(SafepointSynchronize::is_at_safepoint(), "world should be stopped");
   assert(_collectorState == InitialMarking, "just checking");
 
@@ -3483,9 +3210,9 @@ void CMSCollector::checkpointRootsInitialWork(bool asynch) {
   verify_overflow_empty();
 }
 
-bool CMSCollector::markFromRoots(bool asynch) {
+bool CMSCollector::markFromRoots() {
   // we might be tempted to assert that:
-  // assert(asynch == !SafepointSynchronize::is_at_safepoint(),
+  // assert(!SafepointSynchronize::is_at_safepoint(),
   //        "inconsistent argument?");
   // However that wouldn't be right, because it's possible that
   // a safepoint is indeed in progress as a younger generation
@@ -3494,37 +3221,28 @@ bool CMSCollector::markFromRoots(bool asynch) {
   check_correct_thread_executing();
   verify_overflow_empty();
 
-  bool res;
-  if (asynch) {
-    // Weak ref discovery note: We may be discovering weak
-    // refs in this generation concurrent (but interleaved) with
-    // weak ref discovery by a younger generation collector.
+  // Weak ref discovery note: We may be discovering weak
+  // refs in this generation concurrent (but interleaved) with
+  // weak ref discovery by a younger generation collector.
 
-    CMSTokenSyncWithLocks ts(true, bitMapLock());
-    TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
-    CMSPhaseAccounting pa(this, "mark", _gc_tracer_cm->gc_id(), !PrintGCDetails);
-    res = markFromRootsWork(asynch);
-    if (res) {
-      _collectorState = Precleaning;
-    } else { // We failed and a foreground collection wants to take over
-      assert(_foregroundGCIsActive, "internal state inconsistency");
-      assert(_restart_addr == NULL,  "foreground will restart from scratch");
-      if (PrintGCDetails) {
-        gclog_or_tty->print_cr("bailing out to foreground collection");
-      }
+  CMSTokenSyncWithLocks ts(true, bitMapLock());
+  TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
+  CMSPhaseAccounting pa(this, "mark", _gc_tracer_cm->gc_id(), !PrintGCDetails);
+  bool res = markFromRootsWork();
+  if (res) {
+    _collectorState = Precleaning;
+  } else { // We failed and a foreground collection wants to take over
+    assert(_foregroundGCIsActive, "internal state inconsistency");
+    assert(_restart_addr == NULL,  "foreground will restart from scratch");
+    if (PrintGCDetails) {
+      gclog_or_tty->print_cr("bailing out to foreground collection");
     }
-  } else {
-    assert(SafepointSynchronize::is_at_safepoint(),
-           "inconsistent with asynch == false");
-    // already have locks
-    res = markFromRootsWork(asynch);
-    _collectorState = FinalMarking;
   }
   verify_overflow_empty();
   return res;
 }
 
-bool CMSCollector::markFromRootsWork(bool asynch) {
+bool CMSCollector::markFromRootsWork() {
   // iterate over marked bits in bit map, doing a full scan and mark
   // from these roots using the following algorithm:
   // . if oop is to the right of the current scan pointer,
@@ -3549,9 +3267,9 @@ bool CMSCollector::markFromRootsWork(bool asynch) {
   verify_overflow_empty();
   bool result = false;
   if (CMSConcurrentMTEnabled && ConcGCThreads > 0) {
-    result = do_marking_mt(asynch);
+    result = do_marking_mt();
   } else {
-    result = do_marking_st(asynch);
+    result = do_marking_st();
   }
   return result;
 }
@@ -3591,7 +3309,6 @@ class CMSConcMarkingTerminatorTerminator: public TerminatorTerminator {
 class CMSConcMarkingTask: public YieldingFlexibleGangTask {
   CMSCollector* _collector;
   int           _n_workers;                  // requested/desired # workers
-  bool          _asynch;
   bool          _result;
   CompactibleFreeListSpace*  _cms_space;
   char          _pad_front[64];   // padding to ...
@@ -3612,13 +3329,12 @@ class CMSConcMarkingTask: public YieldingFlexibleGangTask {
  public:
   CMSConcMarkingTask(CMSCollector* collector,
                  CompactibleFreeListSpace* cms_space,
-                 bool asynch,
                  YieldingFlexibleWorkGang* workers,
                  OopTaskQueueSet* task_queues):
     YieldingFlexibleGangTask("Concurrent marking done multi-threaded"),
     _collector(collector),
     _cms_space(cms_space),
-    _asynch(asynch), _n_workers(0), _result(true),
+    _n_workers(0), _result(true),
     _task_queues(task_queues),
     _term(_n_workers, task_queues, _collector),
     _bit_map_lock(collector->bitMapLock())
@@ -3645,8 +3361,7 @@ class CMSConcMarkingTask: public YieldingFlexibleGangTask {
   void work(uint worker_id);
   bool should_yield() {
     return    ConcurrentMarkSweepThread::should_yield()
-           && !_collector->foregroundGCIsActive()
-           && _asynch;
+           && !_collector->foregroundGCIsActive();
   }
 
   virtual void coordinator_yield();  // stuff done by coordinator
@@ -3878,8 +3593,7 @@ void CMSConcMarkingTask::do_scan_and_mark(int i, CompactibleFreeListSpace* sp) {
         Par_MarkFromRootsClosure cl(this, _collector, my_span,
                                     &_collector->_markBitMap,
                                     work_queue(i),
-                                    &_collector->_markStack,
-                                    _asynch);
+                                    &_collector->_markStack);
         _collector->_markBitMap.iterate(&cl, my_span.start(), my_span.end());
       } // else nothing to do for this task
     }   // else nothing to do for this task
@@ -4084,7 +3798,7 @@ void CMSConcMarkingTask::coordinator_yield() {
   _collector->startTimer();
 }
 
-bool CMSCollector::do_marking_mt(bool asynch) {
+bool CMSCollector::do_marking_mt() {
   assert(ConcGCThreads > 0 && conc_workers() != NULL, "precondition");
   int num_workers = AdaptiveSizePolicy::calc_active_conc_workers(
                                        conc_workers()->total_workers(),
@@ -4096,7 +3810,6 @@ bool CMSCollector::do_marking_mt(bool asynch) {
 
   CMSConcMarkingTask tsk(this,
                          cms_space,
-                         asynch,
                          conc_workers(),
                          task_queues());
 
@@ -4125,7 +3838,7 @@ bool CMSCollector::do_marking_mt(bool asynch) {
     // If _restart_addr is non-NULL, a marking stack overflow
     // occurred; we need to do a fresh marking iteration from the
     // indicated restart address.
-    if (_foregroundGCIsActive && asynch) {
+    if (_foregroundGCIsActive) {
       // We may be running into repeated stack overflows, having
       // reached the limit of the stack size, while making very
       // slow forward progress. It may be best to bail out and
@@ -4154,14 +3867,14 @@ bool CMSCollector::do_marking_mt(bool asynch) {
   return true;
 }
 
-bool CMSCollector::do_marking_st(bool asynch) {
+bool CMSCollector::do_marking_st() {
   ResourceMark rm;
   HandleMark   hm;
 
   // Temporarily make refs discovery single threaded (non-MT)
   ReferenceProcessorMTDiscoveryMutator rp_mut_discovery(ref_processor(), false);
   MarkFromRootsClosure markFromRootsClosure(this, _span, &_markBitMap,
-    &_markStack, CMSYield && asynch);
+    &_markStack, CMSYield);
   // the last argument to iterate indicates whether the iteration
   // should be incremental with periodic yields.
   _markBitMap.iterate(&markFromRootsClosure);
@@ -4169,7 +3882,7 @@ bool CMSCollector::do_marking_st(bool asynch) {
   // occurred; we need to do a fresh iteration from the
   // indicated restart address.
   while (_restart_addr != NULL) {
-    if (_foregroundGCIsActive && asynch) {
+    if (_foregroundGCIsActive) {
       // We may be running into repeated stack overflows, having
       // reached the limit of the stack size, while making very
       // slow forward progress. It may be best to bail out and
@@ -4703,8 +4416,7 @@ void CMSCollector::preclean_klasses(MarkRefsIntoAndScanClosure* cl, Mutex* freel
   verify_overflow_empty();
 }
 
-void CMSCollector::checkpointRootsFinal(bool asynch,
-  bool clear_all_soft_refs, bool init_mark_was_synchronous) {
+void CMSCollector::checkpointRootsFinal() {
   assert(_collectorState == FinalMarking, "incorrect state transition?");
   check_correct_thread_executing();
   // world is stopped at this checkpoint
@@ -4721,7 +4433,7 @@ void CMSCollector::checkpointRootsFinal(bool asynch,
                         _young_gen->used() / K,
                         _young_gen->capacity() / K);
   }
-  if (asynch) {
+  {
     if (CMSScavengeBeforeRemark) {
       GenCollectedHeap* gch = GenCollectedHeap::heap();
       // Temporarily set flag to false, GCH->do_collection will
@@ -4742,21 +4454,14 @@ void CMSCollector::checkpointRootsFinal(bool asynch,
     FreelistLocker x(this);
     MutexLockerEx y(bitMapLock(),
                     Mutex::_no_safepoint_check_flag);
-    assert(!init_mark_was_synchronous, "but that's impossible!");
-    checkpointRootsFinalWork(asynch, clear_all_soft_refs, false);
-  } else {
-    // already have all the locks
-    checkpointRootsFinalWork(asynch, clear_all_soft_refs,
-                             init_mark_was_synchronous);
+    checkpointRootsFinalWork();
   }
   verify_work_stacks_empty();
   verify_overflow_empty();
   SpecializationStats::print();
 }
 
-void CMSCollector::checkpointRootsFinalWork(bool asynch,
-  bool clear_all_soft_refs, bool init_mark_was_synchronous) {
-
+void CMSCollector::checkpointRootsFinalWork() {
   NOT_PRODUCT(GCTraceTime tr("checkpointRootsFinalWork", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());)
 
   assert(haveFreelistLocks(), "must have free list locks");
@@ -4773,60 +4478,54 @@ void CMSCollector::checkpointRootsFinalWork(bool asynch,
   assert(haveFreelistLocks(), "must have free list locks");
   assert_lock_strong(bitMapLock());
 
-  if (!init_mark_was_synchronous) {
-    // We might assume that we need not fill TLAB's when
-    // CMSScavengeBeforeRemark is set, because we may have just done
-    // a scavenge which would have filled all TLAB's -- and besides
-    // Eden would be empty. This however may not always be the case --
-    // for instance although we asked for a scavenge, it may not have
-    // happened because of a JNI critical section. We probably need
-    // a policy for deciding whether we can in that case wait until
-    // the critical section releases and then do the remark following
-    // the scavenge, and skip it here. In the absence of that policy,
-    // or of an indication of whether the scavenge did indeed occur,
-    // we cannot rely on TLAB's having been filled and must do
-    // so here just in case a scavenge did not happen.
-    gch->ensure_parsability(false);  // fill TLAB's, but no need to retire them
-    // Update the saved marks which may affect the root scans.
-    gch->save_marks();
+  // We might assume that we need not fill TLAB's when
+  // CMSScavengeBeforeRemark is set, because we may have just done
+  // a scavenge which would have filled all TLAB's -- and besides
+  // Eden would be empty. This however may not always be the case --
+  // for instance although we asked for a scavenge, it may not have
+  // happened because of a JNI critical section. We probably need
+  // a policy for deciding whether we can in that case wait until
+  // the critical section releases and then do the remark following
+  // the scavenge, and skip it here. In the absence of that policy,
+  // or of an indication of whether the scavenge did indeed occur,
+  // we cannot rely on TLAB's having been filled and must do
+  // so here just in case a scavenge did not happen.
+  gch->ensure_parsability(false);  // fill TLAB's, but no need to retire them
+  // Update the saved marks which may affect the root scans.
+  gch->save_marks();
 
-    if (CMSPrintEdenSurvivorChunks) {
-      print_eden_and_survivor_chunk_arrays();
+  if (CMSPrintEdenSurvivorChunks) {
+    print_eden_and_survivor_chunk_arrays();
+  }
+
+  {
+    COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;)
+
+    // Note on the role of the mod union table:
+    // Since the marker in "markFromRoots" marks concurrently with
+    // mutators, it is possible for some reachable objects not to have been
+    // scanned. For instance, an only reference to an object A was
+    // placed in object B after the marker scanned B. Unless B is rescanned,
+    // A would be collected. Such updates to references in marked objects
+    // are detected via the mod union table which is the set of all cards
+    // dirtied since the first checkpoint in this GC cycle and prior to
+    // the most recent young generation GC, minus those cleaned up by the
+    // concurrent precleaning.
+    if (CMSParallelRemarkEnabled && CollectedHeap::use_parallel_gc_threads()) {
+      GCTraceTime t("Rescan (parallel) ", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
+      do_remark_parallel();
+    } else {
+      GCTraceTime t("Rescan (non-parallel) ", PrintGCDetails, false,
+                  _gc_timer_cm, _gc_tracer_cm->gc_id());
+      do_remark_non_parallel();
     }
-
-    {
-      COMPILER2_PRESENT(DerivedPointerTableDeactivate dpt_deact;)
-
-      // Note on the role of the mod union table:
-      // Since the marker in "markFromRoots" marks concurrently with
-      // mutators, it is possible for some reachable objects not to have been
-      // scanned. For instance, an only reference to an object A was
-      // placed in object B after the marker scanned B. Unless B is rescanned,
-      // A would be collected. Such updates to references in marked objects
-      // are detected via the mod union table which is the set of all cards
-      // dirtied since the first checkpoint in this GC cycle and prior to
-      // the most recent young generation GC, minus those cleaned up by the
-      // concurrent precleaning.
-      if (CMSParallelRemarkEnabled && CollectedHeap::use_parallel_gc_threads()) {
-        GCTraceTime t("Rescan (parallel) ", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());
-        do_remark_parallel();
-      } else {
-        GCTraceTime t("Rescan (non-parallel) ", PrintGCDetails, false,
-                    _gc_timer_cm, _gc_tracer_cm->gc_id());
-        do_remark_non_parallel();
-      }
-    }
-  } else {
-    assert(!asynch, "Can't have init_mark_was_synchronous in asynch mode");
-    // The initial mark was stop-world, so there's no rescanning to
-    // do; go straight on to the next step below.
   }
   verify_work_stacks_empty();
   verify_overflow_empty();
 
   {
     NOT_PRODUCT(GCTraceTime ts("refProcessingWork", PrintGCDetails, false, _gc_timer_cm, _gc_tracer_cm->gc_id());)
-    refProcessingWork(asynch, clear_all_soft_refs);
+    refProcessingWork();
   }
   verify_work_stacks_empty();
   verify_overflow_empty();
@@ -5872,8 +5571,7 @@ void CMSRefProcTaskExecutor::execute(EnqueueTask& task)
   workers->run_task(&enq_task);
 }
 
-void CMSCollector::refProcessingWork(bool asynch, bool clear_all_soft_refs) {
-
+void CMSCollector::refProcessingWork() {
   ResourceMark rm;
   HandleMark   hm;
 
@@ -5881,7 +5579,7 @@ void CMSCollector::refProcessingWork(bool asynch, bool clear_all_soft_refs) {
   assert(rp->span().equals(_span), "Spans should be equal");
   assert(!rp->enqueuing_is_done(), "Enqueuing should not be complete");
   // Process weak references.
-  rp->setup_policy(clear_all_soft_refs);
+  rp->setup_policy(false);
   verify_work_stacks_empty();
 
   CMSKeepAliveClosure cmsKeepAliveClosure(this, _span, &_markBitMap,
@@ -6005,7 +5703,7 @@ void CMSCollector::check_correct_thread_executing() {
 }
 #endif
 
-void CMSCollector::sweep(bool asynch) {
+void CMSCollector::sweep() {
   assert(_collectorState == Sweeping, "just checking");
   check_correct_thread_executing();
   verify_work_stacks_empty();
@@ -6019,14 +5717,14 @@ void CMSCollector::sweep(bool asynch) {
   assert(!_intra_sweep_timer.is_active(), "Should not be active");
   _intra_sweep_timer.reset();
   _intra_sweep_timer.start();
-  if (asynch) {
+  {
     TraceCPUTime tcpu(PrintGCDetails, true, gclog_or_tty);
     CMSPhaseAccounting pa(this, "sweep", _gc_tracer_cm->gc_id(), !PrintGCDetails);
     // First sweep the old gen
     {
       CMSTokenSyncWithLocks ts(true, _cmsGen->freelistLock(),
                                bitMapLock());
-      sweepWork(_cmsGen, asynch);
+      sweepWork(_cmsGen);
     }
 
     // Update Universe::_heap_*_at_gc figures.
@@ -6040,13 +5738,6 @@ void CMSCollector::sweep(bool asynch) {
       Universe::update_heap_info_at_gc();
       _collectorState = Resizing;
     }
-  } else {
-    // already have needed locks
-    sweepWork(_cmsGen,  asynch);
-    // Update heap occupancy information which is used as
-    // input to soft ref clearing policy at the next gc.
-    Universe::update_heap_info_at_gc();
-    _collectorState = Resizing;
   }
   verify_work_stacks_empty();
   verify_overflow_empty();
@@ -6141,18 +5832,16 @@ void ConcurrentMarkSweepGeneration::update_gc_stats(int current_level,
 
 void ConcurrentMarkSweepGeneration::rotate_debug_collection_type() {
   if (PrintGCDetails && Verbose) {
-    gclog_or_tty->print("Rotate from %d ", _debug_collection_type);
-  }
-  _debug_collection_type = (CollectionTypes) (_debug_collection_type + 1);
-  _debug_collection_type =
-    (CollectionTypes) (_debug_collection_type % Unknown_collection_type);
-  if (PrintGCDetails && Verbose) {
-    gclog_or_tty->print_cr("to %d ", _debug_collection_type);
+    if (_debug_concurrent_cycle) {
+      gclog_or_tty->print_cr("Rotate from concurrent to STW collections");
+    } else {
+      gclog_or_tty->print_cr("Rotate from STW to concurrent collections");
+    }
   }
+  _debug_concurrent_cycle = !_debug_concurrent_cycle;
 }
 
-void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen,
-  bool asynch) {
+void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen) {
   // We iterate over the space(s) underlying this generation,
   // checking the mark bit map to see if the bits corresponding
   // to specific blocks are marked or not. Blocks that are
@@ -6180,9 +5869,7 @@ void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen,
 
   // check that we hold the requisite locks
   assert(have_cms_token(), "Should hold cms token");
-  assert(   (asynch && ConcurrentMarkSweepThread::cms_thread_has_cms_token())
-         || (!asynch && ConcurrentMarkSweepThread::vm_thread_has_cms_token()),
-        "Should possess CMS token to sweep");
+  assert(ConcurrentMarkSweepThread::cms_thread_has_cms_token(), "Should possess CMS token to sweep");
   assert_lock_strong(gen->freelistLock());
   assert_lock_strong(bitMapLock());
 
@@ -6194,8 +5881,7 @@ void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen,
   gen->setNearLargestChunk();
 
   {
-    SweepClosure sweepClosure(this, gen, &_markBitMap,
-                            CMSYield && asynch);
+    SweepClosure sweepClosure(this, gen, &_markBitMap, CMSYield);
     gen->cmsSpace()->blk_iterate_careful(&sweepClosure);
     // We need to free-up/coalesce garbage/blocks from a
     // co-terminal free run. This is done in the SweepClosure
@@ -6213,8 +5899,8 @@ void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen,
 
 // Reset CMS data structures (for now just the marking bit map)
 // preparatory for the next cycle.
-void CMSCollector::reset(bool asynch) {
-  if (asynch) {
+void CMSCollector::reset(bool concurrent) {
+  if (concurrent) {
     CMSTokenSyncWithLocks ts(true, bitMapLock());
 
     // If the state is not "Resetting", the foreground  thread
@@ -6293,7 +5979,7 @@ void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) {
   switch (op) {
     case CMS_op_checkpointRootsInitial: {
       SvcGCMarker sgcm(SvcGCMarker::OTHER);
-      checkpointRootsInitial(true);       // asynch
+      checkpointRootsInitial();
       if (PrintGC) {
         _cmsGen->printOccupancy("initial-mark");
       }
@@ -6301,9 +5987,7 @@ void CMSCollector::do_CMS_operation(CMS_op_type op, GCCause::Cause gc_cause) {
     }
     case CMS_op_checkpointRootsFinal: {
       SvcGCMarker sgcm(SvcGCMarker::OTHER);
-      checkpointRootsFinal(true,    // asynch
-                           false,   // !clear_all_soft_refs
-                           false);  // !init_mark_was_synchronous
+      checkpointRootsFinal();
       if (PrintGC) {
         _cmsGen->printOccupancy("remark");
       }
@@ -7193,8 +6877,7 @@ Par_MarkFromRootsClosure::Par_MarkFromRootsClosure(CMSConcMarkingTask* task,
                        CMSCollector* collector, MemRegion span,
                        CMSBitMap* bit_map,
                        OopTaskQueue* work_queue,
-                       CMSMarkStack*  overflow_stack,
-                       bool should_yield):
+                       CMSMarkStack*  overflow_stack):
   _collector(collector),
   _whole_span(collector->_span),
   _span(span),
@@ -7202,7 +6885,6 @@ Par_MarkFromRootsClosure::Par_MarkFromRootsClosure(CMSConcMarkingTask* task,
   _mut(&collector->_modUnionTable),
   _work_queue(work_queue),
   _overflow_stack(overflow_stack),
-  _yield(should_yield),
   _skip_bits(0),
   _task(task)
 {
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
index e46c01e400c..aa117dec415 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
@@ -608,7 +608,6 @@ class CMSCollector: public CHeapObj<mtGC> {
   GCHeapSummary _last_heap_summary;
   MetaspaceSummary _last_metaspace_summary;
 
-  void register_foreground_gc_start(GCCause::Cause cause);
   void register_gc_start(GCCause::Cause cause);
   void register_gc_end();
   void save_heap_summary();
@@ -695,8 +694,6 @@ class CMSCollector: public CHeapObj<mtGC> {
   int    _numYields;
   size_t _numDirtyCards;
   size_t _sweep_count;
-  // Number of full gc's since the last concurrent gc.
-  uint   _full_gcs_since_conc_gc;
 
   // Occupancy used for bootstrapping stats
   double _bootstrap_occupancy;
@@ -760,14 +757,14 @@ class CMSCollector: public CHeapObj<mtGC> {
   NOT_PRODUCT(bool par_simulate_overflow();)   // MT version
 
   // CMS work methods
-  void checkpointRootsInitialWork(bool asynch); // Initial checkpoint work
+  void checkpointRootsInitialWork(); // Initial checkpoint work
 
   // A return value of false indicates failure due to stack overflow
-  bool markFromRootsWork(bool asynch);  // Concurrent marking work
+  bool markFromRootsWork();  // Concurrent marking work
 
  public:   // FIX ME!!! only for testing
-  bool do_marking_st(bool asynch);      // Single-threaded marking
-  bool do_marking_mt(bool asynch);      // Multi-threaded  marking
+  bool do_marking_st();      // Single-threaded marking
+  bool do_marking_mt();      // Multi-threaded  marking
 
  private:
 
@@ -788,20 +785,19 @@ class CMSCollector: public CHeapObj<mtGC> {
   void reset_survivor_plab_arrays();
 
   // Final (second) checkpoint work
-  void checkpointRootsFinalWork(bool asynch, bool clear_all_soft_refs,
-                                bool init_mark_was_synchronous);
+  void checkpointRootsFinalWork();
   // Work routine for parallel version of remark
   void do_remark_parallel();
   // Work routine for non-parallel version of remark
   void do_remark_non_parallel();
   // Reference processing work routine (during second checkpoint)
-  void refProcessingWork(bool asynch, bool clear_all_soft_refs);
+  void refProcessingWork();
 
   // Concurrent sweeping work
-  void sweepWork(ConcurrentMarkSweepGeneration* gen, bool asynch);
+  void sweepWork(ConcurrentMarkSweepGeneration* gen);
 
   // (Concurrent) resetting of support data structures
-  void reset(bool asynch);
+  void reset(bool concurrent);
 
   // Clear _expansion_cause fields of constituent generations
   void clear_expansion_cause();
@@ -810,22 +806,10 @@ class CMSCollector: public CHeapObj<mtGC> {
   // used regions of each generation to limit the extent of sweep
   void save_sweep_limits();
 
-  // A work method used by foreground collection to determine
-  // what type of collection (compacting or not, continuing or fresh)
-  // it should do.
-  void decide_foreground_collection_type(bool clear_all_soft_refs,
-    bool* should_compact, bool* should_start_over);
-
   // A work method used by the foreground collector to do
   // a mark-sweep-compact.
   void do_compaction_work(bool clear_all_soft_refs);
 
-  // A work method used by the foreground collector to do
-  // a mark-sweep, after taking over from a possibly on-going
-  // concurrent mark-sweep collection.
-  void do_mark_sweep_work(bool clear_all_soft_refs,
-    CollectorState first_state, bool should_start_over);
-
   // Work methods for reporting concurrent mode interruption or failure
   bool is_external_interruption();
   void report_concurrent_mode_interruption();
@@ -868,15 +852,13 @@ class CMSCollector: public CHeapObj<mtGC> {
   // Locking checks
   NOT_PRODUCT(static bool have_cms_token();)
 
-  // XXXPERM bool should_collect(bool full, size_t size, bool tlab);
   bool shouldConcurrentCollect();
 
   void collect(bool   full,
                bool   clear_all_soft_refs,
                size_t size,
                bool   tlab);
-  void collect_in_background(bool clear_all_soft_refs, GCCause::Cause cause);
-  void collect_in_foreground(bool clear_all_soft_refs, GCCause::Cause cause);
+  void collect_in_background(GCCause::Cause cause);
 
   // In support of ExplicitGCInvokesConcurrent
   static void request_full_gc(unsigned int full_gc_count, GCCause::Cause cause);
@@ -928,18 +910,16 @@ class CMSCollector: public CHeapObj<mtGC> {
   void directAllocated(HeapWord* start, size_t size);
 
   // Main CMS steps and related support
-  void checkpointRootsInitial(bool asynch);
-  bool markFromRoots(bool asynch);  // a return value of false indicates failure
-                                    // due to stack overflow
+  void checkpointRootsInitial();
+  bool markFromRoots();  // a return value of false indicates failure
+                         // due to stack overflow
   void preclean();
-  void checkpointRootsFinal(bool asynch, bool clear_all_soft_refs,
-                            bool init_mark_was_synchronous);
-  void sweep(bool asynch);
+  void checkpointRootsFinal();
+  void sweep();
 
   // Check that the currently executing thread is the expected
   // one (foreground collector or background collector).
   static void check_correct_thread_executing() PRODUCT_RETURN;
-  // XXXPERM void print_statistics()           PRODUCT_RETURN;
 
   bool is_cms_reachable(HeapWord* addr);
 
@@ -1060,14 +1040,7 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
   // In support of MinChunkSize being larger than min object size
   const double _dilatation_factor;
 
-  enum CollectionTypes {
-    Concurrent_collection_type          = 0,
-    MS_foreground_collection_type       = 1,
-    MSC_foreground_collection_type      = 2,
-    Unknown_collection_type             = 3
-  };
-
-  CollectionTypes _debug_collection_type;
+  bool _debug_concurrent_cycle;
 
   // True if a compacting collection was done.
   bool _did_compact;
@@ -1152,7 +1125,7 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
   // hack to allow the collection of the younger gen first if the flag is
   // set.
   virtual bool full_collects_younger_generations() const {
-    return UseCMSCompactAtFullCollection && !ScavengeBeforeFullGC;
+    return !ScavengeBeforeFullGC;
   }
 
   void space_iterate(SpaceClosure* blk, bool usedOnly = false);
@@ -1296,7 +1269,7 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
   // collection.
   void compute_new_size_free_list();
 
-  CollectionTypes debug_collection_type() { return _debug_collection_type; }
+  bool debug_concurrent_cycle() { return _debug_concurrent_cycle; }
   void rotate_debug_collection_type();
 };
 
@@ -1344,7 +1317,6 @@ class Par_MarkFromRootsClosure: public BitMapClosure {
   CMSBitMap*     _mut;
   OopTaskQueue*  _work_queue;
   CMSMarkStack*  _overflow_stack;
-  bool           _yield;
   int            _skip_bits;
   HeapWord*      _finger;
   HeapWord*      _threshold;
@@ -1354,8 +1326,7 @@ class Par_MarkFromRootsClosure: public BitMapClosure {
                        MemRegion span,
                        CMSBitMap* bit_map,
                        OopTaskQueue* work_queue,
-                       CMSMarkStack*  overflow_stack,
-                       bool should_yield);
+                       CMSMarkStack*  overflow_stack);
   bool do_bit(size_t offset);
   inline void do_yield_check();
 
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp
index 53eb0a80976..b80830bf234 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp
@@ -398,8 +398,7 @@ inline void MarkFromRootsClosure::do_yield_check() {
 
 inline void Par_MarkFromRootsClosure::do_yield_check() {
   if (ConcurrentMarkSweepThread::should_yield() &&
-      !_collector->foregroundGCIsActive() &&
-      _yield) {
+      !_collector->foregroundGCIsActive()) {
     do_yield_work();
   }
 }
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
index 8e31f5610d2..b588cce717e 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
@@ -134,7 +134,7 @@ void ConcurrentMarkSweepThread::run() {
     if (_should_terminate) break;
     GCCause::Cause cause = _collector->_full_gc_requested ?
       _collector->_full_gc_cause : GCCause::_cms_concurrent_mark;
-    _collector->collect_in_background(false, cause);
+    _collector->collect_in_background(cause);
   }
   assert(_should_terminate, "just checking");
   // Check that the state of any protocol for synchronization
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index d06ccf47e2d..f9adba7985a 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -2202,15 +2202,6 @@ void Arguments::check_deprecated_gc_flags() {
     warning("DefaultMaxRAMFraction is deprecated and will likely be removed in a future release. "
         "Use MaxRAMFraction instead.");
   }
-  if (FLAG_IS_CMDLINE(UseCMSCompactAtFullCollection)) {
-    warning("UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release.");
-  }
-  if (FLAG_IS_CMDLINE(CMSFullGCsBeforeCompaction)) {
-    warning("CMSFullGCsBeforeCompaction is deprecated and will likely be removed in a future release.");
-  }
-  if (FLAG_IS_CMDLINE(UseCMSCollectionPassing)) {
-    warning("UseCMSCollectionPassing is deprecated and will likely be removed in a future release.");
-  }
 }
 
 // Check stack pages settings
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index 580d3867f59..3d296d09162 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -1529,9 +1529,6 @@ class CommandLineFlags {
   product(bool, UseCMSBestFit, true,                                        \
           "Use CMS best fit allocation strategy")                           \
                                                                             \
-  product(bool, UseCMSCollectionPassing, true,                              \
-          "Use passing of collection from background to foreground")        \
-                                                                            \
   product(bool, UseParNewGC, false,                                         \
           "Use parallel threads in the new generation")                     \
                                                                             \
@@ -1707,16 +1704,6 @@ class CommandLineFlags {
           "When CMS class unloading is enabled, the maximum CMS cycle "     \
           "count for which classes may not be unloaded")                    \
                                                                             \
-  product(bool, CMSCompactWhenClearAllSoftRefs, true,                       \
-          "Compact when asked to collect CMS gen with "                     \
-          "clear_all_soft_refs()")                                          \
-                                                                            \
-  product(bool, UseCMSCompactAtFullCollection, true,                        \
-          "Use Mark-Sweep-Compact algorithm at full collections")           \
-                                                                            \
-  product(uintx, CMSFullGCsBeforeCompaction, 0,                             \
-          "Number of CMS full collection done before compaction if > 0")    \
-                                                                            \
   develop(intx, CMSDictionaryChoice, 0,                                     \
           "Use BinaryTreeDictionary as default in the CMS generation")      \
                                                                             \
diff --git a/hotspot/test/gc/concurrentMarkSweep/CheckAllocateAndSystemGC.java b/hotspot/test/gc/concurrentMarkSweep/CheckAllocateAndSystemGC.java
deleted file mode 100644
index e548539c0e0..00000000000
--- a/hotspot/test/gc/concurrentMarkSweep/CheckAllocateAndSystemGC.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2013, 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 CheckAllocateAndSystemGC
- * @summary CMS: assert(used() == used_after_gc && used_after_gc <= capacity()) failed: used: 0 used_after_gc: 292080 capacity: 1431699456
- * @bug 8013032
- * @key gc
- * @key regression
- * @library /testlibrary
- * @run main/othervm CheckAllocateAndSystemGC
- * @author jon.masamitsu@oracle.com
- */
-
-import com.oracle.java.testlibrary.*;
-
-public class CheckAllocateAndSystemGC {
-  public static void main(String args[]) throws Exception {
-
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-      "-showversion",
-      "-XX:+UseConcMarkSweepGC",
-      "-Xmn4m",
-      "-XX:MaxTenuringThreshold=1",
-      "-XX:-UseCMSCompactAtFullCollection",
-      "CheckAllocateAndSystemGC$AllocateAndSystemGC"
-      );
-
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-
-    output.shouldNotContain("error");
-
-    output.shouldHaveExitValue(0);
-  }
-  static class AllocateAndSystemGC {
-    public static void main(String [] args) {
-      Integer x[] = new Integer [1000];
-      // Allocate enough objects to cause a minor collection.
-      // These allocations suffice for a 4m young geneneration.
-      for (int i = 0; i < 100; i++) {
-        Integer y[] = new Integer[10000];
-      }
-      System.gc();
-    }
-  }
-}
diff --git a/hotspot/test/gc/concurrentMarkSweep/SystemGCOnForegroundCollector.java b/hotspot/test/gc/concurrentMarkSweep/SystemGCOnForegroundCollector.java
deleted file mode 100644
index c590f3dcb30..00000000000
--- a/hotspot/test/gc/concurrentMarkSweep/SystemGCOnForegroundCollector.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (c) 2013, 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 SystemGCOnForegroundCollector
- * @summary CMS: Call reset_after_compaction() only if a compaction has been done
- * @bug 8013184
- * @key gc
- * @key regression
- * @library /testlibrary
- * @run main/othervm SystemGCOnForegroundCollector
- * @author jon.masamitsu@oracle.com
- */
-
-import com.oracle.java.testlibrary.*;
-
-public class SystemGCOnForegroundCollector {
-  public static void main(String args[]) throws Exception {
-
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
-      "-showversion",
-      "-XX:+UseConcMarkSweepGC",
-      "-XX:MaxTenuringThreshold=1",
-      "-XX:-UseCMSCompactAtFullCollection",
-      ThreePlusMSSystemGC.class.getName()
-      );
-
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-
-    output.shouldNotContain("error");
-
-    output.shouldHaveExitValue(0);
-  }
-
-  static class ThreePlusMSSystemGC {
-    public static void main(String [] args) {
-      // From running this test 3 System.gc() were always
-      // enough to see the failure but the cause of the failure
-      // depends on how objects are allocated in the CMS generation
-      // which is non-deterministic.  Use 30 iterations for a more
-      // reliable test.
-      for (int i = 0; i < 30; i++) {
-        System.gc();
-      }
-    }
-  }
-}
diff --git a/hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java b/hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java
deleted file mode 100644
index ead8788524a..00000000000
--- a/hotspot/test/gc/startup_warnings/TestCMSForegroundFlags.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
-* Copyright (c) 2013, 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 TestCMSForegroundFlags
-* @key gc
-* @bug 8027132
-* @summary Test that the deprecated CMS foreground collector flags print warning messages
-* @library /testlibrary
-* @run main TestCMSForegroundFlags -XX:-UseCMSCompactAtFullCollection UseCMSCompactAtFullCollection
-* @run main TestCMSForegroundFlags -XX:CMSFullGCsBeforeCompaction=4 CMSFullGCsBeforeCompaction
-* @run main TestCMSForegroundFlags -XX:-UseCMSCollectionPassing UseCMSCollectionPassing
-*/
-
-import com.oracle.java.testlibrary.OutputAnalyzer;
-import com.oracle.java.testlibrary.ProcessTools;
-
-public class TestCMSForegroundFlags {
-  public static void main(String[] args) throws Exception {
-    if (args.length != 2) {
-      throw new Exception("Expected two arguments,flagValue and flagName");
-    }
-    String flagValue = args[0];
-    String flagName = args[1];
-
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(flagValue, "-version");
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("warning: " + flagName + " is deprecated and will likely be removed in a future release.");
-    output.shouldNotContain("error");
-    output.shouldHaveExitValue(0);
-  }
-}

From f3997d8eedaec622eb19a892fa08ea004dfbfcdb Mon Sep 17 00:00:00 2001
From: Erik Helin <ehelin@openjdk.org>
Date: Tue, 18 Nov 2014 10:36:42 +0100
Subject: [PATCH 023/299] 8064721: The card tables only ever need two covering
 regions

Reviewed-by: jmasa, tschatzl, kbarrett
---
 .../gc_implementation/g1/g1CollectedHeap.cpp  |  2 +-
 .../g1/g1SATBCardTableModRefBS.cpp            | 10 ++++------
 .../g1/g1SATBCardTableModRefBS.hpp            |  6 ++----
 .../parallelScavenge/cardTableExtension.hpp   |  4 ++--
 .../parallelScavenge/parallelScavengeHeap.cpp |  2 +-
 hotspot/src/share/vm/memory/barrierSet.hpp    | 19 ++++++-------------
 .../src/share/vm/memory/cardTableModRefBS.cpp |  5 ++---
 .../src/share/vm/memory/cardTableModRefBS.hpp |  7 +++----
 hotspot/src/share/vm/memory/cardTableRS.cpp   | 13 +++++--------
 hotspot/src/share/vm/memory/cardTableRS.hpp   |  5 +++--
 .../src/share/vm/memory/collectorPolicy.cpp   |  5 ++---
 .../src/share/vm/memory/collectorPolicy.hpp   |  5 +----
 .../src/share/vm/memory/genCollectedHeap.cpp  | 14 ++------------
 .../src/share/vm/memory/genCollectedHeap.hpp  |  4 +---
 .../src/share/vm/memory/generationSpec.hpp    |  4 ----
 .../src/share/vm/memory/modRefBarrierSet.hpp  |  4 ----
 hotspot/src/share/vm/runtime/vmStructs.cpp    |  1 -
 17 files changed, 35 insertions(+), 75 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index e2ae3205d51..8d51bbfcdfd 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -1888,7 +1888,7 @@ jint G1CollectedHeap::initialize() {
   initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*)(heap_rs.base() + heap_rs.size()));
 
   // Create the gen rem set (and barrier set) for the entire reserved region.
-  _rem_set = collector_policy()->create_rem_set(reserved_region(), 2);
+  _rem_set = collector_policy()->create_rem_set(reserved_region());
   set_barrier_set(rem_set()->bs());
   if (!barrier_set()->is_a(BarrierSet::G1SATBCTLogging)) {
     vm_exit_during_initialization("G1 requires a G1SATBLoggingCardTableModRefBS");
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
index 7e1c8c08105..1e3788858b0 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.cpp
@@ -32,9 +32,8 @@
 #include "runtime/orderAccess.inline.hpp"
 #include "runtime/thread.inline.hpp"
 
-G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap,
-                                                 int max_covered_regions) :
-    CardTableModRefBSForCTRS(whole_heap, max_covered_regions)
+G1SATBCardTableModRefBS::G1SATBCardTableModRefBS(MemRegion whole_heap) :
+    CardTableModRefBSForCTRS(whole_heap)
 {
   _kind = G1SATBCT;
 }
@@ -132,9 +131,8 @@ void G1SATBCardTableLoggingModRefBSChangedListener::on_commit(uint start_idx, si
 }
 
 G1SATBCardTableLoggingModRefBS::
-G1SATBCardTableLoggingModRefBS(MemRegion whole_heap,
-                               int max_covered_regions) :
-  G1SATBCardTableModRefBS(whole_heap, max_covered_regions),
+G1SATBCardTableLoggingModRefBS(MemRegion whole_heap) :
+  G1SATBCardTableModRefBS(whole_heap),
   _dcqs(JavaThread::dirty_card_queue_set()),
   _listener()
 {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
index 1fbe45faaea..6a06523d0cb 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1SATBCardTableModRefBS.hpp
@@ -50,8 +50,7 @@ public:
   // pre-marking object graph.
   static void enqueue(oop pre_val);
 
-  G1SATBCardTableModRefBS(MemRegion whole_heap,
-                          int max_covered_regions);
+  G1SATBCardTableModRefBS(MemRegion whole_heap);
 
   bool is_a(BarrierSet::Name bsn) {
     return bsn == BarrierSet::G1SATBCT || CardTableModRefBS::is_a(bsn);
@@ -152,8 +151,7 @@ class G1SATBCardTableLoggingModRefBS: public G1SATBCardTableModRefBS {
     return ReservedSpace::allocation_align_size_up(number_of_slots);
   }
 
-  G1SATBCardTableLoggingModRefBS(MemRegion whole_heap,
-                                 int max_covered_regions);
+  G1SATBCardTableLoggingModRefBS(MemRegion whole_heap);
 
   virtual void initialize() { }
   virtual void initialize(G1RegionToSpaceMapper* mapper);
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp
index 733b5c91ad9..1fc55ad081b 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/cardTableExtension.hpp
@@ -53,8 +53,8 @@ class CardTableExtension : public CardTableModRefBS {
     verify_card       = CardTableModRefBS::CT_MR_BS_last_reserved + 5
   };
 
-  CardTableExtension(MemRegion whole_heap, int max_covered_regions) :
-    CardTableModRefBS(whole_heap, max_covered_regions) { }
+  CardTableExtension(MemRegion whole_heap) :
+    CardTableModRefBS(whole_heap) { }
 
   // Too risky for the 4/10/02 putback
   // BarrierSet::Name kind() { return BarrierSet::CardTableExtension; }
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp
index 4e1a1b06323..0a410ccb0f6 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/parallelScavengeHeap.cpp
@@ -76,7 +76,7 @@ jint ParallelScavengeHeap::initialize() {
 
   initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*)(heap_rs.base() + heap_rs.size()));
 
-  CardTableExtension* const barrier_set = new CardTableExtension(reserved_region(), 3);
+  CardTableExtension* const barrier_set = new CardTableExtension(reserved_region());
   barrier_set->initialize();
   _barrier_set = barrier_set;
   oopDesc::set_bs(_barrier_set);
diff --git a/hotspot/src/share/vm/memory/barrierSet.hpp b/hotspot/src/share/vm/memory/barrierSet.hpp
index 3a5342bc9fc..08d354c36df 100644
--- a/hotspot/src/share/vm/memory/barrierSet.hpp
+++ b/hotspot/src/share/vm/memory/barrierSet.hpp
@@ -49,7 +49,12 @@ public:
     TargetUninitialized = 1
   };
 protected:
-  int _max_covered_regions;
+  // Some barrier sets create tables whose elements correspond to parts of
+  // the heap; the CardTableModRefBS is an example.  Such barrier sets will
+  // normally reserve space for such tables, and commit parts of the table
+  // "covering" parts of the heap that are committed. At most one covered
+  // region per generation is needed.
+  static const int _max_covered_regions = 2;
   Name _kind;
 
 public:
@@ -159,18 +164,6 @@ public:
 protected:
   virtual void write_region_work(MemRegion mr) = 0;
 public:
-
-  // Some barrier sets create tables whose elements correspond to parts of
-  // the heap; the CardTableModRefBS is an example.  Such barrier sets will
-  // normally reserve space for such tables, and commit parts of the table
-  // "covering" parts of the heap that are committed.  The constructor is
-  // passed the maximum number of independently committable subregions to
-  // be covered, and the "resize_covered_region" function allows the
-  // sub-parts of the heap to inform the barrier set of changes of their
-  // sizes.
-  BarrierSet(int max_covered_regions) :
-    _max_covered_regions(max_covered_regions) {}
-
   // Inform the BarrierSet that the the covered heap region that starts
   // with "base" has been changed to have the given size (possibly from 0,
   // for initialization.)
diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
index 30e8618d597..8446d290266 100644
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
@@ -53,9 +53,8 @@ size_t CardTableModRefBS::compute_byte_map_size()
   return align_size_up(_guard_index + 1, MAX2(_page_size, granularity));
 }
 
-CardTableModRefBS::CardTableModRefBS(MemRegion whole_heap,
-                                     int max_covered_regions):
-  ModRefBarrierSet(max_covered_regions),
+CardTableModRefBS::CardTableModRefBS(MemRegion whole_heap) :
+  ModRefBarrierSet(),
   _whole_heap(whole_heap),
   _guard_index(0),
   _guard_region(),
diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
index c824e6185a0..04a1cb1b937 100644
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
@@ -284,7 +284,7 @@ public:
     return bsn == BarrierSet::CardTableModRef || ModRefBarrierSet::is_a(bsn);
   }
 
-  CardTableModRefBS(MemRegion whole_heap, int max_covered_regions);
+  CardTableModRefBS(MemRegion whole_heap);
   ~CardTableModRefBS();
 
   virtual void initialize();
@@ -482,9 +482,8 @@ protected:
   bool card_will_be_scanned(jbyte cv);
   bool card_may_have_been_dirty(jbyte cv);
 public:
-  CardTableModRefBSForCTRS(MemRegion whole_heap,
-                           int max_covered_regions) :
-    CardTableModRefBS(whole_heap, max_covered_regions) {}
+  CardTableModRefBSForCTRS(MemRegion whole_heap) :
+    CardTableModRefBS(whole_heap) {}
 
   void set_CTRS(CardTableRS* rs) { _rs = rs; }
 };
diff --git a/hotspot/src/share/vm/memory/cardTableRS.cpp b/hotspot/src/share/vm/memory/cardTableRS.cpp
index 90f72d19efd..c3b8968cb07 100644
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp
@@ -38,21 +38,18 @@
 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
 #endif // INCLUDE_ALL_GCS
 
-CardTableRS::CardTableRS(MemRegion whole_heap,
-                         int max_covered_regions) :
+CardTableRS::CardTableRS(MemRegion whole_heap) :
   GenRemSet(),
-  _cur_youngergen_card_val(youngergenP1_card),
-  _regions_to_iterate(max_covered_regions - 1)
+  _cur_youngergen_card_val(youngergenP1_card)
 {
 #if INCLUDE_ALL_GCS
   if (UseG1GC) {
-      _ct_bs = new G1SATBCardTableLoggingModRefBS(whole_heap,
-                                                  max_covered_regions);
+      _ct_bs = new G1SATBCardTableLoggingModRefBS(whole_heap);
   } else {
-    _ct_bs = new CardTableModRefBSForCTRS(whole_heap, max_covered_regions);
+    _ct_bs = new CardTableModRefBSForCTRS(whole_heap);
   }
 #else
-  _ct_bs = new CardTableModRefBSForCTRS(whole_heap, max_covered_regions);
+  _ct_bs = new CardTableModRefBSForCTRS(whole_heap);
 #endif
   _ct_bs->initialize();
   set_bs(_ct_bs);
diff --git a/hotspot/src/share/vm/memory/cardTableRS.hpp b/hotspot/src/share/vm/memory/cardTableRS.hpp
index 873b3f62f94..a9bfef87b76 100644
--- a/hotspot/src/share/vm/memory/cardTableRS.hpp
+++ b/hotspot/src/share/vm/memory/cardTableRS.hpp
@@ -83,7 +83,8 @@ class CardTableRS: public GenRemSet {
 
   jbyte _cur_youngergen_card_val;
 
-  int _regions_to_iterate;
+  // Number of generations, plus one for lingering PermGen issues in CardTableRS.
+  static const int _regions_to_iterate = 3;
 
   jbyte cur_youngergen_card_val() {
     return _cur_youngergen_card_val;
@@ -101,7 +102,7 @@ class CardTableRS: public GenRemSet {
   jbyte find_unused_youngergenP_card_value();
 
 public:
-  CardTableRS(MemRegion whole_heap, int max_covered_regions);
+  CardTableRS(MemRegion whole_heap);
   ~CardTableRS();
 
   // *** GenRemSet functions.
diff --git a/hotspot/src/share/vm/memory/collectorPolicy.cpp b/hotspot/src/share/vm/memory/collectorPolicy.cpp
index fa07a5794de..86c7a979d93 100644
--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp
@@ -152,9 +152,8 @@ bool CollectorPolicy::use_should_clear_all_soft_refs(bool v) {
   return result;
 }
 
-GenRemSet* CollectorPolicy::create_rem_set(MemRegion whole_heap,
-                                           int max_covered_regions) {
-  return new CardTableRS(whole_heap, max_covered_regions);
+GenRemSet* CollectorPolicy::create_rem_set(MemRegion whole_heap) {
+  return new CardTableRS(whole_heap);
 }
 
 void CollectorPolicy::cleared_all_soft_refs() {
diff --git a/hotspot/src/share/vm/memory/collectorPolicy.hpp b/hotspot/src/share/vm/memory/collectorPolicy.hpp
index d923cf36a27..6f20be7f6dc 100644
--- a/hotspot/src/share/vm/memory/collectorPolicy.hpp
+++ b/hotspot/src/share/vm/memory/collectorPolicy.hpp
@@ -152,10 +152,7 @@ class CollectorPolicy : public CHeapObj<mtGC> {
 
   virtual BarrierSet::Name barrier_set_name() = 0;
 
-  // Create the remembered set (to cover the given reserved region,
-  // allowing breaking up into at most "max_covered_regions").
-  virtual GenRemSet* create_rem_set(MemRegion reserved,
-                                    int max_covered_regions);
+  virtual GenRemSet* create_rem_set(MemRegion reserved);
 
   // This method controls how a collector satisfies a request
   // for a block of memory.  "gc_time_limit_was_exceeded" will
diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
index 28a062825c3..bf7a3f7f0a5 100644
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
@@ -109,13 +109,11 @@ jint GenCollectedHeap::initialize() {
 
   char* heap_address;
   size_t total_reserved = 0;
-  int n_covered_regions = 0;
   ReservedSpace heap_rs;
 
   size_t heap_alignment = collector_policy()->heap_alignment();
 
-  heap_address = allocate(heap_alignment, &total_reserved,
-                          &n_covered_regions, &heap_rs);
+  heap_address = allocate(heap_alignment, &total_reserved, &heap_rs);
 
   if (!heap_rs.is_reserved()) {
     vm_shutdown_during_initialization(
@@ -125,7 +123,7 @@ jint GenCollectedHeap::initialize() {
 
   initialize_reserved_region((HeapWord*)heap_rs.base(), (HeapWord*)(heap_rs.base() + heap_rs.size()));
 
-  _rem_set = collector_policy()->create_rem_set(reserved_region(), n_covered_regions);
+  _rem_set = collector_policy()->create_rem_set(reserved_region());
   set_barrier_set(rem_set()->bs());
 
   _gch = this;
@@ -152,14 +150,12 @@ jint GenCollectedHeap::initialize() {
 
 char* GenCollectedHeap::allocate(size_t alignment,
                                  size_t* _total_reserved,
-                                 int* _n_covered_regions,
                                  ReservedSpace* heap_rs){
   const char overflow_msg[] = "The size of the object heap + VM data exceeds "
     "the maximum representable size";
 
   // Now figure out the total size.
   size_t total_reserved = 0;
-  int n_covered_regions = 0;
   const size_t pageSize = UseLargePages ?
       os::large_page_size() : os::vm_page_size();
 
@@ -170,18 +166,12 @@ char* GenCollectedHeap::allocate(size_t alignment,
     if (total_reserved < _gen_specs[i]->max_size()) {
       vm_exit_during_initialization(overflow_msg);
     }
-    n_covered_regions += _gen_specs[i]->n_covered_regions();
   }
   assert(total_reserved % alignment == 0,
          err_msg("Gen size; total_reserved=" SIZE_FORMAT ", alignment="
                  SIZE_FORMAT, total_reserved, alignment));
 
-  // Needed until the cardtable is fixed to have the right number
-  // of covered regions.
-  n_covered_regions += 2;
-
   *_total_reserved = total_reserved;
-  *_n_covered_regions = n_covered_regions;
 
   *heap_rs = Universe::reserve_heap(total_reserved, alignment);
   return heap_rs->base();
diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.hpp b/hotspot/src/share/vm/memory/genCollectedHeap.hpp
index dab317d71ff..e4615b3b76b 100644
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp
@@ -121,9 +121,7 @@ public:
 
   // Returns JNI_OK on success
   virtual jint initialize();
-  char* allocate(size_t alignment,
-                 size_t* _total_reserved, int* _n_covered_regions,
-                 ReservedSpace* heap_rs);
+  char* allocate(size_t alignment, size_t* _total_reserved, ReservedSpace* heap_rs);
 
   // Does operations required after initialization has been done.
   void post_initialize();
diff --git a/hotspot/src/share/vm/memory/generationSpec.hpp b/hotspot/src/share/vm/memory/generationSpec.hpp
index 64ebd270b43..58448a496af 100644
--- a/hotspot/src/share/vm/memory/generationSpec.hpp
+++ b/hotspot/src/share/vm/memory/generationSpec.hpp
@@ -59,10 +59,6 @@ public:
     set_init_size(align_size_up(init_size(), alignment));
     set_max_size(align_size_up(max_size(), alignment));
   }
-
-  // Return the number of regions contained in the generation which
-  // might need to be independently covered by a remembered set.
-  virtual int n_covered_regions() const { return 1; }
 };
 
 typedef GenerationSpec* GenerationSpecPtr;
diff --git a/hotspot/src/share/vm/memory/modRefBarrierSet.hpp b/hotspot/src/share/vm/memory/modRefBarrierSet.hpp
index ec89a235d70..a320e61c854 100644
--- a/hotspot/src/share/vm/memory/modRefBarrierSet.hpp
+++ b/hotspot/src/share/vm/memory/modRefBarrierSet.hpp
@@ -95,10 +95,6 @@ public:
   // The caller guarantees that "mr" contains no references.  (Perhaps it's
   // objects have been moved elsewhere.)
   virtual void clear(MemRegion mr) = 0;
-
-  // Pass along the argument to the superclass.
-  ModRefBarrierSet(int max_covered_regions) :
-    BarrierSet(max_covered_regions) {}
 };
 
 #endif // SHARE_VM_MEMORY_MODREFBARRIERSET_HPP
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index 9c1cec41a39..cbd7aa43a37 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -473,7 +473,6 @@ typedef TwoOopHashtable<Symbol*, mtClass>     SymbolTwoOopHashtable;
                                                                                                                                      \
   unchecked_nonstatic_field(ageTable,          sizes,                                         sizeof(ageTable::sizes))               \
                                                                                                                                      \
-  nonstatic_field(BarrierSet,                  _max_covered_regions,                          int)                                   \
   nonstatic_field(BarrierSet,                  _kind,                                         BarrierSet::Name)                      \
   nonstatic_field(BlockOffsetTable,            _bottom,                                       HeapWord*)                             \
   nonstatic_field(BlockOffsetTable,            _end,                                          HeapWord*)                             \

From 2da855a25934dd648e039f437cf741ef1d4c8b49 Mon Sep 17 00:00:00 2001
From: Bengt Rutisson <brutisso@openjdk.org>
Date: Tue, 18 Nov 2014 10:39:16 +0100
Subject: [PATCH 024/299] 8064865: Remove the debug funciontality
 RotateCMSCollectionTypes for CMS

Reviewed-by: jmasa, kbarrett, ysr
---
 .../concurrentMarkSweepGeneration.cpp         | 26 -------------------
 .../concurrentMarkSweepGeneration.hpp         |  5 ----
 hotspot/src/share/vm/runtime/globals.hpp      |  3 ---
 3 files changed, 34 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
index b94bd52a3a9..c088c7d130c 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
@@ -192,7 +192,6 @@ ConcurrentMarkSweepGeneration::ConcurrentMarkSweepGeneration(
      FreeBlockDictionary<FreeChunk>::DictionaryChoice dictionaryChoice) :
   CardGeneration(rs, initial_byte_size, level, ct),
   _dilatation_factor(((double)MinChunkSize)/((double)(CollectedHeap::min_fill_size()))),
-  _debug_concurrent_cycle(true),
   _did_compact(false)
 {
   HeapWord* bottom = (HeapWord*) _virtual_space.low();
@@ -1245,14 +1244,6 @@ bool CMSCollector::shouldConcurrentCollect() {
     return true;
   }
 
-  // For debugging purposes, change the type of collection.
-  // Rotate between concurrent and stop-the-world full GCs.
-  NOT_PRODUCT(
-    if (RotateCMSCollectionTypes) {
-      return _cmsGen->debug_concurrent_cycle();
-    }
-  )
-
   FreelistLocker x(this);
   // ------------------------------------------------------------------
   // Print out lots of information which affects the initiation of
@@ -5830,17 +5821,6 @@ void ConcurrentMarkSweepGeneration::update_gc_stats(int current_level,
   }
 }
 
-void ConcurrentMarkSweepGeneration::rotate_debug_collection_type() {
-  if (PrintGCDetails && Verbose) {
-    if (_debug_concurrent_cycle) {
-      gclog_or_tty->print_cr("Rotate from concurrent to STW collections");
-    } else {
-      gclog_or_tty->print_cr("Rotate from STW to concurrent collections");
-    }
-  }
-  _debug_concurrent_cycle = !_debug_concurrent_cycle;
-}
-
 void CMSCollector::sweepWork(ConcurrentMarkSweepGeneration* gen) {
   // We iterate over the space(s) underlying this generation,
   // checking the mark bit map to see if the bits corresponding
@@ -5961,12 +5941,6 @@ void CMSCollector::reset(bool concurrent) {
     _collectorState = Idling;
   }
 
-  NOT_PRODUCT(
-    if (RotateCMSCollectionTypes) {
-      _cmsGen->rotate_debug_collection_type();
-    }
-  )
-
   register_gc_end();
 }
 
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
index aa117dec415..58ee68d7b27 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
@@ -1040,8 +1040,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
   // In support of MinChunkSize being larger than min object size
   const double _dilatation_factor;
 
-  bool _debug_concurrent_cycle;
-
   // True if a compacting collection was done.
   bool _did_compact;
   bool did_compact() { return _did_compact; }
@@ -1268,9 +1266,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
   // Resize the generation after a non-compacting
   // collection.
   void compute_new_size_free_list();
-
-  bool debug_concurrent_cycle() { return _debug_concurrent_cycle; }
-  void rotate_debug_collection_type();
 };
 
 //
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index 3d296d09162..8420890b566 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -1523,9 +1523,6 @@ class CommandLineFlags {
   develop(bool, UseAsyncConcMarkSweepGC, true,                              \
           "Use Asynchronous Concurrent Mark-Sweep GC in the old generation")\
                                                                             \
-  develop(bool, RotateCMSCollectionTypes, false,                            \
-          "Rotate the CMS collections among concurrent and STW")            \
-                                                                            \
   product(bool, UseCMSBestFit, true,                                        \
           "Use CMS best fit allocation strategy")                           \
                                                                             \

From a324ff0f31379653fa0c1fbdf6d74cfc22a21c4e Mon Sep 17 00:00:00 2001
From: Erik Osterlund <erik.osterlund@lnu.se>
Date: Tue, 21 Oct 2014 15:07:25 +0200
Subject: [PATCH 025/299] 8058255: Native jbyte Atomic::cmpxchg for supported
 x86 platforms

Use the native cmpxchgb instruction on x86.

Reviewed-by: dholmes, kbarrett, phh
---
 .../src/cpu/sparc/vm/stubGenerator_sparc.cpp  |  1 +
 hotspot/src/cpu/x86/vm/assembler_x86.cpp      | 11 +++++++
 hotspot/src/cpu/x86/vm/assembler_x86.hpp      |  1 +
 .../src/cpu/x86/vm/stubGenerator_x86_64.cpp   | 33 +++++++++++++++++--
 .../src/cpu/zero/vm/stubGenerator_zero.cpp    |  1 +
 .../bsd_x86/vm/atomic_bsd_x86.inline.hpp      |  9 +++++
 .../linux_x86/vm/atomic_linux_x86.inline.hpp  |  9 +++++
 .../vm/atomic_solaris_x86.inline.hpp          | 16 +++++++++
 .../os_cpu/solaris_x86/vm/solaris_x86_32.il   | 17 ++++++++++
 .../os_cpu/solaris_x86/vm/solaris_x86_64.il   |  9 +++++
 .../vm/atomic_windows_x86.inline.hpp          | 18 ++++++++++
 .../os_cpu/windows_x86/vm/os_windows_x86.cpp  | 19 +++++++++++
 .../os_cpu/windows_x86/vm/os_windows_x86.hpp  |  2 ++
 hotspot/src/share/vm/runtime/atomic.cpp       |  8 ++++-
 hotspot/src/share/vm/runtime/atomic.hpp       |  5 ++-
 .../src/share/vm/runtime/atomic.inline.hpp    |  8 +++++
 hotspot/src/share/vm/runtime/stubRoutines.cpp |  1 +
 hotspot/src/share/vm/runtime/stubRoutines.hpp |  2 ++
 18 files changed, 165 insertions(+), 5 deletions(-)

diff --git a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp
index e4cc113c2e2..780120bd60d 100644
--- a/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/stubGenerator_sparc.cpp
@@ -4813,6 +4813,7 @@ class StubGenerator: public StubCodeGenerator {
     StubRoutines::_atomic_add_entry          = generate_atomic_add();
     StubRoutines::_atomic_xchg_ptr_entry     = StubRoutines::_atomic_xchg_entry;
     StubRoutines::_atomic_cmpxchg_ptr_entry  = StubRoutines::_atomic_cmpxchg_entry;
+    StubRoutines::_atomic_cmpxchg_byte_entry = ShouldNotCallThisStub();
     StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long();
     StubRoutines::_atomic_add_ptr_entry      = StubRoutines::_atomic_add_entry;
 #endif  // COMPILER2 !=> _LP64
diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.cpp b/hotspot/src/cpu/x86/vm/assembler_x86.cpp
index 8098e889ba9..f61e0a0917c 100644
--- a/hotspot/src/cpu/x86/vm/assembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.cpp
@@ -1297,6 +1297,17 @@ void Assembler::cmpxchgl(Register reg, Address adr) { // cmpxchg
   emit_operand(reg, adr);
 }
 
+// The 8-bit cmpxchg compares the value at adr with the contents of rax,
+// and stores reg into adr if so; otherwise, the value at adr is loaded into rax,.
+// The ZF is set if the compared values were equal, and cleared otherwise.
+void Assembler::cmpxchgb(Register reg, Address adr) { // cmpxchg
+  InstructionMark im(this);
+  prefix(adr, reg, true);
+  emit_int8(0x0F);
+  emit_int8((unsigned char)0xB0);
+  emit_operand(reg, adr);
+}
+
 void Assembler::comisd(XMMRegister dst, Address src) {
   // NOTE: dbx seems to decode this as comiss even though the
   // 0x66 is there. Strangly ucomisd comes out correct
diff --git a/hotspot/src/cpu/x86/vm/assembler_x86.hpp b/hotspot/src/cpu/x86/vm/assembler_x86.hpp
index ef16f27538f..3f3fff83d66 100644
--- a/hotspot/src/cpu/x86/vm/assembler_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/assembler_x86.hpp
@@ -1006,6 +1006,7 @@ private:
 
   void cmpxchg8 (Address adr);
 
+  void cmpxchgb(Register reg, Address adr);
   void cmpxchgl(Register reg, Address adr);
 
   void cmpxchgq(Register reg, Address adr);
diff --git a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
index 0000146f535..c3c2500126d 100644
--- a/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/stubGenerator_x86_64.cpp
@@ -594,9 +594,35 @@ class StubGenerator: public StubCodeGenerator {
     return start;
   }
 
-  // Support for jint atomic::atomic_cmpxchg_long(jlong exchange_value,
-  //                                             volatile jlong* dest,
-  //                                             jlong compare_value)
+  // Support for jbyte atomic::atomic_cmpxchg(jbyte exchange_value, volatile jbyte* dest,
+  //                                          jbyte compare_value)
+  //
+  // Arguments :
+  //    c_rarg0: exchange_value
+  //    c_rarg1: dest
+  //    c_rarg2: compare_value
+  //
+  // Result:
+  //    if ( compare_value == *dest ) {
+  //       *dest = exchange_value
+  //       return compare_value;
+  //    else
+  //       return *dest;
+  address generate_atomic_cmpxchg_byte() {
+    StubCodeMark mark(this, "StubRoutines", "atomic_cmpxchg_byte");
+    address start = __ pc();
+
+    __ movsbq(rax, c_rarg2);
+   if ( os::is_MP() ) __ lock();
+    __ cmpxchgb(c_rarg0, Address(c_rarg1, 0));
+    __ ret(0);
+
+    return start;
+  }
+
+  // Support for jlong atomic::atomic_cmpxchg(jlong exchange_value,
+  //                                          volatile jlong* dest,
+  //                                          jlong compare_value)
   // Arguments :
   //    c_rarg0: exchange_value
   //    c_rarg1: dest
@@ -3894,6 +3920,7 @@ class StubGenerator: public StubCodeGenerator {
     StubRoutines::_atomic_xchg_entry         = generate_atomic_xchg();
     StubRoutines::_atomic_xchg_ptr_entry     = generate_atomic_xchg_ptr();
     StubRoutines::_atomic_cmpxchg_entry      = generate_atomic_cmpxchg();
+    StubRoutines::_atomic_cmpxchg_byte_entry = generate_atomic_cmpxchg_byte();
     StubRoutines::_atomic_cmpxchg_long_entry = generate_atomic_cmpxchg_long();
     StubRoutines::_atomic_add_entry          = generate_atomic_add();
     StubRoutines::_atomic_add_ptr_entry      = generate_atomic_add_ptr();
diff --git a/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp b/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp
index b88df23737b..be7f72b2341 100644
--- a/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp
+++ b/hotspot/src/cpu/zero/vm/stubGenerator_zero.cpp
@@ -207,6 +207,7 @@ class StubGenerator: public StubCodeGenerator {
     StubRoutines::_atomic_xchg_ptr_entry     = ShouldNotCallThisStub();
     StubRoutines::_atomic_cmpxchg_entry      = ShouldNotCallThisStub();
     StubRoutines::_atomic_cmpxchg_ptr_entry  = ShouldNotCallThisStub();
+    StubRoutines::_atomic_cmpxchg_byte_entry = ShouldNotCallThisStub();
     StubRoutines::_atomic_cmpxchg_long_entry = ShouldNotCallThisStub();
     StubRoutines::_atomic_add_entry          = ShouldNotCallThisStub();
     StubRoutines::_atomic_add_ptr_entry      = ShouldNotCallThisStub();
diff --git a/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp b/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp
index 0a9feddfec4..9108476c2d5 100644
--- a/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp
+++ b/hotspot/src/os_cpu/bsd_x86/vm/atomic_bsd_x86.inline.hpp
@@ -88,6 +88,15 @@ inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     des
   return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
 }
 
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte    Atomic::cmpxchg    (jbyte    exchange_value, volatile jbyte*    dest, jbyte    compare_value) {
+  int mp = os::is_MP();
+  __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
+                    : "=a" (exchange_value)
+                    : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+                    : "cc", "memory");
+  return exchange_value;
+}
 
 inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value) {
   int mp = os::is_MP();
diff --git a/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp b/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp
index 679dd614523..03fa9bcf840 100644
--- a/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp
+++ b/hotspot/src/os_cpu/linux_x86/vm/atomic_linux_x86.inline.hpp
@@ -88,6 +88,15 @@ inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     des
   return (void*)xchg_ptr((intptr_t)exchange_value, (volatile intptr_t*)dest);
 }
 
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte    Atomic::cmpxchg    (jbyte    exchange_value, volatile jbyte*    dest, jbyte    compare_value) {
+  int mp = os::is_MP();
+  __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
+                    : "=a" (exchange_value)
+                    : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+                    : "cc", "memory");
+  return exchange_value;
+}
 
 inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value) {
   int mp = os::is_MP();
diff --git a/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp b/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp
index e00d5be1ff0..f8b47f56495 100644
--- a/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp
+++ b/hotspot/src/os_cpu/solaris_x86/vm/atomic_solaris_x86.inline.hpp
@@ -68,6 +68,8 @@ inline void Atomic::dec_ptr(volatile void*     dest) { (void)add_ptr(-1, dest);
 extern "C" {
   jint _Atomic_add(jint add_value, volatile jint* dest IS_MP_DECL());
   jint _Atomic_xchg(jint exchange_value, volatile jint* dest);
+  jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest,
+                       jbyte compare_value IS_MP_DECL());
   jint _Atomic_cmpxchg(jint exchange_value, volatile jint* dest,
                        jint compare_value IS_MP_DECL());
   jlong _Atomic_cmpxchg_long(jlong exchange_value, volatile jlong* dest,
@@ -82,6 +84,11 @@ inline jint     Atomic::xchg       (jint     exchange_value, volatile jint*
   return _Atomic_xchg(exchange_value, dest);
 }
 
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte    Atomic::cmpxchg    (jbyte    exchange_value, volatile jbyte*    dest, jbyte    compare_value) {
+  return _Atomic_cmpxchg_byte(exchange_value, dest, compare_value IS_MP_ARG());
+}
+
 inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value) {
   return _Atomic_cmpxchg(exchange_value, dest, compare_value IS_MP_ARG());
 }
@@ -217,6 +224,15 @@ extern "C" {
     return exchange_value;
   }
 
+
+  inline jbyte _Atomic_cmpxchg_byte(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value, int mp) {
+    __asm__ volatile (LOCK_IF_MP(%4) "cmpxchgb %1,(%3)"
+                    : "=a" (exchange_value)
+                    : "q" (exchange_value), "a" (compare_value), "r" (dest), "r" (mp)
+                    : "cc", "memory");
+    return exchange_value;
+  }
+
   // This is the interface to the atomic instruction in solaris_i486.s.
   jlong _Atomic_cmpxchg_long_gcc(jlong exchange_value, volatile jlong* dest, jlong compare_value, int mp);
 
diff --git a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il
index 281711d4b3a..f6d289e725c 100644
--- a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il
+++ b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_32.il
@@ -76,6 +76,23 @@
       xchgl    (%ecx), %eax
       .end
 
+  // Support for jbyte Atomic::cmpxchg(jbyte exchange_value, 
+  //                                   volatile jbyte *dest, 
+  //                                   jbyte compare_value)
+  // An additional bool (os::is_MP()) is passed as the last argument.
+      .inline _Atomic_cmpxchg_byte,4
+      movb     8(%esp), %al   // compare_value
+      movb     0(%esp), %cl   // exchange_value
+      movl     4(%esp), %edx   // dest
+      cmp      $0, 12(%esp)    // MP test
+      jne      1f
+      cmpxchgb %cl, (%edx)
+      jmp      2f
+1:    lock
+      cmpxchgb %cl, (%edx)
+2:
+      .end
+
   // Support for jint Atomic::cmpxchg(jint exchange_value, 
   //                                  volatile jint *dest, 
   //                                  jint compare_value)
diff --git a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il
index 16bd3541079..bf0335f7f17 100644
--- a/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il
+++ b/hotspot/src/os_cpu/solaris_x86/vm/solaris_x86_64.il
@@ -77,6 +77,15 @@
       movq     %rdi, %rax
       .end
 
+  // Support for jbyte Atomic::cmpxchg(jbyte exchange_value, 
+  //                                   volatile jbyte *dest, 
+  //                                   jbyte compare_value)
+      .inline _Atomic_cmpxchg_byte,3
+      movb     %dl, %al      // compare_value
+      lock
+      cmpxchgb %dil, (%rsi)
+      .end
+
   // Support for jint Atomic::cmpxchg(jint exchange_value, 
   //                                  volatile jint *dest, 
   //                                  jint compare_value)
diff --git a/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp b/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp
index 072b61f07d3..d8c5f70870c 100644
--- a/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp
+++ b/hotspot/src/os_cpu/windows_x86/vm/atomic_windows_x86.inline.hpp
@@ -123,6 +123,11 @@ inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*
   return (*os::atomic_cmpxchg_func)(exchange_value, dest, compare_value);
 }
 
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte    Atomic::cmpxchg    (jbyte    exchange_value, volatile jbyte*    dest, jbyte    compare_value) {
+    return (*os::atomic_cmpxchg_byte_func)(exchange_value, dest, compare_value);
+}
+
 inline jlong    Atomic::cmpxchg    (jlong    exchange_value, volatile jlong*    dest, jlong    compare_value) {
   return (*os::atomic_cmpxchg_long_func)(exchange_value, dest, compare_value);
 }
@@ -212,6 +217,19 @@ inline void*    Atomic::xchg_ptr(void*    exchange_value, volatile void*     des
   return (void*)xchg((jint)exchange_value, (volatile jint*)dest);
 }
 
+#define VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+inline jbyte    Atomic::cmpxchg    (jbyte    exchange_value, volatile jbyte*    dest, jbyte    compare_value) {
+  // alternative for InterlockedCompareExchange
+  int mp = os::is_MP();
+  __asm {
+    mov edx, dest
+    mov cl, exchange_value
+    mov al, compare_value
+    LOCK_IF_MP(mp)
+    cmpxchg byte ptr [edx], cl
+  }
+}
+
 inline jint     Atomic::cmpxchg    (jint     exchange_value, volatile jint*     dest, jint     compare_value) {
   // alternative for InterlockedCompareExchange
   int mp = os::is_MP();
diff --git a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
index 5325e0ee807..29c9851bb2f 100644
--- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
@@ -220,6 +220,7 @@ void os::initialize_thread(Thread* thr) {
 typedef jint      xchg_func_t            (jint,     volatile jint*);
 typedef intptr_t  xchg_ptr_func_t        (intptr_t, volatile intptr_t*);
 typedef jint      cmpxchg_func_t         (jint,     volatile jint*,  jint);
+typedef jbyte     cmpxchg_byte_func_t    (jbyte,    volatile jbyte*, jbyte);
 typedef jlong     cmpxchg_long_func_t    (jlong,    volatile jlong*, jlong);
 typedef jint      add_func_t             (jint,     volatile jint*);
 typedef intptr_t  add_ptr_func_t         (intptr_t, volatile intptr_t*);
@@ -272,6 +273,23 @@ jint os::atomic_cmpxchg_bootstrap(jint exchange_value, volatile jint* dest, jint
     *dest = exchange_value;
   return old_value;
 }
+
+jbyte os::atomic_cmpxchg_byte_bootstrap(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+  // try to use the stub:
+  cmpxchg_byte_func_t* func = CAST_TO_FN_PTR(cmpxchg_byte_func_t*, StubRoutines::atomic_cmpxchg_byte_entry());
+
+  if (func != NULL) {
+    os::atomic_cmpxchg_byte_func = func;
+    return (*func)(exchange_value, dest, compare_value);
+  }
+  assert(Threads::number_of_threads() == 0, "for bootstrap only");
+
+  jbyte old_value = *dest;
+  if (old_value == compare_value)
+    *dest = exchange_value;
+  return old_value;
+}
+
 #endif // AMD64
 
 jlong os::atomic_cmpxchg_long_bootstrap(jlong exchange_value, volatile jlong* dest, jlong compare_value) {
@@ -321,6 +339,7 @@ intptr_t os::atomic_add_ptr_bootstrap(intptr_t add_value, volatile intptr_t* des
 xchg_func_t*         os::atomic_xchg_func         = os::atomic_xchg_bootstrap;
 xchg_ptr_func_t*     os::atomic_xchg_ptr_func     = os::atomic_xchg_ptr_bootstrap;
 cmpxchg_func_t*      os::atomic_cmpxchg_func      = os::atomic_cmpxchg_bootstrap;
+cmpxchg_byte_func_t* os::atomic_cmpxchg_byte_func = os::atomic_cmpxchg_byte_bootstrap;
 add_func_t*          os::atomic_add_func          = os::atomic_add_bootstrap;
 add_ptr_func_t*      os::atomic_add_ptr_func      = os::atomic_add_ptr_bootstrap;
 
diff --git a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp
index 1ac00b10455..9433ef72f8d 100644
--- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.hpp
@@ -33,6 +33,7 @@
   static intptr_t  (*atomic_xchg_ptr_func)      (intptr_t,  volatile intptr_t*);
 
   static jint      (*atomic_cmpxchg_func)       (jint,      volatile jint*,  jint);
+  static jbyte     (*atomic_cmpxchg_byte_func)  (jbyte,     volatile jbyte*, jbyte);
   static jlong     (*atomic_cmpxchg_long_func)  (jlong,     volatile jlong*, jlong);
 
   static jint      (*atomic_add_func)           (jint,      volatile jint*);
@@ -42,6 +43,7 @@
   static intptr_t  atomic_xchg_ptr_bootstrap    (intptr_t,  volatile intptr_t*);
 
   static jint      atomic_cmpxchg_bootstrap     (jint,      volatile jint*,  jint);
+  static jbyte     atomic_cmpxchg_byte_bootstrap(jbyte,     volatile jbyte*, jbyte);
 #else
 
   static jlong (*atomic_cmpxchg_long_func)  (jlong, volatile jlong*, jlong);
diff --git a/hotspot/src/share/vm/runtime/atomic.cpp b/hotspot/src/share/vm/runtime/atomic.cpp
index 2a3dbc5a6ac..9aaa416e24c 100644
--- a/hotspot/src/share/vm/runtime/atomic.cpp
+++ b/hotspot/src/share/vm/runtime/atomic.cpp
@@ -25,7 +25,13 @@
 #include "precompiled.hpp"
 #include "runtime/atomic.inline.hpp"
 
-jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
+/*
+ * This is the default implementation of byte-sized cmpxchg. It emulates jbyte-sized cmpxchg
+ * in terms of jint-sized cmpxchg. Platforms may override this by defining their own inline definition
+ * as well as defining VM_HAS_SPECIALIZED_CMPXCHG_BYTE. This will cause the platform specific
+ * implementation to be used instead.
+ */
+jbyte Atomic::cmpxchg_general(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value) {
   assert(sizeof(jbyte) == 1, "assumption.");
   uintptr_t dest_addr = (uintptr_t)dest;
   uintptr_t offset = dest_addr % sizeof(jint);
diff --git a/hotspot/src/share/vm/runtime/atomic.hpp b/hotspot/src/share/vm/runtime/atomic.hpp
index 4729adefc5f..0662c8e3b2a 100644
--- a/hotspot/src/share/vm/runtime/atomic.hpp
+++ b/hotspot/src/share/vm/runtime/atomic.hpp
@@ -28,6 +28,9 @@
 #include "memory/allocation.hpp"
 
 class Atomic : AllStatic {
+ private:
+  static jbyte cmpxchg_general(jbyte exchange_value, volatile jbyte* dest, jbyte compare_value);
+
  public:
   // Atomic operations on jlong types are not available on all 32-bit
   // platforms. If atomic ops on jlongs are defined here they must only
@@ -104,7 +107,7 @@ class Atomic : AllStatic {
   // *dest with exchange_value if the comparison succeeded. Returns prior
   // value of *dest. cmpxchg*() provide:
   // <fence> compare-and-exchange <membar StoreLoad|StoreStore>
-  static jbyte           cmpxchg    (jbyte        exchange_value, volatile jbyte*        dest, jbyte        compare_value);
+  inline static jbyte    cmpxchg    (jbyte        exchange_value, volatile jbyte*        dest, jbyte        compare_value);
   inline static jint     cmpxchg    (jint         exchange_value, volatile jint*         dest, jint         compare_value);
   // See comment above about using jlong atomics on 32-bit platforms
   inline static jlong    cmpxchg    (jlong        exchange_value, volatile jlong*        dest, jlong        compare_value);
diff --git a/hotspot/src/share/vm/runtime/atomic.inline.hpp b/hotspot/src/share/vm/runtime/atomic.inline.hpp
index e3983ef6b55..afe405826a8 100644
--- a/hotspot/src/share/vm/runtime/atomic.inline.hpp
+++ b/hotspot/src/share/vm/runtime/atomic.inline.hpp
@@ -87,4 +87,12 @@ inline void Atomic::dec(volatile size_t* dest) {
   dec_ptr((volatile intptr_t*) dest);
 }
 
+#ifndef VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+// See comment in atomic.cpp how to override.
+inline jbyte Atomic::cmpxchg(jbyte exchange_value, volatile jbyte *dest, jbyte comparand)
+{
+  return cmpxchg_general(exchange_value, dest, comparand);
+}
+#endif // VM_HAS_SPECIALIZED_CMPXCHG_BYTE
+
 #endif // SHARE_VM_RUNTIME_ATOMIC_INLINE_HPP
diff --git a/hotspot/src/share/vm/runtime/stubRoutines.cpp b/hotspot/src/share/vm/runtime/stubRoutines.cpp
index f35cce9f5e9..61838c12a1d 100644
--- a/hotspot/src/share/vm/runtime/stubRoutines.cpp
+++ b/hotspot/src/share/vm/runtime/stubRoutines.cpp
@@ -62,6 +62,7 @@ address StubRoutines::_atomic_store_entry                       = NULL;
 address StubRoutines::_atomic_store_ptr_entry                   = NULL;
 address StubRoutines::_atomic_cmpxchg_entry                     = NULL;
 address StubRoutines::_atomic_cmpxchg_ptr_entry                 = NULL;
+address StubRoutines::_atomic_cmpxchg_byte_entry                = NULL;
 address StubRoutines::_atomic_cmpxchg_long_entry                = NULL;
 address StubRoutines::_atomic_add_entry                         = NULL;
 address StubRoutines::_atomic_add_ptr_entry                     = NULL;
diff --git a/hotspot/src/share/vm/runtime/stubRoutines.hpp b/hotspot/src/share/vm/runtime/stubRoutines.hpp
index 60f24843abf..de2e090f3b2 100644
--- a/hotspot/src/share/vm/runtime/stubRoutines.hpp
+++ b/hotspot/src/share/vm/runtime/stubRoutines.hpp
@@ -126,6 +126,7 @@ class StubRoutines: AllStatic {
   static address _atomic_store_ptr_entry;
   static address _atomic_cmpxchg_entry;
   static address _atomic_cmpxchg_ptr_entry;
+  static address _atomic_cmpxchg_byte_entry;
   static address _atomic_cmpxchg_long_entry;
   static address _atomic_add_entry;
   static address _atomic_add_ptr_entry;
@@ -282,6 +283,7 @@ class StubRoutines: AllStatic {
   static address atomic_store_ptr_entry()                  { return _atomic_store_ptr_entry; }
   static address atomic_cmpxchg_entry()                    { return _atomic_cmpxchg_entry; }
   static address atomic_cmpxchg_ptr_entry()                { return _atomic_cmpxchg_ptr_entry; }
+  static address atomic_cmpxchg_byte_entry()               { return _atomic_cmpxchg_byte_entry; }
   static address atomic_cmpxchg_long_entry()               { return _atomic_cmpxchg_long_entry; }
   static address atomic_add_entry()                        { return _atomic_add_entry; }
   static address atomic_add_ptr_entry()                    { return _atomic_add_ptr_entry; }

From 6306dce8314bc82d7bf3cb7a3b3a53ff7440ed2f Mon Sep 17 00:00:00 2001
From: Stefan Johansson <sjohanss@openjdk.org>
Date: Thu, 30 Oct 2014 10:51:06 +0100
Subject: [PATCH 026/299] 8061234: ResourceContext.requestAccurateUpdate() is
 unreliable

Changing copy_allocation_context_stats to return if there are more stats available after the copy.

Reviewed-by: rriggs, jcoomes
---
 .../src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp  | 2 +-
 .../share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp  | 3 ++-
 hotspot/src/share/vm/gc_interface/collectedHeap.hpp        | 7 +++++--
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
index f1aaceaacb4..e7ff5d4b016 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.hpp
@@ -1248,7 +1248,7 @@ public:
   // The same as above but assume that the caller holds the Heap_lock.
   void collect_locked(GCCause::Cause cause);
 
-  virtual void copy_allocation_context_stats(const jint* contexts,
+  virtual bool copy_allocation_context_stats(const jint* contexts,
                                              jlong* totals,
                                              jbyte* accuracy,
                                              jint len);
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp
index 401b28b6fee..7f71451b6ca 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap_ext.cpp
@@ -25,8 +25,9 @@
 #include "precompiled.hpp"
 #include "gc_implementation/g1/g1CollectedHeap.hpp"
 
-void G1CollectedHeap::copy_allocation_context_stats(const jint* contexts,
+bool G1CollectedHeap::copy_allocation_context_stats(const jint* contexts,
                                                     jlong* totals,
                                                     jbyte* accuracy,
                                                     jint len) {
+  return false;
 }
diff --git a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp
index ea2dcc9a54b..bbd778c3463 100644
--- a/hotspot/src/share/vm/gc_interface/collectedHeap.hpp
+++ b/hotspot/src/share/vm/gc_interface/collectedHeap.hpp
@@ -644,10 +644,13 @@ class CollectedHeap : public CHeapObj<mtInternal> {
   // For each context in contexts, set the corresponding entries in the totals
   // and accuracy arrays to the current values held by the statistics.  Each
   // array should be of length len.
-  virtual void copy_allocation_context_stats(const jint* contexts,
+  // Returns true if there are more stats available.
+  virtual bool copy_allocation_context_stats(const jint* contexts,
                                              jlong* totals,
                                              jbyte* accuracy,
-                                             jint len) { }
+                                             jint len) {
+    return false;
+  }
 
   /////////////// Unit tests ///////////////
 

From 5fd7516136651023ac48fec20d360fe261f7c2a7 Mon Sep 17 00:00:00 2001
From: Marcus Larsson <mlarsson@openjdk.org>
Date: Thu, 30 Oct 2014 12:45:22 +0100
Subject: [PATCH 027/299] 8043243: convert SCAN_AND_FORWARD,
 SCAN_AND_ADJUST_POINTERS, SCAN_AND_COMPACT macros to methods

Reviewed-by: mgerdin, kbarrett
---
 .../compactibleFreeListSpace.cpp              |  10 +-
 .../compactibleFreeListSpace.hpp              |  29 +
 .../vm/gc_implementation/g1/heapRegion.cpp    |  10 +-
 .../vm/gc_implementation/g1/heapRegion.hpp    |  22 +-
 .../shared/markSweep.inline.hpp               |   1 +
 hotspot/src/share/vm/memory/space.cpp         |  50 +-
 hotspot/src/share/vm/memory/space.hpp         |  84 ++-
 hotspot/src/share/vm/memory/space.inline.hpp  | 528 +++++++++---------
 8 files changed, 402 insertions(+), 332 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
index 1406d5dfd8b..ee2dc9b3622 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
@@ -2083,17 +2083,13 @@ bool CompactibleFreeListSpace::should_concurrent_collect() const {
 }
 
 // Support for compaction
-
 void CompactibleFreeListSpace::prepare_for_compaction(CompactPoint* cp) {
-  SCAN_AND_FORWARD(cp,end,block_is_obj,block_size);
+  scan_and_forward(this, cp);
   // Prepare_for_compaction() uses the space between live objects
   // so that later phase can skip dead space quickly.  So verification
   // of the free lists doesn't work after.
 }
 
-#define obj_size(q) adjustObjectSize(oop(q)->size())
-#define adjust_obj_size(s) adjustObjectSize(s)
-
 void CompactibleFreeListSpace::adjust_pointers() {
   // In other versions of adjust_pointers(), a bail out
   // based on the amount of live data in the generation
@@ -2101,12 +2097,12 @@ void CompactibleFreeListSpace::adjust_pointers() {
   // Cannot test used() == 0 here because the free lists have already
   // been mangled by the compaction.
 
-  SCAN_AND_ADJUST_POINTERS(adjust_obj_size);
+  scan_and_adjust_pointers(this);
   // See note about verification in prepare_for_compaction().
 }
 
 void CompactibleFreeListSpace::compact() {
-  SCAN_AND_COMPACT(obj_size);
+  scan_and_compact(this);
 }
 
 // Fragmentation metric = 1 - [sum of (fbs**2) / (sum of fbs)**2]
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp
index 4b10e6fb2bc..5c05828103c 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp
@@ -73,6 +73,13 @@ class CompactibleFreeListSpace: public CompactibleSpace {
   friend class CMSCollector;
   // Local alloc buffer for promotion into this space.
   friend class CFLS_LAB;
+  // Allow scan_and_* functions to call (private) overrides of the auxiliary functions on this class
+  template <typename SpaceType>
+  friend void CompactibleSpace::scan_and_adjust_pointers(SpaceType* space);
+  template <typename SpaceType>
+  friend void CompactibleSpace::scan_and_compact(SpaceType* space);
+  template <typename SpaceType>
+  friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp);
 
   // "Size" of chunks of work (executed during parallel remark phases
   // of CMS collection); this probably belongs in CMSCollector, although
@@ -288,6 +295,28 @@ class CompactibleFreeListSpace: public CompactibleSpace {
     _bt.freed(start, size);
   }
 
+  // Auxiliary functions for scan_and_{forward,adjust_pointers,compact} support.
+  // See comments for CompactibleSpace for more information.
+  inline HeapWord* scan_limit() const {
+    return end();
+  }
+
+  inline bool scanned_block_is_obj(const HeapWord* addr) const {
+    return CompactibleFreeListSpace::block_is_obj(addr); // Avoid virtual call
+  }
+
+  inline size_t scanned_block_size(const HeapWord* addr) const {
+    return CompactibleFreeListSpace::block_size(addr); // Avoid virtual call
+  }
+
+  inline size_t adjust_obj_size(size_t size) const {
+    return adjustObjectSize(size);
+  }
+
+  inline size_t obj_size(const HeapWord* addr) const {
+    return adjustObjectSize(oop(addr)->size());
+  }
+
  protected:
   // Reset the indexed free list to its initial empty condition.
   void resetIndexedFreeListArray();
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
index 55e74c6669c..3b49ff164fb 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
@@ -960,6 +960,10 @@ void HeapRegion::verify() const {
   verify(VerifyOption_G1UsePrevMarking, /* failures */ &dummy);
 }
 
+void HeapRegion::prepare_for_compaction(CompactPoint* cp) {
+  scan_and_forward(this, cp);
+}
+
 // G1OffsetTableContigSpace code; copied from space.cpp.  Hope this can go
 // away eventually.
 
@@ -1043,12 +1047,6 @@ void G1OffsetTableContigSpace::object_iterate(ObjectClosure* blk) {
   }
 }
 
-#define block_is_always_obj(q) true
-void G1OffsetTableContigSpace::prepare_for_compaction(CompactPoint* cp) {
-  SCAN_AND_FORWARD(cp, top, block_is_always_obj, block_size);
-}
-#undef block_is_always_obj
-
 G1OffsetTableContigSpace::
 G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray,
                          MemRegion mr) :
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp
index 916726e48a0..997524b5bed 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp
@@ -187,8 +187,6 @@ class G1OffsetTableContigSpace: public CompactibleSpace {
   HeapWord* block_start(const void* p);
   HeapWord* block_start_const(const void* p) const;
 
-  void prepare_for_compaction(CompactPoint* cp);
-
   // Add offset table update.
   virtual HeapWord* allocate(size_t word_size);
   HeapWord* par_allocate(size_t word_size);
@@ -210,6 +208,9 @@ class G1OffsetTableContigSpace: public CompactibleSpace {
 
 class HeapRegion: public G1OffsetTableContigSpace {
   friend class VMStructs;
+  // Allow scan_and_forward to call (private) overrides for auxiliary functions on this class
+  template <typename SpaceType>
+  friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp);
  private:
 
   // The remembered set for this region.
@@ -219,6 +220,20 @@ class HeapRegion: public G1OffsetTableContigSpace {
 
   G1BlockOffsetArrayContigSpace* offsets() { return &_offsets; }
 
+  // Auxiliary functions for scan_and_forward support.
+  // See comments for CompactibleSpace for more information.
+  inline HeapWord* scan_limit() const {
+    return top();
+  }
+
+  inline bool scanned_block_is_obj(const HeapWord* addr) const {
+    return true; // Always true, since scan_limit is top
+  }
+
+  inline size_t scanned_block_size(const HeapWord* addr) const {
+    return HeapRegion::block_size(addr); // Avoid virtual call
+  }
+
  protected:
   // The index of this region in the heap region sequence.
   uint  _hrm_index;
@@ -340,6 +355,9 @@ class HeapRegion: public G1OffsetTableContigSpace {
   // and the amount of unallocated words if called on top()
   size_t block_size(const HeapWord* p) const;
 
+  // Override for scan_and_forward support.
+  void prepare_for_compaction(CompactPoint* cp);
+
   inline HeapWord* par_allocate_no_bot_updates(size_t word_size);
   inline HeapWord* allocate_no_bot_updates(size_t word_size);
 
diff --git a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp
index c08e7a6379b..ebc89061a32 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/markSweep.inline.hpp
@@ -27,6 +27,7 @@
 
 #include "gc_implementation/shared/markSweep.hpp"
 #include "gc_interface/collectedHeap.hpp"
+#include "oops/markOop.inline.hpp"
 #include "utilities/stack.inline.hpp"
 #include "utilities/macros.hpp"
 #if INCLUDE_ALL_GCS
diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp
index 41f1a72150a..092a68bee70 100644
--- a/hotspot/src/share/vm/memory/space.cpp
+++ b/hotspot/src/share/vm/memory/space.cpp
@@ -438,52 +438,8 @@ bool CompactibleSpace::insert_deadspace(size_t& allowed_deadspace_words,
   }
 }
 
-#define block_is_always_obj(q) true
-#define obj_size(q) oop(q)->size()
-#define adjust_obj_size(s) s
-
-void CompactibleSpace::prepare_for_compaction(CompactPoint* cp) {
-  SCAN_AND_FORWARD(cp, end, block_is_obj, block_size);
-}
-
-// Faster object search.
 void ContiguousSpace::prepare_for_compaction(CompactPoint* cp) {
-  SCAN_AND_FORWARD(cp, top, block_is_always_obj, obj_size);
-}
-
-void Space::adjust_pointers() {
-  // adjust all the interior pointers to point at the new locations of objects
-  // Used by MarkSweep::mark_sweep_phase3()
-
-  // First check to see if there is any work to be done.
-  if (used() == 0) {
-    return;  // Nothing to do.
-  }
-
-  // Otherwise...
-  HeapWord* q = bottom();
-  HeapWord* t = end();
-
-  debug_only(HeapWord* prev_q = NULL);
-  while (q < t) {
-    if (oop(q)->is_gc_marked()) {
-      // q is alive
-
-      // point all the oops to the new location
-      size_t size = oop(q)->adjust_pointers();
-
-      debug_only(prev_q = q);
-
-      q += size;
-    } else {
-      // q is not a live object.  But we're not in a compactible space,
-      // So we don't have live ranges.
-      debug_only(prev_q = q);
-      q += block_size(q);
-      assert(q > prev_q, "we should be moving forward through memory");
-    }
-  }
-  assert(q == t, "just checking");
+  scan_and_forward(this, cp);
 }
 
 void CompactibleSpace::adjust_pointers() {
@@ -492,11 +448,11 @@ void CompactibleSpace::adjust_pointers() {
     return;   // Nothing to do.
   }
 
-  SCAN_AND_ADJUST_POINTERS(adjust_obj_size);
+  scan_and_adjust_pointers(this);
 }
 
 void CompactibleSpace::compact() {
-  SCAN_AND_COMPACT(obj_size);
+  scan_and_compact(this);
 }
 
 void Space::print_short() const { print_short_on(tty); }
diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp
index f7c313cca0d..dddbcf26109 100644
--- a/hotspot/src/share/vm/memory/space.hpp
+++ b/hotspot/src/share/vm/memory/space.hpp
@@ -46,6 +46,7 @@
 // - Space               -- an abstract base class describing a heap area
 //   - CompactibleSpace  -- a space supporting compaction
 //     - CompactibleFreeListSpace -- (used for CMS generation)
+//     - G1OffsetTableContigSpace -- G1 version of OffsetTableContigSpace
 //     - ContiguousSpace -- a compactible space in which all free space
 //                          is contiguous
 //       - EdenSpace     -- contiguous space used as nursery
@@ -238,7 +239,7 @@ class Space: public CHeapObj<mtGC> {
 
   // Mark-sweep-compact support: all spaces can update pointers to objects
   // moving as a part of compaction.
-  virtual void adjust_pointers();
+  virtual void adjust_pointers() = 0;
 
   // PrintHeapAtGC support
   virtual void print() const;
@@ -339,7 +340,36 @@ public:
 // necessarily, a space that is normally contiguous.  But, for example, a
 // free-list-based space whose normal collection is a mark-sweep without
 // compaction could still support compaction in full GC's.
-
+//
+// The compaction operations are implemented by the
+// scan_and_{adjust_pointers,compact,forward} function templates.
+// The following are, non-virtual, auxiliary functions used by these function templates:
+// - scan_limit()
+// - scanned_block_is_obj()
+// - scanned_block_size()
+// - adjust_obj_size()
+// - obj_size()
+// These functions are to be used exclusively by the scan_and_* function templates,
+// and must be defined for all (non-abstract) subclasses of CompactibleSpace.
+//
+// NOTE: Any subclasses to CompactibleSpace wanting to change/define the behavior
+// in any of the auxiliary functions must also override the corresponding
+// prepare_for_compaction/adjust_pointers/compact functions using them.
+// If not, such changes will not be used or have no effect on the compaction operations.
+//
+// This translates to the following dependencies:
+// Overrides/definitions of
+//  - scan_limit
+//  - scanned_block_is_obj
+//  - scanned_block_size
+// require override/definition of prepare_for_compaction().
+// Similar dependencies exist between
+//  - adjust_obj_size  and adjust_pointers()
+//  - obj_size         and compact().
+//
+// Additionally, this also means that changes to block_size() or block_is_obj() that
+// should be effective during the compaction operations must provide a corresponding
+// definition of scanned_block_size/scanned_block_is_obj respectively.
 class CompactibleSpace: public Space {
   friend class VMStructs;
   friend class CompactibleFreeListSpace;
@@ -347,6 +377,15 @@ private:
   HeapWord* _compaction_top;
   CompactibleSpace* _next_compaction_space;
 
+  // Auxiliary functions for scan_and_{forward,adjust_pointers,compact} support.
+  inline size_t adjust_obj_size(size_t size) const {
+    return size;
+  }
+
+  inline size_t obj_size(const HeapWord* addr) const {
+    return oop(addr)->size();
+  }
+
 public:
   CompactibleSpace() :
    _compaction_top(NULL), _next_compaction_space(NULL) {}
@@ -390,7 +429,7 @@ public:
   // "cp->compaction_space" up-to-date.  Offset tables may be updated in
   // this phase as if the final copy had occurred; if so, "cp->threshold"
   // indicates when the next such action should be taken.
-  virtual void prepare_for_compaction(CompactPoint* cp);
+  virtual void prepare_for_compaction(CompactPoint* cp) = 0;
   // MarkSweep support phase3
   virtual void adjust_pointers();
   // MarkSweep support phase4
@@ -449,6 +488,25 @@ protected:
   // words remaining after this operation.
   bool insert_deadspace(size_t& allowed_deadspace_words, HeapWord* q,
                         size_t word_len);
+
+  // Below are template functions for scan_and_* algorithms (avoiding virtual calls).
+  // The space argument should be a subclass of CompactibleSpace, implementing
+  // scan_limit(), scanned_block_is_obj(), and scanned_block_size(),
+  // and possibly also overriding obj_size(), and adjust_obj_size().
+  // These functions should avoid virtual calls whenever possible.
+
+  // Frequently calls adjust_obj_size().
+  template <class SpaceType>
+  static inline void scan_and_adjust_pointers(SpaceType* space);
+
+  // Frequently calls obj_size().
+  template <class SpaceType>
+  static inline void scan_and_compact(SpaceType* space);
+
+  // Frequently calls scanned_block_is_obj() and scanned_block_size().
+  // Requires the scan_limit() function.
+  template <class SpaceType>
+  static inline void scan_and_forward(SpaceType* space, CompactPoint* cp);
 };
 
 class GenSpaceMangler;
@@ -458,6 +516,25 @@ class GenSpaceMangler;
 class ContiguousSpace: public CompactibleSpace {
   friend class OneContigSpaceCardGeneration;
   friend class VMStructs;
+  // Allow scan_and_forward function to call (private) overrides for auxiliary functions on this class
+  template <typename SpaceType>
+  friend void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp);
+
+ private:
+  // Auxiliary functions for scan_and_forward support.
+  // See comments for CompactibleSpace for more information.
+  inline HeapWord* scan_limit() const {
+    return top();
+  }
+
+  inline bool scanned_block_is_obj(const HeapWord* addr) const {
+    return true; // Always true, since scan_limit is top
+  }
+
+  inline size_t scanned_block_size(const HeapWord* addr) const {
+    return oop(addr)->size();
+  }
+
  protected:
   HeapWord* _top;
   HeapWord* _concurrent_iteration_safe_limit;
@@ -622,7 +699,6 @@ class ContiguousSpace: public CompactibleSpace {
   // Used to increase collection frequency.  "factor" of 0 means entire
   // space.
   void allocate_temporary_filler(int factor);
-
 };
 
 
diff --git a/hotspot/src/share/vm/memory/space.inline.hpp b/hotspot/src/share/vm/memory/space.inline.hpp
index 007cebd16e6..d85ba249e28 100644
--- a/hotspot/src/share/vm/memory/space.inline.hpp
+++ b/hotspot/src/share/vm/memory/space.inline.hpp
@@ -25,6 +25,9 @@
 #ifndef SHARE_VM_MEMORY_SPACE_INLINE_HPP
 #define SHARE_VM_MEMORY_SPACE_INLINE_HPP
 
+#include "gc_implementation/shared/liveRange.hpp"
+#include "gc_implementation/shared/markSweep.inline.hpp"
+#include "gc_implementation/shared/spaceDecorator.hpp"
 #include "gc_interface/collectedHeap.hpp"
 #include "memory/space.hpp"
 #include "memory/universe.hpp"
@@ -35,272 +38,6 @@ inline HeapWord* Space::block_start(const void* p) {
   return block_start_const(p);
 }
 
-#define SCAN_AND_FORWARD(cp,scan_limit,block_is_obj,block_size) {            \
-  /* Compute the new addresses for the live objects and store it in the mark \
-   * Used by universe::mark_sweep_phase2()                                   \
-   */                                                                        \
-  HeapWord* compact_top; /* This is where we are currently compacting to. */ \
-                                                                             \
-  /* We're sure to be here before any objects are compacted into this        \
-   * space, so this is a good time to initialize this:                       \
-   */                                                                        \
-  set_compaction_top(bottom());                                              \
-                                                                             \
-  if (cp->space == NULL) {                                                   \
-    assert(cp->gen != NULL, "need a generation");                            \
-    assert(cp->threshold == NULL, "just checking");                          \
-    assert(cp->gen->first_compaction_space() == this, "just checking");      \
-    cp->space = cp->gen->first_compaction_space();                           \
-    compact_top = cp->space->bottom();                                       \
-    cp->space->set_compaction_top(compact_top);                              \
-    cp->threshold = cp->space->initialize_threshold();                       \
-  } else {                                                                   \
-    compact_top = cp->space->compaction_top();                               \
-  }                                                                          \
-                                                                             \
-  /* We allow some amount of garbage towards the bottom of the space, so     \
-   * we don't start compacting before there is a significant gain to be made.\
-   * Occasionally, we want to ensure a full compaction, which is determined  \
-   * by the MarkSweepAlwaysCompactCount parameter.                           \
-   */                                                                        \
-  uint invocations = MarkSweep::total_invocations();                         \
-  bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0);       \
-                                                                             \
-  size_t allowed_deadspace = 0;                                              \
-  if (skip_dead) {                                                           \
-    const size_t ratio = allowed_dead_ratio();                               \
-    allowed_deadspace = (capacity() * ratio / 100) / HeapWordSize;           \
-  }                                                                          \
-                                                                             \
-  HeapWord* q = bottom();                                                    \
-  HeapWord* t = scan_limit();                                                \
-                                                                             \
-  HeapWord*  end_of_live= q;    /* One byte beyond the last byte of the last \
-                                   live object. */                           \
-  HeapWord*  first_dead = end();/* The first dead object. */                 \
-  LiveRange* liveRange  = NULL; /* The current live range, recorded in the   \
-                                   first header of preceding free area. */   \
-  _first_dead = first_dead;                                                  \
-                                                                             \
-  const intx interval = PrefetchScanIntervalInBytes;                         \
-                                                                             \
-  while (q < t) {                                                            \
-    assert(!block_is_obj(q) ||                                               \
-           oop(q)->mark()->is_marked() || oop(q)->mark()->is_unlocked() ||   \
-           oop(q)->mark()->has_bias_pattern(),                               \
-           "these are the only valid states during a mark sweep");           \
-    if (block_is_obj(q) && oop(q)->is_gc_marked()) {                         \
-      /* prefetch beyond q */                                                \
-      Prefetch::write(q, interval);                                          \
-      size_t size = block_size(q);                                           \
-      compact_top = cp->space->forward(oop(q), size, cp, compact_top);       \
-      q += size;                                                             \
-      end_of_live = q;                                                       \
-    } else {                                                                 \
-      /* run over all the contiguous dead objects */                         \
-      HeapWord* end = q;                                                     \
-      do {                                                                   \
-        /* prefetch beyond end */                                            \
-        Prefetch::write(end, interval);                                      \
-        end += block_size(end);                                              \
-      } while (end < t && (!block_is_obj(end) || !oop(end)->is_gc_marked()));\
-                                                                             \
-      /* see if we might want to pretend this object is alive so that        \
-       * we don't have to compact quite as often.                            \
-       */                                                                    \
-      if (allowed_deadspace > 0 && q == compact_top) {                       \
-        size_t sz = pointer_delta(end, q);                                   \
-        if (insert_deadspace(allowed_deadspace, q, sz)) {                    \
-          compact_top = cp->space->forward(oop(q), sz, cp, compact_top);     \
-          q = end;                                                           \
-          end_of_live = end;                                                 \
-          continue;                                                          \
-        }                                                                    \
-      }                                                                      \
-                                                                             \
-      /* otherwise, it really is a free region. */                           \
-                                                                             \
-      /* for the previous LiveRange, record the end of the live objects. */  \
-      if (liveRange) {                                                       \
-        liveRange->set_end(q);                                               \
-      }                                                                      \
-                                                                             \
-      /* record the current LiveRange object.                                \
-       * liveRange->start() is overlaid on the mark word.                    \
-       */                                                                    \
-      liveRange = (LiveRange*)q;                                             \
-      liveRange->set_start(end);                                             \
-      liveRange->set_end(end);                                               \
-                                                                             \
-      /* see if this is the first dead region. */                            \
-      if (q < first_dead) {                                                  \
-        first_dead = q;                                                      \
-      }                                                                      \
-                                                                             \
-      /* move on to the next object */                                       \
-      q = end;                                                               \
-    }                                                                        \
-  }                                                                          \
-                                                                             \
-  assert(q == t, "just checking");                                           \
-  if (liveRange != NULL) {                                                   \
-    liveRange->set_end(q);                                                   \
-  }                                                                          \
-  _end_of_live = end_of_live;                                                \
-  if (end_of_live < first_dead) {                                            \
-    first_dead = end_of_live;                                                \
-  }                                                                          \
-  _first_dead = first_dead;                                                  \
-                                                                             \
-  /* save the compaction_top of the compaction space. */                     \
-  cp->space->set_compaction_top(compact_top);                                \
-}
-
-#define SCAN_AND_ADJUST_POINTERS(adjust_obj_size) {                             \
-  /* adjust all the interior pointers to point at the new locations of objects  \
-   * Used by MarkSweep::mark_sweep_phase3() */                                  \
-                                                                                \
-  HeapWord* q = bottom();                                                       \
-  HeapWord* t = _end_of_live;  /* Established by "prepare_for_compaction". */   \
-                                                                                \
-  assert(_first_dead <= _end_of_live, "Stands to reason, no?");                 \
-                                                                                \
-  if (q < t && _first_dead > q &&                                               \
-      !oop(q)->is_gc_marked()) {                                                \
-    /* we have a chunk of the space which hasn't moved and we've                \
-     * reinitialized the mark word during the previous pass, so we can't        \
-     * use is_gc_marked for the traversal. */                                   \
-    HeapWord* end = _first_dead;                                                \
-                                                                                \
-    while (q < end) {                                                           \
-      /* I originally tried to conjoin "block_start(q) == q" to the             \
-       * assertion below, but that doesn't work, because you can't              \
-       * accurately traverse previous objects to get to the current one         \
-       * after their pointers have been                                         \
-       * updated, until the actual compaction is done.  dld, 4/00 */            \
-      assert(block_is_obj(q),                                                   \
-             "should be at block boundaries, and should be looking at objs");   \
-                                                                                \
-      /* point all the oops to the new location */                              \
-      size_t size = oop(q)->adjust_pointers();                                  \
-      size = adjust_obj_size(size);                                             \
-                                                                                \
-      q += size;                                                                \
-    }                                                                           \
-                                                                                \
-    if (_first_dead == t) {                                                     \
-      q = t;                                                                    \
-    } else {                                                                    \
-      /* $$$ This is funky.  Using this to read the previously written          \
-       * LiveRange.  See also use below. */                                     \
-      q = (HeapWord*)oop(_first_dead)->mark()->decode_pointer();                \
-    }                                                                           \
-  }                                                                             \
-                                                                                \
-  const intx interval = PrefetchScanIntervalInBytes;                            \
-                                                                                \
-  debug_only(HeapWord* prev_q = NULL);                                          \
-  while (q < t) {                                                               \
-    /* prefetch beyond q */                                                     \
-    Prefetch::write(q, interval);                                               \
-    if (oop(q)->is_gc_marked()) {                                               \
-      /* q is alive */                                                          \
-      /* point all the oops to the new location */                              \
-      size_t size = oop(q)->adjust_pointers();                                  \
-      size = adjust_obj_size(size);                                             \
-      debug_only(prev_q = q);                                                   \
-      q += size;                                                                \
-    } else {                                                                    \
-      /* q is not a live object, so its mark should point at the next           \
-       * live object */                                                         \
-      debug_only(prev_q = q);                                                   \
-      q = (HeapWord*) oop(q)->mark()->decode_pointer();                         \
-      assert(q > prev_q, "we should be moving forward through memory");         \
-    }                                                                           \
-  }                                                                             \
-                                                                                \
-  assert(q == t, "just checking");                                              \
-}
-
-#define SCAN_AND_COMPACT(obj_size) {                                            \
-  /* Copy all live objects to their new location                                \
-   * Used by MarkSweep::mark_sweep_phase4() */                                  \
-                                                                                \
-  HeapWord*       q = bottom();                                                 \
-  HeapWord* const t = _end_of_live;                                             \
-  debug_only(HeapWord* prev_q = NULL);                                          \
-                                                                                \
-  if (q < t && _first_dead > q &&                                               \
-      !oop(q)->is_gc_marked()) {                                                \
-    debug_only(                                                                 \
-    /* we have a chunk of the space which hasn't moved and we've reinitialized  \
-     * the mark word during the previous pass, so we can't use is_gc_marked for \
-     * the traversal. */                                                        \
-    HeapWord* const end = _first_dead;                                          \
-                                                                                \
-    while (q < end) {                                                           \
-      size_t size = obj_size(q);                                                \
-      assert(!oop(q)->is_gc_marked(),                                           \
-             "should be unmarked (special dense prefix handling)");             \
-      debug_only(prev_q = q);                                                   \
-      q += size;                                                                \
-    }                                                                           \
-    )  /* debug_only */                                                         \
-                                                                                \
-    if (_first_dead == t) {                                                     \
-      q = t;                                                                    \
-    } else {                                                                    \
-      /* $$$ Funky */                                                           \
-      q = (HeapWord*) oop(_first_dead)->mark()->decode_pointer();               \
-    }                                                                           \
-  }                                                                             \
-                                                                                \
-  const intx scan_interval = PrefetchScanIntervalInBytes;                       \
-  const intx copy_interval = PrefetchCopyIntervalInBytes;                       \
-  while (q < t) {                                                               \
-    if (!oop(q)->is_gc_marked()) {                                              \
-      /* mark is pointer to next marked oop */                                  \
-      debug_only(prev_q = q);                                                   \
-      q = (HeapWord*) oop(q)->mark()->decode_pointer();                         \
-      assert(q > prev_q, "we should be moving forward through memory");         \
-    } else {                                                                    \
-      /* prefetch beyond q */                                                   \
-      Prefetch::read(q, scan_interval);                                         \
-                                                                                \
-      /* size and destination */                                                \
-      size_t size = obj_size(q);                                                \
-      HeapWord* compaction_top = (HeapWord*)oop(q)->forwardee();                \
-                                                                                \
-      /* prefetch beyond compaction_top */                                      \
-      Prefetch::write(compaction_top, copy_interval);                           \
-                                                                                \
-      /* copy object and reinit its mark */                                     \
-      assert(q != compaction_top, "everything in this pass should be moving");  \
-      Copy::aligned_conjoint_words(q, compaction_top, size);                    \
-      oop(compaction_top)->init_mark();                                         \
-      assert(oop(compaction_top)->klass() != NULL, "should have a class");      \
-                                                                                \
-      debug_only(prev_q = q);                                                   \
-      q += size;                                                                \
-    }                                                                           \
-  }                                                                             \
-                                                                                \
-  /* Let's remember if we were empty before we did the compaction. */           \
-  bool was_empty = used_region().is_empty();                                    \
-  /* Reset space after compaction is complete */                                \
-  reset_after_compaction();                                                     \
-  /* We do this clear, below, since it has overloaded meanings for some */      \
-  /* space subtypes.  For example, OffsetTableContigSpace's that were   */      \
-  /* compacted into will have had their offset table thresholds updated */      \
-  /* continuously, but those that weren't need to have their thresholds */      \
-  /* re-initialized.  Also mangles unused area for debugging.           */      \
-  if (used_region().is_empty()) {                                               \
-    if (!was_empty) clear(SpaceDecorator::Mangle);                              \
-  } else {                                                                      \
-    if (ZapUnusedHeapArea) mangle_unused_area();                                \
-  }                                                                             \
-}
-
 inline HeapWord* OffsetTableContigSpace::allocate(size_t size) {
   HeapWord* res = ContiguousSpace::allocate(size);
   if (res != NULL) {
@@ -334,4 +71,263 @@ OffsetTableContigSpace::block_start_const(const void* p) const {
   return _offsets.block_start(p);
 }
 
+template <class SpaceType>
+inline void CompactibleSpace::scan_and_forward(SpaceType* space, CompactPoint* cp) {
+  // Compute the new addresses for the live objects and store it in the mark
+  // Used by universe::mark_sweep_phase2()
+  HeapWord* compact_top; // This is where we are currently compacting to.
+
+  // We're sure to be here before any objects are compacted into this
+  // space, so this is a good time to initialize this:
+  space->set_compaction_top(space->bottom());
+
+  if (cp->space == NULL) {
+    assert(cp->gen != NULL, "need a generation");
+    assert(cp->threshold == NULL, "just checking");
+    assert(cp->gen->first_compaction_space() == space, "just checking");
+    cp->space = cp->gen->first_compaction_space();
+    compact_top = cp->space->bottom();
+    cp->space->set_compaction_top(compact_top);
+    cp->threshold = cp->space->initialize_threshold();
+  } else {
+    compact_top = cp->space->compaction_top();
+  }
+
+  // We allow some amount of garbage towards the bottom of the space, so
+  // we don't start compacting before there is a significant gain to be made.
+  // Occasionally, we want to ensure a full compaction, which is determined
+  // by the MarkSweepAlwaysCompactCount parameter.
+  uint invocations = MarkSweep::total_invocations();
+  bool skip_dead = ((invocations % MarkSweepAlwaysCompactCount) != 0);
+
+  size_t allowed_deadspace = 0;
+  if (skip_dead) {
+    const size_t ratio = space->allowed_dead_ratio();
+    allowed_deadspace = (space->capacity() * ratio / 100) / HeapWordSize;
+  }
+
+  HeapWord* q = space->bottom();
+  HeapWord* t = space->scan_limit();
+
+  HeapWord*  end_of_live= q;            // One byte beyond the last byte of the last
+                                        // live object.
+  HeapWord*  first_dead = space->end(); // The first dead object.
+  LiveRange* liveRange  = NULL;         // The current live range, recorded in the
+                                        // first header of preceding free area.
+  space->_first_dead = first_dead;
+
+  const intx interval = PrefetchScanIntervalInBytes;
+
+  while (q < t) {
+    assert(!space->scanned_block_is_obj(q) ||
+           oop(q)->mark()->is_marked() || oop(q)->mark()->is_unlocked() ||
+           oop(q)->mark()->has_bias_pattern(),
+           "these are the only valid states during a mark sweep");
+    if (space->scanned_block_is_obj(q) && oop(q)->is_gc_marked()) {
+      // prefetch beyond q
+      Prefetch::write(q, interval);
+      size_t size = space->scanned_block_size(q);
+      compact_top = cp->space->forward(oop(q), size, cp, compact_top);
+      q += size;
+      end_of_live = q;
+    } else {
+      // run over all the contiguous dead objects
+      HeapWord* end = q;
+      do {
+        // prefetch beyond end
+        Prefetch::write(end, interval);
+        end += space->scanned_block_size(end);
+      } while (end < t && (!space->scanned_block_is_obj(end) || !oop(end)->is_gc_marked()));
+
+      // see if we might want to pretend this object is alive so that
+      // we don't have to compact quite as often.
+      if (allowed_deadspace > 0 && q == compact_top) {
+        size_t sz = pointer_delta(end, q);
+        if (space->insert_deadspace(allowed_deadspace, q, sz)) {
+          compact_top = cp->space->forward(oop(q), sz, cp, compact_top);
+          q = end;
+          end_of_live = end;
+          continue;
+        }
+      }
+
+      // otherwise, it really is a free region.
+
+      // for the previous LiveRange, record the end of the live objects.
+      if (liveRange) {
+        liveRange->set_end(q);
+      }
+
+      // record the current LiveRange object.
+      // liveRange->start() is overlaid on the mark word.
+      liveRange = (LiveRange*)q;
+      liveRange->set_start(end);
+      liveRange->set_end(end);
+
+      // see if this is the first dead region.
+      if (q < first_dead) {
+        first_dead = q;
+      }
+
+      // move on to the next object
+      q = end;
+    }
+  }
+
+  assert(q == t, "just checking");
+  if (liveRange != NULL) {
+    liveRange->set_end(q);
+  }
+  space->_end_of_live = end_of_live;
+  if (end_of_live < first_dead) {
+    first_dead = end_of_live;
+  }
+  space->_first_dead = first_dead;
+
+  // save the compaction_top of the compaction space.
+  cp->space->set_compaction_top(compact_top);
+}
+
+template <class SpaceType>
+inline void CompactibleSpace::scan_and_adjust_pointers(SpaceType* space) {
+  // adjust all the interior pointers to point at the new locations of objects
+  // Used by MarkSweep::mark_sweep_phase3()
+
+  HeapWord* q = space->bottom();
+  HeapWord* t = space->_end_of_live;  // Established by "prepare_for_compaction".
+
+  assert(space->_first_dead <= space->_end_of_live, "Stands to reason, no?");
+
+  if (q < t && space->_first_dead > q && !oop(q)->is_gc_marked()) {
+    // we have a chunk of the space which hasn't moved and we've
+    // reinitialized the mark word during the previous pass, so we can't
+    // use is_gc_marked for the traversal.
+    HeapWord* end = space->_first_dead;
+
+    while (q < end) {
+      // I originally tried to conjoin "block_start(q) == q" to the
+      // assertion below, but that doesn't work, because you can't
+      // accurately traverse previous objects to get to the current one
+      // after their pointers have been
+      // updated, until the actual compaction is done.  dld, 4/00
+      assert(space->block_is_obj(q), "should be at block boundaries, and should be looking at objs");
+
+      // point all the oops to the new location
+      size_t size = oop(q)->adjust_pointers();
+      size = space->adjust_obj_size(size);
+
+      q += size;
+    }
+
+    if (space->_first_dead == t) {
+      q = t;
+    } else {
+      // $$$ This is funky.  Using this to read the previously written
+      // LiveRange.  See also use below.
+      q = (HeapWord*)oop(space->_first_dead)->mark()->decode_pointer();
+    }
+  }
+
+  const intx interval = PrefetchScanIntervalInBytes;
+
+  debug_only(HeapWord* prev_q = NULL);
+  while (q < t) {
+    // prefetch beyond q
+    Prefetch::write(q, interval);
+    if (oop(q)->is_gc_marked()) {
+      // q is alive
+      // point all the oops to the new location
+      size_t size = oop(q)->adjust_pointers();
+      size = space->adjust_obj_size(size);
+      debug_only(prev_q = q);
+      q += size;
+    } else {
+      // q is not a live object, so its mark should point at the next
+      // live object
+      debug_only(prev_q = q);
+      q = (HeapWord*) oop(q)->mark()->decode_pointer();
+      assert(q > prev_q, "we should be moving forward through memory");
+    }
+  }
+
+  assert(q == t, "just checking");
+}
+
+template <class SpaceType>
+inline void CompactibleSpace::scan_and_compact(SpaceType* space) {
+  // Copy all live objects to their new location
+  // Used by MarkSweep::mark_sweep_phase4()
+
+  HeapWord*       q = space->bottom();
+  HeapWord* const t = space->_end_of_live;
+  debug_only(HeapWord* prev_q = NULL);
+
+  if (q < t && space->_first_dead > q && !oop(q)->is_gc_marked()) {
+    #ifdef ASSERT // Debug only
+      // we have a chunk of the space which hasn't moved and we've reinitialized
+      // the mark word during the previous pass, so we can't use is_gc_marked for
+      // the traversal.
+      HeapWord* const end = space->_first_dead;
+
+      while (q < end) {
+        size_t size = space->obj_size(q);
+        assert(!oop(q)->is_gc_marked(), "should be unmarked (special dense prefix handling)");
+        prev_q = q;
+        q += size;
+      }
+    #endif
+
+    if (space->_first_dead == t) {
+      q = t;
+    } else {
+      // $$$ Funky
+      q = (HeapWord*) oop(space->_first_dead)->mark()->decode_pointer();
+    }
+  }
+
+  const intx scan_interval = PrefetchScanIntervalInBytes;
+  const intx copy_interval = PrefetchCopyIntervalInBytes;
+  while (q < t) {
+    if (!oop(q)->is_gc_marked()) {
+      // mark is pointer to next marked oop
+      debug_only(prev_q = q);
+      q = (HeapWord*) oop(q)->mark()->decode_pointer();
+      assert(q > prev_q, "we should be moving forward through memory");
+    } else {
+      // prefetch beyond q
+      Prefetch::read(q, scan_interval);
+
+      // size and destination
+      size_t size = space->obj_size(q);
+      HeapWord* compaction_top = (HeapWord*)oop(q)->forwardee();
+
+      // prefetch beyond compaction_top
+      Prefetch::write(compaction_top, copy_interval);
+
+      // copy object and reinit its mark
+      assert(q != compaction_top, "everything in this pass should be moving");
+      Copy::aligned_conjoint_words(q, compaction_top, size);
+      oop(compaction_top)->init_mark();
+      assert(oop(compaction_top)->klass() != NULL, "should have a class");
+
+      debug_only(prev_q = q);
+      q += size;
+    }
+  }
+
+  // Let's remember if we were empty before we did the compaction.
+  bool was_empty = space->used_region().is_empty();
+  // Reset space after compaction is complete
+  space->reset_after_compaction();
+  // We do this clear, below, since it has overloaded meanings for some
+  // space subtypes.  For example, OffsetTableContigSpace's that were
+  // compacted into will have had their offset table thresholds updated
+  // continuously, but those that weren't need to have their thresholds
+  // re-initialized.  Also mangles unused area for debugging.
+  if (space->used_region().is_empty()) {
+    if (!was_empty) space->clear(SpaceDecorator::Mangle);
+  } else {
+    if (ZapUnusedHeapArea) space->mangle_unused_area();
+  }
+}
 #endif // SHARE_VM_MEMORY_SPACE_INLINE_HPP

From 4601eb634ac385f04815597a53d48a414bf7ffa7 Mon Sep 17 00:00:00 2001
From: Bengt Rutisson <brutisso@openjdk.org>
Date: Fri, 31 Oct 2014 09:10:51 +0100
Subject: [PATCH 028/299] 8061308: Remove iCMS

Reviewed-by: mgerdin, jmasa
---
 .../jvm/hotspot/memory/DefNewGeneration.java  |   4 +-
 .../sun/jvm/hotspot/memory/EdenSpace.java     |  40 ---
 .../src/cpu/ppc/vm/templateTable_ppc_64.cpp   |   2 +-
 .../src/cpu/sparc/vm/macroAssembler_sparc.cpp |   4 +-
 .../src/cpu/sparc/vm/templateTable_sparc.cpp  |   2 +-
 hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp |   4 +-
 .../src/cpu/x86/vm/templateTable_x86_32.cpp   |   2 +-
 .../src/cpu/x86/vm/templateTable_x86_64.cpp   |   2 +-
 hotspot/src/share/vm/Xusage.txt               |   1 -
 .../cmsCollectorPolicy.cpp                    |   6 -
 .../cmsCollectorPolicy.hpp                    |   3 -
 .../concurrentMarkSweepGeneration.cpp         | 273 +-----------------
 .../concurrentMarkSweepGeneration.hpp         |  43 ---
 .../concurrentMarkSweepGeneration.inline.hpp  |  45 ---
 .../concurrentMarkSweepThread.cpp             |  71 +----
 .../concurrentMarkSweepThread.hpp             | 114 +-------
 .../concurrentMarkSweep/vmCMSOperations.cpp   |  10 -
 .../concurrentMarkSweep/vmCMSOperations.hpp   |   4 +-
 .../src/share/vm/memory/collectorPolicy.hpp   |   5 -
 .../src/share/vm/memory/defNewGeneration.cpp  |  47 +--
 .../src/share/vm/memory/defNewGeneration.hpp  |  11 +-
 hotspot/src/share/vm/memory/generation.hpp    |   8 -
 hotspot/src/share/vm/memory/space.cpp         |  57 +---
 hotspot/src/share/vm/memory/space.hpp         |  68 +----
 hotspot/src/share/vm/opto/macro.cpp           |   3 +-
 hotspot/src/share/vm/runtime/arguments.cpp    |  42 +--
 hotspot/src/share/vm/runtime/globals.hpp      |  29 --
 hotspot/src/share/vm/runtime/mutexLocker.cpp  |   4 -
 hotspot/src/share/vm/runtime/mutexLocker.hpp  |   1 -
 hotspot/src/share/vm/runtime/vmStructs.cpp    |   6 +-
 hotspot/test/TEST.groups                      |   5 -
 .../test/gc/g1/TestShrinkAuxiliaryData.java   |   3 +-
 .../TestCMSIncrementalMode.java               |  46 ---
 .../TestCMSNoIncrementalMode.java             |  45 ---
 .../test/gc/startup_warnings/TestIncGC.java   |  46 ---
 35 files changed, 57 insertions(+), 999 deletions(-)
 delete mode 100644 hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/EdenSpace.java
 delete mode 100644 hotspot/test/gc/startup_warnings/TestCMSIncrementalMode.java
 delete mode 100644 hotspot/test/gc/startup_warnings/TestCMSNoIncrementalMode.java
 delete mode 100644 hotspot/test/gc/startup_warnings/TestIncGC.java

diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java
index 89c8dbe4803..bbc44198406 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/DefNewGeneration.java
@@ -64,8 +64,8 @@ public class DefNewGeneration extends Generation {
   }
 
   // Accessing spaces
-  public EdenSpace eden() {
-    return (EdenSpace) VMObjectFactory.newObject(EdenSpace.class, edenSpaceField.getValue(addr));
+  public ContiguousSpace eden() {
+    return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, edenSpaceField.getValue(addr));
   }
 
   public ContiguousSpace from() {
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/EdenSpace.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/EdenSpace.java
deleted file mode 100644
index 67584c3146e..00000000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/EdenSpace.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- *
- */
-
-package sun.jvm.hotspot.memory;
-
-import java.util.*;
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-/** <P> Class EdenSpace describes eden-space in new
-    generation. (Currently it does not add any significant
-    functionality beyond ContiguousSpace.) */
-
-public class EdenSpace extends ContiguousSpace {
-  public EdenSpace(Address addr) {
-    super(addr);
-  }
-}
diff --git a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp
index f0c7097abbd..bf8f5ead1c9 100644
--- a/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp
+++ b/hotspot/src/cpu/ppc/vm/templateTable_ppc_64.cpp
@@ -3513,7 +3513,7 @@ void TemplateTable::_new() {
                  Rtags            = R3_ARG1,
                  Rindex           = R5_ARG3;
 
-  const bool allow_shared_alloc = Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode;
+  const bool allow_shared_alloc = Universe::heap()->supports_inline_contig_alloc();
 
   // --------------------------------------------------------------------------
   // Check if fast case is possible.
diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
index 79ca56aecd3..4b6aa5d4f54 100644
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
@@ -3196,7 +3196,7 @@ void MacroAssembler::eden_allocate(
   assert(0 <= con_size_in_bytes && Assembler::is_simm13(con_size_in_bytes), "illegal object size");
   assert((con_size_in_bytes & MinObjAlignmentInBytesMask) == 0, "object size is not multiple of alignment");
 
-  if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) {
+  if (!Universe::heap()->supports_inline_contig_alloc()) {
     // No allocation in the shared eden.
     ba(slow_case);
     delayed()->nop();
@@ -3331,7 +3331,7 @@ void MacroAssembler::tlab_refill(Label& retry, Label& try_eden, Label& slow_case
   assert_different_registers(top, t1, t2, t3, G4, G5 /* preserve G4 and G5 */);
   Label do_refill, discard_tlab;
 
-  if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) {
+  if (!Universe::heap()->supports_inline_contig_alloc()) {
     // No allocation in the shared eden.
     ba(slow_case);
     delayed()->nop();
diff --git a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp
index cd40653a2fb..9424b1be1f6 100644
--- a/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/templateTable_sparc.cpp
@@ -3309,7 +3309,7 @@ void TemplateTable::_new() {
   // (creates a new TLAB, etc.)
 
   const bool allow_shared_alloc =
-    Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode;
+    Universe::heap()->supports_inline_contig_alloc();
 
   if(UseTLAB) {
     Register RoldTopValue = RallocatedObject;
diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
index 592b45c9fd0..74e52a436ee 100644
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
@@ -2964,7 +2964,7 @@ void MacroAssembler::eden_allocate(Register obj,
                                    Label& slow_case) {
   assert(obj == rax, "obj must be in rax, for cmpxchg");
   assert_different_registers(obj, var_size_in_bytes, t1);
-  if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) {
+  if (!Universe::heap()->supports_inline_contig_alloc()) {
     jmp(slow_case);
   } else {
     Register end = t1;
@@ -4437,7 +4437,7 @@ Register MacroAssembler::tlab_refill(Label& retry,
   assert_different_registers(top, thread_reg, t1, t2, /* preserve: */ rbx, rdx);
   Label do_refill, discard_tlab;
 
-  if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) {
+  if (!Universe::heap()->supports_inline_contig_alloc()) {
     // No allocation in the shared eden.
     jmp(slow_case);
   }
diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp
index 958613081f3..2187056a384 100644
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_32.cpp
@@ -3214,7 +3214,7 @@ void TemplateTable::_new() {
   // (creates a new TLAB, etc.)
 
   const bool allow_shared_alloc =
-    Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode;
+    Universe::heap()->supports_inline_contig_alloc();
 
   const Register thread = rcx;
   if (UseTLAB || allow_shared_alloc) {
diff --git a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp
index cd7ee3b65b0..b1b1b00a615 100644
--- a/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp
+++ b/hotspot/src/cpu/x86/vm/templateTable_x86_64.cpp
@@ -3269,7 +3269,7 @@ void TemplateTable::_new() {
   // (creates a new TLAB, etc.)
 
   const bool allow_shared_alloc =
-    Universe::heap()->supports_inline_contig_alloc() && !CMSIncrementalMode;
+    Universe::heap()->supports_inline_contig_alloc();
 
   if (UseTLAB) {
     __ movptr(rax, Address(r15_thread, in_bytes(JavaThread::tlab_top_offset())));
diff --git a/hotspot/src/share/vm/Xusage.txt b/hotspot/src/share/vm/Xusage.txt
index 11302aaa6d9..acd829b449f 100644
--- a/hotspot/src/share/vm/Xusage.txt
+++ b/hotspot/src/share/vm/Xusage.txt
@@ -7,7 +7,6 @@
     -Xbootclasspath/p:<directories and zip/jar files separated by ;>
                       prepend in front of bootstrap class path
     -Xnoclassgc       disable class garbage collection
-    -Xincgc           enable incremental garbage collection
     -Xloggc:<file>    log GC status to a file with time stamps
     -Xbatch           disable background compilation
     -Xms<size>        set initial Java heap size
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp
index aed729017c0..9bd48077b87 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp
@@ -89,9 +89,3 @@ void ConcurrentMarkSweepPolicy::initialize_gc_policy_counters() {
     _gc_policy_counters = new GCPolicyCounters("Copy:CMS", 2, 3);
   }
 }
-
-// Returns true if the incremental mode is enabled.
-bool ConcurrentMarkSweepPolicy::has_soft_ended_eden()
-{
-  return CMSIncrementalMode;
-}
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp
index 24c59ac83ab..0f09d0cf6ac 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp
@@ -42,9 +42,6 @@ class ConcurrentMarkSweepPolicy : public GenCollectorPolicy {
   virtual void initialize_size_policy(size_t init_eden_size,
                                       size_t init_promo_size,
                                       size_t init_survivor_size);
-
-  // Returns true if the incremental mode is enabled.
-  virtual bool has_soft_ended_eden();
 };
 
 #endif // SHARE_VM_GC_IMPLEMENTATION_CONCURRENTMARKSWEEP_CMSCOLLECTORPOLICY_HPP
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
index bc9547d4ee4..aec716c782a 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
@@ -167,16 +167,6 @@ class CMSTokenSyncWithLocks: public CMSTokenSync {
 };
 
 
-// Wrapper class to temporarily disable icms during a foreground cms collection.
-class ICMSDisabler: public StackObj {
- public:
-  // The ctor disables icms and wakes up the thread so it notices the change;
-  // the dtor re-enables icms.  Note that the CMSCollector methods will check
-  // CMSIncrementalMode.
-  ICMSDisabler()  { CMSCollector::disable_icms(); CMSCollector::start_icms(); }
-  ~ICMSDisabler() { CMSCollector::enable_icms(); }
-};
-
 //////////////////////////////////////////////////////////////////
 //  Concurrent Mark-Sweep Generation /////////////////////////////
 //////////////////////////////////////////////////////////////////
@@ -363,7 +353,6 @@ CMSStats::CMSStats(ConcurrentMarkSweepGeneration* cms_gen, unsigned int alpha):
   _cms_used_at_gc0_end = 0;
   _allow_duty_cycle_reduction = false;
   _valid_bits = 0;
-  _icms_duty_cycle = CMSIncrementalDutyCycle;
 }
 
 double CMSStats::cms_free_adjustment_factor(size_t free) const {
@@ -442,86 +431,17 @@ double CMSStats::time_until_cms_start() const {
   return work - deadline;
 }
 
-// Return a duty cycle based on old_duty_cycle and new_duty_cycle, limiting the
-// amount of change to prevent wild oscillation.
-unsigned int CMSStats::icms_damped_duty_cycle(unsigned int old_duty_cycle,
-                                              unsigned int new_duty_cycle) {
-  assert(old_duty_cycle <= 100, "bad input value");
-  assert(new_duty_cycle <= 100, "bad input value");
-
-  // Note:  use subtraction with caution since it may underflow (values are
-  // unsigned).  Addition is safe since we're in the range 0-100.
-  unsigned int damped_duty_cycle = new_duty_cycle;
-  if (new_duty_cycle < old_duty_cycle) {
-    const unsigned int largest_delta = MAX2(old_duty_cycle / 4, 5U);
-    if (new_duty_cycle + largest_delta < old_duty_cycle) {
-      damped_duty_cycle = old_duty_cycle - largest_delta;
-    }
-  } else if (new_duty_cycle > old_duty_cycle) {
-    const unsigned int largest_delta = MAX2(old_duty_cycle / 4, 15U);
-    if (new_duty_cycle > old_duty_cycle + largest_delta) {
-      damped_duty_cycle = MIN2(old_duty_cycle + largest_delta, 100U);
-    }
-  }
-  assert(damped_duty_cycle <= 100, "invalid duty cycle computed");
-
-  if (CMSTraceIncrementalPacing) {
-    gclog_or_tty->print(" [icms_damped_duty_cycle(%d,%d) = %d] ",
-                           old_duty_cycle, new_duty_cycle, damped_duty_cycle);
-  }
-  return damped_duty_cycle;
-}
-
-unsigned int CMSStats::icms_update_duty_cycle_impl() {
-  assert(CMSIncrementalPacing && valid(),
-         "should be handled in icms_update_duty_cycle()");
-
-  double cms_time_so_far = cms_timer().seconds();
-  double scaled_duration = cms_duration_per_mb() * _cms_used_at_gc0_end / M;
-  double scaled_duration_remaining = fabsd(scaled_duration - cms_time_so_far);
-
-  // Avoid division by 0.
-  double time_until_full = MAX2(time_until_cms_gen_full(), 0.01);
-  double duty_cycle_dbl = 100.0 * scaled_duration_remaining / time_until_full;
-
-  unsigned int new_duty_cycle = MIN2((unsigned int)duty_cycle_dbl, 100U);
-  if (new_duty_cycle > _icms_duty_cycle) {
-    // Avoid very small duty cycles (1 or 2); 0 is allowed.
-    if (new_duty_cycle > 2) {
-      _icms_duty_cycle = icms_damped_duty_cycle(_icms_duty_cycle,
-                                                new_duty_cycle);
-    }
-  } else if (_allow_duty_cycle_reduction) {
-    // The duty cycle is reduced only once per cms cycle (see record_cms_end()).
-    new_duty_cycle = icms_damped_duty_cycle(_icms_duty_cycle, new_duty_cycle);
-    // Respect the minimum duty cycle.
-    unsigned int min_duty_cycle = (unsigned int)CMSIncrementalDutyCycleMin;
-    _icms_duty_cycle = MAX2(new_duty_cycle, min_duty_cycle);
-  }
-
-  if (PrintGCDetails || CMSTraceIncrementalPacing) {
-    gclog_or_tty->print(" icms_dc=%d ", _icms_duty_cycle);
-  }
-
-  _allow_duty_cycle_reduction = false;
-  return _icms_duty_cycle;
-}
-
 #ifndef PRODUCT
 void CMSStats::print_on(outputStream *st) const {
   st->print(" gc0_alpha=%d,cms_alpha=%d", _gc0_alpha, _cms_alpha);
   st->print(",gc0_dur=%g,gc0_per=%g,gc0_promo=" SIZE_FORMAT,
                gc0_duration(), gc0_period(), gc0_promoted());
-  st->print(",cms_dur=%g,cms_dur_per_mb=%g,cms_per=%g,cms_alloc=" SIZE_FORMAT,
-            cms_duration(), cms_duration_per_mb(),
-            cms_period(), cms_allocated());
+  st->print(",cms_dur=%g,cms_per=%g,cms_alloc=" SIZE_FORMAT,
+            cms_duration(), cms_period(), cms_allocated());
   st->print(",cms_since_beg=%g,cms_since_end=%g",
             cms_time_since_begin(), cms_time_since_end());
   st->print(",cms_used_beg=" SIZE_FORMAT ",cms_used_end=" SIZE_FORMAT,
             _cms_used_at_gc0_begin, _cms_used_at_gc0_end);
-  if (CMSIncrementalMode) {
-    st->print(",dc=%d", icms_duty_cycle());
-  }
 
   if (valid()) {
     st->print(",promo_rate=%g,cms_alloc_rate=%g",
@@ -579,8 +499,6 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
 #endif
   _collection_count_start(0),
   _verifying(false),
-  _icms_start_limit(NULL),
-  _icms_stop_limit(NULL),
   _verification_mark_bm(0, Mutex::leaf + 1, "CMS_verification_mark_bm_lock"),
   _completed_initialization(false),
   _collector_policy(cp),
@@ -1116,137 +1034,6 @@ void CMSCollector::promoted(bool par, HeapWord* start,
   }
 }
 
-static inline size_t percent_of_space(Space* space, HeapWord* addr)
-{
-  size_t delta = pointer_delta(addr, space->bottom());
-  return (size_t)(delta * 100.0 / (space->capacity() / HeapWordSize));
-}
-
-void CMSCollector::icms_update_allocation_limits()
-{
-  Generation* young = GenCollectedHeap::heap()->get_gen(0);
-  EdenSpace* eden = young->as_DefNewGeneration()->eden();
-
-  const unsigned int duty_cycle = stats().icms_update_duty_cycle();
-  if (CMSTraceIncrementalPacing) {
-    stats().print();
-  }
-
-  assert(duty_cycle <= 100, "invalid duty cycle");
-  if (duty_cycle != 0) {
-    // The duty_cycle is a percentage between 0 and 100; convert to words and
-    // then compute the offset from the endpoints of the space.
-    size_t free_words = eden->free() / HeapWordSize;
-    double free_words_dbl = (double)free_words;
-    size_t duty_cycle_words = (size_t)(free_words_dbl * duty_cycle / 100.0);
-    size_t offset_words = (free_words - duty_cycle_words) / 2;
-
-    _icms_start_limit = eden->top() + offset_words;
-    _icms_stop_limit = eden->end() - offset_words;
-
-    // The limits may be adjusted (shifted to the right) by
-    // CMSIncrementalOffset, to allow the application more mutator time after a
-    // young gen gc (when all mutators were stopped) and before CMS starts and
-    // takes away one or more cpus.
-    if (CMSIncrementalOffset != 0) {
-      double adjustment_dbl = free_words_dbl * CMSIncrementalOffset / 100.0;
-      size_t adjustment = (size_t)adjustment_dbl;
-      HeapWord* tmp_stop = _icms_stop_limit + adjustment;
-      if (tmp_stop > _icms_stop_limit && tmp_stop < eden->end()) {
-        _icms_start_limit += adjustment;
-        _icms_stop_limit = tmp_stop;
-      }
-    }
-  }
-  if (duty_cycle == 0 || (_icms_start_limit == _icms_stop_limit)) {
-    _icms_start_limit = _icms_stop_limit = eden->end();
-  }
-
-  // Install the new start limit.
-  eden->set_soft_end(_icms_start_limit);
-
-  if (CMSTraceIncrementalMode) {
-    gclog_or_tty->print(" icms alloc limits:  "
-                           PTR_FORMAT "," PTR_FORMAT
-                           " (" SIZE_FORMAT "%%," SIZE_FORMAT "%%) ",
-                           p2i(_icms_start_limit), p2i(_icms_stop_limit),
-                           percent_of_space(eden, _icms_start_limit),
-                           percent_of_space(eden, _icms_stop_limit));
-    if (Verbose) {
-      gclog_or_tty->print("eden:  ");
-      eden->print_on(gclog_or_tty);
-    }
-  }
-}
-
-// Any changes here should try to maintain the invariant
-// that if this method is called with _icms_start_limit
-// and _icms_stop_limit both NULL, then it should return NULL
-// and not notify the icms thread.
-HeapWord*
-CMSCollector::allocation_limit_reached(Space* space, HeapWord* top,
-                                       size_t word_size)
-{
-  // A start_limit equal to end() means the duty cycle is 0, so treat that as a
-  // nop.
-  if (CMSIncrementalMode && _icms_start_limit != space->end()) {
-    if (top <= _icms_start_limit) {
-      if (CMSTraceIncrementalMode) {
-        space->print_on(gclog_or_tty);
-        gclog_or_tty->stamp();
-        gclog_or_tty->print_cr(" start limit top=" PTR_FORMAT
-                               ", new limit=" PTR_FORMAT
-                               " (" SIZE_FORMAT "%%)",
-                               p2i(top), p2i(_icms_stop_limit),
-                               percent_of_space(space, _icms_stop_limit));
-      }
-      ConcurrentMarkSweepThread::start_icms();
-      assert(top < _icms_stop_limit, "Tautology");
-      if (word_size < pointer_delta(_icms_stop_limit, top)) {
-        return _icms_stop_limit;
-      }
-
-      // The allocation will cross both the _start and _stop limits, so do the
-      // stop notification also and return end().
-      if (CMSTraceIncrementalMode) {
-        space->print_on(gclog_or_tty);
-        gclog_or_tty->stamp();
-        gclog_or_tty->print_cr(" +stop limit top=" PTR_FORMAT
-                               ", new limit=" PTR_FORMAT
-                               " (" SIZE_FORMAT "%%)",
-                               p2i(top), p2i(space->end()),
-                               percent_of_space(space, space->end()));
-      }
-      ConcurrentMarkSweepThread::stop_icms();
-      return space->end();
-    }
-
-    if (top <= _icms_stop_limit) {
-      if (CMSTraceIncrementalMode) {
-        space->print_on(gclog_or_tty);
-        gclog_or_tty->stamp();
-        gclog_or_tty->print_cr(" stop limit top=" PTR_FORMAT
-                               ", new limit=" PTR_FORMAT
-                               " (" SIZE_FORMAT "%%)",
-                               top, space->end(),
-                               percent_of_space(space, space->end()));
-      }
-      ConcurrentMarkSweepThread::stop_icms();
-      return space->end();
-    }
-
-    if (CMSTraceIncrementalMode) {
-      space->print_on(gclog_or_tty);
-      gclog_or_tty->stamp();
-      gclog_or_tty->print_cr(" end limit top=" PTR_FORMAT
-                             ", new limit=" PTR_FORMAT,
-                             top, NULL);
-    }
-  }
-
-  return NULL;
-}
-
 oop ConcurrentMarkSweepGeneration::promote(oop obj, size_t obj_size) {
   assert(obj_size == (size_t)obj->size(), "bad obj_size passed in");
   // allocate, copy and if necessary update promoinfo --
@@ -1289,14 +1076,6 @@ oop ConcurrentMarkSweepGeneration::promote(oop obj, size_t obj_size) {
 }
 
 
-HeapWord*
-ConcurrentMarkSweepGeneration::allocation_limit_reached(Space* space,
-                                             HeapWord* top,
-                                             size_t word_sz)
-{
-  return collector()->allocation_limit_reached(space, top, word_sz);
-}
-
 // IMPORTANT: Notes on object size recognition in CMS.
 // ---------------------------------------------------
 // A block of storage in the CMS generation is always in
@@ -1809,9 +1588,6 @@ void CMSCollector::acquire_control_and_collect(bool full,
   // we want to do a foreground collection.
   _foregroundGCIsActive = true;
 
-  // Disable incremental mode during a foreground collection.
-  ICMSDisabler icms_disabler;
-
   // release locks and wait for a notify from the background collector
   // releasing the locks in only necessary for phases which
   // do yields to improve the granularity of the collection.
@@ -2135,7 +1911,7 @@ void CMSCollector::do_mark_sweep_work(bool clear_all_soft_refs,
 
 void CMSCollector::print_eden_and_survivor_chunk_arrays() {
   DefNewGeneration* dng = _young_gen->as_DefNewGeneration();
-  EdenSpace* eden_space = dng->eden();
+  ContiguousSpace* eden_space = dng->eden();
   ContiguousSpace* from_space = dng->from();
   ContiguousSpace* to_space   = dng->to();
   // Eden
@@ -2783,10 +2559,6 @@ void CMSCollector::gc_epilogue(bool full) {
   //
   _cmsGen->update_counters(cms_used);
 
-  if (CMSIncrementalMode) {
-    icms_update_allocation_limits();
-  }
-
   bitMapLock()->unlock();
   releaseFreelistLocks();
 
@@ -4272,12 +4044,10 @@ void CMSConcMarkingTask::coordinator_yield() {
   assert_lock_strong(_bit_map_lock);
   _bit_map_lock->unlock();
   ConcurrentMarkSweepThread::desynchronize(true);
-  ConcurrentMarkSweepThread::acknowledge_yield_request();
   _collector->stopTimer();
   if (PrintCMSStatistics != 0) {
     _collector->incrementYields();
   }
-  _collector->icms_wait();
 
   // It is possible for whichever thread initiated the yield request
   // not to get a chance to wake up and take the bitmap lock between
@@ -4307,7 +4077,6 @@ void CMSConcMarkingTask::coordinator_yield() {
                    ConcurrentMarkSweepThread::should_yield() &&
                    !CMSCollector::foregroundGCIsActive(); ++i) {
     os::sleep(Thread::current(), 1, false);
-    ConcurrentMarkSweepThread::acknowledge_yield_request();
   }
 
   ConcurrentMarkSweepThread::synchronize(true);
@@ -5238,7 +5007,7 @@ class RemarkKlassClosure : public KlassClosure {
 
 void CMSParMarkTask::work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl) {
   DefNewGeneration* dng = _collector->_young_gen->as_DefNewGeneration();
-  EdenSpace* eden_space = dng->eden();
+  ContiguousSpace* eden_space = dng->eden();
   ContiguousSpace* from_space = dng->from();
   ContiguousSpace* to_space   = dng->to();
 
@@ -5410,7 +5179,7 @@ CMSParMarkTask::do_young_space_rescan(uint worker_id,
     while (!pst->is_task_claimed(/* reference */ nth_task)) {
       // We claimed task # nth_task; compute its boundaries.
       if (chunk_top == 0) {  // no samples were taken
-        assert(nth_task == 0 && n_tasks == 1, "Can have only 1 EdenSpace task");
+        assert(nth_task == 0 && n_tasks == 1, "Can have only 1 eden task");
         start = space->bottom();
         end   = space->top();
       } else if (nth_task == 0) {
@@ -5788,7 +5557,7 @@ void CMSCollector::do_remark_parallel() {
   // process_roots (which currently doesn't know how to
   // parallelize such a scan), but rather will be broken up into
   // a set of parallel tasks (via the sampling that the [abortable]
-  // preclean phase did of EdenSpace, plus the [two] tasks of
+  // preclean phase did of eden, plus the [two] tasks of
   // scanning the [two] survivor spaces. Further fine-grain
   // parallelization of the scanning of the survivor spaces
   // themselves, and of precleaning of the younger gen itself
@@ -6474,19 +6243,16 @@ void CMSCollector::reset(bool asynch) {
         assert_lock_strong(bitMapLock());
         bitMapLock()->unlock();
         ConcurrentMarkSweepThread::desynchronize(true);
-        ConcurrentMarkSweepThread::acknowledge_yield_request();
         stopTimer();
         if (PrintCMSStatistics != 0) {
           incrementYields();
         }
-        icms_wait();
 
         // See the comment in coordinator_yield()
         for (unsigned i = 0; i < CMSYieldSleepCount &&
                          ConcurrentMarkSweepThread::should_yield() &&
                          !CMSCollector::foregroundGCIsActive(); ++i) {
           os::sleep(Thread::current(), 1, false);
-          ConcurrentMarkSweepThread::acknowledge_yield_request();
         }
 
         ConcurrentMarkSweepThread::synchronize(true);
@@ -6509,10 +6275,6 @@ void CMSCollector::reset(bool asynch) {
     _collectorState = Idling;
   }
 
-  // Stop incremental mode after a cycle completes, so that any future cycles
-  // are triggered by allocation.
-  stop_icms();
-
   NOT_PRODUCT(
     if (RotateCMSCollectionTypes) {
       _cmsGen->rotate_debug_collection_type();
@@ -6964,12 +6726,10 @@ void MarkRefsIntoAndScanClosure::do_yield_work() {
   _bit_map->lock()->unlock();
   _freelistLock->unlock();
   ConcurrentMarkSweepThread::desynchronize(true);
-  ConcurrentMarkSweepThread::acknowledge_yield_request();
   _collector->stopTimer();
   if (PrintCMSStatistics != 0) {
     _collector->incrementYields();
   }
-  _collector->icms_wait();
 
   // See the comment in coordinator_yield()
   for (unsigned i = 0;
@@ -6978,7 +6738,6 @@ void MarkRefsIntoAndScanClosure::do_yield_work() {
        !CMSCollector::foregroundGCIsActive();
        ++i) {
     os::sleep(Thread::current(), 1, false);
-    ConcurrentMarkSweepThread::acknowledge_yield_request();
   }
 
   ConcurrentMarkSweepThread::synchronize(true);
@@ -7124,19 +6883,16 @@ void ScanMarkedObjectsAgainCarefullyClosure::do_yield_work() {
   _bitMap->lock()->unlock();
   _freelistLock->unlock();
   ConcurrentMarkSweepThread::desynchronize(true);
-  ConcurrentMarkSweepThread::acknowledge_yield_request();
   _collector->stopTimer();
   if (PrintCMSStatistics != 0) {
     _collector->incrementYields();
   }
-  _collector->icms_wait();
 
   // See the comment in coordinator_yield()
   for (unsigned i = 0; i < CMSYieldSleepCount &&
                    ConcurrentMarkSweepThread::should_yield() &&
                    !CMSCollector::foregroundGCIsActive(); ++i) {
     os::sleep(Thread::current(), 1, false);
-    ConcurrentMarkSweepThread::acknowledge_yield_request();
   }
 
   ConcurrentMarkSweepThread::synchronize(true);
@@ -7196,19 +6952,16 @@ void SurvivorSpacePrecleanClosure::do_yield_work() {
   // Relinquish the bit map lock
   _bit_map->lock()->unlock();
   ConcurrentMarkSweepThread::desynchronize(true);
-  ConcurrentMarkSweepThread::acknowledge_yield_request();
   _collector->stopTimer();
   if (PrintCMSStatistics != 0) {
     _collector->incrementYields();
   }
-  _collector->icms_wait();
 
   // See the comment in coordinator_yield()
   for (unsigned i = 0; i < CMSYieldSleepCount &&
                        ConcurrentMarkSweepThread::should_yield() &&
                        !CMSCollector::foregroundGCIsActive(); ++i) {
     os::sleep(Thread::current(), 1, false);
-    ConcurrentMarkSweepThread::acknowledge_yield_request();
   }
 
   ConcurrentMarkSweepThread::synchronize(true);
@@ -7354,19 +7107,16 @@ void MarkFromRootsClosure::do_yield_work() {
   assert_lock_strong(_bitMap->lock());
   _bitMap->lock()->unlock();
   ConcurrentMarkSweepThread::desynchronize(true);
-  ConcurrentMarkSweepThread::acknowledge_yield_request();
   _collector->stopTimer();
   if (PrintCMSStatistics != 0) {
     _collector->incrementYields();
   }
-  _collector->icms_wait();
 
   // See the comment in coordinator_yield()
   for (unsigned i = 0; i < CMSYieldSleepCount &&
                        ConcurrentMarkSweepThread::should_yield() &&
                        !CMSCollector::foregroundGCIsActive(); ++i) {
     os::sleep(Thread::current(), 1, false);
-    ConcurrentMarkSweepThread::acknowledge_yield_request();
   }
 
   ConcurrentMarkSweepThread::synchronize(true);
@@ -7388,7 +7138,7 @@ void MarkFromRootsClosure::scanOopsInOop(HeapWord* ptr) {
   _finger = ptr + obj->size();
   assert(_finger > ptr, "we just incremented it above");
   // On large heaps, it may take us some time to get through
-  // the marking phase (especially if running iCMS). During
+  // the marking phase. During
   // this time it's possible that a lot of mutations have
   // accumulated in the card table and the mod union table --
   // these mutation records are redundant until we have
@@ -7505,7 +7255,7 @@ void Par_MarkFromRootsClosure::scan_oops_in_oop(HeapWord* ptr) {
   _finger = ptr + obj->size();
   assert(_finger > ptr, "we just incremented it above");
   // On large heaps, it may take us some time to get through
-  // the marking phase (especially if running iCMS). During
+  // the marking phase. During
   // this time it's possible that a lot of mutations have
   // accumulated in the card table and the mod union table --
   // these mutation records are redundant until we have
@@ -7994,20 +7744,16 @@ void CMSPrecleanRefsYieldClosure::do_yield_work() {
   bml->unlock();
   ConcurrentMarkSweepThread::desynchronize(true);
 
-  ConcurrentMarkSweepThread::acknowledge_yield_request();
-
   _collector->stopTimer();
   if (PrintCMSStatistics != 0) {
     _collector->incrementYields();
   }
-  _collector->icms_wait();
 
   // See the comment in coordinator_yield()
   for (unsigned i = 0; i < CMSYieldSleepCount &&
                        ConcurrentMarkSweepThread::should_yield() &&
                        !CMSCollector::foregroundGCIsActive(); ++i) {
     os::sleep(Thread::current(), 1, false);
-    ConcurrentMarkSweepThread::acknowledge_yield_request();
   }
 
   ConcurrentMarkSweepThread::synchronize(true);
@@ -8675,19 +8421,16 @@ void SweepClosure::do_yield_work(HeapWord* addr) {
   _bitMap->lock()->unlock();
   _freelistLock->unlock();
   ConcurrentMarkSweepThread::desynchronize(true);
-  ConcurrentMarkSweepThread::acknowledge_yield_request();
   _collector->stopTimer();
   if (PrintCMSStatistics != 0) {
     _collector->incrementYields();
   }
-  _collector->icms_wait();
 
   // See the comment in coordinator_yield()
   for (unsigned i = 0; i < CMSYieldSleepCount &&
                        ConcurrentMarkSweepThread::should_yield() &&
                        !CMSCollector::foregroundGCIsActive(); ++i) {
     os::sleep(Thread::current(), 1, false);
-    ConcurrentMarkSweepThread::acknowledge_yield_request();
   }
 
   ConcurrentMarkSweepThread::synchronize(true);
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
index 8d3d6ef128e..e46c01e400c 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
@@ -356,7 +356,6 @@ class CMSStats VALUE_OBJ_CLASS_SPEC {
   size_t _gc0_promoted;         // bytes promoted per gc0
   double _cms_duration;
   double _cms_duration_pre_sweep; // time from initiation to start of sweep
-  double _cms_duration_per_mb;
   double _cms_period;
   size_t _cms_allocated;        // bytes of direct allocation per gc0 period
 
@@ -383,17 +382,7 @@ class CMSStats VALUE_OBJ_CLASS_SPEC {
 
   unsigned int _valid_bits;
 
-  unsigned int _icms_duty_cycle;        // icms duty cycle (0-100).
-
  protected:
-
-  // Return a duty cycle that avoids wild oscillations, by limiting the amount
-  // of change between old_duty_cycle and new_duty_cycle (the latter is treated
-  // as a recommended value).
-  static unsigned int icms_damped_duty_cycle(unsigned int old_duty_cycle,
-                                             unsigned int new_duty_cycle);
-  unsigned int icms_update_duty_cycle_impl();
-
   // In support of adjusting of cms trigger ratios based on history
   // of concurrent mode failure.
   double cms_free_adjustment_factor(size_t free) const;
@@ -426,7 +415,6 @@ class CMSStats VALUE_OBJ_CLASS_SPEC {
   size_t gc0_promoted() const   { return _gc0_promoted; }
   double cms_period() const          { return _cms_period; }
   double cms_duration() const        { return _cms_duration; }
-  double cms_duration_per_mb() const { return _cms_duration_per_mb; }
   size_t cms_allocated() const       { return _cms_allocated; }
 
   size_t cms_used_at_gc0_end() const { return _cms_used_at_gc0_end;}
@@ -458,12 +446,6 @@ class CMSStats VALUE_OBJ_CLASS_SPEC {
 
   // End of higher level statistics.
 
-  // Returns the cms incremental mode duty cycle, as a percentage (0-100).
-  unsigned int icms_duty_cycle() const { return _icms_duty_cycle; }
-
-  // Update the duty cycle and return the new value.
-  unsigned int icms_update_duty_cycle();
-
   // Debugging.
   void print_on(outputStream* st) const PRODUCT_RETURN;
   void print() const { print_on(gclog_or_tty); }
@@ -725,13 +707,6 @@ class CMSCollector: public CHeapObj<mtGC> {
   // Timing, allocation and promotion statistics, used for scheduling.
   CMSStats      _stats;
 
-  // Allocation limits installed in the young gen, used only in
-  // CMSIncrementalMode.  When an allocation in the young gen would cross one of
-  // these limits, the cms generation is notified and the cms thread is started
-  // or stopped, respectively.
-  HeapWord*     _icms_start_limit;
-  HeapWord*     _icms_stop_limit;
-
   enum CMS_op_type {
     CMS_op_checkpointRootsInitial,
     CMS_op_checkpointRootsFinal
@@ -867,10 +842,6 @@ class CMSCollector: public CHeapObj<mtGC> {
   // collector.
   bool waitForForegroundGC();
 
-  // Incremental mode triggering:  recompute the icms duty cycle and set the
-  // allocation limits in the young gen.
-  void icms_update_allocation_limits();
-
   size_t block_size_using_printezis_bits(HeapWord* addr) const;
   size_t block_size_if_printezis_bits(HeapWord* addr) const;
   HeapWord* next_card_start_after_block(HeapWord* addr) const;
@@ -928,9 +899,6 @@ class CMSCollector: public CHeapObj<mtGC> {
   void promoted(bool par, HeapWord* start,
                 bool is_obj_array, size_t obj_size);
 
-  HeapWord* allocation_limit_reached(Space* space, HeapWord* top,
-                                     size_t word_size);
-
   void getFreelistLocks() const;
   void releaseFreelistLocks() const;
   bool haveFreelistLocks() const;
@@ -1001,14 +969,6 @@ class CMSCollector: public CHeapObj<mtGC> {
   // Timers/stats for gc scheduling and incremental mode pacing.
   CMSStats& stats() { return _stats; }
 
-  // Convenience methods that check whether CMSIncrementalMode is enabled and
-  // forward to the corresponding methods in ConcurrentMarkSweepThread.
-  static void start_icms();
-  static void stop_icms();    // Called at the end of the cms cycle.
-  static void disable_icms(); // Called before a foreground collection.
-  static void enable_icms();  // Called after a foreground collection.
-  void icms_wait();          // Called at yield points.
-
   // Adaptive size policy
   AdaptiveSizePolicy* size_policy();
 
@@ -1211,9 +1171,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
     return allocate(size, tlab);
   }
 
-  // Incremental mode triggering.
-  HeapWord* allocation_limit_reached(Space* space, HeapWord* top,
-                                     size_t word_size);
 
   // Used by CMSStats to track direct allocation.  The value is sampled and
   // reset after each young gen collection.
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp
index 46c518e4b64..53eb0a80976 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp
@@ -234,36 +234,6 @@ inline void CMSBitMap::iterate(BitMapClosure* cl, HeapWord* left,
   }
 }
 
-inline void CMSCollector::start_icms() {
-  if (CMSIncrementalMode) {
-    ConcurrentMarkSweepThread::start_icms();
-  }
-}
-
-inline void CMSCollector::stop_icms() {
-  if (CMSIncrementalMode) {
-    ConcurrentMarkSweepThread::stop_icms();
-  }
-}
-
-inline void CMSCollector::disable_icms() {
-  if (CMSIncrementalMode) {
-    ConcurrentMarkSweepThread::disable_icms();
-  }
-}
-
-inline void CMSCollector::enable_icms() {
-  if (CMSIncrementalMode) {
-    ConcurrentMarkSweepThread::enable_icms();
-  }
-}
-
-inline void CMSCollector::icms_wait() {
-  if (CMSIncrementalMode) {
-    cmsThread()->icms_wait();
-  }
-}
-
 inline void CMSCollector::save_sweep_limits() {
   _cmsGen->save_sweep_limit();
 }
@@ -363,12 +333,6 @@ inline void CMSStats::record_cms_end() {
   _cms_duration = AdaptiveWeightedAverage::exp_avg(_cms_duration,
     cur_duration, _cms_alpha);
 
-  // Avoid division by 0.
-  const size_t cms_used_mb = MAX2(_cms_used_at_cms_begin / M, (size_t)1);
-  _cms_duration_per_mb = AdaptiveWeightedAverage::exp_avg(_cms_duration_per_mb,
-                                 cur_duration / cms_used_mb,
-                                 _cms_alpha);
-
   _cms_end_time.update();
   _cms_alpha = _saved_alpha;
   _allow_duty_cycle_reduction = true;
@@ -400,15 +364,6 @@ inline double CMSStats::cms_consumption_rate() const {
   return (gc0_promoted() + cms_allocated()) / gc0_period();
 }
 
-inline unsigned int CMSStats::icms_update_duty_cycle() {
-  // Update the duty cycle only if pacing is enabled and the stats are valid
-  // (after at least one young gen gc and one cms cycle have completed).
-  if (CMSIncrementalPacing && valid()) {
-    return icms_update_duty_cycle_impl();
-  }
-  return _icms_duty_cycle;
-}
-
 inline void ConcurrentMarkSweepGeneration::save_sweep_limit() {
   cmsSpace()->save_sweep_limit();
 }
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
index 0479143d4f9..8e31f5610d2 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.cpp
@@ -49,13 +49,6 @@ bool ConcurrentMarkSweepThread::_should_terminate = false;
 int  ConcurrentMarkSweepThread::_CMS_flag         = CMS_nil;
 
 volatile jint ConcurrentMarkSweepThread::_pending_yields      = 0;
-volatile jint ConcurrentMarkSweepThread::_pending_decrements  = 0;
-
-volatile jint ConcurrentMarkSweepThread::_icms_disabled   = 0;
-volatile bool ConcurrentMarkSweepThread::_should_run     = false;
-// When icms is enabled, the icms thread is stopped until explicitly
-// started.
-volatile bool ConcurrentMarkSweepThread::_should_stop    = true;
 
 SurrogateLockerThread*
      ConcurrentMarkSweepThread::_slt = NULL;
@@ -99,7 +92,6 @@ ConcurrentMarkSweepThread::ConcurrentMarkSweepThread(CMSCollector* collector)
     }
   }
   _sltMonitor = SLT_lock;
-  assert(!CMSIncrementalMode || icms_is_enabled(), "Error");
 }
 
 void ConcurrentMarkSweepThread::run() {
@@ -184,11 +176,6 @@ ConcurrentMarkSweepThread* ConcurrentMarkSweepThread::start(CMSCollector* collec
 }
 
 void ConcurrentMarkSweepThread::stop() {
-  if (CMSIncrementalMode) {
-    // Disable incremental mode and wake up the thread so it notices the change.
-    disable_icms();
-    start_icms();
-  }
   // it is ok to take late safepoints here, if needed
   {
     MutexLockerEx x(Terminator_lock);
@@ -387,23 +374,13 @@ void ConcurrentMarkSweepThread::wait_on_cms_lock_for_scavenge(long t_millis) {
 
 void ConcurrentMarkSweepThread::sleepBeforeNextCycle() {
   while (!_should_terminate) {
-    if (CMSIncrementalMode) {
-      icms_wait();
-      if(CMSWaitDuration >= 0) {
-        // Wait until the next synchronous GC, a concurrent full gc
-        // request or a timeout, whichever is earlier.
-        wait_on_cms_lock_for_scavenge(CMSWaitDuration);
-      }
-      return;
+    if(CMSWaitDuration >= 0) {
+      // Wait until the next synchronous GC, a concurrent full gc
+      // request or a timeout, whichever is earlier.
+      wait_on_cms_lock_for_scavenge(CMSWaitDuration);
     } else {
-      if(CMSWaitDuration >= 0) {
-        // Wait until the next synchronous GC, a concurrent full gc
-        // request or a timeout, whichever is earlier.
-        wait_on_cms_lock_for_scavenge(CMSWaitDuration);
-      } else {
-        // Wait until any cms_lock event or check interval not to call shouldConcurrentCollect permanently
-        wait_on_cms_lock(CMSCheckInterval);
-      }
+      // Wait until any cms_lock event or check interval not to call shouldConcurrentCollect permanently
+      wait_on_cms_lock(CMSCheckInterval);
     }
     // Check if we should start a CMS collection cycle
     if (_collector->shouldConcurrentCollect()) {
@@ -414,42 +391,6 @@ void ConcurrentMarkSweepThread::sleepBeforeNextCycle() {
   }
 }
 
-// Incremental CMS
-void ConcurrentMarkSweepThread::start_icms() {
-  assert(UseConcMarkSweepGC && CMSIncrementalMode, "just checking");
-  MutexLockerEx x(iCMS_lock, Mutex::_no_safepoint_check_flag);
-  trace_state("start_icms");
-  _should_run = true;
-  iCMS_lock->notify_all();
-}
-
-void ConcurrentMarkSweepThread::stop_icms() {
-  assert(UseConcMarkSweepGC && CMSIncrementalMode, "just checking");
-  MutexLockerEx x(iCMS_lock, Mutex::_no_safepoint_check_flag);
-  if (!_should_stop) {
-    trace_state("stop_icms");
-    _should_stop = true;
-    _should_run = false;
-    asynchronous_yield_request();
-    iCMS_lock->notify_all();
-  }
-}
-
-void ConcurrentMarkSweepThread::icms_wait() {
-  assert(UseConcMarkSweepGC && CMSIncrementalMode, "just checking");
-  if (_should_stop && icms_is_enabled()) {
-    MutexLockerEx x(iCMS_lock, Mutex::_no_safepoint_check_flag);
-    trace_state("pause_icms");
-    _collector->stats().stop_cms_timer();
-    while(!_should_run && icms_is_enabled()) {
-      iCMS_lock->wait(Mutex::_no_safepoint_check_flag);
-    }
-    _collector->stats().start_cms_timer();
-    _should_stop = false;
-    trace_state("pause_icms end");
-  }
-}
-
 // Note: this method, although exported by the ConcurrentMarkSweepThread,
 // which is a non-JavaThread, can only be called by a JavaThread.
 // Currently this is done at vm creation time (post-vm-init) by the
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp
index 5f508cc09a4..f3e40f61d48 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp
@@ -64,20 +64,11 @@ class ConcurrentMarkSweepThread: public ConcurrentGCThread {
   static bool clear_CMS_flag(int b)         { return (_CMS_flag &= ~b) != 0; }
   void sleepBeforeNextCycle();
 
-  // CMS thread should yield for a young gen collection, direct allocation,
-  // and iCMS activity.
+  // CMS thread should yield for a young gen collection and direct allocations
   static char _pad_1[64 - sizeof(jint)];    // prevent cache-line sharing
   static volatile jint _pending_yields;
-  static volatile jint _pending_decrements; // decrements to _pending_yields
   static char _pad_2[64 - sizeof(jint)];    // prevent cache-line sharing
 
-  // Tracing messages, enabled by CMSTraceThreadState.
-  static inline void trace_state(const char* desc);
-
-  static volatile int _icms_disabled;   // a counter to track #iCMS disable & enable
-  static volatile bool _should_run;     // iCMS may run
-  static volatile bool _should_stop;    // iCMS should stop
-
   // debugging
   void verify_ok_to_terminate() const PRODUCT_RETURN;
 
@@ -135,44 +126,13 @@ class ConcurrentMarkSweepThread: public ConcurrentGCThread {
   void wait_on_cms_lock_for_scavenge(long t_millis);
 
   // The CMS thread will yield during the work portion of its cycle
-  // only when requested to.  Both synchronous and asychronous requests
-  // are provided:
-  // (1) A synchronous request is used for young gen collections and
-  //     for direct allocations.  The requesting thread increments
-  //     _pending_yields at the beginning of an operation, and decrements
-  //     _pending_yields when that operation is completed.
-  //     In turn, the CMS thread yields when _pending_yields is positive,
-  //     and continues to yield until the value reverts to 0.
-  // (2) An asynchronous request, on the other hand, is used by iCMS
-  //     for the stop_icms() operation. A single yield satisfies all of
-  //     the outstanding asynch yield requests, of which there may
-  //     occasionally be several in close succession. To accomplish
-  //     this, an asynch-requesting thread atomically increments both
-  //     _pending_yields and _pending_decrements. An asynchr requesting
-  //     thread does not wait and "acknowledge" completion of an operation
-  //     and deregister the request, like the synchronous version described
-  //     above does. In turn, after yielding, the CMS thread decrements both
-  //     _pending_yields and _pending_decrements by the value seen in
-  //     _pending_decrements before the decrement.
-  //  NOTE: The above scheme is isomorphic to having two request counters,
-  //  one for async requests and one for sync requests, and for the CMS thread
-  //  to check the sum of the two counters to decide whether it should yield
-  //  and to clear only the async counter when it yields. However, it turns out
-  //  to be more efficient for CMS code to just check a single counter
-  //  _pending_yields that holds the sum (of both sync and async requests), and
-  //  a second counter _pending_decrements that only holds the async requests,
-  //  for greater efficiency, since in a typical CMS run, there are many more
-  //  potential (i.e. static) yield points than there are actual
-  //  (i.e. dynamic) yields because of requests, which are few and far between.
-  //
-  // Note that, while "_pending_yields >= _pending_decrements" is an invariant,
-  // we cannot easily test that invariant, since the counters are manipulated via
-  // atomic instructions without explicit locking and we cannot read
-  // the two counters atomically together: one suggestion is to
-  // use (for example) 16-bit counters so as to be able to read the
-  // two counters atomically even on 32-bit platforms. Notice that
-  // the second assert in acknowledge_yield_request() below does indeed
-  // check a form of the above invariant, albeit indirectly.
+  // only when requested to.
+  // A synchronous request is used for young gen collections and
+  // for direct allocations.  The requesting thread increments
+  // _pending_yields at the beginning of an operation, and decrements
+  // _pending_yields when that operation is completed.
+  // In turn, the CMS thread yields when _pending_yields is positive,
+  // and continues to yield until the value reverts to 0.
 
   static void increment_pending_yields()   {
     Atomic::inc(&_pending_yields);
@@ -182,67 +142,9 @@ class ConcurrentMarkSweepThread: public ConcurrentGCThread {
     Atomic::dec(&_pending_yields);
     assert(_pending_yields >= 0, "can't be negative");
   }
-  static void asynchronous_yield_request() {
-    assert(CMSIncrementalMode, "Currently only used w/iCMS");
-    increment_pending_yields();
-    Atomic::inc(&_pending_decrements);
-    assert(_pending_decrements >= 0, "can't be negative");
-  }
-  static void acknowledge_yield_request() {
-    jint decrement = _pending_decrements;
-    if (decrement > 0) {
-      assert(CMSIncrementalMode, "Currently only used w/iCMS");
-      // Order important to preserve: _pending_yields >= _pending_decrements
-      Atomic::add(-decrement, &_pending_decrements);
-      Atomic::add(-decrement, &_pending_yields);
-      assert(_pending_decrements >= 0, "can't be negative");
-      assert(_pending_yields >= 0, "can't be negative");
-    }
-  }
   static bool should_yield()   { return _pending_yields > 0; }
-
-  // CMS incremental mode.
-  static void start_icms(); // notify thread to start a quantum of work
-  static void stop_icms();  // request thread to stop working
-  void icms_wait();         // if asked to stop, wait until notified to start
-
-  // Incremental mode is enabled globally by the flag CMSIncrementalMode.  It
-  // must also be enabled/disabled dynamically to allow foreground collections.
-#define ICMS_ENABLING_ASSERT                                                      \
-          assert((CMSIncrementalMode  && _icms_disabled >= 0) ||                  \
-                 (!CMSIncrementalMode && _icms_disabled <= 0), "Error")
-
-  static inline void enable_icms() {
-    ICMS_ENABLING_ASSERT;
-    Atomic::dec(&_icms_disabled);
-  }
-  static inline void disable_icms() {
-   ICMS_ENABLING_ASSERT;
-   Atomic::inc(&_icms_disabled);
-  }
-  static inline bool icms_is_disabled() {
-   ICMS_ENABLING_ASSERT;
-   return _icms_disabled > 0;
-  }
-  static inline bool icms_is_enabled() {
-   return !icms_is_disabled();
-  }
 };
 
-inline void ConcurrentMarkSweepThread::trace_state(const char* desc) {
-  if (CMSTraceThreadState) {
-    char buf[128];
-    TimeStamp& ts = gclog_or_tty->time_stamp();
-    if (!ts.is_updated()) {
-      ts.update();
-    }
-    jio_snprintf(buf, sizeof(buf), " [%.3f:  CMSThread %s] ",
-                 ts.seconds(), desc);
-    buf[sizeof(buf) - 1] = '\0';
-    gclog_or_tty->print("%s", buf);
-  }
-}
-
 // For scoped increment/decrement of (synchronous) yield requests
 class CMSSynchronousYieldRequest: public StackObj {
  public:
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp
index 1b23ecbb554..7dfbad541bb 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.cpp
@@ -207,12 +207,6 @@ void VM_GenCollectFullConcurrent::doit() {
   MutexLockerEx x(FullGCCount_lock, Mutex::_no_safepoint_check_flag);
   assert(_full_gc_count_before <= gch->total_full_collections(), "Error");
   if (gch->total_full_collections() == _full_gc_count_before) {
-    // Disable iCMS until the full collection is done, and
-    // remember that we did so.
-    CMSCollector::disable_icms();
-    _disabled_icms = true;
-    // In case CMS thread was in icms_wait(), wake it up.
-    CMSCollector::start_icms();
     // Nudge the CMS thread to start a concurrent collection.
     CMSCollector::request_full_gc(_full_gc_count_before, _gc_cause);
   } else {
@@ -276,8 +270,4 @@ void VM_GenCollectFullConcurrent::doit_epilogue() {
       FullGCCount_lock->wait(Mutex::_no_safepoint_check_flag);
     }
   }
-  // Enable iCMS back if we disabled it earlier.
-  if (_disabled_icms) {
-    CMSCollector::enable_icms();
-  }
 }
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp
index 982f7c1036d..35c846a1921 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/vmCMSOperations.hpp
@@ -128,13 +128,11 @@ class VM_CMS_Final_Remark: public VM_CMS_Operation {
 // VM operation to invoke a concurrent collection of the heap as a
 // GenCollectedHeap heap.
 class VM_GenCollectFullConcurrent: public VM_GC_Operation {
-  bool _disabled_icms;
  public:
   VM_GenCollectFullConcurrent(unsigned int gc_count_before,
                               unsigned int full_gc_count_before,
                               GCCause::Cause gc_cause)
-    : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */),
-      _disabled_icms(false)
+    : VM_GC_Operation(gc_count_before, gc_cause, full_gc_count_before, true /* full */)
   {
     assert(FullGCCount_lock != NULL, "Error");
     assert(UseAsyncConcMarkSweepGC, "Else will hang caller");
diff --git a/hotspot/src/share/vm/memory/collectorPolicy.hpp b/hotspot/src/share/vm/memory/collectorPolicy.hpp
index faffc6fec34..d923cf36a27 100644
--- a/hotspot/src/share/vm/memory/collectorPolicy.hpp
+++ b/hotspot/src/share/vm/memory/collectorPolicy.hpp
@@ -189,11 +189,6 @@ class CollectorPolicy : public CHeapObj<mtGC> {
     return CollectorPolicy::CollectorPolicyKind;
   }
 
-  // Returns true if a collector has eden space with soft end.
-  virtual bool has_soft_ended_eden() {
-    return false;
-  }
-
   // Do any updates required to global flags that are due to heap initialization
   // changes
   virtual void post_heap_initialize() = 0;
diff --git a/hotspot/src/share/vm/memory/defNewGeneration.cpp b/hotspot/src/share/vm/memory/defNewGeneration.cpp
index ae3726281ec..57cdf5c3c27 100644
--- a/hotspot/src/share/vm/memory/defNewGeneration.cpp
+++ b/hotspot/src/share/vm/memory/defNewGeneration.cpp
@@ -194,11 +194,7 @@ DefNewGeneration::DefNewGeneration(ReservedSpace rs,
                 (HeapWord*)_virtual_space.high());
   Universe::heap()->barrier_set()->resize_covered_region(cmr);
 
-  if (GenCollectedHeap::heap()->collector_policy()->has_soft_ended_eden()) {
-    _eden_space = new ConcEdenSpace(this);
-  } else {
-    _eden_space = new EdenSpace(this);
-  }
+  _eden_space = new ContiguousSpace();
   _from_space = new ContiguousSpace();
   _to_space   = new ContiguousSpace();
 
@@ -1038,38 +1034,12 @@ HeapWord* DefNewGeneration::allocate(size_t word_size,
     if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
       _next_gen->sample_eden_chunk();
     }
-    return result;
-  }
-  do {
-    HeapWord* old_limit = eden()->soft_end();
-    if (old_limit < eden()->end()) {
-      // Tell the next generation we reached a limit.
-      HeapWord* new_limit =
-        next_gen()->allocation_limit_reached(eden(), eden()->top(), word_size);
-      if (new_limit != NULL) {
-        Atomic::cmpxchg_ptr(new_limit, eden()->soft_end_addr(), old_limit);
-      } else {
-        assert(eden()->soft_end() == eden()->end(),
-               "invalid state after allocation_limit_reached returned null");
-      }
-    } else {
-      // The allocation failed and the soft limit is equal to the hard limit,
-      // there are no reasons to do an attempt to allocate
-      assert(old_limit == eden()->end(), "sanity check");
-      break;
-    }
-    // Try to allocate until succeeded or the soft limit can't be adjusted
-    result = eden()->par_allocate(word_size);
-  } while (result == NULL);
-
-  // If the eden is full and the last collection bailed out, we are running
-  // out of heap space, and we try to allocate the from-space, too.
-  // allocate_from_space can't be inlined because that would introduce a
-  // circular dependency at compile time.
-  if (result == NULL) {
+  } else {
+    // If the eden is full and the last collection bailed out, we are running
+    // out of heap space, and we try to allocate the from-space, too.
+    // allocate_from_space can't be inlined because that would introduce a
+    // circular dependency at compile time.
     result = allocate_from_space(word_size);
-  } else if (CMSEdenChunksRecordAlways && _next_gen != NULL) {
-    _next_gen->sample_eden_chunk();
   }
   return result;
 }
@@ -1083,11 +1053,6 @@ HeapWord* DefNewGeneration::par_allocate(size_t word_size,
   return res;
 }
 
-void DefNewGeneration::gc_prologue(bool full) {
-  // Ensure that _end and _soft_end are the same in eden space.
-  eden()->set_soft_end(eden()->end());
-}
-
 size_t DefNewGeneration::tlab_capacity() const {
   return eden()->capacity();
 }
diff --git a/hotspot/src/share/vm/memory/defNewGeneration.hpp b/hotspot/src/share/vm/memory/defNewGeneration.hpp
index a5c0eb30951..c6e8c56f4b1 100644
--- a/hotspot/src/share/vm/memory/defNewGeneration.hpp
+++ b/hotspot/src/share/vm/memory/defNewGeneration.hpp
@@ -32,7 +32,6 @@
 #include "memory/generation.inline.hpp"
 #include "utilities/stack.hpp"
 
-class EdenSpace;
 class ContiguousSpace;
 class ScanClosure;
 class STWGCTimer;
@@ -132,7 +131,7 @@ protected:
   void adjust_desired_tenuring_threshold();
 
   // Spaces
-  EdenSpace*       _eden_space;
+  ContiguousSpace* _eden_space;
   ContiguousSpace* _from_space;
   ContiguousSpace* _to_space;
 
@@ -214,9 +213,9 @@ protected:
   virtual Generation::Name kind() { return Generation::DefNew; }
 
   // Accessing spaces
-  EdenSpace*       eden() const           { return _eden_space; }
-  ContiguousSpace* from() const           { return _from_space;  }
-  ContiguousSpace* to()   const           { return _to_space;    }
+  ContiguousSpace* eden() const           { return _eden_space; }
+  ContiguousSpace* from() const           { return _from_space; }
+  ContiguousSpace* to()   const           { return _to_space;   }
 
   virtual CompactibleSpace* first_compaction_space() const;
 
@@ -282,8 +281,6 @@ protected:
 
   HeapWord* par_allocate(size_t word_size, bool is_tlab);
 
-  // Prologue & Epilogue
-  virtual void gc_prologue(bool full);
   virtual void gc_epilogue(bool full);
 
   // Save the tops for eden, from, and to
diff --git a/hotspot/src/share/vm/memory/generation.hpp b/hotspot/src/share/vm/memory/generation.hpp
index feb2fb7946d..e472d9b8a46 100644
--- a/hotspot/src/share/vm/memory/generation.hpp
+++ b/hotspot/src/share/vm/memory/generation.hpp
@@ -265,14 +265,6 @@ class Generation: public CHeapObj<mtGC> {
   // Like "allocate", but performs any necessary locking internally.
   virtual HeapWord* par_allocate(size_t word_size, bool is_tlab) = 0;
 
-  // A 'younger' gen has reached an allocation limit, and uses this to notify
-  // the next older gen.  The return value is a new limit, or NULL if none.  The
-  // caller must do the necessary locking.
-  virtual HeapWord* allocation_limit_reached(Space* space, HeapWord* top,
-                                             size_t word_size) {
-    return NULL;
-  }
-
   // Some generation may offer a region for shared, contiguous allocation,
   // via inlined code (by exporting the address of the top and end fields
   // defining the extent of the contiguous allocation region.)
diff --git a/hotspot/src/share/vm/memory/space.cpp b/hotspot/src/share/vm/memory/space.cpp
index 092a68bee70..9ced66021d1 100644
--- a/hotspot/src/share/vm/memory/space.cpp
+++ b/hotspot/src/share/vm/memory/space.cpp
@@ -640,13 +640,12 @@ size_t ContiguousSpace::block_size(const HeapWord* p) const {
 }
 
 // This version requires locking.
-inline HeapWord* ContiguousSpace::allocate_impl(size_t size,
-                                                HeapWord* const end_value) {
+inline HeapWord* ContiguousSpace::allocate_impl(size_t size) {
   assert(Heap_lock->owned_by_self() ||
          (SafepointSynchronize::is_at_safepoint() && Thread::current()->is_VM_thread()),
          "not locked");
   HeapWord* obj = top();
-  if (pointer_delta(end_value, obj) >= size) {
+  if (pointer_delta(end(), obj) >= size) {
     HeapWord* new_top = obj + size;
     set_top(new_top);
     assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
@@ -657,11 +656,10 @@ inline HeapWord* ContiguousSpace::allocate_impl(size_t size,
 }
 
 // This version is lock-free.
-inline HeapWord* ContiguousSpace::par_allocate_impl(size_t size,
-                                                    HeapWord* const end_value) {
+inline HeapWord* ContiguousSpace::par_allocate_impl(size_t size) {
   do {
     HeapWord* obj = top();
-    if (pointer_delta(end_value, obj) >= size) {
+    if (pointer_delta(end(), obj) >= size) {
       HeapWord* new_top = obj + size;
       HeapWord* result = (HeapWord*)Atomic::cmpxchg_ptr(new_top, top_addr(), obj);
       // result can be one of two:
@@ -700,12 +698,12 @@ HeapWord* ContiguousSpace::allocate_aligned(size_t size) {
 
 // Requires locking.
 HeapWord* ContiguousSpace::allocate(size_t size) {
-  return allocate_impl(size, end());
+  return allocate_impl(size);
 }
 
 // Lock-free.
 HeapWord* ContiguousSpace::par_allocate(size_t size) {
-  return par_allocate_impl(size, end());
+  return par_allocate_impl(size);
 }
 
 void ContiguousSpace::allocate_temporary_filler(int factor) {
@@ -740,49 +738,6 @@ void ContiguousSpace::allocate_temporary_filler(int factor) {
   }
 }
 
-void EdenSpace::clear(bool mangle_space) {
-  ContiguousSpace::clear(mangle_space);
-  set_soft_end(end());
-}
-
-// Requires locking.
-HeapWord* EdenSpace::allocate(size_t size) {
-  return allocate_impl(size, soft_end());
-}
-
-// Lock-free.
-HeapWord* EdenSpace::par_allocate(size_t size) {
-  return par_allocate_impl(size, soft_end());
-}
-
-HeapWord* ConcEdenSpace::par_allocate(size_t size)
-{
-  do {
-    // The invariant is top() should be read before end() because
-    // top() can't be greater than end(), so if an update of _soft_end
-    // occurs between 'end_val = end();' and 'top_val = top();' top()
-    // also can grow up to the new end() and the condition
-    // 'top_val > end_val' is true. To ensure the loading order
-    // OrderAccess::loadload() is required after top() read.
-    HeapWord* obj = top();
-    OrderAccess::loadload();
-    if (pointer_delta(*soft_end_addr(), obj) >= size) {
-      HeapWord* new_top = obj + size;
-      HeapWord* result = (HeapWord*)Atomic::cmpxchg_ptr(new_top, top_addr(), obj);
-      // result can be one of two:
-      //  the old top value: the exchange succeeded
-      //  otherwise: the new value of the top is returned.
-      if (result == obj) {
-        assert(is_aligned(obj) && is_aligned(new_top), "checking alignment");
-        return obj;
-      }
-    } else {
-      return NULL;
-    }
-  } while (true);
-}
-
-
 HeapWord* OffsetTableContigSpace::initialize_threshold() {
   return _offsets.initialize_threshold();
 }
diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp
index dddbcf26109..d0c7a111784 100644
--- a/hotspot/src/share/vm/memory/space.hpp
+++ b/hotspot/src/share/vm/memory/space.hpp
@@ -41,20 +41,6 @@
 // implementations for keeping track of free and used space,
 // for iterating over objects and free blocks, etc.
 
-// Here's the Space hierarchy:
-//
-// - Space               -- an abstract base class describing a heap area
-//   - CompactibleSpace  -- a space supporting compaction
-//     - CompactibleFreeListSpace -- (used for CMS generation)
-//     - G1OffsetTableContigSpace -- G1 version of OffsetTableContigSpace
-//     - ContiguousSpace -- a compactible space in which all free space
-//                          is contiguous
-//       - EdenSpace     -- contiguous space used as nursery
-//         - ConcEdenSpace -- contiguous space with a 'soft end safe' allocation
-//       - OffsetTableContigSpace -- contiguous space with a block offset array
-//                          that allows "fast" block_start calls
-//         - TenuredSpace -- (used for TenuredGeneration)
-
 // Forward decls.
 class Space;
 class BlockOffsetArray;
@@ -544,8 +530,8 @@ class ContiguousSpace: public CompactibleSpace {
   GenSpaceMangler* mangler() { return _mangler; }
 
   // Allocation helpers (return NULL if full).
-  inline HeapWord* allocate_impl(size_t word_size, HeapWord* end_value);
-  inline HeapWord* par_allocate_impl(size_t word_size, HeapWord* end_value);
+  inline HeapWord* allocate_impl(size_t word_size);
+  inline HeapWord* par_allocate_impl(size_t word_size);
 
  public:
   ContiguousSpace();
@@ -761,56 +747,6 @@ public:
   {}
 };
 
-
-// Class EdenSpace describes eden-space in new generation.
-
-class DefNewGeneration;
-
-class EdenSpace : public ContiguousSpace {
-  friend class VMStructs;
- private:
-  DefNewGeneration* _gen;
-
-  // _soft_end is used as a soft limit on allocation.  As soft limits are
-  // reached, the slow-path allocation code can invoke other actions and then
-  // adjust _soft_end up to a new soft limit or to end().
-  HeapWord* _soft_end;
-
- public:
-  EdenSpace(DefNewGeneration* gen) :
-   _gen(gen), _soft_end(NULL) {}
-
-  // Get/set just the 'soft' limit.
-  HeapWord* soft_end()               { return _soft_end; }
-  HeapWord** soft_end_addr()         { return &_soft_end; }
-  void set_soft_end(HeapWord* value) { _soft_end = value; }
-
-  // Override.
-  void clear(bool mangle_space);
-
-  // Set both the 'hard' and 'soft' limits (_end and _soft_end).
-  void set_end(HeapWord* value) {
-    set_soft_end(value);
-    ContiguousSpace::set_end(value);
-  }
-
-  // Allocation (return NULL if full)
-  HeapWord* allocate(size_t word_size);
-  HeapWord* par_allocate(size_t word_size);
-};
-
-// Class ConcEdenSpace extends EdenSpace for the sake of safe
-// allocation while soft-end is being modified concurrently
-
-class ConcEdenSpace : public EdenSpace {
- public:
-  ConcEdenSpace(DefNewGeneration* gen) : EdenSpace(gen) { }
-
-  // Allocation (return NULL if full)
-  HeapWord* par_allocate(size_t word_size);
-};
-
-
 // A ContigSpace that Supports an efficient "block_start" operation via
 // a BlockOffsetArray (whose BlockOffsetSharedArray may be shared with
 // other spaces.)  This is the abstract base class for old generation
diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp
index 40cc26aa0d1..ded7ed21554 100644
--- a/hotspot/src/share/vm/opto/macro.cpp
+++ b/hotspot/src/share/vm/opto/macro.cpp
@@ -1197,8 +1197,7 @@ void PhaseMacroExpand::expand_allocate_common(
   }
 
   if (C->env()->dtrace_alloc_probes() ||
-      !UseTLAB && (!Universe::heap()->supports_inline_contig_alloc() ||
-                   (UseConcMarkSweepGC && CMSIncrementalMode))) {
+      !UseTLAB && (!Universe::heap()->supports_inline_contig_alloc())) {
     // Force slow-path allocation
     always_slow = true;
     initial_slow_test = NULL;
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index 346208fa427..b002b524af2 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -1774,7 +1774,7 @@ void Arguments::set_g1_gc_flags() {
 #ifdef ASSERT
 static bool verify_serial_gc_flags() {
   return (UseSerialGC &&
-        !(UseParNewGC || (UseConcMarkSweepGC || CMSIncrementalMode) || UseG1GC ||
+        !(UseParNewGC || (UseConcMarkSweepGC) || UseG1GC ||
           UseParallelGC || UseParallelOldGC));
 }
 #endif // ASSERT
@@ -2188,10 +2188,6 @@ void Arguments::check_deprecated_gcs() {
     warning("Using the ParNew young collector with the Serial old collector is deprecated "
         "and will likely be removed in a future release");
   }
-
-  if (CMSIncrementalMode) {
-    warning("Using incremental CMS is deprecated and will likely be removed in a future release");
-  }
 }
 
 void Arguments::check_deprecated_gc_flags() {
@@ -2313,31 +2309,8 @@ bool Arguments::check_vm_args_consistency() {
   status = status && ArgumentsExt::check_gc_consistency_user();
   status = status && check_stack_pages();
 
-  if (CMSIncrementalMode) {
-    if (!UseConcMarkSweepGC) {
-      jio_fprintf(defaultStream::error_stream(),
-                  "error:  invalid argument combination.\n"
-                  "The CMS collector (-XX:+UseConcMarkSweepGC) must be "
-                  "selected in order\nto use CMSIncrementalMode.\n");
-      status = false;
-    } else {
-      status = status && verify_percentage(CMSIncrementalDutyCycle,
-                                  "CMSIncrementalDutyCycle");
-      status = status && verify_percentage(CMSIncrementalDutyCycleMin,
-                                  "CMSIncrementalDutyCycleMin");
-      status = status && verify_percentage(CMSIncrementalSafetyFactor,
-                                  "CMSIncrementalSafetyFactor");
-      status = status && verify_percentage(CMSIncrementalOffset,
-                                  "CMSIncrementalOffset");
-      status = status && verify_percentage(CMSExpAvgFactor,
-                                  "CMSExpAvgFactor");
-      // If it was not set on the command line, set
-      // CMSInitiatingOccupancyFraction to 1 so icms can initiate cycles early.
-      if (CMSInitiatingOccupancyFraction < 0) {
-        FLAG_SET_DEFAULT(CMSInitiatingOccupancyFraction, 1);
-      }
-    }
-  }
+  status = status && verify_percentage(CMSIncrementalSafetyFactor,
+                                    "CMSIncrementalSafetyFactor");
 
   // CMS space iteration, which FLSVerifyAllHeapreferences entails,
   // insists that we hold the requisite locks so that the iteration is
@@ -2870,14 +2843,6 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
     // -Xnoclassgc
     } else if (match_option(option, "-Xnoclassgc", &tail)) {
       FLAG_SET_CMDLINE(bool, ClassUnloading, false);
-    // -Xincgc: i-CMS
-    } else if (match_option(option, "-Xincgc", &tail)) {
-      FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true);
-      FLAG_SET_CMDLINE(bool, CMSIncrementalMode, true);
-    // -Xnoincgc: no i-CMS
-    } else if (match_option(option, "-Xnoincgc", &tail)) {
-      FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, false);
-      FLAG_SET_CMDLINE(bool, CMSIncrementalMode, false);
     // -Xconcgc
     } else if (match_option(option, "-Xconcgc", &tail)) {
       FLAG_SET_CMDLINE(bool, UseConcMarkSweepGC, true);
@@ -3707,7 +3672,6 @@ void Arguments::set_shared_spaces_flags() {
 #if !INCLUDE_ALL_GCS
 static void force_serial_gc() {
   FLAG_SET_DEFAULT(UseSerialGC, true);
-  FLAG_SET_DEFAULT(CMSIncrementalMode, false);  // special CMS suboption
   UNSUPPORTED_GC_OPTION(UseG1GC);
   UNSUPPORTED_GC_OPTION(UseParallelGC);
   UNSUPPORTED_GC_OPTION(UseParallelOldGC);
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index bbab0184627..cb6b2306745 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -1638,30 +1638,10 @@ class CommandLineFlags {
           "The maximum size of young gen chosen by default per GC worker "  \
           "thread available")                                               \
                                                                             \
-  product(bool, CMSIncrementalMode, false,                                  \
-          "Whether CMS GC should operate in \"incremental\" mode")          \
-                                                                            \
-  product(uintx, CMSIncrementalDutyCycle, 10,                               \
-          "Percentage (0-100) of CMS incremental mode duty cycle. If "      \
-          "CMSIncrementalPacing is enabled, then this is just the initial " \
-          "value.")                                                         \
-                                                                            \
-  product(bool, CMSIncrementalPacing, true,                                 \
-          "Whether the CMS incremental mode duty cycle should be "          \
-          "automatically adjusted")                                         \
-                                                                            \
-  product(uintx, CMSIncrementalDutyCycleMin, 0,                             \
-          "Minimum percentage (0-100) of the CMS incremental duty cycle "   \
-          "used when CMSIncrementalPacing is enabled")                      \
-                                                                            \
   product(uintx, CMSIncrementalSafetyFactor, 10,                            \
           "Percentage (0-100) used to add conservatism when computing the " \
           "duty cycle")                                                     \
                                                                             \
-  product(uintx, CMSIncrementalOffset, 0,                                   \
-          "Percentage (0-100) by which the CMS incremental mode duty cycle "\
-          "is shifted to the right within the period between young GCs")    \
-                                                                            \
   product(uintx, CMSExpAvgFactor, 50,                                       \
           "Percentage (0-100) used to weight the current sample when "      \
           "computing exponential averages for CMS statistics")              \
@@ -1720,15 +1700,6 @@ class CommandLineFlags {
           "Skip block flux-rate sampling for an epoch unless inter-sweep "  \
           "duration exceeds this threshold in milliseconds")                \
                                                                             \
-  develop(bool, CMSTraceIncrementalMode, false,                             \
-          "Trace CMS incremental mode")                                     \
-                                                                            \
-  develop(bool, CMSTraceIncrementalPacing, false,                           \
-          "Trace CMS incremental mode pacing computation")                  \
-                                                                            \
-  develop(bool, CMSTraceThreadState, false,                                 \
-          "Trace the CMS thread state (enable the trace_state() method)")   \
-                                                                            \
   product(bool, CMSClassUnloadingEnabled, true,                             \
           "Whether class unloading enabled when using CMS GC")              \
                                                                             \
diff --git a/hotspot/src/share/vm/runtime/mutexLocker.cpp b/hotspot/src/share/vm/runtime/mutexLocker.cpp
index 5cbbbeb3828..6acb0828407 100644
--- a/hotspot/src/share/vm/runtime/mutexLocker.cpp
+++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp
@@ -72,7 +72,6 @@ Monitor* Threads_lock                 = NULL;
 Monitor* CGC_lock                     = NULL;
 Monitor* STS_lock                     = NULL;
 Monitor* SLT_lock                     = NULL;
-Monitor* iCMS_lock                    = NULL;
 Monitor* FullGCCount_lock             = NULL;
 Monitor* CMark_lock                   = NULL;
 Mutex*   CMRegionStack_lock           = NULL;
@@ -175,9 +174,6 @@ void mutex_init() {
 
   def(CGC_lock                   , Monitor, special,     true ); // coordinate between fore- and background GC
   def(STS_lock                   , Monitor, leaf,        true );
-  if (UseConcMarkSweepGC) {
-    def(iCMS_lock                  , Monitor, special,     true ); // CMS incremental mode start/stop notification
-  }
   if (UseConcMarkSweepGC || UseG1GC) {
     def(FullGCCount_lock           , Monitor, leaf,        true ); // in support of ExplicitGCInvokesConcurrent
   }
diff --git a/hotspot/src/share/vm/runtime/mutexLocker.hpp b/hotspot/src/share/vm/runtime/mutexLocker.hpp
index ab027291d30..0a28a6821f6 100644
--- a/hotspot/src/share/vm/runtime/mutexLocker.hpp
+++ b/hotspot/src/share/vm/runtime/mutexLocker.hpp
@@ -66,7 +66,6 @@ extern Monitor* CGC_lock;                        // used for coordination betwee
                                                  // fore- & background GC threads.
 extern Monitor* STS_lock;                        // used for joining/leaving SuspendibleThreadSet.
 extern Monitor* SLT_lock;                        // used in CMS GC for acquiring PLL
-extern Monitor* iCMS_lock;                       // CMS incremental mode start/stop notification
 extern Monitor* FullGCCount_lock;                // in support of "concurrent" full gc
 extern Monitor* CMark_lock;                      // used for concurrent mark thread coordination
 extern Mutex*   CMRegionStack_lock;              // used for protecting accesses to the CM region stack
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index c81cd8a2c9a..14fa1fc7ff5 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -527,12 +527,10 @@ typedef TwoOopHashtable<Symbol*, mtClass>     SymbolTwoOopHashtable;
   nonstatic_field(DefNewGeneration,            _next_gen,                                     Generation*)                           \
   nonstatic_field(DefNewGeneration,            _tenuring_threshold,                           uint)                                  \
   nonstatic_field(DefNewGeneration,            _age_table,                                    ageTable)                              \
-  nonstatic_field(DefNewGeneration,            _eden_space,                                   EdenSpace*)                            \
+  nonstatic_field(DefNewGeneration,            _eden_space,                                   ContiguousSpace*)                      \
   nonstatic_field(DefNewGeneration,            _from_space,                                   ContiguousSpace*)                      \
   nonstatic_field(DefNewGeneration,            _to_space,                                     ContiguousSpace*)                      \
                                                                                                                                      \
-  nonstatic_field(EdenSpace,                   _gen,                                          DefNewGeneration*)                     \
-                                                                                                                                     \
   nonstatic_field(Generation,                  _reserved,                                     MemRegion)                             \
   nonstatic_field(Generation,                  _virtual_space,                                VirtualSpace)                          \
   nonstatic_field(Generation,                  _level,                                        int)                                   \
@@ -1490,7 +1488,6 @@ typedef TwoOopHashtable<Symbol*, mtClass>     SymbolTwoOopHashtable;
   declare_toplevel_type(BitMap)                                           \
            declare_type(CompactibleSpace,             Space)              \
            declare_type(ContiguousSpace,              CompactibleSpace)   \
-           declare_type(EdenSpace,                    ContiguousSpace)    \
            declare_type(OffsetTableContigSpace,       ContiguousSpace)    \
            declare_type(TenuredSpace,                 OffsetTableContigSpace) \
   declare_toplevel_type(BarrierSet)                                       \
@@ -1532,7 +1529,6 @@ typedef TwoOopHashtable<Symbol*, mtClass>     SymbolTwoOopHashtable;
   declare_toplevel_type(CollectedHeap*)                                   \
   declare_toplevel_type(ContiguousSpace*)                                 \
   declare_toplevel_type(DefNewGeneration*)                                \
-  declare_toplevel_type(EdenSpace*)                                       \
   declare_toplevel_type(GenCollectedHeap*)                                \
   declare_toplevel_type(Generation*)                                      \
   declare_toplevel_type(GenerationSpec**)                                 \
diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups
index 0b65e906df7..9c12a059526 100644
--- a/hotspot/test/TEST.groups
+++ b/hotspot/test/TEST.groups
@@ -175,11 +175,8 @@ needs_full_vm_compact1 = \
   gc/g1/TestShrinkToOneRegion.java \
   gc/metaspace/G1AddMetaspaceDependency.java \
   gc/startup_warnings/TestCMS.java \
-  gc/startup_warnings/TestCMSIncrementalMode.java \
-  gc/startup_warnings/TestCMSNoIncrementalMode.java \
   gc/startup_warnings/TestDefaultMaxRAMFraction.java \
   gc/startup_warnings/TestDefNewCMS.java \
-  gc/startup_warnings/TestIncGC.java \
   gc/startup_warnings/TestParallelGC.java \
   gc/startup_warnings/TestParallelScavengeSerialOld.java \
   gc/startup_warnings/TestParNewCMS.java \
@@ -273,8 +270,6 @@ needs_cmsgc = \
   gc/class_unloading/TestCMSClassUnloadingEnabledHWM.java \
   gc/concurrentMarkSweep/ \
   gc/startup_warnings/TestCMS.java \
-  gc/startup_warnings/TestCMSIncrementalMode.java \
-  gc/startup_warnings/TestCMSNoIncrementalMode.java \
   gc/startup_warnings/TestDefNewCMS.java \
   gc/startup_warnings/TestParNewCMS.java
 
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
index a185fe5d4e8..6a268ae8c46 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
@@ -279,8 +279,7 @@ public class TestShrinkAuxiliaryData {
             "-XX:\\+UseConcMarkSweepGC",
             "-XX:\\+UseParallelOldGC",
             "-XX:\\+UseParNewGC",
-            "-Xconcgc",
-            "-Xincgc"
+            "-Xconcgc"
         };
     }
 }
diff --git a/hotspot/test/gc/startup_warnings/TestCMSIncrementalMode.java b/hotspot/test/gc/startup_warnings/TestCMSIncrementalMode.java
deleted file mode 100644
index 2103093ce58..00000000000
--- a/hotspot/test/gc/startup_warnings/TestCMSIncrementalMode.java
+++ /dev/null
@@ -1,46 +0,0 @@
-
-/*
-* Copyright (c) 2013, 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 TestCMSIncrementalMode
-* @key gc
-* @bug 8006398
-* @summary Test that the deprecated CMSIncrementalMode print a warning message
-* @library /testlibrary
-*/
-
-import com.oracle.java.testlibrary.OutputAnalyzer;
-import com.oracle.java.testlibrary.ProcessTools;
-
-public class TestCMSIncrementalMode {
-
-  public static void main(String args[]) throws Exception {
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseConcMarkSweepGC", "-XX:+CMSIncrementalMode", "-version");
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("warning: Using incremental CMS is deprecated and will likely be removed in a future release");
-    output.shouldNotContain("error");
-    output.shouldHaveExitValue(0);
-  }
-
-}
diff --git a/hotspot/test/gc/startup_warnings/TestCMSNoIncrementalMode.java b/hotspot/test/gc/startup_warnings/TestCMSNoIncrementalMode.java
deleted file mode 100644
index 0d329fbe57e..00000000000
--- a/hotspot/test/gc/startup_warnings/TestCMSNoIncrementalMode.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
-* Copyright (c) 2013, 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 TestCMSNoIncrementalMode
-* @key gc
-* @bug 8006398
-* @summary Test that CMS with incremental mode turned off does not print a warning message
-* @library /testlibrary
-*/
-
-import com.oracle.java.testlibrary.OutputAnalyzer;
-import com.oracle.java.testlibrary.ProcessTools;
-
-public class TestCMSNoIncrementalMode {
-
-  public static void main(String args[]) throws Exception {
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseConcMarkSweepGC", "-XX:-CMSIncrementalMode", "-version");
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldNotContain("deprecated");
-    output.shouldNotContain("error");
-    output.shouldHaveExitValue(0);
-  }
-
-}
diff --git a/hotspot/test/gc/startup_warnings/TestIncGC.java b/hotspot/test/gc/startup_warnings/TestIncGC.java
deleted file mode 100644
index 03c7f9b9fad..00000000000
--- a/hotspot/test/gc/startup_warnings/TestIncGC.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-* Copyright (c) 2013, 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 TestIncGC
-* @key gc
-* @bug 8006398
-* @summary Test that the deprecated -Xincgc print a warning message
-* @library /testlibrary
-*/
-
-import com.oracle.java.testlibrary.OutputAnalyzer;
-import com.oracle.java.testlibrary.ProcessTools;
-
-
-public class TestIncGC {
-
-  public static void main(String args[]) throws Exception {
-    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-Xincgc", "-version");
-    OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("warning: Using incremental CMS is deprecated and will likely be removed in a future release");
-    output.shouldNotContain("error");
-    output.shouldHaveExitValue(0);
-  }
-
-}

From fe45f7091b90e3345e9d66faedb98c59d2e12e48 Mon Sep 17 00:00:00 2001
From: Marcus Larsson <mlarsson@openjdk.org>
Date: Mon, 3 Nov 2014 11:29:00 +0100
Subject: [PATCH 029/299] 8054491: Remove wrong assert and refactor code in
 G1CollectorPolicy::record_concurrent_mark_end

Reviewed-by: tschatzl, brutisso
---
 .../g1/g1CollectorPolicy.cpp                  | 38 +++++++------------
 .../g1/g1CollectorPolicy.hpp                  |  6 ++-
 2 files changed, 18 insertions(+), 26 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
index 4b193af1fae..ec9dc9a506a 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
@@ -1585,34 +1585,22 @@ public:
   }
 };
 
+uint G1CollectorPolicy::calculate_parallel_work_chunk_size(uint n_workers, uint n_regions) {
+  assert(n_workers > 0, "Active gc workers should be greater than 0");
+  const uint overpartition_factor = 4;
+  const uint min_chunk_size = MAX2(n_regions / n_workers, 1U);
+  return MAX2(n_regions / (n_workers * overpartition_factor), min_chunk_size);
+}
+
 void
-G1CollectorPolicy::record_concurrent_mark_cleanup_end(int no_of_gc_threads) {
+G1CollectorPolicy::record_concurrent_mark_cleanup_end(uint n_workers) {
   _collectionSetChooser->clear();
 
-  uint region_num = _g1->num_regions();
-  const uint OverpartitionFactor = 4;
-  uint WorkUnit;
-  // The use of MinChunkSize = 8 in the original code
-  // causes some assertion failures when the total number of
-  // region is less than 8.  The code here tries to fix that.
-  // Should the original code also be fixed?
-  if (no_of_gc_threads > 0) {
-    const uint MinWorkUnit = MAX2(region_num / no_of_gc_threads, 1U);
-    WorkUnit = MAX2(region_num / (no_of_gc_threads * OverpartitionFactor),
-                    MinWorkUnit);
-  } else {
-    assert(no_of_gc_threads > 0,
-      "The active gc workers should be greater than 0");
-    // In a product build do something reasonable to avoid a crash.
-    const uint MinWorkUnit = MAX2(region_num / (uint) ParallelGCThreads, 1U);
-    WorkUnit =
-      MAX2(region_num / (uint) (ParallelGCThreads * OverpartitionFactor),
-           MinWorkUnit);
-  }
-  _collectionSetChooser->prepare_for_par_region_addition(_g1->num_regions(),
-                                                         WorkUnit);
-  ParKnownGarbageTask parKnownGarbageTask(_collectionSetChooser, WorkUnit, (uint) no_of_gc_threads);
-  _g1->workers()->run_task(&parKnownGarbageTask);
+  uint n_regions = _g1->num_regions();
+  uint chunk_size = calculate_parallel_work_chunk_size(n_workers, n_regions);
+  _collectionSetChooser->prepare_for_par_region_addition(n_regions, chunk_size);
+  ParKnownGarbageTask par_known_garbage_task(_collectionSetChooser, chunk_size, n_workers);
+  _g1->workers()->run_task(&par_known_garbage_task);
 
   _collectionSetChooser->sort_regions();
 
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
index 4746e0aac8a..b9c73f4120b 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
@@ -612,6 +612,10 @@ private:
                                           uint desired_min_length,
                                           uint desired_max_length);
 
+  // Calculate and return chunk size (in number of regions) for parallel
+  // concurrent mark cleanup.
+  uint calculate_parallel_work_chunk_size(uint n_workers, uint n_regions);
+
   // Check whether a given young length (young_length) fits into the
   // given target pause time and whether the prediction for the amount
   // of objects to be copied for the given length will fit into the
@@ -687,7 +691,7 @@ public:
 
   // Record start, end, and completion of cleanup.
   void record_concurrent_mark_cleanup_start();
-  void record_concurrent_mark_cleanup_end(int no_of_gc_threads);
+  void record_concurrent_mark_cleanup_end(uint n_workers);
   void record_concurrent_mark_cleanup_completed();
 
   // Records the information about the heap size for reporting in

From 4a9f06758726838799673a0e19af9588f4447500 Mon Sep 17 00:00:00 2001
From: Marcus Larsson <mlarsson@openjdk.org>
Date: Mon, 3 Nov 2014 12:49:21 +0100
Subject: [PATCH 030/299] 8049341: Parallelize clearing the next mark bitmap

Reviewed-by: mgerdin, tschatzl
---
 .../gc_implementation/g1/concurrentMark.cpp   | 28 +++++++++++++++++--
 .../g1/concurrentMarkThread.cpp               |  1 -
 2 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
index eeb110cd015..b01b5d16860 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
@@ -180,9 +180,32 @@ class ClearBitmapHRClosure : public HeapRegionClosure {
   }
 };
 
+class ParClearNextMarkBitmapTask : public AbstractGangTask {
+  ClearBitmapHRClosure* _cl;
+  HeapRegionClaimer     _hrclaimer;
+  bool                  _suspendible; // If the task is suspendible, workers must join the STS.
+
+public:
+  ParClearNextMarkBitmapTask(ClearBitmapHRClosure *cl, uint n_workers, bool suspendible) :
+      _cl(cl), _suspendible(suspendible), AbstractGangTask("Parallel Clear Bitmap Task"), _hrclaimer(n_workers) {}
+
+  void work(uint worker_id) {
+    if (_suspendible) {
+      SuspendibleThreadSet::join();
+    }
+    G1CollectedHeap::heap()->heap_region_par_iterate(_cl, worker_id, &_hrclaimer);
+    if (_suspendible) {
+      SuspendibleThreadSet::leave();
+    }
+  }
+};
+
 void CMBitMap::clearAll() {
+  G1CollectedHeap* g1h = G1CollectedHeap::heap();
   ClearBitmapHRClosure cl(NULL, this, false /* may_yield */);
-  G1CollectedHeap::heap()->heap_region_iterate(&cl);
+  uint n_workers = g1h->workers()->active_workers();
+  ParClearNextMarkBitmapTask task(&cl, n_workers, false);
+  g1h->workers()->run_task(&task);
   guarantee(cl.complete(), "Must have completed iteration.");
   return;
 }
@@ -861,7 +884,8 @@ void ConcurrentMark::clearNextBitmap() {
   guarantee(!g1h->mark_in_progress(), "invariant");
 
   ClearBitmapHRClosure cl(this, _nextMarkBitMap, true /* may_yield */);
-  g1h->heap_region_iterate(&cl);
+  ParClearNextMarkBitmapTask task(&cl, parallel_marking_threads(), true);
+  _parallel_workers->run_task(&task);
 
   // Clear the liveness counting data. If the marking has been aborted, the abort()
   // call already did that.
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
index 1f9f0661779..5b51a6f4675 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
@@ -280,7 +280,6 @@ void ConcurrentMarkThread::run() {
       // We may have aborted just before the remark. Do not bother clearing the
       // bitmap then, as it has been done during mark abort.
       if (!cm()->has_aborted()) {
-        SuspendibleThreadSetJoiner sts;
         _cm->clearNextBitmap();
       } else {
         assert(!G1VerifyBitmaps || _cm->nextMarkBitmapIsClear(), "Next mark bitmap must be clear");

From c1bc4be92b0dae26e36cd165a63bd62872cf16c2 Mon Sep 17 00:00:00 2001
From: Bengt Rutisson <brutisso@openjdk.org>
Date: Wed, 5 Nov 2014 10:12:51 +0100
Subject: [PATCH 031/299] 8061449: G1: FreeRegionList_test() fails with G1
 after the JDK-8058534 fix to HeapRegion::orig_end()

Reviewed-by: mgerdin, tschatzl, stefank
---
 .../vm/gc_implementation/g1/heapRegionSet.cpp  | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
index e1674516881..7c954ffd6bc 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
@@ -426,11 +426,19 @@ void FreeRegionList_test() {
                                          mtGC);
   G1BlockOffsetSharedArray oa(heap, bot_storage);
   bot_storage->commit_regions(0, num_regions_in_test);
-  HeapRegion hr0(0, &oa, heap);
-  HeapRegion hr1(1, &oa, heap);
-  HeapRegion hr2(2, &oa, heap);
-  HeapRegion hr3(3, &oa, heap);
-  HeapRegion hr4(4, &oa, heap);
+
+  // Set up memory regions for the heap regions.
+  MemRegion mr0(heap.start(), HeapRegion::GrainWords);
+  MemRegion mr1(mr0.end(), HeapRegion::GrainWords);
+  MemRegion mr2(mr1.end(), HeapRegion::GrainWords);
+  MemRegion mr3(mr2.end(), HeapRegion::GrainWords);
+  MemRegion mr4(mr3.end(), HeapRegion::GrainWords);
+
+  HeapRegion hr0(0, &oa, mr0);
+  HeapRegion hr1(1, &oa, mr1);
+  HeapRegion hr2(2, &oa, mr2);
+  HeapRegion hr3(3, &oa, mr3);
+  HeapRegion hr4(4, &oa, mr4);
   l.add_ordered(&hr1);
   l.add_ordered(&hr0);
   l.add_ordered(&hr3);

From 0e5492868614324428f9ab876df4214ce5066f39 Mon Sep 17 00:00:00 2001
From: Erik Helin <ehelin@openjdk.org>
Date: Wed, 5 Nov 2014 16:39:10 +0100
Subject: [PATCH 032/299] 8061467: Bad page size passed to setup_large_pages()
 on Solaris

Reviewed-by: tschatzl, mgerdin
---
 hotspot/src/os/solaris/vm/os_solaris.cpp |  5 +++-
 hotspot/test/gc/TestNUMAPageSize.java    | 37 ++++++++++++++++++++++++
 2 files changed, 41 insertions(+), 1 deletion(-)
 create mode 100644 hotspot/test/gc/TestNUMAPageSize.java

diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp
index dddb4e7e567..fdf2c1ec1d7 100644
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp
@@ -2607,7 +2607,10 @@ void os::pd_realign_memory(char *addr, size_t bytes, size_t alignment_hint) {
   assert((intptr_t)addr % alignment_hint == 0, "Address should be aligned.");
   assert((intptr_t)(addr + bytes) % alignment_hint == 0, "End should be aligned.");
   if (UseLargePages) {
-    Solaris::setup_large_pages(addr, bytes, alignment_hint);
+    size_t page_size = Solaris::page_size_for_alignment(alignment_hint);
+    if (page_size > (size_t) vm_page_size()) {
+      Solaris::setup_large_pages(addr, bytes, page_size);
+    }
   }
 }
 
diff --git a/hotspot/test/gc/TestNUMAPageSize.java b/hotspot/test/gc/TestNUMAPageSize.java
new file mode 100644
index 00000000000..1a3b5ddbebf
--- /dev/null
+++ b/hotspot/test/gc/TestNUMAPageSize.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014, 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 TestNUMAPageSize
+ * @summary Make sure that start up with NUMA support does not cause problems.
+ * @bug 8061467
+ * @key gc
+ * @key regression
+ * @run main/othervm -Xmx8M -XX:+UseNUMA TestNUMAPageSize
+ */
+
+public class TestNUMAPageSize {
+  public static void main(String args[]) throws Exception {
+    // nothing to do
+  }
+}

From 7339456266104bf8f691e4710cc4cd19b5a221ac Mon Sep 17 00:00:00 2001
From: Jesper Wilhelmsson <jwilhelm@openjdk.org>
Date: Wed, 5 Nov 2014 15:50:14 +0100
Subject: [PATCH 033/299] 8062836: BACKOUT - Parallelize clearing the next mark
 bitmap

Backing out due to non-trivial issues found in nightly testing

Reviewed-by: mgerdin, mlarsson
---
 .../gc_implementation/g1/concurrentMark.cpp   | 28 ++-----------------
 .../g1/concurrentMarkThread.cpp               |  1 +
 2 files changed, 3 insertions(+), 26 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
index b01b5d16860..eeb110cd015 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
@@ -180,32 +180,9 @@ class ClearBitmapHRClosure : public HeapRegionClosure {
   }
 };
 
-class ParClearNextMarkBitmapTask : public AbstractGangTask {
-  ClearBitmapHRClosure* _cl;
-  HeapRegionClaimer     _hrclaimer;
-  bool                  _suspendible; // If the task is suspendible, workers must join the STS.
-
-public:
-  ParClearNextMarkBitmapTask(ClearBitmapHRClosure *cl, uint n_workers, bool suspendible) :
-      _cl(cl), _suspendible(suspendible), AbstractGangTask("Parallel Clear Bitmap Task"), _hrclaimer(n_workers) {}
-
-  void work(uint worker_id) {
-    if (_suspendible) {
-      SuspendibleThreadSet::join();
-    }
-    G1CollectedHeap::heap()->heap_region_par_iterate(_cl, worker_id, &_hrclaimer);
-    if (_suspendible) {
-      SuspendibleThreadSet::leave();
-    }
-  }
-};
-
 void CMBitMap::clearAll() {
-  G1CollectedHeap* g1h = G1CollectedHeap::heap();
   ClearBitmapHRClosure cl(NULL, this, false /* may_yield */);
-  uint n_workers = g1h->workers()->active_workers();
-  ParClearNextMarkBitmapTask task(&cl, n_workers, false);
-  g1h->workers()->run_task(&task);
+  G1CollectedHeap::heap()->heap_region_iterate(&cl);
   guarantee(cl.complete(), "Must have completed iteration.");
   return;
 }
@@ -884,8 +861,7 @@ void ConcurrentMark::clearNextBitmap() {
   guarantee(!g1h->mark_in_progress(), "invariant");
 
   ClearBitmapHRClosure cl(this, _nextMarkBitMap, true /* may_yield */);
-  ParClearNextMarkBitmapTask task(&cl, parallel_marking_threads(), true);
-  _parallel_workers->run_task(&task);
+  g1h->heap_region_iterate(&cl);
 
   // Clear the liveness counting data. If the marking has been aborted, the abort()
   // call already did that.
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
index 5b51a6f4675..1f9f0661779 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp
@@ -280,6 +280,7 @@ void ConcurrentMarkThread::run() {
       // We may have aborted just before the remark. Do not bother clearing the
       // bitmap then, as it has been done during mark abort.
       if (!cm()->has_aborted()) {
+        SuspendibleThreadSetJoiner sts;
         _cm->clearNextBitmap();
       } else {
         assert(!G1VerifyBitmaps || _cm->nextMarkBitmapIsClear(), "Next mark bitmap must be clear");

From bb556024a72ae9ce6177f8f73d90e5887246b358 Mon Sep 17 00:00:00 2001
From: Mikael Gerdin <mgerdin@openjdk.org>
Date: Mon, 3 Nov 2014 11:08:03 +0100
Subject: [PATCH 034/299] 8061964: Insufficient compiler barriers for GCC in
 OrderAccess functions

Fix OrderAccess functions to emit memory clobbering inline assembly to attempt to stop copiler reordering.

Reviewed-by: dcubed, dholmes, bdelsart
---
 .../vm/orderAccess_linux_x86.inline.hpp       | 57 ++++++++++---------
 1 file changed, 30 insertions(+), 27 deletions(-)

diff --git a/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp b/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp
index a71a53cfa8c..d391baf8095 100644
--- a/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp
+++ b/hotspot/src/os_cpu/linux_x86/vm/orderAccess_linux_x86.inline.hpp
@@ -31,6 +31,11 @@
 
 // Implementation of class OrderAccess.
 
+// A compiler barrier, forcing the C++ compiler to invalidate all memory assumptions
+static inline void compiler_barrier() {
+  __asm__ volatile ("" : : : "memory");
+}
+
 inline void OrderAccess::loadload()   { acquire(); }
 inline void OrderAccess::storestore() { release(); }
 inline void OrderAccess::loadstore()  { acquire(); }
@@ -46,9 +51,7 @@ inline void OrderAccess::acquire() {
 }
 
 inline void OrderAccess::release() {
-  // Avoid hitting the same cache-line from
-  // different threads.
-  volatile jint local_dummy = 0;
+  compiler_barrier();
 }
 
 inline void OrderAccess::fence() {
@@ -62,34 +65,34 @@ inline void OrderAccess::fence() {
   }
 }
 
-inline jbyte    OrderAccess::load_acquire(volatile jbyte*   p) { return *p; }
-inline jshort   OrderAccess::load_acquire(volatile jshort*  p) { return *p; }
-inline jint     OrderAccess::load_acquire(volatile jint*    p) { return *p; }
-inline jlong    OrderAccess::load_acquire(volatile jlong*   p) { return Atomic::load(p); }
-inline jubyte   OrderAccess::load_acquire(volatile jubyte*  p) { return *p; }
-inline jushort  OrderAccess::load_acquire(volatile jushort* p) { return *p; }
-inline juint    OrderAccess::load_acquire(volatile juint*   p) { return *p; }
-inline julong   OrderAccess::load_acquire(volatile julong*  p) { return Atomic::load((volatile jlong*)p); }
-inline jfloat   OrderAccess::load_acquire(volatile jfloat*  p) { return *p; }
-inline jdouble  OrderAccess::load_acquire(volatile jdouble* p) { return jdouble_cast(Atomic::load((volatile jlong*)p)); }
+inline jbyte    OrderAccess::load_acquire(volatile jbyte*   p) { jbyte   v = *p; compiler_barrier(); return v; }
+inline jshort   OrderAccess::load_acquire(volatile jshort*  p) { jshort  v = *p; compiler_barrier(); return v; }
+inline jint     OrderAccess::load_acquire(volatile jint*    p) { jint    v = *p; compiler_barrier(); return v; }
+inline jlong    OrderAccess::load_acquire(volatile jlong*   p) { jlong   v = Atomic::load(p); compiler_barrier(); return v; }
+inline jubyte   OrderAccess::load_acquire(volatile jubyte*  p) { jubyte  v = *p; compiler_barrier(); return v; }
+inline jushort  OrderAccess::load_acquire(volatile jushort* p) { jushort v = *p; compiler_barrier(); return v; }
+inline juint    OrderAccess::load_acquire(volatile juint*   p) { juint   v = *p; compiler_barrier(); return v; }
+inline julong   OrderAccess::load_acquire(volatile julong*  p) { julong  v = Atomic::load((volatile jlong*)p); compiler_barrier(); return v; }
+inline jfloat   OrderAccess::load_acquire(volatile jfloat*  p) { jfloat  v = *p; compiler_barrier(); return v; }
+inline jdouble  OrderAccess::load_acquire(volatile jdouble* p) { jdouble v = jdouble_cast(Atomic::load((volatile jlong*)p)); compiler_barrier(); return v; }
 
-inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t*   p) { return *p; }
-inline void*    OrderAccess::load_ptr_acquire(volatile void*       p) { return *(void* volatile *)p; }
-inline void*    OrderAccess::load_ptr_acquire(const volatile void* p) { return *(void* const volatile *)p; }
+inline intptr_t OrderAccess::load_ptr_acquire(volatile intptr_t*   p) { intptr_t v = *p; compiler_barrier(); return v; }
+inline void*    OrderAccess::load_ptr_acquire(volatile void*       p) { void*    v = *(void* volatile *)p; compiler_barrier(); return v; }
+inline void*    OrderAccess::load_ptr_acquire(const volatile void* p) { void*    v = *(void* const volatile *)p; compiler_barrier(); return v; }
 
-inline void     OrderAccess::release_store(volatile jbyte*   p, jbyte   v) { *p = v; }
-inline void     OrderAccess::release_store(volatile jshort*  p, jshort  v) { *p = v; }
-inline void     OrderAccess::release_store(volatile jint*    p, jint    v) { *p = v; }
-inline void     OrderAccess::release_store(volatile jlong*   p, jlong   v) { Atomic::store(v, p); }
-inline void     OrderAccess::release_store(volatile jubyte*  p, jubyte  v) { *p = v; }
-inline void     OrderAccess::release_store(volatile jushort* p, jushort v) { *p = v; }
-inline void     OrderAccess::release_store(volatile juint*   p, juint   v) { *p = v; }
-inline void     OrderAccess::release_store(volatile julong*  p, julong  v) { Atomic::store((jlong)v, (volatile jlong*)p); }
-inline void     OrderAccess::release_store(volatile jfloat*  p, jfloat  v) { *p = v; }
+inline void     OrderAccess::release_store(volatile jbyte*   p, jbyte   v) { compiler_barrier(); *p = v; }
+inline void     OrderAccess::release_store(volatile jshort*  p, jshort  v) { compiler_barrier(); *p = v; }
+inline void     OrderAccess::release_store(volatile jint*    p, jint    v) { compiler_barrier(); *p = v; }
+inline void     OrderAccess::release_store(volatile jlong*   p, jlong   v) { compiler_barrier(); Atomic::store(v, p); }
+inline void     OrderAccess::release_store(volatile jubyte*  p, jubyte  v) { compiler_barrier(); *p = v; }
+inline void     OrderAccess::release_store(volatile jushort* p, jushort v) { compiler_barrier(); *p = v; }
+inline void     OrderAccess::release_store(volatile juint*   p, juint   v) { compiler_barrier(); *p = v; }
+inline void     OrderAccess::release_store(volatile julong*  p, julong  v) { compiler_barrier(); Atomic::store((jlong)v, (volatile jlong*)p); }
+inline void     OrderAccess::release_store(volatile jfloat*  p, jfloat  v) { compiler_barrier(); *p = v; }
 inline void     OrderAccess::release_store(volatile jdouble* p, jdouble v) { release_store((volatile jlong *)p, jlong_cast(v)); }
 
-inline void     OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { *p = v; }
-inline void     OrderAccess::release_store_ptr(volatile void*     p, void*    v) { *(void* volatile *)p = v; }
+inline void     OrderAccess::release_store_ptr(volatile intptr_t* p, intptr_t v) { compiler_barrier(); *p = v; }
+inline void     OrderAccess::release_store_ptr(volatile void*     p, void*    v) { compiler_barrier(); *(void* volatile *)p = v; }
 
 inline void     OrderAccess::store_fence(jbyte*  p, jbyte  v) {
   __asm__ volatile (  "xchgb (%2),%0"

From 894e9e8f87916207edf5969cfa2365d4c1a7df85 Mon Sep 17 00:00:00 2001
From: John Coomes <jcoomes@openjdk.org>
Date: Fri, 7 Nov 2014 15:34:33 -0800
Subject: [PATCH 035/299] 8060467: CMS: small OldPLABSize and -XX:-ResizePLAB
 cause assert(ResizePLAB || n_blks == OldPLABSize) failed: Error

Reviewed-by: tschatzl, jmasa, kbarrett
---
 .../compactibleFreeListSpace.cpp              |  2 +-
 .../DisableResizePLAB.java                    | 44 +++++++++++++++++++
 2 files changed, 45 insertions(+), 1 deletion(-)
 create mode 100644 hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java

diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
index ee2dc9b3622..812b8bcf3cf 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
@@ -2625,7 +2625,7 @@ void CFLS_LAB::get_from_global_pool(size_t word_sz, AdaptiveFreeList<FreeChunk>*
   // Get the #blocks we want to claim
   size_t n_blks = (size_t)_blocks_to_claim[word_sz].average();
   assert(n_blks > 0, "Error");
-  assert(ResizePLAB || n_blks == OldPLABSize, "Error");
+  assert(ResizeOldPLAB || n_blks == OldPLABSize, "Error");
   // In some cases, when the application has a phase change,
   // there may be a sudden and sharp shift in the object survival
   // profile, and updating the counts at the end of a scavenge
diff --git a/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java b/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java
new file mode 100644
index 00000000000..c504d069a72
--- /dev/null
+++ b/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java
@@ -0,0 +1,44 @@
+/*
+* Copyright (c) 2014, 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 DisableResizePLAB
+ * @key gc
+ * @bug 8060467
+ * @author filipp.zhinkin@oracle.com, john.coomes@oracle.com
+ * @summary Run CMS with PLAB resizing disabled and a small OldPLABSize
+ * @run main/othervm -XX:+UseConcMarkSweepGC -XX:-ResizePLAB -XX:OldPLABSize=1k -Xmx256m -XX:+PrintGCDetails DisableResizePLAB
+ */
+
+public class DisableResizePLAB {
+    public static void main(String args[]) throws Exception {
+        Object garbage[] = new Object[1_000];
+        for (int i = 0; i < garbage.length; i++) {
+            garbage[i] = new byte[0];
+        }
+        long startTime = System.currentTimeMillis();
+        while (System.currentTimeMillis() - startTime < 10_000) {
+            Object o = new byte[1024];
+        }
+    }
+}

From 6e148efe69a6ea2ab2838ae179854e51fb8a8400 Mon Sep 17 00:00:00 2001
From: Marcus Larsson <mlarsson@openjdk.org>
Date: Mon, 10 Nov 2014 12:13:46 +0100
Subject: [PATCH 036/299] 8064348: Add TraceEvent::is_enabled() for
 embedded/minimal builds

Reviewed-by: ehelin, sla
---
 hotspot/src/share/vm/trace/traceEventClasses.xsl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/hotspot/src/share/vm/trace/traceEventClasses.xsl b/hotspot/src/share/vm/trace/traceEventClasses.xsl
index b213ea29c18..12496ac65e8 100644
--- a/hotspot/src/share/vm/trace/traceEventClasses.xsl
+++ b/hotspot/src/share/vm/trace/traceEventClasses.xsl
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
- Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 
  This code is free software; you can redistribute it and/or modify it
@@ -59,6 +59,7 @@ public:
   void set_starttime(const Ticks&amp; time) {}
   void set_endtime(const Ticks&amp; time) {}
   bool should_commit() const { return false; }
+  static bool is_enabled() { return false; }
   void commit() const {}
 };
 

From f9d8e2ae9dcb4a7fbc21c9d6a70e087d45a80954 Mon Sep 17 00:00:00 2001
From: Kim Barrett <kbarrett@openjdk.org>
Date: Mon, 27 Oct 2014 17:24:10 -0400
Subject: [PATCH 037/299] 8062206: Remove unusable G1RSLogCheckCardTable
 command line argument

Remove dependent assertion and remove develop option

Reviewed-by: jwilhelm, mgerdin, tschatzl
---
 .../share/vm/gc_implementation/g1/g1RemSet.cpp   | 16 ----------------
 .../share/vm/gc_implementation/g1/g1RemSet.hpp   | 13 -------------
 .../share/vm/gc_implementation/g1/g1_globals.hpp |  4 ----
 3 files changed, 33 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
index 833404b3412..048c09f5c52 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
@@ -97,13 +97,6 @@ G1RemSet::~G1RemSet() {
   FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl, mtGC);
 }
 
-void CountNonCleanMemRegionClosure::do_MemRegion(MemRegion mr) {
-  if (_g1->is_in_g1_reserved(mr.start())) {
-    _n += (int) ((mr.byte_size() / CardTableModRefBS::card_size));
-    if (_start_first == NULL) _start_first = mr.start();
-  }
-}
-
 class ScanRSClosure : public HeapRegionClosure {
   size_t _cards_done, _cards;
   G1CollectedHeap* _g1h;
@@ -303,15 +296,6 @@ void G1RemSet::updateRS(DirtyCardQueue* into_cset_dcq, uint worker_i) {
 
   _g1->iterate_dirty_card_closure(&into_cset_update_rs_cl, into_cset_dcq, false, worker_i);
 
-  // Now there should be no dirty cards.
-  if (G1RSLogCheckCardTable) {
-    CountNonCleanMemRegionClosure cl(_g1);
-    _ct_bs->mod_card_iterate(&cl);
-    // XXX This isn't true any more: keeping cards of young regions
-    // marked dirty broke it.  Need some reasonable fix.
-    guarantee(cl.n() == 0, "Card table should be clean.");
-  }
-
   _g1p->phase_times()->record_update_rs_time(worker_i, (os::elapsedTime() - start) * 1000.0);
 }
 
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp
index 126703ed691..ae51cdd19ce 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.hpp
@@ -151,19 +151,6 @@ public:
   }
 };
 
-class CountNonCleanMemRegionClosure: public MemRegionClosure {
-  G1CollectedHeap* _g1;
-  int _n;
-  HeapWord* _start_first;
-public:
-  CountNonCleanMemRegionClosure(G1CollectedHeap* g1) :
-    _g1(g1), _n(0), _start_first(NULL)
-  {}
-  void do_MemRegion(MemRegion mr);
-  int n() { return _n; };
-  HeapWord* start_first() { return _start_first; }
-};
-
 class UpdateRSOopClosure: public ExtendedOopClosure {
   HeapRegion* _from;
   G1RemSet* _rs;
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp
index a2d8366d5c6..1d8838740c1 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1_globals.hpp
@@ -108,10 +108,6 @@
   develop(bool, G1RSBarrierRegionFilter, true,                              \
           "If true, generate region filtering code in RS barrier")          \
                                                                             \
-  develop(bool, G1RSLogCheckCardTable, false,                               \
-          "If true, verify that no dirty cards remain after RS log "        \
-          "processing.")                                                    \
-                                                                            \
   diagnostic(bool, G1PrintRegionLivenessInfo, false,                        \
             "Prints the liveness information for all regions in the heap "  \
             "at the end of a marking cycle.")                               \

From 33df9eecaaecf8a2f50a186aadbc8799e0de592d Mon Sep 17 00:00:00 2001
From: Bengt Rutisson <brutisso@openjdk.org>
Date: Fri, 31 Oct 2014 09:29:32 +0100
Subject: [PATCH 038/299] 8061308: Remove iCMS

Reviewed-by: mgerdin, jmasa
---
 jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java
index 2795b29f71d..e96898c8fc5 100644
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java
@@ -128,8 +128,7 @@ public final class Utils {
      */
     private static final Pattern useGcPattern = Pattern.compile(
             "(?:\\-XX\\:[\\+\\-]Use.+GC)"
-            + "|(?:\\-Xconcgc)"
-            + "|(?:\\-Xincgc)");
+            + "|(?:\\-Xconcgc)");
     public static List<String> removeGcOpts(List<String> opts) {
         List<String> optsWithoutGC = new ArrayList<String>();
         for (String opt : opts) {

From 49b224a4f7540fc1f9a308646c4b88ca98ef26df Mon Sep 17 00:00:00 2001
From: Zoltan Majo <zmajo@openjdk.org>
Date: Thu, 6 Nov 2014 09:40:58 +0100
Subject: [PATCH 039/299] 8057622:
 java/util/stream/test/org/openjdk/tests/java/util/stream/InfiniteStreamWithLimitOpTest:
 SEGV inside compiled code (sparc)

In Parse::array_store_check(), add control edge FROM IfTrue branch of runtime type check of the destination array TO loading _element_klass from destination array.

Reviewed-by: kvn, roland, anoll
---
 hotspot/src/share/vm/opto/doCall.cpp         |  4 +-
 hotspot/src/share/vm/opto/graphKit.cpp       |  4 +-
 hotspot/src/share/vm/opto/library_call.cpp   |  6 +--
 hotspot/src/share/vm/opto/macro.cpp          |  2 +-
 hotspot/src/share/vm/opto/macroArrayCopy.cpp |  2 +-
 hotspot/src/share/vm/opto/memnode.cpp        | 16 +++++--
 hotspot/src/share/vm/opto/memnode.hpp        | 14 ++++--
 hotspot/src/share/vm/opto/parse1.cpp         |  2 +-
 hotspot/src/share/vm/opto/parseHelper.cpp    | 45 +++++++++++++++-----
 9 files changed, 69 insertions(+), 26 deletions(-)

diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp
index 813d9450fc3..9cf6bc4dfe8 100644
--- a/hotspot/src/share/vm/opto/doCall.cpp
+++ b/hotspot/src/share/vm/opto/doCall.cpp
@@ -794,7 +794,7 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
   Node* ex_klass_node = NULL;
   if (has_ex_handler() && !ex_type->klass_is_exact()) {
     Node* p = basic_plus_adr( ex_node, ex_node, oopDesc::klass_offset_in_bytes());
-    ex_klass_node = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) );
+    ex_klass_node = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT));
 
     // Compute the exception klass a little more cleverly.
     // Obvious solution is to simple do a LoadKlass from the 'ex_node'.
@@ -812,7 +812,7 @@ void Parse::catch_inline_exceptions(SafePointNode* ex_map) {
           continue;
         }
         Node* p = basic_plus_adr(ex_in, ex_in, oopDesc::klass_offset_in_bytes());
-        Node* k = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT) );
+        Node* k = _gvn.transform( LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeInstPtr::KLASS, TypeKlassPtr::OBJECT));
         ex_klass_node->init_req( i, k );
       }
       _gvn.set_type(ex_klass_node, TypeKlassPtr::OBJECT);
diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp
index 931f1d9cbb2..eee548e219e 100644
--- a/hotspot/src/share/vm/opto/graphKit.cpp
+++ b/hotspot/src/share/vm/opto/graphKit.cpp
@@ -1154,7 +1154,7 @@ Node* GraphKit::load_object_klass(Node* obj) {
   Node* akls = AllocateNode::Ideal_klass(obj, &_gvn);
   if (akls != NULL)  return akls;
   Node* k_adr = basic_plus_adr(obj, oopDesc::klass_offset_in_bytes());
-  return _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), k_adr, TypeInstPtr::KLASS) );
+  return _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), k_adr, TypeInstPtr::KLASS));
 }
 
 //-------------------------load_array_length-----------------------------------
@@ -2615,7 +2615,7 @@ Node* Phase::gen_subtype_check(Node* subklass, Node* superklass, Node** ctrl, Me
   // types load from the super-class display table which is immutable.
   m = mem->memory_at(C->get_alias_index(gvn->type(p2)->is_ptr()));
   Node *kmem = might_be_cache ? m : C->immutable_memory();
-  Node *nkls = gvn->transform(LoadKlassNode::make(*gvn, kmem, p2, gvn->type(p2)->is_ptr(), TypeKlassPtr::OBJECT_OR_NULL));
+  Node *nkls = gvn->transform(LoadKlassNode::make(*gvn, NULL, kmem, p2, gvn->type(p2)->is_ptr(), TypeKlassPtr::OBJECT_OR_NULL));
 
   // Compile speed common case: ARE a subtype and we canNOT fail
   if( superklass == nkls )
diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp
index 10c857ca0dd..aad0a78cb64 100644
--- a/hotspot/src/share/vm/opto/library_call.cpp
+++ b/hotspot/src/share/vm/opto/library_call.cpp
@@ -3345,7 +3345,7 @@ Node* LibraryCallKit::load_klass_from_mirror_common(Node* mirror,
   if (region == NULL)  never_see_null = true;
   Node* p = basic_plus_adr(mirror, offset);
   const TypeKlassPtr*  kls_type = TypeKlassPtr::OBJECT_OR_NULL;
-  Node* kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, kls_type));
+  Node* kls = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeRawPtr::BOTTOM, kls_type));
   Node* null_ctl = top();
   kls = null_check_oop(kls, &null_ctl, never_see_null);
   if (region != NULL) {
@@ -3517,7 +3517,7 @@ bool LibraryCallKit::inline_native_Class_query(vmIntrinsics::ID id) {
       phi->add_req(makecon(TypeInstPtr::make(env()->Object_klass()->java_mirror())));
     // If we fall through, it's a plain class.  Get its _super.
     p = basic_plus_adr(kls, in_bytes(Klass::super_offset()));
-    kls = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL));
+    kls = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeRawPtr::BOTTOM, TypeKlassPtr::OBJECT_OR_NULL));
     null_ctl = top();
     kls = null_check_oop(kls, &null_ctl);
     if (null_ctl != top()) {
@@ -3671,7 +3671,7 @@ bool LibraryCallKit::inline_native_subtype_check() {
     args[which_arg] = arg;
 
     Node* p = basic_plus_adr(arg, class_klass_offset);
-    Node* kls = LoadKlassNode::make(_gvn, immutable_memory(), p, adr_type, kls_type);
+    Node* kls = LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, adr_type, kls_type);
     klasses[which_arg] = _gvn.transform(kls);
   }
 
diff --git a/hotspot/src/share/vm/opto/macro.cpp b/hotspot/src/share/vm/opto/macro.cpp
index 40cc26aa0d1..b8d9c815cd3 100644
--- a/hotspot/src/share/vm/opto/macro.cpp
+++ b/hotspot/src/share/vm/opto/macro.cpp
@@ -2202,7 +2202,7 @@ void PhaseMacroExpand::expand_lock_node(LockNode *lock) {
     Node* klass_node = AllocateNode::Ideal_klass(obj, &_igvn);
     if (klass_node == NULL) {
       Node* k_adr = basic_plus_adr(obj, oopDesc::klass_offset_in_bytes());
-      klass_node = transform_later( LoadKlassNode::make(_igvn, mem, k_adr, _igvn.type(k_adr)->is_ptr()) );
+      klass_node = transform_later(LoadKlassNode::make(_igvn, NULL, mem, k_adr, _igvn.type(k_adr)->is_ptr()));
 #ifdef _LP64
       if (UseCompressedClassPointers && klass_node->is_DecodeNKlass()) {
         assert(klass_node->in(1)->Opcode() == Op_LoadNKlass, "sanity");
diff --git a/hotspot/src/share/vm/opto/macroArrayCopy.cpp b/hotspot/src/share/vm/opto/macroArrayCopy.cpp
index 8b8a177d20c..438ee0e67fa 100644
--- a/hotspot/src/share/vm/opto/macroArrayCopy.cpp
+++ b/hotspot/src/share/vm/opto/macroArrayCopy.cpp
@@ -529,7 +529,7 @@ Node* PhaseMacroExpand::generate_arraycopy(ArrayCopyNode *ac, AllocateArrayNode*
       // (At this point we can assume disjoint_bases, since types differ.)
       int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset());
       Node* p1 = basic_plus_adr(dest_klass, ek_offset);
-      Node* n1 = LoadKlassNode::make(_igvn, C->immutable_memory(), p1, TypeRawPtr::BOTTOM);
+      Node* n1 = LoadKlassNode::make(_igvn, NULL, C->immutable_memory(), p1, TypeRawPtr::BOTTOM);
       Node* dest_elem_klass = transform_later(n1);
       Node* cv = generate_checkcast_arraycopy(&local_ctrl, &local_mem,
                                               adr_type,
diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp
index 8ed5154f7be..1be984c4e74 100644
--- a/hotspot/src/share/vm/opto/memnode.cpp
+++ b/hotspot/src/share/vm/opto/memnode.cpp
@@ -861,6 +861,10 @@ Node *MemNode::Ideal_common_DU_postCCP( PhaseCCP *ccp, Node* n, Node* adr ) {
 
 
 //=============================================================================
+// Should LoadNode::Ideal() attempt to remove control edges?
+bool LoadNode::can_remove_control() const {
+  return true;
+}
 uint LoadNode::size_of() const { return sizeof(*this); }
 uint LoadNode::cmp( const Node &n ) const
 { return !Type::cmp( _type, ((LoadNode&)n)._type ); }
@@ -1471,7 +1475,7 @@ Node *LoadNode::split_through_phi(PhaseGVN *phase) {
 }
 
 //------------------------------Ideal------------------------------------------
-// If the load is from Field memory and the pointer is non-null, we can
+// If the load is from Field memory and the pointer is non-null, it might be possible to
 // zero out the control input.
 // If the offset is constant and the base is an object allocation,
 // try to hook me up to the exact initializing store.
@@ -1498,6 +1502,7 @@ Node *LoadNode::Ideal(PhaseGVN *phase, bool can_reshape) {
       && phase->C->get_alias_index(phase->type(address)->is_ptr()) != Compile::AliasIdxRaw) {
     // Check for useless control edge in some common special cases
     if (in(MemNode::Control) != NULL
+        && can_remove_control()
         && phase->type(base)->higher_equal(TypePtr::NOTNULL)
         && all_controls_dominate(base, phase->C->start())) {
       // A method-invariant, non-null address (constant or 'this' argument).
@@ -2019,8 +2024,7 @@ const Type* LoadSNode::Value(PhaseTransform *phase) const {
 //=============================================================================
 //----------------------------LoadKlassNode::make------------------------------
 // Polymorphic factory method:
-Node *LoadKlassNode::make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* at, const TypeKlassPtr *tk ) {
-  Node *ctl = NULL;
+Node* LoadKlassNode::make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* at, const TypeKlassPtr* tk) {
   // sanity check the alias category against the created node type
   const TypePtr *adr_type = adr->bottom_type()->isa_ptr();
   assert(adr_type != NULL, "expecting TypeKlassPtr");
@@ -2040,6 +2044,12 @@ const Type *LoadKlassNode::Value( PhaseTransform *phase ) const {
   return klass_value_common(phase);
 }
 
+// In most cases, LoadKlassNode does not have the control input set. If the control
+// input is set, it must not be removed (by LoadNode::Ideal()).
+bool LoadKlassNode::can_remove_control() const {
+  return false;
+}
+
 const Type *LoadNode::klass_value_common( PhaseTransform *phase ) const {
   // Either input is TOP ==> the result is TOP
   const Type *t1 = phase->type( in(MemNode::Memory) );
diff --git a/hotspot/src/share/vm/opto/memnode.hpp b/hotspot/src/share/vm/opto/memnode.hpp
index 4a7064ad6d6..cbdd689fe8b 100644
--- a/hotspot/src/share/vm/opto/memnode.hpp
+++ b/hotspot/src/share/vm/opto/memnode.hpp
@@ -148,6 +148,8 @@ private:
 protected:
   virtual uint cmp(const Node &n) const;
   virtual uint size_of() const; // Size is bigger
+  // Should LoadNode::Ideal() attempt to remove control edges?
+  virtual bool can_remove_control() const;
   const Type* const _type;      // What kind of value is loaded?
 public:
 
@@ -171,8 +173,10 @@ public:
   // we are equivalent to.  We look for Load of a Store.
   virtual Node *Identity( PhaseTransform *phase );
 
-  // If the load is from Field memory and the pointer is non-null, we can
+  // If the load is from Field memory and the pointer is non-null, it might be possible to
   // zero out the control input.
+  // If the offset is constant and the base is an object allocation,
+  // try to hook me up to the exact initializing store.
   virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
 
   // Split instance field load through Phi.
@@ -431,6 +435,10 @@ public:
 //------------------------------LoadKlassNode----------------------------------
 // Load a Klass from an object
 class LoadKlassNode : public LoadPNode {
+protected:
+  // In most cases, LoadKlassNode does not have the control input set. If the control
+  // input is set, it must not be removed (by LoadNode::Ideal()).
+  virtual bool can_remove_control() const;
 public:
   LoadKlassNode(Node *c, Node *mem, Node *adr, const TypePtr *at, const TypeKlassPtr *tk, MemOrd mo)
     : LoadPNode(c, mem, adr, at, tk, mo) {}
@@ -440,8 +448,8 @@ public:
   virtual bool depends_only_on_test() const { return true; }
 
   // Polymorphic factory method:
-  static Node* make( PhaseGVN& gvn, Node *mem, Node *adr, const TypePtr* at,
-                     const TypeKlassPtr *tk = TypeKlassPtr::OBJECT );
+  static Node* make(PhaseGVN& gvn, Node* ctl, Node* mem, Node* adr, const TypePtr* at,
+                    const TypeKlassPtr* tk = TypeKlassPtr::OBJECT);
 };
 
 //------------------------------LoadNKlassNode---------------------------------
diff --git a/hotspot/src/share/vm/opto/parse1.cpp b/hotspot/src/share/vm/opto/parse1.cpp
index f4d331ba83f..4508c3848c7 100644
--- a/hotspot/src/share/vm/opto/parse1.cpp
+++ b/hotspot/src/share/vm/opto/parse1.cpp
@@ -1987,7 +1987,7 @@ void Parse::call_register_finalizer() {
   // finalization.  In general this will fold up since the concrete
   // class is often visible so the access flags are constant.
   Node* klass_addr = basic_plus_adr( receiver, receiver, oopDesc::klass_offset_in_bytes() );
-  Node* klass = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), klass_addr, TypeInstPtr::KLASS) );
+  Node* klass = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), klass_addr, TypeInstPtr::KLASS));
 
   Node* access_flags_addr = basic_plus_adr(klass, klass, in_bytes(Klass::access_flags_offset()));
   Node* access_flags = make_load(NULL, access_flags_addr, TypeInt::INT, T_INT, MemNode::unordered);
diff --git a/hotspot/src/share/vm/opto/parseHelper.cpp b/hotspot/src/share/vm/opto/parseHelper.cpp
index a71fb8f7752..43a42bbd7a7 100644
--- a/hotspot/src/share/vm/opto/parseHelper.cpp
+++ b/hotspot/src/share/vm/opto/parseHelper.cpp
@@ -156,22 +156,43 @@ void Parse::array_store_check() {
   int klass_offset = oopDesc::klass_offset_in_bytes();
   Node* p = basic_plus_adr( ary, ary, klass_offset );
   // p's type is array-of-OOPS plus klass_offset
-  Node* array_klass = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p, TypeInstPtr::KLASS) );
+  Node* array_klass = _gvn.transform(LoadKlassNode::make(_gvn, NULL, immutable_memory(), p, TypeInstPtr::KLASS));
   // Get the array klass
   const TypeKlassPtr *tak = _gvn.type(array_klass)->is_klassptr();
 
-  // array_klass's type is generally INexact array-of-oop.  Heroically
-  // cast the array klass to EXACT array and uncommon-trap if the cast
-  // fails.
+  // The type of array_klass is usually INexact array-of-oop.  Heroically
+  // cast array_klass to EXACT array and uncommon-trap if the cast fails.
+  // Make constant out of the inexact array klass, but use it only if the cast
+  // succeeds.
   bool always_see_exact_class = false;
   if (MonomorphicArrayCheck
-      && !too_many_traps(Deoptimization::Reason_array_check)) {
+      && !too_many_traps(Deoptimization::Reason_array_check)
+      && !tak->klass_is_exact()
+      && tak != TypeKlassPtr::OBJECT) {
+      // Regarding the fourth condition in the if-statement from above:
+      //
+      // If the compiler has determined that the type of array 'ary' (represented
+      // by 'array_klass') is java/lang/Object, the compiler must not assume that
+      // the array 'ary' is monomorphic.
+      //
+      // If 'ary' were of type java/lang/Object, this arraystore would have to fail,
+      // because it is not possible to perform a arraystore into an object that is not
+      // a "proper" array.
+      //
+      // Therefore, let's obtain at runtime the type of 'ary' and check if we can still
+      // successfully perform the store.
+      //
+      // The implementation reasons for the condition are the following:
+      //
+      // java/lang/Object is the superclass of all arrays, but it is represented by the VM
+      // as an InstanceKlass. The checks generated by gen_checkcast() (see below) expect
+      // 'array_klass' to be ObjArrayKlass, which can result in invalid memory accesses.
+      //
+      // See issue JDK-8057622 for details.
+
     always_see_exact_class = true;
     // (If no MDO at all, hope for the best, until a trap actually occurs.)
-  }
 
-  // Is the array klass is exactly its defined type?
-  if (always_see_exact_class && !tak->klass_is_exact()) {
     // Make a constant out of the inexact array klass
     const TypeKlassPtr *extak = tak->cast_to_exactness(true)->is_klassptr();
     Node* con = makecon(extak);
@@ -202,11 +223,15 @@ void Parse::array_store_check() {
   // Extract the array element class
   int element_klass_offset = in_bytes(ObjArrayKlass::element_klass_offset());
   Node *p2 = basic_plus_adr(array_klass, array_klass, element_klass_offset);
-  Node *a_e_klass = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), p2, tak) );
+  // We are allowed to use the constant type only if cast succeeded. If always_see_exact_class is true,
+  // we must set a control edge from the IfTrue node created by the uncommon_trap above to the
+  // LoadKlassNode.
+  Node* a_e_klass = _gvn.transform(LoadKlassNode::make(_gvn, always_see_exact_class ? control() : NULL,
+                                                       immutable_memory(), p2, tak));
 
   // Check (the hard way) and throw if not a subklass.
   // Result is ignored, we just need the CFG effects.
-  gen_checkcast( obj, a_e_klass );
+  gen_checkcast(obj, a_e_klass);
 }
 
 

From d4fc9133aba29f0c3262cb16d0c6bbb7113ea25a Mon Sep 17 00:00:00 2001
From: Martin Doerr <mdoerr@openjdk.org>
Date: Wed, 5 Nov 2014 16:28:11 +0100
Subject: [PATCH 040/299] 8062950: Bug in locking code when UseOptoBiasInlining
 is disabled: assert(dmw->is_neutral()) failed: invariant

Reviewed-by: dholmes, kvn
---
 hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
index 592b45c9fd0..5857a935006 100644
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
@@ -1769,7 +1769,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
     // at [FETCH], below, will never observe a biased encoding (*101b).
     // If this invariant is not held we risk exclusion (safety) failure.
     if (UseBiasedLocking && !UseOptoBiasInlining) {
-      biased_locking_enter(boxReg, objReg, tmpReg, scrReg, true, DONE_LABEL, NULL, counters);
+      biased_locking_enter(boxReg, objReg, tmpReg, scrReg, false, DONE_LABEL, NULL, counters);
     }
 
 #if INCLUDE_RTM_OPT

From 2476a824bd30be50e9ac15fb28b769475419e137 Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov <serb@openjdk.org>
Date: Wed, 5 Nov 2014 18:33:28 +0300
Subject: [PATCH 041/299] 7195187: [TEST_BUG] [macosx]
 javax/swing/SwingUtilities/7088744/bug7088744.java failed

Reviewed-by: azvegint, alexsch
---
 .../SwingUtilities/7088744/bug7088744.java    | 43 ++++++++++---------
 1 file changed, 23 insertions(+), 20 deletions(-)

diff --git a/jdk/test/javax/swing/SwingUtilities/7088744/bug7088744.java b/jdk/test/javax/swing/SwingUtilities/7088744/bug7088744.java
index 9d2962c8f36..b4ed0351546 100644
--- a/jdk/test/javax/swing/SwingUtilities/7088744/bug7088744.java
+++ b/jdk/test/javax/swing/SwingUtilities/7088744/bug7088744.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,18 +27,24 @@
    @author Pavel Porvatov
 */
 
-import sun.awt.SunToolkit;
-
-import javax.swing.*;
-import java.awt.*;
+import java.awt.Component;
+import java.awt.Event;
+import java.awt.Point;
+import java.awt.Robot;
 import java.awt.event.InputEvent;
 import java.awt.event.MouseAdapter;
 import java.awt.event.MouseEvent;
 
-public class bug7088744 {
-    private static volatile JLabel label;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+import javax.swing.SwingUtilities;
 
-    private static volatile Point point;
+public class bug7088744 {
+
+    private static volatile JLabel label;
+    private static volatile JFrame frame;
+
+    private static volatile Point point = new Point();
 
     private static final int MOUSE_CLICKED = 1;
     private static final int MOUSE_PRESSED = 2;
@@ -117,7 +123,7 @@ public class bug7088744 {
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
-                JFrame frame = new JFrame();
+                frame = new JFrame();
 
                 label = new JLabel("A label");
 
@@ -137,26 +143,24 @@ public class bug7088744 {
                 frame.add(label);
                 frame.setSize(200, 100);
                 frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+                frame.setLocationRelativeTo(null);
                 frame.setVisible(true);
             }
         });
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-
-        toolkit.realSync();
-
-        // On Linux platforms realSync doesn't guaranties setSize completion
-        Thread.sleep(1000);
+        Robot robot = new Robot();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
-                point = label.getLocationOnScreen();
+                Point pt = label.getLocationOnScreen();
+                point.x = pt.x + label.getWidth() / 2;
+                point.y = pt.y + label.getHeight() / 2;
             }
         });
 
-        Robot robot = new Robot();
-
         robot.setAutoDelay(100);
+        robot.setAutoWaitForIdle(true);
         robot.mouseMove(point.x, point.y);
         robot.mousePress(InputEvent.BUTTON1_MASK);
         robot.mousePress(InputEvent.BUTTON2_MASK);
@@ -165,10 +169,9 @@ public class bug7088744 {
         robot.mouseRelease(InputEvent.BUTTON2_MASK);
         robot.mouseRelease(InputEvent.BUTTON3_MASK);
 
-        toolkit.realSync();
-
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
+                frame.dispose();
                 if (eventCount != BUTTON_EVENTS_SEQUENCE.length) {
                     throw new RuntimeException("Not all events received");
                 }

From d7ec650456aeac5aa18a544f1b978a6fb50a15a3 Mon Sep 17 00:00:00 2001
From: "Daniel D. Daugherty" <dcubed@openjdk.org>
Date: Thu, 6 Nov 2014 13:05:14 -0800
Subject: [PATCH 042/299] 8062851: cleanup ObjectMonitor offset adjustments

JEP-143/JDK-8046133 - cleanup computation of ObjectMonitor field pointers

Reviewed-by: dholmes, redestad, coleenp
---
 .../src/cpu/sparc/vm/macroAssembler_sparc.cpp |  32 +++---
 hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp | 102 ++++++++----------
 .../src/share/vm/runtime/objectMonitor.hpp    |  14 +++
 3 files changed, 72 insertions(+), 76 deletions(-)

diff --git a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
index 79ca56aecd3..3d23336c5cf 100644
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.cpp
@@ -2734,12 +2734,12 @@ void MacroAssembler::biased_locking_exit (Address mark_addr, Register temp_reg,
 // box->dhw disposition - post-conditions at DONE_LABEL.
 // -   Successful inflated lock:  box->dhw != 0.
 //     Any non-zero value suffices.
-//     Consider G2_thread, rsp, boxReg, or unused_mark()
+//     Consider G2_thread, rsp, boxReg, or markOopDesc::unused_mark()
 // -   Successful Stack-lock: box->dhw == mark.
 //     box->dhw must contain the displaced mark word value
 // -   Failure -- icc.ZFlag == 0 and box->dhw is undefined.
 //     The slow-path fast_enter() and slow_enter() operators
-//     are responsible for setting box->dhw = NonZero (typically ::unused_mark).
+//     are responsible for setting box->dhw = NonZero (typically markOopDesc::unused_mark()).
 // -   Biased: box->dhw is undefined
 //
 // SPARC refworkload performance - specifically jetstream and scimark - are
@@ -2855,7 +2855,7 @@ void MacroAssembler::compiler_lock_object(Register Roop, Register Rmark,
          // If m->owner != null goto IsLocked
          // Pessimistic form: Test-and-CAS vs CAS
          // The optimistic form avoids RTS->RTO cache line upgrades.
-         ld_ptr(Rmark, ObjectMonitor::owner_offset_in_bytes() - 2, Rscratch);
+         ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rscratch);
          andcc(Rscratch, Rscratch, G0);
          brx(Assembler::notZero, false, Assembler::pn, done);
          delayed()->nop();
@@ -2864,7 +2864,7 @@ void MacroAssembler::compiler_lock_object(Register Roop, Register Rmark,
 
       // Try to CAS m->owner from null to Self
       // Invariant: if we acquire the lock then _recursions should be 0.
-      add(Rmark, ObjectMonitor::owner_offset_in_bytes()-2, Rmark);
+      add(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rmark);
       mov(G2_thread, Rscratch);
       cas_ptr(Rmark, G0, Rscratch);
       cmp(Rscratch, G0);
@@ -2948,7 +2948,7 @@ void MacroAssembler::compiler_lock_object(Register Roop, Register Rmark,
          // Test-and-CAS vs CAS
          // Pessimistic form avoids futile (doomed) CAS attempts
          // The optimistic form avoids RTS->RTO cache line upgrades.
-         ld_ptr(Rmark, ObjectMonitor::owner_offset_in_bytes() - 2, Rscratch);
+         ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rscratch);
          andcc(Rscratch, Rscratch, G0);
          brx(Assembler::notZero, false, Assembler::pn, done);
          delayed()->nop();
@@ -2957,13 +2957,13 @@ void MacroAssembler::compiler_lock_object(Register Roop, Register Rmark,
 
       // Try to CAS m->owner from null to Self
       // Invariant: if we acquire the lock then _recursions should be 0.
-      add(Rmark, ObjectMonitor::owner_offset_in_bytes()-2, Rmark);
+      add(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rmark);
       mov(G2_thread, Rscratch);
       cas_ptr(Rmark, G0, Rscratch);
       cmp(Rscratch, G0);
       // ST box->displaced_header = NonZero.
       // Any non-zero value suffices:
-      //    unused_mark(), G2_thread, RBox, RScratch, rsp, etc.
+      //    markOopDesc::unused_mark(), G2_thread, RBox, RScratch, rsp, etc.
       st_ptr(Rbox, Rbox, BasicLock::displaced_header_offset_in_bytes());
       // Intentional fall-through into done
    }
@@ -3031,30 +3031,30 @@ void MacroAssembler::compiler_unlock_object(Register Roop, Register Rmark,
    // Note that we use 1-0 locking by default for the inflated case.  We
    // close the resultant (and rare) race by having contented threads in
    // monitorenter periodically poll _owner.
-   ld_ptr(Rmark, ObjectMonitor::owner_offset_in_bytes() - 2, Rscratch);
-   ld_ptr(Rmark, ObjectMonitor::recursions_offset_in_bytes() - 2, Rbox);
+   ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rscratch);
+   ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions), Rbox);
    xor3(Rscratch, G2_thread, Rscratch);
    orcc(Rbox, Rscratch, Rbox);
    brx(Assembler::notZero, false, Assembler::pn, done);
    delayed()->
-   ld_ptr(Rmark, ObjectMonitor::EntryList_offset_in_bytes() - 2, Rscratch);
-   ld_ptr(Rmark, ObjectMonitor::cxq_offset_in_bytes() - 2, Rbox);
+   ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(EntryList), Rscratch);
+   ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(cxq), Rbox);
    orcc(Rbox, Rscratch, G0);
    if (EmitSync & 65536) {
       Label LSucc ;
       brx(Assembler::notZero, false, Assembler::pn, LSucc);
       delayed()->nop();
       ba(done);
-      delayed()->st_ptr(G0, Rmark, ObjectMonitor::owner_offset_in_bytes() - 2);
+      delayed()->st_ptr(G0, Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner));
 
       bind(LSucc);
-      st_ptr(G0, Rmark, ObjectMonitor::owner_offset_in_bytes() - 2);
+      st_ptr(G0, Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner));
       if (os::is_MP()) { membar (StoreLoad); }
-      ld_ptr(Rmark, ObjectMonitor::succ_offset_in_bytes() - 2, Rscratch);
+      ld_ptr(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ), Rscratch);
       andcc(Rscratch, Rscratch, G0);
       brx(Assembler::notZero, false, Assembler::pt, done);
       delayed()->andcc(G0, G0, G0);
-      add(Rmark, ObjectMonitor::owner_offset_in_bytes()-2, Rmark);
+      add(Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner), Rmark);
       mov(G2_thread, Rscratch);
       cas_ptr(Rmark, G0, Rscratch);
       // invert icc.zf and goto done
@@ -3066,7 +3066,7 @@ void MacroAssembler::compiler_unlock_object(Register Roop, Register Rmark,
       brx(Assembler::notZero, false, Assembler::pn, done);
       delayed()->nop();
       ba(done);
-      delayed()->st_ptr(G0, Rmark, ObjectMonitor::owner_offset_in_bytes() - 2);
+      delayed()->st_ptr(G0, Rmark, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner));
    }
 
    bind   (LStacked);
diff --git a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
index 592b45c9fd0..a42fe8f6ff8 100644
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.cpp
@@ -1450,8 +1450,7 @@ void MacroAssembler::rtm_retry_lock_on_abort(Register retry_count_Reg, Register
 void MacroAssembler::rtm_retry_lock_on_busy(Register retry_count_Reg, Register box_Reg,
                                             Register tmp_Reg, Register scr_Reg, Label& retryLabel) {
   Label SpinLoop, SpinExit, doneRetry;
-  // Clean monitor_value bit to get valid pointer
-  int owner_offset = ObjectMonitor::owner_offset_in_bytes() - markOopDesc::monitor_value;
+  int owner_offset = OM_OFFSET_NO_MONITOR_VALUE_TAG(owner);
 
   testl(retry_count_Reg, retry_count_Reg);
   jccb(Assembler::zero, doneRetry);
@@ -1532,7 +1531,7 @@ void MacroAssembler::rtm_stack_locking(Register objReg, Register tmpReg, Registe
 // Use RTM for inflating locks
 // inputs: objReg (object to lock)
 //         boxReg (on-stack box address (displaced header location) - KILLED)
-//         tmpReg (ObjectMonitor address + 2(monitor_value))
+//         tmpReg (ObjectMonitor address + markOopDesc::monitor_value)
 void MacroAssembler::rtm_inflated_locking(Register objReg, Register boxReg, Register tmpReg,
                                           Register scrReg, Register retry_on_busy_count_Reg,
                                           Register retry_on_abort_count_Reg,
@@ -1543,8 +1542,7 @@ void MacroAssembler::rtm_inflated_locking(Register objReg, Register boxReg, Regi
   assert(tmpReg == rax, "");
   assert(scrReg == rdx, "");
   Label L_rtm_retry, L_decrement_retry, L_on_abort;
-  // Clean monitor_value bit to get valid pointer
-  int owner_offset = ObjectMonitor::owner_offset_in_bytes() - markOopDesc::monitor_value;
+  int owner_offset = OM_OFFSET_NO_MONITOR_VALUE_TAG(owner);
 
   // Without cast to int32_t a movptr will destroy r10 which is typically obj
   movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark()));
@@ -1716,7 +1714,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
     atomic_incl(ExternalAddress((address)counters->total_entry_count_addr()), scrReg);
   }
   if (EmitSync & 1) {
-      // set box->dhw = unused_mark (3)
+      // set box->dhw = markOopDesc::unused_mark()
       // Force all sync thru slow-path: slow_enter() and slow_exit()
       movptr (Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark()));
       cmpptr (rsp, (int32_t)NULL_WORD);
@@ -1811,7 +1809,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
     jmp(DONE_LABEL);
 
     bind(IsInflated);
-    // The object is inflated. tmpReg contains pointer to ObjectMonitor* + 2(monitor_value)
+    // The object is inflated. tmpReg contains pointer to ObjectMonitor* + markOopDesc::monitor_value
 
 #if INCLUDE_RTM_OPT
     // Use the same RTM locking code in 32- and 64-bit VM.
@@ -1823,25 +1821,10 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
 
 #ifndef _LP64
     // The object is inflated.
-    //
-    // TODO-FIXME: eliminate the ugly use of manifest constants:
-    //   Use markOopDesc::monitor_value instead of "2".
-    //   use markOop::unused_mark() instead of "3".
-    // The tmpReg value is an objectMonitor reference ORed with
-    // markOopDesc::monitor_value (2).   We can either convert tmpReg to an
-    // objectmonitor pointer by masking off the "2" bit or we can just
-    // use tmpReg as an objectmonitor pointer but bias the objectmonitor
-    // field offsets with "-2" to compensate for and annul the low-order tag bit.
-    //
-    // I use the latter as it avoids AGI stalls.
-    // As such, we write "mov r, [tmpReg+OFFSETOF(Owner)-2]"
-    // instead of "mov r, [tmpReg+OFFSETOF(Owner)]".
-    //
-    #define OFFSET_SKEWED(f) ((ObjectMonitor::f ## _offset_in_bytes())-2)
 
     // boxReg refers to the on-stack BasicLock in the current frame.
     // We'd like to write:
-    //   set box->_displaced_header = markOop::unused_mark().  Any non-0 value suffices.
+    //   set box->_displaced_header = markOopDesc::unused_mark().  Any non-0 value suffices.
     // This is convenient but results a ST-before-CAS penalty.  The following CAS suffers
     // additional latency as we have another ST in the store buffer that must drain.
 
@@ -1853,7 +1836,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
        if (os::is_MP()) {
          lock();
        }
-       cmpxchgptr(scrReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2));
+       cmpxchgptr(scrReg, Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
     } else
     if ((EmitSync & 128) == 0) {                      // avoid ST-before-CAS
        movptr(scrReg, boxReg);
@@ -1862,7 +1845,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
        // Using a prefetchw helps avoid later RTS->RTO upgrades and cache probes
        if ((EmitSync & 2048) && VM_Version::supports_3dnow_prefetch() && os::is_MP()) {
           // prefetchw [eax + Offset(_owner)-2]
-          prefetchw(Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
+          prefetchw(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
        }
 
        if ((EmitSync & 64) == 0) {
@@ -1871,7 +1854,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
        } else {
          // Can suffer RTS->RTO upgrades on shared or cold $ lines
          // Test-And-CAS instead of CAS
-         movptr(tmpReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));   // rax, = m->_owner
+         movptr(tmpReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));   // rax, = m->_owner
          testptr(tmpReg, tmpReg);                   // Locked ?
          jccb  (Assembler::notZero, DONE_LABEL);
        }
@@ -1887,11 +1870,11 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
        if (os::is_MP()) {
          lock();
        }
-       cmpxchgptr(scrReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2));
+       cmpxchgptr(scrReg, Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
        movptr(Address(scrReg, 0), 3);          // box->_displaced_header = 3
        jccb  (Assembler::notZero, DONE_LABEL);
        get_thread (scrReg);                    // beware: clobbers ICCs
-       movptr(Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2), scrReg);
+       movptr(Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), scrReg);
        xorptr(boxReg, boxReg);                 // set icc.ZFlag = 1 to indicate success
 
        // If the CAS fails we can either retry or pass control to the slow-path.
@@ -1908,7 +1891,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
        // Using a prefetchw helps avoid later RTS->RTO upgrades and cache probes
        if ((EmitSync & 2048) && VM_Version::supports_3dnow_prefetch() && os::is_MP()) {
           // prefetchw [eax + Offset(_owner)-2]
-          prefetchw(Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
+          prefetchw(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
        }
 
        if ((EmitSync & 64) == 0) {
@@ -1916,7 +1899,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
          xorptr  (tmpReg, tmpReg);
        } else {
          // Can suffer RTS->RTO upgrades on shared or cold $ lines
-         movptr(tmpReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));   // rax, = m->_owner
+         movptr(tmpReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));   // rax, = m->_owner
          testptr(tmpReg, tmpReg);                   // Locked ?
          jccb  (Assembler::notZero, DONE_LABEL);
        }
@@ -1928,7 +1911,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
        if (os::is_MP()) {
          lock();
        }
-       cmpxchgptr(scrReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2));
+       cmpxchgptr(scrReg, Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
 
        // If the CAS fails we can either retry or pass control to the slow-path.
        // We use the latter tactic.
@@ -1951,7 +1934,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
     movptr(Address(boxReg, 0), (int32_t)intptr_t(markOopDesc::unused_mark()));
 
     movptr (boxReg, tmpReg);
-    movptr (tmpReg, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2));
+    movptr(tmpReg, Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
     testptr(tmpReg, tmpReg);
     jccb   (Assembler::notZero, DONE_LABEL);
 
@@ -1959,7 +1942,7 @@ void MacroAssembler::fast_lock(Register objReg, Register boxReg, Register tmpReg
     if (os::is_MP()) {
       lock();
     }
-    cmpxchgptr(r15_thread, Address(boxReg, ObjectMonitor::owner_offset_in_bytes()-2));
+    cmpxchgptr(r15_thread, Address(boxReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
     // Intentional fall-through into DONE_LABEL ...
 #endif // _LP64
 
@@ -2065,8 +2048,7 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
 #if INCLUDE_RTM_OPT
     if (use_rtm) {
       Label L_regular_inflated_unlock;
-      // Clean monitor_value bit to get valid pointer
-      int owner_offset = ObjectMonitor::owner_offset_in_bytes() - markOopDesc::monitor_value;
+      int owner_offset = OM_OFFSET_NO_MONITOR_VALUE_TAG(owner);
       movptr(boxReg, Address(tmpReg, owner_offset));
       testptr(boxReg, boxReg);
       jccb(Assembler::notZero, L_regular_inflated_unlock);
@@ -2102,7 +2084,7 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
     get_thread (boxReg);
     if ((EmitSync & 4096) && VM_Version::supports_3dnow_prefetch() && os::is_MP()) {
       // prefetchw [ebx + Offset(_owner)-2]
-      prefetchw(Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
+      prefetchw(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
     }
 
     // Note that we could employ various encoding schemes to reduce
@@ -2111,21 +2093,21 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
     // In practice the chain of fetches doesn't seem to impact performance, however.
     if ((EmitSync & 65536) == 0 && (EmitSync & 256)) {
        // Attempt to reduce branch density - AMD's branch predictor.
-       xorptr(boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
-       orptr(boxReg, Address (tmpReg, ObjectMonitor::recursions_offset_in_bytes()-2));
-       orptr(boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2));
-       orptr(boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2));
+       xorptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
+       orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions)));
+       orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(EntryList)));
+       orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(cxq)));
        jccb  (Assembler::notZero, DONE_LABEL);
-       movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), NULL_WORD);
+       movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), NULL_WORD);
        jmpb  (DONE_LABEL);
     } else {
-       xorptr(boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
-       orptr(boxReg, Address (tmpReg, ObjectMonitor::recursions_offset_in_bytes()-2));
+       xorptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
+       orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions)));
        jccb  (Assembler::notZero, DONE_LABEL);
-       movptr(boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2));
-       orptr(boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2));
+       movptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(EntryList)));
+       orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(cxq)));
        jccb  (Assembler::notZero, CheckSucc);
-       movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), NULL_WORD);
+       movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), NULL_WORD);
        jmpb  (DONE_LABEL);
     }
 
@@ -2143,7 +2125,7 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
 
        // Optional pre-test ... it's safe to elide this
        if ((EmitSync & 16) == 0) {
-          cmpptr(Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2), (int32_t)NULL_WORD);
+          cmpptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), (int32_t)NULL_WORD);
           jccb  (Assembler::zero, LGoSlowPath);
        }
 
@@ -2173,7 +2155,7 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
        // We currently use (3), although it's likely that switching to (2)
        // is correct for the future.
 
-       movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), NULL_WORD);
+       movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), NULL_WORD);
        if (os::is_MP()) {
           if (VM_Version::supports_sse2() && 1 == FenceInstruction) {
             mfence();
@@ -2182,18 +2164,18 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
           }
        }
        // Ratify _succ remains non-null
-       cmpptr(Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2), 0);
+       cmpptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), 0);
        jccb  (Assembler::notZero, LSuccess);
 
        xorptr(boxReg, boxReg);                  // box is really EAX
        if (os::is_MP()) { lock(); }
-       cmpxchgptr(rsp, Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
+       cmpxchgptr(rsp, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
        jccb  (Assembler::notEqual, LSuccess);
        // Since we're low on registers we installed rsp as a placeholding in _owner.
        // Now install Self over rsp.  This is safe as we're transitioning from
        // non-null to non=null
        get_thread (boxReg);
-       movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), boxReg);
+       movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), boxReg);
        // Intentional fall-through into LGoSlowPath ...
 
        bind  (LGoSlowPath);
@@ -2228,36 +2210,36 @@ void MacroAssembler::fast_unlock(Register objReg, Register boxReg, Register tmpR
     }
 #else // _LP64
     // It's inflated
-    movptr(boxReg, Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
+    movptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
     xorptr(boxReg, r15_thread);
-    orptr (boxReg, Address (tmpReg, ObjectMonitor::recursions_offset_in_bytes()-2));
+    orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(recursions)));
     jccb  (Assembler::notZero, DONE_LABEL);
-    movptr(boxReg, Address (tmpReg, ObjectMonitor::cxq_offset_in_bytes()-2));
-    orptr (boxReg, Address (tmpReg, ObjectMonitor::EntryList_offset_in_bytes()-2));
+    movptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(cxq)));
+    orptr(boxReg, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(EntryList)));
     jccb  (Assembler::notZero, CheckSucc);
-    movptr(Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), (int32_t)NULL_WORD);
+    movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), (int32_t)NULL_WORD);
     jmpb  (DONE_LABEL);
 
     if ((EmitSync & 65536) == 0) {
       Label LSuccess, LGoSlowPath ;
       bind  (CheckSucc);
-      cmpptr(Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2), (int32_t)NULL_WORD);
+      cmpptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), (int32_t)NULL_WORD);
       jccb  (Assembler::zero, LGoSlowPath);
 
       // I'd much rather use lock:andl m->_owner, 0 as it's faster than the
       // the explicit ST;MEMBAR combination, but masm doesn't currently support
       // "ANDQ M,IMM".  Don't use MFENCE here.  lock:add to TOS, xchg, etc
       // are all faster when the write buffer is populated.
-      movptr (Address (tmpReg, ObjectMonitor::owner_offset_in_bytes()-2), (int32_t)NULL_WORD);
+      movptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)), (int32_t)NULL_WORD);
       if (os::is_MP()) {
          lock (); addl (Address(rsp, 0), 0);
       }
-      cmpptr(Address (tmpReg, ObjectMonitor::succ_offset_in_bytes()-2), (int32_t)NULL_WORD);
+      cmpptr(Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(succ)), (int32_t)NULL_WORD);
       jccb  (Assembler::notZero, LSuccess);
 
       movptr (boxReg, (int32_t)NULL_WORD);                   // box is really EAX
       if (os::is_MP()) { lock(); }
-      cmpxchgptr(r15_thread, Address(tmpReg, ObjectMonitor::owner_offset_in_bytes()-2));
+      cmpxchgptr(r15_thread, Address(tmpReg, OM_OFFSET_NO_MONITOR_VALUE_TAG(owner)));
       jccb  (Assembler::notEqual, LSuccess);
       // Intentional fall-through into slow-path
 
diff --git a/hotspot/src/share/vm/runtime/objectMonitor.hpp b/hotspot/src/share/vm/runtime/objectMonitor.hpp
index c060cc7173b..901462c2005 100644
--- a/hotspot/src/share/vm/runtime/objectMonitor.hpp
+++ b/hotspot/src/share/vm/runtime/objectMonitor.hpp
@@ -228,6 +228,20 @@ class ObjectMonitor {
   static int Responsible_offset_in_bytes() { return offset_of(ObjectMonitor, _Responsible); }
   static int Spinner_offset_in_bytes()     { return offset_of(ObjectMonitor, _Spinner); }
 
+  // ObjectMonitor references can be ORed with markOopDesc::monitor_value
+  // as part of the ObjectMonitor tagging mechanism. When we combine an
+  // ObjectMonitor reference with an offset, we need to remove the tag
+  // value in order to generate the proper address.
+  //
+  // We can either adjust the ObjectMonitor reference and then add the
+  // offset or we can adjust the offset that is added to the ObjectMonitor
+  // reference. The latter avoids an AGI (Address Generation Interlock)
+  // stall so the helper macro adjusts the offset value that is returned
+  // to the ObjectMonitor reference manipulation code:
+  //
+  #define OM_OFFSET_NO_MONITOR_VALUE_TAG(f) \
+    ((ObjectMonitor::f ## _offset_in_bytes()) - markOopDesc::monitor_value)
+
   // Eventually we'll make provisions for multiple callbacks, but
   // now one will suffice.
   static int (*SpinCallbackFunction)(intptr_t, int);

From 7c51cce1adebbcdabe1b77c28539bbea2a8c9c41 Mon Sep 17 00:00:00 2001
From: Martin Buchholz <martin@openjdk.org>
Date: Fri, 14 Nov 2014 11:23:07 -0800
Subject: [PATCH 043/299] 8064846: Lazy-init thread safety problems in core
 reflection

Make several fields in core reflection volatile

Reviewed-by: jfranck, shade, plevart
---
 .../generics/repository/ClassRepository.java  | 22 ++++++++++++-------
 .../repository/GenericDeclRepository.java     | 15 +++++++------
 .../reflect/generics/scope/AbstractScope.java | 10 +++++++--
 3 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/jdk/src/java.base/share/classes/sun/reflect/generics/repository/ClassRepository.java b/jdk/src/java.base/share/classes/sun/reflect/generics/repository/ClassRepository.java
index f60f03346c3..edcdc865889 100644
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/repository/ClassRepository.java
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/repository/ClassRepository.java
@@ -42,8 +42,11 @@ public class ClassRepository extends GenericDeclRepository<ClassSignature> {
 
     public static final ClassRepository NONE = ClassRepository.make("Ljava/lang/Object;", null);
 
-    private Type superclass; // caches the generic superclass info
-    private Type[] superInterfaces; // caches the generic superinterface info
+    /** The generic superclass info.  Lazily initialized. */
+    private volatile Type superclass;
+
+    /** The generic superinterface info.  Lazily initialized. */
+    private volatile Type[] superInterfaces;
 
  // private, to enforce use of static factory
     private ClassRepository(String rawSig, GenericsFactory f) {
@@ -79,31 +82,34 @@ public class ClassRepository extends GenericDeclRepository<ClassSignature> {
  * with which the repository was created.
  */
 
-    public Type getSuperclass(){
+    public Type getSuperclass() {
+        Type superclass = this.superclass;
         if (superclass == null) { // lazily initialize superclass
             Reifier r = getReifier(); // obtain visitor
             // Extract superclass subtree from AST and reify
             getTree().getSuperclass().accept(r);
             // extract result from visitor and cache it
             superclass = r.getResult();
-            }
+            this.superclass = superclass;
+        }
         return superclass; // return cached result
     }
 
-    public Type[] getSuperInterfaces(){
+    public Type[] getSuperInterfaces() {
+        Type[] superInterfaces = this.superInterfaces;
         if (superInterfaces == null) { // lazily initialize super interfaces
             // first, extract super interface subtree(s) from AST
             TypeTree[] ts  = getTree().getSuperInterfaces();
             // create array to store reified subtree(s)
-            Type[] sis = new Type[ts.length];
+            superInterfaces = new Type[ts.length];
             // reify all subtrees
             for (int i = 0; i < ts.length; i++) {
                 Reifier r = getReifier(); // obtain visitor
                 ts[i].accept(r);// reify subtree
                 // extract result from visitor and store it
-                sis[i] = r.getResult();
+                superInterfaces[i] = r.getResult();
             }
-            superInterfaces = sis; // cache overall result
+            this.superInterfaces = superInterfaces;
         }
         return superInterfaces.clone(); // return cached result
     }
diff --git a/jdk/src/java.base/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java b/jdk/src/java.base/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
index 28cb4b4c70a..e530d573d84 100644
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/repository/GenericDeclRepository.java
@@ -42,7 +42,8 @@ import sun.reflect.generics.visitor.Reifier;
 public abstract class GenericDeclRepository<S extends Signature>
     extends AbstractRepository<S> {
 
-    private TypeVariable<?>[] typeParams; // caches the formal type parameters
+    /** The formal type parameters.  Lazily initialized. */
+    private volatile TypeVariable<?>[] typeParams;
 
     protected GenericDeclRepository(String rawSig, GenericsFactory f) {
         super(rawSig, f);
@@ -55,8 +56,7 @@ public abstract class GenericDeclRepository<S extends Signature>
  * If the corresponding field is non-null, it is returned.
  * If not, it is created lazily. This is done by selecting the appropriate
  * part of the tree and transforming it into a reflective object
- * using a visitor.
- * a visitor, which is created by feeding it the factory
+ * using a visitor, which is created by feeding it the factory
  * with which the repository was created.
  */
 
@@ -64,20 +64,21 @@ public abstract class GenericDeclRepository<S extends Signature>
      * Return the formal type parameters of this generic declaration.
      * @return the formal type parameters of this generic declaration
      */
-    public TypeVariable<?>[] getTypeParameters(){
+    public TypeVariable<?>[] getTypeParameters() {
+        TypeVariable<?>[] typeParams = this.typeParams;
         if (typeParams == null) { // lazily initialize type parameters
             // first, extract type parameter subtree(s) from AST
             FormalTypeParameter[] ftps = getTree().getFormalTypeParameters();
             // create array to store reified subtree(s)
-            TypeVariable<?>[] tps = new TypeVariable<?>[ftps.length];
+            typeParams = new TypeVariable<?>[ftps.length];
             // reify all subtrees
             for (int i = 0; i < ftps.length; i++) {
                 Reifier r = getReifier(); // obtain visitor
                 ftps[i].accept(r); // reify subtree
                 // extract result from visitor and store it
-                tps[i] = (TypeVariable<?>) r.getResult();
+                typeParams[i] = (TypeVariable<?>) r.getResult();
             }
-            typeParams = tps; // cache overall result
+            this.typeParams = typeParams; // cache overall result
         }
         return typeParams.clone(); // return cached result
     }
diff --git a/jdk/src/java.base/share/classes/sun/reflect/generics/scope/AbstractScope.java b/jdk/src/java.base/share/classes/sun/reflect/generics/scope/AbstractScope.java
index 8709b3e82a3..6a1827144aa 100644
--- a/jdk/src/java.base/share/classes/sun/reflect/generics/scope/AbstractScope.java
+++ b/jdk/src/java.base/share/classes/sun/reflect/generics/scope/AbstractScope.java
@@ -42,7 +42,9 @@ public abstract class AbstractScope<D extends GenericDeclaration>
     implements Scope {
 
     private final D recvr; // the declaration whose scope this instance represents
-    private Scope enclosingScope; // the enclosing scope of this scope
+
+    /** The enclosing scope of this scope.  Lazily initialized. */
+    private volatile Scope enclosingScope;
 
     /**
      * Constructor. Takes a reflective object whose scope the newly
@@ -71,7 +73,11 @@ public abstract class AbstractScope<D extends GenericDeclaration>
      * @return the enclosing scope
      */
     protected Scope getEnclosingScope(){
-        if (enclosingScope == null) {enclosingScope = computeEnclosingScope();}
+        Scope enclosingScope = this.enclosingScope;
+        if (enclosingScope == null) {
+            enclosingScope = computeEnclosingScope();
+            this.enclosingScope = enclosingScope;
+        }
         return enclosingScope;
     }
 

From 8ecf707b8df884e4c459f902c665ccfbe30a7158 Mon Sep 17 00:00:00 2001
From: Martin Buchholz <martin@openjdk.org>
Date: Thu, 6 Nov 2014 13:29:36 -0800
Subject: [PATCH 044/299] 8062773: Clarifications for Class specification

Reviewed-by: darcy, psandoz
---
 .../share/classes/java/lang/Class.java        | 85 +++++++++----------
 1 file changed, 42 insertions(+), 43 deletions(-)

diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java
index 9063450866f..ee24402ec8d 100644
--- a/jdk/src/java.base/share/classes/java/lang/Class.java
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java
@@ -719,15 +719,15 @@ public final class Class<T> implements java.io.Serializable,
 
 
     /**
-     * Returns the {@code Class} representing the superclass of the entity
-     * (class, interface, primitive type or void) represented by this
-     * {@code Class}.  If this {@code Class} represents either the
+     * Returns the {@code Class} representing the direct superclass of the
+     * entity (class, interface, primitive type or void) represented by
+     * this {@code Class}.  If this {@code Class} represents either the
      * {@code Object} class, an interface, a primitive type, or void, then
      * null is returned.  If this object represents an array class then the
      * {@code Class} object representing the {@code Object} class is
      * returned.
      *
-     * @return the superclass of the class represented by this object.
+     * @return the direct superclass of the class represented by this object
      */
     public native Class<? super T> getSuperclass();
 
@@ -758,7 +758,7 @@ public final class Class<T> implements java.io.Serializable,
      * @throws java.lang.reflect.MalformedParameterizedTypeException if the
      *     generic superclass refers to a parameterized type that cannot be
      *     instantiated  for any reason
-     * @return the superclass of the class represented by this object
+     * @return the direct superclass of the class represented by this object
      * @since 1.5
      */
     public Type getGenericSuperclass() {
@@ -798,15 +798,15 @@ public final class Class<T> implements java.io.Serializable,
 
 
     /**
-     * Determines the interfaces implemented by the class or interface
+     * Returns the interfaces directly implemented by the class or interface
      * represented by this object.
      *
-     * <p> If this object represents a class, the return value is an array
-     * containing objects representing all interfaces implemented by the
-     * class. The order of the interface objects in the array corresponds to
-     * the order of the interface names in the {@code implements} clause
-     * of the declaration of the class represented by this object. For
-     * example, given the declaration:
+     * <p>If this object represents a class, the return value is an array
+     * containing objects representing all interfaces directly implemented by
+     * the class.  The order of the interface objects in the array corresponds
+     * to the order of the interface names in the {@code implements} clause of
+     * the declaration of the class represented by this object.  For example,
+     * given the declaration:
      * <blockquote>
      * {@code class Shimmer implements FloorWax, DessertTopping { ... }}
      * </blockquote>
@@ -823,23 +823,23 @@ public final class Class<T> implements java.io.Serializable,
      * is the {@code Class} object that represents interface
      * {@code DessertTopping}.
      *
-     * <p> If this object represents an interface, the array contains objects
-     * representing all interfaces extended by the interface. The order of the
-     * interface objects in the array corresponds to the order of the interface
-     * names in the {@code extends} clause of the declaration of the
-     * interface represented by this object.
+     * <p>If this object represents an interface, the array contains objects
+     * representing all interfaces directly extended by the interface.  The
+     * order of the interface objects in the array corresponds to the order of
+     * the interface names in the {@code extends} clause of the declaration of
+     * the interface represented by this object.
      *
-     * <p> If this object represents a class or interface that implements no
+     * <p>If this object represents a class or interface that implements no
      * interfaces, the method returns an array of length 0.
      *
-     * <p> If this object represents a primitive type or void, the method
+     * <p>If this object represents a primitive type or void, the method
      * returns an array of length 0.
      *
-     * <p> If this {@code Class} object represents an array type, the
+     * <p>If this {@code Class} object represents an array type, the
      * interfaces {@code Cloneable} and {@code java.io.Serializable} are
      * returned in that order.
      *
-     * @return an array of interfaces implemented by this class.
+     * @return an array of interfaces directly implemented by this class
      */
     public Class<?>[] getInterfaces() {
         ReflectionData<T> rd = reflectionData();
@@ -873,29 +873,28 @@ public final class Class<T> implements java.io.Serializable,
      * for the semantics of the creation process for parameterized
      * types.
      *
-     * <p> If this object represents a class, the return value is an
-     * array containing objects representing all interfaces
-     * implemented by the class. The order of the interface objects in
-     * the array corresponds to the order of the interface names in
-     * the {@code implements} clause of the declaration of the class
-     * represented by this object.  In the case of an array class, the
-     * interfaces {@code Cloneable} and {@code Serializable} are
+     * <p>If this object represents a class, the return value is an array
+     * containing objects representing all interfaces directly implemented by
+     * the class.  The order of the interface objects in the array corresponds
+     * to the order of the interface names in the {@code implements} clause of
+     * the declaration of the class represented by this object.
+     *
+     * <p>If this object represents an interface, the array contains objects
+     * representing all interfaces directly extended by the interface.  The
+     * order of the interface objects in the array corresponds to the order of
+     * the interface names in the {@code extends} clause of the declaration of
+     * the interface represented by this object.
+     *
+     * <p>If this object represents a class or interface that implements no
+     * interfaces, the method returns an array of length 0.
+     *
+     * <p>If this object represents a primitive type or void, the method
+     * returns an array of length 0.
+     *
+     * <p>If this {@code Class} object represents an array type, the
+     * interfaces {@code Cloneable} and {@code java.io.Serializable} are
      * returned in that order.
      *
-     * <p>If this object represents an interface, the array contains
-     * objects representing all interfaces directly extended by the
-     * interface.  The order of the interface objects in the array
-     * corresponds to the order of the interface names in the
-     * {@code extends} clause of the declaration of the interface
-     * represented by this object.
-     *
-     * <p>If this object represents a class or interface that
-     * implements no interfaces, the method returns an array of length
-     * 0.
-     *
-     * <p>If this object represents a primitive type or void, the
-     * method returns an array of length 0.
-     *
      * @throws java.lang.reflect.GenericSignatureFormatError
      *     if the generic class signature does not conform to the format
      *     specified in
@@ -905,7 +904,7 @@ public final class Class<T> implements java.io.Serializable,
      * @throws java.lang.reflect.MalformedParameterizedTypeException
      *     if any of the generic superinterfaces refer to a parameterized
      *     type that cannot be instantiated for any reason
-     * @return an array of interfaces implemented by this class
+     * @return an array of interfaces directly implemented by this class
      * @since 1.5
      */
     public Type[] getGenericInterfaces() {

From f465a5f2283c31856a6c8a2ccdc8b17ef8f2a991 Mon Sep 17 00:00:00 2001
From: Phil Race <prr@openjdk.org>
Date: Thu, 6 Nov 2014 15:10:00 -0800
Subject: [PATCH 045/299] 8062163:
 java/awt/geom/AffineTransform/TestInvertMethods.java test fails

Reviewed-by: jgodinez
---
 .../java/awt/geom/AffineTransform/TestInvertMethods.java  | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/jdk/test/java/awt/geom/AffineTransform/TestInvertMethods.java b/jdk/test/java/awt/geom/AffineTransform/TestInvertMethods.java
index 6d260a1ad89..d53806d08df 100644
--- a/jdk/test/java/awt/geom/AffineTransform/TestInvertMethods.java
+++ b/jdk/test/java/awt/geom/AffineTransform/TestInvertMethods.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 4987374
+ * @bug 4987374 8062163
  * @summary Unit test for inversion methods:
  *
  *          AffineTransform.createInverse();
@@ -188,6 +188,8 @@ public class TestInvertMethods {
             double m11 = at.getScaleY();
             double m02 = at.getTranslateX();
             double m12 = at.getTranslateY();
+            if (Math.abs(m00-1.0) < 1E-10) m00 = 1.0;
+            if (Math.abs(m11-1.0) < 1E-10) m11 = 1.0;
             if (Math.abs(m02) < 1E-10) m02 = 0.0;
             if (Math.abs(m12) < 1E-10) m12 = 0.0;
             if (Math.abs(m01) < 1E-15) m01 = 0.0;
@@ -273,7 +275,7 @@ public class TestInvertMethods {
                 int inc = full ? 10 : 45;
                 for (int i = -720; i <= 720; i += inc) {
                     AffineTransform at2 = new AffineTransform(init);
-                    at2.rotate(Math.toRadians(i));
+                    at2.rotate(i / 180.0 * Math.PI);
                     if (verbose) System.out.println("*Rotate("+i+") = "+at2);
                     next.test(at2, full);
                 }

From 1768fe1eb9ce9bee4fccddc5c684b1a79ff10d9e Mon Sep 17 00:00:00 2001
From: Yumin Qi <yumin.qi@oracle.com>
Date: Fri, 7 Nov 2014 12:48:09 -0800
Subject: [PATCH 046/299] 8062247: [TESTBUG] Allow WhiteBox test to access JVM
 offsets

Reviewed-by: coleenp, iklam, mseledtsov
---
 .../test/testlibrary/whitebox/sun/hotspot/WhiteBox.java  | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
index a5a07947954..e66cfad94ee 100644
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
@@ -207,4 +207,13 @@ public class WhiteBox {
                        .findAny()
                        .orElse(null);
   }
+  public native int getOffsetForName0(String name);
+  public int getOffsetForName(String name) throws Exception {
+    int offset = getOffsetForName0(name);
+    if (offset == -1) {
+      throw new RuntimeException(name + " not found");
+    }
+    return offset;
+  }
+
 }

From dda16f6ccd77bbb9c1054818f21d0c9418dcc5ab Mon Sep 17 00:00:00 2001
From: Tatiana Pivovarova <tatiana.pivovarova@oracle.com>
Date: Sat, 8 Nov 2014 16:00:27 +0300
Subject: [PATCH 047/299] 8062011: JT_HS/compiler/7068051 uses
 jre/lib/javaws.jar

Reviewed-by: kvn, iignatyev
---
 .../test/compiler/7068051/Test7068051.java    | 135 +++++++++++++-----
 hotspot/test/compiler/7068051/Test7068051.sh  |  45 ------
 2 files changed, 97 insertions(+), 83 deletions(-)
 delete mode 100644 hotspot/test/compiler/7068051/Test7068051.sh

diff --git a/hotspot/test/compiler/7068051/Test7068051.java b/hotspot/test/compiler/7068051/Test7068051.java
index e2b1927aa55..cd35feb76d6 100644
--- a/hotspot/test/compiler/7068051/Test7068051.java
+++ b/hotspot/test/compiler/7068051/Test7068051.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,57 +26,116 @@
  * @test
  * @bug 7068051
  * @summary SIGSEGV in PhaseIdealLoop::build_loop_late_post on T5440
+ * @library /testlibrary
  *
- * @run shell/timeout=300 Test7068051.sh
+ * @run main/othervm -showversion -Xbatch Test7068051
  */
 
-import java.io.*;
-import java.nio.*;
-import java.util.*;
-import java.util.zip.*;
+import com.oracle.java.testlibrary.JDKToolLauncher;
+import com.oracle.java.testlibrary.OutputAnalyzer;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.StandardCopyOption;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
 
 public class Test7068051 {
+    private static final String SELF_NAME = Test7068051.class.getSimpleName();
+    private static final String SELF_FILE_NAME = SELF_NAME + ".java";
+    private static final String JAR_NAME = "foo.jar";
+    private static final String TEST_PATH = System.getProperty("test.src");
+    private static final Path CURRENT_DIR = Paths.get(".");
+    private static final Path TEST_SOURCE_PATH = Paths.get(TEST_PATH, SELF_FILE_NAME);
 
-    public static void main (String[] args) throws Throwable {
+    public static void main (String[] args) throws IOException {
+        createTestJarFile();
+        System.out.println("Running test...");
 
-        ZipFile zf = new ZipFile(args[0]);
+        try (ZipFile zf = new ZipFile(JAR_NAME)) {
 
-        Enumeration<? extends ZipEntry> entries = zf.entries();
-        ArrayList<String> names = new ArrayList<String>();
-        while (entries.hasMoreElements()) {
-            names.add(entries.nextElement().getName());
-        }
+            Enumeration<? extends ZipEntry> entries = zf.entries();
+            ArrayList<String> names = new ArrayList<String>();
+            while (entries.hasMoreElements()) {
+                names.add(entries.nextElement().getName());
+            }
 
-        byte[] bytes = new byte[16];
-        for (String name : names) {
-            ZipEntry e = zf.getEntry(name);
+            byte[] bytes = new byte[16];
+            for (String name : names) {
+                ZipEntry e = zf.getEntry(name);
 
-            if (e.isDirectory())
-                continue;
-
-            final InputStream is = zf.getInputStream(e);
-
-            try  {
-                while (is.read(bytes) >= 0) {
+                if (e.isDirectory()) {
+                    continue;
                 }
-                is.close();
 
-            } catch (IOException x) {
-                 System.out.println("..................................");
-                 System.out.println("          -->  is :" + is);
-                 System.out.println("          is.hash :" + is.hashCode());
-                 System.out.println();
-                 System.out.println("           e.name :" + e.getName());
-                 System.out.println("           e.hash :" + e.hashCode());
-                 System.out.println("         e.method :" + e.getMethod());
-                 System.out.println("           e.size :" + e.getSize());
-                 System.out.println("          e.csize :" + e.getCompressedSize());
+                try (final InputStream is = zf.getInputStream(e)) {
+                    try {
+                        while (is.read(bytes) >= 0) {
+                        }
+                    } catch (IOException x) {
+                        System.out.println("..................................");
+                        System.out.println("          -->  is :" + is);
+                        System.out.println("          is.hash :" + is.hashCode());
+                        System.out.println();
+                        System.out.println("           e.name :" + e.getName());
+                        System.out.println("           e.hash :" + e.hashCode());
+                        System.out.println("         e.method :" + e.getMethod());
+                        System.out.println("           e.size :" + e.getSize());
+                        System.out.println("          e.csize :" + e.getCompressedSize());
+                        System.out.println("..................................");
 
-                 x.printStackTrace();
-                 System.out.println("..................................");
-                 System.exit(97);
+                        throw new AssertionError("IOException was throwing while read the archive. Test failed.", x);
+                    }
+                }
             }
         }
-        zf.close();
+        System.out.println("Test passed.");
+    }
+
+    private static void createTestJarFile() {
+        ArrayList<String> jarOptions = new ArrayList<>();
+
+        // jar cf foo.jar *
+        System.out.println("Creating jar file..");
+        jarOptions.add("cf");
+        jarOptions.add(JAR_NAME);
+        try {
+            for (int i = 0; i < 100; ++i) {
+                Path temp = Files.createTempFile(CURRENT_DIR, SELF_NAME, ".java");
+                Files.copy(TEST_SOURCE_PATH, temp, StandardCopyOption.REPLACE_EXISTING);
+                jarOptions.add(temp.toString());
+            }
+        } catch (IOException ex) {
+            throw new AssertionError("TESTBUG: Creating temp files failed.", ex);
+        }
+        runJar(jarOptions);
+
+        // jar -uf0 foo.jar Test7068051.java
+        System.out.println("Adding unpacked file...");
+        jarOptions.clear();
+        jarOptions.add("-uf0");
+        jarOptions.add(JAR_NAME);
+        jarOptions.add(TEST_SOURCE_PATH.toString());
+        runJar(jarOptions);
+    }
+
+    private static void runJar(List<String> params) {
+        JDKToolLauncher jar = JDKToolLauncher.create("jar");
+        for (String p : params) {
+            jar.addToolArg(p);
+        }
+        ProcessBuilder pb = new ProcessBuilder(jar.getCommand());
+        try {
+            OutputAnalyzer output = new OutputAnalyzer(pb.start());
+            output.shouldHaveExitValue(0);
+        } catch (IOException ex) {
+            throw new AssertionError("TESTBUG: jar failed.", ex);
+        }
     }
 }
diff --git a/hotspot/test/compiler/7068051/Test7068051.sh b/hotspot/test/compiler/7068051/Test7068051.sh
deleted file mode 100644
index 35bc0f72efd..00000000000
--- a/hotspot/test/compiler/7068051/Test7068051.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#!/bin/sh
-# 
-# Copyright (c) 2011, 2014, 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.
-# 
-# 
-## some tests require path to find test source dir
-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 -x
-
-${COMPILEJAVA}/bin/jar xf ${COMPILEJAVA}/jre/lib/javaws.jar
-${COMPILEJAVA}/bin/jar cf foo.jar *
-cp ${TESTSRC}/Test7068051.java ./
-${COMPILEJAVA}/bin/jar -uf0 foo.jar Test7068051.java
-
-${COMPILEJAVA}/bin/javac ${TESTJAVACOPTS} -d . Test7068051.java
-
-${TESTJAVA}/bin/java ${TESTOPTS} -showversion -Xbatch Test7068051 foo.jar
-

From 80830d4932c73e38f5932d2ea7aeef291ca4e0f8 Mon Sep 17 00:00:00 2001
From: Tatiana Pivovarova <tatiana.pivovarova@oracle.com>
Date: Sat, 8 Nov 2014 16:00:28 +0300
Subject: [PATCH 048/299] 8062742: compiler/EliminateAutoBox/UnsignedLoads.java
 fails with client vm

Reviewed-by: kvn, rbackman, anoll, vlivanov, iignatyev
---
 hotspot/test/TEST.groups                                  | 3 ++-
 hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups
index 8dbacc847f3..dbeb191ee3c 100644
--- a/hotspot/test/TEST.groups
+++ b/hotspot/test/TEST.groups
@@ -431,7 +431,8 @@ hotspot_compiler_2 = \
   compiler/8005033/Test8005033.java \
   compiler/8005419/Test8005419.java \
   compiler/8005956/PolynomialRoot.java \
-  compiler/8007294/Test8007294.java
+  compiler/8007294/Test8007294.java \
+  compiler/EliminateAutoBox/UnsignedLoads.java
 
 hotspot_compiler_3 = \
   compiler/8007722/Test8007722.java \
diff --git a/hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java b/hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java
index 982c5f7beb1..6343386b999 100644
--- a/hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java
+++ b/hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java
@@ -26,7 +26,7 @@
 /*
  * @test
  * @library /testlibrary
- * @run main/othervm -Xbatch -XX:+EliminateAutoBox
+ * @run main/othervm -Xbatch -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox
  *                   -XX:CompileOnly=::valueOf,::byteValue,::shortValue,::testUnsignedByte,::testUnsignedShort
  *                   UnsignedLoads
  */

From e8c7cc1187a169adf895f7d0c92150fc9933e01f Mon Sep 17 00:00:00 2001
From: Sergey Bylokhov <serb@openjdk.org>
Date: Sun, 9 Nov 2014 22:17:45 +0300
Subject: [PATCH 049/299] 7169583: JInternalFrame title not antialiased in
 Nimbus LaF

Reviewed-by: azvegint, alexsch
---
 .../plaf/basic/BasicInternalFrameTitlePane.java      | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
index 7ae4bc1b408..17284fd4f86 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicInternalFrameTitlePane.java
@@ -31,16 +31,14 @@ import java.awt.event.*;
 import javax.accessibility.AccessibleContext;
 import javax.swing.*;
 import javax.swing.plaf.*;
-import javax.swing.border.*;
 import javax.swing.event.InternalFrameEvent;
-import java.util.EventListener;
 import java.beans.PropertyChangeListener;
 import java.beans.PropertyChangeEvent;
-import java.beans.VetoableChangeListener;
 import java.beans.PropertyVetoException;
 
 import sun.swing.DefaultLookup;
-import sun.swing.UIAction;
+
+import static sun.swing.SwingUtilities2.AA_TEXT_PROPERTY_KEY;
 
 /**
  * The class that manages a basic title bar
@@ -215,6 +213,12 @@ public class BasicInternalFrameTitlePane extends JComponent
         createButtons();
         addSubComponents();
 
+        updateProperties();
+    }
+
+    private void updateProperties() {
+        final Object aaTextInfo = frame.getClientProperty(AA_TEXT_PROPERTY_KEY);
+        putClientProperty(AA_TEXT_PROPERTY_KEY, aaTextInfo);
     }
 
     /**

From 043868fac75236bf49dbb9d6776b57f57a3fef41 Mon Sep 17 00:00:00 2001
From: Yuri Nesterenko <yan@openjdk.org>
Date: Mon, 10 Nov 2014 16:23:30 +0300
Subject: [PATCH 050/299] 8063102: Change open awt regression tests to avoid
 sun.awt.SunToolkit.realSync, part 1

Reviewed-by: pchelko, serb
---
 .../sun/awt/Translucency/WindowOpacity.java   | 15 ++++----
 .../NoUpdateUponShow/NoUpdateUponShow.java    |  9 +++--
 .../java/awt/Component/PaintAll/PaintAll.java | 17 ++++++----
 .../ModalBlockedStealsFocusTest.java          | 10 ++++--
 .../WindowInitialFocusTest.java               | 17 ++++++----
 .../ExceptionOnSetExtendedStateTest.java      | 11 +++---
 .../awt/Frame/FrameSize/TestFrameSize.java    |  8 ++++-
 .../MaximizedByPlatform.java                  | 18 +++++++---
 .../MaximizedToMaximized.java                 |  5 +--
 .../SlideNotResizableTest.java                |  7 ++--
 .../TranslucentWindow/TranslucentWindow.java  | 15 +++++---
 .../IncorrectDisplayModeExitFullscreen.java   | 20 ++++++-----
 .../GridBagLayoutIpadXYTest.java              |  9 ++++-
 .../List/ListPeer/R2303044ListSelection.java  | 10 +++---
 .../SingleModeDeselect.java                   |  9 +++--
 jdk/test/java/awt/Paint/ExposeOnEDT.java      | 17 ++++++----
 .../ScrollPanePreferredSize.java              | 13 ++++---
 .../awt/TextArea/DisposeTest/TestDispose.java | 17 ++++++----
 .../bug7129742.java                           |  7 ++--
 .../TextAreaTwicePack/TextAreaTwicePack.java  |  9 ++---
 .../TextField/DisposeTest/TestDispose.java    | 16 +++++----
 .../PopupMenuLeakTest/PopupMenuLeakTest.java  | 10 +++---
 .../java/awt/Window/8027025/Test8027025.java  |  5 ++-
 .../AlwaysOnTop/AlwaysOnTopFieldTest.java     | 21 +++++++-----
 .../OwnedWindowsSerialization.java            |  5 ++-
 .../TextEventSequenceTest.java                | 34 +++++++++++--------
 .../WarningWindowDisposeCrashTest.java        | 19 +++++------
 .../WarningWindowDisposeTest.java             | 23 +++++++------
 28 files changed, 233 insertions(+), 143 deletions(-)

diff --git a/jdk/test/com/sun/awt/Translucency/WindowOpacity.java b/jdk/test/com/sun/awt/Translucency/WindowOpacity.java
index 26c611c35d5..a8391503238 100644
--- a/jdk/test/com/sun/awt/Translucency/WindowOpacity.java
+++ b/jdk/test/com/sun/awt/Translucency/WindowOpacity.java
@@ -33,15 +33,12 @@ import java.awt.*;
 import java.awt.event.*;
 
 import com.sun.awt.AWTUtilities;
-import sun.awt.SunToolkit;
 
 public class WindowOpacity
 {
     //*** test-writer defined static variables go here ***
 
-    private static void realSync() {
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
-    }
+   private static Robot robot;
 
 
     private static void init()
@@ -60,6 +57,12 @@ public class WindowOpacity
             System.out.println("Either the Toolkit or the native system does not support controlling the window opacity level.");
             pass();
         }
+        try {
+            robot = new Robot();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException ("Unexpected failure");
+        }
 
         boolean passed;
 
@@ -137,7 +140,7 @@ public class WindowOpacity
         f.setBounds(100, 100, 300, 200);
         f.setVisible(true);
 
-        realSync();
+        robot.waitForIdle();
 
         curOpacity = AWTUtilities.getWindowOpacity(f);
         if (curOpacity < 0.75f || curOpacity > 0.75f) {
@@ -147,7 +150,7 @@ public class WindowOpacity
 
 
         AWTUtilities.setWindowOpacity(f, 0.5f);
-        realSync();
+        robot.waitForIdle();
 
         curOpacity = AWTUtilities.getWindowOpacity(f);
         if (curOpacity < 0.5f || curOpacity > 0.5f) {
diff --git a/jdk/test/java/awt/Component/NoUpdateUponShow/NoUpdateUponShow.java b/jdk/test/java/awt/Component/NoUpdateUponShow/NoUpdateUponShow.java
index 80360dfdbe5..d032f0d784b 100644
--- a/jdk/test/java/awt/Component/NoUpdateUponShow/NoUpdateUponShow.java
+++ b/jdk/test/java/awt/Component/NoUpdateUponShow/NoUpdateUponShow.java
@@ -36,7 +36,6 @@
  */
 
 import java.awt.*;
-import sun.awt.SunToolkit;
 
 public class NoUpdateUponShow
 {
@@ -70,7 +69,13 @@ public class NoUpdateUponShow
         });
         f.setVisible(true);
 
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        try {
+            Robot robot = new Robot();
+            robot.waitForIdle();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
 
         if (wasUpdate) {
             fail(" Unexpected update. ");
diff --git a/jdk/test/java/awt/Component/PaintAll/PaintAll.java b/jdk/test/java/awt/Component/PaintAll/PaintAll.java
index e734cad1fdf..483f1a5bd5a 100644
--- a/jdk/test/java/awt/Component/PaintAll/PaintAll.java
+++ b/jdk/test/java/awt/Component/PaintAll/PaintAll.java
@@ -21,8 +21,6 @@
  * questions.
  */
 
-import sun.awt.SunToolkit;
-
 import java.awt.Button;
 import java.awt.Canvas;
 import java.awt.Checkbox;
@@ -48,6 +46,8 @@ import java.awt.image.BufferedImage;
   @bug 6596915
   @summary Test Component.paintAll() method
   @author sergey.bylokhov@oracle.com: area=awt.component
+  @library ../../../../lib/testlibrary/
+  @build ExtendedRobot
   @run main PaintAll
 */
 public class PaintAll {
@@ -66,6 +66,7 @@ public class PaintAll {
     private static volatile boolean scrollPanePainted;
     private static volatile boolean textAreaPainted;
     private static volatile boolean textFieldPainted;
+    private static ExtendedRobot robot = null;
 
     private static final Button buttonStub = new Button() {
         @Override
@@ -283,11 +284,15 @@ public class PaintAll {
     }
 
     private static void sleep() {
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
-        try {
-            Thread.sleep(500L);
-        } catch (InterruptedException ignored) {
+        if(robot == null) {
+            try {
+                robot = new ExtendedRobot();
+            }catch(Exception ex) {
+                ex.printStackTrace();
+                throw new RuntimeException("Unexpected failure");
+            }
         }
+        robot.waitForIdle(500);
     }
 
     private static void fail(final String message) {
diff --git a/jdk/test/java/awt/Focus/ModalBlockedStealsFocusTest/ModalBlockedStealsFocusTest.java b/jdk/test/java/awt/Focus/ModalBlockedStealsFocusTest/ModalBlockedStealsFocusTest.java
index 7c8e6574c92..f718ecbcfc1 100644
--- a/jdk/test/java/awt/Focus/ModalBlockedStealsFocusTest/ModalBlockedStealsFocusTest.java
+++ b/jdk/test/java/awt/Focus/ModalBlockedStealsFocusTest/ModalBlockedStealsFocusTest.java
@@ -34,11 +34,9 @@ import java.awt.event.*;
 import java.applet.Applet;
 import java.util.concurrent.atomic.AtomicBoolean;
 import java.lang.reflect.InvocationTargetException;
-import sun.awt.SunToolkit;
 import test.java.awt.regtesthelpers.Util;
 
 public class ModalBlockedStealsFocusTest extends Applet {
-    SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
     Frame frame = new Frame("Blocked Frame");
     Dialog dialog = new Dialog(frame, "Modal Dialog", Dialog.ModalityType.TOOLKIT_MODAL);
     AtomicBoolean lostFocus = new AtomicBoolean(false);
@@ -85,7 +83,13 @@ public class ModalBlockedStealsFocusTest extends Applet {
             }).start();
 
         Util.waitTillShown(dialog);
-        toolkit.realSync();
+        try {
+            Robot robot = new Robot();
+            robot.waitForIdle();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
 
         // Test 1. Show a modal blocked frame, check that it doesn't steal focus.
 
diff --git a/jdk/test/java/awt/Focus/WindowInitialFocusTest/WindowInitialFocusTest.java b/jdk/test/java/awt/Focus/WindowInitialFocusTest/WindowInitialFocusTest.java
index ee047a3b493..38c924b3a6c 100644
--- a/jdk/test/java/awt/Focus/WindowInitialFocusTest/WindowInitialFocusTest.java
+++ b/jdk/test/java/awt/Focus/WindowInitialFocusTest/WindowInitialFocusTest.java
@@ -33,7 +33,6 @@ import java.awt.*;
 import java.awt.event.*;
 import java.applet.Applet;
 import java.util.concurrent.atomic.AtomicBoolean;
-import sun.awt.SunToolkit;
 import test.java.awt.regtesthelpers.Util;
 
 public class WindowInitialFocusTest extends Applet {
@@ -41,7 +40,7 @@ public class WindowInitialFocusTest extends Applet {
     Window window = new Window(frame);
     Button button = new Button("button");
     AtomicBoolean focused = new AtomicBoolean(false);
-    SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
+    Robot robot;
 
     public static void main(String[] args) {
         WindowInitialFocusTest app = new WindowInitialFocusTest();
@@ -75,12 +74,18 @@ public class WindowInitialFocusTest extends Applet {
                 }});
 
         frame.setVisible(true);
-        toolkit.realSync();
+        try {
+            robot = new Robot();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
+        robot.waitForIdle();
 
         // Test 1. Show the window, check that it become focused.
 
         window.setVisible(true);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (!Util.waitForCondition(focused, 2000L)) {
             throw new TestFailedException("the window didn't get focused on its showing!");
@@ -89,13 +94,13 @@ public class WindowInitialFocusTest extends Applet {
         // Test 2. Show unfocusable window, check that it doesn't become focused.
 
         window.setVisible(false);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         window.setFocusableWindowState(false);
         focused.set(false);
 
         window.setVisible(true);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (Util.waitForCondition(focused, 2000L)) {
             throw new TestFailedException("the unfocusable window got focused on its showing!");
diff --git a/jdk/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java b/jdk/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java
index b0f3c63b048..845138ab3bb 100644
--- a/jdk/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java
+++ b/jdk/test/java/awt/Frame/ExceptionOnSetExtendedStateTest/ExceptionOnSetExtendedStateTest.java
@@ -30,11 +30,8 @@
 
 import java.awt.*;
 
-import sun.awt.SunToolkit;
-
 public class ExceptionOnSetExtendedStateTest {
     private static final int[] frameStates = { Frame.NORMAL, Frame.ICONIFIED, Frame.MAXIMIZED_BOTH };
-    private static final SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
 
     private static boolean validatePlatform() {
         String osName = System.getProperty("os.name");
@@ -53,7 +50,13 @@ public class ExceptionOnSetExtendedStateTest {
         frame.setSize(200, 200);
         frame.setUndecorated(!decoratedFrame);
         frame.setVisible(true);
-        toolkit.realSync();
+        try {
+            Robot robot = new Robot();
+            robot.waitForIdle();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
 
         frame.setExtendedState(oldState);
         sleep(1000);
diff --git a/jdk/test/java/awt/Frame/FrameSize/TestFrameSize.java b/jdk/test/java/awt/Frame/FrameSize/TestFrameSize.java
index b2a978300a9..b42a70fbd11 100644
--- a/jdk/test/java/awt/Frame/FrameSize/TestFrameSize.java
+++ b/jdk/test/java/awt/Frame/FrameSize/TestFrameSize.java
@@ -77,7 +77,13 @@ public class TestFrameSize {
 
         mainWindow.setVisible(true);
 
-        ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        try {
+            Robot robot = new Robot();
+            robot.waitForIdle();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure.");
+        }
 
         Dimension clientSize2 = getClientSize(mainWindow);
         System.out.println("Client size after showing: " + clientSize2);
diff --git a/jdk/test/java/awt/Frame/MaximizedByPlatform/MaximizedByPlatform.java b/jdk/test/java/awt/Frame/MaximizedByPlatform/MaximizedByPlatform.java
index 070aa4deba6..224c10e7996 100644
--- a/jdk/test/java/awt/Frame/MaximizedByPlatform/MaximizedByPlatform.java
+++ b/jdk/test/java/awt/Frame/MaximizedByPlatform/MaximizedByPlatform.java
@@ -25,11 +25,12 @@
  * @bug 8026143
  * @summary [macosx] Maximized state could be inconsistent between peer and frame
  * @author Petr Pchelko
+ * @library ../../../../lib/testlibrary
+ * @build jdk.testlibrary.OSInfo
  * @run main MaximizedByPlatform
  */
 
-import sun.awt.OSInfo;
-import sun.awt.SunToolkit;
+import jdk.testlibrary.OSInfo;
 
 import java.awt.*;
 
@@ -43,6 +44,13 @@ public class MaximizedByPlatform {
             return;
         }
 
+        Robot robot;
+        try {
+            robot = new Robot();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
         availableScreenBounds = getAvailableScreenBounds();
 
         // Test 1. The maximized state is set in setBounds
@@ -51,12 +59,12 @@ public class MaximizedByPlatform {
             frame.setBounds(100, 100, 100, 100);
             frame.setVisible(true);
 
-            ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+            robot.waitForIdle();
 
             frame.setBounds(availableScreenBounds.x, availableScreenBounds.y,
                     availableScreenBounds.width, availableScreenBounds.height);
 
-            ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+            robot.waitForIdle();
 
             if (frame.getExtendedState() != Frame.MAXIMIZED_BOTH) {
                 throw new RuntimeException("Maximized state was not set for frame in setBounds");
@@ -73,7 +81,7 @@ public class MaximizedByPlatform {
                     availableScreenBounds.width + 100, availableScreenBounds.height);
             frame.setVisible(true);
 
-            ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+            robot.waitForIdle();
 
             if (frame.getExtendedState() != Frame.MAXIMIZED_BOTH) {
                 throw new RuntimeException("Maximized state was not set for frame in setVisible");
diff --git a/jdk/test/java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java b/jdk/test/java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java
index 83fcfa1701d..e0da056b035 100644
--- a/jdk/test/java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java
+++ b/jdk/test/java/awt/Frame/MaximizedToMaximized/MaximizedToMaximized.java
@@ -28,7 +28,7 @@ import java.awt.GraphicsEnvironment;
 import java.awt.Insets;
 import java.awt.Rectangle;
 import java.awt.Toolkit;
-import sun.awt.SunToolkit;
+import java.awt.Robot;
 
 /**
  * @test
@@ -65,7 +65,8 @@ public class MaximizedToMaximized {
 
         Rectangle frameBounds = frame.getBounds();
         frame.setExtendedState(Frame.MAXIMIZED_BOTH);
-        ((SunToolkit) toolkit).realSync();
+        Robot robot = new Robot();
+        robot.waitForIdle();
 
         Rectangle maximizedFrameBounds = frame.getBounds();
         if (maximizedFrameBounds.width < frameBounds.width
diff --git a/jdk/test/java/awt/Frame/SlideNotResizableTest/SlideNotResizableTest.java b/jdk/test/java/awt/Frame/SlideNotResizableTest/SlideNotResizableTest.java
index 37df055ca22..b5938187185 100644
--- a/jdk/test/java/awt/Frame/SlideNotResizableTest/SlideNotResizableTest.java
+++ b/jdk/test/java/awt/Frame/SlideNotResizableTest/SlideNotResizableTest.java
@@ -21,8 +21,6 @@
  * questions.
  */
 
-import sun.awt.SunToolkit;
-
 import java.awt.*;
 import java.awt.Dimension;
 import java.awt.Point;
@@ -62,8 +60,9 @@ public class SlideNotResizableTest {
         }
     }
 
-    private static void sync() throws InterruptedException {
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+    private static void sync() throws Exception {
+        Robot robot = new Robot();
+        robot.waitForIdle();
         Thread.sleep(1000);
     }
 }
diff --git a/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java b/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java
index 1210b0dc551..35ab7dc906f 100644
--- a/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java
+++ b/jdk/test/java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java
@@ -34,10 +34,17 @@ import java.awt.geom.*;
 
 import static java.awt.GraphicsDevice.WindowTranslucency.*;
 
-import sun.awt.SunToolkit;
 
 public class TranslucentWindow {
     public static void main(String args[]) {
+        Robot robot;
+        try {
+            robot = new Robot();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
+
         GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
         GraphicsDevice gd = ge.getDefaultScreenDevice();
 
@@ -47,10 +54,10 @@ public class TranslucentWindow {
 
         // First, check it can be made fullscreen window without any effects applied
         gd.setFullScreenWindow(f);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         gd.setFullScreenWindow(null);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         // Second, check if it applying any effects doesn't prevent the window
         // from going into the fullscreen mode
@@ -64,7 +71,7 @@ public class TranslucentWindow {
             f.setBackground(new Color(0, 0, 0, 128));
         }
         gd.setFullScreenWindow(f);
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         // Third, make sure all the effects are unset when entering the fullscreen mode
         if (f.getShape() != null) {
diff --git a/jdk/test/java/awt/GraphicsDevice/IncorrectDisplayModeExitFullscreen.java b/jdk/test/java/awt/GraphicsDevice/IncorrectDisplayModeExitFullscreen.java
index 1d42db8f47d..ad808c3ab63 100644
--- a/jdk/test/java/awt/GraphicsDevice/IncorrectDisplayModeExitFullscreen.java
+++ b/jdk/test/java/awt/GraphicsDevice/IncorrectDisplayModeExitFullscreen.java
@@ -27,16 +27,17 @@ import java.awt.DisplayMode;
 import java.awt.Frame;
 import java.awt.GraphicsDevice;
 import java.awt.GraphicsEnvironment;
-import java.awt.Toolkit;
-
-import sun.awt.SunToolkit;
 
 /**
  * @test
  * @bug 8019587
  * @author Sergey Bylokhov
+ * @library ../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @run main IncorrectDisplayModeExitFullscreen
  */
 public class IncorrectDisplayModeExitFullscreen {
+    static ExtendedRobot robot;
 
     public static void main(final String[] args) {
 
@@ -64,6 +65,13 @@ public class IncorrectDisplayModeExitFullscreen {
             return;
         }
 
+        try {
+            robot = new ExtendedRobot();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
+
         final Frame frame = new Frame();
         frame.setBackground(Color.GREEN);
         frame.setUndecorated(true);
@@ -85,10 +93,6 @@ public class IncorrectDisplayModeExitFullscreen {
         }
     }
     private static void sleep() {
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
-        try {
-            Thread.sleep(1500);
-        } catch (InterruptedException ignored) {
-        }
+        robot.waitForIdle(1500);
     }
 }
diff --git a/jdk/test/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java b/jdk/test/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java
index f547ead583e..637bed4f3d5 100644
--- a/jdk/test/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java
+++ b/jdk/test/java/awt/GridBagLayout/GridBagLayoutIpadXYTest/GridBagLayoutIpadXYTest.java
@@ -71,7 +71,14 @@ public class GridBagLayoutIpadXYTest extends Applet
         frame.pack();
         frame.setVisible(true);
 
-        ((sun.awt.SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        Robot robot;
+        try {
+            robot = new Robot();
+            robot.waitForIdle();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
 
         Dimension minSize = jtf.getMinimumSize();
         if ( minSize.width + customIpadx != jtf.getSize().width ||
diff --git a/jdk/test/java/awt/List/ListPeer/R2303044ListSelection.java b/jdk/test/java/awt/List/ListPeer/R2303044ListSelection.java
index d7ef3902a03..d170fe081b9 100644
--- a/jdk/test/java/awt/List/ListPeer/R2303044ListSelection.java
+++ b/jdk/test/java/awt/List/ListPeer/R2303044ListSelection.java
@@ -21,12 +21,10 @@
  * questions.
  */
 
-import sun.awt.SunToolkit;
-
 import java.awt.Frame;
 import java.awt.HeadlessException;
 import java.awt.List;
-import java.awt.Toolkit;
+import java.awt.Robot;
 
 /**
  * @test
@@ -57,9 +55,11 @@ public final class R2303044ListSelection {
 
     private static void sleep() {
         try {
-            ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+            Robot robot = new Robot();
+            robot.waitForIdle();
             Thread.sleep(1000);
-        } catch (final InterruptedException ignored) {
+        } catch (final Exception ignored) {
+            ignored.printStackTrace();
         }
     }
 }
diff --git a/jdk/test/java/awt/List/SingleModeDeselect/SingleModeDeselect.java b/jdk/test/java/awt/List/SingleModeDeselect/SingleModeDeselect.java
index 726835f5f73..c4452cd1015 100644
--- a/jdk/test/java/awt/List/SingleModeDeselect/SingleModeDeselect.java
+++ b/jdk/test/java/awt/List/SingleModeDeselect/SingleModeDeselect.java
@@ -30,7 +30,6 @@
 */
 
 import java.awt.*;
-import sun.awt.SunToolkit;
 
 public class SingleModeDeselect
 {
@@ -50,7 +49,13 @@ public class SingleModeDeselect
         list.select(0);
         list.deselect(1);
 
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
+        try {
+            Robot robot = new Robot();
+            robot.waitForIdle();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
 
         if (list.getSelectedIndex() != 0){
             throw new RuntimeException("Test failed: List.getSelectedIndex() returns "+list.getSelectedIndex());
diff --git a/jdk/test/java/awt/Paint/ExposeOnEDT.java b/jdk/test/java/awt/Paint/ExposeOnEDT.java
index cf8a3a547e0..21f7dc00c29 100644
--- a/jdk/test/java/awt/Paint/ExposeOnEDT.java
+++ b/jdk/test/java/awt/Paint/ExposeOnEDT.java
@@ -22,18 +22,19 @@
  */
 
 
-import sun.awt.SunToolkit;
-
 import java.awt.*;
 
 /**
  * @test
  * @bug 7090424
  * @author Sergey Bylokhov
+ * @library ../../../lib/testlibrary/
+ * @build ExtendedRobot
  * @run main ExposeOnEDT
  */
 public final class ExposeOnEDT {
 
+    private static ExtendedRobot robot = null;
     private static final Button buttonStub = new Button() {
         @Override
         public void paint(final Graphics g) {
@@ -275,11 +276,15 @@ public final class ExposeOnEDT {
     }
 
     private static void sleep() {
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
-        try {
-            Thread.sleep(1000L);
-        } catch (InterruptedException ignored) {
+        if(robot == null) {
+            try {
+                robot = new ExtendedRobot();
+            }catch(Exception ex) {
+                ex.printStackTrace();
+                throw new RuntimeException("Unexpected failure");
+            }
         }
+        robot.waitForIdle(1000);
     }
 
     private static void fail(final String message) {
diff --git a/jdk/test/java/awt/ScrollPane/ScrollPanePreferredSize/ScrollPanePreferredSize.java b/jdk/test/java/awt/ScrollPane/ScrollPanePreferredSize/ScrollPanePreferredSize.java
index 0c799f14a1d..02a84e859fa 100644
--- a/jdk/test/java/awt/ScrollPane/ScrollPanePreferredSize/ScrollPanePreferredSize.java
+++ b/jdk/test/java/awt/ScrollPane/ScrollPanePreferredSize/ScrollPanePreferredSize.java
@@ -26,12 +26,13 @@ import java.awt.Frame;
 import java.awt.ScrollPane;
 import java.awt.Toolkit;
 
-import sun.awt.SunToolkit;
-
 /**
  * @test
  * @bug 7124213
  * @author Sergey Bylokhov
+ * @library ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @run main ScrollPanePreferredSize
  */
 public final class ScrollPanePreferredSize {
 
@@ -54,10 +55,12 @@ public final class ScrollPanePreferredSize {
     }
 
     private static void sleep() {
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
         try {
-            Thread.sleep(500L);
-        } catch (InterruptedException ignored) {
+            ExtendedRobot robot = new ExtendedRobot();
+            robot.waitForIdle(500);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
         }
     }
 }
diff --git a/jdk/test/java/awt/TextArea/DisposeTest/TestDispose.java b/jdk/test/java/awt/TextArea/DisposeTest/TestDispose.java
index 91c795fbfee..47c534be94f 100644
--- a/jdk/test/java/awt/TextArea/DisposeTest/TestDispose.java
+++ b/jdk/test/java/awt/TextArea/DisposeTest/TestDispose.java
@@ -35,14 +35,12 @@
 import java.awt.FlowLayout;
 import java.awt.Frame;
 import java.awt.TextArea;
-import java.awt.Toolkit;
+import java.awt.Robot;
 import java.lang.reflect.InvocationTargetException;
 
 import javax.swing.JFrame;
 import javax.swing.SwingUtilities;
 
-import sun.awt.SunToolkit;
-
 public class TestDispose {
 
     public static Frame frame = null;
@@ -51,7 +49,14 @@ public class TestDispose {
 
     public void testDispose() throws InvocationTargetException,
             InterruptedException {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot;
+        try {
+            robot = new Robot();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
+
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
@@ -69,7 +74,7 @@ public class TestDispose {
                 frame.setVisible(true);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
@@ -77,7 +82,7 @@ public class TestDispose {
                 frame.dispose();
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
     }
 
     public static void main(String[] args) throws Exception{
diff --git a/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java b/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java
index d3de4954591..94f1d911f89 100644
--- a/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java
+++ b/jdk/test/java/awt/TextArea/TextAreaCaretVisibilityTest/bug7129742.java
@@ -34,7 +34,7 @@
 
 import java.awt.FlowLayout;
 import java.awt.TextArea;
-import java.awt.Toolkit;
+import java.awt.Robot;
 import java.lang.reflect.Field;
 
 import javax.swing.JFrame;
@@ -42,7 +42,6 @@ import javax.swing.JTextArea;
 import javax.swing.SwingUtilities;
 import javax.swing.text.DefaultCaret;
 
-import sun.awt.SunToolkit;
 
 public class bug7129742 {
 
@@ -51,7 +50,7 @@ public class bug7129742 {
     public static boolean fastreturn = false;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
@@ -88,7 +87,7 @@ public class bug7129742 {
                 }
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
diff --git a/jdk/test/java/awt/TextArea/TextAreaTwicePack/TextAreaTwicePack.java b/jdk/test/java/awt/TextArea/TextAreaTwicePack/TextAreaTwicePack.java
index eba92a50063..e134c386c05 100644
--- a/jdk/test/java/awt/TextArea/TextAreaTwicePack/TextAreaTwicePack.java
+++ b/jdk/test/java/awt/TextArea/TextAreaTwicePack/TextAreaTwicePack.java
@@ -24,9 +24,8 @@
 import java.awt.Dimension;
 import java.awt.Frame;
 import java.awt.TextArea;
-import java.awt.Toolkit;
+import java.awt.Robot;
 
-import sun.awt.SunToolkit;
 
 /**
  * @test
@@ -55,10 +54,12 @@ public final class TextAreaTwicePack {
     }
 
     private static void sleep() {
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
         try {
+            Robot robot = new Robot();
+            robot.waitForIdle();
             Thread.sleep(500L);
-        } catch (InterruptedException ignored) {
+        } catch (Exception ignored) {
+            ignored.printStackTrace();
         }
     }
 }
diff --git a/jdk/test/java/awt/TextField/DisposeTest/TestDispose.java b/jdk/test/java/awt/TextField/DisposeTest/TestDispose.java
index 6ef00cd215d..a4adbc2b229 100644
--- a/jdk/test/java/awt/TextField/DisposeTest/TestDispose.java
+++ b/jdk/test/java/awt/TextField/DisposeTest/TestDispose.java
@@ -35,14 +35,12 @@
 import java.awt.FlowLayout;
 import java.awt.Frame;
 import java.awt.TextField;
-import java.awt.Toolkit;
+import java.awt.Robot;
 import java.lang.reflect.InvocationTargetException;
 
 import javax.swing.JFrame;
 import javax.swing.SwingUtilities;
 
-import sun.awt.SunToolkit;
-
 public class TestDispose {
 
     public static Frame frame = null;
@@ -51,7 +49,13 @@ public class TestDispose {
 
     public void testDispose() throws InvocationTargetException,
             InterruptedException {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot;
+        try {
+            robot = new Robot();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
@@ -69,7 +73,7 @@ public class TestDispose {
                 frame.setVisible(true);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
@@ -77,7 +81,7 @@ public class TestDispose {
                 frame.dispose();
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
     }
 
diff --git a/jdk/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java b/jdk/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java
index 4d5dd7295f6..5220546fd63 100644
--- a/jdk/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java
+++ b/jdk/test/java/awt/TrayIcon/PopupMenuLeakTest/PopupMenuLeakTest.java
@@ -26,12 +26,13 @@
   @bug 8007220
   @summary Reference to the popup leaks after the TrayIcon is removed
   @author Petr Pchelko
+  @library ../../../../lib/testlibrary/
+  @build ExtendedRobot
   @run main/othervm -Xmx50m PopupMenuLeakTest
  */
 
 import java.awt.*;
 import javax.swing.SwingUtilities;
-import sun.awt.SunToolkit;
 
 import java.awt.image.BufferedImage;
 import java.lang.ref.WeakReference;
@@ -42,8 +43,10 @@ public class PopupMenuLeakTest {
 
     static final AtomicReference<WeakReference<TrayIcon>> iconWeakReference = new AtomicReference<>();
     static final AtomicReference<WeakReference<PopupMenu>> popupWeakReference = new AtomicReference<>();
+    static ExtendedRobot robot;
 
     public static void main(String[] args) throws Exception {
+        robot = new ExtendedRobot();
         SwingUtilities.invokeAndWait(PopupMenuLeakTest::createSystemTrayIcon);
         sleep();
         // To make the test automatic we explicitly call addNotify on a popup to create the peer
@@ -141,9 +144,6 @@ public class PopupMenuLeakTest {
     }
 
     private static void sleep() {
-        ((SunToolkit)Toolkit.getDefaultToolkit()).realSync();
-        try {
-            Thread.sleep(100);
-        } catch (InterruptedException ignored) { }
+        robot.waitForIdle(100);
     }
 }
diff --git a/jdk/test/java/awt/Window/8027025/Test8027025.java b/jdk/test/java/awt/Window/8027025/Test8027025.java
index 44988904419..e798354264f 100644
--- a/jdk/test/java/awt/Window/8027025/Test8027025.java
+++ b/jdk/test/java/awt/Window/8027025/Test8027025.java
@@ -28,8 +28,6 @@
  * @run main Test8027025
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 import java.util.concurrent.atomic.AtomicReference;
@@ -49,7 +47,8 @@ public class Test8027025 {
                 window.setVisible(true);
             });
 
-            ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+            Robot robot = new Robot();
+            robot.waitForIdle();
 
             AtomicReference<Point> point = new AtomicReference<>();
             SwingUtilities.invokeAndWait(() -> point.set(window.getLocationOnScreen()));
diff --git a/jdk/test/java/awt/Window/AlwaysOnTop/AlwaysOnTopFieldTest.java b/jdk/test/java/awt/Window/AlwaysOnTop/AlwaysOnTopFieldTest.java
index 965eb7f5b07..5cfaa00419c 100644
--- a/jdk/test/java/awt/Window/AlwaysOnTop/AlwaysOnTopFieldTest.java
+++ b/jdk/test/java/awt/Window/AlwaysOnTop/AlwaysOnTopFieldTest.java
@@ -22,9 +22,8 @@
  */
 import java.awt.Dialog;
 import java.awt.Frame;
-import java.awt.Toolkit;
+import java.awt.Robot;
 import java.awt.Window;
-import sun.awt.SunToolkit;
 /**
  * @test
  * @bug 7081594
@@ -35,19 +34,25 @@ import sun.awt.SunToolkit;
 public class AlwaysOnTopFieldTest {
 
     public static void main(String[] args) {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot;
+        try {
+            robot = new Robot();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
 
         Window window = new Frame("Window 1");
         window.setSize(200, 200);
         window.setAlwaysOnTop(true);
         window.setVisible(true);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         Dialog dialog = new Dialog(window, "Owned dialog 1");
         dialog.setSize(200, 200);
         dialog.setLocation(100, 100);
         dialog.setVisible(true);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         try {
             if (!window.isAlwaysOnTop()) {
@@ -64,17 +69,17 @@ public class AlwaysOnTopFieldTest {
         window = new Frame("Window 2");
         window.setSize(200, 200);
         window.setVisible(true);
-        toolkit.realSync();
+        robot.waitForIdle();
 
 
         dialog = new Dialog(window, "Owned dialog 2");
         dialog.setSize(200, 200);
         dialog.setLocation(100, 100);
         dialog.setVisible(true);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         window.setAlwaysOnTop(true);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         try {
             if (!window.isAlwaysOnTop()) {
diff --git a/jdk/test/java/awt/Window/OwnedWindowsSerialization/OwnedWindowsSerialization.java b/jdk/test/java/awt/Window/OwnedWindowsSerialization/OwnedWindowsSerialization.java
index 864c5add1df..9100c500674 100644
--- a/jdk/test/java/awt/Window/OwnedWindowsSerialization/OwnedWindowsSerialization.java
+++ b/jdk/test/java/awt/Window/OwnedWindowsSerialization/OwnedWindowsSerialization.java
@@ -21,8 +21,6 @@
  * questions.
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 import java.io.ByteArrayInputStream;
@@ -54,7 +52,8 @@ public class OwnedWindowsSerialization {
             subDialog = new Dialog(dialog, SUBDIALOG_LABEL);
         });
 
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        Robot robot = new Robot();
+        robot.waitForIdle();
 
         if (!topFrame.isAlwaysOnTop() || !dialog.isAlwaysOnTop() || !subDialog.isAlwaysOnTop()) {
             throw new RuntimeException("TEST FAILED: AlwaysOnTop was not set properly");
diff --git a/jdk/test/java/awt/event/TextEvent/TextEventSequenceTest/TextEventSequenceTest.java b/jdk/test/java/awt/event/TextEvent/TextEventSequenceTest/TextEventSequenceTest.java
index 7836b086f4e..0c06ba162eb 100644
--- a/jdk/test/java/awt/event/TextEvent/TextEventSequenceTest/TextEventSequenceTest.java
+++ b/jdk/test/java/awt/event/TextEvent/TextEventSequenceTest/TextEventSequenceTest.java
@@ -30,7 +30,6 @@
  */
 import java.awt.*;
 import java.awt.event.*;
-import sun.awt.SunToolkit;
 
 public class TextEventSequenceTest {
 
@@ -48,43 +47,50 @@ public class TextEventSequenceTest {
     }
 
     private static void test(String test) {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        Robot robot;
+        try {
+            robot = new Robot();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
 
         createAndShowGUI(test);
-        toolkit.realSync();
+        robot.waitForIdle();
 
         initCounts();
         t.setText("Hello ");
-        toolkit.realSync();
+        robot.waitForIdle();
         t.append("World! !");
-        toolkit.realSync();
+        robot.waitForIdle();
         t.insert("from Roger Pham", 13);
-        toolkit.realSync();
+        robot.waitForIdle();
         t.replaceRange("Java Duke", 18, 28);
-        toolkit.realSync();
+        robot.waitForIdle();
         checkCounts(0, 4);
 
         initCounts();
         t.setText("");
-        toolkit.realSync();
+        robot.waitForIdle();
         t.setText("");
-        toolkit.realSync();
+        robot.waitForIdle();
         t.setText("");
-        toolkit.realSync();
+        robot.waitForIdle();
         checkCounts(1, 0);
 
         initCounts();
         tf.setText("Hello There!");
-        toolkit.realSync();
+        robot.waitForIdle();
         checkCounts(0, 1);
 
         initCounts();
         tf.setText("");
-        toolkit.realSync();
+        robot.waitForIdle();
         tf.setText("");
-        toolkit.realSync();
+        robot.waitForIdle();
         tf.setText("");
-        toolkit.realSync();
+        robot.waitForIdle();
         checkCounts(1, 0);
 
         f.dispose();
diff --git a/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java b/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java
index 298059054d9..25e03d61646 100644
--- a/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java
+++ b/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeCrashTest.java
@@ -26,26 +26,25 @@
   @bug 8041490
   @summary tests that the WarningWindow's surface is invalidated on dispose
   @author Petr Pchelko
-  @run main/othervm WarningWindowDisposeCrashTest
+  @run main/othervm/policy=policy  -Djava.security.manager WarningWindowDisposeCrashTest
 */
 
 
-import sun.applet.AppletSecurity;
-import sun.awt.SunToolkit;
 
 import java.awt.*;
 
 public class WarningWindowDisposeCrashTest {
     public static void main(String[] args) throws Exception {
-        System.setSecurityManager(new AppletSecurity() {
-            @Override
-            public void checkPackageAccess (String s){
-            }
-        });
-
         Frame f = new Frame();
         f.setVisible(true);
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        Robot robot;
+        try{
+            robot = new Robot();
+            robot.waitForIdle();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Cannot create Robot");
+        }
         Thread.sleep(1000);
         f.dispose();
         // If the bug is present VM could crash after this call
diff --git a/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeTest.java b/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeTest.java
index 6f0149dc4d1..3f525e967d9 100644
--- a/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeTest.java
+++ b/jdk/test/java/awt/security/WarningWindowDisposeTest/WarningWindowDisposeTest.java
@@ -31,12 +31,11 @@
   @run main WarningWindowDisposeTest
 */
 
-import sun.applet.AppletSecurity;
-import sun.awt.SunToolkit;
-
 import java.awt.*;
 import java.awt.Toolkit;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.security.Permission;
+import java.io.File;
 
 import test.java.awt.regtesthelpers.process.ProcessCommunicator;
 import test.java.awt.regtesthelpers.process.ProcessResults;
@@ -57,7 +56,9 @@ public class WarningWindowDisposeTest {
         }, "TimeoutThread").start();
 
         String classpath = System.getProperty("java.class.path");
-        ProcessResults pres = ProcessCommunicator.executeChildProcess(TestApplication.class, classpath, new String[0]);
+        String policyPath = System.getProperty("test.src")+File.separatorChar+"policy";
+        System.out.println("policyPath in main: "+policyPath);
+        ProcessResults pres = ProcessCommunicator.executeChildProcess(TestApplication.class, classpath+" -Djava.security.manager -Djava.security.policy="+policyPath, new String[0]);
         passed.set(true);
         if (pres.getStdErr() != null && pres.getStdErr().length() > 0) {
             System.err.println("========= Child VM System.err ========");
@@ -74,14 +75,16 @@ public class WarningWindowDisposeTest {
 
     public static class TestApplication {
         public static void main(String[] args) throws Exception {
-            System.setSecurityManager(new AppletSecurity() {
-                @Override
-                public void checkPackageAccess (String s){
-                }
-            });
+            Robot robot;
+            try{
+                robot = new Robot();
+            }catch(Exception ex) {
+                ex.printStackTrace();
+                throw new RuntimeException("Cannot create Robot");
+            }
             Frame f = new Frame("Test frame");
             f.setVisible(true);
-            ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+            robot.waitForIdle();
             Thread.sleep(500);
             f.setVisible(false);
             f.dispose();

From 41d2bc7e75c358daf3c0def4bbbdcc8371ed46f1 Mon Sep 17 00:00:00 2001
From: Yuri Nesterenko <yan@openjdk.org>
Date: Mon, 10 Nov 2014 16:37:40 +0300
Subject: [PATCH 051/299] 8063106: Change open swing regression tests to avoid
 sun.awt.SunToolkit.realSync, part 1

Reviewed-by: pchelko, serb
---
 .../plaf/windows/8016551/bug8016551.java      |   7 +-
 .../CompEventOnHiddenComponent.java           | 441 ++++++++++++++++++
 .../Window/GetWindowsTest/GetWindowsTest.java | 271 +++++++++++
 .../HandleWindowDestroyTest.html              |  23 +
 .../HandleWindowDestroyTest.java              |  96 ++++
 .../MovedResizedTwiceTest.java                | 276 +++++++++++
 .../security/WarningWindowDisposeTest/policy  |   3 +
 .../JButtonPaintNPE/JButtonPaintNPE.java      |  15 +-
 .../swing/JComboBox/6406264/bug6406264.java   | 118 +++++
 .../swing/JComboBox/8015300/Test8015300.java  |  17 +-
 .../ShowPopupAfterHidePopupTest.java          |   9 +-
 .../swing/JComponent/6989617/bug6989617.java  |  12 +-
 .../swing/JEditorPane/4492274/bug4492274.java |   9 +-
 .../JInternalFrame/4251301/bug4251301.java    |   9 +-
 .../JInternalFrame/6647340/bug6647340.java    |  31 +-
 .../JInternalFrame/6725409/bug6725409.java    |  23 +-
 .../swing/JLayer/6824395/bug6824395.java      |  12 +-
 .../swing/JPopupMenu/6583251/bug6583251.java  |  77 +++
 .../swing/JPopupMenu/6691503/bug6691503.java  |  10 +-
 .../swing/JPopupMenu/6694823/bug6694823.java  |  19 +-
 .../swing/JScrollBar/4865918/bug4865918.java  |   7 +-
 .../swing/JScrollPane/6274267/bug6274267.java | 100 ++++
 .../swing/JSpinner/8008657/bug8008657.java    |  17 +-
 .../swing/JSplitPane/4816114/bug4816114.java  |   7 +-
 .../JTabbedPane/7024235/Test7024235.java      |  14 +-
 .../swing/JTabbedPane/7170310/bug7170310.java |  17 +-
 .../swing/JTabbedPane/8017284/bug8017284.java |   7 +-
 .../swing/JTable/8032874/bug8032874.java      |   8 +-
 .../swing/JTextArea/7049024/bug7049024.java   |  14 +-
 .../swing/JToolBar/4529206/bug4529206.java    |  91 ++++
 .../swing/JViewport/7107099/bug7107099.java   |   9 +-
 .../javax/swing/Popup/6514582/bug6514582.java |  73 +++
 .../IconifyTest/IconifyTest.java              |   7 +-
 .../swing/Security/6657138/ComponentTest.java |   8 +-
 jdk/test/javax/swing/SwingTest.java           |   8 +-
 .../swing/text/Utilities/bug7045593.java      |   5 +-
 .../swing/text/View/8048110/bug8048110.java   |   7 +-
 .../swing/text/html/7189299/bug7189299.java   |   7 +-
 .../html/HTMLDocument/8058120/bug8058120.java |  14 +-
 .../HTMLEditorKit/4242228/bug4242228.java     |   5 +-
 .../parser/Parser/7165725/bug7165725.java     |   6 +-
 41 files changed, 1760 insertions(+), 149 deletions(-)
 create mode 100644 jdk/test/java/awt/Component/CompEventOnHiddenComponent/CompEventOnHiddenComponent.java
 create mode 100644 jdk/test/java/awt/Window/GetWindowsTest/GetWindowsTest.java
 create mode 100644 jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.html
 create mode 100644 jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.java
 create mode 100644 jdk/test/java/awt/event/ComponentEvent/MovedResizedTwiceTest/MovedResizedTwiceTest.java
 create mode 100644 jdk/test/java/awt/security/WarningWindowDisposeTest/policy
 create mode 100644 jdk/test/javax/swing/JComboBox/6406264/bug6406264.java
 create mode 100644 jdk/test/javax/swing/JPopupMenu/6583251/bug6583251.java
 create mode 100644 jdk/test/javax/swing/JScrollPane/6274267/bug6274267.java
 create mode 100644 jdk/test/javax/swing/JToolBar/4529206/bug4529206.java
 create mode 100644 jdk/test/javax/swing/Popup/6514582/bug6514582.java

diff --git a/jdk/test/com/sun/java/swing/plaf/windows/8016551/bug8016551.java b/jdk/test/com/sun/java/swing/plaf/windows/8016551/bug8016551.java
index 35e55f09174..23c46ff533d 100644
--- a/jdk/test/com/sun/java/swing/plaf/windows/8016551/bug8016551.java
+++ b/jdk/test/com/sun/java/swing/plaf/windows/8016551/bug8016551.java
@@ -30,8 +30,7 @@
 
 import javax.swing.*;
 import java.awt.Graphics;
-import java.awt.Toolkit;
-import sun.awt.SunToolkit;
+import java.awt.Robot;
 
 public class bug8016551 {
     private static volatile RuntimeException exception = null;
@@ -64,8 +63,8 @@ public class bug8016551 {
             }
         });
 
-        SunToolkit tk = (SunToolkit)Toolkit.getDefaultToolkit();
-        tk.realSync();
+        Robot robot = new Robot();
+        robot.waitForIdle();
 
         if (exception != null) {
             throw exception;
diff --git a/jdk/test/java/awt/Component/CompEventOnHiddenComponent/CompEventOnHiddenComponent.java b/jdk/test/java/awt/Component/CompEventOnHiddenComponent/CompEventOnHiddenComponent.java
new file mode 100644
index 00000000000..43a6d326702
--- /dev/null
+++ b/jdk/test/java/awt/Component/CompEventOnHiddenComponent/CompEventOnHiddenComponent.java
@@ -0,0 +1,441 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 6383903
+  @summary REGRESSION: componentMoved is now getting called for some hidden components
+  @author andrei.dmitriev: area=awt.component
+  @run main CompEventOnHiddenComponent
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+import javax.swing.*;
+
+public class CompEventOnHiddenComponent
+{
+    transient static boolean moved = false;
+    transient static boolean resized = false;
+
+    transient static boolean ancestor_moved = false;
+    transient static boolean ancestor_resized = false;
+    static String passed = "";
+
+    private static void init()
+    {
+        String[] instructions =
+        {
+            "This is an AUTOMATIC test, simply wait until it is done.",
+            "The result (passed or failed) will be shown in the",
+            "message window below."
+        };
+        Sysout.createDialog( );
+        Sysout.printInstructions( instructions );
+
+        Robot robot;
+        try {
+            robot = new Robot();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
+
+        EventQueue.invokeLater(new Runnable(){
+                public void run(){
+                    JFrame f = new JFrame("JFrame");
+                    JButton b = new JButton("JButton");
+                    f.add(b);
+                    new JOptionPane().
+                        createInternalFrame(b, "Test").
+                        addComponentListener(new ComponentAdapter() {
+                                public void componentMoved(ComponentEvent e) {
+                                    moved = true;
+                                    System.out.println(e);
+                                }
+                                public void componentResized(ComponentEvent e) {
+                                    resized = true;
+                                    System.out.println(e);
+                                }
+                            });
+                }
+            });
+
+        robot.waitForIdle();
+
+        if (moved || resized){
+            passed = "Hidden component got COMPONENT_MOVED or COMPONENT_RESIZED event";
+        } else {
+            System.out.println("Stage 1 passed.");
+        }
+
+        EventQueue.invokeLater(new Runnable() {
+                public void run() {
+                    JFrame parentWindow = new JFrame("JFrame 1");
+                    JButton component = new JButton("JButton 1");;
+                    JButton smallButton = new JButton("Small Button");
+
+
+                    smallButton.addHierarchyBoundsListener(new HierarchyBoundsAdapter() {
+                            public void ancestorMoved(HierarchyEvent e) {
+                                ancestor_moved = true;
+                                System.out.println("SMALL COMPONENT >>>>>"+e);
+                            }
+                            public void ancestorResized(HierarchyEvent e) {
+                                ancestor_resized = true;
+                                System.out.println("SMALL COMPONENT >>>>>"+e);
+                            }
+                        });
+
+
+                    parentWindow.add(component);
+                    component.add(smallButton);
+
+                    component.setSize(100, 100);
+                    component.setLocation(100, 100);
+
+                }
+            });
+
+        robot.waitForIdle();
+
+        if (!ancestor_resized || !ancestor_moved){
+            passed = "Hidden component didn't get ANCESTOR event";
+        } else {
+            System.out.println("Stage 2 passed.");
+        }
+
+        robot.waitForIdle();
+
+        if (passed.equals("")){
+            CompEventOnHiddenComponent.pass();
+        } else {
+            CompEventOnHiddenComponent.fail(passed);
+        }
+
+    }//End  init()
+
+
+
+    /*****************************************************
+     * Standard Test Machinery Section
+     * DO NOT modify anything in this section -- it's a
+     * standard chunk of code which has all of the
+     * synchronisation necessary for the test harness.
+     * By keeping it the same in all tests, it is easier
+     * to read and understand someone else's test, as
+     * well as insuring that all tests behave correctly
+     * with the test harness.
+     * There is a section following this for test-
+     * classes
+     ******************************************************/
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+
+    private static Thread mainThread = null;
+
+    private static int sleepTime = 300000;
+
+    // Not sure about what happens if multiple of this test are
+    //  instantiated in the same VM.  Being static (and using
+    //  static vars), it aint gonna work.  Not worrying about
+    //  it for now.
+    public static void main( String args[] ) throws InterruptedException
+    {
+        mainThread = Thread.currentThread();
+        try
+        {
+            init();
+        }
+        catch( TestPassedException e )
+        {
+            //The test passed, so just return from main and harness will
+            // interepret this return as a pass
+            return;
+        }
+        //At this point, neither test pass nor test fail has been
+        // called -- either would have thrown an exception and ended the
+        // test, so we know we have multiple threads.
+
+        //Test involves other threads, so sleep and wait for them to
+        // called pass() or fail()
+        try
+        {
+            Thread.sleep( sleepTime );
+            //Timed out, so fail the test
+            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+        }
+        catch (InterruptedException e)
+        {
+            //The test harness may have interrupted the test.  If so, rethrow the exception
+            // so that the harness gets it and deals with it.
+            if( ! testGeneratedInterrupt ) throw e;
+
+            //reset flag in case hit this code more than once for some reason (just safety)
+            testGeneratedInterrupt = false;
+
+            if ( theTestPassed == false )
+            {
+                throw new RuntimeException( failureMessage );
+            }
+        }
+
+    }//main
+
+    public static synchronized void setTimeoutTo( int seconds )
+    {
+        sleepTime = seconds * 1000;
+    }
+
+    public static synchronized void pass()
+    {
+        Sysout.println( "The test passed." );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //first check if this is executing in main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //Still in the main thread, so set the flag just for kicks,
+            // and throw a test passed exception which will be caught
+            // and end the test.
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }//pass()
+
+    public static synchronized void fail()
+    {
+        //test writer didn't specify why test failed, so give generic
+        fail( "it just plain failed! :-)" );
+    }
+
+    public static synchronized void fail( String whyFailed )
+    {
+        Sysout.println( "The test failed: " + whyFailed );
+        Sysout.println( "The test is over, hit  Ctl-C to stop Java VM" );
+        //check if this called from main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //If main thread, fail now 'cause not sleeping
+            throw new RuntimeException( whyFailed );
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed;
+        mainThread.interrupt();
+    }//fail()
+
+}// class CompEventOnHiddenComponent
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException
+{
+}
+
+//*********** End Standard Test Machinery Section **********
+
+
+//************ Begin classes defined for the test ****************
+
+// if want to make listeners, here is the recommended place for them, then instantiate
+//  them in init()
+
+/* Example of a class which may be written as part of a test
+class NewClass implements anInterface
+ {
+   static int newVar = 0;
+
+   public void eventDispatched(AWTEvent e)
+    {
+      //Counting events to see if we get enough
+      eventCount++;
+
+      if( eventCount == 20 )
+       {
+         //got enough events, so pass
+
+         CompEventOnHiddenComponent.pass();
+       }
+      else if( tries == 20 )
+       {
+         //tried too many times without getting enough events so fail
+
+         CompEventOnHiddenComponent.fail();
+       }
+
+    }// eventDispatched()
+
+ }// NewClass class
+
+*/
+
+
+//************** End classes defined for the test *******************
+
+
+
+
+/****************************************************
+ Standard Test Machinery
+ DO NOT modify anything below -- it's a standard
+  chunk of code whose purpose is to make user
+  interaction uniform, and thereby make it simpler
+  to read and understand someone else's test.
+ ****************************************************/
+
+/**
+ This is part of the standard test machinery.
+ It creates a dialog (with the instructions), and is the interface
+  for sending text messages to the user.
+ To print the instructions, send an array of strings to Sysout.createDialog
+  WithInstructions method.  Put one line of instructions per array entry.
+ To display a message for the tester to see, simply call Sysout.println
+  with the string to be displayed.
+ This mimics System.out.println but works within the test harness as well
+  as standalone.
+ */
+
+class Sysout
+{
+    private static TestDialog dialog;
+
+    public static void createDialogWithInstructions( String[] instructions )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        dialog.printInstructions( instructions );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+    public static void createDialog( )
+    {
+        dialog = new TestDialog( new Frame(), "Instructions" );
+        String[] defInstr = { "Instructions will appear here. ", "" } ;
+        dialog.printInstructions( defInstr );
+        dialog.setVisible(true);
+        println( "Any messages for the tester will display here." );
+    }
+
+
+    public static void printInstructions( String[] instructions )
+    {
+        dialog.printInstructions( instructions );
+    }
+
+
+    public static void println( String messageIn )
+    {
+        dialog.displayMessage( messageIn );
+        System.out.println(messageIn);
+    }
+
+}// Sysout  class
+
+/**
+  This is part of the standard test machinery.  It provides a place for the
+   test instructions to be displayed, and a place for interactive messages
+   to the user to be displayed.
+  To have the test instructions displayed, see Sysout.
+  To have a message to the user be displayed, see Sysout.
+  Do not call anything in this dialog directly.
+  */
+class TestDialog extends Dialog
+{
+
+    TextArea instructionsText;
+    TextArea messageText;
+    int maxStringLength = 80;
+
+    //DO NOT call this directly, go through Sysout
+    public TestDialog( Frame frame, String name )
+    {
+        super( frame, name );
+        int scrollBoth = TextArea.SCROLLBARS_BOTH;
+        instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth );
+        add( "North", instructionsText );
+
+        messageText = new TextArea( "", 5, maxStringLength, scrollBoth );
+        add("Center", messageText);
+
+        pack();
+
+        setVisible(true);
+    }// TestDialog()
+
+    //DO NOT call this directly, go through Sysout
+    public void printInstructions( String[] instructions )
+    {
+        //Clear out any current instructions
+        instructionsText.setText( "" );
+
+        //Go down array of instruction strings
+
+        String printStr, remainingStr;
+        for( int i=0; i < instructions.length; i++ )
+        {
+            //chop up each into pieces maxSringLength long
+            remainingStr = instructions[ i ];
+            while( remainingStr.length() > 0 )
+            {
+                //if longer than max then chop off first max chars to print
+                if( remainingStr.length() >= maxStringLength )
+                {
+                    //Try to chop on a word boundary
+                    int posOfSpace = remainingStr.
+                        lastIndexOf( ' ', maxStringLength - 1 );
+
+                    if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1;
+
+                    printStr = remainingStr.substring( 0, posOfSpace + 1 );
+                    remainingStr = remainingStr.substring( posOfSpace + 1 );
+                }
+                //else just print
+                else
+                {
+                    printStr = remainingStr;
+                    remainingStr = "";
+                }
+
+                instructionsText.append( printStr + "\n" );
+
+            }// while
+
+        }// for
+
+    }//printInstructions()
+
+    //DO NOT call this directly, go through Sysout
+    public void displayMessage( String messageIn )
+    {
+        messageText.append( messageIn + "\n" );
+        System.out.println(messageIn);
+    }
+
+}// TestDialog  class
diff --git a/jdk/test/java/awt/Window/GetWindowsTest/GetWindowsTest.java b/jdk/test/java/awt/Window/GetWindowsTest/GetWindowsTest.java
new file mode 100644
index 00000000000..e1a9482cd39
--- /dev/null
+++ b/jdk/test/java/awt/Window/GetWindowsTest/GetWindowsTest.java
@@ -0,0 +1,271 @@
+/*
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 6322270
+  @summary Test for new API introduced in the fix for 6322270: Window.getWindows(),
+Window.getOwnerlessWindows() and Frame.getFrames()
+  @author artem.ananiev: area=awt.toplevel
+  @run main GetWindowsTest
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+
+import java.util.*;
+
+public class GetWindowsTest
+{
+    private static Vector<Window> frames = new Vector<Window>();
+    private static Vector<Window> windows = new Vector<Window>();
+    private static Vector<Window> ownerless = new Vector<Window>();
+
+    private static void init()
+    {
+        Frame f1 = new Frame("F1");
+        f1.setBounds(100, 100, 100, 100);
+        f1.setVisible(true);
+        addToWindowsList(f1);
+
+        Dialog d1 = new Dialog(f1, "D1", Dialog.ModalityType.MODELESS);
+        d1.setBounds(120, 120, 100, 100);
+        d1.setVisible(true);
+        addToWindowsList(d1);
+
+        Window w1 = new Window(d1);
+        w1.setBounds(140, 140, 100, 100);
+        w1.setVisible(true);
+        addToWindowsList(w1);
+
+        Frame f2 = new Frame("F2");
+        f2.setBounds(300, 100, 100, 100);
+        f2.setVisible(true);
+        addToWindowsList(f2);
+
+        Window w2 = new Window(f2);
+        w2.setBounds(320, 120, 100, 100);
+        w2.setVisible(true);
+        addToWindowsList(w2);
+
+        Dialog d2 = new Dialog(f2, "D2", Dialog.ModalityType.MODELESS);
+        d2.setBounds(340, 140, 100, 100);
+        d2.setVisible(true);
+        addToWindowsList(d2);
+
+        Dialog d3 = new Dialog((Frame)null, "D3", Dialog.ModalityType.MODELESS);
+        d3.setBounds(500, 100, 100, 100);
+        d3.setVisible(true);
+        addToWindowsList(d3);
+
+        Dialog d4 = new Dialog(d3, "D4", Dialog.ModalityType.MODELESS);
+        d4.setBounds(520, 120, 100, 100);
+        d4.setVisible(true);
+        addToWindowsList(d4);
+
+        Window w3 = new Window((Frame)null);
+        w3.setBounds(700, 100, 100, 100);
+        w3.setVisible(true);
+        addToWindowsList(w3);
+
+        Window w4 = new Window(w3);
+        w4.setBounds(720, 120, 100, 100);
+        w4.setVisible(true);
+        addToWindowsList(w4);
+
+        try {
+            Robot robot = new Robot();
+            robot.waitForIdle();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new Error("Unexpected failure");
+        }
+
+        Frame[] fl = Frame.getFrames();
+        Vector<Window> framesToCheck = new Vector<Window>();
+        for (Frame f : fl)
+        {
+            framesToCheck.add(f);
+        }
+        checkWindowsList(frames, framesToCheck, "Frame.getFrames()");
+
+        Window[] wl = Window.getWindows();
+        Vector<Window> windowsToCheck = new Vector<Window>();
+        for (Window w : wl)
+        {
+            windowsToCheck.add(w);
+        }
+        checkWindowsList(windows, windowsToCheck, "Window.getWindows()");
+
+        Window[] ol = Window.getOwnerlessWindows();
+        Vector<Window> ownerlessToCheck = new Vector<Window>();
+        for (Window o : ol)
+        {
+            ownerlessToCheck.add(o);
+        }
+        checkWindowsList(ownerless, ownerlessToCheck, "Window.getOwnerlessWindows()");
+
+        GetWindowsTest.pass();
+    }
+
+    private static void addToWindowsList(Window w)
+    {
+        if (w instanceof Frame)
+        {
+            frames.add(w);
+        }
+        windows.add(w);
+        if (w.getOwner() == null)
+        {
+            ownerless.add(w);
+        }
+    }
+
+    private static void checkWindowsList(Vector<Window> wl1, Vector<Window> wl2, String methodName)
+    {
+        if ((wl1.size() != wl2.size()) ||
+            !wl1.containsAll(wl2) ||
+            !wl2.containsAll(wl1))
+        {
+            fail("Test FAILED: method " + methodName + " returns incorrect list of windows");
+        }
+    }
+
+/*****************************************************
+ * Standard Test Machinery Section
+ * DO NOT modify anything in this section -- it's a
+ * standard chunk of code which has all of the
+ * synchronisation necessary for the test harness.
+ * By keeping it the same in all tests, it is easier
+ * to read and understand someone else's test, as
+ * well as insuring that all tests behave correctly
+ * with the test harness.
+ * There is a section following this for test-
+ * classes
+ ******************************************************/
+
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+
+    private static Thread mainThread = null;
+
+    private static int sleepTime = 300000;
+
+    // Not sure about what happens if multiple of this test are
+    //  instantiated in the same VM.  Being static (and using
+    //  static vars), it aint gonna work.  Not worrying about
+    //  it for now.
+    public static void main( String args[] ) throws InterruptedException
+    {
+        mainThread = Thread.currentThread();
+        try
+        {
+            init();
+        }
+        catch( TestPassedException e )
+        {
+            //The test passed, so just return from main and harness will
+            // interepret this return as a pass
+            return;
+        }
+        //At this point, neither test pass nor test fail has been
+        // called -- either would have thrown an exception and ended the
+        // test, so we know we have multiple threads.
+
+        //Test involves other threads, so sleep and wait for them to
+        // called pass() or fail()
+        try
+        {
+            Thread.sleep( sleepTime );
+            //Timed out, so fail the test
+            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+        }
+        catch (InterruptedException e)
+        {
+            //The test harness may have interrupted the test.  If so, rethrow the exception
+            // so that the harness gets it and deals with it.
+            if( ! testGeneratedInterrupt ) throw e;
+
+            //reset flag in case hit this code more than once for some reason (just safety)
+            testGeneratedInterrupt = false;
+
+            if ( theTestPassed == false )
+            {
+                throw new RuntimeException( failureMessage );
+            }
+        }
+    }
+
+    public static synchronized void setTimeoutTo( int seconds )
+    {
+        sleepTime = seconds * 1000;
+    }
+
+    public static synchronized void pass()
+    {
+        //first check if this is executing in main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //Still in the main thread, so set the flag just for kicks,
+            // and throw a test passed exception which will be caught
+            // and end the test.
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    public static synchronized void fail()
+    {
+        //test writer didn't specify why test failed, so give generic
+        fail( "it just plain failed! :-)" );
+    }
+
+    public static synchronized void fail( String whyFailed )
+    {
+        //check if this called from main thread
+        if ( mainThread == Thread.currentThread() )
+        {
+            //If main thread, fail now 'cause not sleeping
+            throw new RuntimeException( whyFailed );
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed;
+        mainThread.interrupt();
+    }
+}
+
+//This exception is used to exit from any level of call nesting
+// when it's determined that the test has passed, and immediately
+// end the test.
+class TestPassedException extends RuntimeException
+{
+}
+
+//*********** End Standard Test Machinery Section **********
diff --git a/jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.html b/jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.html
new file mode 100644
index 00000000000..aea7f2317e6
--- /dev/null
+++ b/jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.html
@@ -0,0 +1,23 @@
+<html>
+<!--  
+  @test
+  @bug 6260648
+  @summary Tests that WINDOW_DESTROY event can be handled by overriding handleEvent(). Also,
+tests that handleEvent() is not called by AWT if any listener is added to the component
+(i. e. when post-1.1 events schema is used)
+  @author artem.ananiev: area=awt.event
+  @run applet HandleWindowDestroyTest.html
+  -->
+<head>
+<title>  </title>
+</head>
+<body>
+
+<h1>HandleWindowDestroyTest<br>Bug ID: 6260648</h1>
+
+<p> This is an AUTOMATIC test, simply wait for completion </p>
+
+<APPLET CODE="HandleWindowDestroyTest.class" WIDTH=200 HEIGHT=200></APPLET>
+</body>
+</html>
+
diff --git a/jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.java b/jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.java
new file mode 100644
index 00000000000..fffcf18dc3b
--- /dev/null
+++ b/jdk/test/java/awt/Window/HandleWindowDestroyTest/HandleWindowDestroyTest.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  test
+  @bug 6260648
+  @summary Tests that WINDOW_DESTROY event can be handled by overriding handleEvent(). Also,
+tests that handleEvent() is not called by AWT if any listener is added to the component
+(i. e. when post-1.1 events schema is used)
+  @author artem.ananiev: area=awt.event
+  @run applet HandleWindowDestroyTest.html
+*/
+
+import java.applet.*;
+
+import java.awt.*;
+import java.awt.event.*;
+
+public class HandleWindowDestroyTest extends Applet
+{
+    private volatile boolean handleEventCalled;
+
+    public void start ()
+    {
+        setSize (200,200);
+        setVisible(true);
+        validate();
+
+        Robot robot;
+        try {
+            robot = new Robot();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
+
+        Frame f = new Frame("Frame")
+        {
+            public boolean handleEvent(Event e)
+            {
+                if (e.id == Event.WINDOW_DESTROY)
+                {
+                    handleEventCalled = true;
+                }
+                return super.handleEvent(e);
+            }
+        };
+        f.setBounds(100, 100, 100, 100);
+        f.setVisible(true);
+        robot.waitForIdle();
+
+        handleEventCalled = false;
+        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(f, Event.WINDOW_DESTROY));
+        robot.waitForIdle();
+
+        if (!handleEventCalled)
+        {
+            throw new RuntimeException("Test FAILED: handleEvent() is not called");
+        }
+
+        f.addWindowListener(new WindowAdapter()
+        {
+        });
+
+        handleEventCalled = false;
+        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(new WindowEvent(f, Event.WINDOW_DESTROY));
+        robot.waitForIdle();
+
+        if (handleEventCalled)
+        {
+            throw new RuntimeException("Test FAILED: handleEvent() is called event with a listener added");
+        }
+    }
+}
diff --git a/jdk/test/java/awt/event/ComponentEvent/MovedResizedTwiceTest/MovedResizedTwiceTest.java b/jdk/test/java/awt/event/ComponentEvent/MovedResizedTwiceTest/MovedResizedTwiceTest.java
new file mode 100644
index 00000000000..d88c54d9fab
--- /dev/null
+++ b/jdk/test/java/awt/event/ComponentEvent/MovedResizedTwiceTest/MovedResizedTwiceTest.java
@@ -0,0 +1,276 @@
+/*
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+  @test
+  @bug 5025858
+  @summary Tests that after programmatically moving or resizing a component,
+corresponding ComponentEvents are generated only once
+  @author artem.ananiev: area=awt.event
+  @run main/manual MovedResizedTwiceTest
+*/
+
+import java.awt.*;
+import java.awt.event.*;
+
+/*
+  IMPORTANT: this test is made manual as some window managers may generate
+  strange events and that would lead to the test to fail. However, on most
+  popular platforms (windows, linux w/ KDE or GNOME, solaris w/ CDE or
+  GNOME) it usually passes successfully.
+*/
+
+public class MovedResizedTwiceTest
+{
+    private static volatile int componentMovedCount;
+    private static volatile int componentResizedCount;
+
+    private static volatile int rightX, rightY;
+
+    private static volatile boolean failed = false;
+
+    private static void init()
+    {
+        componentMovedCount = componentResizedCount = 0;
+
+        Robot robot;
+        try {
+            robot = new Robot();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Cannot create Robot: failure");
+        }
+
+        Frame f = new Frame("Frame F");
+        f.setLayout(null);
+        f.setBounds(100, 100, 100, 100);
+        f.add(new Button("Button"));
+
+        f.setVisible(true);
+        robot.waitForIdle();
+
+        ComponentListener cl = new ComponentAdapter()
+        {
+            public void componentMoved(ComponentEvent e)
+            {
+                componentMovedCount++;
+                Component c = (Component)e.getSource();
+                if (!(c instanceof Window))
+                {
+                    return;
+                }
+                Point p = c.getLocationOnScreen();
+                if ((p.x != rightX) || (p.y != rightY))
+                {
+                    System.err.println("Error: wrong location on screen after COMPONENT_MOVED");
+                    System.err.println("Location on screen is (" + p.x + ", " + p.y + ") against right location (" + rightX + ", " + rightY + ")");
+                    failed = true;
+                }
+            }
+            public void componentResized(ComponentEvent e)
+            {
+                componentResizedCount++;
+            }
+        };
+
+        f.addComponentListener(cl);
+
+        componentResizedCount = componentMovedCount = 0;
+        rightX = 100;
+        rightY = 100;
+        f.setSize(200, 200);
+        robot.waitForIdle();
+        checkResized("setSize", f);
+
+        componentResizedCount = componentMovedCount = 0;
+        rightX = 200;
+        rightY = 200;
+        f.setLocation(200, 200);
+        robot.waitForIdle();
+        checkMoved("setLocation", f);
+
+        componentResizedCount = componentMovedCount = 0;
+        rightX = 150;
+        rightY = 150;
+        f.setBounds(150, 150, 100, 100);
+        robot.waitForIdle();
+        checkResized("setBounds", f);
+        checkMoved("setBounds", f);
+
+        Button b = new Button("B");
+        b.setBounds(10, 10, 40, 40);
+        f.add(b);
+        robot.waitForIdle();
+
+        b.addComponentListener(cl);
+
+        componentResizedCount = componentMovedCount = 0;
+        b.setBounds(20, 20, 50, 50);
+        robot.waitForIdle();
+        checkMoved("setBounds", b);
+        checkResized("setBounds", b);
+        f.remove(b);
+
+        Component c = new Component() {};
+        c.setBounds(10, 10, 40, 40);
+        f.add(c);
+        robot.waitForIdle();
+
+        c.addComponentListener(cl);
+
+        componentResizedCount = componentMovedCount = 0;
+        c.setBounds(20, 20, 50, 50);
+        robot.waitForIdle();
+        checkMoved("setBounds", c);
+        checkResized("setBounds", c);
+        f.remove(c);
+
+        if (failed)
+        {
+            MovedResizedTwiceTest.fail("Test FAILED");
+        }
+        else
+        {
+            MovedResizedTwiceTest.pass();
+        }
+    }
+
+    private static void checkResized(String methodName, Component c)
+    {
+        String failMessage = null;
+        if (componentResizedCount == 1)
+        {
+            return;
+        }
+        else if (componentResizedCount == 0)
+        {
+            failMessage = "Test FAILED: COMPONENT_RESIZED is not sent after call to " + methodName + "()";
+        }
+        else
+        {
+            failMessage = "Test FAILED: COMPONENT_RESIZED is sent " + componentResizedCount + " + times after call to " + methodName + "()";
+        }
+        System.err.println("Failed component: " + c);
+        MovedResizedTwiceTest.fail(failMessage);
+    }
+
+    private static void checkMoved(String methodName, Component c)
+    {
+        String failMessage = null;
+        if (componentMovedCount == 1)
+        {
+            return;
+        }
+        if (componentMovedCount == 0)
+        {
+            failMessage = "Test FAILED: COMPONENT_MOVED is not sent after call to " + methodName + "()";
+        }
+        else
+        {
+            failMessage = "Test FAILED: COMPONENT_MOVED is sent " + componentMovedCount + " times after call to " + methodName + "()";
+        }
+        System.err.println("Failed component: " + c);
+        MovedResizedTwiceTest.fail(failMessage);
+    }
+
+    private static boolean theTestPassed = false;
+    private static boolean testGeneratedInterrupt = false;
+    private static String failureMessage = "";
+
+    private static Thread mainThread = null;
+
+    private static int sleepTime = 300000;
+
+    public static void main( String args[] ) throws InterruptedException
+    {
+        mainThread = Thread.currentThread();
+        try
+        {
+            init();
+        }
+        catch (TestPassedException e)
+        {
+            return;
+        }
+
+        try
+        {
+            Thread.sleep(sleepTime);
+            throw new RuntimeException( "Timed out after " + sleepTime/1000 + " seconds" );
+        }
+        catch (InterruptedException e)
+        {
+            if (!testGeneratedInterrupt)
+            {
+                throw e;
+            }
+
+            testGeneratedInterrupt = false;
+
+            if (!theTestPassed)
+            {
+                throw new RuntimeException( failureMessage );
+            }
+        }
+    }
+
+    public static synchronized void setTimeoutTo(int seconds)
+    {
+        sleepTime = seconds * 1000;
+    }
+
+    public static synchronized void pass()
+    {
+        if (mainThread == Thread.currentThread())
+        {
+            theTestPassed = true;
+            throw new TestPassedException();
+        }
+        theTestPassed = true;
+        testGeneratedInterrupt = true;
+        mainThread.interrupt();
+    }
+
+    public static synchronized void fail()
+    {
+        fail("it just plain failed! :-)");
+    }
+
+    public static synchronized void fail(String whyFailed)
+    {
+        if (mainThread == Thread.currentThread())
+        {
+            throw new RuntimeException(whyFailed);
+        }
+        theTestPassed = false;
+        testGeneratedInterrupt = true;
+        failureMessage = whyFailed;
+        mainThread.interrupt();
+    }
+}
+
+class TestPassedException extends RuntimeException
+{
+}
diff --git a/jdk/test/java/awt/security/WarningWindowDisposeTest/policy b/jdk/test/java/awt/security/WarningWindowDisposeTest/policy
new file mode 100644
index 00000000000..22405359e59
--- /dev/null
+++ b/jdk/test/java/awt/security/WarningWindowDisposeTest/policy
@@ -0,0 +1,3 @@
+grant {
+        permission java.awt.AWTPermission "createRobot";
+};
diff --git a/jdk/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java b/jdk/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java
index 75e49967aa7..e0182a5fc03 100644
--- a/jdk/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java
+++ b/jdk/test/javax/swing/JButton/JButtonPaintNPE/JButtonPaintNPE.java
@@ -31,12 +31,13 @@ import javax.swing.JButton;
 import javax.swing.JFrame;
 import javax.swing.SwingUtilities;
 
-import sun.awt.SunToolkit;
-
 /**
  * @test
  * @bug 8009919
  * @author Sergey Bylokhov
+ * @library ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @run main JButtonPaintNPE
  */
 public final class JButtonPaintNPE {
 
@@ -69,9 +70,11 @@ public final class JButtonPaintNPE {
 
     private static void sleep() {
         try {
-            ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
-            Thread.sleep(1000);
-        } catch (final InterruptedException ignored) {
-        }
+             ExtendedRobot robot = new ExtendedRobot();
+             robot.waitForIdle(1000);
+         }catch(Exception ex) {
+             ex.printStackTrace();
+             throw new Error("Unexpected Failure");
+         }
     }
 }
diff --git a/jdk/test/javax/swing/JComboBox/6406264/bug6406264.java b/jdk/test/javax/swing/JComboBox/6406264/bug6406264.java
new file mode 100644
index 00000000000..91356c3d476
--- /dev/null
+++ b/jdk/test/javax/swing/JComboBox/6406264/bug6406264.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug 6406264
+   @summary Tests that JComboBox's focusable popup can be shown.
+   @author Mikhail Lapshin
+   @run main bug6406264
+ */
+
+import javax.swing.JComboBox;
+import javax.swing.JFrame;
+import javax.swing.SwingUtilities;
+import javax.swing.plaf.basic.BasicComboBoxUI;
+import javax.swing.plaf.basic.ComboPopup;
+import javax.swing.plaf.basic.BasicComboPopup;
+import java.awt.*;
+
+public class bug6406264 extends JComboBox {
+
+    static JFrame frame;
+    static bug6406264 comboBox;
+
+    public static void main(String[] args) throws Exception {
+
+        Robot robot = new Robot();
+        // Setup and show frame
+        SwingUtilities.invokeAndWait(
+                new Runnable() {
+                    public void run() {
+                        frame = new JFrame("JComboBox6406264 test");
+                        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+                        comboBox = new bug6406264("One", "Two", "Three");
+                        frame.getContentPane().add(comboBox);
+
+                        frame.setLocationRelativeTo(null);
+                        frame.pack();
+                        frame.setVisible(true);
+                    }
+                }
+        );
+
+        robot.waitForIdle();
+
+        // Show popup
+        SwingUtilities.invokeAndWait(
+                new Runnable() {
+                    public void run() {
+                        comboBox.showPopup();
+                    }
+                });
+        robot.waitForIdle();
+
+        // Check that popup is visible
+        SwingUtilities.invokeAndWait(
+                new Runnable() {
+                    public void run() {
+                        if (comboBox.getUI().isPopupVisible(comboBox) == false)
+                        {
+                            throw new RuntimeException("A focusable popup is not visible " +
+                                    "in JComboBox!");
+                        }
+                    }
+                }
+        );
+
+        frame.dispose();
+    }
+
+    public bug6406264(Object ... items) {
+        super(items);
+    }
+
+    public void updateUI() {
+        setUI(new CustomComboBoxUI());
+    }
+
+    // Use FocusablePopup for our JComboBox
+    private class CustomComboBoxUI extends BasicComboBoxUI {
+        protected ComboPopup createPopup() {
+            return new FocusablePopup(bug6406264.this);
+        }
+    }
+
+    // Popup window which can take a focus
+    private class FocusablePopup extends BasicComboPopup {
+        public FocusablePopup(JComboBox combo) {
+            super(combo);
+        }
+
+        public boolean isFocusable() {
+            return true;
+        }
+    }
+}
diff --git a/jdk/test/javax/swing/JComboBox/8015300/Test8015300.java b/jdk/test/javax/swing/JComboBox/8015300/Test8015300.java
index 1fadfdbb9d1..37a8c0d6404 100644
--- a/jdk/test/javax/swing/JComboBox/8015300/Test8015300.java
+++ b/jdk/test/javax/swing/JComboBox/8015300/Test8015300.java
@@ -41,10 +41,13 @@ import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
  * @bug 8015300
  * @summary Tests that editable combobox select all text
  * @author Sergey Malenkov
+ * @library ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @run main Test8015300
  */
 
 public class Test8015300 {
-    private static final SunToolkit STK = (SunToolkit) Toolkit.getDefaultToolkit();
+    private static final ExtendedRobot robot = createRobot();
     private static final String[] ITEMS = {
             "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M",
             "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z"};
@@ -113,7 +116,15 @@ public class Test8015300 {
                 combo.setSelectedIndex(index);
             }
         });
-        STK.realSync();
-        Thread.sleep(50L);
+        robot.waitForIdle(50);
+    }
+    private static ExtendedRobot createRobot() {
+         try {
+             ExtendedRobot robot = new ExtendedRobot();
+             return robot;
+         }catch(Exception ex) {
+             ex.printStackTrace();
+             throw new Error("Unexpected Failure");
+         }
     }
 }
diff --git a/jdk/test/javax/swing/JComboBox/ShowPopupAfterHidePopupTest/ShowPopupAfterHidePopupTest.java b/jdk/test/javax/swing/JComboBox/ShowPopupAfterHidePopupTest/ShowPopupAfterHidePopupTest.java
index e015f5ed587..52b9e71ea29 100644
--- a/jdk/test/javax/swing/JComboBox/ShowPopupAfterHidePopupTest/ShowPopupAfterHidePopupTest.java
+++ b/jdk/test/javax/swing/JComboBox/ShowPopupAfterHidePopupTest/ShowPopupAfterHidePopupTest.java
@@ -25,6 +25,7 @@
    @bug 8006417
    @summary JComboBox.showPopup(), hidePopup() fails in JRE 1.7 on OS X
    @author Anton Litvinov
+   @run main ShowPopupAfterHidePopupTest
 */
 
 import java.awt.*;
@@ -32,8 +33,6 @@ import java.awt.*;
 import javax.swing.*;
 import javax.swing.plaf.metal.*;
 
-import sun.awt.SunToolkit;
-
 public class ShowPopupAfterHidePopupTest {
     private static JFrame frame = null;
     private static JComboBox comboBox = null;
@@ -41,6 +40,7 @@ public class ShowPopupAfterHidePopupTest {
 
     public static void main(String[] args) throws Exception {
         UIManager.setLookAndFeel(new MetalLookAndFeel());
+        Robot robot = new Robot();
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
             public void run() {
@@ -51,8 +51,7 @@ public class ShowPopupAfterHidePopupTest {
                 frame.setVisible(true);
             }
         });
-        final SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
@@ -62,7 +61,7 @@ public class ShowPopupAfterHidePopupTest {
                 comboBox.showPopup();
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
diff --git a/jdk/test/javax/swing/JComponent/6989617/bug6989617.java b/jdk/test/javax/swing/JComponent/6989617/bug6989617.java
index 23f3754b78a..a13201df761 100644
--- a/jdk/test/javax/swing/JComponent/6989617/bug6989617.java
+++ b/jdk/test/javax/swing/JComponent/6989617/bug6989617.java
@@ -28,8 +28,6 @@
    @run main bug6989617
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 
@@ -38,7 +36,7 @@ public class bug6989617 {
     private static JButton button;
 
     public static void main(String... args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 JFrame frame = new JFrame();
@@ -56,14 +54,14 @@ public class bug6989617 {
         // Testing the panel as a painting origin,
         // the panel.paintImmediately() must be triggered
         // when button.repaint() is called
-        toolkit.realSync();
+        robot.waitForIdle();
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 panel.resetPaintRectangle();
                 button.repaint();
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 Rectangle pr = panel.getPaintRectangle();
@@ -78,7 +76,7 @@ public class bug6989617 {
         // Testing the panel as NOT a painting origin
         // the panel.paintImmediately() must NOT be triggered
         // when button.repaint() is called
-        toolkit.realSync();
+        robot.waitForIdle();
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 panel.resetPaintRectangle();
@@ -89,7 +87,7 @@ public class bug6989617 {
                 button.repaint();
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 if(panel.getPaintRectangle() != null) {
diff --git a/jdk/test/javax/swing/JEditorPane/4492274/bug4492274.java b/jdk/test/javax/swing/JEditorPane/4492274/bug4492274.java
index cf732a9c5f2..369f05f17a7 100644
--- a/jdk/test/javax/swing/JEditorPane/4492274/bug4492274.java
+++ b/jdk/test/javax/swing/JEditorPane/4492274/bug4492274.java
@@ -25,10 +25,9 @@
  * @bug 4492274
  * @summary  Tests if JEditorPane.getPage() correctly returns anchor reference.
  * @author Denis Sharypov
+ * @run main bug4492274
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.text.html.HTMLEditorKit;
 import java.awt.*;
@@ -42,8 +41,8 @@ public class bug4492274 {
     private static JEditorPane jep;
 
     public static void main(String args[]) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
+        Robot robot = new Robot();
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
             public void run() {
@@ -51,7 +50,7 @@ public class bug4492274 {
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
@@ -65,7 +64,7 @@ public class bug4492274 {
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (getPageAnchor() == null) {
             throw new RuntimeException("JEditorPane.getPage() returns null anchor reference");
diff --git a/jdk/test/javax/swing/JInternalFrame/4251301/bug4251301.java b/jdk/test/javax/swing/JInternalFrame/4251301/bug4251301.java
index 304d0582407..281b7ec08cd 100644
--- a/jdk/test/javax/swing/JInternalFrame/4251301/bug4251301.java
+++ b/jdk/test/javax/swing/JInternalFrame/4251301/bug4251301.java
@@ -24,6 +24,8 @@
    @bug 4251301
    @summary Keybinding for show/hide the system menu.
    @author Andrey Pikalev
+   @library ../../../../lib/testlibrary
+   @build jdk.testlibrary.OSInfo
    @run main/manual bug4251301
 */
 
@@ -32,12 +34,10 @@ import java.awt.*;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 import java.beans.*;
-import sun.awt.OSInfo;
-import sun.awt.SunToolkit;
+import jdk.testlibrary.OSInfo;
 
 
 public class bug4251301 {
-    private static final SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
     static Test test = new Test();
     public static void main(String[] args) throws Exception {
         if (OSInfo.getOSType() == OSInfo.OSType.MACOSX) {
@@ -50,7 +50,8 @@ public class bug4251301 {
                 createAndShowGUI();
             }
         });
-        toolkit.realSync();
+        Robot robot = new Robot();
+        robot.waitForIdle();
         test.waitTestResult();
     }
 
diff --git a/jdk/test/javax/swing/JInternalFrame/6647340/bug6647340.java b/jdk/test/javax/swing/JInternalFrame/6647340/bug6647340.java
index de27c8f2a70..8bb1ffc92e1 100644
--- a/jdk/test/javax/swing/JInternalFrame/6647340/bug6647340.java
+++ b/jdk/test/javax/swing/JInternalFrame/6647340/bug6647340.java
@@ -26,10 +26,11 @@
  * @summary Checks that iconified internal frame follows
  *          the main frame borders properly.
  * @author Mikhail Lapshin
+ * @library ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @run main bug6647340
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 import java.beans.PropertyVetoException;
@@ -38,6 +39,7 @@ public class bug6647340 {
     private JFrame frame;
     private Point location;
     private JInternalFrame jif;
+    private static ExtendedRobot robot = createRobot();
 
     public static void main(String[] args) throws Exception {
         final bug6647340 test = new bug6647340();
@@ -74,13 +76,13 @@ public class bug6647340 {
     }
 
     private void test() throws Exception {
-        realSync();
+        sync();
         test1();
-        realSync();
+        sync();
         check1();
-        realSync();
+        sync();
         test2();
-        realSync();
+        sync();
         check2();
     }
 
@@ -101,14 +103,14 @@ public class bug6647340 {
                 setIcon(false);
             }
         });
-        realSync();
+        sync();
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 Dimension size = frame.getSize();
                 frame.setSize(size.width - 100, size.height - 100);
             }
         });
-        realSync();
+        sync();
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 setIcon(true);
@@ -132,8 +134,17 @@ public class bug6647340 {
         }
     }
 
-    private static void realSync() {
-        ((SunToolkit) (Toolkit.getDefaultToolkit())).realSync();
+    private static void sync() {
+        robot.waitForIdle();
+    }
+    private static ExtendedRobot createRobot() {
+        try {
+             ExtendedRobot robot = new ExtendedRobot();
+             return robot;
+         }catch(Exception ex) {
+             ex.printStackTrace();
+             throw new Error("Unexpected Failure");
+         }
     }
 
     private void setIcon(boolean b) {
diff --git a/jdk/test/javax/swing/JInternalFrame/6725409/bug6725409.java b/jdk/test/javax/swing/JInternalFrame/6725409/bug6725409.java
index 87443b4529f..6fb9b655b77 100644
--- a/jdk/test/javax/swing/JInternalFrame/6725409/bug6725409.java
+++ b/jdk/test/javax/swing/JInternalFrame/6725409/bug6725409.java
@@ -26,6 +26,9 @@
  * @summary Checks that JInternalFrame's system menu
  *          can be localized during run-time
  * @author Mikhail Lapshin
+ * @library ../../../../lib/testlibrary/
+ * @build ExtendedRobot
+ * @run main bug6725409
  */
 
 import javax.swing.*;
@@ -36,6 +39,7 @@ public class bug6725409 {
     private JInternalFrame iFrame;
     private TestTitlePane testTitlePane;
     private boolean passed;
+    private static ExtendedRobot robot = createRobot();
 
     public static void main(String[] args) throws Exception {
         try {
@@ -53,19 +57,19 @@ public class bug6725409 {
                     bug6725409.setupUIStep1();
                 }
             });
-            realSync();
+            sync();
             SwingUtilities.invokeAndWait(new Runnable() {
                 public void run() {
                     bug6725409.setupUIStep2();
                 }
             });
-            realSync();
+            sync();
             SwingUtilities.invokeAndWait(new Runnable() {
                 public void run() {
                     bug6725409.test();
                 }
             });
-            realSync();
+            sync();
             bug6725409.checkResult();
         } finally {
             if (bug6725409.frame != null) {
@@ -137,8 +141,17 @@ public class bug6725409 {
         }
     }
 
-    private static void realSync() {
-        ((sun.awt.SunToolkit) (Toolkit.getDefaultToolkit())).realSync();
+    private static void sync() {
+        robot.waitForIdle();
+    }
+    private static ExtendedRobot createRobot() {
+        try {
+             ExtendedRobot robot = new ExtendedRobot();
+             return robot;
+         }catch(Exception ex) {
+             ex.printStackTrace();
+             throw new Error("Unexpected Failure");
+         }
     }
 
     // Extend WindowsInternalFrameTitlePane to get access to systemPopupMenu
diff --git a/jdk/test/javax/swing/JLayer/6824395/bug6824395.java b/jdk/test/javax/swing/JLayer/6824395/bug6824395.java
index 1b428697da2..f2040f4b327 100644
--- a/jdk/test/javax/swing/JLayer/6824395/bug6824395.java
+++ b/jdk/test/javax/swing/JLayer/6824395/bug6824395.java
@@ -25,11 +25,12 @@
  * @test
  * @summary Checks that JLayer inside JViewport works is correctly laid out
  * @author Alexander Potochkin
+ * @library ../../../../lib/testlibrary/
+ * @build ExtendedRobot
  * @run main bug6824395
  */
 
 
-import sun.awt.SunToolkit;
 
 import javax.swing.*;
 import javax.swing.plaf.LayerUI;
@@ -40,7 +41,6 @@ public class bug6824395 {
     static JScrollPane scrollPane;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 JFrame frame = new JFrame("testing");
@@ -68,7 +68,13 @@ public class bug6824395 {
                 frame.setVisible(true);
             }
         });
-        toolkit.realSync();
+        try {
+             ExtendedRobot robot = new ExtendedRobot();
+             robot.waitForIdle(300);
+         }catch(Exception ex) {
+             ex.printStackTrace();
+             throw new Error("Unexpected Failure");
+         }
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 if (scrollPane.getViewportBorderBounds().width != scrollPane.getViewport().getView().getWidth()) {
diff --git a/jdk/test/javax/swing/JPopupMenu/6583251/bug6583251.java b/jdk/test/javax/swing/JPopupMenu/6583251/bug6583251.java
new file mode 100644
index 00000000000..d44c221093d
--- /dev/null
+++ b/jdk/test/javax/swing/JPopupMenu/6583251/bug6583251.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+@test
+@bug 6583251
+@summary One more ClassCastException in Swing with TrayIcon
+@author Alexander Potochkin
+@run main bug6583251
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.MouseEvent;
+import java.awt.image.BufferedImage;
+
+public class bug6583251 {
+    private static JFrame frame;
+    private static JPopupMenu menu;
+
+    private static void createGui() {
+        frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        JPanel panel = new JPanel();
+        menu = new JPopupMenu();
+        menu.add(new JMenuItem("item"));
+        panel.setComponentPopupMenu(menu);
+        frame.add(panel);
+
+        frame.setSize(200, 200);
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                createGui();
+            }
+        });
+
+        Robot robot = new Robot();
+        robot.waitForIdle();
+        menu.show(frame, 0, 0);
+        robot.waitForIdle();
+
+        TrayIcon trayIcon = new TrayIcon(new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB));
+        MouseEvent ev = new MouseEvent(
+                new JButton(), MouseEvent.MOUSE_PRESSED, System.currentTimeMillis(), 0, 0, 0, 1, false);
+        ev.setSource(trayIcon);
+        Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ev);
+    }
+}
diff --git a/jdk/test/javax/swing/JPopupMenu/6691503/bug6691503.java b/jdk/test/javax/swing/JPopupMenu/6691503/bug6691503.java
index c1c16ee5a2c..f07ebd19a35 100644
--- a/jdk/test/javax/swing/JPopupMenu/6691503/bug6691503.java
+++ b/jdk/test/javax/swing/JPopupMenu/6691503/bug6691503.java
@@ -31,8 +31,6 @@
  * @run main bug6691503
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 
@@ -93,7 +91,13 @@ public class bug6691503 {
     }
 
     private void checkResult() {
-        ((SunToolkit)(Toolkit.getDefaultToolkit())).realSync();
+        try {
+            Robot robot = new Robot();
+            robot.waitForIdle();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
         if (!isAlwaysOnTop1 || isAlwaysOnTop2) {
             throw new RuntimeException("Malicious applet can show always-on-top " +
                     "popup menu which has whole screen size");
diff --git a/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java b/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java
index 045cc68066f..3e6c4be0c69 100644
--- a/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java
+++ b/jdk/test/javax/swing/JPopupMenu/6694823/bug6694823.java
@@ -32,25 +32,25 @@
 
 import javax.swing.*;
 import java.awt.*;
-import sun.awt.SunToolkit;
 import java.security.Permission;
-import sun.awt.AWTPermissions;
 
 public class bug6694823 {
     private static JFrame frame;
     private static JPopupMenu popup;
-    private static SunToolkit toolkit;
+    private static Toolkit toolkit;
     private static Insets screenInsets;
+    private static Robot robot;
 
     public static void main(String[] args) throws Exception {
-        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        robot = new Robot();
+        toolkit = Toolkit.getDefaultToolkit();
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 createGui();
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         // Get screen insets
         screenInsets = toolkit.getScreenInsets(frame.getGraphicsConfiguration());
@@ -61,12 +61,9 @@ public class bug6694823 {
 
         System.setSecurityManager(new SecurityManager(){
 
-            private String allowsAlwaysOnTopPermission =
-                AWTPermissions.SET_WINDOW_ALWAYS_ON_TOP_PERMISSION.getName();
-
             @Override
             public void checkPermission(Permission perm) {
-                if (allowsAlwaysOnTopPermission.equals(perm.getName())) {
+                if (perm.getName().equals("setWindowAlwaysOnTop") ) {
                     throw new SecurityException();
                 }
             }
@@ -107,7 +104,7 @@ public class bug6694823 {
         });
 
         // Ensure frame is visible
-        toolkit.realSync();
+        robot.waitForIdle();
 
         final Point point = new Point();
         SwingUtilities.invokeAndWait(new Runnable() {
@@ -120,7 +117,7 @@ public class bug6694823 {
         });
 
         // Ensure popup is visible
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
diff --git a/jdk/test/javax/swing/JScrollBar/4865918/bug4865918.java b/jdk/test/javax/swing/JScrollBar/4865918/bug4865918.java
index 8a1a8045fd7..2bf5be45b2d 100644
--- a/jdk/test/javax/swing/JScrollBar/4865918/bug4865918.java
+++ b/jdk/test/javax/swing/JScrollBar/4865918/bug4865918.java
@@ -33,15 +33,14 @@ import javax.swing.*;
 import java.awt.*;
 import java.awt.event.*;
 import java.util.*;
-import sun.awt.SunToolkit;
 
 public class bug4865918 {
 
     private static TestScrollBar sbar;
 
     public static void main(String[] argv) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
 
+        Robot robot = new Robot();
         SwingUtilities.invokeAndWait(new Runnable() {
 
             public void run() {
@@ -49,7 +48,7 @@ public class bug4865918 {
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
@@ -59,7 +58,7 @@ public class bug4865918 {
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         int value = getValue();
 
diff --git a/jdk/test/javax/swing/JScrollPane/6274267/bug6274267.java b/jdk/test/javax/swing/JScrollPane/6274267/bug6274267.java
new file mode 100644
index 00000000000..1783c0f81b1
--- /dev/null
+++ b/jdk/test/javax/swing/JScrollPane/6274267/bug6274267.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug 6274267
+   @summary Checks that ScrollPaneLayout properly calculates preferred
+   layout size.
+   @author Mikhail Lapshin
+   @run main bug6274267
+*/
+
+import javax.swing.*;
+import java.awt.*;
+
+public class bug6274267 {
+    private JFrame frame;
+    private Component left;
+
+    public static void main(String[] args) throws Exception {
+        final bug6274267 test = new bug6274267();
+        Robot robot = new Robot();
+        try {
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    test.setupUI1();
+                }
+            });
+            robot.waitForIdle();
+            SwingUtilities.invokeAndWait(new Runnable() {
+                public void run() {
+                    test.setupUI2();
+                }
+            });
+            test.test();
+        } finally {
+            if (test.frame != null) {
+                test.frame.dispose();
+            }
+        }
+    }
+
+    private void setupUI1() {
+        frame = new JFrame();
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+        left = new JPanel();
+        left.setPreferredSize(new Dimension(100, 100));
+
+        JPanel rightPanel = new JPanel();
+        rightPanel.setPreferredSize(new Dimension(100, 50));
+        Component right = new JScrollPane(rightPanel);
+
+        JSplitPane split =
+                new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right);
+
+        frame = new JFrame();
+        frame.add(split);
+        frame.pack();
+    }
+
+    // It is important to separate frame.pack() from frame.setVisible(true).
+    // Otherwise the repaint manager will combine validate() calls and
+    // the bug won't appear.
+    private void setupUI2() {
+        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+        frame.setLocationRelativeTo(null);
+        frame.setVisible(true);
+    }
+
+    private void test() throws Exception {
+        if (left.getSize().width == 100) {
+            System.out.println("Test passed");
+        } else {
+            throw new RuntimeException("ScrollPaneLayout sometimes improperly " +
+                    "calculates the preferred layout size. ");
+        }
+    }
+}
diff --git a/jdk/test/javax/swing/JSpinner/8008657/bug8008657.java b/jdk/test/javax/swing/JSpinner/8008657/bug8008657.java
index 63e07730090..3cbe7a61d03 100644
--- a/jdk/test/javax/swing/JSpinner/8008657/bug8008657.java
+++ b/jdk/test/javax/swing/JSpinner/8008657/bug8008657.java
@@ -22,7 +22,7 @@
  */
 
 import java.awt.ComponentOrientation;
-import java.awt.Toolkit;
+import java.awt.Robot;
 import java.util.Calendar;
 import java.util.Date;
 import javax.swing.JFrame;
@@ -32,7 +32,6 @@ import javax.swing.SpinnerDateModel;
 import javax.swing.SpinnerModel;
 import javax.swing.SpinnerNumberModel;
 import javax.swing.SwingUtilities;
-import sun.awt.SunToolkit;
 
 /**
  * @test
@@ -43,19 +42,19 @@ import sun.awt.SunToolkit;
  */
 public class bug8008657 {
 
-    private static SunToolkit toolkit;
+    private static Robot robot;
     private static JSpinner spinner;
 
     public static void main(String[] args) throws Exception {
 
-        toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        robot = new Robot();
 
         SwingUtilities.invokeAndWait(() -> {
             createDateSpinner();
             createAndShowUI();
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
         testSpinner(false);
 
         SwingUtilities.invokeAndWait(() -> {
@@ -63,7 +62,7 @@ public class bug8008657 {
             createAndShowUI();
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
         testSpinner(true);
     }
 
@@ -73,7 +72,7 @@ public class bug8008657 {
         SwingUtilities.invokeAndWait(() -> {
             spinner.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(() -> {
 
@@ -91,7 +90,7 @@ public class bug8008657 {
             spinner.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT);
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(() -> {
             JTextField textField = getTextField();
@@ -152,4 +151,4 @@ public class bug8008657 {
         frame.getContentPane().add(spinner);
         frame.setVisible(true);
     }
-}
\ No newline at end of file
+}
diff --git a/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java b/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java
index 0b3247f9746..11296836916 100644
--- a/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java
+++ b/jdk/test/javax/swing/JSplitPane/4816114/bug4816114.java
@@ -30,7 +30,6 @@
 import javax.swing.*;
 import java.awt.*;
 import java.lang.reflect.*;
-import sun.awt.SunToolkit;
 
 
 public class bug4816114 {
@@ -46,14 +45,14 @@ public class bug4816114 {
 
     static bug4816114 test = new bug4816114();
 
-    public static void main(String[] args) throws InterruptedException, InvocationTargetException {
+    public static void main(String[] args) throws InterruptedException, InvocationTargetException, AWTException {
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 test.createAndShowGUI();
             }
         });
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-        toolkit.realSync();
+        Robot robot = new Robot();
+        robot.waitForIdle();
         Thread.sleep(1000);
         Thread.sleep(2000);
 
diff --git a/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java b/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java
index 228aa008567..e18f4aac8c4 100644
--- a/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java
+++ b/jdk/test/javax/swing/JTabbedPane/7024235/Test7024235.java
@@ -22,7 +22,6 @@
  */
 
 import java.awt.BorderLayout;
-import sun.awt.SunToolkit;
 
 import java.awt.Container;
 import java.awt.Rectangle;
@@ -41,7 +40,10 @@ import javax.swing.UIManager.LookAndFeelInfo;
  * @test
  * @bug 7024235
  * @summary Tests JFrame.pack() with the JTabbedPane
+ * @library ../../../../lib/testlibrary/
+ * @build ExtendedRobot
  * @author Sergey Malenkov
+ * @run main Test7024235
  */
 
 public class Test7024235 implements Runnable {
@@ -50,13 +52,17 @@ public class Test7024235 implements Runnable {
 
     public static void main(String[] args) throws Exception {
         Test7024235 test = new Test7024235();
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
         for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
             UIManager.setLookAndFeel(info.getClassName());
 
             test.test();
-            toolkit.realSync();
-            Thread.sleep(1000);
+            try {
+                ExtendedRobot robot = new ExtendedRobot();
+                robot.waitForIdle(1000);
+            }catch(Exception ex) {
+                ex.printStackTrace();
+                throw new Error("Unexpected Failure");
+            }
             test.test();
         }
     }
diff --git a/jdk/test/javax/swing/JTabbedPane/7170310/bug7170310.java b/jdk/test/javax/swing/JTabbedPane/7170310/bug7170310.java
index 2ceb8a45ccb..94eaa6e3ce1 100644
--- a/jdk/test/javax/swing/JTabbedPane/7170310/bug7170310.java
+++ b/jdk/test/javax/swing/JTabbedPane/7170310/bug7170310.java
@@ -34,13 +34,14 @@ import javax.swing.SwingUtilities;
 import javax.swing.UIManager;
 import javax.swing.plaf.metal.MetalLookAndFeel;
 
-import sun.awt.SunToolkit;
 
 /**
  * @test
  * @bug 7170310
  * @author Alexey Ivanov
  * @summary Selected tab should be scrolled into view.
+ * @library ../../../../lib/testlibrary/
+ * @build ExtendedRobot
  * @run main bug7170310
  */
 public class bug7170310 {
@@ -58,12 +59,11 @@ public class bug7170310 {
             UIManager.setLookAndFeel(new MetalLookAndFeel());
             SwingUtilities.invokeAndWait(bug7170310::createAndShowUI);
 
-            SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
-            toolkit.realSync();
+            sync();
 
             for (int i = 0; i < TABS_NUMBER; i++) {
                 SwingUtilities.invokeAndWait(bug7170310::addTab);
-                toolkit.realSync();
+                sync();
             }
 
             SwingUtilities.invokeAndWait(bug7170310::check);
@@ -121,4 +121,13 @@ public class bug7170310 {
             exception = e;
         }
     }
+    private static void sync() {
+        try {
+             ExtendedRobot robot = new ExtendedRobot();
+             robot.waitForIdle(300);
+         }catch(Exception ex) {
+             ex.printStackTrace();
+             throw new Error("Unexpected Failure");
+         }
+    }
 }
diff --git a/jdk/test/javax/swing/JTabbedPane/8017284/bug8017284.java b/jdk/test/javax/swing/JTabbedPane/8017284/bug8017284.java
index db99233f577..5a71726e631 100644
--- a/jdk/test/javax/swing/JTabbedPane/8017284/bug8017284.java
+++ b/jdk/test/javax/swing/JTabbedPane/8017284/bug8017284.java
@@ -22,12 +22,12 @@
  */
 import java.awt.BorderLayout;
 import java.awt.Toolkit;
+import java.awt.Robot;
 import javax.swing.JFrame;
 import javax.swing.JLabel;
 import javax.swing.JTabbedPane;
 import javax.swing.SwingUtilities;
 import javax.swing.plaf.metal.MetalLookAndFeel;
-import sun.awt.SunToolkit;
 
 /**
  * @test
@@ -45,6 +45,7 @@ public class bug8017284 {
 
     public static void main(String[] args) throws Exception {
 
+        Robot robot = new Robot();
         SwingUtilities.invokeAndWait(() -> {
             frame = new JFrame();
             frame.setSize(500, 500);
@@ -61,7 +62,7 @@ public class bug8017284 {
             frame.setVisible(true);
         });
 
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(() -> {
             for (int j = 0; j < ITERATIONS; j++) {
@@ -70,7 +71,7 @@ public class bug8017284 {
                 }
             }
         });
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(() -> frame.dispose());
     }
diff --git a/jdk/test/javax/swing/JTable/8032874/bug8032874.java b/jdk/test/javax/swing/JTable/8032874/bug8032874.java
index e5d6da00ccf..1116aebe267 100644
--- a/jdk/test/javax/swing/JTable/8032874/bug8032874.java
+++ b/jdk/test/javax/swing/JTable/8032874/bug8032874.java
@@ -37,15 +37,13 @@ import javax.swing.*;
 import javax.swing.table.AbstractTableModel;
 import javax.swing.table.TableRowSorter;
 
-import sun.awt.SunToolkit;
-
 public class bug8032874 {
     private static final int ROW_COUNT = 5;
     private static JTable table;
     private static TestTableModel tableModel;
 
     public static void main(String args[]) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
@@ -53,7 +51,7 @@ public class bug8032874 {
                 createAndShowUI();
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
@@ -63,7 +61,7 @@ public class bug8032874 {
                 table.setRowSelectionInterval(1, 2);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
diff --git a/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java b/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java
index d6e232618dd..36d328fe1e8 100644
--- a/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java
+++ b/jdk/test/javax/swing/JTextArea/7049024/bug7049024.java
@@ -31,8 +31,6 @@
  * @author Sean Chou
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.text.DefaultCaret;
 import java.awt.*;
@@ -53,7 +51,7 @@ public class bug7049024 {
 
     public static void main(String[] args) throws Exception {
 
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
             public void run() {
@@ -70,7 +68,7 @@ public class bug7049024 {
                 frame.setVisible(true);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         clipboard = textField.getToolkit().getSystemSelection();
         if (null == clipboard) {
@@ -83,7 +81,7 @@ public class bug7049024 {
                 textField.requestFocusInWindow();
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
@@ -93,7 +91,7 @@ public class bug7049024 {
                 caret.moveDot(4);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         String oldSelection = (String) clipboard.getData(DataFlavor.stringFlavor);
         System.out.println("oldSelection is " + oldSelection);
@@ -104,7 +102,7 @@ public class bug7049024 {
                 button.requestFocusInWindow();
             }
         });
-        toolkit.realSync(); // So JTextField loses the focus.
+        robot.waitForIdle(); // So JTextField loses the focus.
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
@@ -113,7 +111,7 @@ public class bug7049024 {
                 caret.moveDot(6);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         String newSelection = (String) clipboard.getData(DataFlavor.stringFlavor);
         System.out.println("newSelection is " + newSelection);
diff --git a/jdk/test/javax/swing/JToolBar/4529206/bug4529206.java b/jdk/test/javax/swing/JToolBar/4529206/bug4529206.java
new file mode 100644
index 00000000000..61e96b728b0
--- /dev/null
+++ b/jdk/test/javax/swing/JToolBar/4529206/bug4529206.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug     4529206
+   @summary JToolBar - setFloating does not work correctly
+   @author  Konstantin Eremin
+   @run     main bug4529206
+*/
+
+import javax.swing.*;
+import java.awt.*;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+public class bug4529206 extends JFrame {
+    static JFrame frame;
+    static JToolBar jToolBar1;
+    public bug4529206() {
+        setDefaultCloseOperation(EXIT_ON_CLOSE);
+        JPanel jPanFrame = (JPanel) this.getContentPane();
+        jPanFrame.setLayout(new BorderLayout());
+        this.setSize(new Dimension(200, 100));
+        this.setLocation(125, 75);
+        this.setTitle("Test Floating Toolbar");
+        jToolBar1 = new JToolBar();
+        JButton jButton1 = new JButton("Float");
+        jPanFrame.add(jToolBar1, BorderLayout.NORTH);
+        JTextField tf = new JTextField("click here");
+        jPanFrame.add(tf);
+        jToolBar1.add(jButton1, null);
+        jButton1.addActionListener(new ActionListener() {
+            public void actionPerformed(ActionEvent e) {
+                buttonPressed(e);
+            }
+        });
+        makeToolbarFloat();
+        setVisible(true);
+    }
+
+    private void makeToolbarFloat() {
+        javax.swing.plaf.basic.BasicToolBarUI ui = (javax.swing.plaf.basic.BasicToolBarUI) jToolBar1.getUI();
+        if (!ui.isFloating()) {
+            ui.setFloatingLocation(100, 100);
+            ui.setFloating(true, jToolBar1.getLocation());
+        }
+    }
+
+    private void buttonPressed(ActionEvent e) {
+        makeToolbarFloat();
+    }
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                frame = new bug4529206();
+            }
+        });
+        Robot robot = new Robot();
+        robot.waitForIdle();
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                if (frame.isFocused()) {
+                    throw (new RuntimeException("setFloating does not work correctly"));
+                }
+            }
+        });
+    }
+}
diff --git a/jdk/test/javax/swing/JViewport/7107099/bug7107099.java b/jdk/test/javax/swing/JViewport/7107099/bug7107099.java
index eff27bccdae..a6bdce4b445 100644
--- a/jdk/test/javax/swing/JViewport/7107099/bug7107099.java
+++ b/jdk/test/javax/swing/JViewport/7107099/bug7107099.java
@@ -27,8 +27,6 @@
    @author Pavel Porvatov
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 
@@ -43,7 +41,8 @@ public class bug7107099 {
     private static int extent;
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+
+        java.awt.Robot robot = new java.awt.Robot();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
@@ -61,7 +60,7 @@ public class bug7107099 {
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
@@ -81,7 +80,7 @@ public class bug7107099 {
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
diff --git a/jdk/test/javax/swing/Popup/6514582/bug6514582.java b/jdk/test/javax/swing/Popup/6514582/bug6514582.java
new file mode 100644
index 00000000000..94fee3f4f82
--- /dev/null
+++ b/jdk/test/javax/swing/Popup/6514582/bug6514582.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/* @test
+   @bug 6514582
+   @summary SubMenu of a JMenu with no items paints a single pixel tiny menu.
+   @author Alexander Potochkin
+   @run main bug6514582
+*/
+
+import javax.swing.*;
+import java.awt.*;
+
+public class bug6514582 {
+    private static JPopupMenu popup;
+
+    public static void main(String ...args) throws Exception {
+        Robot robot = new Robot();
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                popup = new JPopupMenu();
+                popup.add(new JMenuItem("item"));
+                popup.setVisible(true);
+
+            }
+        });
+
+        robot.waitForIdle();
+
+        if (!popup.isShowing()) {
+            throw new RuntimeException("Where is my popup ?");
+        }
+
+        SwingUtilities.invokeAndWait(new Runnable() {
+            public void run() {
+                popup.setVisible(false);
+                popup.removeAll();
+                popup.setVisible(true);
+            }
+        });
+
+        robot.waitForIdle();
+
+        if (popup.isShowing()) {
+            throw new RuntimeException("Empty popup is shown");
+        }
+
+        popup.setVisible(false);
+    }
+}
diff --git a/jdk/test/javax/swing/RepaintManager/IconifyTest/IconifyTest.java b/jdk/test/javax/swing/RepaintManager/IconifyTest/IconifyTest.java
index cbe6d2230de..5d4198cc669 100644
--- a/jdk/test/javax/swing/RepaintManager/IconifyTest/IconifyTest.java
+++ b/jdk/test/javax/swing/RepaintManager/IconifyTest/IconifyTest.java
@@ -31,7 +31,6 @@
 import java.awt.*;
 import java.awt.event.*;
 import javax.swing.*;
-import sun.awt.*;
 
 public class IconifyTest {
     private static volatile boolean windowIconifiedIsCalled = false;
@@ -40,7 +39,7 @@ public class IconifyTest {
     static JButton button;
 
     public static void main(String[] args) throws Throwable {
-        SunToolkit toolkit = (SunToolkit) SunToolkit.getDefaultToolkit();
+        Robot robot = new Robot();
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 frame = new JFrame();
@@ -61,14 +60,14 @@ public class IconifyTest {
                 frame.setVisible(true);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 frame.setExtendedState(Frame.ICONIFIED);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
 
         if (!windowIconifiedIsCalled) {
             throw new Exception("Test failed: window was not iconified.");
diff --git a/jdk/test/javax/swing/Security/6657138/ComponentTest.java b/jdk/test/javax/swing/Security/6657138/ComponentTest.java
index bfd818eb6f6..2ee7b84bbfa 100644
--- a/jdk/test/javax/swing/Security/6657138/ComponentTest.java
+++ b/jdk/test/javax/swing/Security/6657138/ComponentTest.java
@@ -28,8 +28,6 @@
  * @author Alexander Potochkin
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import java.awt.*;
 
@@ -50,14 +48,14 @@ public class ComponentTest extends JFrame {
 
 
     public static void main(String[] args) throws Exception {
-        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
+        Robot robot = new Robot();
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
                 frame = new ComponentTest();
                 frame.setVisible(true);
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
         UIManager.LookAndFeelInfo[] lafs = UIManager.getInstalledLookAndFeels();
         for (final UIManager.LookAndFeelInfo laf : lafs) {
             SwingUtilities.invokeAndWait(new Runnable() {
@@ -70,7 +68,7 @@ public class ComponentTest extends JFrame {
                     SwingUtilities.updateComponentTreeUI(frame);
                 }
             });
-            toolkit.realSync();
+            robot.waitForIdle();
         }
     }
 }
diff --git a/jdk/test/javax/swing/SwingTest.java b/jdk/test/javax/swing/SwingTest.java
index ef8dfea27e0..f7f6889f635 100644
--- a/jdk/test/javax/swing/SwingTest.java
+++ b/jdk/test/javax/swing/SwingTest.java
@@ -21,7 +21,6 @@
  * questions.
  */
 
-import sun.awt.SunToolkit;
 import java.awt.Toolkit;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
@@ -134,11 +133,8 @@ final class SwingTest implements Runnable {
             else {
                 SwingUtilities.invokeLater(this); // invoke on the event dispatch thread
             }
-            Toolkit tk = Toolkit.getDefaultToolkit();
-            if (tk instanceof SunToolkit) {
-                SunToolkit stk = (SunToolkit) tk;
-                stk.realSync(); // wait until done
-            }
+            java.awt.Robot robot = new java.awt.Robot();
+            robot.waitForIdle();
         }
         while (this.frame != null);
         if (this.error != null) {
diff --git a/jdk/test/javax/swing/text/Utilities/bug7045593.java b/jdk/test/javax/swing/text/Utilities/bug7045593.java
index 84beb0d53b9..1de7cc142c2 100644
--- a/jdk/test/javax/swing/text/Utilities/bug7045593.java
+++ b/jdk/test/javax/swing/text/Utilities/bug7045593.java
@@ -28,8 +28,6 @@
  * @author Pavel Porvatov
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.text.BadLocationException;
 import java.awt.*;
@@ -49,7 +47,8 @@ public class bug7045593 {
             }
         });
 
-        ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync();
+        Robot robot = new Robot();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {
diff --git a/jdk/test/javax/swing/text/View/8048110/bug8048110.java b/jdk/test/javax/swing/text/View/8048110/bug8048110.java
index 2151e3fb502..85ae35708e5 100644
--- a/jdk/test/javax/swing/text/View/8048110/bug8048110.java
+++ b/jdk/test/javax/swing/text/View/8048110/bug8048110.java
@@ -28,8 +28,6 @@
  * @run main bug8048110
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.text.Element;
 import javax.swing.text.html.HTMLDocument;
@@ -37,7 +35,7 @@ import javax.swing.text.html.HTMLEditorKit;
 import java.awt.*;
 
 public class bug8048110 {
-    private static SunToolkit toolkit = (SunToolkit)Toolkit.getDefaultToolkit();
+    private static Robot robot;
     private static Object lock = new Object();
     private static boolean isRealSyncPerformed = false;
     private static final String htmlText = "<table width=\"100%\" cellpadding=\"10\" cellspacing=\"5\" align=\"center\">" +
@@ -45,6 +43,7 @@ public class bug8048110 {
             "<tr><td align=\"left\" bgcolor=\"#bec3c6\">PC</td><td align=\"left\" bgcolor=\"#46a055\">Ok</td></tr></table>";
 
     public static void main(String[] args) throws Exception {
+        robot = new Robot();
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
             public void run() {
@@ -55,7 +54,7 @@ public class bug8048110 {
         Thread thread = new Thread() {
             @Override
             public void run() {
-                toolkit.realSync();
+                robot.waitForIdle();
                 synchronized (lock) {
                     isRealSyncPerformed = true;
                     lock.notifyAll();
diff --git a/jdk/test/javax/swing/text/html/7189299/bug7189299.java b/jdk/test/javax/swing/text/html/7189299/bug7189299.java
index 83862122ec2..609635c4fc5 100644
--- a/jdk/test/javax/swing/text/html/7189299/bug7189299.java
+++ b/jdk/test/javax/swing/text/html/7189299/bug7189299.java
@@ -25,7 +25,7 @@
  * Portions Copyright (c) 2013 IBM Corporation
  */
 import java.awt.BorderLayout;
-import java.awt.Toolkit;
+import java.awt.Robot;
 
 import java.awt.event.ActionListener;
 import javax.swing.DefaultButtonModel;
@@ -35,7 +35,6 @@ import javax.swing.SwingUtilities;
 import javax.swing.text.StyleConstants;
 import javax.swing.text.StyleContext;
 import javax.swing.text.html.HTMLEditorKit;
-import sun.awt.SunToolkit;
 
 
 /*
@@ -111,7 +110,7 @@ public class bug7189299 {
     }
 
     public static void main(String[] args) throws Exception {
-        final SunToolkit toolkit = ((SunToolkit) Toolkit.getDefaultToolkit());
+        final Robot robot = new Robot();
 
         SwingUtilities.invokeAndWait(new Runnable() {
 
@@ -120,7 +119,7 @@ public class bug7189299 {
                 setup();
             }
         });
-        toolkit.realSync();
+        robot.waitForIdle();
         SwingUtilities.invokeAndWait(new Runnable() {
 
             @Override
diff --git a/jdk/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java b/jdk/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java
index 2378fd2e334..86ebdbb963f 100644
--- a/jdk/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java
+++ b/jdk/test/javax/swing/text/html/HTMLDocument/8058120/bug8058120.java
@@ -28,8 +28,6 @@
  * @run main bug8058120
  */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.text.Element;
 import javax.swing.text.html.HTML;
@@ -38,12 +36,18 @@ import javax.swing.text.html.HTMLEditorKit;
 import java.awt.*;
 
 public class bug8058120 {
-    private static SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
     private static HTMLDocument document = null;
     private static final String text = "<p id = 'ab'>ab</p>";
     private static final String textToInsert = "c";
 
     public static void main(String[] args) {
+        Robot robot;
+        try {
+             robot = new Robot();
+        }catch(Exception ex) {
+            ex.printStackTrace();
+            throw new RuntimeException("Unexpected failure");
+        }
         SwingUtilities.invokeLater(new Runnable() {
             @Override
             public void run() {
@@ -51,7 +55,7 @@ public class bug8058120 {
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeLater(new Runnable() {
             @Override
@@ -64,7 +68,7 @@ public class bug8058120 {
             }
         });
 
-        toolkit.realSync();
+        robot.waitForIdle();
 
         SwingUtilities.invokeLater(new Runnable() {
             @Override
diff --git a/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java b/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java
index c18dccd02de..835990fa142 100644
--- a/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java
+++ b/jdk/test/javax/swing/text/html/HTMLEditorKit/4242228/bug4242228.java
@@ -27,8 +27,6 @@
    @author Peter Zhelezniakov
 */
 
-import sun.awt.SunToolkit;
-
 import javax.swing.*;
 import javax.swing.event.ChangeEvent;
 import javax.swing.event.ChangeListener;
@@ -85,7 +83,8 @@ public class bug4242228 {
             }
         });
 
-        ((SunToolkit) Toolkit.getDefaultToolkit()).realSync();
+        Robot robot = new Robot();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             @Override
diff --git a/jdk/test/javax/swing/text/html/parser/Parser/7165725/bug7165725.java b/jdk/test/javax/swing/text/html/parser/Parser/7165725/bug7165725.java
index 2c89050ef4a..339e52f1e70 100644
--- a/jdk/test/javax/swing/text/html/parser/Parser/7165725/bug7165725.java
+++ b/jdk/test/javax/swing/text/html/parser/Parser/7165725/bug7165725.java
@@ -28,9 +28,8 @@
    @run main bug7165725
 */
 
-import sun.awt.SunToolkit;
-
 import java.awt.BorderLayout;
+import java.awt.Robot;
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
@@ -127,7 +126,8 @@ public class bug7165725 extends JFrame {
             }
         });
 
-        ((SunToolkit) SunToolkit.getDefaultToolkit()).realSync();
+        Robot robot = new Robot();
+        robot.waitForIdle();
 
         SwingUtilities.invokeAndWait(new Runnable() {
             public void run() {

From bdac8228110c81efccee4fffe2eddcb4cc42e528 Mon Sep 17 00:00:00 2001
From: Igor Ignatyev <iignatyev@openjdk.org>
Date: Mon, 10 Nov 2014 19:04:38 +0300
Subject: [PATCH 052/299] 8059624: Test task: WhiteBox API for testing
 segmented codecache feature

Reviewed-by: kvn, thartmann
---
 hotspot/src/share/vm/code/codeBlob.cpp        |   2 +-
 hotspot/src/share/vm/code/codeBlob.hpp        |   4 +-
 hotspot/src/share/vm/code/codeCache.cpp       |   2 +-
 hotspot/src/share/vm/code/codeCache.hpp       |   3 +-
 .../src/share/vm/compiler/compileBroker.cpp   |   7 +
 hotspot/src/share/vm/prims/whitebox.cpp       | 153 +++++++++++++++++-
 hotspot/src/share/vm/prims/whitebox.hpp       |   9 +-
 hotspot/src/share/vm/runtime/mutexLocker.cpp  |   5 +-
 hotspot/src/share/vm/runtime/mutexLocker.hpp  |   1 +
 hotspot/src/share/vm/runtime/sweeper.hpp      |   5 +-
 .../whitebox/AllocationCodeBlobTest.java      | 128 +++++++++++++++
 .../whitebox/GetCodeHeapEntriesTest.java      |  95 +++++++++++
 .../compiler/whitebox/GetNMethodTest.java     |  43 ++++-
 .../whitebox/LockCompilationTest.java         |  91 +++++++++++
 .../whitebox/sun/hotspot/WhiteBox.java        |   6 +
 .../whitebox/sun/hotspot/code/BlobType.java   |  79 +++++++++
 .../whitebox/sun/hotspot/code/CodeBlob.java   |  61 +++++++
 .../whitebox/sun/hotspot/code/NMethod.java    |  28 ++--
 18 files changed, 687 insertions(+), 35 deletions(-)
 create mode 100644 hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
 create mode 100644 hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java
 create mode 100644 hotspot/test/compiler/whitebox/LockCompilationTest.java
 create mode 100644 hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java
 create mode 100644 hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java

diff --git a/hotspot/src/share/vm/code/codeBlob.cpp b/hotspot/src/share/vm/code/codeBlob.cpp
index 98b7ec0f23c..3cf66665d87 100644
--- a/hotspot/src/share/vm/code/codeBlob.cpp
+++ b/hotspot/src/share/vm/code/codeBlob.cpp
@@ -43,7 +43,7 @@
 #include "c1/c1_Runtime1.hpp"
 #endif
 
-unsigned int align_code_offset(int offset) {
+unsigned int CodeBlob::align_code_offset(int offset) {
   // align the size to CodeEntryAlignment
   return
     ((offset + (int)CodeHeap::header_size() + (CodeEntryAlignment-1)) & ~(CodeEntryAlignment-1))
diff --git a/hotspot/src/share/vm/code/codeBlob.hpp b/hotspot/src/share/vm/code/codeBlob.hpp
index 2c066788657..e1f83936158 100644
--- a/hotspot/src/share/vm/code/codeBlob.hpp
+++ b/hotspot/src/share/vm/code/codeBlob.hpp
@@ -83,6 +83,7 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC {
  public:
   // Returns the space needed for CodeBlob
   static unsigned int allocation_size(CodeBuffer* cb, int header_size);
+  static unsigned int align_code_offset(int offset);
 
   // Creation
   // a) simple CodeBlob
@@ -207,7 +208,7 @@ class CodeBlob VALUE_OBJ_CLASS_SPEC {
   }
 };
 
-
+class WhiteBox;
 //----------------------------------------------------------------------------------------------------
 // BufferBlob: used to hold non-relocatable machine code such as the interpreter, stubroutines, etc.
 
@@ -215,6 +216,7 @@ class BufferBlob: public CodeBlob {
   friend class VMStructs;
   friend class AdapterBlob;
   friend class MethodHandlesAdapterBlob;
+  friend class WhiteBox;
 
  private:
   // Creation support
diff --git a/hotspot/src/share/vm/code/codeCache.cpp b/hotspot/src/share/vm/code/codeCache.cpp
index 4876a40111d..b3942454ab8 100644
--- a/hotspot/src/share/vm/code/codeCache.cpp
+++ b/hotspot/src/share/vm/code/codeCache.cpp
@@ -305,7 +305,7 @@ void CodeCache::add_heap(ReservedSpace rs, const char* name, size_t size_initial
   MemoryService::add_code_heap_memory_pool(heap, name);
 }
 
-CodeHeap* CodeCache::get_code_heap(CodeBlob* cb) {
+CodeHeap* CodeCache::get_code_heap(const CodeBlob* cb) {
   assert(cb != NULL, "CodeBlob is null");
   FOR_ALL_HEAPS(heap) {
     if ((*heap)->contains(cb)) {
diff --git a/hotspot/src/share/vm/code/codeCache.hpp b/hotspot/src/share/vm/code/codeCache.hpp
index fd7fb286c31..25c5288cdde 100644
--- a/hotspot/src/share/vm/code/codeCache.hpp
+++ b/hotspot/src/share/vm/code/codeCache.hpp
@@ -77,6 +77,7 @@ class DepChange;
 class CodeCache : AllStatic {
   friend class VMStructs;
   friend class NMethodIterator;
+  friend class WhiteBox;
  private:
   // CodeHeaps of the cache
   static GrowableArray<CodeHeap*>* _heaps;
@@ -98,7 +99,7 @@ class CodeCache : AllStatic {
   static void initialize_heaps();                             // Initializes the CodeHeaps
   // Creates a new heap with the given name and size, containing CodeBlobs of the given type
   static void add_heap(ReservedSpace rs, const char* name, size_t size_initial, int code_blob_type);
-  static CodeHeap* get_code_heap(CodeBlob* cb);               // Returns the CodeHeap for the given CodeBlob
+  static CodeHeap* get_code_heap(const CodeBlob* cb);         // Returns the CodeHeap for the given CodeBlob
   static CodeHeap* get_code_heap(int code_blob_type);         // Returns the CodeHeap for the given CodeBlobType
   // Returns the name of the VM option to set the size of the corresponding CodeHeap
   static const char* get_code_heap_flag_name(int code_blob_type);
diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp
index 330fa0214ef..0ab0dae2dd6 100644
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp
@@ -35,6 +35,7 @@
 #include "oops/method.hpp"
 #include "oops/oop.inline.hpp"
 #include "prims/nativeLookup.hpp"
+#include "prims/whitebox.hpp"
 #include "runtime/arguments.hpp"
 #include "runtime/atomic.inline.hpp"
 #include "runtime/compilationPolicy.hpp"
@@ -1963,6 +1964,12 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
     if (comp == NULL) {
       ci_env.record_method_not_compilable("no compiler", !TieredCompilation);
     } else {
+      if (WhiteBoxAPI && WhiteBox::compilation_locked) {
+        MonitorLockerEx locker(Compilation_lock, Mutex::_no_safepoint_check_flag);
+        while (WhiteBox::compilation_locked) {
+          locker.wait(Mutex::_no_safepoint_check_flag);
+        }
+      }
       comp->compile_method(&ci_env, target, osr_bci);
     }
 
diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp
index 0bc2b71c892..f412484cbe0 100644
--- a/hotspot/src/share/vm/prims/whitebox.cpp
+++ b/hotspot/src/share/vm/prims/whitebox.cpp
@@ -24,6 +24,8 @@
 
 #include "precompiled.hpp"
 
+#include <new>
+
 #include "code/codeCache.hpp"
 #include "memory/metadataFactory.hpp"
 #include "memory/universe.hpp"
@@ -37,9 +39,11 @@
 
 #include "runtime/thread.hpp"
 #include "runtime/arguments.hpp"
+#include "runtime/deoptimization.hpp"
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/os.hpp"
 #include "runtime/vm_version.hpp"
+#include "runtime/sweeper.hpp"
 
 #include "utilities/array.hpp"
 #include "utilities/debug.hpp"
@@ -67,6 +71,7 @@ PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 #define SIZE_T_MAX_VALUE ((size_t) -1)
 
 bool WhiteBox::_used = false;
+volatile bool WhiteBox::compilation_locked = false;
 
 WB_ENTRY(jlong, WB_GetObjectAddress(JNIEnv* env, jobject o, jobject obj))
   return (jlong)(void*)JNIHandles::resolve(obj);
@@ -302,13 +307,12 @@ WB_END
 WB_ENTRY(jlong, WB_NMTReserveMemory(JNIEnv* env, jobject o, jlong size))
   jlong addr = 0;
 
-    addr = (jlong)(uintptr_t)os::reserve_memory(size);
-    MemTracker::record_virtual_memory_type((address)addr, mtTest);
+  addr = (jlong)(uintptr_t)os::reserve_memory(size);
+  MemTracker::record_virtual_memory_type((address)addr, mtTest);
 
   return addr;
 WB_END
 
-
 WB_ENTRY(void, WB_NMTCommitMemory(JNIEnv* env, jobject o, jlong addr, jlong size))
   os::commit_memory((char *)(uintptr_t)addr, size, !ExecMem);
   MemTracker::record_virtual_memory_type((address)(uintptr_t)addr, mtTest);
@@ -728,6 +732,29 @@ WB_ENTRY(void, WB_SetStringVMFlag(JNIEnv* env, jobject o, jstring name, jstring
 WB_END
 
 
+WB_ENTRY(void, WB_LockCompilation(JNIEnv* env, jobject o, jlong timeout))
+  WhiteBox::compilation_locked = true;
+WB_END
+
+WB_ENTRY(void, WB_UnlockCompilation(JNIEnv* env, jobject o))
+  MonitorLockerEx mo(Compilation_lock, Mutex::_no_safepoint_check_flag);
+  WhiteBox::compilation_locked = false;
+  mo.notify_all();
+WB_END
+
+void WhiteBox::force_sweep() {
+  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled");
+  {
+    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    NMethodSweeper::_should_sweep = true;
+  }
+  NMethodSweeper::possibly_sweep();
+}
+
+WB_ENTRY(void, WB_ForceNMethodSweep(JNIEnv* env, jobject o))
+  WhiteBox::force_sweep();
+WB_END
+
 WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString))
   ResourceMark rm(THREAD);
   int len;
@@ -774,6 +801,46 @@ WB_ENTRY(jstring, WB_GetCPUFeatures(JNIEnv* env, jobject o))
   return features_string;
 WB_END
 
+int WhiteBox::get_blob_type(const CodeBlob* code) {
+  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled");
+  return CodeCache::get_code_heap(code)->code_blob_type();
+}
+
+CodeHeap* WhiteBox::get_code_heap(int blob_type) {
+  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled");
+  return CodeCache::get_code_heap(blob_type);
+}
+
+struct CodeBlobStub {
+  CodeBlobStub(const CodeBlob* blob) :
+      name(os::strdup(blob->name())),
+      size(blob->size()),
+      blob_type(WhiteBox::get_blob_type(blob)) { }
+  ~CodeBlobStub() { os::free((void*) name); }
+  const char* const name;
+  const int         size;
+  const int         blob_type;
+};
+
+static jobjectArray codeBlob2objectArray(JavaThread* thread, JNIEnv* env, CodeBlobStub* cb) {
+  jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  jobjectArray result = env->NewObjectArray(3, clazz, NULL);
+
+  jstring name = env->NewStringUTF(cb->name);
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  env->SetObjectArrayElement(result, 0, name);
+
+  jobject obj = integerBox(thread, env, cb->size);
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  env->SetObjectArrayElement(result, 1, obj);
+
+  obj = integerBox(thread, env, cb->blob_type);
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  env->SetObjectArrayElement(result, 2, obj);
+
+  return result;
+}
 
 WB_ENTRY(jobjectArray, WB_GetNMethod(JNIEnv* env, jobject o, jobject method, jboolean is_osr))
   ResourceMark rm(THREAD);
@@ -790,27 +857,93 @@ WB_ENTRY(jobjectArray, WB_GetNMethod(JNIEnv* env, jobject o, jobject method, jbo
   ThreadToNativeFromVM ttn(thread);
   jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
   CHECK_JNI_EXCEPTION_(env, NULL);
-  result = env->NewObjectArray(3, clazz, NULL);
+  result = env->NewObjectArray(4, clazz, NULL);
   if (result == NULL) {
     return result;
   }
 
+  CodeBlobStub stub(code);
+  jobjectArray codeBlob = codeBlob2objectArray(thread, env, &stub);
+  env->SetObjectArrayElement(result, 0, codeBlob);
+
   jobject level = integerBox(thread, env, code->comp_level());
   CHECK_JNI_EXCEPTION_(env, NULL);
-  env->SetObjectArrayElement(result, 0, level);
+  env->SetObjectArrayElement(result, 1, level);
 
   jbyteArray insts = env->NewByteArray(insts_size);
   CHECK_JNI_EXCEPTION_(env, NULL);
   env->SetByteArrayRegion(insts, 0, insts_size, (jbyte*) code->insts_begin());
-  env->SetObjectArrayElement(result, 1, insts);
+  env->SetObjectArrayElement(result, 2, insts);
 
   jobject id = integerBox(thread, env, code->compile_id());
   CHECK_JNI_EXCEPTION_(env, NULL);
-  env->SetObjectArrayElement(result, 2, id);
+  env->SetObjectArrayElement(result, 3, id);
 
   return result;
 WB_END
 
+CodeBlob* WhiteBox::allocate_code_blob(int size, int blob_type) {
+  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled");
+  BufferBlob* blob;
+  int full_size = CodeBlob::align_code_offset(sizeof(BufferBlob));
+  if (full_size < size) {
+    full_size += round_to(size - full_size, oopSize);
+  }
+  {
+    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    blob = (BufferBlob*) CodeCache::allocate(full_size, blob_type);
+  }
+  // Track memory usage statistic after releasing CodeCache_lock
+  MemoryService::track_code_cache_memory_usage();
+  ::new (blob) BufferBlob("WB::DummyBlob", full_size);
+  return blob;
+}
+
+WB_ENTRY(jlong, WB_AllocateCodeBlob(JNIEnv* env, jobject o, jint size, jint blob_type))
+    return (jlong) WhiteBox::allocate_code_blob(size, blob_type);
+WB_END
+
+WB_ENTRY(void, WB_FreeCodeBlob(JNIEnv* env, jobject o, jlong addr))
+    BufferBlob::free((BufferBlob*) addr);
+WB_END
+
+WB_ENTRY(jobjectArray, WB_GetCodeHeapEntries(JNIEnv* env, jobject o, jint blob_type))
+  ResourceMark rm;
+  GrowableArray<CodeBlobStub*> blobs;
+  {
+    MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
+    CodeHeap* heap = WhiteBox::get_code_heap(blob_type);
+    if (heap == NULL) {
+      return NULL;
+    }
+    for (CodeBlob* cb = (CodeBlob*) heap->first();
+         cb != NULL; cb = (CodeBlob*) heap->next(cb)) {
+      CodeBlobStub* stub = NEW_RESOURCE_OBJ(CodeBlobStub);
+      new (stub) CodeBlobStub(cb);
+      blobs.append(stub);
+    }
+  }
+  if (blobs.length() == 0) {
+    return NULL;
+  }
+  ThreadToNativeFromVM ttn(thread);
+  jobjectArray result = NULL;
+  jclass clazz = env->FindClass(vmSymbols::java_lang_Object()->as_C_string());
+  CHECK_JNI_EXCEPTION_(env, NULL);
+  result = env->NewObjectArray(blobs.length(), clazz, NULL);
+  if (result == NULL) {
+    return result;
+  }
+  int i = 0;
+  for (GrowableArrayIterator<CodeBlobStub*> it = blobs.begin();
+       it != blobs.end(); ++it) {
+    jobjectArray obj = codeBlob2objectArray(thread, env, *it);
+    env->SetObjectArrayElement(result, i, obj);
+    ++i;
+  }
+  return result;
+WB_END
+
 WB_ENTRY(jlong, WB_GetThreadStackSize(JNIEnv* env, jobject o))
   return (jlong) Thread::current()->stack_size();
 WB_END
@@ -1018,6 +1151,8 @@ static JNINativeMethod methods[] = {
       CC"(Ljava/lang/reflect/Executable;II)Z",        (void*)&WB_EnqueueMethodForCompilation},
   {CC"clearMethodState",
       CC"(Ljava/lang/reflect/Executable;)V",          (void*)&WB_ClearMethodState},
+  {CC"lockCompilation",    CC"()V",                   (void*)&WB_LockCompilation},
+  {CC"unlockCompilation",  CC"()V",                   (void*)&WB_UnlockCompilation},
   {CC"isConstantVMFlag",   CC"(Ljava/lang/String;)Z", (void*)&WB_IsConstantVMFlag},
   {CC"isLockedVMFlag",     CC"(Ljava/lang/String;)Z", (void*)&WB_IsLockedVMFlag},
   {CC"setBooleanVMFlag",   CC"(Ljava/lang/String;Z)V",(void*)&WB_SetBooleanVMFlag},
@@ -1055,6 +1190,10 @@ static JNINativeMethod methods[] = {
   {CC"getCPUFeatures",     CC"()Ljava/lang/String;",  (void*)&WB_GetCPUFeatures     },
   {CC"getNMethod",         CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;",
                                                       (void*)&WB_GetNMethod         },
+  {CC"forceNMethodSweep",  CC"()V",                   (void*)&WB_ForceNMethodSweep  },
+  {CC"allocateCodeBlob",   CC"(II)J",                 (void*)&WB_AllocateCodeBlob   },
+  {CC"freeCodeBlob",       CC"(J)V",                  (void*)&WB_FreeCodeBlob       },
+  {CC"getCodeHeapEntries", CC"(I)[Ljava/lang/Object;",(void*)&WB_GetCodeHeapEntries },
   {CC"getThreadStackSize", CC"()J",                   (void*)&WB_GetThreadStackSize },
   {CC"getThreadRemainingStackSize", CC"()J",          (void*)&WB_GetThreadRemainingStackSize },
 };
diff --git a/hotspot/src/share/vm/prims/whitebox.hpp b/hotspot/src/share/vm/prims/whitebox.hpp
index 6461d1eb812..6325eef1568 100644
--- a/hotspot/src/share/vm/prims/whitebox.hpp
+++ b/hotspot/src/share/vm/prims/whitebox.hpp
@@ -54,17 +54,24 @@
     }                                                                  \
   } while (0)
 
+class CodeBlob;
+class CodeHeap;
+
 class WhiteBox : public AllStatic {
  private:
   static bool _used;
  public:
+  static volatile bool compilation_locked;
   static bool used()     { return _used; }
   static void set_used() { _used = true; }
   static int offset_for_field(const char* field_name, oop object,
     Symbol* signature_symbol);
   static const char* lookup_jstring(const char* field_name, oop object);
   static bool lookup_bool(const char* field_name, oop object);
-
+  static void force_sweep();
+  static int get_blob_type(const CodeBlob* code);
+  static CodeHeap* get_code_heap(int blob_type);
+  static CodeBlob* allocate_code_blob(int blob_type, int size);
   static int array_bytes_to_length(size_t bytes);
   static void register_methods(JNIEnv* env, jclass wbclass, JavaThread* thread,
     JNINativeMethod* method_array, int method_count);
diff --git a/hotspot/src/share/vm/runtime/mutexLocker.cpp b/hotspot/src/share/vm/runtime/mutexLocker.cpp
index 25a897a142f..9c8a3f0dc5e 100644
--- a/hotspot/src/share/vm/runtime/mutexLocker.cpp
+++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp
@@ -88,6 +88,7 @@ Mutex*   DerivedPointerTableGC_lock   = NULL;
 Mutex*   Compile_lock                 = NULL;
 Monitor* MethodCompileQueue_lock      = NULL;
 Monitor* CompileThread_lock           = NULL;
+Monitor* Compilation_lock             = NULL;
 Mutex*   CompileTaskAlloc_lock        = NULL;
 Mutex*   CompileStatistics_lock       = NULL;
 Mutex*   MultiArray_lock              = NULL;
@@ -278,7 +279,9 @@ void mutex_init() {
   def(ProfileVM_lock               , Monitor, special,   false); // used for profiling of the VMThread
   def(CompileThread_lock           , Monitor, nonleaf+5,   false );
   def(PeriodicTask_lock            , Monitor, nonleaf+5,   true);
-
+  if (WhiteBoxAPI) {
+    def(Compilation_lock           , Monitor, leaf,        false );
+  }
 #ifdef INCLUDE_TRACE
   def(JfrMsg_lock                  , Monitor, leaf,        true);
   def(JfrBuffer_lock               , Mutex,   leaf,        true);
diff --git a/hotspot/src/share/vm/runtime/mutexLocker.hpp b/hotspot/src/share/vm/runtime/mutexLocker.hpp
index 94d8adec813..6bfb0fd6533 100644
--- a/hotspot/src/share/vm/runtime/mutexLocker.hpp
+++ b/hotspot/src/share/vm/runtime/mutexLocker.hpp
@@ -91,6 +91,7 @@ extern Mutex*   EvacFailureStack_lock;           // guards the evac failure scan
 extern Mutex*   Compile_lock;                    // a lock held when Compilation is updating code (used to block CodeCache traversal, CHA updates, etc)
 extern Monitor* MethodCompileQueue_lock;         // a lock held when method compilations are enqueued, dequeued
 extern Monitor* CompileThread_lock;              // a lock held by compile threads during compilation system initialization
+extern Monitor* Compilation_lock;                // a lock used to pause compilation
 extern Mutex*   CompileTaskAlloc_lock;           // a lock held when CompileTasks are allocated
 extern Mutex*   CompileStatistics_lock;          // a lock held when updating compilation statistics
 extern Mutex*   MultiArray_lock;                 // a lock used to guard allocation of multi-dim arrays
diff --git a/hotspot/src/share/vm/runtime/sweeper.hpp b/hotspot/src/share/vm/runtime/sweeper.hpp
index 2da9425390e..e66c96adb23 100644
--- a/hotspot/src/share/vm/runtime/sweeper.hpp
+++ b/hotspot/src/share/vm/runtime/sweeper.hpp
@@ -25,6 +25,8 @@
 #ifndef SHARE_VM_RUNTIME_SWEEPER_HPP
 #define SHARE_VM_RUNTIME_SWEEPER_HPP
 
+class WhiteBox;
+
 #include "utilities/ticks.hpp"
 // An NmethodSweeper is an incremental cleaner for:
 //    - cleanup inline caches
@@ -52,6 +54,8 @@
 //     nmethod's space is freed.
 
 class NMethodSweeper : public AllStatic {
+  friend class WhiteBox;
+ private:
   static long      _traversals;                   // Stack scan count, also sweep ID.
   static long      _total_nof_code_cache_sweeps;  // Total number of full sweeps of the code cache
   static long      _time_counter;                 // Virtual time used to periodically invoke sweeper
@@ -88,7 +92,6 @@ class NMethodSweeper : public AllStatic {
   static void handle_safepoint_request();
   static void do_stack_scanning();
   static void possibly_sweep();
-
  public:
   static long traversal_count()              { return _traversals; }
   static int  total_nof_methods_reclaimed()  { return _total_nof_methods_reclaimed; }
diff --git a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
new file mode 100644
index 00000000000..3738b35b375
--- /dev/null
+++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2014, 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.lang.management.MemoryPoolMXBean;
+import java.util.EnumSet;
+import java.util.ArrayList;
+
+import sun.hotspot.WhiteBox;
+import sun.hotspot.code.BlobType;
+import com.oracle.java.testlibrary.Asserts;
+
+/*
+ * @test AllocationCodeBlobTest
+ * @bug 8059624
+ * @library /testlibrary /testlibrary/whitebox
+ * @build AllocationCodeBlobTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ *                   -XX:-SegmentedCodeCache AllocationCodeBlobTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ *                   -XX:+SegmentedCodeCache AllocationCodeBlobTest
+ * @summary testing of WB::allocate/freeCodeBlob()
+ */
+public class AllocationCodeBlobTest {
+    private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+    private static final long CODE_CACHE_SIZE
+            = WHITE_BOX.getUintxVMFlag("ReservedCodeCacheSize");
+    private static final int SIZE = 1;
+
+    public static void main(String[] args) {
+        // check that Sweeper handels dummy blobs correctly
+        new ForcedSweeper(500).start();
+        EnumSet<BlobType> blobTypes = BlobType.getAvailable();
+        for (BlobType type : blobTypes) {
+            new AllocationCodeBlobTest(type).test();
+        }
+    }
+
+    private final BlobType type;
+    private final MemoryPoolMXBean bean;
+    private AllocationCodeBlobTest(BlobType type) {
+        this.type = type;
+        bean = type.getMemoryPool();
+    }
+
+    private void test() {
+        System.out.printf("type %s%n", type);
+        long start = getUsage();
+        long addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id);
+        Asserts.assertNE(0, addr, "allocation failed");
+
+        long firstAllocation = getUsage();
+        Asserts.assertLTE(start + SIZE, firstAllocation,
+                "allocation should increase memory usage: "
+                + start + " + " + SIZE + " <= " + firstAllocation);
+
+        WHITE_BOX.freeCodeBlob(addr);
+        long firstFree = getUsage();
+        Asserts.assertLTE(firstFree, firstAllocation,
+                "free shouldn't increase memory usage: "
+                + firstFree + " <= " + firstAllocation);
+
+        addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id);
+        Asserts.assertNE(0, addr, "allocation failed");
+
+        long secondAllocation = getUsage();
+        Asserts.assertEQ(firstAllocation, secondAllocation);
+
+        WHITE_BOX.freeCodeBlob(addr);
+        System.out.println("allocating till possible...");
+        ArrayList<Long> blobs = new ArrayList<>();
+        int size = (int) (CODE_CACHE_SIZE >> 7);
+        while ((addr = WHITE_BOX.allocateCodeBlob(size, type.id)) != 0) {
+            blobs.add(addr);
+        }
+        for (Long blob : blobs) {
+            WHITE_BOX.freeCodeBlob(blob);
+        }
+    }
+
+    private long getUsage() {
+        return bean.getUsage().getUsed();
+    }
+
+    private static class ForcedSweeper extends Thread {
+        private final int millis;
+        public ForcedSweeper(int millis) {
+            super("ForcedSweeper");
+            setDaemon(true);
+            this.millis = millis;
+        }
+        public void run() {
+            try {
+                while (true) {
+                    WHITE_BOX.forceNMethodSweep();
+                    Thread.sleep(millis);
+                }
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                throw new Error(e);
+            }
+        }
+    }
+}
diff --git a/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java
new file mode 100644
index 00000000000..0fb35424efc
--- /dev/null
+++ b/hotspot/test/compiler/whitebox/GetCodeHeapEntriesTest.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2014, 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.util.Arrays;
+import java.util.EnumSet;
+
+import sun.hotspot.WhiteBox;
+import sun.hotspot.code.CodeBlob;
+import sun.hotspot.code.BlobType;
+import com.oracle.java.testlibrary.Asserts;
+
+/*
+ * @test GetCodeHeapEntriesTest
+ * @bug 8059624
+ * @library /testlibrary /testlibrary/whitebox
+ * @build GetCodeHeapEntriesTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:-SegmentedCodeCache
+ *                   GetCodeHeapEntriesTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:+SegmentedCodeCache
+ *                   GetCodeHeapEntriesTest
+ * @summary testing of WB::getCodeHeapEntries()
+ */
+public class GetCodeHeapEntriesTest {
+    private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+    private static final int SIZE = 1024;
+    private static final String DUMMY_NAME = "WB::DummyBlob";
+    private static EnumSet<BlobType> SEGMENTED_TYPES
+            = EnumSet.complementOf(EnumSet.of(BlobType.All));
+
+    public static void main(String[] args) {
+        EnumSet<BlobType> blobTypes = BlobType.getAvailable();
+        for (BlobType type : blobTypes) {
+            new GetCodeHeapEntriesTest(type).test();
+        }
+    }
+
+    private final BlobType type;
+    private GetCodeHeapEntriesTest(BlobType type) {
+        this.type = type;
+    }
+
+    private void test() {
+        System.out.printf("type %s%n", type);
+        long addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id);
+        Asserts.assertNE(0, addr, "allocation failed");
+        CodeBlob[] blobs = CodeBlob.getCodeBlobs(type);
+        Asserts.assertNotNull(blobs);
+        CodeBlob blob = Arrays.stream(blobs)
+                              .filter(GetCodeHeapEntriesTest::filter)
+                              .findAny()
+                              .get();
+        Asserts.assertNotNull(blob);
+        Asserts.assertEQ(blob.code_blob_type, type);
+        Asserts.assertGTE(blob.size, SIZE);
+
+        WHITE_BOX.freeCodeBlob(addr);
+        blobs = CodeBlob.getCodeBlobs(type);
+        long count = Arrays.stream(blobs)
+                           .filter(GetCodeHeapEntriesTest::filter)
+                           .count();
+        Asserts.assertEQ(0L, count);
+    }
+
+    private static boolean filter(CodeBlob blob) {
+        if (blob == null) {
+            return false;
+        }
+        return DUMMY_NAME.equals(blob.name);
+    }
+}
diff --git a/hotspot/test/compiler/whitebox/GetNMethodTest.java b/hotspot/test/compiler/whitebox/GetNMethodTest.java
index 25373808fd2..dc3d35d42e0 100644
--- a/hotspot/test/compiler/whitebox/GetNMethodTest.java
+++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java
@@ -22,7 +22,9 @@
  *
  */
 
+import sun.hotspot.code.BlobType;
 import sun.hotspot.code.NMethod;
+import com.oracle.java.testlibrary.Asserts;
 
 /*
  * @test GetNMethodTest
@@ -52,21 +54,46 @@ public class GetNMethodTest extends CompilerWhiteBoxTest {
 
         compile();
         checkCompiled();
+
         NMethod nmethod = NMethod.get(method, testCase.isOsr());
         if (IS_VERBOSE) {
             System.out.println("nmethod = " + nmethod);
         }
-        if (nmethod == null) {
-            throw new RuntimeException("nmethod of compiled method is null");
-        }
-        if (nmethod.insts.length == 0) {
-            throw new RuntimeException("compiled method's instructions is empty");
+        Asserts.assertNotNull(nmethod,
+                "nmethod of compiled method is null");
+        Asserts.assertNotNull(nmethod.insts,
+                "nmethod.insts of compiled method is null");
+        Asserts.assertGT(nmethod.insts.length, 0,
+                "compiled method's instructions is empty");
+        Asserts.assertNotNull(nmethod.code_blob_type, "blob type is null");
+        if (WHITE_BOX.getBooleanVMFlag("SegmentedCodeCache")) {
+            Asserts.assertNE(nmethod.code_blob_type, BlobType.All);
+            switch (nmethod.comp_level) {
+            case 1:
+            case 4:
+                checkBlockType(nmethod, BlobType.MethodNonProfiled);
+                break;
+            case 2:
+            case 3:
+                checkBlockType(nmethod, BlobType.MethodNonProfiled);
+                break;
+            default:
+                throw new Error("unexpected comp level " + nmethod);
+            }
+        } else {
+            Asserts.assertEQ(nmethod.code_blob_type, BlobType.All);
         }
+
         deoptimize();
         checkNotCompiled();
         nmethod = NMethod.get(method, testCase.isOsr());
-        if (nmethod != null) {
-            throw new RuntimeException("nmethod of non-compiled method isn't null");
-        }
+        Asserts.assertNull(nmethod,
+                "nmethod of non-compiled method isn't null");
+    }
+
+    private void checkBlockType(NMethod nmethod, BlobType expectedType) {
+        Asserts.assertEQ(nmethod.code_blob_type, expectedType,
+                String.format("blob_type[%s] for %d level isn't %s",
+                        nmethod.code_blob_type, nmethod.comp_level, expectedType));
     }
 }
diff --git a/hotspot/test/compiler/whitebox/LockCompilationTest.java b/hotspot/test/compiler/whitebox/LockCompilationTest.java
new file mode 100644
index 00000000000..5f16481a6de
--- /dev/null
+++ b/hotspot/test/compiler/whitebox/LockCompilationTest.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, 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 LockCompilationTest
+ * @bug 8059624
+ * @library /testlibrary /testlibrary/whitebox
+ * @build LockCompilationTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm/timeout=600 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* LockCompilationTest
+ * @summary testing of WB::lock/unlockCompilation()
+ */
+
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
+
+import com.oracle.java.testlibrary.Asserts;
+
+public class LockCompilationTest extends CompilerWhiteBoxTest {
+    public static void main(String[] args) throws Exception {
+        CompilerWhiteBoxTest.main(LockCompilationTest::new, args);
+    }
+
+    private LockCompilationTest(TestCase testCase) {
+        super(testCase);
+        // to prevent inlining of #method
+        WHITE_BOX.testSetDontInlineMethod(method, true);
+    }
+
+    protected void test() throws Exception {
+        checkNotCompiled();
+
+        System.out.println("locking compilation");
+        WHITE_BOX.lockCompilation();
+
+        try {
+            System.out.println("trying to compile");
+            compile();
+            // to check if it works correctly w/ safepoints
+            System.out.println("going to safepoint");
+            WHITE_BOX.fullGC();
+            waitBackgroundCompilation();
+            Asserts.assertTrue(
+                    WHITE_BOX.isMethodQueuedForCompilation(method),
+                    method + " must be in queue");
+            Asserts.assertFalse(
+                    WHITE_BOX.isMethodCompiled(method, false),
+                    method + " must be not compiled");
+            Asserts.assertEQ(
+                    WHITE_BOX.getMethodCompilationLevel(method, false), 0,
+                    method + " comp_level must be == 0");
+            Asserts.assertFalse(
+                    WHITE_BOX.isMethodCompiled(method, true),
+                    method + " must be not osr_compiled");
+            Asserts.assertEQ(
+                    WHITE_BOX.getMethodCompilationLevel(method, true), 0,
+                    method + " osr_comp_level must be == 0");
+        } finally {
+            System.out.println("unlocking compilation");
+            WHITE_BOX.unlockCompilation();
+        }
+        waitBackgroundCompilation();
+        Asserts.assertFalse(
+                WHITE_BOX.isMethodQueuedForCompilation(method),
+                method + " must not be in queue");
+    }
+}
+
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
index a5a07947954..08e8c80863d 100644
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
@@ -143,8 +143,14 @@ public class WhiteBox {
   }
   public native boolean enqueueMethodForCompilation(Executable method, int compLevel, int entry_bci);
   public native void    clearMethodState(Executable method);
+  public native void    lockCompilation();
+  public native void    unlockCompilation();
   public native int     getMethodEntryBci(Executable method);
   public native Object[] getNMethod(Executable method, boolean isOsr);
+  public native long    allocateCodeBlob(int size, int type);
+  public native void    freeCodeBlob(long addr);
+  public native void    forceNMethodSweep();
+  public native Object[] getCodeHeapEntries(int type);
 
   // Intered strings
   public native boolean isInStringTable(String str);
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java
new file mode 100644
index 00000000000..ee273bcd916
--- /dev/null
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ */
+
+package sun.hotspot.code;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.MemoryPoolMXBean;
+import java.util.EnumSet;
+
+import sun.hotspot.WhiteBox;
+
+public enum BlobType {
+    // Execution level 1 and 4 (non-profiled) nmethods (including native nmethods)
+    MethodNonProfiled(0, "CodeHeap 'non-profiled nmethods'"),
+    // Execution level 2 and 3 (profiled) nmethods
+    MethodProfiled(1, "CodeHeap 'profiled nmethods'"),
+    // Non-nmethods like Buffers, Adapters and Runtime Stubs
+    NonNMethod(2, "CodeHeap 'non-nmethods'"),
+    // All types (No code cache segmentation)
+    All(3, "CodeCache");
+
+    public final int id;
+    private final String beanName;
+
+    private BlobType(int id, String beanName) {
+        this.id = id;
+        this.beanName = beanName;
+    }
+
+    public MemoryPoolMXBean getMemoryPool() {
+        for (MemoryPoolMXBean bean : ManagementFactory.getMemoryPoolMXBeans()) {
+            String name = bean.getName();
+            if (beanName.equals(name)) {
+                return bean;
+            }
+        }
+        return null;
+    }
+    public static EnumSet<BlobType> getAvailable() {
+        WhiteBox whiteBox = WhiteBox.getWhiteBox();
+        if (!whiteBox.getBooleanVMFlag("SegmentedCodeCache")) {
+            // only All for non segmented world
+            return EnumSet.of(All);
+        }
+        if (System.getProperty("java.vm.info").startsWith("interpreted ")) {
+            // only NonNMethod for -Xint
+            return EnumSet.of(NonNMethod);
+        }
+
+        EnumSet<BlobType> result = EnumSet.complementOf(EnumSet.of(All));
+        if (!whiteBox.getBooleanVMFlag("TieredCompilation")
+                || whiteBox.getIntxVMFlag("TieredStopAtLevel") <= 1) {
+            // there is no MethodProfiled in non tiered world or pure C1
+            result.remove(MethodProfiled);
+        }
+        return result;
+    }
+}
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java
new file mode 100644
index 00000000000..66556ddaa7c
--- /dev/null
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ */
+
+package sun.hotspot.code;
+
+import sun.hotspot.WhiteBox;
+
+public class CodeBlob {
+  private static final WhiteBox WB = WhiteBox.getWhiteBox();
+  public static CodeBlob[] getCodeBlobs(BlobType type) {
+    Object[] obj = WB.getCodeHeapEntries(type.id);
+    if (obj == null) {
+      return null;
+    }
+    CodeBlob[] result = new CodeBlob[obj.length];
+    for (int i = 0, n = result.length; i < n; ++i) {
+      result[i] = new CodeBlob((Object[]) obj[i]);
+    }
+    return result;
+  }
+  protected CodeBlob(Object[] obj) {
+    assert obj.length == 3;
+    name = (String) obj[0];
+    size = (Integer) obj[1];
+    code_blob_type = BlobType.values()[(Integer) obj[2]];
+    assert code_blob_type.id == (Integer) obj[2];
+  }
+  public final String name;
+  public final int size;
+  public final BlobType code_blob_type;
+
+  @Override
+  public String toString() {
+    return "CodeBlob{"
+        + "name=" + name
+        + ", size=" + size
+        + ", code_blob_type=" + code_blob_type
+        + '}';
+  }
+}
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java
index 9ac182df343..f82b38d8710 100644
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/NMethod.java
@@ -27,28 +27,30 @@ package sun.hotspot.code;
 import java.lang.reflect.Executable;
 import sun.hotspot.WhiteBox;
 
-public class NMethod {
+public class NMethod extends CodeBlob {
   private static final WhiteBox wb = WhiteBox.getWhiteBox();
   public static NMethod get(Executable method, boolean isOsr) {
     Object[] obj = wb.getNMethod(method, isOsr);
     return obj == null ? null : new NMethod(obj);
   }
   private NMethod(Object[] obj) {
-    assert obj.length == 3;
-    comp_level = (Integer) obj[0];
-    insts = (byte[]) obj[1];
-    compile_id = (Integer) obj[2];
+    super((Object[])obj[0]);
+    assert obj.length == 4;
+    comp_level = (Integer) obj[1];
+    insts = (byte[]) obj[2];
+    compile_id = (Integer) obj[3];
   }
-  public byte[] insts;
-  public int comp_level;
-  public int compile_id;
+  public final byte[] insts;
+  public final int comp_level;
+  public final int compile_id;
 
   @Override
   public String toString() {
-    return "NMethod{" +
-        "insts=" + insts +
-        ", comp_level=" + comp_level +
-        ", compile_id=" + compile_id +
-        '}';
+    return "NMethod{"
+        + super.toString()
+        + ", insts=" + insts
+        + ", comp_level=" + comp_level
+        + ", compile_id=" + compile_id
+        + '}';
   }
 }

From c278cc80e9fe9f75d5dcd943b9e3438416bf969f Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Fri, 5 Dec 2014 17:36:18 -0800
Subject: [PATCH 053/299] 8066638: Suppress deprecation warnings in jdk.crypto
 module 8066641: Suppress deprecation warnings in jdk.naming module

Reviewed-by: wetmore, xuelei, valeriep, lancea
---
 .../share/classes/sun/security/pkcs11/P11Key.java            | 3 ++-
 .../share/classes/sun/security/pkcs11/P11RSACipher.java      | 4 +++-
 .../share/classes/sun/security/pkcs11/P11Signature.java      | 2 ++
 .../sun/security/pkcs11/P11TlsKeyMaterialGenerator.java      | 5 ++++-
 .../sun/security/pkcs11/P11TlsMasterSecretGenerator.java     | 4 +++-
 .../classes/sun/security/pkcs11/P11TlsPrfGenerator.java      | 4 +++-
 .../security/pkcs11/P11TlsRsaPremasterSecretGenerator.java   | 4 +++-
 .../classes/com/sun/jndi/rmi/registry/RegistryContext.java   | 4 +++-
 8 files changed, 23 insertions(+), 7 deletions(-)

diff --git a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Key.java b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Key.java
index 235c1488a44..652bf0cbd92 100644
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Key.java
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Key.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -445,6 +445,7 @@ abstract class P11Key implements Key, Length {
         }
     }
 
+    @SuppressWarnings("deprecation")
     private static class P11TlsMasterSecretKey extends P11SecretKey
             implements TlsMasterSecret {
         private static final long serialVersionUID = -1318560923770573441L;
diff --git a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11RSACipher.java b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11RSACipher.java
index 253b8913a82..bc65e2f2424 100644
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11RSACipher.java
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11RSACipher.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -169,6 +169,7 @@ final class P11RSACipher extends CipherSpi {
     }
 
     // see JCE spec
+    @SuppressWarnings("deprecation")
     protected void engineInit(int opmode, Key key,
             AlgorithmParameterSpec params, SecureRandom random)
             throws InvalidKeyException, InvalidAlgorithmParameterException {
@@ -461,6 +462,7 @@ final class P11RSACipher extends CipherSpi {
     }
 
     // see JCE spec
+    @SuppressWarnings("deprecation")
     protected Key engineUnwrap(byte[] wrappedKey, String algorithm,
             int type) throws InvalidKeyException, NoSuchAlgorithmException {
 
diff --git a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Signature.java b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Signature.java
index 1bac22ca62c..e5f498ffc71 100644
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Signature.java
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11Signature.java
@@ -765,12 +765,14 @@ final class P11Signature extends SignatureSpi {
     }
 
     // see JCA spec
+    @SuppressWarnings("deprecation")
     protected void engineSetParameter(String param, Object value)
             throws InvalidParameterException {
         throw new UnsupportedOperationException("setParameter() not supported");
     }
 
     // see JCA spec
+    @SuppressWarnings("deprecation")
     protected Object engineGetParameter(String param)
             throws InvalidParameterException {
         throw new UnsupportedOperationException("getParameter() not supported");
diff --git a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsKeyMaterialGenerator.java b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsKeyMaterialGenerator.java
index babebabf008..c054f312c55 100644
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsKeyMaterialGenerator.java
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsKeyMaterialGenerator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -62,6 +62,7 @@ public final class P11TlsKeyMaterialGenerator extends KeyGeneratorSpi {
     private long mechanism;
 
     // parameter spec
+    @SuppressWarnings("deprecation")
     private TlsKeyMaterialParameterSpec spec;
 
     // master secret as a P11Key
@@ -82,6 +83,7 @@ public final class P11TlsKeyMaterialGenerator extends KeyGeneratorSpi {
         throw new InvalidParameterException(MSG);
     }
 
+    @SuppressWarnings("deprecation")
     protected void engineInit(AlgorithmParameterSpec params,
             SecureRandom random) throws InvalidAlgorithmParameterException {
         if (params instanceof TlsKeyMaterialParameterSpec == false) {
@@ -107,6 +109,7 @@ public final class P11TlsKeyMaterialGenerator extends KeyGeneratorSpi {
         throw new InvalidParameterException(MSG);
     }
 
+    @SuppressWarnings("deprecation")
     protected SecretKey engineGenerateKey() {
         if (spec == null) {
             throw new IllegalStateException
diff --git a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsMasterSecretGenerator.java b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsMasterSecretGenerator.java
index ef30daf41fc..73a2ac2e890 100644
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsMasterSecretGenerator.java
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsMasterSecretGenerator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,6 +57,7 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
     // mechanism id
     private long mechanism;
 
+    @SuppressWarnings("deprecation")
     private TlsMasterSecretParameterSpec spec;
     private P11Key p11Key;
 
@@ -74,6 +75,7 @@ public final class P11TlsMasterSecretGenerator extends KeyGeneratorSpi {
         throw new InvalidParameterException(MSG);
     }
 
+    @SuppressWarnings("deprecation")
     protected void engineInit(AlgorithmParameterSpec params,
             SecureRandom random) throws InvalidAlgorithmParameterException {
         if (params instanceof TlsMasterSecretParameterSpec == false) {
diff --git a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java
index 86bee16a72f..739f66965d4 100644
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsPrfGenerator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -63,6 +63,7 @@ final class P11TlsPrfGenerator extends KeyGeneratorSpi {
     // mechanism id
     private final long mechanism;
 
+    @SuppressWarnings("deprecation")
     private TlsPrfParameterSpec spec;
 
     private P11Key p11Key;
@@ -79,6 +80,7 @@ final class P11TlsPrfGenerator extends KeyGeneratorSpi {
         throw new InvalidParameterException(MSG);
     }
 
+    @SuppressWarnings("deprecation")
     protected void engineInit(AlgorithmParameterSpec params,
             SecureRandom random) throws InvalidAlgorithmParameterException {
         if (params instanceof TlsPrfParameterSpec == false) {
diff --git a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java
index 21c853794bc..40d3a634ce5 100644
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11TlsRsaPremasterSecretGenerator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,6 +57,7 @@ final class P11TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi {
     // mechanism id
     private long mechanism;
 
+    @SuppressWarnings("deprecation")
     private TlsRsaPremasterSecretParameterSpec spec;
 
     P11TlsRsaPremasterSecretGenerator(Token token, String algorithm, long mechanism)
@@ -71,6 +72,7 @@ final class P11TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi {
         throw new InvalidParameterException(MSG);
     }
 
+    @SuppressWarnings("deprecation")
     protected void engineInit(AlgorithmParameterSpec params,
             SecureRandom random) throws InvalidAlgorithmParameterException {
         if (!(params instanceof TlsRsaPremasterSecretParameterSpec)) {
diff --git a/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java b/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java
index a6de4af5cd8..cf3de07fe79 100644
--- a/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java
+++ b/jdk/src/jdk.naming.rmi/share/classes/com/sun/jndi/rmi/registry/RegistryContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -353,6 +353,7 @@ public class RegistryContext implements Context, Referenceable {
     /**
      * Wrap a RemoteException inside a NamingException.
      */
+    @SuppressWarnings("deprecation")
     public static NamingException wrapRemoteException(RemoteException re) {
 
         NamingException ne;
@@ -413,6 +414,7 @@ public class RegistryContext implements Context, Referenceable {
      * Attempts to install a security manager if none is currently in
      * place.
      */
+    @SuppressWarnings("deprecation")
     private static void installSecurityMgr() {
 
         try {

From 9eafb6c406bc3f4d68ef116e69029898d0f56cca Mon Sep 17 00:00:00 2001
From: Kirk Shoop <kirk.shoop@microsoft.com>
Date: Sun, 7 Dec 2014 07:10:29 +0000
Subject: [PATCH 054/299] 8064407: (fc) FileChannel transferTo should use
 TransmitFile on Windows

Co-authored-by: Valeriy Kopylov <v-valkop@microsoft.com>
Reviewed-by: alanb
---
 .../classes/sun/nio/ch/FileChannelImpl.java   | 81 +++++++++++++------
 .../classes/sun/nio/ch/FileDispatcher.java    |  8 +-
 .../sun/nio/ch/FileDispatcherImpl.java        | 14 +++-
 .../unix/native/libnio/ch/FileChannelImpl.c   |  7 +-
 .../sun/nio/ch/FileDispatcherImpl.java        | 46 +++++++++--
 .../native/libnio/ch/FileChannelImpl.c        | 43 +++++++++-
 .../FileChannel/TransferToChannel.java        |  2 +
 7 files changed, 160 insertions(+), 41 deletions(-)

diff --git a/jdk/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java b/jdk/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java
index 2c3102feadd..8f18d44d63e 100644
--- a/jdk/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/FileChannelImpl.java
@@ -38,6 +38,7 @@ import java.nio.channels.NonReadableChannelException;
 import java.nio.channels.NonWritableChannelException;
 import java.nio.channels.OverlappingFileLockException;
 import java.nio.channels.ReadableByteChannel;
+import java.nio.channels.SelectableChannel;
 import java.nio.channels.WritableByteChannel;
 import java.security.AccessController;
 import java.util.ArrayList;
@@ -404,30 +405,13 @@ public class FileChannelImpl
     //
     private static volatile boolean fileSupported = true;
 
-    private long transferToDirectly(long position, int icount,
-                                    WritableByteChannel target)
+    private long transferToDirectlyInternal(long position, int icount,
+                                            WritableByteChannel target,
+                                            FileDescriptor targetFD)
         throws IOException
     {
-        if (!transferSupported)
-            return IOStatus.UNSUPPORTED;
-
-        FileDescriptor targetFD = null;
-        if (target instanceof FileChannelImpl) {
-            if (!fileSupported)
-                return IOStatus.UNSUPPORTED_CASE;
-            targetFD = ((FileChannelImpl)target).fd;
-        } else if (target instanceof SelChImpl) {
-            // Direct transfer to pipe causes EINVAL on some configurations
-            if ((target instanceof SinkChannelImpl) && !pipeSupported)
-                return IOStatus.UNSUPPORTED_CASE;
-            targetFD = ((SelChImpl)target).getFD();
-        }
-        if (targetFD == null)
-            return IOStatus.UNSUPPORTED;
-        int thisFDVal = IOUtil.fdVal(fd);
-        int targetFDVal = IOUtil.fdVal(targetFD);
-        if (thisFDVal == targetFDVal) // Not supported on some configurations
-            return IOStatus.UNSUPPORTED;
+        assert !nd.transferToDirectlyNeedsPositionLock() ||
+               Thread.holdsLock(positionLock);
 
         long n = -1;
         int ti = -1;
@@ -437,7 +421,7 @@ public class FileChannelImpl
             if (!isOpen())
                 return -1;
             do {
-                n = transferTo0(thisFDVal, position, icount, targetFDVal);
+                n = transferTo0(fd, position, icount, targetFD);
             } while ((n == IOStatus.INTERRUPTED) && isOpen());
             if (n == IOStatus.UNSUPPORTED_CASE) {
                 if (target instanceof SinkChannelImpl)
@@ -458,6 +442,54 @@ public class FileChannelImpl
         }
     }
 
+    private long transferToDirectly(long position, int icount,
+                                    WritableByteChannel target)
+        throws IOException
+    {
+        if (!transferSupported)
+            return IOStatus.UNSUPPORTED;
+
+        FileDescriptor targetFD = null;
+        if (target instanceof FileChannelImpl) {
+            if (!fileSupported)
+                return IOStatus.UNSUPPORTED_CASE;
+            targetFD = ((FileChannelImpl)target).fd;
+        } else if (target instanceof SelChImpl) {
+            // Direct transfer to pipe causes EINVAL on some configurations
+            if ((target instanceof SinkChannelImpl) && !pipeSupported)
+                return IOStatus.UNSUPPORTED_CASE;
+
+            // Platform-specific restrictions. Now there is only one:
+            // Direct transfer to non-blocking channel could be forbidden
+            SelectableChannel sc = (SelectableChannel)target;
+            if (!nd.canTransferToDirectly(sc))
+                return IOStatus.UNSUPPORTED_CASE;
+
+            targetFD = ((SelChImpl)target).getFD();
+        }
+
+        if (targetFD == null)
+            return IOStatus.UNSUPPORTED;
+        int thisFDVal = IOUtil.fdVal(fd);
+        int targetFDVal = IOUtil.fdVal(targetFD);
+        if (thisFDVal == targetFDVal) // Not supported on some configurations
+            return IOStatus.UNSUPPORTED;
+
+        if (nd.transferToDirectlyNeedsPositionLock()) {
+            synchronized (positionLock) {
+                long pos = position();
+                try {
+                    return transferToDirectlyInternal(position, icount,
+                                                      target, targetFD);
+                } finally {
+                    position(pos);
+                }
+            }
+        } else {
+            return transferToDirectlyInternal(position, icount, target, targetFD);
+        }
+    }
+
     // Maximum size to map when using a mapped buffer
     private static final long MAPPED_TRANSFER_SIZE = 8L*1024L*1024L;
 
@@ -1173,7 +1205,8 @@ public class FileChannelImpl
     private static native int unmap0(long address, long length);
 
     // Transfers from src to dst, or returns -2 if kernel can't do that
-    private native long transferTo0(int src, long position, long count, int dst);
+    private native long transferTo0(FileDescriptor src, long position,
+                                    long count, FileDescriptor dst);
 
     // Sets or reports this file's position
     // If offset is -1, the current position is returned
diff --git a/jdk/src/java.base/share/classes/sun/nio/ch/FileDispatcher.java b/jdk/src/java.base/share/classes/sun/nio/ch/FileDispatcher.java
index 6e5df225080..5e9f82fc037 100644
--- a/jdk/src/java.base/share/classes/sun/nio/ch/FileDispatcher.java
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/FileDispatcher.java
@@ -25,7 +25,9 @@
 
 package sun.nio.ch;
 
-import java.io.*;
+import java.io.FileDescriptor;
+import java.io.IOException;
+import java.nio.channels.SelectableChannel;
 
 abstract class FileDispatcher extends NativeDispatcher {
 
@@ -53,4 +55,8 @@ abstract class FileDispatcher extends NativeDispatcher {
      */
     abstract FileDescriptor duplicateForMapping(FileDescriptor fd)
         throws IOException;
+
+    abstract boolean canTransferToDirectly(SelectableChannel sc);
+
+    abstract boolean transferToDirectlyNeedsPositionLock();
 }
diff --git a/jdk/src/java.base/unix/classes/sun/nio/ch/FileDispatcherImpl.java b/jdk/src/java.base/unix/classes/sun/nio/ch/FileDispatcherImpl.java
index c6c85f7fac9..9d960e2d2e0 100644
--- a/jdk/src/java.base/unix/classes/sun/nio/ch/FileDispatcherImpl.java
+++ b/jdk/src/java.base/unix/classes/sun/nio/ch/FileDispatcherImpl.java
@@ -25,10 +25,10 @@
 
 package sun.nio.ch;
 
-import java.io.*;
+import java.io.FileDescriptor;
+import java.io.IOException;
 
-class FileDispatcherImpl extends FileDispatcher
-{
+class FileDispatcherImpl extends FileDispatcher {
 
     static {
         IOUtil.load();
@@ -104,6 +104,14 @@ class FileDispatcherImpl extends FileDispatcher
         return new FileDescriptor();
     }
 
+    boolean canTransferToDirectly(java.nio.channels.SelectableChannel sc) {
+        return true;
+    }
+
+    boolean transferToDirectlyNeedsPositionLock() {
+        return false;
+    }
+
     // -- Native methods --
 
     static native int read0(FileDescriptor fd, long address, int len)
diff --git a/jdk/src/java.base/unix/native/libnio/ch/FileChannelImpl.c b/jdk/src/java.base/unix/native/libnio/ch/FileChannelImpl.c
index 895289067d6..d8face71c37 100644
--- a/jdk/src/java.base/unix/native/libnio/ch/FileChannelImpl.c
+++ b/jdk/src/java.base/unix/native/libnio/ch/FileChannelImpl.c
@@ -154,10 +154,13 @@ Java_sun_nio_ch_FileChannelImpl_close0(JNIEnv *env, jobject this, jobject fdo)
 
 JNIEXPORT jlong JNICALL
 Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
-                                            jint srcFD,
+                                            jobject srcFDO,
                                             jlong position, jlong count,
-                                            jint dstFD)
+                                            jobject dstFDO)
 {
+    jint srcFD = fdval(env, srcFDO);
+    jint dstFD = fdval(env, dstFDO);
+
 #if defined(__linux__)
     off64_t offset = (off64_t)position;
     jlong n = sendfile64(dstFD, srcFD, &offset, (size_t)count);
diff --git a/jdk/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java b/jdk/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java
index 19997d0c1ec..c767a34cc08 100644
--- a/jdk/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java
+++ b/jdk/src/java.base/windows/classes/sun/nio/ch/FileDispatcherImpl.java
@@ -25,21 +25,21 @@
 
 package sun.nio.ch;
 
-import java.io.*;
+import java.io.FileDescriptor;
+import java.io.IOException;
+import java.security.PrivilegedAction;
 import sun.misc.SharedSecrets;
 import sun.misc.JavaIOFileDescriptorAccess;
 
-class FileDispatcherImpl extends FileDispatcher
-{
+class FileDispatcherImpl extends FileDispatcher {
+
     private static final JavaIOFileDescriptorAccess fdAccess =
         SharedSecrets.getJavaIOFileDescriptorAccess();
 
-    static {
-        IOUtil.load();
-    }
+    // set to true if fast file transmission (TransmitFile) is enabled
+    private static final boolean fastFileTransfer;
 
-    FileDispatcherImpl() {
-    }
+    FileDispatcherImpl() { }
 
     @Override
     boolean needsPositionLock() {
@@ -110,6 +110,36 @@ class FileDispatcherImpl extends FileDispatcher
         return result;
     }
 
+    boolean canTransferToDirectly(java.nio.channels.SelectableChannel sc) {
+        return fastFileTransfer && sc.isBlocking();
+    }
+
+    boolean transferToDirectlyNeedsPositionLock() {
+        return true;
+    }
+
+    static boolean isFastFileTransferRequested() {
+        String fileTransferProp = java.security.AccessController.doPrivileged(
+            new PrivilegedAction<String>() {
+                @Override
+                public String run() {
+                    return System.getProperty("jdk.net.enableFastFileTransfer");
+                }
+            });
+        boolean enable;
+        if ("".equals(fileTransferProp)) {
+            enable = true;
+        } else {
+            enable = Boolean.parseBoolean(fileTransferProp);
+        }
+        return enable;
+    }
+
+    static {
+        IOUtil.load();
+        fastFileTransfer = isFastFileTransferRequested();
+    }
+
     //-- Native methods
 
     static native int read0(FileDescriptor fd, long address, int len)
diff --git a/jdk/src/java.base/windows/native/libnio/ch/FileChannelImpl.c b/jdk/src/java.base/windows/native/libnio/ch/FileChannelImpl.c
index 0c03958aa33..2e0a6ca0fd9 100644
--- a/jdk/src/java.base/windows/native/libnio/ch/FileChannelImpl.c
+++ b/jdk/src/java.base/windows/native/libnio/ch/FileChannelImpl.c
@@ -31,6 +31,10 @@
 #include "nio.h"
 #include "nio_util.h"
 #include "sun_nio_ch_FileChannelImpl.h"
+#include "java_lang_Integer.h"
+
+#include <Mswsock.h>
+#pragma comment(lib, "Mswsock.lib")
 
 static jfieldID chan_fd; /* id for jobject 'fd' in java.io.FileChannel */
 
@@ -175,9 +179,42 @@ Java_sun_nio_ch_FileChannelImpl_close0(JNIEnv *env, jobject this, jobject fdo)
 
 JNIEXPORT jlong JNICALL
 Java_sun_nio_ch_FileChannelImpl_transferTo0(JNIEnv *env, jobject this,
-                                            jint srcFD,
+                                            jobject srcFD,
                                             jlong position, jlong count,
-                                            jint dstFD)
+                                            jobject dstFD)
 {
-    return IOS_UNSUPPORTED;
+    const int PACKET_SIZE = 524288;
+
+    HANDLE src = (HANDLE)(handleval(env, srcFD));
+    SOCKET dst = (SOCKET)(fdval(env, dstFD));
+    DWORD chunkSize = (count > java_lang_Integer_MAX_VALUE) ?
+        java_lang_Integer_MAX_VALUE : (DWORD)count;
+    BOOL result = 0;
+
+    jlong pos = Java_sun_nio_ch_FileChannelImpl_position0(env, this, srcFD, position);
+    if (pos == IOS_THROWN) {
+        return IOS_THROWN;
+    }
+
+    result = TransmitFile(
+        dst,
+        src,
+        chunkSize,
+        PACKET_SIZE,
+        NULL,
+        NULL,
+        TF_USE_KERNEL_APC
+    );
+    if (!result) {
+        int error = WSAGetLastError();
+        if (WSAEINVAL == error && count >= 0) {
+            return IOS_UNSUPPORTED_CASE;
+        }
+        if (WSAENOTSOCK == error) {
+            return IOS_UNSUPPORTED_CASE;
+        }
+        JNU_ThrowIOExceptionWithLastError(env, "transfer failed");
+        return IOS_THROWN;
+    }
+    return chunkSize;
 }
diff --git a/jdk/test/java/nio/channels/FileChannel/TransferToChannel.java b/jdk/test/java/nio/channels/FileChannel/TransferToChannel.java
index 05069d296dc..2aa1b4bd2cc 100644
--- a/jdk/test/java/nio/channels/FileChannel/TransferToChannel.java
+++ b/jdk/test/java/nio/channels/FileChannel/TransferToChannel.java
@@ -24,6 +24,8 @@
 /* @test
  * @bug 4652496
  * @summary Test transferTo with different target channels
+ * @run main TransferToChannel
+ * @run main/othervm -Djdk.net.enableFastFileTransfer TransferToChannel
  */
 
 import java.nio.channels.FileChannel;

From 918fac5a5270f1761de02d480c701a30b01fec94 Mon Sep 17 00:00:00 2001
From: Neil Toda <neil.toda@oracle.com>
Date: Mon, 10 Nov 2014 08:43:27 -0800
Subject: [PATCH 055/299] 8058407: Remove Multiple JRE support in the Java
 launcher

Reviewed-by: alanb, darcy, ksrini
---
 .../macosx/native/libjli/java_md_macosx.c     |   7 +-
 .../java.base/share/native/libjli/emessages.h |   8 +-
 jdk/src/java.base/share/native/libjli/java.c  | 143 ++----
 jdk/src/java.base/share/native/libjli/java.h  |   4 +-
 .../share/native/libjli/parse_manifest.c      |  17 +-
 .../share/native/libjli/version_comp.c        | 357 ---------------
 .../share/native/libjli/version_comp.h        |  37 --
 .../java.base/unix/native/libjli/java_md.h    |   7 +-
 .../unix/native/libjli/java_md_common.c       | 196 +-------
 .../unix/native/libjli/java_md_solinux.c      |   7 +-
 .../java.base/windows/native/libjli/java_md.c | 417 +-----------------
 .../java.base/windows/native/libjli/java_md.h |   5 +-
 jdk/test/tools/launcher/Arrrghs.java          |  19 +-
 jdk/test/tools/launcher/MultipleJRE.sh        | 227 +++++-----
 14 files changed, 156 insertions(+), 1295 deletions(-)
 delete mode 100644 jdk/src/java.base/share/native/libjli/version_comp.c
 delete mode 100644 jdk/src/java.base/share/native/libjli/version_comp.h

diff --git a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c
index 4fa1e4b2855..802d8742dee 100644
--- a/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c
+++ b/jdk/src/java.base/macosx/native/libjli/java_md_macosx.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,6 @@
 #include <sys/time.h>
 
 #include "manifest_info.h"
-#include "version_comp.h"
 
 /* Support Cocoa event loop on the main thread */
 #include <Cocoa/Cocoa.h>
@@ -104,10 +103,6 @@ struct NSAppArgs {
  *  (incoming argv)
  *  |
  * \|/
- * SelectVersion
- * (selects the JRE version, note: not data model)
- *  |
- * \|/
  * CreateExecutionEnvironment
  * (determines desired data model)
  *  |
diff --git a/jdk/src/java.base/share/native/libjli/emessages.h b/jdk/src/java.base/share/native/libjli/emessages.h
index e390c71b49b..961ff7be3f7 100644
--- a/jdk/src/java.base/share/native/libjli/emessages.h
+++ b/jdk/src/java.base/share/native/libjli/emessages.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -72,9 +72,6 @@
 #define CFG_ERROR8      "Error: missing `%s' JVM at `%s'.\nPlease install or use the JRE or JDK that contains these missing components."
 #define CFG_ERROR9      "Error: could not determine JVM type."
 
-
-#define SPC_ERROR1      "Error: Syntax error in version specification \"%s\""
-
 #define JRE_ERROR1      "Error: Could not find Java SE Runtime Environment."
 #define JRE_ERROR2      "Error: This Java instance does not support a %d-bit JVM.\nPlease install the desired version."
 #define JRE_ERROR3      "Error: Improper value at line %d."
@@ -89,6 +86,9 @@
 #define JRE_ERROR12     "Error: Exec of %s failed"
 #define JRE_ERROR13     "Error: String processing operation failed"
 
+#define SPC_ERROR1      "Error: Specifying an alternate JDK/JRE version is no longer supported.\n  The use of the flag '-version:' is no longer valid.\n  Please download and execute the appropriate version."
+#define SPC_ERROR2      "Error: Specifying an alternate JDK/JRE is no longer supported.\n  The related flags -jre-restrict-search | -jre-no-restrict-search are also no longer valid."
+
 #define DLL_ERROR1      "Error: dl failure on line %d"
 #define DLL_ERROR2      "Error: failed %s, because %s"
 #define DLL_ERROR3      "Error: could not find executable %s"
diff --git a/jdk/src/java.base/share/native/libjli/java.c b/jdk/src/java.base/share/native/libjli/java.c
index c71f4c26fab..becd6cbf749 100644
--- a/jdk/src/java.base/share/native/libjli/java.c
+++ b/jdk/src/java.base/share/native/libjli/java.c
@@ -216,21 +216,14 @@ JLI_Launch(int argc, char ** argv,              /* main argc, argc */
     }
 
     /*
-     * Make sure the specified version of the JRE is running.
+     * SelectVersion() has several responsibilities:
      *
-     * There are three things to note about the SelectVersion() routine:
-     *  1) If the version running isn't correct, this routine doesn't
-     *     return (either the correct version has been exec'd or an error
-     *     was issued).
-     *  2) Argc and Argv in this scope are *not* altered by this routine.
-     *     It is the responsibility of subsequent code to ignore the
-     *     arguments handled by this routine.
-     *  3) As a side-effect, the variable "main_class" is guaranteed to
-     *     be set (if it should ever be set).  This isn't exactly the
-     *     poster child for structured programming, but it is a small
-     *     price to pay for not processing a jar file operand twice.
-     *     (Note: This side effect has been disabled.  See comment on
-     *     bugid 5030265 below.)
+     *  1) Disallow specification of another JRE.  With 1.9, another
+     *     version of the JRE cannot be invoked.
+     *  2) Allow for a JRE version to invoke JDK 1.9 or later.  Since
+     *     all mJRE directives have been stripped from the request but
+     *     the pre 1.9 JRE [ 1.6 thru 1.8 ], it is as if 1.9+ has been
+     *     invoked from the command line.
      */
     SelectVersion(argc, argv, &main_class);
 
@@ -829,8 +822,6 @@ static void
 SelectVersion(int argc, char **argv, char **main_class)
 {
     char    *arg;
-    char    **new_argv;
-    char    **new_argp;
     char    *operand;
     char    *version = NULL;
     char    *jre = NULL;
@@ -849,6 +840,17 @@ SelectVersion(int argc, char **argv, char **main_class)
      * with the value passed through the environment (if any) and
      * simply return.
      */
+
+    /*
+     * This environmental variable can be set by mJRE capable JREs
+     * [ 1.5 thru 1.8 ].  All other aspects of mJRE processing have been
+     * stripped by those JREs.  This environmental variable allows 1.9+
+     * JREs to be started by these mJRE capable JREs.
+     * Note that mJRE directives in the jar manifest file would have been
+     * ignored for a JRE started by another JRE...
+     * .. skipped for JRE 1.5 and beyond.
+     * .. not even checked for pre 1.5.
+     */
     if ((env_in = getenv(ENV_ENTRY)) != NULL) {
         if (*env_in != '\0')
             *main_class = JLI_StringDup(env_in);
@@ -857,41 +859,26 @@ SelectVersion(int argc, char **argv, char **main_class)
 
     /*
      * Scan through the arguments for options relevant to multiple JRE
-     * support.  For reference, the command line syntax is defined as:
+     * support.  Multiple JRE support existed in JRE versions 1.5 thru 1.8.
      *
-     * SYNOPSIS
-     *      java [options] class [argument...]
-     *
-     *      java [options] -jar file.jar [argument...]
-     *
-     * As the scan is performed, make a copy of the argument list with
-     * the version specification options (new to 1.5) removed, so that
-     * a version less than 1.5 can be exec'd.
-     *
-     * Note that due to the syntax of the native Windows interface
-     * CreateProcess(), processing similar to the following exists in
-     * the Windows platform specific routine ExecJRE (in java_md.c).
-     * Changes here should be reproduced there.
+     * This capability is no longer available with JRE versions 1.9 and later.
+     * These command line options are reported as errors.
      */
-    new_argv = JLI_MemAlloc((argc + 1) * sizeof(char*));
-    new_argv[0] = argv[0];
-    new_argp = &new_argv[1];
     argc--;
     argv++;
     while ((arg = *argv) != 0 && *arg == '-') {
         if (JLI_StrCCmp(arg, "-version:") == 0) {
-            version = arg + 9;
+            JLI_ReportErrorMessage(SPC_ERROR1);
         } else if (JLI_StrCmp(arg, "-jre-restrict-search") == 0) {
-            restrict_search = 1;
-        } else if (JLI_StrCmp(arg, "-no-jre-restrict-search") == 0) {
-            restrict_search = 0;
+            JLI_ReportErrorMessage(SPC_ERROR2);
+        } else if (JLI_StrCmp(arg, "-jre-no-restrict-search") == 0) {
+            JLI_ReportErrorMessage(SPC_ERROR2);
         } else {
             if (JLI_StrCmp(arg, "-jar") == 0)
                 jarflag = 1;
             /* deal with "unfortunate" classpath syntax */
             if ((JLI_StrCmp(arg, "-classpath") == 0 || JLI_StrCmp(arg, "-cp") == 0) &&
               (argc >= 2)) {
-                *new_argp++ = arg;
                 argc--;
                 argv++;
                 arg = *argv;
@@ -908,7 +895,6 @@ SelectVersion(int argc, char **argv, char **main_class)
             } else if (JLI_StrCCmp(arg, "-splash:") == 0) {
                 splash_file_name = arg+8;
             }
-            *new_argp++ = arg;
         }
         argc--;
         argv++;
@@ -917,11 +903,8 @@ SelectVersion(int argc, char **argv, char **main_class)
         operand = NULL;
     } else {
         argc--;
-        *new_argp++ = operand = *argv++;
+        operand = *argv++;
     }
-    while (argc-- > 0)  /* Copy over [argument...] */
-        *new_argp++ = *argv++;
-    *new_argp = NULL;
 
     /*
      * If there is a jar file, read the manifest. If the jarfile can't be
@@ -974,14 +957,6 @@ SelectVersion(int argc, char **argv, char **main_class)
         putenv(splash_jar_entry);
     }
 
-    /*
-     * The JRE-Version and JRE-Restrict-Search values (if any) from the
-     * manifest are overwritten by any specified on the command line.
-     */
-    if (version != NULL)
-        info.jre_version = version;
-    if (restrict_search != -1)
-        info.jre_restrict_search = restrict_search;
 
     /*
      * "Valid" returns (other than unrecoverable errors) follow.  Set
@@ -990,72 +965,11 @@ SelectVersion(int argc, char **argv, char **main_class)
     if (info.main_class != NULL)
         *main_class = JLI_StringDup(info.main_class);
 
-    /*
-     * If no version selection information is found either on the command
-     * line or in the manifest, simply return.
-     */
     if (info.jre_version == NULL) {
         JLI_FreeManifest();
-        JLI_MemFree(new_argv);
         return;
     }
 
-    /*
-     * Check for correct syntax of the version specification (JSR 56).
-     */
-    if (!JLI_ValidVersionString(info.jre_version)) {
-        JLI_ReportErrorMessage(SPC_ERROR1, info.jre_version);
-        exit(1);
-    }
-
-    /*
-     * Find the appropriate JVM on the system. Just to be as forgiving as
-     * possible, if the standard algorithms don't locate an appropriate
-     * jre, check to see if the one running will satisfy the requirements.
-     * This can happen on systems which haven't been set-up for multiple
-     * JRE support.
-     */
-    jre = LocateJRE(&info);
-    JLI_TraceLauncher("JRE-Version = %s, JRE-Restrict-Search = %s Selected = %s\n",
-        (info.jre_version?info.jre_version:"null"),
-        (info.jre_restrict_search?"true":"false"), (jre?jre:"null"));
-
-    if (jre == NULL) {
-        if (JLI_AcceptableRelease(GetFullVersion(), info.jre_version)) {
-            JLI_FreeManifest();
-            JLI_MemFree(new_argv);
-            return;
-        } else {
-            JLI_ReportErrorMessage(CFG_ERROR4, info.jre_version);
-            exit(1);
-        }
-    }
-
-    /*
-     * If I'm not the chosen one, exec the chosen one.  Returning from
-     * ExecJRE indicates that I am indeed the chosen one.
-     *
-     * The private environment variable _JAVA_VERSION_SET is used to
-     * prevent the chosen one from re-reading the manifest file and
-     * using the values found within to override the (potential) command
-     * line flags stripped from argv (because the target may not
-     * understand them).  Passing the MainClass value is an optimization
-     * to avoid locating, expanding and parsing the manifest extra
-     * times.
-     */
-    if (info.main_class != NULL) {
-        if (JLI_StrLen(info.main_class) <= MAXNAMELEN) {
-            (void)JLI_StrCat(env_entry, info.main_class);
-        } else {
-            JLI_ReportErrorMessage(CLS_ERROR5, MAXNAMELEN);
-            exit(1);
-        }
-    }
-    (void)putenv(env_entry);
-    ExecJRE(jre, new_argv);
-    JLI_FreeManifest();
-    JLI_MemFree(new_argv);
-    return;
 }
 
 /*
@@ -1154,10 +1068,7 @@ ParseArguments(int *pargc, char ***pargv,
                    JLI_StrCmp(arg, "-noasyncgc") == 0) {
             /* No longer supported */
             JLI_ReportErrorMessage(ARG_WARN, arg);
-        } else if (JLI_StrCCmp(arg, "-version:") == 0 ||
-                   JLI_StrCmp(arg, "-no-jre-restrict-search") == 0 ||
-                   JLI_StrCmp(arg, "-jre-restrict-search") == 0 ||
-                   JLI_StrCCmp(arg, "-splash:") == 0) {
+        } else if (JLI_StrCCmp(arg, "-splash:") == 0) {
             ; /* Ignore machine independent options already handled */
         } else if (ProcessPlatformOption(arg)) {
             ; /* Processing of platform dependent options */
diff --git a/jdk/src/java.base/share/native/libjli/java.h b/jdk/src/java.base/share/native/libjli/java.h
index 83e97e60d9c..615b16cd9c3 100644
--- a/jdk/src/java.base/share/native/libjli/java.h
+++ b/jdk/src/java.base/share/native/libjli/java.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,9 +40,7 @@
 #include "emessages.h"
 #include "java_md.h"
 #include "jli_util.h"
-
 #include "manifest_info.h"
-#include "version_comp.h"
 #include "wildcard.h"
 #include "splashscreen.h"
 
diff --git a/jdk/src/java.base/share/native/libjli/parse_manifest.c b/jdk/src/java.base/share/native/libjli/parse_manifest.c
index c17249c0b30..a8e17b89b25 100644
--- a/jdk/src/java.base/share/native/libjli/parse_manifest.c
+++ b/jdk/src/java.base/share/native/libjli/parse_manifest.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -588,15 +588,16 @@ JLI_ParseManifest(char *jarfile, manifest_info *info)
     }
     lp = manifest;
     while ((rc = parse_nv_pair(&lp, &name, &value)) > 0) {
-        if (JLI_StrCaseCmp(name, "Manifest-Version") == 0)
+        if (JLI_StrCaseCmp(name, "Manifest-Version") == 0) {
             info->manifest_version = value;
-        else if (JLI_StrCaseCmp(name, "Main-Class") == 0)
+        } else if (JLI_StrCaseCmp(name, "Main-Class") == 0) {
             info->main_class = value;
-        else if (JLI_StrCaseCmp(name, "JRE-Version") == 0)
-            info->jre_version = value;
-        else if (JLI_StrCaseCmp(name, "JRE-Restrict-Search") == 0) {
-            if (JLI_StrCaseCmp(value, "true") == 0)
-                info->jre_restrict_search = 1;
+        } else if (JLI_StrCaseCmp(name, "JRE-Version") == 0) {
+            /*
+             * Manifest specification overridden by command line option
+             * so we will silently override there with no specification.
+             */
+            info->jre_version = 0;
         } else if (JLI_StrCaseCmp(name, "Splashscreen-Image") == 0) {
             info->splashscreen_image_file_name = value;
         }
diff --git a/jdk/src/java.base/share/native/libjli/version_comp.c b/jdk/src/java.base/share/native/libjli/version_comp.c
deleted file mode 100644
index fc20ba94e9a..00000000000
--- a/jdk/src/java.base/share/native/libjli/version_comp.c
+++ /dev/null
@@ -1,357 +0,0 @@
-/*
- * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#include <ctype.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include "jni.h"
-#include "jli_util.h"
-#include "version_comp.h"
-
-/*
- *      A collection of useful strings. One should think of these as #define
- *      entries, but actual strings can be more efficient (with many compilers).
- */
-static const char *separators   = ".-_";
-static const char *zero_string  = "0";
-
-/*
- *      Validate a string as parsable as a "Java int". If so parsable,
- *      return true (non-zero) and store the numeric value at the address
- *      passed in as "value"; otherwise return false (zero).
- *
- *      Note that the maximum allowable value is 2147483647 as defined by
- *      the "Java Language Specification" which precludes the use of native
- *      conversion routines which may have other limits.
- *
- *      Also note that we don't have to worry about the alternate maximum
- *      allowable value of 2147483648 because it is only allowed after
- *      the unary negation operator and this grammar doesn't have one
- *      of those.
- *
- *      Finally, note that a value which exceeds the maximum jint value will
- *      return false (zero). This results in the otherwise purely numeric
- *      string being compared as a string of characters (as per the spec.)
- */
-static int
-isjavaint(const char *s, jint *value)
-{
-    jlong sum = 0;
-    jint digit;
-    while (*s != '\0')
-        if (isdigit(*s)) {
-            digit = (jint)((int)(*s++) - (int)('0'));
-            sum = (sum * 10) + digit;
-            if (sum > 2147483647)
-                return (0);     /* Overflows jint (but not jlong) */
-        } else
-            return (0);
-    *value = (jint)sum;
-    return (1);
-}
-
-/*
- *      Modeled after strcmp(), compare two strings (as in the grammar defined
- *      in Appendix A of JSR 56).  If both strings can be interpreted as
- *      Java ints, do a numeric comparison, else it is strcmp().
- */
-static int
-comp_string(const char *s1, const char *s2)
-{
-    jint v1, v2;
-    if (isjavaint(s1, &v1) && isjavaint(s2, &v2))
-        return ((int)(v1 - v2));
-    else
-        return (JLI_StrCmp(s1, s2));
-}
-
-/*
- *      Modeled after strcmp(), compare two version-ids for a Prefix
- *      Match as defined in JSR 56.
- */
-int
-JLI_PrefixVersionId(const char *id1, char *id2)
-{
-    char        *s1 = JLI_StringDup(id1);
-    char        *s2 = JLI_StringDup(id2);
-    char        *m1 = s1;
-    char        *m2 = s2;
-    char        *end1 = NULL;
-    char        *end2 = NULL;
-    int res = 0;
-
-    do {
-
-        if ((s1 != NULL) && ((end1 = JLI_StrPBrk(s1, ".-_")) != NULL))
-            *end1 = '\0';
-        if ((s2 != NULL) && ((end2 = JLI_StrPBrk(s2, ".-_")) != NULL))
-            *end2 = '\0';
-
-        res = comp_string(s1, s2);
-
-        if (end1 != NULL)
-            s1 = end1 + 1;
-        else
-            s1 = NULL;
-        if (end2 != NULL)
-            s2 = end2 + 1;
-        else
-            s2 = NULL;
-
-    } while (res == 0 && ((s1 != NULL) && (s2 != NULL)));
-
-    JLI_MemFree(m1);
-    JLI_MemFree(m2);
-    return (res);
-}
-
-/*
- *      Modeled after strcmp(), compare two version-ids for an Exact
- *      Match as defined in JSR 56.
- */
-int
-JLI_ExactVersionId(const char *id1, char *id2)
-{
-    char        *s1 = JLI_StringDup(id1);
-    char        *s2 = JLI_StringDup(id2);
-    char        *m1 = s1;
-    char        *m2 = s2;
-    char        *end1 = NULL;
-    char        *end2 = NULL;
-    int res = 0;
-
-    do {
-
-        if ((s1 != NULL) && ((end1 = JLI_StrPBrk(s1, separators)) != NULL))
-            *end1 = '\0';
-        if ((s2 != NULL) && ((end2 = JLI_StrPBrk(s2, separators)) != NULL))
-            *end2 = '\0';
-
-        if ((s1 != NULL) && (s2 == NULL))
-            res = comp_string(s1, zero_string);
-        else if ((s1 == NULL) && (s2 != NULL))
-            res = comp_string(zero_string, s2);
-        else
-            res = comp_string(s1, s2);
-
-        if (end1 != NULL)
-            s1 = end1 + 1;
-        else
-            s1 = NULL;
-        if (end2 != NULL)
-            s2 = end2 + 1;
-        else
-            s2 = NULL;
-
-    } while (res == 0 && ((s1 != NULL) || (s2 != NULL)));
-
-    JLI_MemFree(m1);
-    JLI_MemFree(m2);
-    return (res);
-}
-
-/*
- *      Return true if this simple-element (as defined in JSR 56) forms
- *      an acceptable match.
- *
- *      JSR 56 is modified by the Java Web Start <rel> Developer Guide
- *      where it is stated "... Java Web Start will not consider an installed
- *      non-FCS (i.e., milestone) JRE as a match. ... a JRE from Sun
- *      Microsystems, Inc., is by convention a non-FCS (milestone) JRE
- *      if there is a dash (-) in the version string."
- *
- *      An undocumented caveat to the above is that an exact match with a
- *      hyphen is accepted as a development extension.
- *
- *      These modifications are addressed by the specific comparisons
- *      for releases with hyphens.
- */
-static int
-acceptable_simple_element(const char *release, char *simple_element)
-{
-    char        *modifier;
-    modifier = simple_element + JLI_StrLen(simple_element) - 1;
-    if (*modifier == '*') {
-        *modifier = '\0';
-        if (JLI_StrChr(release, '-'))
-            return ((JLI_StrCmp(release, simple_element) == 0)?1:0);
-        return ((JLI_PrefixVersionId(release, simple_element) == 0)?1:0);
-    } else if (*modifier == '+') {
-        *modifier = '\0';
-        if (JLI_StrChr(release, '-'))
-            return ((JLI_StrCmp(release, simple_element) == 0)?1:0);
-        return ((JLI_ExactVersionId(release, simple_element) >= 0)?1:0);
-    } else {
-        return ((JLI_ExactVersionId(release, simple_element) == 0)?1:0);
-    }
-}
-
-/*
- *      Return true if this element (as defined in JSR 56) forms
- *      an acceptable match. An element is the intersection (and)
- *      of multiple simple-elements.
- */
-static int
-acceptable_element(const char *release, char *element)
-{
-    char        *end;
-    do {
-        if ((end = JLI_StrChr(element, '&')) != NULL)
-            *end = '\0';
-        if (!acceptable_simple_element(release, element))
-            return (0);
-        if (end != NULL)
-            element = end + 1;
-    } while (end != NULL);
-    return (1);
-}
-
-/*
- *      Checks if release is acceptable by the specification version-string.
- *      Return true if this version-string (as defined in JSR 56) forms
- *      an acceptable match. A version-string is the union (or) of multiple
- *      elements.
- */
-int
-JLI_AcceptableRelease(const char *release, char *version_string)
-{
-    char        *vs;
-    char        *m1;
-    char        *end;
-    m1 = vs = JLI_StringDup(version_string);
-    do {
-        if ((end = JLI_StrChr(vs, ' ')) != NULL)
-            *end = '\0';
-        if (acceptable_element(release, vs)) {
-            JLI_MemFree(m1);
-            return (1);
-        }
-        if (end != NULL)
-            vs = end + 1;
-    } while (end != NULL);
-    JLI_MemFree(m1);
-    return (0);
-}
-
-/*
- *      Return true if this is a valid simple-element (as defined in JSR 56).
- *
- *      The official grammar for a simple-element is:
- *
- *              simple-element  ::= version-id | version-id modifier
- *              modifier        ::= '+' | '*'
- *              version-id      ::= string ( separator  string )*
- *              string          ::= char ( char )*
- *              char            ::= Any ASCII character except a space, an
- *                                  ampersand, a separator or a modifier
- *              separator       ::= '.' | '-' | '_'
- *
- *      However, for efficiency, it is time to abandon the top down parser
- *      implementation.  After deleting the potential trailing modifier, we
- *      are left with a version-id.
- *
- *      Note that a valid version-id has three simple properties:
- *
- *      1) Doesn't contain a space, an ampersand or a modifier.
- *
- *      2) Doesn't begin or end with a separator.
- *
- *      3) Doesn't contain two adjacent separators.
- *
- *      Any other line noise constitutes a valid version-id.
- */
-static int
-valid_simple_element(char *simple_element)
-{
-    char        *last;
-    size_t      len;
-
-    if ((simple_element == NULL) || ((len = JLI_StrLen(simple_element)) == 0))
-        return (0);
-    last = simple_element + len - 1;
-    if (*last == '*' || *last == '+') {
-        if (--len == 0)
-            return (0);
-        *last-- = '\0';
-    }
-    if (JLI_StrPBrk(simple_element, " &+*") != NULL)    /* Property #1 */
-        return (0);
-    if ((JLI_StrChr(".-_", *simple_element) != NULL) || /* Property #2 */
-      (JLI_StrChr(".-_", *last) != NULL))
-        return (0);
-    for (; simple_element != last; simple_element++)    /* Property #3 */
-        if ((JLI_StrChr(".-_", *simple_element) != NULL) &&
-          (JLI_StrChr(".-_", *(simple_element + 1)) != NULL))
-            return (0);
-    return (1);
-}
-
-/*
- *      Return true if this is a valid element (as defined in JSR 56).
- *      An element is the intersection (and) of multiple simple-elements.
- */
-static int
-valid_element(char *element)
-{
-    char        *end;
-    if ((element == NULL) || (JLI_StrLen(element) == 0))
-        return (0);
-    do {
-        if ((end = JLI_StrChr(element, '&')) != NULL)
-            *end = '\0';
-        if (!valid_simple_element(element))
-            return (0);
-        if (end != NULL)
-            element = end + 1;
-    } while (end != NULL);
-    return (1);
-}
-
-/*
- *      Validates a version string by the extended JSR 56 grammar.
- */
-int
-JLI_ValidVersionString(char *version_string)
-{
-    char        *vs;
-    char        *m1;
-    char        *end;
-    if ((version_string == NULL) || (JLI_StrLen(version_string) == 0))
-        return (0);
-    m1 = vs = JLI_StringDup(version_string);
-    do {
-        if ((end = JLI_StrChr(vs, ' ')) != NULL)
-            *end = '\0';
-        if (!valid_element(vs)) {
-            JLI_MemFree(m1);
-            return (0);
-        }
-        if (end != NULL)
-            vs = end + 1;
-    } while (end != NULL);
-    JLI_MemFree(m1);
-    return (1);
-}
diff --git a/jdk/src/java.base/share/native/libjli/version_comp.h b/jdk/src/java.base/share/native/libjli/version_comp.h
deleted file mode 100644
index 397e831b7d5..00000000000
--- a/jdk/src/java.base/share/native/libjli/version_comp.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-#ifndef _VERSION_COMP_H
-#define _VERSION_COMP_H
-
-/*
- * Function prototypes.
- */
-int JLI_ExactVersionId(const char *id1, char *id2);
-int JLI_PrefixVersionId(const char *id1, char *id2);
-int JLI_AcceptableRelease(const char *release, char *version_string);
-int JLI_ValidVersionString(char *version_string);
-
-#endif /* _VERSION_COMP_H */
diff --git a/jdk/src/java.base/unix/native/libjli/java_md.h b/jdk/src/java.base/unix/native/libjli/java_md.h
index ec0615c1320..212ae0a2732 100644
--- a/jdk/src/java.base/unix/native/libjli/java_md.h
+++ b/jdk/src/java.base/unix/native/libjli/java_md.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -43,11 +43,6 @@
 #define MAXNAMELEN              PATH_MAX
 #endif
 
-/*
- * Common function prototypes and sundries.
- */
-char *LocateJRE(manifest_info *info);
-void ExecJRE(char *jre, char **argv);
 int UnsetEnv(char *name);
 char *FindExecName(char *program);
 const char *SetExecname(char **argv);
diff --git a/jdk/src/java.base/unix/native/libjli/java_md_common.c b/jdk/src/java.base/unix/native/libjli/java_md_common.c
index fb446db739a..27d5a2ddcaa 100644
--- a/jdk/src/java.base/unix/native/libjli/java_md_common.c
+++ b/jdk/src/java.base/unix/native/libjli/java_md_common.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, 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
@@ -190,200 +190,6 @@ CheckSanity(char *path, char *dir)
     return ((access(buffer, X_OK) == 0) ? 1 : 0);
 }
 
-/*
- *      Determine if there is an acceptable JRE in the directory dirname.
- *      Upon locating the "best" one, return a fully qualified path to
- *      it. "Best" is defined as the most advanced JRE meeting the
- *      constraints contained in the manifest_info. If no JRE in this
- *      directory meets the constraints, return NULL.
- *
- *      Note that we don't check for errors in reading the directory
- *      (which would be done by checking errno).  This is because it
- *      doesn't matter if we get an error reading the directory, or
- *      we just don't find anything interesting in the directory.  We
- *      just return NULL in either case.
- *
- *      The historical names of j2sdk and j2re were changed to jdk and
- *      jre respecively as part of the 1.5 rebranding effort.  Since the
- *      former names are legacy on Linux, they must be recognized for
- *      all time.  Fortunately, this is a minor cost.
- */
-static char
-*ProcessDir(manifest_info *info, char *dirname)
-{
-    DIR     *dirp;
-    struct dirent *dp;
-    char    *best = NULL;
-    int     offset;
-    int     best_offset = 0;
-    char    *ret_str = NULL;
-    char    buffer[PATH_MAX];
-
-    if ((dirp = opendir(dirname)) == NULL)
-        return (NULL);
-
-    do {
-        if ((dp = readdir(dirp)) != NULL) {
-            offset = 0;
-            if ((JLI_StrNCmp(dp->d_name, "jre", 3) == 0) ||
-                (JLI_StrNCmp(dp->d_name, "jdk", 3) == 0))
-                offset = 3;
-            else if (JLI_StrNCmp(dp->d_name, "j2re", 4) == 0)
-                offset = 4;
-            else if (JLI_StrNCmp(dp->d_name, "j2sdk", 5) == 0)
-                offset = 5;
-            if (offset > 0) {
-                if ((JLI_AcceptableRelease(dp->d_name + offset,
-                    info->jre_version)) && CheckSanity(dirname, dp->d_name))
-                    if ((best == NULL) || (JLI_ExactVersionId(
-                      dp->d_name + offset, best + best_offset) > 0)) {
-                        if (best != NULL)
-                            JLI_MemFree(best);
-                        best = JLI_StringDup(dp->d_name);
-                        best_offset = offset;
-                    }
-            }
-        }
-    } while (dp != NULL);
-    (void) closedir(dirp);
-    if (best == NULL)
-        return (NULL);
-    else {
-        ret_str = JLI_MemAlloc(JLI_StrLen(dirname) + JLI_StrLen(best) + 2);
-        sprintf(ret_str, "%s/%s", dirname, best);
-        JLI_MemFree(best);
-        return (ret_str);
-    }
-}
-
-/*
- *      This is the global entry point. It examines the host for the optimal
- *      JRE to be used by scanning a set of directories.  The set of directories
- *      is platform dependent and can be overridden by the environment
- *      variable JAVA_VERSION_PATH.
- *
- *      This routine itself simply determines the set of appropriate
- *      directories before passing control onto ProcessDir().
- */
-char*
-LocateJRE(manifest_info* info)
-{
-    char        *path;
-    char        *home;
-    char        *target = NULL;
-    char        *dp;
-    char        *cp;
-
-    /*
-     * Start by getting JAVA_VERSION_PATH
-     */
-    if (info->jre_restrict_search) {
-        path = JLI_StringDup(system_dir);
-    } else if ((path = getenv("JAVA_VERSION_PATH")) != NULL) {
-        path = JLI_StringDup(path);
-    } else {
-        if ((home = getenv("HOME")) != NULL) {
-            path = (char *)JLI_MemAlloc(JLI_StrLen(home) + \
-                        JLI_StrLen(system_dir) + JLI_StrLen(user_dir) + 2);
-            sprintf(path, "%s%s:%s", home, user_dir, system_dir);
-        } else {
-            path = JLI_StringDup(system_dir);
-        }
-    }
-
-    /*
-     * Step through each directory on the path. Terminate the scan with
-     * the first directory with an acceptable JRE.
-     */
-    cp = dp = path;
-    while (dp != NULL) {
-        cp = JLI_StrChr(dp, (int)':');
-        if (cp != NULL)
-            *cp = '\0';
-        if ((target = ProcessDir(info, dp)) != NULL)
-            break;
-        dp = cp;
-        if (dp != NULL)
-            dp++;
-    }
-    JLI_MemFree(path);
-    return (target);
-}
-
-/*
- * Given a path to a jre to execute, this routine checks if this process
- * is indeed that jre.  If not, it exec's that jre.
- *
- * We want to actually check the paths rather than just the version string
- * built into the executable, so that given version specification (and
- * JAVA_VERSION_PATH) will yield the exact same Java environment, regardless
- * of the version of the arbitrary launcher we start with.
- */
-void
-ExecJRE(char *jre, char **argv)
-{
-    char    wanted[PATH_MAX];
-    const char* progname = GetProgramName();
-    const char* execname = NULL;
-
-    /*
-     * Resolve the real path to the directory containing the selected JRE.
-     */
-    if (realpath(jre, wanted) == NULL) {
-        JLI_ReportErrorMessage(JRE_ERROR9, jre);
-        exit(1);
-    }
-
-    /*
-     * Resolve the real path to the currently running launcher.
-     */
-    SetExecname(argv);
-    execname = GetExecName();
-    if (execname == NULL) {
-        JLI_ReportErrorMessage(JRE_ERROR10);
-        exit(1);
-    }
-
-    /*
-     * If the path to the selected JRE directory is a match to the initial
-     * portion of the path to the currently executing JRE, we have a winner!
-     * If so, just return.
-     */
-    if (JLI_StrNCmp(wanted, execname, JLI_StrLen(wanted)) == 0)
-        return;                 /* I am the droid you were looking for */
-
-
-    /*
-     * This should never happen (because of the selection code in SelectJRE),
-     * but check for "impossibly" long path names just because buffer overruns
-     * can be so deadly.
-     */
-    if (JLI_StrLen(wanted) + JLI_StrLen(progname) + 6 > PATH_MAX) {
-        JLI_ReportErrorMessage(JRE_ERROR11);
-        exit(1);
-    }
-
-    /*
-     * Construct the path and exec it.
-     */
-    (void)JLI_StrCat(JLI_StrCat(wanted, "/bin/"), progname);
-    argv[0] = JLI_StringDup(progname);
-    if (JLI_IsTraceLauncher()) {
-        int i;
-        printf("ReExec Command: %s (%s)\n", wanted, argv[0]);
-        printf("ReExec Args:");
-        for (i = 1; argv[i] != NULL; i++)
-            printf(" %s", argv[i]);
-        printf("\n");
-    }
-    JLI_TraceLauncher("TRACER_MARKER:About to EXEC\n");
-    (void)fflush(stdout);
-    (void)fflush(stderr);
-    execv(wanted, argv);
-    JLI_ReportErrorMessageSys(JRE_ERROR12, wanted);
-    exit(1);
-}
-
 /*
  * "Borrowed" from Solaris 10 where the unsetenv() function is being added
  * to libc thanks to SUSv3 (Standard Unix Specification, version 3). As
diff --git a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c
index 05f7a4d8112..77a36890a25 100644
--- a/jdk/src/java.base/unix/native/libjli/java_md_solinux.c
+++ b/jdk/src/java.base/unix/native/libjli/java_md_solinux.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,6 @@
 #include <unistd.h>
 #include <sys/types.h>
 #include "manifest_info.h"
-#include "version_comp.h"
 
 
 #define JVM_DLL "libjvm.so"
@@ -100,10 +99,6 @@
  *  (incoming argv)
  *  |
  * \|/
- * SelectVersion
- * (selects the JRE version, note: not data model)
- *  |
- * \|/
  * CreateExecutionEnvironment
  * (determines desired data model)
  *  |
diff --git a/jdk/src/java.base/windows/native/libjli/java_md.c b/jdk/src/java.base/windows/native/libjli/java_md.c
index 10fe6ce4a65..81b1c263821 100644
--- a/jdk/src/java.base/windows/native/libjli/java_md.c
+++ b/jdk/src/java.base/windows/native/libjli/java_md.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,6 @@
 
 #include <jni.h>
 #include "java.h"
-#include "version_comp.h"
 
 #define JVM_DLL "jvm.dll"
 #define JAVA_DLL "java.dll"
@@ -674,420 +673,6 @@ ServerClassMachine() {
     return (GetErgoPolicy() == ALWAYS_SERVER_CLASS) ? JNI_TRUE : JNI_FALSE;
 }
 
-/*
- * Determine if there is an acceptable JRE in the registry directory top_key.
- * Upon locating the "best" one, return a fully qualified path to it.
- * "Best" is defined as the most advanced JRE meeting the constraints
- * contained in the manifest_info. If no JRE in this directory meets the
- * constraints, return NULL.
- *
- * It doesn't matter if we get an error reading the registry, or we just
- * don't find anything interesting in the directory.  We just return NULL
- * in either case.
- */
-static char *
-ProcessDir(manifest_info* info, HKEY top_key) {
-    DWORD   index = 0;
-    HKEY    ver_key;
-    char    name[MAXNAMELEN];
-    int     len;
-    char    *best = NULL;
-
-    /*
-     * Enumerate "<top_key>/SOFTWARE/JavaSoft/Java Runtime Environment"
-     * searching for the best available version.
-     */
-    while (RegEnumKey(top_key, index, name, MAXNAMELEN) == ERROR_SUCCESS) {
-        index++;
-        if (JLI_AcceptableRelease(name, info->jre_version))
-            if ((best == NULL) || (JLI_ExactVersionId(name, best) > 0)) {
-                if (best != NULL)
-                    JLI_MemFree(best);
-                best = JLI_StringDup(name);
-            }
-    }
-
-    /*
-     * Extract "JavaHome" from the "best" registry directory and return
-     * that path.  If no appropriate version was located, or there is an
-     * error in extracting the "JavaHome" string, return null.
-     */
-    if (best == NULL)
-        return (NULL);
-    else {
-        if (RegOpenKeyEx(top_key, best, 0, KEY_READ, &ver_key)
-          != ERROR_SUCCESS) {
-            JLI_MemFree(best);
-            if (ver_key != NULL)
-                RegCloseKey(ver_key);
-            return (NULL);
-        }
-        JLI_MemFree(best);
-        len = MAXNAMELEN;
-        if (RegQueryValueEx(ver_key, "JavaHome", NULL, NULL, (LPBYTE)name, &len)
-          != ERROR_SUCCESS) {
-            if (ver_key != NULL)
-                RegCloseKey(ver_key);
-            return (NULL);
-        }
-        if (ver_key != NULL)
-            RegCloseKey(ver_key);
-        return (JLI_StringDup(name));
-    }
-}
-
-/*
- * This is the global entry point. It examines the host for the optimal
- * JRE to be used by scanning a set of registry entries.  This set of entries
- * is hardwired on Windows as "Software\JavaSoft\Java Runtime Environment"
- * under the set of roots "{ HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE }".
- *
- * This routine simply opens each of these registry directories before passing
- * control onto ProcessDir().
- */
-char *
-LocateJRE(manifest_info* info) {
-    HKEY    key = NULL;
-    char    *path;
-    int     key_index;
-    HKEY    root_keys[2] = { HKEY_CURRENT_USER, HKEY_LOCAL_MACHINE };
-
-    for (key_index = 0; key_index <= 1; key_index++) {
-        if (RegOpenKeyEx(root_keys[key_index], JRE_KEY, 0, KEY_READ, &key)
-          == ERROR_SUCCESS)
-            if ((path = ProcessDir(info, key)) != NULL) {
-                if (key != NULL)
-                    RegCloseKey(key);
-                return (path);
-            }
-        if (key != NULL)
-            RegCloseKey(key);
-    }
-    return NULL;
-}
-
-/*
- * Local helper routine to isolate a single token (option or argument)
- * from the command line.
- *
- * This routine accepts a pointer to a character pointer.  The first
- * token (as defined by MSDN command-line argument syntax) is isolated
- * from that string.
- *
- * Upon return, the input character pointer pointed to by the parameter s
- * is updated to point to the remainding, unscanned, portion of the string,
- * or to a null character if the entire string has been consummed.
- *
- * This function returns a pointer to a null-terminated string which
- * contains the isolated first token, or to the null character if no
- * token could be isolated.
- *
- * Note the side effect of modifying the input string s by the insertion
- * of a null character, making it two strings.
- *
- * See "Parsing C Command-Line Arguments" in the MSDN Library for the
- * parsing rule details.  The rule summary from that specification is:
- *
- *  * Arguments are delimited by white space, which is either a space or a tab.
- *
- *  * A string surrounded by double quotation marks is interpreted as a single
- *    argument, regardless of white space contained within. A quoted string can
- *    be embedded in an argument. Note that the caret (^) is not recognized as
- *    an escape character or delimiter.
- *
- *  * A double quotation mark preceded by a backslash, \", is interpreted as a
- *    literal double quotation mark (").
- *
- *  * Backslashes are interpreted literally, unless they immediately precede a
- *    double quotation mark.
- *
- *  * If an even number of backslashes is followed by a double quotation mark,
- *    then one backslash (\) is placed in the argv array for every pair of
- *    backslashes (\\), and the double quotation mark (") is interpreted as a
- *    string delimiter.
- *
- *  * If an odd number of backslashes is followed by a double quotation mark,
- *    then one backslash (\) is placed in the argv array for every pair of
- *    backslashes (\\) and the double quotation mark is interpreted as an
- *    escape sequence by the remaining backslash, causing a literal double
- *    quotation mark (") to be placed in argv.
- */
-static char*
-nextarg(char** s) {
-    char    *p = *s;
-    char    *head;
-    int     slashes = 0;
-    int     inquote = 0;
-
-    /*
-     * Strip leading whitespace, which MSDN defines as only space or tab.
-     * (Hence, no locale specific "isspace" here.)
-     */
-    while (*p != (char)0 && (*p == ' ' || *p == '\t'))
-        p++;
-    head = p;                   /* Save the start of the token to return */
-
-    /*
-     * Isolate a token from the command line.
-     */
-    while (*p != (char)0 && (inquote || !(*p == ' ' || *p == '\t'))) {
-        if (*p == '\\' && *(p+1) == '"' && slashes % 2 == 0)
-            p++;
-        else if (*p == '"')
-            inquote = !inquote;
-        slashes = (*p++ == '\\') ? slashes + 1 : 0;
-    }
-
-    /*
-     * If the token isolated isn't already terminated in a "char zero",
-     * then replace the whitespace character with one and move to the
-     * next character.
-     */
-    if (*p != (char)0)
-        *p++ = (char)0;
-
-    /*
-     * Update the parameter to point to the head of the remaining string
-     * reflecting the command line and return a pointer to the leading
-     * token which was isolated from the command line.
-     */
-    *s = p;
-    return (head);
-}
-
-/*
- * Local helper routine to return a string equivalent to the input string
- * s, but with quotes removed so the result is a string as would be found
- * in argv[].  The returned string should be freed by a call to JLI_MemFree().
- *
- * The rules for quoting (and escaped quotes) are:
- *
- *  1 A double quotation mark preceded by a backslash, \", is interpreted as a
- *    literal double quotation mark (").
- *
- *  2 Backslashes are interpreted literally, unless they immediately precede a
- *    double quotation mark.
- *
- *  3 If an even number of backslashes is followed by a double quotation mark,
- *    then one backslash (\) is placed in the argv array for every pair of
- *    backslashes (\\), and the double quotation mark (") is interpreted as a
- *    string delimiter.
- *
- *  4 If an odd number of backslashes is followed by a double quotation mark,
- *    then one backslash (\) is placed in the argv array for every pair of
- *    backslashes (\\) and the double quotation mark is interpreted as an
- *    escape sequence by the remaining backslash, causing a literal double
- *    quotation mark (") to be placed in argv.
- */
-static char*
-unquote(const char *s) {
-    const char *p = s;          /* Pointer to the tail of the original string */
-    char *un = (char*)JLI_MemAlloc(JLI_StrLen(s) + 1);  /* Ptr to unquoted string */
-    char *pun = un;             /* Pointer to the tail of the unquoted string */
-
-    while (*p != '\0') {
-        if (*p == '"') {
-            p++;
-        } else if (*p == '\\') {
-            const char *q = p + JLI_StrSpn(p,"\\");
-            if (*q == '"')
-                do {
-                    *pun++ = '\\';
-                    p += 2;
-                 } while (*p == '\\' && p < q);
-            else
-                while (p < q)
-                    *pun++ = *p++;
-        } else {
-            *pun++ = *p++;
-        }
-    }
-    *pun = '\0';
-    return un;
-}
-
-/*
- * Given a path to a jre to execute, this routine checks if this process
- * is indeed that jre.  If not, it exec's that jre.
- *
- * We want to actually check the paths rather than just the version string
- * built into the executable, so that given version specification will yield
- * the exact same Java environment, regardless of the version of the arbitrary
- * launcher we start with.
- */
-void
-ExecJRE(char *jre, char **argv) {
-    jint     len;
-    char    path[MAXPATHLEN + 1];
-
-    const char *progname = GetProgramName();
-
-    /*
-     * Resolve the real path to the currently running launcher.
-     */
-    len = GetModuleFileName(NULL, path, MAXPATHLEN + 1);
-    if (len == 0 || len > MAXPATHLEN) {
-        JLI_ReportErrorMessageSys(JRE_ERROR9, progname);
-        exit(1);
-    }
-
-    JLI_TraceLauncher("ExecJRE: old: %s\n", path);
-    JLI_TraceLauncher("ExecJRE: new: %s\n", jre);
-
-    /*
-     * If the path to the selected JRE directory is a match to the initial
-     * portion of the path to the currently executing JRE, we have a winner!
-     * If so, just return.
-     */
-    if (JLI_StrNCaseCmp(jre, path, JLI_StrLen(jre)) == 0)
-        return;                 /* I am the droid you were looking for */
-
-    /*
-     * If this isn't the selected version, exec the selected version.
-     */
-    JLI_Snprintf(path, sizeof(path), "%s\\bin\\%s.exe", jre, progname);
-
-    /*
-     * Although Windows has an execv() entrypoint, it doesn't actually
-     * overlay a process: it can only create a new process and terminate
-     * the old process.  Therefore, any processes waiting on the initial
-     * process wake up and they shouldn't.  Hence, a chain of pseudo-zombie
-     * processes must be retained to maintain the proper wait semantics.
-     * Fortunately the image size of the launcher isn't too large at this
-     * time.
-     *
-     * If it weren't for this semantic flaw, the code below would be ...
-     *
-     *     execv(path, argv);
-     *     JLI_ReportErrorMessage("Error: Exec of %s failed\n", path);
-     *     exit(1);
-     *
-     * The incorrect exec semantics could be addressed by:
-     *
-     *     exit((int)spawnv(_P_WAIT, path, argv));
-     *
-     * Unfortunately, a bug in Windows spawn/exec impementation prevents
-     * this from completely working.  All the Windows POSIX process creation
-     * interfaces are implemented as wrappers around the native Windows
-     * function CreateProcess().  CreateProcess() takes a single string
-     * to specify command line options and arguments, so the POSIX routine
-     * wrappers build a single string from the argv[] array and in the
-     * process, any quoting information is lost.
-     *
-     * The solution to this to get the original command line, to process it
-     * to remove the new multiple JRE options (if any) as was done for argv
-     * in the common SelectVersion() routine and finally to pass it directly
-     * to the native CreateProcess() Windows process control interface.
-     */
-    {
-        char    *cmdline;
-        char    *p;
-        char    *np;
-        char    *ocl;
-        char    *ccl;
-        char    *unquoted;
-        DWORD   exitCode;
-        STARTUPINFO si;
-        PROCESS_INFORMATION pi;
-
-        /*
-         * The following code block gets and processes the original command
-         * line, replacing the argv[0] equivalent in the command line with
-         * the path to the new executable and removing the appropriate
-         * Multiple JRE support options. Note that similar logic exists
-         * in the platform independent SelectVersion routine, but is
-         * replicated here due to the syntax of CreateProcess().
-         *
-         * The magic "+ 4" characters added to the command line length are
-         * 2 possible quotes around the path (argv[0]), a space after the
-         * path and a terminating null character.
-         */
-        ocl = GetCommandLine();
-        np = ccl = JLI_StringDup(ocl);
-        p = nextarg(&np);               /* Discard argv[0] */
-        cmdline = (char *)JLI_MemAlloc(JLI_StrLen(path) + JLI_StrLen(np) + 4);
-        if (JLI_StrChr(path, (int)' ') == NULL && JLI_StrChr(path, (int)'\t') == NULL)
-            cmdline = JLI_StrCpy(cmdline, path);
-        else
-            cmdline = JLI_StrCat(JLI_StrCat(JLI_StrCpy(cmdline, "\""), path), "\"");
-
-        while (*np != (char)0) {                /* While more command-line */
-            p = nextarg(&np);
-            if (*p != (char)0) {                /* If a token was isolated */
-                unquoted = unquote(p);
-                if (*unquoted == '-') {         /* Looks like an option */
-                    if (JLI_StrCmp(unquoted, "-classpath") == 0 ||
-                      JLI_StrCmp(unquoted, "-cp") == 0) {       /* Unique cp syntax */
-                        cmdline = JLI_StrCat(JLI_StrCat(cmdline, " "), p);
-                        p = nextarg(&np);
-                        if (*p != (char)0)      /* If a token was isolated */
-                            cmdline = JLI_StrCat(JLI_StrCat(cmdline, " "), p);
-                    } else if (JLI_StrNCmp(unquoted, "-version:", 9) != 0 &&
-                      JLI_StrCmp(unquoted, "-jre-restrict-search") != 0 &&
-                      JLI_StrCmp(unquoted, "-no-jre-restrict-search") != 0) {
-                        cmdline = JLI_StrCat(JLI_StrCat(cmdline, " "), p);
-                    }
-                } else {                        /* End of options */
-                    cmdline = JLI_StrCat(JLI_StrCat(cmdline, " "), p);
-                    cmdline = JLI_StrCat(JLI_StrCat(cmdline, " "), np);
-                    JLI_MemFree((void *)unquoted);
-                    break;
-                }
-                JLI_MemFree((void *)unquoted);
-            }
-        }
-        JLI_MemFree((void *)ccl);
-
-        if (JLI_IsTraceLauncher()) {
-            np = ccl = JLI_StringDup(cmdline);
-            p = nextarg(&np);
-            printf("ReExec Command: %s (%s)\n", path, p);
-            printf("ReExec Args: %s\n", np);
-            JLI_MemFree((void *)ccl);
-        }
-        (void)fflush(stdout);
-        (void)fflush(stderr);
-
-        /*
-         * The following code is modeled after a model presented in the
-         * Microsoft Technical Article "Moving Unix Applications to
-         * Windows NT" (March 6, 1994) and "Creating Processes" on MSDN
-         * (Februrary 2005).  It approximates UNIX spawn semantics with
-         * the parent waiting for termination of the child.
-         */
-        memset(&si, 0, sizeof(si));
-        si.cb =sizeof(STARTUPINFO);
-        memset(&pi, 0, sizeof(pi));
-
-        if (!CreateProcess((LPCTSTR)path,       /* executable name */
-          (LPTSTR)cmdline,                      /* command line */
-          (LPSECURITY_ATTRIBUTES)NULL,          /* process security attr. */
-          (LPSECURITY_ATTRIBUTES)NULL,          /* thread security attr. */
-          (BOOL)TRUE,                           /* inherits system handles */
-          (DWORD)0,                             /* creation flags */
-          (LPVOID)NULL,                         /* environment block */
-          (LPCTSTR)NULL,                        /* current directory */
-          (LPSTARTUPINFO)&si,                   /* (in) startup information */
-          (LPPROCESS_INFORMATION)&pi)) {        /* (out) process information */
-            JLI_ReportErrorMessageSys(SYS_ERROR1, path);
-            exit(1);
-        }
-
-        if (WaitForSingleObject(pi.hProcess, INFINITE) != WAIT_FAILED) {
-            if (GetExitCodeProcess(pi.hProcess, &exitCode) == FALSE)
-                exitCode = 1;
-        } else {
-            JLI_ReportErrorMessage(SYS_ERROR2);
-            exitCode = 1;
-        }
-
-        CloseHandle(pi.hThread);
-        CloseHandle(pi.hProcess);
-
-        exit(exitCode);
-    }
-}
-
 /*
  * Wrapper for platform dependent unsetenv function.
  */
diff --git a/jdk/src/java.base/windows/native/libjli/java_md.h b/jdk/src/java.base/windows/native/libjli/java_md.h
index 72151b92e50..aa9fc2f0b44 100644
--- a/jdk/src/java.base/windows/native/libjli/java_md.h
+++ b/jdk/src/java.base/windows/native/libjli/java_md.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -50,8 +50,7 @@ extern jlong Counter2Micros(jlong counts);
 /*
  * Function prototypes.
  */
-char *LocateJRE(manifest_info *info);
-void ExecJRE(char *jre, char **argv);
+
 int UnsetEnv(char *name);
 
 #endif /* JAVA_MD_H */
diff --git a/jdk/test/tools/launcher/Arrrghs.java b/jdk/test/tools/launcher/Arrrghs.java
index 62552c38959..0096f22ad3b 100644
--- a/jdk/test/tools/launcher/Arrrghs.java
+++ b/jdk/test/tools/launcher/Arrrghs.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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
@@ -734,23 +734,6 @@ public class Arrrghs extends TestHelper {
             System.out.println(tr);
     }
 
-    @Test
-    static void testJreRestrictSearchFlag() {
-        // test both arguments to ensure they exist
-        TestResult tr = null;
-        tr = doExec(javaCmd,
-                "-no-jre-restrict-search", "-version");
-        tr.checkPositive();
-        if (!tr.testStatus)
-            System.out.println(tr);
-
-        tr = doExec(javaCmd,
-                "-jre-restrict-search", "-version");
-        tr.checkPositive();
-        if (!tr.testStatus)
-            System.out.println(tr);
-    }
-
     /**
      * @param args the command line arguments
      * @throws java.io.FileNotFoundException
diff --git a/jdk/test/tools/launcher/MultipleJRE.sh b/jdk/test/tools/launcher/MultipleJRE.sh
index 799d003e08f..61cac1b3eb9 100644
--- a/jdk/test/tools/launcher/MultipleJRE.sh
+++ b/jdk/test/tools/launcher/MultipleJRE.sh
@@ -5,7 +5,7 @@
 # @build UglyPrintVersion
 # @build ZipMeUp
 # @run shell MultipleJRE.sh
-# @summary Verify Multiple JRE version support
+# @summary Verify Multiple JRE version support has been removed
 # @author Joseph E. Kowalski
 
 #
@@ -222,37 +222,76 @@ CreateAlignedJar() {
 #	long file name (path) or a long "Ext" entry, but adding the long
 #	comment is the easiest way.
 #
+MONDO=" Mondo comment line 00 is designed to take up space - lots and lots of space.  Mondo comment line 01 is designed to take up space - lots and lots of space.  Mondo comment line 02 is designed to take up space - lots and lots of space.  Mondo comment line 03 is designed to take up space - lots and lots of space.  Mondo comment line 04 is designed to take up space - lots and lots of space.  Mondo comment line 05 is designed to take up space - lots and lots of space.  Mondo comment line 06 is designed to take up space - lots and lots of space.  Mondo comment line 07 is designed to take up space - lots and lots of space.  Mondo comment line 08 is designed to take up space - lots and lots of space.  Mondo comment line 09 is designed to take up space - lots and lots of space.  Mondo comment line 0a is designed to take up space - lots and lots of space.  Mondo comment line 0b is designed to take up space - lots and lots of space.  Mondo comment line 0c is designed to take up space - lots and lots of space.  Mondo comment line 0d is designed to take up space - lots and lots of space.  Mondo comment line 0e is designed to take up space - lots and lots of space.  Mondo comment line 0f is designed to take up space - lots and lots of space.  Mondo comment line 10 is designed to take up space - lots and lots of space.  Mondo comment line 11 is designed to take up space - lots and lots of space.  Mondo comment line 12 is designed to take up space - lots and lots of space.  Mondo comment line 13 is designed to take up space - lots and lots of space.  Mondo comment line 14 is designed to take up space - lots and lots of space.  Mondo comment line 15 is designed to take up space - lots and lots of space.  Mondo comment line 16 is designed to take up space - lots and lots of space.  Mondo comment line 17 is designed to take up space - lots and lots of space.  Mondo comment line 18 is designed to take up space - lots and lots of space.  Mondo comment line 19 is designed to take up space - lots and lots of space.  Mondo comment line 1a is designed to take up space - lots and lots of space.  Mondo comment line 1b is designed to take up space - lots and lots of space.  Mondo comment line 1c is designed to take up space - lots and lots of space.  Mondo comment line 1d is designed to take up space - lots and lots of space.  Mondo comment line 1e is designed to take up space - lots and lots of space.  Mondo comment line 1f is designed to take up space - lots and lots of space.  Mondo comment line 20 is designed to take up space - lots and lots of space.  Mondo comment line 21 is designed to take up space - lots and lots of space.  Mondo comment line 22 is designed to take up space - lots and lots of space.  Mondo comment line 23 is designed to take up space - lots and lots of space.  Mondo comment line 24 is designed to take up space - lots and lots of space.  Mondo comment line 25 is designed to take up space - lots and lots of space.  Mondo comment line 26 is designed to take up space - lots and lots of space.  Mondo comment line 27 is designed to take up space - lots and lots of space.  Mondo comment line 28 is designed to take up space - lots and lots of space.  Mondo comment line 29 is designed to take up space - lots and lots of space.  Mondo comment line 2a is designed to take up space - lots and lots of space.  Mondo comment line 2b is designed to take up space - lots and lots of space.  Mondo comment line 2c is designed to take up space - lots and lots of space.  Mondo comment line 2d is designed to take up space - lots and lots of space.  Mondo comment line 2e is designed to take up space - lots and lots of space.  Mondo comment line 2f is designed to take up space - lots and lots of space.  Mondo comment line 30 is designed to take up space - lots and lots of space.  Mondo comment line 31 is designed to take up space - lots and lots of space.  Mondo comment line 32 is designed to take up space - lots and lots of space.  Mondo comment line 33 is designed to take up space - lots and lots of space.  Mondo comment line 34 is designed to take up space - lots and lots of space.  Mondo comment line 35 is designed to take up space - lots and lots of space.  Mondo comment line 36 is designed to take up space - lots and lots of space.  Mondo comment line 37 is designed to take up space - lots and lots of space.  Mondo comment line 38 is designed to take up space - lots and lots of space.  Mondo comment line 39 is designed to take up space - lots and lots of space.  Mondo comment line 3a is designed to take up space - lots and lots of space.  Mondo comment line 3b is designed to take up space - lots and lots of space.  Mondo comment line 3c is designed to take up space - lots and lots of space.  Mondo comment line 3d is designed to take up space - lots and lots of space.  Mondo comment line 3e is designed to take up space - lots and lots of space.  Mondo comment line 3f is designed to take up space - lots and lots of space.  Mondo comment line 40 is designed to take up space - lots and lots of space.  Mondo comment line 41 is designed to take up space - lots and lots of space.  Mondo comment line 42 is designed to take up space - lots and lots of space.  Mondo comment line 43 is designed to take up space - lots and lots of space.  Mondo comment line 44 is designed to take up space - lots and lots of space.  Mondo comment line 45 is designed to take up space - lots and lots of space.  Mondo comment line 46 is designed to take up space - lots and lots of space.  Mondo comment line 47 is designed to take up space - lots and lots of space.  Mondo comment line 48 is designed to take up space - lots and lots of space.  Mondo comment line 49 is designed to take up space - lots and lots of space.  Mondo comment line 4a is designed to take up space - lots and lots of space.  Mondo comment line 4b is designed to take up space - lots and lots of space.  Mondo comment line 4c is designed to take up space - lots and lots of space.  Mondo comment line 4d is designed to take up space - lots and lots of space.  Mondo comment line 4e is designed to take up space - lots and lots of space.  Mondo comment line 4f is designed to take up space - lots and lots of space.  Mondo comment line 50 is designed to take up space - lots and lots of space.  Mondo comment line 51 is designed to take up space - lots and lots of space.  Mondo comment line 52 is designed to take up space - lots and lots of space.  Mondo comment line 53 is designed to take up space - lots and lots of space.  Mondo comment line 54 is designed to take up space - lots and lots of space.  Mondo comment line 55 is designed to take up space - lots and lots of space.  Mondo comment line 56 is designed to take up space - lots and lots of space.  Mondo comment line 57 is designed to take up space - lots and lots of space.  Mondo comment line 58 is designed to take up space - lots and lots of space.  Mondo comment line 59 is designed to take up space - lots and lots of space.  Mondo comment line 5a is designed to take up space - lots and lots of space.  Mondo comment line 5b is designed to take up space - lots and lots of space.  Mondo comment line 5c is designed to take up space - lots and lots of space.  Mondo comment line 5d is designed to take up space - lots and lots of space.  Mondo comment line 5e is designed to take up space - lots and lots of space.  Mondo comment line 5f is designed to take up space - lots and lots of space.  Mondo comment line 60 is designed to take up space - lots and lots of space.  Mondo comment line 61 is designed to take up space - lots and lots of space.  Mondo comment line 62 is designed to take up space - lots and lots of space.  Mondo comment line 63 is designed to take up space - lots and lots of space.  Mondo comment line 64 is designed to take up space - lots and lots of space.  Mondo comment line 65 is designed to take up space - lots and lots of space.  Mondo comment line 66 is designed to take up space - lots and lots of space.  Mondo comment line 67 is designed to take up space - lots and lots of space.  Mondo comment line 68 is designed to take up space - lots and lots of space.  Mondo comment line 69 is designed to take up space - lots and lots of space.  Mondo comment line 6a is designed to take up space - lots and lots of space.  Mondo comment line 6b is designed to take up space - lots and lots of space.  Mondo comment line 6c is designed to take up space - lots and lots of space.  Mondo comment line 6d is designed to take up space - lots and lots of space.  Mondo comment line 6e is designed to take up space - lots and lots of space.  Mondo comment line 6f is designed to take up space - lots and lots of space.  Mondo comment line 70 is designed to take up space - lots and lots of space.  Mondo comment line 71 is designed to take up space - lots and lots of space.  Mondo comment line 72 is designed to take up space - lots and lots of space.  Mondo comment line 73 is designed to take up space - lots and lots of space.  Mondo comment line 74 is designed to take up space - lots and lots of space.  Mondo comment line 75 is designed to take up space - lots and lots of space.  Mondo comment line 76 is designed to take up space - lots and lots of space.  Mondo comment line 77 is designed to take up space - lots and lots of space.  Mondo comment line 78 is designed to take up space - lots and lots of space.  Mondo comment line 79 is designed to take up space - lots and lots of space.  Mondo comment line 7a is designed to take up space - lots and lots of space.  Mondo comment line 7b is designed to take up space - lots and lots of space.  Mondo comment line 7c is designed to take up space - lots and lots of space.  Mondo comment line 7d is designed to take up space - lots and lots of space.  Mondo comment line 7e is designed to take up space - lots and lots of space.  Mondo comment line 7f is designed to take up space - lots and lots of space.  Mondo comment line 80 is designed to take up space - lots and lots of space.  Mondo comment line 81 is designed to take up space - lots and lots of space.  Mondo comment line 82 is designed to take up space - lots and lots of space.  Mondo comment line 83 is designed to take up space - lots and lots of space.  Mondo comment line 84 is designed to take up space - lots and lots of space.  Mondo comment line 85 is designed to take up space - lots and lots of space.  Mondo comment line 86 is designed to take up space - lots and lots of space.  Mondo comment line 87 is designed to take up space - lots and lots of space.  Mondo comment line 88 is designed to take up space - lots and lots of space.  Mondo comment line 89 is designed to take up space - lots and lots of space.  Mondo comment line 8a is designed to take up space - lots and lots of space.  Mondo comment line 8b is designed to take up space - lots and lots of space.  Mondo comment line 8c is designed to take up space - lots and lots of space.  Mondo comment line 8d is designed to take up space - lots and lots of space.  Mondo comment line 8e is designed to take up space - lots and lots of space.  Mondo comment line 8f is designed to take up space - lots and lots of space.  Mondo comment line 90 is designed to take up space - lots and lots of space.  Mondo comment line 91 is designed to take up space - lots and lots of space.  Mondo comment line 92 is designed to take up space - lots and lots of space.  Mondo comment line 93 is designed to take up space - lots and lots of space.  Mondo comment line 94 is designed to take up space - lots and lots of space.  Mondo comment line 95 is designed to take up space - lots and lots of space.  Mondo comment line 96 is designed to take up space - lots and lots of space.  Mondo comment line 97 is designed to take up space - lots and lots of space.  Mondo comment line 98 is designed to take up space - lots and lots of space.  Mondo comment line 99 is designed to take up space - lots and lots of space.  Mondo comment line 9a is designed to take up space - lots and lots of space.  Mondo comment line 9b is designed to take up space - lots and lots of space.  Mondo comment line 9c is designed to take up space - lots and lots of space.  Mondo comment line 9d is designed to take up space - lots and lots of space.  Mondo comment line 9e is designed to take up space - lots and lots of space.  Mondo comment line 9f is designed to take up space - lots and lots of space.  Mondo comment line a0 is designed to take up space - lots and lots of space.  Mondo comment line a1 is designed to take up space - lots and lots of space.  Mondo comment line a2 is designed to take up space - lots and lots of space.  Mondo comment line a3 is designed to take up space - lots and lots of space.  Mondo comment line a4 is designed to take up space - lots and lots of space.  Mondo comment line a5 is designed to take up space - lots and lots of space.  Mondo comment line a6 is designed to take up space - lots and lots of space.  Mondo comment line a7 is designed to take up space - lots and lots of space.  Mondo comment line a8 is designed to take up space - lots and lots of space.  Mondo comment line a9 is designed to take up space - lots and lots of space.  Mondo comment line aa is designed to take up space - lots and lots of space.  Mondo comment line ab is designed to take up space - lots and lots of space.  Mondo comment line ac is designed to take up space - lots and lots of space.  Mondo comment line ad is designed to take up space - lots and lots of space.  Mondo comment line ae is designed to take up space - lots and lots of space.  Mondo comment line af is designed to take up space - lots and lots of space.  Mondo comment line b0 is designed to take up space - lots and lots of space.  Mondo comment line b1 is designed to take up space - lots and lots of space.  Mondo comment line b2 is designed to take up space - lots and lots of space.  Mondo comment line b3 is designed to take up space - lots and lots of space.  Mondo comment line b4 is designed to take up space - lots and lots of space.  Mondo comment line b5 is designed to take up space - lots and lots of space.  Mondo comment line b6 is designed to take up space - lots and lots of space.  Mondo comment line b7 is designed to take up space - lots and lots of space.  Mondo comment line b8 is designed to take up space - lots and lots of space.  Mondo comment line b9 is designed to take up space - lots and lots of space.  Mondo comment line ba is designed to take up space - lots and lots of space.  Mondo comment line bb is designed to take up space - lots and lots of space.  Mondo comment line bc is designed to take up space - lots and lots of space.  Mondo comment line bd is designed to take up space - lots and lots of space.  Mondo comment line be is designed to take up space - lots and lots of space.  Mondo comment line bf is designed to take up space - lots and lots of space.  Mondo comment line c0 is designed to take up space - lots and lots of space.  Mondo comment line c1 is designed to take up space - lots and lots of space.  Mondo comment line c2 is designed to take up space - lots and lots of space.  Mondo comment line c3 is designed to take up space - lots and lots of space.  Mondo comment line c4 is designed to take up space - lots and lots of space.  Mondo comment line c5 is designed to take up space - lots and lots of space.  Mondo comment line c6 is designed to take up space - lots and lots of space.  Mondo comment line c7 is designed to take up space - lots and lots of space.  Mondo comment line c8 is designed to take up space - lots and lots of space.  Mondo comment line c9 is designed to take up space - lots and lots of space.  Mondo comment line ca is designed to take up space - lots and lots of space.  Mondo comment line cb is designed to take up space - lots and lots of space.  Mondo comment line cc is designed to take up space - lots and lots of space.  Mondo comment line cd is designed to take up space - lots and lots of space.  Mondo comment line ce is designed to take up space - lots and lots of space.  Mondo comment line cf is designed to take up space - lots and lots of space.  Mondo comment line d0 is designed to take up space - lots and lots of space.  Mondo comment line d1 is designed to take up space - lots and lots of space.  Mondo comment line d2 is designed to take up space - lots and lots of space.  Mondo comment line d3 is designed to take up space - lots and lots of space.  Mondo comment line d4 is designed to take up space - lots and lots of space.  Mondo comment line d5 is designed to take up space - lots and lots of space.  Mondo comment line d6 is designed to take up space - lots and lots of space.  Mondo comment line d7 is designed to take up space - lots and lots of space.  Mondo comment line d8 is designed to take up space - lots and lots of space.  Mondo comment line d9 is designed to take up space - lots and lots of space.  Mondo comment line da is designed to take up space - lots and lots of space.  Mondo comment line db is designed to take up space - lots and lots of space.  Mondo comment line dc is designed to take up space - lots and lots of space.  Mondo comment line dd is designed to take up space - lots and lots of space.  Mondo comment line de is designed to take up space - lots and lots of space.  Mondo comment line df is designed to take up space - lots and lots of space.  Mondo comment line e0 is designed to take up space - lots and lots of space.  Mondo comment line e1 is designed to take up space - lots and lots of space.  Mondo comment line e2 is designed to take up space - lots and lots of space.  Mondo comment line e3 is designed to take up space - lots and lots of space.  Mondo comment line e4 is designed to take up space - lots and lots of space.  Mondo comment line e5 is designed to take up space - lots and lots of space.  Mondo comment line e6 is designed to take up space - lots and lots of space.  Mondo comment line e7 is designed to take up space - lots and lots of space.  Mondo comment line e8 is designed to take up space - lots and lots of space.  Mondo comment line e9 is designed to take up space - lots and lots of space.  Mondo comment line ea is designed to take up space - lots and lots of space.  Mondo comment line eb is designed to take up space - lots and lots of space.  Mondo comment line ec is designed to take up space - lots and lots of space.  Mondo comment line ed is designed to take up space - lots and lots of space.  Mondo comment line ee is designed to take up space - lots and lots of space.  Mondo comment line ef is designed to take up space - lots and lots of space.  Mondo comment line f0 is designed to take up space - lots and lots of space.  Mondo comment line f1 is designed to take up space - lots and lots of space.  Mondo comment line f2 is designed to take up space - lots and lots of space.  Mondo comment line f3 is designed to take up space - lots and lots of space.  Mondo comment line f4 is designed to take up space - lots and lots of space.  Mondo comment line f5 is designed to take up space - lots and lots of space.  Mondo comment line f6 is designed to take up space - lots and lots of space.  Mondo comment line f7 is designed to take up space - lots and lots of space.  Mondo comment line f8 is designed to take up space - lots and lots of space.  Mondo comment line f9 is designed to take up space - lots and lots of space.  Mondo comment line fa is designed to take up space - lots and lots of space.  Mondo comment line fb is designed to take up space - lots and lots of space.  Mondo comment line fc is designed to take up space - lots and lots of space.  Mondo comment line fd is designed to take up space - lots and lots of space.  Mondo comment line fe is designed to take up space - lots and lots of space.  Mondo comment line ff is designed to take up space - lots and lots of space."
 CommentZipFile() {
-    file=
-    tail="is designed to take up space - lots and lots of space."
-    mv PrintVersion PrintVersion.zip
-    /usr/bin/zipnote PrintVersion.zip > zipout
-    while read ampersand line; do
-	if [ "$ampersand" = "@" ]; then
-	    if [ "$line" = "(comment above this line)" ]; then
-		echo "File Comment Line." >> zipin
-		if [ "$file" = "$1" ]; then
-		    for i in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
-			for j in 0 1 2 3 4 5 6 7 8 9 a b c d e f; do
-			    echo "Mondo comment line $i$j $tail" >> zipin
-			done
-		    done
-		fi
-	    else
-		file=$line
-	    fi
+	mkdir -p META-INF
+	echo "Manifest-Version: 1.0" > META-INF/MANIFEST.MF
+	echo "Main-Class: PrintVersion" >> META-INF/MANIFEST.MF
+	if [ "$1" != "" ]; then
+	    echo "JRE-Version: $1" >> META-INF/MANIFEST.MF
 	fi
-	echo "$ampersand $line" >> zipin
-	if [ "$ampersand" = "@" ]; then
-	    if [ "$line" = "(zip file comment below this line)" ]; then
-		echo "Zip File Comment Line number 1" >> zipin
-		echo "Zip File Comment Line number 2" >> zipin
-	    fi
-	fi
-    done < zipout
-    /usr/bin/zipnote -w PrintVersion.zip < zipin
+	cp $TESTCLASSES/PrintVersion.class .
+
+	# The remaining code in CommentZipFile essentially replaces the
+	#   following code, which added comments to the jar file.
+	#   Unfortunately zipnote has been broken since 3.0 [ 2008 ] and
+	#   there has been no new [ fixed ] version.  zipnote has probably
+	#   always failed, or failed for a long time without causing the
+	#   test to fail.  So no comments were added to the file.
+	#   The comments are added using zip(1) during the creation of the
+	#   zip file.
+	#
+	# NOTE:
+	#   It seems the original intent of this test was to add a very long
+	#   comment for one file.  But zip allows a max of 256 characters, so
+	#   we settle for adding 256-character comments to lots of files.
+	#
+	# $JAR $2cMf PrintVersion PrintVersion.class AfairlyLong*
+	# $JAR $2umf META-INF/MANIFEST.MF PrintVersion
+	# /usr/bin/zipnote PrintVersion.zip > zipout
+	# ... code to modify zipout adding comments
+	# /usr/bin/zipnote -w PrintVersion.zip < zipin
+	# mv PrintVersion.zip PrintVersion
+	#
+
+
+	for i in 0 1 2 3 4 5 6 7 8 9 ; do
+		for j in 0 1 2 3 4 5 6 7 8 9 ; do
+			touch AfairlyLongNameEatsUpDirectorySpaceBetter$i$j
+		done
+	done
+
+        zip -$2c PrintVersion.zip PrintVersion.class AfairlyLong* META-INF/MANIFEST.MF << FINI
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+File Comment Line.
+$MONDO
+File Comment Line.
+File Comment Line.
+File Comment Line.
+FINI
+
+	rm -f AfairlyLong*
+
     mv PrintVersion.zip PrintVersion
-    rm zipout zipin
+
 }
 
 #
@@ -261,22 +300,29 @@ CommentZipFile() {
 #
 LaunchVM() {
 	if [ "$1" != "" ]; then
-		mess="`$JAVA -version:\"$1\" -jar PrintVersion 2>&1`"
-	else
-		mess="`$JAVA -jar PrintVersion 2>&1`"
-	fi
-	if [ $? -ne 0 ]; then
-		prefix=`echo "$mess" | cut -d ' ' -f 1-3`
-		if [ "$prefix" != "Unable to locate" ]; then
+		mess="`$JAVA \"$1\" -jar PrintVersion 2>&1`"
+		if [ $? -eq 0 ]; then
+			echo "Unexpected success of -Version:$1"
 			echo "$mess"
 			exit 1
 		fi
-		echo "Unexpected error in attempting to locate $1"
-		exit 1
+	else
+		mess="`$JAVA -jar PrintVersion 2>&1`"
+		if [ $? -ne 0 ]; then
+			prefix=`echo "$mess" | cut -d ' ' -f 1-3`
+			if [ "$prefix" != "Unable to locate" ]; then
+				echo "$mess"
+				exit 1
+			fi
+			echo "Unexpected error in attempting to locate $1"
+			exit 1
+		fi
+
 	fi
+
 	echo $mess | grep "$2" > /dev/null 2>&1
 	if [ $? != 0 ]; then
-	    echo "Launched $mess, expected $2"
+	    echo "Launched $mess, expected $1"
 	    exit 1
 	fi
 }
@@ -307,6 +353,7 @@ TestLongMainClass() {
 #
 # Main test sequence starts here
 #
+
 RELEASE=`$JAVA -version 2>&1 | head -n 1 | cut -d ' ' -f 3 | \
   sed -e "s/\"//g"`
 BASE_RELEASE=`echo $RELEASE | sed -e "s/-.*//g"`
@@ -386,91 +433,31 @@ if [ -x /usr/bin/zipnote ]; then
 fi
 
 #
-# Throw some syntactically challenged (illegal) version specifiers at
-# the interface.  Failure (of the launcher) is success for the test.
+# Now test specification of mJRE
+#
+#   In some cases this should result in failure of the command,
+#   in some cases, a warning messages, with the command succeeding.
 #
-TestSyntax "1.2..3"				# Two adjacent separators
-TestSyntax "_1.2.3"				# Begins with a separator
-TestSyntax "1.2.3-"				# Ends with a separator
-TestSyntax "1.2+.3"				# Embedded modifier
-TestSyntax "1.2.4+&1.2*&1++"			# Long and invalid
 
-# On windows we see if there is another jre installed, usually
-# there is, then we test using that, otherwise links are created
-# to get through to SelectVersion.
-if [ `IsWindows` = "false" ]; then
-   TestLongMainClass "mklink"
-else
-    $JAVAEXE -version:1.0+
-    if [ $? -eq 0 ]; then
-        TestLongMainClass "1.0+"
-    else
-        printf  "Warning: TestLongMainClass skipped as there is no"
-	printf  "viable MJRE installed.\n"
-    fi
-fi
+	# Commandline use of "-version:" should fail
+	#   with a message containing "no longer supported"
+	LaunchVM "-version:1.10+" "Error: Specifying an alternate JDK/JRE"
+	LaunchVM "-version:prettymuchanything" "Error: Specifying an alternate JDK/JRE"
 
-#
-# Because scribbling in the registry can be rather destructive, only a
-# subset of the tests are run on Windows.
-#
-if [ `IsWindows` = "true" ]; then
-    exit 0;
-fi
+	# Commandline use of "-jre-restrict-search" should now fail
+	LaunchVM "-jre-restrict-search" "\-jre\-no\-restrict\-search are also no longer valid"
+	# Commandline use of "-jre-no-restrict-search" should now fail
+	LaunchVM "-jre-no-restrict-search" "\-jre\-no\-restrict\-search are also no longer valid"
 
-#
-# Additional version specifiers containing spaces.  (Sigh, unable to
-# figure out the glomming on Windows)
-#
-TestSyntax "1.2.3_99 1.3.2+ 1.2.4+&1.2*&1++"	# Long and invalid
 
-#
-# Create a mock installation of a number of shell scripts named as though
-# they were installed JREs.  Then test to see if the launcher can cause
-# the right shell scripts to be invoked.
-#
-# Note, that as a side effect, this test verifies that JAVA_VERSION_PATH
-# works.
-#
-rm -rf jdk
-JAVA_VERSION_PATH="`pwd`/jdk"
-export JAVA_VERSION_PATH
-
-CreateMockVM 1.10
-CreateMockVM 1.11.3
-CreateMockVM 1.11.3_03
-CreateMockVM 1.11.4
-CreateMockVM 1.12.3_03
-CreateMockVM 1.12.3_03-lastweek
-CreateMockVM 1.13.3_03
-CreateMockVM 1.13.3_03-lastweek
-CreateMockVM 1.13.3_03_lastweek
-CreateMockVM 1.20.0
-
-#
-# Test extracting the version information from the jar file:
-#
-#	  Requested		Expected
-CreateJar "1.10+" ""
-LaunchVM  ""			"1.20.0"
-CreateJar "1.11.3_03+&1.11*" ""
-LaunchVM  ""			"1.11.4"
-CreateJar "1.12.3_03+&1.12.3*" ""
-LaunchVM  ""			"1.12.3_03"
-CreateJar "1.13.3_03+&1.13.3*" ""
-LaunchVM  ""			"1.13.3_03_lastweek"	# Strange but true
-
-#
-# Test obtaining the version information from the command line (and that
-# it overrides the manifest).
-#
-CreateJar "${BASERELEASE}*" ""
-LaunchVM  "1.10+"		"1.20.0"
-LaunchVM  "1.11.3_03+&1.11*"	"1.11.4"
-LaunchVM  "1.12.3_03+&1.12.3*"	"1.12.3_03"
-LaunchVM  "1.13.3_03+&1.13.3*"	"1.13.3_03_lastweek"	# Strange but true
-
-[ -d jdk ] && rm -rf jdk
-[ -d META_INF ] && rm -rf META_INF
+	# mJRE directives to use a specific version should be flagged
+	#   with a warning, but the jar should be executed with the
+	#   current jre
+	CreateFullJar "junk request" ""
+	LaunchVM "" "${RELEASE}"
+        # Going to silently ignore JRE-Version setting in jar file manifest
+	#LaunchVM "" "warning: The jarfile JRE-Version"
+	
 
 exit 0
+

From 5ccaf44879591eaef30f9a3df35febac4401b325 Mon Sep 17 00:00:00 2001
From: Calvin Cheung <ccheung@openjdk.org>
Date: Mon, 10 Nov 2014 10:13:10 -0800
Subject: [PATCH 056/299] 8060721: Test
 runtime/SharedArchiveFile/LimitSharedSizes.java fails in jdk 9 fcs new
 platforms/compiler

Replaced strcat() with jio_snprintf()

Reviewed-by: dholmes, iklam, dlong, minqi
---
 hotspot/src/share/vm/memory/metaspaceShared.cpp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/hotspot/src/share/vm/memory/metaspaceShared.cpp b/hotspot/src/share/vm/memory/metaspaceShared.cpp
index f71baaed660..d7025cc4d4b 100644
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp
@@ -715,15 +715,17 @@ void MetaspaceShared::preload_and_dump(TRAPS) {
     if (class_list_path_len >= 3) {
       if (strcmp(class_list_path_str + class_list_path_len - 3, "lib") != 0) {
         if (class_list_path_len < JVM_MAXPATHLEN - 4) {
-          strncat(class_list_path_str, os::file_separator(), 1);
-          strncat(class_list_path_str, "lib", 3);
+          jio_snprintf(class_list_path_str + class_list_path_len,
+                       sizeof(class_list_path_str) - class_list_path_len,
+                       "%slib", os::file_separator());
+          class_list_path_len += 4;
         }
       }
     }
-    class_list_path_len = (int)strlen(class_list_path_str);
     if (class_list_path_len < JVM_MAXPATHLEN - 10) {
-      strncat(class_list_path_str, os::file_separator(), 1);
-      strncat(class_list_path_str, "classlist", 9);
+      jio_snprintf(class_list_path_str + class_list_path_len,
+                   sizeof(class_list_path_str) - class_list_path_len,
+                   "%sclasslist", os::file_separator());
     }
     class_list_path = class_list_path_str;
   } else {

From 935c33a50c4f510438c5346a5521774a37a7df18 Mon Sep 17 00:00:00 2001
From: Eric McCorkle <emc@openjdk.org>
Date: Mon, 10 Nov 2014 15:06:13 -0500
Subject: [PATCH 057/299] 8062556: Add jdk tests for JDK-8058322 and
 JDK-8058313

Add tests for two hotspot reflection fixes.

Reviewed-by: dholmes
---
 .../lang/reflect/Parameter/BadClassFiles.java | 239 +++++++++++++++---
 .../java/lang/reflect/Parameter/NoName.java   | 121 +++++++++
 2 files changed, 323 insertions(+), 37 deletions(-)
 create mode 100644 jdk/test/java/lang/reflect/Parameter/NoName.java

diff --git a/jdk/test/java/lang/reflect/Parameter/BadClassFiles.java b/jdk/test/java/lang/reflect/Parameter/BadClassFiles.java
index 581d4ef6f5f..55e67f32710 100644
--- a/jdk/test/java/lang/reflect/Parameter/BadClassFiles.java
+++ b/jdk/test/java/lang/reflect/Parameter/BadClassFiles.java
@@ -81,10 +81,23 @@ public class BadClassFiles {
         0,25,0,0,0,3,0,0,
         0,1,-79,0,0,0,1,0,
         7,0,0,0,6,0,1,0,
-        0,0,2,0,10,0,0,0,
-        9,2,0,11,0,0,0,12,
-        0,0,0,1,0,13,0,0,
-        0,2,0,14
+        0,0,2,
+        // Method Parameters attribute here
+        0,10,
+        // attribute_length
+        0,0,0,9,
+        // parameter_count
+        2,
+        // first parameter name
+        0,11,
+        // first parameter modifiers
+        0,0,
+        // second parameter name
+        0,12,
+        // second parameter modifiers
+        0,0,
+        // end attribute
+        0,1,0,13,0,0,0,2,0,14
     };
 
     private static final byte[] BadModifiers_bytes = {
@@ -121,10 +134,23 @@ public class BadClassFiles {
         25,0,0,0,3,0,0,0,
         1,-79,0,0,0,1,0,7,
         0,0,0,6,0,1,0,0,
-        0,2,0,10,0,0,0,9,
-        2,0,11,0,51,51,12,0,
-        0,0,1,0,13,0,0,0,
-        2,0,14
+        0,2,
+        // Method Parameters attribute here
+        0,10,
+        // attribute_length
+        0,0,0,9,
+        // parameter_count
+        2,
+        // first parameter name
+        0,11,
+        // first parameter modifiers
+        51,51,
+        // second parameter name
+        0,12,
+        // second parameter modifiers
+        0,0,
+        // end attribute
+        0,1,0,13,0,0,0,2,0,14
     };
 
     private static final byte[] BadNameIndex_bytes = {
@@ -161,10 +187,23 @@ public class BadClassFiles {
         25,0,0,0,3,0,0,0,
         1,-79,0,0,0,1,0,7,
         0,0,0,6,0,1,0,0,
-        0,2,0,10,0,0,0,9,
-        2,0,1,0,0,0,12,0,
-        0,0,1,0,13,0,0,0,
-        2,0,14
+        0,2,
+        // Method Parameters attribute here
+        0,10,
+        // attribute_length
+        0,0,0,9,
+        // parameter_count
+        2,
+        // first parameter name
+        0,1,
+        // first parameter modifiers
+        0,0,
+        // second parameter name
+        0,12,
+        // second parameter modifiers
+        0,0,
+        // end attribute
+        0,1,0,13,0,0,0,2,0,14
     };
 
     private static final byte[] NameIndexOutOfBounds_bytes = {
@@ -203,11 +242,23 @@ public class BadClassFiles {
         25,0,0,0,3,0,0,0,
         1,-79,0,0,0,1,0,7,
         0,0,0,6,0,1,0,0,
-        0,2,0,10,0,0,0,9,
-        2,0,-1,0,0,0,12,0,
-        0,0,1,0,13,0,0,0,
-        2,0,14
-
+        0,2,
+        // Method Parameters attribute here
+        0,10,
+        // attribute_length
+        0,0,0,9,
+        // parameter_count
+        2,
+        // first parameter name
+        0,-1,
+        // first parameter modifiers
+        0,0,
+        // second parameter name
+        0,12,
+        // second parameter modifiers
+        0,0,
+        // end attribute
+        0,1,0,13,0,0,0,2,0,14
     };
 
     private static final byte[] ExtraParams_bytes = {
@@ -244,10 +295,26 @@ public class BadClassFiles {
         0,0,3,0,0,0,1,-79,
         0,0,0,1,0,7,0,0,
         0,6,0,1,0,0,0,2,
-        0,10,0,0,0,13,3,0,
-        11,0,0,0,12,0,0,0,
-        11,0,0,0,1,0,13,0,
-        0,0,2,0,14
+        // Method Parameters attribute here
+        0,10,
+        // attribute_length
+        0,0,0,13,
+        // parameter_count
+        3,
+        // first parameter name
+        0,11,
+        // first parameter modifiers
+        0,0,
+        // second parameter name
+        0,12,
+        // second parameter modifiers
+        0,0,
+        // third parameter name
+        0,11,
+        // third parameter modifiers
+        0,0,
+        // end attribute
+        0,1,0,13,0,0,0,2,0,14
     };
 
     private static final byte[] BadName1_bytes = {
@@ -283,10 +350,23 @@ public class BadClassFiles {
         25,0,0,0,3,0,0,0,
         1,-79,0,0,0,1,0,7,
         0,0,0,6,0,1,0,0,
-        0,2,0,10,0,0,0,9,
-        2,0,11,0,0,0,12,0,
-        0,0,1,0,13,0,0,0,
-        2,0,14
+        0,2,
+        // Method Parameters attribute here
+        0,10,
+        // attribute_length
+        0,0,0,9,
+        // parameter_count
+        2,
+        // first parameter name
+        0,11,
+        // first parameter modifiers
+        0,0,
+        // second parameter name
+        0,12,
+        // second parameter modifiers
+        0,0,
+        // end attribute
+        0,1,0,13,0,0,0,2,0,14
     };
 
     private static final byte[] BadName2_bytes = {
@@ -322,10 +402,23 @@ public class BadClassFiles {
         25,0,0,0,3,0,0,0,
         1,-79,0,0,0,1,0,7,
         0,0,0,6,0,1,0,0,
-        0,2,0,10,0,0,0,9,
-        2,0,11,0,0,0,12,0,
-        0,0,1,0,13,0,0,0,
-        2,0,14
+        0,2,
+        // Method Parameters attribute here
+        0,10,
+        // attribute_length
+        0,0,0,9,
+        // parameter_count
+        2,
+        // first parameter name
+        0,11,
+        // first parameter modifiers
+        0,0,
+        // second parameter name
+        0,12,
+        // second parameter modifiers
+        0,0,
+        // end attribute
+        0,1,0,13,0,0,0,2,0,14
     };
 
     private static final byte[] BadName3_bytes = {
@@ -361,10 +454,23 @@ public class BadClassFiles {
         25,0,0,0,3,0,0,0,
         1,-79,0,0,0,1,0,7,
         0,0,0,6,0,1,0,0,
-        0,2,0,10,0,0,0,9,
-        2,0,11,0,0,0,12,0,
-        0,0,1,0,13,0,0,0,
-        2,0,14
+        0,2,
+        // Method Parameters attribute here
+        0,10,
+        // attribute_length
+        0,0,0,9,
+        // parameter_count
+        2,
+        // first parameter name
+        0,11,
+        // first parameter modifiers
+        0,0,
+        // second parameter name
+        0,12,
+        // second parameter modifiers
+        0,0,
+        // end attribute
+        0,1,0,13,0,0,0,2,0,14
     };
 
     private static final byte[] BadName4_bytes = {
@@ -400,10 +506,68 @@ public class BadClassFiles {
         25,0,0,0,3,0,0,0,
         1,-79,0,0,0,1,0,7,
         0,0,0,6,0,1,0,0,
-        0,2,0,10,0,0,0,9,
-        2,0,11,0,0,0,12,0,
-        0,0,1,0,13,0,0,0,
-        2,0,14
+        0,2,
+        // Method Parameters attribute here
+        0,10,
+        // attribute_length
+        0,0,0,9,
+        // parameter_count
+        2,
+        // first parameter name
+        0,11,
+        // first parameter modifiers
+        0,0,
+        // second parameter name
+        0,12,
+        // second parameter modifiers
+        0,0,
+        // end attribute
+        0,1,0,13,0,0,0,2,0,14
+    };
+
+    private static final byte[] BadParams_bytes = {
+        -54,-2,-70,-66,0,0,0,
+        52,0,18,10,0,3,0,15,
+        7,0,16,7,0,17,1,0,6,
+        60,105,110,105,116,62,
+        1,0,3,40,41,86,1,0,4,
+        67,111,100,101,1,0,15,
+        76,105,110,101,78,117,
+        109,98,101,114,84,97,
+        98,108,101,1,0,1,109,
+        1,0,5,40,73,73,41,86,
+        1,0,16,77,101,116,104,
+        111,100,80,97,114,97,
+        109,101,116,101,114,115,
+        1,0,1,97,1,0,1,98,1,
+        0,10,83,111,117,114,
+        99,101,70,105,108,101,
+        1,0,14,66,97,100,80,97,
+        114,97,109,115,46,106,
+        97,118,97,12,0,4,0,5,
+        1,0,9,66,97,100,80,97,
+        114,97,109,115,1,0,16,
+        106,97,118,97,47,108,97,
+        110,103,47,79,98,106,
+        101,99,116,0,33,0,
+        2,0,3,0,0,0,0,0,2,
+        0,1,0,4,0,5,0,1,0,
+        6,0,0,0,29,0,1,0,1,
+        0,0,0,5,42,-73,0,1,
+        -79,0,0,0,1,0,7,0,0,
+        0,6,0,1,0,0,0,1,0,1,
+        0,8,0,9,0,2,0,6,0,0,
+        0,25,0,0,0,3,0,0,0,1,
+        -79,0,0,0,1,0,7,0,0,
+        0,6,0,1,0,0,0,2,
+        // Method Parameters attribute here
+        0,10,
+        // attribute_length
+        0,0,0,1,
+        // parameter_count
+        0,
+        // end attribute
+        0,1,0,13,0,0,0,2,0,14
     };
 
     private static class InMemoryClassLoader extends ClassLoader {
@@ -423,6 +587,7 @@ public class BadClassFiles {
             loader.defineClass("BadNameIndex", BadNameIndex_bytes),
             loader.defineClass("NameIndexOutOfBounds", NameIndexOutOfBounds_bytes),
             loader.defineClass("ExtraParams", ExtraParams_bytes),
+            loader.defineClass("BadParams", BadParams_bytes),
             // Name with .
             loader.defineClass("BadName1", BadName1_bytes),
             // Name with [
diff --git a/jdk/test/java/lang/reflect/Parameter/NoName.java b/jdk/test/java/lang/reflect/Parameter/NoName.java
new file mode 100644
index 00000000000..7f3a1f69580
--- /dev/null
+++ b/jdk/test/java/lang/reflect/Parameter/NoName.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2013, 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
+ * @run main NoName
+ * @summary The reflection API should report parameters with no name properly.
+ */
+import java.lang.Class;
+import java.lang.reflect.Method;
+import java.lang.reflect.Parameter;
+import java.lang.reflect.MalformedParametersException;
+import java.lang.ClassLoader;
+import java.lang.ClassNotFoundException;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+public class NoName {
+
+    private static final byte[] NoName_bytes = {
+        -54,-2,-70,-66,0,0,0,52,
+        0,18,10,0,3,0,15,7,
+        0,16,7,0,17,1,0,6,
+        60,105,110,105,116,62,1,0,
+        3,40,41,86,1,0,4,67,
+        111,100,101,1,0,15,76,105,
+        110,101,78,117,109,98,101,114,
+        84,97,98,108,101,1,0,1,
+        109,1,0,5,40,73,73,41,
+        86,1,0,16,77,101,116,104,
+        111,100,80,97,114,97,109,101,
+        116,101,114,115,1,0,0,1,
+        0,1,98,1,0,10,83,111,
+        117,114,99,101,70,105,108,101,
+        1,0,14,69,109,112,116,121,
+        78,97,109,101,46,106,97,118,
+        97,12,0,4,0,5,1,0,
+        9,69,109,112,116,121,78,97,
+        109,101,1,0,16,106,97,118,
+        97,47,108,97,110,103,47,79,
+        98,106,101,99,116,0,33,0,
+        2,0,3,0,0,0,0,0,
+        2,0,1,0,4,0,5,0,
+        1,0,6,0,0,0,29,0,
+        1,0,1,0,0,0,5,42,
+        -73,0,1,-79,0,0,0,1,
+        0,7,0,0,0,6,0,1,
+        0,0,0,1,0,1,0,8,
+        0,9,0,2,0,6,0,0,
+        0,25,0,0,0,3,0,0,
+        0,1,-79,0,0,0,1,0,
+        7,0,0,0,6,0,1,0,
+        0,0,2,
+        // Method Parameters attribute here
+        0,10,
+        // attribute_length
+        0,0,0,9,
+        // parameter_count
+        2,
+        // first parameter name
+        0,0,
+        // first parameter modifiers
+        0,0,
+        // second parameter name
+        0,12,
+        // second parameter modifiers
+        0,0,
+        // end attribute
+        0,1,0,13,0,0,0,2,0,14
+    };
+
+    private static class InMemoryClassLoader extends ClassLoader {
+        public Class<?> defineClass(String name, byte[] b) {
+            return defineClass(name, b, 0, b.length);
+        }
+    };
+
+    private static final InMemoryClassLoader loader = new InMemoryClassLoader();
+
+    private final Class<?> noName;
+
+    private NoName() throws ClassNotFoundException {
+        noName = loader.defineClass("EmptyName", NoName_bytes);
+    }
+
+    public static void main(String... args)
+        throws NoSuchMethodException, IOException, ClassNotFoundException {
+        new NoName().run();
+    }
+
+    public void run() throws NoSuchMethodException {
+        final Class<?> cls = noName;
+        System.err.println("Trying " + cls);
+        final Method method = cls.getMethod("m", int.class, int.class);
+        final Parameter[] params = method.getParameters();
+        System.err.println("Name " + params[0].getName());
+        System.err.println("Name " + params[1].getName());
+    }
+
+}

From bbd7b058d18c5dd72c9a8748f88d8a928e3bddae Mon Sep 17 00:00:00 2001
From: Eric McCorkle <emc@openjdk.org>
Date: Mon, 10 Nov 2014 16:45:46 -0500
Subject: [PATCH 058/299] 8058313: Mismatch of method descriptor and
 MethodParameters.parameters_count should cause MalformedParameterException

Allow hotspot to store and report zero-length MethodParameters attribute data

Reviewed-by: coleenp, jiangli
---
 hotspot/src/share/vm/classfile/classFileParser.cpp |  7 ++++---
 hotspot/src/share/vm/oops/constMethod.cpp          | 12 ++++++++----
 hotspot/src/share/vm/oops/constMethod.hpp          |  5 +++++
 hotspot/src/share/vm/prims/jvm.cpp                 | 14 +++++++++++---
 4 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp
index fe9f2443a80..da2f897ed0d 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp
@@ -2059,7 +2059,7 @@ methodHandle ClassFileParser::parse_method(bool is_interface,
   u2** localvariable_table_start;
   u2* localvariable_type_table_length;
   u2** localvariable_type_table_start;
-  u2 method_parameters_length = 0;
+  int method_parameters_length = -1;
   u1* method_parameters_data = NULL;
   bool method_parameters_seen = false;
   bool parsed_code_attribute = false;
@@ -2278,7 +2278,8 @@ methodHandle ClassFileParser::parse_method(bool is_interface,
       }
       method_parameters_seen = true;
       method_parameters_length = cfs->get_u1_fast();
-      if (method_attribute_length != (method_parameters_length * 4u) + 1u) {
+      const u2 real_length = (method_parameters_length * 4u) + 1u;
+      if (method_attribute_length != real_length) {
         classfile_parse_error(
           "Invalid MethodParameters method attribute length %u in class file",
           method_attribute_length, CHECK_(nullHandle));
@@ -2288,7 +2289,7 @@ methodHandle ClassFileParser::parse_method(bool is_interface,
       cfs->skip_u2_fast(method_parameters_length);
       // ignore this attribute if it cannot be reflected
       if (!SystemDictionary::Parameter_klass_loaded())
-        method_parameters_length = 0;
+        method_parameters_length = -1;
     } else if (method_attribute_name == vmSymbols::tag_synthetic()) {
       if (method_attribute_length != 0) {
         classfile_parse_error(
diff --git a/hotspot/src/share/vm/oops/constMethod.cpp b/hotspot/src/share/vm/oops/constMethod.cpp
index ea51a2c02c4..e3703be0c59 100644
--- a/hotspot/src/share/vm/oops/constMethod.cpp
+++ b/hotspot/src/share/vm/oops/constMethod.cpp
@@ -116,7 +116,11 @@ int ConstMethod::size(int code_size,
   if (sizes->generic_signature_index() != 0) {
     extra_bytes += sizeof(u2);
   }
-  if (sizes->method_parameters_length() > 0) {
+  // This has to be a less-than-or-equal check, because we might be
+  // storing information from a zero-length MethodParameters
+  // attribute.  We have to store these, because in some cases, they
+  // cause the reflection API to throw a MalformedParametersException.
+  if (sizes->method_parameters_length() >= 0) {
     extra_bytes += sizeof(u2);
     extra_bytes += sizes->method_parameters_length() * sizeof(MethodParametersElement);
   }
@@ -237,7 +241,7 @@ void ConstMethod::set_inlined_tables_length(InlineTableSizes* sizes) {
     _flags |= _has_linenumber_table;
   if (sizes->generic_signature_index() != 0)
     _flags |= _has_generic_signature;
-  if (sizes->method_parameters_length() > 0)
+  if (sizes->method_parameters_length() >= 0)
     _flags |= _has_method_parameters;
   if (sizes->checked_exceptions_length() > 0)
     _flags |= _has_checked_exceptions;
@@ -272,7 +276,7 @@ void ConstMethod::set_inlined_tables_length(InlineTableSizes* sizes) {
   if (sizes->generic_signature_index() != 0)
     *(generic_signature_index_addr()) = sizes->generic_signature_index();
   // New data should probably go here.
-  if (sizes->method_parameters_length() > 0)
+  if (sizes->method_parameters_length() >= 0)
     *(method_parameters_length_addr()) = sizes->method_parameters_length();
   if (sizes->checked_exceptions_length() > 0)
     *(checked_exceptions_length_addr()) = sizes->checked_exceptions_length();
@@ -283,7 +287,7 @@ void ConstMethod::set_inlined_tables_length(InlineTableSizes* sizes) {
 }
 
 int ConstMethod::method_parameters_length() const {
-  return has_method_parameters() ? *(method_parameters_length_addr()) : 0;
+  return has_method_parameters() ? *(method_parameters_length_addr()) : -1;
 }
 
 MethodParametersElement* ConstMethod::method_parameters_start() const {
diff --git a/hotspot/src/share/vm/oops/constMethod.hpp b/hotspot/src/share/vm/oops/constMethod.hpp
index 830a8f98a72..3f3ae19ea01 100644
--- a/hotspot/src/share/vm/oops/constMethod.hpp
+++ b/hotspot/src/share/vm/oops/constMethod.hpp
@@ -372,6 +372,11 @@ public:
   ExceptionTableElement* exception_table_start() const;
 
   // method parameters table
+
+  // This returns -1 if no parameters are present, a non-negative
+  // value otherwise.  Note: sometimes, there are 0-length parameters
+  // attributes that must be reported up to the reflection API all the
+  // same.
   int method_parameters_length() const;
   MethodParametersElement* method_parameters_start() const;
 
diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp
index a9eab534820..419abd6d0f0 100644
--- a/hotspot/src/share/vm/prims/jvm.cpp
+++ b/hotspot/src/share/vm/prims/jvm.cpp
@@ -1657,7 +1657,17 @@ JVM_ENTRY(jobjectArray, JVM_GetMethodParameters(JNIEnv *env, jobject method))
   Handle reflected_method (THREAD, JNIHandles::resolve_non_null(method));
   const int num_params = mh->method_parameters_length();
 
-  if (0 != num_params) {
+  if (num_params < 0) {
+    // A -1 return value from method_parameters_length means there is no
+    // parameter data.  Return null to indicate this to the reflection
+    // API.
+    assert(num_params == -1, "num_params should be -1 if it is less than zero");
+    return (jobjectArray)NULL;
+  } else {
+    // Otherwise, we return something up to reflection, even if it is
+    // a zero-length array.  Why?  Because in some cases this can
+    // trigger a MalformedParametersException.
+
     // make sure all the symbols are properly formatted
     for (int i = 0; i < num_params; i++) {
       MethodParametersElement* params = mh->method_parameters_start();
@@ -1685,8 +1695,6 @@ JVM_ENTRY(jobjectArray, JVM_GetMethodParameters(JNIEnv *env, jobject method))
       result->obj_at_put(i, param);
     }
     return (jobjectArray)JNIHandles::make_local(env, result());
-  } else {
-    return (jobjectArray)NULL;
   }
 }
 JVM_END

From 4f4c4bbd5c4a2ed359579cc6899fb53054ae5eb0 Mon Sep 17 00:00:00 2001
From: Jiangli Zhou <jiangli@openjdk.org>
Date: Mon, 10 Nov 2014 19:28:51 -0500
Subject: [PATCH 059/299] 8064375: Change certain errors to warnings in CDS
 output

Change CDS non-fatal preloading errors to warnings.

Reviewed-by: minqi, mseledtsov, coleenp
---
 hotspot/src/share/vm/classfile/classLoader.cpp  | 2 +-
 hotspot/src/share/vm/classfile/dictionary.cpp   | 2 +-
 hotspot/src/share/vm/memory/metaspaceShared.cpp | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp
index 780fea1c2a3..4def66bb3b0 100644
--- a/hotspot/src/share/vm/classfile/classLoader.cpp
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp
@@ -1120,7 +1120,7 @@ instanceKlassHandle ClassLoader::load_classfile(Symbol* h_name, TRAPS) {
     h = context.record_result(classpath_index, e, result, THREAD);
   } else {
     if (DumpSharedSpaces) {
-      tty->print_cr("Preload Error: Cannot find %s", class_name);
+      tty->print_cr("Preload Warning: Cannot find %s", class_name);
     }
   }
 
diff --git a/hotspot/src/share/vm/classfile/dictionary.cpp b/hotspot/src/share/vm/classfile/dictionary.cpp
index 37381afbd65..5e8f5a5ec16 100644
--- a/hotspot/src/share/vm/classfile/dictionary.cpp
+++ b/hotspot/src/share/vm/classfile/dictionary.cpp
@@ -223,7 +223,7 @@ void Dictionary::remove_classes_in_error_state() {
         }
         free_entry(probe);
         ResourceMark rm;
-        tty->print_cr("Removed error class: %s", ik->external_name());
+        tty->print_cr("Preload Warning: Removed error class: %s", ik->external_name());
         continue;
       }
 
diff --git a/hotspot/src/share/vm/memory/metaspaceShared.cpp b/hotspot/src/share/vm/memory/metaspaceShared.cpp
index ab0d5de72b0..b50ca8e58bd 100644
--- a/hotspot/src/share/vm/memory/metaspaceShared.cpp
+++ b/hotspot/src/share/vm/memory/metaspaceShared.cpp
@@ -846,7 +846,7 @@ bool MetaspaceShared::try_link_class(InstanceKlass* ik, TRAPS) {
     ik->link_class(THREAD);
     if (HAS_PENDING_EXCEPTION) {
       ResourceMark rm;
-      tty->print_cr("Preload Error: Verification failed for %s",
+      tty->print_cr("Preload Warning: Verification failed for %s",
                     ik->external_name());
       CLEAR_PENDING_EXCEPTION;
       ik->set_in_error_state();

From cba5bd26387dc2ecb31ac8d6bea21bcc01da0cd5 Mon Sep 17 00:00:00 2001
From: Eric McCorkle <emc@openjdk.org>
Date: Mon, 10 Nov 2014 19:37:32 -0500
Subject: [PATCH 060/299] 8058322: Zero name_index item of MethodParameters
 attribute cause MalformedParameterException

Allow hotspot to report null for 0 parameter_name index in MethodParameters attribute

Reviewed-by: coleenp, dholmes
---
 hotspot/src/share/vm/runtime/reflection.cpp | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/hotspot/src/share/vm/runtime/reflection.cpp b/hotspot/src/share/vm/runtime/reflection.cpp
index c6cb79ce7a4..c5bff3c1603 100644
--- a/hotspot/src/share/vm/runtime/reflection.cpp
+++ b/hotspot/src/share/vm/runtime/reflection.cpp
@@ -806,17 +806,16 @@ oop Reflection::new_field(fieldDescriptor* fd, TRAPS) {
 
 oop Reflection::new_parameter(Handle method, int index, Symbol* sym,
                               int flags, TRAPS) {
-  Handle name;
-
-  // A null symbol here translates to the empty string
-  if(NULL != sym) {
-    name = java_lang_String::create_from_symbol(sym, CHECK_NULL);
-  } else {
-    name = java_lang_String::create_from_str("", CHECK_NULL);
-  }
 
   Handle rh = java_lang_reflect_Parameter::create(CHECK_NULL);
-  java_lang_reflect_Parameter::set_name(rh(), name());
+
+  if(NULL != sym) {
+    Handle name = java_lang_String::create_from_symbol(sym, CHECK_NULL);
+    java_lang_reflect_Parameter::set_name(rh(), name());
+  } else {
+    java_lang_reflect_Parameter::set_name(rh(), NULL);
+  }
+
   java_lang_reflect_Parameter::set_modifiers(rh(), flags);
   java_lang_reflect_Parameter::set_executable(rh(), method());
   java_lang_reflect_Parameter::set_index(rh(), index);

From 00aa20db4a29174d4fa530b7d02dbee6a1af705a Mon Sep 17 00:00:00 2001
From: Tobias Hartmann <thartmann@openjdk.org>
Date: Tue, 11 Nov 2014 11:05:41 +0100
Subject: [PATCH 061/299] 8056071:
 compiler/whitebox/IsMethodCompilableTest.java fails with 'method() is not
 compilable after 3 iterations'

Always use MDO if valid and always compile trivial methods with C1 if available.

Reviewed-by: kvn, iveresov
---
 hotspot/src/share/vm/interpreter/bytecodes.hpp |  2 ++
 hotspot/src/share/vm/oops/method.cpp           |  9 +++++++++
 hotspot/src/share/vm/oops/method.hpp           |  3 +++
 hotspot/src/share/vm/oops/methodData.cpp       |  2 +-
 hotspot/src/share/vm/oops/methodData.hpp       |  7 ++++---
 .../vm/runtime/advancedThresholdPolicy.cpp     |  4 ++--
 .../runtime/simpleThresholdPolicy.inline.hpp   | 18 +++++++++++-------
 .../whitebox/IsMethodCompilableTest.java       |  2 +-
 8 files changed, 33 insertions(+), 14 deletions(-)

diff --git a/hotspot/src/share/vm/interpreter/bytecodes.hpp b/hotspot/src/share/vm/interpreter/bytecodes.hpp
index 04a1f564abc..d66ceb46033 100644
--- a/hotspot/src/share/vm/interpreter/bytecodes.hpp
+++ b/hotspot/src/share/vm/interpreter/bytecodes.hpp
@@ -401,8 +401,10 @@ class Bytecodes: AllStatic {
   static bool        is_astore      (Code code)    { return (code == _astore || code == _astore_0 || code == _astore_1
                                                                              || code == _astore_2 || code == _astore_3); }
 
+  static bool        is_const       (Code code)    { return (_aconst_null <= code && code <= _ldc2_w); }
   static bool        is_zero_const  (Code code)    { return (code == _aconst_null || code == _iconst_0
                                                            || code == _fconst_0 || code == _dconst_0); }
+  static bool        is_return      (Code code)    { return (_ireturn <= code && code <= _return); }
   static bool        is_invoke      (Code code)    { return (_invokevirtual <= code && code <= _invokedynamic); }
   static bool        has_receiver   (Code code)    { assert(is_invoke(code), "");  return code == _invokevirtual ||
                                                                                           code == _invokespecial ||
diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp
index e60245ba052..9a248ce3e27 100644
--- a/hotspot/src/share/vm/oops/method.cpp
+++ b/hotspot/src/share/vm/oops/method.cpp
@@ -588,6 +588,15 @@ bool Method::is_accessor() const {
   return true;
 }
 
+bool Method::is_constant_getter() const {
+  int last_index = code_size() - 1;
+  // Check if the first 1-3 bytecodes are a constant push
+  // and the last bytecode is a return.
+  return (2 <= code_size() && code_size() <= 4 &&
+          Bytecodes::is_const(java_code_at(0)) &&
+          Bytecodes::length_for(java_code_at(0)) == last_index &&
+          Bytecodes::is_return(java_code_at(last_index)));
+}
 
 bool Method::is_initializer() const {
   return name() == vmSymbols::object_initializer_name() || is_static_initializer();
diff --git a/hotspot/src/share/vm/oops/method.hpp b/hotspot/src/share/vm/oops/method.hpp
index b2b4d791fc9..8b279341dc8 100644
--- a/hotspot/src/share/vm/oops/method.hpp
+++ b/hotspot/src/share/vm/oops/method.hpp
@@ -595,6 +595,9 @@ class Method : public Metadata {
   // returns true if the method is an accessor function (setter/getter).
   bool is_accessor() const;
 
+  // returns true if the method does nothing but return a constant of primitive type
+  bool is_constant_getter() const;
+
   // returns true if the method is an initializer (<init> or <clinit>).
   bool is_initializer() const;
 
diff --git a/hotspot/src/share/vm/oops/methodData.cpp b/hotspot/src/share/vm/oops/methodData.cpp
index 95fdb621301..b93f3a0b5c8 100644
--- a/hotspot/src/share/vm/oops/methodData.cpp
+++ b/hotspot/src/share/vm/oops/methodData.cpp
@@ -1134,7 +1134,7 @@ void MethodData::init() {
   _tenure_traps = 0;
   _num_loops = 0;
   _num_blocks = 0;
-  _would_profile = true;
+  _would_profile = unknown;
 
 #if INCLUDE_RTM_OPT
   _rtm_state = NoRTM; // No RTM lock eliding by default
diff --git a/hotspot/src/share/vm/oops/methodData.hpp b/hotspot/src/share/vm/oops/methodData.hpp
index cd273f50bad..49768dd001e 100644
--- a/hotspot/src/share/vm/oops/methodData.hpp
+++ b/hotspot/src/share/vm/oops/methodData.hpp
@@ -2096,7 +2096,8 @@ private:
   short             _num_loops;
   short             _num_blocks;
   // Does this method contain anything worth profiling?
-  bool              _would_profile;
+  enum WouldProfile {unknown, no_profile, profile};
+  WouldProfile      _would_profile;
 
   // Size of _data array in bytes.  (Excludes header and extra_data fields.)
   int _data_size;
@@ -2270,8 +2271,8 @@ public:
   }
 #endif
 
-  void set_would_profile(bool p)              { _would_profile = p;    }
-  bool would_profile() const                  { return _would_profile; }
+  void set_would_profile(bool p)              { _would_profile = p ? profile : no_profile; }
+  bool would_profile() const                  { return _would_profile != no_profile; }
 
   int num_loops() const                       { return _num_loops;  }
   void set_num_loops(int n)                   { _num_loops = n;     }
diff --git a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp
index e6ceddba295..bd78c3dec77 100644
--- a/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp
+++ b/hotspot/src/share/vm/runtime/advancedThresholdPolicy.cpp
@@ -317,8 +317,8 @@ void AdvancedThresholdPolicy::create_mdo(methodHandle mh, JavaThread* THREAD) {
  * c. 0 -> (3->2) -> 4.
  *    In this case we enqueue a method for compilation at level 3, but the C1 queue is long enough
  *    to enable the profiling to fully occur at level 0. In this case we change the compilation level
- *    of the method to 2, because it'll allow it to run much faster without full profiling while c2
- *    is compiling.
+ *    of the method to 2 while the request is still in-queue, because it'll allow it to run much faster
+ *    without full profiling while c2 is compiling.
  *
  * d. 0 -> 3 -> 1 or 0 -> 2 -> 1.
  *    After a method was once compiled with C1 it can be identified as trivial and be compiled to
diff --git a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp
index a142fa8abca..ff0a6cf8330 100644
--- a/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp
+++ b/hotspot/src/share/vm/runtime/simpleThresholdPolicy.inline.hpp
@@ -54,13 +54,17 @@ bool SimpleThresholdPolicy::loop_predicate_helper(int i, int b, double scale) {
 // Simple methods are as good being compiled with C1 as C2.
 // Determine if a given method is such a case.
 bool SimpleThresholdPolicy::is_trivial(Method* method) {
-  if (method->is_accessor()) return true;
-  if (method->code() != NULL) {
-    MethodData* mdo = method->method_data();
-    if (mdo != NULL && mdo->num_loops() == 0 &&
-        (method->code_size() < 5  || (mdo->num_blocks() < 4) && (method->code_size() < 15))) {
-      return !mdo->would_profile();
-    }
+  if (method->is_accessor() ||
+      method->is_constant_getter()) {
+    return true;
+  }
+  if (method->has_loops() || method->code_size() >= 15) {
+    return false;
+  }
+  MethodData* mdo = method->method_data();
+  if (mdo != NULL && !mdo->would_profile() &&
+      (method->code_size() < 5  || (mdo->num_blocks() < 4))) {
+    return true;
   }
   return false;
 }
diff --git a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java
index 0e340f9b238..2f301c75520 100644
--- a/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java
+++ b/hotspot/test/compiler/whitebox/IsMethodCompilableTest.java
@@ -29,7 +29,7 @@
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
  * @run main ClassFileInstaller com.oracle.java.testlibrary.Platform
- * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest
+ * @run main/othervm/timeout=2400 -Xbootclasspath/a:. -Xmixed -XX:-TieredCompilation -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:PerMethodRecompilationCutoff=3 -XX:CompileCommand=compileonly,SimpleTestCase$Helper::* IsMethodCompilableTest
  * @summary testing of WB::isMethodCompilable()
  * @author igor.ignatyev@oracle.com
  */

From 21527b2ff25dc83e2c251d1eb37c631697d89cdc Mon Sep 17 00:00:00 2001
From: Aleksey Shipilev <shade@openjdk.org>
Date: Tue, 11 Nov 2014 15:07:09 +0300
Subject: [PATCH 062/299] 8015272: Make @Contended within the same group to use
 the same oop map

Reviewed-by: coleenp, dholmes
---
 .../share/vm/classfile/classFileParser.cpp    | 32 +++++--
 .../runtime/contended/OopMapsSameGroup.java   | 95 +++++++++++++++++++
 2 files changed, 117 insertions(+), 10 deletions(-)
 create mode 100644 hotspot/test/runtime/contended/OopMapsSameGroup.java

diff --git a/hotspot/src/share/vm/classfile/classFileParser.cpp b/hotspot/src/share/vm/classfile/classFileParser.cpp
index da2f897ed0d..40bc6075faf 100644
--- a/hotspot/src/share/vm/classfile/classFileParser.cpp
+++ b/hotspot/src/share/vm/classfile/classFileParser.cpp
@@ -3492,17 +3492,18 @@ void ClassFileParser::layout_fields(Handle class_loader,
           real_offset = next_nonstatic_oop_offset;
           next_nonstatic_oop_offset += heapOopSize;
         }
-        // Update oop maps
+
+        // Record this oop in the oop maps
         if( nonstatic_oop_map_count > 0 &&
             nonstatic_oop_offsets[nonstatic_oop_map_count - 1] ==
             real_offset -
             int(nonstatic_oop_counts[nonstatic_oop_map_count - 1]) *
             heapOopSize ) {
-          // Extend current oop map
+          // This oop is adjacent to the previous one, add to current oop map
           assert(nonstatic_oop_map_count - 1 < max_nonstatic_oop_maps, "range check");
           nonstatic_oop_counts[nonstatic_oop_map_count - 1] += 1;
         } else {
-          // Create new oop map
+          // This oop is not adjacent to the previous one, create new oop map
           assert(nonstatic_oop_map_count < max_nonstatic_oop_maps, "range check");
           nonstatic_oop_offsets[nonstatic_oop_map_count] = real_offset;
           nonstatic_oop_counts [nonstatic_oop_map_count] = 1;
@@ -3624,13 +3625,24 @@ void ClassFileParser::layout_fields(Handle class_loader,
             real_offset = next_nonstatic_padded_offset;
             next_nonstatic_padded_offset += heapOopSize;
 
-            // Create new oop map
-            assert(nonstatic_oop_map_count < max_nonstatic_oop_maps, "range check");
-            nonstatic_oop_offsets[nonstatic_oop_map_count] = real_offset;
-            nonstatic_oop_counts [nonstatic_oop_map_count] = 1;
-            nonstatic_oop_map_count += 1;
-            if( first_nonstatic_oop_offset == 0 ) { // Undefined
-              first_nonstatic_oop_offset = real_offset;
+            // Record this oop in the oop maps
+            if( nonstatic_oop_map_count > 0 &&
+                nonstatic_oop_offsets[nonstatic_oop_map_count - 1] ==
+                real_offset -
+                int(nonstatic_oop_counts[nonstatic_oop_map_count - 1]) *
+                heapOopSize ) {
+              // This oop is adjacent to the previous one, add to current oop map
+              assert(nonstatic_oop_map_count - 1 < max_nonstatic_oop_maps, "range check");
+              nonstatic_oop_counts[nonstatic_oop_map_count - 1] += 1;
+            } else {
+              // This oop is not adjacent to the previous one, create new oop map
+              assert(nonstatic_oop_map_count < max_nonstatic_oop_maps, "range check");
+              nonstatic_oop_offsets[nonstatic_oop_map_count] = real_offset;
+              nonstatic_oop_counts [nonstatic_oop_map_count] = 1;
+              nonstatic_oop_map_count += 1;
+              if( first_nonstatic_oop_offset == 0 ) { // Undefined
+                first_nonstatic_oop_offset = real_offset;
+              }
             }
             break;
 
diff --git a/hotspot/test/runtime/contended/OopMapsSameGroup.java b/hotspot/test/runtime/contended/OopMapsSameGroup.java
new file mode 100644
index 00000000000..4f4bbfee272
--- /dev/null
+++ b/hotspot/test/runtime/contended/OopMapsSameGroup.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2013, 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.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.lang.Class;
+import java.lang.String;
+import java.lang.System;
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.CyclicBarrier;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import sun.misc.Unsafe;
+import sun.misc.Contended;
+
+/*
+ * @test
+ * @bug     8015272
+ * @summary \@Contended within the same group to use the same oop map
+ *
+ * @run main/othervm -XX:-RestrictContended -XX:ContendedPaddingWidth=128 -Xmx128m OopMapsSameGroup
+ */
+public class OopMapsSameGroup {
+
+    public static final int COUNT = 10000;
+
+    public static void main(String[] args) throws Exception {
+        Object o01 = new Object();
+        Object o02 = new Object();
+        Object o03 = new Object();
+        Object o04 = new Object();
+
+        R[] rs = new R[COUNT];
+
+        for (int i = 0; i < COUNT; i++) {
+           R r = new R();
+           r.o01 = o01;
+           r.o02 = o02;
+           r.o03 = o03;
+           r.o04 = o04;
+           rs[i] = r;
+        }
+
+        System.gc();
+
+        for (int i = 0; i < COUNT; i++) {
+           R r = rs[i];
+           if (r.o01 != o01) throw new Error("Test Error: o01");
+           if (r.o02 != o02) throw new Error("Test Error: o02");
+           if (r.o03 != o03) throw new Error("Test Error: o03");
+           if (r.o04 != o04) throw new Error("Test Error: o04");
+        }
+    }
+
+    public static class R {
+        @Contended("group1")
+        Object o01;
+
+        @Contended("group1")
+        Object o02;
+
+        @Contended("group2")
+        Object o03;
+
+        @Contended("group2")
+        Object o04;
+    }
+
+}
+

From fb8f27e2afd505808e5e7ba29f540c3a410098b2 Mon Sep 17 00:00:00 2001
From: Dmitry Samersoff <dsamersoff@openjdk.org>
Date: Tue, 11 Nov 2014 04:34:56 -0800
Subject: [PATCH 063/299] 8059131: sawindbg.dll is not compiled with /SAFESEH

Make variable SAFESEH_FLAG replaced with /SAFESEH link option.

Reviewed-by: mgronlun, sla
---
 hotspot/make/windows/makefiles/sa.make | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hotspot/make/windows/makefiles/sa.make b/hotspot/make/windows/makefiles/sa.make
index 0ecb3278b15..44c39a74fdf 100644
--- a/hotspot/make/windows/makefiles/sa.make
+++ b/hotspot/make/windows/makefiles/sa.make
@@ -122,7 +122,7 @@ SA_LFLAGS = $(SA_LD_FLAGS) -nologo -subsystem:console -machine:$(MACHINE)
 SA_LFLAGS = $(SA_LFLAGS) -map -debug
 !endif
 !if "$(BUILDARCH)" == "i486"
-SA_LFLAGS = $(SAFESEH_FLAG) $(SA_LFLAGS)
+SA_LFLAGS = /SAFESEH $(SA_LFLAGS)
 !endif
 
 SA_CFLAGS = $(SA_CFLAGS) $(MP_FLAG)

From 3e0d07ed5c17c693f2ae85d4b9fe3f877258c352 Mon Sep 17 00:00:00 2001
From: Vladimir Ivanov <vlivanov@openjdk.org>
Date: Tue, 11 Nov 2014 04:46:13 -0800
Subject: [PATCH 064/299] 8060147: SIGSEGV in Metadata::mark_on_stack() while
 marking metadata in ciEnv

Reviewed-by: kvn, roland, coleenp, mgerdin
---
 hotspot/src/share/vm/ci/ciMethod.cpp        |  6 ++-
 hotspot/src/share/vm/ci/ciMethod.hpp        |  2 +-
 hotspot/src/share/vm/ci/ciObjectFactory.cpp | 43 ++++++++++++++-------
 hotspot/src/share/vm/ci/ciObjectFactory.hpp |  2 +-
 4 files changed, 35 insertions(+), 18 deletions(-)

diff --git a/hotspot/src/share/vm/ci/ciMethod.cpp b/hotspot/src/share/vm/ci/ciMethod.cpp
index 27b913ca177..d32df16bcbb 100644
--- a/hotspot/src/share/vm/ci/ciMethod.cpp
+++ b/hotspot/src/share/vm/ci/ciMethod.cpp
@@ -68,7 +68,10 @@
 // ciMethod::ciMethod
 //
 // Loaded method.
-ciMethod::ciMethod(methodHandle h_m) : ciMetadata(h_m()) {
+ciMethod::ciMethod(methodHandle h_m, ciInstanceKlass* holder) :
+  ciMetadata(h_m()),
+  _holder(holder)
+{
   assert(h_m() != NULL, "no null method");
 
   // These fields are always filled in in loaded methods.
@@ -124,7 +127,6 @@ ciMethod::ciMethod(methodHandle h_m) : ciMetadata(h_m()) {
   // generating _signature may allow GC and therefore move m.
   // These fields are always filled in.
   _name = env->get_symbol(h_m()->name());
-  _holder = env->get_instance_klass(h_m()->method_holder());
   ciSymbol* sig_symbol = env->get_symbol(h_m()->signature());
   constantPoolHandle cpool = h_m()->constants();
   _signature = new (env->arena()) ciSignature(_holder, cpool, sig_symbol);
diff --git a/hotspot/src/share/vm/ci/ciMethod.hpp b/hotspot/src/share/vm/ci/ciMethod.hpp
index c1641000f93..5a46fc483c9 100644
--- a/hotspot/src/share/vm/ci/ciMethod.hpp
+++ b/hotspot/src/share/vm/ci/ciMethod.hpp
@@ -91,7 +91,7 @@ class ciMethod : public ciMetadata {
   BCEscapeAnalyzer*   _bcea;
 #endif
 
-  ciMethod(methodHandle h_m);
+  ciMethod(methodHandle h_m, ciInstanceKlass* holder);
   ciMethod(ciInstanceKlass* holder, ciSymbol* name, ciSymbol* signature, ciInstanceKlass* accessor);
 
   Method* get_Method() const {
diff --git a/hotspot/src/share/vm/ci/ciObjectFactory.cpp b/hotspot/src/share/vm/ci/ciObjectFactory.cpp
index aaa607ff135..c7415310a17 100644
--- a/hotspot/src/share/vm/ci/ciObjectFactory.cpp
+++ b/hotspot/src/share/vm/ci/ciObjectFactory.cpp
@@ -239,7 +239,7 @@ void ciObjectFactory::remove_symbols() {
 ciObject* ciObjectFactory::get(oop key) {
   ASSERT_IN_VM;
 
-  assert(key == NULL || Universe::heap()->is_in_reserved(key), "must be");
+  assert(Universe::heap()->is_in_reserved(key), "must be");
 
   NonPermObject* &bucket = find_non_perm(key);
   if (bucket != NULL) {
@@ -260,10 +260,10 @@ ciObject* ciObjectFactory::get(oop key) {
 }
 
 // ------------------------------------------------------------------
-// ciObjectFactory::get
+// ciObjectFactory::get_metadata
 //
-// Get the ciObject corresponding to some oop.  If the ciObject has
-// already been created, it is returned.  Otherwise, a new ciObject
+// Get the ciMetadata corresponding to some Metadata. If the ciMetadata has
+// already been created, it is returned. Otherwise, a new ciMetadata
 // is created.
 ciMetadata* ciObjectFactory::get_metadata(Metadata* key) {
   ASSERT_IN_VM;
@@ -290,9 +290,9 @@ ciMetadata* ciObjectFactory::get_metadata(Metadata* key) {
   }
 #endif
   if (!is_found_at(index, key, _ci_metadata)) {
-    // The ciObject does not yet exist.  Create it and insert it
+    // The ciMetadata does not yet exist. Create it and insert it
     // into the cache.
-    ciMetadata* new_object = create_new_object(key);
+    ciMetadata* new_object = create_new_metadata(key);
     init_ident_of(new_object);
     assert(new_object->is_metadata(), "must be");
 
@@ -344,15 +344,28 @@ ciObject* ciObjectFactory::create_new_object(oop o) {
 }
 
 // ------------------------------------------------------------------
-// ciObjectFactory::create_new_object
+// ciObjectFactory::create_new_metadata
 //
-// Create a new ciObject from a Metadata*.
+// Create a new ciMetadata from a Metadata*.
 //
-// Implementation note: this functionality could be virtual behavior
-// of the oop itself.  For now, we explicitly marshal the object.
-ciMetadata* ciObjectFactory::create_new_object(Metadata* o) {
+// Implementation note: in order to keep Metadata live, an auxiliary ciObject
+// is used, which points to it's holder.
+ciMetadata* ciObjectFactory::create_new_metadata(Metadata* o) {
   EXCEPTION_CONTEXT;
 
+  // Hold metadata from unloading by keeping it's holder alive.
+  if (_initialized && o->is_klass()) {
+    Klass* holder = ((Klass*)o);
+    if (holder->oop_is_instance() && InstanceKlass::cast(holder)->is_anonymous()) {
+      // Though ciInstanceKlass records class loader oop, it's not enough to keep
+      // VM anonymous classes alive (loader == NULL). Klass holder should be used instead.
+      // It is enough to record a ciObject, since cached elements are never removed
+      // during ciObjectFactory lifetime. ciObjectFactory itself is created for
+      // every compilation and lives for the whole duration of the compilation.
+      ciObject* h = get(holder->klass_holder());
+    }
+  }
+
   if (o->is_klass()) {
     KlassHandle h_k(THREAD, (Klass*)o);
     Klass* k = (Klass*)o;
@@ -365,14 +378,16 @@ ciMetadata* ciObjectFactory::create_new_object(Metadata* o) {
     }
   } else if (o->is_method()) {
     methodHandle h_m(THREAD, (Method*)o);
-    return new (arena()) ciMethod(h_m);
+    ciEnv *env = CURRENT_THREAD_ENV;
+    ciInstanceKlass* holder = env->get_instance_klass(h_m()->method_holder());
+    return new (arena()) ciMethod(h_m, holder);
   } else if (o->is_methodData()) {
     // Hold methodHandle alive - might not be necessary ???
     methodHandle h_m(THREAD, ((MethodData*)o)->method());
     return new (arena()) ciMethodData((MethodData*)o);
   }
 
-  // The oop is of some type not supported by the compiler interface.
+  // The Metadata* is of some type not supported by the compiler interface.
   ShouldNotReachHere();
   return NULL;
 }
@@ -701,7 +716,7 @@ static ciObjectFactory::NonPermObject* emptyBucket = NULL;
 // If there is no entry in the cache corresponding to this oop, return
 // the null tail of the bucket into which the oop should be inserted.
 ciObjectFactory::NonPermObject* &ciObjectFactory::find_non_perm(oop key) {
-  assert(Universe::heap()->is_in_reserved_or_null(key), "must be");
+  assert(Universe::heap()->is_in_reserved(key), "must be");
   ciMetadata* klass = get_metadata(key->klass());
   NonPermObject* *bp = &_non_perm_bucket[(unsigned) klass->hash() % NON_PERM_BUCKETS];
   for (NonPermObject* p; (p = (*bp)) != NULL; bp = &p->next()) {
diff --git a/hotspot/src/share/vm/ci/ciObjectFactory.hpp b/hotspot/src/share/vm/ci/ciObjectFactory.hpp
index 6c228e09d40..4cdcc69beac 100644
--- a/hotspot/src/share/vm/ci/ciObjectFactory.hpp
+++ b/hotspot/src/share/vm/ci/ciObjectFactory.hpp
@@ -73,7 +73,7 @@ private:
   void insert(int index, ciMetadata* obj, GrowableArray<ciMetadata*>* objects);
 
   ciObject* create_new_object(oop o);
-  ciMetadata* create_new_object(Metadata* o);
+  ciMetadata* create_new_metadata(Metadata* o);
 
   void ensure_metadata_alive(ciMetadata* m);
 

From d6de9519474f3f6aaa9892d0ee07c3c495e68f0e Mon Sep 17 00:00:00 2001
From: Coleen Phillimore <coleenp@openjdk.org>
Date: Tue, 11 Nov 2014 09:59:50 -0500
Subject: [PATCH 065/299] 8062870: src/share/vm/services/mallocTracker.hpp:64
 assert(_count > 0) failed: Negative counter

Signed bitfield size y can only have (1 << y)-1 values.

Reviewed-by: shade, dholmes, jrose, ctornqvi, gtriantafill
---
 hotspot/src/share/vm/services/mallocTracker.hpp      | 8 ++++----
 hotspot/test/runtime/NMT/MallocSiteHashOverflow.java | 1 -
 hotspot/test/runtime/NMT/MallocTrackingVerify.java   | 1 -
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/hotspot/src/share/vm/services/mallocTracker.hpp b/hotspot/src/share/vm/services/mallocTracker.hpp
index 00f1b0027d5..3c61aa4327a 100644
--- a/hotspot/src/share/vm/services/mallocTracker.hpp
+++ b/hotspot/src/share/vm/services/mallocTracker.hpp
@@ -243,15 +243,15 @@ class MallocHeader VALUE_OBJ_CLASS_SPEC {
   size_t           _flags     : 8;
   size_t           _pos_idx   : 16;
   size_t           _bucket_idx: 40;
-#define MAX_MALLOCSITE_TABLE_SIZE ((size_t)1 << 40)
-#define MAX_BUCKET_LENGTH         ((size_t)(1 << 16))
+#define MAX_MALLOCSITE_TABLE_SIZE right_n_bits(40)
+#define MAX_BUCKET_LENGTH         right_n_bits(16)
 #else
   size_t           _size      : 32;
   size_t           _flags     : 8;
   size_t           _pos_idx   : 8;
   size_t           _bucket_idx: 16;
-#define MAX_MALLOCSITE_TABLE_SIZE  ((size_t)(1 << 16))
-#define MAX_BUCKET_LENGTH          ((size_t)(1 << 8))
+#define MAX_MALLOCSITE_TABLE_SIZE  right_n_bits(16)
+#define MAX_BUCKET_LENGTH          right_n_bits(8)
 #endif  // _LP64
 
  public:
diff --git a/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java b/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java
index 0e3109b52bb..8f3404cbc42 100644
--- a/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java
+++ b/hotspot/test/runtime/NMT/MallocSiteHashOverflow.java
@@ -27,7 +27,6 @@
  * @requires sun.arch.data.model == "32"
  * @key nmt jcmd stress
  * @library /testlibrary /testlibrary/whitebox
- * @ignore 8062870
  * @build MallocSiteHashOverflow
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocSiteHashOverflow
diff --git a/hotspot/test/runtime/NMT/MallocTrackingVerify.java b/hotspot/test/runtime/NMT/MallocTrackingVerify.java
index 3ed900fc0a4..2403a70ab9d 100644
--- a/hotspot/test/runtime/NMT/MallocTrackingVerify.java
+++ b/hotspot/test/runtime/NMT/MallocTrackingVerify.java
@@ -27,7 +27,6 @@
  * @summary Test to verify correctness of malloc tracking
  * @key nmt jcmd
  * @library /testlibrary /testlibrary/whitebox
- * @ignore 8058251
  * @build MallocTrackingVerify
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:NativeMemoryTracking=detail MallocTrackingVerify

From cc2452b769b8d326c560bdfd08a5fbc072c9ea44 Mon Sep 17 00:00:00 2001
From: Serguei Spitsyn <sspitsyn@openjdk.org>
Date: Tue, 11 Nov 2014 21:46:02 -0800
Subject: [PATCH 066/299] 6988950: JDWP exit error JVMTI_ERROR_WRONG_PHASE(112)

Synchronize the jdwp VirtualMachine command functions with the VM_DEATH event

Reviewed-by: dcubed, dsamersoff, dholmes
---
 .../share/native/libjdwp/debugLoop.c          | 35 +++++++------------
 1 file changed, 12 insertions(+), 23 deletions(-)

diff --git a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c
index 388e6ae228b..f49b53c7a69 100644
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/debugLoop.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -45,7 +45,7 @@ struct PacketList {
 
 static volatile struct PacketList *cmdQueue;
 static jrawMonitorID cmdQueueLock;
-static jrawMonitorID resumeLock;
+static jrawMonitorID vmDeathLock;
 static jboolean transportError;
 
 static jboolean
@@ -60,28 +60,17 @@ lastCommand(jdwpCmdPacket *cmd)
     }
 }
 
-static jboolean
-resumeCommand(jdwpCmdPacket *cmd)
-{
-    if ( (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)) &&
-         (cmd->cmd == JDWP_COMMAND(VirtualMachine, Resume)) ) {
-        return JNI_TRUE;
-    } else {
-        return JNI_FALSE;
-    }
-}
-
 void
 debugLoop_initialize(void)
 {
-    resumeLock = debugMonitorCreate("JDWP Resume Lock");
+    vmDeathLock = debugMonitorCreate("JDWP VM_DEATH Lock");
 }
 
 void
 debugLoop_sync(void)
 {
-    debugMonitorEnter(resumeLock);
-    debugMonitorExit(resumeLock);
+    debugMonitorEnter(vmDeathLock);
+    debugMonitorExit(vmDeathLock);
 }
 
 /*
@@ -136,14 +125,14 @@ debugLoop_run(void)
             jboolean replyToSender = JNI_TRUE;
 
             /*
-             * For VirtualMachine.Resume commands we hold the resumeLock
+             * For VirtualMachine commands we hold the vmDeathLock
              * while executing and replying to the command. This ensures
-             * that a Resume after VM_DEATH will be allowed to complete
+             * that a VM command after VM_DEATH will be allowed to complete
              * before the thread posting the VM_DEATH continues VM
              * termination.
              */
-            if (resumeCommand(cmd)) {
-                debugMonitorEnter(resumeLock);
+            if (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)){
+                debugMonitorEnter(vmDeathLock);
             }
 
             /* Initialize the input and output streams */
@@ -181,10 +170,10 @@ debugLoop_run(void)
             }
 
             /*
-             * Release the resumeLock as the reply has been posted.
+             * Release the vmDeathLock as the reply has been posted.
              */
-            if (resumeCommand(cmd)) {
-                debugMonitorExit(resumeLock);
+            if (cmd->cmdSet == JDWP_COMMAND_SET(VirtualMachine)){
+               debugMonitorExit(vmDeathLock);
             }
 
             inStream_destroy(&in);

From afd3405c2f668f752bfaa8e111ac745e3b506220 Mon Sep 17 00:00:00 2001
From: Jiangli Zhou <jiangli@openjdk.org>
Date: Wed, 12 Nov 2014 13:12:35 -0500
Subject: [PATCH 067/299] 8054008: Using -XX:-LazyBootClassLoader crashes with
 ACCESS_VIOLATION on Win 64bit

Only enable the assert for current_stack_pointer after stub routines become available.

Reviewed-by: dholmes, roland, lfoltan
---
 hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
index 5325e0ee807..4686c81cf44 100644
--- a/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
+++ b/hotspot/src/os_cpu/windows_x86/vm/os_windows_x86.cpp
@@ -635,7 +635,11 @@ void os::setup_fpu() {
 #ifndef PRODUCT
 void os::verify_stack_alignment() {
 #ifdef AMD64
-  assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment");
+  // The current_stack_pointer() calls generated get_previous_sp stub routine.
+  // Only enable the assert after the routine becomes available.
+  if (StubRoutines::code1() != NULL) {
+    assert(((intptr_t)os::current_stack_pointer() & (StackAlignmentInBytes-1)) == 0, "incorrect stack alignment");
+  }
 #endif
 }
 #endif

From 4a8e05977e15402904e2b19351ab4c5e8765d5c4 Mon Sep 17 00:00:00 2001
From: Aleksey Shipilev <shade@openjdk.org>
Date: Thu, 13 Nov 2014 01:55:21 +0300
Subject: [PATCH 068/299] 8059677: Thread.getName() instantiates Strings

Reviewed-by: chegar, dholmes, sla, rriggs
---
 .../java.base/share/classes/java/lang/Thread.java    | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/jdk/src/java.base/share/classes/java/lang/Thread.java b/jdk/src/java.base/share/classes/java/lang/Thread.java
index adcc982cf9e..e7477416ecb 100644
--- a/jdk/src/java.base/share/classes/java/lang/Thread.java
+++ b/jdk/src/java.base/share/classes/java/lang/Thread.java
@@ -145,7 +145,7 @@ class Thread implements Runnable {
         registerNatives();
     }
 
-    private volatile char  name[];
+    private volatile String name;
     private int            priority;
     private Thread         threadQ;
     private long           eetop;
@@ -366,7 +366,7 @@ class Thread implements Runnable {
             throw new NullPointerException("name cannot be null");
         }
 
-        this.name = name.toCharArray();
+        this.name = name;
 
         Thread parent = currentThread();
         SecurityManager security = System.getSecurityManager();
@@ -1119,7 +1119,11 @@ class Thread implements Runnable {
      */
     public final synchronized void setName(String name) {
         checkAccess();
-        this.name = name.toCharArray();
+        if (name == null) {
+            throw new NullPointerException("name cannot be null");
+        }
+
+        this.name = name;
         if (threadStatus != 0) {
             setNativeName(name);
         }
@@ -1132,7 +1136,7 @@ class Thread implements Runnable {
      * @see     #setName(String)
      */
     public final String getName() {
-        return new String(name, true);
+        return name;
     }
 
     /**

From f8712e7800e1d611018d05e0a4b6bf402f079f90 Mon Sep 17 00:00:00 2001
From: Aleksey Shipilev <shade@openjdk.org>
Date: Thu, 13 Nov 2014 01:57:09 +0300
Subject: [PATCH 069/299] 8059677: Thread.getName() instantiates Strings

Reviewed-by: coleenp, dholmes, sla
---
 .../classes/sun/jvm/hotspot/oops/OopUtilities.java    |  4 ++--
 hotspot/src/share/vm/classfile/javaClasses.cpp        | 11 ++++-------
 hotspot/src/share/vm/classfile/javaClasses.hpp        |  4 ++--
 hotspot/src/share/vm/prims/jvmtiEnv.cpp               |  6 +++---
 hotspot/src/share/vm/prims/jvmtiTrace.cpp             |  6 +++---
 hotspot/src/share/vm/runtime/thread.cpp               |  8 +++-----
 6 files changed, 17 insertions(+), 22 deletions(-)

diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
index fe93d6238a8..ef8a7e1849e 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/oops/OopUtilities.java
@@ -219,7 +219,7 @@ public class OopUtilities implements /* imports */ JVMTIThreadState {
     if (threadNameField == null) {
       SystemDictionary sysDict = VM.getVM().getSystemDictionary();
       InstanceKlass k = sysDict.getThreadKlass();
-      threadNameField  = (OopField) k.findField("name", "[C");
+      threadNameField  = (OopField) k.findField("name", "Ljava/lang/String;");
       threadGroupField = (OopField) k.findField("group", "Ljava/lang/ThreadGroup;");
       threadEETopField = (LongField) k.findField("eetop", "J");
       threadTIDField = (LongField) k.findField("tid", "J");
@@ -258,7 +258,7 @@ public class OopUtilities implements /* imports */ JVMTIThreadState {
 
   public static String threadOopGetName(Oop threadOop) {
     initThreadFields();
-    return charArrayToString((TypeArray) threadNameField.getValue(threadOop));
+    return stringOopToString(threadNameField.getValue(threadOop));
   }
 
   /** May return null if, e.g., thread was not started */
diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp
index 075dea57d81..754134bdafa 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp
@@ -944,7 +944,7 @@ void java_lang_Thread::compute_offsets() {
   assert(_group_offset == 0, "offsets should be initialized only once");
 
   Klass* k = SystemDictionary::Thread_klass();
-  compute_offset(_name_offset,      k, vmSymbols::name_name(),      vmSymbols::char_array_signature());
+  compute_offset(_name_offset,      k, vmSymbols::name_name(),      vmSymbols::string_signature());
   compute_offset(_group_offset,     k, vmSymbols::group_name(),     vmSymbols::threadgroup_signature());
   compute_offset(_contextClassLoader_offset, k, vmSymbols::contextClassLoader_name(), vmSymbols::classloader_signature());
   compute_offset(_inheritedAccessControlContext_offset, k, vmSymbols::inheritedAccessControlContext_name(), vmSymbols::accesscontrolcontext_signature());
@@ -974,15 +974,12 @@ void java_lang_Thread::set_thread(oop java_thread, JavaThread* thread) {
 }
 
 
-typeArrayOop java_lang_Thread::name(oop java_thread) {
-  oop name = java_thread->obj_field(_name_offset);
-  assert(name == NULL || (name->is_typeArray() && TypeArrayKlass::cast(name->klass())->element_type() == T_CHAR), "just checking");
-  return typeArrayOop(name);
+oop java_lang_Thread::name(oop java_thread) {
+  return java_thread->obj_field(_name_offset);
 }
 
 
-void java_lang_Thread::set_name(oop java_thread, typeArrayOop name) {
-  assert(java_thread->obj_field(_name_offset) == NULL, "name should be NULL");
+void java_lang_Thread::set_name(oop java_thread, oop name) {
   java_thread->obj_field_put(_name_offset, name);
 }
 
diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp
index ef3e8ec78b0..c7890d20720 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp
@@ -345,8 +345,8 @@ class java_lang_Thread : AllStatic {
   // Set JavaThread for instance
   static void set_thread(oop java_thread, JavaThread* thread);
   // Name
-  static typeArrayOop name(oop java_thread);
-  static void set_name(oop java_thread, typeArrayOop name);
+  static oop name(oop java_thread);
+  static void set_name(oop java_thread, oop name);
   // Priority
   static ThreadPriority priority(oop java_thread);
   static void set_priority(oop java_thread, ThreadPriority priority);
diff --git a/hotspot/src/share/vm/prims/jvmtiEnv.cpp b/hotspot/src/share/vm/prims/jvmtiEnv.cpp
index 840fd65cc85..5ddbf130e66 100644
--- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp
+++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp
@@ -942,7 +942,7 @@ JvmtiEnv::GetThreadInfo(jthread thread, jvmtiThreadInfo* info_ptr) {
     return JVMTI_ERROR_INVALID_THREAD;
 
   Handle thread_obj(current_thread, thread_oop);
-  typeArrayHandle    name;
+  Handle name;
   ThreadPriority priority;
   Handle     thread_group;
   Handle context_class_loader;
@@ -950,7 +950,7 @@ JvmtiEnv::GetThreadInfo(jthread thread, jvmtiThreadInfo* info_ptr) {
 
   { MutexLocker mu(Threads_lock);
 
-    name = typeArrayHandle(current_thread, java_lang_Thread::name(thread_obj()));
+    name = Handle(current_thread, java_lang_Thread::name(thread_obj()));
     priority = java_lang_Thread::priority(thread_obj());
     thread_group = Handle(current_thread, java_lang_Thread::threadGroup(thread_obj()));
     is_daemon = java_lang_Thread::is_daemon(thread_obj());
@@ -961,7 +961,7 @@ JvmtiEnv::GetThreadInfo(jthread thread, jvmtiThreadInfo* info_ptr) {
   { const char *n;
 
     if (name() != NULL) {
-      n = UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length());
+      n = java_lang_String::as_utf8_string(name());
     } else {
       n = UNICODE::as_utf8(NULL, 0);
     }
diff --git a/hotspot/src/share/vm/prims/jvmtiTrace.cpp b/hotspot/src/share/vm/prims/jvmtiTrace.cpp
index 279e23ab3c6..1cc63efe074 100644
--- a/hotspot/src/share/vm/prims/jvmtiTrace.cpp
+++ b/hotspot/src/share/vm/prims/jvmtiTrace.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -266,11 +266,11 @@ const char *JvmtiTrace::safe_get_thread_name(Thread *thread) {
   if (threadObj == NULL) {
     return "NULL";
   }
-  typeArrayOop name = java_lang_Thread::name(threadObj);
+  oop name = java_lang_Thread::name(threadObj);
   if (name == NULL) {
     return "<NOT FILLED IN>";
   }
-  return UNICODE::as_utf8((jchar*) name->base(T_CHAR), name->length());
+  return java_lang_String::as_utf8_string(name);
 }
 
 
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index 4e406f9efbe..75e2f1e18ba 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -2872,14 +2872,12 @@ const char* JavaThread::get_thread_name_string(char* buf, int buflen) const {
   const char* name_str;
   oop thread_obj = threadObj();
   if (thread_obj != NULL) {
-    typeArrayOop name = java_lang_Thread::name(thread_obj);
+    oop name = java_lang_Thread::name(thread_obj);
     if (name != NULL) {
       if (buf == NULL) {
-        name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR),
-                                    name->length());
+        name_str = java_lang_String::as_utf8_string(name);
       } else {
-        name_str = UNICODE::as_utf8((jchar*) name->base(T_CHAR),
-                                    name->length(), buf, buflen);
+        name_str = java_lang_String::as_utf8_string(name, buf, buflen);
       }
     } else if (is_attaching_via_jni()) { // workaround for 6412693 - see 6404306
       name_str = "<no-name - thread is attaching>";

From 959631d58da1c852c94eff94a0bf9248c88ab4dd Mon Sep 17 00:00:00 2001
From: David Holmes <dholmes@openjdk.org>
Date: Wed, 12 Nov 2014 19:05:59 -0500
Subject: [PATCH 070/299] 8062307: 'Reference handler' thread triggers assert
 w/ TraceThreadEvents

Removed unused and non-working TraceThreadEvents option

Reviewed-by: coleenp, jiangli
---
 hotspot/src/share/vm/runtime/globals.hpp |  3 --
 hotspot/src/share/vm/runtime/thread.cpp  | 45 ------------------------
 hotspot/src/share/vm/runtime/thread.hpp  |  3 --
 3 files changed, 51 deletions(-)

diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index e74b9bbdf20..c71bd2084f9 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -1335,9 +1335,6 @@ class CommandLineFlags {
   develop(bool, TraceJNIHandleAllocation, false,                            \
           "Trace allocation/deallocation of JNI handle blocks")             \
                                                                             \
-  develop(bool, TraceThreadEvents, false,                                   \
-          "Trace all thread events")                                        \
-                                                                            \
   develop(bool, TraceBytecodes, false,                                      \
           "Trace bytecode execution")                                       \
                                                                             \
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index 4e406f9efbe..25649d8cd65 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -374,42 +374,7 @@ void check_for_dangling_thread_pointer(Thread *thread) {
 }
 #endif
 
-
-#ifndef PRODUCT
-// Tracing method for basic thread operations
-void Thread::trace(const char* msg, const Thread* const thread) {
-  if (!TraceThreadEvents) return;
-  ResourceMark rm;
-  ThreadCritical tc;
-  const char *name = "non-Java thread";
-  int prio = -1;
-  if (thread->is_Java_thread()
-      && !thread->is_Compiler_thread()) {
-    // The Threads_lock must be held to get information about
-    // this thread but may not be in some situations when
-    // tracing  thread events.
-    bool release_Threads_lock = false;
-    if (!Threads_lock->owned_by_self()) {
-      Threads_lock->lock();
-      release_Threads_lock = true;
-    }
-    JavaThread* jt = (JavaThread *)thread;
-    name = (char *)jt->get_thread_name();
-    oop thread_oop = jt->threadObj();
-    if (thread_oop != NULL) {
-      prio = java_lang_Thread::priority(thread_oop);
-    }
-    if (release_Threads_lock) {
-      Threads_lock->unlock();
-    }
-  }
-  tty->print_cr("Thread::%s " INTPTR_FORMAT " [%lx] %s (prio: %d)", msg, thread, thread->osthread()->thread_id(), name, prio);
-}
-#endif
-
-
 ThreadPriority Thread::get_priority(const Thread* const thread) {
-  trace("get priority", thread);
   ThreadPriority priority;
   // Can return an error!
   (void)os::get_priority(thread, priority);
@@ -418,7 +383,6 @@ ThreadPriority Thread::get_priority(const Thread* const thread) {
 }
 
 void Thread::set_priority(Thread* thread, ThreadPriority priority) {
-  trace("set priority", thread);
   debug_only(check_for_dangling_thread_pointer(thread);)
   // Can return an error!
   (void)os::set_priority(thread, priority);
@@ -426,7 +390,6 @@ void Thread::set_priority(Thread* thread, ThreadPriority priority) {
 
 
 void Thread::start(Thread* thread) {
-  trace("start", thread);
   // Start is different from resume in that its safety is guaranteed by context or
   // being called from a Java method synchronized on the Thread object.
   if (!DisableStartThread) {
@@ -769,13 +732,11 @@ bool JavaThread::profile_last_Java_frame(frame* _fr) {
 }
 
 void Thread::interrupt(Thread* thread) {
-  trace("interrupt", thread);
   debug_only(check_for_dangling_thread_pointer(thread);)
   os::interrupt(thread);
 }
 
 bool Thread::is_interrupted(Thread* thread, bool clear_interrupted) {
-  trace("is_interrupted", thread);
   debug_only(check_for_dangling_thread_pointer(thread);)
   // Note:  If clear_interrupted==false, this simply fetches and
   // returns the value of the field osthread()->interrupted().
@@ -1563,9 +1524,6 @@ JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) :
                        _dirty_card_queue(&_dirty_card_queue_set)
 #endif // INCLUDE_ALL_GCS
 {
-  if (TraceThreadEvents) {
-    tty->print_cr("creating thread %p", this);
-  }
   initialize();
   _jni_attach_state = _not_attaching_via_jni;
   set_entry_point(entry_point);
@@ -1588,9 +1546,6 @@ JavaThread::JavaThread(ThreadFunction entry_point, size_t stack_sz) :
 }
 
 JavaThread::~JavaThread() {
-  if (TraceThreadEvents) {
-    tty->print_cr("terminate thread %p", this);
-  }
 
   // JSR166 -- return the parker to the free list
   Parker::Release(_parker);
diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp
index c39b2eff624..67043b9d245 100644
--- a/hotspot/src/share/vm/runtime/thread.hpp
+++ b/hotspot/src/share/vm/runtime/thread.hpp
@@ -212,9 +212,6 @@ class Thread: public ThreadShadow {
   bool is_inside_signal_handler() const { return _num_nested_signal > 0; }
 
  private:
-  // Debug tracing
-  static void trace(const char* msg, const Thread* const thread) PRODUCT_RETURN;
-
   // Active_handles points to a block of handles
   JNIHandleBlock* _active_handles;
 

From 1f7d2d4c0dc454d7830c3fe7c532408227c3d4ec Mon Sep 17 00:00:00 2001
From: Calvin Cheung <ccheung@openjdk.org>
Date: Wed, 12 Nov 2014 16:22:12 -0800
Subject: [PATCH 071/299] 8043491: warning LNK4197: export '... ...' specified
 multiple times; using first specification

No need to use the /export linker option on windows 64-bit platform

Reviewed-by: ctornqvi, minqi
---
 hotspot/make/windows/makefiles/vm.make        | 31 +++++++++++--------
 .../tools/ProjectCreator/BuildConfig.java     |  4 ++-
 .../ProjectCreator/WinGammaPlatformVC10.java  | 22 +++++++------
 3 files changed, 33 insertions(+), 24 deletions(-)

diff --git a/hotspot/make/windows/makefiles/vm.make b/hotspot/make/windows/makefiles/vm.make
index 6145a4aa828..9267a71aac9 100644
--- a/hotspot/make/windows/makefiles/vm.make
+++ b/hotspot/make/windows/makefiles/vm.make
@@ -89,19 +89,24 @@ AGCT_EXPORT=/export:AsyncGetCallTrace
 
 # If you modify exports below please do the corresponding changes in
 # src/share/tools/ProjectCreator/WinGammaPlatformVC7.java
-LD_FLAGS=$(LD_FLAGS) $(STACK_SIZE) /subsystem:windows /dll /base:0x8000000 \
-  /export:JNI_GetDefaultJavaVMInitArgs       \
-  /export:JNI_CreateJavaVM                   \
-  /export:JVM_FindClassFromBootLoader        \
-  /export:JNI_GetCreatedJavaVMs              \
-  /export:jio_snprintf                       \
-  /export:jio_printf                         \
-  /export:jio_fprintf                        \
-  /export:jio_vfprintf                       \
-  /export:jio_vsnprintf                      \
-  $(AGCT_EXPORT)                             \
-  /export:JVM_GetVersionInfo                 \
-  /export:JVM_InitAgentProperties
+!if "$(BUILDARCH)" == "amd64"
+EXPORT_LIST=
+!else
+EXPORT_LIST=/export:JNI_GetDefaultJavaVMInitArgs \
+            /export:JNI_CreateJavaVM             \
+            /export:JVM_FindClassFromBootLoader  \
+            /export:JNI_GetCreatedJavaVMs        \
+            /export:jio_snprintf                 \
+            /export:jio_printf                   \
+            /export:jio_fprintf                  \
+            /export:jio_vfprintf                 \
+            /export:jio_vsnprintf                \
+            $(AGCT_EXPORT)                       \
+            /export:JVM_GetVersionInfo           \
+            /export:JVM_InitAgentProperties
+!endif
+
+LD_FLAGS=$(LD_FLAGS) $(STACK_SIZE) /subsystem:windows /dll /base:0x8000000 $(EXPORT_LIST)
 
 CXX_INCLUDE_DIRS=/I "..\generated"
 
diff --git a/hotspot/src/share/tools/ProjectCreator/BuildConfig.java b/hotspot/src/share/tools/ProjectCreator/BuildConfig.java
index f743cf27e9e..9cd3cc3ee4e 100644
--- a/hotspot/src/share/tools/ProjectCreator/BuildConfig.java
+++ b/hotspot/src/share/tools/ProjectCreator/BuildConfig.java
@@ -512,7 +512,9 @@ abstract class GenericDebugConfig extends BuildConfig {
 abstract class GenericDebugNonKernelConfig extends GenericDebugConfig {
     protected void init(Vector includes, Vector defines) {
         super.init(includes, defines);
-        getCI().getAdditionalNonKernelLinkerFlags(getV("LinkerFlags"));
+        if (get("PlatformName").equals("Win32")) {
+            getCI().getAdditionalNonKernelLinkerFlags(getV("LinkerFlags"));
+        }
    }
 }
 
diff --git a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java
index 543b0ddc88b..0f8af0f6fd5 100644
--- a/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java
+++ b/hotspot/src/share/tools/ProjectCreator/WinGammaPlatformVC10.java
@@ -401,16 +401,18 @@ class CompilerInterfaceVC10 extends CompilerInterface {
     Vector getBaseLinkerFlags(String outDir, String outDll, String platformName) {
         Vector rv = new Vector();
 
-        addAttr(rv, "AdditionalOptions",
-                "/export:JNI_GetDefaultJavaVMInitArgs " +
-                "/export:JNI_CreateJavaVM " +
-                "/export:JVM_FindClassFromBootLoader "+
-                "/export:JNI_GetCreatedJavaVMs "+
-                "/export:jio_snprintf /export:jio_printf "+
-                "/export:jio_fprintf /export:jio_vfprintf "+
-                "/export:jio_vsnprintf "+
-                "/export:JVM_GetVersionInfo "+
-                "/export:JVM_InitAgentProperties");
+        if(platformName.equals("Win32")) {
+            addAttr(rv, "AdditionalOptions",
+                    "/export:JNI_GetDefaultJavaVMInitArgs " +
+                    "/export:JNI_CreateJavaVM " +
+                    "/export:JVM_FindClassFromBootLoader "+
+                    "/export:JNI_GetCreatedJavaVMs "+
+                    "/export:jio_snprintf /export:jio_printf "+
+                    "/export:jio_fprintf /export:jio_vfprintf "+
+                    "/export:jio_vsnprintf "+
+                    "/export:JVM_GetVersionInfo "+
+                    "/export:JVM_InitAgentProperties");
+        }
         addAttr(rv, "AdditionalDependencies", "kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;Wsock32.lib;winmm.lib;psapi.lib;version.lib");
         addAttr(rv, "OutputFile", outDll);
         addAttr(rv, "SuppressStartupBanner", "true");

From f36e847523819ea488b6fcf4a3c76382d62ec49e Mon Sep 17 00:00:00 2001
From: Vladimir Kozlov <kvn@openjdk.org>
Date: Fri, 21 Nov 2014 17:17:41 -0800
Subject: [PATCH 072/299] 8065618: C2 RA incorrectly removes kill projections

Don't remove KILL projections if their "defining" nodes have SCMemProj projection (memory side effects).

Reviewed-by: iveresov
---
 hotspot/src/share/vm/opto/ifg.cpp | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/hotspot/src/share/vm/opto/ifg.cpp b/hotspot/src/share/vm/opto/ifg.cpp
index 91b97f46777..61e13439637 100644
--- a/hotspot/src/share/vm/opto/ifg.cpp
+++ b/hotspot/src/share/vm/opto/ifg.cpp
@@ -527,6 +527,22 @@ bool PhaseChaitin::remove_node_if_not_used(Block* b, uint location, Node* n, uin
   Node* def = n->in(0);
   if (!n->is_Proj() ||
       (_lrg_map.live_range_id(def) && !liveout->member(_lrg_map.live_range_id(def)))) {
+    if (n->is_MachProj()) {
+      // Don't remove KILL projections if their "defining" nodes have
+      // memory effects (have SCMemProj projection node) -
+      // they are not dead even when their result is not used.
+      // For example, compareAndSwapL (and other CAS) and EncodeISOArray nodes.
+      // The method add_input_to_liveout() keeps such nodes alive (put them on liveout list)
+      // when it sees SCMemProj node in a block. Unfortunately SCMemProj node could be placed
+      // in block in such order that KILL MachProj nodes are processed first.
+      uint cnt = def->outcnt();
+      for (uint i = 0; i < cnt; i++) {
+        Node* proj = def->raw_out(i);
+        if (proj->Opcode() == Op_SCMemProj) {
+          return false;
+        }
+      }
+    }
     b->remove_node(location);
     LRG& lrg = lrgs(lid);
     if (lrg._def == n) {

From 9adb455ba855e519714654272017d406aa71d2f9 Mon Sep 17 00:00:00 2001
From: Tobias Hartmann <thartmann@openjdk.org>
Date: Mon, 24 Nov 2014 08:48:15 +0100
Subject: [PATCH 073/299] 8065339: Failed compilation does not always trigger a
 JFR event 'CompilerFailure'

CompilerFailure JFR event should be triggered in ciEnv.

Reviewed-by: kvn
---
 hotspot/src/share/vm/ci/ciEnv.cpp               | 11 +++++++++++
 hotspot/src/share/vm/ci/ciEnv.hpp               |  3 ++-
 hotspot/src/share/vm/compiler/compileBroker.cpp |  1 +
 hotspot/src/share/vm/opto/c2compiler.cpp        |  4 +++-
 hotspot/src/share/vm/opto/compile.cpp           |  8 --------
 5 files changed, 17 insertions(+), 10 deletions(-)

diff --git a/hotspot/src/share/vm/ci/ciEnv.cpp b/hotspot/src/share/vm/ci/ciEnv.cpp
index ec16b8da1ee..5c6e12e5e75 100644
--- a/hotspot/src/share/vm/ci/ciEnv.cpp
+++ b/hotspot/src/share/vm/ci/ciEnv.cpp
@@ -53,6 +53,7 @@
 #include "runtime/reflection.hpp"
 #include "runtime/sharedRuntime.hpp"
 #include "runtime/thread.inline.hpp"
+#include "trace/tracing.hpp"
 #include "utilities/dtrace.hpp"
 #include "utilities/macros.hpp"
 #ifdef COMPILER1
@@ -1141,6 +1142,16 @@ void ciEnv::record_failure(const char* reason) {
   }
 }
 
+void ciEnv::report_failure(const char* reason) {
+  // Create and fire JFR event
+  EventCompilerFailure event;
+  if (event.should_commit()) {
+    event.set_compileID(compile_id());
+    event.set_failure(reason);
+    event.commit();
+  }
+}
+
 // ------------------------------------------------------------------
 // ciEnv::record_method_not_compilable()
 void ciEnv::record_method_not_compilable(const char* reason, bool all_tiers) {
diff --git a/hotspot/src/share/vm/ci/ciEnv.hpp b/hotspot/src/share/vm/ci/ciEnv.hpp
index ced8d895207..29e52c352af 100644
--- a/hotspot/src/share/vm/ci/ciEnv.hpp
+++ b/hotspot/src/share/vm/ci/ciEnv.hpp
@@ -450,7 +450,8 @@ public:
   // Check for changes to the system dictionary during compilation
   bool system_dictionary_modification_counter_changed();
 
-  void record_failure(const char* reason);
+  void record_failure(const char* reason);      // Record failure and report later
+  void report_failure(const char* reason);      // Report failure immediately
   void record_method_not_compilable(const char* reason, bool all_tiers = true);
   void record_out_of_memory_failure();
 
diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp
index 2fa80c675dd..079d0835883 100644
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp
@@ -1985,6 +1985,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) {
 
     if (ci_env.failing()) {
       task->set_failure_reason(ci_env.failure_reason());
+      ci_env.report_failure(ci_env.failure_reason());
       const char* retry_message = ci_env.retry_message();
       if (_compilation_log != NULL) {
         _compilation_log->log_failure(thread, task, ci_env.failure_reason(), retry_message);
diff --git a/hotspot/src/share/vm/opto/c2compiler.cpp b/hotspot/src/share/vm/opto/c2compiler.cpp
index 472ab4a8c22..71e2a0bbbab 100644
--- a/hotspot/src/share/vm/opto/c2compiler.cpp
+++ b/hotspot/src/share/vm/opto/c2compiler.cpp
@@ -102,23 +102,25 @@ void C2Compiler::compile_method(ciEnv* env, ciMethod* target, int entry_bci) {
     // Attempt to compile while subsuming loads into machine instructions.
     Compile C(env, this, target, entry_bci, subsume_loads, do_escape_analysis, eliminate_boxing);
 
-
     // Check result and retry if appropriate.
     if (C.failure_reason() != NULL) {
       if (C.failure_reason_is(retry_no_subsuming_loads())) {
         assert(subsume_loads, "must make progress");
         subsume_loads = false;
+        env->report_failure(C.failure_reason());
         continue;  // retry
       }
       if (C.failure_reason_is(retry_no_escape_analysis())) {
         assert(do_escape_analysis, "must make progress");
         do_escape_analysis = false;
+        env->report_failure(C.failure_reason());
         continue;  // retry
       }
       if (C.has_boxed_value()) {
         // Recompile without boxing elimination regardless failure reason.
         assert(eliminate_boxing, "must make progress");
         eliminate_boxing = false;
+        env->report_failure(C.failure_reason());
         continue;  // retry
       }
       // Pass any other failure reason up to the ciEnv.
diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp
index ec74d5ef4a1..c2943720c60 100644
--- a/hotspot/src/share/vm/opto/compile.cpp
+++ b/hotspot/src/share/vm/opto/compile.cpp
@@ -67,7 +67,6 @@
 #include "runtime/signature.hpp"
 #include "runtime/stubRoutines.hpp"
 #include "runtime/timer.hpp"
-#include "trace/tracing.hpp"
 #include "utilities/copy.hpp"
 
 
@@ -3542,13 +3541,6 @@ void Compile::record_failure(const char* reason) {
     _failure_reason = reason;
   }
 
-  EventCompilerFailure event;
-  if (event.should_commit()) {
-    event.set_compileID(Compile::compile_id());
-    event.set_failure(reason);
-    event.commit();
-  }
-
   if (!C->failure_reason_is(C2Compiler::retry_no_subsuming_loads())) {
     C->print_method(PHASE_FAILURE);
   }

From 5a00d5f6b559850dfd65488e56202586854b65cd Mon Sep 17 00:00:00 2001
From: Vladimir Ivanov <vlivanov@openjdk.org>
Date: Mon, 24 Nov 2014 07:29:03 -0800
Subject: [PATCH 074/299] 8058148: MaxNodeLimit and LiveNodeCountInliningCutoff

Reviewed-by: kvn, roland
---
 hotspot/src/share/vm/ci/ciTypeFlow.cpp      | 3 ++-
 hotspot/src/share/vm/opto/c2_globals.hpp    | 2 +-
 hotspot/src/share/vm/opto/compile.cpp       | 7 +++++--
 hotspot/src/share/vm/opto/compile.hpp       | 6 +++++-
 hotspot/src/share/vm/opto/doCall.cpp        | 5 +++++
 hotspot/src/share/vm/opto/escape.cpp        | 2 +-
 hotspot/src/share/vm/opto/loopTransform.cpp | 9 ++++-----
 hotspot/src/share/vm/opto/loopUnswitch.cpp  | 4 ++--
 hotspot/src/share/vm/opto/loopopts.cpp      | 2 +-
 hotspot/src/share/vm/opto/node.cpp          | 4 ++--
 10 files changed, 28 insertions(+), 16 deletions(-)

diff --git a/hotspot/src/share/vm/ci/ciTypeFlow.cpp b/hotspot/src/share/vm/ci/ciTypeFlow.cpp
index 834f71be5e7..d78eb145624 100644
--- a/hotspot/src/share/vm/ci/ciTypeFlow.cpp
+++ b/hotspot/src/share/vm/ci/ciTypeFlow.cpp
@@ -35,6 +35,7 @@
 #include "interpreter/bytecode.hpp"
 #include "interpreter/bytecodes.hpp"
 #include "memory/allocation.inline.hpp"
+#include "opto/compile.hpp"
 #include "runtime/deoptimization.hpp"
 #include "utilities/growableArray.hpp"
 
@@ -2646,7 +2647,7 @@ void ciTypeFlow::df_flow_types(Block* start,
       assert (!blk->has_pre_order(), "");
       blk->set_next_pre_order();
 
-      if (_next_pre_order >= MaxNodeLimit / 2) {
+      if (_next_pre_order >= (int)Compile::current()->max_node_limit() / 2) {
         // Too many basic blocks.  Bail out.
         // This can happen when try/finally constructs are nested to depth N,
         // and there is O(2**N) cloning of jsr bodies.  See bug 4697245!
diff --git a/hotspot/src/share/vm/opto/c2_globals.hpp b/hotspot/src/share/vm/opto/c2_globals.hpp
index a49f31641dc..b74dbe40bea 100644
--- a/hotspot/src/share/vm/opto/c2_globals.hpp
+++ b/hotspot/src/share/vm/opto/c2_globals.hpp
@@ -647,7 +647,7 @@
   develop(bool, AlwaysIncrementalInline, false,                             \
           "do all inlining incrementally")                                  \
                                                                             \
-  product(intx, LiveNodeCountInliningCutoff, 20000,                         \
+  product(intx, LiveNodeCountInliningCutoff, 40000,                         \
           "max number of live nodes in a method")                           \
                                                                             \
   diagnostic(bool, OptimizeExpensiveOps, true,                              \
diff --git a/hotspot/src/share/vm/opto/compile.cpp b/hotspot/src/share/vm/opto/compile.cpp
index c2943720c60..17ffca9e6ff 100644
--- a/hotspot/src/share/vm/opto/compile.cpp
+++ b/hotspot/src/share/vm/opto/compile.cpp
@@ -661,7 +661,8 @@ Compile::Compile( ciEnv* ci_env, C2Compiler* compiler, ciMethod* target, int osr
                   _print_inlining_stream(NULL),
                   _print_inlining_idx(0),
                   _print_inlining_output(NULL),
-                  _interpreter_frame_size(0) {
+                  _interpreter_frame_size(0),
+                  _max_node_limit(MaxNodeLimit) {
   C = this;
 
   CompileWrapper cw(this);
@@ -974,7 +975,8 @@ Compile::Compile( ciEnv* ci_env,
     _print_inlining_idx(0),
     _print_inlining_output(NULL),
     _allowed_reasons(0),
-    _interpreter_frame_size(0) {
+    _interpreter_frame_size(0),
+    _max_node_limit(MaxNodeLimit) {
   C = this;
 
   TraceTime t1(NULL, &_t_totalCompilation, CITime, false);
@@ -1087,6 +1089,7 @@ void Compile::Init(int aliaslevel) {
   set_do_method_data_update(false);
   set_age_code(has_method() && method()->profile_aging());
   set_rtm_state(NoRTM); // No RTM lock eliding by default
+  method_has_option_value("MaxNodeLimit", _max_node_limit);
 #if INCLUDE_RTM_OPT
   if (UseRTMLocking && has_method() && (method()->method_data_or_null() != NULL)) {
     int rtm_state = method()->method_data()->rtm_state();
diff --git a/hotspot/src/share/vm/opto/compile.hpp b/hotspot/src/share/vm/opto/compile.hpp
index 137ba6b2b9d..c901da09405 100644
--- a/hotspot/src/share/vm/opto/compile.hpp
+++ b/hotspot/src/share/vm/opto/compile.hpp
@@ -289,6 +289,7 @@ class Compile : public Phase {
   int                   _freq_inline_size;      // Max hot method inline size for this compilation
   int                   _fixed_slots;           // count of frame slots not allocated by the register
                                                 // allocator i.e. locks, original deopt pc, etc.
+  uintx                 _max_node_limit;        // Max unique node count during a single compilation.
   // For deopt
   int                   _orig_pc_slot;
   int                   _orig_pc_slot_offset_in_bytes;
@@ -597,6 +598,9 @@ class Compile : public Phase {
   void          set_rtm_state(RTMState s)        { _rtm_state = s; }
   bool              use_rtm() const              { return (_rtm_state & NoRTM) == 0; }
   bool          profile_rtm() const              { return _rtm_state == ProfileRTM; }
+  uint              max_node_limit() const       { return (uint)_max_node_limit; }
+  void          set_max_node_limit(uint n)       { _max_node_limit = n; }
+
   // check the CompilerOracle for special behaviours for this compile
   bool          method_has_option(const char * option) {
     return method() != NULL && method()->has_option(option);
@@ -735,7 +739,7 @@ class Compile : public Phase {
     record_method_not_compilable(reason, true);
   }
   bool check_node_count(uint margin, const char* reason) {
-    if (live_nodes() + margin > (uint)MaxNodeLimit) {
+    if (live_nodes() + margin > max_node_limit()) {
       record_method_not_compilable(reason);
       return true;
     } else {
diff --git a/hotspot/src/share/vm/opto/doCall.cpp b/hotspot/src/share/vm/opto/doCall.cpp
index 9cf6bc4dfe8..7397f9e27cb 100644
--- a/hotspot/src/share/vm/opto/doCall.cpp
+++ b/hotspot/src/share/vm/opto/doCall.cpp
@@ -418,6 +418,11 @@ void Parse::do_call() {
   ciInstanceKlass* klass = ciEnv::get_instance_klass_for_declared_method_holder(holder);
   assert(declared_signature != NULL, "cannot be null");
 
+  // Bump max node limit for JSR292 users
+  if (bc() == Bytecodes::_invokedynamic || orig_callee->is_method_handle_intrinsic()) {
+    C->set_max_node_limit(3*MaxNodeLimit);
+  }
+
   // uncommon-trap when callee is unloaded, uninitialized or will not link
   // bailout when too many arguments for register representation
   if (!will_link || can_not_compile_call_site(orig_callee, klass)) {
diff --git a/hotspot/src/share/vm/opto/escape.cpp b/hotspot/src/share/vm/opto/escape.cpp
index 9f09b62d761..355e02cc896 100644
--- a/hotspot/src/share/vm/opto/escape.cpp
+++ b/hotspot/src/share/vm/opto/escape.cpp
@@ -2417,7 +2417,7 @@ PhiNode *ConnectionGraph::create_split_phi(PhiNode *orig_phi, int alias_idx, Gro
       }
     }
   }
-  if ((int) (C->live_nodes() + 2*NodeLimitFudgeFactor) > MaxNodeLimit) {
+  if (C->live_nodes() + 2*NodeLimitFudgeFactor > C->max_node_limit()) {
     if (C->do_escape_analysis() == true && !C->failing()) {
       // Retry compilation without escape analysis.
       // If this is the first failure, the sentinel string will "stick"
diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp
index 9701cfd2cf2..ad60d2d9ff9 100644
--- a/hotspot/src/share/vm/opto/loopTransform.cpp
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp
@@ -272,10 +272,9 @@ void IdealLoopTree::reassociate_invariants(PhaseIdealLoop *phase) {
 bool IdealLoopTree::policy_peeling( PhaseIdealLoop *phase ) const {
   Node *test = ((IdealLoopTree*)this)->tail();
   int  body_size = ((IdealLoopTree*)this)->_body.size();
-  int  live_node_count = phase->C->live_nodes();
   // Peeling does loop cloning which can result in O(N^2) node construction
   if( body_size > 255 /* Prevent overflow for large body_size */
-      || (body_size * body_size + live_node_count > MaxNodeLimit) ) {
+      || (body_size * body_size + phase->C->live_nodes()) > phase->C->max_node_limit() ) {
     return false;           // too large to safely clone
   }
   while( test != _head ) {      // Scan till run off top of loop
@@ -604,7 +603,7 @@ bool IdealLoopTree::policy_maximally_unroll( PhaseIdealLoop *phase ) const {
     return false;
   if (new_body_size > unroll_limit ||
       // Unrolling can result in a large amount of node construction
-      new_body_size >= MaxNodeLimit - (uint) phase->C->live_nodes()) {
+      new_body_size >= phase->C->max_node_limit() - phase->C->live_nodes()) {
     return false;
   }
 
@@ -2281,8 +2280,8 @@ bool IdealLoopTree::iteration_split_impl( PhaseIdealLoop *phase, Node_List &old_
 
   // Skip next optimizations if running low on nodes. Note that
   // policy_unswitching and policy_maximally_unroll have this check.
-  uint nodes_left = MaxNodeLimit - (uint) phase->C->live_nodes();
-  if ((2 * _body.size()) > nodes_left) {
+  int nodes_left = phase->C->max_node_limit() - phase->C->live_nodes();
+  if ((int)(2 * _body.size()) > nodes_left) {
     return true;
   }
 
diff --git a/hotspot/src/share/vm/opto/loopUnswitch.cpp b/hotspot/src/share/vm/opto/loopUnswitch.cpp
index 43f2008f2aa..dab8fd387a8 100644
--- a/hotspot/src/share/vm/opto/loopUnswitch.cpp
+++ b/hotspot/src/share/vm/opto/loopUnswitch.cpp
@@ -61,8 +61,8 @@ bool IdealLoopTree::policy_unswitching( PhaseIdealLoop *phase ) const {
   if (!_head->is_Loop()) {
     return false;
   }
-  uint nodes_left = MaxNodeLimit - phase->C->live_nodes();
-  if (2 * _body.size() > nodes_left) {
+  int nodes_left = phase->C->max_node_limit() - phase->C->live_nodes();
+  if ((int)(2 * _body.size()) > nodes_left) {
     return false; // Too speculative if running low on nodes.
   }
   LoopNode* head = _head->as_Loop();
diff --git a/hotspot/src/share/vm/opto/loopopts.cpp b/hotspot/src/share/vm/opto/loopopts.cpp
index 20ad4ff1f6d..bfa483c0181 100644
--- a/hotspot/src/share/vm/opto/loopopts.cpp
+++ b/hotspot/src/share/vm/opto/loopopts.cpp
@@ -736,7 +736,7 @@ static bool merge_point_too_heavy(Compile* C, Node* region) {
   for (DUIterator_Fast imax, i = region->fast_outs(imax); i < imax; i++) {
     weight += region->fast_out(i)->outcnt();
   }
-  int nodes_left = MaxNodeLimit - C->live_nodes();
+  int nodes_left = C->max_node_limit() - C->live_nodes();
   if (weight * 8 > nodes_left) {
 #ifndef PRODUCT
     if (PrintOpto)
diff --git a/hotspot/src/share/vm/opto/node.cpp b/hotspot/src/share/vm/opto/node.cpp
index c7cd9cd5c37..29cd82e4acc 100644
--- a/hotspot/src/share/vm/opto/node.cpp
+++ b/hotspot/src/share/vm/opto/node.cpp
@@ -69,7 +69,7 @@ void Node::verify_construction() {
   Compile::set_debug_idx(new_debug_idx);
   set_debug_idx( new_debug_idx );
   assert(Compile::current()->unique() < (INT_MAX - 1), "Node limit exceeded INT_MAX");
-  assert(Compile::current()->live_nodes() < (uint)MaxNodeLimit, "Live Node limit exceeded limit");
+  assert(Compile::current()->live_nodes() < Compile::current()->max_node_limit(), "Live Node limit exceeded limit");
   if (BreakAtNode != 0 && (_debug_idx == BreakAtNode || (int)_idx == BreakAtNode)) {
     tty->print_cr("BreakAtNode: _idx=%d _debug_idx=%d", _idx, _debug_idx);
     BREAKPOINT;
@@ -313,7 +313,7 @@ inline int Node::Init(int req) {
 Node::Node(uint req)
   : _idx(Init(req))
 {
-  assert( req < (uint)(MaxNodeLimit - NodeLimitFudgeFactor), "Input limit exceeded" );
+  assert( req < Compile::current()->max_node_limit() - NodeLimitFudgeFactor, "Input limit exceeded" );
   debug_only( verify_construction() );
   NOT_PRODUCT(nodes_created++);
   if (req == 0) {

From 4bc2edad15cfc23acba8cffe0601e7c3915c6b31 Mon Sep 17 00:00:00 2001
From: Roland Westrelin <roland@openjdk.org>
Date: Thu, 13 Nov 2014 09:19:46 +0100
Subject: [PATCH 075/299] 8054478: C2: Incorrectly compiled char[] array access
 crashes JVM

Dead backbranch in main loop results in erroneous array access

Reviewed-by: kvn, iveresov
---
 hotspot/src/share/vm/opto/castnode.cpp        | 95 +++++++++++++++++++
 hotspot/src/share/vm/opto/castnode.hpp        | 17 +++-
 hotspot/src/share/vm/opto/loopTransform.cpp   | 33 +++++++
 hotspot/src/share/vm/opto/loopnode.hpp        |  2 +
 hotspot/src/share/vm/opto/phaseX.cpp          | 39 +++++++-
 hotspot/src/share/vm/opto/subnode.cpp         |  2 -
 hotspot/src/share/vm/opto/subnode.hpp         |  2 -
 .../TestDeadBackbranchArrayAccess.java        | 58 +++++++++++
 8 files changed, 238 insertions(+), 10 deletions(-)
 create mode 100644 hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java

diff --git a/hotspot/src/share/vm/opto/castnode.cpp b/hotspot/src/share/vm/opto/castnode.cpp
index afaddaf72fb..3f3c5cab2ed 100644
--- a/hotspot/src/share/vm/opto/castnode.cpp
+++ b/hotspot/src/share/vm/opto/castnode.cpp
@@ -83,6 +83,101 @@ Node *ConstraintCastNode::Ideal_DU_postCCP( PhaseCCP *ccp ) {
   return this;
 }
 
+uint CastIINode::size_of() const {
+  return sizeof(*this);
+}
+
+uint CastIINode::cmp(const Node &n) const {
+  return TypeNode::cmp(n) && ((CastIINode&)n)._carry_dependency == _carry_dependency;
+}
+
+Node *CastIINode::Identity(PhaseTransform *phase) {
+  if (_carry_dependency) {
+    return this;
+  }
+  return ConstraintCastNode::Identity(phase);
+}
+
+const Type *CastIINode::Value(PhaseTransform *phase) const {
+  const Type *res = ConstraintCastNode::Value(phase);
+
+  // Try to improve the type of the CastII if we recognize a CmpI/If
+  // pattern.
+  if (_carry_dependency) {
+    if (in(0) != NULL && (in(0)->is_IfFalse() || in(0)->is_IfTrue())) {
+      Node* proj = in(0);
+      if (proj->in(0)->in(1)->is_Bool()) {
+        Node* b = proj->in(0)->in(1);
+        if (b->in(1)->Opcode() == Op_CmpI) {
+          Node* cmp = b->in(1);
+          if (cmp->in(1) == in(1) && phase->type(cmp->in(2))->isa_int()) {
+            const TypeInt* in2_t = phase->type(cmp->in(2))->is_int();
+            const Type* t = TypeInt::INT;
+            BoolTest test = b->as_Bool()->_test;
+            if (proj->is_IfFalse()) {
+              test = test.negate();
+            }
+            BoolTest::mask m = test._test;
+            jlong lo_long = min_jint;
+            jlong hi_long = max_jint;
+            if (m == BoolTest::le || m == BoolTest::lt) {
+              hi_long = in2_t->_hi;
+              if (m == BoolTest::lt) {
+                hi_long -= 1;
+              }
+            } else if (m == BoolTest::ge || m == BoolTest::gt) {
+              lo_long = in2_t->_lo;
+              if (m == BoolTest::gt) {
+                lo_long += 1;
+              }
+            } else if (m == BoolTest::eq) {
+              lo_long = in2_t->_lo;
+              hi_long = in2_t->_hi;
+            } else if (m == BoolTest::ne) {
+              // can't do any better
+            } else {
+              stringStream ss;
+              test.dump_on(&ss);
+              fatal(err_msg_res("unexpected comparison %s", ss.as_string()));
+            }
+            int lo_int = (int)lo_long;
+            int hi_int = (int)hi_long;
+
+            if (lo_long != (jlong)lo_int) {
+              lo_int = min_jint;
+            }
+            if (hi_long != (jlong)hi_int) {
+              hi_int = max_jint;
+            }
+
+            t = TypeInt::make(lo_int, hi_int, Type::WidenMax);
+
+            res = res->filter_speculative(t);
+
+            return res;
+          }
+        }
+      }
+    }
+  }
+  return res;
+}
+
+Node *CastIINode::Ideal_DU_postCCP(PhaseCCP *ccp) {
+  if (_carry_dependency) {
+    return NULL;
+  }
+  return ConstraintCastNode::Ideal_DU_postCCP(ccp);
+}
+
+#ifndef PRODUCT
+void CastIINode::dump_spec(outputStream *st) const {
+  TypeNode::dump_spec(st);
+  if (_carry_dependency) {
+    st->print(" carry dependency");
+  }
+}
+#endif
 
 //=============================================================================
 
diff --git a/hotspot/src/share/vm/opto/castnode.hpp b/hotspot/src/share/vm/opto/castnode.hpp
index d0f97c9b249..8b79562b045 100644
--- a/hotspot/src/share/vm/opto/castnode.hpp
+++ b/hotspot/src/share/vm/opto/castnode.hpp
@@ -48,10 +48,25 @@ class ConstraintCastNode: public TypeNode {
 //------------------------------CastIINode-------------------------------------
 // cast integer to integer (different range)
 class CastIINode: public ConstraintCastNode {
+  private:
+  // Can this node be removed post CCP or does it carry a required dependency?
+  const bool _carry_dependency;
+
+  protected:
+  virtual uint cmp( const Node &n ) const;
+  virtual uint size_of() const;
+
   public:
-  CastIINode (Node *n, const Type *t ): ConstraintCastNode(n,t) {}
+  CastIINode(Node *n, const Type *t, bool carry_dependency = false)
+    : ConstraintCastNode(n,t), _carry_dependency(carry_dependency) {}
   virtual int Opcode() const;
   virtual uint ideal_reg() const { return Op_RegI; }
+  virtual Node *Identity( PhaseTransform *phase );
+  virtual const Type *Value( PhaseTransform *phase ) const;
+  virtual Node *Ideal_DU_postCCP( PhaseCCP * );
+#ifndef PRODUCT
+  virtual void dump_spec(outputStream *st) const;
+#endif
 };
 
 //------------------------------CastPPNode-------------------------------------
diff --git a/hotspot/src/share/vm/opto/loopTransform.cpp b/hotspot/src/share/vm/opto/loopTransform.cpp
index ad60d2d9ff9..b917ee113c0 100644
--- a/hotspot/src/share/vm/opto/loopTransform.cpp
+++ b/hotspot/src/share/vm/opto/loopTransform.cpp
@@ -27,6 +27,7 @@
 #include "memory/allocation.inline.hpp"
 #include "opto/addnode.hpp"
 #include "opto/callnode.hpp"
+#include "opto/castnode.hpp"
 #include "opto/connode.hpp"
 #include "opto/convertnode.hpp"
 #include "opto/divnode.hpp"
@@ -884,6 +885,20 @@ Node *PhaseIdealLoop::clone_up_backedge_goo( Node *back_ctrl, Node *preheader_ct
   return n;
 }
 
+bool PhaseIdealLoop::cast_incr_before_loop(Node* incr, Node* ctrl, Node* loop) {
+  Node* castii = new CastIINode(incr, TypeInt::INT, true);
+  castii->set_req(0, ctrl);
+  register_new_node(castii, ctrl);
+  for (DUIterator_Fast imax, i = incr->fast_outs(imax); i < imax; i++) {
+    Node* n = incr->fast_out(i);
+    if (n->is_Phi() && n->in(0) == loop) {
+      int nrep = n->replace_edge(incr, castii);
+      return true;
+    }
+  }
+  return false;
+}
+
 //------------------------------insert_pre_post_loops--------------------------
 // Insert pre and post loops.  If peel_only is set, the pre-loop can not have
 // more iterations added.  It acts as a 'peel' only, no lower-bound RCE, no
@@ -1080,6 +1095,24 @@ void PhaseIdealLoop::insert_pre_post_loops( IdealLoopTree *loop, Node_List &old_
     }
   }
 
+  // Nodes inside the loop may be control dependent on a predicate
+  // that was moved before the preloop. If the back branch of the main
+  // or post loops becomes dead, those nodes won't be dependent on the
+  // test that guards that loop nest anymore which could lead to an
+  // incorrect array access because it executes independently of the
+  // test that was guarding the loop nest. We add a special CastII on
+  // the if branch that enters the loop, between the input induction
+  // variable value and the induction variable Phi to preserve correct
+  // dependencies.
+
+  // CastII for the post loop:
+  bool inserted = cast_incr_before_loop(zer_opaq->in(1), zer_taken, post_head);
+  assert(inserted, "no castII inserted");
+
+  // CastII for the main loop:
+  inserted = cast_incr_before_loop(pre_incr, min_taken, main_head);
+  assert(inserted, "no castII inserted");
+
   // Step B4: Shorten the pre-loop to run only 1 iteration (for now).
   // RCE and alignment may change this later.
   Node *cmp_end = pre_end->cmp_node();
diff --git a/hotspot/src/share/vm/opto/loopnode.hpp b/hotspot/src/share/vm/opto/loopnode.hpp
index 5c962ae9981..c884dd38b96 100644
--- a/hotspot/src/share/vm/opto/loopnode.hpp
+++ b/hotspot/src/share/vm/opto/loopnode.hpp
@@ -602,6 +602,8 @@ class PhaseIdealLoop : public PhaseTransform {
     return ctrl;
   }
 
+  bool cast_incr_before_loop(Node* incr, Node* ctrl, Node* loop);
+
 public:
   bool has_node( Node* n ) const {
     guarantee(n != NULL, "No Node.");
diff --git a/hotspot/src/share/vm/opto/phaseX.cpp b/hotspot/src/share/vm/opto/phaseX.cpp
index 2b0688a90b8..3f5373b7a89 100644
--- a/hotspot/src/share/vm/opto/phaseX.cpp
+++ b/hotspot/src/share/vm/opto/phaseX.cpp
@@ -1392,15 +1392,27 @@ void PhaseIterGVN::add_users_to_worklist( Node *n ) {
       }
     }
 
-    if( use->is_Cmp() ) {       // Enable CMP/BOOL optimization
+    uint use_op = use->Opcode();
+    if(use->is_Cmp()) {       // Enable CMP/BOOL optimization
       add_users_to_worklist(use); // Put Bool on worklist
-      // Look for the 'is_x2logic' pattern: "x ? : 0 : 1" and put the
-      // phi merging either 0 or 1 onto the worklist
       if (use->outcnt() > 0) {
         Node* bol = use->raw_out(0);
         if (bol->outcnt() > 0) {
           Node* iff = bol->raw_out(0);
-          if (iff->outcnt() == 2) {
+          if (use_op == Op_CmpI &&
+              iff->is_CountedLoopEnd()) {
+            CountedLoopEndNode* cle = iff->as_CountedLoopEnd();
+            if (cle->limit() == n && cle->phi() != NULL) {
+              // If an opaque node feeds into the limit condition of a
+              // CountedLoop, we need to process the Phi node for the
+              // induction variable when the opaque node is removed:
+              // the range of values taken by the Phi is now known and
+              // so its type is also known.
+              _worklist.push(cle->phi());
+            }
+          } else if (iff->outcnt() == 2) {
+            // Look for the 'is_x2logic' pattern: "x ? : 0 : 1" and put the
+            // phi merging either 0 or 1 onto the worklist
             Node* ifproj0 = iff->raw_out(0);
             Node* ifproj1 = iff->raw_out(1);
             if (ifproj0->outcnt() > 0 && ifproj1->outcnt() > 0) {
@@ -1412,9 +1424,26 @@ void PhaseIterGVN::add_users_to_worklist( Node *n ) {
           }
         }
       }
+      if (use_op == Op_CmpI) {
+        Node* in1 = use->in(1);
+        for (uint i = 0; i < in1->outcnt(); i++) {
+          if (in1->raw_out(i)->Opcode() == Op_CastII) {
+            Node* castii = in1->raw_out(i);
+            if (castii->in(0) != NULL && castii->in(0)->in(0) != NULL && castii->in(0)->in(0)->is_If()) {
+              Node* ifnode = castii->in(0)->in(0);
+              if (ifnode->in(1) != NULL && ifnode->in(1)->in(1) == use) {
+                // Reprocess a CastII node that may depend on an
+                // opaque node value when the opaque node is
+                // removed. In case it carries a dependency we can do
+                // a better job of computing its type.
+                _worklist.push(castii);
+              }
+            }
+          }
+        }
+      }
     }
 
-    uint use_op = use->Opcode();
     // If changed Cast input, check Phi users for simple cycles
     if( use->is_ConstraintCast() || use->is_CheckCastPP() ) {
       for (DUIterator_Fast i2max, i2 = use->fast_outs(i2max); i2 < i2max; i2++) {
diff --git a/hotspot/src/share/vm/opto/subnode.cpp b/hotspot/src/share/vm/opto/subnode.cpp
index 1fe558c18d3..27cf544da11 100644
--- a/hotspot/src/share/vm/opto/subnode.cpp
+++ b/hotspot/src/share/vm/opto/subnode.cpp
@@ -1147,12 +1147,10 @@ const Type *BoolTest::cc2logical( const Type *CC ) const {
 
 //------------------------------dump_spec-------------------------------------
 // Print special per-node info
-#ifndef PRODUCT
 void BoolTest::dump_on(outputStream *st) const {
   const char *msg[] = {"eq","gt","of","lt","ne","le","nof","ge"};
   st->print("%s", msg[_test]);
 }
-#endif
 
 //=============================================================================
 uint BoolNode::hash() const { return (Node::hash() << 3)|(_test._test+1); }
diff --git a/hotspot/src/share/vm/opto/subnode.hpp b/hotspot/src/share/vm/opto/subnode.hpp
index f809a3b90c7..4cc3dd700b5 100644
--- a/hotspot/src/share/vm/opto/subnode.hpp
+++ b/hotspot/src/share/vm/opto/subnode.hpp
@@ -275,9 +275,7 @@ struct BoolTest VALUE_OBJ_CLASS_SPEC {
   mask commute( ) const { return mask("032147658"[_test]-'0'); }
   mask negate( ) const { return mask(_test^4); }
   bool is_canonical( ) const { return (_test == BoolTest::ne || _test == BoolTest::lt || _test == BoolTest::le || _test == BoolTest::overflow); }
-#ifndef PRODUCT
   void dump_on(outputStream *st) const;
-#endif
 };
 
 //------------------------------BoolNode---------------------------------------
diff --git a/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java b/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java
new file mode 100644
index 00000000000..f2782383f71
--- /dev/null
+++ b/hotspot/test/compiler/loopopts/TestDeadBackbranchArrayAccess.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, 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 8054478
+ * @summary dead backbranch in main loop results in erroneous array access
+ * @run main/othervm -XX:CompileOnly=TestDeadBackbranchArrayAccess -Xcomp TestDeadBackbranchArrayAccess
+ *
+ */
+
+public class TestDeadBackbranchArrayAccess {
+    static char[] pattern0 = {0};
+    static char[] pattern1 = {1};
+
+    static void test(char[] array) {
+        if (pattern1 == null) return;
+
+        int i = 0;
+        int pos = 0;
+        char c = array[pos];
+
+        while (i >= 0 && (c == pattern0[i] || c == pattern1[i])) {
+            i--;
+            pos--;
+            if (pos != -1) {
+                c = array[pos];
+            }
+        }
+    }
+
+    public static void main(String[] args) {
+        for (int i = 0; i < 1000000; i++) {
+            test(new char[1]);
+        }
+    }
+}

From d8d026811c973db15eec4aedbca7492f724f7943 Mon Sep 17 00:00:00 2001
From: Alexander Scherbatiy <alexsch@openjdk.org>
Date: Thu, 13 Nov 2014 12:00:39 +0300
Subject: [PATCH 076/299] 8064468: ownedWindowList access requires
 synchronization in Window.setAlwaysOnTop() method

Reviewed-by: serb, pchelko
---
 .../share/classes/java/awt/Window.java        | 13 +++-
 .../AlwaysOnTop/SyncAlwaysOnTopFieldTest.java | 62 +++++++++++++++++++
 2 files changed, 74 insertions(+), 1 deletion(-)
 create mode 100644 jdk/test/java/awt/Window/AlwaysOnTop/SyncAlwaysOnTopFieldTest.java

diff --git a/jdk/src/java.desktop/share/classes/java/awt/Window.java b/jdk/src/java.desktop/share/classes/java/awt/Window.java
index 4417314634c..b5a466cb7f3 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/Window.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/Window.java
@@ -2254,7 +2254,18 @@ public class Window extends Container implements Accessible {
             }
             firePropertyChange("alwaysOnTop", oldAlwaysOnTop, alwaysOnTop);
         }
-        for (WeakReference<Window> ref : ownedWindowList) {
+        setOwnedWindowsAlwaysOnTop(alwaysOnTop);
+    }
+
+    @SuppressWarnings({"rawtypes", "unchecked"})
+    private void setOwnedWindowsAlwaysOnTop(boolean alwaysOnTop) {
+        WeakReference<Window>[] ownedWindowArray;
+        synchronized (ownedWindowList) {
+            ownedWindowArray = new WeakReference[ownedWindowList.size()];
+            ownedWindowList.copyInto(ownedWindowArray);
+        }
+
+        for (WeakReference<Window> ref : ownedWindowArray) {
             Window window = ref.get();
             if (window != null) {
                 try {
diff --git a/jdk/test/java/awt/Window/AlwaysOnTop/SyncAlwaysOnTopFieldTest.java b/jdk/test/java/awt/Window/AlwaysOnTop/SyncAlwaysOnTopFieldTest.java
new file mode 100644
index 00000000000..ed76fa8e0a2
--- /dev/null
+++ b/jdk/test/java/awt/Window/AlwaysOnTop/SyncAlwaysOnTopFieldTest.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, 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.Window;
+
+/**
+ * @test
+ * @bug 8064468
+ * @author Alexander Scherbatiy
+ * @summary ownedWindowList access requires synchronization in
+ *     Window.setAlwaysOnTop() method
+ * @run main SyncAlwaysOnTopFieldTest
+ */
+public class SyncAlwaysOnTopFieldTest {
+
+    private static final int WINDOWS_COUNT = 200;
+    private static final int STEPS_COUNT = 20;
+
+    public static void main(String[] args) throws Exception {
+        final Window rootWindow = createWindow(null);
+
+        new Thread(() -> {
+            for (int i = 0; i < WINDOWS_COUNT; i++) {
+                createWindow(rootWindow);
+            }
+        }).start();
+
+        boolean alwaysOnTop = true;
+        for (int i = 0; i < STEPS_COUNT; i++) {
+            Thread.sleep(10);
+            rootWindow.setAlwaysOnTop(alwaysOnTop);
+            alwaysOnTop = !alwaysOnTop;
+        }
+    }
+
+    private static Window createWindow(Window parent) {
+        Window window = new Window(parent);
+        window.setSize(200, 200);
+        window.setVisible(true);
+        return window;
+    }
+}
\ No newline at end of file

From bc52e8443ead19ed758a12a758673f9922a57eeb Mon Sep 17 00:00:00 2001
From: Nils Eliasson <neliasso@openjdk.org>
Date: Thu, 13 Nov 2014 14:42:54 +0100
Subject: [PATCH 077/299] 8061256:
 com/sun/management/DiagnosticCommandMBean/DcmdMBeanPermissionsTest.java timed
 out

Must not be at safepoint when taking CompileQueue_lock

Reviewed-by: kvn, anoll
---
 .../src/share/vm/compiler/compileBroker.cpp   | 28 +++++++++----------
 .../src/share/vm/compiler/compileBroker.hpp   |  5 +---
 .../src/share/vm/runtime/vm_operations.hpp    |  1 +
 3 files changed, 16 insertions(+), 18 deletions(-)

diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp
index 0ab0dae2dd6..2fa80c675dd 100644
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp
@@ -594,7 +594,7 @@ void CompileTask::log_task_done(CompileLog* log) {
  * Add a CompileTask to a CompileQueue.
  */
 void CompileQueue::add(CompileTask* task) {
-  assert(lock()->owned_by_self(), "must own lock");
+  assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
 
   task->set_next(NULL);
   task->set_prev(NULL);
@@ -625,7 +625,7 @@ void CompileQueue::add(CompileTask* task) {
   }
 
   // Notify CompilerThreads that a task is available.
-  lock()->notify_all();
+  MethodCompileQueue_lock->notify_all();
 }
 
 /**
@@ -635,7 +635,7 @@ void CompileQueue::add(CompileTask* task) {
  * compilation is disabled.
  */
 void CompileQueue::free_all() {
-  MutexLocker mu(lock());
+  MutexLocker mu(MethodCompileQueue_lock);
   CompileTask* next = _first;
 
   // Iterate over all tasks in the compile queue
@@ -653,14 +653,14 @@ void CompileQueue::free_all() {
   _first = NULL;
 
   // Wake up all threads that block on the queue.
-  lock()->notify_all();
+  MethodCompileQueue_lock->notify_all();
 }
 
 /**
  * Get the next CompileTask from a CompileQueue
  */
 CompileTask* CompileQueue::get() {
-  MutexLocker locker(lock());
+  MutexLocker locker(MethodCompileQueue_lock);
   // If _first is NULL we have no more compile jobs. There are two reasons for
   // having no compile jobs: First, we compiled everything we wanted. Second,
   // we ran out of code cache so compilation has been disabled. In the latter
@@ -681,7 +681,7 @@ CompileTask* CompileQueue::get() {
     // We need a timed wait here, since compiler threads can exit if compilation
     // is disabled forever. We use 5 seconds wait time; the exiting of compiler threads
     // is not critical and we do not want idle compiler threads to wake up too often.
-    lock()->wait(!Mutex::_no_safepoint_check_flag, 5*1000);
+    MethodCompileQueue_lock->wait(!Mutex::_no_safepoint_check_flag, 5*1000);
   }
 
   if (CompileBroker::is_compilation_disabled_forever()) {
@@ -701,7 +701,7 @@ CompileTask* CompileQueue::get() {
 // Clean & deallocate stale compile tasks.
 // Temporarily releases MethodCompileQueue lock.
 void CompileQueue::purge_stale_tasks() {
-  assert(lock()->owned_by_self(), "must own lock");
+  assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
   if (_first_stale != NULL) {
     // Stale tasks are purged when MCQ lock is released,
     // but _first_stale updates are protected by MCQ lock.
@@ -710,7 +710,7 @@ void CompileQueue::purge_stale_tasks() {
     CompileTask* head = _first_stale;
     _first_stale = NULL;
     {
-      MutexUnlocker ul(lock());
+      MutexUnlocker ul(MethodCompileQueue_lock);
       for (CompileTask* task = head; task != NULL; ) {
         CompileTask* next_task = task->next();
         CompileTaskWrapper ctw(task); // Frees the task
@@ -722,7 +722,7 @@ void CompileQueue::purge_stale_tasks() {
 }
 
 void CompileQueue::remove(CompileTask* task) {
-   assert(lock()->owned_by_self(), "must own lock");
+   assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
   if (task->prev() != NULL) {
     task->prev()->set_next(task->next());
   } else {
@@ -742,7 +742,7 @@ void CompileQueue::remove(CompileTask* task) {
 }
 
 void CompileQueue::remove_and_mark_stale(CompileTask* task) {
-  assert(lock()->owned_by_self(), "must own lock");
+  assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
   remove(task);
 
   // Enqueue the task for reclamation (should be done outside MCQ lock)
@@ -780,7 +780,7 @@ void CompileBroker::print_compile_queues(outputStream* st) {
 }
 
 void CompileQueue::print(outputStream* st) {
-  assert(lock()->owned_by_self(), "must own lock");
+  assert(MethodCompileQueue_lock->owned_by_self(), "must own lock");
   st->print_cr("Contents of %s", name());
   st->print_cr("----------------------------");
   CompileTask* task = _first;
@@ -1066,11 +1066,11 @@ void CompileBroker::init_compiler_sweeper_threads(int c1_compiler_count, int c2_
 #endif // !ZERO && !SHARK
   // Initialize the compilation queue
   if (c2_compiler_count > 0) {
-    _c2_compile_queue  = new CompileQueue("C2 compile queue",  MethodCompileQueue_lock);
+    _c2_compile_queue  = new CompileQueue("C2 compile queue");
     _compilers[1]->set_num_compiler_threads(c2_compiler_count);
   }
   if (c1_compiler_count > 0) {
-    _c1_compile_queue  = new CompileQueue("C1 compile queue",  MethodCompileQueue_lock);
+    _c1_compile_queue  = new CompileQueue("C1 compile queue");
     _compilers[0]->set_num_compiler_threads(c1_compiler_count);
   }
 
@@ -1214,7 +1214,7 @@ void CompileBroker::compile_method_base(methodHandle method,
 
   // Acquire our lock.
   {
-    MutexLocker locker(queue->lock(), thread);
+    MutexLocker locker(MethodCompileQueue_lock, thread);
 
     // Make sure the method has not slipped into the queues since
     // last we checked; note that those checks were "fast bail-outs".
diff --git a/hotspot/src/share/vm/compiler/compileBroker.hpp b/hotspot/src/share/vm/compiler/compileBroker.hpp
index e5b0484fc4c..e6d8bb9bdb9 100644
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp
@@ -195,7 +195,6 @@ class CompilerCounters : public CHeapObj<mtCompiler> {
 class CompileQueue : public CHeapObj<mtCompiler> {
  private:
   const char* _name;
-  Monitor*    _lock;
 
   CompileTask* _first;
   CompileTask* _last;
@@ -206,9 +205,8 @@ class CompileQueue : public CHeapObj<mtCompiler> {
 
   void purge_stale_tasks();
  public:
-  CompileQueue(const char* name, Monitor* lock) {
+  CompileQueue(const char* name) {
     _name = name;
-    _lock = lock;
     _first = NULL;
     _last = NULL;
     _size = 0;
@@ -216,7 +214,6 @@ class CompileQueue : public CHeapObj<mtCompiler> {
   }
 
   const char*  name() const                      { return _name; }
-  Monitor*     lock() const                      { return _lock; }
 
   void         add(CompileTask* task);
   void         remove(CompileTask* task);
diff --git a/hotspot/src/share/vm/runtime/vm_operations.hpp b/hotspot/src/share/vm/runtime/vm_operations.hpp
index c8b4a3855fc..ae710ebf782 100644
--- a/hotspot/src/share/vm/runtime/vm_operations.hpp
+++ b/hotspot/src/share/vm/runtime/vm_operations.hpp
@@ -432,6 +432,7 @@ class VM_PrintCompileQueue: public VM_Operation {
  public:
   VM_PrintCompileQueue(outputStream* st) : _out(st) {}
   VMOp_Type type() const { return VMOp_PrintCompileQueue; }
+  Mode evaluation_mode() const { return _no_safepoint; }
   void doit();
 };
 

From 8f3190b805064eb1cb4b76aa5bc03da59baba9a1 Mon Sep 17 00:00:00 2001
From: Aleksey Shipilev <shade@openjdk.org>
Date: Thu, 13 Nov 2014 19:12:28 +0300
Subject: [PATCH 078/299] 8064749: -XX:-UseCompilerSafepoints breaks safepoint
 rendezvous

Reviewed-by: dcubed, coleenp, kvn, dholmes
---
 hotspot/src/share/vm/runtime/arguments.cpp |  1 +
 hotspot/src/share/vm/runtime/globals.hpp   |  3 ---
 hotspot/src/share/vm/runtime/safepoint.cpp | 10 ++++------
 3 files changed, 5 insertions(+), 9 deletions(-)

diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index ff2a25fe1bc..511f316823d 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -313,6 +313,7 @@ static ObsoleteFlag obsolete_jvm_flags[] = {
   { "UseFastAccessorMethods",        JDK_Version::jdk(9), JDK_Version::jdk(10) },
   { "UseFastEmptyMethods",           JDK_Version::jdk(9), JDK_Version::jdk(10) },
 #endif // ZERO
+  { "UseCompilerSafepoints",         JDK_Version::jdk(9), JDK_Version::jdk(10) },
   { NULL, JDK_Version(0), JDK_Version(0) }
 };
 
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index e74b9bbdf20..e89fdc19a49 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -777,9 +777,6 @@ class CommandLineFlags {
   develop(bool, TraceHandleAllocation, false,                               \
           "Print out warnings when suspiciously many handles are allocated")\
                                                                             \
-  product(bool, UseCompilerSafepoints, true,                                \
-          "Stop at safepoints in compiled code")                            \
-                                                                            \
   product(bool, FailOverToOldVerifier, true,                                \
           "Fail over to old verifier when split verifier fails")            \
                                                                             \
diff --git a/hotspot/src/share/vm/runtime/safepoint.cpp b/hotspot/src/share/vm/runtime/safepoint.cpp
index 05460b84dc0..d7c32ccb009 100644
--- a/hotspot/src/share/vm/runtime/safepoint.cpp
+++ b/hotspot/src/share/vm/runtime/safepoint.cpp
@@ -182,7 +182,7 @@ void SafepointSynchronize::begin() {
   // Make interpreter safepoint aware
   Interpreter::notice_safepoints();
 
-  if (UseCompilerSafepoints && DeferPollingPageLoopCount < 0) {
+  if (DeferPollingPageLoopCount < 0) {
     // Make polling safepoint aware
     guarantee (PageArmed == 0, "invariant") ;
     PageArmed = 1 ;
@@ -288,7 +288,7 @@ void SafepointSynchronize::begin() {
       // 9. On windows consider using the return value from SwitchThreadTo()
       //    to drive subsequent spin/SwitchThreadTo()/Sleep(N) decisions.
 
-      if (UseCompilerSafepoints && int(iterations) == DeferPollingPageLoopCount) {
+      if (int(iterations) == DeferPollingPageLoopCount) {
          guarantee (PageArmed == 0, "invariant") ;
          PageArmed = 1 ;
          os::make_polling_page_unreadable();
@@ -1074,7 +1074,7 @@ void SafepointSynchronize::deferred_initialize_stat() {
   guarantee(_safepoint_stats != NULL,
             "not enough memory for safepoint instrumentation data");
 
-  if (UseCompilerSafepoints && DeferPollingPageLoopCount >= 0) {
+  if (DeferPollingPageLoopCount >= 0) {
     need_to_track_page_armed_status = true;
   }
   init_done = true;
@@ -1241,9 +1241,7 @@ void SafepointSynchronize::print_stat_on_exit() {
 
   // Print out polling page sampling status.
   if (!need_to_track_page_armed_status) {
-    if (UseCompilerSafepoints) {
-      tty->print_cr("Polling page always armed");
-    }
+    tty->print_cr("Polling page always armed");
   } else {
     tty->print_cr("Defer polling page loop count = %d\n",
                  DeferPollingPageLoopCount);

From b259ede6922c13015f94b15391fc5161f8b55451 Mon Sep 17 00:00:00 2001
From: "Daniel D. Daugherty" <dcubed@openjdk.org>
Date: Thu, 13 Nov 2014 10:39:35 -0800
Subject: [PATCH 079/299] 8033602: wrong stabs data in libjvm.debuginfo on JDK
 8 - SPARC 8034005: cannot debug in synchronizer.o or objectMonitor.o on
 Solaris X86

Solaris needs objcopy version of 2.21.1 or newer is needed to create valid .debuginfo files.

Reviewed-by: dsamersoff, sspitsyn, dholmes, ihse
---
 .../solaris/makefiles/add_gnu_debuglink.make  |  54 ----
 hotspot/make/solaris/makefiles/defs.make      |  51 +++-
 hotspot/make/solaris/makefiles/dtrace.make    |  37 +--
 .../makefiles/fix_empty_sec_hdr_flags.make    |  54 ----
 hotspot/make/solaris/makefiles/jsig.make      |  13 +-
 hotspot/make/solaris/makefiles/saproc.make    |  13 +-
 hotspot/make/solaris/makefiles/vm.make        |  21 +-
 .../add_gnu_debuglink/add_gnu_debuglink.c     | 285 ------------------
 .../fix_empty_sec_hdr_flags.c                 | 181 -----------
 9 files changed, 64 insertions(+), 645 deletions(-)
 delete mode 100644 hotspot/make/solaris/makefiles/add_gnu_debuglink.make
 delete mode 100644 hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make
 delete mode 100644 hotspot/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c
 delete mode 100644 hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c

diff --git a/hotspot/make/solaris/makefiles/add_gnu_debuglink.make b/hotspot/make/solaris/makefiles/add_gnu_debuglink.make
deleted file mode 100644
index ee75722fa99..00000000000
--- a/hotspot/make/solaris/makefiles/add_gnu_debuglink.make
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# Copyright (c) 2012, 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.
-#  
-#
-
-# Rules to build add_gnu_debuglink, used by vm.make on Solaris
-
-# Allow $(ADD_GNU_DEBUGLINK) to be called from any directory.
-# We don't set or use the GENERATED macro to avoid affecting
-# other HotSpot Makefiles.
-TOPDIR                    = $(shell echo `pwd`)
-ADD_GNU_DEBUGLINK         = $(TOPDIR)/../generated/add_gnu_debuglink
-
-ADD_GNU_DEBUGLINK_DIR     = $(GAMMADIR)/src/os/solaris/add_gnu_debuglink
-ADD_GNU_DEBUGLINK_SRC     = $(ADD_GNU_DEBUGLINK_DIR)/add_gnu_debuglink.c
-ADD_GNU_DEBUGLINK_FLAGS   = 
-LIBS_ADD_GNU_DEBUGLINK   += -lelf
-
-ifeq ("${Platform_compiler}", "sparcWorks")
-# Enable the following ADD_GNU_DEBUGLINK_FLAGS addition if you need to
-# compare the built ELF objects.
-#
-# The -g option makes static data global and the "-W0,-noglobal"
-# option tells the compiler to not globalize static data using a unique
-# globalization prefix. Instead force the use of a static globalization
-# prefix based on the source filepath so the objects from two identical
-# compilations are the same.
-#
-# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't
-#       seem to work. I got "-W0,-noglobal" from Kelly and that works.
-#ADD_GNU_DEBUGLINK_FLAGS += -W0,-noglobal
-endif # Platform_compiler == sparcWorks
-
-$(ADD_GNU_DEBUGLINK): $(ADD_GNU_DEBUGLINK_SRC)
-	$(CC) -g -o $@ $< $(ADD_GNU_DEBUGLINK_FLAGS) $(LIBS_ADD_GNU_DEBUGLINK)
diff --git a/hotspot/make/solaris/makefiles/defs.make b/hotspot/make/solaris/makefiles/defs.make
index 522d3288f96..0a0fe381503 100644
--- a/hotspot/make/solaris/makefiles/defs.make
+++ b/hotspot/make/solaris/makefiles/defs.make
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2006, 2014, 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
@@ -138,6 +138,55 @@ ifeq ($(JDK6_OR_EARLIER),0)
         OBJCOPY=$(shell test -x $(ALT_OBJCOPY) && echo $(ALT_OBJCOPY))
       endif
 
+      ifneq ($(OBJCOPY),)
+        # OBJCOPY version check:
+        # - version number is last blank separate word on first line
+        # - version number formats that have been seen:
+        #   - <major>.<minor>
+        #   - <major>.<minor>.<micro>
+        #
+        # Full Debug Symbols on Solaris needs version 2.21.1 or newer.
+        #
+        OBJCOPY_VERS_CHK := $(shell \
+          $(OBJCOPY) --version \
+            | sed -n \
+                  -e 's/.* //' \
+                  -e '/^[01]\./b bad' \
+                  -e '/^2\./{' \
+                  -e '  s/^2\.//' \
+                  -e '  /^[0-9]$$/b bad' \
+                  -e '  /^[0-9]\./b bad' \
+                  -e '  /^1[0-9]$$/b bad' \
+                  -e '  /^1[0-9]\./b bad' \
+                  -e '  /^20\./b bad' \
+                  -e '  /^21\.0$$/b bad' \
+                  -e '  /^21\.0\./b bad' \
+                  -e '}' \
+                  -e ':good' \
+                  -e 's/.*/VALID_VERSION/p' \
+                  -e 'q' \
+                  -e ':bad' \
+                  -e 's/.*/BAD_VERSION/p' \
+                  -e 'q' \
+          )
+        ifeq ($(OBJCOPY_VERS_CHK),BAD_VERSION)
+          _JUNK_ := $(shell \
+            echo >&2 "WARNING: $(OBJCOPY) --version info:"; \
+            $(OBJCOPY) --version | sed -n -e 's/^/WARNING: /p' -e 'q' >&2; \
+            echo >&2 "WARNING: an objcopy version of 2.21.1 or newer" \
+              "is needed to create valid .debuginfo files."; \
+            echo >&2 "WARNING: ignoring above objcopy command."; \
+            echo >&2 "WARNING: patch 149063-01 or newer contains the" \
+              "correct Solaris 10 SPARC version."; \
+            echo >&2 "WARNING: patch 149064-01 or newer contains the" \
+              "correct Solaris 10 X86 version."; \
+            echo >&2 "WARNING: Solaris 11 Update 1 contains the" \
+              "correct version."; \
+            )
+          OBJCOPY=
+        endif
+      endif
+
       ifeq ($(OBJCOPY),)
         $(eval $(call print_info, "no objcopy cmd found so cannot create .debuginfo files."))
         ENABLE_FULL_DEBUG_SYMBOLS=0
diff --git a/hotspot/make/solaris/makefiles/dtrace.make b/hotspot/make/solaris/makefiles/dtrace.make
index b76ff3cdb15..be6e71dba9e 100644
--- a/hotspot/make/solaris/makefiles/dtrace.make
+++ b/hotspot/make/solaris/makefiles/dtrace.make
@@ -101,25 +101,16 @@ XLIBJVM_DB_DIZ             = $(XLIBJVM_DIR)/$(LIBJVM_DB_DIZ)
 XLIBJVM_DTRACE_DEBUGINFO   = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DEBUGINFO)
 XLIBJVM_DTRACE_DIZ         = $(XLIBJVM_DIR)/$(LIBJVM_DTRACE_DIZ)
 
-$(XLIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
+$(XLIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS).h $(LIBJVM_DB_MAPFILE)
 	@echo $(LOG_INFO) Making $@
 	$(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \
 	$(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. -I$(GENERATED) \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
-# Clear the SHF_ALLOC flag (if set) from empty section headers.
-# An empty section header has sh_addr == 0 and sh_size == 0.
-# This problem has only been seen on Solaris X64, but we call this tool
-# on all Solaris builds just in case.
-	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DB_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
-# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
-#         $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) ;
 # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not
 # in the link name:
-	( cd $(XLIBJVM_DIR) && $(ADD_GNU_DEBUGLINK) $(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) )
+	( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $(LIBJVM_DB) )
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
@@ -136,20 +127,16 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   endif
 endif
 
-$(XLIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
+$(XLIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
 	@echo $(LOG_INFO) Making $@
 	$(QUIETLY) mkdir -p $(XLIBJVM_DIR) ; \
 	$(CC) $(SYMFLAG) $(ARCHFLAG/$(ISA)) -D$(TYPE) -I. \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-# Clear the SHF_ALLOC flag (if set) from empty section headers.
-	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(XLIBJVM_DTRACE_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
-#         $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) ;
 # Do this part in the $(XLIBJVM_DIR) subdir so $(XLIBJVM_DIR) is not
 # in the link name:
-	( cd $(XLIBJVM_DIR) && $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) )
+	( cd $(XLIBJVM_DIR) && $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $(LIBJVM_DTRACE) )
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
@@ -206,17 +193,13 @@ $(JVMOFFS).cpp: $(GENOFFS) $(JVMOFFS).h $(JVMOFFS)Index.h
 $(JVMOFFS.o): $(JVMOFFS).h $(JVMOFFS).cpp 
 	$(QUIETLY) $(CXX) -c -I. -o $@ $(ARCHFLAG) -D$(TYPE) $(JVMOFFS).cpp
 
-$(LIBJVM_DB): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE)
+$(LIBJVM_DB): $(DTRACE_SRCDIR)/$(JVM_DB).c $(JVMOFFS.o) $(XLIBJVM_DB) $(LIBJVM_DB_MAPFILE)
 	@echo $(LOG_INFO) Making $@
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I. -I$(GENERATED) \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DB) -o $@ $(DTRACE_SRCDIR)/$(JVM_DB).c -lc
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-# Clear the SHF_ALLOC flag (if set) from empty section headers.
-	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DB_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
-#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@
-	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DB_DEBUGINFO) $@
+	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DB_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
@@ -231,17 +214,13 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   endif
 endif
 
-$(LIBJVM_DTRACE): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
+$(LIBJVM_DTRACE): $(DTRACE_SRCDIR)/$(JVM_DTRACE).c $(XLIBJVM_DTRACE) $(DTRACE_SRCDIR)/$(JVM_DTRACE).h $(LIBJVM_DTRACE_MAPFILE)
 	@echo $(LOG_INFO) Making $@
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) -D$(TYPE) -I.  \
 		$(SHARED_FLAG) $(LFLAGS_JVM_DTRACE) -o $@ $(DTRACE_SRCDIR)/$(JVM_DTRACE).c -lc -lthread -ldoor
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-# Clear the SHF_ALLOC flag (if set) from empty section headers.
-	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DTRACE_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
-#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@
-	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DTRACE_DEBUGINFO) $@
+	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DTRACE_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
diff --git a/hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make b/hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make
deleted file mode 100644
index bd763904480..00000000000
--- a/hotspot/make/solaris/makefiles/fix_empty_sec_hdr_flags.make
+++ /dev/null
@@ -1,54 +0,0 @@
-#
-# Copyright (c) 2012, 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.
-#  
-#
-
-# Rules to build fix_empty_sec_hdr_flags, used by vm.make on Solaris
-
-# Allow $(FIX_EMPTY_SEC_HDR_FLAGS) to be called from any directory.
-# We don't set or use the GENERATED macro to avoid affecting
-# other HotSpot Makefiles.
-TOPDIR                          = $(shell echo `pwd`)
-FIX_EMPTY_SEC_HDR_FLAGS         = $(TOPDIR)/../generated/fix_empty_sec_hdr_flags
-
-FIX_EMPTY_SEC_HDR_FLAGS_DIR     = $(GAMMADIR)/src/os/solaris/fix_empty_sec_hdr_flags
-FIX_EMPTY_SEC_HDR_FLAGS_SRC     = $(FIX_EMPTY_SEC_HDR_FLAGS_DIR)/fix_empty_sec_hdr_flags.c
-FIX_EMPTY_SEC_HDR_FLAGS_FLAGS   = 
-LIBS_FIX_EMPTY_SEC_HDR_FLAGS   += -lelf
-
-ifeq ("${Platform_compiler}", "sparcWorks")
-# Enable the following FIX_EMPTY_SEC_HDR_FLAGS_FLAGS addition if you need to
-# compare the built ELF objects.
-#
-# The -g option makes static data global and the "-W0,-noglobal"
-# option tells the compiler to not globalize static data using a unique
-# globalization prefix. Instead force the use of a static globalization
-# prefix based on the source filepath so the objects from two identical
-# compilations are the same.
-#
-# Note: The blog says to use "-W0,-xglobalstatic", but that doesn't
-#       seem to work. I got "-W0,-noglobal" from Kelly and that works.
-#FIX_EMPTY_SEC_HDR_FLAGS_FLAGS += -W0,-noglobal
-endif # Platform_compiler == sparcWorks
-
-$(FIX_EMPTY_SEC_HDR_FLAGS): $(FIX_EMPTY_SEC_HDR_FLAGS_SRC)
-	$(CC) -g -o $@ $< $(FIX_EMPTY_SEC_HDR_FLAGS_FLAGS) $(LIBS_FIX_EMPTY_SEC_HDR_FLAGS)
diff --git a/hotspot/make/solaris/makefiles/jsig.make b/hotspot/make/solaris/makefiles/jsig.make
index bb8d9b2e823..d8acd4ee93a 100644
--- a/hotspot/make/solaris/makefiles/jsig.make
+++ b/hotspot/make/solaris/makefiles/jsig.make
@@ -47,22 +47,13 @@ else
 LFLAGS_JSIG += -mt -xnolib
 endif
 
-$(LIBJSIG): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
+$(LIBJSIG): $(JSIGSRCDIR)/jsig.c $(LIBJSIG_MAPFILE)
 	@echo $(LOG_INFO) Making signal interposition lib...
 	$(QUIETLY) $(CC) $(SYMFLAG) $(ARCHFLAG) $(SHARED_FLAG) $(PICFLAG) \
                          $(LFLAGS_JSIG) -o $@ $(JSIGSRCDIR)/jsig.c -ldl
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
-# Clear the SHF_ALLOC flag (if set) from empty section headers.
-# An empty section header has sh_addr == 0 and sh_size == 0.
-# This problem has only been seen on Solaris X64, but we call this tool
-# on all Solaris builds just in case.
-	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJSIG_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
-# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
-#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
-	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJSIG_DEBUGINFO) $@
+	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJSIG_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
diff --git a/hotspot/make/solaris/makefiles/saproc.make b/hotspot/make/solaris/makefiles/saproc.make
index e6adbf69997..c5558527121 100644
--- a/hotspot/make/solaris/makefiles/saproc.make
+++ b/hotspot/make/solaris/makefiles/saproc.make
@@ -90,7 +90,7 @@ $(shell uname -r -v \
 #SOLARIS_11_B159_OR_LATER=-DSOLARIS_11_B159_OR_LATER
 
 
-$(LIBSAPROC): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(SASRCFILES) $(SADISOBJ) $(SAMAPFILE)
+$(LIBSAPROC): $(SASRCFILES) $(SADISOBJ) $(SAMAPFILE)
 	$(QUIETLY) if [ "$(BOOT_JAVA_HOME)" = "" ]; then \
 	  echo "ALT_BOOTDIR, BOOTDIR or JAVA_HOME needs to be defined to build SA"; \
 	  exit 1; \
@@ -121,17 +121,8 @@ $(SADISOBJ): $(SADISSRCFILES)
 	           -c -o $(SADISOBJ)
 
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
-# Clear the SHF_ALLOC flag (if set) from empty section headers.
-# An empty section header has sh_addr == 0 and sh_size == 0.
-# This problem has only been seen on Solaris X64, but we call this tool
-# on all Solaris builds just in case.
-	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBSAPROC_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
-# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
-#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
-	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBSAPROC_DEBUGINFO) $@
+	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBSAPROC_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
diff --git a/hotspot/make/solaris/makefiles/vm.make b/hotspot/make/solaris/makefiles/vm.make
index da906bcfad8..ea4ec4c1bf5 100644
--- a/hotspot/make/solaris/makefiles/vm.make
+++ b/hotspot/make/solaris/makefiles/vm.make
@@ -154,14 +154,6 @@ JDK_LIBDIR = $(JAVA_HOME)/jre/lib/$(LIBARCH)
 # jvm_db & dtrace
 include $(MAKEFILES_DIR)/dtrace.make
 
-#----------------------------------------------------------------------
-# add_gnu_debuglink tool
-include $(MAKEFILES_DIR)/add_gnu_debuglink.make
-
-#----------------------------------------------------------------------
-# fix_empty_sec_hdr_flags tool
-include $(MAKEFILES_DIR)/fix_empty_sec_hdr_flags.make
-
 #----------------------------------------------------------------------
 # JVM
 
@@ -302,7 +294,7 @@ else
 LINK_VM = $(LINK_LIB.CXX)
 endif
 # making the library:
-$(LIBJVM): $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS) $(LIBJVM.o) $(LIBJVM_MAPFILE)
+$(LIBJVM): $(LIBJVM.o) $(LIBJVM_MAPFILE)
 ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
 	@echo $(LOG_INFO) Linking vm...
 	$(QUIETLY) $(LINK_LIB.CXX/PRE_HOOK)
@@ -310,17 +302,8 @@ ifeq ($(filter -sbfast -xsbfast, $(CFLAGS_BROWSE)),)
 	$(QUIETLY) $(LINK_LIB.CXX/POST_HOOK)
 	$(QUIETLY) rm -f $@.1 && ln -s $@ $@.1
 ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
-# gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
-# Clear the SHF_ALLOC flag (if set) from empty section headers.
-# An empty section header has sh_addr == 0 and sh_size == 0.
-# This problem has only been seen on Solaris X64, but we call this tool
-# on all Solaris builds just in case.
-	$(QUIETLY) $(FIX_EMPTY_SEC_HDR_FLAGS) $@
 	$(QUIETLY) $(OBJCOPY) --only-keep-debug $@ $(LIBJVM_DEBUGINFO)
-# $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
-# Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
-#	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
-	$(QUIETLY) $(ADD_GNU_DEBUGLINK) $(LIBJVM_DEBUGINFO) $@
+	$(QUIETLY) $(OBJCOPY) --add-gnu-debuglink=$(LIBJVM_DEBUGINFO) $@
   ifeq ($(STRIP_POLICY),all_strip)
 	$(QUIETLY) $(STRIP) $@
   else
diff --git a/hotspot/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c b/hotspot/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c
deleted file mode 100644
index 3cb2dc489d4..00000000000
--- a/hotspot/src/os/solaris/add_gnu_debuglink/add_gnu_debuglink.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- */
-
-/*
- * Name:        add_gnu_debuglink.c
- *
- * Description: Add a ".gnu_debuglink" section that refers to the specified
- *     debug_info_path to the specified ELF object.
- *
- *     This program is adapted from the example program shown on the
- *     elf(3elf) man page and from code from the Solaris compiler
- *     driver.
- */
-
-/*
- * needed to define SHF_EXCLUDE
- */
-#define ELF_TARGET_ALL
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <libelf.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-static void failure(void);
-static unsigned int gnu_debuglink_crc32(unsigned int crc, unsigned char *buf,
-                                        size_t len);
-
-void
-main(int argc, char ** argv) {
-                                 /* new ELF section name */
-    static char SEC_NAME[] = ".gnu_debuglink";
-
-    unsigned char buffer[8 * 1024];  /* I/O buffer */
-    int           buffer_len;        /* buffer length */
-    char *        debug_info_path;   /* debug info path */
-    void *        ehdr;              /* ELF header */
-    Elf *         elf;               /* ELF descriptor */
-    char *        elf_ident;         /* ELF identity string */
-    char *        elf_obj;           /* elf_obj file */
-    int           fd;                /* descriptor for files */
-    unsigned int  file_crc = 0;      /* CRC for debug info file */
-    int           is_elfclass64;     /* is an ELFCLASS64 file? */
-    Elf_Data *    link_dat;          /* ELF data for new debug info link */
-    Elf_Data *    name_dat;          /* ELF data for new section name */
-    Elf_Scn *     new_scn;           /* new ELF section descriptor */
-    void *        new_shdr;          /* new ELF section header */
-    Elf_Scn *     scn;               /* ELF section descriptor */
-    void *        shdr;              /* ELF section header */
-
-    if (argc != 3) {
-        (void) fprintf(stderr, "Usage: %s debug_info_path elf_obj\n", argv[0]);
-        exit(2);
-    }
-
-    debug_info_path = argv[1];  /* save for later */
-    if ((fd = open(debug_info_path, O_RDONLY)) == -1) {
-        (void) fprintf(stderr, "%s: cannot open file.\n", debug_info_path);
-        exit(3);
-    }
-
-    (void) printf("Computing CRC for '%s'\n", debug_info_path);
-    (void) fflush(stdout);
-    /* compute CRC for the debug info file */
-    for (;;) {
-        int len = read(fd, buffer, sizeof buffer);
-        if (len <= 0) {
-            break;
-        }
-        file_crc = gnu_debuglink_crc32(file_crc, buffer, len);
-    }
-    (void) close(fd);
-
-    /* open the elf_obj */
-    elf_obj = argv[2];
-    if ((fd = open(elf_obj, O_RDWR)) == -1) {
-        (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
-        exit(4);
-    }
-
-    (void) printf("Opening '%s' for update\n", elf_obj);
-    (void) fflush(stdout);
-    (void) elf_version(EV_CURRENT);  /* coordinate ELF versions */
-
-    /* obtain the ELF descriptors from the input file */
-    if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
-        failure();
-    }
-
-    /* determine if ELFCLASS64 or not? */
-    elf_ident = elf_getident(elf, NULL);
-    is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
-
-    /* get the ELF header */
-    if (is_elfclass64) {
-        ehdr = elf64_getehdr(elf);
-    } else {
-        ehdr = elf32_getehdr(elf);
-    }
-    if (ehdr == NULL) {
-        failure();
-    }
-
-    /* get the ELF section descriptor */
-    if (is_elfclass64) {
-        scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
-    } else {
-        scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
-    }
-    if (scn == NULL) {
-        failure();
-    }
-
-    /* get the section header */
-    if (is_elfclass64) {
-        shdr = elf64_getshdr(scn);
-    } else {
-        shdr = elf32_getshdr(scn);
-    }
-    if (shdr == NULL) {
-        failure();
-    }
-
-    (void) printf("Adding ELF data for new section name\n");
-    (void) fflush(stdout);
-    name_dat = elf_newdata(scn);
-    name_dat->d_buf = (void *) SEC_NAME;
-    if (is_elfclass64) {
-        name_dat->d_off = ((Elf64_Shdr *) shdr)->sh_size + 1;
-    } else {
-        name_dat->d_off = ((Elf32_Shdr *) shdr)->sh_size + 1;
-    }
-    name_dat->d_align = 1;
-    name_dat->d_size = strlen(SEC_NAME) + 1;
-
-    new_scn = elf_newscn(elf);
-
-    if (is_elfclass64) {
-        new_shdr = elf64_getshdr(new_scn);
-        ((Elf64_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
-        ((Elf64_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
-        ((Elf64_Shdr *) new_shdr)->sh_name = ((Elf64_Shdr *) shdr)->sh_size;
-        ((Elf64_Shdr *) new_shdr)->sh_addralign = 1;
-        ((Elf64_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
-    } else {
-        new_shdr = elf32_getshdr(new_scn);
-        ((Elf32_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
-        ((Elf32_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
-        ((Elf32_Shdr *) new_shdr)->sh_name = ((Elf32_Shdr *) shdr)->sh_size;
-        ((Elf32_Shdr *) new_shdr)->sh_addralign = 1;
-        ((Elf32_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
-    }
-
-    (void) printf("Adding ELF data for debug_info_path value\n");
-    (void) fflush(stdout);
-    (void) memset(buffer, 0, sizeof buffer);
-    buffer_len = strlen(debug_info_path) + 1;  /* +1 for NUL */
-    (void) strncpy((char *) buffer, debug_info_path, buffer_len);
-    if (buffer_len % 4 != 0) {
-        /* not on a 4 byte boundary so pad to the next one */
-        buffer_len += (4 - buffer_len % 4);
-    }
-    /* save the CRC */
-    (void) memcpy(&buffer[buffer_len], &file_crc, sizeof file_crc);
-    buffer_len += sizeof file_crc;
-
-    link_dat = elf_newdata(new_scn);
-    link_dat->d_type = ELF_T_BYTE;
-    link_dat->d_size = buffer_len;
-    link_dat->d_buf = buffer;
-    link_dat->d_align = 1;
-
-    (void) printf("Saving updates to '%s'\n", elf_obj);
-    (void) fflush(stdout);
-    (void) elf_update(elf, ELF_C_NULL);   /* recalc ELF memory structures */
-    (void) elf_update(elf, ELF_C_WRITE);  /* write out changes to ELF obj */
-    (void) elf_end(elf);                  /* done with ELF obj */
-    (void) close(fd);
-
-    (void) printf("Done updating '%s'\n", elf_obj);
-    (void) fflush(stdout);
-    exit(0);
-}  /* end main */
-
-
-static void
-failure() {
-    (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
-    exit(5);
-}
-
-
-/*
- * The CRC used in gnu_debuglink, retrieved from
- * http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files.
- */
-
-static unsigned int
-gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, size_t len) {
-    static const unsigned int crc32_table[256] = {
-        0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
-        0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
-        0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
-        0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
-        0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
-        0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
-        0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
-        0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
-        0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
-        0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
-        0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
-        0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
-        0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
-        0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
-        0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
-        0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
-        0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
-        0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
-        0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
-        0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
-        0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
-        0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
-        0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
-        0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
-        0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
-        0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
-        0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
-        0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
-        0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
-        0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
-        0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
-        0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
-        0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
-        0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
-        0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
-        0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
-        0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
-        0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
-        0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
-        0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
-        0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
-        0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
-        0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
-        0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
-        0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
-        0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
-        0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
-        0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
-        0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
-        0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
-        0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
-        0x2d02ef8d
-    };
-
-    unsigned char *end;
-
-    crc = ~crc & 0xffffffff;
-    for (end = buf + len; buf < end; ++buf) {
-        crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
-    }
-    return ~crc & 0xffffffff;
-}
diff --git a/hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c b/hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c
deleted file mode 100644
index 6582d950639..00000000000
--- a/hotspot/src/os/solaris/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- */
-
-/*
- * Name:        fix_empty_sec_hdr_flags.c
- *
- * Description: Remove the SHF_ALLOC flag from "empty" section headers.
- *     An "empty" section header has sh_addr == 0 and sh_size == 0.
- *
- *     This program is adapted from the example program shown on the
- *     elf(3elf) man page and from code from the Solaris compiler
- *     driver.
- */
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <libelf.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-static void failure(void);
-
-void
-main(int argc, char ** argv) {
-    void *        ehdr;           /* ELF header */
-    unsigned int  i;              /* section counter */
-    int           fd;             /* descriptor for file */
-    Elf *         elf;            /* ELF descriptor */
-    char *        elf_ident;      /* ELF identity string */
-    char *        elf_obj;        /* elf_obj file */
-    int           fix_count;      /* number of flags fixed */
-    int           is_elfclass64;  /* is an ELFCLASS64 file? */
-    Elf_Scn *     scn;            /* ELF section descriptor */
-    void *        shdr;           /* ELF section header */
-    Elf_Data *    shstrtab;       /* ELF section header string table */
-
-    if (argc != 2) {
-        (void) fprintf(stderr, "Usage: %s elf_obj\n", argv[0]);
-        exit(2);
-    }
-
-    /* open the elf_obj */
-    elf_obj = argv[1];
-    if ((fd = open(elf_obj, O_RDWR)) == -1) {
-        (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
-        exit(3);
-    }
-
-    (void) printf("Opening '%s' for update\n", elf_obj);
-    (void) fflush(stdout);
-    (void) elf_version(EV_CURRENT);  /* coordinate ELF versions */
-
-    /* obtain the ELF descriptors from the input file */
-    if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
-        failure();
-    }
-
-    /* determine if ELFCLASS64 or not? */
-    elf_ident = elf_getident(elf, NULL);
-    is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
-
-    /* get the ELF header */
-    if (is_elfclass64) {
-        ehdr = elf64_getehdr(elf);
-    } else {
-        ehdr = elf32_getehdr(elf);
-    }
-    if (ehdr == NULL) {
-        failure();
-    }
-
-    /* get the ELF section descriptor */
-    if (is_elfclass64) {
-        scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
-    } else {
-        scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
-    }
-    if (scn == NULL) {
-        failure();
-    }
-
-    /* get the section header string table */
-    shstrtab = elf_getdata(scn, NULL);
-    if (shstrtab == NULL) {
-        failure();
-    }
-
-    fix_count = 0;
-
-    /* traverse the sections of the input file */
-    for (i = 1, scn = NULL; scn = elf_nextscn(elf, scn); i++) {
-        int    has_flag_set;  /* is SHF_ALLOC flag set? */
-        int    is_empty;      /* is section empty? */
-        char * name;          /* short hand pointer */
-
-        /* get the section header */
-        if (is_elfclass64) {
-            shdr = elf64_getshdr(scn);
-        } else {
-            shdr = elf32_getshdr(scn);
-        }
-        if (shdr == NULL) {
-            failure();
-        }
-
-        if (is_elfclass64) {
-            name = (char *)shstrtab->d_buf + ((Elf64_Shdr *) shdr)->sh_name;
-        } else {
-            name = (char *)shstrtab->d_buf + ((Elf32_Shdr *) shdr)->sh_name;
-        }
-
-        if (is_elfclass64) {
-            has_flag_set = ((Elf64_Shdr *) shdr)->sh_flags & SHF_ALLOC;
-            is_empty = ((Elf64_Shdr *) shdr)->sh_addr == 0 &&
-                ((Elf64_Shdr *) shdr)->sh_size == 0;
-        } else {
-            has_flag_set = ((Elf32_Shdr *) shdr)->sh_flags & SHF_ALLOC;
-            is_empty = ((Elf32_Shdr *) shdr)->sh_addr == 0 &&
-                ((Elf32_Shdr *) shdr)->sh_size == 0;
-        }
-
-        if (is_empty && has_flag_set) {
-            (void) printf("section[%u] '%s' is empty, "
-                "but SHF_ALLOC flag is set.\n", i, name);
-            (void) printf("Clearing the SHF_ALLOC flag.\n");
-
-            if (is_elfclass64) {
-                ((Elf64_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
-            } else {
-                ((Elf32_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
-            }
-            fix_count++;
-        }
-    }  /* end for each ELF section */
-
-    if (fix_count > 0) {
-        (void) printf("Saving %d updates to '%s'\n", fix_count, elf_obj);
-        (void) fflush(stdout);
-        (void) elf_update(elf, ELF_C_NULL);   /* recalc ELF memory structures */
-        (void) elf_update(elf, ELF_C_WRITE);  /* write out changes to ELF obj */
-    } else {
-        (void) printf("No SHF_ALLOC flags needed to be cleared.\n");
-    }
-
-    (void) elf_end(elf);                  /* done with ELF obj */
-    (void) close(fd);
-
-    (void) printf("Done %s '%s'\n",
-               (fix_count > 0) ? "updating" : "with", elf_obj);
-    (void) fflush(stdout);
-    exit(0);
-}  /* end main */
-
-
-static void
-failure() {
-    (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
-    exit(6);
-}

From 3e575a7078cf9f65240d99a600d07aaa63f7dfce Mon Sep 17 00:00:00 2001
From: Eric McCorkle <emc@openjdk.org>
Date: Fri, 14 Nov 2014 12:45:55 -0500
Subject: [PATCH 080/299] 8064571:
 java/lang/instrument/IsModifiableClassAgent.java: assert(length > 0) failed:
 should only be called if table is present

Remove tautological assert

Reviewed-by: coleenp, lfoltan, sspitsyn, jiangli
---
 hotspot/src/share/vm/oops/constMethod.cpp | 1 -
 1 file changed, 1 deletion(-)

diff --git a/hotspot/src/share/vm/oops/constMethod.cpp b/hotspot/src/share/vm/oops/constMethod.cpp
index e3703be0c59..88d2c0ffee4 100644
--- a/hotspot/src/share/vm/oops/constMethod.cpp
+++ b/hotspot/src/share/vm/oops/constMethod.cpp
@@ -293,7 +293,6 @@ int ConstMethod::method_parameters_length() const {
 MethodParametersElement* ConstMethod::method_parameters_start() const {
   u2* addr = method_parameters_length_addr();
   u2 length = *addr;
-  assert(length > 0, "should only be called if table is present");
   addr -= length * sizeof(MethodParametersElement) / sizeof(u2);
   return (MethodParametersElement*) addr;
 }

From 54d2060d4290181d7e1c688612b7d2f1c06c08e3 Mon Sep 17 00:00:00 2001
From: Max Ockner <max.ockner@oracle.com>
Date: Fri, 14 Nov 2014 13:09:53 -0500
Subject: [PATCH 081/299] 8060449: Obsolete command line flags accept arbitrary
 appendix

Proper error messages for newly obsolete command line flags.

Reviewed-by: lfoltan, dcubed, coleenp
---
 hotspot/src/share/vm/runtime/arguments.cpp    | 17 +++++--
 .../CommandLine/ObsoleteFlagErrorMessage.java | 44 +++++++++++++++++++
 2 files changed, 58 insertions(+), 3 deletions(-)
 create mode 100644 hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java

diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index ff2a25fe1bc..018cb0c5267 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -327,9 +327,12 @@ bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) {
     const ObsoleteFlag& flag_status = obsolete_jvm_flags[i];
     // <flag>=xxx form
     // [-|+]<flag> form
-    if ((strncmp(flag_status.name, s, strlen(flag_status.name)) == 0) ||
+    size_t len = strlen(flag_status.name);
+    if (((strncmp(flag_status.name, s, len) == 0) &&
+         (strlen(s) == len)) ||
         ((s[0] == '+' || s[0] == '-') &&
-        (strncmp(flag_status.name, &s[1], strlen(flag_status.name)) == 0))) {
+         (strncmp(flag_status.name, &s[1], len) == 0) &&
+         (strlen(&s[1]) == len))) {
       if (JDK_Version::current().compare(flag_status.accept_until) == -1) {
           *version = flag_status.obsoleted_in;
           return true;
@@ -934,10 +937,18 @@ bool Arguments::process_argument(const char* arg,
     Flag* fuzzy_matched = Flag::fuzzy_match((const char*)argname, arg_len, true);
     if (fuzzy_matched != NULL) {
       jio_fprintf(defaultStream::error_stream(),
-                  "Did you mean '%s%s%s'?\n",
+                  "Did you mean '%s%s%s'? ",
                   (fuzzy_matched->is_bool()) ? "(+/-)" : "",
                   fuzzy_matched->_name,
                   (fuzzy_matched->is_bool()) ? "" : "=<value>");
+      if (is_newly_obsolete(fuzzy_matched->_name, &since)) {
+        char version[256];
+        since.to_string(version, sizeof(version));
+        jio_fprintf(defaultStream::error_stream(),
+                    "Warning: support for %s was removed in %s\n",
+                    fuzzy_matched->_name,
+                    version);
+      }
     }
   }
 
diff --git a/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java
new file mode 100644
index 00000000000..3af8408fcbe
--- /dev/null
+++ b/hotspot/test/runtime/CommandLine/ObsoleteFlagErrorMessage.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014, 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 8060449
+ * @summary Newly obsolete command line options should still give useful error messages when used improperly.
+ * @library /testlibrary
+ */
+
+import com.oracle.java.testlibrary.*;
+
+public class ObsoleteFlagErrorMessage {
+  public static void main(String[] args) throws Exception {
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder(
+        "-XX:UseBoundThreadsPlusJunk", "-version");
+
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+    output.shouldContain("Unrecognized VM option 'UseBoundThreadsPlusJunk'"); // Must identify bad option.
+    output.shouldContain("UseBoundThreads"); // Should apply fuzzy matching to find correct option.
+    output.shouldContain("support").shouldContain("removed"); // Should warn user that the option they are trying to use is no longer supported.
+    output.shouldHaveExitValue(1);
+  }
+}

From c96487313bcbefdc14d03c09c0eabba1bce5a591 Mon Sep 17 00:00:00 2001
From: Thomas Stuefe <thomas.stuefe@sap.com>
Date: Mon, 17 Nov 2014 11:26:43 -0500
Subject: [PATCH 082/299] 8064779: Add additional comments for "8062370:
 Various minor code improvements"

Provide additional comments to jio_snprintf and jio_vsnprintf

Reviewed-by: simonis, coleenp, mgronlun
---
 hotspot/src/share/vm/prims/jvm.cpp |  4 ++++
 hotspot/src/share/vm/prims/jvm.h   | 12 ++++++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp
index 419abd6d0f0..e28db7c4985 100644
--- a/hotspot/src/share/vm/prims/jvm.cpp
+++ b/hotspot/src/share/vm/prims/jvm.cpp
@@ -2593,6 +2593,10 @@ int jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args) {
   if ((intptr_t)count <= 0) return -1;
 
   int result = vsnprintf(str, count, fmt, args);
+  // Note: on truncation vsnprintf(3) on Unix returns numbers of
+  // characters which would have been written had the buffer been large
+  // enough; on Windows, it returns -1. We handle both cases here and
+  // always return -1, and perform null termination.
   if ((result > 0 && (size_t)result >= count) || result == -1) {
     str[count - 1] = '\0';
     result = -1;
diff --git a/hotspot/src/share/vm/prims/jvm.h b/hotspot/src/share/vm/prims/jvm.h
index e51b07f8f97..f3b045c9521 100644
--- a/hotspot/src/share/vm/prims/jvm.h
+++ b/hotspot/src/share/vm/prims/jvm.h
@@ -1167,10 +1167,14 @@ JVM_NativePath(char *);
  * be renamed to JVM_* in the future?
  */
 
-/*
- * BE CAREFUL! The following functions do not implement the
- * full feature set of standard C printf formats.
- */
+/* jio_snprintf() and jio_vsnprintf() behave like snprintf(3) and vsnprintf(3),
+ *  respectively, with the following differences:
+ * - The string written to str is always zero-terminated, also in case of
+ *   truncation (count is too small to hold the result string), unless count
+ *   is 0. In case of truncation count-1 characters are written and '\0'
+ *   appendend.
+ * - If count is too small to hold the whole string, -1 is returned across
+ *   all platforms. */
 JNIEXPORT int
 jio_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
 

From 8e5771854ad18e41e9ae5b380f01875c080d96dc Mon Sep 17 00:00:00 2001
From: Gunter Haug <gunter.haug@sap.com>
Date: Thu, 13 Nov 2014 16:58:56 +0100
Subject: [PATCH 083/299] 8064471: Port 8013895: G1: G1SummarizeRSetStats
 output on Linux needs improvement to AIX

Reviewed-by: dholmes, simonis
---
 hotspot/src/os/aix/vm/os_aix.cpp | 22 ++++++++++++++++------
 1 file changed, 16 insertions(+), 6 deletions(-)

diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp
index d0765c4c1fc..d7420ad820d 100644
--- a/hotspot/src/os/aix/vm/os_aix.cpp
+++ b/hotspot/src/os/aix/vm/os_aix.cpp
@@ -107,6 +107,12 @@
 #include <sys/vminfo.h>
 #include <sys/wait.h>
 
+// If RUSAGE_THREAD for getrusage() has not been defined, do it here. The code calling
+// getrusage() is prepared to handle the associated failure.
+#ifndef RUSAGE_THREAD
+#define RUSAGE_THREAD   (1)               /* only the calling thread */
+#endif
+
 // Add missing declarations (should be in procinfo.h but isn't until AIX 6.1).
 #if !defined(_AIXVERSION_610)
 extern "C" {
@@ -1072,15 +1078,19 @@ jlong os::elapsed_frequency() {
   return (1000 * 1000);
 }
 
-// For now, we say that linux does not support vtime. I have no idea
-// whether it can actually be made to (DLD, 9/13/05).
-
-bool os::supports_vtime() { return false; }
+bool os::supports_vtime() { return true; }
 bool os::enable_vtime()   { return false; }
 bool os::vtime_enabled()  { return false; }
+
 double os::elapsedVTime() {
-  // better than nothing, but not much
-  return elapsedTime();
+  struct rusage usage;
+  int retval = getrusage(RUSAGE_THREAD, &usage);
+  if (retval == 0) {
+    return usage.ru_utime.tv_sec + usage.ru_stime.tv_sec + (usage.ru_utime.tv_usec + usage.ru_stime.tv_usec) / (1000.0 * 1000);
+  } else {
+    // better than nothing, but not much
+    return elapsedTime();
+  }
 }
 
 jlong os::javaTimeMillis() {

From 9cc6c5c2c5812587eb9be4ee97231704038d52a3 Mon Sep 17 00:00:00 2001
From: Mikael Auno <miauno@openjdk.org>
Date: Fri, 14 Nov 2014 10:22:43 +0100
Subject: [PATCH 084/299] 8064799: [TESTBUG] JT-Reg Serviceability tests to be
 run as part of JPRT submit job

Reviewed-by: sla, alanb, dholmes, sspitsyn
---
 jdk/test/TEST.groups | 59 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)

diff --git a/jdk/test/TEST.groups b/jdk/test/TEST.groups
index 6cee6e39d0d..b832f2335a4 100644
--- a/jdk/test/TEST.groups
+++ b/jdk/test/TEST.groups
@@ -290,6 +290,65 @@ jdk_desktop = \
     :jdk_sound \
     :jdk_imageio
 
+###############################################################################
+#
+# Serviceability sanity groups
+#
+# These groups specify a subset of Serviceability tests that are supposed to
+# guard against breakage of Serviceability features by other component teams.
+# They are added to the "hotspot" testset in JPRT so that they will run on all
+# full-forest pushes through JPRT.
+#
+
+jdk_svc_sanity = \
+    :jdk_management_sanity \
+    :jdk_instrument_sanity \
+    :jdk_jmx_sanity \
+    :jdk_jdi_sanity \
+    :svc_tools_sanity
+
+jdk_management_sanity =
+
+jdk_instrument_sanity =
+
+jdk_jmx_sanity =
+
+jdk_jdi_sanity = \
+    com/sun/jdi/AcceptTimeout.java \
+    com/sun/jdi/AccessSpecifierTest.java \
+    com/sun/jdi/AfterThreadDeathTest.java \
+    com/sun/jdi/ArrayRangeTest.java \
+    com/sun/jdi/ConstantPoolInfo.java \
+    com/sun/jdi/CountFilterTest.java \
+    com/sun/jdi/EarlyReturnNegativeTest.java \
+    com/sun/jdi/EarlyReturnTest.java \
+    com/sun/jdi/FieldWatchpoints.java \
+    com/sun/jdi/FramesTest.java \
+    com/sun/jdi/InstanceFilter.java \
+    com/sun/jdi/InterfaceMethodsTest.java \
+    com/sun/jdi/InvokeTest.java \
+    com/sun/jdi/LocalVariableEqual.java \
+    com/sun/jdi/LocationTest.java \
+    com/sun/jdi/ModificationWatchpoints.java \
+    com/sun/jdi/MonitorEventTest.java \
+    com/sun/jdi/MonitorFrameInfo.java \
+    com/sun/jdi/NullThreadGroupNameTest.java \
+    com/sun/jdi/PopAndStepTest.java \
+    com/sun/jdi/PopAsynchronousTest.java \
+    com/sun/jdi/ProcessAttachTest.java \
+    com/sun/jdi/ReferrersTest.java \
+    com/sun/jdi/RequestReflectionTest.java \
+    com/sun/jdi/ResumeOneThreadTest.java \
+    com/sun/jdi/RunToExit.java \
+    com/sun/jdi/SourceNameFilterTest.java \
+    com/sun/jdi/VarargsTest.java \
+    com/sun/jdi/Vars.java \
+    com/sun/jdi/redefineMethod/RedefineTest.java \
+    com/sun/jdi/sde/MangleTest.java \
+    com/sun/jdi/sde/TemperatureTableTest.java
+
+svc_tools_sanity =
+
 #############################
 #
 # Stable test groups

From e158f32141f6c06346fb4e062bd7dd0ce40166ac Mon Sep 17 00:00:00 2001
From: Jan Lahoda <jlahoda@openjdk.org>
Date: Fri, 14 Nov 2014 11:58:28 +0100
Subject: [PATCH 085/299] 8062747: Compiler error when anonymous class uses
 method with parametrized exception

When inferring lambda's thrown types, avoid tracking variables that are not under the lambda to avoid crashes.

Reviewed-by: vromero
---
 .../com/sun/tools/javac/comp/Flow.java        |  8 ++++++-
 langtools/test/tools/javac/flow/T8062747.java | 24 +++++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletion(-)
 create mode 100644 langtools/test/tools/javac/flow/T8062747.java

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java
index 36dae43110b..092fa8ac234 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java
@@ -242,9 +242,15 @@ public class Flow {
         Log.DiagnosticHandler diagHandler = new Log.DiscardDiagnosticHandler(log);
         try {
             new AssignAnalyzer() {
+                WriteableScope enclosedSymbols = WriteableScope.create(env.enclClass.sym);
+                @Override
+                public void visitVarDef(JCVariableDecl tree) {
+                    enclosedSymbols.enter(tree.sym);
+                    super.visitVarDef(tree);
+                }
                 @Override
                 protected boolean trackable(VarSymbol sym) {
-                    return !env.info.scope.includes(sym) &&
+                    return enclosedSymbols.includes(sym) &&
                            sym.owner.kind == MTH;
                 }
             }.analyzeTree(env, that);
diff --git a/langtools/test/tools/javac/flow/T8062747.java b/langtools/test/tools/javac/flow/T8062747.java
new file mode 100644
index 00000000000..857474216d5
--- /dev/null
+++ b/langtools/test/tools/javac/flow/T8062747.java
@@ -0,0 +1,24 @@
+/**
+ * @test
+ * @bug 8062747
+ * @summary Avoiding an error for lambdas with thrown types inference inside an anonymous class.
+ * @compile T8062747.java
+ */
+public class T8062747 {
+
+    public interface Throwing<Y extends Exception> {
+        void canThrow() throws Y;
+    }
+
+    public static <Y extends Exception> void wrap(Throwing<Y> action) {
+    }
+
+    public static void invoke(String a) {
+        Runnable r = new Runnable() {
+            @Override
+            public void run() {
+                wrap(() -> System.out.println(a));
+            }
+        };
+    }
+}

From 24c525eb116137aaebbd373e6ce22f1f7f799d25 Mon Sep 17 00:00:00 2001
From: Petr Pchelko <pchelko@openjdk.org>
Date: Fri, 14 Nov 2014 16:19:40 +0400
Subject: [PATCH 086/299] 8023723: Can not paste and copy the text from the
 text area into the editor

Reviewed-by: serb, alexsch
---
 .../META-INF/services/sun.datatransfer.DesktopDatatransferService | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 rename jdk/src/java.desktop/share/classes/{sun/awt/datatransfer => }/META-INF/services/sun.datatransfer.DesktopDatatransferService (100%)

diff --git a/jdk/src/java.desktop/share/classes/sun/awt/datatransfer/META-INF/services/sun.datatransfer.DesktopDatatransferService b/jdk/src/java.desktop/share/classes/META-INF/services/sun.datatransfer.DesktopDatatransferService
similarity index 100%
rename from jdk/src/java.desktop/share/classes/sun/awt/datatransfer/META-INF/services/sun.datatransfer.DesktopDatatransferService
rename to jdk/src/java.desktop/share/classes/META-INF/services/sun.datatransfer.DesktopDatatransferService

From da1287a38fd498ca58db1d7dace53816e5faa8b4 Mon Sep 17 00:00:00 2001
From: Andrey Zakharov <azakharov@openjdk.org>
Date: Fri, 14 Nov 2014 17:36:56 +0400
Subject: [PATCH 087/299] 8064716: TestHumongousShrinkHeap.java can not be run
 with -XX:+ExplicitGCInvokesConcurrent 8062957: Heap is not shrunk when
 deallocating under memory pressure

Added explicit -XX:-ExplicitGCInvokesConcurrent to invocations

Reviewed-by: brutisso, tschatzl
---
 hotspot/test/gc/g1/TestHumongousShrinkHeap.java    | 7 +++++--
 hotspot/test/gc/g1/TestShrinkAuxiliaryData.java    | 1 +
 hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java | 1 +
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java
index 97d60546b25..b350bcd8611 100644
--- a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java
+++ b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java
@@ -24,9 +24,12 @@
 /**
  * @test TestHumongousShrinkHeap
  * @bug 8036025 8056043
- * @summary Verify that heap shrinks after GC in the presence of fragmentation due to humongous objects
+ * @summary Verify that heap shrinks after GC in the presence of fragmentation
+ * due to humongous objects
  * @library /testlibrary
- * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc TestHumongousShrinkHeap
+ * @run main/othervm -XX:-ExplicitGCInvokesConcurrent -XX:MinHeapFreeRatio=10
+ * -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc
+ * TestHumongousShrinkHeap
  */
 
 import java.lang.management.ManagementFactory;
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
index a185fe5d4e8..cba813882a5 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
@@ -45,6 +45,7 @@ public class TestShrinkAuxiliaryData {
         "-XX:MaxHeapFreeRatio=11",
         "-XX:+UseG1GC",
         "-XX:G1HeapRegionSize=1m",
+        "-XX:-ExplicitGCInvokesConcurrent",
         "-XX:+PrintGCDetails"
     };
 
diff --git a/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java b/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java
index 94eb690e97d..c23c8721af3 100644
--- a/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java
+++ b/hotspot/test/gc/g1/TestShrinkDefragmentedHeap.java
@@ -59,6 +59,7 @@ public class TestShrinkDefragmentedHeap {
                 "-XX:MaxHeapFreeRatio=11",
                 "-XX:+UseG1GC",
                 "-XX:G1HeapRegionSize=" + REGION_SIZE,
+                "-XX:-ExplicitGCInvokesConcurrent",
                 "-verbose:gc",
                 GCTest.class.getName()
         );

From 5b4a9bc9764355ca732617c6a65e94e044fe13df Mon Sep 17 00:00:00 2001
From: Anton Nashatyrev <anashaty@openjdk.org>
Date: Fri, 14 Nov 2014 17:53:46 +0300
Subject: [PATCH 088/299] 8059739: Dragged and Dropped data is corrupted for
 two data types

Reviewed-by: serb, pchelko
---
 .../swing/plaf/basic/BasicTransferable.java   | 15 +++-
 .../DataTransfer/8059739/bug8059739.java      | 80 +++++++++++++++++++
 2 files changed, 93 insertions(+), 2 deletions(-)
 create mode 100644 jdk/test/javax/swing/DataTransfer/8059739/bug8059739.java

diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java
index 7ed4e3d53ba..544c2ebe731 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTransferable.java
@@ -24,6 +24,8 @@
  */
 package javax.swing.plaf.basic;
 
+import sun.datatransfer.DataFlavorUtil;
+
 import java.io.*;
 import java.awt.datatransfer.*;
 import javax.swing.plaf.UIResource;
@@ -145,7 +147,7 @@ class BasicTransferable implements Transferable, UIResource {
             } else if (Reader.class.equals(flavor.getRepresentationClass())) {
                 return new StringReader(data);
             } else if (InputStream.class.equals(flavor.getRepresentationClass())) {
-                return new StringBufferInputStream(data);
+                return createInputStream(flavor, data);
             }
             // fall through to unsupported
         } else if (isPlainFlavor(flavor)) {
@@ -156,7 +158,7 @@ class BasicTransferable implements Transferable, UIResource {
             } else if (Reader.class.equals(flavor.getRepresentationClass())) {
                 return new StringReader(data);
             } else if (InputStream.class.equals(flavor.getRepresentationClass())) {
-                return new StringBufferInputStream(data);
+                return createInputStream(flavor, data);
             }
             // fall through to unsupported
 
@@ -168,6 +170,15 @@ class BasicTransferable implements Transferable, UIResource {
         throw new UnsupportedFlavorException(flavor);
     }
 
+    private InputStream createInputStream(DataFlavor flavor, String data)
+            throws IOException, UnsupportedFlavorException {
+        String cs = DataFlavorUtil.getTextCharset(flavor);
+        if (cs == null) {
+            throw new UnsupportedFlavorException(flavor);
+        }
+        return new ByteArrayInputStream(data.getBytes(cs));
+    }
+
     // --- richer subclass flavors ----------------------------------------------
 
     protected boolean isRicherFlavor(DataFlavor flavor) {
diff --git a/jdk/test/javax/swing/DataTransfer/8059739/bug8059739.java b/jdk/test/javax/swing/DataTransfer/8059739/bug8059739.java
new file mode 100644
index 00000000000..b2b8bada4da
--- /dev/null
+++ b/jdk/test/javax/swing/DataTransfer/8059739/bug8059739.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2014, 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 8059739
+   @summary Dragged and Dropped data is corrupted for two data types
+   @author Anton Nashatyrev
+*/
+
+import javax.swing.*;
+import java.awt.datatransfer.Clipboard;
+import java.awt.datatransfer.DataFlavor;
+import java.io.BufferedReader;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+
+public class bug8059739 {
+
+    private static boolean passed = true;
+
+    public static void main(String[] args) throws Exception {
+        SwingUtilities.invokeAndWait(new Runnable() {
+            @Override
+            public void run() {
+                try {
+                    runTest();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                    passed = false;
+                }
+            }
+        });
+
+        if (!passed) {
+            throw new RuntimeException("Test FAILED.");
+        } else {
+            System.out.println("Passed.");
+        }
+    }
+
+    private static void runTest() throws Exception {
+        String testString = "my string";
+        JTextField tf = new JTextField(testString);
+        tf.selectAll();
+        Clipboard clipboard = new Clipboard("clip");
+        tf.getTransferHandler().exportToClipboard(tf, clipboard, TransferHandler.COPY);
+        DataFlavor[] dfs = clipboard.getAvailableDataFlavors();
+        for (DataFlavor df: dfs) {
+            String charset = df.getParameter("charset");
+            if (InputStream.class.isAssignableFrom(df.getRepresentationClass()) &&
+                    charset != null) {
+                BufferedReader br = new BufferedReader(new InputStreamReader(
+                        (InputStream) clipboard.getData(df), charset));
+                String s = br.readLine();
+                System.out.println("Content: '" + s + "'");
+                passed &= s.contains(testString);
+            }
+        }
+    }
+}

From 477b157f387116cf14f674e166eed72adce2363b Mon Sep 17 00:00:00 2001
From: Claes Redestad <redestad@openjdk.org>
Date: Mon, 17 Nov 2014 23:56:53 +0100
Subject: [PATCH 089/299] 8065070: (fmt) Avoid creating substrings when
 building FormatSpecifier

Reviewed-by: martin, shade
---
 .../share/classes/java/util/Formatter.java    | 41 +++++++++----------
 1 file changed, 19 insertions(+), 22 deletions(-)

diff --git a/jdk/src/java.base/share/classes/java/util/Formatter.java b/jdk/src/java.base/share/classes/java/util/Formatter.java
index a12952bde02..70298d5b59f 100644
--- a/jdk/src/java.base/share/classes/java/util/Formatter.java
+++ b/jdk/src/java.base/share/classes/java/util/Formatter.java
@@ -2624,10 +2624,11 @@ public final class Formatter implements Closeable, Flushable {
         private boolean dt = false;
         private char c;
 
-        private int index(String s) {
-            if (s != null) {
+        private int index(String s, int start, int end) {
+            if (start >= 0) {
                 try {
-                    index = Integer.parseInt(s.substring(0, s.length() - 1));
+                    // skip the trailing '$'
+                    index = Integer.parseInt(s, start, end - 1, 10);
                 } catch (NumberFormatException x) {
                     assert(false);
                 }
@@ -2648,11 +2649,11 @@ public final class Formatter implements Closeable, Flushable {
             return f;
         }
 
-        private int width(String s) {
+        private int width(String s, int start, int end) {
             width = -1;
-            if (s != null) {
+            if (start >= 0) {
                 try {
-                    width  = Integer.parseInt(s);
+                    width = Integer.parseInt(s, start, end, 10);
                     if (width < 0)
                         throw new IllegalFormatWidthException(width);
                 } catch (NumberFormatException x) {
@@ -2662,12 +2663,12 @@ public final class Formatter implements Closeable, Flushable {
             return width;
         }
 
-        private int precision(String s) {
+        private int precision(String s, int start, int end) {
             precision = -1;
-            if (s != null) {
+            if (start >= 0) {
                 try {
-                    // remove the '.'
-                    precision = Integer.parseInt(s.substring(1));
+                    // skip the leading '.'
+                    precision = Integer.parseInt(s, start + 1, end, 10);
                     if (precision < 0)
                         throw new IllegalFormatPrecisionException(precision);
                 } catch (NumberFormatException x) {
@@ -2695,23 +2696,19 @@ public final class Formatter implements Closeable, Flushable {
         }
 
         FormatSpecifier(String s, Matcher m) {
-            int idx = 1;
+            index(s, m.start(1), m.end(1));
+            flags(s, m.start(2), m.end(2));
+            width(s, m.start(3), m.end(3));
+            precision(s, m.start(4), m.end(4));
 
-            index(m.group(idx++));
-            flags(s, m.start(idx), m.end(idx++));
-            width(m.group(idx++));
-            precision(m.group(idx++));
-
-            int tTStart = m.start(idx);
-            int tTEnd = m.end(idx++);
-            if (tTStart != -1 && tTEnd != -1) {
+            int tTStart = m.start(5);
+            if (tTStart >= 0) {
                 dt = true;
-                if (tTStart == tTEnd - 1 && s.charAt(tTStart) == 'T') {
+                if (s.charAt(tTStart) == 'T') {
                     f.add(Flags.UPPERCASE);
                 }
             }
-
-            conversion(s.charAt(m.start(idx)));
+            conversion(s.charAt(m.start(6)));
 
             if (dt)
                 checkDateTime();

From 53906a2cb4cc06f0817d97be68a405c60edf5efa Mon Sep 17 00:00:00 2001
From: Roger Riggs <rriggs@openjdk.org>
Date: Wed, 19 Nov 2014 21:22:22 -0500
Subject: [PATCH 090/299] 8064932: java/lang/ProcessBuilder/Basic.java: waitFor
 didn't take long enough

Reviewed-by: dholmes, martin
---
 .../unix/classes/java/lang/UNIXProcess.java    | 17 ++++++++++-------
 .../windows/classes/java/lang/ProcessImpl.java | 18 ++++++++++++++----
 2 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/jdk/src/java.base/unix/classes/java/lang/UNIXProcess.java b/jdk/src/java.base/unix/classes/java/lang/UNIXProcess.java
index 85f15407c8f..d3adac90cd2 100644
--- a/jdk/src/java.base/unix/classes/java/lang/UNIXProcess.java
+++ b/jdk/src/java.base/unix/classes/java/lang/UNIXProcess.java
@@ -406,14 +406,17 @@ final class UNIXProcess extends Process {
         if (hasExited) return true;
         if (timeout <= 0) return false;
 
-        long timeoutAsNanos = unit.toNanos(timeout);
-        long startTime = System.nanoTime();
-        long rem = timeoutAsNanos;
+        long remainingNanos = unit.toNanos(timeout);
+        long deadline = System.nanoTime() + remainingNanos;
 
-        while (!hasExited && (rem > 0)) {
-            wait(Math.max(TimeUnit.NANOSECONDS.toMillis(rem), 1));
-            rem = timeoutAsNanos - (System.nanoTime() - startTime);
-        }
+        do {
+            // Round up to next millisecond
+            wait(TimeUnit.NANOSECONDS.toMillis(remainingNanos + 999_999L));
+            if (hasExited) {
+                return true;
+            }
+            remainingNanos = deadline - System.nanoTime();
+        } while (remainingNanos > 0);
         return hasExited;
     }
 
diff --git a/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java b/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java
index 02e0c7bf346..ec90ea0da3a 100644
--- a/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java
+++ b/jdk/src/java.base/windows/classes/java/lang/ProcessImpl.java
@@ -461,11 +461,21 @@ final class ProcessImpl extends Process {
         if (getExitCodeProcess(handle) != STILL_ACTIVE) return true;
         if (timeout <= 0) return false;
 
-        long msTimeout = unit.toMillis(timeout);
+        long remainingNanos  = unit.toNanos(timeout);
+        long deadline = System.nanoTime() + remainingNanos ;
+
+        do {
+            // Round up to next millisecond
+            long msTimeout = TimeUnit.NANOSECONDS.toMillis(remainingNanos + 999_999L);
+            waitForTimeoutInterruptibly(handle, msTimeout);
+            if (Thread.interrupted())
+                throw new InterruptedException();
+            if (getExitCodeProcess(handle) != STILL_ACTIVE) {
+                return true;
+            }
+            remainingNanos = deadline - System.nanoTime();
+        } while (remainingNanos > 0);
 
-        waitForTimeoutInterruptibly(handle, msTimeout);
-        if (Thread.interrupted())
-            throw new InterruptedException();
         return (getExitCodeProcess(handle) != STILL_ACTIVE);
     }
 

From d5aaa2d8ffcc9fe9d6df7927089db4af38ee1f61 Mon Sep 17 00:00:00 2001
From: Roger Riggs <rriggs@openjdk.org>
Date: Wed, 19 Nov 2014 21:28:26 -0500
Subject: [PATCH 091/299] 8065372: Object.wait(ms, ns) timeout returns early

Reviewed-by: martin, dholmes
---
 jdk/src/java.base/share/classes/java/lang/Object.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/src/java.base/share/classes/java/lang/Object.java b/jdk/src/java.base/share/classes/java/lang/Object.java
index bf6133109d5..04ca33153d6 100644
--- a/jdk/src/java.base/share/classes/java/lang/Object.java
+++ b/jdk/src/java.base/share/classes/java/lang/Object.java
@@ -453,7 +453,7 @@ public class Object {
                                 "nanosecond timeout value out of range");
         }
 
-        if (nanos >= 500000 || (nanos != 0 && timeout == 0)) {
+        if (nanos > 0) {
             timeout++;
         }
 

From f4aff4270865de2eb699c156269bd95685429c54 Mon Sep 17 00:00:00 2001
From: Brent Christian <bchristi@openjdk.org>
Date: Fri, 14 Nov 2014 13:46:19 -0800
Subject: [PATCH 092/299] 8064288: sun.management.Flag should loadLibrary()

Call System.loadLibrary("management") from Flag static initializer

Reviewed-by: mchung
---
 .../share/classes/sun/management/Flag.java                | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/jdk/src/java.management/share/classes/sun/management/Flag.java b/jdk/src/java.management/share/classes/sun/management/Flag.java
index 4f52cb51495..52da43e8408 100644
--- a/jdk/src/java.management/share/classes/sun/management/Flag.java
+++ b/jdk/src/java.management/share/classes/sun/management/Flag.java
@@ -28,6 +28,7 @@ package sun.management;
 import java.util.*;
 import com.sun.management.VMOption;
 import com.sun.management.VMOption.Origin;
+import java.security.AccessController;
 
 /**
  * Flag class is a helper class for constructing a VMOption.
@@ -115,6 +116,13 @@ class Flag {
     static synchronized native void setStringValue(String name, String value);
 
     static {
+        AccessController.doPrivileged(
+            new java.security.PrivilegedAction<Void>() {
+                public Void run() {
+                    System.loadLibrary("management");
+                    return null;
+                }
+            });
         initialize();
     }
     private static native void initialize();

From f50ee8896ab8c7fff4af38fc9d9ed86649a1c4f5 Mon Sep 17 00:00:00 2001
From: Claes Redestad <redestad@openjdk.org>
Date: Sun, 16 Nov 2014 15:03:46 +0100
Subject: [PATCH 093/299] 8058887: (fmt) Improve java/util/Formatter test
 coverage of group separators and width

Reviewed-by: sherman
---
 .../java/util/Formatter/Basic-X.java.template | 44 ++++++++-
 .../java/util/Formatter/BasicBigDecimal.java  | 73 ++++++++++++++-
 .../java/util/Formatter/BasicBigInteger.java  | 89 ++++++++++++++++++-
 .../java/util/Formatter/BasicBoolean.java     | 89 ++++++++++++++++++-
 .../util/Formatter/BasicBooleanObject.java    | 89 ++++++++++++++++++-
 jdk/test/java/util/Formatter/BasicByte.java   | 89 ++++++++++++++++++-
 .../java/util/Formatter/BasicByteObject.java  | 89 ++++++++++++++++++-
 jdk/test/java/util/Formatter/BasicChar.java   | 89 ++++++++++++++++++-
 .../java/util/Formatter/BasicCharObject.java  | 89 ++++++++++++++++++-
 .../java/util/Formatter/BasicDateTime.java    | 89 ++++++++++++++++++-
 jdk/test/java/util/Formatter/BasicDouble.java | 55 ++++++++++--
 .../util/Formatter/BasicDoubleObject.java     | 73 ++++++++++++++-
 jdk/test/java/util/Formatter/BasicFloat.java  | 73 ++++++++++++++-
 .../java/util/Formatter/BasicFloatObject.java | 73 ++++++++++++++-
 jdk/test/java/util/Formatter/BasicInt.java    | 89 ++++++++++++++++++-
 .../java/util/Formatter/BasicIntObject.java   | 89 ++++++++++++++++++-
 jdk/test/java/util/Formatter/BasicLong.java   | 89 ++++++++++++++++++-
 .../java/util/Formatter/BasicLongObject.java  | 89 ++++++++++++++++++-
 jdk/test/java/util/Formatter/BasicShort.java  | 89 ++++++++++++++++++-
 .../java/util/Formatter/BasicShortObject.java | 89 ++++++++++++++++++-
 jdk/test/java/util/Formatter/genBasic.sh      |  2 +-
 21 files changed, 1614 insertions(+), 25 deletions(-)

diff --git a/jdk/test/java/util/Formatter/Basic-X.java.template b/jdk/test/java/util/Formatter/Basic-X.java.template
index 2393cfaa59b..47c5516be49 100644
--- a/jdk/test/java/util/Formatter/Basic-X.java.template
+++ b/jdk/test/java/util/Formatter/Basic-X.java.template
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class Basic$Type$ extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class Basic$Type$ extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -572,6 +580,14 @@ public class Basic$Type$ extends Basic {
         test("%(10d", "   (12345)", negate(oneToFive));
         test("%-10d", "12345     ", oneToFive);
         test("%-10d", "-12345    ", negate(oneToFive));
+        // , variations:
+        test("% ,d", " 12,345", oneToFive);
+        test("% ,d", "-12,345", negate(oneToFive));
+        test("%0,10d", "000012,345", oneToFive);
+        test("%0,10d", "-00012,345", negate(oneToFive));
+        test("%(,10d", "  (12,345)", negate(oneToFive));
+        test("%-,10d", "12,345    ", oneToFive);
+        test("%-,10d", "-12,345   ", negate(oneToFive));
 
 #else[short]
 #if[prim]
@@ -594,6 +610,16 @@ public class Basic$Type$ extends Basic {
         test("%(10d", " (1234567)", negate(oneToSeven));
         test("%-10d", "1234567   ", oneToSeven);
         test("%-10d", "-1234567  ", negate(oneToSeven));
+        // , variations:
+        test("% ,d", " 1,234,567", oneToSeven);
+        test("% ,d", "-1,234,567", negate(oneToSeven));
+        test("%+,10d", "+1,234,567", oneToSeven);
+        test("%0,10d", "01,234,567", oneToSeven);
+        test("%0,10d", "-1,234,567", negate(oneToSeven));
+        test("%(,10d", "(1,234,567)", negate(oneToSeven));
+        test("%-,10d", "1,234,567 ", oneToSeven);
+        test("%-,10d", "-1,234,567", negate(oneToSeven));
+
 #end[prim]
 #end[short]
 #end[byte]
@@ -781,6 +807,14 @@ public class Basic$Type$ extends Basic {
         test("%+d", "-1234567", new BigInteger("-1234567", 10));
         test("%-10d", "1234567   ", new BigInteger("1234567", 10));
         test("%-10d", "-1234567  ", new BigInteger("-1234567", 10));
+        // , variations:
+        test("%0,10d", "01,234,567", new BigInteger("1234567", 10));
+        test("%0,10d", "-1,234,567", new BigInteger("-1234567", 10));
+        test("%(,10d", "(1,234,567)", new BigInteger("-1234567", 10));
+        test("%+,d", "+1,234,567", new BigInteger("1234567", 10));
+        test("%+,d", "-1,234,567", new BigInteger("-1234567", 10));
+        test("%-,10d", "1,234,567 ", new BigInteger("1234567", 10));
+        test("%-,10d", "-1,234,567", new BigInteger("-1234567", 10));
 
         //---------------------------------------------------------------------
         // %o - BigInteger
@@ -1039,6 +1073,14 @@ public class Basic$Type$ extends Basic {
         test("%3.0f", "1000000",   1000000.00);
         test("%3.0f", "10000000",  10000000.00);
         test("%3.0f", "100000000", 100000000.00);
+        test("%10.0f", "   1000000",   1000000.00);
+        test("%,10.0f", " 1,000,000",   1000000.00);
+        test("%,10.1f", "1,000,000.0",   1000000.00);
+        test("%,3.0f", "1,000,000",   1000000.00);
+        test("%,3.0f", "10,000,000",  10000000.00);
+        test("%,3.0f", "100,000,000", 100000000.00);
+        test("%,3.0f", "10,000,000",  10000000.00);
+        test("%,3.0f", "100,000,000", 100000000.00);
 #if[BigDecimal]
         //---------------------------------------------------------------------
         // %f - BigDecimal
diff --git a/jdk/test/java/util/Formatter/BasicBigDecimal.java b/jdk/test/java/util/Formatter/BasicBigDecimal.java
index a622e5afd02..00a04f4535f 100644
--- a/jdk/test/java/util/Formatter/BasicBigDecimal.java
+++ b/jdk/test/java/util/Formatter/BasicBigDecimal.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicBigDecimal extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicBigDecimal extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -810,6 +818,32 @@ public class BasicBigDecimal extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -1039,6 +1073,14 @@ public class BasicBigDecimal extends Basic {
         test("%3.0f", "1000000",   1000000.00);
         test("%3.0f", "10000000",  10000000.00);
         test("%3.0f", "100000000", 100000000.00);
+        test("%10.0f", "   1000000",   1000000.00);
+        test("%,10.0f", " 1,000,000",   1000000.00);
+        test("%,10.1f", "1,000,000.0",   1000000.00);
+        test("%,3.0f", "1,000,000",   1000000.00);
+        test("%,3.0f", "10,000,000",  10000000.00);
+        test("%,3.0f", "100,000,000", 100000000.00);
+        test("%,3.0f", "10,000,000",  10000000.00);
+        test("%,3.0f", "100,000,000", 100000000.00);
 
         //---------------------------------------------------------------------
         // %f - BigDecimal
@@ -1330,6 +1372,35 @@ public class BasicBigDecimal extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicBigInteger.java b/jdk/test/java/util/Formatter/BasicBigInteger.java
index af3cac5e47b..aceecc67c81 100644
--- a/jdk/test/java/util/Formatter/BasicBigInteger.java
+++ b/jdk/test/java/util/Formatter/BasicBigInteger.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicBigInteger extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicBigInteger extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -735,6 +743,24 @@ public class BasicBigInteger extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -781,6 +807,14 @@ public class BasicBigInteger extends Basic {
         test("%+d", "-1234567", new BigInteger("-1234567", 10));
         test("%-10d", "1234567   ", new BigInteger("1234567", 10));
         test("%-10d", "-1234567  ", new BigInteger("-1234567", 10));
+        // , variations:
+        test("%0,10d", "01,234,567", new BigInteger("1234567", 10));
+        test("%0,10d", "-1,234,567", new BigInteger("-1234567", 10));
+        test("%(,10d", "(1,234,567)", new BigInteger("-1234567", 10));
+        test("%+,d", "+1,234,567", new BigInteger("1234567", 10));
+        test("%+,d", "-1,234,567", new BigInteger("-1234567", 10));
+        test("%-,10d", "1,234,567 ", new BigInteger("1234567", 10));
+        test("%-,10d", "-1,234,567", new BigInteger("-1234567", 10));
 
         //---------------------------------------------------------------------
         // %o - BigInteger
@@ -1552,6 +1586,59 @@ public class BasicBigInteger extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicBoolean.java b/jdk/test/java/util/Formatter/BasicBoolean.java
index 192a2192460..83f8accb1ab 100644
--- a/jdk/test/java/util/Formatter/BasicBoolean.java
+++ b/jdk/test/java/util/Formatter/BasicBoolean.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicBoolean extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicBoolean extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -1552,6 +1560,85 @@ public class BasicBoolean extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicBooleanObject.java b/jdk/test/java/util/Formatter/BasicBooleanObject.java
index 830fe729788..86b940591d3 100644
--- a/jdk/test/java/util/Formatter/BasicBooleanObject.java
+++ b/jdk/test/java/util/Formatter/BasicBooleanObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicBooleanObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicBooleanObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -1552,6 +1560,85 @@ public class BasicBooleanObject extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicByte.java b/jdk/test/java/util/Formatter/BasicByte.java
index 4887e948b11..663153f6bd2 100644
--- a/jdk/test/java/util/Formatter/BasicByte.java
+++ b/jdk/test/java/util/Formatter/BasicByte.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicByte extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicByte extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -578,6 +586,24 @@ public class BasicByte extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -1552,6 +1578,67 @@ public class BasicByte extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicByteObject.java b/jdk/test/java/util/Formatter/BasicByteObject.java
index 9a6dd23adbc..ac4aef83571 100644
--- a/jdk/test/java/util/Formatter/BasicByteObject.java
+++ b/jdk/test/java/util/Formatter/BasicByteObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicByteObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicByteObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -578,6 +586,24 @@ public class BasicByteObject extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -1552,6 +1578,67 @@ public class BasicByteObject extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicChar.java b/jdk/test/java/util/Formatter/BasicChar.java
index 8fe4bd52323..ce0e5311b09 100644
--- a/jdk/test/java/util/Formatter/BasicChar.java
+++ b/jdk/test/java/util/Formatter/BasicChar.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicChar extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicChar extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -1552,6 +1560,85 @@ public class BasicChar extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicCharObject.java b/jdk/test/java/util/Formatter/BasicCharObject.java
index 744103e8bd2..e1baf82cb80 100644
--- a/jdk/test/java/util/Formatter/BasicCharObject.java
+++ b/jdk/test/java/util/Formatter/BasicCharObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicCharObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicCharObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -1552,6 +1560,85 @@ public class BasicCharObject extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicDateTime.java b/jdk/test/java/util/Formatter/BasicDateTime.java
index 131d7234b65..f31238189d8 100644
--- a/jdk/test/java/util/Formatter/BasicDateTime.java
+++ b/jdk/test/java/util/Formatter/BasicDateTime.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicDateTime extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicDateTime extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -1552,6 +1560,85 @@ public class BasicDateTime extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicDouble.java b/jdk/test/java/util/Formatter/BasicDouble.java
index 4d3bcae836e..11760f17f7f 100644
--- a/jdk/test/java/util/Formatter/BasicDouble.java
+++ b/jdk/test/java/util/Formatter/BasicDouble.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,6 +36,9 @@ import java.math.BigInteger;
 import java.text.DateFormatSymbols;
 import java.util.*;
 
+import sun.misc.DoubleConsts;
+
+
 import static java.util.Calendar.*;
 
 
@@ -48,6 +51,10 @@ public class BasicDouble extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -55,6 +62,10 @@ public class BasicDouble extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -838,6 +849,32 @@ public class BasicDouble extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -1036,6 +1073,14 @@ public class BasicDouble extends Basic {
         test("%3.0f", "1000000",   1000000.00);
         test("%3.0f", "10000000",  10000000.00);
         test("%3.0f", "100000000", 100000000.00);
+        test("%10.0f", "   1000000",   1000000.00);
+        test("%,10.0f", " 1,000,000",   1000000.00);
+        test("%,10.1f", "1,000,000.0",   1000000.00);
+        test("%,3.0f", "1,000,000",   1000000.00);
+        test("%,3.0f", "10,000,000",  10000000.00);
+        test("%,3.0f", "100,000,000", 100000000.00);
+        test("%,3.0f", "10,000,000",  10000000.00);
+        test("%,3.0f", "100,000,000", 100000000.00);
 
 
 
@@ -1310,12 +1355,12 @@ public class BasicDouble extends Basic {
         test("%.1a", "-0x1.0p0", -1.0);
         test("%.11a", "0x1.80000000000p1", 3.0);
         test("%.1a", "0x1.8p1", 3.0);
-        test("%.11a", "0x1.00000000000p-1022", Double.MIN_NORMAL);
-        test("%.1a", "0x1.0p-1022", Double.MIN_NORMAL);
+        test("%.11a", "0x1.00000000000p-1022", DoubleConsts.MIN_NORMAL);
+        test("%.1a", "0x1.0p-1022", DoubleConsts.MIN_NORMAL);
         test("%.11a", "0x1.00000000000p-1022",
-             Math.nextDown(Double.MIN_NORMAL));
+             Math.nextDown(DoubleConsts.MIN_NORMAL));
         test("%.1a", "0x1.0p-1022",
-             Math.nextDown(Double.MIN_NORMAL));
+             Math.nextDown(DoubleConsts.MIN_NORMAL));
         test("%.11a", "0x1.ffffffffffep-1023", 0x0.fffffffffffp-1022);
         test("%.1a", "0x1.0p-1022", 0x0.fffffffffffp-1022);
         test("%.30a", "0x0.000000000000100000000000000000p-1022", Double.MIN_VALUE);
diff --git a/jdk/test/java/util/Formatter/BasicDoubleObject.java b/jdk/test/java/util/Formatter/BasicDoubleObject.java
index 8ecfc453d7a..3dea2a346b8 100644
--- a/jdk/test/java/util/Formatter/BasicDoubleObject.java
+++ b/jdk/test/java/util/Formatter/BasicDoubleObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicDoubleObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicDoubleObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -851,6 +859,32 @@ public class BasicDoubleObject extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -1039,6 +1073,14 @@ public class BasicDoubleObject extends Basic {
         test("%3.0f", "1000000",   1000000.00);
         test("%3.0f", "10000000",  10000000.00);
         test("%3.0f", "100000000", 100000000.00);
+        test("%10.0f", "   1000000",   1000000.00);
+        test("%,10.0f", " 1,000,000",   1000000.00);
+        test("%,10.1f", "1,000,000.0",   1000000.00);
+        test("%,3.0f", "1,000,000",   1000000.00);
+        test("%,3.0f", "10,000,000",  10000000.00);
+        test("%,3.0f", "100,000,000", 100000000.00);
+        test("%,3.0f", "10,000,000",  10000000.00);
+        test("%,3.0f", "100,000,000", 100000000.00);
 
 
 
@@ -1330,6 +1372,35 @@ public class BasicDoubleObject extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicFloat.java b/jdk/test/java/util/Formatter/BasicFloat.java
index 94eb867b4fb..0ac8a6f45f0 100644
--- a/jdk/test/java/util/Formatter/BasicFloat.java
+++ b/jdk/test/java/util/Formatter/BasicFloat.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicFloat extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicFloat extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -821,6 +829,32 @@ public class BasicFloat extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -1039,6 +1073,14 @@ public class BasicFloat extends Basic {
         test("%3.0f", "1000000",   1000000.00);
         test("%3.0f", "10000000",  10000000.00);
         test("%3.0f", "100000000", 100000000.00);
+        test("%10.0f", "   1000000",   1000000.00);
+        test("%,10.0f", " 1,000,000",   1000000.00);
+        test("%,10.1f", "1,000,000.0",   1000000.00);
+        test("%,3.0f", "1,000,000",   1000000.00);
+        test("%,3.0f", "10,000,000",  10000000.00);
+        test("%,3.0f", "100,000,000", 100000000.00);
+        test("%,3.0f", "10,000,000",  10000000.00);
+        test("%,3.0f", "100,000,000", 100000000.00);
 
 
 
@@ -1330,6 +1372,35 @@ public class BasicFloat extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicFloatObject.java b/jdk/test/java/util/Formatter/BasicFloatObject.java
index 5dd9c44efec..d9fb5de7aa4 100644
--- a/jdk/test/java/util/Formatter/BasicFloatObject.java
+++ b/jdk/test/java/util/Formatter/BasicFloatObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicFloatObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicFloatObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -831,6 +839,32 @@ public class BasicFloatObject extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -1039,6 +1073,14 @@ public class BasicFloatObject extends Basic {
         test("%3.0f", "1000000",   1000000.00);
         test("%3.0f", "10000000",  10000000.00);
         test("%3.0f", "100000000", 100000000.00);
+        test("%10.0f", "   1000000",   1000000.00);
+        test("%,10.0f", " 1,000,000",   1000000.00);
+        test("%,10.1f", "1,000,000.0",   1000000.00);
+        test("%,3.0f", "1,000,000",   1000000.00);
+        test("%,3.0f", "10,000,000",  10000000.00);
+        test("%,3.0f", "100,000,000", 100000000.00);
+        test("%,3.0f", "10,000,000",  10000000.00);
+        test("%,3.0f", "100,000,000", 100000000.00);
 
 
 
@@ -1330,6 +1372,35 @@ public class BasicFloatObject extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicInt.java b/jdk/test/java/util/Formatter/BasicInt.java
index cc71a40172f..7cef571e086 100644
--- a/jdk/test/java/util/Formatter/BasicInt.java
+++ b/jdk/test/java/util/Formatter/BasicInt.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicInt extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicInt extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -566,6 +574,14 @@ public class BasicInt extends Basic {
 
 
 
+
+
+
+
+
+
+
+
 
 
 
@@ -594,6 +610,16 @@ public class BasicInt extends Basic {
         test("%(10d", " (1234567)", negate(oneToSeven));
         test("%-10d", "1234567   ", oneToSeven);
         test("%-10d", "-1234567  ", negate(oneToSeven));
+        // , variations:
+        test("% ,d", " 1,234,567", oneToSeven);
+        test("% ,d", "-1,234,567", negate(oneToSeven));
+        test("%+,10d", "+1,234,567", oneToSeven);
+        test("%0,10d", "01,234,567", oneToSeven);
+        test("%0,10d", "-1,234,567", negate(oneToSeven));
+        test("%(,10d", "(1,234,567)", negate(oneToSeven));
+        test("%-,10d", "1,234,567 ", oneToSeven);
+        test("%-,10d", "-1,234,567", negate(oneToSeven));
+
 
 
 
@@ -1552,6 +1578,67 @@ public class BasicInt extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicIntObject.java b/jdk/test/java/util/Formatter/BasicIntObject.java
index 08b6bd56a5c..df2c2a26a63 100644
--- a/jdk/test/java/util/Formatter/BasicIntObject.java
+++ b/jdk/test/java/util/Formatter/BasicIntObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicIntObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicIntObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -578,6 +586,24 @@ public class BasicIntObject extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -1552,6 +1578,67 @@ public class BasicIntObject extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicLong.java b/jdk/test/java/util/Formatter/BasicLong.java
index b26d6b0a03d..bcac973aaa0 100644
--- a/jdk/test/java/util/Formatter/BasicLong.java
+++ b/jdk/test/java/util/Formatter/BasicLong.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicLong extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicLong extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -566,6 +574,14 @@ public class BasicLong extends Basic {
 
 
 
+
+
+
+
+
+
+
+
 
 
 
@@ -594,6 +610,16 @@ public class BasicLong extends Basic {
         test("%(10d", " (1234567)", negate(oneToSeven));
         test("%-10d", "1234567   ", oneToSeven);
         test("%-10d", "-1234567  ", negate(oneToSeven));
+        // , variations:
+        test("% ,d", " 1,234,567", oneToSeven);
+        test("% ,d", "-1,234,567", negate(oneToSeven));
+        test("%+,10d", "+1,234,567", oneToSeven);
+        test("%0,10d", "01,234,567", oneToSeven);
+        test("%0,10d", "-1,234,567", negate(oneToSeven));
+        test("%(,10d", "(1,234,567)", negate(oneToSeven));
+        test("%-,10d", "1,234,567 ", oneToSeven);
+        test("%-,10d", "-1,234,567", negate(oneToSeven));
+
 
 
 
@@ -1552,6 +1578,67 @@ public class BasicLong extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicLongObject.java b/jdk/test/java/util/Formatter/BasicLongObject.java
index 847b66c8db4..852bbc4127c 100644
--- a/jdk/test/java/util/Formatter/BasicLongObject.java
+++ b/jdk/test/java/util/Formatter/BasicLongObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicLongObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicLongObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -578,6 +586,24 @@ public class BasicLongObject extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -1552,6 +1578,67 @@ public class BasicLongObject extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicShort.java b/jdk/test/java/util/Formatter/BasicShort.java
index f2b61b121cc..04923018da5 100644
--- a/jdk/test/java/util/Formatter/BasicShort.java
+++ b/jdk/test/java/util/Formatter/BasicShort.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicShort extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicShort extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -572,6 +580,24 @@ public class BasicShort extends Basic {
         test("%(10d", "   (12345)", negate(oneToFive));
         test("%-10d", "12345     ", oneToFive);
         test("%-10d", "-12345    ", negate(oneToFive));
+        // , variations:
+        test("% ,d", " 12,345", oneToFive);
+        test("% ,d", "-12,345", negate(oneToFive));
+        test("%0,10d", "000012,345", oneToFive);
+        test("%0,10d", "-00012,345", negate(oneToFive));
+        test("%(,10d", "  (12,345)", negate(oneToFive));
+        test("%-,10d", "12,345    ", oneToFive);
+        test("%-,10d", "-12,345   ", negate(oneToFive));
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -1552,6 +1578,67 @@ public class BasicShort extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/BasicShortObject.java b/jdk/test/java/util/Formatter/BasicShortObject.java
index 1ed1263c729..1e8b7809a33 100644
--- a/jdk/test/java/util/Formatter/BasicShortObject.java
+++ b/jdk/test/java/util/Formatter/BasicShortObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,10 @@ public class BasicShortObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), Locale.US);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), Locale.US);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(Locale l, String fs, String exp, Object ... args)
@@ -58,6 +62,10 @@ public class BasicShortObject extends Basic {
         Formatter f = new Formatter(new StringBuilder(), l);
         f.format(fs, args);
         ck(fs, exp, f.toString());
+
+        f = new Formatter(new StringBuilder(), l);
+        f.format("foo " + fs + " bar", args);
+        ck(fs, "foo " + exp + " bar", f.toString());
     }
 
     private static void test(String fs, Object ... args) {
@@ -578,6 +586,24 @@ public class BasicShortObject extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
@@ -1552,6 +1578,67 @@ public class BasicShortObject extends Basic {
 
 
 
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
 
 
 
diff --git a/jdk/test/java/util/Formatter/genBasic.sh b/jdk/test/java/util/Formatter/genBasic.sh
index 0931cc15874..24bd5f786e0 100644
--- a/jdk/test/java/util/Formatter/genBasic.sh
+++ b/jdk/test/java/util/Formatter/genBasic.sh
@@ -23,7 +23,7 @@
 # questions.
 #
 
-javac -d . ../../../../make/tools/src/build/tools/spp/Spp.java
+javac -d . ../../../../make/src/classes/build/tools/spp/Spp.java
 
 gen() {
 #  if [ $3 = "true" ]

From f81bd8ff29e46c32439e51559916cc041eee087c Mon Sep 17 00:00:00 2001
From: Igor Ignatyev <iignatyev@openjdk.org>
Date: Mon, 17 Nov 2014 12:57:49 +0300
Subject: [PATCH 094/299] 8059732: improve hotspot_*test targets

Reviewed-by: kvn, dholmes
---
 hotspot/test/Makefile | 37 ++++++++++++++++++++++++-------------
 1 file changed, 24 insertions(+), 13 deletions(-)

diff --git a/hotspot/test/Makefile b/hotspot/test/Makefile
index 479851a3e5a..e0526fcf35c 100644
--- a/hotspot/test/Makefile
+++ b/hotspot/test/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,10 @@
 # Makefile to run various hotspot tests
 #
 
+ALT_MAKE ?= closed
+
+-include $(ALT_MAKE)/Makefile
+
 GETMIXEDPATH=echo
 
 # Utilities used
@@ -305,14 +309,27 @@ jtreg_tests: prep $(PRODUCT_HOME) $(JTREG)
 
 PHONY_LIST += jtreg_tests
 
+# flags used to execute java in test targets
+TEST_FLAGS += -version -Xinternalversion -X -help 
+
+sanitytest: prep $(PRODUCT_HOME)
+	@for flag in $(TEST_FLAGS);                                             \
+	do                                                                      \
+	    echo Executing java $(JAVA_OPTIONS) $$flag;                         \
+	    $(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) $$flag;                    \
+	    res=$$?;                                                            \
+	    if [ $$res -ne 0 ]; then                                            \
+	        exit $$res;                                                     \
+	    fi;                                                                 \
+	done
+
+PHONY_LIST += sanitytest
+
 ################################################################
 
 # clienttest (make sure various basic java client options work)
 
-hotspot_clienttest clienttest: prep $(PRODUCT_HOME)
-	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version
-	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help
-	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X
+hotspot_clienttest clienttest: sanitytest
 	$(RM) $(PRODUCT_HOME)/jre/lib/*/client/classes.jsa
 	$(RM) $(PRODUCT_HOME)/jre/bin/client/classes.jsa
 	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -Xshare:dump
@@ -323,10 +340,7 @@ PHONY_LIST += hotspot_clienttest clienttest
 
 # minimaltest (make sure various basic java minimal options work)
 
-hotspot_minimaltest minimaltest: prep $(PRODUCT_HOME)
-	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version
-	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help
-	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X
+hotspot_minimaltest minimaltest: sanitytest
 
 PHONY_LIST += hotspot_minimaltest minimaltest
 
@@ -334,10 +348,7 @@ PHONY_LIST += hotspot_minimaltest minimaltest
 
 # servertest (make sure various basic java server options work)
 
-hotspot_servertest servertest: prep $(PRODUCT_HOME)
-	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -version
-	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -help
-	$(PRODUCT_HOME)/bin/java $(JAVA_OPTIONS) -X
+hotspot_servertest servertest: sanitytest
 
 PHONY_LIST += hotspot_servertest servertest
 

From fdb39122a12686ade08ff71ab1309520d6ee19ad Mon Sep 17 00:00:00 2001
From: Aleksei Efimov <aefimov@openjdk.org>
Date: Mon, 17 Nov 2014 14:11:08 +0300
Subject: [PATCH 095/299] 8064914: tzdb.dat compilation failure when using
 tzdata2014j

Reviewed-by: sherman, coffeys
---
 .../build/tools/tzdb/TzdbZoneRulesProvider.java      | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java b/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java
index 220de9276c7..a59ce61eff9 100644
--- a/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java
+++ b/jdk/make/src/classes/build/tools/tzdb/TzdbZoneRulesProvider.java
@@ -95,7 +95,17 @@ class TzdbZoneRulesProvider {
                 obj = zones.get(zoneId);
             }
             if (obj == null) {
-                throw new ZoneRulesException("Unknown time-zone ID: " + zoneId0);
+                // Timezone link can be located in 'backward' file and it
+                // can refer to another link, so we need to check for
+                // link one more time, before throwing an exception
+                String zoneIdBack = zoneId;
+                if (links.containsKey(zoneId)) {
+                    zoneId = links.get(zoneId);
+                    obj = zones.get(zoneId);
+                }
+                if (obj == null) {
+                    throw new ZoneRulesException("Unknown time-zone ID: " + zoneIdBack);
+                }
             }
         }
         if (obj instanceof ZoneRules) {

From ee4d018bad9db3e102296ed419179080b72ae76e Mon Sep 17 00:00:00 2001
From: Aleksei Efimov <aefimov@openjdk.org>
Date: Mon, 17 Nov 2014 14:50:05 +0300
Subject: [PATCH 096/299] 8064560: (tz) Support tzdata2014j

Reviewed-by: okutsu
---
 jdk/make/data/tzdata/VERSION                  |   2 +-
 jdk/make/data/tzdata/africa                   |  79 +++-----
 jdk/make/data/tzdata/asia                     |  87 +++++----
 jdk/make/data/tzdata/australasia              |  12 +-
 jdk/make/data/tzdata/europe                   |  18 +-
 jdk/make/data/tzdata/leapseconds              |   4 +-
 jdk/make/data/tzdata/northamerica             |  20 ++-
 jdk/make/data/tzdata/southamerica             |  18 +-
 jdk/test/sun/util/calendar/zi/tzdata/VERSION  |   2 +-
 jdk/test/sun/util/calendar/zi/tzdata/africa   | 136 +++++---------
 jdk/test/sun/util/calendar/zi/tzdata/asia     | 169 ++++++++++++------
 .../sun/util/calendar/zi/tzdata/australasia   |  56 ++++--
 jdk/test/sun/util/calendar/zi/tzdata/europe   |  33 +++-
 .../sun/util/calendar/zi/tzdata/leapseconds   |   4 +-
 .../sun/util/calendar/zi/tzdata/northamerica  |  61 ++++---
 .../sun/util/calendar/zi/tzdata/southamerica  |  18 +-
 jdk/test/sun/util/calendar/zi/tzdata/zone.tab |   3 +-
 17 files changed, 407 insertions(+), 315 deletions(-)

diff --git a/jdk/make/data/tzdata/VERSION b/jdk/make/data/tzdata/VERSION
index fa498de5234..9987fde6dcb 100644
--- a/jdk/make/data/tzdata/VERSION
+++ b/jdk/make/data/tzdata/VERSION
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2014i
+tzdata2014j
diff --git a/jdk/make/data/tzdata/africa b/jdk/make/data/tzdata/africa
index 92c0d4728f3..43103225577 100644
--- a/jdk/make/data/tzdata/africa
+++ b/jdk/make/data/tzdata/africa
@@ -29,20 +29,19 @@
 # tz@iana.org for general use in the future).  For more, please see
 # the file CONTRIBUTING in the tz distribution.
 
-# From Paul Eggert (2013-02-21):
+# From Paul Eggert (2014-10-31):
 #
-# A good source for time zone historical data outside the U.S. is
+# Unless otherwise specified, the source for data through 1990 is:
 # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
 # San Diego: ACS Publications, Inc. (2003).
+# Unfortunately this book contains many errors and cites no sources.
 #
 # Gwillim Law writes that a good source
 # for recent time zone data is the International Air Transport
 # Association's Standard Schedules Information Manual (IATA SSIM),
 # published semiannually.  Law sent in several helpful summaries
-# of the IATA's data after 1990.
-#
-# Except where otherwise noted, Shanks & Pottenger is the source for
-# entries through 1990, and IATA SSIM is the source for entries afterwards.
+# of the IATA's data after 1990.  Except where otherwise noted,
+# IATA SSIM is the source for entries after 1990.
 #
 # Another source occasionally used is Edward W. Whitman, World Time Differences,
 # Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which
@@ -88,7 +87,6 @@
 #	 3:00	CAST	Central Africa Summer Time (no longer used)
 #	 3:00	SAST	South Africa Summer Time (no longer used)
 #	 3:00	EAT	East Africa Time
-#	 4:00	EAST	East Africa Summer Time (no longer used)
 
 # Algeria
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
@@ -169,9 +167,7 @@ Zone	Africa/Ndjamena	1:00:12 -	LMT	1912        # N'Djamena
 			1:00	-	WAT
 
 # Comoros
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Indian/Comoro	2:53:04 -	LMT	1911 Jul # Moroni, Gran Comoro
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 # Democratic Republic of the Congo
 # See Africa/Lagos for the western part and Africa/Maputo for the eastern.
@@ -195,9 +191,7 @@ Link Africa/Abidjan Africa/Sao_Tome	# São Tomé and Príncipe
 Link Africa/Abidjan Atlantic/St_Helena	# St Helena
 
 # Djibouti
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Djibouti	2:52:36 -	LMT	1911 Jul
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 ###############################################################################
 
@@ -410,27 +404,8 @@ Zone	Africa/Cairo	2:05:09 -	LMT	1900 Oct
 # See Africa/Lagos.
 
 # Eritrea
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Asmara	2:35:32 -	LMT	1870
-			2:35:32	-	AMT	1890        # Asmara Mean Time
-			2:35:20	-	ADMT	1936 May  5 # Adis Dera MT
-			3:00	-	EAT
-
 # Ethiopia
-# From Paul Eggert (2014-07-31):
-# Like the Swahili of Kenya and Tanzania, many Ethiopians keep a
-# 12-hour clock starting at our 06:00, so their "8 o'clock" is our
-# 02:00 or 14:00.  Keep this in mind when you ask the time in Amharic.
-#
-# Shanks & Pottenger write that Ethiopia had six narrowly-spaced time
-# zones between 1870 and 1890, that they merged to 38E50 (2:35:20) in
-# 1890, and that they switched to 3:00 on 1936-05-05.  Perhaps 38E50
-# was for Adis Dera.  Quite likely the Shanks data entries are wrong
-# anyway.
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Addis_Ababa	2:34:48 -	LMT	1870
-			2:35:20	-	ADMT	1936 May  5 # Adis Dera MT
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 # Gabon
 # See Africa/Lagos.
@@ -474,6 +449,15 @@ Zone	Africa/Nairobi	2:27:16	-	LMT	1928 Jul
 			2:30	-	BEAT	1940
 			2:45	-	BEAUT	1960
 			3:00	-	EAT
+Link Africa/Nairobi Africa/Addis_Ababa	 # Ethiopia
+Link Africa/Nairobi Africa/Asmara	 # Eritrea
+Link Africa/Nairobi Africa/Dar_es_Salaam # Tanzania
+Link Africa/Nairobi Africa/Djibouti
+Link Africa/Nairobi Africa/Kampala	 # Uganda
+Link Africa/Nairobi Africa/Mogadishu	 # Somalia
+Link Africa/Nairobi Indian/Antananarivo	 # Madagascar
+Link Africa/Nairobi Indian/Comoro
+Link Africa/Nairobi Indian/Mayotte
 
 # Lesotho
 # See Africa/Johannesburg.
@@ -551,11 +535,7 @@ Zone	Africa/Tripoli	0:52:44 -	LMT	1920
 			2:00	-	EET
 
 # Madagascar
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Indian/Antananarivo 3:10:04 -	LMT	1911 Jul
-			3:00	-	EAT	1954 Feb 27 23:00s
-			3:00	1:00	EAST	1954 May 29 23:00s
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 # Malawi
 # See Africa/Maputo.
@@ -658,9 +638,7 @@ Zone Indian/Mauritius	3:50:00 -	LMT	1907 # Port Louis
 # no information; probably like Indian/Mauritius
 
 # Mayotte
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Indian/Mayotte	3:00:56 -	LMT	1911 Jul # Mamoutzou
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 # Morocco
 # See the 'europe' file for Spanish Morocco (Africa/Ceuta).
@@ -1072,11 +1050,7 @@ Zone	Indian/Mahe	3:41:48 -	LMT	1906 Jun # Victoria
 # See Africa/Abidjan.
 
 # Somalia
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Mogadishu	3:01:28 -	LMT	1893 Nov
-			3:00	-	EAT	1931
-			2:30	-	BEAT	1957
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 # South Africa
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
@@ -1119,11 +1093,7 @@ Link Africa/Khartoum Africa/Juba
 # See Africa/Johannesburg.
 
 # Tanzania
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Dar_es_Salaam 2:37:08 -	LMT	1931
-			3:00	-	EAT	1948
-			2:45	-	BEAUT	1961
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 # Togo
 # See Africa/Abidjan.
@@ -1229,12 +1199,7 @@ Zone	Africa/Tunis	0:40:44 -	LMT	1881 May 12
 			1:00	Tunisia	CE%sT
 
 # Uganda
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Kampala	2:09:40 -	LMT	1928 Jul
-			3:00	-	EAT	1930
-			2:30	-	BEAT	1948
-			2:45	-	BEAUT	1957
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 # Zambia
 # Zimbabwe
diff --git a/jdk/make/data/tzdata/asia b/jdk/make/data/tzdata/asia
index 31754b2d567..960cab5062e 100644
--- a/jdk/make/data/tzdata/asia
+++ b/jdk/make/data/tzdata/asia
@@ -29,20 +29,19 @@
 # tz@iana.org for general use in the future).  For more, please see
 # the file CONTRIBUTING in the tz distribution.
 
-# From Paul Eggert (2013-08-11):
+# From Paul Eggert (2014-10-31):
 #
-# A good source for time zone historical data outside the U.S. is
+# Unless otherwise specified, the source for data through 1990 is:
 # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
 # San Diego: ACS Publications, Inc. (2003).
+# Unfortunately this book contains many errors and cites no sources.
 #
 # Gwillim Law writes that a good source
 # for recent time zone data is the International Air Transport
 # Association's Standard Schedules Information Manual (IATA SSIM),
 # published semiannually.  Law sent in several helpful summaries
-# of the IATA's data after 1990.
-#
-# Except where otherwise noted, Shanks & Pottenger is the source for
-# entries through 1990, and IATA SSIM is the source for entries afterwards.
+# of the IATA's data after 1990.  Except where otherwise noted,
+# IATA SSIM is the source for entries after 1990.
 #
 # Another source occasionally used is Edward W. Whitman, World Time Differences,
 # Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which
@@ -1686,44 +1685,70 @@ Zone	Asia/Bishkek	4:58:24 -	LMT	1924 May  2
 # Korea (North and South)
 
 # From Annie I. Bang (2006-07-10):
-# http://www.koreaherald.co.kr/SITE/data/html_dir/2006/07/10/200607100012.asp
-# The Ministry of Commerce, Industry and Energy has already
-# commissioned a research project [to reintroduce DST] and has said
-# the system may begin as early as 2008....  Korea ran a daylight
-# saving program from 1949-61 but stopped it during the 1950-53 Korean War.
+# http://www.koreaherald.com/view.php?ud=200607100012
+# Korea ran a daylight saving program from 1949-61 but stopped it
+# during the 1950-53 Korean War.  The system was temporarily enforced
+# between 1987 and 1988 ...
+
+# From Sanghyuk Jung (2014-10-29):
+# http://mm.icann.org/pipermail/tz/2014-October/021830.html
+# According to the Korean Wikipedia
+# http://ko.wikipedia.org/wiki/한국_표준시
+# [oldid=12896437 2014-09-04 08:03 UTC]
+# DST in Republic of Korea was as follows....  And I checked old
+# newspapers in Korean, all articles correspond with data in Wikipedia.
+# For example, the article in 1948 (Korean Language) proved that DST
+# started at June 1 in that year.  For another example, the article in
+# 1988 said that DST started at 2:00 AM in that year.
 
-# From Shanks & Pottenger:
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-Rule	ROK	1960	only	-	May	15	0:00	1:00	D
-Rule	ROK	1960	only	-	Sep	13	0:00	0	S
-Rule	ROK	1987	1988	-	May	Sun>=8	0:00	1:00	D
-Rule	ROK	1987	1988	-	Oct	Sun>=8	0:00	0	S
+Rule	ROK	1948	only	-	Jun	 1	0:00	1:00	D
+Rule	ROK	1948	only	-	Sep	13	0:00	0	S
+Rule	ROK	1949	only	-	Apr	 3	0:00	1:00	D
+Rule	ROK	1949	1951	-	Sep	Sun>=8	0:00	0	S
+Rule	ROK	1950	only	-	Apr	 1	0:00	1:00	D
+Rule	ROK	1951	only	-	May	 6	0:00	1:00	D
+Rule	ROK	1955	only	-	May	 5	0:00	1:00	D
+Rule	ROK	1955	only	-	Sep	 9	0:00	0	S
+Rule	ROK	1956	only	-	May	20	0:00	1:00	D
+Rule	ROK	1956	only	-	Sep	30	0:00	0	S
+Rule	ROK	1957	1960	-	May	Sun>=1	0:00	1:00	D
+Rule	ROK	1957	1960	-	Sep	Sun>=18	0:00	0	S
+Rule	ROK	1987	1988	-	May	Sun>=8	2:00	1:00	D
+Rule	ROK	1987	1988	-	Oct	Sun>=8	3:00	0	S
 
-# From Paul Eggert (2014-07-01):
-# The following entries are from Shanks & Pottenger, except that I
-# guessed that time zone abbreviations through 1945 followed the same
+# From Paul Eggert (2014-10-30):
+# The Korean Wikipedia entry gives the following sources for UT offsets:
+#
+# 1908: Official Journal Article No. 3994 (Edict No. 5)
+# 1912: Governor-General of Korea Official Gazette Issue No. 367
+#       (Announcement No. 338)
+# 1954: Presidential Decree No. 876 (1954-03-17)
+# 1961: Law No. 676 (1961-08-07)
+# 1987: Law No. 3919 (1986-12-31)
+#
+# The Wikipedia entry also has confusing information about a change
+# to UT+9 in April 1910, but then what would be the point of the later change
+# to UT+9 on 1912-01-01?  Omit the 1910 change for now.
+#
+# I guessed that time zone abbreviations through 1945 followed the same
 # rules as discussed under Taiwan, with nominal switches from JST to KST
 # when the respective cities were taken over by the Allies after WWII.
+#
+# For Pyongyang we have no information; guess no changes since World War II.
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Seoul	8:27:52	-	LMT	1890
-			8:30	-	KST	1904 Dec
-			9:00	-	JCST	1928
-			8:30	-	KST	1932
+Zone	Asia/Seoul	8:27:52	-	LMT	1908 Apr  1
+			8:30	-	KST	1912 Jan  1
 			9:00	-	JCST	1937 Oct  1
 			9:00	-	JST	1945 Sep  8
 			9:00	-	KST	1954 Mar 21
-			8:00	ROK	K%sT	1961 Aug 10
-			8:30	-	KST	1968 Oct
+			8:30	ROK	K%sT	1961 Aug 10
 			9:00	ROK	K%sT
-Zone	Asia/Pyongyang	8:23:00 -	LMT	1890
-			8:30	-	KST	1904 Dec
-			9:00	-	JCST	1928
-			8:30	-	KST	1932
+Zone	Asia/Pyongyang	8:23:00 -	LMT	1908 Apr  1
+			8:30	-	KST	1912 Jan  1
 			9:00	-	JCST	1937 Oct  1
 			9:00	-	JST	1945 Aug 24
-			9:00	-	KST	1954 Mar 21
-			8:00	-	KST	1961 Aug 10
 			9:00	-	KST
 
 ###############################################################################
diff --git a/jdk/make/data/tzdata/australasia b/jdk/make/data/tzdata/australasia
index c45680ace6a..f2a89e8ee37 100644
--- a/jdk/make/data/tzdata/australasia
+++ b/jdk/make/data/tzdata/australasia
@@ -820,19 +820,19 @@ Zone	Pacific/Wallis	12:15:20 -	LMT	1901
 # tz@iana.org for general use in the future).  For more, please see
 # the file CONTRIBUTING in the tz distribution.
 
-# From Paul Eggert (2013-02-21):
-# A good source for time zone historical data outside the U.S. is
+# From Paul Eggert (2014-10-31):
+#
+# Unless otherwise specified, the source for data through 1990 is:
 # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
 # San Diego: ACS Publications, Inc. (2003).
+# Unfortunately this book contains many errors and cites no sources.
 #
 # Gwillim Law writes that a good source
 # for recent time zone data is the International Air Transport
 # Association's Standard Schedules Information Manual (IATA SSIM),
 # published semiannually.  Law sent in several helpful summaries
-# of the IATA's data after 1990.
-#
-# Except where otherwise noted, Shanks & Pottenger is the source for
-# entries through 1990, and IATA SSIM is the source for entries afterwards.
+# of the IATA's data after 1990.  Except where otherwise noted,
+# IATA SSIM is the source for entries after 1990.
 #
 # Another source occasionally used is Edward W. Whitman, World Time Differences,
 # Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which
diff --git a/jdk/make/data/tzdata/europe b/jdk/make/data/tzdata/europe
index fb24b87a754..2ed6ad36b5d 100644
--- a/jdk/make/data/tzdata/europe
+++ b/jdk/make/data/tzdata/europe
@@ -29,16 +29,19 @@
 # tz@iana.org for general use in the future).  For more, please see
 # the file CONTRIBUTING in the tz distribution.
 
-# From Paul Eggert (2014-05-31):
-# A good source for time zone historical data outside the U.S. is
+# From Paul Eggert (2014-10-31):
+#
+# Unless otherwise specified, the source for data through 1990 is:
 # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
 # San Diego: ACS Publications, Inc. (2003).
+# Unfortunately this book contains many errors and cites no sources.
 #
 # Gwillim Law writes that a good source
 # for recent time zone data is the International Air Transport
 # Association's Standard Schedules Information Manual (IATA SSIM),
 # published semiannually.  Law sent in several helpful summaries
-# of the IATA's data after 1990.
+# of the IATA's data after 1990.  Except where otherwise noted,
+# IATA SSIM is the source for entries after 1990.
 #
 # A reliable and entertaining source about time zones is
 # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
@@ -310,6 +313,14 @@
 #   "Timeball on the ballast office is down.  Dunsink time."
 #   -- James Joyce, Ulysses
 
+# "Countess Markievicz ... claimed that the [1916] abolition of Dublin Mean Time
+# was among various actions undertaken by the 'English' government that
+# would 'put the whole country into the SF (Sinn Féin) camp'.  She claimed
+# Irish 'public feeling (was) outraged by forcing of English time on us'."
+# -- Parsons M. Dublin lost its time zone - and 25 minutes - after 1916 Rising.
+# Irish Times 2014-10-27.
+# http://www.irishtimes.com/news/politics/dublin-lost-its-time-zone-and-25-minutes-after-1916-rising-1.1977411
+
 # From Joseph S. Myers (2005-01-26):
 # Irish laws are available online at <http://www.irishstatutebook.ie>.
 # These include various relating to legal time, for example:
@@ -617,6 +628,7 @@ Rule	Russia	1992	only	-	Sep	lastSat	 23:00	0	-
 Rule	Russia	1993	2010	-	Mar	lastSun	 2:00s	1:00	S
 Rule	Russia	1993	1995	-	Sep	lastSun	 2:00s	0	-
 Rule	Russia	1996	2010	-	Oct	lastSun	 2:00s	0	-
+# As described below, Russia's 2014 change affects Zone data, not Rule data.
 
 # From Alexander Krivenyshev (2011-06-14):
 # According to Kremlin press service, Russian President Dmitry Medvedev
diff --git a/jdk/make/data/tzdata/leapseconds b/jdk/make/data/tzdata/leapseconds
index d38abd6a4bd..7612f2bc9b7 100644
--- a/jdk/make/data/tzdata/leapseconds
+++ b/jdk/make/data/tzdata/leapseconds
@@ -33,8 +33,8 @@
 # The NTP Timescale and Leap Seconds
 # http://www.eecis.udel.edu/~mills/leap.html
 
-# The International Earth Rotation Service periodically uses leap seconds
-# to keep UTC to within 0.9 s of UT1
+# The International Earth Rotation and Reference Systems Service
+# periodically uses leap seconds to keep UTC to within 0.9 s of UT1
 # (which measures the true angular orientation of the earth in space); see
 # Terry J Quinn, The BIPM and the accurate measure of time,
 # Proc IEEE 79, 7 (July 1991), 894-905 <http://dx.doi.org/10.1109/5.84965>.
diff --git a/jdk/make/data/tzdata/northamerica b/jdk/make/data/tzdata/northamerica
index 329b633ba98..86c9503a4eb 100644
--- a/jdk/make/data/tzdata/northamerica
+++ b/jdk/make/data/tzdata/northamerica
@@ -1014,19 +1014,19 @@ Zone America/Menominee	-5:50:27 -	LMT	1885 Sep 18 12:00
 ################################################################################
 
 
-# From Paul Eggert (2006-03-22):
-# A good source for time zone historical data outside the U.S. is
+# From Paul Eggert (2014-10-31):
+#
+# Unless otherwise specified, the source for data through 1990 is:
 # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
 # San Diego: ACS Publications, Inc. (2003).
+# Unfortunately this book contains many errors and cites no sources.
 #
 # Gwillim Law writes that a good source
 # for recent time zone data is the International Air Transport
 # Association's Standard Schedules Information Manual (IATA SSIM),
 # published semiannually.  Law sent in several helpful summaries
-# of the IATA's data after 1990.
-#
-# Except where otherwise noted, Shanks & Pottenger is the source for
-# entries through 1990, and IATA SSIM is the source for entries afterwards.
+# of the IATA's data after 1990.  Except where otherwise noted,
+# IATA SSIM is the source for entries after 1990.
 #
 # Other sources occasionally used include:
 #
@@ -3154,13 +3154,17 @@ Zone America/Miquelon	-3:44:40 -	LMT	1911 May 15 # St Pierre
 # From Paul Eggert (2014-08-19):
 # The 2014-08-13 Cabinet meeting decided to stay on UTC-4 year-round.  See:
 # http://tcweeklynews.com/daylight-savings-time-to-be-maintained-p5353-127.htm
-# Model this as a switch from EST/EDT to AST on 2014-11-02 at 02:00.
+# Model this as a switch from EST/EDT to AST ...
+# From Chris Walton (2014-11-04):
+# ... the TCI government appears to have delayed the switch to
+# "permanent daylight saving time" by one year....
+# http://tcweeklynews.com/time-change-to-go-ahead-this-november-p5437-127.htm
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Grand_Turk	-4:44:32 -	LMT	1890
 			-5:07:11 -	KMT	1912 Feb # Kingston Mean Time
 			-5:00	-	EST	1979
-			-5:00	US	E%sT	2014 Nov  2  2:00
+			-5:00	US	E%sT	2015 Nov Sun>=1 2:00
 			-4:00	-	AST
 
 # British Virgin Is
diff --git a/jdk/make/data/tzdata/southamerica b/jdk/make/data/tzdata/southamerica
index 398ec0e4f06..0b70dea5616 100644
--- a/jdk/make/data/tzdata/southamerica
+++ b/jdk/make/data/tzdata/southamerica
@@ -29,23 +29,23 @@
 # tz@iana.org for general use in the future).  For more, please see
 # the file CONTRIBUTING in the tz distribution.
 
-# From Paul Eggert (2006-03-22):
-# A good source for time zone historical data outside the U.S. is
+# From Paul Eggert (2014-10-31):
+#
+# Unless otherwise specified, the source for data through 1990 is:
 # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
 # San Diego: ACS Publications, Inc. (2003).
-#
-# For data circa 1899, a common source is:
-# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
-# http://www.jstor.org/stable/1774359
+# Unfortunately this book contains many errors and cites no sources.
 #
 # Gwillim Law writes that a good source
 # for recent time zone data is the International Air Transport
 # Association's Standard Schedules Information Manual (IATA SSIM),
 # published semiannually.  Law sent in several helpful summaries
-# of the IATA's data after 1990.
+# of the IATA's data after 1990.  Except where otherwise noted,
+# IATA SSIM is the source for entries after 1990.
 #
-# Except where otherwise noted, Shanks & Pottenger is the source for
-# entries through 1990, and IATA SSIM is the source for entries afterwards.
+# For data circa 1899, a common source is:
+# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
+# http://www.jstor.org/stable/1774359
 #
 # Earlier editions of these tables used the North American style (e.g. ARST and
 # ARDT for Argentine Standard and Daylight Time), but the following quote
diff --git a/jdk/test/sun/util/calendar/zi/tzdata/VERSION b/jdk/test/sun/util/calendar/zi/tzdata/VERSION
index 5e925ada8df..9987fde6dcb 100644
--- a/jdk/test/sun/util/calendar/zi/tzdata/VERSION
+++ b/jdk/test/sun/util/calendar/zi/tzdata/VERSION
@@ -21,4 +21,4 @@
 # or visit www.oracle.com if you need additional information or have any
 # questions.
 #
-tzdata2014g
+tzdata2014j
diff --git a/jdk/test/sun/util/calendar/zi/tzdata/africa b/jdk/test/sun/util/calendar/zi/tzdata/africa
index aa91f365ce1..43103225577 100644
--- a/jdk/test/sun/util/calendar/zi/tzdata/africa
+++ b/jdk/test/sun/util/calendar/zi/tzdata/africa
@@ -29,20 +29,19 @@
 # tz@iana.org for general use in the future).  For more, please see
 # the file CONTRIBUTING in the tz distribution.
 
-# From Paul Eggert (2013-02-21):
+# From Paul Eggert (2014-10-31):
 #
-# A good source for time zone historical data outside the U.S. is
+# Unless otherwise specified, the source for data through 1990 is:
 # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
 # San Diego: ACS Publications, Inc. (2003).
+# Unfortunately this book contains many errors and cites no sources.
 #
 # Gwillim Law writes that a good source
 # for recent time zone data is the International Air Transport
 # Association's Standard Schedules Information Manual (IATA SSIM),
 # published semiannually.  Law sent in several helpful summaries
-# of the IATA's data after 1990.
-#
-# Except where otherwise noted, Shanks & Pottenger is the source for
-# entries through 1990, and IATA SSIM is the source for entries afterwards.
+# of the IATA's data after 1990.  Except where otherwise noted,
+# IATA SSIM is the source for entries after 1990.
 #
 # Another source occasionally used is Edward W. Whitman, World Time Differences,
 # Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which
@@ -88,7 +87,6 @@
 #	 3:00	CAST	Central Africa Summer Time (no longer used)
 #	 3:00	SAST	South Africa Summer Time (no longer used)
 #	 3:00	EAT	East Africa Time
-#	 4:00	EAST	East Africa Summer Time (no longer used)
 
 # Algeria
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
@@ -133,23 +131,13 @@ Zone	Africa/Algiers	0:12:12 -	LMT	1891 Mar 15  0:01
 # See Africa/Lagos.
 
 # Botswana
-# From Paul Eggert (2013-02-21):
-# Milne says they were regulated by the Cape Town Signal in 1899;
-# assume they switched to 2:00 when Cape Town did.
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Gaborone	1:43:40 -	LMT	1885
-			1:30	-	SAST	1903 Mar
-			2:00	-	CAT	1943 Sep 19  2:00
-			2:00	1:00	CAST	1944 Mar 19  2:00
-			2:00	-	CAT
+# See Africa/Maputo.
 
 # Burkina Faso
 # See Africa/Abidjan.
 
 # Burundi
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Bujumbura	1:57:28	-	LMT	1890
-			2:00	-	CAT
+# See Africa/Maputo.
 
 # Cameroon
 # See Africa/Lagos.
@@ -179,15 +167,10 @@ Zone	Africa/Ndjamena	1:00:12 -	LMT	1912        # N'Djamena
 			1:00	-	WAT
 
 # Comoros
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Indian/Comoro	2:53:04 -	LMT	1911 Jul # Moroni, Gran Comoro
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 # Democratic Republic of the Congo
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Lubumbashi	1:49:52 -	LMT	1897 Nov 9
-			2:00	-	CAT
-# The above is for the eastern part; see Africa/Lagos for the western part.
+# See Africa/Lagos for the western part and Africa/Maputo for the eastern.
 
 # Republic of the Congo
 # See Africa/Lagos.
@@ -208,9 +191,7 @@ Link Africa/Abidjan Africa/Sao_Tome	# São Tomé and Príncipe
 Link Africa/Abidjan Atlantic/St_Helena	# St Helena
 
 # Djibouti
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Djibouti	2:52:36 -	LMT	1911 Jul
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 ###############################################################################
 
@@ -339,7 +320,7 @@ Rule	Egypt	2007	only	-	Sep	Thu>=1	24:00	0	-
 # Egypt is to change back to Daylight system on May 15
 # http://english.ahram.org.eg/NewsContent/1/64/100735/Egypt/Politics-/Egypts-government-to-reapply-daylight-saving-time-.aspx
 
-# From Gunther Vermier (2015-05-13):
+# From Gunther Vermier (2014-05-13):
 # our Egypt office confirms that the change will be at 15 May "midnight" (24:00)
 
 # From Imed Chihi (2014-06-04):
@@ -423,27 +404,8 @@ Zone	Africa/Cairo	2:05:09 -	LMT	1900 Oct
 # See Africa/Lagos.
 
 # Eritrea
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Asmara	2:35:32 -	LMT	1870
-			2:35:32	-	AMT	1890        # Asmara Mean Time
-			2:35:20	-	ADMT	1936 May  5 # Adis Dera MT
-			3:00	-	EAT
-
 # Ethiopia
-# From Paul Eggert (2014-07-31):
-# Like the Swahili of Kenya and Tanzania, many Ethiopians keep a
-# 12-hour clock starting at our 06:00, so their "8 o'clock" is our
-# 02:00 or 14:00.  Keep this in mind when you ask the time in Amharic.
-#
-# Shanks & Pottenger write that Ethiopia had six narrowly-spaced time
-# zones between 1870 and 1890, that they merged to 38E50 (2:35:20) in
-# 1890, and that they switched to 3:00 on 1936-05-05.  Perhaps 38E50
-# was for Adis Dera.  Quite likely the Shanks data entries are wrong
-# anyway.
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Addis_Ababa	2:34:48 -	LMT	1870
-			2:35:20	-	ADMT	1936 May  5 # Adis Dera MT
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 # Gabon
 # See Africa/Lagos.
@@ -487,13 +449,18 @@ Zone	Africa/Nairobi	2:27:16	-	LMT	1928 Jul
 			2:30	-	BEAT	1940
 			2:45	-	BEAUT	1960
 			3:00	-	EAT
+Link Africa/Nairobi Africa/Addis_Ababa	 # Ethiopia
+Link Africa/Nairobi Africa/Asmara	 # Eritrea
+Link Africa/Nairobi Africa/Dar_es_Salaam # Tanzania
+Link Africa/Nairobi Africa/Djibouti
+Link Africa/Nairobi Africa/Kampala	 # Uganda
+Link Africa/Nairobi Africa/Mogadishu	 # Somalia
+Link Africa/Nairobi Indian/Antananarivo	 # Madagascar
+Link Africa/Nairobi Indian/Comoro
+Link Africa/Nairobi Indian/Mayotte
 
 # Lesotho
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Maseru	1:50:00 -	LMT	1903 Mar
-			2:00	-	SAST	1943 Sep 19  2:00
-			2:00	1:00	SAST	1944 Mar 19  2:00
-			2:00	-	SAST
+# See Africa/Johannesburg.
 
 # Liberia
 # From Paul Eggert (2006-03-22):
@@ -568,16 +535,10 @@ Zone	Africa/Tripoli	0:52:44 -	LMT	1920
 			2:00	-	EET
 
 # Madagascar
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Indian/Antananarivo 3:10:04 -	LMT	1911 Jul
-			3:00	-	EAT	1954 Feb 27 23:00s
-			3:00	1:00	EAST	1954 May 29 23:00s
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 # Malawi
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Blantyre	2:20:00 -	LMT	1903 Mar
-			2:00	-	CAT
+# See Africa/Maputo.
 
 # Mali
 # Mauritania
@@ -677,9 +638,7 @@ Zone Indian/Mauritius	3:50:00 -	LMT	1907 # Port Louis
 # no information; probably like Indian/Mauritius
 
 # Mayotte
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Indian/Mayotte	3:00:56 -	LMT	1911 Jul # Mamoutzou
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 # Morocco
 # See the 'europe' file for Spanish Morocco (Africa/Ceuta).
@@ -987,6 +946,13 @@ Zone Africa/El_Aaiun	-0:52:48 -	LMT	1934 Jan # El Aaiún
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Africa/Maputo	2:10:20 -	LMT	1903 Mar
 			2:00	-	CAT
+Link Africa/Maputo Africa/Blantyre	# Malawi
+Link Africa/Maputo Africa/Bujumbura	# Burundi
+Link Africa/Maputo Africa/Gaborone	# Botswana
+Link Africa/Maputo Africa/Harare	# Zimbabwe
+Link Africa/Maputo Africa/Kigali	# Rwanda
+Link Africa/Maputo Africa/Lubumbashi	# E Dem. Rep. of Congo
+Link Africa/Maputo Africa/Lusaka	# Zambia
 
 # Namibia
 # The 1994-04-03 transition is from Shanks & Pottenger.
@@ -1054,9 +1020,7 @@ Zone	Indian/Reunion	3:41:52 -	LMT	1911 Jun # Saint-Denis
 # Tromelin - inhabited until at least 1958
 
 # Rwanda
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Kigali	2:00:16 -	LMT	1935 Jun
-			2:00	-	CAT
+# See Africa/Maputo.
 
 # St Helena
 # See Africa/Abidjan.
@@ -1086,11 +1050,7 @@ Zone	Indian/Mahe	3:41:48 -	LMT	1906 Jun # Victoria
 # See Africa/Abidjan.
 
 # Somalia
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Mogadishu	3:01:28 -	LMT	1893 Nov
-			3:00	-	EAT	1931
-			2:30	-	BEAT	1957
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 # South Africa
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
@@ -1100,6 +1060,9 @@ Rule	SA	1943	1944	-	Mar	Sun>=15	2:00	0	-
 Zone Africa/Johannesburg 1:52:00 -	LMT	1892 Feb 8
 			1:30	-	SAST	1903 Mar
 			2:00	SA	SAST
+Link Africa/Johannesburg Africa/Maseru	   # Lesotho
+Link Africa/Johannesburg Africa/Mbabane    # Swaziland
+#
 # Marion and Prince Edward Is
 # scientific station since 1947
 # no information
@@ -1127,16 +1090,10 @@ Zone	Africa/Khartoum	2:10:08 -	LMT	1931
 Link Africa/Khartoum Africa/Juba
 
 # Swaziland
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Mbabane	2:04:24 -	LMT	1903 Mar
-			2:00	-	SAST
+# See Africa/Johannesburg.
 
 # Tanzania
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone Africa/Dar_es_Salaam 2:37:08 -	LMT	1931
-			3:00	-	EAT	1948
-			2:45	-	BEAUT	1961
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 # Togo
 # See Africa/Abidjan.
@@ -1242,19 +1199,8 @@ Zone	Africa/Tunis	0:40:44 -	LMT	1881 May 12
 			1:00	Tunisia	CE%sT
 
 # Uganda
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Kampala	2:09:40 -	LMT	1928 Jul
-			3:00	-	EAT	1930
-			2:30	-	BEAT	1948
-			2:45	-	BEAUT	1957
-			3:00	-	EAT
+# See Africa/Nairobi.
 
 # Zambia
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Lusaka	1:53:08 -	LMT	1903 Mar
-			2:00	-	CAT
-
 # Zimbabwe
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Africa/Harare	2:04:12 -	LMT	1903 Mar
-			2:00	-	CAT
+# See Africa/Maputo.
diff --git a/jdk/test/sun/util/calendar/zi/tzdata/asia b/jdk/test/sun/util/calendar/zi/tzdata/asia
index 906c0a97cda..960cab5062e 100644
--- a/jdk/test/sun/util/calendar/zi/tzdata/asia
+++ b/jdk/test/sun/util/calendar/zi/tzdata/asia
@@ -29,20 +29,19 @@
 # tz@iana.org for general use in the future).  For more, please see
 # the file CONTRIBUTING in the tz distribution.
 
-# From Paul Eggert (2013-08-11):
+# From Paul Eggert (2014-10-31):
 #
-# A good source for time zone historical data outside the U.S. is
+# Unless otherwise specified, the source for data through 1990 is:
 # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
 # San Diego: ACS Publications, Inc. (2003).
+# Unfortunately this book contains many errors and cites no sources.
 #
 # Gwillim Law writes that a good source
 # for recent time zone data is the International Air Transport
 # Association's Standard Schedules Information Manual (IATA SSIM),
 # published semiannually.  Law sent in several helpful summaries
-# of the IATA's data after 1990.
-#
-# Except where otherwise noted, Shanks & Pottenger is the source for
-# entries through 1990, and IATA SSIM is the source for entries afterwards.
+# of the IATA's data after 1990.  Except where otherwise noted,
+# IATA SSIM is the source for entries after 1990.
 #
 # Another source occasionally used is Edward W. Whitman, World Time Differences,
 # Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which
@@ -70,10 +69,11 @@
 #	3:30 IRST IRDT	Iran
 #	4:00 GST	Gulf*
 #	5:30 IST	India
-#	7:00 ICT	Indochina*
+#	7:00 ICT	Indochina, most times and locations*
 #	7:00 WIB	west Indonesia (Waktu Indonesia Barat)
 #	8:00 WITA	central Indonesia (Waktu Indonesia Tengah)
 #	8:00 CST	China
+#	8:00 IDT	Indochina, 1943-45, 1947-55, 1960-75 (some locations)*
 #	8:00 JWST	Western Standard Time (Japan, 1896/1937)*
 #	9:00 JCST	Central Standard Time (Japan, 1896/1937)
 #	9:00 WIT	east Indonesia (Waktu Indonesia Timur)
@@ -294,12 +294,8 @@ Zone	Asia/Rangoon	6:24:40 -	LMT	1880        # or Yangon
 			6:30	-	MMT	# Myanmar Time
 
 # Cambodia
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Phnom_Penh	6:59:40 -	LMT	1906 Jun  9
-			7:06:20	-	SMT	1911 Mar 11  0:01 # Saigon MT?
-			7:00	-	ICT	1912 May
-			8:00	-	ICT	1931 May
-			7:00	-	ICT
+# See Asia/Bangkok.
+
 
 # China
 
@@ -916,6 +912,10 @@ Zone	Asia/Kolkata	5:53:28 -	LMT	1880        # Kolkata
 
 # Indonesia
 #
+# From Paul Eggert (2014-09-06):
+# The 1876 Report of the Secretary of the [US] Navy, p 306 says that Batavia
+# civil time was 7:07:12.5; round to even for Jakarta.
+#
 # From Gwillim Law (2001-05-28), overriding Shanks & Pottenger:
 # http://www.sumatera-inc.com/go_to_invest/about_indonesia.asp#standtime
 # says that Indonesia's time zones changed on 1988-01-01.  Looking at some
@@ -1685,44 +1685,70 @@ Zone	Asia/Bishkek	4:58:24 -	LMT	1924 May  2
 # Korea (North and South)
 
 # From Annie I. Bang (2006-07-10):
-# http://www.koreaherald.co.kr/SITE/data/html_dir/2006/07/10/200607100012.asp
-# The Ministry of Commerce, Industry and Energy has already
-# commissioned a research project [to reintroduce DST] and has said
-# the system may begin as early as 2008....  Korea ran a daylight
-# saving program from 1949-61 but stopped it during the 1950-53 Korean War.
+# http://www.koreaherald.com/view.php?ud=200607100012
+# Korea ran a daylight saving program from 1949-61 but stopped it
+# during the 1950-53 Korean War.  The system was temporarily enforced
+# between 1987 and 1988 ...
+
+# From Sanghyuk Jung (2014-10-29):
+# http://mm.icann.org/pipermail/tz/2014-October/021830.html
+# According to the Korean Wikipedia
+# http://ko.wikipedia.org/wiki/한국_표준시
+# [oldid=12896437 2014-09-04 08:03 UTC]
+# DST in Republic of Korea was as follows....  And I checked old
+# newspapers in Korean, all articles correspond with data in Wikipedia.
+# For example, the article in 1948 (Korean Language) proved that DST
+# started at June 1 in that year.  For another example, the article in
+# 1988 said that DST started at 2:00 AM in that year.
 
-# From Shanks & Pottenger:
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
-Rule	ROK	1960	only	-	May	15	0:00	1:00	D
-Rule	ROK	1960	only	-	Sep	13	0:00	0	S
-Rule	ROK	1987	1988	-	May	Sun>=8	0:00	1:00	D
-Rule	ROK	1987	1988	-	Oct	Sun>=8	0:00	0	S
+Rule	ROK	1948	only	-	Jun	 1	0:00	1:00	D
+Rule	ROK	1948	only	-	Sep	13	0:00	0	S
+Rule	ROK	1949	only	-	Apr	 3	0:00	1:00	D
+Rule	ROK	1949	1951	-	Sep	Sun>=8	0:00	0	S
+Rule	ROK	1950	only	-	Apr	 1	0:00	1:00	D
+Rule	ROK	1951	only	-	May	 6	0:00	1:00	D
+Rule	ROK	1955	only	-	May	 5	0:00	1:00	D
+Rule	ROK	1955	only	-	Sep	 9	0:00	0	S
+Rule	ROK	1956	only	-	May	20	0:00	1:00	D
+Rule	ROK	1956	only	-	Sep	30	0:00	0	S
+Rule	ROK	1957	1960	-	May	Sun>=1	0:00	1:00	D
+Rule	ROK	1957	1960	-	Sep	Sun>=18	0:00	0	S
+Rule	ROK	1987	1988	-	May	Sun>=8	2:00	1:00	D
+Rule	ROK	1987	1988	-	Oct	Sun>=8	3:00	0	S
 
-# From Paul Eggert (2014-07-01):
-# The following entries are from Shanks & Pottenger, except that I
-# guessed that time zone abbreviations through 1945 followed the same
+# From Paul Eggert (2014-10-30):
+# The Korean Wikipedia entry gives the following sources for UT offsets:
+#
+# 1908: Official Journal Article No. 3994 (Edict No. 5)
+# 1912: Governor-General of Korea Official Gazette Issue No. 367
+#       (Announcement No. 338)
+# 1954: Presidential Decree No. 876 (1954-03-17)
+# 1961: Law No. 676 (1961-08-07)
+# 1987: Law No. 3919 (1986-12-31)
+#
+# The Wikipedia entry also has confusing information about a change
+# to UT+9 in April 1910, but then what would be the point of the later change
+# to UT+9 on 1912-01-01?  Omit the 1910 change for now.
+#
+# I guessed that time zone abbreviations through 1945 followed the same
 # rules as discussed under Taiwan, with nominal switches from JST to KST
 # when the respective cities were taken over by the Allies after WWII.
+#
+# For Pyongyang we have no information; guess no changes since World War II.
 
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Seoul	8:27:52	-	LMT	1890
-			8:30	-	KST	1904 Dec
-			9:00	-	JCST	1928
-			8:30	-	KST	1932
+Zone	Asia/Seoul	8:27:52	-	LMT	1908 Apr  1
+			8:30	-	KST	1912 Jan  1
 			9:00	-	JCST	1937 Oct  1
 			9:00	-	JST	1945 Sep  8
 			9:00	-	KST	1954 Mar 21
-			8:00	ROK	K%sT	1961 Aug 10
-			8:30	-	KST	1968 Oct
+			8:30	ROK	K%sT	1961 Aug 10
 			9:00	ROK	K%sT
-Zone	Asia/Pyongyang	8:23:00 -	LMT	1890
-			8:30	-	KST	1904 Dec
-			9:00	-	JCST	1928
-			8:30	-	KST	1932
+Zone	Asia/Pyongyang	8:23:00 -	LMT	1908 Apr  1
+			8:30	-	KST	1912 Jan  1
 			9:00	-	JCST	1937 Oct  1
 			9:00	-	JST	1945 Aug 24
-			9:00	-	KST	1954 Mar 21
-			8:00	-	KST	1961 Aug 10
 			9:00	-	KST
 
 ###############################################################################
@@ -1733,12 +1759,8 @@ Zone	Asia/Kuwait	3:11:56 -	LMT	1950
 			3:00	-	AST
 
 # Laos
-# Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Vientiane	6:50:24 -	LMT	1906 Jun  9       # or Viangchan
-			7:06:20	-	SMT	1911 Mar 11  0:01 # Saigon MT?
-			7:00	-	ICT	1912 May
-			8:00	-	ICT	1931 May
-			7:00	-	ICT
+# See Asia/Bangkok.
+
 
 # Lebanon
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
@@ -2751,6 +2773,8 @@ Zone	Asia/Dushanbe	4:35:12 -	LMT	1924 May  2
 Zone	Asia/Bangkok	6:42:04	-	LMT	1880
 			6:42:04	-	BMT	1920 Apr # Bangkok Mean Time
 			7:00	-	ICT
+Link Asia/Bangkok Asia/Phnom_Penh	# Cambodia
+Link Asia/Bangkok Asia/Vientiane	# Laos
 
 # Turkmenistan
 # From Shanks & Pottenger.
@@ -2788,22 +2812,65 @@ Zone	Asia/Tashkent	4:37:11 -	LMT	1924 May  2
 
 # Vietnam
 
-# From Paul Eggert (2013-02-21):
+# From Paul Eggert (2014-10-04):
 # Milne gives 7:16:56 for the meridian of Saigon in 1899, as being
 # used in Lower Laos, Cambodia, and Annam.  But this is quite a ways
 # from Saigon's location.  For now, ignore this and stick with Shanks
-# and Pottenger.
+# and Pottenger for LMT before 1906.
 
 # From Arthur David Olson (2008-03-18):
 # The English-language name of Vietnam's most populous city is "Ho Chi Minh
 # City"; use Ho_Chi_Minh below to avoid a name of more than 14 characters.
 
-# From Shanks & Pottenger:
+# From Paul Eggert (2014-10-21) after a heads-up from Trần Ngọc Quân:
+# Trần Tiến Bình's authoritative book "Lịch Việt Nam: thế kỷ XX-XXI (1901-2100)"
+# (Nhà xuất bản Văn Hoá - Thông Tin, Hanoi, 2005), pp 49-50,
+# is quoted verbatim in:
+# http://www.thoigian.com.vn/?mPage=P80D01
+# is translated by Brian Inglis in:
+# http://mm.icann.org/pipermail/tz/2014-October/021654.html
+# and is the basis for the information below.
+#
+# The 1906 transition was effective July 1 and standardized Indochina to
+# Phù Liễn Observatory, legally 104 deg. 17'17" east of Paris.
+# It's unclear whether this meant legal Paris Mean Time (00:09:21) or
+# the Paris Meridian (2 deg. 20'14.03" E); the former yields 07:06:30.1333...
+# and the latter 07:06:29.333... so either way it rounds to 07:06:30,
+# which is used below even though the modern-day Phù Liễn Observatory
+# is closer to 07:06:31.  Abbreviate Phù Liễn Mean Time as PLMT.
+#
+# The following transitions occurred in Indochina in general (before 1954)
+# and in South Vietnam in particular (after 1954):
+# To 07:00 on 1911-05-01.
+# To 08:00 on 1942-12-31 at 23:00.
+# To 09:00 in 1945-03-14 at 23:00.
+# To 07:00 on 1945-09-02 in Vietnam.
+# To 08:00 on 1947-04-01 in French-controlled Indochina.
+# To 07:00 on 1955-07-01 in South Vietnam.
+# To 08:00 on 1959-12-31 at 23:00 in South Vietnam.
+# To 07:00 on 1975-06-13 in South Vietnam.
+#
+# Trần cites the following sources; it's unclear which supplied the info above.
+#
+# Hoàng Xuân Hãn: "Lịch và lịch Việt Nam". Tập san Khoa học Xã hội,
+# No. 9, Paris, February 1982.
+#
+# Lê Thành Lân: "Lịch và niên biểu lịch sử hai mươi thế kỷ (0001-2010)",
+# NXB Thống kê, Hanoi, 2000.
+#
+# Lê Thành Lân: "Lịch hai thế kỷ (1802-2010) và các lịch vĩnh cửu",
+# NXB Thuận Hoá, Huế, 1995.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
-Zone	Asia/Ho_Chi_Minh	7:06:40 -	LMT	1906 Jun  9
-			7:06:20	-	SMT	1911 Mar 11  0:01 # Saigon MT?
-			7:00	-	ICT	1912 May
-			8:00	-	ICT	1931 May
+Zone Asia/Ho_Chi_Minh	7:06:40 -	LMT	1906 Jul  1
+			7:06:30	-	PLMT	1911 May  1
+			7:00	-	ICT	1942 Dec 31 23:00
+			8:00	-	IDT	1945 Mar 14 23:00
+			9:00	-	JST	1945 Sep  2
+			7:00	-	ICT	1947 Apr  1
+			8:00	-	IDT	1955 Jul  1
+			7:00	-	ICT	1959 Dec 31 23:00
+			8:00	-	IDT	1975 Jun 13
 			7:00	-	ICT
 
 # Yemen
diff --git a/jdk/test/sun/util/calendar/zi/tzdata/australasia b/jdk/test/sun/util/calendar/zi/tzdata/australasia
index 52d32904178..f2a89e8ee37 100644
--- a/jdk/test/sun/util/calendar/zi/tzdata/australasia
+++ b/jdk/test/sun/util/calendar/zi/tzdata/australasia
@@ -354,20 +354,27 @@ Zone	Indian/Cocos	6:27:40	-	LMT	1900
 # Fiji will end DST on 2014-01-19 02:00:
 # http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVINGS-TO-END-THIS-MONTH-%281%29.aspx
 
-# From Paul Eggert (2014-01-10):
-# For now, guess that Fiji springs forward the Sunday before the fourth
-# Monday in October, and springs back the penultimate Sunday in January.
-# This is ad hoc, but matches recent practice.
+# From Ken Rylander (2014-10-20):
+# DST will start Nov. 2 this year.
+# http://www.fiji.gov.fj/Media-Center/Press-Releases/DAYLIGHT-SAVING-STARTS-ON-SUNDAY,-NOVEMBER-2ND.aspx
+
+# From Paul Eggert (2014-10-20):
+# For now, guess DST from 02:00 the first Sunday in November to
+# 03:00 the first Sunday on or after January 18.  Although ad hoc, it
+# matches this year's plan and seems more likely to match future
+# practice than guessing no DST.
 
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Fiji	1998	1999	-	Nov	Sun>=1	2:00	1:00	S
 Rule	Fiji	1999	2000	-	Feb	lastSun	3:00	0	-
 Rule	Fiji	2009	only	-	Nov	29	2:00	1:00	S
 Rule	Fiji	2010	only	-	Mar	lastSun	3:00	0	-
-Rule	Fiji	2010	max	-	Oct	Sun>=21	2:00	1:00	S
+Rule	Fiji	2010	2013	-	Oct	Sun>=21	2:00	1:00	S
 Rule	Fiji	2011	only	-	Mar	Sun>=1	3:00	0	-
 Rule	Fiji	2012	2013	-	Jan	Sun>=18	3:00	0	-
-Rule	Fiji	2014	max	-	Jan	Sun>=18	2:00	0	-
+Rule	Fiji	2014	only	-	Jan	Sun>=18	2:00	0	-
+Rule	Fiji	2014	max	-	Nov	Sun>=1	2:00	1:00	S
+Rule	Fiji	2015	max	-	Jan	Sun>=18	3:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Pacific/Fiji	11:55:44 -	LMT	1915 Oct 26 # Suva
 			12:00	Fiji	FJ%sT	# Fiji Time
@@ -542,6 +549,30 @@ Zone Pacific/Palau	8:57:56 -	LMT	1901 # Koror
 Zone Pacific/Port_Moresby 9:48:40 -	LMT	1880
 			9:48:32	-	PMMT	1895 # Port Moresby Mean Time
 			10:00	-	PGT	# Papua New Guinea Time
+#
+# From Paul Eggert (2014-10-13):
+# Base the Bougainville entry on the Arawa-Kieta region, which appears to have
+# the most people even though it was devastated in the Bougainville Civil War.
+#
+# Although Shanks gives 1942-03-15 / 1943-11-01 for JST, these dates
+# are apparently rough guesswork from the starts of military campaigns.
+# The World War II entries below are instead based on Arawa-Kieta.
+# The Japanese occupied Kieta in July 1942,
+# according to the Pacific War Online Encyclopedia
+# http://pwencycl.kgbudge.com/B/o/Bougainville.htm
+# and seem to have controlled it until their 1945-08-21 surrender.
+#
+# The Autonomous Region of Bougainville plans to switch from UTC+10 to UTC+11
+# on 2014-12-28 at 02:00.  They call UTC+11 "Bougainville Standard Time";
+# abbreviate this as BST.  See:
+# http://www.bougainville24.com/bougainville-issues/bougainville-gets-own-timezone/
+#
+Zone Pacific/Bougainville 10:22:16 -	LMT	1880
+			 9:48:32 -	PMMT	1895
+			10:00	-	PGT	1942 Jul
+			 9:00	-	JST	1945 Aug 21
+			10:00	-	PGT	2014 Dec 28  2:00
+			11:00	-	BST
 
 # Pitcairn
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
@@ -789,19 +820,19 @@ Zone	Pacific/Wallis	12:15:20 -	LMT	1901
 # tz@iana.org for general use in the future).  For more, please see
 # the file CONTRIBUTING in the tz distribution.
 
-# From Paul Eggert (2013-02-21):
-# A good source for time zone historical data outside the U.S. is
+# From Paul Eggert (2014-10-31):
+#
+# Unless otherwise specified, the source for data through 1990 is:
 # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
 # San Diego: ACS Publications, Inc. (2003).
+# Unfortunately this book contains many errors and cites no sources.
 #
 # Gwillim Law writes that a good source
 # for recent time zone data is the International Air Transport
 # Association's Standard Schedules Information Manual (IATA SSIM),
 # published semiannually.  Law sent in several helpful summaries
-# of the IATA's data after 1990.
-#
-# Except where otherwise noted, Shanks & Pottenger is the source for
-# entries through 1990, and IATA SSIM is the source for entries afterwards.
+# of the IATA's data after 1990.  Except where otherwise noted,
+# IATA SSIM is the source for entries after 1990.
 #
 # Another source occasionally used is Edward W. Whitman, World Time Differences,
 # Whitman Publishing Co, 2 Niagara Av, Ealing, London (undated), which
@@ -826,6 +857,7 @@ Zone	Pacific/Wallis	12:15:20 -	LMT	1901
 #	 10:00	AEST	AEDT	Eastern Australia
 #	 10:00	ChST		Chamorro
 #	 10:30	LHST	LHDT	Lord Howe*
+#	 11:00	BST		Bougainville*
 #	 11:30	NZMT	NZST	New Zealand through 1945
 #	 12:00	NZST	NZDT	New Zealand 1946-present
 #	 12:15	CHAST		Chatham through 1945*
diff --git a/jdk/test/sun/util/calendar/zi/tzdata/europe b/jdk/test/sun/util/calendar/zi/tzdata/europe
index 0c5f5667da9..2ed6ad36b5d 100644
--- a/jdk/test/sun/util/calendar/zi/tzdata/europe
+++ b/jdk/test/sun/util/calendar/zi/tzdata/europe
@@ -29,16 +29,19 @@
 # tz@iana.org for general use in the future).  For more, please see
 # the file CONTRIBUTING in the tz distribution.
 
-# From Paul Eggert (2014-05-31):
-# A good source for time zone historical data outside the U.S. is
+# From Paul Eggert (2014-10-31):
+#
+# Unless otherwise specified, the source for data through 1990 is:
 # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
 # San Diego: ACS Publications, Inc. (2003).
+# Unfortunately this book contains many errors and cites no sources.
 #
 # Gwillim Law writes that a good source
 # for recent time zone data is the International Air Transport
 # Association's Standard Schedules Information Manual (IATA SSIM),
 # published semiannually.  Law sent in several helpful summaries
-# of the IATA's data after 1990.
+# of the IATA's data after 1990.  Except where otherwise noted,
+# IATA SSIM is the source for entries after 1990.
 #
 # A reliable and entertaining source about time zones is
 # Derek Howse, Greenwich time and longitude, Philip Wilson Publishers (1997).
@@ -91,10 +94,11 @@
 #        0:00       WET WEST WEMT Western Europe
 #        0:19:32.13 AMT NST       Amsterdam, Netherlands Summer (1835-1937)*
 #        0:20       NET NEST      Netherlands (1937-1940)*
+#        1:00       BST           British Standard (1968-1971)
 #        1:00       CET CEST CEMT Central Europe
 #        1:00:14    SET           Swedish (1879-1899)*
 #        2:00       EET EEST      Eastern Europe
-#        3:00       FET           Further-eastern Europe*
+#        3:00       FET           Further-eastern Europe (2011-2014)*
 #        3:00       MSK MSD  MSM* Moscow
 
 # From Peter Ilieve (1994-12-04),
@@ -309,6 +313,14 @@
 #   "Timeball on the ballast office is down.  Dunsink time."
 #   -- James Joyce, Ulysses
 
+# "Countess Markievicz ... claimed that the [1916] abolition of Dublin Mean Time
+# was among various actions undertaken by the 'English' government that
+# would 'put the whole country into the SF (Sinn Féin) camp'.  She claimed
+# Irish 'public feeling (was) outraged by forcing of English time on us'."
+# -- Parsons M. Dublin lost its time zone - and 25 minutes - after 1916 Rising.
+# Irish Times 2014-10-27.
+# http://www.irishtimes.com/news/politics/dublin-lost-its-time-zone-and-25-minutes-after-1916-rising-1.1977411
+
 # From Joseph S. Myers (2005-01-26):
 # Irish laws are available online at <http://www.irishstatutebook.ie>.
 # These include various relating to legal time, for example:
@@ -616,6 +628,7 @@ Rule	Russia	1992	only	-	Sep	lastSat	 23:00	0	-
 Rule	Russia	1993	2010	-	Mar	lastSun	 2:00s	1:00	S
 Rule	Russia	1993	1995	-	Sep	lastSun	 2:00s	0	-
 Rule	Russia	1996	2010	-	Oct	lastSun	 2:00s	0	-
+# As described below, Russia's 2014 change affects Zone data, not Rule data.
 
 # From Alexander Krivenyshev (2011-06-14):
 # According to Kremlin press service, Russian President Dmitry Medvedev
@@ -746,6 +759,13 @@ Zone	Europe/Vienna	1:05:21 -	LMT	1893 Apr
 # http://www.belta.by/ru/all_news/society/V-Belarusi-otmenjaetsja-perexod-na-sezonnoe-vremja_i_572952.html
 # http://naviny.by/rubrics/society/2011/09/16/ic_articles_116_175144/
 # http://news.tut.by/society/250578.html
+#
+# From Alexander Bokovoy (2014-10-09):
+# Belarussian government decided against changing to winter time....
+# http://eng.belta.by/all_news/society/Belarus-decides-against-adjusting-time-in-Russias-wake_i_76335.html
+# From Paul Eggert (2014-10-08):
+# Hence Belarus can share time zone abbreviations with Moscow again.
+#
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Europe/Minsk	1:50:16 -	LMT	1880
 			1:50	-	MMT	1924 May  2 # Minsk Mean Time
@@ -758,7 +778,8 @@ Zone	Europe/Minsk	1:50:16 -	LMT	1880
 			2:00	-	EET	1992 Mar 29  0:00s
 			2:00	1:00	EEST	1992 Sep 27  0:00s
 			2:00	Russia	EE%sT	2011 Mar 27  2:00s
-			3:00	-	FET
+			3:00	-	FET	2014 Oct 26  1:00s
+			3:00	-	MSK
 
 # Belgium
 #
@@ -2524,7 +2545,7 @@ Zone Asia/Novosibirsk	 5:31:40 -	LMT	1919 Dec 14  6:00
 # The Kemerovo region will remain at UTC+7 through the 2014-10-26 change, thus
 # realigning itself with KRAT.
 
-Zone Asia/Novokuznetsk	 5:48:48 -	NMT	1920 Jan  6
+Zone Asia/Novokuznetsk	 5:48:48 -	LMT	1924 May  1
 			 6:00	-	KRAT	1930 Jun 21 # Krasnoyarsk Time
 			 7:00	Russia	KRA%sT	1991 Mar 31  2:00s
 			 6:00	Russia	KRA%sT	1992 Jan 19  2:00s
diff --git a/jdk/test/sun/util/calendar/zi/tzdata/leapseconds b/jdk/test/sun/util/calendar/zi/tzdata/leapseconds
index d38abd6a4bd..7612f2bc9b7 100644
--- a/jdk/test/sun/util/calendar/zi/tzdata/leapseconds
+++ b/jdk/test/sun/util/calendar/zi/tzdata/leapseconds
@@ -33,8 +33,8 @@
 # The NTP Timescale and Leap Seconds
 # http://www.eecis.udel.edu/~mills/leap.html
 
-# The International Earth Rotation Service periodically uses leap seconds
-# to keep UTC to within 0.9 s of UT1
+# The International Earth Rotation and Reference Systems Service
+# periodically uses leap seconds to keep UTC to within 0.9 s of UT1
 # (which measures the true angular orientation of the earth in space); see
 # Terry J Quinn, The BIPM and the accurate measure of time,
 # Proc IEEE 79, 7 (July 1991), 894-905 <http://dx.doi.org/10.1109/5.84965>.
diff --git a/jdk/test/sun/util/calendar/zi/tzdata/northamerica b/jdk/test/sun/util/calendar/zi/tzdata/northamerica
index 0dc714aa92d..86c9503a4eb 100644
--- a/jdk/test/sun/util/calendar/zi/tzdata/northamerica
+++ b/jdk/test/sun/util/calendar/zi/tzdata/northamerica
@@ -300,6 +300,12 @@ Zone	PST8PDT		 -8:00	US	P%sT
 # time zone, but we do go by the Eastern time zone because so many people work
 # in Columbus."
 
+# From Paul Eggert (2014-09-06):
+# Monthly Notices of the Royal Astronomical Society 44, 4 (1884-02-08), 208
+# says that New York City Hall time was 3 minutes 58.4 seconds fast of
+# Eastern time (i.e., -4:56:01.6) just before the 1883 switch.  Round to the
+# nearest second.
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER
 Rule	NYC	1920	only	-	Mar	lastSun	2:00	1:00	D
 Rule	NYC	1920	only	-	Oct	lastSun	2:00	0	S
@@ -1008,19 +1014,19 @@ Zone America/Menominee	-5:50:27 -	LMT	1885 Sep 18 12:00
 ################################################################################
 
 
-# From Paul Eggert (2006-03-22):
-# A good source for time zone historical data outside the U.S. is
+# From Paul Eggert (2014-10-31):
+#
+# Unless otherwise specified, the source for data through 1990 is:
 # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
 # San Diego: ACS Publications, Inc. (2003).
+# Unfortunately this book contains many errors and cites no sources.
 #
 # Gwillim Law writes that a good source
 # for recent time zone data is the International Air Transport
 # Association's Standard Schedules Information Manual (IATA SSIM),
 # published semiannually.  Law sent in several helpful summaries
-# of the IATA's data after 1990.
-#
-# Except where otherwise noted, Shanks & Pottenger is the source for
-# entries through 1990, and IATA SSIM is the source for entries afterwards.
+# of the IATA's data after 1990.  Except where otherwise noted,
+# IATA SSIM is the source for entries after 1990.
 #
 # Other sources occasionally used include:
 #
@@ -1118,17 +1124,16 @@ Zone America/Menominee	-5:50:27 -	LMT	1885 Sep 18 12:00
 # An amendment to the Interpretation Act was registered on February 19/2007....
 # http://action.attavik.ca/home/justice-gn/attach/2007/gaz02part2.pdf
 
-# From Paul Eggert (2006-04-25):
+# From Paul Eggert (2014-10-18):
 # H. David Matthews and Mary Vincent's map
 # "It's about TIME", _Canadian Geographic_ (September-October 1998)
-# http://www.canadiangeographic.ca/Magazine/SO98/geomap.asp
+# http://www.canadiangeographic.ca/Magazine/SO98/alacarte.asp
 # contains detailed boundaries for regions observing nonstandard
 # time and daylight saving time arrangements in Canada circa 1998.
 #
-# INMS, the Institute for National Measurement Standards in Ottawa, has
-# information about standard and daylight saving time zones in Canada.
-# http://inms-ienm.nrc-cnrc.gc.ca/en/time_services/daylight_saving_e.php
-# (updated periodically).
+# National Research Council Canada maintains info about time zones and DST.
+# http://www.nrc-cnrc.gc.ca/eng/services/time/time_zones.html
+# http://www.nrc-cnrc.gc.ca/eng/services/time/faq/index.html#Q5
 # Its unofficial information is often taken from Matthews and Vincent.
 
 # From Paul Eggert (2006-06-27):
@@ -1993,10 +1998,7 @@ Zone America/Creston	-7:46:04 -	LMT	1884
 # [Also see <http://www.nunatsiaq.com/nunavut/nvt10309_06.html> (2001-03-09).]
 
 # From Gwillim Law (2005-05-21):
-# According to maps at
-# http://inms-ienm.nrc-cnrc.gc.ca/images/time_services/TZ01SWE.jpg
-# http://inms-ienm.nrc-cnrc.gc.ca/images/time_services/TZ01SSE.jpg
-# (both dated 2003), and
+# According to ...
 # http://www.canadiangeographic.ca/Magazine/SO98/geomap.asp
 # (from a 1998 Canadian Geographic article), the de facto and de jure time
 # for Southampton Island (at the north end of Hudson Bay) is UTC-5 all year
@@ -2005,9 +2007,11 @@ Zone America/Creston	-7:46:04 -	LMT	1884
 # predates the creation of Nunavut, it probably goes back many years....
 # The Inuktitut name of Coral Harbour is Sallit, but it's rarely used.
 #
-# From Paul Eggert (2005-07-26):
+# From Paul Eggert (2014-10-17):
 # For lack of better information, assume that Southampton Island observed
-# daylight saving only during wartime.
+# daylight saving only during wartime.  Gwillim Law's email also
+# mentioned maps now maintained by National Research Council Canada;
+# see above for an up-to-date link.
 
 # From Chris Walton (2007-03-01):
 # ... the community of Resolute (located on Cornwallis Island in
@@ -3008,10 +3012,21 @@ Zone America/Tegucigalpa -5:48:52 -	LMT	1921 Apr
 # Shanks & Pottenger give -5:07:12, but Milne records -5:07:10.41 from an
 # unspecified official document, and says "This time is used throughout the
 # island".  Go with Milne.  Round to the nearest second as required by zic.
+#
+# Shanks & Pottenger give April 28 for the 1974 spring-forward transition, but
+# Lance Neita writes that Prime Minister Michael Manley decreed it January 5.
+# Assume Neita meant Jan 6 02:00, the same as the US.  Neita also writes that
+# Manley's supporters associated this act with Manley's nickname "Joshua"
+# (recall that in the Bible the sun stood still at Joshua's request),
+# and with the Rod of Correction which Manley said he had received from
+# Haile Selassie, Emperor of Ethiopia.  See:
+# Neita L. The politician in all of us. Jamaica Observer 2014-09-20
+# http://www.jamaicaobserver.com/columns/The-politician-in-all-of-us_17573647
+#
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	America/Jamaica	-5:07:11 -	LMT	1890        # Kingston
 			-5:07:11 -	KMT	1912 Feb    # Kingston Mean Time
-			-5:00	-	EST	1974 Apr 28  2:00
+			-5:00	-	EST	1974
 			-5:00	US	E%sT	1984
 			-5:00	-	EST
 
@@ -3139,13 +3154,17 @@ Zone America/Miquelon	-3:44:40 -	LMT	1911 May 15 # St Pierre
 # From Paul Eggert (2014-08-19):
 # The 2014-08-13 Cabinet meeting decided to stay on UTC-4 year-round.  See:
 # http://tcweeklynews.com/daylight-savings-time-to-be-maintained-p5353-127.htm
-# Model this as a switch from EST/EDT to AST on 2014-11-02 at 02:00.
+# Model this as a switch from EST/EDT to AST ...
+# From Chris Walton (2014-11-04):
+# ... the TCI government appears to have delayed the switch to
+# "permanent daylight saving time" by one year....
+# http://tcweeklynews.com/time-change-to-go-ahead-this-november-p5437-127.htm
 #
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone America/Grand_Turk	-4:44:32 -	LMT	1890
 			-5:07:11 -	KMT	1912 Feb # Kingston Mean Time
 			-5:00	-	EST	1979
-			-5:00	US	E%sT	2014 Nov  2  2:00
+			-5:00	US	E%sT	2015 Nov Sun>=1 2:00
 			-4:00	-	AST
 
 # British Virgin Is
diff --git a/jdk/test/sun/util/calendar/zi/tzdata/southamerica b/jdk/test/sun/util/calendar/zi/tzdata/southamerica
index 398ec0e4f06..0b70dea5616 100644
--- a/jdk/test/sun/util/calendar/zi/tzdata/southamerica
+++ b/jdk/test/sun/util/calendar/zi/tzdata/southamerica
@@ -29,23 +29,23 @@
 # tz@iana.org for general use in the future).  For more, please see
 # the file CONTRIBUTING in the tz distribution.
 
-# From Paul Eggert (2006-03-22):
-# A good source for time zone historical data outside the U.S. is
+# From Paul Eggert (2014-10-31):
+#
+# Unless otherwise specified, the source for data through 1990 is:
 # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition),
 # San Diego: ACS Publications, Inc. (2003).
-#
-# For data circa 1899, a common source is:
-# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
-# http://www.jstor.org/stable/1774359
+# Unfortunately this book contains many errors and cites no sources.
 #
 # Gwillim Law writes that a good source
 # for recent time zone data is the International Air Transport
 # Association's Standard Schedules Information Manual (IATA SSIM),
 # published semiannually.  Law sent in several helpful summaries
-# of the IATA's data after 1990.
+# of the IATA's data after 1990.  Except where otherwise noted,
+# IATA SSIM is the source for entries after 1990.
 #
-# Except where otherwise noted, Shanks & Pottenger is the source for
-# entries through 1990, and IATA SSIM is the source for entries afterwards.
+# For data circa 1899, a common source is:
+# Milne J. Civil time. Geogr J. 1899 Feb;13(2):173-94.
+# http://www.jstor.org/stable/1774359
 #
 # Earlier editions of these tables used the North American style (e.g. ARST and
 # ARDT for Argentine Standard and Daylight Time), but the following quote
diff --git a/jdk/test/sun/util/calendar/zi/tzdata/zone.tab b/jdk/test/sun/util/calendar/zi/tzdata/zone.tab
index 45351ca8486..0ef9ba869ea 100644
--- a/jdk/test/sun/util/calendar/zi/tzdata/zone.tab
+++ b/jdk/test/sun/util/calendar/zi/tzdata/zone.tab
@@ -330,7 +330,8 @@ PE	-1203-07703	America/Lima
 PF	-1732-14934	Pacific/Tahiti	Society Islands
 PF	-0900-13930	Pacific/Marquesas	Marquesas Islands
 PF	-2308-13457	Pacific/Gambier	Gambier Islands
-PG	-0930+14710	Pacific/Port_Moresby
+PG	-0930+14710	Pacific/Port_Moresby	most locations
+PG	-0613+15534	Pacific/Bougainville	Bougainville
 PH	+1435+12100	Asia/Manila
 PK	+2452+06703	Asia/Karachi
 PL	+5215+02100	Europe/Warsaw

From 42c6853ed1f3f6ba5783f47a7b94e78830c5d044 Mon Sep 17 00:00:00 2001
From: Sergey Lugovoy <slugovoy@openjdk.org>
Date: Mon, 17 Nov 2014 14:57:28 +0300
Subject: [PATCH 097/299] 8062638: RuntimeException when run command from js
 with -scripting on Cygwin

Reviewed-by: hannesw, lagergren
---
 nashorn/test/script/nosecurity/JDK-8050964.js | 1 +
 nashorn/test/script/nosecurity/JDK-8055034.js | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/nashorn/test/script/nosecurity/JDK-8050964.js b/nashorn/test/script/nosecurity/JDK-8050964.js
index 486948aa566..eda3d1b632b 100644
--- a/nashorn/test/script/nosecurity/JDK-8050964.js
+++ b/nashorn/test/script/nosecurity/JDK-8050964.js
@@ -50,6 +50,7 @@ var javahome = System.getProperty("java.home");
 var jdepsPath = javahome + "/../bin/jdeps".replaceAll(/\//g, File.separater);
 
 // run jdep on nashorn.jar - only summary but print profile info
+$ENV.PWD=System.getProperty("user.dir") // to avoid RE on Cygwin
 `${jdepsPath} -s -P ${nashornJar.absolutePath}`
 
 // check for "(compact1)" in output from jdep tool
diff --git a/nashorn/test/script/nosecurity/JDK-8055034.js b/nashorn/test/script/nosecurity/JDK-8055034.js
index 76f24be704e..a0e5057e87e 100644
--- a/nashorn/test/script/nosecurity/JDK-8055034.js
+++ b/nashorn/test/script/nosecurity/JDK-8055034.js
@@ -49,7 +49,7 @@ var nashornJarDir = nashornJar.parentFile.absolutePath;
 var jjsCmd = javahome + "/../bin/jjs";
 jjsCmd += " -J-Djava.ext.dirs=" + nashornJarDir;
 jjsCmd = jjsCmd.toString().replaceAll(/\//g, File.separater);
-
+$ENV.PWD=System.getProperty("user.dir") // to avoid RE on Cygwin
 $EXEC(jjsCmd, "var x = Object.create(null);\nx;\nprint('PASSED');\nexit(0)");
 
 // $ERR has all interactions including prompts! Just check for error substring.

From fb6b965e8610ff30a42c1865425969499b9087fb Mon Sep 17 00:00:00 2001
From: Katja Kantserova <ykantser@openjdk.org>
Date: Tue, 18 Nov 2014 16:20:16 +0100
Subject: [PATCH 098/299] 6542634: TEST BUG: MISC_REGRESSION tests need to have
 minimum timeouts examined

Reviewed-by: sla, jbachorik, egahlin
---
 jdk/test/ProblemList.txt                      |   3 +
 jdk/test/sun/tools/jinfo/Basic.sh             | 117 ----------------
 jdk/test/sun/tools/jinfo/JInfoHelper.java     |  74 ++++++++++
 .../jinfo/JInfoRunningProcessFlagTest.java    | 128 ++++++++++++++++++
 .../tools/jinfo/JInfoRunningProcessTest.java  |  64 +++++++++
 jdk/test/sun/tools/jinfo/JInfoSanityTest.java |  76 +++++++++++
 6 files changed, 345 insertions(+), 117 deletions(-)
 delete mode 100644 jdk/test/sun/tools/jinfo/Basic.sh
 create mode 100644 jdk/test/sun/tools/jinfo/JInfoHelper.java
 create mode 100644 jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java
 create mode 100644 jdk/test/sun/tools/jinfo/JInfoRunningProcessTest.java
 create mode 100644 jdk/test/sun/tools/jinfo/JInfoSanityTest.java

diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index 449db57f61f..d3c1c3a0c95 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -315,6 +315,9 @@ sun/tools/jstatd/TestJstatdExternalRegistry.java                generic-all
 # 6456333
 sun/tools/jps/TestJpsJarRelative.java				generic-all
 
+# 6734748
+sun/tools/jinfo/JInfoRunningProcessFlagTest.java		generic-all
+
 # 8057732
 sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java    generic-all
 
diff --git a/jdk/test/sun/tools/jinfo/Basic.sh b/jdk/test/sun/tools/jinfo/Basic.sh
deleted file mode 100644
index 445ccf333f5..00000000000
--- a/jdk/test/sun/tools/jinfo/Basic.sh
+++ /dev/null
@@ -1,117 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2006, 2012, 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 6402766
-# @summary Unit test for jinfo utility
-#
-# @library ../common
-# @build SimpleApplication ShutdownSimpleApplication
-# @run shell Basic.sh
-
-. ${TESTSRC}/../common/CommonSetup.sh
-. ${TESTSRC}/../common/ApplicationSetup.sh
-
-# Start application and use PORTFILE for coordination
-PORTFILE="${TESTCLASSES}"/shutdown.port
-startApplication SimpleApplication "${PORTFILE}"
-
-# all return statuses are checked in this test
-set +e
-set -x
-
-failed=0
-
-runSA=true
-
-if [ $isMacos = true -o $isAIX = true -o `uname -m` = ppc64 ]; then
-    runSA=false
-fi
-
-if [ $isLinux = true ]; then
-    # Some Linux systems disable non-child ptrace (see 7050524)
-    ptrace_scope=`/sbin/sysctl -n kernel.yama.ptrace_scope`
-    if [ $? = 0 ]; then
-        if [ $ptrace_scope = 1 ]; then
-            runSA=false
-        fi
-    fi
-fi
-
-if [ $runSA = true ]; then
-    # -sysprops option
-    ${JINFO} -J-XX:+UsePerfData -F -sysprops $appJavaPid
-    if [ $? != 0 ]; then failed=1; fi
-
-    # -flags option
-    ${JINFO} -J-XX:+UsePerfData -F -flags $appJavaPid
-    if [ $? != 0 ]; then failed=1; fi
-
-    # no option
-    ${JINFO} -J-XX:+UsePerfData -F $appJavaPid
-    if [ $? != 0 ]; then failed=1; fi
-fi
-
-# -sysprops option
-${JINFO} -J-XX:+UsePerfData -sysprops $appJavaPid
-if [ $? != 0 ]; then failed=1; fi
-
-# -flags option
-${JINFO} -J-XX:+UsePerfData -flags $appJavaPid
-if [ $? != 0 ]; then failed=1; fi
-
-# no option
-${JINFO} -J-XX:+UsePerfData $appJavaPid
-if [ $? != 0 ]; then failed=1; fi
-
-# -flag option
-${JINFO} -J-XX:+UsePerfData -flag +PrintGC $appJavaPid
-if [ $? != 0 ]; then failed=1; fi 
-
-${JINFO} -J-XX:+UsePerfData -flag -PrintGC $appJavaPid
-if [ $? != 0 ]; then failed=1; fi
-
-${JINFO} -J-XX:+UsePerfData -flag PrintGC $appJavaPid
-if [ $? != 0 ]; then failed=1; fi
-
-if $isSolaris; then
-
-    ${JINFO} -J-XX:+UsePerfData -flag +ExtendedDTraceProbes $appJavaPid
-    if [ $? != 0 ]; then failed=1; fi
-
-    ${JINFO} -J-XX:+UsePerfData -flag -ExtendedDTraceProbes $appJavaPid
-    if [ $? != 0 ]; then failed=1; fi
-
-    ${JINFO} -J-XX:+UsePerfData -flag ExtendedDTraceProbes $appJavaPid
-    if [ $? != 0 ]; then failed=1; fi
-
-fi
-
-set -e
-
-stopApplication "${PORTFILE}"
-waitForApplication
-
-exit $failed
diff --git a/jdk/test/sun/tools/jinfo/JInfoHelper.java b/jdk/test/sun/tools/jinfo/JInfoHelper.java
new file mode 100644
index 00000000000..abbc862c2c8
--- /dev/null
+++ b/jdk/test/sun/tools/jinfo/JInfoHelper.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.util.Arrays;
+
+import jdk.testlibrary.JDKToolLauncher;
+import jdk.testlibrary.OutputAnalyzer;
+import jdk.testlibrary.ProcessTools;
+
+/**
+ *  The helper class for running jinfo utility.
+ */
+public final class JInfoHelper {
+
+    /**
+     * Print configuration information for the current process
+     *
+     * @param toolArgs List of jinfo options
+     */
+    public static OutputAnalyzer jinfo(String... toolArgs) throws Exception {
+        return jinfo(true, toolArgs);
+    }
+
+    /**
+     * Print usage information
+     *
+     * @param toolArgs List of jinfo options
+     */
+    public static OutputAnalyzer jinfoNoPid(String... toolArgs) throws Exception {
+        return jinfo(false, toolArgs);
+    }
+
+    private static OutputAnalyzer jinfo(boolean toPid, String... toolArgs) throws Exception {
+        JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("jinfo");
+        if (toolArgs != null) {
+            for (String toolArg : toolArgs) {
+                launcher.addToolArg(toolArg);
+            }
+        }
+        if (toPid) {
+            launcher.addToolArg(Integer.toString(ProcessTools.getProcessId()));
+        }
+
+        ProcessBuilder processBuilder = new ProcessBuilder(launcher.getCommand());
+        System.out.println(Arrays.toString(processBuilder.command().toArray()).replace(",", ""));
+        OutputAnalyzer output = ProcessTools.executeProcess(processBuilder);
+        System.out.println(output.getOutput());
+
+        return output;
+    }
+
+}
diff --git a/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java b/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java
new file mode 100644
index 00000000000..deb3c860d63
--- /dev/null
+++ b/jdk/test/sun/tools/jinfo/JInfoRunningProcessFlagTest.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import sun.management.ManagementFactoryHelper;
+
+import com.sun.management.HotSpotDiagnosticMXBean;
+
+import jdk.testlibrary.OutputAnalyzer;
+import static jdk.testlibrary.Platform.isSolaris;
+import static jdk.testlibrary.Asserts.assertEquals;
+import static jdk.testlibrary.Asserts.assertNotEquals;
+import static jdk.testlibrary.Asserts.assertTrue;
+
+/**
+ * @test
+ * @summary The test sanity checks 'jinfo -flag' option.
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.* JInfoHelper
+ * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError JInfoRunningProcessFlagTest
+ */
+public class JInfoRunningProcessFlagTest {
+
+    public static void main(String[] args) throws Exception {
+        testFlag();
+        testFlagPlus();
+        testFlagMinus();
+        testFlagEqual();
+
+        testInvalidFlag();
+
+        testSolarisSpecificFlag();
+    }
+
+    private static void testFlag() throws Exception {
+        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "HeapDumpOnOutOfMemoryError");
+        output.shouldHaveExitValue(0);
+        assertTrue(output.getStderr().isEmpty(), "'jinfo -flag HeapDumpOnOutOfMemoryError' stderr should be empty");
+        output.shouldContain("+HeapDumpOnOutOfMemoryError");
+    }
+
+    private static void testFlagPlus() throws Exception {
+        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+PrintGC");
+        output.shouldHaveExitValue(0);
+        output = JInfoHelper.jinfo("-flag", "PrintGC");
+        output.shouldHaveExitValue(0);
+        output.shouldContain("+PrintGC");
+        verifyIsEnabled("PrintGC");
+    }
+
+    private static void testFlagMinus() throws Exception {
+        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "-PrintGC");
+        output.shouldHaveExitValue(0);
+        output = JInfoHelper.jinfo("-flag", "PrintGC");
+        output.shouldHaveExitValue(0);
+        output.shouldContain("-PrintGC");
+        verifyIsDisabled("PrintGC");
+    }
+
+    private static void testFlagEqual() throws Exception {
+        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "PrintGC=1");
+        output.shouldHaveExitValue(0);
+        output = JInfoHelper.jinfo("-flag", "PrintGC");
+        output.shouldHaveExitValue(0);
+        output.shouldContain("+PrintGC");
+        verifyIsEnabled("PrintGC");
+    }
+
+    private static void testInvalidFlag() throws Exception {
+        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "monkey");
+        assertNotEquals(output.getExitValue(), 0, "A non-zero exit code should be returned for invalid flag");
+    }
+
+    private static void testSolarisSpecificFlag() throws Exception {
+        if (!isSolaris())
+            return;
+
+        OutputAnalyzer output = JInfoHelper.jinfo("-flag", "+ExtendedDTraceProbes");
+        output.shouldHaveExitValue(0);
+        output = JInfoHelper.jinfo();
+        output.shouldContain("+ExtendedDTraceProbes");
+        verifyIsEnabled("ExtendedDTraceProbes");
+
+        output = JInfoHelper.jinfo("-flag", "-ExtendedDTraceProbes");
+        output.shouldHaveExitValue(0);
+        output = JInfoHelper.jinfo();
+        output.shouldContain("-ExtendedDTraceProbes");
+        verifyIsDisabled("ExtendedDTraceProbes");
+
+        output = JInfoHelper.jinfo("-flag", "ExtendedDTraceProbes");
+        output.shouldContain("-ExtendedDTraceProbes");
+        output.shouldHaveExitValue(0);
+    }
+
+    private static void verifyIsEnabled(String flag) {
+        HotSpotDiagnosticMXBean hotspotDiagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
+        String flagValue = hotspotDiagnostic.getVMOption(flag).getValue();
+        assertEquals(flagValue, "true", "Expected '" + flag + "' flag be enabled");
+    }
+
+    private static void verifyIsDisabled(String flag) {
+        HotSpotDiagnosticMXBean hotspotDiagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
+        String flagValue = hotspotDiagnostic.getVMOption(flag).getValue();
+        assertEquals(flagValue, "false", "Expected '" + flag + "' flag be disabled");
+    }
+
+}
diff --git a/jdk/test/sun/tools/jinfo/JInfoRunningProcessTest.java b/jdk/test/sun/tools/jinfo/JInfoRunningProcessTest.java
new file mode 100644
index 00000000000..e204254ab34
--- /dev/null
+++ b/jdk/test/sun/tools/jinfo/JInfoRunningProcessTest.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import jdk.testlibrary.OutputAnalyzer;
+import static jdk.testlibrary.Asserts.assertTrue;
+
+/**
+ * @test
+ * @summary The test sanity checks functionality of 'jinfo', 'jinfo -sysprops' and 'jinfo -flags'
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.* JInfoHelper
+ * @run main/othervm -XX:+HeapDumpOnOutOfMemoryError JInfoRunningProcessTest
+ */
+public class JInfoRunningProcessTest {
+
+    public static void main(String[] args) throws Exception {
+        testNoOptions();
+        testSysprops();
+        testFlags();
+    }
+
+    private static void testNoOptions() throws Exception {
+        OutputAnalyzer output = JInfoHelper.jinfo();
+        output.shouldHaveExitValue(0);
+        assertTrue(output.getStderr().isEmpty(), "'jinfo' stderr should be empty");
+        output.shouldContain("+HeapDumpOnOutOfMemoryError");
+    }
+
+    private static void testSysprops() throws Exception {
+        OutputAnalyzer output = JInfoHelper.jinfo("-sysprops");
+        output.shouldHaveExitValue(0);
+        assertTrue(output.getStderr().isEmpty(), "'jinfo -sysprops' stderr should be empty");
+    }
+
+    private static void testFlags() throws Exception {
+        OutputAnalyzer output = JInfoHelper.jinfo("-flags");
+        output.shouldHaveExitValue(0);
+        assertTrue(output.getStderr().isEmpty(), "'jinfo -flags' stderr should be empty");
+        output.shouldContain("+HeapDumpOnOutOfMemoryError");
+    }
+
+}
diff --git a/jdk/test/sun/tools/jinfo/JInfoSanityTest.java b/jdk/test/sun/tools/jinfo/JInfoSanityTest.java
new file mode 100644
index 00000000000..dfc1b13d1f3
--- /dev/null
+++ b/jdk/test/sun/tools/jinfo/JInfoSanityTest.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import static jdk.testlibrary.Asserts.assertNotEquals;
+import static jdk.testlibrary.Asserts.assertTrue;
+import static jdk.testlibrary.Asserts.assertFalse;
+import jdk.testlibrary.OutputAnalyzer;
+
+/**
+ * @test
+ * @summary The test sanity checks functionality of 'jinfo -h', 'jinfo -help',
+ *          and verifies jinfo exits abnormally if started with invalid options.
+ * @library /lib/testlibrary
+ * @build jdk.testlibrary.* JInfoHelper
+ * @run main JInfoSanityTest
+ */
+public class JInfoSanityTest {
+
+    public static void main(String[] args) throws Exception {
+        test_h();
+        test_help();
+        testVersion();
+        testUnknownHost();
+    }
+
+    private static void test_h() throws Exception {
+        OutputAnalyzer output = JInfoHelper.jinfoNoPid("-h");
+        output.shouldHaveExitValue(0);
+        assertFalse(output.getStderr().isEmpty(), "'jinfo -h' stderr should not be empty");
+        assertTrue(output.getStdout().isEmpty(), "'jinfo -h' stdout should be empty");
+    }
+
+    private static void test_help() throws Exception {
+        OutputAnalyzer output = JInfoHelper.jinfoNoPid("-help");
+        output.shouldHaveExitValue(0);
+        assertFalse(output.getStderr().isEmpty(), "'jinfo -help' stderr should not be empty");
+        assertTrue(output.getStdout().isEmpty(), "'jinfo -help' stdout should be empty");
+    }
+
+    private static void testVersion() throws Exception {
+        OutputAnalyzer output = JInfoHelper.jinfoNoPid("-version");
+        output.shouldHaveExitValue(1);
+        assertFalse(output.getStderr().isEmpty(), "'jinfo -version' stderr should not be empty");
+        assertTrue(output.getStdout().isEmpty(), "'jinfo -version' stdout should be empty");
+    }
+
+    private static void testUnknownHost() throws Exception {
+        String unknownHost = "Oja781nh2ev7vcvbajdg-Sda1-C";
+        OutputAnalyzer output = JInfoHelper.jinfoNoPid("med@" + unknownHost);
+        assertNotEquals(output.getExitValue(), 0, "A non-zero exit code should be returned for invalid operation");
+        output.shouldContain("UnknownHostException: " + unknownHost);
+    }
+
+}

From f30ba73e1622e12ac129138a3db8b3693d034eff Mon Sep 17 00:00:00 2001
From: Sergey Gabdurakhmanov <sgabdura@openjdk.org>
Date: Mon, 17 Nov 2014 13:11:37 +0100
Subject: [PATCH 099/299] 8048050: Agent NullPointerException when rmi.port in
 use

Reviewed-by: jbachorik, dfuchs
---
 .../classes/sun/management/jmxremote/ConnectorBootstrap.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java b/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java
index a2f05634c62..e4d1c2f005f 100644
--- a/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java
+++ b/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java
@@ -767,7 +767,7 @@ public final class ConnectorBootstrap {
                     JMXConnectorServerFactory.newJMXConnectorServer(url, env, mbs);
             connServer.start();
         } catch (IOException e) {
-            if (connServer == null) {
+            if (connServer == null || connServer.getAddress() == null) {
                 throw new AgentConfigurationError(CONNECTOR_SERVER_IO_ERROR,
                         e, url.toString());
             } else {

From e1f99ed979672150e8a9532701a7862bb106afd1 Mon Sep 17 00:00:00 2001
From: Aleksey Shipilev <shade@openjdk.org>
Date: Mon, 17 Nov 2014 15:30:22 +0300
Subject: [PATCH 100/299] 8065096: java.net.Authenticator.theAuthenticator
 should be properly synchronized

Reviewed-by: chegar, lancea
---
 jdk/src/java.base/share/classes/java/net/Authenticator.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/src/java.base/share/classes/java/net/Authenticator.java b/jdk/src/java.base/share/classes/java/net/Authenticator.java
index c88a6006b89..a83f40791d2 100644
--- a/jdk/src/java.base/share/classes/java/net/Authenticator.java
+++ b/jdk/src/java.base/share/classes/java/net/Authenticator.java
@@ -60,7 +60,7 @@ public abstract
 class Authenticator {
 
     // The system-wide authenticator object.  See setDefault().
-    private static Authenticator theAuthenticator;
+    private static volatile Authenticator theAuthenticator;
 
     private String requestingHost;
     private InetAddress requestingSite;

From ad0645eb58d386fb427eafdc3c41e0e004922ed7 Mon Sep 17 00:00:00 2001
From: Marcus Lagergren <lagergren@openjdk.org>
Date: Mon, 17 Nov 2014 14:36:15 +0100
Subject: [PATCH 101/299] 8049407: Endianness problem with TypedArrays

Reviewed-by: hannesw, sundar
---
 .../script/basic/JDK-8049407-big-endian.js    |  33 +++
 .../basic/JDK-8049407-big-endian.js.EXPECTED  |   1 +
 .../test/script/basic/JDK-8049407-payload.js  |  37 +++
 nashorn/test/script/basic/JDK-8049407.js      |  33 +++
 .../test/script/basic/JDK-8049407.js.EXPECTED |   1 +
 .../script/basic/NASHORN-377-big-endian.js    |  33 +++
 .../basic/NASHORN-377-big-endian.js.EXPECTED  |  34 +++
 .../test/script/basic/NASHORN-377-payload.js  | 226 ++++++++++++++++++
 nashorn/test/script/basic/NASHORN-377.js      | 199 +--------------
 .../internal/test/framework/TestFinder.java   |   7 +
 10 files changed, 408 insertions(+), 196 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8049407-big-endian.js
 create mode 100644 nashorn/test/script/basic/JDK-8049407-big-endian.js.EXPECTED
 create mode 100644 nashorn/test/script/basic/JDK-8049407-payload.js
 create mode 100644 nashorn/test/script/basic/JDK-8049407.js
 create mode 100644 nashorn/test/script/basic/JDK-8049407.js.EXPECTED
 create mode 100644 nashorn/test/script/basic/NASHORN-377-big-endian.js
 create mode 100644 nashorn/test/script/basic/NASHORN-377-big-endian.js.EXPECTED
 create mode 100644 nashorn/test/script/basic/NASHORN-377-payload.js

diff --git a/nashorn/test/script/basic/JDK-8049407-big-endian.js b/nashorn/test/script/basic/JDK-8049407-big-endian.js
new file mode 100644
index 00000000000..323c4540246
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8049407-big-endian.js
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * Verify DataView behavior with little/big endian
+ *
+ * @test
+ * @run
+ * @bigendian
+ */
+
+var dir = typeof(__DIR__) == 'undefined' ? "test/script/basic/" : __DIR__;
+load(dir + "JDK-8049407-payload.js");
diff --git a/nashorn/test/script/basic/JDK-8049407-big-endian.js.EXPECTED b/nashorn/test/script/basic/JDK-8049407-big-endian.js.EXPECTED
new file mode 100644
index 00000000000..c508d5366f7
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8049407-big-endian.js.EXPECTED
@@ -0,0 +1 @@
+false
diff --git a/nashorn/test/script/basic/JDK-8049407-payload.js b/nashorn/test/script/basic/JDK-8049407-payload.js
new file mode 100644
index 00000000000..467d4bb7cb3
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8049407-payload.js
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * Verify DataView behavior with little/big endian
+ *
+ * @subtest
+ * @run
+ */
+
+var littleEndian = (function() {
+	var buffer = new ArrayBuffer(2);
+	new DataView(buffer).setInt16(0, 256, true);
+	return new Int16Array(buffer)[0] === 256;
+    })();
+
+print(littleEndian);
diff --git a/nashorn/test/script/basic/JDK-8049407.js b/nashorn/test/script/basic/JDK-8049407.js
new file mode 100644
index 00000000000..4bfcd26c30f
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8049407.js
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * Verify DataView behavior with little/big endian
+ *
+ * @test
+ * @run
+ * @littleendian
+ */
+
+var dir = typeof(__DIR__) == 'undefined' ? "test/script/basic/" : __DIR__;
+load(dir + "JDK-8049407-payload.js");
diff --git a/nashorn/test/script/basic/JDK-8049407.js.EXPECTED b/nashorn/test/script/basic/JDK-8049407.js.EXPECTED
new file mode 100644
index 00000000000..27ba77ddaf6
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8049407.js.EXPECTED
@@ -0,0 +1 @@
+true
diff --git a/nashorn/test/script/basic/NASHORN-377-big-endian.js b/nashorn/test/script/basic/NASHORN-377-big-endian.js
new file mode 100644
index 00000000000..30f0cc3eb49
--- /dev/null
+++ b/nashorn/test/script/basic/NASHORN-377-big-endian.js
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+/*
+ * NASHORN-377: Typed arrays.
+ *
+ * @test
+ * @run
+ * @bigendian
+ */
+
+var dir = typeof(__DIR__) == 'undefined' ? "test/script/basic/" : __DIR__;
+load(dir + "NASHORN-377-payload.js");
diff --git a/nashorn/test/script/basic/NASHORN-377-big-endian.js.EXPECTED b/nashorn/test/script/basic/NASHORN-377-big-endian.js.EXPECTED
new file mode 100644
index 00000000000..ed3f19abd00
--- /dev/null
+++ b/nashorn/test/script/basic/NASHORN-377-big-endian.js.EXPECTED
@@ -0,0 +1,34 @@
+8 8 true undefined
+[object ArrayBuffer] [object ArrayBuffer] [object Int8Array]
+0 8 8 1
+0 8 8 1
+0 8 8 1
+0 8 4 2
+0 8 4 2
+0 8 2 4
+0 8 2 4
+0 8 2 4
+0 8 1 8
+7071727374-807677 7071727374807677
+727374-807677 2 6
+72737480 2 4
+71727374 1 4
+717273748076
+7071727374807677 1886483059 1954575991
+70717273-1020305 1886483059 -16909061
+70717273fefdfcfb 1886483059 4278058235
+40490fdafefdfcfb 2
+400921fb4d12d84a 1
+400921fb4d12d84a 1074340347 1293080650
+00000000400921fb4d12d84a
+400921fb4d12-27b6 400921fb4d12d84a
+00-100804d12-27b6 ffff00804d12d84a
+0 1 2 3 4 5 6 7
+0102030405060708
+subarray(2,4)=0304 subarray(-6,-4)=0304
+010203040506
+03040506 0405
+0102030405060708090a0b0c0d0e0f10
+slice(4,8)=05060708 slice(-8,-4)=090a0b0c
+0102030405060708090a0b0c
+060708090a0b
diff --git a/nashorn/test/script/basic/NASHORN-377-payload.js b/nashorn/test/script/basic/NASHORN-377-payload.js
new file mode 100644
index 00000000000..b47fb7cfa74
--- /dev/null
+++ b/nashorn/test/script/basic/NASHORN-377-payload.js
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2010, 2013, 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.
+ */
+
+/*
+ * NASHORN-377: Typed arrays. Payload for litte and big endian platforms.
+ *
+ * @subtest
+ * @run
+ */
+
+var types = [Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];
+
+//---------------------------------------------------------------------------
+// utility functions
+//---------------------------------------------------------------------------
+function tohex(d, w) {
+  var hex = Number(d).toString(16);
+  var pad = (w ? w : 8) - hex.length;
+  hex = "00000000".substr(0, pad) + hex;
+  return hex;
+}
+
+function arrstr(a, n, w) {
+  var s = "";
+  if (typeof n == "undefined") n = a.length;
+  if (typeof w == "undefined") w = a.constructor.BYTES_PER_ELEMENT * 2;
+  for (var i = 0; i < n; i++) {
+    s += tohex(a[i], w);
+  }
+  return s;
+}
+function bufstr(b) {
+  if (b.buffer !== undefined) {
+    b = b.buffer;
+  }
+  return arrstr(new Uint8Array(b));
+}
+
+function assertFail(f) {
+  try {
+    f();
+  } catch (e) {
+    //print(e);
+    return;
+  }
+  throw "assertion failed: expected exception";
+}
+
+function assertTrue(f) {
+  if (f() !== true) throw "assertion failed: " + f;
+}
+
+function isUndefined(x) {
+  return typeof x === "undefined";
+}
+
+function fillArray(a, start) {
+  if (typeof start == "undefined") start = 1;
+  for (var i = 0; i < a.length; i++) {
+    a[i] = i + start;
+  }
+  return a;
+}
+
+//---------------------------------------------------------------------------
+// tests
+//---------------------------------------------------------------------------
+(function() {
+  var b = new ArrayBuffer(8);
+  var i8 = new Int8Array(b);
+  print(i8.buffer.byteLength, b.byteLength, i8.buffer === b, b.length);
+  print(b, i8.buffer, i8);
+})();
+
+(function test_attributes() {
+  var b = new ArrayBuffer(8);
+  for (var i in types) {
+    var x = new types[i](b);
+    print(x.byteOffset, x.byteLength, x.length, x.constructor.BYTES_PER_ELEMENT);
+    assertTrue(function(){ return x.constructor === types[i] });
+  }
+})();
+
+(function() {
+  var b = new ArrayBuffer(8);
+  var i8 = new Int8Array(b);
+  fillArray(i8, 0x70);
+
+  var i8_2 = new Int8Array(b, 2);
+  var i8_2_4 = new Uint8Array(b, 2, 4);
+
+  i8_2_4[3] = 0x80;
+
+  print(arrstr(i8, 8, 2)  + " " + bufstr(i8));
+  print(arrstr(i8_2, 6)   + " " + i8_2.byteOffset   + " " + i8_2.byteLength);
+  print(arrstr(i8_2_4, 4) + " " + i8_2_4.byteOffset + " " + i8_2_4.byteLength);
+
+  var i8_1_5 = i8.subarray(1, 5);
+  i8_2_4.subarray(1, 5);
+  print(arrstr(i8_1_5, 4) + " " + i8_1_5.byteOffset + " " + i8_1_5.byteLength);
+
+  print(bufstr(b.slice(1,7)));
+})();
+
+(function() {
+  var b = new ArrayBuffer(8);
+  fillArray(new Int8Array(b), 0x70);
+  new Int8Array(b)[5] = 0x80;
+
+  var i32 = new Int32Array(b);
+  var u32 = new Uint32Array(b);
+  print(arrstr(i32), i32[0], i32[1]);
+  i32[1] = 0xfefdfcfb;
+  print(arrstr(i32), i32[0], i32[1]);
+  print(arrstr(u32), u32[0], u32[1]);
+
+  var pi = 3.1415926;
+  var f32 = new Float32Array(b);
+  var f64 = new Float64Array(b);
+  f32[0] = pi;
+  print(bufstr(b), f32.length);
+  f64[0] = pi;
+  print(bufstr(b), f64.length);
+  print(arrstr(u32), u32[0], u32[1]);
+
+  var d = new Int32Array(3);
+  d.set(i32,1);
+  print(bufstr(d));
+
+  var s = new Int16Array(b);
+  var t = new Uint16Array(b);
+  print(arrstr(s), arrstr(t));
+  s[0] = -1; s[1] = 0x80;
+  print(arrstr(s), arrstr(t));
+})();
+
+(function enumerate_properties() {
+  var i8 = new Int8Array(new ArrayBuffer(8));
+  var s = ""; for (var i in i8) { s += i + " "; } print(s.trim());
+})();
+
+// check that ScriptObject fallback is still working
+// DISABLED because correct behavior is unclear
+(function() {
+  // NB: firefox will never set any out-of-bounds or non-array values although it does get both from prototype.
+  var z = new Uint8Array(4);
+  z["asdf"] = "asdf"; print(z["asdf"]);
+  z[0x100000000] = "asdf"; print(z[0x100000000]);
+  z[-1] = "asdf"; print(z[-1]);
+
+  // v8 and nashorn disagree on out-of-bounds uint32 indices: v8 won't go to the prototype.
+  z[0xf0000000] = "asdf"; print(z[0xf0000000]);
+  z[0xffffffff] = "asdf"; print(z[0xffffffff]);
+  z[0x70000000] = "asdf"; print(z[0x70000000]);
+
+  // this will work in firefox and nashorn (not in v8).
+  Uint8Array.prototype[4] = "asdf"; print(z[4]);
+});
+
+(function test_exceptions() {
+  assertFail(function() { new Int32Array(new ArrayBuffer(7)); });
+  assertFail(function() { new Int32Array(new ArrayBuffer(8), 0, 4); });
+  assertFail(function() { new Int32Array(new ArrayBuffer(8),-1, 2); });
+  assertFail(function() { new Int32Array(new ArrayBuffer(8), 0,-1); });
+})();
+
+(function test_subarray() {
+  var x = fillArray(new Int8Array(8));
+  print(arrstr(x));
+  print("subarray(2,4)=" + arrstr(x.subarray(2, 4)), "subarray(-6,-4)=" + arrstr(x.subarray(-6, -4))); // negative index refers from the end of the array
+  print(arrstr(x.subarray(-10, -2))); // negative index clamped to 0
+  assertTrue(function(){ return arrstr(x.subarray(6, 4)) === ""; }); // negative length clamped to 0
+  print(arrstr(x.subarray(1,-1).subarray(1,-1)), arrstr(x.subarray(1,-1).subarray(1,-1).subarray(1,-1))); // subarray of subarray
+})();
+
+(function test_slice() {
+  var b = new ArrayBuffer(16);
+  fillArray(new Int8Array(b));
+  print(bufstr(b));
+  print("slice(4,8)=" + bufstr(b.slice(4, 8)), "slice(-8,-4)=" + bufstr(b.slice(-8, -4))); // negative index refers from the end of the array
+  print(bufstr(b.slice(-20, -4))); // negative index clamped to 0
+  assertTrue(function(){ return bufstr(b.slice(8, 4)) === ""; }); // negative length clamped to 0
+  print(arrstr(new Int16Array(b.slice(1,-1).slice(2,-1).slice(1,-2).slice(1,-1)))); // slice of slice
+})();
+
+(function test_clamped() {
+  var a = new Uint8ClampedArray(10);
+  a[0] = -17;       // clamped to 0
+  a[1] = 4711;      // clamped to 255
+  a[2] = 17.5;      // clamped to 18
+  a[3] = 16.5;      // clamped to 16
+  a[4] = 255.9;     // clamped to 255
+  a[5] = Infinity;  // clamped to 255
+  a[6] = -Infinity; // clamped to 0
+  a[7] = NaN;       // 0
+  assertTrue(function(){ return a[0] === 0 && a[1] === 255 && a[2] === 18 && a[3] === 16 && a[4] === 255 && a[5] === 255 && a[6] === 0 && a[7] === 0; });
+})();
+
+(function test_out_of_bounds() {
+  var a = new Int32Array(10);
+  a[10] = 10;
+  a[100] = 100;
+  a[1000] = 1000;
+  assertTrue(function(){ return isUndefined(a[10]) && isUndefined(a[11]) && isUndefined(a[100]) && isUndefined(a[123]) && isUndefined(a[1000]); });
+})();
+
diff --git a/nashorn/test/script/basic/NASHORN-377.js b/nashorn/test/script/basic/NASHORN-377.js
index 968e46e8797..3484223f90d 100644
--- a/nashorn/test/script/basic/NASHORN-377.js
+++ b/nashorn/test/script/basic/NASHORN-377.js
@@ -26,201 +26,8 @@
  *
  * @test
  * @run
+ * @littleendian
  */
 
-var types = [Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array];
-
-//---------------------------------------------------------------------------
-// utility functions
-//---------------------------------------------------------------------------
-function tohex(d, w) {
-  var hex = Number(d).toString(16);
-  var pad = (w ? w : 8) - hex.length;
-  hex = "00000000".substr(0, pad) + hex;
-  return hex;
-}
-
-function arrstr(a, n, w) {
-  var s = "";
-  if (typeof n == "undefined") n = a.length;
-  if (typeof w == "undefined") w = a.constructor.BYTES_PER_ELEMENT * 2;
-  for (var i = 0; i < n; i++) {
-    s += tohex(a[i], w);
-  }
-  return s;
-}
-function bufstr(b) {
-  if (b.buffer !== undefined) {
-    b = b.buffer;
-  }
-  return arrstr(new Uint8Array(b));
-}
-
-function assertFail(f) {
-  try {
-    f();
-  } catch (e) {
-    //print(e);
-    return;
-  }
-  throw "assertion failed: expected exception";
-}
-
-function assertTrue(f) {
-  if (f() !== true) throw "assertion failed: " + f;
-}
-
-function isUndefined(x) {
-  return typeof x === "undefined";
-}
-
-function fillArray(a, start) {
-  if (typeof start == "undefined") start = 1;
-  for (var i = 0; i < a.length; i++) {
-    a[i] = i + start;
-  }
-  return a;
-}
-
-//---------------------------------------------------------------------------
-// tests
-//---------------------------------------------------------------------------
-(function() {
-  var b = new ArrayBuffer(8);
-  var i8 = new Int8Array(b);
-  print(i8.buffer.byteLength, b.byteLength, i8.buffer === b, b.length);
-  print(b, i8.buffer, i8);
-})();
-
-(function test_attributes() {
-  var b = new ArrayBuffer(8);
-  for (var i in types) {
-    var x = new types[i](b);
-    print(x.byteOffset, x.byteLength, x.length, x.constructor.BYTES_PER_ELEMENT);
-    assertTrue(function(){ return x.constructor === types[i] });
-  }
-})();
-
-(function() {
-  var b = new ArrayBuffer(8);
-  var i8 = new Int8Array(b);
-  fillArray(i8, 0x70);
-
-  var i8_2 = new Int8Array(b, 2);
-  var i8_2_4 = new Uint8Array(b, 2, 4);
-
-  i8_2_4[3] = 0x80;
-
-  print(arrstr(i8, 8, 2)  + " " + bufstr(i8));
-  print(arrstr(i8_2, 6)   + " " + i8_2.byteOffset   + " " + i8_2.byteLength);
-  print(arrstr(i8_2_4, 4) + " " + i8_2_4.byteOffset + " " + i8_2_4.byteLength);
-
-  var i8_1_5 = i8.subarray(1, 5);
-  i8_2_4.subarray(1, 5);
-  print(arrstr(i8_1_5, 4) + " " + i8_1_5.byteOffset + " " + i8_1_5.byteLength);
-
-  print(bufstr(b.slice(1,7)));
-})();
-
-(function() {
-  var b = new ArrayBuffer(8);
-  fillArray(new Int8Array(b), 0x70);
-  new Int8Array(b)[5] = 0x80;
-
-  var i32 = new Int32Array(b);
-  var u32 = new Uint32Array(b);
-  print(arrstr(i32), i32[0], i32[1]);
-  i32[1] = 0xfefdfcfb;
-  print(arrstr(i32), i32[0], i32[1]);
-  print(arrstr(u32), u32[0], u32[1]);
-
-  var pi = 3.1415926;
-  var f32 = new Float32Array(b);
-  var f64 = new Float64Array(b);
-  f32[0] = pi;
-  print(bufstr(b), f32.length);
-  f64[0] = pi;
-  print(bufstr(b), f64.length);
-  print(arrstr(u32), u32[0], u32[1]);
-
-  var d = new Int32Array(3);
-  d.set(i32,1);
-  print(bufstr(d));
-
-  var s = new Int16Array(b);
-  var t = new Uint16Array(b);
-  print(arrstr(s), arrstr(t));
-  s[0] = -1; s[1] = 0x80;
-  print(arrstr(s), arrstr(t));
-})();
-
-(function enumerate_properties() {
-  var i8 = new Int8Array(new ArrayBuffer(8));
-  var s = ""; for (var i in i8) { s += i + " "; } print(s.trim());
-})();
-
-// check that ScriptObject fallback is still working
-// DISABLED because correct behavior is unclear
-(function() {
-  // NB: firefox will never set any out-of-bounds or non-array values although it does get both from prototype.
-  var z = new Uint8Array(4);
-  z["asdf"] = "asdf"; print(z["asdf"]);
-  z[0x100000000] = "asdf"; print(z[0x100000000]);
-  z[-1] = "asdf"; print(z[-1]);
-
-  // v8 and nashorn disagree on out-of-bounds uint32 indices: v8 won't go to the prototype.
-  z[0xf0000000] = "asdf"; print(z[0xf0000000]);
-  z[0xffffffff] = "asdf"; print(z[0xffffffff]);
-  z[0x70000000] = "asdf"; print(z[0x70000000]);
-
-  // this will work in firefox and nashorn (not in v8).
-  Uint8Array.prototype[4] = "asdf"; print(z[4]);
-});
-
-(function test_exceptions() {
-  assertFail(function() { new Int32Array(new ArrayBuffer(7)); });
-  assertFail(function() { new Int32Array(new ArrayBuffer(8), 0, 4); });
-  assertFail(function() { new Int32Array(new ArrayBuffer(8),-1, 2); });
-  assertFail(function() { new Int32Array(new ArrayBuffer(8), 0,-1); });
-})();
-
-(function test_subarray() {
-  var x = fillArray(new Int8Array(8));
-  print(arrstr(x));
-  print("subarray(2,4)=" + arrstr(x.subarray(2, 4)), "subarray(-6,-4)=" + arrstr(x.subarray(-6, -4))); // negative index refers from the end of the array
-  print(arrstr(x.subarray(-10, -2))); // negative index clamped to 0
-  assertTrue(function(){ return arrstr(x.subarray(6, 4)) === ""; }); // negative length clamped to 0
-  print(arrstr(x.subarray(1,-1).subarray(1,-1)), arrstr(x.subarray(1,-1).subarray(1,-1).subarray(1,-1))); // subarray of subarray
-})();
-
-(function test_slice() {
-  var b = new ArrayBuffer(16);
-  fillArray(new Int8Array(b));
-  print(bufstr(b));
-  print("slice(4,8)=" + bufstr(b.slice(4, 8)), "slice(-8,-4)=" + bufstr(b.slice(-8, -4))); // negative index refers from the end of the array
-  print(bufstr(b.slice(-20, -4))); // negative index clamped to 0
-  assertTrue(function(){ return bufstr(b.slice(8, 4)) === ""; }); // negative length clamped to 0
-  print(arrstr(new Int16Array(b.slice(1,-1).slice(2,-1).slice(1,-2).slice(1,-1)))); // slice of slice
-})();
-
-(function test_clamped() {
-  var a = new Uint8ClampedArray(10);
-  a[0] = -17;       // clamped to 0
-  a[1] = 4711;      // clamped to 255
-  a[2] = 17.5;      // clamped to 18
-  a[3] = 16.5;      // clamped to 16
-  a[4] = 255.9;     // clamped to 255
-  a[5] = Infinity;  // clamped to 255
-  a[6] = -Infinity; // clamped to 0
-  a[7] = NaN;       // 0
-  assertTrue(function(){ return a[0] === 0 && a[1] === 255 && a[2] === 18 && a[3] === 16 && a[4] === 255 && a[5] === 255 && a[6] === 0 && a[7] === 0; });
-})();
-
-(function test_out_of_bounds() {
-  var a = new Int32Array(10);
-  a[10] = 10;
-  a[100] = 100;
-  a[1000] = 1000;
-  assertTrue(function(){ return isUndefined(a[10]) && isUndefined(a[11]) && isUndefined(a[100]) && isUndefined(a[123]) && isUndefined(a[1000]); });
-})();
-
+var dir = typeof(__DIR__) == 'undefined' ? "test/script/basic/" : __DIR__;
+load(dir + "NASHORN-377-payload.js");
diff --git a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java
index 851cb46c1fe..3f4252b0c04 100644
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/TestFinder.java
@@ -46,6 +46,7 @@ import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileReader;
 import java.io.IOException;
+import java.nio.ByteOrder;
 import java.nio.file.FileSystem;
 import java.nio.file.FileSystems;
 import java.nio.file.FileVisitOption;
@@ -264,6 +265,12 @@ public final class TestFinder {
                     isTest = false;
                     isNotTest = true;
                     break;
+                case "@bigendian":
+                    shouldRun = ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN;
+                    break;
+                case "@littleendian":
+                    shouldRun = ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN;
+                    break;
                 case "@runif": {
                     final String prop = scanner.next();
                     if (System.getProperty(prop) != null) {

From f3d9096e4dac9a267d8e888945d13dd18732c304 Mon Sep 17 00:00:00 2001
From: Vladimir Ivanov <vlivanov@openjdk.org>
Date: Mon, 17 Nov 2014 14:02:45 -0800
Subject: [PATCH 102/299] 8062258: compiler/debug/TraceIterativeGVN.java
 segfaults in trace_PhaseIterGVN

Reviewed-by: kvn
---
 hotspot/src/share/vm/opto/machnode.cpp | 4 +++-
 hotspot/src/share/vm/opto/memnode.cpp  | 2 ++
 hotspot/src/share/vm/opto/memnode.hpp  | 6 +++++-
 hotspot/src/share/vm/opto/multnode.cpp | 4 +++-
 4 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/hotspot/src/share/vm/opto/machnode.cpp b/hotspot/src/share/vm/opto/machnode.cpp
index a2112199f26..39c30782936 100644
--- a/hotspot/src/share/vm/opto/machnode.cpp
+++ b/hotspot/src/share/vm/opto/machnode.cpp
@@ -561,7 +561,9 @@ const Type *MachProjNode::bottom_type() const {
 const TypePtr *MachProjNode::adr_type() const {
   if (bottom_type() == Type::MEMORY) {
     // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM
-    const TypePtr* adr_type = in(0)->adr_type();
+    Node* ctrl = in(0);
+    if (ctrl == NULL)  return NULL; // node is dead
+    const TypePtr* adr_type = ctrl->adr_type();
     #ifdef ASSERT
     if (!is_error_reported() && !Node::in_dump())
       assert(adr_type != NULL, "source must have adr_type");
diff --git a/hotspot/src/share/vm/opto/memnode.cpp b/hotspot/src/share/vm/opto/memnode.cpp
index 1be984c4e74..702cc9bbd7e 100644
--- a/hotspot/src/share/vm/opto/memnode.cpp
+++ b/hotspot/src/share/vm/opto/memnode.cpp
@@ -52,6 +52,7 @@ uint MemNode::size_of() const { return sizeof(*this); }
 
 const TypePtr *MemNode::adr_type() const {
   Node* adr = in(Address);
+  if (adr == NULL)  return NULL; // node is dead
   const TypePtr* cross_check = NULL;
   DEBUG_ONLY(cross_check = _adr_type);
   return calculate_adr_type(adr->bottom_type(), cross_check);
@@ -2741,6 +2742,7 @@ LoadStoreConditionalNode::LoadStoreConditionalNode( Node *c, Node *mem, Node *ad
 // Do we Match on this edge index or not?  Do not match memory
 const TypePtr* ClearArrayNode::adr_type() const {
   Node *adr = in(3);
+  if (adr == NULL)  return NULL; // node is dead
   return MemNode::calculate_adr_type(adr->bottom_type());
 }
 
diff --git a/hotspot/src/share/vm/opto/memnode.hpp b/hotspot/src/share/vm/opto/memnode.hpp
index cbdd689fe8b..d32a4fa0c09 100644
--- a/hotspot/src/share/vm/opto/memnode.hpp
+++ b/hotspot/src/share/vm/opto/memnode.hpp
@@ -730,7 +730,11 @@ public:
   virtual int Opcode() const;
   virtual bool      is_CFG() const  { return false; }
   virtual const Type *bottom_type() const {return Type::MEMORY;}
-  virtual const TypePtr *adr_type() const { return in(0)->in(MemNode::Memory)->adr_type();}
+  virtual const TypePtr *adr_type() const {
+    Node* ctrl = in(0);
+    if (ctrl == NULL)  return NULL; // node is dead
+    return ctrl->in(MemNode::Memory)->adr_type();
+  }
   virtual uint ideal_reg() const { return 0;} // memory projections don't have a register
   virtual const Type *Value( PhaseTransform *phase ) const;
 #ifndef PRODUCT
diff --git a/hotspot/src/share/vm/opto/multnode.cpp b/hotspot/src/share/vm/opto/multnode.cpp
index 1da4b7789f4..c4d167faae9 100644
--- a/hotspot/src/share/vm/opto/multnode.cpp
+++ b/hotspot/src/share/vm/opto/multnode.cpp
@@ -102,7 +102,9 @@ const Type *ProjNode::bottom_type() const {
 const TypePtr *ProjNode::adr_type() const {
   if (bottom_type() == Type::MEMORY) {
     // in(0) might be a narrow MemBar; otherwise we will report TypePtr::BOTTOM
-    const TypePtr* adr_type = in(0)->adr_type();
+    Node* ctrl = in(0);
+    if (ctrl == NULL)  return NULL; // node is dead
+    const TypePtr* adr_type = ctrl->adr_type();
     #ifdef ASSERT
     if (!is_error_reported() && !Node::in_dump())
       assert(adr_type != NULL, "source must have adr_type");

From 5bb86103a9d71205f00e4fcc1483b2983be99193 Mon Sep 17 00:00:00 2001
From: Maurizio Cimadamore <mcimadamore@openjdk.org>
Date: Mon, 17 Nov 2014 23:41:56 +0000
Subject: [PATCH 103/299] 8064803: Javac erroneously uses instantiated
 signatures when merging abstract most-specific methods

Wrong method type used in AmbiguousError.mergeAbstracts

Reviewed-by: jlahoda
---
 .../com/sun/tools/javac/comp/Resolve.java     |  2 +-
 .../javac/generics/8064803/T8064803.java      | 53 +++++++++++++++++++
 2 files changed, 54 insertions(+), 1 deletion(-)
 create mode 100644 langtools/test/tools/javac/generics/8064803/T8064803.java

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
index 72083cd5269..4eab19f4531 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
@@ -4039,7 +4039,7 @@ public class Resolve {
                             s : new MethodSymbol(
                                 s.flags(),
                                 s.name,
-                                types.createMethodTypeWithThrown(mt, allThrown),
+                                types.createMethodTypeWithThrown(s.type, allThrown),
                                 s.owner);
                 }
             }
diff --git a/langtools/test/tools/javac/generics/8064803/T8064803.java b/langtools/test/tools/javac/generics/8064803/T8064803.java
new file mode 100644
index 00000000000..c12abf269de
--- /dev/null
+++ b/langtools/test/tools/javac/generics/8064803/T8064803.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @bug 8064803
+ * @summary Javac erroneously uses instantiated signatures when merging abstract most-specific methods
+ */
+public class T8064803 {
+    interface ParentA<T> {
+        T process() throws Exception;
+    }
+
+    interface ParentB<T> {
+        T process() throws Exception;
+    }
+
+    interface Child<T> extends ParentA<T>, ParentB<T> { }
+
+    static class ChildImpl<T> implements Child<T> {
+        @Override
+        public T process() {
+            return null;
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+        Child<String> child = new ChildImpl<String>();
+        child.process();
+    }
+}

From 9d6d069c222d8a65983c0494ab2f0fd3b777ee2b Mon Sep 17 00:00:00 2001
From: Michael Fang <mfang@openjdk.org>
Date: Mon, 17 Nov 2014 23:11:05 -0800
Subject: [PATCH 104/299] 8055798: Japanese translation for a warning from
 javac looks incorrect

Reviewed-by: peytoia
---
 .../com/sun/tools/javac/resources/compiler_ja.properties      | 4 ++--
 .../com/sun/tools/javac/resources/compiler_zh_CN.properties   | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties
index c045a085d8e..68f2a536e0d 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_ja.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2014, 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
@@ -1526,7 +1526,7 @@ compiler.warn.override.unchecked.ret={0}\n\u623B\u308A\u5024\u306E\u578B\u306F{1
 compiler.warn.override.unchecked.thrown={0}\n\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3055\u308C\u305F\u30E1\u30BD\u30C3\u30C9\u306F{1}\u3092\u30B9\u30ED\u30FC\u3057\u307E\u305B\u3093
 
 # 0: symbol
-compiler.warn.override.equals.but.not.hashcode=\u30AF\u30E9\u30B9{0}\u306F\u7B49\u53F7\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u307E\u3059\u304C\u3001\u3053\u306E\u30AF\u30E9\u30B9\u3082\u30B9\u30FC\u30D1\u30FC\u30AF\u30E9\u30B9\u3082hashCode\u30E1\u30BD\u30C3\u30C9\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u307E\u305B\u3093
+compiler.warn.override.equals.but.not.hashcode=\u30AF\u30E9\u30B9{0}\u306Fequals\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u307E\u3059\u304C\u3001\u3053\u306E\u30AF\u30E9\u30B9\u3082\u3001\u307E\u305F\u3001\u3044\u304B\u306A\u308B\u30B9\u30FC\u30D1\u30FC\u30AF\u30E9\u30B9\u3082\u3001hashCode\u30E1\u30BD\u30C3\u30C9\u3092\u30AA\u30FC\u30D0\u30FC\u30E9\u30A4\u30C9\u3057\u307E\u305B\u3093
 
 ## The following are all possible strings for the first argument ({0}) of the
 ## above strings.
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties
index 8f808a30e60..3cfa41c34e0 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler_zh_CN.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1999, 2014, 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
@@ -1526,7 +1526,7 @@ compiler.warn.override.unchecked.ret={0}\n\u8FD4\u56DE\u7C7B\u578B\u9700\u8981\u
 compiler.warn.override.unchecked.thrown={0}\n\u88AB\u8986\u76D6\u7684\u65B9\u6CD5\u672A\u629B\u51FA{1}
 
 # 0: symbol
-compiler.warn.override.equals.but.not.hashcode=\u7C7B{0}\u8986\u76D6\u4E86\u7B49\u53F7, \u4F46\u8BE5\u7C7B\u6216\u4EFB\u4F55\u8D85\u7C7B\u90FD\u672A\u8986\u76D6 hashCode \u65B9\u6CD5
+compiler.warn.override.equals.but.not.hashcode=\u7C7B{0}\u8986\u76D6\u4E86 equals, \u4F46\u8BE5\u7C7B\u6216\u4EFB\u4F55\u8D85\u7C7B\u90FD\u672A\u8986\u76D6 hashCode \u65B9\u6CD5
 
 ## The following are all possible strings for the first argument ({0}) of the
 ## above strings.

From 8a5d63f3a270ebd8ba2dbf8eff38ecbb7898eb13 Mon Sep 17 00:00:00 2001
From: Severin Gehwolf <sgehwolf@redhat.com>
Date: Tue, 18 Nov 2014 19:17:16 +0100
Subject: [PATCH 105/299] 8064815: Zero+PPC64: Stack overflow when running
 Maven

Reviewed-by: kvn, simonis
---
 hotspot/src/cpu/zero/vm/stack_zero.cpp        | 4 +++-
 hotspot/src/cpu/zero/vm/stack_zero.inline.hpp | 6 ++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/hotspot/src/cpu/zero/vm/stack_zero.cpp b/hotspot/src/cpu/zero/vm/stack_zero.cpp
index 33b0551b539..747199f5492 100644
--- a/hotspot/src/cpu/zero/vm/stack_zero.cpp
+++ b/hotspot/src/cpu/zero/vm/stack_zero.cpp
@@ -30,7 +30,9 @@
 
 int ZeroStack::suggest_size(Thread *thread) const {
   assert(needs_setup(), "already set up");
-  return align_size_down(abi_stack_available(thread) / 2, wordSize);
+  int abi_available = abi_stack_available(thread);
+  assert(abi_available >= 0, "available abi stack must be >= 0");
+  return align_size_down(abi_available / 2, wordSize);
 }
 
 void ZeroStack::handle_overflow(TRAPS) {
diff --git a/hotspot/src/cpu/zero/vm/stack_zero.inline.hpp b/hotspot/src/cpu/zero/vm/stack_zero.inline.hpp
index f0387bb7bfd..0f868823f69 100644
--- a/hotspot/src/cpu/zero/vm/stack_zero.inline.hpp
+++ b/hotspot/src/cpu/zero/vm/stack_zero.inline.hpp
@@ -48,9 +48,11 @@ inline void ZeroStack::overflow_check(int required_words, TRAPS) {
 // to use under normal circumstances.  Note that the returned
 // value can be negative.
 inline int ZeroStack::abi_stack_available(Thread *thread) const {
-  int stack_used = thread->stack_base() - (address) &stack_used;
+  guarantee(Thread::current() == thread, "should run in the same thread");
+  int stack_used = thread->stack_base() - (address) &stack_used
+    + (StackYellowPages+StackRedPages+StackShadowPages) * os::vm_page_size();
   int stack_free = thread->stack_size() - stack_used;
-  return stack_free - shadow_pages_size();
+  return stack_free;
 }
 
 #endif // CPU_ZERO_VM_STACK_ZERO_INLINE_HPP

From 1de18064559ef618f059a5b7c60f3fb646b5f6e9 Mon Sep 17 00:00:00 2001
From: Poonam Bajaj <poonam@openjdk.org>
Date: Tue, 18 Nov 2014 10:19:04 -0800
Subject: [PATCH 106/299] 8065220: Include alternate sa.make file for MacOSX

Include alternate sa.make in make/bsd/makefiles/sa.make

Reviewed-by: mgronlun, egahlin, sla
---
 hotspot/make/bsd/makefiles/sa.make | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hotspot/make/bsd/makefiles/sa.make b/hotspot/make/bsd/makefiles/sa.make
index 11503127bbb..fb3afd43dad 100644
--- a/hotspot/make/bsd/makefiles/sa.make
+++ b/hotspot/make/bsd/makefiles/sa.make
@@ -40,6 +40,8 @@ AGENT_DIR = $(GAMMADIR)/agent
 
 include $(GAMMADIR)/make/sa.files
 
+-include $(HS_ALT_MAKE)/bsd/makefiles/sa.make
+
 TOPDIR    = $(shell echo `pwd`)
 GENERATED = $(TOPDIR)/../generated
 

From ef64d5393d91b7577dfbed91f67ac33e5ddf5142 Mon Sep 17 00:00:00 2001
From: Ioi Lam <iklam@openjdk.org>
Date: Tue, 18 Nov 2014 03:38:50 -0800
Subject: [PATCH 107/299] 8064701: Some CDS optimizations should be disabled if
 bootclasspath is modified by JVMTI

Added API to track bootclasspath modification

Reviewed-by: jiangli, dholmes, minqi
---
 .../src/share/vm/classfile/classLoaderExt.hpp |  3 ++
 hotspot/src/share/vm/prims/jvmtiEnv.cpp       |  3 +-
 hotspot/src/share/vm/prims/whitebox.cpp       | 30 +++++++++++++++++++
 .../whitebox/sun/hotspot/WhiteBox.java        |  4 +++
 4 files changed, 39 insertions(+), 1 deletion(-)

diff --git a/hotspot/src/share/vm/classfile/classLoaderExt.hpp b/hotspot/src/share/vm/classfile/classLoaderExt.hpp
index ee2e0ec6851..50c0ff4f118 100644
--- a/hotspot/src/share/vm/classfile/classLoaderExt.hpp
+++ b/hotspot/src/share/vm/classfile/classLoaderExt.hpp
@@ -63,6 +63,9 @@ public:
                                    ClassPathEntry* new_entry) {
     ClassLoader::add_to_list(new_entry);
   }
+  static void append_boot_classpath(ClassPathEntry* new_entry) {
+    ClassLoader::add_to_list(new_entry);
+  }
   static void setup_search_paths() {}
 };
 
diff --git a/hotspot/src/share/vm/prims/jvmtiEnv.cpp b/hotspot/src/share/vm/prims/jvmtiEnv.cpp
index 5ddbf130e66..3ca776ac694 100644
--- a/hotspot/src/share/vm/prims/jvmtiEnv.cpp
+++ b/hotspot/src/share/vm/prims/jvmtiEnv.cpp
@@ -23,6 +23,7 @@
  */
 
 #include "precompiled.hpp"
+#include "classfile/classLoaderExt.hpp"
 #include "classfile/systemDictionary.hpp"
 #include "classfile/vmSymbols.hpp"
 #include "interpreter/bytecodeStream.hpp"
@@ -472,7 +473,7 @@ JvmtiEnv::AddToBootstrapClassLoaderSearch(const char* segment) {
     if (TraceClassLoading) {
       tty->print_cr("[Opened %s]", zip_entry->name());
     }
-    ClassLoader::add_to_list(zip_entry);
+    ClassLoaderExt::append_boot_classpath(zip_entry);
     return JVMTI_ERROR_NONE;
   } else {
     return JVMTI_ERROR_WRONG_PHASE;
diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp
index f412484cbe0..8757dbece88 100644
--- a/hotspot/src/share/vm/prims/whitebox.cpp
+++ b/hotspot/src/share/vm/prims/whitebox.cpp
@@ -64,6 +64,7 @@
 #endif // INCLUDE_NMT
 
 #include "compiler/compileBroker.hpp"
+#include "jvmtifiles/jvmtiEnv.hpp"
 #include "runtime/compilationPolicy.hpp"
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
@@ -113,6 +114,31 @@ WB_ENTRY(jboolean, WB_IsClassAlive(JNIEnv* env, jobject target, jstring name))
   return closure.found();
 WB_END
 
+WB_ENTRY(void, WB_AddToBootstrapClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) {
+#if INCLUDE_JVMTI
+  ThreadToNativeFromVM ttnfv(thread);   // can't be in VM when we call JNI
+  const char* seg = env->GetStringUTFChars(segment, NULL);
+  JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION);
+  jvmtiError err = jvmti_env->AddToBootstrapClassLoaderSearch(seg);
+  assert(err == JVMTI_ERROR_NONE, "must not fail");
+  env->ReleaseStringUTFChars(segment, seg);
+#endif
+}
+WB_END
+
+WB_ENTRY(void, WB_AddToSystemClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) {
+#if INCLUDE_JVMTI
+  ThreadToNativeFromVM ttnfv(thread);   // can't be in VM when we call JNI
+  const char* seg = env->GetStringUTFChars(segment, NULL);
+  JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION);
+  jvmtiError err = jvmti_env->AddToSystemClassLoaderSearch(seg);
+  assert(err == JVMTI_ERROR_NONE, "must not fail");
+  env->ReleaseStringUTFChars(segment, seg);
+#endif
+}
+WB_END
+
+
 WB_ENTRY(jlong, WB_GetCompressedOopsMaxHeapSize(JNIEnv* env, jobject o)) {
   return (jlong)Arguments::max_heap_for_compressed_oops();
 }
@@ -1102,6 +1128,10 @@ static JNINativeMethod methods[] = {
       CC"(Ljava/lang/String;[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
       (void*) &WB_ParseCommandLine
   },
+  {CC"addToBootstrapClassLoaderSearch", CC"(Ljava/lang/String;)V",
+                                                      (void*)&WB_AddToBootstrapClassLoaderSearch},
+  {CC"addToSystemClassLoaderSearch",    CC"(Ljava/lang/String;)V",
+                                                      (void*)&WB_AddToSystemClassLoaderSearch},
   {CC"getCompressedOopsMaxHeapSize", CC"()J",
       (void*)&WB_GetCompressedOopsMaxHeapSize},
   {CC"printHeapSizes",     CC"()V",                   (void*)&WB_PrintHeapSizes    },
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
index 1759d925731..09e3aa27c5f 100644
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
@@ -84,6 +84,10 @@ public class WhiteBox {
   }
   private native boolean isClassAlive0(String name);
 
+  // JVMTI
+  public native void addToBootstrapClassLoaderSearch(String segment);
+  public native void addToSystemClassLoaderSearch(String segment);
+
   // G1
   public native boolean g1InConcurrentMark();
   public native boolean g1IsHumongous(Object o);

From 68b0d32b05be03cd0851327105e08bd17717bc1c Mon Sep 17 00:00:00 2001
From: Zoltan Majo <zmajo@openjdk.org>
Date: Tue, 18 Nov 2014 19:44:45 +0100
Subject: [PATCH 108/299] 8062854: move compiler jtreg test to corresponding
 subfolders and use those in TEST.groups

Move all test from <bug_id> directories to <functional_dir_name>/<bug_id>; update TEST.groups to execute more tests

Reviewed-by: drchase, kvn
---
 hotspot/test/TEST.groups                      | 317 +++++-------------
 .../{ => c1}/6478991/NullCheckTest.java       |   0
 .../{ => c1}/6579789/Test6579789.java         |   0
 .../{ => c1}/6756768/Test6756768.java         |   0
 .../{ => c1}/6756768/Test6756768_2.java       |   0
 .../{ => c1}/6757316/Test6757316.java         |   0
 .../{ => c1}/6758234/Test6758234.java         |   0
 .../6769124/TestArrayCopy6769124.java         |   0
 .../{ => c1}/6769124/TestDeoptInt6769124.java |   0
 .../6769124/TestUnalignedLoad6769124.java     |   0
 .../{ => c1}/6795465/Test6795465.java         |   0
 .../test/compiler/{ => c1}/6849574/Test.java  |   0
 .../{ => c1}/6855215/Test6855215.java         |   0
 .../{ => c1}/6932496/Test6932496.java         |   0
 .../{ => c1}/7042153/Test7042153.java         |   0
 .../{ => c1}/7090976/Test7090976.java         |   0
 .../{ => c1}/7103261/Test7103261.java         |   0
 .../{ => c1}/7123108/Test7123108.java         |   0
 .../{ => c1}/8004051/Test8004051.java         |   0
 .../{ => c1}/8011706/Test8011706.java         |   0
 .../{ => c1}/8011771/Test8011771.java         |   0
 .../{ => c2}/5057225/Test5057225.java         |   0
 .../{ => c2}/5091921/Test5091921.java         |   0
 .../{ => c2}/5091921/Test6186134.java         |   0
 .../{ => c2}/5091921/Test6196102.java         |   0
 .../{ => c2}/5091921/Test6357214.java         |   0
 .../{ => c2}/5091921/Test6559156.java         |   0
 .../{ => c2}/5091921/Test6753639.java         |   0
 .../{ => c2}/5091921/Test6850611.java         |   0
 .../{ => c2}/5091921/Test6890943.java         |   0
 .../{ => c2}/5091921/Test6897150.java         |   0
 .../{ => c2}/5091921/Test6905845.java         |   0
 .../{ => c2}/5091921/Test6931567.java         |   0
 .../{ => c2}/5091921/Test6935022.java         |   0
 .../{ => c2}/5091921/Test6959129.java         |   0
 .../{ => c2}/5091921/Test6985295.java         |   0
 .../{ => c2}/5091921/Test6992759.java         |   0
 .../{ => c2}/5091921/Test7005594.java         |   0
 .../compiler/{ => c2}/5091921/Test7005594.sh  |   2 +-
 .../{ => c2}/5091921/Test7020614.java         |   0
 .../{ => c2}/5091921/input6890943.txt         |   0
 .../{ => c2}/5091921/output6890943.txt        |   0
 .../{ => c2}/6340864/TestByteVect.java        |   0
 .../{ => c2}/6340864/TestDoubleVect.java      |   0
 .../{ => c2}/6340864/TestFloatVect.java       |   0
 .../{ => c2}/6340864/TestIntVect.java         |   0
 .../{ => c2}/6340864/TestLongVect.java        |   0
 .../{ => c2}/6340864/TestShortVect.java       |   0
 .../{ => c2}/6443505/Test6443505.java         |   0
 .../6589834/InlinedArrayCloneTestCase.java    |   0
 .../compiler/{ => c2}/6589834/Test_ia32.java  |   0
 .../test/compiler/{ => c2}/6603011/Test.java  |   0
 .../test/compiler/{ => c2}/6636138/Test1.java |   0
 .../test/compiler/{ => c2}/6636138/Test2.java |   0
 .../test/compiler/{ => c2}/6646019/Test.java  |   0
 .../compiler/{ => c2}/6646020/Tester.java     |   0
 .../test/compiler/{ => c2}/6661247/Test.java  |   0
 .../compiler/{ => c2}/6663621/IVTest.java     |   0
 .../compiler/{ => c2}/6663848/Tester.java     |   0
 .../{ => c2}/6663854/Test6663854.java         |   0
 .../test/compiler/{ => c2}/6695810/Test.java  |   0
 .../{ => c2}/6700047/Test6700047.java         |   0
 .../test/compiler/{ => c2}/6711100/Test.java  |   0
 .../test/compiler/{ => c2}/6711117/Test.java  |   0
 .../{ => c2}/6712835/Test6712835.java         |   0
 .../compiler/{ => c2}/6714694/Tester.java     |   0
 .../test/compiler/{ => c2}/6724218/Test.java  |   0
 .../{ => c2}/6732154/Test6732154.java         |   0
 .../compiler/{ => c2}/6741738/Tester.java     |   0
 .../{ => c2}/6772683/InterruptedTest.java     |   0
 .../{ => c2}/6792161/Test6792161.java         |   0
 .../{ => c2}/6795362/Test6795362.java         |   0
 .../{ => c2}/6796786/Test6796786.java         |   0
 .../test/compiler/{ => c2}/6799693/Test.java  |   0
 .../{ => c2}/6800154/Test6800154.java         |   0
 .../{ => c2}/6805724/Test6805724.java         |   0
 .../test/compiler/{ => c2}/6823453/Test.java  |   0
 .../test/compiler/{ => c2}/6832293/Test.java  |   0
 .../{ => c2}/6837011/Test6837011.java         |   0
 .../test/compiler/{ => c2}/6837094/Test.java  |   0
 .../test/compiler/{ => c2}/6843752/Test.java  |   0
 .../test/compiler/{ => c2}/6851282/Test.java  |   0
 .../{ => c2}/6852078/Test6852078.java         |   0
 .../{ => c2}/6857159/Test6857159.java         |   0
 .../compiler/{ => c2}/6857159/Test6857159.sh  |   2 +-
 .../{ => c2}/6863155/Test6863155.java         |   0
 .../test/compiler/{ => c2}/6865031/Test.java  |   0
 .../test/compiler/{ => c2}/6866651/Test.java  |   0
 .../test/compiler/{ => c2}/6877254/Test.java  |   0
 .../{ => c2}/6880034/Test6880034.java         |   0
 .../{ => c2}/6885584/Test6885584.java         |   0
 .../{ => c2}/6894807/IsInstanceTest.java      |   0
 .../compiler/{ => c2}/6894807/Test6894807.sh  |   2 +-
 .../test/compiler/{ => c2}/6901572/Test.java  |   0
 .../test/compiler/{ => c2}/6910484/Test.java  |   0
 .../test/compiler/{ => c2}/6910605/Test.java  |   0
 .../test/compiler/{ => c2}/6910618/Test.java  |   0
 .../test/compiler/{ => c2}/6912517/Test.java  |   0
 .../{ => c2}/6916644/Test6916644.java         |   0
 .../6921969/TestMultiplyLongHiZero.java       |   0
 .../{ => c2}/6930043/Test6930043.java         |   0
 .../6946040/TestCharShortByteSwap.java        |   0
 .../{ => c2}/6956668/Test6956668.java         |   0
 .../test/compiler/{ => c2}/6958485/Test.java  |   0
 .../{ => c2}/6968348/Test6968348.java         |   0
 .../test/compiler/{ => c2}/6973329/Test.java  |   0
 .../{ => c2}/7002666/Test7002666.java         |   0
 .../{ => c2}/7009359/Test7009359.java         |   0
 .../test/compiler/{ => c2}/7017746/Test.java  |   0
 .../{ => c2}/7024475/Test7024475.java         |   0
 .../test/compiler/{ => c2}/7029152/Test.java  |   0
 .../{ => c2}/7041100/Test7041100.java         |   0
 .../{ => c2}/7046096/Test7046096.java         |   0
 .../{ => c2}/7047069/Test7047069.java         |   0
 .../{ => c2}/7048332/Test7048332.java         |   0
 .../{ => c2}/7068051/Test7068051.java         |   0
 .../compiler/{ => c2}/7070134/Stemmer.java    |   0
 .../compiler/{ => c2}/7070134/Test7070134.sh  |   2 +-
 hotspot/test/compiler/{ => c2}/7070134/words  |   0
 .../{ => c2}/7110586/Test7110586.java         |   0
 .../{ => c2}/7125879/Test7125879.java         |   0
 .../{ => c2}/7160610/Test7160610.java         |   0
 .../{ => c2}/7169782/Test7169782.java         |   0
 .../{ => c2}/7174363/Test7174363.java         |   0
 .../{ => c2}/7177917/Test7177917.java         |   0
 .../{ => c2}/7179138/Test7179138_1.java       |   0
 .../{ => c2}/7179138/Test7179138_2.java       |   0
 .../{ => c2}/7190310/Test7190310.java         |   0
 .../{ => c2}/7190310/Test7190310_unsafe.java  |   0
 .../{ => c2}/7192963/TestByteVect.java        |   0
 .../{ => c2}/7192963/TestDoubleVect.java      |   0
 .../{ => c2}/7192963/TestFloatVect.java       |   0
 .../{ => c2}/7192963/TestIntVect.java         |   0
 .../{ => c2}/7192963/TestLongVect.java        |   0
 .../{ => c2}/7192963/TestShortVect.java       |   0
 .../{ => c2}/7199742/Test7199742.java         |   0
 .../compiler/{ => c2}/7200264/Test7200264.sh  |   2 +-
 .../{ => c2}/7200264/TestIntVect.java         |   0
 .../{ => c2}/8000805/Test8000805.java         |   0
 .../{ => c2}/8002069/Test8002069.java         |   0
 .../{ => c2}/8004741/Test8004741.java         |   0
 .../{ => c2}/8004867/TestIntAtomicCAS.java    |   0
 .../8004867/TestIntAtomicOrdered.java         |   0
 .../8004867/TestIntAtomicVolatile.java        |   0
 .../{ => c2}/8004867/TestIntUnsafeCAS.java    |   0
 .../8004867/TestIntUnsafeOrdered.java         |   0
 .../8004867/TestIntUnsafeVolatile.java        |   0
 .../{ => c2}/8005956/PolynomialRoot.java      |   0
 .../{ => c2}/8007294/Test8007294.java         |   0
 .../{ => c2}/8007722/Test8007722.java         |   0
 .../{ => codegen}/6378821/Test6378821.java    |   0
 .../compiler/{ => codegen}/6431242/Test.java  |   0
 .../{ => codegen}/6797305/Test6797305.java    |   0
 .../{ => codegen}/6814842/Test6814842.java    |   0
 .../{ => codegen}/6823354/Test6823354.java    |   0
 .../compiler/{ => codegen}/6875866/Test.java  |   0
 .../{ => codegen}/6879902/Test6879902.java    |   0
 .../{ => codegen}/6896617/Test6896617.java    |   0
 .../{ => codegen}/6909839/Test6909839.java    |   0
 .../compiler/{ => codegen}/6935535/Test.java  |   0
 .../compiler/{ => codegen}/6942326/Test.java  |   0
 .../{ => codegen}/7009231/Test7009231.java    |   0
 .../{ => codegen}/7088419/CRCTest.java        |   0
 .../{ => codegen}/7100757/Test7100757.java    |   0
 .../7119644/TestBooleanVect.java              |   0
 .../7119644/TestByteDoubleVect.java           |   0
 .../7119644/TestByteFloatVect.java            |   0
 .../7119644/TestByteIntVect.java              |   0
 .../7119644/TestByteLongVect.java             |   0
 .../7119644/TestByteShortVect.java            |   0
 .../{ => codegen}/7119644/TestByteVect.java   |   0
 .../7119644/TestCharShortVect.java            |   0
 .../{ => codegen}/7119644/TestCharVect.java   |   0
 .../{ => codegen}/7119644/TestDoubleVect.java |   0
 .../7119644/TestFloatDoubleVect.java          |   0
 .../{ => codegen}/7119644/TestFloatVect.java  |   0
 .../7119644/TestIntDoubleVect.java            |   0
 .../7119644/TestIntFloatVect.java             |   0
 .../7119644/TestIntLongVect.java              |   0
 .../{ => codegen}/7119644/TestIntVect.java    |   0
 .../7119644/TestLongDoubleVect.java           |   0
 .../7119644/TestLongFloatVect.java            |   0
 .../{ => codegen}/7119644/TestLongVect.java   |   0
 .../7119644/TestShortDoubleVect.java          |   0
 .../7119644/TestShortFloatVect.java           |   0
 .../7119644/TestShortIntVect.java             |   0
 .../7119644/TestShortLongVect.java            |   0
 .../{ => codegen}/7119644/TestShortVect.java  |   0
 .../{ => codegen}/7184394/TestAESBase.java    |   0
 .../{ => codegen}/7184394/TestAESDecode.java  |   0
 .../{ => codegen}/7184394/TestAESEncode.java  |   0
 .../{ => codegen}/7184394/TestAESMain.java    |   0
 .../{ => codegen}/8001183/TestCharVect.java   |   0
 .../{ => codegen}/8005033/Test8005033.java    |   0
 .../{ => codegen}/8011901/Test8011901.java    |   0
 .../6934604/TestByteBoxing.java               |   0
 .../6934604/TestDoubleBoxing.java             |   0
 .../6934604/TestFloatBoxing.java              |   0
 .../6934604/TestIntBoxing.java                |   0
 .../6934604/TestLongBoxing.java               |   0
 .../6934604/TestShortBoxing.java              |   0
 .../UnsignedLoads.java                        |   0
 .../{ => escapeAnalysis}/6689060/Test.java    |   0
 .../{ => escapeAnalysis}/6716441/Tester.java  |   0
 .../{ => escapeAnalysis}/6726999/Test.java    |   0
 .../{ => escapeAnalysis}/6775880/Test.java    |   0
 .../{ => escapeAnalysis}/6795161/Test.java    |   0
 .../{ => escapeAnalysis}/6895383/Test.java    |   0
 .../{ => escapeAnalysis}/6896727/Test.java    |   0
 .../Test8020215.java                          |   0
 .../TestAllocatedEscapesPtrComparison.java    |   0
 ...tUnsafePutAddressNullObjMustNotEscape.java |   0
 .../TestIntegerComparison.java                |   0
 .../{ => interpreter}/6539464/Test.java       |   0
 .../{ => interpreter}/6833129/Test.java       |   0
 .../{ => interpreter}/7116216/LargeFrame.java |   0
 .../7116216/StackOverflow.java                |   0
 .../{ => intrinsics}/6982370/Test6982370.java |   0
 .../{ => intrinsics}/8005419/Test8005419.java |   0
 .../{ => jsr292}/6990212/Test6990212.java     |   0
 .../{ => jsr292}/7082949/Test7082949.java     |   0
 .../compiler/{ => loopopts}/6659207/Test.java |   0
 .../compiler/{ => loopopts}/6855164/Test.java |   0
 .../compiler/{ => loopopts}/6860469/Test.java |   0
 .../{ => loopopts}/7044738/Test7044738.java   |   0
 .../{ => loopopts}/7052494/Test7052494.java   |   0
 .../compiler/{ => runtime}/6778657/Test.java  |   0
 .../compiler/{ => runtime}/6826736/Test.java  |   0
 .../{ => runtime}/6859338/Test6859338.java    |   0
 .../compiler/{ => runtime}/6863420/Test.java  |   0
 .../6865265/StackOverflowBug.java             |   0
 .../{ => runtime}/6891750/Test6891750.java    |   0
 .../compiler/{ => runtime}/6892265/Test.java  |   0
 .../{ => runtime}/7088020/Test7088020.java    |   0
 .../{ => runtime}/7141637/SpreadNullArg.java  |   0
 .../{ => runtime}/7196199/Test7196199.java    |   0
 .../{ => runtime}/8010927/Test8010927.java    |   0
 .../{ => runtime}/8015436/Test8015436.java    |   0
 .../8009761/Test8009761.java                  |   0
 239 files changed, 83 insertions(+), 244 deletions(-)
 rename hotspot/test/compiler/{ => c1}/6478991/NullCheckTest.java (100%)
 rename hotspot/test/compiler/{ => c1}/6579789/Test6579789.java (100%)
 rename hotspot/test/compiler/{ => c1}/6756768/Test6756768.java (100%)
 rename hotspot/test/compiler/{ => c1}/6756768/Test6756768_2.java (100%)
 rename hotspot/test/compiler/{ => c1}/6757316/Test6757316.java (100%)
 rename hotspot/test/compiler/{ => c1}/6758234/Test6758234.java (100%)
 rename hotspot/test/compiler/{ => c1}/6769124/TestArrayCopy6769124.java (100%)
 rename hotspot/test/compiler/{ => c1}/6769124/TestDeoptInt6769124.java (100%)
 rename hotspot/test/compiler/{ => c1}/6769124/TestUnalignedLoad6769124.java (100%)
 rename hotspot/test/compiler/{ => c1}/6795465/Test6795465.java (100%)
 rename hotspot/test/compiler/{ => c1}/6849574/Test.java (100%)
 rename hotspot/test/compiler/{ => c1}/6855215/Test6855215.java (100%)
 rename hotspot/test/compiler/{ => c1}/6932496/Test6932496.java (100%)
 rename hotspot/test/compiler/{ => c1}/7042153/Test7042153.java (100%)
 rename hotspot/test/compiler/{ => c1}/7090976/Test7090976.java (100%)
 rename hotspot/test/compiler/{ => c1}/7103261/Test7103261.java (100%)
 rename hotspot/test/compiler/{ => c1}/7123108/Test7123108.java (100%)
 rename hotspot/test/compiler/{ => c1}/8004051/Test8004051.java (100%)
 rename hotspot/test/compiler/{ => c1}/8011706/Test8011706.java (100%)
 rename hotspot/test/compiler/{ => c1}/8011771/Test8011771.java (100%)
 rename hotspot/test/compiler/{ => c2}/5057225/Test5057225.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test5091921.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test6186134.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test6196102.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test6357214.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test6559156.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test6753639.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test6850611.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test6890943.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test6897150.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test6905845.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test6931567.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test6935022.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test6959129.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test6985295.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test6992759.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test7005594.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test7005594.sh (98%)
 rename hotspot/test/compiler/{ => c2}/5091921/Test7020614.java (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/input6890943.txt (100%)
 rename hotspot/test/compiler/{ => c2}/5091921/output6890943.txt (100%)
 rename hotspot/test/compiler/{ => c2}/6340864/TestByteVect.java (100%)
 rename hotspot/test/compiler/{ => c2}/6340864/TestDoubleVect.java (100%)
 rename hotspot/test/compiler/{ => c2}/6340864/TestFloatVect.java (100%)
 rename hotspot/test/compiler/{ => c2}/6340864/TestIntVect.java (100%)
 rename hotspot/test/compiler/{ => c2}/6340864/TestLongVect.java (100%)
 rename hotspot/test/compiler/{ => c2}/6340864/TestShortVect.java (100%)
 rename hotspot/test/compiler/{ => c2}/6443505/Test6443505.java (100%)
 rename hotspot/test/compiler/{ => c2}/6589834/InlinedArrayCloneTestCase.java (100%)
 rename hotspot/test/compiler/{ => c2}/6589834/Test_ia32.java (100%)
 rename hotspot/test/compiler/{ => c2}/6603011/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6636138/Test1.java (100%)
 rename hotspot/test/compiler/{ => c2}/6636138/Test2.java (100%)
 rename hotspot/test/compiler/{ => c2}/6646019/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6646020/Tester.java (100%)
 rename hotspot/test/compiler/{ => c2}/6661247/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6663621/IVTest.java (100%)
 rename hotspot/test/compiler/{ => c2}/6663848/Tester.java (100%)
 rename hotspot/test/compiler/{ => c2}/6663854/Test6663854.java (100%)
 rename hotspot/test/compiler/{ => c2}/6695810/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6700047/Test6700047.java (100%)
 rename hotspot/test/compiler/{ => c2}/6711100/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6711117/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6712835/Test6712835.java (100%)
 rename hotspot/test/compiler/{ => c2}/6714694/Tester.java (100%)
 rename hotspot/test/compiler/{ => c2}/6724218/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6732154/Test6732154.java (100%)
 rename hotspot/test/compiler/{ => c2}/6741738/Tester.java (100%)
 rename hotspot/test/compiler/{ => c2}/6772683/InterruptedTest.java (100%)
 rename hotspot/test/compiler/{ => c2}/6792161/Test6792161.java (100%)
 rename hotspot/test/compiler/{ => c2}/6795362/Test6795362.java (100%)
 rename hotspot/test/compiler/{ => c2}/6796786/Test6796786.java (100%)
 rename hotspot/test/compiler/{ => c2}/6799693/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6800154/Test6800154.java (100%)
 rename hotspot/test/compiler/{ => c2}/6805724/Test6805724.java (100%)
 rename hotspot/test/compiler/{ => c2}/6823453/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6832293/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6837011/Test6837011.java (100%)
 rename hotspot/test/compiler/{ => c2}/6837094/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6843752/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6851282/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6852078/Test6852078.java (100%)
 rename hotspot/test/compiler/{ => c2}/6857159/Test6857159.java (100%)
 rename hotspot/test/compiler/{ => c2}/6857159/Test6857159.sh (98%)
 rename hotspot/test/compiler/{ => c2}/6863155/Test6863155.java (100%)
 rename hotspot/test/compiler/{ => c2}/6865031/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6866651/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6877254/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6880034/Test6880034.java (100%)
 rename hotspot/test/compiler/{ => c2}/6885584/Test6885584.java (100%)
 rename hotspot/test/compiler/{ => c2}/6894807/IsInstanceTest.java (100%)
 rename hotspot/test/compiler/{ => c2}/6894807/Test6894807.sh (97%)
 rename hotspot/test/compiler/{ => c2}/6901572/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6910484/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6910605/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6910618/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6912517/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6916644/Test6916644.java (100%)
 rename hotspot/test/compiler/{ => c2}/6921969/TestMultiplyLongHiZero.java (100%)
 rename hotspot/test/compiler/{ => c2}/6930043/Test6930043.java (100%)
 rename hotspot/test/compiler/{ => c2}/6946040/TestCharShortByteSwap.java (100%)
 rename hotspot/test/compiler/{ => c2}/6956668/Test6956668.java (100%)
 rename hotspot/test/compiler/{ => c2}/6958485/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/6968348/Test6968348.java (100%)
 rename hotspot/test/compiler/{ => c2}/6973329/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/7002666/Test7002666.java (100%)
 rename hotspot/test/compiler/{ => c2}/7009359/Test7009359.java (100%)
 rename hotspot/test/compiler/{ => c2}/7017746/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/7024475/Test7024475.java (100%)
 rename hotspot/test/compiler/{ => c2}/7029152/Test.java (100%)
 rename hotspot/test/compiler/{ => c2}/7041100/Test7041100.java (100%)
 rename hotspot/test/compiler/{ => c2}/7046096/Test7046096.java (100%)
 rename hotspot/test/compiler/{ => c2}/7047069/Test7047069.java (100%)
 rename hotspot/test/compiler/{ => c2}/7048332/Test7048332.java (100%)
 rename hotspot/test/compiler/{ => c2}/7068051/Test7068051.java (100%)
 rename hotspot/test/compiler/{ => c2}/7070134/Stemmer.java (100%)
 rename hotspot/test/compiler/{ => c2}/7070134/Test7070134.sh (97%)
 rename hotspot/test/compiler/{ => c2}/7070134/words (100%)
 rename hotspot/test/compiler/{ => c2}/7110586/Test7110586.java (100%)
 rename hotspot/test/compiler/{ => c2}/7125879/Test7125879.java (100%)
 rename hotspot/test/compiler/{ => c2}/7160610/Test7160610.java (100%)
 rename hotspot/test/compiler/{ => c2}/7169782/Test7169782.java (100%)
 rename hotspot/test/compiler/{ => c2}/7174363/Test7174363.java (100%)
 rename hotspot/test/compiler/{ => c2}/7177917/Test7177917.java (100%)
 rename hotspot/test/compiler/{ => c2}/7179138/Test7179138_1.java (100%)
 rename hotspot/test/compiler/{ => c2}/7179138/Test7179138_2.java (100%)
 rename hotspot/test/compiler/{ => c2}/7190310/Test7190310.java (100%)
 rename hotspot/test/compiler/{ => c2}/7190310/Test7190310_unsafe.java (100%)
 rename hotspot/test/compiler/{ => c2}/7192963/TestByteVect.java (100%)
 rename hotspot/test/compiler/{ => c2}/7192963/TestDoubleVect.java (100%)
 rename hotspot/test/compiler/{ => c2}/7192963/TestFloatVect.java (100%)
 rename hotspot/test/compiler/{ => c2}/7192963/TestIntVect.java (100%)
 rename hotspot/test/compiler/{ => c2}/7192963/TestLongVect.java (100%)
 rename hotspot/test/compiler/{ => c2}/7192963/TestShortVect.java (100%)
 rename hotspot/test/compiler/{ => c2}/7199742/Test7199742.java (100%)
 rename hotspot/test/compiler/{ => c2}/7200264/Test7200264.sh (99%)
 rename hotspot/test/compiler/{ => c2}/7200264/TestIntVect.java (100%)
 rename hotspot/test/compiler/{ => c2}/8000805/Test8000805.java (100%)
 rename hotspot/test/compiler/{ => c2}/8002069/Test8002069.java (100%)
 rename hotspot/test/compiler/{ => c2}/8004741/Test8004741.java (100%)
 rename hotspot/test/compiler/{ => c2}/8004867/TestIntAtomicCAS.java (100%)
 rename hotspot/test/compiler/{ => c2}/8004867/TestIntAtomicOrdered.java (100%)
 rename hotspot/test/compiler/{ => c2}/8004867/TestIntAtomicVolatile.java (100%)
 rename hotspot/test/compiler/{ => c2}/8004867/TestIntUnsafeCAS.java (100%)
 rename hotspot/test/compiler/{ => c2}/8004867/TestIntUnsafeOrdered.java (100%)
 rename hotspot/test/compiler/{ => c2}/8004867/TestIntUnsafeVolatile.java (100%)
 rename hotspot/test/compiler/{ => c2}/8005956/PolynomialRoot.java (100%)
 rename hotspot/test/compiler/{ => c2}/8007294/Test8007294.java (100%)
 rename hotspot/test/compiler/{ => c2}/8007722/Test8007722.java (100%)
 rename hotspot/test/compiler/{ => codegen}/6378821/Test6378821.java (100%)
 rename hotspot/test/compiler/{ => codegen}/6431242/Test.java (100%)
 rename hotspot/test/compiler/{ => codegen}/6797305/Test6797305.java (100%)
 rename hotspot/test/compiler/{ => codegen}/6814842/Test6814842.java (100%)
 rename hotspot/test/compiler/{ => codegen}/6823354/Test6823354.java (100%)
 rename hotspot/test/compiler/{ => codegen}/6875866/Test.java (100%)
 rename hotspot/test/compiler/{ => codegen}/6879902/Test6879902.java (100%)
 rename hotspot/test/compiler/{ => codegen}/6896617/Test6896617.java (100%)
 rename hotspot/test/compiler/{ => codegen}/6909839/Test6909839.java (100%)
 rename hotspot/test/compiler/{ => codegen}/6935535/Test.java (100%)
 rename hotspot/test/compiler/{ => codegen}/6942326/Test.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7009231/Test7009231.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7088419/CRCTest.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7100757/Test7100757.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestBooleanVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestByteDoubleVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestByteFloatVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestByteIntVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestByteLongVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestByteShortVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestByteVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestCharShortVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestCharVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestDoubleVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestFloatDoubleVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestFloatVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestIntDoubleVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestIntFloatVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestIntLongVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestIntVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestLongDoubleVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestLongFloatVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestLongVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestShortDoubleVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestShortFloatVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestShortIntVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestShortLongVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7119644/TestShortVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7184394/TestAESBase.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7184394/TestAESDecode.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7184394/TestAESEncode.java (100%)
 rename hotspot/test/compiler/{ => codegen}/7184394/TestAESMain.java (100%)
 rename hotspot/test/compiler/{ => codegen}/8001183/TestCharVect.java (100%)
 rename hotspot/test/compiler/{ => codegen}/8005033/Test8005033.java (100%)
 rename hotspot/test/compiler/{ => codegen}/8011901/Test8011901.java (100%)
 rename hotspot/test/compiler/{ => eliminateAutobox}/6934604/TestByteBoxing.java (100%)
 rename hotspot/test/compiler/{ => eliminateAutobox}/6934604/TestDoubleBoxing.java (100%)
 rename hotspot/test/compiler/{ => eliminateAutobox}/6934604/TestFloatBoxing.java (100%)
 rename hotspot/test/compiler/{ => eliminateAutobox}/6934604/TestIntBoxing.java (100%)
 rename hotspot/test/compiler/{ => eliminateAutobox}/6934604/TestLongBoxing.java (100%)
 rename hotspot/test/compiler/{ => eliminateAutobox}/6934604/TestShortBoxing.java (100%)
 rename hotspot/test/compiler/{EliminateAutoBox => eliminateAutobox}/UnsignedLoads.java (100%)
 rename hotspot/test/compiler/{ => escapeAnalysis}/6689060/Test.java (100%)
 rename hotspot/test/compiler/{ => escapeAnalysis}/6716441/Tester.java (100%)
 rename hotspot/test/compiler/{ => escapeAnalysis}/6726999/Test.java (100%)
 rename hotspot/test/compiler/{ => escapeAnalysis}/6775880/Test.java (100%)
 rename hotspot/test/compiler/{ => escapeAnalysis}/6795161/Test.java (100%)
 rename hotspot/test/compiler/{ => escapeAnalysis}/6895383/Test.java (100%)
 rename hotspot/test/compiler/{ => escapeAnalysis}/6896727/Test.java (100%)
 rename hotspot/test/compiler/{EscapeAnalysis => escapeAnalysis}/Test8020215.java (100%)
 rename hotspot/test/compiler/{EscapeAnalysis => escapeAnalysis}/TestAllocatedEscapesPtrComparison.java (100%)
 rename hotspot/test/compiler/{EscapeAnalysis => escapeAnalysis}/TestUnsafePutAddressNullObjMustNotEscape.java (100%)
 rename hotspot/test/compiler/{IntegerArithmetic => integerArithmetic}/TestIntegerComparison.java (100%)
 rename hotspot/test/compiler/{ => interpreter}/6539464/Test.java (100%)
 rename hotspot/test/compiler/{ => interpreter}/6833129/Test.java (100%)
 rename hotspot/test/compiler/{ => interpreter}/7116216/LargeFrame.java (100%)
 rename hotspot/test/compiler/{ => interpreter}/7116216/StackOverflow.java (100%)
 rename hotspot/test/compiler/{ => intrinsics}/6982370/Test6982370.java (100%)
 rename hotspot/test/compiler/{ => intrinsics}/8005419/Test8005419.java (100%)
 rename hotspot/test/compiler/{ => jsr292}/6990212/Test6990212.java (100%)
 rename hotspot/test/compiler/{ => jsr292}/7082949/Test7082949.java (100%)
 rename hotspot/test/compiler/{ => loopopts}/6659207/Test.java (100%)
 rename hotspot/test/compiler/{ => loopopts}/6855164/Test.java (100%)
 rename hotspot/test/compiler/{ => loopopts}/6860469/Test.java (100%)
 rename hotspot/test/compiler/{ => loopopts}/7044738/Test7044738.java (100%)
 rename hotspot/test/compiler/{ => loopopts}/7052494/Test7052494.java (100%)
 rename hotspot/test/compiler/{ => runtime}/6778657/Test.java (100%)
 rename hotspot/test/compiler/{ => runtime}/6826736/Test.java (100%)
 rename hotspot/test/compiler/{ => runtime}/6859338/Test6859338.java (100%)
 rename hotspot/test/compiler/{ => runtime}/6863420/Test.java (100%)
 rename hotspot/test/compiler/{ => runtime}/6865265/StackOverflowBug.java (100%)
 rename hotspot/test/compiler/{ => runtime}/6891750/Test6891750.java (100%)
 rename hotspot/test/compiler/{ => runtime}/6892265/Test.java (100%)
 rename hotspot/test/compiler/{ => runtime}/7088020/Test7088020.java (100%)
 rename hotspot/test/compiler/{ => runtime}/7141637/SpreadNullArg.java (100%)
 rename hotspot/test/compiler/{ => runtime}/7196199/Test7196199.java (100%)
 rename hotspot/test/compiler/{ => runtime}/8010927/Test8010927.java (100%)
 rename hotspot/test/compiler/{ => runtime}/8015436/Test8015436.java (100%)
 rename hotspot/test/compiler/{ => uncommontrap}/8009761/Test8009761.java (100%)

diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups
index 8ea66a65e68..e4dbf572f06 100644
--- a/hotspot/test/TEST.groups
+++ b/hotspot/test/TEST.groups
@@ -107,8 +107,8 @@ jre = \
 # Tests that require the full JRE
 #
 needs_jre = \
-  compiler/6852078/Test6852078.java \
-  compiler/7047069/Test7047069.java \
+  compiler/c2/6852078/Test6852078.java \
+  compiler/c2/7047069/Test7047069.java \
   runtime/6294277/SourceDebugExtension.java \
   runtime/ClassFile/JsrRewriting.java \
   runtime/ClassFile/OomWhileParsingRepeatedJsr.java
@@ -325,245 +325,84 @@ hotspot_wbapitest = \
   sanity/
 
 hotspot_compiler_1 = \
-  compiler/5057225/Test5057225.java \
-  compiler/5091921/Test5091921.java \
-  compiler/5091921/Test6186134.java \
-  compiler/5091921/Test6196102.java \
-  compiler/5091921/Test6357214.java \
-  compiler/5091921/Test6559156.java \
-  compiler/5091921/Test6753639.java \
-  compiler/5091921/Test6935022.java \
-  compiler/5091921/Test6959129.java \
-  compiler/5091921/Test6985295.java \
-  compiler/5091921/Test6992759.java \
-  compiler/5091921/Test7005594.java \
-  compiler/5091921/Test7020614.java \
-  compiler/6378821/Test6378821.java \
-  compiler/6431242/Test.java \
-  compiler/6443505/Test6443505.java \
-  compiler/6478991/NullCheckTest.java \
-  compiler/6539464/Test.java \
-  compiler/6579789/Test6579789.java \
-  compiler/6636138/ \
-  compiler/6646019/Test.java \
-  compiler/6659207/Test.java \
-  compiler/6661247/Test.java \
-  compiler/6663621/IVTest.java \
-  compiler/6689060/Test.java \
-  compiler/6695810/Test.java \
-  compiler/6700047/Test6700047.java \
-  compiler/6711100/Test.java \
-  compiler/6724218/Test.java \
-  compiler/6732154/Test6732154.java \
-  compiler/6758234/Test6758234.java \
-  compiler/6769124/ \
-  compiler/6772683/InterruptedTest.java \
-  compiler/6778657/Test.java \
-  compiler/6795161/Test.java \
-  compiler/6795362/Test6795362.java \
-  compiler/6795465/Test6795465.java \
-  compiler/6796786/Test6796786.java \
-  compiler/6799693/Test.java \
-  compiler/6805724/Test6805724.java \
-  compiler/6814842/Test6814842.java \
-  compiler/6823453/Test.java \
-  compiler/6833129/Test.java \
-  compiler/6837011/Test6837011.java \
-  compiler/6843752/Test.java \
-  compiler/6849574/Test.java \
-  compiler/6855164/Test.java \
-  compiler/6855215/Test6855215.java \
-  compiler/6857159/Test6857159.java \
-  compiler/6860469/Test.java \
-  compiler/6863155/Test6863155.java \
-  compiler/6863420/Test.java \
-  compiler/6865265/StackOverflowBug.java \
-  compiler/6879902/Test6879902.java \
-  compiler/6880034/Test6880034.java \
-  compiler/6891750/Test6891750.java \
-  compiler/6892265/Test.java \
-  compiler/6894807/IsInstanceTest.java \
-  compiler/6901572/Test.java \
-  compiler/6909839/Test6909839.java \
-  compiler/6910484/Test.java \
-  compiler/6910605/Test.java \
-  compiler/6910618/Test.java \
-  compiler/6916644/Test6916644.java \
-  compiler/6921969/TestMultiplyLongHiZero.java \
-  compiler/6930043/Test6930043.java \
-  compiler/6932496/Test6932496.java \
-  compiler/6956668/Test6956668.java \
-  compiler/6968348/Test6968348.java \
-  compiler/6973329/Test.java
-
-hotspot_compiler_2 = \
-  compiler/6982370/Test6982370.java \
-  compiler/7009231/Test7009231.java \
-  compiler/7009359/Test7009359.java \
-  compiler/7017746/Test.java \
-  compiler/7024475/Test7024475.java \
-  compiler/7041100/Test7041100.java \
-  compiler/7044738/Test7044738.java \
-  compiler/7046096/Test7046096.java \
-  compiler/7048332/Test7048332.java \
-  compiler/7068051/Test7068051.java \
-  compiler/7082949/Test7082949.java \
-  compiler/7088020/Test7088020.java \
-  compiler/7090976/Test7090976.java \
-  compiler/7103261/Test7103261.java \
-  compiler/7110586/Test7110586.java \
-  compiler/7119644/ \
-  compiler/7141637/SpreadNullArg.java \
-  compiler/7169782/Test7169782.java \
-  compiler/7174363/Test7174363.java \
-  compiler/7179138/ \
-  compiler/7190310/ \
-  compiler/7192963/ \
-  compiler/7200264/TestIntVect.java \
-  compiler/8000805/Test8000805.java \
-  compiler/8002069/Test8002069.java \
-  compiler/8004741/Test8004741.java \
-  compiler/8005033/Test8005033.java \
-  compiler/8005419/Test8005419.java \
-  compiler/8005956/PolynomialRoot.java \
-  compiler/8007294/Test8007294.java \
-  compiler/EliminateAutoBox/UnsignedLoads.java
-
-hotspot_compiler_3 = \
-  compiler/8007722/Test8007722.java \
-  compiler/8009761/Test8009761.java \
-  compiler/8010927/Test8010927.java \
-  compiler/8011706/Test8011706.java \
-  compiler/8011771/Test8011771.java \
-  compiler/8011901/Test8011901.java \
-  compiler/arraycopy/TestMissingControl.java \
-  compiler/ciReplay/TestVM_no_comp_level.sh \
-  compiler/classUnloading/anonymousClass/TestAnonymousClassUnloading.java \
-  compiler/codecache/CheckSegmentedCodeCache.java \
-  compiler/codecache/CheckUpperLimit.java \
-  compiler/codegen/ \
-  compiler/cpuflags/RestoreMXCSR.java \
-  compiler/EscapeAnalysis/ \
-  compiler/exceptions/ \
-  compiler/floatingpoint/ModNaN.java \
-  compiler/gcbarriers/G1CrashTest.java \
-  compiler/inlining/ \
-  compiler/IntegerArithmetic/TestIntegerComparison.java \
-  compiler/intrinsics/bmi/TestAndnI.java \
-  compiler/intrinsics/bmi/TestAndnI.java \
-  compiler/intrinsics/bmi/TestAndnL.java \
-  compiler/intrinsics/bmi/TestBlsiI.java \
-  compiler/intrinsics/bmi/TestBlsiL.java \
-  compiler/intrinsics/bmi/TestBlsmskI.java \
-  compiler/intrinsics/bmi/TestBlsmskL.java \
-  compiler/intrinsics/bmi/TestBlsrI.java \
-  compiler/intrinsics/bmi/TestBlsrL.java \
-  compiler/intrinsics/bmi/TestLzcntI.java \
-  compiler/intrinsics/bmi/TestLzcntL.java \
-  compiler/intrinsics/bmi/TestTzcntI.java \
-  compiler/intrinsics/bmi/TestTzcntL.java \
-  compiler/intrinsics/clone/TestObjectClone.java \
-  compiler/intrinsics/hashcode/TestHashCode.java \
-  compiler/intrinsics/mathexact/CompareTest.java \
-  compiler/intrinsics/mathexact/GVNTest.java \
-  compiler/intrinsics/mathexact/NegExactILoadTest.java \
-  compiler/intrinsics/mathexact/NegExactILoopDependentTest.java \
-  compiler/intrinsics/mathexact/NegExactINonConstantTest.java \
-  compiler/intrinsics/mathexact/SubExactICondTest.java \
-  compiler/intrinsics/mathexact/SubExactILoadTest.java \
-  compiler/intrinsics/mathexact/SubExactILoopDependentTest.java \
-  compiler/intrinsics/stringequals/TestStringEqualsBadLength.java \
-  compiler/intrinsics/unsafe/UnsafeGetAddressTest.java \
-  compiler/intrinsics/classcast/NullCheckDroppingsTest.java \
-  compiler/jsr292/ConcurrentClassLoadingTest.java \
-  compiler/jsr292/CreatesInterfaceDotEqualsCallInfo.java \
-  compiler/loopopts/TestLogSum.java \
-  compiler/macronodes/TestEliminateAllocationPhi.java \
-  compiler/membars/TestMemBarAcquire.java \
-  compiler/osr/TestOSRWithNonEmptyStack.java \
-  compiler/profiling/TestMethodHandleInvokesIntrinsic.java \
-  compiler/profiling/TestSpecTrapClassUnloading.java \
-  compiler/profiling/TestUnexpectedProfilingMismatch.java \
-  compiler/regalloc/C1ObjectSpillInLogicOp.java \
-  compiler/startup/NumCompilerThreadsCheck.java \
-  compiler/startup/SmallCodeCacheStartup.java \
-  compiler/types/TestSpeculationFailedHigherEqual.java \
-  compiler/types/TypeSpeculation.java \
-  compiler/uncommontrap/StackOverflowGuardPagesOff.java \
-  compiler/uncommontrap/TestStackBangMonitorOwned.java \
-  compiler/uncommontrap/TestStackBangRbp.java \
-  compiler/unsafe/GetUnsafeObjectG1PreBarrier.java
+  compiler/arraycopy/ \
+  compiler/c1/ \
+  compiler/c2/ \
+  -compiler/c2/5091921/Test6850611.java \
+  -compiler/c2/5091921/Test6890943.java \
+  -compiler/c2/5091921/Test6905845.java \
+  -compiler/c2/6340864 \
+  -compiler/c2/6589834 \
+  -compiler/c2/6603011 \
+  -compiler/c2/6912517 \
+  -compiler/c2/6792161 \
+  -compiler/c2/7070134 \
+  -compiler/c2/8004867
   
+hotspot_compiler_2 = \
+  compiler/classUnloading/ \
+  compiler/codecache/ \
+  compiler/codegen/ \
+  compiler/cpuflags/ \
+  compiler/eliminateAutobox/ \
+  compiler/escapeAnalysis/ \
+  compiler/exceptions/ \
+  compiler/floatingpoint/ \
+  compiler/gcbarriers/ \
+  compiler/inlining/ \
+  compiler/integerArithmetic/ \
+  compiler/interpreter/ \
+  -compiler/codegen/7184394
+  
+hotspot_compiler_3 = \
+  compiler/intrinsics/ \
+  compiler/jsr292/ \
+  compiler/loopopts/ \
+  compiler/macronodes/ \
+  compiler/osr/ \
+  compiler/regalloc/ \
+  compiler/runtime/ \
+  compiler/startup/ \
+  compiler/types/ \
+  compiler/uncommontrap/ \
+  compiler/unsafe/ \
+  -compiler/intrinsics/bmi/verifycode \
+  -compiler/intrinsics/mathexact \
+  -compiler/intrinsics/multiplytolen \
+  -compiler/intrinsics/sha \
+  -compiler/loopopts/7052494 \
+  -compiler/runtime/6826736
 
 hotspot_compiler_closed = \
-  closed/compiler/4292742/Test.java \
-  closed/compiler/4474154/Test4474154.java \
-  closed/compiler/4482613/Test4482613.java \
-  closed/compiler/4490177/tctest.java \
-  closed/compiler/4495990/Application.java \
-  closed/compiler/4522874/Test4522874.sh \
-  closed/compiler/4629512/Test4629512.java \
-  closed/compiler/4647299/Looper.java \
-  closed/compiler/4655758/TestClass.java \
-  closed/compiler/4671453/LongCompTest.java \
-  closed/compiler/4671460/CharArrTest.java \
-  closed/compiler/4709105/StringTest2.java \
-  closed/compiler/4732721/Bug.java \
-  closed/compiler/4750681/ReadTest.java \
-  closed/compiler/4787943/LongCrash.java \
-  closed/compiler/4819903/Base64Test.java \
-  closed/compiler/4903383/Test.java \
-  closed/compiler/4906393/Test.java \
-  closed/compiler/4907999/Uidtest.java \
-  closed/compiler/4917709/Tester.java \
-  closed/compiler/4957832/Test.java \
-  closed/compiler/4965430/LoopTest.java \
-  closed/compiler/4979449/T4979449.java \
-  closed/compiler/5031274/Test.java \
-  closed/compiler/5043395/T5043395.java \
-  closed/compiler/5049410/Test.java \
-  closed/compiler/5098422/Test.java \
-  closed/compiler/6173783/Test.java \
-  closed/compiler/6272923/Test6272923.sh \
-  closed/compiler/6290963/Test.java \
-  closed/compiler/6305546/Test.java \
-  closed/compiler/6309806/Test.java \
-  closed/compiler/6311859/Test.java \
-  closed/compiler/6321689/Test.java \
-  closed/compiler/6326935/Test.java \
-  closed/compiler/6367889/Test.java \
-  closed/compiler/6371167/Test.java \
-  closed/compiler/6389127/Test.java \
-  closed/compiler/6397650/Test.java \
-  closed/compiler/6414932/Test.java \
-  closed/compiler/6421619/Test_6421619.java \
-  closed/compiler/6427750/UnsafeVolatile.java \
-  closed/compiler/6431243/Test.java \
-  closed/compiler/6433572/TestSyncJSR.java \
-  closed/compiler/6433840/clinit.java \
-  closed/compiler/6457854/Test.java \
-  closed/compiler/6476804/Test.java \
-  closed/compiler/6512111/CorruptFinalLong.java \
-  closed/compiler/6551887/Test.java \
-  closed/compiler/6571539/Test.java \
-  closed/compiler/6587132/Test.java \
-  closed/compiler/6588045/Test.java \
-  closed/compiler/6588598/etype.java \
-  closed/compiler/6661918/Test6661918.java \
-  closed/compiler/6707044/Test.java \
-  closed/compiler/6730716/Test.java \
-  closed/compiler/6772368/Test6772368.sh \
-  closed/compiler/6897150/Test6897150.java \
-  closed/compiler/6931567/Test6931567.java \
-  closed/compiler/7196857/Test7196857.java \
-  closed/compiler/8009699/Test8009699.java \
-  closed/compiler/8009699/Test8009699B.java \
-  closed/compiler/8014811/Test8014811.java \
-  closed/compiler/8029507/InvokePrivate.java \
-  closed/compiler/callingConvention/Arg9Double.java \
-  closed/compiler/deoptimization/DeoptArithmetic.java \
-  closed/compiler/deoptimization/TestDoubleLocals.java \
-  closed/compiler/deoptimization/TestDoubleMerge.java
+  closed/compiler/c1/ \
+  closed/compiler/c2/ \
+  closed/compiler/codegen/ \
+  closed/compiler/escapeAnalysis/ \
+  closed/compiler/interpreter/ \
+  closed/compiler/jsr292/ \
+  closed/compiler/loopopts/ \
+  closed/compiler/oracle/ \
+  closed/compiler/runtime/ \
+  closed/compiler/symantec/ \
+  -closed/compiler/c1/4477197 \
+  -closed/compiler/c1/5040872 \
+  -closed/compiler/c1/6507107 \
+  -closed/compiler/c2/4344895 \
+  -closed/compiler/c2/4485006 \
+  -closed/compiler/c2/4523683 \
+  -closed/compiler/c2/4620290 \
+  -closed/compiler/c2/4998314 \
+  -closed/compiler/c2/6329104 \
+  -closed/compiler/c2/6434117 \
+  -closed/compiler/c2/6547163 \
+  -closed/compiler/c2/6563987 \
+  -closed/compiler/c2/6595044 \
+  -closed/compiler/codegen/6440479 \
+  -closed/compiler/codegen/6603011 \
+  -closed/compiler/interpreter/5034475 \
+  -closed/compiler/jsr292/LongLambdaFormDynamicStackDepth.java \
+  -closed/compiler/loopopts/4463485 \
+  -closed/compiler/loopopts/8021898
 
 hotspot_gc = \
   sanity/ExecuteInternalVMTests.java
@@ -609,4 +448,4 @@ needs_nashorn = \
 #
 not_needs_nashorn = \
   :jdk \
-  -:needs_nashorh
+  -:needs_nashorn
diff --git a/hotspot/test/compiler/6478991/NullCheckTest.java b/hotspot/test/compiler/c1/6478991/NullCheckTest.java
similarity index 100%
rename from hotspot/test/compiler/6478991/NullCheckTest.java
rename to hotspot/test/compiler/c1/6478991/NullCheckTest.java
diff --git a/hotspot/test/compiler/6579789/Test6579789.java b/hotspot/test/compiler/c1/6579789/Test6579789.java
similarity index 100%
rename from hotspot/test/compiler/6579789/Test6579789.java
rename to hotspot/test/compiler/c1/6579789/Test6579789.java
diff --git a/hotspot/test/compiler/6756768/Test6756768.java b/hotspot/test/compiler/c1/6756768/Test6756768.java
similarity index 100%
rename from hotspot/test/compiler/6756768/Test6756768.java
rename to hotspot/test/compiler/c1/6756768/Test6756768.java
diff --git a/hotspot/test/compiler/6756768/Test6756768_2.java b/hotspot/test/compiler/c1/6756768/Test6756768_2.java
similarity index 100%
rename from hotspot/test/compiler/6756768/Test6756768_2.java
rename to hotspot/test/compiler/c1/6756768/Test6756768_2.java
diff --git a/hotspot/test/compiler/6757316/Test6757316.java b/hotspot/test/compiler/c1/6757316/Test6757316.java
similarity index 100%
rename from hotspot/test/compiler/6757316/Test6757316.java
rename to hotspot/test/compiler/c1/6757316/Test6757316.java
diff --git a/hotspot/test/compiler/6758234/Test6758234.java b/hotspot/test/compiler/c1/6758234/Test6758234.java
similarity index 100%
rename from hotspot/test/compiler/6758234/Test6758234.java
rename to hotspot/test/compiler/c1/6758234/Test6758234.java
diff --git a/hotspot/test/compiler/6769124/TestArrayCopy6769124.java b/hotspot/test/compiler/c1/6769124/TestArrayCopy6769124.java
similarity index 100%
rename from hotspot/test/compiler/6769124/TestArrayCopy6769124.java
rename to hotspot/test/compiler/c1/6769124/TestArrayCopy6769124.java
diff --git a/hotspot/test/compiler/6769124/TestDeoptInt6769124.java b/hotspot/test/compiler/c1/6769124/TestDeoptInt6769124.java
similarity index 100%
rename from hotspot/test/compiler/6769124/TestDeoptInt6769124.java
rename to hotspot/test/compiler/c1/6769124/TestDeoptInt6769124.java
diff --git a/hotspot/test/compiler/6769124/TestUnalignedLoad6769124.java b/hotspot/test/compiler/c1/6769124/TestUnalignedLoad6769124.java
similarity index 100%
rename from hotspot/test/compiler/6769124/TestUnalignedLoad6769124.java
rename to hotspot/test/compiler/c1/6769124/TestUnalignedLoad6769124.java
diff --git a/hotspot/test/compiler/6795465/Test6795465.java b/hotspot/test/compiler/c1/6795465/Test6795465.java
similarity index 100%
rename from hotspot/test/compiler/6795465/Test6795465.java
rename to hotspot/test/compiler/c1/6795465/Test6795465.java
diff --git a/hotspot/test/compiler/6849574/Test.java b/hotspot/test/compiler/c1/6849574/Test.java
similarity index 100%
rename from hotspot/test/compiler/6849574/Test.java
rename to hotspot/test/compiler/c1/6849574/Test.java
diff --git a/hotspot/test/compiler/6855215/Test6855215.java b/hotspot/test/compiler/c1/6855215/Test6855215.java
similarity index 100%
rename from hotspot/test/compiler/6855215/Test6855215.java
rename to hotspot/test/compiler/c1/6855215/Test6855215.java
diff --git a/hotspot/test/compiler/6932496/Test6932496.java b/hotspot/test/compiler/c1/6932496/Test6932496.java
similarity index 100%
rename from hotspot/test/compiler/6932496/Test6932496.java
rename to hotspot/test/compiler/c1/6932496/Test6932496.java
diff --git a/hotspot/test/compiler/7042153/Test7042153.java b/hotspot/test/compiler/c1/7042153/Test7042153.java
similarity index 100%
rename from hotspot/test/compiler/7042153/Test7042153.java
rename to hotspot/test/compiler/c1/7042153/Test7042153.java
diff --git a/hotspot/test/compiler/7090976/Test7090976.java b/hotspot/test/compiler/c1/7090976/Test7090976.java
similarity index 100%
rename from hotspot/test/compiler/7090976/Test7090976.java
rename to hotspot/test/compiler/c1/7090976/Test7090976.java
diff --git a/hotspot/test/compiler/7103261/Test7103261.java b/hotspot/test/compiler/c1/7103261/Test7103261.java
similarity index 100%
rename from hotspot/test/compiler/7103261/Test7103261.java
rename to hotspot/test/compiler/c1/7103261/Test7103261.java
diff --git a/hotspot/test/compiler/7123108/Test7123108.java b/hotspot/test/compiler/c1/7123108/Test7123108.java
similarity index 100%
rename from hotspot/test/compiler/7123108/Test7123108.java
rename to hotspot/test/compiler/c1/7123108/Test7123108.java
diff --git a/hotspot/test/compiler/8004051/Test8004051.java b/hotspot/test/compiler/c1/8004051/Test8004051.java
similarity index 100%
rename from hotspot/test/compiler/8004051/Test8004051.java
rename to hotspot/test/compiler/c1/8004051/Test8004051.java
diff --git a/hotspot/test/compiler/8011706/Test8011706.java b/hotspot/test/compiler/c1/8011706/Test8011706.java
similarity index 100%
rename from hotspot/test/compiler/8011706/Test8011706.java
rename to hotspot/test/compiler/c1/8011706/Test8011706.java
diff --git a/hotspot/test/compiler/8011771/Test8011771.java b/hotspot/test/compiler/c1/8011771/Test8011771.java
similarity index 100%
rename from hotspot/test/compiler/8011771/Test8011771.java
rename to hotspot/test/compiler/c1/8011771/Test8011771.java
diff --git a/hotspot/test/compiler/5057225/Test5057225.java b/hotspot/test/compiler/c2/5057225/Test5057225.java
similarity index 100%
rename from hotspot/test/compiler/5057225/Test5057225.java
rename to hotspot/test/compiler/c2/5057225/Test5057225.java
diff --git a/hotspot/test/compiler/5091921/Test5091921.java b/hotspot/test/compiler/c2/5091921/Test5091921.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test5091921.java
rename to hotspot/test/compiler/c2/5091921/Test5091921.java
diff --git a/hotspot/test/compiler/5091921/Test6186134.java b/hotspot/test/compiler/c2/5091921/Test6186134.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6186134.java
rename to hotspot/test/compiler/c2/5091921/Test6186134.java
diff --git a/hotspot/test/compiler/5091921/Test6196102.java b/hotspot/test/compiler/c2/5091921/Test6196102.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6196102.java
rename to hotspot/test/compiler/c2/5091921/Test6196102.java
diff --git a/hotspot/test/compiler/5091921/Test6357214.java b/hotspot/test/compiler/c2/5091921/Test6357214.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6357214.java
rename to hotspot/test/compiler/c2/5091921/Test6357214.java
diff --git a/hotspot/test/compiler/5091921/Test6559156.java b/hotspot/test/compiler/c2/5091921/Test6559156.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6559156.java
rename to hotspot/test/compiler/c2/5091921/Test6559156.java
diff --git a/hotspot/test/compiler/5091921/Test6753639.java b/hotspot/test/compiler/c2/5091921/Test6753639.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6753639.java
rename to hotspot/test/compiler/c2/5091921/Test6753639.java
diff --git a/hotspot/test/compiler/5091921/Test6850611.java b/hotspot/test/compiler/c2/5091921/Test6850611.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6850611.java
rename to hotspot/test/compiler/c2/5091921/Test6850611.java
diff --git a/hotspot/test/compiler/5091921/Test6890943.java b/hotspot/test/compiler/c2/5091921/Test6890943.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6890943.java
rename to hotspot/test/compiler/c2/5091921/Test6890943.java
diff --git a/hotspot/test/compiler/5091921/Test6897150.java b/hotspot/test/compiler/c2/5091921/Test6897150.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6897150.java
rename to hotspot/test/compiler/c2/5091921/Test6897150.java
diff --git a/hotspot/test/compiler/5091921/Test6905845.java b/hotspot/test/compiler/c2/5091921/Test6905845.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6905845.java
rename to hotspot/test/compiler/c2/5091921/Test6905845.java
diff --git a/hotspot/test/compiler/5091921/Test6931567.java b/hotspot/test/compiler/c2/5091921/Test6931567.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6931567.java
rename to hotspot/test/compiler/c2/5091921/Test6931567.java
diff --git a/hotspot/test/compiler/5091921/Test6935022.java b/hotspot/test/compiler/c2/5091921/Test6935022.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6935022.java
rename to hotspot/test/compiler/c2/5091921/Test6935022.java
diff --git a/hotspot/test/compiler/5091921/Test6959129.java b/hotspot/test/compiler/c2/5091921/Test6959129.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6959129.java
rename to hotspot/test/compiler/c2/5091921/Test6959129.java
diff --git a/hotspot/test/compiler/5091921/Test6985295.java b/hotspot/test/compiler/c2/5091921/Test6985295.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6985295.java
rename to hotspot/test/compiler/c2/5091921/Test6985295.java
diff --git a/hotspot/test/compiler/5091921/Test6992759.java b/hotspot/test/compiler/c2/5091921/Test6992759.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test6992759.java
rename to hotspot/test/compiler/c2/5091921/Test6992759.java
diff --git a/hotspot/test/compiler/5091921/Test7005594.java b/hotspot/test/compiler/c2/5091921/Test7005594.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test7005594.java
rename to hotspot/test/compiler/c2/5091921/Test7005594.java
diff --git a/hotspot/test/compiler/5091921/Test7005594.sh b/hotspot/test/compiler/c2/5091921/Test7005594.sh
similarity index 98%
rename from hotspot/test/compiler/5091921/Test7005594.sh
rename to hotspot/test/compiler/c2/5091921/Test7005594.sh
index 4fa458ca723..cd6fd807b9d 100644
--- a/hotspot/test/compiler/5091921/Test7005594.sh
+++ b/hotspot/test/compiler/c2/5091921/Test7005594.sh
@@ -30,7 +30,7 @@ then
 fi
 echo "TESTSRC=${TESTSRC}"
 ## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../test_env.sh
+. ${TESTSRC}/../../../test_env.sh
 
 # Amount of physical memory in megabytes
 MEM=0
diff --git a/hotspot/test/compiler/5091921/Test7020614.java b/hotspot/test/compiler/c2/5091921/Test7020614.java
similarity index 100%
rename from hotspot/test/compiler/5091921/Test7020614.java
rename to hotspot/test/compiler/c2/5091921/Test7020614.java
diff --git a/hotspot/test/compiler/5091921/input6890943.txt b/hotspot/test/compiler/c2/5091921/input6890943.txt
similarity index 100%
rename from hotspot/test/compiler/5091921/input6890943.txt
rename to hotspot/test/compiler/c2/5091921/input6890943.txt
diff --git a/hotspot/test/compiler/5091921/output6890943.txt b/hotspot/test/compiler/c2/5091921/output6890943.txt
similarity index 100%
rename from hotspot/test/compiler/5091921/output6890943.txt
rename to hotspot/test/compiler/c2/5091921/output6890943.txt
diff --git a/hotspot/test/compiler/6340864/TestByteVect.java b/hotspot/test/compiler/c2/6340864/TestByteVect.java
similarity index 100%
rename from hotspot/test/compiler/6340864/TestByteVect.java
rename to hotspot/test/compiler/c2/6340864/TestByteVect.java
diff --git a/hotspot/test/compiler/6340864/TestDoubleVect.java b/hotspot/test/compiler/c2/6340864/TestDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/6340864/TestDoubleVect.java
rename to hotspot/test/compiler/c2/6340864/TestDoubleVect.java
diff --git a/hotspot/test/compiler/6340864/TestFloatVect.java b/hotspot/test/compiler/c2/6340864/TestFloatVect.java
similarity index 100%
rename from hotspot/test/compiler/6340864/TestFloatVect.java
rename to hotspot/test/compiler/c2/6340864/TestFloatVect.java
diff --git a/hotspot/test/compiler/6340864/TestIntVect.java b/hotspot/test/compiler/c2/6340864/TestIntVect.java
similarity index 100%
rename from hotspot/test/compiler/6340864/TestIntVect.java
rename to hotspot/test/compiler/c2/6340864/TestIntVect.java
diff --git a/hotspot/test/compiler/6340864/TestLongVect.java b/hotspot/test/compiler/c2/6340864/TestLongVect.java
similarity index 100%
rename from hotspot/test/compiler/6340864/TestLongVect.java
rename to hotspot/test/compiler/c2/6340864/TestLongVect.java
diff --git a/hotspot/test/compiler/6340864/TestShortVect.java b/hotspot/test/compiler/c2/6340864/TestShortVect.java
similarity index 100%
rename from hotspot/test/compiler/6340864/TestShortVect.java
rename to hotspot/test/compiler/c2/6340864/TestShortVect.java
diff --git a/hotspot/test/compiler/6443505/Test6443505.java b/hotspot/test/compiler/c2/6443505/Test6443505.java
similarity index 100%
rename from hotspot/test/compiler/6443505/Test6443505.java
rename to hotspot/test/compiler/c2/6443505/Test6443505.java
diff --git a/hotspot/test/compiler/6589834/InlinedArrayCloneTestCase.java b/hotspot/test/compiler/c2/6589834/InlinedArrayCloneTestCase.java
similarity index 100%
rename from hotspot/test/compiler/6589834/InlinedArrayCloneTestCase.java
rename to hotspot/test/compiler/c2/6589834/InlinedArrayCloneTestCase.java
diff --git a/hotspot/test/compiler/6589834/Test_ia32.java b/hotspot/test/compiler/c2/6589834/Test_ia32.java
similarity index 100%
rename from hotspot/test/compiler/6589834/Test_ia32.java
rename to hotspot/test/compiler/c2/6589834/Test_ia32.java
diff --git a/hotspot/test/compiler/6603011/Test.java b/hotspot/test/compiler/c2/6603011/Test.java
similarity index 100%
rename from hotspot/test/compiler/6603011/Test.java
rename to hotspot/test/compiler/c2/6603011/Test.java
diff --git a/hotspot/test/compiler/6636138/Test1.java b/hotspot/test/compiler/c2/6636138/Test1.java
similarity index 100%
rename from hotspot/test/compiler/6636138/Test1.java
rename to hotspot/test/compiler/c2/6636138/Test1.java
diff --git a/hotspot/test/compiler/6636138/Test2.java b/hotspot/test/compiler/c2/6636138/Test2.java
similarity index 100%
rename from hotspot/test/compiler/6636138/Test2.java
rename to hotspot/test/compiler/c2/6636138/Test2.java
diff --git a/hotspot/test/compiler/6646019/Test.java b/hotspot/test/compiler/c2/6646019/Test.java
similarity index 100%
rename from hotspot/test/compiler/6646019/Test.java
rename to hotspot/test/compiler/c2/6646019/Test.java
diff --git a/hotspot/test/compiler/6646020/Tester.java b/hotspot/test/compiler/c2/6646020/Tester.java
similarity index 100%
rename from hotspot/test/compiler/6646020/Tester.java
rename to hotspot/test/compiler/c2/6646020/Tester.java
diff --git a/hotspot/test/compiler/6661247/Test.java b/hotspot/test/compiler/c2/6661247/Test.java
similarity index 100%
rename from hotspot/test/compiler/6661247/Test.java
rename to hotspot/test/compiler/c2/6661247/Test.java
diff --git a/hotspot/test/compiler/6663621/IVTest.java b/hotspot/test/compiler/c2/6663621/IVTest.java
similarity index 100%
rename from hotspot/test/compiler/6663621/IVTest.java
rename to hotspot/test/compiler/c2/6663621/IVTest.java
diff --git a/hotspot/test/compiler/6663848/Tester.java b/hotspot/test/compiler/c2/6663848/Tester.java
similarity index 100%
rename from hotspot/test/compiler/6663848/Tester.java
rename to hotspot/test/compiler/c2/6663848/Tester.java
diff --git a/hotspot/test/compiler/6663854/Test6663854.java b/hotspot/test/compiler/c2/6663854/Test6663854.java
similarity index 100%
rename from hotspot/test/compiler/6663854/Test6663854.java
rename to hotspot/test/compiler/c2/6663854/Test6663854.java
diff --git a/hotspot/test/compiler/6695810/Test.java b/hotspot/test/compiler/c2/6695810/Test.java
similarity index 100%
rename from hotspot/test/compiler/6695810/Test.java
rename to hotspot/test/compiler/c2/6695810/Test.java
diff --git a/hotspot/test/compiler/6700047/Test6700047.java b/hotspot/test/compiler/c2/6700047/Test6700047.java
similarity index 100%
rename from hotspot/test/compiler/6700047/Test6700047.java
rename to hotspot/test/compiler/c2/6700047/Test6700047.java
diff --git a/hotspot/test/compiler/6711100/Test.java b/hotspot/test/compiler/c2/6711100/Test.java
similarity index 100%
rename from hotspot/test/compiler/6711100/Test.java
rename to hotspot/test/compiler/c2/6711100/Test.java
diff --git a/hotspot/test/compiler/6711117/Test.java b/hotspot/test/compiler/c2/6711117/Test.java
similarity index 100%
rename from hotspot/test/compiler/6711117/Test.java
rename to hotspot/test/compiler/c2/6711117/Test.java
diff --git a/hotspot/test/compiler/6712835/Test6712835.java b/hotspot/test/compiler/c2/6712835/Test6712835.java
similarity index 100%
rename from hotspot/test/compiler/6712835/Test6712835.java
rename to hotspot/test/compiler/c2/6712835/Test6712835.java
diff --git a/hotspot/test/compiler/6714694/Tester.java b/hotspot/test/compiler/c2/6714694/Tester.java
similarity index 100%
rename from hotspot/test/compiler/6714694/Tester.java
rename to hotspot/test/compiler/c2/6714694/Tester.java
diff --git a/hotspot/test/compiler/6724218/Test.java b/hotspot/test/compiler/c2/6724218/Test.java
similarity index 100%
rename from hotspot/test/compiler/6724218/Test.java
rename to hotspot/test/compiler/c2/6724218/Test.java
diff --git a/hotspot/test/compiler/6732154/Test6732154.java b/hotspot/test/compiler/c2/6732154/Test6732154.java
similarity index 100%
rename from hotspot/test/compiler/6732154/Test6732154.java
rename to hotspot/test/compiler/c2/6732154/Test6732154.java
diff --git a/hotspot/test/compiler/6741738/Tester.java b/hotspot/test/compiler/c2/6741738/Tester.java
similarity index 100%
rename from hotspot/test/compiler/6741738/Tester.java
rename to hotspot/test/compiler/c2/6741738/Tester.java
diff --git a/hotspot/test/compiler/6772683/InterruptedTest.java b/hotspot/test/compiler/c2/6772683/InterruptedTest.java
similarity index 100%
rename from hotspot/test/compiler/6772683/InterruptedTest.java
rename to hotspot/test/compiler/c2/6772683/InterruptedTest.java
diff --git a/hotspot/test/compiler/6792161/Test6792161.java b/hotspot/test/compiler/c2/6792161/Test6792161.java
similarity index 100%
rename from hotspot/test/compiler/6792161/Test6792161.java
rename to hotspot/test/compiler/c2/6792161/Test6792161.java
diff --git a/hotspot/test/compiler/6795362/Test6795362.java b/hotspot/test/compiler/c2/6795362/Test6795362.java
similarity index 100%
rename from hotspot/test/compiler/6795362/Test6795362.java
rename to hotspot/test/compiler/c2/6795362/Test6795362.java
diff --git a/hotspot/test/compiler/6796786/Test6796786.java b/hotspot/test/compiler/c2/6796786/Test6796786.java
similarity index 100%
rename from hotspot/test/compiler/6796786/Test6796786.java
rename to hotspot/test/compiler/c2/6796786/Test6796786.java
diff --git a/hotspot/test/compiler/6799693/Test.java b/hotspot/test/compiler/c2/6799693/Test.java
similarity index 100%
rename from hotspot/test/compiler/6799693/Test.java
rename to hotspot/test/compiler/c2/6799693/Test.java
diff --git a/hotspot/test/compiler/6800154/Test6800154.java b/hotspot/test/compiler/c2/6800154/Test6800154.java
similarity index 100%
rename from hotspot/test/compiler/6800154/Test6800154.java
rename to hotspot/test/compiler/c2/6800154/Test6800154.java
diff --git a/hotspot/test/compiler/6805724/Test6805724.java b/hotspot/test/compiler/c2/6805724/Test6805724.java
similarity index 100%
rename from hotspot/test/compiler/6805724/Test6805724.java
rename to hotspot/test/compiler/c2/6805724/Test6805724.java
diff --git a/hotspot/test/compiler/6823453/Test.java b/hotspot/test/compiler/c2/6823453/Test.java
similarity index 100%
rename from hotspot/test/compiler/6823453/Test.java
rename to hotspot/test/compiler/c2/6823453/Test.java
diff --git a/hotspot/test/compiler/6832293/Test.java b/hotspot/test/compiler/c2/6832293/Test.java
similarity index 100%
rename from hotspot/test/compiler/6832293/Test.java
rename to hotspot/test/compiler/c2/6832293/Test.java
diff --git a/hotspot/test/compiler/6837011/Test6837011.java b/hotspot/test/compiler/c2/6837011/Test6837011.java
similarity index 100%
rename from hotspot/test/compiler/6837011/Test6837011.java
rename to hotspot/test/compiler/c2/6837011/Test6837011.java
diff --git a/hotspot/test/compiler/6837094/Test.java b/hotspot/test/compiler/c2/6837094/Test.java
similarity index 100%
rename from hotspot/test/compiler/6837094/Test.java
rename to hotspot/test/compiler/c2/6837094/Test.java
diff --git a/hotspot/test/compiler/6843752/Test.java b/hotspot/test/compiler/c2/6843752/Test.java
similarity index 100%
rename from hotspot/test/compiler/6843752/Test.java
rename to hotspot/test/compiler/c2/6843752/Test.java
diff --git a/hotspot/test/compiler/6851282/Test.java b/hotspot/test/compiler/c2/6851282/Test.java
similarity index 100%
rename from hotspot/test/compiler/6851282/Test.java
rename to hotspot/test/compiler/c2/6851282/Test.java
diff --git a/hotspot/test/compiler/6852078/Test6852078.java b/hotspot/test/compiler/c2/6852078/Test6852078.java
similarity index 100%
rename from hotspot/test/compiler/6852078/Test6852078.java
rename to hotspot/test/compiler/c2/6852078/Test6852078.java
diff --git a/hotspot/test/compiler/6857159/Test6857159.java b/hotspot/test/compiler/c2/6857159/Test6857159.java
similarity index 100%
rename from hotspot/test/compiler/6857159/Test6857159.java
rename to hotspot/test/compiler/c2/6857159/Test6857159.java
diff --git a/hotspot/test/compiler/6857159/Test6857159.sh b/hotspot/test/compiler/c2/6857159/Test6857159.sh
similarity index 98%
rename from hotspot/test/compiler/6857159/Test6857159.sh
rename to hotspot/test/compiler/c2/6857159/Test6857159.sh
index cb790127c9c..0762fe17ca8 100644
--- a/hotspot/test/compiler/6857159/Test6857159.sh
+++ b/hotspot/test/compiler/c2/6857159/Test6857159.sh
@@ -30,7 +30,7 @@ then
 fi
 echo "TESTSRC=${TESTSRC}"
 ## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../test_env.sh
+. ${TESTSRC}/../../../test_env.sh
 
 set -x
 
diff --git a/hotspot/test/compiler/6863155/Test6863155.java b/hotspot/test/compiler/c2/6863155/Test6863155.java
similarity index 100%
rename from hotspot/test/compiler/6863155/Test6863155.java
rename to hotspot/test/compiler/c2/6863155/Test6863155.java
diff --git a/hotspot/test/compiler/6865031/Test.java b/hotspot/test/compiler/c2/6865031/Test.java
similarity index 100%
rename from hotspot/test/compiler/6865031/Test.java
rename to hotspot/test/compiler/c2/6865031/Test.java
diff --git a/hotspot/test/compiler/6866651/Test.java b/hotspot/test/compiler/c2/6866651/Test.java
similarity index 100%
rename from hotspot/test/compiler/6866651/Test.java
rename to hotspot/test/compiler/c2/6866651/Test.java
diff --git a/hotspot/test/compiler/6877254/Test.java b/hotspot/test/compiler/c2/6877254/Test.java
similarity index 100%
rename from hotspot/test/compiler/6877254/Test.java
rename to hotspot/test/compiler/c2/6877254/Test.java
diff --git a/hotspot/test/compiler/6880034/Test6880034.java b/hotspot/test/compiler/c2/6880034/Test6880034.java
similarity index 100%
rename from hotspot/test/compiler/6880034/Test6880034.java
rename to hotspot/test/compiler/c2/6880034/Test6880034.java
diff --git a/hotspot/test/compiler/6885584/Test6885584.java b/hotspot/test/compiler/c2/6885584/Test6885584.java
similarity index 100%
rename from hotspot/test/compiler/6885584/Test6885584.java
rename to hotspot/test/compiler/c2/6885584/Test6885584.java
diff --git a/hotspot/test/compiler/6894807/IsInstanceTest.java b/hotspot/test/compiler/c2/6894807/IsInstanceTest.java
similarity index 100%
rename from hotspot/test/compiler/6894807/IsInstanceTest.java
rename to hotspot/test/compiler/c2/6894807/IsInstanceTest.java
diff --git a/hotspot/test/compiler/6894807/Test6894807.sh b/hotspot/test/compiler/c2/6894807/Test6894807.sh
similarity index 97%
rename from hotspot/test/compiler/6894807/Test6894807.sh
rename to hotspot/test/compiler/c2/6894807/Test6894807.sh
index 609af074eda..bf10ba263bf 100644
--- a/hotspot/test/compiler/6894807/Test6894807.sh
+++ b/hotspot/test/compiler/c2/6894807/Test6894807.sh
@@ -30,7 +30,7 @@ fi
 echo "TESTSRC=${TESTSRC}"
 
 ## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../test_env.sh
+. ${TESTSRC}/../../../test_env.sh
 
 ${TESTJAVA}${FS}bin${FS}java ${TESTOPTS} IsInstanceTest > test.out 2>&1
 
diff --git a/hotspot/test/compiler/6901572/Test.java b/hotspot/test/compiler/c2/6901572/Test.java
similarity index 100%
rename from hotspot/test/compiler/6901572/Test.java
rename to hotspot/test/compiler/c2/6901572/Test.java
diff --git a/hotspot/test/compiler/6910484/Test.java b/hotspot/test/compiler/c2/6910484/Test.java
similarity index 100%
rename from hotspot/test/compiler/6910484/Test.java
rename to hotspot/test/compiler/c2/6910484/Test.java
diff --git a/hotspot/test/compiler/6910605/Test.java b/hotspot/test/compiler/c2/6910605/Test.java
similarity index 100%
rename from hotspot/test/compiler/6910605/Test.java
rename to hotspot/test/compiler/c2/6910605/Test.java
diff --git a/hotspot/test/compiler/6910618/Test.java b/hotspot/test/compiler/c2/6910618/Test.java
similarity index 100%
rename from hotspot/test/compiler/6910618/Test.java
rename to hotspot/test/compiler/c2/6910618/Test.java
diff --git a/hotspot/test/compiler/6912517/Test.java b/hotspot/test/compiler/c2/6912517/Test.java
similarity index 100%
rename from hotspot/test/compiler/6912517/Test.java
rename to hotspot/test/compiler/c2/6912517/Test.java
diff --git a/hotspot/test/compiler/6916644/Test6916644.java b/hotspot/test/compiler/c2/6916644/Test6916644.java
similarity index 100%
rename from hotspot/test/compiler/6916644/Test6916644.java
rename to hotspot/test/compiler/c2/6916644/Test6916644.java
diff --git a/hotspot/test/compiler/6921969/TestMultiplyLongHiZero.java b/hotspot/test/compiler/c2/6921969/TestMultiplyLongHiZero.java
similarity index 100%
rename from hotspot/test/compiler/6921969/TestMultiplyLongHiZero.java
rename to hotspot/test/compiler/c2/6921969/TestMultiplyLongHiZero.java
diff --git a/hotspot/test/compiler/6930043/Test6930043.java b/hotspot/test/compiler/c2/6930043/Test6930043.java
similarity index 100%
rename from hotspot/test/compiler/6930043/Test6930043.java
rename to hotspot/test/compiler/c2/6930043/Test6930043.java
diff --git a/hotspot/test/compiler/6946040/TestCharShortByteSwap.java b/hotspot/test/compiler/c2/6946040/TestCharShortByteSwap.java
similarity index 100%
rename from hotspot/test/compiler/6946040/TestCharShortByteSwap.java
rename to hotspot/test/compiler/c2/6946040/TestCharShortByteSwap.java
diff --git a/hotspot/test/compiler/6956668/Test6956668.java b/hotspot/test/compiler/c2/6956668/Test6956668.java
similarity index 100%
rename from hotspot/test/compiler/6956668/Test6956668.java
rename to hotspot/test/compiler/c2/6956668/Test6956668.java
diff --git a/hotspot/test/compiler/6958485/Test.java b/hotspot/test/compiler/c2/6958485/Test.java
similarity index 100%
rename from hotspot/test/compiler/6958485/Test.java
rename to hotspot/test/compiler/c2/6958485/Test.java
diff --git a/hotspot/test/compiler/6968348/Test6968348.java b/hotspot/test/compiler/c2/6968348/Test6968348.java
similarity index 100%
rename from hotspot/test/compiler/6968348/Test6968348.java
rename to hotspot/test/compiler/c2/6968348/Test6968348.java
diff --git a/hotspot/test/compiler/6973329/Test.java b/hotspot/test/compiler/c2/6973329/Test.java
similarity index 100%
rename from hotspot/test/compiler/6973329/Test.java
rename to hotspot/test/compiler/c2/6973329/Test.java
diff --git a/hotspot/test/compiler/7002666/Test7002666.java b/hotspot/test/compiler/c2/7002666/Test7002666.java
similarity index 100%
rename from hotspot/test/compiler/7002666/Test7002666.java
rename to hotspot/test/compiler/c2/7002666/Test7002666.java
diff --git a/hotspot/test/compiler/7009359/Test7009359.java b/hotspot/test/compiler/c2/7009359/Test7009359.java
similarity index 100%
rename from hotspot/test/compiler/7009359/Test7009359.java
rename to hotspot/test/compiler/c2/7009359/Test7009359.java
diff --git a/hotspot/test/compiler/7017746/Test.java b/hotspot/test/compiler/c2/7017746/Test.java
similarity index 100%
rename from hotspot/test/compiler/7017746/Test.java
rename to hotspot/test/compiler/c2/7017746/Test.java
diff --git a/hotspot/test/compiler/7024475/Test7024475.java b/hotspot/test/compiler/c2/7024475/Test7024475.java
similarity index 100%
rename from hotspot/test/compiler/7024475/Test7024475.java
rename to hotspot/test/compiler/c2/7024475/Test7024475.java
diff --git a/hotspot/test/compiler/7029152/Test.java b/hotspot/test/compiler/c2/7029152/Test.java
similarity index 100%
rename from hotspot/test/compiler/7029152/Test.java
rename to hotspot/test/compiler/c2/7029152/Test.java
diff --git a/hotspot/test/compiler/7041100/Test7041100.java b/hotspot/test/compiler/c2/7041100/Test7041100.java
similarity index 100%
rename from hotspot/test/compiler/7041100/Test7041100.java
rename to hotspot/test/compiler/c2/7041100/Test7041100.java
diff --git a/hotspot/test/compiler/7046096/Test7046096.java b/hotspot/test/compiler/c2/7046096/Test7046096.java
similarity index 100%
rename from hotspot/test/compiler/7046096/Test7046096.java
rename to hotspot/test/compiler/c2/7046096/Test7046096.java
diff --git a/hotspot/test/compiler/7047069/Test7047069.java b/hotspot/test/compiler/c2/7047069/Test7047069.java
similarity index 100%
rename from hotspot/test/compiler/7047069/Test7047069.java
rename to hotspot/test/compiler/c2/7047069/Test7047069.java
diff --git a/hotspot/test/compiler/7048332/Test7048332.java b/hotspot/test/compiler/c2/7048332/Test7048332.java
similarity index 100%
rename from hotspot/test/compiler/7048332/Test7048332.java
rename to hotspot/test/compiler/c2/7048332/Test7048332.java
diff --git a/hotspot/test/compiler/7068051/Test7068051.java b/hotspot/test/compiler/c2/7068051/Test7068051.java
similarity index 100%
rename from hotspot/test/compiler/7068051/Test7068051.java
rename to hotspot/test/compiler/c2/7068051/Test7068051.java
diff --git a/hotspot/test/compiler/7070134/Stemmer.java b/hotspot/test/compiler/c2/7070134/Stemmer.java
similarity index 100%
rename from hotspot/test/compiler/7070134/Stemmer.java
rename to hotspot/test/compiler/c2/7070134/Stemmer.java
diff --git a/hotspot/test/compiler/7070134/Test7070134.sh b/hotspot/test/compiler/c2/7070134/Test7070134.sh
similarity index 97%
rename from hotspot/test/compiler/7070134/Test7070134.sh
rename to hotspot/test/compiler/c2/7070134/Test7070134.sh
index 87618616c97..b79b5b16e5a 100644
--- a/hotspot/test/compiler/7070134/Test7070134.sh
+++ b/hotspot/test/compiler/c2/7070134/Test7070134.sh
@@ -30,7 +30,7 @@ then
 fi
 echo "TESTSRC=${TESTSRC}"
 ## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../test_env.sh
+. ${TESTSRC}/../../../test_env.sh
 
 set -x
 
diff --git a/hotspot/test/compiler/7070134/words b/hotspot/test/compiler/c2/7070134/words
similarity index 100%
rename from hotspot/test/compiler/7070134/words
rename to hotspot/test/compiler/c2/7070134/words
diff --git a/hotspot/test/compiler/7110586/Test7110586.java b/hotspot/test/compiler/c2/7110586/Test7110586.java
similarity index 100%
rename from hotspot/test/compiler/7110586/Test7110586.java
rename to hotspot/test/compiler/c2/7110586/Test7110586.java
diff --git a/hotspot/test/compiler/7125879/Test7125879.java b/hotspot/test/compiler/c2/7125879/Test7125879.java
similarity index 100%
rename from hotspot/test/compiler/7125879/Test7125879.java
rename to hotspot/test/compiler/c2/7125879/Test7125879.java
diff --git a/hotspot/test/compiler/7160610/Test7160610.java b/hotspot/test/compiler/c2/7160610/Test7160610.java
similarity index 100%
rename from hotspot/test/compiler/7160610/Test7160610.java
rename to hotspot/test/compiler/c2/7160610/Test7160610.java
diff --git a/hotspot/test/compiler/7169782/Test7169782.java b/hotspot/test/compiler/c2/7169782/Test7169782.java
similarity index 100%
rename from hotspot/test/compiler/7169782/Test7169782.java
rename to hotspot/test/compiler/c2/7169782/Test7169782.java
diff --git a/hotspot/test/compiler/7174363/Test7174363.java b/hotspot/test/compiler/c2/7174363/Test7174363.java
similarity index 100%
rename from hotspot/test/compiler/7174363/Test7174363.java
rename to hotspot/test/compiler/c2/7174363/Test7174363.java
diff --git a/hotspot/test/compiler/7177917/Test7177917.java b/hotspot/test/compiler/c2/7177917/Test7177917.java
similarity index 100%
rename from hotspot/test/compiler/7177917/Test7177917.java
rename to hotspot/test/compiler/c2/7177917/Test7177917.java
diff --git a/hotspot/test/compiler/7179138/Test7179138_1.java b/hotspot/test/compiler/c2/7179138/Test7179138_1.java
similarity index 100%
rename from hotspot/test/compiler/7179138/Test7179138_1.java
rename to hotspot/test/compiler/c2/7179138/Test7179138_1.java
diff --git a/hotspot/test/compiler/7179138/Test7179138_2.java b/hotspot/test/compiler/c2/7179138/Test7179138_2.java
similarity index 100%
rename from hotspot/test/compiler/7179138/Test7179138_2.java
rename to hotspot/test/compiler/c2/7179138/Test7179138_2.java
diff --git a/hotspot/test/compiler/7190310/Test7190310.java b/hotspot/test/compiler/c2/7190310/Test7190310.java
similarity index 100%
rename from hotspot/test/compiler/7190310/Test7190310.java
rename to hotspot/test/compiler/c2/7190310/Test7190310.java
diff --git a/hotspot/test/compiler/7190310/Test7190310_unsafe.java b/hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java
similarity index 100%
rename from hotspot/test/compiler/7190310/Test7190310_unsafe.java
rename to hotspot/test/compiler/c2/7190310/Test7190310_unsafe.java
diff --git a/hotspot/test/compiler/7192963/TestByteVect.java b/hotspot/test/compiler/c2/7192963/TestByteVect.java
similarity index 100%
rename from hotspot/test/compiler/7192963/TestByteVect.java
rename to hotspot/test/compiler/c2/7192963/TestByteVect.java
diff --git a/hotspot/test/compiler/7192963/TestDoubleVect.java b/hotspot/test/compiler/c2/7192963/TestDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/7192963/TestDoubleVect.java
rename to hotspot/test/compiler/c2/7192963/TestDoubleVect.java
diff --git a/hotspot/test/compiler/7192963/TestFloatVect.java b/hotspot/test/compiler/c2/7192963/TestFloatVect.java
similarity index 100%
rename from hotspot/test/compiler/7192963/TestFloatVect.java
rename to hotspot/test/compiler/c2/7192963/TestFloatVect.java
diff --git a/hotspot/test/compiler/7192963/TestIntVect.java b/hotspot/test/compiler/c2/7192963/TestIntVect.java
similarity index 100%
rename from hotspot/test/compiler/7192963/TestIntVect.java
rename to hotspot/test/compiler/c2/7192963/TestIntVect.java
diff --git a/hotspot/test/compiler/7192963/TestLongVect.java b/hotspot/test/compiler/c2/7192963/TestLongVect.java
similarity index 100%
rename from hotspot/test/compiler/7192963/TestLongVect.java
rename to hotspot/test/compiler/c2/7192963/TestLongVect.java
diff --git a/hotspot/test/compiler/7192963/TestShortVect.java b/hotspot/test/compiler/c2/7192963/TestShortVect.java
similarity index 100%
rename from hotspot/test/compiler/7192963/TestShortVect.java
rename to hotspot/test/compiler/c2/7192963/TestShortVect.java
diff --git a/hotspot/test/compiler/7199742/Test7199742.java b/hotspot/test/compiler/c2/7199742/Test7199742.java
similarity index 100%
rename from hotspot/test/compiler/7199742/Test7199742.java
rename to hotspot/test/compiler/c2/7199742/Test7199742.java
diff --git a/hotspot/test/compiler/7200264/Test7200264.sh b/hotspot/test/compiler/c2/7200264/Test7200264.sh
similarity index 99%
rename from hotspot/test/compiler/7200264/Test7200264.sh
rename to hotspot/test/compiler/c2/7200264/Test7200264.sh
index 5e7e508a5f2..a8fee1b7835 100644
--- a/hotspot/test/compiler/7200264/Test7200264.sh
+++ b/hotspot/test/compiler/c2/7200264/Test7200264.sh
@@ -31,7 +31,7 @@ then
 fi
 echo "TESTSRC=${TESTSRC}"
 ## Adding common setup Variables for running shell tests.
-. ${TESTSRC}/../../test_env.sh
+. ${TESTSRC}/../../../test_env.sh
 
 ${TESTJAVA}${FS}bin${FS}java ${TESTOPTS} -Xinternalversion | sed 's/amd64/x86/' | grep "x86" | grep "Server VM" | grep "debug"
 
diff --git a/hotspot/test/compiler/7200264/TestIntVect.java b/hotspot/test/compiler/c2/7200264/TestIntVect.java
similarity index 100%
rename from hotspot/test/compiler/7200264/TestIntVect.java
rename to hotspot/test/compiler/c2/7200264/TestIntVect.java
diff --git a/hotspot/test/compiler/8000805/Test8000805.java b/hotspot/test/compiler/c2/8000805/Test8000805.java
similarity index 100%
rename from hotspot/test/compiler/8000805/Test8000805.java
rename to hotspot/test/compiler/c2/8000805/Test8000805.java
diff --git a/hotspot/test/compiler/8002069/Test8002069.java b/hotspot/test/compiler/c2/8002069/Test8002069.java
similarity index 100%
rename from hotspot/test/compiler/8002069/Test8002069.java
rename to hotspot/test/compiler/c2/8002069/Test8002069.java
diff --git a/hotspot/test/compiler/8004741/Test8004741.java b/hotspot/test/compiler/c2/8004741/Test8004741.java
similarity index 100%
rename from hotspot/test/compiler/8004741/Test8004741.java
rename to hotspot/test/compiler/c2/8004741/Test8004741.java
diff --git a/hotspot/test/compiler/8004867/TestIntAtomicCAS.java b/hotspot/test/compiler/c2/8004867/TestIntAtomicCAS.java
similarity index 100%
rename from hotspot/test/compiler/8004867/TestIntAtomicCAS.java
rename to hotspot/test/compiler/c2/8004867/TestIntAtomicCAS.java
diff --git a/hotspot/test/compiler/8004867/TestIntAtomicOrdered.java b/hotspot/test/compiler/c2/8004867/TestIntAtomicOrdered.java
similarity index 100%
rename from hotspot/test/compiler/8004867/TestIntAtomicOrdered.java
rename to hotspot/test/compiler/c2/8004867/TestIntAtomicOrdered.java
diff --git a/hotspot/test/compiler/8004867/TestIntAtomicVolatile.java b/hotspot/test/compiler/c2/8004867/TestIntAtomicVolatile.java
similarity index 100%
rename from hotspot/test/compiler/8004867/TestIntAtomicVolatile.java
rename to hotspot/test/compiler/c2/8004867/TestIntAtomicVolatile.java
diff --git a/hotspot/test/compiler/8004867/TestIntUnsafeCAS.java b/hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java
similarity index 100%
rename from hotspot/test/compiler/8004867/TestIntUnsafeCAS.java
rename to hotspot/test/compiler/c2/8004867/TestIntUnsafeCAS.java
diff --git a/hotspot/test/compiler/8004867/TestIntUnsafeOrdered.java b/hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java
similarity index 100%
rename from hotspot/test/compiler/8004867/TestIntUnsafeOrdered.java
rename to hotspot/test/compiler/c2/8004867/TestIntUnsafeOrdered.java
diff --git a/hotspot/test/compiler/8004867/TestIntUnsafeVolatile.java b/hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java
similarity index 100%
rename from hotspot/test/compiler/8004867/TestIntUnsafeVolatile.java
rename to hotspot/test/compiler/c2/8004867/TestIntUnsafeVolatile.java
diff --git a/hotspot/test/compiler/8005956/PolynomialRoot.java b/hotspot/test/compiler/c2/8005956/PolynomialRoot.java
similarity index 100%
rename from hotspot/test/compiler/8005956/PolynomialRoot.java
rename to hotspot/test/compiler/c2/8005956/PolynomialRoot.java
diff --git a/hotspot/test/compiler/8007294/Test8007294.java b/hotspot/test/compiler/c2/8007294/Test8007294.java
similarity index 100%
rename from hotspot/test/compiler/8007294/Test8007294.java
rename to hotspot/test/compiler/c2/8007294/Test8007294.java
diff --git a/hotspot/test/compiler/8007722/Test8007722.java b/hotspot/test/compiler/c2/8007722/Test8007722.java
similarity index 100%
rename from hotspot/test/compiler/8007722/Test8007722.java
rename to hotspot/test/compiler/c2/8007722/Test8007722.java
diff --git a/hotspot/test/compiler/6378821/Test6378821.java b/hotspot/test/compiler/codegen/6378821/Test6378821.java
similarity index 100%
rename from hotspot/test/compiler/6378821/Test6378821.java
rename to hotspot/test/compiler/codegen/6378821/Test6378821.java
diff --git a/hotspot/test/compiler/6431242/Test.java b/hotspot/test/compiler/codegen/6431242/Test.java
similarity index 100%
rename from hotspot/test/compiler/6431242/Test.java
rename to hotspot/test/compiler/codegen/6431242/Test.java
diff --git a/hotspot/test/compiler/6797305/Test6797305.java b/hotspot/test/compiler/codegen/6797305/Test6797305.java
similarity index 100%
rename from hotspot/test/compiler/6797305/Test6797305.java
rename to hotspot/test/compiler/codegen/6797305/Test6797305.java
diff --git a/hotspot/test/compiler/6814842/Test6814842.java b/hotspot/test/compiler/codegen/6814842/Test6814842.java
similarity index 100%
rename from hotspot/test/compiler/6814842/Test6814842.java
rename to hotspot/test/compiler/codegen/6814842/Test6814842.java
diff --git a/hotspot/test/compiler/6823354/Test6823354.java b/hotspot/test/compiler/codegen/6823354/Test6823354.java
similarity index 100%
rename from hotspot/test/compiler/6823354/Test6823354.java
rename to hotspot/test/compiler/codegen/6823354/Test6823354.java
diff --git a/hotspot/test/compiler/6875866/Test.java b/hotspot/test/compiler/codegen/6875866/Test.java
similarity index 100%
rename from hotspot/test/compiler/6875866/Test.java
rename to hotspot/test/compiler/codegen/6875866/Test.java
diff --git a/hotspot/test/compiler/6879902/Test6879902.java b/hotspot/test/compiler/codegen/6879902/Test6879902.java
similarity index 100%
rename from hotspot/test/compiler/6879902/Test6879902.java
rename to hotspot/test/compiler/codegen/6879902/Test6879902.java
diff --git a/hotspot/test/compiler/6896617/Test6896617.java b/hotspot/test/compiler/codegen/6896617/Test6896617.java
similarity index 100%
rename from hotspot/test/compiler/6896617/Test6896617.java
rename to hotspot/test/compiler/codegen/6896617/Test6896617.java
diff --git a/hotspot/test/compiler/6909839/Test6909839.java b/hotspot/test/compiler/codegen/6909839/Test6909839.java
similarity index 100%
rename from hotspot/test/compiler/6909839/Test6909839.java
rename to hotspot/test/compiler/codegen/6909839/Test6909839.java
diff --git a/hotspot/test/compiler/6935535/Test.java b/hotspot/test/compiler/codegen/6935535/Test.java
similarity index 100%
rename from hotspot/test/compiler/6935535/Test.java
rename to hotspot/test/compiler/codegen/6935535/Test.java
diff --git a/hotspot/test/compiler/6942326/Test.java b/hotspot/test/compiler/codegen/6942326/Test.java
similarity index 100%
rename from hotspot/test/compiler/6942326/Test.java
rename to hotspot/test/compiler/codegen/6942326/Test.java
diff --git a/hotspot/test/compiler/7009231/Test7009231.java b/hotspot/test/compiler/codegen/7009231/Test7009231.java
similarity index 100%
rename from hotspot/test/compiler/7009231/Test7009231.java
rename to hotspot/test/compiler/codegen/7009231/Test7009231.java
diff --git a/hotspot/test/compiler/7088419/CRCTest.java b/hotspot/test/compiler/codegen/7088419/CRCTest.java
similarity index 100%
rename from hotspot/test/compiler/7088419/CRCTest.java
rename to hotspot/test/compiler/codegen/7088419/CRCTest.java
diff --git a/hotspot/test/compiler/7100757/Test7100757.java b/hotspot/test/compiler/codegen/7100757/Test7100757.java
similarity index 100%
rename from hotspot/test/compiler/7100757/Test7100757.java
rename to hotspot/test/compiler/codegen/7100757/Test7100757.java
diff --git a/hotspot/test/compiler/7119644/TestBooleanVect.java b/hotspot/test/compiler/codegen/7119644/TestBooleanVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestBooleanVect.java
rename to hotspot/test/compiler/codegen/7119644/TestBooleanVect.java
diff --git a/hotspot/test/compiler/7119644/TestByteDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestByteDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestByteDoubleVect.java
rename to hotspot/test/compiler/codegen/7119644/TestByteDoubleVect.java
diff --git a/hotspot/test/compiler/7119644/TestByteFloatVect.java b/hotspot/test/compiler/codegen/7119644/TestByteFloatVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestByteFloatVect.java
rename to hotspot/test/compiler/codegen/7119644/TestByteFloatVect.java
diff --git a/hotspot/test/compiler/7119644/TestByteIntVect.java b/hotspot/test/compiler/codegen/7119644/TestByteIntVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestByteIntVect.java
rename to hotspot/test/compiler/codegen/7119644/TestByteIntVect.java
diff --git a/hotspot/test/compiler/7119644/TestByteLongVect.java b/hotspot/test/compiler/codegen/7119644/TestByteLongVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestByteLongVect.java
rename to hotspot/test/compiler/codegen/7119644/TestByteLongVect.java
diff --git a/hotspot/test/compiler/7119644/TestByteShortVect.java b/hotspot/test/compiler/codegen/7119644/TestByteShortVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestByteShortVect.java
rename to hotspot/test/compiler/codegen/7119644/TestByteShortVect.java
diff --git a/hotspot/test/compiler/7119644/TestByteVect.java b/hotspot/test/compiler/codegen/7119644/TestByteVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestByteVect.java
rename to hotspot/test/compiler/codegen/7119644/TestByteVect.java
diff --git a/hotspot/test/compiler/7119644/TestCharShortVect.java b/hotspot/test/compiler/codegen/7119644/TestCharShortVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestCharShortVect.java
rename to hotspot/test/compiler/codegen/7119644/TestCharShortVect.java
diff --git a/hotspot/test/compiler/7119644/TestCharVect.java b/hotspot/test/compiler/codegen/7119644/TestCharVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestCharVect.java
rename to hotspot/test/compiler/codegen/7119644/TestCharVect.java
diff --git a/hotspot/test/compiler/7119644/TestDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestDoubleVect.java
rename to hotspot/test/compiler/codegen/7119644/TestDoubleVect.java
diff --git a/hotspot/test/compiler/7119644/TestFloatDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestFloatDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestFloatDoubleVect.java
rename to hotspot/test/compiler/codegen/7119644/TestFloatDoubleVect.java
diff --git a/hotspot/test/compiler/7119644/TestFloatVect.java b/hotspot/test/compiler/codegen/7119644/TestFloatVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestFloatVect.java
rename to hotspot/test/compiler/codegen/7119644/TestFloatVect.java
diff --git a/hotspot/test/compiler/7119644/TestIntDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestIntDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestIntDoubleVect.java
rename to hotspot/test/compiler/codegen/7119644/TestIntDoubleVect.java
diff --git a/hotspot/test/compiler/7119644/TestIntFloatVect.java b/hotspot/test/compiler/codegen/7119644/TestIntFloatVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestIntFloatVect.java
rename to hotspot/test/compiler/codegen/7119644/TestIntFloatVect.java
diff --git a/hotspot/test/compiler/7119644/TestIntLongVect.java b/hotspot/test/compiler/codegen/7119644/TestIntLongVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestIntLongVect.java
rename to hotspot/test/compiler/codegen/7119644/TestIntLongVect.java
diff --git a/hotspot/test/compiler/7119644/TestIntVect.java b/hotspot/test/compiler/codegen/7119644/TestIntVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestIntVect.java
rename to hotspot/test/compiler/codegen/7119644/TestIntVect.java
diff --git a/hotspot/test/compiler/7119644/TestLongDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestLongDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestLongDoubleVect.java
rename to hotspot/test/compiler/codegen/7119644/TestLongDoubleVect.java
diff --git a/hotspot/test/compiler/7119644/TestLongFloatVect.java b/hotspot/test/compiler/codegen/7119644/TestLongFloatVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestLongFloatVect.java
rename to hotspot/test/compiler/codegen/7119644/TestLongFloatVect.java
diff --git a/hotspot/test/compiler/7119644/TestLongVect.java b/hotspot/test/compiler/codegen/7119644/TestLongVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestLongVect.java
rename to hotspot/test/compiler/codegen/7119644/TestLongVect.java
diff --git a/hotspot/test/compiler/7119644/TestShortDoubleVect.java b/hotspot/test/compiler/codegen/7119644/TestShortDoubleVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestShortDoubleVect.java
rename to hotspot/test/compiler/codegen/7119644/TestShortDoubleVect.java
diff --git a/hotspot/test/compiler/7119644/TestShortFloatVect.java b/hotspot/test/compiler/codegen/7119644/TestShortFloatVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestShortFloatVect.java
rename to hotspot/test/compiler/codegen/7119644/TestShortFloatVect.java
diff --git a/hotspot/test/compiler/7119644/TestShortIntVect.java b/hotspot/test/compiler/codegen/7119644/TestShortIntVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestShortIntVect.java
rename to hotspot/test/compiler/codegen/7119644/TestShortIntVect.java
diff --git a/hotspot/test/compiler/7119644/TestShortLongVect.java b/hotspot/test/compiler/codegen/7119644/TestShortLongVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestShortLongVect.java
rename to hotspot/test/compiler/codegen/7119644/TestShortLongVect.java
diff --git a/hotspot/test/compiler/7119644/TestShortVect.java b/hotspot/test/compiler/codegen/7119644/TestShortVect.java
similarity index 100%
rename from hotspot/test/compiler/7119644/TestShortVect.java
rename to hotspot/test/compiler/codegen/7119644/TestShortVect.java
diff --git a/hotspot/test/compiler/7184394/TestAESBase.java b/hotspot/test/compiler/codegen/7184394/TestAESBase.java
similarity index 100%
rename from hotspot/test/compiler/7184394/TestAESBase.java
rename to hotspot/test/compiler/codegen/7184394/TestAESBase.java
diff --git a/hotspot/test/compiler/7184394/TestAESDecode.java b/hotspot/test/compiler/codegen/7184394/TestAESDecode.java
similarity index 100%
rename from hotspot/test/compiler/7184394/TestAESDecode.java
rename to hotspot/test/compiler/codegen/7184394/TestAESDecode.java
diff --git a/hotspot/test/compiler/7184394/TestAESEncode.java b/hotspot/test/compiler/codegen/7184394/TestAESEncode.java
similarity index 100%
rename from hotspot/test/compiler/7184394/TestAESEncode.java
rename to hotspot/test/compiler/codegen/7184394/TestAESEncode.java
diff --git a/hotspot/test/compiler/7184394/TestAESMain.java b/hotspot/test/compiler/codegen/7184394/TestAESMain.java
similarity index 100%
rename from hotspot/test/compiler/7184394/TestAESMain.java
rename to hotspot/test/compiler/codegen/7184394/TestAESMain.java
diff --git a/hotspot/test/compiler/8001183/TestCharVect.java b/hotspot/test/compiler/codegen/8001183/TestCharVect.java
similarity index 100%
rename from hotspot/test/compiler/8001183/TestCharVect.java
rename to hotspot/test/compiler/codegen/8001183/TestCharVect.java
diff --git a/hotspot/test/compiler/8005033/Test8005033.java b/hotspot/test/compiler/codegen/8005033/Test8005033.java
similarity index 100%
rename from hotspot/test/compiler/8005033/Test8005033.java
rename to hotspot/test/compiler/codegen/8005033/Test8005033.java
diff --git a/hotspot/test/compiler/8011901/Test8011901.java b/hotspot/test/compiler/codegen/8011901/Test8011901.java
similarity index 100%
rename from hotspot/test/compiler/8011901/Test8011901.java
rename to hotspot/test/compiler/codegen/8011901/Test8011901.java
diff --git a/hotspot/test/compiler/6934604/TestByteBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestByteBoxing.java
similarity index 100%
rename from hotspot/test/compiler/6934604/TestByteBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/6934604/TestByteBoxing.java
diff --git a/hotspot/test/compiler/6934604/TestDoubleBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestDoubleBoxing.java
similarity index 100%
rename from hotspot/test/compiler/6934604/TestDoubleBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/6934604/TestDoubleBoxing.java
diff --git a/hotspot/test/compiler/6934604/TestFloatBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestFloatBoxing.java
similarity index 100%
rename from hotspot/test/compiler/6934604/TestFloatBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/6934604/TestFloatBoxing.java
diff --git a/hotspot/test/compiler/6934604/TestIntBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestIntBoxing.java
similarity index 100%
rename from hotspot/test/compiler/6934604/TestIntBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/6934604/TestIntBoxing.java
diff --git a/hotspot/test/compiler/6934604/TestLongBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestLongBoxing.java
similarity index 100%
rename from hotspot/test/compiler/6934604/TestLongBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/6934604/TestLongBoxing.java
diff --git a/hotspot/test/compiler/6934604/TestShortBoxing.java b/hotspot/test/compiler/eliminateAutobox/6934604/TestShortBoxing.java
similarity index 100%
rename from hotspot/test/compiler/6934604/TestShortBoxing.java
rename to hotspot/test/compiler/eliminateAutobox/6934604/TestShortBoxing.java
diff --git a/hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java b/hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java
similarity index 100%
rename from hotspot/test/compiler/EliminateAutoBox/UnsignedLoads.java
rename to hotspot/test/compiler/eliminateAutobox/UnsignedLoads.java
diff --git a/hotspot/test/compiler/6689060/Test.java b/hotspot/test/compiler/escapeAnalysis/6689060/Test.java
similarity index 100%
rename from hotspot/test/compiler/6689060/Test.java
rename to hotspot/test/compiler/escapeAnalysis/6689060/Test.java
diff --git a/hotspot/test/compiler/6716441/Tester.java b/hotspot/test/compiler/escapeAnalysis/6716441/Tester.java
similarity index 100%
rename from hotspot/test/compiler/6716441/Tester.java
rename to hotspot/test/compiler/escapeAnalysis/6716441/Tester.java
diff --git a/hotspot/test/compiler/6726999/Test.java b/hotspot/test/compiler/escapeAnalysis/6726999/Test.java
similarity index 100%
rename from hotspot/test/compiler/6726999/Test.java
rename to hotspot/test/compiler/escapeAnalysis/6726999/Test.java
diff --git a/hotspot/test/compiler/6775880/Test.java b/hotspot/test/compiler/escapeAnalysis/6775880/Test.java
similarity index 100%
rename from hotspot/test/compiler/6775880/Test.java
rename to hotspot/test/compiler/escapeAnalysis/6775880/Test.java
diff --git a/hotspot/test/compiler/6795161/Test.java b/hotspot/test/compiler/escapeAnalysis/6795161/Test.java
similarity index 100%
rename from hotspot/test/compiler/6795161/Test.java
rename to hotspot/test/compiler/escapeAnalysis/6795161/Test.java
diff --git a/hotspot/test/compiler/6895383/Test.java b/hotspot/test/compiler/escapeAnalysis/6895383/Test.java
similarity index 100%
rename from hotspot/test/compiler/6895383/Test.java
rename to hotspot/test/compiler/escapeAnalysis/6895383/Test.java
diff --git a/hotspot/test/compiler/6896727/Test.java b/hotspot/test/compiler/escapeAnalysis/6896727/Test.java
similarity index 100%
rename from hotspot/test/compiler/6896727/Test.java
rename to hotspot/test/compiler/escapeAnalysis/6896727/Test.java
diff --git a/hotspot/test/compiler/EscapeAnalysis/Test8020215.java b/hotspot/test/compiler/escapeAnalysis/Test8020215.java
similarity index 100%
rename from hotspot/test/compiler/EscapeAnalysis/Test8020215.java
rename to hotspot/test/compiler/escapeAnalysis/Test8020215.java
diff --git a/hotspot/test/compiler/EscapeAnalysis/TestAllocatedEscapesPtrComparison.java b/hotspot/test/compiler/escapeAnalysis/TestAllocatedEscapesPtrComparison.java
similarity index 100%
rename from hotspot/test/compiler/EscapeAnalysis/TestAllocatedEscapesPtrComparison.java
rename to hotspot/test/compiler/escapeAnalysis/TestAllocatedEscapesPtrComparison.java
diff --git a/hotspot/test/compiler/EscapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java b/hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java
similarity index 100%
rename from hotspot/test/compiler/EscapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java
rename to hotspot/test/compiler/escapeAnalysis/TestUnsafePutAddressNullObjMustNotEscape.java
diff --git a/hotspot/test/compiler/IntegerArithmetic/TestIntegerComparison.java b/hotspot/test/compiler/integerArithmetic/TestIntegerComparison.java
similarity index 100%
rename from hotspot/test/compiler/IntegerArithmetic/TestIntegerComparison.java
rename to hotspot/test/compiler/integerArithmetic/TestIntegerComparison.java
diff --git a/hotspot/test/compiler/6539464/Test.java b/hotspot/test/compiler/interpreter/6539464/Test.java
similarity index 100%
rename from hotspot/test/compiler/6539464/Test.java
rename to hotspot/test/compiler/interpreter/6539464/Test.java
diff --git a/hotspot/test/compiler/6833129/Test.java b/hotspot/test/compiler/interpreter/6833129/Test.java
similarity index 100%
rename from hotspot/test/compiler/6833129/Test.java
rename to hotspot/test/compiler/interpreter/6833129/Test.java
diff --git a/hotspot/test/compiler/7116216/LargeFrame.java b/hotspot/test/compiler/interpreter/7116216/LargeFrame.java
similarity index 100%
rename from hotspot/test/compiler/7116216/LargeFrame.java
rename to hotspot/test/compiler/interpreter/7116216/LargeFrame.java
diff --git a/hotspot/test/compiler/7116216/StackOverflow.java b/hotspot/test/compiler/interpreter/7116216/StackOverflow.java
similarity index 100%
rename from hotspot/test/compiler/7116216/StackOverflow.java
rename to hotspot/test/compiler/interpreter/7116216/StackOverflow.java
diff --git a/hotspot/test/compiler/6982370/Test6982370.java b/hotspot/test/compiler/intrinsics/6982370/Test6982370.java
similarity index 100%
rename from hotspot/test/compiler/6982370/Test6982370.java
rename to hotspot/test/compiler/intrinsics/6982370/Test6982370.java
diff --git a/hotspot/test/compiler/8005419/Test8005419.java b/hotspot/test/compiler/intrinsics/8005419/Test8005419.java
similarity index 100%
rename from hotspot/test/compiler/8005419/Test8005419.java
rename to hotspot/test/compiler/intrinsics/8005419/Test8005419.java
diff --git a/hotspot/test/compiler/6990212/Test6990212.java b/hotspot/test/compiler/jsr292/6990212/Test6990212.java
similarity index 100%
rename from hotspot/test/compiler/6990212/Test6990212.java
rename to hotspot/test/compiler/jsr292/6990212/Test6990212.java
diff --git a/hotspot/test/compiler/7082949/Test7082949.java b/hotspot/test/compiler/jsr292/7082949/Test7082949.java
similarity index 100%
rename from hotspot/test/compiler/7082949/Test7082949.java
rename to hotspot/test/compiler/jsr292/7082949/Test7082949.java
diff --git a/hotspot/test/compiler/6659207/Test.java b/hotspot/test/compiler/loopopts/6659207/Test.java
similarity index 100%
rename from hotspot/test/compiler/6659207/Test.java
rename to hotspot/test/compiler/loopopts/6659207/Test.java
diff --git a/hotspot/test/compiler/6855164/Test.java b/hotspot/test/compiler/loopopts/6855164/Test.java
similarity index 100%
rename from hotspot/test/compiler/6855164/Test.java
rename to hotspot/test/compiler/loopopts/6855164/Test.java
diff --git a/hotspot/test/compiler/6860469/Test.java b/hotspot/test/compiler/loopopts/6860469/Test.java
similarity index 100%
rename from hotspot/test/compiler/6860469/Test.java
rename to hotspot/test/compiler/loopopts/6860469/Test.java
diff --git a/hotspot/test/compiler/7044738/Test7044738.java b/hotspot/test/compiler/loopopts/7044738/Test7044738.java
similarity index 100%
rename from hotspot/test/compiler/7044738/Test7044738.java
rename to hotspot/test/compiler/loopopts/7044738/Test7044738.java
diff --git a/hotspot/test/compiler/7052494/Test7052494.java b/hotspot/test/compiler/loopopts/7052494/Test7052494.java
similarity index 100%
rename from hotspot/test/compiler/7052494/Test7052494.java
rename to hotspot/test/compiler/loopopts/7052494/Test7052494.java
diff --git a/hotspot/test/compiler/6778657/Test.java b/hotspot/test/compiler/runtime/6778657/Test.java
similarity index 100%
rename from hotspot/test/compiler/6778657/Test.java
rename to hotspot/test/compiler/runtime/6778657/Test.java
diff --git a/hotspot/test/compiler/6826736/Test.java b/hotspot/test/compiler/runtime/6826736/Test.java
similarity index 100%
rename from hotspot/test/compiler/6826736/Test.java
rename to hotspot/test/compiler/runtime/6826736/Test.java
diff --git a/hotspot/test/compiler/6859338/Test6859338.java b/hotspot/test/compiler/runtime/6859338/Test6859338.java
similarity index 100%
rename from hotspot/test/compiler/6859338/Test6859338.java
rename to hotspot/test/compiler/runtime/6859338/Test6859338.java
diff --git a/hotspot/test/compiler/6863420/Test.java b/hotspot/test/compiler/runtime/6863420/Test.java
similarity index 100%
rename from hotspot/test/compiler/6863420/Test.java
rename to hotspot/test/compiler/runtime/6863420/Test.java
diff --git a/hotspot/test/compiler/6865265/StackOverflowBug.java b/hotspot/test/compiler/runtime/6865265/StackOverflowBug.java
similarity index 100%
rename from hotspot/test/compiler/6865265/StackOverflowBug.java
rename to hotspot/test/compiler/runtime/6865265/StackOverflowBug.java
diff --git a/hotspot/test/compiler/6891750/Test6891750.java b/hotspot/test/compiler/runtime/6891750/Test6891750.java
similarity index 100%
rename from hotspot/test/compiler/6891750/Test6891750.java
rename to hotspot/test/compiler/runtime/6891750/Test6891750.java
diff --git a/hotspot/test/compiler/6892265/Test.java b/hotspot/test/compiler/runtime/6892265/Test.java
similarity index 100%
rename from hotspot/test/compiler/6892265/Test.java
rename to hotspot/test/compiler/runtime/6892265/Test.java
diff --git a/hotspot/test/compiler/7088020/Test7088020.java b/hotspot/test/compiler/runtime/7088020/Test7088020.java
similarity index 100%
rename from hotspot/test/compiler/7088020/Test7088020.java
rename to hotspot/test/compiler/runtime/7088020/Test7088020.java
diff --git a/hotspot/test/compiler/7141637/SpreadNullArg.java b/hotspot/test/compiler/runtime/7141637/SpreadNullArg.java
similarity index 100%
rename from hotspot/test/compiler/7141637/SpreadNullArg.java
rename to hotspot/test/compiler/runtime/7141637/SpreadNullArg.java
diff --git a/hotspot/test/compiler/7196199/Test7196199.java b/hotspot/test/compiler/runtime/7196199/Test7196199.java
similarity index 100%
rename from hotspot/test/compiler/7196199/Test7196199.java
rename to hotspot/test/compiler/runtime/7196199/Test7196199.java
diff --git a/hotspot/test/compiler/8010927/Test8010927.java b/hotspot/test/compiler/runtime/8010927/Test8010927.java
similarity index 100%
rename from hotspot/test/compiler/8010927/Test8010927.java
rename to hotspot/test/compiler/runtime/8010927/Test8010927.java
diff --git a/hotspot/test/compiler/8015436/Test8015436.java b/hotspot/test/compiler/runtime/8015436/Test8015436.java
similarity index 100%
rename from hotspot/test/compiler/8015436/Test8015436.java
rename to hotspot/test/compiler/runtime/8015436/Test8015436.java
diff --git a/hotspot/test/compiler/8009761/Test8009761.java b/hotspot/test/compiler/uncommontrap/8009761/Test8009761.java
similarity index 100%
rename from hotspot/test/compiler/8009761/Test8009761.java
rename to hotspot/test/compiler/uncommontrap/8009761/Test8009761.java

From a669f5bd5840e7137b1eab1055f8b54973b54a0a Mon Sep 17 00:00:00 2001
From: Frank Yuan <frank.yuan@oracle.com>
Date: Tue, 18 Nov 2014 12:01:27 -0800
Subject: [PATCH 109/299] 8043084: XML JAXP unittest co-location

Reviewed-by: joehw, dfuchs
---
 jaxp/test/TEST.ROOT                           |    3 +
 jaxp/test/javax/xml/jaxp/TEST.properties      |    3 +
 .../unittest/javax/xml/common/Bug6350682.java |   69 +
 .../javax/xml/common/Bug6723276Test.java      |   64 +
 .../unittest/javax/xml/common/Bug6941169.xml  |   10 +
 .../unittest/javax/xml/common/Bug6941169.xsd  |   11 +
 .../javax/xml/common/Bug6941169Test.java      |  501 +++
 .../javax/xml/common/Bug6979306Test.java      |   44 +
 .../javax/xml/common/Bug7143711Test.java      |  159 +
 .../javax/xml/datatype/Bug6320118.java        |  104 +
 .../javax/xml/datatype/Bug6937951Test.java    |   49 +
 .../javax/xml/datatype/Bug6937964Test.java    |  262 ++
 .../javax/xml/datatype/Bug7042647Test.java    |   52 +
 .../xml/datatype/DatatypeFactoryTest.java     |  631 +++
 .../javax/xml/datatype/DurationTest.java      |  476 +++
 .../javax/xml/datatype/FactoryFindTest.java   |   76 +
 .../datatype/XMLGregorianCalendarTest.java    |  219 +
 .../parsers/Bug4674384_MAX_OCCURS_Test.java   |   63 +
 .../parsers/Bug4674384_MAX_OCCURS_Test.xml    |    8 +
 .../parsers/Bug4674384_MAX_OCCURS_Test.xsd    |   15 +
 .../javax/xml/parsers/Bug4934208.java         |   70 +
 .../javax/xml/parsers/Bug4967002.java         |   97 +
 .../javax/xml/parsers/Bug4985486.java         |   64 +
 .../unittest/javax/xml/parsers/Bug4985486.xml |    2 +
 .../javax/xml/parsers/Bug4991020.java         |   52 +
 .../unittest/javax/xml/parsers/Bug4991020.xml |    5 +
 .../unittest/javax/xml/parsers/Bug4991020.xsd |   16 +
 .../javax/xml/parsers/Bug4991946.java         |   52 +
 .../unittest/javax/xml/parsers/Bug4991946.xml |    7 +
 .../unittest/javax/xml/parsers/Bug4991946.xsd |   16 +
 .../javax/xml/parsers/Bug5010072.java         |   73 +
 .../unittest/javax/xml/parsers/Bug5010072.xsd |   14 +
 .../javax/xml/parsers/Bug5025825.java         |   85 +
 .../javax/xml/parsers/Bug6309988.java         |  380 ++
 .../javax/xml/parsers/Bug6341770.java         |   74 +
 .../javax/xml/parsers/Bug6361283.java         |   52 +
 .../javax/xml/parsers/Bug6506304Test.java     |   62 +
 .../javax/xml/parsers/Bug6518733.java         |   63 +
 .../unittest/javax/xml/parsers/Bug6518733.xml |   32 +
 .../javax/xml/parsers/Bug6564400.java         |  176 +
 .../unittest/javax/xml/parsers/Bug6564400.xml |    4 +
 .../unittest/javax/xml/parsers/Bug6564400.xsd |    9 +
 .../javax/xml/parsers/Bug6573786.java         |   69 +
 .../xml/parsers/Bug6573786ErrorHandler.java   |   47 +
 .../javax/xml/parsers/Bug6594813.java         |  171 +
 .../unittest/javax/xml/parsers/Bug6608841.dtd |    3 +
 .../javax/xml/parsers/Bug6608841.java         |   55 +
 .../unittest/javax/xml/parsers/Bug6608841.xml |   10 +
 .../xml/parsers/Bug6608841_xhtml11-flat.dtd   |    1 +
 .../javax/xml/parsers/Bug6690015.java         |   83 +
 .../javax/xml/parsers/Bug6760982.java         |  164 +
 .../javax/xml/parsers/Bug6849942Test.java     |   74 +
 .../unittest/javax/xml/parsers/Bug7157608.dtd |    1 +
 .../unittest/javax/xml/parsers/Bug7157608.xml |   13 +
 .../javax/xml/parsers/Bug7157608Test.java     |  209 +
 .../javax/xml/parsers/Bug7157608_1.xml        |   14 +
 .../javax/xml/parsers/Bug7166896Test.java     |   72 +
 .../javax/xml/parsers/Bug8003147Test.java     |   79 +
 .../unittest/javax/xml/parsers/DosTest.xml    | 2031 ++++++++++
 .../unittest/javax/xml/parsers/DosTest3.xml   |   42 +
 .../javax/xml/parsers/FactoryFindTest.java    |   73 +
 .../javax/xml/parsers/MyDefaultHandler.java   |   47 +
 .../javax/xml/parsers/MyErrorHandler.java     |   55 +
 .../javax/xml/parsers/ParseEmptyStream.java   |   85 +
 .../unittest/javax/xml/parsers/bug6690015.xml |    6 +
 .../unittest/javax/xml/parsers/bug6760982.xml |   13 +
 .../unittest/javax/xml/parsers/catalog.xml    |    2 +
 .../unittest/javax/xml/parsers/catalog.xsd    |  122 +
 .../unittest/javax/xml/parsers/entity.xml     |    8 +
 .../unittest/javax/xml/parsers/entity64K.xml  |    4 +
 .../jaxp/unittest/javax/xml/parsers/test.xsd  |   44 +
 .../jaxp/unittest/javax/xml/parsers/test1.xml |   10 +
 .../jaxp/unittest/javax/xml/parsers/test2.xml |    4 +
 .../jaxp/unittest/javax/xml/parsers/toys.xml  |   39 +
 .../jaxp/unittest/javax/xml/parsers/toys.xsd  |   17 +
 .../unittest/javax/xml/parsers/toys3002.xsd   |   17 +
 .../xml/parsers/xinclude/Bug6794483Test.java  |  114 +
 .../javax/xml/parsers/xinclude/test1.xml      |    9 +
 .../javax/xml/parsers/xinclude/test2.xml      |   12 +
 .../AttributeLocalNameTest.java               |   62 +
 .../unittest/javax/xml/stream/Bug6370703.java |   65 +
 .../unittest/javax/xml/stream/Bug6378422.java |   47 +
 .../unittest/javax/xml/stream/Bug6380870.java |   54 +
 .../unittest/javax/xml/stream/Bug6489502.java |   79 +
 .../unittest/javax/xml/stream/Bug6509774.java |  170 +
 .../javax/xml/stream/Bug6688002Test.java      |  104 +
 .../unittest/javax/xml/stream/Bug6976938.xml  | 1810 +++++++++
 .../javax/xml/stream/Bug6976938Test.java      |   92 +
 .../xml/stream/CoalesceTest/CoalesceTest.java |  106 +
 .../xml/stream/CoalesceTest/coalesce.xml      |   15 +
 .../xml/stream/EntitiesTest/EntityTest.java   |  175 +
 .../xml/stream/EntitiesTest/testCharRef.xml   |    9 +
 .../EntitiesTest/testCharRef.xml.output       |    5 +
 .../xml/stream/EventReaderDelegateTest.java   |  221 +
 .../javax/xml/stream/Events/Issue41Test.java  |  174 +
 .../javax/xml/stream/Events/Issue48Test.java  |  111 +
 .../javax/xml/stream/Events/Issue53Test.java  |   67 +
 .../javax/xml/stream/Events/Issue58Test.java  |   80 +
 .../javax/xml/stream/FactoryFindTest.java     |  141 +
 .../javax/xml/stream/FactoryFindTest.policy   |   23 +
 .../xml/stream/IgnoreExternalDTDTest.java     |   68 +
 .../ProcessingInstructionTest.java            |   63 +
 .../xml/stream/StreamReaderDelegateTest.java  |  374 ++
 .../xml/stream/XMLEventLocationTest.java      |   76 +
 .../stream/XMLEventReaderTest/Bug6489890.java |   73 +
 .../stream/XMLEventReaderTest/Bug6555001.java |  104 +
 .../XMLEventReaderTest/Bug6586466Test.java    |   62 +
 .../XMLEventReaderTest/Bug6613059Test.java    |   85 +
 .../XMLEventReaderTest/Bug6668115Test.java    |   97 +
 .../XMLEventReaderTest/Bug6846133Test.java    |   79 +
 .../XMLEventReaderTest/Issue40Test.java       |   96 +
 .../stream/XMLEventReaderTest/bug6613059.xml  |   20 +
 .../xml/stream/XMLEventReaderTest/play.xml    |    4 +
 .../xml/stream/XMLEventReaderTest/play2.xml   |    9 +
 .../xml/stream/XMLEventReaderTest/sgml.xml    |  100 +
 .../ReaderToWriterTest.java                   |  210 +
 .../ReaderToWriterTest.wsdl                   |  523 +++
 .../XMLEventWriterTest/ReaderToWriterTest.xml |    2 +
 .../W2JDLR4002TestService.wsdl.data           |   60 +
 .../XMLEventWriterTest.java                   |  152 +
 .../XMLEventWriterTest/XMLEventWriterTest.xml |   29 +
 .../xml/stream/XMLEventWriterTest/merge-1.xml |   32 +
 .../xml/stream/XMLEventWriterTest/merge-2.xml |   26 +
 .../stream/XMLEventWriterTest/replace1.txt    |    2 +
 .../XMLInputFactoryTest/Bug6756677Test.java   |  151 +
 .../XMLInputFactoryTest/Bug6909759Test.java   |   62 +
 .../XMLInputFactoryTest/IssueTracker38.java   |   88 +
 .../XMLInputFactoryTest/MyInputFactory.java   |  160 +
 .../xml/stream/XMLInputFactoryTest/play.xml   |    6 +
 .../XMLOutputFactoryTest/Bug6846132Test.java  |   85 +
 .../DuplicateNSDeclarationTest.java           |   79 +
 .../StreamResultTest.java                     |  156 +
 .../XMLResolverTest/XMLResolverTest.java      |   92 +
 .../XMLResolverTest/XMLResolverTest.xml       |   13 +
 .../xml/stream/XMLResolverTest/replace1.txt   |    2 +
 .../xml/stream/XMLResolverTest/replace2.txt   |    2 +
 .../XMLStreamExceptionTest/ExceptionTest.java |   49 +
 .../XMLStreamFilterTest/Bug6481615.java       |   64 +
 .../XMLStreamFilterTest/Bug6481678.java       |  221 +
 .../XMLStreamFilterTest/HasNextTest.java      |  141 +
 .../XMLStreamFilterTest/HasNextTest.xml       |    9 +
 .../HasNextTypeFilter.java                    |   49 +
 .../stream/XMLStreamReaderTest/BOMTest.java   |   63 +
 .../XMLStreamReaderTest/Bug6388460.java       |   72 +
 .../XMLStreamReaderTest/Bug6472982Test.java   |   75 +
 .../stream/XMLStreamReaderTest/Bug6767322.xml |    4 +
 .../XMLStreamReaderTest/Bug6767322Test.java   |   72 +
 .../XMLStreamReaderTest/Bug6847819Test.java   |   65 +
 .../stream/XMLStreamReaderTest/BugTest.java   |   47 +
 .../DefaultAttributeTest.java                 |  104 +
 .../XMLStreamReaderTest/DoubleXmlnsTest.java  |  114 +
 .../XMLStreamReaderTest/ExternalDTD.dtd       |   13 +
 .../XMLStreamReaderTest/ExternalDTD.dtd.bak   |   13 +
 .../XMLStreamReaderTest/ExternalDTD.xml       |   19 +
 .../XMLStreamReaderTest/ExternalDTD.xml.bak   |   19 +
 .../XMLStreamReaderTest/Hello.wsdl.data       |   42 +
 .../XMLStreamReaderTest/IsValidatingTest.java |  161 +
 .../XMLStreamReaderTest/IsValidatingTest.xml  |   30 +
 .../IsValidatingTestInternalSubset.xml        |   32 +
 .../XMLStreamReaderTest/Issue44Test.java      |   55 +
 .../XMLStreamReaderTest/Issue47Test.java      |   85 +
 .../XMLStreamReaderTest/IssueTracker24.java   |   57 +
 .../XMLStreamReaderTest/IssueTracker35.java   |   55 +
 .../XMLStreamReaderTest/IssueTracker70.java   |   72 +
 .../XMLStreamReaderTest/IssueTracker70.xml    |    3 +
 .../XMLStreamReaderTest/Jsr173MR1Req5.xml     |    2 +
 .../Jsr173MR1Req5Test.java                    |   87 +
 .../XMLStreamReaderTest/Jsr173MR1Req8.xml     |    2 +
 .../Jsr173MR1Req8Test.java                    |   65 +
 .../XMLStreamReaderTest/NamespaceTest.java    |  149 +
 .../XMLStreamReaderTest/StreamReaderTest.java |   58 +
 .../XMLStreamReaderTest/SupportDTDTest.java   |  284 ++
 .../XMLStreamReaderTest/UTF16-BE.wsdl.data    |   60 +
 .../XMLStreamReaderTest/UTF8-BOM.xml.data     |    1 +
 .../XMLStreamReaderTest/VoiceXMLDTDTest.java  |   54 +
 .../stream/XMLStreamReaderTest/XML11Test.java |   50 +
 .../stream/XMLStreamReaderTest/XMLSchema.dtd  |  402 ++
 .../stream/XMLStreamReaderTest/XMLSchema.xsd  | 2534 ++++++++++++
 .../stream/XMLStreamReaderTest/datatypes.dtd  |  203 +
 .../xml/stream/XMLStreamReaderTest/report.dtd |   31 +
 .../xml/stream/XMLStreamReaderTest/sgml.xml   |  101 +
 .../stream/XMLStreamReaderTest/voicexml.xml   |    3 +
 .../xml/stream/XMLStreamReaderTest/vxml.dtd   |  474 +++
 .../stream/XMLStreamReaderTest/xml11.xml.data |   23 +
 .../AttributeEscapeTest.java                  |   99 +
 .../XMLStreamWriterTest/Bug6452107.java       |   60 +
 .../XMLStreamWriterTest/Bug6600882Test.java   |   55 +
 .../XMLStreamWriterTest/Bug6675332Test.java   |  160 +
 .../XMLStreamWriterTest/Bug7037352Test.java   |   61 +
 .../stream/XMLStreamWriterTest/DOMUtil.java   |  223 ++
 .../XMLStreamWriterTest/DomUtilTest.java      |  121 +
 .../XMLStreamWriterTest/EmptyElementTest.java |   81 +
 .../XMLStreamWriterTest/EncodingTest.java     |  106 +
 .../XMLStreamWriterTest/NamespaceTest.java    | 1439 +++++++
 .../NullUriDetectionTest.java                 |   50 +
 .../XMLStreamWriterTest/SqeLinuxTest.java     |   84 +
 .../UnprefixedNameTest.java                   |  121 +
 .../XMLStreamWriterTest/WriterTest.java       |  780 ++++
 .../XMLStreamWriterTest.java                  |   79 +
 .../stream/XMLStreamWriterTest/message_12.xml |  287 ++
 .../XMLStreamWriterTest/testEight.xml.org     |    2 +
 .../XMLStreamWriterTest/testFive.xml.org      |    2 +
 .../XMLStreamWriterTest/testFour.xml.org      |    2 +
 .../XMLStreamWriterTest/testOne.xml.org       |    2 +
 .../XMLStreamWriterTest/testSeven.xml.org     |    2 +
 .../XMLStreamWriterTest/testSix.xml.org       |    2 +
 .../XMLStreamWriterTest/testThree.xml.org     |    2 +
 .../unittest/javax/xml/stream/basic-form.vxml |   25 +
 .../jaxp/unittest/javax/xml/stream/report.dtd |   31 +
 .../javax/xml/stream/sgml-bad-systemId.xml    |  103 +
 .../jaxp/unittest/javax/xml/stream/sgml.xml   |  101 +
 .../javax/xml/stream/sgml_Bug6509774.xml      |  103 +
 .../unittest/javax/xml/stream/testfile1.xml   |    8 +
 .../unittest/javax/xml/stream/testfile2.xml   |    7 +
 .../unittest/javax/xml/stream/testfile3.xml   |    8 +
 .../unittest/javax/xml/stream/testfile4.xml   |    4 +
 .../jaxp/unittest/javax/xml/stream/toys.xml   |   38 +
 .../jaxp/unittest/javax/xml/stream/vxml.dtd   |  479 +++
 .../unittest/javax/xml/transform/5368141.xml  |  329 ++
 .../javax/xml/transform/Bug4693341.dtd        |   39 +
 .../javax/xml/transform/Bug4693341.out        |   19 +
 .../javax/xml/transform/Bug4693341.xml        |   20 +
 .../javax/xml/transform/Bug4693341Test.java   |   80 +
 .../javax/xml/transform/Bug4693341_golden.dtd |   39 +
 .../javax/xml/transform/Bug4693341_golden.xml |   20 +
 .../javax/xml/transform/Bug4892774.java       |  372 ++
 .../javax/xml/transform/Bug5073477.java       |   51 +
 .../javax/xml/transform/Bug5073477.xml        |    6 +
 .../javax/xml/transform/Bug6175602.java       |   50 +
 .../javax/xml/transform/Bug6206491.java       |  130 +
 .../javax/xml/transform/Bug6206491.xml        |   36 +
 .../javax/xml/transform/Bug6206491.xsl        |   19 +
 .../javax/xml/transform/Bug6206491_2.xml      |   30 +
 .../javax/xml/transform/Bug6216226Test.java   |   60 +
 .../javax/xml/transform/Bug6311448.java       |   81 +
 .../javax/xml/transform/Bug6384805.java       |   90 +
 .../javax/xml/transform/Bug6465722.java       |   68 +
 .../javax/xml/transform/Bug6467808.java       |   72 +
 .../javax/xml/transform/Bug6490380.java       |   57 +
 .../javax/xml/transform/Bug6490921.java       |  139 +
 .../javax/xml/transform/Bug6505031.java       |   94 +
 .../javax/xml/transform/Bug6513892.java       |   73 +
 .../javax/xml/transform/Bug6537167.java       |   81 +
 .../javax/xml/transform/Bug6540545.java       |   60 +
 .../javax/xml/transform/Bug6551616.java       |   65 +
 .../javax/xml/transform/Bug6559595.java       |   66 +
 .../javax/xml/transform/Bug6565260.java       |   60 +
 .../javax/xml/transform/Bug6940416.java       |  111 +
 .../javax/xml/transform/BugDB12665704.xml     |    3 +
 .../javax/xml/transform/BugDB12665704.xsl     |   26 +
 .../xml/transform/BugDB12665704Test.java      |  147 +
 .../unittest/javax/xml/transform/CLITest.java |   44 +
 .../javax/xml/transform/CR6401137.xml         |    5 +
 .../javax/xml/transform/CR6401137.xsl         |   14 +
 .../javax/xml/transform/CR6401137Test.java    |   86 +
 .../javax/xml/transform/CR6551600.policy      |   22 +
 .../javax/xml/transform/CR6551600Test.java    |   86 +
 .../javax/xml/transform/CR6577667.xsl         |   26 +
 .../javax/xml/transform/CR6577667Test.java    |   53 +
 .../javax/xml/transform/CR6652519Test.java    |   73 +
 .../javax/xml/transform/CR6689809Test.java    |   59 +
 .../javax/xml/transform/CR6905829.xml         |    7 +
 .../javax/xml/transform/CR6905829.xsl         |   22 +
 .../javax/xml/transform/CR6905829Inc.xsl      |   10 +
 .../javax/xml/transform/CR6905829Test.java    |   59 +
 .../javax/xml/transform/CR6935697.xml         |  158 +
 .../javax/xml/transform/CR6935697.xsl         | 1452 +++++++
 .../javax/xml/transform/CR6935697Test.java    |   68 +
 .../javax/xml/transform/CR6941869.xml         |   21 +
 .../javax/xml/transform/CR6941869.xsl         |   49 +
 .../javax/xml/transform/CR6941869Test.java    |   70 +
 .../javax/xml/transform/CR6957215.xml         |    5 +
 .../javax/xml/transform/CR6957215.xsl         |   19 +
 .../javax/xml/transform/CR6957215Test.java    |   87 +
 .../javax/xml/transform/CR7098746.xml         |   14 +
 .../javax/xml/transform/CR7098746.xsl         |  618 +++
 .../javax/xml/transform/CR7098746Test.java    |   81 +
 .../javax/xml/transform/DOMResultTest.java    |  206 +
 .../javax/xml/transform/FactoryFindTest.java  |   74 +
 .../javax/xml/transform/Issue2204.xml         |    2 +
 .../javax/xml/transform/Issue2204.xsl         |   10 +
 .../javax/xml/transform/Issue2204Test.java    |   63 +
 .../javax/xml/transform/Issue2290.xsl         |    9 +
 .../javax/xml/transform/Issue2290Test.java    |   92 +
 .../xml/transform/MsWordXMLImport.xsl.data    | 3156 +++++++++++++++
 .../NCAA_Conference_Schedule_XML.dtd          |   20 +
 .../xml/transform/OpenJDK100017Test.java      |   60 +
 .../xml/transform/PredicateInKeyTest.xml      |   29 +
 .../xml/transform/PredicateInKeyTest.xsl      |   49 +
 .../javax/xml/transform/SAX2DOMTest.java      |  194 +
 .../javax/xml/transform/SAX2DOMTest.xml       |  109 +
 .../xml/transform/SecureProcessingTest.java   |  147 +
 .../xml/transform/SecureProcessingTest.xml    |    2 +
 .../xml/transform/SecureProcessingTest.xsl    |   15 +
 .../javax/xml/transform/SourceTest.java       |  141 +
 .../javax/xml/transform/SourceTest.xml        |   21 +
 .../javax/xml/transform/SourceTest.xsl        |   52 +
 .../javax/xml/transform/StAXSourceTest.java   |  121 +
 .../xml/transform/TransformerFactoryTest.java |  142 +
 .../javax/xml/transform/TransformerTest.java  |  269 ++
 .../xml/transform/TransformerUtilFactory.java |   58 +
 .../xml/transform/VersionDefaultHandler.java  |   64 +
 .../xml/transform/VersionEventWriter.java     |   84 +
 .../javax/xml/transform/ViewEditor1.xsl       |   50 +
 .../javax/xml/transform/attribset27.xml       |    4 +
 .../javax/xml/transform/attribset27.xsl       |   32 +
 .../unittest/javax/xml/transform/catalog.xml  |    2 +
 .../unittest/javax/xml/transform/catalog.xsd  |  122 +
 .../javax/xml/transform/catalog_10.xml        |    2 +
 .../unittest/javax/xml/transform/config.dtd   |    2 +
 .../unittest/javax/xml/transform/config.xml   |    4 +
 .../javax/xml/transform/default-layout.xsl    |  280 ++
 .../javax/xml/transform/global-variables.xsl  |   34 +
 .../unittest/javax/xml/transform/global.xsl   |  272 ++
 .../unittest/javax/xml/transform/home.xsl     |  514 +++
 .../jaxp/unittest/javax/xml/transform/in.xml  |    3 +
 .../unittest/javax/xml/transform/inner.xsl    |    1 +
 .../unittest/javax/xml/transform/logon.xsl    |   70 +
 .../unittest/javax/xml/transform/maps.xml     |   10 +
 .../javax/xml/transform/msgAttach.xml         |    3 +
 .../javax/xml/transform/numbering63.xml       |   70 +
 .../javax/xml/transform/numbering63.xsl       |   24 +
 .../unittest/javax/xml/transform/outer.xsl    |    3 +
 .../unittest/javax/xml/transform/redirect.xml |    2 +
 .../unittest/javax/xml/transform/redirect.xsl |   18 +
 .../javax/xml/transform/sax/Bug6451633.java   |   58 +
 .../jaxp/unittest/javax/xml/transform/src.xml |   33 +
 .../unittest/javax/xml/transform/template.xml |    5 +
 .../javax/xml/transform/tigertest-in.xml      |    7 +
 .../javax/xml/transform/tigertest.xsl         |   21 +
 .../jaxp/unittest/javax/xml/transform/tmp.xml |    1 +
 .../unittest/javax/xml/transform/toys.xml     |   38 +
 .../javax/xml/transform/transform.xsl         |   28 +
 .../javax/xml/transform/upload-media-form.xsl |  126 +
 .../javax/xml/transform/upload-media.xsl      |   43 +
 .../unittest/javax/xml/transform/util.xsl     |  128 +
 .../javax/xml/transform/util/DOMUtil.java     |   70 +
 .../javax/xml/transform/util/SAXUtil.java     |   71 +
 .../javax/xml/transform/util/StAXUtil.java    |   93 +
 .../javax/xml/transform/util/StreamUtil.java  |   91 +
 .../xml/transform/util/TransformerUtil.java   |   53 +
 .../javax/xml/validation/6773084.policy       |   23 +
 .../javax/xml/validation/Bug4966232.java      |   71 +
 .../javax/xml/validation/Bug4966254.java      |   74 +
 .../javax/xml/validation/Bug4966254.xml       |    2 +
 .../javax/xml/validation/Bug4966254.xsd       |   23 +
 .../javax/xml/validation/Bug4969042.java      |  107 +
 .../javax/xml/validation/Bug4969089.java      |   72 +
 .../javax/xml/validation/Bug4969110.java      |   75 +
 .../javax/xml/validation/Bug4969689.java      |   62 +
 .../javax/xml/validation/Bug4969692.java      |   63 +
 .../javax/xml/validation/Bug4969693.java      |   63 +
 .../javax/xml/validation/Bug4969695.java      |   61 +
 .../javax/xml/validation/Bug4969732.java      |  108 +
 .../javax/xml/validation/Bug4970380.java      |   58 +
 .../javax/xml/validation/Bug4970383.java      |   49 +
 .../javax/xml/validation/Bug4970400.java      |   44 +
 .../javax/xml/validation/Bug4970402.java      |  119 +
 .../javax/xml/validation/Bug4970951.java      |  122 +
 .../javax/xml/validation/Bug4971605.java      |   62 +
 .../javax/xml/validation/Bug4971607.java      |   52 +
 .../javax/xml/validation/Bug4972882.java      |   63 +
 .../javax/xml/validation/Bug4986844.java      |   52 +
 .../javax/xml/validation/Bug4986844.xsd       |   28 +
 .../javax/xml/validation/Bug4987574.java      |   53 +
 .../javax/xml/validation/Bug4988267.java      |   52 +
 .../javax/xml/validation/Bug4988267.xsd       |   15 +
 .../javax/xml/validation/Bug4988268.java      |   42 +
 .../javax/xml/validation/Bug4988268.xsd       |   17 +
 .../javax/xml/validation/Bug4988387.java      |   49 +
 .../javax/xml/validation/Bug4988387.xsd       |   15 +
 .../javax/xml/validation/Bug4996446.java      |   86 +
 .../javax/xml/validation/Bug4996446.xsd       |   19 +
 .../javax/xml/validation/Bug4997818.java      |   77 +
 .../javax/xml/validation/Bug5011500.java      |  104 +
 .../javax/xml/validation/Bug5072946.java      |  121 +
 .../javax/xml/validation/Bug5072946.xml       |    2 +
 .../javax/xml/validation/Bug5072946.xsd       |    8 +
 .../javax/xml/validation/Bug6378043.java      |   49 +
 .../javax/xml/validation/Bug6449797.java      |   42 +
 .../javax/xml/validation/Bug6449797.xsd       |   22 +
 .../javax/xml/validation/Bug6457662.java      |   84 +
 .../javax/xml/validation/Bug6467424.xml       |   19 +
 .../javax/xml/validation/Bug6467424.xsd       |   30 +
 .../javax/xml/validation/Bug6467424Test.java  |  198 +
 .../javax/xml/validation/Bug6483188.java      |   96 +
 .../javax/xml/validation/Bug6493687.java      |   44 +
 .../javax/xml/validation/Bug6493687.xml       |   15 +
 .../javax/xml/validation/Bug6493687.xsd       |   41 +
 .../javax/xml/validation/Bug6509668.java      |  137 +
 .../javax/xml/validation/Bug6526547.java      |   78 +
 .../javax/xml/validation/Bug6526547.xml       |    2 +
 .../javax/xml/validation/Bug6526547.xsd       |    8 +
 .../javax/xml/validation/Bug6531160.java      |   66 +
 .../javax/xml/validation/Bug6695843.xml       |    6 +
 .../javax/xml/validation/Bug6695843.xsd       |   44 +
 .../javax/xml/validation/Bug6695843Test.java  |   75 +
 .../javax/xml/validation/Bug6773084.xsd       |  178 +
 .../validation/Bug6773084In/Bug6773084_1.xml  |   78 +
 .../validation/Bug6773084In/Bug6773084_10.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_11.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_12.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_13.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_14.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_15.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_16.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_17.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_18.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_19.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_2.xml  |   78 +
 .../validation/Bug6773084In/Bug6773084_20.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_21.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_22.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_23.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_24.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_25.xml |   78 +
 .../validation/Bug6773084In/Bug6773084_3.xml  |   78 +
 .../validation/Bug6773084In/Bug6773084_4.xml  |   78 +
 .../validation/Bug6773084In/Bug6773084_5.xml  |   78 +
 .../validation/Bug6773084In/Bug6773084_6.xml  |   78 +
 .../validation/Bug6773084In/Bug6773084_7.xml  |   78 +
 .../validation/Bug6773084In/Bug6773084_8.xml  |   78 +
 .../validation/Bug6773084In/Bug6773084_9.xml  |   78 +
 .../javax/xml/validation/Bug6773084Test.java  |  163 +
 .../javax/xml/validation/Bug6859210.java      |   96 +
 .../javax/xml/validation/Bug6925531Test.java  |  203 +
 .../javax/xml/validation/Bug6946312.xml       |    4 +
 .../javax/xml/validation/Bug6946312Test.java  |  122 +
 .../javax/xml/validation/Bug6954738.xml       |    4 +
 .../javax/xml/validation/Bug6954738.xsd       |   17 +
 .../javax/xml/validation/Bug6954738_Test.java |   76 +
 .../javax/xml/validation/CR6708840Test.java   |  133 +
 .../javax/xml/validation/CR6740048.java       |  130 +
 .../javax/xml/validation/CR6740048.xml        |    3 +
 .../javax/xml/validation/CR6740048.xsd        |    2 +
 .../javax/xml/validation/CREMAS01.xml         | 1138 ++++++
 .../javax/xml/validation/CREMAS01.xsd         | 3541 +++++++++++++++++
 .../xml/validation/ErrorHandlerImpl.java      |   47 +
 .../javax/xml/validation/Issue682.xml         |   15 +
 .../javax/xml/validation/Issue682.xsd         |   34 +
 .../javax/xml/validation/Issue682Test.java    |   74 +
 .../javax/xml/validation/IssueTracker30.java  |  128 +
 .../IssueTracker30_occurs-error.xml           |   18 +
 .../validation/IssueTracker30_occurs-ok.xml   |   17 +
 .../IssueTracker30_occurs-optimize-error.xml  |   10 +
 .../IssueTracker30_occurs-optimize-ok.xml     |    9 +
 .../IssueTracker30_occurs-optimize.xsd        |   21 +
 .../xml/validation/IssueTracker30_occurs.xsd  |   22 +
 .../javax/xml/validation/JaxpIssue43Test.java |   77 +
 .../javax/xml/validation/JaxpIssue49.java     |   87 +
 .../javax/xml/validation/JaxpIssue49.xml      |   10 +
 .../xml/validation/LargeMaxOccursTest.java    |  102 +
 .../javax/xml/validation/MultiOccursTest.java |  143 +
 .../validation/MultiOccursUnboundedTest.java  |  111 +
 .../javax/xml/validation/OccursTest.java      |  143 +
 .../xml/validation/OccursUnboundedTest.java   |  111 +
 .../xml/validation/OccursWildcardTest.java    |  143 +
 .../validation/OccursWildcardUnbounded.java   |  111 +
 .../xml/validation/ParticlesId005Test.java    |   95 +
 .../xml/validation/ParticlesIg004Test.java    |   50 +
 .../xml/validation/ParticlesQ013Test.java     |   94 +
 .../xml/validation/TCKGroupA008Test.java      |   52 +
 .../javax/xml/validation/ValidatorTest.java   |  195 +
 .../javax/xml/validation/XMLDocBuilder.java   |  143 +
 .../xml/validation/XMLSchemaValidator.java    |   61 +
 .../javax/xml/validation/gMonths-invalid.xml  |   32 +
 .../unittest/javax/xml/validation/gMonths.xml |   31 +
 .../unittest/javax/xml/validation/gMonths.xsd |   37 +
 .../javax/xml/validation/groupA008.xsd        |   10 +
 .../javax/xml/validation/groupA008ea.red      |    7 +
 .../javax/xml/validation/groupA008eb.red      |    7 +
 .../javax/xml/validation/hello_literal.wsdl   |  294 ++
 .../unittest/javax/xml/validation/idI009.xsd  |   27 +
 .../unittest/javax/xml/validation/idIimp.xsd  |   20 +
 .../unittest/javax/xml/validation/idIxpns.xsd |   12 +
 .../javax/xml/validation/idIxpns1.xsd         |   12 +
 .../unittest/javax/xml/validation/mgG014.xsd  |    9 +
 .../unittest/javax/xml/validation/mgJ014.xsd  |    9 +
 .../xml/validation/multi-occurs-error-max.xml |   34 +
 .../validation/multi-occurs-error-min-max.xml |   25 +
 .../xml/validation/multi-occurs-error-min.xml |   13 +
 .../javax/xml/validation/multi-occurs-ok.xml  |   38 +
 .../multi-occurs-unbounded-error-min.xml      |   20 +
 .../validation/multi-occurs-unbounded-ok.xml  |   24 +
 .../xml/validation/multi-occurs-unbounded.xsd |   21 +
 .../javax/xml/validation/multi-occurs.xsd     |   21 +
 .../javax/xml/validation/occurs-error-max.xml |   13 +
 .../xml/validation/occurs-error-min-max.xml   |   17 +
 .../javax/xml/validation/occurs-error-min.xml |    7 +
 .../javax/xml/validation/occurs-ok.xml        |   33 +
 .../validation/occurs-unbounded-error-min.xml |    9 +
 .../xml/validation/occurs-unbounded-ok.xml    |   37 +
 .../javax/xml/validation/occurs-unbounded.xsd |   20 +
 .../validation/occurs-wildcard-unbounded.xsd  |   20 +
 .../javax/xml/validation/occurs-wildcard.xsd  |   20 +
 .../unittest/javax/xml/validation/occurs.xsd  |   20 +
 .../javax/xml/validation/particlesId005.xml   |    6 +
 .../javax/xml/validation/particlesId005.xsd   |   20 +
 .../javax/xml/validation/particlesIe003.xsd   |   20 +
 .../javax/xml/validation/particlesIg004.xsd   |   22 +
 .../xml/validation/particlesOptimize.xsd      |   15 +
 .../javax/xml/validation/particlesQ013.xml    |   14 +
 .../javax/xml/validation/particlesQ013.xsd    |   29 +
 .../javax/xml/validation/particlesR005.xsd    |   28 +
 .../javax/xml/validation/targetNS00101m2.xsd  |   25 +
 .../xml/validation/targetNS00101m2_stub.xml   |    5 +
 .../xml/validation/targetNS00101m2_stub.xsd   |    7 +
 .../javax/xml/validation/targetNS00101m2a.xsd |   23 +
 .../Bug6943252In/byte_fractionDigits004.xsd   |   16 +
 .../Bug6943252In/byte_fractionDigits007.xsd   |   17 +
 .../Bug6943252In/int_fractionDigits004.xsd    |   16 +
 .../Bug6943252In/int_fractionDigits007.xsd    |   17 +
 .../integer_fractionDigits004.xsd             |   16 +
 .../integer_fractionDigits007.xsd             |   17 +
 .../Bug6943252In/long_fractionDigits004.xsd   |   16 +
 .../Bug6943252In/long_fractionDigits007.xsd   |   17 +
 .../negativeInteger_fractionDigits004.xsd     |   16 +
 .../negativeInteger_fractionDigits007.xsd     |   17 +
 .../nonNegativeInteger_fractionDigits004.xsd  |   16 +
 .../nonNegativeInteger_fractionDigits007.xsd  |   17 +
 .../nonPositiveInteger_fractionDigits004.xsd  |   16 +
 .../nonPositiveInteger_fractionDigits007.xsd  |   17 +
 .../positiveInteger_fractionDigits004.xsd     |   16 +
 .../positiveInteger_fractionDigits007.xsd     |   17 +
 .../Bug6943252In/short_fractionDigits004.xsd  |   16 +
 .../Bug6943252In/short_fractionDigits007.xsd  |   17 +
 .../unsignedByte_fractionDigits004.xsd        |   16 +
 .../unsignedByte_fractionDigits007.xsd        |   17 +
 .../unsignedInt_fractionDigits004.xsd         |   16 +
 .../unsignedInt_fractionDigits007.xsd         |   17 +
 .../unsignedLong_fractionDigits004.xsd        |   16 +
 .../unsignedLong_fractionDigits007.xsd        |   17 +
 .../unsignedShort_fractionDigits004.xsd       |   16 +
 .../unsignedShort_fractionDigits007.xsd       |   17 +
 .../xml/validation/tck/Bug6943252Test.java    |   65 +
 .../javax/xml/validation/tck/Bug6963124.xsd   |   16 +
 .../xml/validation/tck/Bug6963124Test.java    |   57 +
 .../javax/xml/validation/tck/Bug6963468.xml   |   14 +
 .../javax/xml/validation/tck/Bug6963468.xsd   |   51 +
 .../xml/validation/tck/Bug6963468Test.java    |  144 +
 .../javax/xml/validation/tck/Bug6964720.xsd   |   53 +
 .../xml/validation/tck/Bug6964720Test.java    |   54 +
 .../tck/Bug6967214/RegexTest_1258.xsd         |   15 +
 .../xml/validation/tck/Bug6967214/reD10.xsd   |   25 +
 .../xml/validation/tck/Bug6967214/reD11.xsd   |   29 +
 .../xml/validation/tck/Bug6967214/reD12.xsd   |   25 +
 .../xml/validation/tck/Bug6967214/reE9.xsd    |   29 +
 .../xml/validation/tck/Bug6967214Test.java    |   66 +
 .../javax/xml/validation/tck/Bug6970890.xsd   |   11 +
 .../xml/validation/tck/Bug6970890Test.java    |   68 +
 .../javax/xml/validation/tck/Bug6970890_1.xsd |   24 +
 .../javax/xml/validation/tck/Bug6971190.xml   |  210 +
 .../javax/xml/validation/tck/Bug6971190.xsd   |   25 +
 .../xml/validation/tck/Bug6971190Test.java    |   98 +
 .../javax/xml/validation/tck/Bug6971190_v.xml |   44 +
 .../javax/xml/validation/tck/Bug6971190_v.xsd |   30 +
 .../javax/xml/validation/tck/Bug6974551.xml   |   10 +
 .../javax/xml/validation/tck/Bug6974551.xsd   |   11 +
 .../xml/validation/tck/Bug6974551Test.java    |  118 +
 .../validation/tck/Bug6975265/notatF025.xsd   |   10 +
 .../validation/tck/Bug6975265/notatF037.xsd   |   10 +
 .../validation/tck/Bug6975265/notatF041.xsd   |   10 +
 .../validation/tck/Bug6975265/notatF045.xsd   |   10 +
 .../validation/tck/Bug6975265/notatF049.xsd   |   10 +
 .../xml/validation/tck/Bug6975265Test.java    |   67 +
 .../xml/validation/tck/Bug6977201/reA2.xml    |   11 +
 .../xml/validation/tck/Bug6977201/reA2.xsd    |   25 +
 .../xml/validation/tck/Bug6977201/reA3.xml    |   11 +
 .../xml/validation/tck/Bug6977201/reA3.xsd    |   29 +
 .../xml/validation/tck/Bug6977201/reA4.xml    |   11 +
 .../xml/validation/tck/Bug6977201/reA4.xsd    |   25 +
 .../xml/validation/tck/Bug6977201/reA5.xml    |   11 +
 .../xml/validation/tck/Bug6977201/reA5.xsd    |   29 +
 .../xml/validation/tck/Bug6977201/reA6.xml    |   11 +
 .../xml/validation/tck/Bug6977201/reA6.xsd    |   25 +
 .../xml/validation/tck/Bug6977201Test.java    |   67 +
 .../javax/xml/validation/tck/Bug6989956.xml   |    5 +
 .../javax/xml/validation/tck/Bug6989956.xsd   |   36 +
 .../xml/validation/tck/Bug6989956Test.java    |  144 +
 .../javax/xml/validation/tck/Bug7014246.xsd   |   13 +
 .../xml/validation/tck/Bug7014246Test.java    |   55 +
 .../javax/xml/validation/test-element.xsd     |   29 +
 .../javax/xml/validation/test-sequence.xsd    |   29 +
 .../unittest/javax/xml/validation/test.xsd    |    6 +
 .../unittest/javax/xml/validation/toys.xml    |   38 +
 .../unittest/javax/xml/validation/toys.xsd    |   17 +
 .../unittest/javax/xml/validation/types.xsd   |   34 +
 .../unittest/javax/xml/xpath/Bug4991857.java  |   88 +
 .../unittest/javax/xml/xpath/Bug4991939.java  |   57 +
 .../unittest/javax/xml/xpath/Bug4992788.java  |   78 +
 .../unittest/javax/xml/xpath/Bug4992793.java  |   79 +
 .../unittest/javax/xml/xpath/Bug4992805.java  |   66 +
 .../javax/xml/xpath/ClassLoaderTest.java      |   48 +
 .../javax/xml/xpath/MyClassLoader.java        |   49 +
 .../javax/xml/xpath/SecureProcessingTest.java |  194 +
 .../javax/xml/xpath/SecureProcessingTest.xml  |    2 +
 .../unittest/javax/xml/xpath/XPathTest.java   |   45 +
 .../jaxp/unittest/org/w3c/dom/Bug4915524.java |   77 +
 .../jaxp/unittest/org/w3c/dom/Bug4915748.java |   70 +
 .../jaxp/unittest/org/w3c/dom/Bug4966082.java |   49 +
 .../jaxp/unittest/org/w3c/dom/Bug4966082.xml  |    5 +
 .../jaxp/unittest/org/w3c/dom/Bug4966138.java |   65 +
 .../jaxp/unittest/org/w3c/dom/Bug4966142.java |   57 +
 .../jaxp/unittest/org/w3c/dom/Bug4966142.xml  |    2 +
 .../jaxp/unittest/org/w3c/dom/Bug4966142.xsd  |   19 +
 .../jaxp/unittest/org/w3c/dom/Bug4966143.java |   62 +
 .../jaxp/unittest/org/w3c/dom/Bug4966143.xml  |    2 +
 .../jaxp/unittest/org/w3c/dom/Bug4966143.xsd  |   23 +
 .../jaxp/unittest/org/w3c/dom/Bug6339023.java |  135 +
 .../jaxp/unittest/org/w3c/dom/Bug6355326.java |  114 +
 .../jaxp/unittest/org/w3c/dom/Bug6367542.java |   48 +
 .../jaxp/unittest/org/w3c/dom/Bug6520131.java |   79 +
 .../jaxp/unittest/org/w3c/dom/Bug6521260.java |   73 +
 .../jaxp/unittest/org/w3c/dom/Bug6582545.xml  |   20 +
 .../unittest/org/w3c/dom/Bug6582545Test.java  |  112 +
 .../jaxp/unittest/org/w3c/dom/Bug6879614.xml  |  722 ++++
 .../unittest/org/w3c/dom/Bug6879614Test.java  |   73 +
 .../unittest/org/w3c/dom/CR6333993Test.java   |   82 +
 .../unittest/org/w3c/dom/CR6517707Test.java   |  121 +
 .../unittest/org/w3c/dom/CR6517717Test.java   |   79 +
 .../unittest/org/w3c/dom/CR6909336Test.java   |   67 +
 .../org/w3c/dom/DOMConfigurationTest.java     | 1609 ++++++++
 .../org/w3c/dom/DOMConfigurationTest.xsd      |    6 +
 .../unittest/org/w3c/dom/TCKEncodingTest.java |   97 +
 .../unittest/org/w3c/dom/ls/Bug4973153.java   |  200 +
 .../unittest/org/w3c/dom/ls/Bug6290947.java   |  143 +
 .../unittest/org/w3c/dom/ls/Bug6354955.java   |  138 +
 .../unittest/org/w3c/dom/ls/Bug6376823.java   |  117 +
 .../org/w3c/dom/ls/Bug6710741Test.java        |   74 +
 .../org/w3c/dom/ls/LSParserTCKTest.java       |  576 +++
 .../unittest/org/w3c/dom/ls/LSParserTest.java |  101 +
 .../org/w3c/dom/ls/LSSerializerTest.java      |  293 ++
 .../unittest/org/w3c/dom/ls/note_in_dtd.xml   |   15 +
 .../xml/jaxp/unittest/org/w3c/dom/test.xml    |    2 +
 .../xml/jaxp/unittest/org/w3c/dom/test.xsd    |   10 +
 .../org/xml/sax/Attributes2ImplTest.java      |  149 +
 .../unittest/org/xml/sax/Bug6889654Test.java  |   83 +
 .../unittest/org/xml/sax/Bug6925410Test.java  |   56 +
 .../unittest/org/xml/sax/Bug6949607Test.java  |   77 +
 .../unittest/org/xml/sax/Bug6992561Test.java  |   82 +
 .../jaxp/unittest/org/xml/sax/Bug7057778.xml  |    3 +
 .../unittest/org/xml/sax/Bug7057778Test.java  |  189 +
 .../org/xml/sax/DefaultHandler2Test.java      |  247 ++
 .../org/xml/sax/IssueTracker56Test.java       |  138 +
 .../org/xml/sax/MyDefaultHandler2.java        |  200 +
 .../unittest/org/xml/sax/NSSupportTest.java   |  228 ++
 .../unittest/org/xml/sax/SAXExceptionExt.java |   40 +
 .../jaxp/unittest/org/xml/sax/externalDTD.dtd |    3 +
 .../xml/jaxp/unittest/org/xml/sax/toys.xml    |   31 +
 .../jaxp/unittest/org/xml/sax/toys_error.xml  |   31 +
 .../xml/jaxp/unittest/policy/PolicyUtil.java  |   35 +
 .../xml/jaxp/unittest/policy/common.policy    |   27 +
 .../jaxp/unittest/util/BOMInputStream.java    |   80 +
 .../xml/jaxp/unittest/util/BaseStAXUT.java    |  559 +++
 .../unittest/util/DraconianErrorHandler.java  |   37 +
 655 files changed, 64590 insertions(+)
 create mode 100644 jaxp/test/javax/xml/jaxp/TEST.properties
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6350682.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6723276Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6979306Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug7143711Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6320118.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6937951Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6937964Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug7042647Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/DatatypeFactoryTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/DurationTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/FactoryFindTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/XMLGregorianCalendarTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4934208.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4967002.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4985486.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4985486.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5010072.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5010072.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5025825.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6309988.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6341770.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6361283.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6506304Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6518733.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6518733.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6573786.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6573786ErrorHandler.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6594813.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841_xhtml11-flat.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6690015.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6760982.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6849942Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608_1.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7166896Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug8003147Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/DosTest.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/DosTest3.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/FactoryFindTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/MyDefaultHandler.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/MyErrorHandler.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/ParseEmptyStream.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/bug6690015.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/bug6760982.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/catalog.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/catalog.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/entity.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/entity64K.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/test.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/test1.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/test2.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/toys.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/toys.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/toys3002.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/xinclude/Bug6794483Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/xinclude/test1.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/xinclude/test2.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/AttributeLocalNameTest/AttributeLocalNameTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6370703.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6378422.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6380870.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6489502.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6509774.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6688002Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6976938.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6976938Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/CoalesceTest/CoalesceTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/CoalesceTest/coalesce.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EntitiesTest/EntityTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EntitiesTest/testCharRef.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EntitiesTest/testCharRef.xml.output
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EventReaderDelegateTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue41Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue48Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue53Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue58Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/FactoryFindTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/FactoryFindTest.policy
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/IgnoreExternalDTDTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/ProcessingInstruction/ProcessingInstructionTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/StreamReaderDelegateTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventLocationTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6489890.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6555001.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6586466Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6613059Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6668115Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6846133Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Issue40Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/bug6613059.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/play.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/play2.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/sgml.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.wsdl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/W2JDLR4002TestService.wsdl.data
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/XMLEventWriterTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/XMLEventWriterTest.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/merge-1.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/merge-2.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/replace1.txt
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/Bug6756677Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/Bug6909759Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/IssueTracker38.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/MyInputFactory.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/play.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/Bug6846132Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/StreamResultTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/XMLResolverTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/XMLResolverTest.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/replace1.txt
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/replace2.txt
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamExceptionTest/ExceptionTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/Bug6481615.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/Bug6481678.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTest.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTypeFilter.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/BOMTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6388460.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6472982Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6767322.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6767322Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6847819Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/BugTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/DefaultAttributeTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/DoubleXmlnsTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.dtd.bak
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.xml.bak
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Hello.wsdl.data
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTest.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTestInternalSubset.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Issue44Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Issue47Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker24.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker35.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker70.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker70.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req5.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req8.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/NamespaceTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/StreamReaderTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/SupportDTDTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/UTF16-BE.wsdl.data
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/UTF8-BOM.xml.data
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XML11Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XMLSchema.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XMLSchema.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/datatypes.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/report.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/sgml.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/voicexml.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/vxml.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/xml11.xml.data
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/AttributeEscapeTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6452107.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6600882Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6675332Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug7037352Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/DOMUtil.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/DomUtilTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/EmptyElementTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/EncodingTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NamespaceTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NullUriDetectionTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/SqeLinuxTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/UnprefixedNameTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/WriterTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/XMLStreamWriterTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/message_12.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testEight.xml.org
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testFive.xml.org
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testFour.xml.org
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testOne.xml.org
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testSeven.xml.org
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testSix.xml.org
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testThree.xml.org
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/basic-form.vxml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/report.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml-bad-systemId.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml_Bug6509774.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile1.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile2.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile3.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile4.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/toys.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/vxml.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/5368141.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.out
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341_golden.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341_golden.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4892774.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug5073477.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug5073477.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6175602.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491_2.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6216226Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6311448.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6384805.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6465722.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6467808.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6490380.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6490921.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6505031.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6513892.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6537167.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6540545.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6551616.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6559595.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6565260.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6940416.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CLITest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6551600.policy
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6551600Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6577667.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6577667Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6652519Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6689809Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829Inc.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6935697.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6935697.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6935697Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/DOMResultTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/FactoryFindTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2290.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2290Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/MsWordXMLImport.xsl.data
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/NCAA_Conference_Schedule_XML.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/OpenJDK100017Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/PredicateInKeyTest.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/PredicateInKeyTest.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SAX2DOMTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SAX2DOMTest.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/StAXSourceTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerFactoryTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerUtilFactory.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/VersionDefaultHandler.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/VersionEventWriter.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/ViewEditor1.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/attribset27.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/attribset27.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog_10.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/config.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/config.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/default-layout.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/global-variables.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/global.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/home.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/in.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/inner.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/logon.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/maps.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/msgAttach.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/numbering63.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/numbering63.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/outer.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/redirect.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/redirect.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/sax/Bug6451633.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/src.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/template.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tigertest-in.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tigertest.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tmp.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/toys.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/transform.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/upload-media-form.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/upload-media.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/DOMUtil.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/SAXUtil.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/StAXUtil.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/StreamUtil.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/TransformerUtil.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/6773084.policy
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966232.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969042.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969089.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969110.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969689.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969692.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969693.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969695.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969732.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970380.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970383.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970400.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970402.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970951.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4971605.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4971607.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4972882.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4986844.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4986844.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4987574.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988267.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988267.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988268.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988268.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988387.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988387.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4996446.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4996446.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4997818.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5011500.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6378043.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6449797.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6449797.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6457662.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6483188.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6509668.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6531160.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_1.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_10.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_11.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_12.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_13.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_14.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_15.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_16.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_17.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_18.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_19.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_2.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_20.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_21.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_22.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_23.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_24.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_25.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_3.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_4.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_5.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_6.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_7.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_8.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_9.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6859210.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6925531Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6946312.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6946312Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738_Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6708840Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CREMAS01.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CREMAS01.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ErrorHandlerImpl.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-error.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-ok.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize-error.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize-ok.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue43Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue49.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue49.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/LargeMaxOccursTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/MultiOccursTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/MultiOccursUnboundedTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursUnboundedTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursWildcardTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursWildcardUnbounded.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesId005Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesIg004Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesQ013Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/TCKGroupA008Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ValidatorTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/XMLDocBuilder.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/XMLSchemaValidator.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths-invalid.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008ea.red
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008eb.red
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/hello_literal.wsdl
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idI009.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIimp.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIxpns.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIxpns1.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/mgG014.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/mgJ014.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-max.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-min-max.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-min.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-ok.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded-error-min.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded-ok.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-max.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-min-max.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-min.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-ok.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded-error-min.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded-ok.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-wildcard-unbounded.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-wildcard.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesId005.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesId005.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesIe003.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesIg004.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesOptimize.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesQ013.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesQ013.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesR005.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2_stub.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2_stub.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2a.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/byte_fractionDigits004.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/byte_fractionDigits007.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/int_fractionDigits004.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/int_fractionDigits007.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/integer_fractionDigits004.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/integer_fractionDigits007.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/long_fractionDigits004.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/long_fractionDigits007.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/negativeInteger_fractionDigits004.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/negativeInteger_fractionDigits007.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonNegativeInteger_fractionDigits004.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonNegativeInteger_fractionDigits007.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonPositiveInteger_fractionDigits004.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonPositiveInteger_fractionDigits007.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/positiveInteger_fractionDigits004.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/positiveInteger_fractionDigits007.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/short_fractionDigits004.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/short_fractionDigits007.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedByte_fractionDigits004.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedByte_fractionDigits007.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedInt_fractionDigits004.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedInt_fractionDigits007.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedLong_fractionDigits004.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedLong_fractionDigits007.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedShort_fractionDigits004.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedShort_fractionDigits007.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963124.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963124Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6964720.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6964720Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/RegexTest_1258.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD10.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD11.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD12.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reE9.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890_1.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190_v.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190_v.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF025.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF037.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF041.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF045.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF049.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA2.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA2.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA3.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA3.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA4.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA4.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA5.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA5.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA6.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA6.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug7014246.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug7014246Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test-element.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test-sequence.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/toys.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/toys.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/types.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991857.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991939.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992788.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992793.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992805.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/ClassLoaderTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/MyClassLoader.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/SecureProcessingTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/SecureProcessingTest.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/XPathTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4915524.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4915748.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966082.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966082.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966138.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6339023.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6355326.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6367542.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6520131.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6521260.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6582545.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6582545Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6879614.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6879614Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6333993Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6517707Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6517717Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6909336Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/DOMConfigurationTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/DOMConfigurationTest.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/TCKEncodingTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug4973153.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6290947.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6354955.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6376823.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6710741Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSParserTCKTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSParserTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSSerializerTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/note_in_dtd.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/test.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/test.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Attributes2ImplTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6889654Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6925410Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6949607Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6992561Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug7057778.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug7057778Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/DefaultHandler2Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/IssueTracker56Test.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/MyDefaultHandler2.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/NSSupportTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/SAXExceptionExt.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/externalDTD.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/toys.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/toys_error.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/policy/PolicyUtil.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/policy/common.policy
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/util/BOMInputStream.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java
 create mode 100644 jaxp/test/javax/xml/jaxp/unittest/util/DraconianErrorHandler.java

diff --git a/jaxp/test/TEST.ROOT b/jaxp/test/TEST.ROOT
index 7775538c362..cc03bd9063d 100644
--- a/jaxp/test/TEST.ROOT
+++ b/jaxp/test/TEST.ROOT
@@ -1,3 +1,6 @@
 # This file identifies the root of the test-suite hierarchy.
 # It also contains test-suite configuration information.
 
+# Tests that must run in othervm mode
+othervm.dirs=javax/xml/jaxp/unittest
+
diff --git a/jaxp/test/javax/xml/jaxp/TEST.properties b/jaxp/test/javax/xml/jaxp/TEST.properties
new file mode 100644
index 00000000000..8ba6cb12a72
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/TEST.properties
@@ -0,0 +1,3 @@
+# jaxp test uses TestNG
+TestNG.dirs = unittest
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6350682.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6350682.java
new file mode 100644
index 00000000000..04d4f2502b7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6350682.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.common;
+
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6350682
+ * @summary Test SAXParserFactory and TransformerFactory can newInstance when setContextClassLoader(null).
+ */
+public class Bug6350682 {
+
+    @Test
+    public void testSAXParserFactory() {
+        try {
+            Thread.currentThread().setContextClassLoader(null);
+            if (Bug6350682.class.getClassLoader() == null)
+                System.out.println("this class loader is NULL");
+            else
+                System.out.println("this class loader is NOT NULL");
+            SAXParserFactory factory = SAXParserFactory.newInstance();
+            Assert.assertTrue(factory != null, "Failed to get an instance of a SAXParserFactory");
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testTransformerFactory() {
+        try {
+            Thread.currentThread().setContextClassLoader(null);
+            TransformerFactory factory = TransformerFactory.newInstance();
+            Assert.assertTrue(factory != null, "Failed to get an instance of a TransformerFactory");
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        } catch (TransformerFactoryConfigurationError error) {
+            error.printStackTrace();
+            Assert.fail(error.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6723276Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6723276Test.java
new file mode 100644
index 00000000000..7e1ecd89a6f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6723276Test.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.common;
+
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import javax.xml.parsers.SAXParserFactory;
+
+/*
+ * @bug 6723276
+ * @summary Test JAXP class can be loaded by bootstrap classloader.
+ */
+public class Bug6723276Test {
+
+    @Test
+    public void test1() {
+        try {
+            SAXParserFactory.newInstance();
+        } catch (Exception e) {
+            if (e.getMessage().indexOf("org.apache.xerces.jaxp.SAXParserFactoryImpl not found") > 0) {
+                Assert.fail(e.getMessage());
+            }
+        }
+    }
+
+    @Test
+    public void test2() {
+        try {
+            System.out.println(Thread.currentThread().getContextClassLoader());
+            System.out.println(ClassLoader.getSystemClassLoader().getParent());
+            Thread.currentThread().setContextClassLoader(new URLClassLoader(new URL[0], ClassLoader.getSystemClassLoader().getParent()));
+            SAXParserFactory.newInstance();
+        } catch (Exception e) {
+            if (e.getMessage().indexOf("org.apache.xerces.jaxp.SAXParserFactoryImpl not found") > 0) {
+                Assert.fail(e.getMessage());
+            }
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169.xml
new file mode 100644
index 00000000000..eca850a354f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Bug6941169.xsd">
+	<fooTest>
+    test
+
+
+
+    information
+	</fooTest>
+</root>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169.xsd
new file mode 100644
index 00000000000..27282f4da15
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169.xsd
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+    <xs:element name="root">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="fooTest" type="xs:anySimpleType" fixed="test information"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169Test.java
new file mode 100644
index 00000000000..fa35c3aa2cb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6941169Test.java
@@ -0,0 +1,501 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.common;
+
+import java.io.InputStream;
+import java.io.StringWriter;
+import java.security.AllPermission;
+import java.security.Permission;
+import java.security.Permissions;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 6941169
+ * @summary Test use-service-mechanism feature.
+ */
+public class Bug6941169Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    private static final String DOM_FACTORY_ID = "javax.xml.parsers.DocumentBuilderFactory";
+    private static final String SAX_FACTORY_ID = "javax.xml.parsers.SAXParserFactory";
+
+    // impl specific feature
+    final String ORACLE_FEATURE_SERVICE_MECHANISM = "http://www.oracle.com/feature/use-service-mechanism";
+
+    static String _xml = Bug6941169Test.class.getResource("Bug6941169.xml").getPath();
+    static String _xsd = Bug6941169Test.class.getResource("Bug6941169.xsd").getPath();
+
+    @Test
+    public void testValidation_SAX_withoutServiceMech() {
+        System.out.println("Validation using SAX Source;  Service mechnism is turned off;  SAX Impl should be the default:");
+        InputSource is = new InputSource(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml"));
+        SAXSource ss = new SAXSource(is);
+        System.setProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
+        long start = System.currentTimeMillis();
+        try {
+            SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            factory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, false);
+            Schema schema = factory.newSchema(new StreamSource(_xsd));
+            Validator validator = schema.newValidator();
+            validator.validate(ss, null);
+        } catch (Exception e) {
+            // e.printStackTrace();
+            String error = e.getMessage();
+            if (error.indexOf("javax.xml.parsers.FactoryConfigurationError: Provider MySAXFactoryImpl not found") > 0) {
+                Assert.fail(e.getMessage());
+            } else {
+                System.out.println("Default impl is used");
+            }
+
+            // System.out.println(e.getMessage());
+
+        }
+        long end = System.currentTimeMillis();
+        double elapsedTime = ((end - start));
+        System.out.println("Time elapsed: " + elapsedTime);
+        System.clearProperty(SAX_FACTORY_ID);
+    }
+
+    @Test
+    public void testValidation_SAX_withServiceMech() {
+        System.out.println("Validation using SAX Source. Using service mechnism (by default) to find SAX Impl:");
+        InputSource is = new InputSource(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml"));
+        SAXSource ss = new SAXSource(is);
+        System.setProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
+        long start = System.currentTimeMillis();
+        try {
+            SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            Schema schema = factory.newSchema(new StreamSource(_xsd));
+            Validator validator = schema.newValidator();
+            validator.validate(ss, null);
+            Assert.fail("User impl MySAXFactoryImpl should be used.");
+        } catch (Exception e) {
+            String error = e.getMessage();
+            if (error.indexOf("javax.xml.parsers.FactoryConfigurationError: Provider MySAXFactoryImpl not found") > 0) {
+                // expected
+            }
+            // System.out.println(e.getMessage());
+
+        }
+        long end = System.currentTimeMillis();
+        double elapsedTime = ((end - start));
+        System.out.println("Time elapsed: " + elapsedTime);
+        System.clearProperty(SAX_FACTORY_ID);
+    }
+
+    @Test
+    public void testValidation_SAX_withSM() {
+        System.out.println("Validation using SAX Source with security manager:");
+        InputSource is = new InputSource(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml"));
+        SAXSource ss = new SAXSource(is);
+        System.setProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
+        Permissions granted = new java.security.Permissions();
+        granted.add(new AllPermission());
+        System.setSecurityManager(new MySM(granted));
+
+        long start = System.currentTimeMillis();
+        try {
+            SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            factory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, false);
+            Schema schema = factory.newSchema(new StreamSource(_xsd));
+            Validator validator = schema.newValidator();
+            validator.validate(ss, null);
+        } catch (Exception e) {
+            String error = e.getMessage();
+            if (error.indexOf("javax.xml.parsers.FactoryConfigurationError: Provider MySAXFactoryImpl not found") > 0) {
+                Assert.fail(e.getMessage());
+            } else {
+                System.out.println("Default impl is used");
+            }
+
+            // System.out.println(e.getMessage());
+
+        } finally {
+            System.clearProperty(SAX_FACTORY_ID);
+            System.setSecurityManager(null);
+        }
+        long end = System.currentTimeMillis();
+        double elapsedTime = ((end - start));
+        System.out.println("Time elapsed: " + elapsedTime);
+        System.setSecurityManager(null);
+
+    }
+
+    @Test
+    public void testTransform_DOM_withoutServiceMech() {
+        System.out.println("Transform using DOM Source;  Service mechnism is turned off;  Default DOM Impl should be the default:");
+        DOMSource domSource = new DOMSource();
+        domSource.setSystemId(_xml);
+
+        // DOMSource domSource = new
+        // DOMSource(getDocument(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml")));
+        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+        long start = System.currentTimeMillis();
+        try {
+            TransformerFactory factory = TransformerFactory.newInstance();
+            factory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, false);
+
+            Transformer t = factory.newTransformer();
+
+            StringWriter result = new StringWriter();
+            StreamResult streamResult = new StreamResult(result);
+            t.transform(domSource, streamResult);
+            System.out.println("Writing to " + result.toString());
+
+        } catch (Exception e) {
+            // e.printStackTrace();
+            String error = e.getMessage();
+            if (error.indexOf("Provider MyDOMFactoryImpl not found") > 0) {
+                Assert.fail(e.getMessage());
+            } else {
+                System.out.println("Default impl is used");
+            }
+
+            // System.out.println(e.getMessage());
+
+        } catch (Error e) {
+            // e.printStackTrace();
+            String error = e.getMessage();
+            if (error.indexOf("Provider MyDOMFactoryImpl not found") > 0) {
+                Assert.fail(e.getMessage());
+            } else {
+                System.out.println("Default impl is used");
+            }
+
+            // System.out.println(e.getMessage());
+
+        }
+
+        long end = System.currentTimeMillis();
+        double elapsedTime = ((end - start));
+        System.out.println("Time elapsed: " + elapsedTime);
+        System.clearProperty(DOM_FACTORY_ID);
+    }
+
+    /** this is by default */
+    @Test
+    public void testTransform_DOM_withServiceMech() {
+        System.out.println("Transform using DOM Source;  By default, the factory uses services mechanism to look up impl:");
+        DOMSource domSource = new DOMSource();
+        domSource.setSystemId(_xml);
+
+        // DOMSource domSource = new
+        // DOMSource(getDocument(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml")));
+        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+        long start = System.currentTimeMillis();
+        try {
+            TransformerFactory factory = TransformerFactory.newInstance();
+            Transformer t = factory.newTransformer();
+
+            StringWriter result = new StringWriter();
+            StreamResult streamResult = new StreamResult(result);
+            t.transform(domSource, streamResult);
+            System.out.println("Writing to " + result.toString());
+
+            Assert.fail("User impl MyDOMFactoryImpl should be used.");
+
+        } catch (Exception e) {
+            String error = e.getMessage();
+            if (error.indexOf("Provider MyDOMFactoryImpl not found") > 0) {
+                // expected
+            }
+            System.out.println(error);
+
+        } catch (Error e) {
+            String error = e.getMessage();
+            if (error.indexOf("Provider MyDOMFactoryImpl not found") > 0) {
+                // expected
+            }
+            System.out.println(error);
+
+        }
+
+        long end = System.currentTimeMillis();
+        double elapsedTime = ((end - start));
+        System.out.println("Time elapsed: " + elapsedTime);
+        System.clearProperty(DOM_FACTORY_ID);
+    }
+
+    @Test
+    public void testTransform_DOM_withSM() {
+        System.out.println("Transform using DOM Source;  Security Manager is set:");
+        DOMSource domSource = new DOMSource();
+        domSource.setSystemId(_xml);
+
+        // DOMSource domSource = new
+        // DOMSource(getDocument(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml")));
+        Permissions granted = new java.security.Permissions();
+        granted.add(new AllPermission());
+        System.setSecurityManager(new MySM(granted));
+        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+        long start = System.currentTimeMillis();
+        try {
+            TransformerFactory factory = TransformerFactory.newInstance("com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl",
+                    TransformerFactory.class.getClassLoader());
+            Transformer t = factory.newTransformer();
+
+            StringWriter result = new StringWriter();
+            StreamResult streamResult = new StreamResult(result);
+            t.transform(domSource, streamResult);
+            System.out.println("Writing to " + result.toString());
+
+        } catch (Exception e) {
+            String error = e.getMessage();
+            if (error.indexOf("Provider MyDOMFactoryImpl not found") > 0) {
+                Assert.fail(e.getMessage());
+            } else {
+                System.out.println("Default impl is used");
+            }
+
+            // System.out.println(e.getMessage());
+
+        } catch (Error e) {
+            String error = e.getMessage();
+            if (error.indexOf("Provider MyDOMFactoryImpl not found") > 0) {
+                Assert.fail(e.getMessage());
+            } else {
+                System.out.println("Default impl is used");
+            }
+
+            // System.out.println(e.getMessage());
+
+        } finally {
+            System.clearProperty(DOM_FACTORY_ID);
+            System.setSecurityManager(null);
+        }
+        long end = System.currentTimeMillis();
+        double elapsedTime = ((end - start));
+        System.out.println("Time elapsed: " + elapsedTime);
+        System.clearProperty(DOM_FACTORY_ID);
+    }
+
+    @Test
+    public void testXPath_DOM_withoutServiceMech() {
+        final String XPATH_EXPRESSION = "/fooTest";
+        System.out.println("Evaluate DOM Source;  Service mechnism is turned off;  Default DOM Impl should be used:");
+        Document doc = getDocument(Bug6941169Test.class.getResourceAsStream("Bug6941169.xml"));
+        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+        long start = System.currentTimeMillis();
+        try {
+            XPathFactory xPathFactory = XPathFactory.newInstance();
+            xPathFactory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, false);
+
+            XPath xPath = xPathFactory.newXPath();
+
+            String xPathResult = xPath.evaluate(XPATH_EXPRESSION, doc);
+
+        } catch (Exception e) {
+            // e.printStackTrace();
+            String error = e.getMessage();
+            if (error.indexOf("MyDOMFactoryImpl not found") > 0) {
+                Assert.fail(e.getMessage());
+            } else {
+                System.out.println("Default impl is used");
+            }
+
+            // System.out.println(e.getMessage());
+
+        } catch (Error e) {
+            // e.printStackTrace();
+            String error = e.getMessage();
+            if (error.indexOf("MyDOMFactoryImpl not found") > 0) {
+                Assert.fail(e.getMessage());
+            } else {
+                System.out.println("Default impl is used");
+            }
+
+            // System.out.println(e.getMessage());
+
+        }
+
+        long end = System.currentTimeMillis();
+        double elapsedTime = ((end - start));
+        System.out.println("Time elapsed: " + elapsedTime);
+        System.clearProperty(DOM_FACTORY_ID);
+    }
+
+    @Test
+    public void testXPath_DOM_withServiceMech() {
+        final String XPATH_EXPRESSION = "/fooTest";
+        System.out.println("Evaluate DOM Source;  Service mechnism is on by default;  It would try to use MyDOMFactoryImpl:");
+        InputStream input = getClass().getResourceAsStream("Bug6941169.xml");
+        InputSource source = new InputSource(input);
+        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+        long start = System.currentTimeMillis();
+        try {
+            XPathFactory xPathFactory = XPathFactory.newInstance();
+
+            XPath xPath = xPathFactory.newXPath();
+
+            String xPathResult = xPath.evaluate(XPATH_EXPRESSION, source);
+            Assert.fail("User impl MyDOMFactoryImpl should be used.");
+
+        } catch (Exception e) {
+            // e.printStackTrace();
+            String error = e.getMessage();
+            if (error.indexOf("MyDOMFactoryImpl not found") > 0) {
+                System.out.println("Tried to locate MyDOMFactoryImpl");
+            } else {
+                Assert.fail(e.getMessage());
+
+            }
+
+            // System.out.println(e.getMessage());
+
+        } catch (Error e) {
+            // e.printStackTrace();
+            String error = e.getMessage();
+            if (error.indexOf("MyDOMFactoryImpl not found") > 0) {
+                System.out.println("Tried to locate MyDOMFactoryImpl");
+            } else {
+                Assert.fail(e.getMessage());
+
+            }
+
+            // System.out.println(e.getMessage());
+
+        }
+
+        long end = System.currentTimeMillis();
+        double elapsedTime = ((end - start));
+        System.out.println("Time elapsed: " + elapsedTime);
+        System.clearProperty(DOM_FACTORY_ID);
+    }
+
+    @Test
+    public void testXPath_DOM_withSM() {
+        final String XPATH_EXPRESSION = "/fooTest";
+        System.out.println("Evaluate DOM Source;  Security Manager is set:");
+        Permissions granted = new java.security.Permissions();
+        granted.add(new AllPermission());
+        System.setSecurityManager(new MySM(granted));
+        InputStream input = getClass().getResourceAsStream("Bug6941169.xml");
+        InputSource source = new InputSource(input);
+        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+        long start = System.currentTimeMillis();
+        try {
+            XPathFactory xPathFactory = XPathFactory.newInstance("http://java.sun.com/jaxp/xpath/dom",
+                    "com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl", null);
+
+            XPath xPath = xPathFactory.newXPath();
+
+            String xPathResult = xPath.evaluate(XPATH_EXPRESSION, source);
+            System.out.println("Use default impl");
+        } catch (Exception e) {
+            // e.printStackTrace();
+            String error = e.getMessage();
+            if (error.indexOf("MyDOMFactoryImpl not found") > 0) {
+                Assert.fail(e.getMessage());
+            } else {
+                System.out.println("Default impl should be used");
+            }
+
+            // System.out.println(e.getMessage());
+
+        } catch (Error e) {
+            // e.printStackTrace();
+            String error = e.getMessage();
+            if (error.indexOf("MyDOMFactoryImpl not found") > 0) {
+                Assert.fail(e.getMessage());
+            } else {
+                System.out.println("Default impl should be used");
+            }
+
+            // System.out.println(e.getMessage());
+
+        } finally {
+            System.clearProperty(DOM_FACTORY_ID);
+            System.setSecurityManager(null);
+        }
+        long end = System.currentTimeMillis();
+        double elapsedTime = ((end - start));
+        System.out.println("Time elapsed: " + elapsedTime);
+        System.clearProperty(DOM_FACTORY_ID);
+    }
+
+    @Test
+    public void testSM() {
+        SecurityManager sm = System.getSecurityManager();
+        if (System.getSecurityManager() != null) {
+            System.out.println("Security manager not cleared: " + sm.toString());
+        } else {
+            System.out.println("Security manager cleared: ");
+        }
+    }
+
+    private static Document getDocument(InputStream in) {
+
+        Document document = null;
+
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            document = db.parse(in);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+
+        return document;
+    }
+
+    class MySM extends SecurityManager {
+        Permissions granted;
+
+        public MySM(Permissions perms) {
+            granted = perms;
+        }
+
+        @Override
+        public void checkPermission(Permission perm) {
+            if (granted.implies(perm)) {
+                return;
+            }
+            super.checkPermission(perm);
+        }
+
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6979306Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6979306Test.java
new file mode 100644
index 00000000000..4058e3a41bf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug6979306Test.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.common;
+
+import org.testng.annotations.Test;
+
+import com.sun.org.apache.xalan.internal.xslt.EnvironmentCheck;
+
+/*
+ * @bug 6979306
+ * @summary Test JAXP component version.
+ */
+public class Bug6979306Test {
+
+    @Test
+    public void test() {
+        String[] input = {};
+        EnvironmentCheck.main(input);
+        com.sun.org.apache.xerces.internal.impl.Version.main(input);
+        com.sun.org.apache.xalan.internal.Version._main(input);
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug7143711Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug7143711Test.java
new file mode 100644
index 00000000000..a9f8b84c13c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/common/Bug7143711Test.java
@@ -0,0 +1,159 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.common;
+
+import java.security.AllPermission;
+import java.security.Permission;
+import java.security.Permissions;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.xpath.XPathFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 7143711
+ * @summary Test set use-service-mechanism shall not override what's set by the constructor in secure mode.
+ */
+public class Bug7143711Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    private static final String DOM_FACTORY_ID = "javax.xml.parsers.DocumentBuilderFactory";
+    private static final String SAX_FACTORY_ID = "javax.xml.parsers.SAXParserFactory";
+
+    // impl specific feature
+    final String ORACLE_FEATURE_SERVICE_MECHANISM = "http://www.oracle.com/feature/use-service-mechanism";
+
+    @Test
+    public void testValidation_SAX_withSM() {
+        System.out.println("Validation using SAX Source with security manager:");
+        System.setProperty(SAX_FACTORY_ID, "MySAXFactoryImpl");
+        Permissions granted = new java.security.Permissions();
+        granted.add(new AllPermission());
+        System.setSecurityManager(new MySM(granted));
+
+        try {
+            SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            // should not allow
+            factory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, true);
+            if ((boolean) factory.getFeature(ORACLE_FEATURE_SERVICE_MECHANISM)) {
+                Assert.fail("should not override in secure mode");
+            }
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+
+        } finally {
+            System.clearProperty(SAX_FACTORY_ID);
+            System.setSecurityManager(null);
+        }
+
+        System.setSecurityManager(null);
+
+    }
+
+    @Test
+    public void testTransform_DOM_withSM() {
+        System.out.println("Transform using DOM Source;  Security Manager is set:");
+
+        Permissions granted = new java.security.Permissions();
+        granted.add(new AllPermission());
+        System.setSecurityManager(new MySM(granted));
+        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+
+        try {
+            TransformerFactory factory = TransformerFactory.newInstance("com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl",
+                    TransformerFactory.class.getClassLoader());
+            factory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, true);
+            if (((com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl) factory).useServicesMechnism()) {
+                Assert.fail("should not override in secure mode");
+            }
+
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        } finally {
+            System.clearProperty(DOM_FACTORY_ID);
+            System.setSecurityManager(null);
+        }
+
+        System.clearProperty(DOM_FACTORY_ID);
+    }
+
+    @Test
+    public void testXPath_DOM_withSM() {
+        System.out.println("Evaluate DOM Source;  Security Manager is set:");
+        Permissions granted = new java.security.Permissions();
+        granted.add(new AllPermission());
+        System.setSecurityManager(new MySM(granted));
+        System.setProperty(DOM_FACTORY_ID, "MyDOMFactoryImpl");
+
+        try {
+            XPathFactory xPathFactory = XPathFactory.newInstance("http://java.sun.com/jaxp/xpath/dom",
+                    "com.sun.org.apache.xpath.internal.jaxp.XPathFactoryImpl", null);
+            xPathFactory.setFeature(ORACLE_FEATURE_SERVICE_MECHANISM, true);
+            if ((boolean) xPathFactory.getFeature(ORACLE_FEATURE_SERVICE_MECHANISM)) {
+                Assert.fail("should not override in secure mode");
+            }
+
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        } finally {
+            System.clearProperty(DOM_FACTORY_ID);
+            System.setSecurityManager(null);
+        }
+
+        System.clearProperty(DOM_FACTORY_ID);
+    }
+
+    @Test
+    public void testSM() {
+        SecurityManager sm = System.getSecurityManager();
+        if (System.getSecurityManager() != null) {
+            System.out.println("Security manager not cleared: " + sm.toString());
+        } else {
+            System.out.println("Security manager cleared: ");
+        }
+    }
+
+    class MySM extends SecurityManager {
+        Permissions granted;
+
+        public MySM(Permissions perms) {
+            granted = perms;
+        }
+
+        @Override
+        public void checkPermission(Permission perm) {
+            if (granted.implies(perm)) {
+                return;
+            }
+            super.checkPermission(perm);
+        }
+
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6320118.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6320118.java
new file mode 100644
index 00000000000..959a978f6f0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6320118.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.datatype;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6320118
+ * @summary Test xml datatype XMLGregorianCalendar.
+ */
+public class Bug6320118 {
+
+    DatatypeFactory df;
+
+    @Test
+    public void test1() {
+        try {
+            df = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            XMLGregorianCalendar calendar = df.newXMLGregorianCalendar(1970, 1, 1, 24, 0, 0, 0, 0);
+        } catch (IllegalArgumentException e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void test2() {
+        try {
+            df = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            XMLGregorianCalendar calendar = df.newXMLGregorianCalendarTime(24, 0, 0, 0);
+        } catch (IllegalArgumentException e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void test3() {
+        try {
+            df = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException e) {
+            Assert.fail(e.getMessage());
+        }
+        try {
+            XMLGregorianCalendar calendar = df.newXMLGregorianCalendar();
+            // Must fail as other params are not 0 but undefined
+            calendar.setHour(24);
+            Assert.fail("test3() - Expected IllegalArgumentException not thrown");
+        } catch (IllegalArgumentException e) {
+            // falls through
+        }
+    }
+
+    @Test
+    public void test4() {
+        try {
+            df = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException e) {
+            Assert.fail(e.getMessage());
+        }
+
+        try {
+            XMLGregorianCalendar calendar = df.newXMLGregorianCalendar();
+            calendar.setTime(24, 0, 0, 0);
+        } catch (IllegalArgumentException e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6937951Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6937951Test.java
new file mode 100644
index 00000000000..a7335644c61
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6937951Test.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.datatype;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6937951
+ * @summary Test midnight is same as the start of the next day in XMLGregorianCalendar.
+ */
+public class Bug6937951Test {
+
+    @Test
+    public void test() throws DatatypeConfigurationException {
+        DatatypeFactory dtf = DatatypeFactory.newInstance();
+        XMLGregorianCalendar c1 = dtf.newXMLGregorianCalendar("1999-12-31T24:00:00");
+        XMLGregorianCalendar c2 = dtf.newXMLGregorianCalendar("2000-01-01T00:00:00");
+        System.out.println("c1: " + c1.getYear() + "-" + c1.getMonth() + "-" + c1.getDay() + "T" + c1.getHour());
+        System.out.println(c1.equals(c2) ? "pass" : "fail"); // fails
+        if (!c1.equals(c2))
+            Assert.fail("hour 24 needs to be treated as equal to hour 0 of the next day");
+        if (c1.getYear() != 2000 && c1.getHour() != 0)
+            Assert.fail("hour 24 needs to be treated as equal to hour 0 of the next day");
+
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6937964Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6937964Test.java
new file mode 100644
index 00000000000..31aff0538f9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug6937964Test.java
@@ -0,0 +1,262 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.datatype;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import javax.xml.namespace.QName;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6937964
+ * @summary Test Duration is normalized.
+ */
+public class Bug6937964Test {
+    /**
+     * Print debugging to System.err.
+     */
+    private static final boolean DEBUG = false;
+    /**
+     * Constant to indicate expected lexical test failure.
+     */
+    private static final String TEST_VALUE_FAIL = "*FAIL*";
+
+    private static final String FIELD_UNDEFINED = "FIELD_UNDEFINED";
+    static final DatatypeConstants.Field[] fields = { DatatypeConstants.YEARS, DatatypeConstants.MONTHS, DatatypeConstants.DAYS, DatatypeConstants.HOURS,
+            DatatypeConstants.MINUTES, DatatypeConstants.SECONDS };
+
+    @Test
+    public void test() throws DatatypeConfigurationException {
+        DatatypeFactory dtf = DatatypeFactory.newInstance();
+        Duration d = dtf.newDurationYearMonth("P20Y15M");
+        int years = d.getYears();
+        System.out.println(d.getYears() == 21 ? "pass" : "fail");
+    }
+
+    @Test
+    public void testNewDurationYearMonthLexicalRepresentation() throws DatatypeConfigurationException {
+        DatatypeFactory dtf = DatatypeFactory.newInstance();
+        Duration d = dtf.newDurationYearMonth("P20Y15M");
+        int years = d.getYears();
+        Assert.assertTrue(years == 21, "Return value should be normalized");
+    }
+
+    @Test
+    public void testNewDurationYearMonthMilliseconds() throws DatatypeConfigurationException {
+        DatatypeFactory dtf = DatatypeFactory.newInstance();
+        Duration d = dtf.newDurationYearMonth(671976000000L);
+        int years = d.getYears();
+        System.out.println("Years: " + years);
+        Assert.assertTrue(years == 21, "Return value should be normalized");
+    }
+
+    @Test
+    public void testNewDurationYearMonthBigInteger() throws DatatypeConfigurationException {
+        DatatypeFactory dtf = DatatypeFactory.newInstance();
+        BigInteger year = new BigInteger("20");
+        BigInteger mon = new BigInteger("15");
+        Duration d = dtf.newDurationYearMonth(true, year, mon);
+        int years = d.getYears();
+        Assert.assertTrue(years == 21, "Return value should be normalized");
+    }
+
+    @Test
+    public void testNewDurationYearMonthInt() throws DatatypeConfigurationException {
+        DatatypeFactory dtf = DatatypeFactory.newInstance();
+        Duration d = dtf.newDurationYearMonth(true, 20, 15);
+        int years = d.getYears();
+        Assert.assertTrue(years == 21, "Return value should be normalized");
+    }
+
+    @Test
+    public void testNewDurationDayTimeLexicalRepresentation() throws DatatypeConfigurationException {
+        DatatypeFactory dtf = DatatypeFactory.newInstance();
+        Duration d = dtf.newDurationDayTime("P1DT23H59M65S");
+        int days = d.getDays();
+        Assert.assertTrue(days == 2, "Return value should be normalized");
+    }
+
+    @Test
+    public void testNewDurationDayTimeMilliseconds() throws DatatypeConfigurationException {
+        DatatypeFactory dtf = DatatypeFactory.newInstance();
+        Duration d = dtf.newDurationDayTime(172805000L);
+        int days = d.getDays();
+        Assert.assertTrue(days == 2, "Return value should be normalized");
+    }
+
+    @Test
+    public void testNewDurationDayTimeBigInteger() throws DatatypeConfigurationException {
+        DatatypeFactory dtf = DatatypeFactory.newInstance();
+        BigInteger day = new BigInteger("1");
+        BigInteger hour = new BigInteger("23");
+        BigInteger min = new BigInteger("59");
+        BigInteger sec = new BigInteger("65");
+        Duration d = dtf.newDurationDayTime(true, day, hour, min, sec);
+        int days = d.getDays();
+        System.out.println("Days: " + days);
+        Assert.assertTrue(days == 2, "Return value should be normalized");
+    }
+
+    @Test
+    public void testNewDurationDayTimeInt() throws DatatypeConfigurationException {
+        DatatypeFactory dtf = DatatypeFactory.newInstance();
+        Duration d = dtf.newDurationDayTime(true, 1, 23, 59, 65);
+        int days = d.getDays();
+        System.out.println("Days: " + days);
+        Assert.assertTrue(days == 2, "Return value should be normalized");
+    }
+
+    @Test
+    public final void testNewDurationYearMonthLexicalRepresentation1() {
+
+        /**
+         * Lexical test values to test.
+         */
+        final String[] TEST_VALUES_LEXICAL = { "P13M", "P1Y1M", "-P13M", "-P1Y1M", "P1Y", "P1Y", "-P1Y", "-P1Y", "P1Y25M", "P3Y1M", "-P1Y25M", "-P3Y1M" };
+
+        DatatypeFactory datatypeFactory = null;
+        try {
+            datatypeFactory = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException datatypeConfigurationException) {
+            Assert.fail(datatypeConfigurationException.toString());
+        }
+
+        if (DEBUG) {
+            System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+        }
+
+        // test each value
+        for (int onTestValue = 0; onTestValue < TEST_VALUES_LEXICAL.length; onTestValue = onTestValue + 2) {
+
+            if (DEBUG) {
+                System.err.println("testing value: \"" + TEST_VALUES_LEXICAL[onTestValue] + "\", expecting: \"" + TEST_VALUES_LEXICAL[onTestValue + 1] + "\"");
+            }
+
+            try {
+                Duration duration = datatypeFactory.newDurationYearMonth(TEST_VALUES_LEXICAL[onTestValue]);
+
+                if (DEBUG) {
+                    System.err.println("Duration created: \"" + duration.toString() + "\"");
+                }
+
+                // was this expected to fail?
+                if (TEST_VALUES_LEXICAL[onTestValue + 1].equals(TEST_VALUE_FAIL)) {
+                    Assert.fail("the value \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" is invalid yet it created the Duration \"" + duration.toString() + "\"");
+                }
+
+                // right XMLSchemaType?
+                // TODO: enable test, it should pass, it fails with Exception(s)
+                // for now due to a bug
+                try {
+                    QName xmlSchemaType = duration.getXMLSchemaType();
+                    if (!xmlSchemaType.equals(DatatypeConstants.DURATION_YEARMONTH)) {
+                        Assert.fail("Duration created with XMLSchemaType of\"" + xmlSchemaType + "\" was expected to be \""
+                                + DatatypeConstants.DURATION_YEARMONTH + "\" and has the value \"" + duration.toString() + "\"");
+                    }
+                } catch (IllegalStateException illegalStateException) {
+                    // TODO; this test really should pass
+                    System.err.println("Please fix this bug that is being ignored, for now: " + illegalStateException.getMessage());
+                }
+
+                // does it have the right value?
+                if (!TEST_VALUES_LEXICAL[onTestValue + 1].equals(duration.toString())) {
+                    Assert.fail("Duration created with \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" was expected to be \""
+                            + TEST_VALUES_LEXICAL[onTestValue + 1] + "\" and has the value \"" + duration.toString() + "\"");
+                }
+
+                // Duration created with correct value
+            } catch (Exception exception) {
+
+                if (DEBUG) {
+                    System.err.println("Exception in creating duration: \"" + exception.toString() + "\"");
+                }
+
+                // was this expected to succed?
+                if (!TEST_VALUES_LEXICAL[onTestValue + 1].equals(TEST_VALUE_FAIL)) {
+                    Assert.fail("the value \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" is valid yet it failed with \"" + exception.toString() + "\"");
+                }
+                // expected failure
+            }
+        }
+    }
+
+    /**
+     * TCK test failure
+     */
+    @Test
+    public void testNewDurationDayTime005() {
+        BigInteger one = new BigInteger("1");
+        BigInteger zero = new BigInteger("0");
+        BigDecimal bdZero = new BigDecimal("0");
+        BigDecimal bdOne = new BigDecimal("1");
+
+        Object[][] values = {
+                // lex, isPositive, years, month, days, hours, minutes, seconds
+                { "P1D", Boolean.TRUE, null, null, one, zero, zero, bdZero }, { "PT1H", Boolean.TRUE, null, null, zero, one, zero, bdZero },
+                { "PT1M", Boolean.TRUE, null, null, zero, zero, one, bdZero }, { "PT1.1S", Boolean.TRUE, null, null, zero, zero, zero, bdOne },
+                { "-PT1H1.1S", Boolean.FALSE, null, null, zero, one, zero, bdOne }, };
+
+        StringBuffer result = new StringBuffer();
+        DatatypeFactory df = null;
+
+        try {
+            df = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException e) {
+            Assert.fail(e.toString());
+        }
+
+        for (int valueIndex = 0; valueIndex < values.length; ++valueIndex) {
+            Duration duration = null;
+            try {
+                duration = df.newDurationDayTime(values[valueIndex][1].equals(Boolean.TRUE), ((BigInteger) values[valueIndex][4]).intValue(),
+                        ((BigInteger) values[valueIndex][5]).intValue(), ((BigInteger) values[valueIndex][6]).intValue(),
+                        ((BigDecimal) values[valueIndex][7]).intValue());
+            } catch (IllegalArgumentException e) {
+                result.append("; unexpected " + e + " trying to create duration \'" + values[valueIndex][0] + "\'");
+            }
+            if (duration != null) {
+                if ((duration.getSign() == 1) != values[valueIndex][1].equals(Boolean.TRUE)) {
+                    result.append("; " + values[valueIndex][0] + ": wrong sign " + duration.getSign() + ", expected " + values[valueIndex][1]);
+                }
+                for (int i = 0; i < fields.length; ++i) {
+                    Number value = duration.getField(fields[i]);
+                    if ((value != null && values[valueIndex][2 + i] == null) || (value == null && values[valueIndex][2 + i] != null)
+                            || (value != null && !value.equals(values[valueIndex][2 + i]))) {
+                        result.append("; " + values[valueIndex][0] + ": wrong value of the field " + fields[i] + ": \'" + value + "\'" + ", expected \'"
+                                + values[valueIndex][2 + i] + "\'");
+                    }
+                }
+            }
+        }
+
+        if (result.length() > 0) {
+            Assert.fail(result.substring(2));
+        }
+        System.out.println("OK");
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug7042647Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug7042647Test.java
new file mode 100644
index 00000000000..36438265010
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/Bug7042647Test.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.datatype;
+
+import java.util.Calendar;
+import java.util.GregorianCalendar;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 7042647
+ * @summary Test getFirstDayOfWeek is correct after converting XMLGregorianCalendar to a GregorianCalendar.
+ */
+public class Bug7042647Test {
+
+    @Test
+    public void test() throws DatatypeConfigurationException {
+        XMLGregorianCalendar xmlCalendar = DatatypeFactory.newInstance().newXMLGregorianCalendar(1970, 1, 1, 0, 0, 0, 0, 0);
+        GregorianCalendar calendar = xmlCalendar.toGregorianCalendar();
+        int firstDayOfWeek = calendar.getFirstDayOfWeek();
+        Calendar defaultCalendar = Calendar.getInstance();
+        int defaultFirstDayOfWeek = defaultCalendar.getFirstDayOfWeek();
+        if (firstDayOfWeek != defaultFirstDayOfWeek) {
+            Assert.fail("Failed firstDayOfWeek=" + firstDayOfWeek + " != defaultFirstDayOfWeek=" + defaultFirstDayOfWeek);
+        } else {
+            System.out.println("Success firstDayOfWeek=" + firstDayOfWeek + " == defaultFirstDayOfWeek=" + defaultFirstDayOfWeek);
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/DatatypeFactoryTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/DatatypeFactoryTest.java
new file mode 100644
index 00000000000..67e458ee719
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/DatatypeFactoryTest.java
@@ -0,0 +1,631 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.datatype;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+
+import javax.xml.namespace.QName;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test DatatypeFactory.
+ */
+public class DatatypeFactoryTest {
+
+    private static final boolean DEBUG = false;
+
+    private static final String TEST_VALUE_FAIL = "*FAIL*";
+
+    private static final String FIELD_UNDEFINED = "FIELD_UNDEFINED";
+
+    static int parseInt(String value) {
+        return FIELD_UNDEFINED.equals(value) ? DatatypeConstants.FIELD_UNDEFINED : Integer.parseInt(value);
+    }
+
+    static BigDecimal parseBigDecimal(String value) {
+        return FIELD_UNDEFINED.equals(value) ? null : new BigDecimal(value);
+    }
+
+    static BigInteger parseBigInteger(String value) {
+        return FIELD_UNDEFINED.equals(value) ? null : new BigInteger(value);
+    }
+
+    @Test
+    public final void testNewDurationMilliseconds() {
+
+        /*
+         * to generate millisecond values
+         * final TimeZone GMT = TimeZone.getTimeZone("GMT"); GregorianCalendar
+         * gregorianCalendar = new GregorianCalendar(GMT);
+         * gregorianCalendar.setTimeInMillis(0);
+         * gregorianCalendar.add(Calendar.HOUR_OF_DAY, 1);
+         * gregorianCalendar.add(Calendar.MINUTE, 1);
+         * System.err.println("1 hour, 1 minute = " +
+         * gregorianCalendar.getTimeInMillis() + " milliseconds");
+         */
+
+        /**
+         * Millisecond test values to test.
+         */
+        final long[] TEST_VALUES_MILLISECONDS = { 0L, // 0
+                1L, // 1 millisecond
+                -1L, 1000L, // 1 second
+                -1000L, 1001L, // 1 second, 1 millisecond
+                -1001L, 60000L, // 1 minute
+                -60000L, 61000L, // 1 minute, 1 second
+                -61000L, 3600000L, // 1 hour
+                -3600000L, 3660000L, // 1 hour, 1 minute
+                -3660000L, 86400000L, // 1 day
+                -86400000L, 90000000L, // 1 day, 1 hour
+                -90000000L, 2678400000L, // 1 month
+                -2678400000L, 2764800000L, // 1 month, 1 day
+                -2764800000L, 31536000000L, // 1 year
+                -31536000000L, 34214400000L, // 1 year, 1 month
+                -34214400000L };
+
+        /**
+         * Millisecond test value results of test.
+         */
+        final String[] TEST_VALUES_MILLISECONDS_RESULTS = { "P0Y0M0DT0H0M0.000S", // 0
+                "P0Y0M0DT0H0M0.001S", // 1 millisecond
+                "-P0Y0M0DT0H0M0.001S", "P0Y0M0DT0H0M1.000S", // 1 second
+                "-P0Y0M0DT0H0M1.000S", "P0Y0M0DT0H0M1.001S", // 1 second, 1
+                                                             // millisecond
+                "-P0Y0M0DT0H0M1.001S", "P0Y0M0DT0H1M0.000S", // 1 minute
+                "-P0Y0M0DT0H1M0.000S", "P0Y0M0DT0H1M1.000S", // 1 minute, 1
+                                                             // second
+                "-P0Y0M0DT0H1M1.000S", "P0Y0M0DT1H0M0.000S", // 1 hour
+                "-P0Y0M0DT1H0M0.000S", "P0Y0M0DT1H1M0.000S", // 1 hour, 1 minute
+                "-P0Y0M0DT1H1M0.000S", "P0Y0M1DT0H0M0.000S", // 1 day
+                "-P0Y0M1DT0H0M0.000S", "P0Y0M1DT1H0M0.000S", // 1 day, 1 hour
+                "-P0Y0M1DT1H0M0.000S", "P0Y1M0DT0H0M0.000S", // 1 month
+                "-P0Y1M0DT0H0M0.000S", "P0Y1M1DT0H0M0.000S", // 1 month, 1 day
+                "-P0Y1M1DT0H0M0.000S", "P1Y0M0DT0H0M0.000S", // 1 year
+                "-P1Y0M0DT0H0M0.000S", "P1Y1M0DT0H0M0.000S", // 1 year, 1 month
+                "-P1Y1M0DT0H0M0.000S" };
+
+        DatatypeFactory datatypeFactory = null;
+        try {
+            datatypeFactory = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException datatypeConfigurationException) {
+            Assert.fail(datatypeConfigurationException.toString());
+        }
+
+        if (DEBUG) {
+            System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+        }
+
+        // test each value
+        for (int onTestValue = 0; onTestValue < TEST_VALUES_MILLISECONDS.length; onTestValue++) {
+
+            if (DEBUG) {
+                System.err.println("testing value: \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\", expecting: \""
+                        + TEST_VALUES_MILLISECONDS_RESULTS[onTestValue] + "\"");
+            }
+
+            try {
+                Duration duration = datatypeFactory.newDuration(TEST_VALUES_MILLISECONDS[onTestValue]);
+
+                if (DEBUG) {
+                    System.err.println("Duration created: \"" + duration.toString() + "\"");
+                }
+
+                // was this expected to fail?
+                if (TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(TEST_VALUE_FAIL)) {
+                    Assert.fail("the value \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" is invalid yet it created the Duration \"" + duration.toString()
+                            + "\"");
+                }
+
+                // right XMLSchemaType?
+                QName xmlSchemaType = duration.getXMLSchemaType();
+                if (!xmlSchemaType.equals(DatatypeConstants.DURATION)) {
+                    Assert.fail("Duration created with XMLSchemaType of\"" + xmlSchemaType + "\" was expected to be \"" + DatatypeConstants.DURATION
+                            + "\" and has the value \"" + duration.toString() + "\"");
+                }
+
+                // does it have the right value?
+                if (!TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(duration.toString())) {
+                    Assert.fail("Duration created with \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" was expected to be \""
+                            + TEST_VALUES_MILLISECONDS_RESULTS[onTestValue] + "\" and has the value \"" + duration.toString() + "\"");
+                }
+
+                // Duration created with correct value
+            } catch (Exception exception) {
+
+                if (DEBUG) {
+                    System.err.println("Exception in creating duration: \"" + exception.toString() + "\"");
+                }
+
+                // was this expected to succed?
+                if (!TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(TEST_VALUE_FAIL)) {
+                    Assert.fail("the value \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" is valid yet it failed with \"" + exception.toString() + "\"");
+                }
+                // expected failure
+            }
+        }
+    }
+
+    /**
+     * Test {@link DatatypeFactory.newDurationYearMonth(String
+     * lexicalRepresentation)}.
+     */
+    @Test
+    public final void testNewDurationYearMonthLexicalRepresentation() {
+
+        /**
+         * Lexical test values to test.
+         */
+        final String[] TEST_VALUES_LEXICAL = { null, TEST_VALUE_FAIL, "", TEST_VALUE_FAIL, "-", TEST_VALUE_FAIL, "P", TEST_VALUE_FAIL, "-P", TEST_VALUE_FAIL,
+                "P1D", TEST_VALUE_FAIL, "P1Y1M1D", TEST_VALUE_FAIL, "P1M", "P1M", "-P1M", "-P1M", "P1Y", "P1Y", "-P1Y", "-P1Y", "P1Y1M", "P1Y1M", "-P1Y1M",
+                "-P1Y1M" };
+
+        DatatypeFactory datatypeFactory = null;
+        try {
+            datatypeFactory = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException datatypeConfigurationException) {
+            Assert.fail(datatypeConfigurationException.toString());
+        }
+
+        if (DEBUG) {
+            System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+        }
+
+        // test each value
+        for (int onTestValue = 0; onTestValue < TEST_VALUES_LEXICAL.length; onTestValue = onTestValue + 2) {
+
+            if (DEBUG) {
+                System.err.println("testing value: \"" + TEST_VALUES_LEXICAL[onTestValue] + "\", expecting: \"" + TEST_VALUES_LEXICAL[onTestValue + 1] + "\"");
+            }
+
+            try {
+                Duration duration = datatypeFactory.newDurationYearMonth(TEST_VALUES_LEXICAL[onTestValue]);
+
+                if (DEBUG) {
+                    System.err.println("Duration created: \"" + duration.toString() + "\"");
+                }
+
+                // was this expected to fail?
+                if (TEST_VALUES_LEXICAL[onTestValue + 1].equals(TEST_VALUE_FAIL)) {
+                    Assert.fail("the value \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" is invalid yet it created the Duration \"" + duration.toString() + "\"");
+                }
+
+                // right XMLSchemaType?
+                // TODO: enable test, it should pass, it fails with Exception(s)
+                // for now due to a bug
+                try {
+                    QName xmlSchemaType = duration.getXMLSchemaType();
+                    if (!xmlSchemaType.equals(DatatypeConstants.DURATION_YEARMONTH)) {
+                        Assert.fail("Duration created with XMLSchemaType of\"" + xmlSchemaType + "\" was expected to be \""
+                                + DatatypeConstants.DURATION_YEARMONTH + "\" and has the value \"" + duration.toString() + "\"");
+                    }
+                } catch (IllegalStateException illegalStateException) {
+                    // TODO; this test really should pass
+                    System.err.println("Please fix this bug that is being ignored, for now: " + illegalStateException.getMessage());
+                }
+
+                // does it have the right value?
+                if (!TEST_VALUES_LEXICAL[onTestValue + 1].equals(duration.toString())) {
+                    Assert.fail("Duration created with \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" was expected to be \""
+                            + TEST_VALUES_LEXICAL[onTestValue + 1] + "\" and has the value \"" + duration.toString() + "\"");
+                }
+
+                // Duration created with correct value
+            } catch (Exception exception) {
+
+                if (DEBUG) {
+                    System.err.println("Exception in creating duration: \"" + exception.toString() + "\"");
+                }
+
+                // was this expected to succed?
+                if (!TEST_VALUES_LEXICAL[onTestValue + 1].equals(TEST_VALUE_FAIL)) {
+                    Assert.fail("the value \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" is valid yet it failed with \"" + exception.toString() + "\"");
+                }
+                // expected failure
+            }
+        }
+    }
+
+    /**
+     * Test {@link DatatypeFactory.newDurationYearMonth(long milliseconds)}.
+     *
+     */
+    @Test
+    public final void testNewDurationYearMonthMilliseconds() {
+
+        /**
+         * Millisecond test values to test.
+         */
+        final long[] TEST_VALUES_MILLISECONDS = { 0L, 1L, -1L, 2678400000L, // 31
+                                                                            // days,
+                                                                            // e.g.
+                                                                            // 1
+                                                                            // month
+                -2678400000L, 5270400000L, // 61 days, e.g. 2 months
+                -5270400000L, 31622400000L, // 366 days, e.g. 1 year
+                -31622400000L, 34300800000L, // 397 days, e.g. 1 year, 1 month
+                -34300800000L };
+
+        /**
+         * Millisecond test value results of test.
+         */
+        final String[] TEST_VALUES_MILLISECONDS_RESULTS = { "P0Y0M", "P0Y0M", "P0Y0M", "P0Y1M", "-P0Y1M", "P0Y2M", "-P0Y2M", "P1Y0M", "-P1Y0M", "P1Y1M",
+                "-P1Y1M" };
+
+        DatatypeFactory datatypeFactory = null;
+        try {
+            datatypeFactory = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException datatypeConfigurationException) {
+            Assert.fail(datatypeConfigurationException.toString());
+        }
+
+        if (DEBUG) {
+            System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+        }
+
+        // test each value
+        for (int onTestValue = 0; onTestValue < TEST_VALUES_MILLISECONDS.length; onTestValue++) {
+
+            if (DEBUG) {
+                System.err.println("testing value: \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\", expecting: \""
+                        + TEST_VALUES_MILLISECONDS_RESULTS[onTestValue] + "\"");
+            }
+
+            try {
+                Duration duration = datatypeFactory.newDurationYearMonth(TEST_VALUES_MILLISECONDS[onTestValue]);
+
+                if (DEBUG) {
+                    System.err.println("Duration created: \"" + duration.toString() + "\"");
+                }
+
+                // was this expected to fail?
+                if (TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(TEST_VALUE_FAIL)) {
+                    Assert.fail("the value \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" is invalid yet it created the Duration \"" + duration.toString()
+                            + "\"");
+                }
+
+                // right XMLSchemaType?
+                QName xmlSchemaType = duration.getXMLSchemaType();
+                if (!xmlSchemaType.equals(DatatypeConstants.DURATION_YEARMONTH)) {
+                    Assert.fail("Duration created with XMLSchemaType of\"" + xmlSchemaType + "\" was expected to be \"" + DatatypeConstants.DURATION_YEARMONTH
+                            + "\" and has the value \"" + duration.toString() + "\"");
+                }
+
+                // does it have the right value?
+                if (!TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(duration.toString())) {
+                    Assert.fail("Duration created with \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" was expected to be \""
+                            + TEST_VALUES_MILLISECONDS_RESULTS[onTestValue] + "\" and has the value \"" + duration.toString() + "\"");
+                }
+
+                // only YEAR & MONTH should have values
+                int days = duration.getDays();
+                int hours = duration.getHours();
+                int minutes = duration.getMinutes();
+                if (days != 0 || hours != 0 || minutes != 0) {
+                    Assert.fail("xdt:yearMonthDuration created without discarding remaining milliseconds: " + " days = " + days + ", hours = " + hours
+                            + ", minutess = " + minutes);
+                }
+
+                // Duration created with correct values
+            } catch (Exception exception) {
+
+                if (DEBUG) {
+                    System.err.println("Exception in creating duration: \"" + exception.toString() + "\"");
+                }
+
+                // was this expected to succed?
+                if (!TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(TEST_VALUE_FAIL)) {
+                    Assert.fail("the value \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" is valid yet it failed with \"" + exception.toString() + "\"");
+                }
+                // expected failure
+            }
+        }
+    }
+
+    /**
+     * Test {@link DatatypeFactory.newDurationDayTime(long milliseconds)}.
+     */
+    @Test
+    public final void testNewDurationDayTime() {
+
+        /**
+         * Millisecond test values to test.
+         */
+        final long[] TEST_VALUES_MILLISECONDS = { 0L, 1L, -1L, 2678400000L, // 31
+                                                                            // days,
+                                                                            // e.g.
+                                                                            // 1
+                                                                            // month
+                -2678400000L, 5270400000L, // 61 days, e.g. 2 months
+                -5270400000L, 31622400000L, // 366 days, e.g. 1 year
+                -31622400000L, 34300800000L, // 397 days, e.g. 1 year, 1 month
+                -34300800000L };
+
+        /**
+         * Millisecond test value results of test.
+         */
+        final String[] TEST_VALUES_MILLISECONDS_RESULTS = { "P0Y0M0DT0H0M0.000S", "P0Y0M0DT0H0M0.001S", "-P0Y0M0DT0H0M0.001S", "P0Y1M", "-P0Y1M", "P0Y2M",
+                "-P0Y2M", "P1Y0M", "-P1Y0M", "P1Y1M", "-P1Y1M" };
+
+        DatatypeFactory datatypeFactory = null;
+        try {
+            datatypeFactory = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException datatypeConfigurationException) {
+            Assert.fail(datatypeConfigurationException.toString());
+        }
+
+        if (DEBUG) {
+            System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+        }
+
+        // test each value
+        for (int onTestValue = 0; onTestValue < TEST_VALUES_MILLISECONDS.length; onTestValue++) {
+
+            if (DEBUG) {
+                System.err.println("testing value: \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\", expecting: \""
+                        + TEST_VALUES_MILLISECONDS_RESULTS[onTestValue] + "\"");
+            }
+
+            try {
+                Duration duration = datatypeFactory.newDurationDayTime(TEST_VALUES_MILLISECONDS[onTestValue]);
+
+                if (DEBUG) {
+                    System.err.println("Duration created: \"" + duration.toString() + "\"");
+                }
+
+                // was this expected to fail?
+                if (TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(TEST_VALUE_FAIL)) {
+                    Assert.fail("the value \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" is invalid yet it created the Duration \"" + duration.toString()
+                            + "\"");
+                }
+
+                // does it have the right value?
+                if (!TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(duration.toString())) {
+                    // TODO: this is bug that should be fixed
+                    if (false) {
+                        Assert.fail("Duration created with \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" was expected to be \""
+                                + TEST_VALUES_MILLISECONDS_RESULTS[onTestValue] + "\" and has the value \"" + duration.toString() + "\"");
+                    } else {
+                        System.err.println("Please fix this bug: " + "Duration created with \"" + TEST_VALUES_MILLISECONDS[onTestValue]
+                                + "\" was expected to be \"" + TEST_VALUES_MILLISECONDS_RESULTS[onTestValue] + "\" and has the value \"" + duration.toString()
+                                + "\"");
+                    }
+                }
+
+                // only day, hour, minute, and second should have values
+                QName xmlSchemaType = duration.getXMLSchemaType();
+                int years = duration.getYears();
+                int months = duration.getMonths();
+
+                if (!xmlSchemaType.equals(DatatypeConstants.DURATION_DAYTIME) || years != 0 || months != 0) {
+                    // TODO: this is bug that should be fixed
+                    if (false) {
+                        Assert.fail("xdt:dayTimeDuration created without discarding remaining milliseconds: " + " XMLSchemaType = " + xmlSchemaType
+                                + ", years = " + years + ", months = " + months);
+                    } else {
+                        System.err.println("Please fix this bug: " + "xdt:dayTimeDuration created without discarding remaining milliseconds: "
+                                + " XMLSchemaType = " + xmlSchemaType + ", years = " + years + ", months = " + months);
+                    }
+                }
+
+                // Duration created with correct values
+            } catch (Exception exception) {
+
+                if (DEBUG) {
+                    System.err.println("Exception in creating duration: \"" + exception.toString() + "\"");
+                }
+
+                // was this expected to succed?
+                if (!TEST_VALUES_MILLISECONDS_RESULTS[onTestValue].equals(TEST_VALUE_FAIL)) {
+                    Assert.fail("the value \"" + TEST_VALUES_MILLISECONDS[onTestValue] + "\" is valid yet it failed with \"" + exception.toString() + "\"");
+                }
+                // expected failure
+            }
+        }
+    }
+
+    /**
+     * Test {@link DatatypeFactory.newXMLGregorianCalendar(String
+     * lexicalRepresentation)}.
+     */
+    @Test
+    public final void testNewXMLGregorianCalendarLexicalRepresentation() {
+
+        /**
+         * Lexical test values to test.
+         */
+        final String[] TEST_VALUES_LEXICAL = { null, TEST_VALUE_FAIL, "", TEST_VALUE_FAIL, "---01", "---01", // gDay
+                "---01Z", "---01Z", // gDay, UTC
+                "---01-08:00", "---01-08:00", // gDay, PDT
+                "--01--", TEST_VALUE_FAIL, // gMonth pre errata, --MM--(z?)
+                "--01", "--01", // gMonth
+                "--01Z", "--01Z", // gMonth, UTC
+                "--01-08:00", "--01-08:00", // gMonth, PDT
+                "--01-01", "--01-01", // gMonthDay
+                "--01-01Z", "--01-01Z", // gMonthDay, UTC
+                "--01-01-08:00", "--01-01-08:00" // gMonthDay, PDT
+        };
+
+        // get a DatatypeFactory
+        DatatypeFactory datatypeFactory = null;
+        try {
+            datatypeFactory = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException datatypeConfigurationException) {
+            Assert.fail(datatypeConfigurationException.toString());
+        }
+
+        if (DEBUG) {
+            System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+        }
+
+        // test each value
+        for (int onTestValue = 0; onTestValue < TEST_VALUES_LEXICAL.length; onTestValue = onTestValue + 2) {
+
+            if (DEBUG) {
+                System.err.println("testing value: \"" + TEST_VALUES_LEXICAL[onTestValue] + "\", expecting: \"" + TEST_VALUES_LEXICAL[onTestValue + 1] + "\"");
+            }
+
+            try {
+                XMLGregorianCalendar xmlGregorianCalendar = datatypeFactory.newXMLGregorianCalendar(TEST_VALUES_LEXICAL[onTestValue]);
+
+                if (DEBUG) {
+                    System.err.println("XMLGregorianCalendar created: \"" + xmlGregorianCalendar.toString() + "\"");
+                }
+
+                // was this expected to fail?
+                if (TEST_VALUES_LEXICAL[onTestValue + 1].equals(TEST_VALUE_FAIL)) {
+                    Assert.fail("the value \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" is invalid yet it created the XMLGregorianCalendar \""
+                            + xmlGregorianCalendar.toString() + "\"");
+                }
+
+                // does it have the right value?
+                if (!TEST_VALUES_LEXICAL[onTestValue + 1].equals(xmlGregorianCalendar.toString())) {
+                    Assert.fail("XMLGregorianCalendar created with \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" was expected to be \""
+                            + TEST_VALUES_LEXICAL[onTestValue + 1] + "\" and has the value \"" + xmlGregorianCalendar.toString() + "\"");
+                }
+
+                // XMLGregorianCalendar created with correct value
+            } catch (Exception exception) {
+
+                if (DEBUG) {
+                    System.err.println("Exception in creating XMLGregorianCalendar: \"" + exception.toString() + "\"");
+                }
+
+                // was this expected to succed?
+                if (!TEST_VALUES_LEXICAL[onTestValue + 1].equals(TEST_VALUE_FAIL)) {
+                    Assert.fail("the value \"" + TEST_VALUES_LEXICAL[onTestValue] + "\" is valid yet it failed with \"" + exception.toString() + "\"");
+                }
+                // expected failure
+            }
+        }
+    }
+
+    /**
+     * Test {@link DatatypeFactory.newXMLGregorianCalendar( BigInteger year, int
+     * month, int day, int hour, int minute, int second, BigDecimal
+     * fractionalSecond, int timezone)} and
+     * DatatypeFactory.newXMLGregorianCalendar( int year, int month, int day,
+     * int hour, int minute, int second, int fractionalSecond, int timezone)} .
+     */
+    @Test
+    public final void testNewXMLGregorianCalendarYearMonthDayHourMinuteSecondFractionalSecondTimezone() {
+
+        final String[][] invalidDates = {
+                { "1970", "-1", "1", "0", "0", "0", "0", "0" },
+                { "1970", "0", "1", "0", "0", "0", "0", "0" },
+                { "1970", "13", "1", "0", "0", "0", "0", "0" },
+                { "1970", "1", "-1", "0", "0", "0", "0", "0" },
+                { "1970", "1", "0", "0", "0", "0", "0", "0" },
+                { "1970", "1", "32", "0", "0", "0", "0", "0" },
+                { "1970", "1", "1", "-1", "0", "0", "0", "0" },
+                // valid per Schema Errata:
+                // http://www.w3.org/2001/05/xmlschema-errata#e2-45
+                // {"1970", "1", "1", "24", "0", "0", "0", "0" }
+                // put in a repeat value to preserve offsets & TCK tests
+                { "1970", "1", "1", "0", "-1", "0", "0", "0" }, { "1970", "1", "1", "0", "-1", "0", "0", "0" }, { "1970", "1", "1", "0", "60", "0", "0", "0" },
+                { "1970", "1", "1", "0", "0", "-1", "0", "0" }, { "1970", "1", "1", "0", "0", "61", "0", "0" },
+                { "1970", "1", "1", "0", "0", "0", "-0.000001", "0" }, { "1970", "1", "1", "0", "0", "0", "1.0001", "0" },
+                { "1970", "1", "1", "0", "0", "0", "0", "841" }, { "1970", "1", "1", "0", "0", "0", "0", "-841" }, };
+
+        // get a DatatypeFactory
+        DatatypeFactory datatypeFactory = null;
+        try {
+            datatypeFactory = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException datatypeConfigurationException) {
+            Assert.fail(datatypeConfigurationException.toString());
+        }
+
+        if (DEBUG) {
+            System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+        }
+
+        // test values, expect failure
+        for (int valueIndex = 0; valueIndex < invalidDates.length; ++valueIndex) {
+
+            try {
+
+                if (DEBUG) {
+                    System.err.println("testing DatatypeFactory.newXMLGregorianCalendar(" + invalidDates[valueIndex][0] + ", " + invalidDates[valueIndex][1]
+                            + ", " + invalidDates[valueIndex][2] + ", " + invalidDates[valueIndex][3] + ", " + invalidDates[valueIndex][4] + ", "
+                            + invalidDates[valueIndex][5] + ", " + invalidDates[valueIndex][6] + ", " + invalidDates[valueIndex][7] + ")");
+                }
+
+                XMLGregorianCalendar xmlGregorianCalendar = datatypeFactory.newXMLGregorianCalendar(parseBigInteger(invalidDates[valueIndex][0]),
+                        parseInt(invalidDates[valueIndex][1]), parseInt(invalidDates[valueIndex][2]), parseInt(invalidDates[valueIndex][3]),
+                        parseInt(invalidDates[valueIndex][4]), parseInt(invalidDates[valueIndex][5]), parseBigDecimal(invalidDates[valueIndex][6]),
+                        parseInt(invalidDates[valueIndex][7]));
+
+                if (DEBUG) {
+                    System.err.println("created XMLGregorianCalendar: " + xmlGregorianCalendar.toString());
+                }
+
+                // unexpected success, should have failed
+                Assert.fail("expected IllegalArgumentException " + "for DatatypeFactory.newXMLGregorianCalendar(" + invalidDates[valueIndex][0] + ", "
+                        + invalidDates[valueIndex][1] + ", " + invalidDates[valueIndex][2] + ", " + invalidDates[valueIndex][3] + ", "
+                        + invalidDates[valueIndex][4] + ", " + invalidDates[valueIndex][5] + ", " + invalidDates[valueIndex][6] + ", "
+                        + invalidDates[valueIndex][7] + ").  " + "Instead, XMLGregorianCalendar: \"" + xmlGregorianCalendar.toString() + "\" was created.");
+            } catch (IllegalArgumentException illegalArgumentException) {
+                // expected failure
+                if (DEBUG) {
+                    System.err.println("Exception creating XMLGregorianCalendar: " + illegalArgumentException.toString());
+                }
+            }
+        }
+
+        // test with all ints
+        int[] testIndex = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 14, 15, };
+        for (int i = 0; i < testIndex.length; ++i) {
+            int valueIndex = testIndex[i];
+            try {
+                if (DEBUG) {
+                    System.err.println("testing DatatypeFactory.newXMLGregorianCalendar(" + invalidDates[valueIndex][0] + ", " + invalidDates[valueIndex][1]
+                            + ", " + invalidDates[valueIndex][2] + ", " + invalidDates[valueIndex][3] + ", " + invalidDates[valueIndex][4] + ", "
+                            + invalidDates[valueIndex][5] + ", " + invalidDates[valueIndex][6] + ", " + invalidDates[valueIndex][7] + ")");
+                }
+
+                XMLGregorianCalendar xmlGregorianCalendar = datatypeFactory.newXMLGregorianCalendar(parseInt(invalidDates[valueIndex][0]),
+                        parseInt(invalidDates[valueIndex][1]), parseInt(invalidDates[valueIndex][2]), parseInt(invalidDates[valueIndex][3]),
+                        parseInt(invalidDates[valueIndex][4]), parseInt(invalidDates[valueIndex][5]), parseInt(invalidDates[valueIndex][6]),
+                        parseInt(invalidDates[valueIndex][7]));
+
+                if (DEBUG) {
+                    System.err.println("created XMLGregorianCalendar: " + xmlGregorianCalendar.toString());
+                }
+
+                // unexpected success, should have failed
+                Assert.fail("expected IllegalArgumentException " + "for DatatypeFactory.newXMLGregorianCalendar(" + invalidDates[valueIndex][0] + ", "
+                        + invalidDates[valueIndex][1] + ", " + invalidDates[valueIndex][2] + ", " + invalidDates[valueIndex][3] + ", "
+                        + invalidDates[valueIndex][4] + ", " + invalidDates[valueIndex][5] + ", " + invalidDates[valueIndex][6] + ", "
+                        + invalidDates[valueIndex][7] + ").  " + "Instead, XMLGregorianCalendar: \"" + xmlGregorianCalendar.toString() + "\" was created.");
+            } catch (IllegalArgumentException illegalArgumentException) {
+                // expected failure
+                if (DEBUG) {
+                    System.err.println("Exception creating XMLGregorianCalendar: " + illegalArgumentException.toString());
+                }
+            }
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/DurationTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/DurationTest.java
new file mode 100644
index 00000000000..f97536c8765
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/DurationTest.java
@@ -0,0 +1,476 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.datatype;
+
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.GregorianCalendar;
+import java.util.TimeZone;
+
+import javax.xml.namespace.QName;
+
+import org.testng.Assert;
+import org.testng.AssertJUnit;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test Duration.
+ */
+public class DurationTest {
+
+    private final static boolean DEBUG = true;
+
+    protected Duration duration = null;
+
+    @BeforeMethod
+    protected void setUp() {
+        try {
+            duration = DatatypeFactory.newInstance().newDuration(100);
+        } catch (DatatypeConfigurationException dce) {
+            dce.printStackTrace();
+            Assert.fail("Failed to create instance of DatatypeFactory " + dce.getMessage());
+        }
+    }
+
+    @Test
+    public void testDurationSubtract() {
+        try {
+            Duration bigDur = DatatypeFactory.newInstance().newDuration(20000);
+            Duration smallDur = DatatypeFactory.newInstance().newDuration(10000);
+            if (smallDur.subtract(bigDur).getSign() != -1) {
+                Assert.fail("smallDur.subtract(bigDur).getSign() is not -1");
+            }
+            if (bigDur.subtract(smallDur).getSign() != 1) {
+                Assert.fail("bigDur.subtract(smallDur).getSign() is not 1");
+            }
+            if (smallDur.subtract(smallDur).getSign() != 0) {
+                Assert.fail("smallDur.subtract(smallDur).getSign() is not 0");
+            }
+        } catch (DatatypeConfigurationException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testDurationMultiply() {
+        int num = 5000; // millisends. 5 seconds
+        int factor = 2;
+        try {
+            Duration dur = DatatypeFactory.newInstance().newDuration(num);
+            if (dur.multiply(factor).getSeconds() != 10) {
+                Assert.fail("duration.multiply() return wrong value");
+            }
+            // factor is 2*10^(-1)
+            if (dur.multiply(new BigDecimal(new BigInteger("2"), 1)).getSeconds() != 1) {
+                Assert.fail("duration.multiply() return wrong value");
+            }
+            if (dur.subtract(DatatypeFactory.newInstance().newDuration(1000)).multiply(new BigDecimal(new BigInteger("2"), 1)).getSeconds() != 0) {
+                Assert.fail("duration.multiply() return wrong value");
+            }
+        } catch (DatatypeConfigurationException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testDurationAndCalendar1() {
+        int year = 1;
+        int month = 2;
+        int day = 3;
+        int hour = 4;
+        int min = 5;
+        int sec = 6;
+        String lexicalRepresentation = "P" + year + "Y" + month + "M" + day + "DT" + hour + "H" + min + "M" + sec + "S";
+        try {
+            Duration dur = DatatypeFactory.newInstance().newDuration(lexicalRepresentation);
+            System.out.println(dur.toString());
+            AssertJUnit.assertTrue("year should be 1", dur.getYears() == year);
+            AssertJUnit.assertTrue("month should be 2", dur.getMonths() == month);
+            AssertJUnit.assertTrue("day should be 3", dur.getDays() == day);
+            AssertJUnit.assertTrue("hour should be 4", dur.getHours() == hour);
+            AssertJUnit.assertTrue("minute should be 5", dur.getMinutes() == min);
+            AssertJUnit.assertTrue("second should be 6", dur.getSeconds() == sec);
+        } catch (DatatypeConfigurationException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testDurationAndCalendar2() {
+        try {
+            AssertJUnit.assertTrue("10.00099S means 10 sec since it will be rounded to zero", DatatypeFactory.newInstance().newDuration("PT10.00099S")
+                    .getTimeInMillis(new Date()) == 10000);
+            AssertJUnit.assertTrue("10.00099S means 10 sec since it will be rounded to zero", DatatypeFactory.newInstance().newDuration("-PT10.00099S")
+                    .getTimeInMillis(new Date()) == -10000);
+            AssertJUnit.assertTrue("10.00099S means 10 sec since it will be rounded to zero", DatatypeFactory.newInstance().newDuration("PT10.00099S")
+                    .getTimeInMillis(new GregorianCalendar()) == 10000);
+            AssertJUnit.assertTrue("10.00099S means 10 sec since it will be rounded to zero", DatatypeFactory.newInstance().newDuration("-PT10.00099S")
+                    .getTimeInMillis(new GregorianCalendar()) == -10000);
+        } catch (DatatypeConfigurationException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testDurationAndCalendar3() {
+        try {
+            Calendar cal = new GregorianCalendar();
+            cal.set(Calendar.SECOND, 59);
+            DatatypeFactory.newInstance().newDuration(10000).addTo(cal);
+            AssertJUnit.assertTrue("sec will be 9", cal.get(Calendar.SECOND) == 9);
+
+            Date date = new Date();
+            date.setSeconds(59);
+            DatatypeFactory.newInstance().newDuration(10000).addTo(date);
+            AssertJUnit.assertTrue("sec will be 9", date.getSeconds() == 9);
+        } catch (DatatypeConfigurationException e) {
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testEqualsWithDifferentObjectParam() {
+
+        AssertJUnit.assertFalse("equals method should return false for any object other than Duration", duration.equals(new Integer(0)));
+    }
+
+    @Test
+    public void testEqualsWithNullObjectParam() {
+
+        AssertJUnit.assertFalse("equals method should return false for null parameter", duration.equals(null));
+    }
+
+    @Test
+    public void testEqualsWithEqualObjectParam() {
+        try {
+            AssertJUnit.assertTrue("equals method is expected to return true", duration.equals(DatatypeFactory.newInstance().newDuration(100)));
+        } catch (DatatypeConfigurationException dce) {
+            dce.printStackTrace();
+            Assert.fail("Failed to create instance of DatatypeFactory " + dce.getMessage());
+        }
+    }
+
+    /**
+     * Inspired by CR 5077522 Duration.compare makes mistakes for some values.
+     */
+    @Test
+    public void testCompareWithInderterminateRelation() {
+
+        final String[][] partialOrder = { // partialOrder
+        { "P1Y", "<>", "P365D" }, { "P1Y", "<>", "P366D" }, { "P1M", "<>", "P28D" }, { "P1M", "<>", "P29D" }, { "P1M", "<>", "P30D" }, { "P1M", "<>", "P31D" },
+                { "P5M", "<>", "P150D" }, { "P5M", "<>", "P151D" }, { "P5M", "<>", "P152D" }, { "P5M", "<>", "P153D" }, { "PT2419200S", "<>", "P1M" },
+                { "PT2678400S", "<>", "P1M" }, { "PT31536000S", "<>", "P1Y" }, { "PT31622400S", "<>", "P1Y" }, { "PT525600M", "<>", "P1Y" },
+                { "PT527040M", "<>", "P1Y" }, { "PT8760H", "<>", "P1Y" }, { "PT8784H", "<>", "P1Y" }, { "P365D", "<>", "P1Y" }, };
+
+        DatatypeFactory df = null;
+        try {
+            df = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException ex) {
+            ex.printStackTrace();
+            Assert.fail(ex.toString());
+        }
+
+        boolean compareErrors = false;
+
+        for (int valueIndex = 0; valueIndex < partialOrder.length; ++valueIndex) {
+            Duration duration1 = df.newDuration(partialOrder[valueIndex][0]);
+            Duration duration2 = df.newDuration(partialOrder[valueIndex][2]);
+            int cmp = duration1.compare(duration2);
+            int expected = ">".equals(partialOrder[valueIndex][1]) ? DatatypeConstants.GREATER
+                    : "<".equals(partialOrder[valueIndex][1]) ? DatatypeConstants.LESSER : "==".equals(partialOrder[valueIndex][1]) ? DatatypeConstants.EQUAL
+                            : DatatypeConstants.INDETERMINATE;
+
+            // just note any errors, do not fail until all cases have been
+            // tested
+            if (expected != cmp) {
+                compareErrors = true;
+                System.err.println("returned " + cmp2str(cmp) + " for durations \'" + duration1 + "\' and " + duration2 + "\', but expected "
+                        + cmp2str(expected));
+            }
+        }
+
+        if (compareErrors) {
+            // TODO; fix bug, these tests should pass
+            if (false) {
+                Assert.fail("Errors in comparing indeterminate relations, see Stderr");
+            } else {
+                System.err.println("Please fix this bug: " + "Errors in comparing indeterminate relations, see Stderr");
+            }
+        }
+    }
+
+    public static String cmp2str(int cmp) {
+        return cmp == DatatypeConstants.LESSER ? "LESSER" : cmp == DatatypeConstants.GREATER ? "GREATER" : cmp == DatatypeConstants.EQUAL ? "EQUAL"
+                : cmp == DatatypeConstants.INDETERMINATE ? "INDETERMINATE" : "UNDEFINED";
+    }
+
+    /**
+     * Inspired by CR 6238220 javax.xml.datatype.Duration has no clear
+     * description concerning return values range.
+     */
+    @Test
+    public void testNormalizedReturnValues() throws Exception {
+
+        final Object[] TEST_VALUES = {
+                // test 61 seconds -> 1 minute, 1 second
+                true, // isPositive,
+                BigInteger.ZERO, // years,
+                BigInteger.ZERO, // months
+                BigInteger.ZERO, // days
+                BigInteger.ZERO, // hours
+                BigInteger.ZERO, // minutes
+                new BigDecimal(61), // seconds
+                61000L, // durationInMilliSeconds,
+                "P0Y0M0DT0H0M61S", // lexicalRepresentation
+
+                // test - 61 seconds -> - 1 minute, 1 second
+                false, // isPositive,
+                BigInteger.ZERO, // years,
+                BigInteger.ZERO, // months
+                BigInteger.ZERO, // days
+                BigInteger.ZERO, // hours
+                BigInteger.ZERO, // minutes
+                new BigDecimal(61), // seconds
+                61000L, // durationInMilliSeconds,
+                "-P0Y0M0DT0H0M61S", // lexicalRepresentation
+        };
+
+        final Object[] NORM_VALUES = {
+                // test 61 seconds -> 1 minute, 1 second
+                true, // normalized isPositive,
+                BigInteger.ZERO, // normalized years,
+                BigInteger.ZERO, // normalized months
+                BigInteger.ZERO, // normalized days
+                BigInteger.ZERO, // normalized hours
+                BigInteger.ONE, // normalized minutes
+                BigDecimal.ONE, // normalized seconds
+                61000L, // normalized durationInMilliSeconds,
+                "P0Y0M0DT0H1M1.000S", // normalized lexicalRepresentation
+
+                // test - 61 seconds -> - 1 minute, 1 second
+                false, // normalized isPositive,
+                BigInteger.ZERO, // normalized years,
+                BigInteger.ZERO, // normalized months
+                BigInteger.ZERO, // normalized days
+                BigInteger.ZERO, // normalized hours
+                BigInteger.ONE, // normalized minutes
+                BigDecimal.ONE, // normalized seconds
+                61000L, // normalized durationInMilliSeconds,
+                "-P0Y0M0DT0H1M1.000S" // normalized lexicalRepresentation
+        };
+
+        for (int onValue = 0; onValue < TEST_VALUES.length; onValue += 9) {
+            newDurationTester(((Boolean) TEST_VALUES[onValue]).booleanValue(), // isPositive,
+                    ((Boolean) NORM_VALUES[onValue]).booleanValue(), // normalized
+                                                                     // isPositive,
+                    (BigInteger) TEST_VALUES[onValue + 1], // years,
+                    (BigInteger) NORM_VALUES[onValue + 1], // normalized years,
+                    (BigInteger) TEST_VALUES[onValue + 2], // months
+                    (BigInteger) NORM_VALUES[onValue + 2], // normalized months
+                    (BigInteger) TEST_VALUES[onValue + 3], // days
+                    (BigInteger) NORM_VALUES[onValue + 3], // normalized days
+                    (BigInteger) TEST_VALUES[onValue + 4], // hours
+                    (BigInteger) NORM_VALUES[onValue + 4], // normalized hours
+                    (BigInteger) TEST_VALUES[onValue + 5], // minutes
+                    (BigInteger) NORM_VALUES[onValue + 5], // normalized minutes
+                    (BigDecimal) TEST_VALUES[onValue + 6], // seconds
+                    (BigDecimal) NORM_VALUES[onValue + 6], // normalized seconds
+                    ((Long) TEST_VALUES[onValue + 7]).longValue(), // durationInMilliSeconds,
+                    ((Long) NORM_VALUES[onValue + 7]).longValue(), // normalized
+                                                                   // durationInMilliSeconds,
+                    (String) TEST_VALUES[onValue + 8], // lexicalRepresentation
+                    (String) NORM_VALUES[onValue + 8]); // normalized
+                                                        // lexicalRepresentation
+
+            newDurationDayTimeTester(((Boolean) TEST_VALUES[onValue]).booleanValue(), // isPositive,
+                    ((Boolean) NORM_VALUES[onValue]).booleanValue(), // normalized
+                                                                     // isPositive,
+                    BigInteger.ZERO, // years,
+                    BigInteger.ZERO, // normalized years,
+                    BigInteger.ZERO, // months
+                    BigInteger.ZERO, // normalized months
+                    (BigInteger) TEST_VALUES[onValue + 3], // days
+                    (BigInteger) NORM_VALUES[onValue + 3], // normalized days
+                    (BigInteger) TEST_VALUES[onValue + 4], // hours
+                    (BigInteger) NORM_VALUES[onValue + 4], // normalized hours
+                    (BigInteger) TEST_VALUES[onValue + 5], // minutes
+                    (BigInteger) NORM_VALUES[onValue + 5], // normalized minutes
+                    (BigDecimal) TEST_VALUES[onValue + 6], // seconds
+                    (BigDecimal) NORM_VALUES[onValue + 6], // normalized seconds
+                    ((Long) TEST_VALUES[onValue + 7]).longValue(), // durationInMilliSeconds,
+                    ((Long) NORM_VALUES[onValue + 7]).longValue(), // normalized
+                                                                   // durationInMilliSeconds,
+                    (String) TEST_VALUES[onValue + 8], // lexicalRepresentation
+                    (String) NORM_VALUES[onValue + 8]); // normalized
+                                                        // lexicalRepresentation
+        }
+    }
+
+    private void newDurationTester(boolean isPositive, boolean normalizedIsPositive, BigInteger years, BigInteger normalizedYears, BigInteger months,
+            BigInteger normalizedMonths, BigInteger days, BigInteger normalizedDays, BigInteger hours, BigInteger normalizedHours, BigInteger minutes,
+            BigInteger normalizedMinutes, BigDecimal seconds, BigDecimal normalizedSeconds, long durationInMilliSeconds, long normalizedDurationInMilliSeconds,
+            String lexicalRepresentation, String normalizedLexicalRepresentation) {
+
+        DatatypeFactory datatypeFactory = null;
+        try {
+            datatypeFactory = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException ex) {
+            ex.printStackTrace();
+            Assert.fail(ex.toString());
+        }
+
+        // create 4 Durations using the 4 different constructors
+
+        Duration durationBigInteger = datatypeFactory.newDuration(isPositive, years, months, days, hours, minutes, seconds);
+        durationAssertEquals(durationBigInteger, DatatypeConstants.DURATION, normalizedIsPositive, normalizedYears.intValue(), normalizedMonths.intValue(),
+                normalizedDays.intValue(), normalizedHours.intValue(), normalizedMinutes.intValue(), normalizedSeconds.intValue(),
+                normalizedDurationInMilliSeconds, normalizedLexicalRepresentation);
+
+        Duration durationInt = datatypeFactory.newDuration(isPositive, years.intValue(), months.intValue(), days.intValue(), hours.intValue(),
+                minutes.intValue(), seconds.intValue());
+        durationAssertEquals(durationInt, DatatypeConstants.DURATION, normalizedIsPositive, normalizedYears.intValue(), normalizedMonths.intValue(),
+                normalizedDays.intValue(), normalizedHours.intValue(), normalizedMinutes.intValue(), normalizedSeconds.intValue(),
+                normalizedDurationInMilliSeconds, normalizedLexicalRepresentation);
+
+        Duration durationMilliseconds = datatypeFactory.newDuration(durationInMilliSeconds);
+        durationAssertEquals(durationMilliseconds, DatatypeConstants.DURATION, normalizedIsPositive, normalizedYears.intValue(), normalizedMonths.intValue(),
+                normalizedDays.intValue(), normalizedHours.intValue(), normalizedMinutes.intValue(), normalizedSeconds.intValue(),
+                normalizedDurationInMilliSeconds, normalizedLexicalRepresentation);
+
+        Duration durationLexical = datatypeFactory.newDuration(lexicalRepresentation);
+        durationAssertEquals(durationLexical, DatatypeConstants.DURATION, normalizedIsPositive, normalizedYears.intValue(), normalizedMonths.intValue(),
+                normalizedDays.intValue(), normalizedHours.intValue(), normalizedMinutes.intValue(), normalizedSeconds.intValue(),
+                normalizedDurationInMilliSeconds, normalizedLexicalRepresentation);
+    }
+
+    private void newDurationDayTimeTester(boolean isPositive, boolean normalizedIsPositive, BigInteger years, BigInteger normalizedYears, BigInteger months,
+            BigInteger normalizedMonths, BigInteger days, BigInteger normalizedDays, BigInteger hours, BigInteger normalizedHours, BigInteger minutes,
+            BigInteger normalizedMinutes, BigDecimal seconds, BigDecimal normalizedSeconds, long durationInMilliSeconds, long normalizedDurationInMilliSeconds,
+            String lexicalRepresentation, String normalizedLexicalRepresentation) {
+
+        DatatypeFactory datatypeFactory = null;
+        try {
+            datatypeFactory = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException ex) {
+            ex.printStackTrace();
+            Assert.fail(ex.toString());
+        }
+
+        // create 4 dayTime Durations using the 4 different constructors
+
+        Duration durationDayTimeBigInteger = datatypeFactory.newDurationDayTime(isPositive, days, hours, minutes, seconds.toBigInteger());
+        durationAssertEquals(durationDayTimeBigInteger, DatatypeConstants.DURATION_DAYTIME, normalizedIsPositive, normalizedYears.intValue(),
+                normalizedMonths.intValue(), normalizedDays.intValue(), normalizedHours.intValue(), normalizedMinutes.intValue(), normalizedSeconds.intValue(),
+                normalizedDurationInMilliSeconds, normalizedLexicalRepresentation);
+
+        /*
+         * Duration durationDayTimeInt = datatypeFactory.newDurationDayTime(
+         * isPositive, days.intValue(), hours.intValue(), minutes.intValue(),
+         * seconds.intValue()); Duration durationDayTimeMilliseconds =
+         * datatypeFactory.newDurationDayTime( durationInMilliSeconds); Duration
+         * durationDayTimeLexical = datatypeFactory.newDurationDayTime(
+         * lexicalRepresentation);
+         * Duration durationYearMonthBigInteger =
+         * datatypeFactory.newDurationYearMonth( isPositive, years, months);
+         * Duration durationYearMonthInt = datatypeFactory.newDurationYearMonth(
+         * isPositive, years.intValue(), months.intValue()); Duration
+         * durationYearMonthMilliseconds = datatypeFactory.newDurationYearMonth(
+         * durationInMilliSeconds); Duration durationYearMonthLexical =
+         * datatypeFactory.newDurationYearMonth( lexicalRepresentation) ;
+         */
+
+    }
+
+    private void durationAssertEquals(Duration duration, QName xmlSchemaType, boolean isPositive, int years, int months, int days, int hours, int minutes,
+            int seconds, long milliseconds, String lexical) {
+
+        final TimeZone GMT = TimeZone.getTimeZone("GMT");
+        final GregorianCalendar EPOCH = new GregorianCalendar(GMT);
+        EPOCH.clear();
+
+        if (DEBUG) {
+            System.out.println("Testing Duration: " + duration.toString());
+        }
+
+        // sign
+        if (DEBUG) {
+            boolean actual = (duration.getSign() == 1) ? true : false;
+            System.out.println("sign:");
+            System.out.println("    expected: \"" + isPositive + "\"");
+            System.out.println("    actual:   \"" + actual + "\"");
+        }
+
+        if (DEBUG) {
+            System.out.println("years:");
+            System.out.println("    expected: \"" + years + "\"");
+            System.out.println("    actual:   \"" + duration.getYears() + "\"");
+        }
+
+        if (DEBUG) {
+            System.out.println("months:");
+            System.out.println("    expected: \"" + months + "\"");
+            System.out.println("    actual:   \"" + duration.getMonths() + "\"");
+        }
+
+        if (DEBUG) {
+            System.out.println("days:");
+            System.out.println("    expected: \"" + days + "\"");
+            System.out.println("    actual:   \"" + duration.getDays() + "\"");
+        }
+
+        if (DEBUG) {
+            System.out.println("hours:");
+            System.out.println("    expected: \"" + hours + "\"");
+            System.out.println("    actual:   \"" + duration.getHours() + "\"");
+        }
+
+        if (DEBUG) {
+            System.out.println("minutes:");
+            System.out.println("    expected: \"" + minutes + "\"");
+            System.out.println("    actual:   \"" + duration.getMinutes() + "\"");
+        }
+
+        if (DEBUG) {
+            System.out.println("seconds:");
+            System.out.println("    expected: \"" + seconds + "\"");
+            System.out.println("    actual:   \"" + duration.getSeconds() + "\"");
+        }
+
+        if (DEBUG) {
+            System.out.println("milliseconds:");
+            System.out.println("    expected: \"" + milliseconds + "\"");
+            System.out.println("    actual:   \"" + duration.getTimeInMillis(EPOCH) + "\"");
+        }
+
+        if (DEBUG) {
+            System.out.println("lexical:");
+            System.out.println("    expected: \"" + lexical + "\"");
+            System.out.println("    actual:   \"" + duration.toString() + "\"");
+        }
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/FactoryFindTest.java
new file mode 100644
index 00000000000..e9e84bd61a3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/FactoryFindTest.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.datatype;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test Classloader for DatatypeFactory.
+ */
+public class FactoryFindTest {
+
+    boolean myClassLoaderUsed = false;
+
+    public FactoryFindTest(String name) {
+    }
+
+    @Test
+    public void testFactoryFind() {
+        try {
+            // System.setProperty("jaxp.debug", "true");
+
+            DatatypeFactory factory = DatatypeFactory.newInstance();
+            Assert.assertTrue(factory.getClass().getClassLoader() == null);
+
+            Thread.currentThread().setContextClassLoader(null);
+            factory = DatatypeFactory.newInstance();
+            Assert.assertTrue(factory.getClass().getClassLoader() == null);
+
+            Thread.currentThread().setContextClassLoader(new MyClassLoader());
+            factory = DatatypeFactory.newInstance();
+            if (System.getSecurityManager() == null)
+                Assert.assertTrue(myClassLoaderUsed);
+            else
+                Assert.assertFalse(myClassLoaderUsed);
+        } catch (Exception ex) {
+        }
+
+    }
+
+    class MyClassLoader extends URLClassLoader {
+
+        public MyClassLoader() {
+            super(new URL[0]);
+        }
+
+        public Class loadClass(String name) throws ClassNotFoundException {
+            myClassLoaderUsed = true;
+            return super.loadClass(name);
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/XMLGregorianCalendarTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/XMLGregorianCalendarTest.java
new file mode 100644
index 00000000000..b842fd5a177
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/datatype/XMLGregorianCalendarTest.java
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.datatype;
+
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLGregorianCalendar.
+ */
+public class XMLGregorianCalendarTest {
+
+    private static final boolean DEBUG = false;
+
+    private static final int TEST_VALUE_FAIL = 0;
+
+    private static final int TEST_VALUE_PASS = 1;
+
+    private XMLGregorianCalendar calendar;
+
+    @BeforeMethod
+    protected void setUp() {
+        try {
+            calendar = DatatypeFactory.newInstance().newXMLGregorianCalendar();
+        } catch (DatatypeConfigurationException dce) {
+            dce.printStackTrace();
+            Assert.fail("Failed to create instance of DatatypeFactory " + dce.getMessage());
+        }
+    }
+
+    @Test
+    public final void testSetTime() {
+
+        /**
+         * Hour, minute, second values to test and expected result.
+         */
+        final int[] TEST_VALUES = { 24, 0, 0, TEST_VALUE_PASS, 24, 1, 0, TEST_VALUE_FAIL, 24, 0, 1, TEST_VALUE_FAIL, 24, DatatypeConstants.FIELD_UNDEFINED, 0,
+                TEST_VALUE_FAIL, 24, 0, DatatypeConstants.FIELD_UNDEFINED, TEST_VALUE_FAIL };
+
+        // create DatatypeFactory
+        DatatypeFactory datatypeFactory = null;
+        try {
+            datatypeFactory = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException datatypeConfigurationException) {
+            Assert.fail(datatypeConfigurationException.toString());
+        }
+
+        if (DEBUG) {
+            System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+        }
+
+        // create XMLGregorianCalendar
+        XMLGregorianCalendar xmlGregorianCalendar = datatypeFactory.newXMLGregorianCalendar();
+
+        // test each value
+        for (int onTestValue = 0; onTestValue < TEST_VALUES.length; onTestValue = onTestValue + 4) {
+
+            if (DEBUG) {
+                System.err.println("testing values: (" + TEST_VALUES[onTestValue] + ", " + TEST_VALUES[onTestValue + 1] + ", " + TEST_VALUES[onTestValue + 2]
+                        + ") expected (0=fail, 1=pass): " + TEST_VALUES[onTestValue + 3]);
+            }
+
+            try {
+                // set time
+                xmlGregorianCalendar.setTime(TEST_VALUES[onTestValue], TEST_VALUES[onTestValue + 1], TEST_VALUES[onTestValue + 2]);
+
+                if (DEBUG) {
+                    System.err.println("XMLGregorianCalendar created: \"" + xmlGregorianCalendar.toString() + "\"");
+                }
+
+                // was this expected to fail?
+                if (TEST_VALUES[onTestValue + 3] == TEST_VALUE_FAIL) {
+                    Assert.fail("the values: (" + TEST_VALUES[onTestValue] + ", " + TEST_VALUES[onTestValue + 1] + ", " + TEST_VALUES[onTestValue + 2]
+                            + ") are invalid, " + "yet it created the XMLGregorianCalendar \"" + xmlGregorianCalendar.toString() + "\"");
+                }
+            } catch (Exception exception) {
+
+                if (DEBUG) {
+                    System.err.println("Exception in creating XMLGregorianCalendar: \"" + exception.toString() + "\"");
+                }
+
+                // was this expected to succed?
+                if (TEST_VALUES[onTestValue + 3] == TEST_VALUE_PASS) {
+                    Assert.fail("the values: (" + TEST_VALUES[onTestValue] + ", " + TEST_VALUES[onTestValue + 1] + ", " + TEST_VALUES[onTestValue + 2]
+                            + ") are valid yet it failed with \"" + exception.toString() + "\"");
+                }
+                // expected failure
+            }
+        }
+    }
+
+    @Test
+    public final void testSetHour() {
+
+        /**
+         * Hour values to test and expected result.
+         */
+        final int[] TEST_VALUES = {
+                // setTime(H, M, S), hour override, expected result
+                0, 0, 0, 0, TEST_VALUE_PASS, 0, 0, 0, 23, TEST_VALUE_PASS, 0, 0, 0, 24, TEST_VALUE_PASS,
+                // creates invalid state
+                0, 0, 0, DatatypeConstants.FIELD_UNDEFINED, TEST_VALUE_FAIL,
+                // violates Schema Errata
+                0, 0, 1, 24, TEST_VALUE_FAIL };
+
+        // create DatatypeFactory
+        DatatypeFactory datatypeFactory = null;
+        try {
+            datatypeFactory = DatatypeFactory.newInstance();
+        } catch (DatatypeConfigurationException datatypeConfigurationException) {
+            Assert.fail(datatypeConfigurationException.toString());
+        }
+
+        if (DEBUG) {
+            System.err.println("DatatypeFactory created: " + datatypeFactory.toString());
+        }
+
+        // create XMLGregorianCalendar
+        XMLGregorianCalendar xmlGregorianCalendar = datatypeFactory.newXMLGregorianCalendar();
+
+        // test each value
+        for (int onTestValue = 0; onTestValue < TEST_VALUES.length; onTestValue = onTestValue + 5) {
+
+            if (DEBUG) {
+                System.err.println("testing values: (" + TEST_VALUES[onTestValue] + ", " + TEST_VALUES[onTestValue + 1] + ", " + TEST_VALUES[onTestValue + 2]
+                        + ", " + TEST_VALUES[onTestValue + 3] + ") expected (0=fail, 1=pass): " + TEST_VALUES[onTestValue + 4]);
+            }
+
+            try {
+                // set time to known valid value
+                xmlGregorianCalendar.setTime(TEST_VALUES[onTestValue], TEST_VALUES[onTestValue + 1], TEST_VALUES[onTestValue + 2]);
+                // now explicitly set hour
+                xmlGregorianCalendar.setHour(TEST_VALUES[onTestValue + 3]);
+
+                if (DEBUG) {
+                    System.err.println("XMLGregorianCalendar created: \"" + xmlGregorianCalendar.toString() + "\"");
+                }
+
+                // was this expected to fail?
+                if (TEST_VALUES[onTestValue + 4] == TEST_VALUE_FAIL) {
+                    Assert.fail("the values: (" + TEST_VALUES[onTestValue] + ", " + TEST_VALUES[onTestValue + 1] + ", " + TEST_VALUES[onTestValue + 2] + ", "
+                            + TEST_VALUES[onTestValue + 3] + ") are invalid, " + "yet it created the XMLGregorianCalendar \"" + xmlGregorianCalendar.toString()
+                            + "\"");
+                }
+            } catch (Exception exception) {
+
+                if (DEBUG) {
+                    System.err.println("Exception in creating XMLGregorianCalendar: \"" + exception.toString() + "\"");
+                }
+
+                // was this expected to succed?
+                if (TEST_VALUES[onTestValue + 4] == TEST_VALUE_PASS) {
+                    Assert.fail("the values: (" + TEST_VALUES[onTestValue] + ", " + TEST_VALUES[onTestValue + 1] + ", " + TEST_VALUES[onTestValue + 2] + ", "
+                            + TEST_VALUES[onTestValue + 3] + ") are valid yet it failed with \"" + exception.toString() + "\"");
+                }
+                // expected failure
+            }
+        }
+    }
+
+    @Test
+    public void testEqualsWithDifferentObjectParam() {
+
+        Assert.assertFalse(calendar.equals(new Integer(0)), "equals method should return false for any object other" + " than XMLGregorianCalendar");
+    }
+
+    @Test
+    public void testEqualsWithNullObjectParam() {
+
+        Assert.assertFalse(calendar.equals(null), "equals method should return false for null parameter");
+    }
+
+    @Test
+    public void testEqualsWithEqualObjectParam() {
+
+        try {
+            Assert.assertTrue(calendar.equals(DatatypeFactory.newInstance().newXMLGregorianCalendar()), "equals method is expected to return true");
+        } catch (DatatypeConfigurationException dce) {
+            dce.printStackTrace();
+            Assert.fail("Failed to create instance of DatatypeFactory " + dce.getMessage());
+        }
+    }
+
+    @Test
+    public void testToString() {
+        try {
+            String inputDateTime = "2006-10-23T22:15:01.000000135+08:00";
+            DatatypeFactory factory = DatatypeFactory.newInstance();
+            XMLGregorianCalendar calendar = factory.newXMLGregorianCalendar(inputDateTime);
+            String toStr = calendar.toString();
+            Assert.assertTrue(toStr.indexOf("E") == -1, "String value cannot contain exponent");
+        } catch (DatatypeConfigurationException dce) {
+            dce.printStackTrace();
+            Assert.fail("Failed to create instance of DatatypeFactory " + dce.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.java
new file mode 100644
index 00000000000..7978e5c7c15
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.File;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4674384
+ * @summary Test large maxOccurs.
+ */
+public class Bug4674384_MAX_OCCURS_Test {
+
+    @Test
+    public final void testLargeMaxOccurs() {
+
+        String XML_FILE_NAME = "Bug4674384_MAX_OCCURS_Test.xml";
+
+        try {
+            // create and initialize the parser
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            spf.setValidating(true);
+
+            SAXParser parser = spf.newSAXParser();
+            parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+
+            File xmlFile = new File(getClass().getResource(XML_FILE_NAME).getPath());
+
+            parser.parse(xmlFile, new DefaultHandler());
+        } catch (Exception e) {
+            System.err.println("Failure: File " + XML_FILE_NAME + " was parsed with a large value of maxOccurs.");
+            e.printStackTrace();
+            Assert.fail("Failure: File " + XML_FILE_NAME + " was parsed with a large value of maxOccurs.  " + e.getMessage());
+        }
+
+        System.out.println("Success: File " + XML_FILE_NAME + " was parsed with a large value of maxOccurs.");
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.xml
new file mode 100644
index 00000000000..56a2fe5eb69
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<test:a
+    xmlns:test="test"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xsi:schemaLocation="test Bug4674384_MAX_OCCURS_Test.xsd">
+<b>1</b>
+<b>2</b>
+</test:a>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.xsd
new file mode 100644
index 00000000000..1a77727eed4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4674384_MAX_OCCURS_Test.xsd
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+
+<xsd:schema
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+  xmlns="test"
+  targetNamespace="test">
+
+     <xsd:element name="a" type="A"/>
+     <xsd:complexType name="A">
+          <xsd:sequence>
+	       <xsd:element name="b" type="xsd:string" maxOccurs="3000"/>
+	  </xsd:sequence>
+     </xsd:complexType>
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4934208.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4934208.java
new file mode 100644
index 00000000000..8e77af0ef87
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4934208.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+import util.DraconianErrorHandler;
+
+/*
+ * @bug 4934208
+ * @summary Test SAXParser can parse keyref constraint with a selector that is a union xpath expression selecting a node and its child.
+ */
+public class Bug4934208 {
+    @Test
+    public void test1() throws Exception {
+        parse(new InputSource(Bug4934208.class.getResourceAsStream("test1.xml")));
+    }
+
+    @Test
+    public void test2() throws Exception {
+        try {
+            parse(new InputSource(Bug4934208.class.getResourceAsStream("test2.xml")));
+        } catch (SAXException e) {
+            Assert.assertTrue(e.getMessage().startsWith("cvc-complex-type.2.4.a"));
+        }
+    }
+
+    private void parse(InputSource is) throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.setValidating(true);
+        SAXParser parser = spf.newSAXParser();
+
+        parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+        parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", Bug4934208.class.getResourceAsStream("test.xsd"));
+
+        XMLReader r = parser.getXMLReader();
+
+        r.setErrorHandler(new DraconianErrorHandler());
+        r.parse(is);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4967002.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4967002.java
new file mode 100644
index 00000000000..3fd09a7b6e4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4967002.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.StringReader;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 4967002
+ * @summary Test DocumentBuilderFactory.newDocumentBuilder() throws ParserConfigurationException
+ * when it uses the "http://java.sun.com/xml/jaxp/properties/schemaSource" property
+ * and/or the "http://java.sun.com/xml/jaxp/properties/schemaLanguage" property
+ * in conjunction with setting a Schema object.
+ */
+public class Bug4967002 {
+    String schemaSource = "<?xml version='1.0'?>\n" + "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>\n" + "  <xsd:element name='test101'>\n"
+            + "    <xsd:complexType>\n" + "      <xsd:attribute name='attr'/>\n" + "      <xsd:attribute name='attr2' default='DEF'/>\n"
+            + "    </xsd:complexType>\n" + "  </xsd:element>\n" + "</xsd:schema>\n";
+
+    Schema createSchema() {
+        SchemaFactory schFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        try {
+            Schema sch = schFactory.newSchema(new StreamSource(new StringReader(schemaSource)));
+            return sch;
+        } catch (Exception se) {
+            throw new IllegalStateException("No Schema : " + se);
+        }
+    }
+
+    @Test
+    public void test1() {
+        setAttr(true);
+    }
+
+    @Test
+    public void test2() {
+        setAttr(false);
+    }
+
+    void setAttr(boolean setSrc) {
+        DocumentBuilderFactory docBFactory = DocumentBuilderFactory.newInstance();
+        Schema sch = createSchema();
+        docBFactory.setSchema(sch);
+        docBFactory.setNamespaceAware(true);
+        docBFactory.setValidating(true);
+
+        final String aSchemaLanguage = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+        final String aSchemaSource = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+        docBFactory.setAttribute(aSchemaLanguage, "http://www.w3.org/2001/XMLSchema");
+        // System.out.println("---- Set schemaLanguage: " +
+        // docBFactory.getAttribute(aSchemaLanguage));
+        if (setSrc) {
+            docBFactory.setAttribute(aSchemaSource, new InputSource(new StringReader(schemaSource)));
+            // System.out.println("---- Set schemaSource: " +
+            // docBFactory.getAttribute(aSchemaSource));
+        }
+
+        try {
+            docBFactory.newDocumentBuilder();
+            Assert.fail("ParserConfigurationException expected");
+        } catch (ParserConfigurationException pce) {
+            return; // success
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4985486.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4985486.java
new file mode 100644
index 00000000000..b8ab86e6858
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4985486.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4985486
+ * @summary Test SAXParser can parse large characters(more than 10000).
+ */
+public class Bug4985486 {
+
+    @Test
+    public void test1() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        System.out.println(spf.getClass().getName());
+        spf.setNamespaceAware(true);
+        spf.newSAXParser().parse(Bug4985486.class.getResourceAsStream("Bug4985486.xml"), new Handler());
+    }
+
+    private class Handler extends DefaultHandler {
+        StringBuffer buf = new StringBuffer();
+
+        public void characters(char[] ch, int start, int length) throws SAXException {
+            buf.append(ch, start, length);
+        }
+
+        public void endDocument() throws SAXException {
+            String contents = buf.toString();
+            Assert.assertTrue(contents.endsWith("[END]"));
+            while (contents.length() >= 10) {
+                Assert.assertTrue(contents.startsWith("0123456789"));
+                contents = contents.substring(10);
+            }
+        }
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4985486.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4985486.xml
new file mode 100644
index 00000000000..aed65c33013
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4985486.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<root>0123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789[END]</root>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.java
new file mode 100644
index 00000000000..38036a725e0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4991020
+ * @summary Test XPath like "node_name/." can be parsed.
+ */
+public class Bug4991020 {
+
+    protected static SAXParser createParser() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.setValidating(true);
+        SAXParser parser = spf.newSAXParser();
+        parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+
+        return parser;
+    }
+
+    @Test
+    public void test1() throws Exception {
+        SAXParser parser = createParser();
+        parser.parse(Bug4991020.class.getResource("Bug4991020.xml").toExternalForm(), new util.DraconianErrorHandler());
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.xml
new file mode 100644
index 00000000000..f65d9102d77
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<test:root xmlns:test="test"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="test Bug4991020.xsd"
+><child>123</child></test:root>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.xsd
new file mode 100644
index 00000000000..def42b11889
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991020.xsd
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+             targetNamespace="test">
+     <xsd:element name="root">
+         <xsd:complexType>
+             <xsd:sequence>
+                 <xsd:element name="child" type="xsd:string"/>
+             </xsd:sequence>
+         </xsd:complexType>
+
+         <xsd:key name="key1">
+             <xsd:selector xpath="."/>
+             <xsd:field xpath="child/."/>
+         </xsd:key>
+     </xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.java
new file mode 100644
index 00000000000..39091809059
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4991946
+ * @summary Can parse the element type is anyType in the schema and is substituted by the simple type via the 'xsi:type' attribute in xml document.
+ */
+public class Bug4991946 {
+
+    protected static SAXParser createParser() throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.setValidating(true);
+        SAXParser parser = spf.newSAXParser();
+        parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+
+        return parser;
+    }
+
+    @Test
+    public void test1() throws Exception {
+        SAXParser parser = createParser();
+        parser.parse(Bug4991946.class.getResource("Bug4991946.xml").toExternalForm(), new util.DraconianErrorHandler());
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.xml
new file mode 100644
index 00000000000..f3dea92f87d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0"?>
+<test:root xmlns:test="test"
+            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+            xsi:schemaLocation="test Bug4991946.xsd"
+            xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+   <child xsi:type="xsd:string">123</child>
+</test:root>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.xsd
new file mode 100644
index 00000000000..86b23ed1a00
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug4991946.xsd
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+             targetNamespace="test">
+     <xsd:element name="root">
+         <xsd:complexType>
+             <xsd:sequence>
+                 <xsd:element name="child" type="xsd:anyType"/>
+             </xsd:sequence>
+         </xsd:complexType>
+
+         <xsd:key name="key1">
+             <xsd:selector xpath="."/>
+             <xsd:field xpath="child"/>
+         </xsd:key>
+     </xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5010072.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5010072.java
new file mode 100644
index 00000000000..292a3042e71
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5010072.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 5010072
+ * @summary Test SchemaFactory throws SAXException if xpath is "@".
+ */
+public class Bug5010072 {
+
+    protected static class ErrorHandler extends DefaultHandler {
+        public int errorCounter = 0;
+
+        public void error(SAXParseException e) throws SAXException {
+
+            System.err.println("Error: " + "[[" + e.getPublicId() + "][" + e.getSystemId() + "]]" + "[[" + e.getLineNumber() + "][" + e.getColumnNumber()
+                    + "]]" + e);
+
+            errorCounter++;
+
+            throw e;
+        }
+
+        public void fatalError(SAXParseException e) throws SAXException {
+            System.err.println("Fatal Error: " + e);
+            errorCounter++;
+        }
+    }
+
+    @Test
+    public void test1() throws Exception {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+        ErrorHandler errorHandler = new ErrorHandler();
+        schemaFactory.setErrorHandler(errorHandler);
+
+        try {
+            schemaFactory.newSchema(Bug5010072.class.getResource("Bug5010072.xsd"));
+            Assert.fail("should fail to compile");
+        } catch (SAXException e) {
+            ; // as expected
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5010072.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5010072.xsd
new file mode 100644
index 00000000000..4dde0ec6a62
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5010072.xsd
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+	<xsd:element name="root">
+		<xsd:complexType>
+			<xsd:sequence>
+				<xsd:element name="tid" maxOccurs="unbounded"/>
+			</xsd:sequence>
+		</xsd:complexType>
+		<xsd:unique id="foo123" name="uid">
+			<xsd:selector xpath=".//tid"/>
+			<xsd:field xpath="@"/>
+		</xsd:unique>
+	</xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5025825.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5025825.java
new file mode 100644
index 00000000000..a2912089f9e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug5025825.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.StringReader;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 5025825
+ * @summary Test if SAXParserFactory set a Schema object, when SAXParser sets "http://java.sun.com/xml/jaxp/properties/schemaSource" property
+ * and/or "http://java.sun.com/xml/jaxp/properties/schemaLanguage" property, it shall throw SAXException.
+ */
+public class Bug5025825 {
+
+    String schemaSource = "<?xml version='1.0'?>\n" + "<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>\n" + "  <xsd:element name='test101'>\n"
+            + "    <xsd:complexType>\n" + "      <xsd:attribute name='attr'/>\n" + "      <xsd:attribute name='attr2' default='DEF'/>\n"
+            + "    </xsd:complexType>\n" + "  </xsd:element>\n" + "</xsd:schema>\n";
+
+    private Schema createSchema() throws SAXException {
+        SchemaFactory schFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        return schFactory.newSchema(new StreamSource(new StringReader(schemaSource)));
+    }
+
+    @Test
+    public void test1() throws Exception {
+        Schema sch = createSchema();
+        Assert.assertNotNull(sch);
+
+        SAXParserFactory spFactory = SAXParserFactory.newInstance();
+        spFactory.setNamespaceAware(true);
+        spFactory.setValidating(true);
+        spFactory.setSchema(sch);
+
+        SAXParser sParser = spFactory.newSAXParser();
+
+        final String aSchemaLanguage = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+        final String aSchemaSource = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+        try {
+            sParser.setProperty(aSchemaLanguage, "http://www.w3.org/2001/XMLSchema");
+            Assert.fail("---- Set schemaLanguage: " + sParser.getProperty(aSchemaLanguage));
+        } catch (SAXException e) {
+            ; // as expected
+        }
+
+        try {
+            sParser.setProperty(aSchemaSource, new InputSource(new StringReader(schemaSource)));
+            Assert.fail("---- Set schemaSource: " + sParser.getProperty(aSchemaSource));
+        } catch (SAXException e) {
+            ; // as expected
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6309988.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6309988.java
new file mode 100644
index 00000000000..499dc2a5861
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6309988.java
@@ -0,0 +1,380 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.File;
+import java.io.InputStream;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6309988
+ * @summary Test elementAttributeLimit, maxOccurLimit, entityExpansionLimit.
+ */
+public class Bug6309988 {
+
+    DocumentBuilderFactory dbf = null;
+    static boolean _isSecureMode = false;
+    static {
+        if (System.getSecurityManager() != null) {
+            _isSecureMode = true;
+            System.out.println("Security Manager is present");
+        } else {
+            System.out.println("Security Manager is NOT present");
+        }
+    }
+
+    /*
+     * Given XML document has more than 10000 attributes. Exception is expected
+     */
+    @Test
+    public void testDOMParserElementAttributeLimit() {
+        try {
+            dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder parser = dbf.newDocumentBuilder();
+            Document doc = parser.parse(this.getClass().getResourceAsStream("DosTest.xml"));
+            Assert.fail("SAXParserException is expected, as given XML document contains more than 10000 attributes");
+        } catch (SAXParseException e) {
+            System.out.println(e.getMessage());
+        } catch (Exception e) {
+            Assert.fail("Exception " + e.getMessage());
+        }
+    }
+
+    /*
+     * Given XML document has more than 10000 attributes. It should report an
+     * error.
+     */
+    @Test
+    public void testDOMNSParserElementAttributeLimit() {
+        try {
+            dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder parser = dbf.newDocumentBuilder();
+            Document doc = parser.parse(this.getClass().getResourceAsStream("DosTest.xml"));
+            Assert.fail("SAXParserException is expected, as given XML document contains more than 10000 attributes");
+        } catch (SAXParseException e) {
+            System.out.println(e.getMessage());
+        } catch (Exception e) {
+            Assert.fail("Exception " + e.getMessage());
+        }
+    }
+
+    /*
+     * Given XML document has more than 10000 attributes. Parsing this XML
+     * document in non-secure mode, should not report any error.
+     */
+    @Test
+    public void testDOMNSParserElementAttributeLimitWithoutSecureProcessing() {
+        if (_isSecureMode)
+            return; // jaxp secure feature can not be turned off when security
+                    // manager is present
+        try {
+            dbf = DocumentBuilderFactory.newInstance();
+            dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+            dbf.setNamespaceAware(true);
+            DocumentBuilder parser = dbf.newDocumentBuilder();
+            Document doc = parser.parse(this.getClass().getResourceAsStream("DosTest.xml"));
+
+        } catch (SAXParseException e) {
+            Assert.fail(e.getMessage());
+        } catch (Exception e) {
+            Assert.fail("Exception " + e.getMessage());
+        }
+    }
+
+    /*
+     * Before 8014530: Given XML document has 3 attributes and System property
+     * is set to 2. Parsing this XML document in non-secure mode, should not
+     * report an error.
+     * After 8014530: System properties will override FSP, the result of this
+     * test should be the same as
+     * testSystemElementAttributeLimitWithSecureProcessing
+     */
+    @Test
+    public void testSystemElementAttributeLimitWithoutSecureProcessing() {
+        if (_isSecureMode)
+            return; // jaxp secure feature can not be turned off when security
+                    // manager is present
+        try {
+            dbf = DocumentBuilderFactory.newInstance();
+            dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+            dbf.setNamespaceAware(true);
+            System.setProperty("elementAttributeLimit", "2");
+            DocumentBuilder parser = dbf.newDocumentBuilder();
+            Document doc = parser.parse(this.getClass().getResourceAsStream("DosTest3.xml"));
+
+            Assert.fail("SAXParserException is expected, as given XML document contains more than 2 attributes");
+        } catch (Exception e) {
+            String errMsg = e.getMessage();
+            Throwable cause = e.getCause();
+            if (cause != null) {
+                errMsg += cause.getMessage();
+            }
+            if (errMsg.contains("JAXP0001")) {
+                // expected
+            } else {
+                Assert.fail("Unexpected error: " + e.getMessage());
+            }
+        } finally {
+            System.clearProperty("elementAttributeLimit");
+        }
+    }
+
+    /*
+     * Given XML document has 3 attributes and System property is set to 2.
+     * Parsing this XML document in secure mode, should report an error.
+     */
+    @Test
+    public void testSystemElementAttributeLimitWithSecureProcessing() {
+        try {
+            dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            System.setProperty("elementAttributeLimit", "2");
+            DocumentBuilder parser = dbf.newDocumentBuilder();
+            Document doc = parser.parse(this.getClass().getResourceAsStream("DosTest3.xml"));
+            Assert.fail("SAXParserException is expected, as given XML document contains more than 2 attributes");
+        } catch (SAXParseException e) {
+            System.out.println(e.getMessage());
+        } catch (Exception e) {
+            Assert.fail("Exception " + e.getMessage());
+        } finally {
+            System.setProperty("elementAttributeLimit", "");
+        }
+    }
+
+    /*
+     * Default value for secure processing feature should be true.
+     */
+    @Test
+    public void testDOMSecureProcessingDefaultValue() {
+        try {
+            dbf = DocumentBuilderFactory.newInstance();
+            Assert.assertTrue(dbf.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING), "Default value for secureProcessing feature should be true");
+
+        } catch (Exception e) {
+            Assert.fail("Exception " + e.getMessage());
+        }
+    }
+
+    /*
+     * Default value for secure processing feature should be true.
+     */
+    @Test
+    public void testSAXSecureProcessingDefaultValue() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            Assert.assertTrue(spf.getFeature(XMLConstants.FEATURE_SECURE_PROCESSING), "Default value for secureProcessing feature should be true");
+
+        } catch (Exception e) {
+            Assert.fail("Exception " + e.getMessage());
+        }
+    }
+
+    /*
+     * This method sets system property for maxOccurLimit=2 and secure process
+     * feature is off. Given doument contains more than 2 elements and hence an
+     * error should be reported.
+     */
+    @Test
+    public void testSystemMaxOccurLimitWithoutSecureProcessing() {
+        if (_isSecureMode)
+            return; // jaxp secure feature can not be turned off when security
+                    // manager is present
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+            spf.setValidating(true);
+            System.setProperty("maxOccurLimit", "2");
+            // Set the properties for Schema Validation
+            String SCHEMA_LANG = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+            String SCHEMA_TYPE = "http://www.w3.org/2001/XMLSchema";
+            // Get the Schema location as a File object
+            File schemaFile = new File(this.getClass().getResource("toys.xsd").toURI());
+            // Get the parser
+            SAXParser parser = spf.newSAXParser();
+            parser.setProperty(SCHEMA_LANG, SCHEMA_TYPE);
+            parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaFile);
+
+            InputStream is = this.getClass().getResourceAsStream("toys.xml");
+            MyErrorHandler eh = new MyErrorHandler();
+            parser.parse(is, eh);
+            Assert.assertFalse(eh.errorOccured, "Not Expected Error");
+            System.setProperty("maxOccurLimit", "");
+        } catch (Exception e) {
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    /*
+     * This test will take longer time to execute( abt 120sec). This method
+     * tries to validate a document. This document contains an element whose
+     * maxOccur is '3002'. Since secure processing feature is off, document
+     * should be parsed without any errors.
+     */
+    @Test
+    public void testValidMaxOccurLimitWithOutSecureProcessing() {
+        if (_isSecureMode)
+            return; // jaxp secure feature can not be turned off when security
+                    // manager is present
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+            spf.setValidating(true);
+            // Set the properties for Schema Validation
+            String SCHEMA_LANG = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+            String SCHEMA_TYPE = "http://www.w3.org/2001/XMLSchema";
+            // Get the Schema location as a File object
+            File schemaFile = new File(this.getClass().getResource("toys3002.xsd").toURI());
+            // Get the parser
+            SAXParser parser = spf.newSAXParser();
+            parser.setProperty(SCHEMA_LANG, SCHEMA_TYPE);
+            parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", schemaFile);
+
+            InputStream is = this.getClass().getResourceAsStream("toys.xml");
+            MyErrorHandler eh = new MyErrorHandler();
+            parser.parse(is, eh);
+            Assert.assertFalse(eh.errorOccured, "Expected Error as maxOccurLimit is exceeded");
+
+        } catch (Exception e) {
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    /*
+     * Before 8014530: System property is set to 2. Given XML document has more
+     * than 2 entity references. Parsing this document in non-secure mode,
+     * should *not* report an error.
+     * After 8014530: System properties will override FSP, the result of this
+     * test should be the same as
+     * testSystemElementAttributeLimitWithSecureProcessing
+     */
+    @Test
+    public void testSystemEntityExpansionLimitWithOutSecureProcessing() {
+        if (_isSecureMode)
+            return; // jaxp secure feature can not be turned off when security
+                    // manager is present
+        try {
+            System.setProperty("entityExpansionLimit", "2");
+            dbf = DocumentBuilderFactory.newInstance();
+            dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+            dbf.setValidating(true);
+            DocumentBuilder parser = dbf.newDocumentBuilder();
+            Document doc = parser.parse(this.getClass().getResourceAsStream("entity.xml"));
+            Assert.fail("SAXParserException is expected, as given XML document contains more 2 entity references");
+        } catch (Exception e) {
+            String errMsg = e.getMessage();
+            Throwable cause = e.getCause();
+            if (cause != null) {
+                errMsg += cause.getMessage();
+            }
+            if (errMsg.contains("JAXP0001")) {
+                // expected
+            } else {
+                Assert.fail("Unexpected error: " + e.getMessage());
+            }
+        } finally {
+            System.clearProperty("entityExpansionLimit");
+        }
+    }
+
+    /*
+     * System property is set to 2. Given XML document has more than 2 entity
+     * references. Parsing this document in secure mode, should report an error.
+     */
+    @Test
+    public void testSystemEntityExpansionLimitWithSecureProcessing() {
+        try {
+            dbf = DocumentBuilderFactory.newInstance();
+            dbf.setValidating(true);
+            System.setProperty("entityExpansionLimit", "2");
+            DocumentBuilder parser = dbf.newDocumentBuilder();
+            Document doc = parser.parse(this.getClass().getResourceAsStream("entity.xml"));
+            Assert.fail("SAXParserException is expected, as given XML document contains more 2 entity references");
+
+        } catch (SAXParseException e) {
+            System.out.println(e.getMessage());
+        } catch (Exception e) {
+            Assert.fail("Exception " + e.getMessage());
+        } finally {
+            System.setProperty("entityExpansionLimit", "");
+        }
+    }
+
+    /*
+     * Given XML document has more than 64000 entity references. Parsing this
+     * document in secure mode, should report an error.
+     */
+    @Test
+    public void testEntityExpansionLimitWithSecureProcessing() {
+        try {
+            dbf = DocumentBuilderFactory.newInstance();
+            dbf.setValidating(true);
+            DocumentBuilder parser = dbf.newDocumentBuilder();
+            Document doc = parser.parse(this.getClass().getResourceAsStream("entity64K.xml"));
+            Assert.fail("SAXParserException is expected, as given XML document contains more 2 entity references");
+
+        } catch (SAXParseException e) {
+            System.out.println(e.getMessage());
+        } catch (Exception e) {
+            Assert.fail("Exception " + e.getMessage());
+        } finally {
+            System.setProperty("entityExpansionLimit", "");
+        }
+    }
+
+    /*
+     * Given XML document has more than 64000 entity references. Parsing this
+     * document in non-secure mode, should not report any error.
+     */
+    @Test
+    public void testEntityExpansionLimitWithOutSecureProcessing() {
+        if (_isSecureMode)
+            return; // jaxp secure feature can not be turned off when security
+                    // manager is present
+        try {
+            dbf = DocumentBuilderFactory.newInstance();
+            dbf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+            dbf.setValidating(true);
+            DocumentBuilder parser = dbf.newDocumentBuilder();
+            Document doc = parser.parse(this.getClass().getResourceAsStream("entity64K.xml"));
+
+        } catch (SAXParseException e) {
+            Assert.fail("Exception " + e.getMessage());
+        } catch (Exception e) {
+            Assert.fail("Exception " + e.getMessage());
+        } finally {
+            System.setProperty("entityExpansionLimit", "");
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6341770.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6341770.java
new file mode 100644
index 00000000000..e5b1f74a793
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6341770.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6341770
+ * @summary Test external entity linked to non-ASCII base URL.
+ */
+public class Bug6341770 {
+
+    // naming a file "aux" would fail on windows.
+    @Test
+    public void testNonAsciiURI() {
+        try {
+            File dir = File.createTempFile("sko\u0159ice", null);
+            dir.delete();
+            dir.mkdir();
+            File main = new File(dir, "main.xml");
+            PrintWriter w = new PrintWriter(new FileWriter(main));
+            w.println("<!DOCTYPE r [<!ENTITY aux SYSTEM \"aux1.xml\">]>");
+            w.println("<r>&aux;</r>");
+            w.flush();
+            w.close();
+            File aux = new File(dir, "aux1.xml");
+            w = new PrintWriter(new FileWriter(aux));
+            w.println("<x/>");
+            w.flush();
+            w.close();
+            System.out.println("Parsing: " + main);
+            SAXParserFactory.newInstance().newSAXParser().parse(main, new DefaultHandler() {
+                public void startElement(String uri, String localname, String qname, Attributes attr) throws SAXException {
+                    System.out.println("encountered <" + qname + ">");
+                }
+            });
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception: " + e.getMessage());
+        }
+        System.out.println("OK.");
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6361283.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6361283.java
new file mode 100644
index 00000000000..8a0f3c9f322
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6361283.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6361283
+ * @summary Test SAXParser returns version as 1.1 for XML 1.1 document.
+ */
+public class Bug6361283 {
+
+    @Test
+    public void testXMLVersion() {
+        try {
+            SAXParserFactory factory = SAXParserFactory.newInstance();
+            SAXParser parser = factory.newSAXParser();
+            Assert.assertTrue(factory.getFeature("http://xml.org/sax/features/use-locator2"), "use-locator2 should have value as true");
+            MyDefaultHandler dh = new MyDefaultHandler();
+            parser.parse(this.getClass().getResourceAsStream("catalog.xml"), dh);
+            Assert.assertTrue(dh.xmlVersion.equals("1.1"), "XML Document version should be 1.1");
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6506304Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6506304Test.java
new file mode 100644
index 00000000000..b93e7333977
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6506304Test.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.XMLReader;
+
+/*
+ * @bug 6506304
+ * @summary Test MalformedURLException: unknown protocol won't be thrown when there is a space within the full path file name.
+ */
+public class Bug6506304Test {
+    public static boolean isWindows = false;
+    static {
+        if (System.getProperty("os.name").indexOf("Windows") > -1) {
+            isWindows = true;
+        }
+    };
+
+    @Test
+    public void testPath() throws Exception {
+        if (isWindows) {
+            try {
+                SAXParserFactory factory = SAXParserFactory.newInstance();
+                factory.setNamespaceAware(true);
+                SAXParser jaxpParser = factory.newSAXParser();
+                XMLReader reader = jaxpParser.getXMLReader();
+                reader.parse("C:/space error/x.xml");
+                System.exit(0);
+            } catch (Exception e) {
+                System.out.println(e.getMessage());
+                if (e.getMessage().equalsIgnoreCase("unknown protocol: c")) {
+                    Assert.fail("jdk5 allowed the above form");
+                } else if (e.getMessage().indexOf("(The system cannot find the path specified)") > 0) {
+                    // expected
+                }
+            }
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6518733.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6518733.java
new file mode 100644
index 00000000000..c1d141eef53
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6518733.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.FileReader;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6518733
+ * @summary Test SAX parser handles several attributes that each contain a newline within the attribute value.
+ */
+public class Bug6518733 {
+
+    @Test
+    public void test() {
+        SAXParserFactory factory = SAXParserFactory.newInstance();
+        try {
+            SAXParser saxParser = factory.newSAXParser();
+            saxParser.parse(new InputSource(new FileReader(getClass().getResource("Bug6518733.xml").getFile())), new Handler());
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    static class Handler extends org.xml.sax.helpers.DefaultHandler {
+        public void startElement(String uri, String localName, String qName, Attributes attrs) throws SAXException {
+            // Make sure that the value of attribute q7 is "7 G"
+            if (qName.equals("obj")) {
+                Assert.assertTrue(attrs.getValue("", "q7").equals("7 G"));
+            }
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6518733.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6518733.xml
new file mode 100644
index 00000000000..349e5803533
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6518733.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+
+<obj
+
+q1="1
+A"
+
+q2="2
+B"
+
+q3="3
+C"
+
+q4="4
+D"
+
+q5="5
+E"
+
+q6="6
+F"
+
+q7="7
+G"
+
+q8="8
+H"
+
+q9="9
+I"
+
+/>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.java
new file mode 100644
index 00000000000..c76304d8bad
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6564400
+ * @summary Test ignorable whitespace handling with schema validation.
+ */
+public class Bug6564400 {
+    private boolean sawIgnorable = false;
+    Schema schema = null;
+
+    public Bug6564400(String name) {
+        String xsdFile = "Bug6564400.xsd";
+        File schemaFile = new File(xsdFile);
+
+        // Now attempt to load up the schema
+        try {
+            SchemaFactory schFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            schema = schFactory.newSchema(new StreamSource(getClass().getResourceAsStream(xsdFile)));
+        } catch (Exception e) {
+            // Nevermind, bad things will happen later
+        }
+    }
+
+    @Test
+    public void testDOM() throws ParserConfigurationException, SAXException, IOException {
+        InputStream xmlFile = getClass().getResourceAsStream("Bug6564400.xml");
+
+        // Set the options on the DocumentFactory to remove comments, remove
+        // whitespace
+        // and validate against the schema.
+        DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+        docFactory.setIgnoringComments(true);
+        docFactory.setIgnoringElementContentWhitespace(true);
+        docFactory.setSchema(schema);
+
+        DocumentBuilder parser = docFactory.newDocumentBuilder();
+        Document xmlDoc = parser.parse(xmlFile);
+
+        boolean ok = dump(xmlDoc, true);
+        Assert.assertEquals(true, ok);
+    }
+
+    @Test
+    public void testSAX() throws ParserConfigurationException, SAXException, IOException {
+        InputStream xmlFile = getClass().getResourceAsStream("Bug6564400.xml");
+
+        // Parse with SAX
+        SAXParserFactory saxFactory = SAXParserFactory.newInstance();
+        saxFactory.setSchema(schema);
+
+        SAXParser saxparser = saxFactory.newSAXParser();
+
+        sawIgnorable = false;
+        saxparser.parse(xmlFile, new MyHandler());
+        Assert.assertEquals(true, sawIgnorable);
+    }
+
+    @Test
+    public void testConformantDOM() throws ParserConfigurationException, SAXException, IOException {
+        InputStream xmlFile = getClass().getResourceAsStream("Bug6564400.xml");
+
+        // Set the options on the DocumentFactory to remove comments, remove
+        // whitespace
+        // and validate against the schema.
+        DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+        docFactory.setIgnoringComments(true);
+        docFactory.setIgnoringElementContentWhitespace(true);
+        docFactory.setSchema(schema);
+        docFactory.setFeature("http://java.sun.com/xml/schema/features/report-ignored-element-content-whitespace", true);
+
+        DocumentBuilder parser = docFactory.newDocumentBuilder();
+        Document xmlDoc = parser.parse(xmlFile);
+
+        boolean ok = dump(xmlDoc, true);
+        Assert.assertEquals(false, ok);
+    }
+
+    @Test
+    public void testConformantSAX() throws ParserConfigurationException, SAXException, IOException {
+        InputStream xmlFile = getClass().getResourceAsStream("Bug6564400.xml");
+
+        // Parse with SAX
+        SAXParserFactory saxFactory = SAXParserFactory.newInstance();
+        saxFactory.setSchema(schema);
+        saxFactory.setFeature("http://java.sun.com/xml/schema/features/report-ignored-element-content-whitespace", true);
+
+        SAXParser saxparser = saxFactory.newSAXParser();
+
+        sawIgnorable = false;
+        saxparser.parse(xmlFile, new MyHandler());
+        Assert.assertEquals(false, sawIgnorable);
+    }
+
+    private boolean dump(Node node) {
+        return dump(node, false);
+    }
+
+    private boolean dump(Node node, boolean silent) {
+        return dump(node, silent, 0);
+    }
+
+    private boolean dump(Node node, boolean silent, int depth) {
+        boolean ok = true;
+        if (!silent) {
+            for (int i = 0; i < depth; i++) {
+                System.out.print("  ");
+            }
+            System.out.println(node);
+        }
+
+        if (node.getNodeType() == Node.TEXT_NODE) {
+            String text = ((Text) node).getData();
+            ok = ok && text.trim().length() > 0;
+        }
+
+        if (node.getNodeType() == Node.ELEMENT_NODE || node.getNodeType() == Node.DOCUMENT_NODE) {
+            Node child = node.getFirstChild();
+            while (child != null) {
+                ok = ok && dump(child, silent, depth + 1);
+                child = child.getNextSibling();
+            }
+        }
+        return ok;
+    }
+
+    public class MyHandler extends DefaultHandler {
+        public void ignorableWhitespace(char[] ch, int start, int length) {
+            sawIgnorable = true;
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.xml
new file mode 100644
index 00000000000..3261c65e718
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.xml
@@ -0,0 +1,4 @@
+<Person>
+        <FirstName>Doofus</FirstName><!-- MONKEY -->
+        <LastName>McGee</LastName>
+</Person>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.xsd
new file mode 100644
index 00000000000..46e5241b5ec
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6564400.xsd
@@ -0,0 +1,9 @@
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
+  <xsd:element name='Person' type='PersonType'/>
+  <xsd:complexType name='PersonType'>
+                <xsd:sequence>
+                        <xsd:element name='FirstName' type='xsd:string'/>
+                        <xsd:element name='LastName' type='xsd:string'/>
+                </xsd:sequence>
+        </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6573786.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6573786.java
new file mode 100644
index 00000000000..49488360b0d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6573786.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.InputStream;
+import java.io.StringBufferInputStream;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6573786
+ * @summary Test parser error messages are formatted.
+ */
+public class Bug6573786 {
+    String _cache = "";
+
+    @Test
+    public void test() {
+        final String XML = "" + "<?xml version='1.0' encoding='UTF-8' standalone='bad_value' ?>" + "<root />";
+
+        runTest(XML);
+
+    }
+
+    @Test
+    public void test1() {
+        final String XML = "" + "<?xml version='1.0' standalone='bad_value' encoding='UTF-8' ?>" + "<root />";
+        runTest(XML);
+
+    }
+
+    void runTest(String xmlString) {
+        Bug6573786ErrorHandler handler = new Bug6573786ErrorHandler();
+        try {
+            InputStream is = new StringBufferInputStream(xmlString);
+            SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
+            parser.parse(is, handler);
+        } catch (Exception e) {
+            if (handler.fail) {
+                Assert.fail("The value of standalone attribute should be merged into the error message.");
+            }
+        }
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6573786ErrorHandler.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6573786ErrorHandler.java
new file mode 100644
index 00000000000..5d55cea1029
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6573786ErrorHandler.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class Bug6573786ErrorHandler extends DefaultHandler {
+    public boolean fail = false;
+
+    public void fatalError(SAXParseException e) throws SAXException {
+        System.out.println(e.getMessage());
+        if (e.getMessage().indexOf("bad_value") < 0) {
+            fail = true;
+        }
+    } // fatalError ()
+
+    public void error(SAXParseException e) throws SAXException {
+        System.out.println(e.getMessage());
+    } // error ()
+
+    public void warning(SAXParseException e) throws SAXException {
+        System.out.println(e.getMessage());
+    } // warning ()
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6594813.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6594813.java
new file mode 100644
index 00000000000..d660f958bcc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6594813.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6594813
+ * @summary Test SAXParser output is wellformed with name space.
+ */
+public class Bug6594813 {
+
+    public Bug6594813(String name) {
+    }
+
+    private static final String TESTXML = "<?xml version='1.0' ?>\n"
+            + "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ns1='http://faulttestservice.org/wsdl'>\n"
+            + "<soapenv:Body>\n" + "<soapenv:Fault xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>\n" + "<faultcode>\n"
+            + "soapenv:Server</faultcode>\n" + "<faultstring>\n" + "com.sun.ts.tests.jaxws.sharedwebservices.faultservice.DummyException</faultstring>\n"
+            + "<detail>\n" + "<ns1:DummyException>\n" + "<dummyField1>\n" + "dummyString1</dummyField1>\n" + "<dummyField2>\n" + "dummyString2</dummyField2>\n"
+            + "</ns1:DummyException>\n" + "</detail>\n" + "</soapenv:Fault>\n" + "</soapenv:Body>\n" + "</soapenv:Envelope>\n";
+
+    // simplest XML to re-declare same prefix/namespace mappings
+    private static final String SIMPLE_TESTXML = "<?xml version='1.0' ?>\n" + "<prefix:ElementName xmlns:prefix='URI'>\n"
+            + "<prefix:ElementName xmlns:prefix='URI'>\n" + "</prefix:ElementName>\n" + "</prefix:ElementName>\n";
+
+    private String runTransform(SAXParser sp) throws Exception {
+        // Run identity transform using SAX parser
+        SAXSource src = new SAXSource(sp.getXMLReader(), new InputSource(new StringReader(TESTXML)));
+        Transformer transformer = TransformerFactory.newInstance().newTransformer();
+        StringWriter sw = new StringWriter();
+        transformer.transform(src, new StreamResult(sw));
+
+        String result = sw.getBuffer().toString();
+        // System.out.println(result);
+        return result;
+    }
+
+    private void checkWellFormedness(String xml) throws Exception {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true); // Same as default
+        spf.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+        SAXParser sp = spf.newSAXParser();
+
+        // Re-parse output to make sure that it is well formed
+        sp.parse(new InputSource(new StringReader(xml)), new DefaultHandler());
+    }
+
+    /**
+     * Test an identity transform of an XML document with NS decls using a
+     * non-ns-aware parser. Output result to a StreamSource. Set ns-awareness to
+     * FALSE and prefixes to FALSE.
+     */
+    @Test
+    public void testXMLNoNsAwareStreamResult1() {
+        try {
+            // Create SAX parser *without* enabling ns
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(false); // Same as default
+            spf.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
+            SAXParser sp = spf.newSAXParser();
+
+            // Make sure that the output is well formed
+            String xml = runTransform(sp);
+            checkWellFormedness(xml);
+        } catch (Throwable ex) {
+            Assert.fail(ex.toString());
+        }
+    }
+
+    /**
+     * Test an identity transform of an XML document with NS decls using a
+     * non-ns-aware parser. Output result to a StreamSource. Set ns-awareness to
+     * FALSE and prefixes to TRUE.
+     */
+    @Test
+    public void testXMLNoNsAwareStreamResult2() {
+        try {
+            // Create SAX parser *without* enabling ns
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(false); // Same as default
+            spf.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+            SAXParser sp = spf.newSAXParser();
+
+            // Make sure that the output is well formed
+            String xml = runTransform(sp);
+            checkWellFormedness(xml);
+        } catch (Throwable ex) {
+            Assert.fail(ex.toString());
+        }
+    }
+
+    /**
+     * Test an identity transform of an XML document with NS decls using a
+     * non-ns-aware parser. Output result to a StreamSource. Set ns-awareness to
+     * TRUE and prefixes to FALSE.
+     */
+    @Test
+    public void testXMLNoNsAwareStreamResult3() {
+        try {
+            // Create SAX parser *without* enabling ns
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true); // Same as default
+            spf.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
+            SAXParser sp = spf.newSAXParser();
+
+            // Make sure that the output is well formed
+            String xml = runTransform(sp);
+            checkWellFormedness(xml);
+        } catch (Throwable ex) {
+            Assert.fail(ex.toString());
+        }
+    }
+
+    /**
+     * Test an identity transform of an XML document with NS decls using a
+     * non-ns-aware parser. Output result to a StreamSource. Set ns-awareness to
+     * TRUE and prefixes to TRUE.
+     */
+    @Test
+    public void testXMLNoNsAwareStreamResult4() {
+        try {
+            // Create SAX parser *without* enabling ns
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true); // Same as default
+            spf.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+            SAXParser sp = spf.newSAXParser();
+
+            // Make sure that the output is well formed
+            String xml = runTransform(sp);
+            checkWellFormedness(xml);
+        } catch (Throwable ex) {
+            Assert.fail(ex.toString());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.dtd
new file mode 100644
index 00000000000..84cfe658bef
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.dtd
@@ -0,0 +1,3 @@
+<!ENTITY % label.qname "IGNORE" >
+<!ENTITY % xhtml PUBLIC "-//W3C//DTD XHTML 1.1//EN" "Bug6608841_xhtml11-flat.dtd">
+%xhtml;
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.java
new file mode 100644
index 00000000000..d68837793fe
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6608841
+ * @summary Test SAX parses external parameter entity.
+ */
+public class Bug6608841 {
+    public Bug6608841(String name) {
+    }
+
+    @Test
+    public void testParse() throws ParserConfigurationException, SAXException, IOException {
+        String file = getClass().getResource("Bug6608841.xml").getFile();
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        SAXParser parser = spf.newSAXParser();
+        parser.parse(new File(file), new MyHandler());
+    }
+
+    public class MyHandler extends DefaultHandler {
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.xml
new file mode 100644
index 00000000000..faf829fc099
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841.xml
@@ -0,0 +1,10 @@
+<!DOCTYPE html SYSTEM "Bug6608841.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<title>Some Title</title>
+</head>
+<body>
+<h1>Some Title</h1>
+<p>This is a test. This is only a test.</p>
+</body>
+</html>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841_xhtml11-flat.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841_xhtml11-flat.dtd
new file mode 100644
index 00000000000..e5fc323f8fa
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6608841_xhtml11-flat.dtd
@@ -0,0 +1 @@
+<?doc type="doctype" role="title" { XHTML 1.1 } ?>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6690015.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6690015.java
new file mode 100644
index 00000000000..50838e82196
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6690015.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.FileInputStream;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 6518733
+ * @summary Test SAX parser handles several attributes with newlines.
+ */
+public class Bug6690015 {
+
+    public Bug6690015() {
+    }
+
+    @Test
+    public void test() {
+        try {
+            FileInputStream fis = new FileInputStream(getClass().getResource("bug6690015.xml").getFile());
+
+            Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(new InputSource(fis));
+            Element root = doc.getDocumentElement();
+            NodeList textnodes = root.getElementsByTagName("text");
+            int len = textnodes.getLength();
+            int index = 0;
+            int attindex = 0;
+            int attrlen = 0;
+            NamedNodeMap attrs = null;
+
+            while (index < len) {
+                Element te = (Element) textnodes.item(index);
+                attrs = te.getAttributes();
+                attrlen = attrs.getLength();
+                attindex = 0;
+                Node node = null;
+
+                while (attindex < attrlen) {
+                    node = attrs.item(attindex);
+                    System.out.println("attr: " + node.getNodeName() + " is shown holding value: " + node.getNodeValue());
+                    attindex++;
+                }
+                index++;
+                System.out.println("-------------");
+            }
+            fis.close();
+        } catch (Exception e) {
+            Assert.fail("Exception: " + e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6760982.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6760982.java
new file mode 100644
index 00000000000..1a2bc04f9de
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6760982.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.Reader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 6518733
+ * @summary Test SAX parser handles several attributes with containing "&gt;".
+ */
+public class Bug6760982 {
+
+    @Test
+    public void test() {
+        try {
+            Document xmlDoc = _Parse(new File(getClass().getResource("bug6760982.xml").getFile()));
+            Node node = xmlDoc.getDocumentElement();
+
+            _ProcessNode(node, 0);
+            _Flush();
+        } catch (Exception e) {
+            _ErrPrintln("Exception: " + e.toString());
+            Assert.fail("Exception: " + e.getMessage());
+        }
+    }
+
+    private static void _Flush() {
+        System.out.flush();
+        System.err.flush();
+    }
+
+    private static void _Println(String str, int level) {
+        for (int i = 0; i < level; i++)
+            System.out.print("    ");
+
+        System.out.println(str);
+        System.out.flush();
+    }
+
+    private static void _ErrPrintln(String aStr) {
+        System.out.flush();
+        System.err.println(aStr);
+        System.err.flush();
+    }
+
+    private static Document _Parse(File f) throws Exception {
+        FileReader rd = new FileReader(f);
+        Document doc = _Parse(rd);
+
+        rd.close();
+
+        return doc;
+    }
+
+    private static Document _Parse(Reader src) throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+        dbf.setValidating(false); // to improve performance
+
+        DocumentBuilder xmlParser = dbf.newDocumentBuilder();
+        InputSource is = new InputSource(src);
+
+        return xmlParser.parse(is);
+    }
+
+    private static void _PrintAttributes(Node n, int level) {
+        NamedNodeMap nnmap = n.getAttributes();
+
+        if (nnmap != null && nnmap.getLength() > 0) {
+            _Println("<attribs> (" + nnmap.getClass() + "):", level + 1);
+
+            for (int i = 0; i < nnmap.getLength(); i++) {
+                Node an = nnmap.item(i);
+
+                String nameStr = an.getNodeName();
+                String valueStr = an.getNodeValue();
+
+                if (valueStr != "")
+                    nameStr += " = " + valueStr;
+
+                _Println(nameStr, level + 2);
+            }
+        }
+    }
+
+    private static void _ProcessChildren(Node n, int level) throws Exception {
+        NodeList nlist = n.getChildNodes();
+
+        if (nlist != null)
+            for (int i = 0; i < nlist.getLength(); i++)
+                _ProcessNode(nlist.item(i), level + 1);
+    }
+
+    private static void _ProcessNode(Node n, int level) throws Exception {
+        n.getAttributes();
+        n.getChildNodes();
+
+        // At this point, for JVM 1.6 and Xerces <= 1.3.1,
+        // Test-XML.xml::mytest:Y's attribute is (already) bad.
+
+        switch (n.getNodeType()) {
+
+            case Node.TEXT_NODE:
+                String str = n.getNodeValue().trim();
+
+                /* ...Only print non-empty strings... */
+                if (str.length() > 0) {
+                    String valStr = n.getNodeValue();
+
+                    _Println(valStr, level);
+                }
+                break;
+
+            case Node.COMMENT_NODE:
+                break;
+
+            default: {
+                String nodeNameStr = n.getNodeName();
+
+                _Println(nodeNameStr + " (" + n.getClass() + "):", level);
+
+                /* ...Print children... */
+                _ProcessChildren(n, level);
+
+                /* ...Print optional node attributes... */
+                _PrintAttributes(n, level);
+            }
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6849942Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6849942Test.java
new file mode 100644
index 00000000000..3a28a094243
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug6849942Test.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.ByteArrayInputStream;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.ProcessingInstruction;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 6849942
+ * @summary Test parsing an XML that starts with a processing instruction and no prolog.
+ */
+public class Bug6849942Test {
+
+    @Test
+    public void test() throws Exception {
+        try {
+            ByteArrayInputStream bais = new ByteArrayInputStream("<?xmltarget foo?><test></test>".getBytes());
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            DocumentBuilder xmlParser = factory.newDocumentBuilder();
+            // DOMParser p = new DOMParser();
+            Document document = xmlParser.parse(new InputSource(bais));
+            String result = ((ProcessingInstruction) document.getFirstChild()).getData();
+            System.out.println(result);
+            if (!result.equalsIgnoreCase("foo")) {
+                Assert.fail("missing PI data");
+            }
+
+        } catch (Exception e) {
+        }
+    }
+
+    @Test
+    public void testWProlog() throws Exception {
+        try {
+            ByteArrayInputStream bais = new ByteArrayInputStream("<?xml version=\"1.1\" encoding=\"UTF-8\"?><?xmltarget foo?><test></test>".getBytes());
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            DocumentBuilder xmlParser = factory.newDocumentBuilder();
+            // DOMParser p = new DOMParser();
+            Document document = xmlParser.parse(new InputSource(bais));
+            String result = ((ProcessingInstruction) document.getFirstChild()).getData();
+            System.out.println(result);
+            if (!result.equalsIgnoreCase("foo")) {
+                Assert.fail("missing PI data");
+            }
+        } catch (Exception e) {
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608.dtd
new file mode 100644
index 00000000000..25db77a98a5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608.dtd
@@ -0,0 +1 @@
+<!ELEMENT arg (#PCDATA)>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608.xml
new file mode 100644
index 00000000000..7c53ec2d426
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Document   : test1.xml
+    Created on : 2012/04/13, 18:21
+    Author     : 10385373
+    Description:
+        Purpose of the document follows.
+-->
+
+<root>
+
+</root>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608Test.java
new file mode 100644
index 00000000000..c4a7f7a42e6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608Test.java
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.File;
+import java.io.IOException;
+
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 7157608
+ * @summary Test feature standard-uri-conformant works.
+ */
+public class Bug7157608Test {
+    public static boolean isWindows = false;
+    static {
+        if (System.getProperty("os.name").indexOf("Windows") > -1) {
+            isWindows = true;
+        }
+    };
+
+    String xml1, xml2;
+
+    @BeforeMethod
+    protected void setUp() throws IOException {
+        File file1 = new File(getClass().getResource("Bug7157608.xml").getFile());
+        xml1 = file1.getPath().replace("\\", "\\\\");
+        File file2 = new File(getClass().getResource("Bug7157608_1.xml").getFile());
+        xml2 = file2.getPath();
+    }
+
+    // case 1
+    // standard-uri-confomant is false
+    // dtd-validation is false
+    @Test
+    public void test1() {
+        if (isWindows) {
+            try {
+                ParserSettings ps = new ParserSettings();
+
+                DocumentBuilder db = getDocumentBuilder(ps);
+                InputSource is = new InputSource();
+                is.setSystemId(xml1);
+                Document doc = db.parse(is);
+                System.out.println("test1() :OK");
+            } catch (Exception e) {
+                Assert.fail("test1() :NG");
+
+            }
+        }
+    }
+
+    // case 2
+    // standard-uri-confomant is false
+    // dtd-validation is true
+    @Test
+    public void test2() {
+        if (isWindows) {
+            try {
+                ParserSettings ps = new ParserSettings();
+                ps.validating = true;
+
+                DocumentBuilder db = getDocumentBuilder(ps);
+                InputSource is = new InputSource(xml2);
+                Document doc = db.parse(is);
+                System.out.println("test2() :OK");
+            } catch (Exception e) {
+                Assert.fail("test2() :NG");
+                // logger.info(e.getMessage());
+            }
+        }
+    }
+
+    // case 3
+    // standard-uri-confomant is true
+    @Test
+    public void test3() {
+        if (isWindows) {
+            try {
+                ParserSettings ps = new ParserSettings();
+                ps.standardUriConformant = true;
+
+                DocumentBuilder db = getDocumentBuilder(ps);
+                InputSource is = new InputSource();
+                is.setSystemId(xml1);
+                Document doc = db.parse(is);
+                Assert.fail("test3() :NG");
+            } catch (IOException e) {
+                String returnedErr = e.getMessage();
+                String expectedStr = "Opaque part contains invalid character";
+
+                if (returnedErr.indexOf(expectedStr) >= 0) {
+                    System.out.println("test3() :OK");
+                } else {
+                    Assert.fail("test3() :NG");
+                }
+            } catch (Exception e) {
+                System.out.println("test3() :NG");
+            }
+        }
+    }
+
+    // case 4
+    // standard-uri-confomant is true
+    // dtd-validation is true
+    @Test
+    public void test4() {
+        if (isWindows) {
+            try {
+                ParserSettings ps = new ParserSettings();
+                ps.standardUriConformant = true;
+                ps.validating = true;
+
+                DocumentBuilder db = getDocumentBuilder(ps);
+                InputSource is = new InputSource(xml2);
+                Document doc = db.parse(is);
+                Assert.fail("test4() :NG");
+            } catch (IOException e) {
+                String returnedErr = e.getMessage();
+                String expectedStr = "Opaque part contains invalid character";
+
+                if (returnedErr.indexOf(expectedStr) >= 0) {
+                    System.out.println("test3() :OK");
+                } else {
+                    Assert.fail("test3() :NG");
+                }
+            } catch (Exception e) {
+                Assert.fail("test4() :NG");
+            }
+        }
+    }
+
+    public DocumentBuilder getDocumentBuilder(ParserSettings ps) {
+        DocumentBuilder db = null;
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            if (ps.standardUriConformant) {
+                dbf.setFeature("http://apache.org/xml/features/standard-uri-conformant", true);
+            }
+            dbf.setValidating(ps.validating);
+            db = dbf.newDocumentBuilder();
+            db.setErrorHandler(new MyHandler());
+        } catch (Exception e) {
+            Assert.fail("standard-uri-conformant not recognized");
+        }
+        return db;
+    }
+
+    class MyHandler extends DefaultHandler {
+        @Override
+        public void warning(SAXParseException e) throws SAXException {
+            printDetail("**Warning**", e);
+        }
+
+        @Override
+        public void error(SAXParseException e) throws SAXException {
+            printDetail("**Error**", e);
+            throw new SAXException("Error encountered");
+        }
+
+        @Override
+        public void fatalError(SAXParseException e) throws SAXException {
+            printDetail("**Fatal Error**", e);
+            throw new SAXException("Fatal Error encountered");
+        }
+
+        public void printDetail(String msg, SAXParseException e) {
+            System.out.println(msg);
+            System.out.println(e.getMessage());
+            System.out.println("  Line:    " + e.getLineNumber());
+            System.out.println("  Column:  " + e.getColumnNumber());
+            System.out.println("  URI:     " + e.getSystemId());
+        }
+
+    }
+
+    class ParserSettings {
+        boolean standardUriConformant = false;
+        boolean validating = false;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608_1.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608_1.xml
new file mode 100644
index 00000000000..0b5e94cd6f1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7157608_1.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Document   : test2.xml
+    Created on : 2012/04/13, 20:08
+    Author     : 10385373
+    Description:
+        Purpose of the document follows.
+-->
+
+<!DOCTYPE arg PUBLIC '-//Apache Software Foundation//DTD Commons Validator Rules Configuration 1.1.3//EN' 'Bug7157608.dtd'>
+<arg>
+test
+</arg>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7166896Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7166896Test.java
new file mode 100644
index 00000000000..e886bca59c9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug7166896Test.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.IOException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 7166896
+ * @summary Test DocumentBuilder.parse(String uri) supports IPv6 format.
+ */
+public class Bug7166896Test {
+
+    @Test
+    public void test() throws Exception {
+        final String url = "http://[fe80::la03:73ff:fead:f7b0]/note.xml";
+        final DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+        domFactory.setNamespaceAware(true);
+        DocumentBuilder builder;
+        Document doc = null;
+        System.out.println("URL is " + url);
+        try {
+            builder = domFactory.newDocumentBuilder();
+            // here comes the MalformedURLException. With Java6 / 7 it looks
+            // like this:
+            // java.net.MalformedURLException: For input string:
+            // ":la03:73ff:fead:f7b0%5D"
+            // which is not fine.
+            // with xerces 2.11.0 it complains about a non-existing host, which
+            // is fine
+            System.out.println("passing URL to DocumentBuilder.parse()");
+            doc = builder.parse(url);
+
+        } catch (SAXException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            String em = e.getMessage();
+            System.err.println("Error message: " + em);
+            if (em.contains("For input string: \":la03:73ff:fead:f7b0%5D\"")) {
+                Assert.fail("failed to accept IPv6 address");
+            }
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+        }
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug8003147Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug8003147Test.java
new file mode 100644
index 00000000000..d345f1bf2d6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/Bug8003147Test.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.FileOutputStream;
+import java.util.ArrayList;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.sun.org.apache.bcel.internal.classfile.ClassParser;
+import com.sun.org.apache.bcel.internal.classfile.ConstantClass;
+import com.sun.org.apache.bcel.internal.classfile.ConstantPool;
+import com.sun.org.apache.bcel.internal.classfile.ConstantUtf8;
+import com.sun.org.apache.bcel.internal.classfile.JavaClass;
+import com.sun.org.apache.bcel.internal.classfile.Method;
+import com.sun.org.apache.bcel.internal.generic.ClassGen;
+import com.sun.org.apache.bcel.internal.generic.MethodGen;
+
+/*
+ * @bug 8003147
+ * @summary Test port fix for BCEL bug 39695.
+ */
+public class Bug8003147Test {
+
+    @Test
+    public void test() throws Exception {
+        String classfile = getClass().getResource("Bug8003147Test.class").getPath();
+        JavaClass jc = new ClassParser(classfile).parse();
+        // rename class
+        ConstantPool cp = jc.getConstantPool();
+        int cpIndex = ((ConstantClass) cp.getConstant(jc.getClassNameIndex())).getNameIndex();
+        cp.setConstant(cpIndex, new ConstantUtf8("javax/xml/parsers/Bug8003147TestPrime"));
+        ClassGen gen = new ClassGen(jc);
+        Method[] methods = jc.getMethods();
+        int index;
+        for (index = 0; index < methods.length; index++) {
+            if (methods[index].getName().equals("doSomething")) {
+                break;
+            }
+        }
+        Method m = methods[index];
+        MethodGen mg = new MethodGen(m, gen.getClassName(), gen.getConstantPool());
+        gen.replaceMethod(m, mg.getMethod());
+        String path = classfile.replace("Bug8003147Test", "Bug8003147TestPrime");
+        gen.getJavaClass().dump(new FileOutputStream(path));
+
+        try {
+            Class.forName("javax.xml.parsers.Bug8003147TestPrime");
+        } catch (ClassFormatError cfe) {
+            cfe.printStackTrace();
+            Assert.fail("modified version of class does not pass verification");
+        }
+    }
+
+    public void doSomething(double d, ArrayList<Integer> list) {
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/DosTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/DosTest.xml
new file mode 100644
index 00000000000..757213ee5f4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/DosTest.xml
@@ -0,0 +1,2031 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<personnel>
+
+<person id="Big.Boss"  A100 = "" 
+A101 = "" A102 = "" A103 = "" A104 = "" A105 = "" A106 = "" A107 = "" A108 = "" A109 = "" A110 = "" 
+A111 = "" A112 = "" A113 = "" A114 = "" A115 = "" A116 = "" A117 = "" A118 = "" A119 = "" A120 = "" 
+A121 = "" A122 = "" A123 = "" A124 = "" A125 = "" A126 = "" A127 = "" A128 = "" A129 = "" A130 = "" 
+A131 = "" A132 = "" A133 = "" A134 = "" A135 = "" A136 = "" A137 = "" A138 = "" A139 = "" A140 = "" 
+A141 = "" A142 = "" A143 = "" A144 = "" A145 = "" A146 = "" A147 = "" A148 = "" A149 = "" A150 = "" 
+A151 = "" A152 = "" A153 = "" A154 = "" A155 = "" A156 = "" A157 = "" A158 = "" A159 = "" A160 = "" 
+A161 = "" A162 = "" A163 = "" A164 = "" A165 = "" A166 = "" A167 = "" A168 = "" A169 = "" A170 = "" 
+A171 = "" A172 = "" A173 = "" A174 = "" A175 = "" A176 = "" A177 = "" A178 = "" A179 = "" A180 = "" 
+A181 = "" A182 = "" A183 = "" A184 = "" A185 = "" A186 = "" A187 = "" A188 = "" A189 = "" A190 = "" 
+A191 = "" A192 = "" A193 = "" A194 = "" A195 = "" A196 = "" A197 = "" A198 = "" A199 = "" A200 = "" 
+A201 = "" A202 = "" A203 = "" A204 = "" A205 = "" A206 = "" A207 = "" A208 = "" A209 = "" A210 = "" 
+A211 = "" A212 = "" A213 = "" A214 = "" A215 = "" A216 = "" A217 = "" A218 = "" A219 = "" A220 = "" 
+A221 = "" A222 = "" A223 = "" A224 = "" A225 = "" A226 = "" A227 = "" A228 = "" A229 = "" A230 = "" 
+A231 = "" A232 = "" A233 = "" A234 = "" A235 = "" A236 = "" A237 = "" A238 = "" A239 = "" A240 = "" 
+A241 = "" A242 = "" A243 = "" A244 = "" A245 = "" A246 = "" A247 = "" A248 = "" A249 = "" A250 = "" 
+A251 = "" A252 = "" A253 = "" A254 = "" A255 = "" A256 = "" A257 = "" A258 = "" A259 = "" A260 = "" 
+A261 = "" A262 = "" A263 = "" A264 = "" A265 = "" A266 = "" A267 = "" A268 = "" A269 = "" A270 = "" 
+A271 = "" A272 = "" A273 = "" A274 = "" A275 = "" A276 = "" A277 = "" A278 = "" A279 = "" A280 = "" 
+A281 = "" A282 = "" A283 = "" A284 = "" A285 = "" A286 = "" A287 = "" A288 = "" A289 = "" A290 = "" 
+A291 = "" A292 = "" A293 = "" A294 = "" A295 = "" A296 = "" A297 = "" A298 = "" A299 = "" A300 = "" 
+A301 = "" A302 = "" A303 = "" A304 = "" A305 = "" A306 = "" A307 = "" A308 = "" A309 = "" A310 = "" 
+A311 = "" A312 = "" A313 = "" A314 = "" A315 = "" A316 = "" A317 = "" A318 = "" A319 = "" A320 = "" 
+A321 = "" A322 = "" A323 = "" A324 = "" A325 = "" A326 = "" A327 = "" A328 = "" A329 = "" A330 = "" 
+A331 = "" A332 = "" A333 = "" A334 = "" A335 = "" A336 = "" A337 = "" A338 = "" A339 = "" A340 = "" 
+A341 = "" A342 = "" A343 = "" A344 = "" A345 = "" A346 = "" A347 = "" A348 = "" A349 = "" A350 = "" 
+A351 = "" A352 = "" A353 = "" A354 = "" A355 = "" A356 = "" A357 = "" A358 = "" A359 = "" A360 = "" 
+A361 = "" A362 = "" A363 = "" A364 = "" A365 = "" A366 = "" A367 = "" A368 = "" A369 = "" A370 = "" 
+A371 = "" A372 = "" A373 = "" A374 = "" A375 = "" A376 = "" A377 = "" A378 = "" A379 = "" A380 = "" 
+A381 = "" A382 = "" A383 = "" A384 = "" A385 = "" A386 = "" A387 = "" A388 = "" A389 = "" A390 = "" 
+A391 = "" A392 = "" A393 = "" A394 = "" A395 = "" A396 = "" A397 = "" A398 = "" A399 = "" A400 = "" 
+A401 = "" A402 = "" A403 = "" A404 = "" A405 = "" A406 = "" A407 = "" A408 = "" A409 = "" A410 = "" 
+A411 = "" A412 = "" A413 = "" A414 = "" A415 = "" A416 = "" A417 = "" A418 = "" A419 = "" A420 = "" 
+A421 = "" A422 = "" A423 = "" A424 = "" A425 = "" A426 = "" A427 = "" A428 = "" A429 = "" A430 = "" 
+A431 = "" A432 = "" A433 = "" A434 = "" A435 = "" A436 = "" A437 = "" A438 = "" A439 = "" A440 = "" 
+A441 = "" A442 = "" A443 = "" A444 = "" A445 = "" A446 = "" A447 = "" A448 = "" A449 = "" A450 = "" 
+A451 = "" A452 = "" A453 = "" A454 = "" A455 = "" A456 = "" A457 = "" A458 = "" A459 = "" A460 = "" 
+A461 = "" A462 = "" A463 = "" A464 = "" A465 = "" A466 = "" A467 = "" A468 = "" A469 = "" A470 = "" 
+A471 = "" A472 = "" A473 = "" A474 = "" A475 = "" A476 = "" A477 = "" A478 = "" A479 = "" A480 = "" 
+A481 = "" A482 = "" A483 = "" A484 = "" A485 = "" A486 = "" A487 = "" A488 = "" A489 = "" A490 = "" 
+A491 = "" A492 = "" A493 = "" A494 = "" A495 = "" A496 = "" A497 = "" A498 = "" A499 = "" A500 = "" 
+A501 = "" A502 = "" A503 = "" A504 = "" A505 = "" A506 = "" A507 = "" A508 = "" A509 = "" A510 = "" 
+A511 = "" A512 = "" A513 = "" A514 = "" A515 = "" A516 = "" A517 = "" A518 = "" A519 = "" A520 = "" 
+A521 = "" A522 = "" A523 = "" A524 = "" A525 = "" A526 = "" A527 = "" A528 = "" A529 = "" A530 = "" 
+A531 = "" A532 = "" A533 = "" A534 = "" A535 = "" A536 = "" A537 = "" A538 = "" A539 = "" A540 = "" 
+A541 = "" A542 = "" A543 = "" A544 = "" A545 = "" A546 = "" A547 = "" A548 = "" A549 = "" A550 = "" 
+A551 = "" A552 = "" A553 = "" A554 = "" A555 = "" A556 = "" A557 = "" A558 = "" A559 = "" A560 = "" 
+A561 = "" A562 = "" A563 = "" A564 = "" A565 = "" A566 = "" A567 = "" A568 = "" A569 = "" A570 = "" 
+A571 = "" A572 = "" A573 = "" A574 = "" A575 = "" A576 = "" A577 = "" A578 = "" A579 = "" A580 = "" 
+A581 = "" A582 = "" A583 = "" A584 = "" A585 = "" A586 = "" A587 = "" A588 = "" A589 = "" A590 = "" 
+A591 = "" A592 = "" A593 = "" A594 = "" A595 = "" A596 = "" A597 = "" A598 = "" A599 = "" A600 = "" 
+A601 = "" A602 = "" A603 = "" A604 = "" A605 = "" A606 = "" A607 = "" A608 = "" A609 = "" A610 = "" 
+A611 = "" A612 = "" A613 = "" A614 = "" A615 = "" A616 = "" A617 = "" A618 = "" A619 = "" A620 = "" 
+A621 = "" A622 = "" A623 = "" A624 = "" A625 = "" A626 = "" A627 = "" A628 = "" A629 = "" A630 = "" 
+A631 = "" A632 = "" A633 = "" A634 = "" A635 = "" A636 = "" A637 = "" A638 = "" A639 = "" A640 = "" 
+A641 = "" A642 = "" A643 = "" A644 = "" A645 = "" A646 = "" A647 = "" A648 = "" A649 = "" A650 = "" 
+A651 = "" A652 = "" A653 = "" A654 = "" A655 = "" A656 = "" A657 = "" A658 = "" A659 = "" A660 = "" 
+A661 = "" A662 = "" A663 = "" A664 = "" A665 = "" A666 = "" A667 = "" A668 = "" A669 = "" A670 = "" 
+A671 = "" A672 = "" A673 = "" A674 = "" A675 = "" A676 = "" A677 = "" A678 = "" A679 = "" A680 = "" 
+A681 = "" A682 = "" A683 = "" A684 = "" A685 = "" A686 = "" A687 = "" A688 = "" A689 = "" A690 = "" 
+A691 = "" A692 = "" A693 = "" A694 = "" A695 = "" A696 = "" A697 = "" A698 = "" A699 = "" A700 = "" 
+A701 = "" A702 = "" A703 = "" A704 = "" A705 = "" A706 = "" A707 = "" A708 = "" A709 = "" A710 = "" 
+A711 = "" A712 = "" A713 = "" A714 = "" A715 = "" A716 = "" A717 = "" A718 = "" A719 = "" A720 = "" 
+A721 = "" A722 = "" A723 = "" A724 = "" A725 = "" A726 = "" A727 = "" A728 = "" A729 = "" A730 = "" 
+A731 = "" A732 = "" A733 = "" A734 = "" A735 = "" A736 = "" A737 = "" A738 = "" A739 = "" A740 = "" 
+A741 = "" A742 = "" A743 = "" A744 = "" A745 = "" A746 = "" A747 = "" A748 = "" A749 = "" A750 = "" 
+A751 = "" A752 = "" A753 = "" A754 = "" A755 = "" A756 = "" A757 = "" A758 = "" A759 = "" A760 = "" 
+A761 = "" A762 = "" A763 = "" A764 = "" A765 = "" A766 = "" A767 = "" A768 = "" A769 = "" A770 = "" 
+A771 = "" A772 = "" A773 = "" A774 = "" A775 = "" A776 = "" A777 = "" A778 = "" A779 = "" A780 = "" 
+A781 = "" A782 = "" A783 = "" A784 = "" A785 = "" A786 = "" A787 = "" A788 = "" A789 = "" A790 = "" 
+A791 = "" A792 = "" A793 = "" A794 = "" A795 = "" A796 = "" A797 = "" A798 = "" A799 = "" A800 = "" 
+A801 = "" A802 = "" A803 = "" A804 = "" A805 = "" A806 = "" A807 = "" A808 = "" A809 = "" A810 = "" 
+A811 = "" A812 = "" A813 = "" A814 = "" A815 = "" A816 = "" A817 = "" A818 = "" A819 = "" A820 = "" 
+A821 = "" A822 = "" A823 = "" A824 = "" A825 = "" A826 = "" A827 = "" A828 = "" A829 = "" A830 = "" 
+A831 = "" A832 = "" A833 = "" A834 = "" A835 = "" A836 = "" A837 = "" A838 = "" A839 = "" A840 = "" 
+A841 = "" A842 = "" A843 = "" A844 = "" A845 = "" A846 = "" A847 = "" A848 = "" A849 = "" A850 = "" 
+A851 = "" A852 = "" A853 = "" A854 = "" A855 = "" A856 = "" A857 = "" A858 = "" A859 = "" A860 = "" 
+A861 = "" A862 = "" A863 = "" A864 = "" A865 = "" A866 = "" A867 = "" A868 = "" A869 = "" A870 = "" 
+A871 = "" A872 = "" A873 = "" A874 = "" A875 = "" A876 = "" A877 = "" A878 = "" A879 = "" A880 = "" 
+A881 = "" A882 = "" A883 = "" A884 = "" A885 = "" A886 = "" A887 = "" A888 = "" A889 = "" A890 = "" 
+A891 = "" A892 = "" A893 = "" A894 = "" A895 = "" A896 = "" A897 = "" A898 = "" A899 = "" A900 = "" 
+A901 = "" A902 = "" A903 = "" A904 = "" A905 = "" A906 = "" A907 = "" A908 = "" A909 = "" A910 = "" 
+A911 = "" A912 = "" A913 = "" A914 = "" A915 = "" A916 = "" A917 = "" A918 = "" A919 = "" A920 = "" 
+A921 = "" A922 = "" A923 = "" A924 = "" A925 = "" A926 = "" A927 = "" A928 = "" A929 = "" A930 = "" 
+A931 = "" A932 = "" A933 = "" A934 = "" A935 = "" A936 = "" A937 = "" A938 = "" A939 = "" A940 = "" 
+A941 = "" A942 = "" A943 = "" A944 = "" A945 = "" A946 = "" A947 = "" A948 = "" A949 = "" A950 = "" 
+A951 = "" A952 = "" A953 = "" A954 = "" A955 = "" A956 = "" A957 = "" A958 = "" A959 = "" A960 = "" 
+A961 = "" A962 = "" A963 = "" A964 = "" A965 = "" A966 = "" A967 = "" A968 = "" A969 = "" A970 = "" 
+A971 = "" A972 = "" A973 = "" A974 = "" A975 = "" A976 = "" A977 = "" A978 = "" A979 = "" A980 = "" 
+A981 = "" A982 = "" A983 = "" A984 = "" A985 = "" A986 = "" A987 = "" A988 = "" A989 = "" A990 = "" 
+A991 = "" A992 = "" A993 = "" A994 = "" A995 = "" A996 = "" A997 = "" A998 = "" A999 = "" A1000 = "" 
+A1001 = "" A1002 = "" A1003 = "" A1004 = "" A1005 = "" A1006 = "" A1007 = "" A1008 = "" A1009 = "" A1010 = "" 
+A1011 = "" A1012 = "" A1013 = "" A1014 = "" A1015 = "" A1016 = "" A1017 = "" A1018 = "" A1019 = "" A1020 = "" 
+A1021 = "" A1022 = "" A1023 = "" A1024 = "" A1025 = "" A1026 = "" A1027 = "" A1028 = "" A1029 = "" A1030 = "" 
+A1031 = "" A1032 = "" A1033 = "" A1034 = "" A1035 = "" A1036 = "" A1037 = "" A1038 = "" A1039 = "" A1040 = "" 
+A1041 = "" A1042 = "" A1043 = "" A1044 = "" A1045 = "" A1046 = "" A1047 = "" A1048 = "" A1049 = "" A1050 = "" 
+A1051 = "" A1052 = "" A1053 = "" A1054 = "" A1055 = "" A1056 = "" A1057 = "" A1058 = "" A1059 = "" A1060 = "" 
+A1061 = "" A1062 = "" A1063 = "" A1064 = "" A1065 = "" A1066 = "" A1067 = "" A1068 = "" A1069 = "" A1070 = "" 
+A1071 = "" A1072 = "" A1073 = "" A1074 = "" A1075 = "" A1076 = "" A1077 = "" A1078 = "" A1079 = "" A1080 = "" 
+A1081 = "" A1082 = "" A1083 = "" A1084 = "" A1085 = "" A1086 = "" A1087 = "" A1088 = "" A1089 = "" A1090 = "" 
+A1091 = "" A1092 = "" A1093 = "" A1094 = "" A1095 = "" A1096 = "" A1097 = "" A1098 = "" A1099 = "" A1100 = "" 
+A1101 = "" A1102 = "" A1103 = "" A1104 = "" A1105 = "" A1106 = "" A1107 = "" A1108 = "" A1109 = "" A1110 = "" 
+A1111 = "" A1112 = "" A1113 = "" A1114 = "" A1115 = "" A1116 = "" A1117 = "" A1118 = "" A1119 = "" A1120 = "" 
+A1121 = "" A1122 = "" A1123 = "" A1124 = "" A1125 = "" A1126 = "" A1127 = "" A1128 = "" A1129 = "" A1130 = "" 
+A1131 = "" A1132 = "" A1133 = "" A1134 = "" A1135 = "" A1136 = "" A1137 = "" A1138 = "" A1139 = "" A1140 = "" 
+A1141 = "" A1142 = "" A1143 = "" A1144 = "" A1145 = "" A1146 = "" A1147 = "" A1148 = "" A1149 = "" A1150 = "" 
+A1151 = "" A1152 = "" A1153 = "" A1154 = "" A1155 = "" A1156 = "" A1157 = "" A1158 = "" A1159 = "" A1160 = "" 
+A1161 = "" A1162 = "" A1163 = "" A1164 = "" A1165 = "" A1166 = "" A1167 = "" A1168 = "" A1169 = "" A1170 = "" 
+A1171 = "" A1172 = "" A1173 = "" A1174 = "" A1175 = "" A1176 = "" A1177 = "" A1178 = "" A1179 = "" A1180 = "" 
+A1181 = "" A1182 = "" A1183 = "" A1184 = "" A1185 = "" A1186 = "" A1187 = "" A1188 = "" A1189 = "" A1190 = "" 
+A1191 = "" A1192 = "" A1193 = "" A1194 = "" A1195 = "" A1196 = "" A1197 = "" A1198 = "" A1199 = "" A1200 = "" 
+A1201 = "" A1202 = "" A1203 = "" A1204 = "" A1205 = "" A1206 = "" A1207 = "" A1208 = "" A1209 = "" A1210 = "" 
+A1211 = "" A1212 = "" A1213 = "" A1214 = "" A1215 = "" A1216 = "" A1217 = "" A1218 = "" A1219 = "" A1220 = "" 
+A1221 = "" A1222 = "" A1223 = "" A1224 = "" A1225 = "" A1226 = "" A1227 = "" A1228 = "" A1229 = "" A1230 = "" 
+A1231 = "" A1232 = "" A1233 = "" A1234 = "" A1235 = "" A1236 = "" A1237 = "" A1238 = "" A1239 = "" A1240 = "" 
+A1241 = "" A1242 = "" A1243 = "" A1244 = "" A1245 = "" A1246 = "" A1247 = "" A1248 = "" A1249 = "" A1250 = "" 
+A1251 = "" A1252 = "" A1253 = "" A1254 = "" A1255 = "" A1256 = "" A1257 = "" A1258 = "" A1259 = "" A1260 = "" 
+A1261 = "" A1262 = "" A1263 = "" A1264 = "" A1265 = "" A1266 = "" A1267 = "" A1268 = "" A1269 = "" A1270 = "" 
+A1271 = "" A1272 = "" A1273 = "" A1274 = "" A1275 = "" A1276 = "" A1277 = "" A1278 = "" A1279 = "" A1280 = "" 
+A1281 = "" A1282 = "" A1283 = "" A1284 = "" A1285 = "" A1286 = "" A1287 = "" A1288 = "" A1289 = "" A1290 = "" 
+A1291 = "" A1292 = "" A1293 = "" A1294 = "" A1295 = "" A1296 = "" A1297 = "" A1298 = "" A1299 = "" A1300 = "" 
+A1301 = "" A1302 = "" A1303 = "" A1304 = "" A1305 = "" A1306 = "" A1307 = "" A1308 = "" A1309 = "" A1310 = "" 
+A1311 = "" A1312 = "" A1313 = "" A1314 = "" A1315 = "" A1316 = "" A1317 = "" A1318 = "" A1319 = "" A1320 = "" 
+A1321 = "" A1322 = "" A1323 = "" A1324 = "" A1325 = "" A1326 = "" A1327 = "" A1328 = "" A1329 = "" A1330 = "" 
+A1331 = "" A1332 = "" A1333 = "" A1334 = "" A1335 = "" A1336 = "" A1337 = "" A1338 = "" A1339 = "" A1340 = "" 
+A1341 = "" A1342 = "" A1343 = "" A1344 = "" A1345 = "" A1346 = "" A1347 = "" A1348 = "" A1349 = "" A1350 = "" 
+A1351 = "" A1352 = "" A1353 = "" A1354 = "" A1355 = "" A1356 = "" A1357 = "" A1358 = "" A1359 = "" A1360 = "" 
+A1361 = "" A1362 = "" A1363 = "" A1364 = "" A1365 = "" A1366 = "" A1367 = "" A1368 = "" A1369 = "" A1370 = "" 
+A1371 = "" A1372 = "" A1373 = "" A1374 = "" A1375 = "" A1376 = "" A1377 = "" A1378 = "" A1379 = "" A1380 = "" 
+A1381 = "" A1382 = "" A1383 = "" A1384 = "" A1385 = "" A1386 = "" A1387 = "" A1388 = "" A1389 = "" A1390 = "" 
+A1391 = "" A1392 = "" A1393 = "" A1394 = "" A1395 = "" A1396 = "" A1397 = "" A1398 = "" A1399 = "" A1400 = "" 
+A1401 = "" A1402 = "" A1403 = "" A1404 = "" A1405 = "" A1406 = "" A1407 = "" A1408 = "" A1409 = "" A1410 = "" 
+A1411 = "" A1412 = "" A1413 = "" A1414 = "" A1415 = "" A1416 = "" A1417 = "" A1418 = "" A1419 = "" A1420 = "" 
+A1421 = "" A1422 = "" A1423 = "" A1424 = "" A1425 = "" A1426 = "" A1427 = "" A1428 = "" A1429 = "" A1430 = "" 
+A1431 = "" A1432 = "" A1433 = "" A1434 = "" A1435 = "" A1436 = "" A1437 = "" A1438 = "" A1439 = "" A1440 = "" 
+A1441 = "" A1442 = "" A1443 = "" A1444 = "" A1445 = "" A1446 = "" A1447 = "" A1448 = "" A1449 = "" A1450 = "" 
+A1451 = "" A1452 = "" A1453 = "" A1454 = "" A1455 = "" A1456 = "" A1457 = "" A1458 = "" A1459 = "" A1460 = "" 
+A1461 = "" A1462 = "" A1463 = "" A1464 = "" A1465 = "" A1466 = "" A1467 = "" A1468 = "" A1469 = "" A1470 = "" 
+A1471 = "" A1472 = "" A1473 = "" A1474 = "" A1475 = "" A1476 = "" A1477 = "" A1478 = "" A1479 = "" A1480 = "" 
+A1481 = "" A1482 = "" A1483 = "" A1484 = "" A1485 = "" A1486 = "" A1487 = "" A1488 = "" A1489 = "" A1490 = "" 
+A1491 = "" A1492 = "" A1493 = "" A1494 = "" A1495 = "" A1496 = "" A1497 = "" A1498 = "" A1499 = "" A1500 = "" 
+A1501 = "" A1502 = "" A1503 = "" A1504 = "" A1505 = "" A1506 = "" A1507 = "" A1508 = "" A1509 = "" A1510 = "" 
+A1511 = "" A1512 = "" A1513 = "" A1514 = "" A1515 = "" A1516 = "" A1517 = "" A1518 = "" A1519 = "" A1520 = "" 
+A1521 = "" A1522 = "" A1523 = "" A1524 = "" A1525 = "" A1526 = "" A1527 = "" A1528 = "" A1529 = "" A1530 = "" 
+A1531 = "" A1532 = "" A1533 = "" A1534 = "" A1535 = "" A1536 = "" A1537 = "" A1538 = "" A1539 = "" A1540 = "" 
+A1541 = "" A1542 = "" A1543 = "" A1544 = "" A1545 = "" A1546 = "" A1547 = "" A1548 = "" A1549 = "" A1550 = "" 
+A1551 = "" A1552 = "" A1553 = "" A1554 = "" A1555 = "" A1556 = "" A1557 = "" A1558 = "" A1559 = "" A1560 = "" 
+A1561 = "" A1562 = "" A1563 = "" A1564 = "" A1565 = "" A1566 = "" A1567 = "" A1568 = "" A1569 = "" A1570 = "" 
+A1571 = "" A1572 = "" A1573 = "" A1574 = "" A1575 = "" A1576 = "" A1577 = "" A1578 = "" A1579 = "" A1580 = "" 
+A1581 = "" A1582 = "" A1583 = "" A1584 = "" A1585 = "" A1586 = "" A1587 = "" A1588 = "" A1589 = "" A1590 = "" 
+A1591 = "" A1592 = "" A1593 = "" A1594 = "" A1595 = "" A1596 = "" A1597 = "" A1598 = "" A1599 = "" A1600 = "" 
+A1601 = "" A1602 = "" A1603 = "" A1604 = "" A1605 = "" A1606 = "" A1607 = "" A1608 = "" A1609 = "" A1610 = "" 
+A1611 = "" A1612 = "" A1613 = "" A1614 = "" A1615 = "" A1616 = "" A1617 = "" A1618 = "" A1619 = "" A1620 = "" 
+A1621 = "" A1622 = "" A1623 = "" A1624 = "" A1625 = "" A1626 = "" A1627 = "" A1628 = "" A1629 = "" A1630 = "" 
+A1631 = "" A1632 = "" A1633 = "" A1634 = "" A1635 = "" A1636 = "" A1637 = "" A1638 = "" A1639 = "" A1640 = "" 
+A1641 = "" A1642 = "" A1643 = "" A1644 = "" A1645 = "" A1646 = "" A1647 = "" A1648 = "" A1649 = "" A1650 = "" 
+A1651 = "" A1652 = "" A1653 = "" A1654 = "" A1655 = "" A1656 = "" A1657 = "" A1658 = "" A1659 = "" A1660 = "" 
+A1661 = "" A1662 = "" A1663 = "" A1664 = "" A1665 = "" A1666 = "" A1667 = "" A1668 = "" A1669 = "" A1670 = "" 
+A1671 = "" A1672 = "" A1673 = "" A1674 = "" A1675 = "" A1676 = "" A1677 = "" A1678 = "" A1679 = "" A1680 = "" 
+A1681 = "" A1682 = "" A1683 = "" A1684 = "" A1685 = "" A1686 = "" A1687 = "" A1688 = "" A1689 = "" A1690 = "" 
+A1691 = "" A1692 = "" A1693 = "" A1694 = "" A1695 = "" A1696 = "" A1697 = "" A1698 = "" A1699 = "" A1700 = "" 
+A1701 = "" A1702 = "" A1703 = "" A1704 = "" A1705 = "" A1706 = "" A1707 = "" A1708 = "" A1709 = "" A1710 = "" 
+A1711 = "" A1712 = "" A1713 = "" A1714 = "" A1715 = "" A1716 = "" A1717 = "" A1718 = "" A1719 = "" A1720 = "" 
+A1721 = "" A1722 = "" A1723 = "" A1724 = "" A1725 = "" A1726 = "" A1727 = "" A1728 = "" A1729 = "" A1730 = "" 
+A1731 = "" A1732 = "" A1733 = "" A1734 = "" A1735 = "" A1736 = "" A1737 = "" A1738 = "" A1739 = "" A1740 = "" 
+A1741 = "" A1742 = "" A1743 = "" A1744 = "" A1745 = "" A1746 = "" A1747 = "" A1748 = "" A1749 = "" A1750 = "" 
+A1751 = "" A1752 = "" A1753 = "" A1754 = "" A1755 = "" A1756 = "" A1757 = "" A1758 = "" A1759 = "" A1760 = "" 
+A1761 = "" A1762 = "" A1763 = "" A1764 = "" A1765 = "" A1766 = "" A1767 = "" A1768 = "" A1769 = "" A1770 = "" 
+A1771 = "" A1772 = "" A1773 = "" A1774 = "" A1775 = "" A1776 = "" A1777 = "" A1778 = "" A1779 = "" A1780 = "" 
+A1781 = "" A1782 = "" A1783 = "" A1784 = "" A1785 = "" A1786 = "" A1787 = "" A1788 = "" A1789 = "" A1790 = "" 
+A1791 = "" A1792 = "" A1793 = "" A1794 = "" A1795 = "" A1796 = "" A1797 = "" A1798 = "" A1799 = "" A1800 = "" 
+A1801 = "" A1802 = "" A1803 = "" A1804 = "" A1805 = "" A1806 = "" A1807 = "" A1808 = "" A1809 = "" A1810 = "" 
+A1811 = "" A1812 = "" A1813 = "" A1814 = "" A1815 = "" A1816 = "" A1817 = "" A1818 = "" A1819 = "" A1820 = "" 
+A1821 = "" A1822 = "" A1823 = "" A1824 = "" A1825 = "" A1826 = "" A1827 = "" A1828 = "" A1829 = "" A1830 = "" 
+A1831 = "" A1832 = "" A1833 = "" A1834 = "" A1835 = "" A1836 = "" A1837 = "" A1838 = "" A1839 = "" A1840 = "" 
+A1841 = "" A1842 = "" A1843 = "" A1844 = "" A1845 = "" A1846 = "" A1847 = "" A1848 = "" A1849 = "" A1850 = "" 
+A1851 = "" A1852 = "" A1853 = "" A1854 = "" A1855 = "" A1856 = "" A1857 = "" A1858 = "" A1859 = "" A1860 = "" 
+A1861 = "" A1862 = "" A1863 = "" A1864 = "" A1865 = "" A1866 = "" A1867 = "" A1868 = "" A1869 = "" A1870 = "" 
+A1871 = "" A1872 = "" A1873 = "" A1874 = "" A1875 = "" A1876 = "" A1877 = "" A1878 = "" A1879 = "" A1880 = "" 
+A1881 = "" A1882 = "" A1883 = "" A1884 = "" A1885 = "" A1886 = "" A1887 = "" A1888 = "" A1889 = "" A1890 = "" 
+A1891 = "" A1892 = "" A1893 = "" A1894 = "" A1895 = "" A1896 = "" A1897 = "" A1898 = "" A1899 = "" A1900 = "" 
+A1901 = "" A1902 = "" A1903 = "" A1904 = "" A1905 = "" A1906 = "" A1907 = "" A1908 = "" A1909 = "" A1910 = "" 
+A1911 = "" A1912 = "" A1913 = "" A1914 = "" A1915 = "" A1916 = "" A1917 = "" A1918 = "" A1919 = "" A1920 = "" 
+A1921 = "" A1922 = "" A1923 = "" A1924 = "" A1925 = "" A1926 = "" A1927 = "" A1928 = "" A1929 = "" A1930 = "" 
+A1931 = "" A1932 = "" A1933 = "" A1934 = "" A1935 = "" A1936 = "" A1937 = "" A1938 = "" A1939 = "" A1940 = "" 
+A1941 = "" A1942 = "" A1943 = "" A1944 = "" A1945 = "" A1946 = "" A1947 = "" A1948 = "" A1949 = "" A1950 = "" 
+A1951 = "" A1952 = "" A1953 = "" A1954 = "" A1955 = "" A1956 = "" A1957 = "" A1958 = "" A1959 = "" A1960 = "" 
+A1961 = "" A1962 = "" A1963 = "" A1964 = "" A1965 = "" A1966 = "" A1967 = "" A1968 = "" A1969 = "" A1970 = "" 
+A1971 = "" A1972 = "" A1973 = "" A1974 = "" A1975 = "" A1976 = "" A1977 = "" A1978 = "" A1979 = "" A1980 = "" 
+A1981 = "" A1982 = "" A1983 = "" A1984 = "" A1985 = "" A1986 = "" A1987 = "" A1988 = "" A1989 = "" A1990 = "" 
+A1991 = "" A1992 = "" A1993 = "" A1994 = "" A1995 = "" A1996 = "" A1997 = "" A1998 = "" A1999 = "" A2000 = "" 
+A2001 = "" A2002 = "" A2003 = "" A2004 = "" A2005 = "" A2006 = "" A2007 = "" A2008 = "" A2009 = "" A2010 = "" 
+A2011 = "" A2012 = "" A2013 = "" A2014 = "" A2015 = "" A2016 = "" A2017 = "" A2018 = "" A2019 = "" A2020 = "" 
+A2021 = "" A2022 = "" A2023 = "" A2024 = "" A2025 = "" A2026 = "" A2027 = "" A2028 = "" A2029 = "" A2030 = "" 
+A2031 = "" A2032 = "" A2033 = "" A2034 = "" A2035 = "" A2036 = "" A2037 = "" A2038 = "" A2039 = "" A2040 = "" 
+A2041 = "" A2042 = "" A2043 = "" A2044 = "" A2045 = "" A2046 = "" A2047 = "" A2048 = "" A2049 = "" A2050 = "" 
+A2051 = "" A2052 = "" A2053 = "" A2054 = "" A2055 = "" A2056 = "" A2057 = "" A2058 = "" A2059 = "" A2060 = "" 
+A2061 = "" A2062 = "" A2063 = "" A2064 = "" A2065 = "" A2066 = "" A2067 = "" A2068 = "" A2069 = "" A2070 = "" 
+A2071 = "" A2072 = "" A2073 = "" A2074 = "" A2075 = "" A2076 = "" A2077 = "" A2078 = "" A2079 = "" A2080 = "" 
+A2081 = "" A2082 = "" A2083 = "" A2084 = "" A2085 = "" A2086 = "" A2087 = "" A2088 = "" A2089 = "" A2090 = "" 
+A2091 = "" A2092 = "" A2093 = "" A2094 = "" A2095 = "" A2096 = "" A2097 = "" A2098 = "" A2099 = "" A2100 = "" 
+A2101 = "" A2102 = "" A2103 = "" A2104 = "" A2105 = "" A2106 = "" A2107 = "" A2108 = "" A2109 = "" A2110 = "" 
+A2111 = "" A2112 = "" A2113 = "" A2114 = "" A2115 = "" A2116 = "" A2117 = "" A2118 = "" A2119 = "" A2120 = "" 
+A2121 = "" A2122 = "" A2123 = "" A2124 = "" A2125 = "" A2126 = "" A2127 = "" A2128 = "" A2129 = "" A2130 = "" 
+A2131 = "" A2132 = "" A2133 = "" A2134 = "" A2135 = "" A2136 = "" A2137 = "" A2138 = "" A2139 = "" A2140 = "" 
+A2141 = "" A2142 = "" A2143 = "" A2144 = "" A2145 = "" A2146 = "" A2147 = "" A2148 = "" A2149 = "" A2150 = "" 
+A2151 = "" A2152 = "" A2153 = "" A2154 = "" A2155 = "" A2156 = "" A2157 = "" A2158 = "" A2159 = "" A2160 = "" 
+A2161 = "" A2162 = "" A2163 = "" A2164 = "" A2165 = "" A2166 = "" A2167 = "" A2168 = "" A2169 = "" A2170 = "" 
+A2171 = "" A2172 = "" A2173 = "" A2174 = "" A2175 = "" A2176 = "" A2177 = "" A2178 = "" A2179 = "" A2180 = "" 
+A2181 = "" A2182 = "" A2183 = "" A2184 = "" A2185 = "" A2186 = "" A2187 = "" A2188 = "" A2189 = "" A2190 = "" 
+A2191 = "" A2192 = "" A2193 = "" A2194 = "" A2195 = "" A2196 = "" A2197 = "" A2198 = "" A2199 = "" A2200 = "" 
+A2201 = "" A2202 = "" A2203 = "" A2204 = "" A2205 = "" A2206 = "" A2207 = "" A2208 = "" A2209 = "" A2210 = "" 
+A2211 = "" A2212 = "" A2213 = "" A2214 = "" A2215 = "" A2216 = "" A2217 = "" A2218 = "" A2219 = "" A2220 = "" 
+A2221 = "" A2222 = "" A2223 = "" A2224 = "" A2225 = "" A2226 = "" A2227 = "" A2228 = "" A2229 = "" A2230 = "" 
+A2231 = "" A2232 = "" A2233 = "" A2234 = "" A2235 = "" A2236 = "" A2237 = "" A2238 = "" A2239 = "" A2240 = "" 
+A2241 = "" A2242 = "" A2243 = "" A2244 = "" A2245 = "" A2246 = "" A2247 = "" A2248 = "" A2249 = "" A2250 = "" 
+A2251 = "" A2252 = "" A2253 = "" A2254 = "" A2255 = "" A2256 = "" A2257 = "" A2258 = "" A2259 = "" A2260 = "" 
+A2261 = "" A2262 = "" A2263 = "" A2264 = "" A2265 = "" A2266 = "" A2267 = "" A2268 = "" A2269 = "" A2270 = "" 
+A2271 = "" A2272 = "" A2273 = "" A2274 = "" A2275 = "" A2276 = "" A2277 = "" A2278 = "" A2279 = "" A2280 = "" 
+A2281 = "" A2282 = "" A2283 = "" A2284 = "" A2285 = "" A2286 = "" A2287 = "" A2288 = "" A2289 = "" A2290 = "" 
+A2291 = "" A2292 = "" A2293 = "" A2294 = "" A2295 = "" A2296 = "" A2297 = "" A2298 = "" A2299 = "" A2300 = "" 
+A2301 = "" A2302 = "" A2303 = "" A2304 = "" A2305 = "" A2306 = "" A2307 = "" A2308 = "" A2309 = "" A2310 = "" 
+A2311 = "" A2312 = "" A2313 = "" A2314 = "" A2315 = "" A2316 = "" A2317 = "" A2318 = "" A2319 = "" A2320 = "" 
+A2321 = "" A2322 = "" A2323 = "" A2324 = "" A2325 = "" A2326 = "" A2327 = "" A2328 = "" A2329 = "" A2330 = "" 
+A2331 = "" A2332 = "" A2333 = "" A2334 = "" A2335 = "" A2336 = "" A2337 = "" A2338 = "" A2339 = "" A2340 = "" 
+A2341 = "" A2342 = "" A2343 = "" A2344 = "" A2345 = "" A2346 = "" A2347 = "" A2348 = "" A2349 = "" A2350 = "" 
+A2351 = "" A2352 = "" A2353 = "" A2354 = "" A2355 = "" A2356 = "" A2357 = "" A2358 = "" A2359 = "" A2360 = "" 
+A2361 = "" A2362 = "" A2363 = "" A2364 = "" A2365 = "" A2366 = "" A2367 = "" A2368 = "" A2369 = "" A2370 = "" 
+A2371 = "" A2372 = "" A2373 = "" A2374 = "" A2375 = "" A2376 = "" A2377 = "" A2378 = "" A2379 = "" A2380 = "" 
+A2381 = "" A2382 = "" A2383 = "" A2384 = "" A2385 = "" A2386 = "" A2387 = "" A2388 = "" A2389 = "" A2390 = "" 
+A2391 = "" A2392 = "" A2393 = "" A2394 = "" A2395 = "" A2396 = "" A2397 = "" A2398 = "" A2399 = "" A2400 = "" 
+A2401 = "" A2402 = "" A2403 = "" A2404 = "" A2405 = "" A2406 = "" A2407 = "" A2408 = "" A2409 = "" A2410 = "" 
+A2411 = "" A2412 = "" A2413 = "" A2414 = "" A2415 = "" A2416 = "" A2417 = "" A2418 = "" A2419 = "" A2420 = "" 
+A2421 = "" A2422 = "" A2423 = "" A2424 = "" A2425 = "" A2426 = "" A2427 = "" A2428 = "" A2429 = "" A2430 = "" 
+A2431 = "" A2432 = "" A2433 = "" A2434 = "" A2435 = "" A2436 = "" A2437 = "" A2438 = "" A2439 = "" A2440 = "" 
+A2441 = "" A2442 = "" A2443 = "" A2444 = "" A2445 = "" A2446 = "" A2447 = "" A2448 = "" A2449 = "" A2450 = "" 
+A2451 = "" A2452 = "" A2453 = "" A2454 = "" A2455 = "" A2456 = "" A2457 = "" A2458 = "" A2459 = "" A2460 = "" 
+A2461 = "" A2462 = "" A2463 = "" A2464 = "" A2465 = "" A2466 = "" A2467 = "" A2468 = "" A2469 = "" A2470 = "" 
+A2471 = "" A2472 = "" A2473 = "" A2474 = "" A2475 = "" A2476 = "" A2477 = "" A2478 = "" A2479 = "" A2480 = "" 
+A2481 = "" A2482 = "" A2483 = "" A2484 = "" A2485 = "" A2486 = "" A2487 = "" A2488 = "" A2489 = "" A2490 = "" 
+A2491 = "" A2492 = "" A2493 = "" A2494 = "" A2495 = "" A2496 = "" A2497 = "" A2498 = "" A2499 = "" A2500 = "" 
+A2501 = "" A2502 = "" A2503 = "" A2504 = "" A2505 = "" A2506 = "" A2507 = "" A2508 = "" A2509 = "" A2510 = "" 
+A2511 = "" A2512 = "" A2513 = "" A2514 = "" A2515 = "" A2516 = "" A2517 = "" A2518 = "" A2519 = "" A2520 = "" 
+A2521 = "" A2522 = "" A2523 = "" A2524 = "" A2525 = "" A2526 = "" A2527 = "" A2528 = "" A2529 = "" A2530 = "" 
+A2531 = "" A2532 = "" A2533 = "" A2534 = "" A2535 = "" A2536 = "" A2537 = "" A2538 = "" A2539 = "" A2540 = "" 
+A2541 = "" A2542 = "" A2543 = "" A2544 = "" A2545 = "" A2546 = "" A2547 = "" A2548 = "" A2549 = "" A2550 = "" 
+A2551 = "" A2552 = "" A2553 = "" A2554 = "" A2555 = "" A2556 = "" A2557 = "" A2558 = "" A2559 = "" A2560 = "" 
+A2561 = "" A2562 = "" A2563 = "" A2564 = "" A2565 = "" A2566 = "" A2567 = "" A2568 = "" A2569 = "" A2570 = "" 
+A2571 = "" A2572 = "" A2573 = "" A2574 = "" A2575 = "" A2576 = "" A2577 = "" A2578 = "" A2579 = "" A2580 = "" 
+A2581 = "" A2582 = "" A2583 = "" A2584 = "" A2585 = "" A2586 = "" A2587 = "" A2588 = "" A2589 = "" A2590 = "" 
+A2591 = "" A2592 = "" A2593 = "" A2594 = "" A2595 = "" A2596 = "" A2597 = "" A2598 = "" A2599 = "" A2600 = "" 
+A2601 = "" A2602 = "" A2603 = "" A2604 = "" A2605 = "" A2606 = "" A2607 = "" A2608 = "" A2609 = "" A2610 = "" 
+A2611 = "" A2612 = "" A2613 = "" A2614 = "" A2615 = "" A2616 = "" A2617 = "" A2618 = "" A2619 = "" A2620 = "" 
+A2621 = "" A2622 = "" A2623 = "" A2624 = "" A2625 = "" A2626 = "" A2627 = "" A2628 = "" A2629 = "" A2630 = "" 
+A2631 = "" A2632 = "" A2633 = "" A2634 = "" A2635 = "" A2636 = "" A2637 = "" A2638 = "" A2639 = "" A2640 = "" 
+A2641 = "" A2642 = "" A2643 = "" A2644 = "" A2645 = "" A2646 = "" A2647 = "" A2648 = "" A2649 = "" A2650 = "" 
+A2651 = "" A2652 = "" A2653 = "" A2654 = "" A2655 = "" A2656 = "" A2657 = "" A2658 = "" A2659 = "" A2660 = "" 
+A2661 = "" A2662 = "" A2663 = "" A2664 = "" A2665 = "" A2666 = "" A2667 = "" A2668 = "" A2669 = "" A2670 = "" 
+A2671 = "" A2672 = "" A2673 = "" A2674 = "" A2675 = "" A2676 = "" A2677 = "" A2678 = "" A2679 = "" A2680 = "" 
+A2681 = "" A2682 = "" A2683 = "" A2684 = "" A2685 = "" A2686 = "" A2687 = "" A2688 = "" A2689 = "" A2690 = "" 
+A2691 = "" A2692 = "" A2693 = "" A2694 = "" A2695 = "" A2696 = "" A2697 = "" A2698 = "" A2699 = "" A2700 = "" 
+A2701 = "" A2702 = "" A2703 = "" A2704 = "" A2705 = "" A2706 = "" A2707 = "" A2708 = "" A2709 = "" A2710 = "" 
+A2711 = "" A2712 = "" A2713 = "" A2714 = "" A2715 = "" A2716 = "" A2717 = "" A2718 = "" A2719 = "" A2720 = "" 
+A2721 = "" A2722 = "" A2723 = "" A2724 = "" A2725 = "" A2726 = "" A2727 = "" A2728 = "" A2729 = "" A2730 = "" 
+A2731 = "" A2732 = "" A2733 = "" A2734 = "" A2735 = "" A2736 = "" A2737 = "" A2738 = "" A2739 = "" A2740 = "" 
+A2741 = "" A2742 = "" A2743 = "" A2744 = "" A2745 = "" A2746 = "" A2747 = "" A2748 = "" A2749 = "" A2750 = "" 
+A2751 = "" A2752 = "" A2753 = "" A2754 = "" A2755 = "" A2756 = "" A2757 = "" A2758 = "" A2759 = "" A2760 = "" 
+A2761 = "" A2762 = "" A2763 = "" A2764 = "" A2765 = "" A2766 = "" A2767 = "" A2768 = "" A2769 = "" A2770 = "" 
+A2771 = "" A2772 = "" A2773 = "" A2774 = "" A2775 = "" A2776 = "" A2777 = "" A2778 = "" A2779 = "" A2780 = "" 
+A2781 = "" A2782 = "" A2783 = "" A2784 = "" A2785 = "" A2786 = "" A2787 = "" A2788 = "" A2789 = "" A2790 = "" 
+A2791 = "" A2792 = "" A2793 = "" A2794 = "" A2795 = "" A2796 = "" A2797 = "" A2798 = "" A2799 = "" A2800 = "" 
+A2801 = "" A2802 = "" A2803 = "" A2804 = "" A2805 = "" A2806 = "" A2807 = "" A2808 = "" A2809 = "" A2810 = "" 
+A2811 = "" A2812 = "" A2813 = "" A2814 = "" A2815 = "" A2816 = "" A2817 = "" A2818 = "" A2819 = "" A2820 = "" 
+A2821 = "" A2822 = "" A2823 = "" A2824 = "" A2825 = "" A2826 = "" A2827 = "" A2828 = "" A2829 = "" A2830 = "" 
+A2831 = "" A2832 = "" A2833 = "" A2834 = "" A2835 = "" A2836 = "" A2837 = "" A2838 = "" A2839 = "" A2840 = "" 
+A2841 = "" A2842 = "" A2843 = "" A2844 = "" A2845 = "" A2846 = "" A2847 = "" A2848 = "" A2849 = "" A2850 = "" 
+A2851 = "" A2852 = "" A2853 = "" A2854 = "" A2855 = "" A2856 = "" A2857 = "" A2858 = "" A2859 = "" A2860 = "" 
+A2861 = "" A2862 = "" A2863 = "" A2864 = "" A2865 = "" A2866 = "" A2867 = "" A2868 = "" A2869 = "" A2870 = "" 
+A2871 = "" A2872 = "" A2873 = "" A2874 = "" A2875 = "" A2876 = "" A2877 = "" A2878 = "" A2879 = "" A2880 = "" 
+A2881 = "" A2882 = "" A2883 = "" A2884 = "" A2885 = "" A2886 = "" A2887 = "" A2888 = "" A2889 = "" A2890 = "" 
+A2891 = "" A2892 = "" A2893 = "" A2894 = "" A2895 = "" A2896 = "" A2897 = "" A2898 = "" A2899 = "" A2900 = "" 
+A2901 = "" A2902 = "" A2903 = "" A2904 = "" A2905 = "" A2906 = "" A2907 = "" A2908 = "" A2909 = "" A2910 = "" 
+A2911 = "" A2912 = "" A2913 = "" A2914 = "" A2915 = "" A2916 = "" A2917 = "" A2918 = "" A2919 = "" A2920 = "" 
+A2921 = "" A2922 = "" A2923 = "" A2924 = "" A2925 = "" A2926 = "" A2927 = "" A2928 = "" A2929 = "" A2930 = "" 
+A2931 = "" A2932 = "" A2933 = "" A2934 = "" A2935 = "" A2936 = "" A2937 = "" A2938 = "" A2939 = "" A2940 = "" 
+A2941 = "" A2942 = "" A2943 = "" A2944 = "" A2945 = "" A2946 = "" A2947 = "" A2948 = "" A2949 = "" A2950 = "" 
+A2951 = "" A2952 = "" A2953 = "" A2954 = "" A2955 = "" A2956 = "" A2957 = "" A2958 = "" A2959 = "" A2960 = "" 
+A2961 = "" A2962 = "" A2963 = "" A2964 = "" A2965 = "" A2966 = "" A2967 = "" A2968 = "" A2969 = "" A2970 = "" 
+A2971 = "" A2972 = "" A2973 = "" A2974 = "" A2975 = "" A2976 = "" A2977 = "" A2978 = "" A2979 = "" A2980 = "" 
+A2981 = "" A2982 = "" A2983 = "" A2984 = "" A2985 = "" A2986 = "" A2987 = "" A2988 = "" A2989 = "" A2990 = "" 
+A2991 = "" A2992 = "" A2993 = "" A2994 = "" A2995 = "" A2996 = "" A2997 = "" A2998 = "" A2999 = "" A3000 = "" 
+A3001 = "" A3002 = "" A3003 = "" A3004 = "" A3005 = "" A3006 = "" A3007 = "" A3008 = "" A3009 = "" A3010 = "" 
+A3011 = "" A3012 = "" A3013 = "" A3014 = "" A3015 = "" A3016 = "" A3017 = "" A3018 = "" A3019 = "" A3020 = "" 
+A3021 = "" A3022 = "" A3023 = "" A3024 = "" A3025 = "" A3026 = "" A3027 = "" A3028 = "" A3029 = "" A3030 = "" 
+A3031 = "" A3032 = "" A3033 = "" A3034 = "" A3035 = "" A3036 = "" A3037 = "" A3038 = "" A3039 = "" A3040 = "" 
+A3041 = "" A3042 = "" A3043 = "" A3044 = "" A3045 = "" A3046 = "" A3047 = "" A3048 = "" A3049 = "" A3050 = "" 
+A3051 = "" A3052 = "" A3053 = "" A3054 = "" A3055 = "" A3056 = "" A3057 = "" A3058 = "" A3059 = "" A3060 = "" 
+A3061 = "" A3062 = "" A3063 = "" A3064 = "" A3065 = "" A3066 = "" A3067 = "" A3068 = "" A3069 = "" A3070 = "" 
+A3071 = "" A3072 = "" A3073 = "" A3074 = "" A3075 = "" A3076 = "" A3077 = "" A3078 = "" A3079 = "" A3080 = "" 
+A3081 = "" A3082 = "" A3083 = "" A3084 = "" A3085 = "" A3086 = "" A3087 = "" A3088 = "" A3089 = "" A3090 = "" 
+A3091 = "" A3092 = "" A3093 = "" A3094 = "" A3095 = "" A3096 = "" A3097 = "" A3098 = "" A3099 = "" A3100 = "" 
+A3101 = "" A3102 = "" A3103 = "" A3104 = "" A3105 = "" A3106 = "" A3107 = "" A3108 = "" A3109 = "" A3110 = "" 
+A3111 = "" A3112 = "" A3113 = "" A3114 = "" A3115 = "" A3116 = "" A3117 = "" A3118 = "" A3119 = "" A3120 = "" 
+A3121 = "" A3122 = "" A3123 = "" A3124 = "" A3125 = "" A3126 = "" A3127 = "" A3128 = "" A3129 = "" A3130 = "" 
+A3131 = "" A3132 = "" A3133 = "" A3134 = "" A3135 = "" A3136 = "" A3137 = "" A3138 = "" A3139 = "" A3140 = "" 
+A3141 = "" A3142 = "" A3143 = "" A3144 = "" A3145 = "" A3146 = "" A3147 = "" A3148 = "" A3149 = "" A3150 = "" 
+A3151 = "" A3152 = "" A3153 = "" A3154 = "" A3155 = "" A3156 = "" A3157 = "" A3158 = "" A3159 = "" A3160 = "" 
+A3161 = "" A3162 = "" A3163 = "" A3164 = "" A3165 = "" A3166 = "" A3167 = "" A3168 = "" A3169 = "" A3170 = "" 
+A3171 = "" A3172 = "" A3173 = "" A3174 = "" A3175 = "" A3176 = "" A3177 = "" A3178 = "" A3179 = "" A3180 = "" 
+A3181 = "" A3182 = "" A3183 = "" A3184 = "" A3185 = "" A3186 = "" A3187 = "" A3188 = "" A3189 = "" A3190 = "" 
+A3191 = "" A3192 = "" A3193 = "" A3194 = "" A3195 = "" A3196 = "" A3197 = "" A3198 = "" A3199 = "" A3200 = "" 
+A3201 = "" A3202 = "" A3203 = "" A3204 = "" A3205 = "" A3206 = "" A3207 = "" A3208 = "" A3209 = "" A3210 = "" 
+A3211 = "" A3212 = "" A3213 = "" A3214 = "" A3215 = "" A3216 = "" A3217 = "" A3218 = "" A3219 = "" A3220 = "" 
+A3221 = "" A3222 = "" A3223 = "" A3224 = "" A3225 = "" A3226 = "" A3227 = "" A3228 = "" A3229 = "" A3230 = "" 
+A3231 = "" A3232 = "" A3233 = "" A3234 = "" A3235 = "" A3236 = "" A3237 = "" A3238 = "" A3239 = "" A3240 = "" 
+A3241 = "" A3242 = "" A3243 = "" A3244 = "" A3245 = "" A3246 = "" A3247 = "" A3248 = "" A3249 = "" A3250 = "" 
+A3251 = "" A3252 = "" A3253 = "" A3254 = "" A3255 = "" A3256 = "" A3257 = "" A3258 = "" A3259 = "" A3260 = "" 
+A3261 = "" A3262 = "" A3263 = "" A3264 = "" A3265 = "" A3266 = "" A3267 = "" A3268 = "" A3269 = "" A3270 = "" 
+A3271 = "" A3272 = "" A3273 = "" A3274 = "" A3275 = "" A3276 = "" A3277 = "" A3278 = "" A3279 = "" A3280 = "" 
+A3281 = "" A3282 = "" A3283 = "" A3284 = "" A3285 = "" A3286 = "" A3287 = "" A3288 = "" A3289 = "" A3290 = "" 
+A3291 = "" A3292 = "" A3293 = "" A3294 = "" A3295 = "" A3296 = "" A3297 = "" A3298 = "" A3299 = "" A3300 = "" 
+A3301 = "" A3302 = "" A3303 = "" A3304 = "" A3305 = "" A3306 = "" A3307 = "" A3308 = "" A3309 = "" A3310 = "" 
+A3311 = "" A3312 = "" A3313 = "" A3314 = "" A3315 = "" A3316 = "" A3317 = "" A3318 = "" A3319 = "" A3320 = "" 
+A3321 = "" A3322 = "" A3323 = "" A3324 = "" A3325 = "" A3326 = "" A3327 = "" A3328 = "" A3329 = "" A3330 = "" 
+A3331 = "" A3332 = "" A3333 = "" A3334 = "" A3335 = "" A3336 = "" A3337 = "" A3338 = "" A3339 = "" A3340 = "" 
+A3341 = "" A3342 = "" A3343 = "" A3344 = "" A3345 = "" A3346 = "" A3347 = "" A3348 = "" A3349 = "" A3350 = "" 
+A3351 = "" A3352 = "" A3353 = "" A3354 = "" A3355 = "" A3356 = "" A3357 = "" A3358 = "" A3359 = "" A3360 = "" 
+A3361 = "" A3362 = "" A3363 = "" A3364 = "" A3365 = "" A3366 = "" A3367 = "" A3368 = "" A3369 = "" A3370 = "" 
+A3371 = "" A3372 = "" A3373 = "" A3374 = "" A3375 = "" A3376 = "" A3377 = "" A3378 = "" A3379 = "" A3380 = "" 
+A3381 = "" A3382 = "" A3383 = "" A3384 = "" A3385 = "" A3386 = "" A3387 = "" A3388 = "" A3389 = "" A3390 = "" 
+A3391 = "" A3392 = "" A3393 = "" A3394 = "" A3395 = "" A3396 = "" A3397 = "" A3398 = "" A3399 = "" A3400 = "" 
+A3401 = "" A3402 = "" A3403 = "" A3404 = "" A3405 = "" A3406 = "" A3407 = "" A3408 = "" A3409 = "" A3410 = "" 
+A3411 = "" A3412 = "" A3413 = "" A3414 = "" A3415 = "" A3416 = "" A3417 = "" A3418 = "" A3419 = "" A3420 = "" 
+A3421 = "" A3422 = "" A3423 = "" A3424 = "" A3425 = "" A3426 = "" A3427 = "" A3428 = "" A3429 = "" A3430 = "" 
+A3431 = "" A3432 = "" A3433 = "" A3434 = "" A3435 = "" A3436 = "" A3437 = "" A3438 = "" A3439 = "" A3440 = "" 
+A3441 = "" A3442 = "" A3443 = "" A3444 = "" A3445 = "" A3446 = "" A3447 = "" A3448 = "" A3449 = "" A3450 = "" 
+A3451 = "" A3452 = "" A3453 = "" A3454 = "" A3455 = "" A3456 = "" A3457 = "" A3458 = "" A3459 = "" A3460 = "" 
+A3461 = "" A3462 = "" A3463 = "" A3464 = "" A3465 = "" A3466 = "" A3467 = "" A3468 = "" A3469 = "" A3470 = "" 
+A3471 = "" A3472 = "" A3473 = "" A3474 = "" A3475 = "" A3476 = "" A3477 = "" A3478 = "" A3479 = "" A3480 = "" 
+A3481 = "" A3482 = "" A3483 = "" A3484 = "" A3485 = "" A3486 = "" A3487 = "" A3488 = "" A3489 = "" A3490 = "" 
+A3491 = "" A3492 = "" A3493 = "" A3494 = "" A3495 = "" A3496 = "" A3497 = "" A3498 = "" A3499 = "" A3500 = "" 
+A3501 = "" A3502 = "" A3503 = "" A3504 = "" A3505 = "" A3506 = "" A3507 = "" A3508 = "" A3509 = "" A3510 = "" 
+A3511 = "" A3512 = "" A3513 = "" A3514 = "" A3515 = "" A3516 = "" A3517 = "" A3518 = "" A3519 = "" A3520 = "" 
+A3521 = "" A3522 = "" A3523 = "" A3524 = "" A3525 = "" A3526 = "" A3527 = "" A3528 = "" A3529 = "" A3530 = "" 
+A3531 = "" A3532 = "" A3533 = "" A3534 = "" A3535 = "" A3536 = "" A3537 = "" A3538 = "" A3539 = "" A3540 = "" 
+A3541 = "" A3542 = "" A3543 = "" A3544 = "" A3545 = "" A3546 = "" A3547 = "" A3548 = "" A3549 = "" A3550 = "" 
+A3551 = "" A3552 = "" A3553 = "" A3554 = "" A3555 = "" A3556 = "" A3557 = "" A3558 = "" A3559 = "" A3560 = "" 
+A3561 = "" A3562 = "" A3563 = "" A3564 = "" A3565 = "" A3566 = "" A3567 = "" A3568 = "" A3569 = "" A3570 = "" 
+A3571 = "" A3572 = "" A3573 = "" A3574 = "" A3575 = "" A3576 = "" A3577 = "" A3578 = "" A3579 = "" A3580 = "" 
+A3581 = "" A3582 = "" A3583 = "" A3584 = "" A3585 = "" A3586 = "" A3587 = "" A3588 = "" A3589 = "" A3590 = "" 
+A3591 = "" A3592 = "" A3593 = "" A3594 = "" A3595 = "" A3596 = "" A3597 = "" A3598 = "" A3599 = "" A3600 = "" 
+A3601 = "" A3602 = "" A3603 = "" A3604 = "" A3605 = "" A3606 = "" A3607 = "" A3608 = "" A3609 = "" A3610 = "" 
+A3611 = "" A3612 = "" A3613 = "" A3614 = "" A3615 = "" A3616 = "" A3617 = "" A3618 = "" A3619 = "" A3620 = "" 
+A3621 = "" A3622 = "" A3623 = "" A3624 = "" A3625 = "" A3626 = "" A3627 = "" A3628 = "" A3629 = "" A3630 = "" 
+A3631 = "" A3632 = "" A3633 = "" A3634 = "" A3635 = "" A3636 = "" A3637 = "" A3638 = "" A3639 = "" A3640 = "" 
+A3641 = "" A3642 = "" A3643 = "" A3644 = "" A3645 = "" A3646 = "" A3647 = "" A3648 = "" A3649 = "" A3650 = "" 
+A3651 = "" A3652 = "" A3653 = "" A3654 = "" A3655 = "" A3656 = "" A3657 = "" A3658 = "" A3659 = "" A3660 = "" 
+A3661 = "" A3662 = "" A3663 = "" A3664 = "" A3665 = "" A3666 = "" A3667 = "" A3668 = "" A3669 = "" A3670 = "" 
+A3671 = "" A3672 = "" A3673 = "" A3674 = "" A3675 = "" A3676 = "" A3677 = "" A3678 = "" A3679 = "" A3680 = "" 
+A3681 = "" A3682 = "" A3683 = "" A3684 = "" A3685 = "" A3686 = "" A3687 = "" A3688 = "" A3689 = "" A3690 = "" 
+A3691 = "" A3692 = "" A3693 = "" A3694 = "" A3695 = "" A3696 = "" A3697 = "" A3698 = "" A3699 = "" A3700 = "" 
+A3701 = "" A3702 = "" A3703 = "" A3704 = "" A3705 = "" A3706 = "" A3707 = "" A3708 = "" A3709 = "" A3710 = "" 
+A3711 = "" A3712 = "" A3713 = "" A3714 = "" A3715 = "" A3716 = "" A3717 = "" A3718 = "" A3719 = "" A3720 = "" 
+A3721 = "" A3722 = "" A3723 = "" A3724 = "" A3725 = "" A3726 = "" A3727 = "" A3728 = "" A3729 = "" A3730 = "" 
+A3731 = "" A3732 = "" A3733 = "" A3734 = "" A3735 = "" A3736 = "" A3737 = "" A3738 = "" A3739 = "" A3740 = "" 
+A3741 = "" A3742 = "" A3743 = "" A3744 = "" A3745 = "" A3746 = "" A3747 = "" A3748 = "" A3749 = "" A3750 = "" 
+A3751 = "" A3752 = "" A3753 = "" A3754 = "" A3755 = "" A3756 = "" A3757 = "" A3758 = "" A3759 = "" A3760 = "" 
+A3761 = "" A3762 = "" A3763 = "" A3764 = "" A3765 = "" A3766 = "" A3767 = "" A3768 = "" A3769 = "" A3770 = "" 
+A3771 = "" A3772 = "" A3773 = "" A3774 = "" A3775 = "" A3776 = "" A3777 = "" A3778 = "" A3779 = "" A3780 = "" 
+A3781 = "" A3782 = "" A3783 = "" A3784 = "" A3785 = "" A3786 = "" A3787 = "" A3788 = "" A3789 = "" A3790 = "" 
+A3791 = "" A3792 = "" A3793 = "" A3794 = "" A3795 = "" A3796 = "" A3797 = "" A3798 = "" A3799 = "" A3800 = "" 
+A3801 = "" A3802 = "" A3803 = "" A3804 = "" A3805 = "" A3806 = "" A3807 = "" A3808 = "" A3809 = "" A3810 = "" 
+A3811 = "" A3812 = "" A3813 = "" A3814 = "" A3815 = "" A3816 = "" A3817 = "" A3818 = "" A3819 = "" A3820 = "" 
+A3821 = "" A3822 = "" A3823 = "" A3824 = "" A3825 = "" A3826 = "" A3827 = "" A3828 = "" A3829 = "" A3830 = "" 
+A3831 = "" A3832 = "" A3833 = "" A3834 = "" A3835 = "" A3836 = "" A3837 = "" A3838 = "" A3839 = "" A3840 = "" 
+A3841 = "" A3842 = "" A3843 = "" A3844 = "" A3845 = "" A3846 = "" A3847 = "" A3848 = "" A3849 = "" A3850 = "" 
+A3851 = "" A3852 = "" A3853 = "" A3854 = "" A3855 = "" A3856 = "" A3857 = "" A3858 = "" A3859 = "" A3860 = "" 
+A3861 = "" A3862 = "" A3863 = "" A3864 = "" A3865 = "" A3866 = "" A3867 = "" A3868 = "" A3869 = "" A3870 = "" 
+A3871 = "" A3872 = "" A3873 = "" A3874 = "" A3875 = "" A3876 = "" A3877 = "" A3878 = "" A3879 = "" A3880 = "" 
+A3881 = "" A3882 = "" A3883 = "" A3884 = "" A3885 = "" A3886 = "" A3887 = "" A3888 = "" A3889 = "" A3890 = "" 
+A3891 = "" A3892 = "" A3893 = "" A3894 = "" A3895 = "" A3896 = "" A3897 = "" A3898 = "" A3899 = "" A3900 = "" 
+A3901 = "" A3902 = "" A3903 = "" A3904 = "" A3905 = "" A3906 = "" A3907 = "" A3908 = "" A3909 = "" A3910 = "" 
+A3911 = "" A3912 = "" A3913 = "" A3914 = "" A3915 = "" A3916 = "" A3917 = "" A3918 = "" A3919 = "" A3920 = "" 
+A3921 = "" A3922 = "" A3923 = "" A3924 = "" A3925 = "" A3926 = "" A3927 = "" A3928 = "" A3929 = "" A3930 = "" 
+A3931 = "" A3932 = "" A3933 = "" A3934 = "" A3935 = "" A3936 = "" A3937 = "" A3938 = "" A3939 = "" A3940 = "" 
+A3941 = "" A3942 = "" A3943 = "" A3944 = "" A3945 = "" A3946 = "" A3947 = "" A3948 = "" A3949 = "" A3950 = "" 
+A3951 = "" A3952 = "" A3953 = "" A3954 = "" A3955 = "" A3956 = "" A3957 = "" A3958 = "" A3959 = "" A3960 = "" 
+A3961 = "" A3962 = "" A3963 = "" A3964 = "" A3965 = "" A3966 = "" A3967 = "" A3968 = "" A3969 = "" A3970 = "" 
+A3971 = "" A3972 = "" A3973 = "" A3974 = "" A3975 = "" A3976 = "" A3977 = "" A3978 = "" A3979 = "" A3980 = "" 
+A3981 = "" A3982 = "" A3983 = "" A3984 = "" A3985 = "" A3986 = "" A3987 = "" A3988 = "" A3989 = "" A3990 = "" 
+A3991 = "" A3992 = "" A3993 = "" A3994 = "" A3995 = "" A3996 = "" A3997 = "" A3998 = "" A3999 = "" A4000 = "" 
+A4001 = "" A4002 = "" A4003 = "" A4004 = "" A4005 = "" A4006 = "" A4007 = "" A4008 = "" A4009 = "" A4010 = "" 
+A4011 = "" A4012 = "" A4013 = "" A4014 = "" A4015 = "" A4016 = "" A4017 = "" A4018 = "" A4019 = "" A4020 = "" 
+A4021 = "" A4022 = "" A4023 = "" A4024 = "" A4025 = "" A4026 = "" A4027 = "" A4028 = "" A4029 = "" A4030 = "" 
+A4031 = "" A4032 = "" A4033 = "" A4034 = "" A4035 = "" A4036 = "" A4037 = "" A4038 = "" A4039 = "" A4040 = "" 
+A4041 = "" A4042 = "" A4043 = "" A4044 = "" A4045 = "" A4046 = "" A4047 = "" A4048 = "" A4049 = "" A4050 = "" 
+A4051 = "" A4052 = "" A4053 = "" A4054 = "" A4055 = "" A4056 = "" A4057 = "" A4058 = "" A4059 = "" A4060 = "" 
+A4061 = "" A4062 = "" A4063 = "" A4064 = "" A4065 = "" A4066 = "" A4067 = "" A4068 = "" A4069 = "" A4070 = "" 
+A4071 = "" A4072 = "" A4073 = "" A4074 = "" A4075 = "" A4076 = "" A4077 = "" A4078 = "" A4079 = "" A4080 = "" 
+A4081 = "" A4082 = "" A4083 = "" A4084 = "" A4085 = "" A4086 = "" A4087 = "" A4088 = "" A4089 = "" A4090 = "" 
+A4091 = "" A4092 = "" A4093 = "" A4094 = "" A4095 = "" A4096 = "" A4097 = "" A4098 = "" A4099 = "" A4100 = "" 
+A4101 = "" A4102 = "" A4103 = "" A4104 = "" A4105 = "" A4106 = "" A4107 = "" A4108 = "" A4109 = "" A4110 = "" 
+A4111 = "" A4112 = "" A4113 = "" A4114 = "" A4115 = "" A4116 = "" A4117 = "" A4118 = "" A4119 = "" A4120 = "" 
+A4121 = "" A4122 = "" A4123 = "" A4124 = "" A4125 = "" A4126 = "" A4127 = "" A4128 = "" A4129 = "" A4130 = "" 
+A4131 = "" A4132 = "" A4133 = "" A4134 = "" A4135 = "" A4136 = "" A4137 = "" A4138 = "" A4139 = "" A4140 = "" 
+A4141 = "" A4142 = "" A4143 = "" A4144 = "" A4145 = "" A4146 = "" A4147 = "" A4148 = "" A4149 = "" A4150 = "" 
+A4151 = "" A4152 = "" A4153 = "" A4154 = "" A4155 = "" A4156 = "" A4157 = "" A4158 = "" A4159 = "" A4160 = "" 
+A4161 = "" A4162 = "" A4163 = "" A4164 = "" A4165 = "" A4166 = "" A4167 = "" A4168 = "" A4169 = "" A4170 = "" 
+A4171 = "" A4172 = "" A4173 = "" A4174 = "" A4175 = "" A4176 = "" A4177 = "" A4178 = "" A4179 = "" A4180 = "" 
+A4181 = "" A4182 = "" A4183 = "" A4184 = "" A4185 = "" A4186 = "" A4187 = "" A4188 = "" A4189 = "" A4190 = "" 
+A4191 = "" A4192 = "" A4193 = "" A4194 = "" A4195 = "" A4196 = "" A4197 = "" A4198 = "" A4199 = "" A4200 = "" 
+A4201 = "" A4202 = "" A4203 = "" A4204 = "" A4205 = "" A4206 = "" A4207 = "" A4208 = "" A4209 = "" A4210 = "" 
+A4211 = "" A4212 = "" A4213 = "" A4214 = "" A4215 = "" A4216 = "" A4217 = "" A4218 = "" A4219 = "" A4220 = "" 
+A4221 = "" A4222 = "" A4223 = "" A4224 = "" A4225 = "" A4226 = "" A4227 = "" A4228 = "" A4229 = "" A4230 = "" 
+A4231 = "" A4232 = "" A4233 = "" A4234 = "" A4235 = "" A4236 = "" A4237 = "" A4238 = "" A4239 = "" A4240 = "" 
+A4241 = "" A4242 = "" A4243 = "" A4244 = "" A4245 = "" A4246 = "" A4247 = "" A4248 = "" A4249 = "" A4250 = "" 
+A4251 = "" A4252 = "" A4253 = "" A4254 = "" A4255 = "" A4256 = "" A4257 = "" A4258 = "" A4259 = "" A4260 = "" 
+A4261 = "" A4262 = "" A4263 = "" A4264 = "" A4265 = "" A4266 = "" A4267 = "" A4268 = "" A4269 = "" A4270 = "" 
+A4271 = "" A4272 = "" A4273 = "" A4274 = "" A4275 = "" A4276 = "" A4277 = "" A4278 = "" A4279 = "" A4280 = "" 
+A4281 = "" A4282 = "" A4283 = "" A4284 = "" A4285 = "" A4286 = "" A4287 = "" A4288 = "" A4289 = "" A4290 = "" 
+A4291 = "" A4292 = "" A4293 = "" A4294 = "" A4295 = "" A4296 = "" A4297 = "" A4298 = "" A4299 = "" A4300 = "" 
+A4301 = "" A4302 = "" A4303 = "" A4304 = "" A4305 = "" A4306 = "" A4307 = "" A4308 = "" A4309 = "" A4310 = "" 
+A4311 = "" A4312 = "" A4313 = "" A4314 = "" A4315 = "" A4316 = "" A4317 = "" A4318 = "" A4319 = "" A4320 = "" 
+A4321 = "" A4322 = "" A4323 = "" A4324 = "" A4325 = "" A4326 = "" A4327 = "" A4328 = "" A4329 = "" A4330 = "" 
+A4331 = "" A4332 = "" A4333 = "" A4334 = "" A4335 = "" A4336 = "" A4337 = "" A4338 = "" A4339 = "" A4340 = "" 
+A4341 = "" A4342 = "" A4343 = "" A4344 = "" A4345 = "" A4346 = "" A4347 = "" A4348 = "" A4349 = "" A4350 = "" 
+A4351 = "" A4352 = "" A4353 = "" A4354 = "" A4355 = "" A4356 = "" A4357 = "" A4358 = "" A4359 = "" A4360 = "" 
+A4361 = "" A4362 = "" A4363 = "" A4364 = "" A4365 = "" A4366 = "" A4367 = "" A4368 = "" A4369 = "" A4370 = "" 
+A4371 = "" A4372 = "" A4373 = "" A4374 = "" A4375 = "" A4376 = "" A4377 = "" A4378 = "" A4379 = "" A4380 = "" 
+A4381 = "" A4382 = "" A4383 = "" A4384 = "" A4385 = "" A4386 = "" A4387 = "" A4388 = "" A4389 = "" A4390 = "" 
+A4391 = "" A4392 = "" A4393 = "" A4394 = "" A4395 = "" A4396 = "" A4397 = "" A4398 = "" A4399 = "" A4400 = "" 
+A4401 = "" A4402 = "" A4403 = "" A4404 = "" A4405 = "" A4406 = "" A4407 = "" A4408 = "" A4409 = "" A4410 = "" 
+A4411 = "" A4412 = "" A4413 = "" A4414 = "" A4415 = "" A4416 = "" A4417 = "" A4418 = "" A4419 = "" A4420 = "" 
+A4421 = "" A4422 = "" A4423 = "" A4424 = "" A4425 = "" A4426 = "" A4427 = "" A4428 = "" A4429 = "" A4430 = "" 
+A4431 = "" A4432 = "" A4433 = "" A4434 = "" A4435 = "" A4436 = "" A4437 = "" A4438 = "" A4439 = "" A4440 = "" 
+A4441 = "" A4442 = "" A4443 = "" A4444 = "" A4445 = "" A4446 = "" A4447 = "" A4448 = "" A4449 = "" A4450 = "" 
+A4451 = "" A4452 = "" A4453 = "" A4454 = "" A4455 = "" A4456 = "" A4457 = "" A4458 = "" A4459 = "" A4460 = "" 
+A4461 = "" A4462 = "" A4463 = "" A4464 = "" A4465 = "" A4466 = "" A4467 = "" A4468 = "" A4469 = "" A4470 = "" 
+A4471 = "" A4472 = "" A4473 = "" A4474 = "" A4475 = "" A4476 = "" A4477 = "" A4478 = "" A4479 = "" A4480 = "" 
+A4481 = "" A4482 = "" A4483 = "" A4484 = "" A4485 = "" A4486 = "" A4487 = "" A4488 = "" A4489 = "" A4490 = "" 
+A4491 = "" A4492 = "" A4493 = "" A4494 = "" A4495 = "" A4496 = "" A4497 = "" A4498 = "" A4499 = "" A4500 = "" 
+A4501 = "" A4502 = "" A4503 = "" A4504 = "" A4505 = "" A4506 = "" A4507 = "" A4508 = "" A4509 = "" A4510 = "" 
+A4511 = "" A4512 = "" A4513 = "" A4514 = "" A4515 = "" A4516 = "" A4517 = "" A4518 = "" A4519 = "" A4520 = "" 
+A4521 = "" A4522 = "" A4523 = "" A4524 = "" A4525 = "" A4526 = "" A4527 = "" A4528 = "" A4529 = "" A4530 = "" 
+A4531 = "" A4532 = "" A4533 = "" A4534 = "" A4535 = "" A4536 = "" A4537 = "" A4538 = "" A4539 = "" A4540 = "" 
+A4541 = "" A4542 = "" A4543 = "" A4544 = "" A4545 = "" A4546 = "" A4547 = "" A4548 = "" A4549 = "" A4550 = "" 
+A4551 = "" A4552 = "" A4553 = "" A4554 = "" A4555 = "" A4556 = "" A4557 = "" A4558 = "" A4559 = "" A4560 = "" 
+A4561 = "" A4562 = "" A4563 = "" A4564 = "" A4565 = "" A4566 = "" A4567 = "" A4568 = "" A4569 = "" A4570 = "" 
+A4571 = "" A4572 = "" A4573 = "" A4574 = "" A4575 = "" A4576 = "" A4577 = "" A4578 = "" A4579 = "" A4580 = "" 
+A4581 = "" A4582 = "" A4583 = "" A4584 = "" A4585 = "" A4586 = "" A4587 = "" A4588 = "" A4589 = "" A4590 = "" 
+A4591 = "" A4592 = "" A4593 = "" A4594 = "" A4595 = "" A4596 = "" A4597 = "" A4598 = "" A4599 = "" A4600 = "" 
+A4601 = "" A4602 = "" A4603 = "" A4604 = "" A4605 = "" A4606 = "" A4607 = "" A4608 = "" A4609 = "" A4610 = "" 
+A4611 = "" A4612 = "" A4613 = "" A4614 = "" A4615 = "" A4616 = "" A4617 = "" A4618 = "" A4619 = "" A4620 = "" 
+A4621 = "" A4622 = "" A4623 = "" A4624 = "" A4625 = "" A4626 = "" A4627 = "" A4628 = "" A4629 = "" A4630 = "" 
+A4631 = "" A4632 = "" A4633 = "" A4634 = "" A4635 = "" A4636 = "" A4637 = "" A4638 = "" A4639 = "" A4640 = "" 
+A4641 = "" A4642 = "" A4643 = "" A4644 = "" A4645 = "" A4646 = "" A4647 = "" A4648 = "" A4649 = "" A4650 = "" 
+A4651 = "" A4652 = "" A4653 = "" A4654 = "" A4655 = "" A4656 = "" A4657 = "" A4658 = "" A4659 = "" A4660 = "" 
+A4661 = "" A4662 = "" A4663 = "" A4664 = "" A4665 = "" A4666 = "" A4667 = "" A4668 = "" A4669 = "" A4670 = "" 
+A4671 = "" A4672 = "" A4673 = "" A4674 = "" A4675 = "" A4676 = "" A4677 = "" A4678 = "" A4679 = "" A4680 = "" 
+A4681 = "" A4682 = "" A4683 = "" A4684 = "" A4685 = "" A4686 = "" A4687 = "" A4688 = "" A4689 = "" A4690 = "" 
+A4691 = "" A4692 = "" A4693 = "" A4694 = "" A4695 = "" A4696 = "" A4697 = "" A4698 = "" A4699 = "" A4700 = "" 
+A4701 = "" A4702 = "" A4703 = "" A4704 = "" A4705 = "" A4706 = "" A4707 = "" A4708 = "" A4709 = "" A4710 = "" 
+A4711 = "" A4712 = "" A4713 = "" A4714 = "" A4715 = "" A4716 = "" A4717 = "" A4718 = "" A4719 = "" A4720 = "" 
+A4721 = "" A4722 = "" A4723 = "" A4724 = "" A4725 = "" A4726 = "" A4727 = "" A4728 = "" A4729 = "" A4730 = "" 
+A4731 = "" A4732 = "" A4733 = "" A4734 = "" A4735 = "" A4736 = "" A4737 = "" A4738 = "" A4739 = "" A4740 = "" 
+A4741 = "" A4742 = "" A4743 = "" A4744 = "" A4745 = "" A4746 = "" A4747 = "" A4748 = "" A4749 = "" A4750 = "" 
+A4751 = "" A4752 = "" A4753 = "" A4754 = "" A4755 = "" A4756 = "" A4757 = "" A4758 = "" A4759 = "" A4760 = "" 
+A4761 = "" A4762 = "" A4763 = "" A4764 = "" A4765 = "" A4766 = "" A4767 = "" A4768 = "" A4769 = "" A4770 = "" 
+A4771 = "" A4772 = "" A4773 = "" A4774 = "" A4775 = "" A4776 = "" A4777 = "" A4778 = "" A4779 = "" A4780 = "" 
+A4781 = "" A4782 = "" A4783 = "" A4784 = "" A4785 = "" A4786 = "" A4787 = "" A4788 = "" A4789 = "" A4790 = "" 
+A4791 = "" A4792 = "" A4793 = "" A4794 = "" A4795 = "" A4796 = "" A4797 = "" A4798 = "" A4799 = "" A4800 = "" 
+A4801 = "" A4802 = "" A4803 = "" A4804 = "" A4805 = "" A4806 = "" A4807 = "" A4808 = "" A4809 = "" A4810 = "" 
+A4811 = "" A4812 = "" A4813 = "" A4814 = "" A4815 = "" A4816 = "" A4817 = "" A4818 = "" A4819 = "" A4820 = "" 
+A4821 = "" A4822 = "" A4823 = "" A4824 = "" A4825 = "" A4826 = "" A4827 = "" A4828 = "" A4829 = "" A4830 = "" 
+A4831 = "" A4832 = "" A4833 = "" A4834 = "" A4835 = "" A4836 = "" A4837 = "" A4838 = "" A4839 = "" A4840 = "" 
+A4841 = "" A4842 = "" A4843 = "" A4844 = "" A4845 = "" A4846 = "" A4847 = "" A4848 = "" A4849 = "" A4850 = "" 
+A4851 = "" A4852 = "" A4853 = "" A4854 = "" A4855 = "" A4856 = "" A4857 = "" A4858 = "" A4859 = "" A4860 = "" 
+A4861 = "" A4862 = "" A4863 = "" A4864 = "" A4865 = "" A4866 = "" A4867 = "" A4868 = "" A4869 = "" A4870 = "" 
+A4871 = "" A4872 = "" A4873 = "" A4874 = "" A4875 = "" A4876 = "" A4877 = "" A4878 = "" A4879 = "" A4880 = "" 
+A4881 = "" A4882 = "" A4883 = "" A4884 = "" A4885 = "" A4886 = "" A4887 = "" A4888 = "" A4889 = "" A4890 = "" 
+A4891 = "" A4892 = "" A4893 = "" A4894 = "" A4895 = "" A4896 = "" A4897 = "" A4898 = "" A4899 = "" A4900 = "" 
+A4901 = "" A4902 = "" A4903 = "" A4904 = "" A4905 = "" A4906 = "" A4907 = "" A4908 = "" A4909 = "" A4910 = "" 
+A4911 = "" A4912 = "" A4913 = "" A4914 = "" A4915 = "" A4916 = "" A4917 = "" A4918 = "" A4919 = "" A4920 = "" 
+A4921 = "" A4922 = "" A4923 = "" A4924 = "" A4925 = "" A4926 = "" A4927 = "" A4928 = "" A4929 = "" A4930 = "" 
+A4931 = "" A4932 = "" A4933 = "" A4934 = "" A4935 = "" A4936 = "" A4937 = "" A4938 = "" A4939 = "" A4940 = "" 
+A4941 = "" A4942 = "" A4943 = "" A4944 = "" A4945 = "" A4946 = "" A4947 = "" A4948 = "" A4949 = "" A4950 = "" 
+A4951 = "" A4952 = "" A4953 = "" A4954 = "" A4955 = "" A4956 = "" A4957 = "" A4958 = "" A4959 = "" A4960 = "" 
+A4961 = "" A4962 = "" A4963 = "" A4964 = "" A4965 = "" A4966 = "" A4967 = "" A4968 = "" A4969 = "" A4970 = "" 
+A4971 = "" A4972 = "" A4973 = "" A4974 = "" A4975 = "" A4976 = "" A4977 = "" A4978 = "" A4979 = "" A4980 = "" 
+A4981 = "" A4982 = "" A4983 = "" A4984 = "" A4985 = "" A4986 = "" A4987 = "" A4988 = "" A4989 = "" A4990 = "" 
+A4991 = "" A4992 = "" A4993 = "" A4994 = "" A4995 = "" A4996 = "" A4997 = "" A4998 = "" A4999 = "" A5000 = "" 
+A5001 = "" A5002 = "" A5003 = "" A5004 = "" A5005 = "" A5006 = "" A5007 = "" A5008 = "" A5009 = "" A5010 = "" 
+A5011 = "" A5012 = "" A5013 = "" A5014 = "" A5015 = "" A5016 = "" A5017 = "" A5018 = "" A5019 = "" A5020 = "" 
+A5021 = "" A5022 = "" A5023 = "" A5024 = "" A5025 = "" A5026 = "" A5027 = "" A5028 = "" A5029 = "" A5030 = "" 
+A5031 = "" A5032 = "" A5033 = "" A5034 = "" A5035 = "" A5036 = "" A5037 = "" A5038 = "" A5039 = "" A5040 = "" 
+A5041 = "" A5042 = "" A5043 = "" A5044 = "" A5045 = "" A5046 = "" A5047 = "" A5048 = "" A5049 = "" A5050 = "" 
+A5051 = "" A5052 = "" A5053 = "" A5054 = "" A5055 = "" A5056 = "" A5057 = "" A5058 = "" A5059 = "" A5060 = "" 
+A5061 = "" A5062 = "" A5063 = "" A5064 = "" A5065 = "" A5066 = "" A5067 = "" A5068 = "" A5069 = "" A5070 = "" 
+A5071 = "" A5072 = "" A5073 = "" A5074 = "" A5075 = "" A5076 = "" A5077 = "" A5078 = "" A5079 = "" A5080 = "" 
+A5081 = "" A5082 = "" A5083 = "" A5084 = "" A5085 = "" A5086 = "" A5087 = "" A5088 = "" A5089 = "" A5090 = "" 
+A5091 = "" A5092 = "" A5093 = "" A5094 = "" A5095 = "" A5096 = "" A5097 = "" A5098 = "" A5099 = "" A5100 = "" 
+A5101 = "" A5102 = "" A5103 = "" A5104 = "" A5105 = "" A5106 = "" A5107 = "" A5108 = "" A5109 = "" A5110 = "" 
+A5111 = "" A5112 = "" A5113 = "" A5114 = "" A5115 = "" A5116 = "" A5117 = "" A5118 = "" A5119 = "" A5120 = "" 
+A5121 = "" A5122 = "" A5123 = "" A5124 = "" A5125 = "" A5126 = "" A5127 = "" A5128 = "" A5129 = "" A5130 = "" 
+A5131 = "" A5132 = "" A5133 = "" A5134 = "" A5135 = "" A5136 = "" A5137 = "" A5138 = "" A5139 = "" A5140 = "" 
+A5141 = "" A5142 = "" A5143 = "" A5144 = "" A5145 = "" A5146 = "" A5147 = "" A5148 = "" A5149 = "" A5150 = "" 
+A5151 = "" A5152 = "" A5153 = "" A5154 = "" A5155 = "" A5156 = "" A5157 = "" A5158 = "" A5159 = "" A5160 = "" 
+A5161 = "" A5162 = "" A5163 = "" A5164 = "" A5165 = "" A5166 = "" A5167 = "" A5168 = "" A5169 = "" A5170 = "" 
+A5171 = "" A5172 = "" A5173 = "" A5174 = "" A5175 = "" A5176 = "" A5177 = "" A5178 = "" A5179 = "" A5180 = "" 
+A5181 = "" A5182 = "" A5183 = "" A5184 = "" A5185 = "" A5186 = "" A5187 = "" A5188 = "" A5189 = "" A5190 = "" 
+A5191 = "" A5192 = "" A5193 = "" A5194 = "" A5195 = "" A5196 = "" A5197 = "" A5198 = "" A5199 = "" A5200 = "" 
+A5201 = "" A5202 = "" A5203 = "" A5204 = "" A5205 = "" A5206 = "" A5207 = "" A5208 = "" A5209 = "" A5210 = "" 
+A5211 = "" A5212 = "" A5213 = "" A5214 = "" A5215 = "" A5216 = "" A5217 = "" A5218 = "" A5219 = "" A5220 = "" 
+A5221 = "" A5222 = "" A5223 = "" A5224 = "" A5225 = "" A5226 = "" A5227 = "" A5228 = "" A5229 = "" A5230 = "" 
+A5231 = "" A5232 = "" A5233 = "" A5234 = "" A5235 = "" A5236 = "" A5237 = "" A5238 = "" A5239 = "" A5240 = "" 
+A5241 = "" A5242 = "" A5243 = "" A5244 = "" A5245 = "" A5246 = "" A5247 = "" A5248 = "" A5249 = "" A5250 = "" 
+A5251 = "" A5252 = "" A5253 = "" A5254 = "" A5255 = "" A5256 = "" A5257 = "" A5258 = "" A5259 = "" A5260 = "" 
+A5261 = "" A5262 = "" A5263 = "" A5264 = "" A5265 = "" A5266 = "" A5267 = "" A5268 = "" A5269 = "" A5270 = "" 
+A5271 = "" A5272 = "" A5273 = "" A5274 = "" A5275 = "" A5276 = "" A5277 = "" A5278 = "" A5279 = "" A5280 = "" 
+A5281 = "" A5282 = "" A5283 = "" A5284 = "" A5285 = "" A5286 = "" A5287 = "" A5288 = "" A5289 = "" A5290 = "" 
+A5291 = "" A5292 = "" A5293 = "" A5294 = "" A5295 = "" A5296 = "" A5297 = "" A5298 = "" A5299 = "" A5300 = "" 
+A5301 = "" A5302 = "" A5303 = "" A5304 = "" A5305 = "" A5306 = "" A5307 = "" A5308 = "" A5309 = "" A5310 = "" 
+A5311 = "" A5312 = "" A5313 = "" A5314 = "" A5315 = "" A5316 = "" A5317 = "" A5318 = "" A5319 = "" A5320 = "" 
+A5321 = "" A5322 = "" A5323 = "" A5324 = "" A5325 = "" A5326 = "" A5327 = "" A5328 = "" A5329 = "" A5330 = "" 
+A5331 = "" A5332 = "" A5333 = "" A5334 = "" A5335 = "" A5336 = "" A5337 = "" A5338 = "" A5339 = "" A5340 = "" 
+A5341 = "" A5342 = "" A5343 = "" A5344 = "" A5345 = "" A5346 = "" A5347 = "" A5348 = "" A5349 = "" A5350 = "" 
+A5351 = "" A5352 = "" A5353 = "" A5354 = "" A5355 = "" A5356 = "" A5357 = "" A5358 = "" A5359 = "" A5360 = "" 
+A5361 = "" A5362 = "" A5363 = "" A5364 = "" A5365 = "" A5366 = "" A5367 = "" A5368 = "" A5369 = "" A5370 = "" 
+A5371 = "" A5372 = "" A5373 = "" A5374 = "" A5375 = "" A5376 = "" A5377 = "" A5378 = "" A5379 = "" A5380 = "" 
+A5381 = "" A5382 = "" A5383 = "" A5384 = "" A5385 = "" A5386 = "" A5387 = "" A5388 = "" A5389 = "" A5390 = "" 
+A5391 = "" A5392 = "" A5393 = "" A5394 = "" A5395 = "" A5396 = "" A5397 = "" A5398 = "" A5399 = "" A5400 = "" 
+A5401 = "" A5402 = "" A5403 = "" A5404 = "" A5405 = "" A5406 = "" A5407 = "" A5408 = "" A5409 = "" A5410 = "" 
+A5411 = "" A5412 = "" A5413 = "" A5414 = "" A5415 = "" A5416 = "" A5417 = "" A5418 = "" A5419 = "" A5420 = "" 
+A5421 = "" A5422 = "" A5423 = "" A5424 = "" A5425 = "" A5426 = "" A5427 = "" A5428 = "" A5429 = "" A5430 = "" 
+A5431 = "" A5432 = "" A5433 = "" A5434 = "" A5435 = "" A5436 = "" A5437 = "" A5438 = "" A5439 = "" A5440 = "" 
+A5441 = "" A5442 = "" A5443 = "" A5444 = "" A5445 = "" A5446 = "" A5447 = "" A5448 = "" A5449 = "" A5450 = "" 
+A5451 = "" A5452 = "" A5453 = "" A5454 = "" A5455 = "" A5456 = "" A5457 = "" A5458 = "" A5459 = "" A5460 = "" 
+A5461 = "" A5462 = "" A5463 = "" A5464 = "" A5465 = "" A5466 = "" A5467 = "" A5468 = "" A5469 = "" A5470 = "" 
+A5471 = "" A5472 = "" A5473 = "" A5474 = "" A5475 = "" A5476 = "" A5477 = "" A5478 = "" A5479 = "" A5480 = "" 
+A5481 = "" A5482 = "" A5483 = "" A5484 = "" A5485 = "" A5486 = "" A5487 = "" A5488 = "" A5489 = "" A5490 = "" 
+A5491 = "" A5492 = "" A5493 = "" A5494 = "" A5495 = "" A5496 = "" A5497 = "" A5498 = "" A5499 = "" A5500 = "" 
+A5501 = "" A5502 = "" A5503 = "" A5504 = "" A5505 = "" A5506 = "" A5507 = "" A5508 = "" A5509 = "" A5510 = "" 
+A5511 = "" A5512 = "" A5513 = "" A5514 = "" A5515 = "" A5516 = "" A5517 = "" A5518 = "" A5519 = "" A5520 = "" 
+A5521 = "" A5522 = "" A5523 = "" A5524 = "" A5525 = "" A5526 = "" A5527 = "" A5528 = "" A5529 = "" A5530 = "" 
+A5531 = "" A5532 = "" A5533 = "" A5534 = "" A5535 = "" A5536 = "" A5537 = "" A5538 = "" A5539 = "" A5540 = "" 
+A5541 = "" A5542 = "" A5543 = "" A5544 = "" A5545 = "" A5546 = "" A5547 = "" A5548 = "" A5549 = "" A5550 = "" 
+A5551 = "" A5552 = "" A5553 = "" A5554 = "" A5555 = "" A5556 = "" A5557 = "" A5558 = "" A5559 = "" A5560 = "" 
+A5561 = "" A5562 = "" A5563 = "" A5564 = "" A5565 = "" A5566 = "" A5567 = "" A5568 = "" A5569 = "" A5570 = "" 
+A5571 = "" A5572 = "" A5573 = "" A5574 = "" A5575 = "" A5576 = "" A5577 = "" A5578 = "" A5579 = "" A5580 = "" 
+A5581 = "" A5582 = "" A5583 = "" A5584 = "" A5585 = "" A5586 = "" A5587 = "" A5588 = "" A5589 = "" A5590 = "" 
+A5591 = "" A5592 = "" A5593 = "" A5594 = "" A5595 = "" A5596 = "" A5597 = "" A5598 = "" A5599 = "" A5600 = "" 
+A5601 = "" A5602 = "" A5603 = "" A5604 = "" A5605 = "" A5606 = "" A5607 = "" A5608 = "" A5609 = "" A5610 = "" 
+A5611 = "" A5612 = "" A5613 = "" A5614 = "" A5615 = "" A5616 = "" A5617 = "" A5618 = "" A5619 = "" A5620 = "" 
+A5621 = "" A5622 = "" A5623 = "" A5624 = "" A5625 = "" A5626 = "" A5627 = "" A5628 = "" A5629 = "" A5630 = "" 
+A5631 = "" A5632 = "" A5633 = "" A5634 = "" A5635 = "" A5636 = "" A5637 = "" A5638 = "" A5639 = "" A5640 = "" 
+A5641 = "" A5642 = "" A5643 = "" A5644 = "" A5645 = "" A5646 = "" A5647 = "" A5648 = "" A5649 = "" A5650 = "" 
+A5651 = "" A5652 = "" A5653 = "" A5654 = "" A5655 = "" A5656 = "" A5657 = "" A5658 = "" A5659 = "" A5660 = "" 
+A5661 = "" A5662 = "" A5663 = "" A5664 = "" A5665 = "" A5666 = "" A5667 = "" A5668 = "" A5669 = "" A5670 = "" 
+A5671 = "" A5672 = "" A5673 = "" A5674 = "" A5675 = "" A5676 = "" A5677 = "" A5678 = "" A5679 = "" A5680 = "" 
+A5681 = "" A5682 = "" A5683 = "" A5684 = "" A5685 = "" A5686 = "" A5687 = "" A5688 = "" A5689 = "" A5690 = "" 
+A5691 = "" A5692 = "" A5693 = "" A5694 = "" A5695 = "" A5696 = "" A5697 = "" A5698 = "" A5699 = "" A5700 = "" 
+A5701 = "" A5702 = "" A5703 = "" A5704 = "" A5705 = "" A5706 = "" A5707 = "" A5708 = "" A5709 = "" A5710 = "" 
+A5711 = "" A5712 = "" A5713 = "" A5714 = "" A5715 = "" A5716 = "" A5717 = "" A5718 = "" A5719 = "" A5720 = "" 
+A5721 = "" A5722 = "" A5723 = "" A5724 = "" A5725 = "" A5726 = "" A5727 = "" A5728 = "" A5729 = "" A5730 = "" 
+A5731 = "" A5732 = "" A5733 = "" A5734 = "" A5735 = "" A5736 = "" A5737 = "" A5738 = "" A5739 = "" A5740 = "" 
+A5741 = "" A5742 = "" A5743 = "" A5744 = "" A5745 = "" A5746 = "" A5747 = "" A5748 = "" A5749 = "" A5750 = "" 
+A5751 = "" A5752 = "" A5753 = "" A5754 = "" A5755 = "" A5756 = "" A5757 = "" A5758 = "" A5759 = "" A5760 = "" 
+A5761 = "" A5762 = "" A5763 = "" A5764 = "" A5765 = "" A5766 = "" A5767 = "" A5768 = "" A5769 = "" A5770 = "" 
+A5771 = "" A5772 = "" A5773 = "" A5774 = "" A5775 = "" A5776 = "" A5777 = "" A5778 = "" A5779 = "" A5780 = "" 
+A5781 = "" A5782 = "" A5783 = "" A5784 = "" A5785 = "" A5786 = "" A5787 = "" A5788 = "" A5789 = "" A5790 = "" 
+A5791 = "" A5792 = "" A5793 = "" A5794 = "" A5795 = "" A5796 = "" A5797 = "" A5798 = "" A5799 = "" A5800 = "" 
+A5801 = "" A5802 = "" A5803 = "" A5804 = "" A5805 = "" A5806 = "" A5807 = "" A5808 = "" A5809 = "" A5810 = "" 
+A5811 = "" A5812 = "" A5813 = "" A5814 = "" A5815 = "" A5816 = "" A5817 = "" A5818 = "" A5819 = "" A5820 = "" 
+A5821 = "" A5822 = "" A5823 = "" A5824 = "" A5825 = "" A5826 = "" A5827 = "" A5828 = "" A5829 = "" A5830 = "" 
+A5831 = "" A5832 = "" A5833 = "" A5834 = "" A5835 = "" A5836 = "" A5837 = "" A5838 = "" A5839 = "" A5840 = "" 
+A5841 = "" A5842 = "" A5843 = "" A5844 = "" A5845 = "" A5846 = "" A5847 = "" A5848 = "" A5849 = "" A5850 = "" 
+A5851 = "" A5852 = "" A5853 = "" A5854 = "" A5855 = "" A5856 = "" A5857 = "" A5858 = "" A5859 = "" A5860 = "" 
+A5861 = "" A5862 = "" A5863 = "" A5864 = "" A5865 = "" A5866 = "" A5867 = "" A5868 = "" A5869 = "" A5870 = "" 
+A5871 = "" A5872 = "" A5873 = "" A5874 = "" A5875 = "" A5876 = "" A5877 = "" A5878 = "" A5879 = "" A5880 = "" 
+A5881 = "" A5882 = "" A5883 = "" A5884 = "" A5885 = "" A5886 = "" A5887 = "" A5888 = "" A5889 = "" A5890 = "" 
+A5891 = "" A5892 = "" A5893 = "" A5894 = "" A5895 = "" A5896 = "" A5897 = "" A5898 = "" A5899 = "" A5900 = "" 
+A5901 = "" A5902 = "" A5903 = "" A5904 = "" A5905 = "" A5906 = "" A5907 = "" A5908 = "" A5909 = "" A5910 = "" 
+A5911 = "" A5912 = "" A5913 = "" A5914 = "" A5915 = "" A5916 = "" A5917 = "" A5918 = "" A5919 = "" A5920 = "" 
+A5921 = "" A5922 = "" A5923 = "" A5924 = "" A5925 = "" A5926 = "" A5927 = "" A5928 = "" A5929 = "" A5930 = "" 
+A5931 = "" A5932 = "" A5933 = "" A5934 = "" A5935 = "" A5936 = "" A5937 = "" A5938 = "" A5939 = "" A5940 = "" 
+A5941 = "" A5942 = "" A5943 = "" A5944 = "" A5945 = "" A5946 = "" A5947 = "" A5948 = "" A5949 = "" A5950 = "" 
+A5951 = "" A5952 = "" A5953 = "" A5954 = "" A5955 = "" A5956 = "" A5957 = "" A5958 = "" A5959 = "" A5960 = "" 
+A5961 = "" A5962 = "" A5963 = "" A5964 = "" A5965 = "" A5966 = "" A5967 = "" A5968 = "" A5969 = "" A5970 = "" 
+A5971 = "" A5972 = "" A5973 = "" A5974 = "" A5975 = "" A5976 = "" A5977 = "" A5978 = "" A5979 = "" A5980 = "" 
+A5981 = "" A5982 = "" A5983 = "" A5984 = "" A5985 = "" A5986 = "" A5987 = "" A5988 = "" A5989 = "" A5990 = "" 
+A5991 = "" A5992 = "" A5993 = "" A5994 = "" A5995 = "" A5996 = "" A5997 = "" A5998 = "" A5999 = "" A6000 = "" 
+A6001 = "" A6002 = "" A6003 = "" A6004 = "" A6005 = "" A6006 = "" A6007 = "" A6008 = "" A6009 = "" A6010 = "" 
+A6011 = "" A6012 = "" A6013 = "" A6014 = "" A6015 = "" A6016 = "" A6017 = "" A6018 = "" A6019 = "" A6020 = "" 
+A6021 = "" A6022 = "" A6023 = "" A6024 = "" A6025 = "" A6026 = "" A6027 = "" A6028 = "" A6029 = "" A6030 = "" 
+A6031 = "" A6032 = "" A6033 = "" A6034 = "" A6035 = "" A6036 = "" A6037 = "" A6038 = "" A6039 = "" A6040 = "" 
+A6041 = "" A6042 = "" A6043 = "" A6044 = "" A6045 = "" A6046 = "" A6047 = "" A6048 = "" A6049 = "" A6050 = "" 
+A6051 = "" A6052 = "" A6053 = "" A6054 = "" A6055 = "" A6056 = "" A6057 = "" A6058 = "" A6059 = "" A6060 = "" 
+A6061 = "" A6062 = "" A6063 = "" A6064 = "" A6065 = "" A6066 = "" A6067 = "" A6068 = "" A6069 = "" A6070 = "" 
+A6071 = "" A6072 = "" A6073 = "" A6074 = "" A6075 = "" A6076 = "" A6077 = "" A6078 = "" A6079 = "" A6080 = "" 
+A6081 = "" A6082 = "" A6083 = "" A6084 = "" A6085 = "" A6086 = "" A6087 = "" A6088 = "" A6089 = "" A6090 = "" 
+A6091 = "" A6092 = "" A6093 = "" A6094 = "" A6095 = "" A6096 = "" A6097 = "" A6098 = "" A6099 = "" A6100 = "" 
+A6101 = "" A6102 = "" A6103 = "" A6104 = "" A6105 = "" A6106 = "" A6107 = "" A6108 = "" A6109 = "" A6110 = "" 
+A6111 = "" A6112 = "" A6113 = "" A6114 = "" A6115 = "" A6116 = "" A6117 = "" A6118 = "" A6119 = "" A6120 = "" 
+A6121 = "" A6122 = "" A6123 = "" A6124 = "" A6125 = "" A6126 = "" A6127 = "" A6128 = "" A6129 = "" A6130 = "" 
+A6131 = "" A6132 = "" A6133 = "" A6134 = "" A6135 = "" A6136 = "" A6137 = "" A6138 = "" A6139 = "" A6140 = "" 
+A6141 = "" A6142 = "" A6143 = "" A6144 = "" A6145 = "" A6146 = "" A6147 = "" A6148 = "" A6149 = "" A6150 = "" 
+A6151 = "" A6152 = "" A6153 = "" A6154 = "" A6155 = "" A6156 = "" A6157 = "" A6158 = "" A6159 = "" A6160 = "" 
+A6161 = "" A6162 = "" A6163 = "" A6164 = "" A6165 = "" A6166 = "" A6167 = "" A6168 = "" A6169 = "" A6170 = "" 
+A6171 = "" A6172 = "" A6173 = "" A6174 = "" A6175 = "" A6176 = "" A6177 = "" A6178 = "" A6179 = "" A6180 = "" 
+A6181 = "" A6182 = "" A6183 = "" A6184 = "" A6185 = "" A6186 = "" A6187 = "" A6188 = "" A6189 = "" A6190 = "" 
+A6191 = "" A6192 = "" A6193 = "" A6194 = "" A6195 = "" A6196 = "" A6197 = "" A6198 = "" A6199 = "" A6200 = "" 
+A6201 = "" A6202 = "" A6203 = "" A6204 = "" A6205 = "" A6206 = "" A6207 = "" A6208 = "" A6209 = "" A6210 = "" 
+A6211 = "" A6212 = "" A6213 = "" A6214 = "" A6215 = "" A6216 = "" A6217 = "" A6218 = "" A6219 = "" A6220 = "" 
+A6221 = "" A6222 = "" A6223 = "" A6224 = "" A6225 = "" A6226 = "" A6227 = "" A6228 = "" A6229 = "" A6230 = "" 
+A6231 = "" A6232 = "" A6233 = "" A6234 = "" A6235 = "" A6236 = "" A6237 = "" A6238 = "" A6239 = "" A6240 = "" 
+A6241 = "" A6242 = "" A6243 = "" A6244 = "" A6245 = "" A6246 = "" A6247 = "" A6248 = "" A6249 = "" A6250 = "" 
+A6251 = "" A6252 = "" A6253 = "" A6254 = "" A6255 = "" A6256 = "" A6257 = "" A6258 = "" A6259 = "" A6260 = "" 
+A6261 = "" A6262 = "" A6263 = "" A6264 = "" A6265 = "" A6266 = "" A6267 = "" A6268 = "" A6269 = "" A6270 = "" 
+A6271 = "" A6272 = "" A6273 = "" A6274 = "" A6275 = "" A6276 = "" A6277 = "" A6278 = "" A6279 = "" A6280 = "" 
+A6281 = "" A6282 = "" A6283 = "" A6284 = "" A6285 = "" A6286 = "" A6287 = "" A6288 = "" A6289 = "" A6290 = "" 
+A6291 = "" A6292 = "" A6293 = "" A6294 = "" A6295 = "" A6296 = "" A6297 = "" A6298 = "" A6299 = "" A6300 = "" 
+A6301 = "" A6302 = "" A6303 = "" A6304 = "" A6305 = "" A6306 = "" A6307 = "" A6308 = "" A6309 = "" A6310 = "" 
+A6311 = "" A6312 = "" A6313 = "" A6314 = "" A6315 = "" A6316 = "" A6317 = "" A6318 = "" A6319 = "" A6320 = "" 
+A6321 = "" A6322 = "" A6323 = "" A6324 = "" A6325 = "" A6326 = "" A6327 = "" A6328 = "" A6329 = "" A6330 = "" 
+A6331 = "" A6332 = "" A6333 = "" A6334 = "" A6335 = "" A6336 = "" A6337 = "" A6338 = "" A6339 = "" A6340 = "" 
+A6341 = "" A6342 = "" A6343 = "" A6344 = "" A6345 = "" A6346 = "" A6347 = "" A6348 = "" A6349 = "" A6350 = "" 
+A6351 = "" A6352 = "" A6353 = "" A6354 = "" A6355 = "" A6356 = "" A6357 = "" A6358 = "" A6359 = "" A6360 = "" 
+A6361 = "" A6362 = "" A6363 = "" A6364 = "" A6365 = "" A6366 = "" A6367 = "" A6368 = "" A6369 = "" A6370 = "" 
+A6371 = "" A6372 = "" A6373 = "" A6374 = "" A6375 = "" A6376 = "" A6377 = "" A6378 = "" A6379 = "" A6380 = "" 
+A6381 = "" A6382 = "" A6383 = "" A6384 = "" A6385 = "" A6386 = "" A6387 = "" A6388 = "" A6389 = "" A6390 = "" 
+A6391 = "" A6392 = "" A6393 = "" A6394 = "" A6395 = "" A6396 = "" A6397 = "" A6398 = "" A6399 = "" A6400 = "" 
+A6401 = "" A6402 = "" A6403 = "" A6404 = "" A6405 = "" A6406 = "" A6407 = "" A6408 = "" A6409 = "" A6410 = "" 
+A6411 = "" A6412 = "" A6413 = "" A6414 = "" A6415 = "" A6416 = "" A6417 = "" A6418 = "" A6419 = "" A6420 = "" 
+A6421 = "" A6422 = "" A6423 = "" A6424 = "" A6425 = "" A6426 = "" A6427 = "" A6428 = "" A6429 = "" A6430 = "" 
+A6431 = "" A6432 = "" A6433 = "" A6434 = "" A6435 = "" A6436 = "" A6437 = "" A6438 = "" A6439 = "" A6440 = "" 
+A6441 = "" A6442 = "" A6443 = "" A6444 = "" A6445 = "" A6446 = "" A6447 = "" A6448 = "" A6449 = "" A6450 = "" 
+A6451 = "" A6452 = "" A6453 = "" A6454 = "" A6455 = "" A6456 = "" A6457 = "" A6458 = "" A6459 = "" A6460 = "" 
+A6461 = "" A6462 = "" A6463 = "" A6464 = "" A6465 = "" A6466 = "" A6467 = "" A6468 = "" A6469 = "" A6470 = "" 
+A6471 = "" A6472 = "" A6473 = "" A6474 = "" A6475 = "" A6476 = "" A6477 = "" A6478 = "" A6479 = "" A6480 = "" 
+A6481 = "" A6482 = "" A6483 = "" A6484 = "" A6485 = "" A6486 = "" A6487 = "" A6488 = "" A6489 = "" A6490 = "" 
+A6491 = "" A6492 = "" A6493 = "" A6494 = "" A6495 = "" A6496 = "" A6497 = "" A6498 = "" A6499 = "" A6500 = "" 
+A6501 = "" A6502 = "" A6503 = "" A6504 = "" A6505 = "" A6506 = "" A6507 = "" A6508 = "" A6509 = "" A6510 = "" 
+A6511 = "" A6512 = "" A6513 = "" A6514 = "" A6515 = "" A6516 = "" A6517 = "" A6518 = "" A6519 = "" A6520 = "" 
+A6521 = "" A6522 = "" A6523 = "" A6524 = "" A6525 = "" A6526 = "" A6527 = "" A6528 = "" A6529 = "" A6530 = "" 
+A6531 = "" A6532 = "" A6533 = "" A6534 = "" A6535 = "" A6536 = "" A6537 = "" A6538 = "" A6539 = "" A6540 = "" 
+A6541 = "" A6542 = "" A6543 = "" A6544 = "" A6545 = "" A6546 = "" A6547 = "" A6548 = "" A6549 = "" A6550 = "" 
+A6551 = "" A6552 = "" A6553 = "" A6554 = "" A6555 = "" A6556 = "" A6557 = "" A6558 = "" A6559 = "" A6560 = "" 
+A6561 = "" A6562 = "" A6563 = "" A6564 = "" A6565 = "" A6566 = "" A6567 = "" A6568 = "" A6569 = "" A6570 = "" 
+A6571 = "" A6572 = "" A6573 = "" A6574 = "" A6575 = "" A6576 = "" A6577 = "" A6578 = "" A6579 = "" A6580 = "" 
+A6581 = "" A6582 = "" A6583 = "" A6584 = "" A6585 = "" A6586 = "" A6587 = "" A6588 = "" A6589 = "" A6590 = "" 
+A6591 = "" A6592 = "" A6593 = "" A6594 = "" A6595 = "" A6596 = "" A6597 = "" A6598 = "" A6599 = "" A6600 = "" 
+A6601 = "" A6602 = "" A6603 = "" A6604 = "" A6605 = "" A6606 = "" A6607 = "" A6608 = "" A6609 = "" A6610 = "" 
+A6611 = "" A6612 = "" A6613 = "" A6614 = "" A6615 = "" A6616 = "" A6617 = "" A6618 = "" A6619 = "" A6620 = "" 
+A6621 = "" A6622 = "" A6623 = "" A6624 = "" A6625 = "" A6626 = "" A6627 = "" A6628 = "" A6629 = "" A6630 = "" 
+A6631 = "" A6632 = "" A6633 = "" A6634 = "" A6635 = "" A6636 = "" A6637 = "" A6638 = "" A6639 = "" A6640 = "" 
+A6641 = "" A6642 = "" A6643 = "" A6644 = "" A6645 = "" A6646 = "" A6647 = "" A6648 = "" A6649 = "" A6650 = "" 
+A6651 = "" A6652 = "" A6653 = "" A6654 = "" A6655 = "" A6656 = "" A6657 = "" A6658 = "" A6659 = "" A6660 = "" 
+A6661 = "" A6662 = "" A6663 = "" A6664 = "" A6665 = "" A6666 = "" A6667 = "" A6668 = "" A6669 = "" A6670 = "" 
+A6671 = "" A6672 = "" A6673 = "" A6674 = "" A6675 = "" A6676 = "" A6677 = "" A6678 = "" A6679 = "" A6680 = "" 
+A6681 = "" A6682 = "" A6683 = "" A6684 = "" A6685 = "" A6686 = "" A6687 = "" A6688 = "" A6689 = "" A6690 = "" 
+A6691 = "" A6692 = "" A6693 = "" A6694 = "" A6695 = "" A6696 = "" A6697 = "" A6698 = "" A6699 = "" A6700 = "" 
+A6701 = "" A6702 = "" A6703 = "" A6704 = "" A6705 = "" A6706 = "" A6707 = "" A6708 = "" A6709 = "" A6710 = "" 
+A6711 = "" A6712 = "" A6713 = "" A6714 = "" A6715 = "" A6716 = "" A6717 = "" A6718 = "" A6719 = "" A6720 = "" 
+A6721 = "" A6722 = "" A6723 = "" A6724 = "" A6725 = "" A6726 = "" A6727 = "" A6728 = "" A6729 = "" A6730 = "" 
+A6731 = "" A6732 = "" A6733 = "" A6734 = "" A6735 = "" A6736 = "" A6737 = "" A6738 = "" A6739 = "" A6740 = "" 
+A6741 = "" A6742 = "" A6743 = "" A6744 = "" A6745 = "" A6746 = "" A6747 = "" A6748 = "" A6749 = "" A6750 = "" 
+A6751 = "" A6752 = "" A6753 = "" A6754 = "" A6755 = "" A6756 = "" A6757 = "" A6758 = "" A6759 = "" A6760 = "" 
+A6761 = "" A6762 = "" A6763 = "" A6764 = "" A6765 = "" A6766 = "" A6767 = "" A6768 = "" A6769 = "" A6770 = "" 
+A6771 = "" A6772 = "" A6773 = "" A6774 = "" A6775 = "" A6776 = "" A6777 = "" A6778 = "" A6779 = "" A6780 = "" 
+A6781 = "" A6782 = "" A6783 = "" A6784 = "" A6785 = "" A6786 = "" A6787 = "" A6788 = "" A6789 = "" A6790 = "" 
+A6791 = "" A6792 = "" A6793 = "" A6794 = "" A6795 = "" A6796 = "" A6797 = "" A6798 = "" A6799 = "" A6800 = "" 
+A6801 = "" A6802 = "" A6803 = "" A6804 = "" A6805 = "" A6806 = "" A6807 = "" A6808 = "" A6809 = "" A6810 = "" 
+A6811 = "" A6812 = "" A6813 = "" A6814 = "" A6815 = "" A6816 = "" A6817 = "" A6818 = "" A6819 = "" A6820 = "" 
+A6821 = "" A6822 = "" A6823 = "" A6824 = "" A6825 = "" A6826 = "" A6827 = "" A6828 = "" A6829 = "" A6830 = "" 
+A6831 = "" A6832 = "" A6833 = "" A6834 = "" A6835 = "" A6836 = "" A6837 = "" A6838 = "" A6839 = "" A6840 = "" 
+A6841 = "" A6842 = "" A6843 = "" A6844 = "" A6845 = "" A6846 = "" A6847 = "" A6848 = "" A6849 = "" A6850 = "" 
+A6851 = "" A6852 = "" A6853 = "" A6854 = "" A6855 = "" A6856 = "" A6857 = "" A6858 = "" A6859 = "" A6860 = "" 
+A6861 = "" A6862 = "" A6863 = "" A6864 = "" A6865 = "" A6866 = "" A6867 = "" A6868 = "" A6869 = "" A6870 = "" 
+A6871 = "" A6872 = "" A6873 = "" A6874 = "" A6875 = "" A6876 = "" A6877 = "" A6878 = "" A6879 = "" A6880 = "" 
+A6881 = "" A6882 = "" A6883 = "" A6884 = "" A6885 = "" A6886 = "" A6887 = "" A6888 = "" A6889 = "" A6890 = "" 
+A6891 = "" A6892 = "" A6893 = "" A6894 = "" A6895 = "" A6896 = "" A6897 = "" A6898 = "" A6899 = "" A6900 = "" 
+A6901 = "" A6902 = "" A6903 = "" A6904 = "" A6905 = "" A6906 = "" A6907 = "" A6908 = "" A6909 = "" A6910 = "" 
+A6911 = "" A6912 = "" A6913 = "" A6914 = "" A6915 = "" A6916 = "" A6917 = "" A6918 = "" A6919 = "" A6920 = "" 
+A6921 = "" A6922 = "" A6923 = "" A6924 = "" A6925 = "" A6926 = "" A6927 = "" A6928 = "" A6929 = "" A6930 = "" 
+A6931 = "" A6932 = "" A6933 = "" A6934 = "" A6935 = "" A6936 = "" A6937 = "" A6938 = "" A6939 = "" A6940 = "" 
+A6941 = "" A6942 = "" A6943 = "" A6944 = "" A6945 = "" A6946 = "" A6947 = "" A6948 = "" A6949 = "" A6950 = "" 
+A6951 = "" A6952 = "" A6953 = "" A6954 = "" A6955 = "" A6956 = "" A6957 = "" A6958 = "" A6959 = "" A6960 = "" 
+A6961 = "" A6962 = "" A6963 = "" A6964 = "" A6965 = "" A6966 = "" A6967 = "" A6968 = "" A6969 = "" A6970 = "" 
+A6971 = "" A6972 = "" A6973 = "" A6974 = "" A6975 = "" A6976 = "" A6977 = "" A6978 = "" A6979 = "" A6980 = "" 
+A6981 = "" A6982 = "" A6983 = "" A6984 = "" A6985 = "" A6986 = "" A6987 = "" A6988 = "" A6989 = "" A6990 = "" 
+A6991 = "" A6992 = "" A6993 = "" A6994 = "" A6995 = "" A6996 = "" A6997 = "" A6998 = "" A6999 = "" A7000 = "" 
+A7001 = "" A7002 = "" A7003 = "" A7004 = "" A7005 = "" A7006 = "" A7007 = "" A7008 = "" A7009 = "" A7010 = "" 
+A7011 = "" A7012 = "" A7013 = "" A7014 = "" A7015 = "" A7016 = "" A7017 = "" A7018 = "" A7019 = "" A7020 = "" 
+A7021 = "" A7022 = "" A7023 = "" A7024 = "" A7025 = "" A7026 = "" A7027 = "" A7028 = "" A7029 = "" A7030 = "" 
+A7031 = "" A7032 = "" A7033 = "" A7034 = "" A7035 = "" A7036 = "" A7037 = "" A7038 = "" A7039 = "" A7040 = "" 
+A7041 = "" A7042 = "" A7043 = "" A7044 = "" A7045 = "" A7046 = "" A7047 = "" A7048 = "" A7049 = "" A7050 = "" 
+A7051 = "" A7052 = "" A7053 = "" A7054 = "" A7055 = "" A7056 = "" A7057 = "" A7058 = "" A7059 = "" A7060 = "" 
+A7061 = "" A7062 = "" A7063 = "" A7064 = "" A7065 = "" A7066 = "" A7067 = "" A7068 = "" A7069 = "" A7070 = "" 
+A7071 = "" A7072 = "" A7073 = "" A7074 = "" A7075 = "" A7076 = "" A7077 = "" A7078 = "" A7079 = "" A7080 = "" 
+A7081 = "" A7082 = "" A7083 = "" A7084 = "" A7085 = "" A7086 = "" A7087 = "" A7088 = "" A7089 = "" A7090 = "" 
+A7091 = "" A7092 = "" A7093 = "" A7094 = "" A7095 = "" A7096 = "" A7097 = "" A7098 = "" A7099 = "" A7100 = "" 
+A7101 = "" A7102 = "" A7103 = "" A7104 = "" A7105 = "" A7106 = "" A7107 = "" A7108 = "" A7109 = "" A7110 = "" 
+A7111 = "" A7112 = "" A7113 = "" A7114 = "" A7115 = "" A7116 = "" A7117 = "" A7118 = "" A7119 = "" A7120 = "" 
+A7121 = "" A7122 = "" A7123 = "" A7124 = "" A7125 = "" A7126 = "" A7127 = "" A7128 = "" A7129 = "" A7130 = "" 
+A7131 = "" A7132 = "" A7133 = "" A7134 = "" A7135 = "" A7136 = "" A7137 = "" A7138 = "" A7139 = "" A7140 = "" 
+A7141 = "" A7142 = "" A7143 = "" A7144 = "" A7145 = "" A7146 = "" A7147 = "" A7148 = "" A7149 = "" A7150 = "" 
+A7151 = "" A7152 = "" A7153 = "" A7154 = "" A7155 = "" A7156 = "" A7157 = "" A7158 = "" A7159 = "" A7160 = "" 
+A7161 = "" A7162 = "" A7163 = "" A7164 = "" A7165 = "" A7166 = "" A7167 = "" A7168 = "" A7169 = "" A7170 = "" 
+A7171 = "" A7172 = "" A7173 = "" A7174 = "" A7175 = "" A7176 = "" A7177 = "" A7178 = "" A7179 = "" A7180 = "" 
+A7181 = "" A7182 = "" A7183 = "" A7184 = "" A7185 = "" A7186 = "" A7187 = "" A7188 = "" A7189 = "" A7190 = "" 
+A7191 = "" A7192 = "" A7193 = "" A7194 = "" A7195 = "" A7196 = "" A7197 = "" A7198 = "" A7199 = "" A7200 = "" 
+A7201 = "" A7202 = "" A7203 = "" A7204 = "" A7205 = "" A7206 = "" A7207 = "" A7208 = "" A7209 = "" A7210 = "" 
+A7211 = "" A7212 = "" A7213 = "" A7214 = "" A7215 = "" A7216 = "" A7217 = "" A7218 = "" A7219 = "" A7220 = "" 
+A7221 = "" A7222 = "" A7223 = "" A7224 = "" A7225 = "" A7226 = "" A7227 = "" A7228 = "" A7229 = "" A7230 = "" 
+A7231 = "" A7232 = "" A7233 = "" A7234 = "" A7235 = "" A7236 = "" A7237 = "" A7238 = "" A7239 = "" A7240 = "" 
+A7241 = "" A7242 = "" A7243 = "" A7244 = "" A7245 = "" A7246 = "" A7247 = "" A7248 = "" A7249 = "" A7250 = "" 
+A7251 = "" A7252 = "" A7253 = "" A7254 = "" A7255 = "" A7256 = "" A7257 = "" A7258 = "" A7259 = "" A7260 = "" 
+A7261 = "" A7262 = "" A7263 = "" A7264 = "" A7265 = "" A7266 = "" A7267 = "" A7268 = "" A7269 = "" A7270 = "" 
+A7271 = "" A7272 = "" A7273 = "" A7274 = "" A7275 = "" A7276 = "" A7277 = "" A7278 = "" A7279 = "" A7280 = "" 
+A7281 = "" A7282 = "" A7283 = "" A7284 = "" A7285 = "" A7286 = "" A7287 = "" A7288 = "" A7289 = "" A7290 = "" 
+A7291 = "" A7292 = "" A7293 = "" A7294 = "" A7295 = "" A7296 = "" A7297 = "" A7298 = "" A7299 = "" A7300 = "" 
+A7301 = "" A7302 = "" A7303 = "" A7304 = "" A7305 = "" A7306 = "" A7307 = "" A7308 = "" A7309 = "" A7310 = "" 
+A7311 = "" A7312 = "" A7313 = "" A7314 = "" A7315 = "" A7316 = "" A7317 = "" A7318 = "" A7319 = "" A7320 = "" 
+A7321 = "" A7322 = "" A7323 = "" A7324 = "" A7325 = "" A7326 = "" A7327 = "" A7328 = "" A7329 = "" A7330 = "" 
+A7331 = "" A7332 = "" A7333 = "" A7334 = "" A7335 = "" A7336 = "" A7337 = "" A7338 = "" A7339 = "" A7340 = "" 
+A7341 = "" A7342 = "" A7343 = "" A7344 = "" A7345 = "" A7346 = "" A7347 = "" A7348 = "" A7349 = "" A7350 = "" 
+A7351 = "" A7352 = "" A7353 = "" A7354 = "" A7355 = "" A7356 = "" A7357 = "" A7358 = "" A7359 = "" A7360 = "" 
+A7361 = "" A7362 = "" A7363 = "" A7364 = "" A7365 = "" A7366 = "" A7367 = "" A7368 = "" A7369 = "" A7370 = "" 
+A7371 = "" A7372 = "" A7373 = "" A7374 = "" A7375 = "" A7376 = "" A7377 = "" A7378 = "" A7379 = "" A7380 = "" 
+A7381 = "" A7382 = "" A7383 = "" A7384 = "" A7385 = "" A7386 = "" A7387 = "" A7388 = "" A7389 = "" A7390 = "" 
+A7391 = "" A7392 = "" A7393 = "" A7394 = "" A7395 = "" A7396 = "" A7397 = "" A7398 = "" A7399 = "" A7400 = "" 
+A7401 = "" A7402 = "" A7403 = "" A7404 = "" A7405 = "" A7406 = "" A7407 = "" A7408 = "" A7409 = "" A7410 = "" 
+A7411 = "" A7412 = "" A7413 = "" A7414 = "" A7415 = "" A7416 = "" A7417 = "" A7418 = "" A7419 = "" A7420 = "" 
+A7421 = "" A7422 = "" A7423 = "" A7424 = "" A7425 = "" A7426 = "" A7427 = "" A7428 = "" A7429 = "" A7430 = "" 
+A7431 = "" A7432 = "" A7433 = "" A7434 = "" A7435 = "" A7436 = "" A7437 = "" A7438 = "" A7439 = "" A7440 = "" 
+A7441 = "" A7442 = "" A7443 = "" A7444 = "" A7445 = "" A7446 = "" A7447 = "" A7448 = "" A7449 = "" A7450 = "" 
+A7451 = "" A7452 = "" A7453 = "" A7454 = "" A7455 = "" A7456 = "" A7457 = "" A7458 = "" A7459 = "" A7460 = "" 
+A7461 = "" A7462 = "" A7463 = "" A7464 = "" A7465 = "" A7466 = "" A7467 = "" A7468 = "" A7469 = "" A7470 = "" 
+A7471 = "" A7472 = "" A7473 = "" A7474 = "" A7475 = "" A7476 = "" A7477 = "" A7478 = "" A7479 = "" A7480 = "" 
+A7481 = "" A7482 = "" A7483 = "" A7484 = "" A7485 = "" A7486 = "" A7487 = "" A7488 = "" A7489 = "" A7490 = "" 
+A7491 = "" A7492 = "" A7493 = "" A7494 = "" A7495 = "" A7496 = "" A7497 = "" A7498 = "" A7499 = "" A7500 = "" 
+A7501 = "" A7502 = "" A7503 = "" A7504 = "" A7505 = "" A7506 = "" A7507 = "" A7508 = "" A7509 = "" A7510 = "" 
+A7511 = "" A7512 = "" A7513 = "" A7514 = "" A7515 = "" A7516 = "" A7517 = "" A7518 = "" A7519 = "" A7520 = "" 
+A7521 = "" A7522 = "" A7523 = "" A7524 = "" A7525 = "" A7526 = "" A7527 = "" A7528 = "" A7529 = "" A7530 = "" 
+A7531 = "" A7532 = "" A7533 = "" A7534 = "" A7535 = "" A7536 = "" A7537 = "" A7538 = "" A7539 = "" A7540 = "" 
+A7541 = "" A7542 = "" A7543 = "" A7544 = "" A7545 = "" A7546 = "" A7547 = "" A7548 = "" A7549 = "" A7550 = "" 
+A7551 = "" A7552 = "" A7553 = "" A7554 = "" A7555 = "" A7556 = "" A7557 = "" A7558 = "" A7559 = "" A7560 = "" 
+A7561 = "" A7562 = "" A7563 = "" A7564 = "" A7565 = "" A7566 = "" A7567 = "" A7568 = "" A7569 = "" A7570 = "" 
+A7571 = "" A7572 = "" A7573 = "" A7574 = "" A7575 = "" A7576 = "" A7577 = "" A7578 = "" A7579 = "" A7580 = "" 
+A7581 = "" A7582 = "" A7583 = "" A7584 = "" A7585 = "" A7586 = "" A7587 = "" A7588 = "" A7589 = "" A7590 = "" 
+A7591 = "" A7592 = "" A7593 = "" A7594 = "" A7595 = "" A7596 = "" A7597 = "" A7598 = "" A7599 = "" A7600 = "" 
+A7601 = "" A7602 = "" A7603 = "" A7604 = "" A7605 = "" A7606 = "" A7607 = "" A7608 = "" A7609 = "" A7610 = "" 
+A7611 = "" A7612 = "" A7613 = "" A7614 = "" A7615 = "" A7616 = "" A7617 = "" A7618 = "" A7619 = "" A7620 = "" 
+A7621 = "" A7622 = "" A7623 = "" A7624 = "" A7625 = "" A7626 = "" A7627 = "" A7628 = "" A7629 = "" A7630 = "" 
+A7631 = "" A7632 = "" A7633 = "" A7634 = "" A7635 = "" A7636 = "" A7637 = "" A7638 = "" A7639 = "" A7640 = "" 
+A7641 = "" A7642 = "" A7643 = "" A7644 = "" A7645 = "" A7646 = "" A7647 = "" A7648 = "" A7649 = "" A7650 = "" 
+A7651 = "" A7652 = "" A7653 = "" A7654 = "" A7655 = "" A7656 = "" A7657 = "" A7658 = "" A7659 = "" A7660 = "" 
+A7661 = "" A7662 = "" A7663 = "" A7664 = "" A7665 = "" A7666 = "" A7667 = "" A7668 = "" A7669 = "" A7670 = "" 
+A7671 = "" A7672 = "" A7673 = "" A7674 = "" A7675 = "" A7676 = "" A7677 = "" A7678 = "" A7679 = "" A7680 = "" 
+A7681 = "" A7682 = "" A7683 = "" A7684 = "" A7685 = "" A7686 = "" A7687 = "" A7688 = "" A7689 = "" A7690 = "" 
+A7691 = "" A7692 = "" A7693 = "" A7694 = "" A7695 = "" A7696 = "" A7697 = "" A7698 = "" A7699 = "" A7700 = "" 
+A7701 = "" A7702 = "" A7703 = "" A7704 = "" A7705 = "" A7706 = "" A7707 = "" A7708 = "" A7709 = "" A7710 = "" 
+A7711 = "" A7712 = "" A7713 = "" A7714 = "" A7715 = "" A7716 = "" A7717 = "" A7718 = "" A7719 = "" A7720 = "" 
+A7721 = "" A7722 = "" A7723 = "" A7724 = "" A7725 = "" A7726 = "" A7727 = "" A7728 = "" A7729 = "" A7730 = "" 
+A7731 = "" A7732 = "" A7733 = "" A7734 = "" A7735 = "" A7736 = "" A7737 = "" A7738 = "" A7739 = "" A7740 = "" 
+A7741 = "" A7742 = "" A7743 = "" A7744 = "" A7745 = "" A7746 = "" A7747 = "" A7748 = "" A7749 = "" A7750 = "" 
+A7751 = "" A7752 = "" A7753 = "" A7754 = "" A7755 = "" A7756 = "" A7757 = "" A7758 = "" A7759 = "" A7760 = "" 
+A7761 = "" A7762 = "" A7763 = "" A7764 = "" A7765 = "" A7766 = "" A7767 = "" A7768 = "" A7769 = "" A7770 = "" 
+A7771 = "" A7772 = "" A7773 = "" A7774 = "" A7775 = "" A7776 = "" A7777 = "" A7778 = "" A7779 = "" A7780 = "" 
+A7781 = "" A7782 = "" A7783 = "" A7784 = "" A7785 = "" A7786 = "" A7787 = "" A7788 = "" A7789 = "" A7790 = "" 
+A7791 = "" A7792 = "" A7793 = "" A7794 = "" A7795 = "" A7796 = "" A7797 = "" A7798 = "" A7799 = "" A7800 = "" 
+A7801 = "" A7802 = "" A7803 = "" A7804 = "" A7805 = "" A7806 = "" A7807 = "" A7808 = "" A7809 = "" A7810 = "" 
+A7811 = "" A7812 = "" A7813 = "" A7814 = "" A7815 = "" A7816 = "" A7817 = "" A7818 = "" A7819 = "" A7820 = "" 
+A7821 = "" A7822 = "" A7823 = "" A7824 = "" A7825 = "" A7826 = "" A7827 = "" A7828 = "" A7829 = "" A7830 = "" 
+A7831 = "" A7832 = "" A7833 = "" A7834 = "" A7835 = "" A7836 = "" A7837 = "" A7838 = "" A7839 = "" A7840 = "" 
+A7841 = "" A7842 = "" A7843 = "" A7844 = "" A7845 = "" A7846 = "" A7847 = "" A7848 = "" A7849 = "" A7850 = "" 
+A7851 = "" A7852 = "" A7853 = "" A7854 = "" A7855 = "" A7856 = "" A7857 = "" A7858 = "" A7859 = "" A7860 = "" 
+A7861 = "" A7862 = "" A7863 = "" A7864 = "" A7865 = "" A7866 = "" A7867 = "" A7868 = "" A7869 = "" A7870 = "" 
+A7871 = "" A7872 = "" A7873 = "" A7874 = "" A7875 = "" A7876 = "" A7877 = "" A7878 = "" A7879 = "" A7880 = "" 
+A7881 = "" A7882 = "" A7883 = "" A7884 = "" A7885 = "" A7886 = "" A7887 = "" A7888 = "" A7889 = "" A7890 = "" 
+A7891 = "" A7892 = "" A7893 = "" A7894 = "" A7895 = "" A7896 = "" A7897 = "" A7898 = "" A7899 = "" A7900 = "" 
+A7901 = "" A7902 = "" A7903 = "" A7904 = "" A7905 = "" A7906 = "" A7907 = "" A7908 = "" A7909 = "" A7910 = "" 
+A7911 = "" A7912 = "" A7913 = "" A7914 = "" A7915 = "" A7916 = "" A7917 = "" A7918 = "" A7919 = "" A7920 = "" 
+A7921 = "" A7922 = "" A7923 = "" A7924 = "" A7925 = "" A7926 = "" A7927 = "" A7928 = "" A7929 = "" A7930 = "" 
+A7931 = "" A7932 = "" A7933 = "" A7934 = "" A7935 = "" A7936 = "" A7937 = "" A7938 = "" A7939 = "" A7940 = "" 
+A7941 = "" A7942 = "" A7943 = "" A7944 = "" A7945 = "" A7946 = "" A7947 = "" A7948 = "" A7949 = "" A7950 = "" 
+A7951 = "" A7952 = "" A7953 = "" A7954 = "" A7955 = "" A7956 = "" A7957 = "" A7958 = "" A7959 = "" A7960 = "" 
+A7961 = "" A7962 = "" A7963 = "" A7964 = "" A7965 = "" A7966 = "" A7967 = "" A7968 = "" A7969 = "" A7970 = "" 
+A7971 = "" A7972 = "" A7973 = "" A7974 = "" A7975 = "" A7976 = "" A7977 = "" A7978 = "" A7979 = "" A7980 = "" 
+A7981 = "" A7982 = "" A7983 = "" A7984 = "" A7985 = "" A7986 = "" A7987 = "" A7988 = "" A7989 = "" A7990 = "" 
+A7991 = "" A7992 = "" A7993 = "" A7994 = "" A7995 = "" A7996 = "" A7997 = "" A7998 = "" A7999 = "" A8000 = "" 
+A8001 = "" A8002 = "" A8003 = "" A8004 = "" A8005 = "" A8006 = "" A8007 = "" A8008 = "" A8009 = "" A8010 = "" 
+A8011 = "" A8012 = "" A8013 = "" A8014 = "" A8015 = "" A8016 = "" A8017 = "" A8018 = "" A8019 = "" A8020 = "" 
+A8021 = "" A8022 = "" A8023 = "" A8024 = "" A8025 = "" A8026 = "" A8027 = "" A8028 = "" A8029 = "" A8030 = "" 
+A8031 = "" A8032 = "" A8033 = "" A8034 = "" A8035 = "" A8036 = "" A8037 = "" A8038 = "" A8039 = "" A8040 = "" 
+A8041 = "" A8042 = "" A8043 = "" A8044 = "" A8045 = "" A8046 = "" A8047 = "" A8048 = "" A8049 = "" A8050 = "" 
+A8051 = "" A8052 = "" A8053 = "" A8054 = "" A8055 = "" A8056 = "" A8057 = "" A8058 = "" A8059 = "" A8060 = "" 
+A8061 = "" A8062 = "" A8063 = "" A8064 = "" A8065 = "" A8066 = "" A8067 = "" A8068 = "" A8069 = "" A8070 = "" 
+A8071 = "" A8072 = "" A8073 = "" A8074 = "" A8075 = "" A8076 = "" A8077 = "" A8078 = "" A8079 = "" A8080 = "" 
+A8081 = "" A8082 = "" A8083 = "" A8084 = "" A8085 = "" A8086 = "" A8087 = "" A8088 = "" A8089 = "" A8090 = "" 
+A8091 = "" A8092 = "" A8093 = "" A8094 = "" A8095 = "" A8096 = "" A8097 = "" A8098 = "" A8099 = "" A8100 = "" 
+A8101 = "" A8102 = "" A8103 = "" A8104 = "" A8105 = "" A8106 = "" A8107 = "" A8108 = "" A8109 = "" A8110 = "" 
+A8111 = "" A8112 = "" A8113 = "" A8114 = "" A8115 = "" A8116 = "" A8117 = "" A8118 = "" A8119 = "" A8120 = "" 
+A8121 = "" A8122 = "" A8123 = "" A8124 = "" A8125 = "" A8126 = "" A8127 = "" A8128 = "" A8129 = "" A8130 = "" 
+A8131 = "" A8132 = "" A8133 = "" A8134 = "" A8135 = "" A8136 = "" A8137 = "" A8138 = "" A8139 = "" A8140 = "" 
+A8141 = "" A8142 = "" A8143 = "" A8144 = "" A8145 = "" A8146 = "" A8147 = "" A8148 = "" A8149 = "" A8150 = "" 
+A8151 = "" A8152 = "" A8153 = "" A8154 = "" A8155 = "" A8156 = "" A8157 = "" A8158 = "" A8159 = "" A8160 = "" 
+A8161 = "" A8162 = "" A8163 = "" A8164 = "" A8165 = "" A8166 = "" A8167 = "" A8168 = "" A8169 = "" A8170 = "" 
+A8171 = "" A8172 = "" A8173 = "" A8174 = "" A8175 = "" A8176 = "" A8177 = "" A8178 = "" A8179 = "" A8180 = "" 
+A8181 = "" A8182 = "" A8183 = "" A8184 = "" A8185 = "" A8186 = "" A8187 = "" A8188 = "" A8189 = "" A8190 = "" 
+A8191 = "" A8192 = "" A8193 = "" A8194 = "" A8195 = "" A8196 = "" A8197 = "" A8198 = "" A8199 = "" A8200 = "" 
+A8201 = "" A8202 = "" A8203 = "" A8204 = "" A8205 = "" A8206 = "" A8207 = "" A8208 = "" A8209 = "" A8210 = "" 
+A8211 = "" A8212 = "" A8213 = "" A8214 = "" A8215 = "" A8216 = "" A8217 = "" A8218 = "" A8219 = "" A8220 = "" 
+A8221 = "" A8222 = "" A8223 = "" A8224 = "" A8225 = "" A8226 = "" A8227 = "" A8228 = "" A8229 = "" A8230 = "" 
+A8231 = "" A8232 = "" A8233 = "" A8234 = "" A8235 = "" A8236 = "" A8237 = "" A8238 = "" A8239 = "" A8240 = "" 
+A8241 = "" A8242 = "" A8243 = "" A8244 = "" A8245 = "" A8246 = "" A8247 = "" A8248 = "" A8249 = "" A8250 = "" 
+A8251 = "" A8252 = "" A8253 = "" A8254 = "" A8255 = "" A8256 = "" A8257 = "" A8258 = "" A8259 = "" A8260 = "" 
+A8261 = "" A8262 = "" A8263 = "" A8264 = "" A8265 = "" A8266 = "" A8267 = "" A8268 = "" A8269 = "" A8270 = "" 
+A8271 = "" A8272 = "" A8273 = "" A8274 = "" A8275 = "" A8276 = "" A8277 = "" A8278 = "" A8279 = "" A8280 = "" 
+A8281 = "" A8282 = "" A8283 = "" A8284 = "" A8285 = "" A8286 = "" A8287 = "" A8288 = "" A8289 = "" A8290 = "" 
+A8291 = "" A8292 = "" A8293 = "" A8294 = "" A8295 = "" A8296 = "" A8297 = "" A8298 = "" A8299 = "" A8300 = "" 
+A8301 = "" A8302 = "" A8303 = "" A8304 = "" A8305 = "" A8306 = "" A8307 = "" A8308 = "" A8309 = "" A8310 = "" 
+A8311 = "" A8312 = "" A8313 = "" A8314 = "" A8315 = "" A8316 = "" A8317 = "" A8318 = "" A8319 = "" A8320 = "" 
+A8321 = "" A8322 = "" A8323 = "" A8324 = "" A8325 = "" A8326 = "" A8327 = "" A8328 = "" A8329 = "" A8330 = "" 
+A8331 = "" A8332 = "" A8333 = "" A8334 = "" A8335 = "" A8336 = "" A8337 = "" A8338 = "" A8339 = "" A8340 = "" 
+A8341 = "" A8342 = "" A8343 = "" A8344 = "" A8345 = "" A8346 = "" A8347 = "" A8348 = "" A8349 = "" A8350 = "" 
+A8351 = "" A8352 = "" A8353 = "" A8354 = "" A8355 = "" A8356 = "" A8357 = "" A8358 = "" A8359 = "" A8360 = "" 
+A8361 = "" A8362 = "" A8363 = "" A8364 = "" A8365 = "" A8366 = "" A8367 = "" A8368 = "" A8369 = "" A8370 = "" 
+A8371 = "" A8372 = "" A8373 = "" A8374 = "" A8375 = "" A8376 = "" A8377 = "" A8378 = "" A8379 = "" A8380 = "" 
+A8381 = "" A8382 = "" A8383 = "" A8384 = "" A8385 = "" A8386 = "" A8387 = "" A8388 = "" A8389 = "" A8390 = "" 
+A8391 = "" A8392 = "" A8393 = "" A8394 = "" A8395 = "" A8396 = "" A8397 = "" A8398 = "" A8399 = "" A8400 = "" 
+A8401 = "" A8402 = "" A8403 = "" A8404 = "" A8405 = "" A8406 = "" A8407 = "" A8408 = "" A8409 = "" A8410 = "" 
+A8411 = "" A8412 = "" A8413 = "" A8414 = "" A8415 = "" A8416 = "" A8417 = "" A8418 = "" A8419 = "" A8420 = "" 
+A8421 = "" A8422 = "" A8423 = "" A8424 = "" A8425 = "" A8426 = "" A8427 = "" A8428 = "" A8429 = "" A8430 = "" 
+A8431 = "" A8432 = "" A8433 = "" A8434 = "" A8435 = "" A8436 = "" A8437 = "" A8438 = "" A8439 = "" A8440 = "" 
+A8441 = "" A8442 = "" A8443 = "" A8444 = "" A8445 = "" A8446 = "" A8447 = "" A8448 = "" A8449 = "" A8450 = "" 
+A8451 = "" A8452 = "" A8453 = "" A8454 = "" A8455 = "" A8456 = "" A8457 = "" A8458 = "" A8459 = "" A8460 = "" 
+A8461 = "" A8462 = "" A8463 = "" A8464 = "" A8465 = "" A8466 = "" A8467 = "" A8468 = "" A8469 = "" A8470 = "" 
+A8471 = "" A8472 = "" A8473 = "" A8474 = "" A8475 = "" A8476 = "" A8477 = "" A8478 = "" A8479 = "" A8480 = "" 
+A8481 = "" A8482 = "" A8483 = "" A8484 = "" A8485 = "" A8486 = "" A8487 = "" A8488 = "" A8489 = "" A8490 = "" 
+A8491 = "" A8492 = "" A8493 = "" A8494 = "" A8495 = "" A8496 = "" A8497 = "" A8498 = "" A8499 = "" A8500 = "" 
+A8501 = "" A8502 = "" A8503 = "" A8504 = "" A8505 = "" A8506 = "" A8507 = "" A8508 = "" A8509 = "" A8510 = "" 
+A8511 = "" A8512 = "" A8513 = "" A8514 = "" A8515 = "" A8516 = "" A8517 = "" A8518 = "" A8519 = "" A8520 = "" 
+A8521 = "" A8522 = "" A8523 = "" A8524 = "" A8525 = "" A8526 = "" A8527 = "" A8528 = "" A8529 = "" A8530 = "" 
+A8531 = "" A8532 = "" A8533 = "" A8534 = "" A8535 = "" A8536 = "" A8537 = "" A8538 = "" A8539 = "" A8540 = "" 
+A8541 = "" A8542 = "" A8543 = "" A8544 = "" A8545 = "" A8546 = "" A8547 = "" A8548 = "" A8549 = "" A8550 = "" 
+A8551 = "" A8552 = "" A8553 = "" A8554 = "" A8555 = "" A8556 = "" A8557 = "" A8558 = "" A8559 = "" A8560 = "" 
+A8561 = "" A8562 = "" A8563 = "" A8564 = "" A8565 = "" A8566 = "" A8567 = "" A8568 = "" A8569 = "" A8570 = "" 
+A8571 = "" A8572 = "" A8573 = "" A8574 = "" A8575 = "" A8576 = "" A8577 = "" A8578 = "" A8579 = "" A8580 = "" 
+A8581 = "" A8582 = "" A8583 = "" A8584 = "" A8585 = "" A8586 = "" A8587 = "" A8588 = "" A8589 = "" A8590 = "" 
+A8591 = "" A8592 = "" A8593 = "" A8594 = "" A8595 = "" A8596 = "" A8597 = "" A8598 = "" A8599 = "" A8600 = "" 
+A8601 = "" A8602 = "" A8603 = "" A8604 = "" A8605 = "" A8606 = "" A8607 = "" A8608 = "" A8609 = "" A8610 = "" 
+A8611 = "" A8612 = "" A8613 = "" A8614 = "" A8615 = "" A8616 = "" A8617 = "" A8618 = "" A8619 = "" A8620 = "" 
+A8621 = "" A8622 = "" A8623 = "" A8624 = "" A8625 = "" A8626 = "" A8627 = "" A8628 = "" A8629 = "" A8630 = "" 
+A8631 = "" A8632 = "" A8633 = "" A8634 = "" A8635 = "" A8636 = "" A8637 = "" A8638 = "" A8639 = "" A8640 = "" 
+A8641 = "" A8642 = "" A8643 = "" A8644 = "" A8645 = "" A8646 = "" A8647 = "" A8648 = "" A8649 = "" A8650 = "" 
+A8651 = "" A8652 = "" A8653 = "" A8654 = "" A8655 = "" A8656 = "" A8657 = "" A8658 = "" A8659 = "" A8660 = "" 
+A8661 = "" A8662 = "" A8663 = "" A8664 = "" A8665 = "" A8666 = "" A8667 = "" A8668 = "" A8669 = "" A8670 = "" 
+A8671 = "" A8672 = "" A8673 = "" A8674 = "" A8675 = "" A8676 = "" A8677 = "" A8678 = "" A8679 = "" A8680 = "" 
+A8681 = "" A8682 = "" A8683 = "" A8684 = "" A8685 = "" A8686 = "" A8687 = "" A8688 = "" A8689 = "" A8690 = "" 
+A8691 = "" A8692 = "" A8693 = "" A8694 = "" A8695 = "" A8696 = "" A8697 = "" A8698 = "" A8699 = "" A8700 = "" 
+A8701 = "" A8702 = "" A8703 = "" A8704 = "" A8705 = "" A8706 = "" A8707 = "" A8708 = "" A8709 = "" A8710 = "" 
+A8711 = "" A8712 = "" A8713 = "" A8714 = "" A8715 = "" A8716 = "" A8717 = "" A8718 = "" A8719 = "" A8720 = "" 
+A8721 = "" A8722 = "" A8723 = "" A8724 = "" A8725 = "" A8726 = "" A8727 = "" A8728 = "" A8729 = "" A8730 = "" 
+A8731 = "" A8732 = "" A8733 = "" A8734 = "" A8735 = "" A8736 = "" A8737 = "" A8738 = "" A8739 = "" A8740 = "" 
+A8741 = "" A8742 = "" A8743 = "" A8744 = "" A8745 = "" A8746 = "" A8747 = "" A8748 = "" A8749 = "" A8750 = "" 
+A8751 = "" A8752 = "" A8753 = "" A8754 = "" A8755 = "" A8756 = "" A8757 = "" A8758 = "" A8759 = "" A8760 = "" 
+A8761 = "" A8762 = "" A8763 = "" A8764 = "" A8765 = "" A8766 = "" A8767 = "" A8768 = "" A8769 = "" A8770 = "" 
+A8771 = "" A8772 = "" A8773 = "" A8774 = "" A8775 = "" A8776 = "" A8777 = "" A8778 = "" A8779 = "" A8780 = "" 
+A8781 = "" A8782 = "" A8783 = "" A8784 = "" A8785 = "" A8786 = "" A8787 = "" A8788 = "" A8789 = "" A8790 = "" 
+A8791 = "" A8792 = "" A8793 = "" A8794 = "" A8795 = "" A8796 = "" A8797 = "" A8798 = "" A8799 = "" A8800 = "" 
+A8801 = "" A8802 = "" A8803 = "" A8804 = "" A8805 = "" A8806 = "" A8807 = "" A8808 = "" A8809 = "" A8810 = "" 
+A8811 = "" A8812 = "" A8813 = "" A8814 = "" A8815 = "" A8816 = "" A8817 = "" A8818 = "" A8819 = "" A8820 = "" 
+A8821 = "" A8822 = "" A8823 = "" A8824 = "" A8825 = "" A8826 = "" A8827 = "" A8828 = "" A8829 = "" A8830 = "" 
+A8831 = "" A8832 = "" A8833 = "" A8834 = "" A8835 = "" A8836 = "" A8837 = "" A8838 = "" A8839 = "" A8840 = "" 
+A8841 = "" A8842 = "" A8843 = "" A8844 = "" A8845 = "" A8846 = "" A8847 = "" A8848 = "" A8849 = "" A8850 = "" 
+A8851 = "" A8852 = "" A8853 = "" A8854 = "" A8855 = "" A8856 = "" A8857 = "" A8858 = "" A8859 = "" A8860 = "" 
+A8861 = "" A8862 = "" A8863 = "" A8864 = "" A8865 = "" A8866 = "" A8867 = "" A8868 = "" A8869 = "" A8870 = "" 
+A8871 = "" A8872 = "" A8873 = "" A8874 = "" A8875 = "" A8876 = "" A8877 = "" A8878 = "" A8879 = "" A8880 = "" 
+A8881 = "" A8882 = "" A8883 = "" A8884 = "" A8885 = "" A8886 = "" A8887 = "" A8888 = "" A8889 = "" A8890 = "" 
+A8891 = "" A8892 = "" A8893 = "" A8894 = "" A8895 = "" A8896 = "" A8897 = "" A8898 = "" A8899 = "" A8900 = "" 
+A8901 = "" A8902 = "" A8903 = "" A8904 = "" A8905 = "" A8906 = "" A8907 = "" A8908 = "" A8909 = "" A8910 = "" 
+A8911 = "" A8912 = "" A8913 = "" A8914 = "" A8915 = "" A8916 = "" A8917 = "" A8918 = "" A8919 = "" A8920 = "" 
+A8921 = "" A8922 = "" A8923 = "" A8924 = "" A8925 = "" A8926 = "" A8927 = "" A8928 = "" A8929 = "" A8930 = "" 
+A8931 = "" A8932 = "" A8933 = "" A8934 = "" A8935 = "" A8936 = "" A8937 = "" A8938 = "" A8939 = "" A8940 = "" 
+A8941 = "" A8942 = "" A8943 = "" A8944 = "" A8945 = "" A8946 = "" A8947 = "" A8948 = "" A8949 = "" A8950 = "" 
+A8951 = "" A8952 = "" A8953 = "" A8954 = "" A8955 = "" A8956 = "" A8957 = "" A8958 = "" A8959 = "" A8960 = "" 
+A8961 = "" A8962 = "" A8963 = "" A8964 = "" A8965 = "" A8966 = "" A8967 = "" A8968 = "" A8969 = "" A8970 = "" 
+A8971 = "" A8972 = "" A8973 = "" A8974 = "" A8975 = "" A8976 = "" A8977 = "" A8978 = "" A8979 = "" A8980 = "" 
+A8981 = "" A8982 = "" A8983 = "" A8984 = "" A8985 = "" A8986 = "" A8987 = "" A8988 = "" A8989 = "" A8990 = "" 
+A8991 = "" A8992 = "" A8993 = "" A8994 = "" A8995 = "" A8996 = "" A8997 = "" A8998 = "" A8999 = "" A9000 = "" 
+A9001 = "" A9002 = "" A9003 = "" A9004 = "" A9005 = "" A9006 = "" A9007 = "" A9008 = "" A9009 = "" A9010 = "" 
+A9011 = "" A9012 = "" A9013 = "" A9014 = "" A9015 = "" A9016 = "" A9017 = "" A9018 = "" A9019 = "" A9020 = "" 
+A9021 = "" A9022 = "" A9023 = "" A9024 = "" A9025 = "" A9026 = "" A9027 = "" A9028 = "" A9029 = "" A9030 = "" 
+A9031 = "" A9032 = "" A9033 = "" A9034 = "" A9035 = "" A9036 = "" A9037 = "" A9038 = "" A9039 = "" A9040 = "" 
+A9041 = "" A9042 = "" A9043 = "" A9044 = "" A9045 = "" A9046 = "" A9047 = "" A9048 = "" A9049 = "" A9050 = "" 
+A9051 = "" A9052 = "" A9053 = "" A9054 = "" A9055 = "" A9056 = "" A9057 = "" A9058 = "" A9059 = "" A9060 = "" 
+A9061 = "" A9062 = "" A9063 = "" A9064 = "" A9065 = "" A9066 = "" A9067 = "" A9068 = "" A9069 = "" A9070 = "" 
+A9071 = "" A9072 = "" A9073 = "" A9074 = "" A9075 = "" A9076 = "" A9077 = "" A9078 = "" A9079 = "" A9080 = "" 
+A9081 = "" A9082 = "" A9083 = "" A9084 = "" A9085 = "" A9086 = "" A9087 = "" A9088 = "" A9089 = "" A9090 = "" 
+A9091 = "" A9092 = "" A9093 = "" A9094 = "" A9095 = "" A9096 = "" A9097 = "" A9098 = "" A9099 = "" A9100 = "" 
+A9101 = "" A9102 = "" A9103 = "" A9104 = "" A9105 = "" A9106 = "" A9107 = "" A9108 = "" A9109 = "" A9110 = "" 
+A9111 = "" A9112 = "" A9113 = "" A9114 = "" A9115 = "" A9116 = "" A9117 = "" A9118 = "" A9119 = "" A9120 = "" 
+A9121 = "" A9122 = "" A9123 = "" A9124 = "" A9125 = "" A9126 = "" A9127 = "" A9128 = "" A9129 = "" A9130 = "" 
+A9131 = "" A9132 = "" A9133 = "" A9134 = "" A9135 = "" A9136 = "" A9137 = "" A9138 = "" A9139 = "" A9140 = "" 
+A9141 = "" A9142 = "" A9143 = "" A9144 = "" A9145 = "" A9146 = "" A9147 = "" A9148 = "" A9149 = "" A9150 = "" 
+A9151 = "" A9152 = "" A9153 = "" A9154 = "" A9155 = "" A9156 = "" A9157 = "" A9158 = "" A9159 = "" A9160 = "" 
+A9161 = "" A9162 = "" A9163 = "" A9164 = "" A9165 = "" A9166 = "" A9167 = "" A9168 = "" A9169 = "" A9170 = "" 
+A9171 = "" A9172 = "" A9173 = "" A9174 = "" A9175 = "" A9176 = "" A9177 = "" A9178 = "" A9179 = "" A9180 = "" 
+A9181 = "" A9182 = "" A9183 = "" A9184 = "" A9185 = "" A9186 = "" A9187 = "" A9188 = "" A9189 = "" A9190 = "" 
+A9191 = "" A9192 = "" A9193 = "" A9194 = "" A9195 = "" A9196 = "" A9197 = "" A9198 = "" A9199 = "" A9200 = "" 
+A9201 = "" A9202 = "" A9203 = "" A9204 = "" A9205 = "" A9206 = "" A9207 = "" A9208 = "" A9209 = "" A9210 = "" 
+A9211 = "" A9212 = "" A9213 = "" A9214 = "" A9215 = "" A9216 = "" A9217 = "" A9218 = "" A9219 = "" A9220 = "" 
+A9221 = "" A9222 = "" A9223 = "" A9224 = "" A9225 = "" A9226 = "" A9227 = "" A9228 = "" A9229 = "" A9230 = "" 
+A9231 = "" A9232 = "" A9233 = "" A9234 = "" A9235 = "" A9236 = "" A9237 = "" A9238 = "" A9239 = "" A9240 = "" 
+A9241 = "" A9242 = "" A9243 = "" A9244 = "" A9245 = "" A9246 = "" A9247 = "" A9248 = "" A9249 = "" A9250 = "" 
+A9251 = "" A9252 = "" A9253 = "" A9254 = "" A9255 = "" A9256 = "" A9257 = "" A9258 = "" A9259 = "" A9260 = "" 
+A9261 = "" A9262 = "" A9263 = "" A9264 = "" A9265 = "" A9266 = "" A9267 = "" A9268 = "" A9269 = "" A9270 = "" 
+A9271 = "" A9272 = "" A9273 = "" A9274 = "" A9275 = "" A9276 = "" A9277 = "" A9278 = "" A9279 = "" A9280 = "" 
+A9281 = "" A9282 = "" A9283 = "" A9284 = "" A9285 = "" A9286 = "" A9287 = "" A9288 = "" A9289 = "" A9290 = "" 
+A9291 = "" A9292 = "" A9293 = "" A9294 = "" A9295 = "" A9296 = "" A9297 = "" A9298 = "" A9299 = "" A9300 = "" 
+A9301 = "" A9302 = "" A9303 = "" A9304 = "" A9305 = "" A9306 = "" A9307 = "" A9308 = "" A9309 = "" A9310 = "" 
+A9311 = "" A9312 = "" A9313 = "" A9314 = "" A9315 = "" A9316 = "" A9317 = "" A9318 = "" A9319 = "" A9320 = "" 
+A9321 = "" A9322 = "" A9323 = "" A9324 = "" A9325 = "" A9326 = "" A9327 = "" A9328 = "" A9329 = "" A9330 = "" 
+A9331 = "" A9332 = "" A9333 = "" A9334 = "" A9335 = "" A9336 = "" A9337 = "" A9338 = "" A9339 = "" A9340 = "" 
+A9341 = "" A9342 = "" A9343 = "" A9344 = "" A9345 = "" A9346 = "" A9347 = "" A9348 = "" A9349 = "" A9350 = "" 
+A9351 = "" A9352 = "" A9353 = "" A9354 = "" A9355 = "" A9356 = "" A9357 = "" A9358 = "" A9359 = "" A9360 = "" 
+A9361 = "" A9362 = "" A9363 = "" A9364 = "" A9365 = "" A9366 = "" A9367 = "" A9368 = "" A9369 = "" A9370 = "" 
+A9371 = "" A9372 = "" A9373 = "" A9374 = "" A9375 = "" A9376 = "" A9377 = "" A9378 = "" A9379 = "" A9380 = "" 
+A9381 = "" A9382 = "" A9383 = "" A9384 = "" A9385 = "" A9386 = "" A9387 = "" A9388 = "" A9389 = "" A9390 = "" 
+A9391 = "" A9392 = "" A9393 = "" A9394 = "" A9395 = "" A9396 = "" A9397 = "" A9398 = "" A9399 = "" A9400 = "" 
+A9401 = "" A9402 = "" A9403 = "" A9404 = "" A9405 = "" A9406 = "" A9407 = "" A9408 = "" A9409 = "" A9410 = "" 
+A9411 = "" A9412 = "" A9413 = "" A9414 = "" A9415 = "" A9416 = "" A9417 = "" A9418 = "" A9419 = "" A9420 = "" 
+A9421 = "" A9422 = "" A9423 = "" A9424 = "" A9425 = "" A9426 = "" A9427 = "" A9428 = "" A9429 = "" A9430 = "" 
+A9431 = "" A9432 = "" A9433 = "" A9434 = "" A9435 = "" A9436 = "" A9437 = "" A9438 = "" A9439 = "" A9440 = "" 
+A9441 = "" A9442 = "" A9443 = "" A9444 = "" A9445 = "" A9446 = "" A9447 = "" A9448 = "" A9449 = "" A9450 = "" 
+A9451 = "" A9452 = "" A9453 = "" A9454 = "" A9455 = "" A9456 = "" A9457 = "" A9458 = "" A9459 = "" A9460 = "" 
+A9461 = "" A9462 = "" A9463 = "" A9464 = "" A9465 = "" A9466 = "" A9467 = "" A9468 = "" A9469 = "" A9470 = "" 
+A9471 = "" A9472 = "" A9473 = "" A9474 = "" A9475 = "" A9476 = "" A9477 = "" A9478 = "" A9479 = "" A9480 = "" 
+A9481 = "" A9482 = "" A9483 = "" A9484 = "" A9485 = "" A9486 = "" A9487 = "" A9488 = "" A9489 = "" A9490 = "" 
+A9491 = "" A9492 = "" A9493 = "" A9494 = "" A9495 = "" A9496 = "" A9497 = "" A9498 = "" A9499 = "" A9500 = "" 
+A9501 = "" A9502 = "" A9503 = "" A9504 = "" A9505 = "" A9506 = "" A9507 = "" A9508 = "" A9509 = "" A9510 = "" 
+A9511 = "" A9512 = "" A9513 = "" A9514 = "" A9515 = "" A9516 = "" A9517 = "" A9518 = "" A9519 = "" A9520 = "" 
+A9521 = "" A9522 = "" A9523 = "" A9524 = "" A9525 = "" A9526 = "" A9527 = "" A9528 = "" A9529 = "" A9530 = "" 
+A9531 = "" A9532 = "" A9533 = "" A9534 = "" A9535 = "" A9536 = "" A9537 = "" A9538 = "" A9539 = "" A9540 = "" 
+A9541 = "" A9542 = "" A9543 = "" A9544 = "" A9545 = "" A9546 = "" A9547 = "" A9548 = "" A9549 = "" A9550 = "" 
+A9551 = "" A9552 = "" A9553 = "" A9554 = "" A9555 = "" A9556 = "" A9557 = "" A9558 = "" A9559 = "" A9560 = "" 
+A9561 = "" A9562 = "" A9563 = "" A9564 = "" A9565 = "" A9566 = "" A9567 = "" A9568 = "" A9569 = "" A9570 = "" 
+A9571 = "" A9572 = "" A9573 = "" A9574 = "" A9575 = "" A9576 = "" A9577 = "" A9578 = "" A9579 = "" A9580 = "" 
+A9581 = "" A9582 = "" A9583 = "" A9584 = "" A9585 = "" A9586 = "" A9587 = "" A9588 = "" A9589 = "" A9590 = "" 
+A9591 = "" A9592 = "" A9593 = "" A9594 = "" A9595 = "" A9596 = "" A9597 = "" A9598 = "" A9599 = "" A9600 = "" 
+A9601 = "" A9602 = "" A9603 = "" A9604 = "" A9605 = "" A9606 = "" A9607 = "" A9608 = "" A9609 = "" A9610 = "" 
+A9611 = "" A9612 = "" A9613 = "" A9614 = "" A9615 = "" A9616 = "" A9617 = "" A9618 = "" A9619 = "" A9620 = "" 
+A9621 = "" A9622 = "" A9623 = "" A9624 = "" A9625 = "" A9626 = "" A9627 = "" A9628 = "" A9629 = "" A9630 = "" 
+A9631 = "" A9632 = "" A9633 = "" A9634 = "" A9635 = "" A9636 = "" A9637 = "" A9638 = "" A9639 = "" A9640 = "" 
+A9641 = "" A9642 = "" A9643 = "" A9644 = "" A9645 = "" A9646 = "" A9647 = "" A9648 = "" A9649 = "" A9650 = "" 
+A9651 = "" A9652 = "" A9653 = "" A9654 = "" A9655 = "" A9656 = "" A9657 = "" A9658 = "" A9659 = "" A9660 = "" 
+A9661 = "" A9662 = "" A9663 = "" A9664 = "" A9665 = "" A9666 = "" A9667 = "" A9668 = "" A9669 = "" A9670 = "" 
+A9671 = "" A9672 = "" A9673 = "" A9674 = "" A9675 = "" A9676 = "" A9677 = "" A9678 = "" A9679 = "" A9680 = "" 
+A9681 = "" A9682 = "" A9683 = "" A9684 = "" A9685 = "" A9686 = "" A9687 = "" A9688 = "" A9689 = "" A9690 = "" 
+A9691 = "" A9692 = "" A9693 = "" A9694 = "" A9695 = "" A9696 = "" A9697 = "" A9698 = "" A9699 = "" A9700 = "" 
+A9701 = "" A9702 = "" A9703 = "" A9704 = "" A9705 = "" A9706 = "" A9707 = "" A9708 = "" A9709 = "" A9710 = "" 
+A9711 = "" A9712 = "" A9713 = "" A9714 = "" A9715 = "" A9716 = "" A9717 = "" A9718 = "" A9719 = "" A9720 = "" 
+A9721 = "" A9722 = "" A9723 = "" A9724 = "" A9725 = "" A9726 = "" A9727 = "" A9728 = "" A9729 = "" A9730 = "" 
+A9731 = "" A9732 = "" A9733 = "" A9734 = "" A9735 = "" A9736 = "" A9737 = "" A9738 = "" A9739 = "" A9740 = "" 
+A9741 = "" A9742 = "" A9743 = "" A9744 = "" A9745 = "" A9746 = "" A9747 = "" A9748 = "" A9749 = "" A9750 = "" 
+A9751 = "" A9752 = "" A9753 = "" A9754 = "" A9755 = "" A9756 = "" A9757 = "" A9758 = "" A9759 = "" A9760 = "" 
+A9761 = "" A9762 = "" A9763 = "" A9764 = "" A9765 = "" A9766 = "" A9767 = "" A9768 = "" A9769 = "" A9770 = "" 
+A9771 = "" A9772 = "" A9773 = "" A9774 = "" A9775 = "" A9776 = "" A9777 = "" A9778 = "" A9779 = "" A9780 = "" 
+A9781 = "" A9782 = "" A9783 = "" A9784 = "" A9785 = "" A9786 = "" A9787 = "" A9788 = "" A9789 = "" A9790 = "" 
+A9791 = "" A9792 = "" A9793 = "" A9794 = "" A9795 = "" A9796 = "" A9797 = "" A9798 = "" A9799 = "" A9800 = "" 
+A9801 = "" A9802 = "" A9803 = "" A9804 = "" A9805 = "" A9806 = "" A9807 = "" A9808 = "" A9809 = "" A9810 = "" 
+A9811 = "" A9812 = "" A9813 = "" A9814 = "" A9815 = "" A9816 = "" A9817 = "" A9818 = "" A9819 = "" A9820 = "" 
+A9821 = "" A9822 = "" A9823 = "" A9824 = "" A9825 = "" A9826 = "" A9827 = "" A9828 = "" A9829 = "" A9830 = "" 
+A9831 = "" A9832 = "" A9833 = "" A9834 = "" A9835 = "" A9836 = "" A9837 = "" A9838 = "" A9839 = "" A9840 = "" 
+A9841 = "" A9842 = "" A9843 = "" A9844 = "" A9845 = "" A9846 = "" A9847 = "" A9848 = "" A9849 = "" A9850 = "" 
+A9851 = "" A9852 = "" A9853 = "" A9854 = "" A9855 = "" A9856 = "" A9857 = "" A9858 = "" A9859 = "" A9860 = "" 
+A9861 = "" A9862 = "" A9863 = "" A9864 = "" A9865 = "" A9866 = "" A9867 = "" A9868 = "" A9869 = "" A9870 = "" 
+A9871 = "" A9872 = "" A9873 = "" A9874 = "" A9875 = "" A9876 = "" A9877 = "" A9878 = "" A9879 = "" A9880 = "" 
+A9881 = "" A9882 = "" A9883 = "" A9884 = "" A9885 = "" A9886 = "" A9887 = "" A9888 = "" A9889 = "" A9890 = "" 
+A9891 = "" A9892 = "" A9893 = "" A9894 = "" A9895 = "" A9896 = "" A9897 = "" A9898 = "" A9899 = "" A9900 = "" 
+A9901 = "" A9902 = "" A9903 = "" A9904 = "" A9905 = "" A9906 = "" A9907 = "" A9908 = "" A9909 = "" A9910 = "" 
+A9911 = "" A9912 = "" A9913 = "" A9914 = "" A9915 = "" A9916 = "" A9917 = "" A9918 = "" A9919 = "" A9920 = "" 
+A9921 = "" A9922 = "" A9923 = "" A9924 = "" A9925 = "" A9926 = "" A9927 = "" A9928 = "" A9929 = "" A9930 = "" 
+A9931 = "" A9932 = "" A9933 = "" A9934 = "" A9935 = "" A9936 = "" A9937 = "" A9938 = "" A9939 = "" A9940 = "" 
+A9941 = "" A9942 = "" A9943 = "" A9944 = "" A9945 = "" A9946 = "" A9947 = "" A9948 = "" A9949 = "" A9950 = "" 
+A9951 = "" A9952 = "" A9953 = "" A9954 = "" A9955 = "" A9956 = "" A9957 = "" A9958 = "" A9959 = "" A9960 = "" 
+A9961 = "" A9962 = "" A9963 = "" A9964 = "" A9965 = "" A9966 = "" A9967 = "" A9968 = "" A9969 = "" A9970 = "" 
+A9971 = "" A9972 = "" A9973 = "" A9974 = "" A9975 = "" A9976 = "" A9977 = "" A9978 = "" A9979 = "" A9980 = "" 
+A9981 = "" A9982 = "" A9983 = "" A9984 = "" A9985 = "" A9986 = "" A9987 = "" A9988 = "" A9989 = "" A9990 = "" 
+A9991 = "" A9992 = "" A9993 = "" A9994 = "" A9995 = "" A9996 = "" A9997 = "" A9998 = "" A9999 = "" A10000 = "" 
+A10001 = "" A10002 = "" A10003 = "" A10004 = "" A10005 = "" A10006 = "" A10007 = "" A10008 = "" A10009 = "" A10010 = "" 
+A10011 = "" A10012 = "" A10013 = "" A10014 = "" A10015 = "" A10016 = "" A10017 = "" A10018 = "" A10019 = "" A10020 = "" 
+A10021 = "" A10022 = "" A10023 = "" A10024 = "" A10025 = "" A10026 = "" A10027 = "" A10028 = "" A10029 = "" A10030 = "" 
+A10031 = "" A10032 = "" A10033 = "" A10034 = "" A10035 = "" A10036 = "" A10037 = "" A10038 = "" A10039 = "" A10040 = "" 
+A10041 = "" A10042 = "" A10043 = "" A10044 = "" A10045 = "" A10046 = "" A10047 = "" A10048 = "" A10049 = "" A10050 = "" 
+A10051 = "" A10052 = "" A10053 = "" A10054 = "" A10055 = "" A10056 = "" A10057 = "" A10058 = "" A10059 = "" A10060 = "" 
+A10061 = "" A10062 = "" A10063 = "" A10064 = "" A10065 = "" A10066 = "" A10067 = "" A10068 = "" A10069 = "" A10070 = "" 
+A10071 = "" A10072 = "" A10073 = "" A10074 = "" A10075 = "" A10076 = "" A10077 = "" A10078 = "" A10079 = "" A10080 = "" 
+A10081 = "" A10082 = "" A10083 = "" A10084 = "" A10085 = "" A10086 = "" A10087 = "" A10088 = "" A10089 = "" A10090 = "" 
+A10091 = "" A10092 = "" A10093 = "" A10094 = "" A10095 = "" A10096 = "" A10097 = "" A10098 = "" A10099 = "" A10100 = "" 
+A10101 = "" A10102 = "" A10103 = "" A10104 = "" A10105 = "" A10106 = "" A10107 = "" A10108 = "" A10109 = "" A10110 = "" 
+A10111 = "" A10112 = "" A10113 = "" A10114 = "" A10115 = "" A10116 = "" A10117 = "" A10118 = "" A10119 = "" A10120 = "" 
+A10121 = "" A10122 = "" A10123 = "" A10124 = "" A10125 = "" A10126 = "" A10127 = "" A10128 = "" A10129 = "" A10130 = "" 
+A10131 = "" A10132 = "" A10133 = "" A10134 = "" A10135 = "" A10136 = "" A10137 = "" A10138 = "" A10139 = "" A10140 = "" 
+A10141 = "" A10142 = "" A10143 = "" A10144 = "" A10145 = "" A10146 = "" A10147 = "" A10148 = "" A10149 = "" A10150 = "" 
+A10151 = "" A10152 = "" A10153 = "" A10154 = "" A10155 = "" A10156 = "" A10157 = "" A10158 = "" A10159 = "" A10160 = "" 
+A10161 = "" A10162 = "" A10163 = "" A10164 = "" A10165 = "" A10166 = "" A10167 = "" A10168 = "" A10169 = "" A10170 = "" 
+A10171 = "" A10172 = "" A10173 = "" A10174 = "" A10175 = "" A10176 = "" A10177 = "" A10178 = "" A10179 = "" A10180 = "" 
+A10181 = "" A10182 = "" A10183 = "" A10184 = "" A10185 = "" A10186 = "" A10187 = "" A10188 = "" A10189 = "" A10190 = "" 
+A10191 = "" A10192 = "" A10193 = "" A10194 = "" A10195 = "" A10196 = "" A10197 = "" A10198 = "" A10199 = "" A10200 = "" 
+A10201 = "" A10202 = "" A10203 = "" A10204 = "" A10205 = "" A10206 = "" A10207 = "" A10208 = "" A10209 = "" A10210 = "" 
+A10211 = "" A10212 = "" A10213 = "" A10214 = "" A10215 = "" A10216 = "" A10217 = "" A10218 = "" A10219 = "" A10220 = "" 
+A10221 = "" A10222 = "" A10223 = "" A10224 = "" A10225 = "" A10226 = "" A10227 = "" A10228 = "" A10229 = "" A10230 = "" 
+A10231 = "" A10232 = "" A10233 = "" A10234 = "" A10235 = "" A10236 = "" A10237 = "" A10238 = "" A10239 = "" A10240 = "" 
+A10241 = "" A10242 = "" A10243 = "" A10244 = "" A10245 = "" A10246 = "" A10247 = "" A10248 = "" A10249 = "" A10250 = "" 
+A10251 = "" A10252 = "" A10253 = "" A10254 = "" A10255 = "" A10256 = "" A10257 = "" A10258 = "" A10259 = "" A10260 = "" 
+A10261 = "" A10262 = "" A10263 = "" A10264 = "" A10265 = "" A10266 = "" A10267 = "" A10268 = "" A10269 = "" A10270 = "" 
+A10271 = "" A10272 = "" A10273 = "" A10274 = "" A10275 = "" A10276 = "" A10277 = "" A10278 = "" A10279 = "" A10280 = "" 
+A10281 = "" A10282 = "" A10283 = "" A10284 = "" A10285 = "" A10286 = "" A10287 = "" A10288 = "" A10289 = "" A10290 = "" 
+A10291 = "" A10292 = "" A10293 = "" A10294 = "" A10295 = "" A10296 = "" A10297 = "" A10298 = "" A10299 = "" A10300 = "" 
+A10301 = "" A10302 = "" A10303 = "" A10304 = "" A10305 = "" A10306 = "" A10307 = "" A10308 = "" A10309 = "" A10310 = "" 
+A10311 = "" A10312 = "" A10313 = "" A10314 = "" A10315 = "" A10316 = "" A10317 = "" A10318 = "" A10319 = "" A10320 = "" 
+A10321 = "" A10322 = "" A10323 = "" A10324 = "" A10325 = "" A10326 = "" A10327 = "" A10328 = "" A10329 = "" A10330 = "" 
+A10331 = "" A10332 = "" A10333 = "" A10334 = "" A10335 = "" A10336 = "" A10337 = "" A10338 = "" A10339 = "" A10340 = "" 
+A10341 = "" A10342 = "" A10343 = "" A10344 = "" A10345 = "" A10346 = "" A10347 = "" A10348 = "" A10349 = "" A10350 = "" 
+A10351 = "" A10352 = "" A10353 = "" A10354 = "" A10355 = "" A10356 = "" A10357 = "" A10358 = "" A10359 = "" A10360 = "" 
+A10361 = "" A10362 = "" A10363 = "" A10364 = "" A10365 = "" A10366 = "" A10367 = "" A10368 = "" A10369 = "" A10370 = "" 
+A10371 = "" A10372 = "" A10373 = "" A10374 = "" A10375 = "" A10376 = "" A10377 = "" A10378 = "" A10379 = "" A10380 = "" 
+A10381 = "" A10382 = "" A10383 = "" A10384 = "" A10385 = "" A10386 = "" A10387 = "" A10388 = "" A10389 = "" A10390 = "" 
+A10391 = "" A10392 = "" A10393 = "" A10394 = "" A10395 = "" A10396 = "" A10397 = "" A10398 = "" A10399 = "" A10400 = "" 
+A10401 = "" A10402 = "" A10403 = "" A10404 = "" A10405 = "" A10406 = "" A10407 = "" A10408 = "" A10409 = "" A10410 = "" 
+A10411 = "" A10412 = "" A10413 = "" A10414 = "" A10415 = "" A10416 = "" A10417 = "" A10418 = "" A10419 = "" A10420 = "" 
+A10421 = "" A10422 = "" A10423 = "" A10424 = "" A10425 = "" A10426 = "" A10427 = "" A10428 = "" A10429 = "" A10430 = "" 
+A10431 = "" A10432 = "" A10433 = "" A10434 = "" A10435 = "" A10436 = "" A10437 = "" A10438 = "" A10439 = "" A10440 = "" 
+A10441 = "" A10442 = "" A10443 = "" A10444 = "" A10445 = "" A10446 = "" A10447 = "" A10448 = "" A10449 = "" A10450 = "" 
+A10451 = "" A10452 = "" A10453 = "" A10454 = "" A10455 = "" A10456 = "" A10457 = "" A10458 = "" A10459 = "" A10460 = "" 
+A10461 = "" A10462 = "" A10463 = "" A10464 = "" A10465 = "" A10466 = "" A10467 = "" A10468 = "" A10469 = "" A10470 = "" 
+A10471 = "" A10472 = "" A10473 = "" A10474 = "" A10475 = "" A10476 = "" A10477 = "" A10478 = "" A10479 = "" A10480 = "" 
+A10481 = "" A10482 = "" A10483 = "" A10484 = "" A10485 = "" A10486 = "" A10487 = "" A10488 = "" A10489 = "" A10490 = "" 
+A10491 = "" A10492 = "" A10493 = "" A10494 = "" A10495 = "" A10496 = "" A10497 = "" A10498 = "" A10499 = "" A10500 = "" 
+A10501 = "" A10502 = "" A10503 = "" A10504 = "" A10505 = "" A10506 = "" A10507 = "" A10508 = "" A10509 = "" A10510 = "" 
+A10511 = "" A10512 = "" A10513 = "" A10514 = "" A10515 = "" A10516 = "" A10517 = "" A10518 = "" A10519 = "" A10520 = "" 
+A10521 = "" A10522 = "" A10523 = "" A10524 = "" A10525 = "" A10526 = "" A10527 = "" A10528 = "" A10529 = "" A10530 = "" 
+A10531 = "" A10532 = "" A10533 = "" A10534 = "" A10535 = "" A10536 = "" A10537 = "" A10538 = "" A10539 = "" A10540 = "" 
+A10541 = "" A10542 = "" A10543 = "" A10544 = "" A10545 = "" A10546 = "" A10547 = "" A10548 = "" A10549 = "" A10550 = "" 
+A10551 = "" A10552 = "" A10553 = "" A10554 = "" A10555 = "" A10556 = "" A10557 = "" A10558 = "" A10559 = "" A10560 = "" 
+A10561 = "" A10562 = "" A10563 = "" A10564 = "" A10565 = "" A10566 = "" A10567 = "" A10568 = "" A10569 = "" A10570 = "" 
+A10571 = "" A10572 = "" A10573 = "" A10574 = "" A10575 = "" A10576 = "" A10577 = "" A10578 = "" A10579 = "" A10580 = "" 
+A10581 = "" A10582 = "" A10583 = "" A10584 = "" A10585 = "" A10586 = "" A10587 = "" A10588 = "" A10589 = "" A10590 = "" 
+A10591 = "" A10592 = "" A10593 = "" A10594 = "" A10595 = "" A10596 = "" A10597 = "" A10598 = "" A10599 = "" A10600 = "" 
+A10601 = "" A10602 = "" A10603 = "" A10604 = "" A10605 = "" A10606 = "" A10607 = "" A10608 = "" A10609 = "" A10610 = "" 
+A10611 = "" A10612 = "" A10613 = "" A10614 = "" A10615 = "" A10616 = "" A10617 = "" A10618 = "" A10619 = "" A10620 = "" 
+A10621 = "" A10622 = "" A10623 = "" A10624 = "" A10625 = "" A10626 = "" A10627 = "" A10628 = "" A10629 = "" A10630 = "" 
+A10631 = "" A10632 = "" A10633 = "" A10634 = "" A10635 = "" A10636 = "" A10637 = "" A10638 = "" A10639 = "" A10640 = "" 
+A10641 = "" A10642 = "" A10643 = "" A10644 = "" A10645 = "" A10646 = "" A10647 = "" A10648 = "" A10649 = "" A10650 = "" 
+A10651 = "" A10652 = "" A10653 = "" A10654 = "" A10655 = "" A10656 = "" A10657 = "" A10658 = "" A10659 = "" A10660 = "" 
+A10661 = "" A10662 = "" A10663 = "" A10664 = "" A10665 = "" A10666 = "" A10667 = "" A10668 = "" A10669 = "" A10670 = "" 
+A10671 = "" A10672 = "" A10673 = "" A10674 = "" A10675 = "" A10676 = "" A10677 = "" A10678 = "" A10679 = "" A10680 = "" 
+A10681 = "" A10682 = "" A10683 = "" A10684 = "" A10685 = "" A10686 = "" A10687 = "" A10688 = "" A10689 = "" A10690 = "" 
+A10691 = "" A10692 = "" A10693 = "" A10694 = "" A10695 = "" A10696 = "" A10697 = "" A10698 = "" A10699 = "" A10700 = "" 
+A10701 = "" A10702 = "" A10703 = "" A10704 = "" A10705 = "" A10706 = "" A10707 = "" A10708 = "" A10709 = "" A10710 = "" 
+A10711 = "" A10712 = "" A10713 = "" A10714 = "" A10715 = "" A10716 = "" A10717 = "" A10718 = "" A10719 = "" A10720 = "" 
+A10721 = "" A10722 = "" A10723 = "" A10724 = "" A10725 = "" A10726 = "" A10727 = "" A10728 = "" A10729 = "" A10730 = "" 
+A10731 = "" A10732 = "" A10733 = "" A10734 = "" A10735 = "" A10736 = "" A10737 = "" A10738 = "" A10739 = "" A10740 = "" 
+A10741 = "" A10742 = "" A10743 = "" A10744 = "" A10745 = "" A10746 = "" A10747 = "" A10748 = "" A10749 = "" A10750 = "" 
+A10751 = "" A10752 = "" A10753 = "" A10754 = "" A10755 = "" A10756 = "" A10757 = "" A10758 = "" A10759 = "" A10760 = "" 
+A10761 = "" A10762 = "" A10763 = "" A10764 = "" A10765 = "" A10766 = "" A10767 = "" A10768 = "" A10769 = "" A10770 = "" 
+A10771 = "" A10772 = "" A10773 = "" A10774 = "" A10775 = "" A10776 = "" A10777 = "" A10778 = "" A10779 = "" A10780 = "" 
+A10781 = "" A10782 = "" A10783 = "" A10784 = "" A10785 = "" A10786 = "" A10787 = "" A10788 = "" A10789 = "" A10790 = "" 
+A10791 = "" A10792 = "" A10793 = "" A10794 = "" A10795 = "" A10796 = "" A10797 = "" A10798 = "" A10799 = "" A10800 = "" 
+A10801 = "" A10802 = "" A10803 = "" A10804 = "" A10805 = "" A10806 = "" A10807 = "" A10808 = "" A10809 = "" A10810 = "" 
+A10811 = "" A10812 = "" A10813 = "" A10814 = "" A10815 = "" A10816 = "" A10817 = "" A10818 = "" A10819 = "" A10820 = "" 
+A10821 = "" A10822 = "" A10823 = "" A10824 = "" A10825 = "" A10826 = "" A10827 = "" A10828 = "" A10829 = "" A10830 = "" 
+A10831 = "" A10832 = "" A10833 = "" A10834 = "" A10835 = "" A10836 = "" A10837 = "" A10838 = "" A10839 = "" A10840 = "" 
+A10841 = "" A10842 = "" A10843 = "" A10844 = "" A10845 = "" A10846 = "" A10847 = "" A10848 = "" A10849 = "" A10850 = "" 
+A10851 = "" A10852 = "" A10853 = "" A10854 = "" A10855 = "" A10856 = "" A10857 = "" A10858 = "" A10859 = "" A10860 = "" 
+A10861 = "" A10862 = "" A10863 = "" A10864 = "" A10865 = "" A10866 = "" A10867 = "" A10868 = "" A10869 = "" A10870 = "" 
+A10871 = "" A10872 = "" A10873 = "" A10874 = "" A10875 = "" A10876 = "" A10877 = "" A10878 = "" A10879 = "" A10880 = "" 
+A10881 = "" A10882 = "" A10883 = "" A10884 = "" A10885 = "" A10886 = "" A10887 = "" A10888 = "" A10889 = "" A10890 = "" 
+A10891 = "" A10892 = "" A10893 = "" A10894 = "" A10895 = "" A10896 = "" A10897 = "" A10898 = "" A10899 = "" A10900 = "" 
+A10901 = "" A10902 = "" A10903 = "" A10904 = "" A10905 = "" A10906 = "" A10907 = "" A10908 = "" A10909 = "" A10910 = "" 
+A10911 = "" A10912 = "" A10913 = "" A10914 = "" A10915 = "" A10916 = "" A10917 = "" A10918 = "" A10919 = "" A10920 = "" 
+A10921 = "" A10922 = "" A10923 = "" A10924 = "" A10925 = "" A10926 = "" A10927 = "" A10928 = "" A10929 = "" A10930 = "" 
+A10931 = "" A10932 = "" A10933 = "" A10934 = "" A10935 = "" A10936 = "" A10937 = "" A10938 = "" A10939 = "" A10940 = "" 
+A10941 = "" A10942 = "" A10943 = "" A10944 = "" A10945 = "" A10946 = "" A10947 = "" A10948 = "" A10949 = "" A10950 = "" 
+A10951 = "" A10952 = "" A10953 = "" A10954 = "" A10955 = "" A10956 = "" A10957 = "" A10958 = "" A10959 = "" A10960 = "" 
+A10961 = "" A10962 = "" A10963 = "" A10964 = "" A10965 = "" A10966 = "" A10967 = "" A10968 = "" A10969 = "" A10970 = "" 
+A10971 = "" A10972 = "" A10973 = "" A10974 = "" A10975 = "" A10976 = "" A10977 = "" A10978 = "" A10979 = "" A10980 = "" 
+A10981 = "" A10982 = "" A10983 = "" A10984 = "" A10985 = "" A10986 = "" A10987 = "" A10988 = "" A10989 = "" A10990 = "" 
+A10991 = "" A10992 = "" A10993 = "" A10994 = "" A10995 = "" A10996 = "" A10997 = "" A10998 = "" A10999 = "" A11000 = "" 
+A11001 = "" A11002 = "" A11003 = "" A11004 = "" A11005 = "" A11006 = "" A11007 = "" A11008 = "" A11009 = "" A11010 = "" 
+A11011 = "" A11012 = "" A11013 = "" A11014 = "" A11015 = "" A11016 = "" A11017 = "" A11018 = "" A11019 = "" A11020 = "" 
+A11021 = "" A11022 = "" A11023 = "" A11024 = "" A11025 = "" A11026 = "" A11027 = "" A11028 = "" A11029 = "" A11030 = "" 
+A11031 = "" A11032 = "" A11033 = "" A11034 = "" A11035 = "" A11036 = "" A11037 = "" A11038 = "" A11039 = "" A11040 = "" 
+A11041 = "" A11042 = "" A11043 = "" A11044 = "" A11045 = "" A11046 = "" A11047 = "" A11048 = "" A11049 = "" A11050 = "" 
+A11051 = "" A11052 = "" A11053 = "" A11054 = "" A11055 = "" A11056 = "" A11057 = "" A11058 = "" A11059 = "" A11060 = "" 
+A11061 = "" A11062 = "" A11063 = "" A11064 = "" A11065 = "" A11066 = "" A11067 = "" A11068 = "" A11069 = "" A11070 = "" 
+A11071 = "" A11072 = "" A11073 = "" A11074 = "" A11075 = "" A11076 = "" A11077 = "" A11078 = "" A11079 = "" A11080 = "" 
+A11081 = "" A11082 = "" A11083 = "" A11084 = "" A11085 = "" A11086 = "" A11087 = "" A11088 = "" A11089 = "" A11090 = "" 
+A11091 = "" A11092 = "" A11093 = "" A11094 = "" A11095 = "" A11096 = "" A11097 = "" A11098 = "" A11099 = "" A11100 = "" 
+A11101 = "" A11102 = "" A11103 = "" A11104 = "" A11105 = "" A11106 = "" A11107 = "" A11108 = "" A11109 = "" A11110 = "" 
+A11111 = "" A11112 = "" A11113 = "" A11114 = "" A11115 = "" A11116 = "" A11117 = "" A11118 = "" A11119 = "" A11120 = "" 
+A11121 = "" A11122 = "" A11123 = "" A11124 = "" A11125 = "" A11126 = "" A11127 = "" A11128 = "" A11129 = "" A11130 = "" 
+A11131 = "" A11132 = "" A11133 = "" A11134 = "" A11135 = "" A11136 = "" A11137 = "" A11138 = "" A11139 = "" A11140 = "" 
+A11141 = "" A11142 = "" A11143 = "" A11144 = "" A11145 = "" A11146 = "" A11147 = "" A11148 = "" A11149 = "" A11150 = "" 
+A11151 = "" A11152 = "" A11153 = "" A11154 = "" A11155 = "" A11156 = "" A11157 = "" A11158 = "" A11159 = "" A11160 = "" 
+A11161 = "" A11162 = "" A11163 = "" A11164 = "" A11165 = "" A11166 = "" A11167 = "" A11168 = "" A11169 = "" A11170 = "" 
+A11171 = "" A11172 = "" A11173 = "" A11174 = "" A11175 = "" A11176 = "" A11177 = "" A11178 = "" A11179 = "" A11180 = "" 
+A11181 = "" A11182 = "" A11183 = "" A11184 = "" A11185 = "" A11186 = "" A11187 = "" A11188 = "" A11189 = "" A11190 = "" 
+A11191 = "" A11192 = "" A11193 = "" A11194 = "" A11195 = "" A11196 = "" A11197 = "" A11198 = "" A11199 = "" A11200 = "" 
+A11201 = "" A11202 = "" A11203 = "" A11204 = "" A11205 = "" A11206 = "" A11207 = "" A11208 = "" A11209 = "" A11210 = "" 
+A11211 = "" A11212 = "" A11213 = "" A11214 = "" A11215 = "" A11216 = "" A11217 = "" A11218 = "" A11219 = "" A11220 = "" 
+A11221 = "" A11222 = "" A11223 = "" A11224 = "" A11225 = "" A11226 = "" A11227 = "" A11228 = "" A11229 = "" A11230 = "" 
+A11231 = "" A11232 = "" A11233 = "" A11234 = "" A11235 = "" A11236 = "" A11237 = "" A11238 = "" A11239 = "" A11240 = "" 
+A11241 = "" A11242 = "" A11243 = "" A11244 = "" A11245 = "" A11246 = "" A11247 = "" A11248 = "" A11249 = "" A11250 = "" 
+A11251 = "" A11252 = "" A11253 = "" A11254 = "" A11255 = "" A11256 = "" A11257 = "" A11258 = "" A11259 = "" A11260 = "" 
+A11261 = "" A11262 = "" A11263 = "" A11264 = "" A11265 = "" A11266 = "" A11267 = "" A11268 = "" A11269 = "" A11270 = "" 
+A11271 = "" A11272 = "" A11273 = "" A11274 = "" A11275 = "" A11276 = "" A11277 = "" A11278 = "" A11279 = "" A11280 = "" 
+A11281 = "" A11282 = "" A11283 = "" A11284 = "" A11285 = "" A11286 = "" A11287 = "" A11288 = "" A11289 = "" A11290 = "" 
+A11291 = "" A11292 = "" A11293 = "" A11294 = "" A11295 = "" A11296 = "" A11297 = "" A11298 = "" A11299 = "" A11300 = "" 
+A11301 = "" A11302 = "" A11303 = "" A11304 = "" A11305 = "" A11306 = "" A11307 = "" A11308 = "" A11309 = "" A11310 = "" 
+A11311 = "" A11312 = "" A11313 = "" A11314 = "" A11315 = "" A11316 = "" A11317 = "" A11318 = "" A11319 = "" A11320 = "" 
+A11321 = "" A11322 = "" A11323 = "" A11324 = "" A11325 = "" A11326 = "" A11327 = "" A11328 = "" A11329 = "" A11330 = "" 
+A11331 = "" A11332 = "" A11333 = "" A11334 = "" A11335 = "" A11336 = "" A11337 = "" A11338 = "" A11339 = "" A11340 = "" 
+A11341 = "" A11342 = "" A11343 = "" A11344 = "" A11345 = "" A11346 = "" A11347 = "" A11348 = "" A11349 = "" A11350 = "" 
+A11351 = "" A11352 = "" A11353 = "" A11354 = "" A11355 = "" A11356 = "" A11357 = "" A11358 = "" A11359 = "" A11360 = "" 
+A11361 = "" A11362 = "" A11363 = "" A11364 = "" A11365 = "" A11366 = "" A11367 = "" A11368 = "" A11369 = "" A11370 = "" 
+A11371 = "" A11372 = "" A11373 = "" A11374 = "" A11375 = "" A11376 = "" A11377 = "" A11378 = "" A11379 = "" A11380 = "" 
+A11381 = "" A11382 = "" A11383 = "" A11384 = "" A11385 = "" A11386 = "" A11387 = "" A11388 = "" A11389 = "" A11390 = "" 
+A11391 = "" A11392 = "" A11393 = "" A11394 = "" A11395 = "" A11396 = "" A11397 = "" A11398 = "" A11399 = "" A11400 = "" 
+A11401 = "" A11402 = "" A11403 = "" A11404 = "" A11405 = "" A11406 = "" A11407 = "" A11408 = "" A11409 = "" A11410 = "" 
+A11411 = "" A11412 = "" A11413 = "" A11414 = "" A11415 = "" A11416 = "" A11417 = "" A11418 = "" A11419 = "" A11420 = "" 
+A11421 = "" A11422 = "" A11423 = "" A11424 = "" A11425 = "" A11426 = "" A11427 = "" A11428 = "" A11429 = "" A11430 = "" 
+A11431 = "" A11432 = "" A11433 = "" A11434 = "" A11435 = "" A11436 = "" A11437 = "" A11438 = "" A11439 = "" A11440 = "" 
+A11441 = "" A11442 = "" A11443 = "" A11444 = "" A11445 = "" A11446 = "" A11447 = "" A11448 = "" A11449 = "" A11450 = "" 
+A11451 = "" A11452 = "" A11453 = "" A11454 = "" A11455 = "" A11456 = "" A11457 = "" A11458 = "" A11459 = "" A11460 = "" 
+A11461 = "" A11462 = "" A11463 = "" A11464 = "" A11465 = "" A11466 = "" A11467 = "" A11468 = "" A11469 = "" A11470 = "" 
+A11471 = "" A11472 = "" A11473 = "" A11474 = "" A11475 = "" A11476 = "" A11477 = "" A11478 = "" A11479 = "" A11480 = "" 
+A11481 = "" A11482 = "" A11483 = "" A11484 = "" A11485 = "" A11486 = "" A11487 = "" A11488 = "" A11489 = "" A11490 = "" 
+A11491 = "" A11492 = "" A11493 = "" A11494 = "" A11495 = "" A11496 = "" A11497 = "" A11498 = "" A11499 = "" A11500 = "" 
+A11501 = "" A11502 = "" A11503 = "" A11504 = "" A11505 = "" A11506 = "" A11507 = "" A11508 = "" A11509 = "" A11510 = "" 
+A11511 = "" A11512 = "" A11513 = "" A11514 = "" A11515 = "" A11516 = "" A11517 = "" A11518 = "" A11519 = "" A11520 = "" 
+A11521 = "" A11522 = "" A11523 = "" A11524 = "" A11525 = "" A11526 = "" A11527 = "" A11528 = "" A11529 = "" A11530 = "" 
+A11531 = "" A11532 = "" A11533 = "" A11534 = "" A11535 = "" A11536 = "" A11537 = "" A11538 = "" A11539 = "" A11540 = "" 
+A11541 = "" A11542 = "" A11543 = "" A11544 = "" A11545 = "" A11546 = "" A11547 = "" A11548 = "" A11549 = "" A11550 = "" 
+A11551 = "" A11552 = "" A11553 = "" A11554 = "" A11555 = "" A11556 = "" A11557 = "" A11558 = "" A11559 = "" A11560 = "" 
+A11561 = "" A11562 = "" A11563 = "" A11564 = "" A11565 = "" A11566 = "" A11567 = "" A11568 = "" A11569 = "" A11570 = "" 
+A11571 = "" A11572 = "" A11573 = "" A11574 = "" A11575 = "" A11576 = "" A11577 = "" A11578 = "" A11579 = "" A11580 = "" 
+A11581 = "" A11582 = "" A11583 = "" A11584 = "" A11585 = "" A11586 = "" A11587 = "" A11588 = "" A11589 = "" A11590 = "" 
+A11591 = "" A11592 = "" A11593 = "" A11594 = "" A11595 = "" A11596 = "" A11597 = "" A11598 = "" A11599 = "" A11600 = "" 
+A11601 = "" A11602 = "" A11603 = "" A11604 = "" A11605 = "" A11606 = "" A11607 = "" A11608 = "" A11609 = "" A11610 = "" 
+A11611 = "" A11612 = "" A11613 = "" A11614 = "" A11615 = "" A11616 = "" A11617 = "" A11618 = "" A11619 = "" A11620 = "" 
+A11621 = "" A11622 = "" A11623 = "" A11624 = "" A11625 = "" A11626 = "" A11627 = "" A11628 = "" A11629 = "" A11630 = "" 
+A11631 = "" A11632 = "" A11633 = "" A11634 = "" A11635 = "" A11636 = "" A11637 = "" A11638 = "" A11639 = "" A11640 = "" 
+A11641 = "" A11642 = "" A11643 = "" A11644 = "" A11645 = "" A11646 = "" A11647 = "" A11648 = "" A11649 = "" A11650 = "" 
+A11651 = "" A11652 = "" A11653 = "" A11654 = "" A11655 = "" A11656 = "" A11657 = "" A11658 = "" A11659 = "" A11660 = "" 
+A11661 = "" A11662 = "" A11663 = "" A11664 = "" A11665 = "" A11666 = "" A11667 = "" A11668 = "" A11669 = "" A11670 = "" 
+A11671 = "" A11672 = "" A11673 = "" A11674 = "" A11675 = "" A11676 = "" A11677 = "" A11678 = "" A11679 = "" A11680 = "" 
+A11681 = "" A11682 = "" A11683 = "" A11684 = "" A11685 = "" A11686 = "" A11687 = "" A11688 = "" A11689 = "" A11690 = "" 
+A11691 = "" A11692 = "" A11693 = "" A11694 = "" A11695 = "" A11696 = "" A11697 = "" A11698 = "" A11699 = "" A11700 = "" 
+A11701 = "" A11702 = "" A11703 = "" A11704 = "" A11705 = "" A11706 = "" A11707 = "" A11708 = "" A11709 = "" A11710 = "" 
+A11711 = "" A11712 = "" A11713 = "" A11714 = "" A11715 = "" A11716 = "" A11717 = "" A11718 = "" A11719 = "" A11720 = "" 
+A11721 = "" A11722 = "" A11723 = "" A11724 = "" A11725 = "" A11726 = "" A11727 = "" A11728 = "" A11729 = "" A11730 = "" 
+A11731 = "" A11732 = "" A11733 = "" A11734 = "" A11735 = "" A11736 = "" A11737 = "" A11738 = "" A11739 = "" A11740 = "" 
+A11741 = "" A11742 = "" A11743 = "" A11744 = "" A11745 = "" A11746 = "" A11747 = "" A11748 = "" A11749 = "" A11750 = "" 
+A11751 = "" A11752 = "" A11753 = "" A11754 = "" A11755 = "" A11756 = "" A11757 = "" A11758 = "" A11759 = "" A11760 = "" 
+A11761 = "" A11762 = "" A11763 = "" A11764 = "" A11765 = "" A11766 = "" A11767 = "" A11768 = "" A11769 = "" A11770 = "" 
+A11771 = "" A11772 = "" A11773 = "" A11774 = "" A11775 = "" A11776 = "" A11777 = "" A11778 = "" A11779 = "" A11780 = "" 
+A11781 = "" A11782 = "" A11783 = "" A11784 = "" A11785 = "" A11786 = "" A11787 = "" A11788 = "" A11789 = "" A11790 = "" 
+A11791 = "" A11792 = "" A11793 = "" A11794 = "" A11795 = "" A11796 = "" A11797 = "" A11798 = "" A11799 = "" A11800 = "" 
+A11801 = "" A11802 = "" A11803 = "" A11804 = "" A11805 = "" A11806 = "" A11807 = "" A11808 = "" A11809 = "" A11810 = "" 
+A11811 = "" A11812 = "" A11813 = "" A11814 = "" A11815 = "" A11816 = "" A11817 = "" A11818 = "" A11819 = "" A11820 = "" 
+A11821 = "" A11822 = "" A11823 = "" A11824 = "" A11825 = "" A11826 = "" A11827 = "" A11828 = "" A11829 = "" A11830 = "" 
+A11831 = "" A11832 = "" A11833 = "" A11834 = "" A11835 = "" A11836 = "" A11837 = "" A11838 = "" A11839 = "" A11840 = "" 
+A11841 = "" A11842 = "" A11843 = "" A11844 = "" A11845 = "" A11846 = "" A11847 = "" A11848 = "" A11849 = "" A11850 = "" 
+A11851 = "" A11852 = "" A11853 = "" A11854 = "" A11855 = "" A11856 = "" A11857 = "" A11858 = "" A11859 = "" A11860 = "" 
+A11861 = "" A11862 = "" A11863 = "" A11864 = "" A11865 = "" A11866 = "" A11867 = "" A11868 = "" A11869 = "" A11870 = "" 
+A11871 = "" A11872 = "" A11873 = "" A11874 = "" A11875 = "" A11876 = "" A11877 = "" A11878 = "" A11879 = "" A11880 = "" 
+A11881 = "" A11882 = "" A11883 = "" A11884 = "" A11885 = "" A11886 = "" A11887 = "" A11888 = "" A11889 = "" A11890 = "" 
+A11891 = "" A11892 = "" A11893 = "" A11894 = "" A11895 = "" A11896 = "" A11897 = "" A11898 = "" A11899 = "" A11900 = "" 
+A11901 = "" A11902 = "" A11903 = "" A11904 = "" A11905 = "" A11906 = "" A11907 = "" A11908 = "" A11909 = "" A11910 = "" 
+A11911 = "" A11912 = "" A11913 = "" A11914 = "" A11915 = "" A11916 = "" A11917 = "" A11918 = "" A11919 = "" A11920 = "" 
+A11921 = "" A11922 = "" A11923 = "" A11924 = "" A11925 = "" A11926 = "" A11927 = "" A11928 = "" A11929 = "" A11930 = "" 
+A11931 = "" A11932 = "" A11933 = "" A11934 = "" A11935 = "" A11936 = "" A11937 = "" A11938 = "" A11939 = "" A11940 = "" 
+A11941 = "" A11942 = "" A11943 = "" A11944 = "" A11945 = "" A11946 = "" A11947 = "" A11948 = "" A11949 = "" A11950 = "" 
+A11951 = "" A11952 = "" A11953 = "" A11954 = "" A11955 = "" A11956 = "" A11957 = "" A11958 = "" A11959 = "" A11960 = "" 
+A11961 = "" A11962 = "" A11963 = "" A11964 = "" A11965 = "" A11966 = "" A11967 = "" A11968 = "" A11969 = "" A11970 = "" 
+A11971 = "" A11972 = "" A11973 = "" A11974 = "" A11975 = "" A11976 = "" A11977 = "" A11978 = "" A11979 = "" A11980 = "" 
+A11981 = "" A11982 = "" A11983 = "" A11984 = "" A11985 = "" A11986 = "" A11987 = "" A11988 = "" A11989 = "" A11990 = "" 
+A11991 = "" A11992 = "" A11993 = "" A11994 = "" A11995 = "" A11996 = "" A11997 = "" A11998 = "" A11999 = "" A12000 = "" 
+A12001 = "" A12002 = "" A12003 = "" A12004 = "" A12005 = "" A12006 = "" A12007 = "" A12008 = "" A12009 = "" A12010 = "" 
+A12011 = "" A12012 = "" A12013 = "" A12014 = "" A12015 = "" A12016 = "" A12017 = "" A12018 = "" A12019 = "" A12020 = "" 
+A12021 = "" A12022 = "" A12023 = "" A12024 = "" A12025 = "" A12026 = "" A12027 = "" A12028 = "" A12029 = "" A12030 = "" 
+A12031 = "" A12032 = "" A12033 = "" A12034 = "" A12035 = "" A12036 = "" A12037 = "" A12038 = "" A12039 = "" A12040 = "" 
+A12041 = "" A12042 = "" A12043 = "" A12044 = "" A12045 = "" A12046 = "" A12047 = "" A12048 = "" A12049 = "" A12050 = "" 
+A12051 = "" A12052 = "" A12053 = "" A12054 = "" A12055 = "" A12056 = "" A12057 = "" A12058 = "" A12059 = "" A12060 = "" 
+A12061 = "" A12062 = "" A12063 = "" A12064 = "" A12065 = "" A12066 = "" A12067 = "" A12068 = "" A12069 = "" A12070 = "" 
+A12071 = "" A12072 = "" A12073 = "" A12074 = "" A12075 = "" A12076 = "" A12077 = "" A12078 = "" A12079 = "" A12080 = "" 
+A12081 = "" A12082 = "" A12083 = "" A12084 = "" A12085 = "" A12086 = "" A12087 = "" A12088 = "" A12089 = "" A12090 = "" 
+A12091 = "" A12092 = "" A12093 = "" A12094 = "" A12095 = "" A12096 = "" A12097 = "" A12098 = "" A12099 = "" A12100 = "" 
+A12101 = "" A12102 = "" A12103 = "" A12104 = "" A12105 = "" A12106 = "" A12107 = "" A12108 = "" A12109 = "" A12110 = "" 
+A12111 = "" A12112 = "" A12113 = "" A12114 = "" A12115 = "" A12116 = "" A12117 = "" A12118 = "" A12119 = "" A12120 = "" 
+A12121 = "" A12122 = "" A12123 = "" A12124 = "" A12125 = "" A12126 = "" A12127 = "" A12128 = "" A12129 = "" A12130 = "" 
+A12131 = "" A12132 = "" A12133 = "" A12134 = "" A12135 = "" A12136 = "" A12137 = "" A12138 = "" A12139 = "" A12140 = "" 
+A12141 = "" A12142 = "" A12143 = "" A12144 = "" A12145 = "" A12146 = "" A12147 = "" A12148 = "" A12149 = "" A12150 = "" 
+A12151 = "" A12152 = "" A12153 = "" A12154 = "" A12155 = "" A12156 = "" A12157 = "" A12158 = "" A12159 = "" A12160 = "" 
+A12161 = "" A12162 = "" A12163 = "" A12164 = "" A12165 = "" A12166 = "" A12167 = "" A12168 = "" A12169 = "" A12170 = "" 
+A12171 = "" A12172 = "" A12173 = "" A12174 = "" A12175 = "" A12176 = "" A12177 = "" A12178 = "" A12179 = "" A12180 = "" 
+A12181 = "" A12182 = "" A12183 = "" A12184 = "" A12185 = "" A12186 = "" A12187 = "" A12188 = "" A12189 = "" A12190 = "" 
+A12191 = "" A12192 = "" A12193 = "" A12194 = "" A12195 = "" A12196 = "" A12197 = "" A12198 = "" A12199 = "" A12200 = "" 
+A12201 = "" A12202 = "" A12203 = "" A12204 = "" A12205 = "" A12206 = "" A12207 = "" A12208 = "" A12209 = "" A12210 = "" 
+A12211 = "" A12212 = "" A12213 = "" A12214 = "" A12215 = "" A12216 = "" A12217 = "" A12218 = "" A12219 = "" A12220 = "" 
+A12221 = "" A12222 = "" A12223 = "" A12224 = "" A12225 = "" A12226 = "" A12227 = "" A12228 = "" A12229 = "" A12230 = "" 
+A12231 = "" A12232 = "" A12233 = "" A12234 = "" A12235 = "" A12236 = "" A12237 = "" A12238 = "" A12239 = "" A12240 = "" 
+A12241 = "" A12242 = "" A12243 = "" A12244 = "" A12245 = "" A12246 = "" A12247 = "" A12248 = "" A12249 = "" A12250 = "" 
+A12251 = "" A12252 = "" A12253 = "" A12254 = "" A12255 = "" A12256 = "" A12257 = "" A12258 = "" A12259 = "" A12260 = "" 
+A12261 = "" A12262 = "" A12263 = "" A12264 = "" A12265 = "" A12266 = "" A12267 = "" A12268 = "" A12269 = "" A12270 = "" 
+A12271 = "" A12272 = "" A12273 = "" A12274 = "" A12275 = "" A12276 = "" A12277 = "" A12278 = "" A12279 = "" A12280 = "" 
+A12281 = "" A12282 = "" A12283 = "" A12284 = "" A12285 = "" A12286 = "" A12287 = "" A12288 = "" A12289 = "" A12290 = "" 
+A12291 = "" A12292 = "" A12293 = "" A12294 = "" A12295 = "" A12296 = "" A12297 = "" A12298 = "" A12299 = "" A12300 = "" 
+A12301 = "" A12302 = "" A12303 = "" A12304 = "" A12305 = "" A12306 = "" A12307 = "" A12308 = "" A12309 = "" A12310 = "" 
+A12311 = "" A12312 = "" A12313 = "" A12314 = "" A12315 = "" A12316 = "" A12317 = "" A12318 = "" A12319 = "" A12320 = "" 
+A12321 = "" A12322 = "" A12323 = "" A12324 = "" A12325 = "" A12326 = "" A12327 = "" A12328 = "" A12329 = "" A12330 = "" 
+A12331 = "" A12332 = "" A12333 = "" A12334 = "" A12335 = "" A12336 = "" A12337 = "" A12338 = "" A12339 = "" A12340 = "" 
+A12341 = "" A12342 = "" A12343 = "" A12344 = "" A12345 = "" A12346 = "" A12347 = "" A12348 = "" A12349 = "" A12350 = "" 
+A12351 = "" A12352 = "" A12353 = "" A12354 = "" A12355 = "" A12356 = "" A12357 = "" A12358 = "" A12359 = "" A12360 = "" 
+A12361 = "" A12362 = "" A12363 = "" A12364 = "" A12365 = "" A12366 = "" A12367 = "" A12368 = "" A12369 = "" A12370 = "" 
+A12371 = "" A12372 = "" A12373 = "" A12374 = "" A12375 = "" A12376 = "" A12377 = "" A12378 = "" A12379 = "" A12380 = "" 
+A12381 = "" A12382 = "" A12383 = "" A12384 = "" A12385 = "" A12386 = "" A12387 = "" A12388 = "" A12389 = "" A12390 = "" 
+A12391 = "" A12392 = "" A12393 = "" A12394 = "" A12395 = "" A12396 = "" A12397 = "" A12398 = "" A12399 = "" A12400 = "" 
+A12401 = "" A12402 = "" A12403 = "" A12404 = "" A12405 = "" A12406 = "" A12407 = "" A12408 = "" A12409 = "" A12410 = "" 
+A12411 = "" A12412 = "" A12413 = "" A12414 = "" A12415 = "" A12416 = "" A12417 = "" A12418 = "" A12419 = "" A12420 = "" 
+A12421 = "" A12422 = "" A12423 = "" A12424 = "" A12425 = "" A12426 = "" A12427 = "" A12428 = "" A12429 = "" A12430 = "" 
+A12431 = "" A12432 = "" A12433 = "" A12434 = "" A12435 = "" A12436 = "" A12437 = "" A12438 = "" A12439 = "" A12440 = "" 
+A12441 = "" A12442 = "" A12443 = "" A12444 = "" A12445 = "" A12446 = "" A12447 = "" A12448 = "" A12449 = "" A12450 = "" 
+A12451 = "" A12452 = "" A12453 = "" A12454 = "" A12455 = "" A12456 = "" A12457 = "" A12458 = "" A12459 = "" A12460 = "" 
+A12461 = "" A12462 = "" A12463 = "" A12464 = "" A12465 = "" A12466 = "" A12467 = "" A12468 = "" A12469 = "" A12470 = "" 
+A12471 = "" A12472 = "" A12473 = "" A12474 = "" A12475 = "" A12476 = "" A12477 = "" A12478 = "" A12479 = "" A12480 = "" 
+A12481 = "" A12482 = "" A12483 = "" A12484 = "" A12485 = "" A12486 = "" A12487 = "" A12488 = "" A12489 = "" A12490 = "" 
+A12491 = "" A12492 = "" A12493 = "" A12494 = "" A12495 = "" A12496 = "" A12497 = "" A12498 = "" A12499 = "" A12500 = "" 
+A12501 = "" A12502 = "" A12503 = "" A12504 = "" A12505 = "" A12506 = "" A12507 = "" A12508 = "" A12509 = "" A12510 = "" 
+A12511 = "" A12512 = "" A12513 = "" A12514 = "" A12515 = "" A12516 = "" A12517 = "" A12518 = "" A12519 = "" A12520 = "" 
+A12521 = "" A12522 = "" A12523 = "" A12524 = "" A12525 = "" A12526 = "" A12527 = "" A12528 = "" A12529 = "" A12530 = "" 
+A12531 = "" A12532 = "" A12533 = "" A12534 = "" A12535 = "" A12536 = "" A12537 = "" A12538 = "" A12539 = "" A12540 = "" 
+A12541 = "" A12542 = "" A12543 = "" A12544 = "" A12545 = "" A12546 = "" A12547 = "" A12548 = "" A12549 = "" A12550 = "" 
+A12551 = "" A12552 = "" A12553 = "" A12554 = "" A12555 = "" A12556 = "" A12557 = "" A12558 = "" A12559 = "" A12560 = "" 
+A12561 = "" A12562 = "" A12563 = "" A12564 = "" A12565 = "" A12566 = "" A12567 = "" A12568 = "" A12569 = "" A12570 = "" 
+A12571 = "" A12572 = "" A12573 = "" A12574 = "" A12575 = "" A12576 = "" A12577 = "" A12578 = "" A12579 = "" A12580 = "" 
+A12581 = "" A12582 = "" A12583 = "" A12584 = "" A12585 = "" A12586 = "" A12587 = "" A12588 = "" A12589 = "" A12590 = "" 
+A12591 = "" A12592 = "" A12593 = "" A12594 = "" A12595 = "" A12596 = "" A12597 = "" A12598 = "" A12599 = "" A12600 = "" 
+A12601 = "" A12602 = "" A12603 = "" A12604 = "" A12605 = "" A12606 = "" A12607 = "" A12608 = "" A12609 = "" A12610 = "" 
+A12611 = "" A12612 = "" A12613 = "" A12614 = "" A12615 = "" A12616 = "" A12617 = "" A12618 = "" A12619 = "" A12620 = "" 
+A12621 = "" A12622 = "" A12623 = "" A12624 = "" A12625 = "" A12626 = "" A12627 = "" A12628 = "" A12629 = "" A12630 = "" 
+A12631 = "" A12632 = "" A12633 = "" A12634 = "" A12635 = "" A12636 = "" A12637 = "" A12638 = "" A12639 = "" A12640 = "" 
+A12641 = "" A12642 = "" A12643 = "" A12644 = "" A12645 = "" A12646 = "" A12647 = "" A12648 = "" A12649 = "" A12650 = "" 
+A12651 = "" A12652 = "" A12653 = "" A12654 = "" A12655 = "" A12656 = "" A12657 = "" A12658 = "" A12659 = "" A12660 = "" 
+A12661 = "" A12662 = "" A12663 = "" A12664 = "" A12665 = "" A12666 = "" A12667 = "" A12668 = "" A12669 = "" A12670 = "" 
+A12671 = "" A12672 = "" A12673 = "" A12674 = "" A12675 = "" A12676 = "" A12677 = "" A12678 = "" A12679 = "" A12680 = "" 
+A12681 = "" A12682 = "" A12683 = "" A12684 = "" A12685 = "" A12686 = "" A12687 = "" A12688 = "" A12689 = "" A12690 = "" 
+A12691 = "" A12692 = "" A12693 = "" A12694 = "" A12695 = "" A12696 = "" A12697 = "" A12698 = "" A12699 = "" A12700 = "" 
+A12701 = "" A12702 = "" A12703 = "" A12704 = "" A12705 = "" A12706 = "" A12707 = "" A12708 = "" A12709 = "" A12710 = "" 
+A12711 = "" A12712 = "" A12713 = "" A12714 = "" A12715 = "" A12716 = "" A12717 = "" A12718 = "" A12719 = "" A12720 = "" 
+A12721 = "" A12722 = "" A12723 = "" A12724 = "" A12725 = "" A12726 = "" A12727 = "" A12728 = "" A12729 = "" A12730 = "" 
+A12731 = "" A12732 = "" A12733 = "" A12734 = "" A12735 = "" A12736 = "" A12737 = "" A12738 = "" A12739 = "" A12740 = "" 
+A12741 = "" A12742 = "" A12743 = "" A12744 = "" A12745 = "" A12746 = "" A12747 = "" A12748 = "" A12749 = "" A12750 = "" 
+A12751 = "" A12752 = "" A12753 = "" A12754 = "" A12755 = "" A12756 = "" A12757 = "" A12758 = "" A12759 = "" A12760 = "" 
+A12761 = "" A12762 = "" A12763 = "" A12764 = "" A12765 = "" A12766 = "" A12767 = "" A12768 = "" A12769 = "" A12770 = "" 
+A12771 = "" A12772 = "" A12773 = "" A12774 = "" A12775 = "" A12776 = "" A12777 = "" A12778 = "" A12779 = "" A12780 = "" 
+A12781 = "" A12782 = "" A12783 = "" A12784 = "" A12785 = "" A12786 = "" A12787 = "" A12788 = "" A12789 = "" A12790 = "" 
+A12791 = "" A12792 = "" A12793 = "" A12794 = "" A12795 = "" A12796 = "" A12797 = "" A12798 = "" A12799 = "" A12800 = "" 
+A12801 = "" A12802 = "" A12803 = "" A12804 = "" A12805 = "" A12806 = "" A12807 = "" A12808 = "" A12809 = "" A12810 = "" 
+A12811 = "" A12812 = "" A12813 = "" A12814 = "" A12815 = "" A12816 = "" A12817 = "" A12818 = "" A12819 = "" A12820 = "" 
+A12821 = "" A12822 = "" A12823 = "" A12824 = "" A12825 = "" A12826 = "" A12827 = "" A12828 = "" A12829 = "" A12830 = "" 
+A12831 = "" A12832 = "" A12833 = "" A12834 = "" A12835 = "" A12836 = "" A12837 = "" A12838 = "" A12839 = "" A12840 = "" 
+A12841 = "" A12842 = "" A12843 = "" A12844 = "" A12845 = "" A12846 = "" A12847 = "" A12848 = "" A12849 = "" A12850 = "" 
+A12851 = "" A12852 = "" A12853 = "" A12854 = "" A12855 = "" A12856 = "" A12857 = "" A12858 = "" A12859 = "" A12860 = "" 
+A12861 = "" A12862 = "" A12863 = "" A12864 = "" A12865 = "" A12866 = "" A12867 = "" A12868 = "" A12869 = "" A12870 = "" 
+A12871 = "" A12872 = "" A12873 = "" A12874 = "" A12875 = "" A12876 = "" A12877 = "" A12878 = "" A12879 = "" A12880 = "" 
+A12881 = "" A12882 = "" A12883 = "" A12884 = "" A12885 = "" A12886 = "" A12887 = "" A12888 = "" A12889 = "" A12890 = "" 
+A12891 = "" A12892 = "" A12893 = "" A12894 = "" A12895 = "" A12896 = "" A12897 = "" A12898 = "" A12899 = "" A12900 = "" 
+A12901 = "" A12902 = "" A12903 = "" A12904 = "" A12905 = "" A12906 = "" A12907 = "" A12908 = "" A12909 = "" A12910 = "" 
+A12911 = "" A12912 = "" A12913 = "" A12914 = "" A12915 = "" A12916 = "" A12917 = "" A12918 = "" A12919 = "" A12920 = "" 
+A12921 = "" A12922 = "" A12923 = "" A12924 = "" A12925 = "" A12926 = "" A12927 = "" A12928 = "" A12929 = "" A12930 = "" 
+A12931 = "" A12932 = "" A12933 = "" A12934 = "" A12935 = "" A12936 = "" A12937 = "" A12938 = "" A12939 = "" A12940 = "" 
+A12941 = "" A12942 = "" A12943 = "" A12944 = "" A12945 = "" A12946 = "" A12947 = "" A12948 = "" A12949 = "" A12950 = "" 
+A12951 = "" A12952 = "" A12953 = "" A12954 = "" A12955 = "" A12956 = "" A12957 = "" A12958 = "" A12959 = "" A12960 = "" 
+A12961 = "" A12962 = "" A12963 = "" A12964 = "" A12965 = "" A12966 = "" A12967 = "" A12968 = "" A12969 = "" A12970 = "" 
+A12971 = "" A12972 = "" A12973 = "" A12974 = "" A12975 = "" A12976 = "" A12977 = "" A12978 = "" A12979 = "" A12980 = "" 
+A12981 = "" A12982 = "" A12983 = "" A12984 = "" A12985 = "" A12986 = "" A12987 = "" A12988 = "" A12989 = "" A12990 = "" 
+A12991 = "" A12992 = "" A12993 = "" A12994 = "" A12995 = "" A12996 = "" A12997 = "" A12998 = "" A12999 = "" A13000 = "" 
+A13001 = "" A13002 = "" A13003 = "" A13004 = "" A13005 = "" A13006 = "" A13007 = "" A13008 = "" A13009 = "" A13010 = "" 
+A13011 = "" A13012 = "" A13013 = "" A13014 = "" A13015 = "" A13016 = "" A13017 = "" A13018 = "" A13019 = "" A13020 = "" 
+A13021 = "" A13022 = "" A13023 = "" A13024 = "" A13025 = "" A13026 = "" A13027 = "" A13028 = "" A13029 = "" A13030 = "" 
+A13031 = "" A13032 = "" A13033 = "" A13034 = "" A13035 = "" A13036 = "" A13037 = "" A13038 = "" A13039 = "" A13040 = "" 
+A13041 = "" A13042 = "" A13043 = "" A13044 = "" A13045 = "" A13046 = "" A13047 = "" A13048 = "" A13049 = "" A13050 = "" 
+A13051 = "" A13052 = "" A13053 = "" A13054 = "" A13055 = "" A13056 = "" A13057 = "" A13058 = "" A13059 = "" A13060 = "" 
+A13061 = "" A13062 = "" A13063 = "" A13064 = "" A13065 = "" A13066 = "" A13067 = "" A13068 = "" A13069 = "" A13070 = "" 
+A13071 = "" A13072 = "" A13073 = "" A13074 = "" A13075 = "" A13076 = "" A13077 = "" A13078 = "" A13079 = "" A13080 = "" 
+A13081 = "" A13082 = "" A13083 = "" A13084 = "" A13085 = "" A13086 = "" A13087 = "" A13088 = "" A13089 = "" A13090 = "" 
+A13091 = "" A13092 = "" A13093 = "" A13094 = "" A13095 = "" A13096 = "" A13097 = "" A13098 = "" A13099 = "" A13100 = "" 
+A13101 = "" A13102 = "" A13103 = "" A13104 = "" A13105 = "" A13106 = "" A13107 = "" A13108 = "" A13109 = "" A13110 = "" 
+A13111 = "" A13112 = "" A13113 = "" A13114 = "" A13115 = "" A13116 = "" A13117 = "" A13118 = "" A13119 = "" A13120 = "" 
+A13121 = "" A13122 = "" A13123 = "" A13124 = "" A13125 = "" A13126 = "" A13127 = "" A13128 = "" A13129 = "" A13130 = "" 
+A13131 = "" A13132 = "" A13133 = "" A13134 = "" A13135 = "" A13136 = "" A13137 = "" A13138 = "" A13139 = "" A13140 = "" 
+A13141 = "" A13142 = "" A13143 = "" A13144 = "" A13145 = "" A13146 = "" A13147 = "" A13148 = "" A13149 = "" A13150 = "" 
+A13151 = "" A13152 = "" A13153 = "" A13154 = "" A13155 = "" A13156 = "" A13157 = "" A13158 = "" A13159 = "" A13160 = "" 
+A13161 = "" A13162 = "" A13163 = "" A13164 = "" A13165 = "" A13166 = "" A13167 = "" A13168 = "" A13169 = "" A13170 = "" 
+A13171 = "" A13172 = "" A13173 = "" A13174 = "" A13175 = "" A13176 = "" A13177 = "" A13178 = "" A13179 = "" A13180 = "" 
+A13181 = "" A13182 = "" A13183 = "" A13184 = "" A13185 = "" A13186 = "" A13187 = "" A13188 = "" A13189 = "" A13190 = "" 
+A13191 = "" A13192 = "" A13193 = "" A13194 = "" A13195 = "" A13196 = "" A13197 = "" A13198 = "" A13199 = "" A13200 = "" 
+A13201 = "" A13202 = "" A13203 = "" A13204 = "" A13205 = "" A13206 = "" A13207 = "" A13208 = "" A13209 = "" A13210 = "" 
+A13211 = "" A13212 = "" A13213 = "" A13214 = "" A13215 = "" A13216 = "" A13217 = "" A13218 = "" A13219 = "" A13220 = "" 
+A13221 = "" A13222 = "" A13223 = "" A13224 = "" A13225 = "" A13226 = "" A13227 = "" A13228 = "" A13229 = "" A13230 = "" 
+A13231 = "" A13232 = "" A13233 = "" A13234 = "" A13235 = "" A13236 = "" A13237 = "" A13238 = "" A13239 = "" A13240 = "" 
+A13241 = "" A13242 = "" A13243 = "" A13244 = "" A13245 = "" A13246 = "" A13247 = "" A13248 = "" A13249 = "" A13250 = "" 
+A13251 = "" A13252 = "" A13253 = "" A13254 = "" A13255 = "" A13256 = "" A13257 = "" A13258 = "" A13259 = "" A13260 = "" 
+A13261 = "" A13262 = "" A13263 = "" A13264 = "" A13265 = "" A13266 = "" A13267 = "" A13268 = "" A13269 = "" A13270 = "" 
+A13271 = "" A13272 = "" A13273 = "" A13274 = "" A13275 = "" A13276 = "" A13277 = "" A13278 = "" A13279 = "" A13280 = "" 
+A13281 = "" A13282 = "" A13283 = "" A13284 = "" A13285 = "" A13286 = "" A13287 = "" A13288 = "" A13289 = "" A13290 = "" 
+A13291 = "" A13292 = "" A13293 = "" A13294 = "" A13295 = "" A13296 = "" A13297 = "" A13298 = "" A13299 = "" A13300 = "" 
+A13301 = "" A13302 = "" A13303 = "" A13304 = "" A13305 = "" A13306 = "" A13307 = "" A13308 = "" A13309 = "" A13310 = "" 
+A13311 = "" A13312 = "" A13313 = "" A13314 = "" A13315 = "" A13316 = "" A13317 = "" A13318 = "" A13319 = "" A13320 = "" 
+A13321 = "" A13322 = "" A13323 = "" A13324 = "" A13325 = "" A13326 = "" A13327 = "" A13328 = "" A13329 = "" A13330 = "" 
+A13331 = "" A13332 = "" A13333 = "" A13334 = "" A13335 = "" A13336 = "" A13337 = "" A13338 = "" A13339 = "" A13340 = "" 
+A13341 = "" A13342 = "" A13343 = "" A13344 = "" A13345 = "" A13346 = "" A13347 = "" A13348 = "" A13349 = "" A13350 = "" 
+A13351 = "" A13352 = "" A13353 = "" A13354 = "" A13355 = "" A13356 = "" A13357 = "" A13358 = "" A13359 = "" A13360 = "" 
+A13361 = "" A13362 = "" A13363 = "" A13364 = "" A13365 = "" A13366 = "" A13367 = "" A13368 = "" A13369 = "" A13370 = "" 
+A13371 = "" A13372 = "" A13373 = "" A13374 = "" A13375 = "" A13376 = "" A13377 = "" A13378 = "" A13379 = "" A13380 = "" 
+A13381 = "" A13382 = "" A13383 = "" A13384 = "" A13385 = "" A13386 = "" A13387 = "" A13388 = "" A13389 = "" A13390 = "" 
+A13391 = "" A13392 = "" A13393 = "" A13394 = "" A13395 = "" A13396 = "" A13397 = "" A13398 = "" A13399 = "" A13400 = "" 
+A13401 = "" A13402 = "" A13403 = "" A13404 = "" A13405 = "" A13406 = "" A13407 = "" A13408 = "" A13409 = "" A13410 = "" 
+A13411 = "" A13412 = "" A13413 = "" A13414 = "" A13415 = "" A13416 = "" A13417 = "" A13418 = "" A13419 = "" A13420 = "" 
+A13421 = "" A13422 = "" A13423 = "" A13424 = "" A13425 = "" A13426 = "" A13427 = "" A13428 = "" A13429 = "" A13430 = "" 
+A13431 = "" A13432 = "" A13433 = "" A13434 = "" A13435 = "" A13436 = "" A13437 = "" A13438 = "" A13439 = "" A13440 = "" 
+A13441 = "" A13442 = "" A13443 = "" A13444 = "" A13445 = "" A13446 = "" A13447 = "" A13448 = "" A13449 = "" A13450 = "" 
+A13451 = "" A13452 = "" A13453 = "" A13454 = "" A13455 = "" A13456 = "" A13457 = "" A13458 = "" A13459 = "" A13460 = "" 
+A13461 = "" A13462 = "" A13463 = "" A13464 = "" A13465 = "" A13466 = "" A13467 = "" A13468 = "" A13469 = "" A13470 = "" 
+A13471 = "" A13472 = "" A13473 = "" A13474 = "" A13475 = "" A13476 = "" A13477 = "" A13478 = "" A13479 = "" A13480 = "" 
+A13481 = "" A13482 = "" A13483 = "" A13484 = "" A13485 = "" A13486 = "" A13487 = "" A13488 = "" A13489 = "" A13490 = "" 
+A13491 = "" A13492 = "" A13493 = "" A13494 = "" A13495 = "" A13496 = "" A13497 = "" A13498 = "" A13499 = "" A13500 = "" 
+A13501 = "" A13502 = "" A13503 = "" A13504 = "" A13505 = "" A13506 = "" A13507 = "" A13508 = "" A13509 = "" A13510 = "" 
+A13511 = "" A13512 = "" A13513 = "" A13514 = "" A13515 = "" A13516 = "" A13517 = "" A13518 = "" A13519 = "" A13520 = "" 
+A13521 = "" A13522 = "" A13523 = "" A13524 = "" A13525 = "" A13526 = "" A13527 = "" A13528 = "" A13529 = "" A13530 = "" 
+A13531 = "" A13532 = "" A13533 = "" A13534 = "" A13535 = "" A13536 = "" A13537 = "" A13538 = "" A13539 = "" A13540 = "" 
+A13541 = "" A13542 = "" A13543 = "" A13544 = "" A13545 = "" A13546 = "" A13547 = "" A13548 = "" A13549 = "" A13550 = "" 
+A13551 = "" A13552 = "" A13553 = "" A13554 = "" A13555 = "" A13556 = "" A13557 = "" A13558 = "" A13559 = "" A13560 = "" 
+A13561 = "" A13562 = "" A13563 = "" A13564 = "" A13565 = "" A13566 = "" A13567 = "" A13568 = "" A13569 = "" A13570 = "" 
+A13571 = "" A13572 = "" A13573 = "" A13574 = "" A13575 = "" A13576 = "" A13577 = "" A13578 = "" A13579 = "" A13580 = "" 
+A13581 = "" A13582 = "" A13583 = "" A13584 = "" A13585 = "" A13586 = "" A13587 = "" A13588 = "" A13589 = "" A13590 = "" 
+A13591 = "" A13592 = "" A13593 = "" A13594 = "" A13595 = "" A13596 = "" A13597 = "" A13598 = "" A13599 = "" A13600 = "" 
+A13601 = "" A13602 = "" A13603 = "" A13604 = "" A13605 = "" A13606 = "" A13607 = "" A13608 = "" A13609 = "" A13610 = "" 
+A13611 = "" A13612 = "" A13613 = "" A13614 = "" A13615 = "" A13616 = "" A13617 = "" A13618 = "" A13619 = "" A13620 = "" 
+A13621 = "" A13622 = "" A13623 = "" A13624 = "" A13625 = "" A13626 = "" A13627 = "" A13628 = "" A13629 = "" A13630 = "" 
+A13631 = "" A13632 = "" A13633 = "" A13634 = "" A13635 = "" A13636 = "" A13637 = "" A13638 = "" A13639 = "" A13640 = "" 
+A13641 = "" A13642 = "" A13643 = "" A13644 = "" A13645 = "" A13646 = "" A13647 = "" A13648 = "" A13649 = "" A13650 = "" 
+A13651 = "" A13652 = "" A13653 = "" A13654 = "" A13655 = "" A13656 = "" A13657 = "" A13658 = "" A13659 = "" A13660 = "" 
+A13661 = "" A13662 = "" A13663 = "" A13664 = "" A13665 = "" A13666 = "" A13667 = "" A13668 = "" A13669 = "" A13670 = "" 
+A13671 = "" A13672 = "" A13673 = "" A13674 = "" A13675 = "" A13676 = "" A13677 = "" A13678 = "" A13679 = "" A13680 = "" 
+A13681 = "" A13682 = "" A13683 = "" A13684 = "" A13685 = "" A13686 = "" A13687 = "" A13688 = "" A13689 = "" A13690 = "" 
+A13691 = "" A13692 = "" A13693 = "" A13694 = "" A13695 = "" A13696 = "" A13697 = "" A13698 = "" A13699 = "" A13700 = "" 
+A13701 = "" A13702 = "" A13703 = "" A13704 = "" A13705 = "" A13706 = "" A13707 = "" A13708 = "" A13709 = "" A13710 = "" 
+A13711 = "" A13712 = "" A13713 = "" A13714 = "" A13715 = "" A13716 = "" A13717 = "" A13718 = "" A13719 = "" A13720 = "" 
+A13721 = "" A13722 = "" A13723 = "" A13724 = "" A13725 = "" A13726 = "" A13727 = "" A13728 = "" A13729 = "" A13730 = "" 
+A13731 = "" A13732 = "" A13733 = "" A13734 = "" A13735 = "" A13736 = "" A13737 = "" A13738 = "" A13739 = "" A13740 = "" 
+A13741 = "" A13742 = "" A13743 = "" A13744 = "" A13745 = "" A13746 = "" A13747 = "" A13748 = "" A13749 = "" A13750 = "" 
+A13751 = "" A13752 = "" A13753 = "" A13754 = "" A13755 = "" A13756 = "" A13757 = "" A13758 = "" A13759 = "" A13760 = "" 
+A13761 = "" A13762 = "" A13763 = "" A13764 = "" A13765 = "" A13766 = "" A13767 = "" A13768 = "" A13769 = "" A13770 = "" 
+A13771 = "" A13772 = "" A13773 = "" A13774 = "" A13775 = "" A13776 = "" A13777 = "" A13778 = "" A13779 = "" A13780 = "" 
+A13781 = "" A13782 = "" A13783 = "" A13784 = "" A13785 = "" A13786 = "" A13787 = "" A13788 = "" A13789 = "" A13790 = "" 
+A13791 = "" A13792 = "" A13793 = "" A13794 = "" A13795 = "" A13796 = "" A13797 = "" A13798 = "" A13799 = "" A13800 = "" 
+A13801 = "" A13802 = "" A13803 = "" A13804 = "" A13805 = "" A13806 = "" A13807 = "" A13808 = "" A13809 = "" A13810 = "" 
+A13811 = "" A13812 = "" A13813 = "" A13814 = "" A13815 = "" A13816 = "" A13817 = "" A13818 = "" A13819 = "" A13820 = "" 
+A13821 = "" A13822 = "" A13823 = "" A13824 = "" A13825 = "" A13826 = "" A13827 = "" A13828 = "" A13829 = "" A13830 = "" 
+A13831 = "" A13832 = "" A13833 = "" A13834 = "" A13835 = "" A13836 = "" A13837 = "" A13838 = "" A13839 = "" A13840 = "" 
+A13841 = "" A13842 = "" A13843 = "" A13844 = "" A13845 = "" A13846 = "" A13847 = "" A13848 = "" A13849 = "" A13850 = "" 
+A13851 = "" A13852 = "" A13853 = "" A13854 = "" A13855 = "" A13856 = "" A13857 = "" A13858 = "" A13859 = "" A13860 = "" 
+A13861 = "" A13862 = "" A13863 = "" A13864 = "" A13865 = "" A13866 = "" A13867 = "" A13868 = "" A13869 = "" A13870 = "" 
+A13871 = "" A13872 = "" A13873 = "" A13874 = "" A13875 = "" A13876 = "" A13877 = "" A13878 = "" A13879 = "" A13880 = "" 
+A13881 = "" A13882 = "" A13883 = "" A13884 = "" A13885 = "" A13886 = "" A13887 = "" A13888 = "" A13889 = "" A13890 = "" 
+A13891 = "" A13892 = "" A13893 = "" A13894 = "" A13895 = "" A13896 = "" A13897 = "" A13898 = "" A13899 = "" A13900 = "" 
+A13901 = "" A13902 = "" A13903 = "" A13904 = "" A13905 = "" A13906 = "" A13907 = "" A13908 = "" A13909 = "" A13910 = "" 
+A13911 = "" A13912 = "" A13913 = "" A13914 = "" A13915 = "" A13916 = "" A13917 = "" A13918 = "" A13919 = "" A13920 = "" 
+A13921 = "" A13922 = "" A13923 = "" A13924 = "" A13925 = "" A13926 = "" A13927 = "" A13928 = "" A13929 = "" A13930 = "" 
+A13931 = "" A13932 = "" A13933 = "" A13934 = "" A13935 = "" A13936 = "" A13937 = "" A13938 = "" A13939 = "" A13940 = "" 
+A13941 = "" A13942 = "" A13943 = "" A13944 = "" A13945 = "" A13946 = "" A13947 = "" A13948 = "" A13949 = "" A13950 = "" 
+A13951 = "" A13952 = "" A13953 = "" A13954 = "" A13955 = "" A13956 = "" A13957 = "" A13958 = "" A13959 = "" A13960 = "" 
+A13961 = "" A13962 = "" A13963 = "" A13964 = "" A13965 = "" A13966 = "" A13967 = "" A13968 = "" A13969 = "" A13970 = "" 
+A13971 = "" A13972 = "" A13973 = "" A13974 = "" A13975 = "" A13976 = "" A13977 = "" A13978 = "" A13979 = "" A13980 = "" 
+A13981 = "" A13982 = "" A13983 = "" A13984 = "" A13985 = "" A13986 = "" A13987 = "" A13988 = "" A13989 = "" A13990 = "" 
+A13991 = "" A13992 = "" A13993 = "" A13994 = "" A13995 = "" A13996 = "" A13997 = "" A13998 = "" A13999 = "" A14000 = "" 
+A14001 = "" A14002 = "" A14003 = "" A14004 = "" A14005 = "" A14006 = "" A14007 = "" A14008 = "" A14009 = "" A14010 = "" 
+A14011 = "" A14012 = "" A14013 = "" A14014 = "" A14015 = "" A14016 = "" A14017 = "" A14018 = "" A14019 = "" A14020 = "" 
+A14021 = "" A14022 = "" A14023 = "" A14024 = "" A14025 = "" A14026 = "" A14027 = "" A14028 = "" A14029 = "" A14030 = "" 
+A14031 = "" A14032 = "" A14033 = "" A14034 = "" A14035 = "" A14036 = "" A14037 = "" A14038 = "" A14039 = "" A14040 = "" 
+A14041 = "" A14042 = "" A14043 = "" A14044 = "" A14045 = "" A14046 = "" A14047 = "" A14048 = "" A14049 = "" A14050 = "" 
+A14051 = "" A14052 = "" A14053 = "" A14054 = "" A14055 = "" A14056 = "" A14057 = "" A14058 = "" A14059 = "" A14060 = "" 
+A14061 = "" A14062 = "" A14063 = "" A14064 = "" A14065 = "" A14066 = "" A14067 = "" A14068 = "" A14069 = "" A14070 = "" 
+A14071 = "" A14072 = "" A14073 = "" A14074 = "" A14075 = "" A14076 = "" A14077 = "" A14078 = "" A14079 = "" A14080 = "" 
+A14081 = "" A14082 = "" A14083 = "" A14084 = "" A14085 = "" A14086 = "" A14087 = "" A14088 = "" A14089 = "" A14090 = "" 
+A14091 = "" A14092 = "" A14093 = "" A14094 = "" A14095 = "" A14096 = "" A14097 = "" A14098 = "" A14099 = "" A14100 = "" 
+A14101 = "" A14102 = "" A14103 = "" A14104 = "" A14105 = "" A14106 = "" A14107 = "" A14108 = "" A14109 = "" A14110 = "" 
+A14111 = "" A14112 = "" A14113 = "" A14114 = "" A14115 = "" A14116 = "" A14117 = "" A14118 = "" A14119 = "" A14120 = "" 
+A14121 = "" A14122 = "" A14123 = "" A14124 = "" A14125 = "" A14126 = "" A14127 = "" A14128 = "" A14129 = "" A14130 = "" 
+A14131 = "" A14132 = "" A14133 = "" A14134 = "" A14135 = "" A14136 = "" A14137 = "" A14138 = "" A14139 = "" A14140 = "" 
+A14141 = "" A14142 = "" A14143 = "" A14144 = "" A14145 = "" A14146 = "" A14147 = "" A14148 = "" A14149 = "" A14150 = "" 
+A14151 = "" A14152 = "" A14153 = "" A14154 = "" A14155 = "" A14156 = "" A14157 = "" A14158 = "" A14159 = "" A14160 = "" 
+A14161 = "" A14162 = "" A14163 = "" A14164 = "" A14165 = "" A14166 = "" A14167 = "" A14168 = "" A14169 = "" A14170 = "" 
+A14171 = "" A14172 = "" A14173 = "" A14174 = "" A14175 = "" A14176 = "" A14177 = "" A14178 = "" A14179 = "" A14180 = "" 
+A14181 = "" A14182 = "" A14183 = "" A14184 = "" A14185 = "" A14186 = "" A14187 = "" A14188 = "" A14189 = "" A14190 = "" 
+A14191 = "" A14192 = "" A14193 = "" A14194 = "" A14195 = "" A14196 = "" A14197 = "" A14198 = "" A14199 = "" A14200 = "" 
+A14201 = "" A14202 = "" A14203 = "" A14204 = "" A14205 = "" A14206 = "" A14207 = "" A14208 = "" A14209 = "" A14210 = "" 
+A14211 = "" A14212 = "" A14213 = "" A14214 = "" A14215 = "" A14216 = "" A14217 = "" A14218 = "" A14219 = "" A14220 = "" 
+A14221 = "" A14222 = "" A14223 = "" A14224 = "" A14225 = "" A14226 = "" A14227 = "" A14228 = "" A14229 = "" A14230 = "" 
+A14231 = "" A14232 = "" A14233 = "" A14234 = "" A14235 = "" A14236 = "" A14237 = "" A14238 = "" A14239 = "" A14240 = "" 
+A14241 = "" A14242 = "" A14243 = "" A14244 = "" A14245 = "" A14246 = "" A14247 = "" A14248 = "" A14249 = "" A14250 = "" 
+A14251 = "" A14252 = "" A14253 = "" A14254 = "" A14255 = "" A14256 = "" A14257 = "" A14258 = "" A14259 = "" A14260 = "" 
+A14261 = "" A14262 = "" A14263 = "" A14264 = "" A14265 = "" A14266 = "" A14267 = "" A14268 = "" A14269 = "" A14270 = "" 
+A14271 = "" A14272 = "" A14273 = "" A14274 = "" A14275 = "" A14276 = "" A14277 = "" A14278 = "" A14279 = "" A14280 = "" 
+A14281 = "" A14282 = "" A14283 = "" A14284 = "" A14285 = "" A14286 = "" A14287 = "" A14288 = "" A14289 = "" A14290 = "" 
+A14291 = "" A14292 = "" A14293 = "" A14294 = "" A14295 = "" A14296 = "" A14297 = "" A14298 = "" A14299 = "" A14300 = "" 
+A14301 = "" A14302 = "" A14303 = "" A14304 = "" A14305 = "" A14306 = "" A14307 = "" A14308 = "" A14309 = "" A14310 = "" 
+A14311 = "" A14312 = "" A14313 = "" A14314 = "" A14315 = "" A14316 = "" A14317 = "" A14318 = "" A14319 = "" A14320 = "" 
+A14321 = "" A14322 = "" A14323 = "" A14324 = "" A14325 = "" A14326 = "" A14327 = "" A14328 = "" A14329 = "" A14330 = "" 
+A14331 = "" A14332 = "" A14333 = "" A14334 = "" A14335 = "" A14336 = "" A14337 = "" A14338 = "" A14339 = "" A14340 = "" 
+A14341 = "" A14342 = "" A14343 = "" A14344 = "" A14345 = "" A14346 = "" A14347 = "" A14348 = "" A14349 = "" A14350 = "" 
+A14351 = "" A14352 = "" A14353 = "" A14354 = "" A14355 = "" A14356 = "" A14357 = "" A14358 = "" A14359 = "" A14360 = "" 
+A14361 = "" A14362 = "" A14363 = "" A14364 = "" A14365 = "" A14366 = "" A14367 = "" A14368 = "" A14369 = "" A14370 = "" 
+A14371 = "" A14372 = "" A14373 = "" A14374 = "" A14375 = "" A14376 = "" A14377 = "" A14378 = "" A14379 = "" A14380 = "" 
+A14381 = "" A14382 = "" A14383 = "" A14384 = "" A14385 = "" A14386 = "" A14387 = "" A14388 = "" A14389 = "" A14390 = "" 
+A14391 = "" A14392 = "" A14393 = "" A14394 = "" A14395 = "" A14396 = "" A14397 = "" A14398 = "" A14399 = "" A14400 = "" 
+A14401 = "" A14402 = "" A14403 = "" A14404 = "" A14405 = "" A14406 = "" A14407 = "" A14408 = "" A14409 = "" A14410 = "" 
+A14411 = "" A14412 = "" A14413 = "" A14414 = "" A14415 = "" A14416 = "" A14417 = "" A14418 = "" A14419 = "" A14420 = "" 
+A14421 = "" A14422 = "" A14423 = "" A14424 = "" A14425 = "" A14426 = "" A14427 = "" A14428 = "" A14429 = "" A14430 = "" 
+A14431 = "" A14432 = "" A14433 = "" A14434 = "" A14435 = "" A14436 = "" A14437 = "" A14438 = "" A14439 = "" A14440 = "" 
+A14441 = "" A14442 = "" A14443 = "" A14444 = "" A14445 = "" A14446 = "" A14447 = "" A14448 = "" A14449 = "" A14450 = "" 
+A14451 = "" A14452 = "" A14453 = "" A14454 = "" A14455 = "" A14456 = "" A14457 = "" A14458 = "" A14459 = "" A14460 = "" 
+A14461 = "" A14462 = "" A14463 = "" A14464 = "" A14465 = "" A14466 = "" A14467 = "" A14468 = "" A14469 = "" A14470 = "" 
+A14471 = "" A14472 = "" A14473 = "" A14474 = "" A14475 = "" A14476 = "" A14477 = "" A14478 = "" A14479 = "" A14480 = "" 
+A14481 = "" A14482 = "" A14483 = "" A14484 = "" A14485 = "" A14486 = "" A14487 = "" A14488 = "" A14489 = "" A14490 = "" 
+A14491 = "" A14492 = "" A14493 = "" A14494 = "" A14495 = "" A14496 = "" A14497 = "" A14498 = "" A14499 = "" A14500 = "" 
+A14501 = "" A14502 = "" A14503 = "" A14504 = "" A14505 = "" A14506 = "" A14507 = "" A14508 = "" A14509 = "" A14510 = "" 
+A14511 = "" A14512 = "" A14513 = "" A14514 = "" A14515 = "" A14516 = "" A14517 = "" A14518 = "" A14519 = "" A14520 = "" 
+A14521 = "" A14522 = "" A14523 = "" A14524 = "" A14525 = "" A14526 = "" A14527 = "" A14528 = "" A14529 = "" A14530 = "" 
+A14531 = "" A14532 = "" A14533 = "" A14534 = "" A14535 = "" A14536 = "" A14537 = "" A14538 = "" A14539 = "" A14540 = "" 
+A14541 = "" A14542 = "" A14543 = "" A14544 = "" A14545 = "" A14546 = "" A14547 = "" A14548 = "" A14549 = "" A14550 = "" 
+A14551 = "" A14552 = "" A14553 = "" A14554 = "" A14555 = "" A14556 = "" A14557 = "" A14558 = "" A14559 = "" A14560 = "" 
+A14561 = "" A14562 = "" A14563 = "" A14564 = "" A14565 = "" A14566 = "" A14567 = "" A14568 = "" A14569 = "" A14570 = "" 
+A14571 = "" A14572 = "" A14573 = "" A14574 = "" A14575 = "" A14576 = "" A14577 = "" A14578 = "" A14579 = "" A14580 = "" 
+A14581 = "" A14582 = "" A14583 = "" A14584 = "" A14585 = "" A14586 = "" A14587 = "" A14588 = "" A14589 = "" A14590 = "" 
+A14591 = "" A14592 = "" A14593 = "" A14594 = "" A14595 = "" A14596 = "" A14597 = "" A14598 = "" A14599 = "" A14600 = "" 
+A14601 = "" A14602 = "" A14603 = "" A14604 = "" A14605 = "" A14606 = "" A14607 = "" A14608 = "" A14609 = "" A14610 = "" 
+A14611 = "" A14612 = "" A14613 = "" A14614 = "" A14615 = "" A14616 = "" A14617 = "" A14618 = "" A14619 = "" A14620 = "" 
+A14621 = "" A14622 = "" A14623 = "" A14624 = "" A14625 = "" A14626 = "" A14627 = "" A14628 = "" A14629 = "" A14630 = "" 
+A14631 = "" A14632 = "" A14633 = "" A14634 = "" A14635 = "" A14636 = "" A14637 = "" A14638 = "" A14639 = "" A14640 = "" 
+A14641 = "" A14642 = "" A14643 = "" A14644 = "" A14645 = "" A14646 = "" A14647 = "" A14648 = "" A14649 = "" A14650 = "" 
+A14651 = "" A14652 = "" A14653 = "" A14654 = "" A14655 = "" A14656 = "" A14657 = "" A14658 = "" A14659 = "" A14660 = "" 
+A14661 = "" A14662 = "" A14663 = "" A14664 = "" A14665 = "" A14666 = "" A14667 = "" A14668 = "" A14669 = "" A14670 = "" 
+A14671 = "" A14672 = "" A14673 = "" A14674 = "" A14675 = "" A14676 = "" A14677 = "" A14678 = "" A14679 = "" A14680 = "" 
+A14681 = "" A14682 = "" A14683 = "" A14684 = "" A14685 = "" A14686 = "" A14687 = "" A14688 = "" A14689 = "" A14690 = "" 
+A14691 = "" A14692 = "" A14693 = "" A14694 = "" A14695 = "" A14696 = "" A14697 = "" A14698 = "" A14699 = "" A14700 = "" 
+A14701 = "" A14702 = "" A14703 = "" A14704 = "" A14705 = "" A14706 = "" A14707 = "" A14708 = "" A14709 = "" A14710 = "" 
+A14711 = "" A14712 = "" A14713 = "" A14714 = "" A14715 = "" A14716 = "" A14717 = "" A14718 = "" A14719 = "" A14720 = "" 
+A14721 = "" A14722 = "" A14723 = "" A14724 = "" A14725 = "" A14726 = "" A14727 = "" A14728 = "" A14729 = "" A14730 = "" 
+A14731 = "" A14732 = "" A14733 = "" A14734 = "" A14735 = "" A14736 = "" A14737 = "" A14738 = "" A14739 = "" A14740 = "" 
+A14741 = "" A14742 = "" A14743 = "" A14744 = "" A14745 = "" A14746 = "" A14747 = "" A14748 = "" A14749 = "" A14750 = "" 
+A14751 = "" A14752 = "" A14753 = "" A14754 = "" A14755 = "" A14756 = "" A14757 = "" A14758 = "" A14759 = "" A14760 = "" 
+A14761 = "" A14762 = "" A14763 = "" A14764 = "" A14765 = "" A14766 = "" A14767 = "" A14768 = "" A14769 = "" A14770 = "" 
+A14771 = "" A14772 = "" A14773 = "" A14774 = "" A14775 = "" A14776 = "" A14777 = "" A14778 = "" A14779 = "" A14780 = "" 
+A14781 = "" A14782 = "" A14783 = "" A14784 = "" A14785 = "" A14786 = "" A14787 = "" A14788 = "" A14789 = "" A14790 = "" 
+A14791 = "" A14792 = "" A14793 = "" A14794 = "" A14795 = "" A14796 = "" A14797 = "" A14798 = "" A14799 = "" A14800 = "" 
+A14801 = "" A14802 = "" A14803 = "" A14804 = "" A14805 = "" A14806 = "" A14807 = "" A14808 = "" A14809 = "" A14810 = "" 
+A14811 = "" A14812 = "" A14813 = "" A14814 = "" A14815 = "" A14816 = "" A14817 = "" A14818 = "" A14819 = "" A14820 = "" 
+A14821 = "" A14822 = "" A14823 = "" A14824 = "" A14825 = "" A14826 = "" A14827 = "" A14828 = "" A14829 = "" A14830 = "" 
+A14831 = "" A14832 = "" A14833 = "" A14834 = "" A14835 = "" A14836 = "" A14837 = "" A14838 = "" A14839 = "" A14840 = "" 
+A14841 = "" A14842 = "" A14843 = "" A14844 = "" A14845 = "" A14846 = "" A14847 = "" A14848 = "" A14849 = "" A14850 = "" 
+A14851 = "" A14852 = "" A14853 = "" A14854 = "" A14855 = "" A14856 = "" A14857 = "" A14858 = "" A14859 = "" A14860 = "" 
+A14861 = "" A14862 = "" A14863 = "" A14864 = "" A14865 = "" A14866 = "" A14867 = "" A14868 = "" A14869 = "" A14870 = "" 
+A14871 = "" A14872 = "" A14873 = "" A14874 = "" A14875 = "" A14876 = "" A14877 = "" A14878 = "" A14879 = "" A14880 = "" 
+A14881 = "" A14882 = "" A14883 = "" A14884 = "" A14885 = "" A14886 = "" A14887 = "" A14888 = "" A14889 = "" A14890 = "" 
+A14891 = "" A14892 = "" A14893 = "" A14894 = "" A14895 = "" A14896 = "" A14897 = "" A14898 = "" A14899 = "" A14900 = "" 
+A14901 = "" A14902 = "" A14903 = "" A14904 = "" A14905 = "" A14906 = "" A14907 = "" A14908 = "" A14909 = "" A14910 = "" 
+A14911 = "" A14912 = "" A14913 = "" A14914 = "" A14915 = "" A14916 = "" A14917 = "" A14918 = "" A14919 = "" A14920 = "" 
+A14921 = "" A14922 = "" A14923 = "" A14924 = "" A14925 = "" A14926 = "" A14927 = "" A14928 = "" A14929 = "" A14930 = "" 
+A14931 = "" A14932 = "" A14933 = "" A14934 = "" A14935 = "" A14936 = "" A14937 = "" A14938 = "" A14939 = "" A14940 = "" 
+A14941 = "" A14942 = "" A14943 = "" A14944 = "" A14945 = "" A14946 = "" A14947 = "" A14948 = "" A14949 = "" A14950 = "" 
+A14951 = "" A14952 = "" A14953 = "" A14954 = "" A14955 = "" A14956 = "" A14957 = "" A14958 = "" A14959 = "" A14960 = "" 
+A14961 = "" A14962 = "" A14963 = "" A14964 = "" A14965 = "" A14966 = "" A14967 = "" A14968 = "" A14969 = "" A14970 = "" 
+A14971 = "" A14972 = "" A14973 = "" A14974 = "" A14975 = "" A14976 = "" A14977 = "" A14978 = "" A14979 = "" A14980 = "" 
+A14981 = "" A14982 = "" A14983 = "" A14984 = "" A14985 = "" A14986 = "" A14987 = "" A14988 = "" A14989 = "" A14990 = "" 
+A14991 = "" A14992 = "" A14993 = "" A14994 = "" A14995 = "" A14996 = "" A14997 = "" A14998 = "" A14999 = "" A15000 = "" 
+A15001 = "" A15002 = "" A15003 = "" A15004 = "" A15005 = "" A15006 = "" A15007 = "" A15008 = "" A15009 = "" A15010 = "" 
+A15011 = "" A15012 = "" A15013 = "" A15014 = "" A15015 = "" A15016 = "" A15017 = "" A15018 = "" A15019 = "" A15020 = "" 
+A15021 = "" A15022 = "" A15023 = "" A15024 = "" A15025 = "" A15026 = "" A15027 = "" A15028 = "" A15029 = "" A15030 = "" 
+A15031 = "" A15032 = "" A15033 = "" A15034 = "" A15035 = "" A15036 = "" A15037 = "" A15038 = "" A15039 = "" A15040 = "" 
+A15041 = "" A15042 = "" A15043 = "" A15044 = "" A15045 = "" A15046 = "" A15047 = "" A15048 = "" A15049 = "" A15050 = "" 
+A15051 = "" A15052 = "" A15053 = "" A15054 = "" A15055 = "" A15056 = "" A15057 = "" A15058 = "" A15059 = "" A15060 = "" 
+A15061 = "" A15062 = "" A15063 = "" A15064 = "" A15065 = "" A15066 = "" A15067 = "" A15068 = "" A15069 = "" A15070 = "" 
+A15071 = "" A15072 = "" A15073 = "" A15074 = "" A15075 = "" A15076 = "" A15077 = "" A15078 = "" A15079 = "" A15080 = "" 
+A15081 = "" A15082 = "" A15083 = "" A15084 = "" A15085 = "" A15086 = "" A15087 = "" A15088 = "" A15089 = "" A15090 = "" 
+A15091 = "" A15092 = "" A15093 = "" A15094 = "" A15095 = "" A15096 = "" A15097 = "" A15098 = "" A15099 = "" A15100 = "" 
+A15101 = "" A15102 = "" A15103 = "" A15104 = "" A15105 = "" A15106 = "" A15107 = "" A15108 = "" A15109 = "" A15110 = "" 
+A15111 = "" A15112 = "" A15113 = "" A15114 = "" A15115 = "" A15116 = "" A15117 = "" A15118 = "" A15119 = "" A15120 = "" 
+A15121 = "" A15122 = "" A15123 = "" A15124 = "" A15125 = "" A15126 = "" A15127 = "" A15128 = "" A15129 = "" A15130 = "" 
+A15131 = "" A15132 = "" A15133 = "" A15134 = "" A15135 = "" A15136 = "" A15137 = "" A15138 = "" A15139 = "" A15140 = "" 
+A15141 = "" A15142 = "" A15143 = "" A15144 = "" A15145 = "" A15146 = "" A15147 = "" A15148 = "" A15149 = "" A15150 = "" 
+A15151 = "" A15152 = "" A15153 = "" A15154 = "" A15155 = "" A15156 = "" A15157 = "" A15158 = "" A15159 = "" A15160 = "" 
+A15161 = "" A15162 = "" A15163 = "" A15164 = "" A15165 = "" A15166 = "" A15167 = "" A15168 = "" A15169 = "" A15170 = "" 
+A15171 = "" A15172 = "" A15173 = "" A15174 = "" A15175 = "" A15176 = "" A15177 = "" A15178 = "" A15179 = "" A15180 = "" 
+A15181 = "" A15182 = "" A15183 = "" A15184 = "" A15185 = "" A15186 = "" A15187 = "" A15188 = "" A15189 = "" A15190 = "" 
+A15191 = "" A15192 = "" A15193 = "" A15194 = "" A15195 = "" A15196 = "" A15197 = "" A15198 = "" A15199 = "" A15200 = "" 
+A15201 = "" A15202 = "" A15203 = "" A15204 = "" A15205 = "" A15206 = "" A15207 = "" A15208 = "" A15209 = "" A15210 = "" 
+A15211 = "" A15212 = "" A15213 = "" A15214 = "" A15215 = "" A15216 = "" A15217 = "" A15218 = "" A15219 = "" A15220 = "" 
+A15221 = "" A15222 = "" A15223 = "" A15224 = "" A15225 = "" A15226 = "" A15227 = "" A15228 = "" A15229 = "" A15230 = "" 
+A15231 = "" A15232 = "" A15233 = "" A15234 = "" A15235 = "" A15236 = "" A15237 = "" A15238 = "" A15239 = "" A15240 = "" 
+A15241 = "" A15242 = "" A15243 = "" A15244 = "" A15245 = "" A15246 = "" A15247 = "" A15248 = "" A15249 = "" A15250 = "" 
+A15251 = "" A15252 = "" A15253 = "" A15254 = "" A15255 = "" A15256 = "" A15257 = "" A15258 = "" A15259 = "" A15260 = "" 
+A15261 = "" A15262 = "" A15263 = "" A15264 = "" A15265 = "" A15266 = "" A15267 = "" A15268 = "" A15269 = "" A15270 = "" 
+A15271 = "" A15272 = "" A15273 = "" A15274 = "" A15275 = "" A15276 = "" A15277 = "" A15278 = "" A15279 = "" A15280 = "" 
+A15281 = "" A15282 = "" A15283 = "" A15284 = "" A15285 = "" A15286 = "" A15287 = "" A15288 = "" A15289 = "" A15290 = "" 
+A15291 = "" A15292 = "" A15293 = "" A15294 = "" A15295 = "" A15296 = "" A15297 = "" A15298 = "" A15299 = "" A15300 = "" 
+A15301 = "" A15302 = "" A15303 = "" A15304 = "" A15305 = "" A15306 = "" A15307 = "" A15308 = "" A15309 = "" A15310 = "" 
+A15311 = "" A15312 = "" A15313 = "" A15314 = "" A15315 = "" A15316 = "" A15317 = "" A15318 = "" A15319 = "" A15320 = "" 
+A15321 = "" A15322 = "" A15323 = "" A15324 = "" A15325 = "" A15326 = "" A15327 = "" A15328 = "" A15329 = "" A15330 = "" 
+A15331 = "" A15332 = "" A15333 = "" A15334 = "" A15335 = "" A15336 = "" A15337 = "" A15338 = "" A15339 = "" A15340 = "" 
+A15341 = "" A15342 = "" A15343 = "" A15344 = "" A15345 = "" A15346 = "" A15347 = "" A15348 = "" A15349 = "" A15350 = "" 
+A15351 = "" A15352 = "" A15353 = "" A15354 = "" A15355 = "" A15356 = "" A15357 = "" A15358 = "" A15359 = "" A15360 = "" 
+A15361 = "" A15362 = "" A15363 = "" A15364 = "" A15365 = "" A15366 = "" A15367 = "" A15368 = "" A15369 = "" A15370 = "" 
+A15371 = "" A15372 = "" A15373 = "" A15374 = "" A15375 = "" A15376 = "" A15377 = "" A15378 = "" A15379 = "" A15380 = "" 
+A15381 = "" A15382 = "" A15383 = "" A15384 = "" A15385 = "" A15386 = "" A15387 = "" A15388 = "" A15389 = "" A15390 = "" 
+A15391 = "" A15392 = "" A15393 = "" A15394 = "" A15395 = "" A15396 = "" A15397 = "" A15398 = "" A15399 = "" A15400 = "" 
+A15401 = "" A15402 = "" A15403 = "" A15404 = "" A15405 = "" A15406 = "" A15407 = "" A15408 = "" A15409 = "" A15410 = "" 
+A15411 = "" A15412 = "" A15413 = "" A15414 = "" A15415 = "" A15416 = "" A15417 = "" A15418 = "" A15419 = "" A15420 = "" 
+A15421 = "" A15422 = "" A15423 = "" A15424 = "" A15425 = "" A15426 = "" A15427 = "" A15428 = "" A15429 = "" A15430 = "" 
+A15431 = "" A15432 = "" A15433 = "" A15434 = "" A15435 = "" A15436 = "" A15437 = "" A15438 = "" A15439 = "" A15440 = "" 
+A15441 = "" A15442 = "" A15443 = "" A15444 = "" A15445 = "" A15446 = "" A15447 = "" A15448 = "" A15449 = "" A15450 = "" 
+A15451 = "" A15452 = "" A15453 = "" A15454 = "" A15455 = "" A15456 = "" A15457 = "" A15458 = "" A15459 = "" A15460 = "" 
+A15461 = "" A15462 = "" A15463 = "" A15464 = "" A15465 = "" A15466 = "" A15467 = "" A15468 = "" A15469 = "" A15470 = "" 
+A15471 = "" A15472 = "" A15473 = "" A15474 = "" A15475 = "" A15476 = "" A15477 = "" A15478 = "" A15479 = "" A15480 = "" 
+A15481 = "" A15482 = "" A15483 = "" A15484 = "" A15485 = "" A15486 = "" A15487 = "" A15488 = "" A15489 = "" A15490 = "" 
+A15491 = "" A15492 = "" A15493 = "" A15494 = "" A15495 = "" A15496 = "" A15497 = "" A15498 = "" A15499 = "" A15500 = "" 
+A15501 = "" A15502 = "" A15503 = "" A15504 = "" A15505 = "" A15506 = "" A15507 = "" A15508 = "" A15509 = "" A15510 = "" 
+A15511 = "" A15512 = "" A15513 = "" A15514 = "" A15515 = "" A15516 = "" A15517 = "" A15518 = "" A15519 = "" A15520 = "" 
+A15521 = "" A15522 = "" A15523 = "" A15524 = "" A15525 = "" A15526 = "" A15527 = "" A15528 = "" A15529 = "" A15530 = "" 
+A15531 = "" A15532 = "" A15533 = "" A15534 = "" A15535 = "" A15536 = "" A15537 = "" A15538 = "" A15539 = "" A15540 = "" 
+A15541 = "" A15542 = "" A15543 = "" A15544 = "" A15545 = "" A15546 = "" A15547 = "" A15548 = "" A15549 = "" A15550 = "" 
+A15551 = "" A15552 = "" A15553 = "" A15554 = "" A15555 = "" A15556 = "" A15557 = "" A15558 = "" A15559 = "" A15560 = "" 
+A15561 = "" A15562 = "" A15563 = "" A15564 = "" A15565 = "" A15566 = "" A15567 = "" A15568 = "" A15569 = "" A15570 = "" 
+A15571 = "" A15572 = "" A15573 = "" A15574 = "" A15575 = "" A15576 = "" A15577 = "" A15578 = "" A15579 = "" A15580 = "" 
+A15581 = "" A15582 = "" A15583 = "" A15584 = "" A15585 = "" A15586 = "" A15587 = "" A15588 = "" A15589 = "" A15590 = "" 
+A15591 = "" A15592 = "" A15593 = "" A15594 = "" A15595 = "" A15596 = "" A15597 = "" A15598 = "" A15599 = "" A15600 = "" 
+A15601 = "" A15602 = "" A15603 = "" A15604 = "" A15605 = "" A15606 = "" A15607 = "" A15608 = "" A15609 = "" A15610 = "" 
+A15611 = "" A15612 = "" A15613 = "" A15614 = "" A15615 = "" A15616 = "" A15617 = "" A15618 = "" A15619 = "" A15620 = "" 
+A15621 = "" A15622 = "" A15623 = "" A15624 = "" A15625 = "" A15626 = "" A15627 = "" A15628 = "" A15629 = "" A15630 = "" 
+A15631 = "" A15632 = "" A15633 = "" A15634 = "" A15635 = "" A15636 = "" A15637 = "" A15638 = "" A15639 = "" A15640 = "" 
+A15641 = "" A15642 = "" A15643 = "" A15644 = "" A15645 = "" A15646 = "" A15647 = "" A15648 = "" A15649 = "" A15650 = "" 
+A15651 = "" A15652 = "" A15653 = "" A15654 = "" A15655 = "" A15656 = "" A15657 = "" A15658 = "" A15659 = "" A15660 = "" 
+A15661 = "" A15662 = "" A15663 = "" A15664 = "" A15665 = "" A15666 = "" A15667 = "" A15668 = "" A15669 = "" A15670 = "" 
+A15671 = "" A15672 = "" A15673 = "" A15674 = "" A15675 = "" A15676 = "" A15677 = "" A15678 = "" A15679 = "" A15680 = "" 
+A15681 = "" A15682 = "" A15683 = "" A15684 = "" A15685 = "" A15686 = "" A15687 = "" A15688 = "" A15689 = "" A15690 = "" 
+A15691 = "" A15692 = "" A15693 = "" A15694 = "" A15695 = "" A15696 = "" A15697 = "" A15698 = "" A15699 = "" A15700 = "" 
+A15701 = "" A15702 = "" A15703 = "" A15704 = "" A15705 = "" A15706 = "" A15707 = "" A15708 = "" A15709 = "" A15710 = "" 
+A15711 = "" A15712 = "" A15713 = "" A15714 = "" A15715 = "" A15716 = "" A15717 = "" A15718 = "" A15719 = "" A15720 = "" 
+A15721 = "" A15722 = "" A15723 = "" A15724 = "" A15725 = "" A15726 = "" A15727 = "" A15728 = "" A15729 = "" A15730 = "" 
+A15731 = "" A15732 = "" A15733 = "" A15734 = "" A15735 = "" A15736 = "" A15737 = "" A15738 = "" A15739 = "" A15740 = "" 
+A15741 = "" A15742 = "" A15743 = "" A15744 = "" A15745 = "" A15746 = "" A15747 = "" A15748 = "" A15749 = "" A15750 = "" 
+A15751 = "" A15752 = "" A15753 = "" A15754 = "" A15755 = "" A15756 = "" A15757 = "" A15758 = "" A15759 = "" A15760 = "" 
+A15761 = "" A15762 = "" A15763 = "" A15764 = "" A15765 = "" A15766 = "" A15767 = "" A15768 = "" A15769 = "" A15770 = "" 
+A15771 = "" A15772 = "" A15773 = "" A15774 = "" A15775 = "" A15776 = "" A15777 = "" A15778 = "" A15779 = "" A15780 = "" 
+A15781 = "" A15782 = "" A15783 = "" A15784 = "" A15785 = "" A15786 = "" A15787 = "" A15788 = "" A15789 = "" A15790 = "" 
+A15791 = "" A15792 = "" A15793 = "" A15794 = "" A15795 = "" A15796 = "" A15797 = "" A15798 = "" A15799 = "" A15800 = "" 
+A15801 = "" A15802 = "" A15803 = "" A15804 = "" A15805 = "" A15806 = "" A15807 = "" A15808 = "" A15809 = "" A15810 = "" 
+A15811 = "" A15812 = "" A15813 = "" A15814 = "" A15815 = "" A15816 = "" A15817 = "" A15818 = "" A15819 = "" A15820 = "" 
+A15821 = "" A15822 = "" A15823 = "" A15824 = "" A15825 = "" A15826 = "" A15827 = "" A15828 = "" A15829 = "" A15830 = "" 
+A15831 = "" A15832 = "" A15833 = "" A15834 = "" A15835 = "" A15836 = "" A15837 = "" A15838 = "" A15839 = "" A15840 = "" 
+A15841 = "" A15842 = "" A15843 = "" A15844 = "" A15845 = "" A15846 = "" A15847 = "" A15848 = "" A15849 = "" A15850 = "" 
+A15851 = "" A15852 = "" A15853 = "" A15854 = "" A15855 = "" A15856 = "" A15857 = "" A15858 = "" A15859 = "" A15860 = "" 
+A15861 = "" A15862 = "" A15863 = "" A15864 = "" A15865 = "" A15866 = "" A15867 = "" A15868 = "" A15869 = "" A15870 = "" 
+A15871 = "" A15872 = "" A15873 = "" A15874 = "" A15875 = "" A15876 = "" A15877 = "" A15878 = "" A15879 = "" A15880 = "" 
+A15881 = "" A15882 = "" A15883 = "" A15884 = "" A15885 = "" A15886 = "" A15887 = "" A15888 = "" A15889 = "" A15890 = "" 
+A15891 = "" A15892 = "" A15893 = "" A15894 = "" A15895 = "" A15896 = "" A15897 = "" A15898 = "" A15899 = "" A15900 = "" 
+A15901 = "" A15902 = "" A15903 = "" A15904 = "" A15905 = "" A15906 = "" A15907 = "" A15908 = "" A15909 = "" A15910 = "" 
+A15911 = "" A15912 = "" A15913 = "" A15914 = "" A15915 = "" A15916 = "" A15917 = "" A15918 = "" A15919 = "" A15920 = "" 
+A15921 = "" A15922 = "" A15923 = "" A15924 = "" A15925 = "" A15926 = "" A15927 = "" A15928 = "" A15929 = "" A15930 = "" 
+A15931 = "" A15932 = "" A15933 = "" A15934 = "" A15935 = "" A15936 = "" A15937 = "" A15938 = "" A15939 = "" A15940 = "" 
+A15941 = "" A15942 = "" A15943 = "" A15944 = "" A15945 = "" A15946 = "" A15947 = "" A15948 = "" A15949 = "" A15950 = "" 
+A15951 = "" A15952 = "" A15953 = "" A15954 = "" A15955 = "" A15956 = "" A15957 = "" A15958 = "" A15959 = "" A15960 = "" 
+A15961 = "" A15962 = "" A15963 = "" A15964 = "" A15965 = "" A15966 = "" A15967 = "" A15968 = "" A15969 = "" A15970 = "" 
+A15971 = "" A15972 = "" A15973 = "" A15974 = "" A15975 = "" A15976 = "" A15977 = "" A15978 = "" A15979 = "" A15980 = "" 
+A15981 = "" A15982 = "" A15983 = "" A15984 = "" A15985 = "" A15986 = "" A15987 = "" A15988 = "" A15989 = "" A15990 = "" 
+A15991 = "" A15992 = "" A15993 = "" A15994 = "" A15995 = "" A15996 = "" A15997 = "" A15998 = "" A15999 = "" A16000 = "" 
+A16001 = "" A16002 = "" A16003 = "" A16004 = "" A16005 = "" A16006 = "" A16007 = "" A16008 = "" A16009 = "" A16010 = "" 
+A16011 = "" A16012 = "" A16013 = "" A16014 = "" A16015 = "" A16016 = "" A16017 = "" A16018 = "" A16019 = "" A16020 = "" 
+A16021 = "" A16022 = "" A16023 = "" A16024 = "" A16025 = "" A16026 = "" A16027 = "" A16028 = "" A16029 = "" A16030 = "" 
+A16031 = "" A16032 = "" A16033 = "" A16034 = "" A16035 = "" A16036 = "" A16037 = "" A16038 = "" A16039 = "" A16040 = "" 
+A16041 = "" A16042 = "" A16043 = "" A16044 = "" A16045 = "" A16046 = "" A16047 = "" A16048 = "" A16049 = "" A16050 = "" 
+A16051 = "" A16052 = "" A16053 = "" A16054 = "" A16055 = "" A16056 = "" A16057 = "" A16058 = "" A16059 = "" A16060 = "" 
+A16061 = "" A16062 = "" A16063 = "" A16064 = "" A16065 = "" A16066 = "" A16067 = "" A16068 = "" A16069 = "" A16070 = "" 
+A16071 = "" A16072 = "" A16073 = "" A16074 = "" A16075 = "" A16076 = "" A16077 = "" A16078 = "" A16079 = "" A16080 = "" 
+A16081 = "" A16082 = "" A16083 = "" A16084 = "" A16085 = "" A16086 = "" A16087 = "" A16088 = "" A16089 = "" A16090 = "" 
+A16091 = "" A16092 = "" A16093 = "" A16094 = "" A16095 = "" A16096 = "" A16097 = "" A16098 = "" A16099 = "" A16100 = "" 
+A16101 = "" A16102 = "" A16103 = "" A16104 = "" A16105 = "" A16106 = "" A16107 = "" A16108 = "" A16109 = "" A16110 = "" 
+A16111 = "" A16112 = "" A16113 = "" A16114 = "" A16115 = "" A16116 = "" A16117 = "" A16118 = "" A16119 = "" A16120 = "" 
+A16121 = "" A16122 = "" A16123 = "" A16124 = "" A16125 = "" A16126 = "" A16127 = "" A16128 = "" A16129 = "" A16130 = "" 
+A16131 = "" A16132 = "" A16133 = "" A16134 = "" A16135 = "" A16136 = "" A16137 = "" A16138 = "" A16139 = "" A16140 = "" 
+A16141 = "" A16142 = "" A16143 = "" A16144 = "" A16145 = "" A16146 = "" A16147 = "" A16148 = "" A16149 = "" A16150 = "" 
+A16151 = "" A16152 = "" A16153 = "" A16154 = "" A16155 = "" A16156 = "" A16157 = "" A16158 = "" A16159 = "" A16160 = "" 
+A16161 = "" A16162 = "" A16163 = "" A16164 = "" A16165 = "" A16166 = "" A16167 = "" A16168 = "" A16169 = "" A16170 = "" 
+A16171 = "" A16172 = "" A16173 = "" A16174 = "" A16175 = "" A16176 = "" A16177 = "" A16178 = "" A16179 = "" A16180 = "" 
+A16181 = "" A16182 = "" A16183 = "" A16184 = "" A16185 = "" A16186 = "" A16187 = "" A16188 = "" A16189 = "" A16190 = "" 
+A16191 = "" A16192 = "" A16193 = "" A16194 = "" A16195 = "" A16196 = "" A16197 = "" A16198 = "" A16199 = "" A16200 = "" 
+A16201 = "" A16202 = "" A16203 = "" A16204 = "" A16205 = "" A16206 = "" A16207 = "" A16208 = "" A16209 = "" A16210 = "" 
+A16211 = "" A16212 = "" A16213 = "" A16214 = "" A16215 = "" A16216 = "" A16217 = "" A16218 = "" A16219 = "" A16220 = "" 
+A16221 = "" A16222 = "" A16223 = "" A16224 = "" A16225 = "" A16226 = "" A16227 = "" A16228 = "" A16229 = "" A16230 = "" 
+A16231 = "" A16232 = "" A16233 = "" A16234 = "" A16235 = "" A16236 = "" A16237 = "" A16238 = "" A16239 = "" A16240 = "" 
+A16241 = "" A16242 = "" A16243 = "" A16244 = "" A16245 = "" A16246 = "" A16247 = "" A16248 = "" A16249 = "" A16250 = "" 
+A16251 = "" A16252 = "" A16253 = "" A16254 = "" A16255 = "" A16256 = "" A16257 = "" A16258 = "" A16259 = "" A16260 = "" 
+A16261 = "" A16262 = "" A16263 = "" A16264 = "" A16265 = "" A16266 = "" A16267 = "" A16268 = "" A16269 = "" A16270 = "" 
+A16271 = "" A16272 = "" A16273 = "" A16274 = "" A16275 = "" A16276 = "" A16277 = "" A16278 = "" A16279 = "" A16280 = "" 
+A16281 = "" A16282 = "" A16283 = "" A16284 = "" A16285 = "" A16286 = "" A16287 = "" A16288 = "" A16289 = "" A16290 = "" 
+A16291 = "" A16292 = "" A16293 = "" A16294 = "" A16295 = "" A16296 = "" A16297 = "" A16298 = "" A16299 = "" A16300 = "" 
+A16301 = "" A16302 = "" A16303 = "" A16304 = "" A16305 = "" A16306 = "" A16307 = "" A16308 = "" A16309 = "" A16310 = "" 
+A16311 = "" A16312 = "" A16313 = "" A16314 = "" A16315 = "" A16316 = "" A16317 = "" A16318 = "" A16319 = "" A16320 = "" 
+A16321 = "" A16322 = "" A16323 = "" A16324 = "" A16325 = "" A16326 = "" A16327 = "" A16328 = "" A16329 = "" A16330 = "" 
+A16331 = "" A16332 = "" A16333 = "" A16334 = "" A16335 = "" A16336 = "" A16337 = "" A16338 = "" A16339 = "" A16340 = "" 
+A16341 = "" A16342 = "" A16343 = "" A16344 = "" A16345 = "" A16346 = "" A16347 = "" A16348 = "" A16349 = "" A16350 = "" 
+A16351 = "" A16352 = "" A16353 = "" A16354 = "" A16355 = "" A16356 = "" A16357 = "" A16358 = "" A16359 = "" A16360 = "" 
+A16361 = "" A16362 = "" A16363 = "" A16364 = "" A16365 = "" A16366 = "" A16367 = "" A16368 = "" A16369 = "" A16370 = "" 
+A16371 = "" A16372 = "" A16373 = "" A16374 = "" A16375 = "" A16376 = "" A16377 = "" A16378 = "" A16379 = "" A16380 = "" 
+A16381 = "" A16382 = "" A16383 = "" A16384 = "" A16385 = "" A16386 = "" A16387 = "" A16388 = "" A16389 = "" A16390 = "" 
+A16391 = "" A16392 = "" A16393 = "" A16394 = "" A16395 = "" A16396 = "" A16397 = "" A16398 = "" A16399 = "" A16400 = "" 
+A16401 = "" A16402 = "" A16403 = "" A16404 = "" A16405 = "" A16406 = "" A16407 = "" A16408 = "" A16409 = "" A16410 = "" 
+A16411 = "" A16412 = "" A16413 = "" A16414 = "" A16415 = "" A16416 = "" A16417 = "" A16418 = "" A16419 = "" A16420 = "" 
+A16421 = "" A16422 = "" A16423 = "" A16424 = "" A16425 = "" A16426 = "" A16427 = "" A16428 = "" A16429 = "" A16430 = "" 
+A16431 = "" A16432 = "" A16433 = "" A16434 = "" A16435 = "" A16436 = "" A16437 = "" A16438 = "" A16439 = "" A16440 = "" 
+A16441 = "" A16442 = "" A16443 = "" A16444 = "" A16445 = "" A16446 = "" A16447 = "" A16448 = "" A16449 = "" A16450 = "" 
+A16451 = "" A16452 = "" A16453 = "" A16454 = "" A16455 = "" A16456 = "" A16457 = "" A16458 = "" A16459 = "" A16460 = "" 
+A16461 = "" A16462 = "" A16463 = "" A16464 = "" A16465 = "" A16466 = "" A16467 = "" A16468 = "" A16469 = "" A16470 = "" 
+A16471 = "" A16472 = "" A16473 = "" A16474 = "" A16475 = "" A16476 = "" A16477 = "" A16478 = "" A16479 = "" A16480 = "" 
+A16481 = "" A16482 = "" A16483 = "" A16484 = "" A16485 = "" A16486 = "" A16487 = "" A16488 = "" A16489 = "" A16490 = "" 
+A16491 = "" A16492 = "" A16493 = "" A16494 = "" A16495 = "" A16496 = "" A16497 = "" A16498 = "" A16499 = "" A16500 = "" 
+A16501 = "" A16502 = "" A16503 = "" A16504 = "" A16505 = "" A16506 = "" A16507 = "" A16508 = "" A16509 = "" A16510 = "" 
+A16511 = "" A16512 = "" A16513 = "" A16514 = "" A16515 = "" A16516 = "" A16517 = "" A16518 = "" A16519 = "" A16520 = "" 
+A16521 = "" A16522 = "" A16523 = "" A16524 = "" A16525 = "" A16526 = "" A16527 = "" A16528 = "" A16529 = "" A16530 = "" 
+A16531 = "" A16532 = "" A16533 = "" A16534 = "" A16535 = "" A16536 = "" A16537 = "" A16538 = "" A16539 = "" A16540 = "" 
+A16541 = "" A16542 = "" A16543 = "" A16544 = "" A16545 = "" A16546 = "" A16547 = "" A16548 = "" A16549 = "" A16550 = "" 
+A16551 = "" A16552 = "" A16553 = "" A16554 = "" A16555 = "" A16556 = "" A16557 = "" A16558 = "" A16559 = "" A16560 = "" 
+A16561 = "" A16562 = "" A16563 = "" A16564 = "" A16565 = "" A16566 = "" A16567 = "" A16568 = "" A16569 = "" A16570 = "" 
+A16571 = "" A16572 = "" A16573 = "" A16574 = "" A16575 = "" A16576 = "" A16577 = "" A16578 = "" A16579 = "" A16580 = "" 
+A16581 = "" A16582 = "" A16583 = "" A16584 = "" A16585 = "" A16586 = "" A16587 = "" A16588 = "" A16589 = "" A16590 = "" 
+A16591 = "" A16592 = "" A16593 = "" A16594 = "" A16595 = "" A16596 = "" A16597 = "" A16598 = "" A16599 = "" A16600 = "" 
+A16601 = "" A16602 = "" A16603 = "" A16604 = "" A16605 = "" A16606 = "" A16607 = "" A16608 = "" A16609 = "" A16610 = "" 
+A16611 = "" A16612 = "" A16613 = "" A16614 = "" A16615 = "" A16616 = "" A16617 = "" A16618 = "" A16619 = "" A16620 = "" 
+A16621 = "" A16622 = "" A16623 = "" A16624 = "" A16625 = "" A16626 = "" A16627 = "" A16628 = "" A16629 = "" A16630 = "" 
+A16631 = "" A16632 = "" A16633 = "" A16634 = "" A16635 = "" A16636 = "" A16637 = "" A16638 = "" A16639 = "" A16640 = "" 
+A16641 = "" A16642 = "" A16643 = "" A16644 = "" A16645 = "" A16646 = "" A16647 = "" A16648 = "" A16649 = "" A16650 = "" 
+A16651 = "" A16652 = "" A16653 = "" A16654 = "" A16655 = "" A16656 = "" A16657 = "" A16658 = "" A16659 = "" A16660 = "" 
+A16661 = "" A16662 = "" A16663 = "" A16664 = "" A16665 = "" A16666 = "" A16667 = "" A16668 = "" A16669 = "" A16670 = "" 
+A16671 = "" A16672 = "" A16673 = "" A16674 = "" A16675 = "" A16676 = "" A16677 = "" A16678 = "" A16679 = "" A16680 = "" 
+A16681 = "" A16682 = "" A16683 = "" A16684 = "" A16685 = "" A16686 = "" A16687 = "" A16688 = "" A16689 = "" A16690 = "" 
+A16691 = "" A16692 = "" A16693 = "" A16694 = "" A16695 = "" A16696 = "" A16697 = "" A16698 = "" A16699 = "" A16700 = "" 
+A16701 = "" A16702 = "" A16703 = "" A16704 = "" A16705 = "" A16706 = "" A16707 = "" A16708 = "" A16709 = "" A16710 = "" 
+A16711 = "" A16712 = "" A16713 = "" A16714 = "" A16715 = "" A16716 = "" A16717 = "" A16718 = "" A16719 = "" A16720 = "" 
+A16721 = "" A16722 = "" A16723 = "" A16724 = "" A16725 = "" A16726 = "" A16727 = "" A16728 = "" A16729 = "" A16730 = "" 
+A16731 = "" A16732 = "" A16733 = "" A16734 = "" A16735 = "" A16736 = "" A16737 = "" A16738 = "" A16739 = "" A16740 = "" 
+A16741 = "" A16742 = "" A16743 = "" A16744 = "" A16745 = "" A16746 = "" A16747 = "" A16748 = "" A16749 = "" A16750 = "" 
+A16751 = "" A16752 = "" A16753 = "" A16754 = "" A16755 = "" A16756 = "" A16757 = "" A16758 = "" A16759 = "" A16760 = "" 
+A16761 = "" A16762 = "" A16763 = "" A16764 = "" A16765 = "" A16766 = "" A16767 = "" A16768 = "" A16769 = "" A16770 = "" 
+A16771 = "" A16772 = "" A16773 = "" A16774 = "" A16775 = "" A16776 = "" A16777 = "" A16778 = "" A16779 = "" A16780 = "" 
+A16781 = "" A16782 = "" A16783 = "" A16784 = "" A16785 = "" A16786 = "" A16787 = "" A16788 = "" A16789 = "" A16790 = "" 
+A16791 = "" A16792 = "" A16793 = "" A16794 = "" A16795 = "" A16796 = "" A16797 = "" A16798 = "" A16799 = "" A16800 = "" 
+A16801 = "" A16802 = "" A16803 = "" A16804 = "" A16805 = "" A16806 = "" A16807 = "" A16808 = "" A16809 = "" A16810 = "" 
+A16811 = "" A16812 = "" A16813 = "" A16814 = "" A16815 = "" A16816 = "" A16817 = "" A16818 = "" A16819 = "" A16820 = "" 
+A16821 = "" A16822 = "" A16823 = "" A16824 = "" A16825 = "" A16826 = "" A16827 = "" A16828 = "" A16829 = "" A16830 = "" 
+A16831 = "" A16832 = "" A16833 = "" A16834 = "" A16835 = "" A16836 = "" A16837 = "" A16838 = "" A16839 = "" A16840 = "" 
+A16841 = "" A16842 = "" A16843 = "" A16844 = "" A16845 = "" A16846 = "" A16847 = "" A16848 = "" A16849 = "" A16850 = "" 
+A16851 = "" A16852 = "" A16853 = "" A16854 = "" A16855 = "" A16856 = "" A16857 = "" A16858 = "" A16859 = "" A16860 = "" 
+A16861 = "" A16862 = "" A16863 = "" A16864 = "" A16865 = "" A16866 = "" A16867 = "" A16868 = "" A16869 = "" A16870 = "" 
+A16871 = "" A16872 = "" A16873 = "" A16874 = "" A16875 = "" A16876 = "" A16877 = "" A16878 = "" A16879 = "" A16880 = "" 
+A16881 = "" A16882 = "" A16883 = "" A16884 = "" A16885 = "" A16886 = "" A16887 = "" A16888 = "" A16889 = "" A16890 = "" 
+A16891 = "" A16892 = "" A16893 = "" A16894 = "" A16895 = "" A16896 = "" A16897 = "" A16898 = "" A16899 = "" A16900 = "" 
+A16901 = "" A16902 = "" A16903 = "" A16904 = "" A16905 = "" A16906 = "" A16907 = "" A16908 = "" A16909 = "" A16910 = "" 
+A16911 = "" A16912 = "" A16913 = "" A16914 = "" A16915 = "" A16916 = "" A16917 = "" A16918 = "" A16919 = "" A16920 = "" 
+A16921 = "" A16922 = "" A16923 = "" A16924 = "" A16925 = "" A16926 = "" A16927 = "" A16928 = "" A16929 = "" A16930 = "" 
+A16931 = "" A16932 = "" A16933 = "" A16934 = "" A16935 = "" A16936 = "" A16937 = "" A16938 = "" A16939 = "" A16940 = "" 
+A16941 = "" A16942 = "" A16943 = "" A16944 = "" A16945 = "" A16946 = "" A16947 = "" A16948 = "" A16949 = "" A16950 = "" 
+A16951 = "" A16952 = "" A16953 = "" A16954 = "" A16955 = "" A16956 = "" A16957 = "" A16958 = "" A16959 = "" A16960 = "" 
+A16961 = "" A16962 = "" A16963 = "" A16964 = "" A16965 = "" A16966 = "" A16967 = "" A16968 = "" A16969 = "" A16970 = "" 
+A16971 = "" A16972 = "" A16973 = "" A16974 = "" A16975 = "" A16976 = "" A16977 = "" A16978 = "" A16979 = "" A16980 = "" 
+A16981 = "" A16982 = "" A16983 = "" A16984 = "" A16985 = "" A16986 = "" A16987 = "" A16988 = "" A16989 = "" A16990 = "" 
+A16991 = "" A16992 = "" A16993 = "" A16994 = "" A16995 = "" A16996 = "" A16997 = "" A16998 = "" A16999 = "" A17000 = "" 
+A17001 = "" A17002 = "" A17003 = "" A17004 = "" A17005 = "" A17006 = "" A17007 = "" A17008 = "" A17009 = "" A17010 = "" 
+A17011 = "" A17012 = "" A17013 = "" A17014 = "" A17015 = "" A17016 = "" A17017 = "" A17018 = "" A17019 = "" A17020 = "" 
+A17021 = "" A17022 = "" A17023 = "" A17024 = "" A17025 = "" A17026 = "" A17027 = "" A17028 = "" A17029 = "" A17030 = "" 
+A17031 = "" A17032 = "" A17033 = "" A17034 = "" A17035 = "" A17036 = "" A17037 = "" A17038 = "" A17039 = "" A17040 = "" 
+A17041 = "" A17042 = "" A17043 = "" A17044 = "" A17045 = "" A17046 = "" A17047 = "" A17048 = "" A17049 = "" A17050 = "" 
+A17051 = "" A17052 = "" A17053 = "" A17054 = "" A17055 = "" A17056 = "" A17057 = "" A17058 = "" A17059 = "" A17060 = "" 
+A17061 = "" A17062 = "" A17063 = "" A17064 = "" A17065 = "" A17066 = "" A17067 = "" A17068 = "" A17069 = "" A17070 = "" 
+A17071 = "" A17072 = "" A17073 = "" A17074 = "" A17075 = "" A17076 = "" A17077 = "" A17078 = "" A17079 = "" A17080 = "" 
+A17081 = "" A17082 = "" A17083 = "" A17084 = "" A17085 = "" A17086 = "" A17087 = "" A17088 = "" A17089 = "" A17090 = "" 
+A17091 = "" A17092 = "" A17093 = "" A17094 = "" A17095 = "" A17096 = "" A17097 = "" A17098 = "" A17099 = "" A17100 = "" 
+A17101 = "" A17102 = "" A17103 = "" A17104 = "" A17105 = "" A17106 = "" A17107 = "" A17108 = "" A17109 = "" A17110 = "" 
+A17111 = "" A17112 = "" A17113 = "" A17114 = "" A17115 = "" A17116 = "" A17117 = "" A17118 = "" A17119 = "" A17120 = "" 
+A17121 = "" A17122 = "" A17123 = "" A17124 = "" A17125 = "" A17126 = "" A17127 = "" A17128 = "" A17129 = "" A17130 = "" 
+A17131 = "" A17132 = "" A17133 = "" A17134 = "" A17135 = "" A17136 = "" A17137 = "" A17138 = "" A17139 = "" A17140 = "" 
+A17141 = "" A17142 = "" A17143 = "" A17144 = "" A17145 = "" A17146 = "" A17147 = "" A17148 = "" A17149 = "" A17150 = "" 
+A17151 = "" A17152 = "" A17153 = "" A17154 = "" A17155 = "" A17156 = "" A17157 = "" A17158 = "" A17159 = "" A17160 = "" 
+A17161 = "" A17162 = "" A17163 = "" A17164 = "" A17165 = "" A17166 = "" A17167 = "" A17168 = "" A17169 = "" A17170 = "" 
+A17171 = "" A17172 = "" A17173 = "" A17174 = "" A17175 = "" A17176 = "" A17177 = "" A17178 = "" A17179 = "" A17180 = "" 
+A17181 = "" A17182 = "" A17183 = "" A17184 = "" A17185 = "" A17186 = "" A17187 = "" A17188 = "" A17189 = "" A17190 = "" 
+A17191 = "" A17192 = "" A17193 = "" A17194 = "" A17195 = "" A17196 = "" A17197 = "" A17198 = "" A17199 = "" A17200 = "" 
+A17201 = "" A17202 = "" A17203 = "" A17204 = "" A17205 = "" A17206 = "" A17207 = "" A17208 = "" A17209 = "" A17210 = "" 
+A17211 = "" A17212 = "" A17213 = "" A17214 = "" A17215 = "" A17216 = "" A17217 = "" A17218 = "" A17219 = "" A17220 = "" 
+A17221 = "" A17222 = "" A17223 = "" A17224 = "" A17225 = "" A17226 = "" A17227 = "" A17228 = "" A17229 = "" A17230 = "" 
+A17231 = "" A17232 = "" A17233 = "" A17234 = "" A17235 = "" A17236 = "" A17237 = "" A17238 = "" A17239 = "" A17240 = "" 
+A17241 = "" A17242 = "" A17243 = "" A17244 = "" A17245 = "" A17246 = "" A17247 = "" A17248 = "" A17249 = "" A17250 = "" 
+A17251 = "" A17252 = "" A17253 = "" A17254 = "" A17255 = "" A17256 = "" A17257 = "" A17258 = "" A17259 = "" A17260 = "" 
+A17261 = "" A17262 = "" A17263 = "" A17264 = "" A17265 = "" A17266 = "" A17267 = "" A17268 = "" A17269 = "" A17270 = "" 
+A17271 = "" A17272 = "" A17273 = "" A17274 = "" A17275 = "" A17276 = "" A17277 = "" A17278 = "" A17279 = "" A17280 = "" 
+A17281 = "" A17282 = "" A17283 = "" A17284 = "" A17285 = "" A17286 = "" A17287 = "" A17288 = "" A17289 = "" A17290 = "" 
+A17291 = "" A17292 = "" A17293 = "" A17294 = "" A17295 = "" A17296 = "" A17297 = "" A17298 = "" A17299 = "" A17300 = "" 
+A17301 = "" A17302 = "" A17303 = "" A17304 = "" A17305 = "" A17306 = "" A17307 = "" A17308 = "" A17309 = "" A17310 = "" 
+A17311 = "" A17312 = "" A17313 = "" A17314 = "" A17315 = "" A17316 = "" A17317 = "" A17318 = "" A17319 = "" A17320 = "" 
+A17321 = "" A17322 = "" A17323 = "" A17324 = "" A17325 = "" A17326 = "" A17327 = "" A17328 = "" A17329 = "" A17330 = "" 
+A17331 = "" A17332 = "" A17333 = "" A17334 = "" A17335 = "" A17336 = "" A17337 = "" A17338 = "" A17339 = "" A17340 = "" 
+A17341 = "" A17342 = "" A17343 = "" A17344 = "" A17345 = "" A17346 = "" A17347 = "" A17348 = "" A17349 = "" A17350 = "" 
+A17351 = "" A17352 = "" A17353 = "" A17354 = "" A17355 = "" A17356 = "" A17357 = "" A17358 = "" A17359 = "" A17360 = "" 
+A17361 = "" A17362 = "" A17363 = "" A17364 = "" A17365 = "" A17366 = "" A17367 = "" A17368 = "" A17369 = "" A17370 = "" 
+A17371 = "" A17372 = "" A17373 = "" A17374 = "" A17375 = "" A17376 = "" A17377 = "" A17378 = "" A17379 = "" A17380 = "" 
+A17381 = "" A17382 = "" A17383 = "" A17384 = "" A17385 = "" A17386 = "" A17387 = "" A17388 = "" A17389 = "" A17390 = "" 
+A17391 = "" A17392 = "" A17393 = "" A17394 = "" A17395 = "" A17396 = "" A17397 = "" A17398 = "" A17399 = "" A17400 = "" 
+A17401 = "" A17402 = "" A17403 = "" A17404 = "" A17405 = "" A17406 = "" A17407 = "" A17408 = "" A17409 = "" A17410 = "" 
+A17411 = "" A17412 = "" A17413 = "" A17414 = "" A17415 = "" A17416 = "" A17417 = "" A17418 = "" A17419 = "" A17420 = "" 
+A17421 = "" A17422 = "" A17423 = "" A17424 = "" A17425 = "" A17426 = "" A17427 = "" A17428 = "" A17429 = "" A17430 = "" 
+A17431 = "" A17432 = "" A17433 = "" A17434 = "" A17435 = "" A17436 = "" A17437 = "" A17438 = "" A17439 = "" A17440 = "" 
+A17441 = "" A17442 = "" A17443 = "" A17444 = "" A17445 = "" A17446 = "" A17447 = "" A17448 = "" A17449 = "" A17450 = "" 
+A17451 = "" A17452 = "" A17453 = "" A17454 = "" A17455 = "" A17456 = "" A17457 = "" A17458 = "" A17459 = "" A17460 = "" 
+A17461 = "" A17462 = "" A17463 = "" A17464 = "" A17465 = "" A17466 = "" A17467 = "" A17468 = "" A17469 = "" A17470 = "" 
+A17471 = "" A17472 = "" A17473 = "" A17474 = "" A17475 = "" A17476 = "" A17477 = "" A17478 = "" A17479 = "" A17480 = "" 
+A17481 = "" A17482 = "" A17483 = "" A17484 = "" A17485 = "" A17486 = "" A17487 = "" A17488 = "" A17489 = "" A17490 = "" 
+A17491 = "" A17492 = "" A17493 = "" A17494 = "" A17495 = "" A17496 = "" A17497 = "" A17498 = "" A17499 = "" A17500 = "" 
+A17501 = "" A17502 = "" A17503 = "" A17504 = "" A17505 = "" A17506 = "" A17507 = "" A17508 = "" A17509 = "" A17510 = "" 
+A17511 = "" A17512 = "" A17513 = "" A17514 = "" A17515 = "" A17516 = "" A17517 = "" A17518 = "" A17519 = "" A17520 = "" 
+A17521 = "" A17522 = "" A17523 = "" A17524 = "" A17525 = "" A17526 = "" A17527 = "" A17528 = "" A17529 = "" A17530 = "" 
+A17531 = "" A17532 = "" A17533 = "" A17534 = "" A17535 = "" A17536 = "" A17537 = "" A17538 = "" A17539 = "" A17540 = "" 
+A17541 = "" A17542 = "" A17543 = "" A17544 = "" A17545 = "" A17546 = "" A17547 = "" A17548 = "" A17549 = "" A17550 = "" 
+A17551 = "" A17552 = "" A17553 = "" A17554 = "" A17555 = "" A17556 = "" A17557 = "" A17558 = "" A17559 = "" A17560 = "" 
+A17561 = "" A17562 = "" A17563 = "" A17564 = "" A17565 = "" A17566 = "" A17567 = "" A17568 = "" A17569 = "" A17570 = "" 
+A17571 = "" A17572 = "" A17573 = "" A17574 = "" A17575 = "" A17576 = "" A17577 = "" A17578 = "" A17579 = "" A17580 = "" 
+A17581 = "" A17582 = "" A17583 = "" A17584 = "" A17585 = "" A17586 = "" A17587 = "" A17588 = "" A17589 = "" A17590 = "" 
+A17591 = "" A17592 = "" A17593 = "" A17594 = "" A17595 = "" A17596 = "" A17597 = "" A17598 = "" A17599 = "" A17600 = "" 
+A17601 = "" A17602 = "" A17603 = "" A17604 = "" A17605 = "" A17606 = "" A17607 = "" A17608 = "" A17609 = "" A17610 = "" 
+A17611 = "" A17612 = "" A17613 = "" A17614 = "" A17615 = "" A17616 = "" A17617 = "" A17618 = "" A17619 = "" A17620 = "" 
+A17621 = "" A17622 = "" A17623 = "" A17624 = "" A17625 = "" A17626 = "" A17627 = "" A17628 = "" A17629 = "" A17630 = "" 
+A17631 = "" A17632 = "" A17633 = "" A17634 = "" A17635 = "" A17636 = "" A17637 = "" A17638 = "" A17639 = "" A17640 = "" 
+A17641 = "" A17642 = "" A17643 = "" A17644 = "" A17645 = "" A17646 = "" A17647 = "" A17648 = "" A17649 = "" A17650 = "" 
+A17651 = "" A17652 = "" A17653 = "" A17654 = "" A17655 = "" A17656 = "" A17657 = "" A17658 = "" A17659 = "" A17660 = "" 
+A17661 = "" A17662 = "" A17663 = "" A17664 = "" A17665 = "" A17666 = "" A17667 = "" A17668 = "" A17669 = "" A17670 = "" 
+A17671 = "" A17672 = "" A17673 = "" A17674 = "" A17675 = "" A17676 = "" A17677 = "" A17678 = "" A17679 = "" A17680 = "" 
+A17681 = "" A17682 = "" A17683 = "" A17684 = "" A17685 = "" A17686 = "" A17687 = "" A17688 = "" A17689 = "" A17690 = "" 
+A17691 = "" A17692 = "" A17693 = "" A17694 = "" A17695 = "" A17696 = "" A17697 = "" A17698 = "" A17699 = "" A17700 = "" 
+A17701 = "" A17702 = "" A17703 = "" A17704 = "" A17705 = "" A17706 = "" A17707 = "" A17708 = "" A17709 = "" A17710 = "" 
+A17711 = "" A17712 = "" A17713 = "" A17714 = "" A17715 = "" A17716 = "" A17717 = "" A17718 = "" A17719 = "" A17720 = "" 
+A17721 = "" A17722 = "" A17723 = "" A17724 = "" A17725 = "" A17726 = "" A17727 = "" A17728 = "" A17729 = "" A17730 = "" 
+A17731 = "" A17732 = "" A17733 = "" A17734 = "" A17735 = "" A17736 = "" A17737 = "" A17738 = "" A17739 = "" A17740 = "" 
+A17741 = "" A17742 = "" A17743 = "" A17744 = "" A17745 = "" A17746 = "" A17747 = "" A17748 = "" A17749 = "" A17750 = "" 
+A17751 = "" A17752 = "" A17753 = "" A17754 = "" A17755 = "" A17756 = "" A17757 = "" A17758 = "" A17759 = "" A17760 = "" 
+A17761 = "" A17762 = "" A17763 = "" A17764 = "" A17765 = "" A17766 = "" A17767 = "" A17768 = "" A17769 = "" A17770 = "" 
+A17771 = "" A17772 = "" A17773 = "" A17774 = "" A17775 = "" A17776 = "" A17777 = "" A17778 = "" A17779 = "" A17780 = "" 
+A17781 = "" A17782 = "" A17783 = "" A17784 = "" A17785 = "" A17786 = "" A17787 = "" A17788 = "" A17789 = "" A17790 = "" 
+A17791 = "" A17792 = "" A17793 = "" A17794 = "" A17795 = "" A17796 = "" A17797 = "" A17798 = "" A17799 = "" A17800 = "" 
+A17801 = "" A17802 = "" A17803 = "" A17804 = "" A17805 = "" A17806 = "" A17807 = "" A17808 = "" A17809 = "" A17810 = "" 
+A17811 = "" A17812 = "" A17813 = "" A17814 = "" A17815 = "" A17816 = "" A17817 = "" A17818 = "" A17819 = "" A17820 = "" 
+A17821 = "" A17822 = "" A17823 = "" A17824 = "" A17825 = "" A17826 = "" A17827 = "" A17828 = "" A17829 = "" A17830 = "" 
+A17831 = "" A17832 = "" A17833 = "" A17834 = "" A17835 = "" A17836 = "" A17837 = "" A17838 = "" A17839 = "" A17840 = "" 
+A17841 = "" A17842 = "" A17843 = "" A17844 = "" A17845 = "" A17846 = "" A17847 = "" A17848 = "" A17849 = "" A17850 = "" 
+A17851 = "" A17852 = "" A17853 = "" A17854 = "" A17855 = "" A17856 = "" A17857 = "" A17858 = "" A17859 = "" A17860 = "" 
+A17861 = "" A17862 = "" A17863 = "" A17864 = "" A17865 = "" A17866 = "" A17867 = "" A17868 = "" A17869 = "" A17870 = "" 
+A17871 = "" A17872 = "" A17873 = "" A17874 = "" A17875 = "" A17876 = "" A17877 = "" A17878 = "" A17879 = "" A17880 = "" 
+A17881 = "" A17882 = "" A17883 = "" A17884 = "" A17885 = "" A17886 = "" A17887 = "" A17888 = "" A17889 = "" A17890 = "" 
+A17891 = "" A17892 = "" A17893 = "" A17894 = "" A17895 = "" A17896 = "" A17897 = "" A17898 = "" A17899 = "" A17900 = "" 
+A17901 = "" A17902 = "" A17903 = "" A17904 = "" A17905 = "" A17906 = "" A17907 = "" A17908 = "" A17909 = "" A17910 = "" 
+A17911 = "" A17912 = "" A17913 = "" A17914 = "" A17915 = "" A17916 = "" A17917 = "" A17918 = "" A17919 = "" A17920 = "" 
+A17921 = "" A17922 = "" A17923 = "" A17924 = "" A17925 = "" A17926 = "" A17927 = "" A17928 = "" A17929 = "" A17930 = "" 
+A17931 = "" A17932 = "" A17933 = "" A17934 = "" A17935 = "" A17936 = "" A17937 = "" A17938 = "" A17939 = "" A17940 = "" 
+A17941 = "" A17942 = "" A17943 = "" A17944 = "" A17945 = "" A17946 = "" A17947 = "" A17948 = "" A17949 = "" A17950 = "" 
+A17951 = "" A17952 = "" A17953 = "" A17954 = "" A17955 = "" A17956 = "" A17957 = "" A17958 = "" A17959 = "" A17960 = "" 
+A17961 = "" A17962 = "" A17963 = "" A17964 = "" A17965 = "" A17966 = "" A17967 = "" A17968 = "" A17969 = "" A17970 = "" 
+A17971 = "" A17972 = "" A17973 = "" A17974 = "" A17975 = "" A17976 = "" A17977 = "" A17978 = "" A17979 = "" A17980 = "" 
+A17981 = "" A17982 = "" A17983 = "" A17984 = "" A17985 = "" A17986 = "" A17987 = "" A17988 = "" A17989 = "" A17990 = "" 
+A17991 = "" A17992 = "" A17993 = "" A17994 = "" A17995 = "" A17996 = "" A17997 = "" A17998 = "" A17999 = "" A18000 = "" 
+A18001 = "" A18002 = "" A18003 = "" A18004 = "" A18005 = "" A18006 = "" A18007 = "" A18008 = "" A18009 = "" A18010 = "" 
+A18011 = "" A18012 = "" A18013 = "" A18014 = "" A18015 = "" A18016 = "" A18017 = "" A18018 = "" A18019 = "" A18020 = "" 
+A18021 = "" A18022 = "" A18023 = "" A18024 = "" A18025 = "" A18026 = "" A18027 = "" A18028 = "" A18029 = "" A18030 = "" 
+A18031 = "" A18032 = "" A18033 = "" A18034 = "" A18035 = "" A18036 = "" A18037 = "" A18038 = "" A18039 = "" A18040 = "" 
+A18041 = "" A18042 = "" A18043 = "" A18044 = "" A18045 = "" A18046 = "" A18047 = "" A18048 = "" A18049 = "" A18050 = "" 
+A18051 = "" A18052 = "" A18053 = "" A18054 = "" A18055 = "" A18056 = "" A18057 = "" A18058 = "" A18059 = "" A18060 = "" 
+A18061 = "" A18062 = "" A18063 = "" A18064 = "" A18065 = "" A18066 = "" A18067 = "" A18068 = "" A18069 = "" A18070 = "" 
+A18071 = "" A18072 = "" A18073 = "" A18074 = "" A18075 = "" A18076 = "" A18077 = "" A18078 = "" A18079 = "" A18080 = "" 
+A18081 = "" A18082 = "" A18083 = "" A18084 = "" A18085 = "" A18086 = "" A18087 = "" A18088 = "" A18089 = "" A18090 = "" 
+A18091 = "" A18092 = "" A18093 = "" A18094 = "" A18095 = "" A18096 = "" A18097 = "" A18098 = "" A18099 = "" A18100 = "" 
+A18101 = "" A18102 = "" A18103 = "" A18104 = "" A18105 = "" A18106 = "" A18107 = "" A18108 = "" A18109 = "" A18110 = "" 
+A18111 = "" A18112 = "" A18113 = "" A18114 = "" A18115 = "" A18116 = "" A18117 = "" A18118 = "" A18119 = "" A18120 = "" 
+A18121 = "" A18122 = "" A18123 = "" A18124 = "" A18125 = "" A18126 = "" A18127 = "" A18128 = "" A18129 = "" A18130 = "" 
+A18131 = "" A18132 = "" A18133 = "" A18134 = "" A18135 = "" A18136 = "" A18137 = "" A18138 = "" A18139 = "" A18140 = "" 
+A18141 = "" A18142 = "" A18143 = "" A18144 = "" A18145 = "" A18146 = "" A18147 = "" A18148 = "" A18149 = "" A18150 = "" 
+A18151 = "" A18152 = "" A18153 = "" A18154 = "" A18155 = "" A18156 = "" A18157 = "" A18158 = "" A18159 = "" A18160 = "" 
+A18161 = "" A18162 = "" A18163 = "" A18164 = "" A18165 = "" A18166 = "" A18167 = "" A18168 = "" A18169 = "" A18170 = "" 
+A18171 = "" A18172 = "" A18173 = "" A18174 = "" A18175 = "" A18176 = "" A18177 = "" A18178 = "" A18179 = "" A18180 = "" 
+A18181 = "" A18182 = "" A18183 = "" A18184 = "" A18185 = "" A18186 = "" A18187 = "" A18188 = "" A18189 = "" A18190 = "" 
+A18191 = "" A18192 = "" A18193 = "" A18194 = "" A18195 = "" A18196 = "" A18197 = "" A18198 = "" A18199 = "" A18200 = "" 
+A18201 = "" A18202 = "" A18203 = "" A18204 = "" A18205 = "" A18206 = "" A18207 = "" A18208 = "" A18209 = "" A18210 = "" 
+A18211 = "" A18212 = "" A18213 = "" A18214 = "" A18215 = "" A18216 = "" A18217 = "" A18218 = "" A18219 = "" A18220 = "" 
+A18221 = "" A18222 = "" A18223 = "" A18224 = "" A18225 = "" A18226 = "" A18227 = "" A18228 = "" A18229 = "" A18230 = "" 
+A18231 = "" A18232 = "" A18233 = "" A18234 = "" A18235 = "" A18236 = "" A18237 = "" A18238 = "" A18239 = "" A18240 = "" 
+A18241 = "" A18242 = "" A18243 = "" A18244 = "" A18245 = "" A18246 = "" A18247 = "" A18248 = "" A18249 = "" A18250 = "" 
+A18251 = "" A18252 = "" A18253 = "" A18254 = "" A18255 = "" A18256 = "" A18257 = "" A18258 = "" A18259 = "" A18260 = "" 
+A18261 = "" A18262 = "" A18263 = "" A18264 = "" A18265 = "" A18266 = "" A18267 = "" A18268 = "" A18269 = "" A18270 = "" 
+A18271 = "" A18272 = "" A18273 = "" A18274 = "" A18275 = "" A18276 = "" A18277 = "" A18278 = "" A18279 = "" A18280 = "" 
+A18281 = "" A18282 = "" A18283 = "" A18284 = "" A18285 = "" A18286 = "" A18287 = "" A18288 = "" A18289 = "" A18290 = "" 
+A18291 = "" A18292 = "" A18293 = "" A18294 = "" A18295 = "" A18296 = "" A18297 = "" A18298 = "" A18299 = "" A18300 = "" 
+A18301 = "" A18302 = "" A18303 = "" A18304 = "" A18305 = "" A18306 = "" A18307 = "" A18308 = "" A18309 = "" A18310 = "" 
+A18311 = "" A18312 = "" A18313 = "" A18314 = "" A18315 = "" A18316 = "" A18317 = "" A18318 = "" A18319 = "" A18320 = "" 
+A18321 = "" A18322 = "" A18323 = "" A18324 = "" A18325 = "" A18326 = "" A18327 = "" A18328 = "" A18329 = "" A18330 = "" 
+A18331 = "" A18332 = "" A18333 = "" A18334 = "" A18335 = "" A18336 = "" A18337 = "" A18338 = "" A18339 = "" A18340 = "" 
+A18341 = "" A18342 = "" A18343 = "" A18344 = "" A18345 = "" A18346 = "" A18347 = "" A18348 = "" A18349 = "" A18350 = "" 
+A18351 = "" A18352 = "" A18353 = "" A18354 = "" A18355 = "" A18356 = "" A18357 = "" A18358 = "" A18359 = "" A18360 = "" 
+A18361 = "" A18362 = "" A18363 = "" A18364 = "" A18365 = "" A18366 = "" A18367 = "" A18368 = "" A18369 = "" A18370 = "" 
+A18371 = "" A18372 = "" A18373 = "" A18374 = "" A18375 = "" A18376 = "" A18377 = "" A18378 = "" A18379 = "" A18380 = "" 
+A18381 = "" A18382 = "" A18383 = "" A18384 = "" A18385 = "" A18386 = "" A18387 = "" A18388 = "" A18389 = "" A18390 = "" 
+A18391 = "" A18392 = "" A18393 = "" A18394 = "" A18395 = "" A18396 = "" A18397 = "" A18398 = "" A18399 = "" A18400 = "" 
+A18401 = "" A18402 = "" A18403 = "" A18404 = "" A18405 = "" A18406 = "" A18407 = "" A18408 = "" A18409 = "" A18410 = "" 
+A18411 = "" A18412 = "" A18413 = "" A18414 = "" A18415 = "" A18416 = "" A18417 = "" A18418 = "" A18419 = "" A18420 = "" 
+A18421 = "" A18422 = "" A18423 = "" A18424 = "" A18425 = "" A18426 = "" A18427 = "" A18428 = "" A18429 = "" A18430 = "" 
+A18431 = "" A18432 = "" A18433 = "" A18434 = "" A18435 = "" A18436 = "" A18437 = "" A18438 = "" A18439 = "" A18440 = "" 
+A18441 = "" A18442 = "" A18443 = "" A18444 = "" A18445 = "" A18446 = "" A18447 = "" A18448 = "" A18449 = "" A18450 = "" 
+A18451 = "" A18452 = "" A18453 = "" A18454 = "" A18455 = "" A18456 = "" A18457 = "" A18458 = "" A18459 = "" A18460 = "" 
+A18461 = "" A18462 = "" A18463 = "" A18464 = "" A18465 = "" A18466 = "" A18467 = "" A18468 = "" A18469 = "" A18470 = "" 
+A18471 = "" A18472 = "" A18473 = "" A18474 = "" A18475 = "" A18476 = "" A18477 = "" A18478 = "" A18479 = "" A18480 = "" 
+A18481 = "" A18482 = "" A18483 = "" A18484 = "" A18485 = "" A18486 = "" A18487 = "" A18488 = "" A18489 = "" A18490 = "" 
+A18491 = "" A18492 = "" A18493 = "" A18494 = "" A18495 = "" A18496 = "" A18497 = "" A18498 = "" A18499 = "" A18500 = "" 
+A18501 = "" A18502 = "" A18503 = "" A18504 = "" A18505 = "" A18506 = "" A18507 = "" A18508 = "" A18509 = "" A18510 = "" 
+A18511 = "" A18512 = "" A18513 = "" A18514 = "" A18515 = "" A18516 = "" A18517 = "" A18518 = "" A18519 = "" A18520 = "" 
+A18521 = "" A18522 = "" A18523 = "" A18524 = "" A18525 = "" A18526 = "" A18527 = "" A18528 = "" A18529 = "" A18530 = "" 
+A18531 = "" A18532 = "" A18533 = "" A18534 = "" A18535 = "" A18536 = "" A18537 = "" A18538 = "" A18539 = "" A18540 = "" 
+A18541 = "" A18542 = "" A18543 = "" A18544 = "" A18545 = "" A18546 = "" A18547 = "" A18548 = "" A18549 = "" A18550 = "" 
+A18551 = "" A18552 = "" A18553 = "" A18554 = "" A18555 = "" A18556 = "" A18557 = "" A18558 = "" A18559 = "" A18560 = "" 
+A18561 = "" A18562 = "" A18563 = "" A18564 = "" A18565 = "" A18566 = "" A18567 = "" A18568 = "" A18569 = "" A18570 = "" 
+A18571 = "" A18572 = "" A18573 = "" A18574 = "" A18575 = "" A18576 = "" A18577 = "" A18578 = "" A18579 = "" A18580 = "" 
+A18581 = "" A18582 = "" A18583 = "" A18584 = "" A18585 = "" A18586 = "" A18587 = "" A18588 = "" A18589 = "" A18590 = "" 
+A18591 = "" A18592 = "" A18593 = "" A18594 = "" A18595 = "" A18596 = "" A18597 = "" A18598 = "" A18599 = "" A18600 = "" 
+A18601 = "" A18602 = "" A18603 = "" A18604 = "" A18605 = "" A18606 = "" A18607 = "" A18608 = "" A18609 = "" A18610 = "" 
+A18611 = "" A18612 = "" A18613 = "" A18614 = "" A18615 = "" A18616 = "" A18617 = "" A18618 = "" A18619 = "" A18620 = "" 
+A18621 = "" A18622 = "" A18623 = "" A18624 = "" A18625 = "" A18626 = "" A18627 = "" A18628 = "" A18629 = "" A18630 = "" 
+A18631 = "" A18632 = "" A18633 = "" A18634 = "" A18635 = "" A18636 = "" A18637 = "" A18638 = "" A18639 = "" A18640 = "" 
+A18641 = "" A18642 = "" A18643 = "" A18644 = "" A18645 = "" A18646 = "" A18647 = "" A18648 = "" A18649 = "" A18650 = "" 
+A18651 = "" A18652 = "" A18653 = "" A18654 = "" A18655 = "" A18656 = "" A18657 = "" A18658 = "" A18659 = "" A18660 = "" 
+A18661 = "" A18662 = "" A18663 = "" A18664 = "" A18665 = "" A18666 = "" A18667 = "" A18668 = "" A18669 = "" A18670 = "" 
+A18671 = "" A18672 = "" A18673 = "" A18674 = "" A18675 = "" A18676 = "" A18677 = "" A18678 = "" A18679 = "" A18680 = "" 
+A18681 = "" A18682 = "" A18683 = "" A18684 = "" A18685 = "" A18686 = "" A18687 = "" A18688 = "" A18689 = "" A18690 = "" 
+A18691 = "" A18692 = "" A18693 = "" A18694 = "" A18695 = "" A18696 = "" A18697 = "" A18698 = "" A18699 = "" A18700 = "" 
+A18701 = "" A18702 = "" A18703 = "" A18704 = "" A18705 = "" A18706 = "" A18707 = "" A18708 = "" A18709 = "" A18710 = "" 
+A18711 = "" A18712 = "" A18713 = "" A18714 = "" A18715 = "" A18716 = "" A18717 = "" A18718 = "" A18719 = "" A18720 = "" 
+A18721 = "" A18722 = "" A18723 = "" A18724 = "" A18725 = "" A18726 = "" A18727 = "" A18728 = "" A18729 = "" A18730 = "" 
+A18731 = "" A18732 = "" A18733 = "" A18734 = "" A18735 = "" A18736 = "" A18737 = "" A18738 = "" A18739 = "" A18740 = "" 
+A18741 = "" A18742 = "" A18743 = "" A18744 = "" A18745 = "" A18746 = "" A18747 = "" A18748 = "" A18749 = "" A18750 = "" 
+A18751 = "" A18752 = "" A18753 = "" A18754 = "" A18755 = "" A18756 = "" A18757 = "" A18758 = "" A18759 = "" A18760 = "" 
+A18761 = "" A18762 = "" A18763 = "" A18764 = "" A18765 = "" A18766 = "" A18767 = "" A18768 = "" A18769 = "" A18770 = "" 
+A18771 = "" A18772 = "" A18773 = "" A18774 = "" A18775 = "" A18776 = "" A18777 = "" A18778 = "" A18779 = "" A18780 = "" 
+A18781 = "" A18782 = "" A18783 = "" A18784 = "" A18785 = "" A18786 = "" A18787 = "" A18788 = "" A18789 = "" A18790 = "" 
+A18791 = "" A18792 = "" A18793 = "" A18794 = "" A18795 = "" A18796 = "" A18797 = "" A18798 = "" A18799 = "" A18800 = "" 
+A18801 = "" A18802 = "" A18803 = "" A18804 = "" A18805 = "" A18806 = "" A18807 = "" A18808 = "" A18809 = "" A18810 = "" 
+A18811 = "" A18812 = "" A18813 = "" A18814 = "" A18815 = "" A18816 = "" A18817 = "" A18818 = "" A18819 = "" A18820 = "" 
+A18821 = "" A18822 = "" A18823 = "" A18824 = "" A18825 = "" A18826 = "" A18827 = "" A18828 = "" A18829 = "" A18830 = "" 
+A18831 = "" A18832 = "" A18833 = "" A18834 = "" A18835 = "" A18836 = "" A18837 = "" A18838 = "" A18839 = "" A18840 = "" 
+A18841 = "" A18842 = "" A18843 = "" A18844 = "" A18845 = "" A18846 = "" A18847 = "" A18848 = "" A18849 = "" A18850 = "" 
+A18851 = "" A18852 = "" A18853 = "" A18854 = "" A18855 = "" A18856 = "" A18857 = "" A18858 = "" A18859 = "" A18860 = "" 
+A18861 = "" A18862 = "" A18863 = "" A18864 = "" A18865 = "" A18866 = "" A18867 = "" A18868 = "" A18869 = "" A18870 = "" 
+A18871 = "" A18872 = "" A18873 = "" A18874 = "" A18875 = "" A18876 = "" A18877 = "" A18878 = "" A18879 = "" A18880 = "" 
+A18881 = "" A18882 = "" A18883 = "" A18884 = "" A18885 = "" A18886 = "" A18887 = "" A18888 = "" A18889 = "" A18890 = "" 
+A18891 = "" A18892 = "" A18893 = "" A18894 = "" A18895 = "" A18896 = "" A18897 = "" A18898 = "" A18899 = "" A18900 = "" 
+A18901 = "" A18902 = "" A18903 = "" A18904 = "" A18905 = "" A18906 = "" A18907 = "" A18908 = "" A18909 = "" A18910 = "" 
+A18911 = "" A18912 = "" A18913 = "" A18914 = "" A18915 = "" A18916 = "" A18917 = "" A18918 = "" A18919 = "" A18920 = "" 
+A18921 = "" A18922 = "" A18923 = "" A18924 = "" A18925 = "" A18926 = "" A18927 = "" A18928 = "" A18929 = "" A18930 = "" 
+A18931 = "" A18932 = "" A18933 = "" A18934 = "" A18935 = "" A18936 = "" A18937 = "" A18938 = "" A18939 = "" A18940 = "" 
+A18941 = "" A18942 = "" A18943 = "" A18944 = "" A18945 = "" A18946 = "" A18947 = "" A18948 = "" A18949 = "" A18950 = "" 
+A18951 = "" A18952 = "" A18953 = "" A18954 = "" A18955 = "" A18956 = "" A18957 = "" A18958 = "" A18959 = "" A18960 = "" 
+A18961 = "" A18962 = "" A18963 = "" A18964 = "" A18965 = "" A18966 = "" A18967 = "" A18968 = "" A18969 = "" A18970 = "" 
+A18971 = "" A18972 = "" A18973 = "" A18974 = "" A18975 = "" A18976 = "" A18977 = "" A18978 = "" A18979 = "" A18980 = "" 
+A18981 = "" A18982 = "" A18983 = "" A18984 = "" A18985 = "" A18986 = "" A18987 = "" A18988 = "" A18989 = "" A18990 = "" 
+A18991 = "" A18992 = "" A18993 = "" A18994 = "" A18995 = "" A18996 = "" A18997 = "" A18998 = "" A18999 = "" A19000 = "" 
+A19001 = "" A19002 = "" A19003 = "" A19004 = "" A19005 = "" A19006 = "" A19007 = "" A19008 = "" A19009 = "" A19010 = "" 
+A19011 = "" A19012 = "" A19013 = "" A19014 = "" A19015 = "" A19016 = "" A19017 = "" A19018 = "" A19019 = "" A19020 = "" 
+A19021 = "" A19022 = "" A19023 = "" A19024 = "" A19025 = "" A19026 = "" A19027 = "" A19028 = "" A19029 = "" A19030 = "" 
+A19031 = "" A19032 = "" A19033 = "" A19034 = "" A19035 = "" A19036 = "" A19037 = "" A19038 = "" A19039 = "" A19040 = "" 
+A19041 = "" A19042 = "" A19043 = "" A19044 = "" A19045 = "" A19046 = "" A19047 = "" A19048 = "" A19049 = "" A19050 = "" 
+A19051 = "" A19052 = "" A19053 = "" A19054 = "" A19055 = "" A19056 = "" A19057 = "" A19058 = "" A19059 = "" A19060 = "" 
+A19061 = "" A19062 = "" A19063 = "" A19064 = "" A19065 = "" A19066 = "" A19067 = "" A19068 = "" A19069 = "" A19070 = "" 
+A19071 = "" A19072 = "" A19073 = "" A19074 = "" A19075 = "" A19076 = "" A19077 = "" A19078 = "" A19079 = "" A19080 = "" 
+A19081 = "" A19082 = "" A19083 = "" A19084 = "" A19085 = "" A19086 = "" A19087 = "" A19088 = "" A19089 = "" A19090 = "" 
+A19091 = "" A19092 = "" A19093 = "" A19094 = "" A19095 = "" A19096 = "" A19097 = "" A19098 = "" A19099 = "" A19100 = "" 
+A19101 = "" A19102 = "" A19103 = "" A19104 = "" A19105 = "" A19106 = "" A19107 = "" A19108 = "" A19109 = "" A19110 = "" 
+A19111 = "" A19112 = "" A19113 = "" A19114 = "" A19115 = "" A19116 = "" A19117 = "" A19118 = "" A19119 = "" A19120 = "" 
+A19121 = "" A19122 = "" A19123 = "" A19124 = "" A19125 = "" A19126 = "" A19127 = "" A19128 = "" A19129 = "" A19130 = "" 
+A19131 = "" A19132 = "" A19133 = "" A19134 = "" A19135 = "" A19136 = "" A19137 = "" A19138 = "" A19139 = "" A19140 = "" 
+A19141 = "" A19142 = "" A19143 = "" A19144 = "" A19145 = "" A19146 = "" A19147 = "" A19148 = "" A19149 = "" A19150 = "" 
+A19151 = "" A19152 = "" A19153 = "" A19154 = "" A19155 = "" A19156 = "" A19157 = "" A19158 = "" A19159 = "" A19160 = "" 
+A19161 = "" A19162 = "" A19163 = "" A19164 = "" A19165 = "" A19166 = "" A19167 = "" A19168 = "" A19169 = "" A19170 = "" 
+A19171 = "" A19172 = "" A19173 = "" A19174 = "" A19175 = "" A19176 = "" A19177 = "" A19178 = "" A19179 = "" A19180 = "" 
+A19181 = "" A19182 = "" A19183 = "" A19184 = "" A19185 = "" A19186 = "" A19187 = "" A19188 = "" A19189 = "" A19190 = "" 
+A19191 = "" A19192 = "" A19193 = "" A19194 = "" A19195 = "" A19196 = "" A19197 = "" A19198 = "" A19199 = "" A19200 = "" 
+A19201 = "" A19202 = "" A19203 = "" A19204 = "" A19205 = "" A19206 = "" A19207 = "" A19208 = "" A19209 = "" A19210 = "" 
+A19211 = "" A19212 = "" A19213 = "" A19214 = "" A19215 = "" A19216 = "" A19217 = "" A19218 = "" A19219 = "" A19220 = "" 
+A19221 = "" A19222 = "" A19223 = "" A19224 = "" A19225 = "" A19226 = "" A19227 = "" A19228 = "" A19229 = "" A19230 = "" 
+A19231 = "" A19232 = "" A19233 = "" A19234 = "" A19235 = "" A19236 = "" A19237 = "" A19238 = "" A19239 = "" A19240 = "" 
+A19241 = "" A19242 = "" A19243 = "" A19244 = "" A19245 = "" A19246 = "" A19247 = "" A19248 = "" A19249 = "" A19250 = "" 
+A19251 = "" A19252 = "" A19253 = "" A19254 = "" A19255 = "" A19256 = "" A19257 = "" A19258 = "" A19259 = "" A19260 = "" 
+A19261 = "" A19262 = "" A19263 = "" A19264 = "" A19265 = "" A19266 = "" A19267 = "" A19268 = "" A19269 = "" A19270 = "" 
+A19271 = "" A19272 = "" A19273 = "" A19274 = "" A19275 = "" A19276 = "" A19277 = "" A19278 = "" A19279 = "" A19280 = "" 
+A19281 = "" A19282 = "" A19283 = "" A19284 = "" A19285 = "" A19286 = "" A19287 = "" A19288 = "" A19289 = "" A19290 = "" 
+A19291 = "" A19292 = "" A19293 = "" A19294 = "" A19295 = "" A19296 = "" A19297 = "" A19298 = "" A19299 = "" A19300 = "" 
+A19301 = "" A19302 = "" A19303 = "" A19304 = "" A19305 = "" A19306 = "" A19307 = "" A19308 = "" A19309 = "" A19310 = "" 
+A19311 = "" A19312 = "" A19313 = "" A19314 = "" A19315 = "" A19316 = "" A19317 = "" A19318 = "" A19319 = "" A19320 = "" 
+A19321 = "" A19322 = "" A19323 = "" A19324 = "" A19325 = "" A19326 = "" A19327 = "" A19328 = "" A19329 = "" A19330 = "" 
+A19331 = "" A19332 = "" A19333 = "" A19334 = "" A19335 = "" A19336 = "" A19337 = "" A19338 = "" A19339 = "" A19340 = "" 
+A19341 = "" A19342 = "" A19343 = "" A19344 = "" A19345 = "" A19346 = "" A19347 = "" A19348 = "" A19349 = "" A19350 = "" 
+A19351 = "" A19352 = "" A19353 = "" A19354 = "" A19355 = "" A19356 = "" A19357 = "" A19358 = "" A19359 = "" A19360 = "" 
+A19361 = "" A19362 = "" A19363 = "" A19364 = "" A19365 = "" A19366 = "" A19367 = "" A19368 = "" A19369 = "" A19370 = "" 
+A19371 = "" A19372 = "" A19373 = "" A19374 = "" A19375 = "" A19376 = "" A19377 = "" A19378 = "" A19379 = "" A19380 = "" 
+A19381 = "" A19382 = "" A19383 = "" A19384 = "" A19385 = "" A19386 = "" A19387 = "" A19388 = "" A19389 = "" A19390 = "" 
+A19391 = "" A19392 = "" A19393 = "" A19394 = "" A19395 = "" A19396 = "" A19397 = "" A19398 = "" A19399 = "" A19400 = "" 
+A19401 = "" A19402 = "" A19403 = "" A19404 = "" A19405 = "" A19406 = "" A19407 = "" A19408 = "" A19409 = "" A19410 = "" 
+A19411 = "" A19412 = "" A19413 = "" A19414 = "" A19415 = "" A19416 = "" A19417 = "" A19418 = "" A19419 = "" A19420 = "" 
+A19421 = "" A19422 = "" A19423 = "" A19424 = "" A19425 = "" A19426 = "" A19427 = "" A19428 = "" A19429 = "" A19430 = "" 
+A19431 = "" A19432 = "" A19433 = "" A19434 = "" A19435 = "" A19436 = "" A19437 = "" A19438 = "" A19439 = "" A19440 = "" 
+A19441 = "" A19442 = "" A19443 = "" A19444 = "" A19445 = "" A19446 = "" A19447 = "" A19448 = "" A19449 = "" A19450 = "" 
+A19451 = "" A19452 = "" A19453 = "" A19454 = "" A19455 = "" A19456 = "" A19457 = "" A19458 = "" A19459 = "" A19460 = "" 
+A19461 = "" A19462 = "" A19463 = "" A19464 = "" A19465 = "" A19466 = "" A19467 = "" A19468 = "" A19469 = "" A19470 = "" 
+A19471 = "" A19472 = "" A19473 = "" A19474 = "" A19475 = "" A19476 = "" A19477 = "" A19478 = "" A19479 = "" A19480 = "" 
+A19481 = "" A19482 = "" A19483 = "" A19484 = "" A19485 = "" A19486 = "" A19487 = "" A19488 = "" A19489 = "" A19490 = "" 
+A19491 = "" A19492 = "" A19493 = "" A19494 = "" A19495 = "" A19496 = "" A19497 = "" A19498 = "" A19499 = "" A19500 = "" 
+A19501 = "" A19502 = "" A19503 = "" A19504 = "" A19505 = "" A19506 = "" A19507 = "" A19508 = "" A19509 = "" A19510 = "" 
+A19511 = "" A19512 = "" A19513 = "" A19514 = "" A19515 = "" A19516 = "" A19517 = "" A19518 = "" A19519 = "" A19520 = "" 
+A19521 = "" A19522 = "" A19523 = "" A19524 = "" A19525 = "" A19526 = "" A19527 = "" A19528 = "" A19529 = "" A19530 = "" 
+A19531 = "" A19532 = "" A19533 = "" A19534 = "" A19535 = "" A19536 = "" A19537 = "" A19538 = "" A19539 = "" A19540 = "" 
+A19541 = "" A19542 = "" A19543 = "" A19544 = "" A19545 = "" A19546 = "" A19547 = "" A19548 = "" A19549 = "" A19550 = "" 
+A19551 = "" A19552 = "" A19553 = "" A19554 = "" A19555 = "" A19556 = "" A19557 = "" A19558 = "" A19559 = "" A19560 = "" 
+A19561 = "" A19562 = "" A19563 = "" A19564 = "" A19565 = "" A19566 = "" A19567 = "" A19568 = "" A19569 = "" A19570 = "" 
+A19571 = "" A19572 = "" A19573 = "" A19574 = "" A19575 = "" A19576 = "" A19577 = "" A19578 = "" A19579 = "" A19580 = "" 
+A19581 = "" A19582 = "" A19583 = "" A19584 = "" A19585 = "" A19586 = "" A19587 = "" A19588 = "" A19589 = "" A19590 = "" 
+A19591 = "" A19592 = "" A19593 = "" A19594 = "" A19595 = "" A19596 = "" A19597 = "" A19598 = "" A19599 = "" A19600 = "" 
+A19601 = "" A19602 = "" A19603 = "" A19604 = "" A19605 = "" A19606 = "" A19607 = "" A19608 = "" A19609 = "" A19610 = "" 
+A19611 = "" A19612 = "" A19613 = "" A19614 = "" A19615 = "" A19616 = "" A19617 = "" A19618 = "" A19619 = "" A19620 = "" 
+A19621 = "" A19622 = "" A19623 = "" A19624 = "" A19625 = "" A19626 = "" A19627 = "" A19628 = "" A19629 = "" A19630 = "" 
+A19631 = "" A19632 = "" A19633 = "" A19634 = "" A19635 = "" A19636 = "" A19637 = "" A19638 = "" A19639 = "" A19640 = "" 
+A19641 = "" A19642 = "" A19643 = "" A19644 = "" A19645 = "" A19646 = "" A19647 = "" A19648 = "" A19649 = "" A19650 = "" 
+A19651 = "" A19652 = "" A19653 = "" A19654 = "" A19655 = "" A19656 = "" A19657 = "" A19658 = "" A19659 = "" A19660 = "" 
+A19661 = "" A19662 = "" A19663 = "" A19664 = "" A19665 = "" A19666 = "" A19667 = "" A19668 = "" A19669 = "" A19670 = "" 
+A19671 = "" A19672 = "" A19673 = "" A19674 = "" A19675 = "" A19676 = "" A19677 = "" A19678 = "" A19679 = "" A19680 = "" 
+A19681 = "" A19682 = "" A19683 = "" A19684 = "" A19685 = "" A19686 = "" A19687 = "" A19688 = "" A19689 = "" A19690 = "" 
+A19691 = "" A19692 = "" A19693 = "" A19694 = "" A19695 = "" A19696 = "" A19697 = "" A19698 = "" A19699 = "" A19700 = "" 
+A19701 = "" A19702 = "" A19703 = "" A19704 = "" A19705 = "" A19706 = "" A19707 = "" A19708 = "" A19709 = "" A19710 = "" 
+A19711 = "" A19712 = "" A19713 = "" A19714 = "" A19715 = "" A19716 = "" A19717 = "" A19718 = "" A19719 = "" A19720 = "" 
+A19721 = "" A19722 = "" A19723 = "" A19724 = "" A19725 = "" A19726 = "" A19727 = "" A19728 = "" A19729 = "" A19730 = "" 
+A19731 = "" A19732 = "" A19733 = "" A19734 = "" A19735 = "" A19736 = "" A19737 = "" A19738 = "" A19739 = "" A19740 = "" 
+A19741 = "" A19742 = "" A19743 = "" A19744 = "" A19745 = "" A19746 = "" A19747 = "" A19748 = "" A19749 = "" A19750 = "" 
+A19751 = "" A19752 = "" A19753 = "" A19754 = "" A19755 = "" A19756 = "" A19757 = "" A19758 = "" A19759 = "" A19760 = "" 
+A19761 = "" A19762 = "" A19763 = "" A19764 = "" A19765 = "" A19766 = "" A19767 = "" A19768 = "" A19769 = "" A19770 = "" 
+A19771 = "" A19772 = "" A19773 = "" A19774 = "" A19775 = "" A19776 = "" A19777 = "" A19778 = "" A19779 = "" A19780 = "" 
+A19781 = "" A19782 = "" A19783 = "" A19784 = "" A19785 = "" A19786 = "" A19787 = "" A19788 = "" A19789 = "" A19790 = "" 
+A19791 = "" A19792 = "" A19793 = "" A19794 = "" A19795 = "" A19796 = "" A19797 = "" A19798 = "" A19799 = "" A19800 = "" 
+A19801 = "" A19802 = "" A19803 = "" A19804 = "" A19805 = "" A19806 = "" A19807 = "" A19808 = "" A19809 = "" A19810 = "" 
+A19811 = "" A19812 = "" A19813 = "" A19814 = "" A19815 = "" A19816 = "" A19817 = "" A19818 = "" A19819 = "" A19820 = "" 
+A19821 = "" A19822 = "" A19823 = "" A19824 = "" A19825 = "" A19826 = "" A19827 = "" A19828 = "" A19829 = "" A19830 = "" 
+A19831 = "" A19832 = "" A19833 = "" A19834 = "" A19835 = "" A19836 = "" A19837 = "" A19838 = "" A19839 = "" A19840 = "" 
+A19841 = "" A19842 = "" A19843 = "" A19844 = "" A19845 = "" A19846 = "" A19847 = "" A19848 = "" A19849 = "" A19850 = "" 
+A19851 = "" A19852 = "" A19853 = "" A19854 = "" A19855 = "" A19856 = "" A19857 = "" A19858 = "" A19859 = "" A19860 = "" 
+A19861 = "" A19862 = "" A19863 = "" A19864 = "" A19865 = "" A19866 = "" A19867 = "" A19868 = "" A19869 = "" A19870 = "" 
+A19871 = "" A19872 = "" A19873 = "" A19874 = "" A19875 = "" A19876 = "" A19877 = "" A19878 = "" A19879 = "" A19880 = "" 
+A19881 = "" A19882 = "" A19883 = "" A19884 = "" A19885 = "" A19886 = "" A19887 = "" A19888 = "" A19889 = "" A19890 = "" 
+A19891 = "" A19892 = "" A19893 = "" A19894 = "" A19895 = "" A19896 = "" A19897 = "" A19898 = "" A19899 = "" A19900 = "" 
+A19901 = "" A19902 = "" A19903 = "" A19904 = "" A19905 = "" A19906 = "" A19907 = "" A19908 = "" A19909 = "" A19910 = "" 
+A19911 = "" A19912 = "" A19913 = "" A19914 = "" A19915 = "" A19916 = "" A19917 = "" A19918 = "" A19919 = "" A19920 = "" 
+A19921 = "" A19922 = "" A19923 = "" A19924 = "" A19925 = "" A19926 = "" A19927 = "" A19928 = "" A19929 = "" A19930 = "" 
+A19931 = "" A19932 = "" A19933 = "" A19934 = "" A19935 = "" A19936 = "" A19937 = "" A19938 = "" A19939 = "" A19940 = "" 
+A19941 = "" A19942 = "" A19943 = "" A19944 = "" A19945 = "" A19946 = "" A19947 = "" A19948 = "" A19949 = "" A19950 = "" 
+A19951 = "" A19952 = "" A19953 = "" A19954 = "" A19955 = "" A19956 = "" A19957 = "" A19958 = "" A19959 = "" A19960 = "" 
+A19961 = "" A19962 = "" A19963 = "" A19964 = "" A19965 = "" A19966 = "" A19967 = "" A19968 = "" A19969 = "" A19970 = "" 
+A19971 = "" A19972 = "" A19973 = "" A19974 = "" A19975 = "" A19976 = "" A19977 = "" A19978 = "" A19979 = "" A19980 = "" 
+A19981 = "" A19982 = "" A19983 = "" A19984 = "" A19985 = "" A19986 = "" A19987 = "" A19988 = "" A19989 = "" A19990 = "" 
+A19991 = "" A19992 = "" A19993 = "" A19994 = "" A19995 = "" A19996 = "" A19997 = "" A19998 = "" A19999 = "" 
+>
+    <name><family>Boss</family> <given>Big</given></name>
+    <email>chief@foo.com</email>
+    <link subordinates="one.worker two.worker three.worker four.worker five.worker"/>
+  </person>
+
+  <person id="one.worker">
+    <name><family>Worker</family> <given>One</given></name>
+    <email>one@foo.com</email>
+    <link manager="Big.Boss"/>
+  </person>
+
+  <person id="two.worker">
+    <name><family>Worker</family> <given>Two</given></name>
+    <email>two@foo.com</email>
+    <link manager="Big.Boss"/>
+  </person>
+
+  <person id="three.worker">
+    <name><family>Worker</family> <given>Three</given></name>
+    <email>three@foo.com</email>
+    <link manager="Big.Boss"/>
+  </person>
+
+  <person id="four.worker">
+    <name><family>Worker</family> <given>Four</given></name>
+    <email>four@foo.com</email>
+    <link manager="Big.Boss"/>
+  </person>
+
+  <person id="five.worker">
+    <name><family>Worker</family> <given>Five</given></name>
+    <email>five@foo.com</email>
+    <link manager="Big.Boss"/>
+  </person>
+
+</personnel>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/DosTest3.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/DosTest3.xml
new file mode 100644
index 00000000000..58d82c93c39
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/DosTest3.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<personnel>
+
+<person id="Big.Boss"  A100 = "" 
+A101 = "" A102 = "" A103 = ""
+>
+    <name><family>Boss</family> <given>Big</given></name>
+    <email>chief@foo.com</email>
+    <link subordinates="one.worker two.worker three.worker four.worker five.worker"/>
+  </person>
+
+  <person id="one.worker">
+    <name><family>Worker</family> <given>One</given></name>
+    <email>one@foo.com</email>
+    <link manager="Big.Boss"/>
+  </person>
+
+  <person id="two.worker">
+    <name><family>Worker</family> <given>Two</given></name>
+    <email>two@foo.com</email>
+    <link manager="Big.Boss"/>
+  </person>
+
+  <person id="three.worker">
+    <name><family>Worker</family> <given>Three</given></name>
+    <email>three@foo.com</email>
+    <link manager="Big.Boss"/>
+  </person>
+
+  <person id="four.worker">
+    <name><family>Worker</family> <given>Four</given></name>
+    <email>four@foo.com</email>
+    <link manager="Big.Boss"/>
+  </person>
+
+  <person id="five.worker">
+    <name><family>Worker</family> <given>Five</given></name>
+    <email>five@foo.com</email>
+    <link manager="Big.Boss"/>
+  </person>
+
+</personnel>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/FactoryFindTest.java
new file mode 100644
index 00000000000..6f769714125
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/FactoryFindTest.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test Classloader for SAXParserFactory.
+ */
+public class FactoryFindTest {
+
+    boolean myClassLoaderUsed = false;
+
+    @Test
+    public void testFactoryFind() {
+        try {
+            // System.setProperty("jaxp.debug", "true");
+
+            SAXParserFactory factory = SAXParserFactory.newInstance();
+            Assert.assertTrue(factory.getClass().getClassLoader() == null);
+
+            Thread.currentThread().setContextClassLoader(null);
+            factory = SAXParserFactory.newInstance();
+            Assert.assertTrue(factory.getClass().getClassLoader() == null);
+
+            Thread.currentThread().setContextClassLoader(new MyClassLoader());
+            factory = SAXParserFactory.newInstance();
+            if (System.getSecurityManager() == null)
+                Assert.assertTrue(myClassLoaderUsed);
+            else
+                Assert.assertFalse(myClassLoaderUsed);
+        } catch (Exception ex) {
+        }
+
+    }
+
+    class MyClassLoader extends URLClassLoader {
+
+        public MyClassLoader() {
+            super(new URL[0]);
+        }
+
+        public Class loadClass(String name) throws ClassNotFoundException {
+            myClassLoaderUsed = true;
+            return super.loadClass(name);
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/MyDefaultHandler.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/MyDefaultHandler.java
new file mode 100644
index 00000000000..a63bcd4cf26
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/MyDefaultHandler.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.ext.Locator2;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class MyDefaultHandler extends DefaultHandler {
+
+    private Locator myLocator = null;
+    String xmlVersion = "";
+
+    public void setDocumentLocator(Locator locator) {
+        myLocator = locator;
+    }
+
+    public void startElement(String uri, String localName, String qName, Attributes attributes) {
+        try {
+            xmlVersion = ((Locator2) myLocator).getXMLVersion();
+        } catch (Exception e) {
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/MyErrorHandler.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/MyErrorHandler.java
new file mode 100644
index 00000000000..3dc24dcdfcb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/MyErrorHandler.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class MyErrorHandler extends DefaultHandler {
+
+    public boolean errorOccured = false;
+
+    public void error(SAXParseException e) throws SAXException {
+
+        System.err.println("Error: " + "[[" + e.getPublicId() + "]" + "[" + e.getSystemId() + "]]" + "[[" + e.getLineNumber() + "]" + "[" + e.getColumnNumber()
+                + "]] " + e);
+
+        errorOccured = true;
+    }
+
+    public void fatalError(SAXParseException e) throws SAXException {
+
+        System.err.println("Fatal Error: " + e);
+
+        errorOccured = true;
+    }
+
+    public void warning(SAXParseException e) throws SAXException {
+
+        System.err.println("Warning: " + e);
+
+        errorOccured = true;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/ParseEmptyStream.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/ParseEmptyStream.java
new file mode 100644
index 00000000000..cc9ba34faa7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/ParseEmptyStream.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers;
+
+import java.io.StringReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @summary Test SAXParser doesn't accept empty stream.
+ */
+public class ParseEmptyStream {
+
+    SAXParserFactory factory = null;
+
+    public ParseEmptyStream(String name) {
+        try {
+            factory = SAXParserFactory.newInstance();
+            factory.setNamespaceAware(true);
+        } catch (Exception ex) {
+            Assert.fail(ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testEmptyStream() {
+        try {
+            SAXParser parser = factory.newSAXParser();
+            InputSource source = new InputSource(new StringReader(""));
+            parser.parse(source, new MyHandler());
+            Assert.fail("Inputstream without document element accepted");
+        } catch (Exception ex) {
+            System.out.println("Exception thrown: " + ex.getMessage());
+            // Premature end of file exception expected
+        }
+    }
+
+    @Test
+    public void testXmlDeclOnly() {
+        try {
+            SAXParser parser = factory.newSAXParser();
+            InputSource source = new InputSource(new StringReader("<?xml version='1.0' encoding='utf-8'?>"));
+            parser.parse(source, new MyHandler());
+            Assert.fail("Inputstream without document element accepted");
+        } catch (Exception ex) {
+            System.out.println("Exception thrown: " + ex.getMessage());
+            // Premature end of file exception expected
+        }
+    }
+
+    static class MyHandler extends DefaultHandler {
+        public void startDocument() {
+            System.out.println("Start document called");
+        }
+
+        public void endDocument() {
+            System.out.println("End document called");
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/bug6690015.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/bug6690015.xml
new file mode 100644
index 00000000000..1c02f285555
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/bug6690015.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<block>
+<lang>
+<text dna="8233" ro="hello, and i'll type some normal characters in (&gt;=1.5 mm) ro" it="here to make sure international characters don't play a part(&gt;=1.5mm) it" tr="make sure international characters don't play a part (&gt;=1.5 mm) tr" pt_br="make sure international characters don't play a part (&gt;=1,5 mm) pt_br" de="make sure international characters don't play a part (&gt;=1,5 mm) de" el="make sure international characters don't play a part (&gt;= 1.5 mm) el" zh_cn="make sure international characters don't play a part¿&gt;= 1.5 mm¿ zh_cn" pt="make sure international characters don't play a part (&gt;=1,5 mm) pt" bg="make sure international characters don't play a part (&gt;= 1.5 mm) bg" fr="make sure international characters don't play a part (&gt;= 1,5 mm) fr" en="make sure international characters don't play a part (&gt;= 1.5 mm) en" ru="make sure international characters don't play a part (&gt;=1.5 ¿¿) ru" es="make sure international characters don't play a part (&gt;=1.5 mm) es" ja="make sure international characters don't play a part¿&gt;=1.5mm¿ ja" nl="make sure international characters don't play a part (&gt;= 1,5 mm) nl" />
+</lang>
+</block>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/bug6760982.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/bug6760982.xml
new file mode 100644
index 00000000000..5b7f9919388
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/bug6760982.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<Test>
+  <mytest  a= '[]'
+           b= '[]'
+           c= '[]'
+           d= '[]'
+           e= '[]'
+           f= '[]'
+           Y= '[]'
+           Z= 'ZZ[]'
+  />
+</Test>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/catalog.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/catalog.xml
new file mode 100644
index 00000000000..0fa5eb7ab58
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/catalog.xml
@@ -0,0 +1,2 @@
+<?xml version="1.1" encoding="UTF-8"?>
+<stardb xmlns="http://www.astro.com/astro" xmlns:astro="http://www.astro.com/astro" xsi:schemaLocation="http://www.astro.com/astro catalog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><_test01></_test01><test-02 xmlns:xsi=""></test-02><test.03></test.03><_test-04>T%e!s#t$</_test-04><star><hr>1</hr><constellation/><fullname/><ra><h>00</h><m>05</m><s>09.9</s><dv>0.08608333333333333</dv></ra><dec><sgn/><d>45</d><m>13</m><s>45</s><dv>45.22916666666667</dv></dec><glng>114.44</glng><glat>-16.88</glat><vmag>6.70</vmag><spec>A1Vn</spec></star><star><hr>2</hr><constellation/><fullname/><ra><h>00</h><m>05</m><s>03.8</s><dv>0.08438888888888889</dv></ra><dec><sgn>-</sgn><d>00</d><m>30</m><s>11</s><dv>-0.5030555555555556</dv></dec><glng>98.33</glng><glat>-61.14</glat><vmag>6.29</vmag><spec>gG9</spec></star><star><hr>3</hr><constellation>Psc</constellation><fullname>33    Psc</fullname><ra><h>00</h><m>05</m><s>20.1</s><dv>0.08891666666666666</dv></ra><dec><sgn>-</sgn><d>05</d><m>42</m><s>27</s><dv>-5.7075000000000005</dv></dec><glng>93.75</glng><glat>-65.93</glat><vmag>4.61</vmag><spec>K0IIIbCN-0.5</spec></star><star><hr>4</hr><constellation>Peg</constellation><fullname>86    Peg</fullname><ra><h>00</h><m>05</m><s>42.0</s><dv>0.095</dv></ra><dec><sgn/><d>13</d><m>23</m><s>46</s><dv>13.39611111111111</dv></dec><glng>106.19</glng><glat>-47.98</glat><vmag>5.51</vmag><spec>G5III</spec></star><star><hr>5</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>16.0</s><dv>0.10444444444444445</dv></ra><dec><sgn/><d>58</d><m>26</m><s>12</s><dv>58.43666666666666</dv></dec><glng>117.03</glng><glat>-03.92</glat><vmag>5.96</vmag><spec>G5V</spec></star><star><hr>6</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>19.0</s><dv>0.10527777777777779</dv></ra><dec><sgn>-</sgn><d>49</d><m>04</m><s>30</s><dv>-49.075</dv></dec><glng>321.61</glng><glat>-66.38</glat><vmag>5.70</vmag><spec>G1IV</spec></star><star><hr>7</hr><constellation>Cas</constellation><fullname>10    Cas</fullname><ra><h>00</h><m>06</m><s>26.5</s><dv>0.10736111111111112</dv></ra><dec><sgn/><d>64</d><m>11</m><s>46</s><dv>64.19611111111111</dv></dec><glng>118.06</glng><glat>1.75</glat><vmag>5.59</vmag><spec>B9III</spec></star><star><hr>8</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>36.8</s><dv>0.11022222222222222</dv></ra><dec><sgn/><d>29</d><m>01</m><s>17</s><dv>29.02138888888889</dv></dec><glng>111.26</glng><glat>-32.83</glat><vmag>6.13</vmag><spec>K0V</spec></star><star><hr>9</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>50.1</s><dv>0.11391666666666667</dv></ra><dec><sgn>-</sgn><d>23</d><m>06</m><s>27</s><dv>-23.1075</dv></dec><glng>52.21</glng><glat>-79.14</glat><vmag>6.18</vmag><spec>A7V</spec></star><star><hr>10</hr><constellation/><fullname/><ra><h>00</h><m>07</m><s>18.2</s><dv>0.12172222222222222</dv></ra><dec><sgn>-</sgn><d>17</d><m>23</m><s>11</s><dv>-17.386388888888888</dv></dec><glng>74.36</glng><glat>-75.90</glat><vmag>6.19</vmag><spec>A6Vn</spec></star></stardb>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/catalog.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/catalog.xsd
new file mode 100644
index 00000000000..6e95cb8e31f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/catalog.xsd
@@ -0,0 +1,122 @@
+<xs:schema 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://www.astro.com/astro" 
+    xmlns:astro="http://www.astro.com/astro"
+    elementFormDefault="qualified"
+    attributeFormDefault="qualified"
+>
+    <!-- Star Identification String Type  -->
+    <xs:simpleType name="staridType">
+	<xs:restriction base="xs:string">
+	    <xs:maxLength value="4"/>
+	</xs:restriction>
+    </xs:simpleType>
+
+    <!-- Hour Type -->
+    <xs:simpleType name="hourType">
+	<xs:restriction base="xs:decimal">
+	    <xs:minInclusive value="0.0"/>
+	    <xs:maxInclusive value="24.0"/>
+	</xs:restriction>
+    </xs:simpleType>
+
+    <!-- Minute Type -->
+    <xs:simpleType name="minuteType">
+	<xs:restriction base="xs:decimal">
+	    <xs:minInclusive value="0.0"/>
+	    <xs:maxInclusive value="60.0"/>
+	</xs:restriction>
+    </xs:simpleType>
+
+    <!-- Second Type -->
+    <xs:simpleType name="secondType">
+	<xs:restriction base="xs:decimal">
+	    <xs:minInclusive value="0.0"/>
+	    <xs:maxInclusive value="60.0"/>
+	</xs:restriction>
+    </xs:simpleType>
+
+    <xs:simpleType name="decimalValueType">
+	<xs:restriction base="xs:decimal">
+	</xs:restriction>
+    </xs:simpleType> 
+
+    <xs:simpleType name="degType">
+	<xs:restriction base="xs:decimal">
+	    <xs:minInclusive value="-90.0"/>
+	    <xs:maxInclusive value="90.0"/>
+	</xs:restriction>
+    </xs:simpleType> 
+
+    <xs:simpleType name="vmagType">
+	<xs:restriction base="xs:decimal">
+	    <xs:minInclusive value="-3.0"/>
+	    <xs:maxInclusive value="12.0"/>
+	</xs:restriction>
+    </xs:simpleType> 
+
+
+    <xs:simpleType name="signType">
+	<xs:restriction base="xs:string">
+	    <xs:enumeration value="+"/>
+	    <xs:enumeration value="-"/>
+	    <xs:enumeration value=""/>
+	</xs:restriction>
+    </xs:simpleType> 
+
+    <xs:complexType name="raType">
+	<xs:sequence>
+	    <xs:element name="h"  type="astro:hourType"/>
+	    <xs:element name="m"  type="astro:minuteType"/>
+	    <xs:element name="s"  type="astro:secondType"/>
+	    <xs:element name="dv" type="astro:decimalValueType"/>
+	</xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="decType">
+	<xs:sequence>
+	    <xs:element name="sgn" type="astro:signType"/>
+	    <xs:element name="d"   type="astro:degType"/>
+	    <xs:element name="m"   type="astro:minuteType"/>
+	    <xs:element name="s"   type="astro:secondType"/>
+	    <xs:element name="dv"  type="astro:decimalValueType"/>
+	</xs:sequence>
+    </xs:complexType>
+
+
+    <xs:complexType name="starType">
+	<xs:sequence>
+	    <xs:element name="hr"            type="astro:staridType"/>
+	    <xs:element name="constellation" type="xs:string"/>
+	    <xs:element name="fullname"      type="xs:string"/>
+	    <xs:element name="ra"            type="astro:raType"/>
+	    <xs:element name="dec"           type="astro:decType"/>
+	    <xs:element name="glng"          type="xs:decimal"/>
+	    <xs:element name="glat"          type="xs:decimal"/>
+	    <xs:element name="vmag"          type="astro:vmagType"/>
+	    <xs:element name="spec"          type="xs:string"/>
+	</xs:sequence>
+    </xs:complexType>
+
+
+    <!-- The real part of the catalog starts here -->
+    <xs:element name="stardb">
+       <xs:complexType>
+          <xs:sequence>
+
+	     <!-- for testing purposes -->
+	     <xs:element name="_test01" type="xs:string"
+		minOccurs="0" maxOccurs="1"/>
+	     <xs:element name="test-02" type="xs:string"/>
+	     <xs:element name="test.03" type="xs:string"/>
+	     <xs:element name="_test-04" type="xs:string"/>
+
+	     <!-- astro data elements -->
+             <xs:element name="star" type="astro:starType"
+	        minOccurs="0" maxOccurs="unbounded"/>
+          </xs:sequence>
+       </xs:complexType>
+    </xs:element>
+    <!-- The real part of the catalog ends here -->
+
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/entity.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/entity.xml
new file mode 100644
index 00000000000..167c0abae0d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/entity.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding='UTF-8'?>
+<!DOCTYPE author [ 
+<!ELEMENT author ANY>
+<!ENTITY writer "Jan Egil Refsnes.">
+<!ENTITY copyright "Copyright XML101.">
+<!ENTITY something "ABC">
+]> 
+<author>&writer;&copyright;&something;&something;</author>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/entity64K.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/entity64K.xml
new file mode 100644
index 00000000000..0b41c20695b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/entity64K.xml
@@ -0,0 +1,4 @@
+<!DOCTYPE author [
+<!ELEMENT author ANY>
+<!ENTITY s "ABC">
+]> <author>&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;&s;</author>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/test.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/test.xsd
new file mode 100644
index 00000000000..c22ae84722d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/test.xsd
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           xmlns:tn="foo"
+           targetNamespace="foo" elementFormDefault="qualified">
+    <xs:element name="root">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="a">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element ref="tn:b"/>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+                <xs:element name="ref" maxOccurs="unbounded" minOccurs="0" type="xs:string" />
+            </xs:sequence>
+        </xs:complexType>
+                                        
+        <!-- identity constraint -->
+        <xs:key name="key">
+            <xs:selector xpath=".//tn:a/tn:b|.//tn:a/tn:b/tn:c"/>
+            <xs:field xpath="@id"/>
+        </xs:key>
+        <xs:keyref name="keyref" refer="tn:key">
+            <xs:selector xpath=".//tn:ref"/>
+            <xs:field xpath="."/>
+        </xs:keyref>
+    </xs:element>
+    
+    <xs:element name="c">
+        <xs:complexType>
+            <xs:attribute name="id" type="xs:string"/>
+        </xs:complexType>
+    </xs:element>
+                
+    <xs:element name="b">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="tn:c" minOccurs="0" />
+            </xs:sequence>
+            <xs:attribute name="id" type="xs:string"/>
+        </xs:complexType>
+    </xs:element>
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/test1.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/test1.xml
new file mode 100644
index 00000000000..2bd7dd7954d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/test1.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root xmlns="foo">
+    <a>
+       <b id="id1">
+         <c id="id2"/>
+       </b>
+    </a>
+
+    <ref>id2</ref>
+</root>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/test2.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/test2.xml
new file mode 100644
index 00000000000..56e7e477959
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/test2.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root xmlns="foo">
+  <undefined />
+</root>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/toys.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/toys.xml
new file mode 100644
index 00000000000..de257194040
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/toys.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Document   : toys.xml
+    Created on : August 11, 2003, 6:42 PM
+    Author     : Prasad Subramanian
+    Description:
+-->
+
+<toys>
+    <toy>
+        <name>Lego-Model01</name>
+        <price>65.99</price>
+    </toy>
+    <toy>
+        <name>Lego-Model2</name>
+        <price>69.99</price>
+    </toy>
+    <toy>
+        <name>Lego-Model3</name>
+        <price>14.99</price>
+    </toy>
+    <toy>
+        <name>Barbie-Pink</name>
+        <price>12.99</price>
+    </toy>
+    <toy>
+        <name>Barbie-Blue</name>
+        <price>13.99</price>
+    </toy>        
+    <toy>
+        <name>Barbie-White</name>
+        <price>13.99</price>
+    </toy>   
+    <toy>
+        <name>Barbie-Plain</name>
+        <price>13.99</price>
+    </toy>           
+</toys>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/toys.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/toys.xsd
new file mode 100644
index 00000000000..34bcf89949b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/toys.xsd
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="toys">
+     <xs:complexType>
+       <xs:sequence>
+         <xs:element name="toy" maxOccurs="200">
+           <xs:complexType>
+             <xs:sequence>
+               <xs:element name="name" type="xs:string" minOccurs="0"/>
+               <xs:element name="price" type="xs:string" minOccurs="0"/>
+             </xs:sequence>
+          </xs:complexType>  
+        </xs:element>
+      </xs:sequence>
+    </xs:complexType>  
+  </xs:element>
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/toys3002.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/toys3002.xsd
new file mode 100644
index 00000000000..6cdc234fa24
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/toys3002.xsd
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="toys">
+     <xs:complexType>
+       <xs:sequence>
+         <xs:element name="toy" maxOccurs="3002">
+           <xs:complexType>
+             <xs:sequence>
+               <xs:element name="name" type="xs:string" minOccurs="0"/>
+               <xs:element name="price" type="xs:string" minOccurs="0"/>
+             </xs:sequence>
+          </xs:complexType>  
+        </xs:element>
+      </xs:sequence>
+    </xs:complexType>  
+  </xs:element>
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/xinclude/Bug6794483Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/xinclude/Bug6794483Test.java
new file mode 100644
index 00000000000..735efe8932b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/xinclude/Bug6794483Test.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers.xinclude;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6794483
+ * @summary Test JAXP parser can parse xml file using <xi:include> to include another xml, which has an empty element.
+ */
+public class Bug6794483Test {
+
+    @Test
+    public final void test() {
+        String xml = getClass().getResource("test1.xml").getPath();
+        Document doc = parseXmlFile(xml);
+
+        StringWriter sw = new StringWriter();
+        StreamResult result = new StreamResult(sw);
+
+        TransformerFactory transformerFact = TransformerFactory.newInstance();
+        transformerFact.setAttribute("indent-number", new Integer(4));
+        Transformer transformer;
+
+        try {
+            transformer = transformerFact.newTransformer();
+            transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+            transformer.setOutputProperty(OutputKeys.METHOD, "xml");
+            transformer.setOutputProperty(OutputKeys.MEDIA_TYPE, "text/xml");
+
+            // "true" indicate Append content If file exist in system
+            transformer.transform(new DOMSource(doc), result);
+            System.out.println("test" + sw);
+
+        } catch (TransformerConfigurationException ex) {
+            ex.printStackTrace();
+            Assert.fail("unexpected TransformerConfigurationException");
+        } catch (TransformerException ex) {
+            ex.printStackTrace();
+            Assert.fail("unexpected TransformerException");
+        }
+
+    }
+
+    public Document parseXmlFile(String fileName) {
+        System.out.println("Parsing XML file... " + fileName);
+        DocumentBuilder docBuilder = null;
+        Document doc = null;
+        DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+        docBuilderFactory.setCoalescing(true);
+        docBuilderFactory.setXIncludeAware(true);
+        System.out.println("Include: " + docBuilderFactory.isXIncludeAware());
+        docBuilderFactory.setNamespaceAware(true);
+        docBuilderFactory.setExpandEntityReferences(true);
+
+        try {
+            docBuilder = docBuilderFactory.newDocumentBuilder();
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+        }
+
+        File sourceFile = new File(fileName);
+        try {
+            doc = docBuilder.parse(sourceFile);
+        } catch (SAXException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+
+        System.out.println("XML file parsed");
+        return doc;
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/xinclude/test1.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/xinclude/test1.xml
new file mode 100644
index 00000000000..4296e186e1d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/xinclude/test1.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scenario xsi:noNamespaceSchemaLocation="..\xsd\Scenario.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xi="http://www.w3.org/2001/XInclude">
+
+<!-- Configuration data for Device-->
+<Device>
+<xi:include href="test2.xml" xpointer="element(/1/1)" parse="xml"/>
+</Device>
+
+</scenario>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/xinclude/test2.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/xinclude/test2.xml
new file mode 100644
index 00000000000..dd58340be38
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/parsers/xinclude/test2.xml
@@ -0,0 +1,12 @@
+<test2>
+<N1>
+<node1>Node1 Value</node1>
+<node2>Node2 Value</node2>
+<node3/>
+<node4>Node4 Value</node4>
+<node5>
+<node6>Node6 Value</node6>
+</node5>
+</N1>
+</test2>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/AttributeLocalNameTest/AttributeLocalNameTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/AttributeLocalNameTest/AttributeLocalNameTest.java
new file mode 100644
index 00000000000..dd2570c8daa
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/AttributeLocalNameTest/AttributeLocalNameTest.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.AttributeLocalNameTest;
+
+import java.io.StringReader;
+
+import javax.xml.stream.StreamFilter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamReader.getAttributeLocalName().
+ */
+public class AttributeLocalNameTest {
+
+    static final String XML = "<?xml version=\"1.0\"?>" + "<S:Envelope foo=\"bar\" xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"></S:Envelope>";
+
+    @Test
+    public void testOne() {
+        try {
+            XMLInputFactory factory = XMLInputFactory.newInstance();
+            XMLStreamReader reader = factory.createFilteredReader(factory.createXMLStreamReader(new StringReader(XML)), new Filter());
+            reader.next();
+            reader.hasNext(); // force filter to cache
+            Assert.assertTrue(reader.getAttributeLocalName(0) != null);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Unexpected Exception: " + e.getMessage());
+        }
+    }
+
+    class Filter implements StreamFilter {
+
+        public boolean accept(XMLStreamReader reader) {
+            return true;
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6370703.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6370703.java
new file mode 100644
index 00000000000..0366b2ef831
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6370703.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6370703
+ * @summary Test StAX parser can parse attribute default value when START_ELEMENT.
+ */
+public class Bug6370703 {
+
+    private static String INPUT_FILE = "sgml.xml";
+
+    @Test
+    public void testStartElement() {
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            XMLStreamReader xsr = xif.createXMLStreamReader(this.getClass().getResource(INPUT_FILE).toExternalForm(),
+                    this.getClass().getResourceAsStream(INPUT_FILE));
+
+            while (xsr.hasNext()) {
+                int event = xsr.next();
+                if (event == XMLStreamReader.START_ELEMENT) {
+                    String localName = xsr.getLocalName();
+                    boolean print = "para".equals(localName);
+                    int nrOfAttr = xsr.getAttributeCount();
+                    if (print) {
+                        Assert.assertTrue(nrOfAttr > 0, "Default attribute declared in DTD is missing");
+                    }
+
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6378422.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6378422.java
new file mode 100644
index 00000000000..be4e230a51f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6378422.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream;
+
+import javax.xml.stream.XMLInputFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6378422
+ * @summary Test setting reuse-instance property on StAX factory.
+ */
+public class Bug6378422 {
+
+    @Test
+    public void testReuseInstanceProp() {
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            xif.setProperty("reuse-instance", Boolean.valueOf(true));
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6380870.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6380870.java
new file mode 100644
index 00000000000..8f8cfa45f98
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6380870.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6380870
+ * @summary Test StAX parser can parse VoiceXML DTD.
+ */
+public class Bug6380870 {
+
+    private static String INPUT_FILE = "basic-form.vxml";
+
+    @Test
+    public void testStreamReader() {
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            XMLStreamReader reader = xif.createXMLStreamReader(this.getClass().getResource(INPUT_FILE).toExternalForm(),
+                    this.getClass().getResourceAsStream(INPUT_FILE));
+            while (reader.hasNext())
+                reader.next();
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6489502.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6489502.java
new file mode 100644
index 00000000000..1c0793995fa
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6489502.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2013, 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.
+ */
+
+package javax.xml.stream;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6489502
+ * @summary Test XMLInputFactory works correctly in case it repeats to create reader.
+ */
+public class Bug6489502 {
+
+    public java.io.File input;
+    public final String filesDir = "./";
+    protected XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+    protected XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+
+    private static String xml = "<?xml version=\"1.0\"?><PLAY><TITLE>The Tragedy of Hamlet, Prince of Denmark</TITLE></PLAY>";
+
+    @Test
+    public void testEventReader1() {
+        try {
+            // Check if event reader returns the correct event
+            XMLEventReader e1 = inputFactory.createXMLEventReader(inputFactory.createXMLStreamReader(new java.io.StringReader(xml)));
+            Assert.assertEquals(e1.peek().getEventType(), XMLStreamConstants.START_DOCUMENT);
+
+            // Repeat same steps to test factory state
+            XMLEventReader e2 = inputFactory.createXMLEventReader(inputFactory.createXMLStreamReader(new java.io.StringReader(xml)));
+            Assert.assertEquals(e2.peek().getEventType(), XMLStreamConstants.START_DOCUMENT);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testEventReader2() {
+        try {
+            // Now advance underlying reader and then call peek on event reader
+            XMLStreamReader s1 = inputFactory.createXMLStreamReader(new java.io.StringReader(xml));
+            Assert.assertEquals(s1.getEventType(), XMLStreamConstants.START_DOCUMENT);
+            s1.next();
+            s1.next(); // advance to <TITLE>
+            Assert.assertTrue(s1.getLocalName().equals("TITLE"));
+
+            XMLEventReader e3 = inputFactory.createXMLEventReader(s1);
+            Assert.assertEquals(e3.peek().getEventType(), XMLStreamConstants.START_ELEMENT);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6509774.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6509774.java
new file mode 100644
index 00000000000..711775fba81
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6509774.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6509774
+ * @summary Test Property javax.xml.stream.supportDTD, DTD events are now returned even if supportDTD=false.
+ */
+public class Bug6509774 {
+
+    @Test
+    public void test0() {
+
+        try {
+
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+
+            xif.setProperty("javax.xml.stream.supportDTD", Boolean.TRUE);
+
+            XMLStreamReader xsr = xif.createXMLStreamReader(
+
+            getClass().getResource("sgml_Bug6509774.xml").toString(),
+
+            getClass().getResourceAsStream("sgml_Bug6509774.xml"));
+
+            Assert.assertTrue(xsr.getEventType() == XMLStreamConstants.START_DOCUMENT);
+
+            int event = xsr.next();
+
+            // Must be a DTD event since DTDs are supported
+
+            Assert.assertTrue(event == XMLStreamConstants.DTD);
+
+            while (xsr.hasNext()) {
+
+                event = xsr.next();
+
+            }
+
+            Assert.assertTrue(event == XMLStreamConstants.END_DOCUMENT);
+
+            xsr.close();
+
+        }
+
+        catch (Exception e) {
+
+            Assert.fail(e.getMessage());
+
+        }
+
+    }
+
+    @Test
+    public void test1() {
+
+        try {
+
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+
+            xif.setProperty("javax.xml.stream.supportDTD", Boolean.FALSE);
+
+            XMLStreamReader xsr = xif.createXMLStreamReader(
+
+            getClass().getResource("sgml_Bug6509774.xml").toString(),
+
+            getClass().getResourceAsStream("sgml_Bug6509774.xml"));
+
+            Assert.assertTrue(xsr.getEventType() == XMLStreamConstants.START_DOCUMENT);
+
+            int event = xsr.next();
+
+            // Should not be a DTD event since they are ignored
+
+            Assert.assertTrue(event == XMLStreamConstants.DTD);
+
+            while (xsr.hasNext()) {
+
+                event = xsr.next();
+
+            }
+
+            Assert.assertTrue(event == XMLStreamConstants.END_DOCUMENT);
+
+            xsr.close();
+
+        }
+
+        catch (Exception e) {
+
+            Assert.fail(e.getMessage());
+
+        }
+
+    }
+
+    @Test
+    public void test2() {
+
+        try {
+
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+
+            xif.setProperty("javax.xml.stream.supportDTD", Boolean.FALSE);
+
+            XMLStreamReader xsr = xif.createXMLStreamReader(
+
+            getClass().getResource("sgml-bad-systemId.xml").toString(),
+
+            getClass().getResourceAsStream("sgml-bad-systemId.xml"));
+
+            Assert.assertTrue(xsr.getEventType() == XMLStreamConstants.START_DOCUMENT);
+
+            int event = xsr.next();
+
+            // Should not be a DTD event since they are ignored
+
+            Assert.assertTrue(event == XMLStreamConstants.DTD);
+
+            while (xsr.hasNext()) {
+
+                event = xsr.next();
+
+            }
+
+            Assert.assertTrue(event == XMLStreamConstants.END_DOCUMENT);
+
+            xsr.close();
+
+        }
+
+        catch (Exception e) {
+
+            // Bogus systemId in XML document should not result in exception
+
+            Assert.fail(e.getMessage());
+
+        }
+
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6688002Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6688002Test.java
new file mode 100644
index 00000000000..594546296b4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6688002Test.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6688002
+ * @summary Test single instance of XMLOutputFactory/XMLInputFactory create multiple Writer/Readers in parallel.
+ */
+public class Bug6688002Test {
+
+    private static final XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+    private static final XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+    private static final int NO_THREADS = 3;
+
+    @Test
+    public void testMultiThread() throws Exception {
+        Thread[] threads = new Thread[NO_THREADS];
+        for (int i = 0; i < NO_THREADS; i++) {
+            threads[i] = new Thread(new MyRunnable(i));
+        }
+        for (int i = 0; i < NO_THREADS; i++) {
+            threads[i].start();
+        }
+        for (int i = 0; i < NO_THREADS; i++) {
+            threads[i].join();
+        }
+    }
+
+    public class MyRunnable implements Runnable {
+        final int no;
+
+        MyRunnable(int no) {
+            this.no = no;
+        }
+
+        public void run() {
+            try {
+                FileOutputStream fos = new FileOutputStream("" + no);
+                XMLStreamWriter w = getWriter(fos);
+                // System.out.println("Writer="+w+" Thread="+Thread.currentThread());
+                w.writeStartDocument();
+                w.writeStartElement("hello");
+                for (int j = 0; j < 50; j++) {
+                    w.writeStartElement("a" + j);
+                    w.writeEndElement();
+                }
+                w.writeEndElement();
+                w.writeEndDocument();
+                w.close();
+                fos.close();
+
+                FileInputStream fis = new FileInputStream("" + no);
+                XMLStreamReader r = getReader(fis);
+                while (r.hasNext()) {
+                    r.next();
+                }
+                r.close();
+                fis.close();
+            } catch (Exception e) {
+                Assert.fail(e.getMessage());
+            }
+        }
+    }
+
+    public static/* synchronized */XMLStreamReader getReader(InputStream is) throws Exception {
+        return inputFactory.createXMLStreamReader(is);
+        // return XMLStreamReaderFactory.create(null, is, true);
+    }
+
+    public static/* synchronized */XMLStreamWriter getWriter(OutputStream os) throws Exception {
+        return outputFactory.createXMLStreamWriter(os);
+        // return XMLStreamWriterFactory.createXMLStreamWriter(os);
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6976938.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6976938.xml
new file mode 100644
index 00000000000..f603ea3ad57
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6976938.xml
@@ -0,0 +1,1810 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<vf:root xmlns:vf="http://www.xxx.com/oss/xml/TroubleTicket">
+      <vf:troubleDescription>
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+&lt;a111111111a&gt;
+  &lt;b111111111b&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+    &lt;c111111111c&gt;
+  &lt;b111111111b&gt;
+&lt;a111111111a&gt;
+
+      </vf:troubleDescription>
+</vf:root>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6976938Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6976938Test.java
new file mode 100644
index 00000000000..08be1fe5c51
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Bug6976938Test.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6976938
+ * @summary Test StAX parser won't throw StackOverflowError while reading valid XML file, in case the text content of an XML element contains many lines like "&lt; ... &gt;".
+ */
+public class Bug6976938Test {
+
+    private static final String INPUT_FILE = "Bug6976938.xml";
+
+    public static final String VF_GENERIC_TT_NAMESPACE = "http://www.vodafone.com/oss/xml/TroubleTicket";
+
+    public static final QName ATTACHMENT_NAME = new QName(VF_GENERIC_TT_NAMESPACE, "attachment");
+
+    @Test
+    public void testEventReader() {
+        XMLInputFactory xif = XMLInputFactory.newInstance();
+        xif.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
+        eventReaderTest(xif);
+    }
+
+    @Test
+    public void testEventReader1() {
+        XMLInputFactory xif = XMLInputFactory.newInstance();
+        eventReaderTest(xif);
+    }
+
+    public void eventReaderTest(XMLInputFactory xif) {
+        XMLEventReader eventReader = null;
+        try {
+            eventReader = xif.createXMLEventReader(this.getClass().getResourceAsStream(INPUT_FILE));
+            XMLEventReader filteredEventReader = xif.createFilteredReader(eventReader, new EventFilter() {
+                public boolean accept(XMLEvent event) {
+                    if (!event.isStartElement()) {
+                        return false;
+                    }
+                    QName elementQName = event.asStartElement().getName();
+                    if ((elementQName.getLocalPart().equals(ATTACHMENT_NAME.getLocalPart()) || elementQName.getLocalPart().equals("Attachment"))
+                            && elementQName.getNamespaceURI().equals(VF_GENERIC_TT_NAMESPACE)) {
+                        return true;
+                    }
+                    return false;
+                }
+            });
+            if (filteredEventReader.hasNext()) {
+                System.out.println("containsAttachments() returns true");
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+
+        } finally {
+            if (eventReader != null) {
+                try {
+                    eventReader.close();
+                } catch (XMLStreamException xse) {
+                    // Ignored by intention
+                }
+            }
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/CoalesceTest/CoalesceTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/CoalesceTest/CoalesceTest.java
new file mode 100644
index 00000000000..899e2705892
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/CoalesceTest/CoalesceTest.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package javax.xml.stream.CoalesceTest;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test Coalesce property works.
+ */
+public class CoalesceTest {
+
+    String countryElementContent = "START India  CS}}}}}} India END";
+    String descriptionElementContent = "a&b";
+    String fooElementContent = "&< cdatastart<><>>><>><<<<cdataend entitystart insert entityend";
+
+    @Test
+    public void testCoalesceProperty() {
+        try {
+            XMLInputFactory xifactory = XMLInputFactory.newInstance();
+            xifactory.setProperty(XMLInputFactory.IS_COALESCING, new Boolean(true));
+            InputStream xml = this.getClass().getResourceAsStream("coalesce.xml");
+            XMLStreamReader streamReader = xifactory.createXMLStreamReader(xml);
+            while (streamReader.hasNext()) {
+                int eventType = streamReader.next();
+                if (eventType == XMLStreamConstants.START_ELEMENT && streamReader.getLocalName().equals("country")) {
+                    eventType = streamReader.next();
+                    if (eventType == XMLStreamConstants.CHARACTERS) {
+                        String text = streamReader.getText();
+                        if (!text.equals(countryElementContent)) {
+                            System.out.println("String dont match");
+                            System.out.println("text = " + text);
+                            System.out.println("countryElementContent = " + countryElementContent);
+                        }
+                        // assertTrue(text.equals(countryElementContent));
+                    }
+                }
+                if (eventType == XMLStreamConstants.START_ELEMENT && streamReader.getLocalName().equals("description")) {
+                    eventType = streamReader.next();
+                    if (eventType == XMLStreamConstants.CHARACTERS) {
+                        String text = streamReader.getText();
+                        if (!text.equals(descriptionElementContent)) {
+                            System.out.println("String dont match");
+                            System.out.println("text = " + text);
+                            System.out.println("descriptionElementContent = " + descriptionElementContent);
+                        }
+                        Assert.assertTrue(text.equals(descriptionElementContent));
+                    }
+                }
+                if (eventType == XMLStreamConstants.START_ELEMENT && streamReader.getLocalName().equals("foo")) {
+                    eventType = streamReader.next();
+                    if (eventType == XMLStreamConstants.CHARACTERS) {
+                        String text = streamReader.getText();
+                        if (!text.equals(fooElementContent)) {
+                            System.out.println("String dont match");
+                            System.out.println("text = " + text);
+                            System.out.println("fooElementContent = " + fooElementContent);
+                        }
+
+                        Assert.assertTrue(text.equals(fooElementContent));
+                    }
+                }
+
+            }
+        } catch (XMLStreamException ex) {
+
+            if (ex.getNestedException() != null) {
+                ex.getNestedException().printStackTrace();
+            }
+            // ex.printStackTrace() ;
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/CoalesceTest/coalesce.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/CoalesceTest/coalesce.xml
new file mode 100644
index 00000000000..48952ef6044
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/CoalesceTest/coalesce.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE city [
+<!ENTITY a "insert">
+<!ENTITY b "<element1>subtree</element1>">
+
+]>
+<city name = "Bangalore" population = "100000">
+
+	<country state = "Karnatka">START India  <![CDATA[CS}}}}}}]]> India END</country>
+        <foo>&amp;&lt; <![CDATA[cdatastart<><>>><>><<<<cdataend]]> entitystart &a; entityend</foo>
+        &b;
+	<description>a&amp;b</description>
+         <?CityHotels Information about the hotels is passed to different appications for processing. ?>	
+
+</city>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EntitiesTest/EntityTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EntitiesTest/EntityTest.java
new file mode 100644
index 00000000000..0da8153adce
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EntitiesTest/EntityTest.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.EntitiesTest;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test StAX parses entity.
+ */
+public class EntityTest {
+
+    XMLInputFactory factory = null;
+    String output = "";
+
+    @BeforeMethod
+    protected void setUp() {
+        try {
+            factory = XMLInputFactory.newInstance();
+        } catch (Exception ex) {
+            Assert.fail("Could not create XMLInputFactory");
+        }
+    }
+
+    @AfterMethod
+    protected void tearDown() {
+        factory = null;
+    }
+
+    @Test
+    public void testProperties() {
+        Assert.assertTrue(factory.isPropertySupported("javax.xml.stream.isReplacingEntityReferences"));
+    }
+
+    @Test
+    public void testCharacterReferences() {
+        try {
+            URL fileName = EntityTest.class.getResource("testCharRef.xml");
+            URL outputFileName = EntityTest.class.getResource("testCharRef.xml.output");
+            XMLStreamReader xmlr = factory.createXMLStreamReader(new InputStreamReader(fileName.openStream()));
+            int eventType = 0;
+            while (xmlr.hasNext()) {
+                eventType = xmlr.next();
+                handleEvent(xmlr, eventType);
+            }
+            System.out.println("Output:");
+            System.out.println(output);
+            Assert.assertTrue(compareOutput(new InputStreamReader(outputFileName.openStream()), new StringReader(output)));
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail(ex.getMessage());
+        }
+    }
+
+    private void handleEvent(XMLStreamReader xmlr, int eventType) {
+        switch (eventType) {
+            case XMLEvent.START_ELEMENT:
+                handleStartElement(xmlr);
+                break;
+            case XMLEvent.END_ELEMENT:
+                handleEndElement(xmlr);
+                break;
+            case XMLEvent.CHARACTERS:
+                handleCharacters(xmlr);
+                break;
+            case XMLEvent.COMMENT:
+                handleComment(xmlr);
+                break;
+            case XMLEvent.ENTITY_REFERENCE:
+                break;
+            case XMLEvent.ATTRIBUTE:
+                break;
+            case XMLEvent.DTD:
+                break;
+            case XMLEvent.CDATA:
+                break;
+            default:
+                break;
+        }
+    }
+
+    private void handleStartElement(XMLStreamReader xmlr) {
+        output += "<";
+        output += xmlr.getLocalName();
+        if (xmlr.hasText())
+            output += xmlr.getText();
+        printAttributes(xmlr);
+        output += ">";
+    }
+
+    private void handleEndElement(XMLStreamReader xmlr) {
+        output += "</";
+        output += xmlr.getLocalName();
+        output += ">";
+    }
+
+    private void handleComment(XMLStreamReader xmlr) {
+        if (xmlr.hasText())
+            output += xmlr.getText();
+    }
+
+    private void handleCharacters(XMLStreamReader xmlr) {
+        if (xmlr.hasText())
+            output += xmlr.getText();
+    }
+
+    private void printAttributes(XMLStreamReader xmlr) {
+        if (xmlr.getAttributeCount() > 0) {
+            int count = xmlr.getAttributeCount();
+            for (int i = 0; i < count; i++) {
+                output += xmlr.getAttributeName(i);
+                output += "=";
+                output += xmlr.getAttributeValue(i);
+                /*
+                 * String name = xmlr.getAttributeName(i) ; String value =
+                 * xmlr.getAttributeValue(i) ;
+                 * System.out.println(name+"="+value);
+                 */
+            }
+        }
+    }
+
+    protected boolean compareOutput(Reader expected, Reader actual) throws IOException {
+        LineNumberReader expectedOutput = new LineNumberReader(expected);
+        LineNumberReader actualOutput = new LineNumberReader(actual);
+
+        while (expectedOutput.ready() && actualOutput.ready()) {
+            String expectedLine = expectedOutput.readLine();
+            String actualLine = actualOutput.readLine();
+            if (!expectedLine.equals(actualLine)) {
+                System.out.println("Entityreference expansion failed, line no: " + expectedOutput.getLineNumber());
+                System.out.println("Expected: " + expectedLine);
+                System.out.println("Actual  : " + actualLine);
+                return false;
+            }
+        }
+        expectedOutput.close();
+        actualOutput.close();
+        return true;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EntitiesTest/testCharRef.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EntitiesTest/testCharRef.xml
new file mode 100644
index 00000000000..c8dc1889e0a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EntitiesTest/testCharRef.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding='UTF-8'?>
+<!DOCTYPE juicers [
+<!ENTITY ch1 "T">
+]>
+<juicers>
+
+<reftest>TES&ch1;CHARREF</reftest>
+
+</juicers>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EntitiesTest/testCharRef.xml.output b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EntitiesTest/testCharRef.xml.output
new file mode 100644
index 00000000000..26357bfeb22
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EntitiesTest/testCharRef.xml.output
@@ -0,0 +1,5 @@
+<juicers>
+
+<reftest>TESTCHARREF</reftest>
+
+</juicers>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EventReaderDelegateTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EventReaderDelegateTest.java
new file mode 100644
index 00000000000..77186aea6e1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/EventReaderDelegateTest.java
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream;
+
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+import javax.xml.stream.events.XMLEvent;
+import javax.xml.stream.util.EventReaderDelegate;
+
+/*
+ * @summary Test EventReaderDelegate.
+ */
+public class EventReaderDelegateTest {
+
+    public EventReaderDelegateTest(String name) {
+    }
+
+    @Test
+    public void testGetElementText() {
+        try {
+            XMLInputFactory ifac = XMLInputFactory.newFactory();
+            XMLEventReader reader = ifac.createXMLEventReader(new FileInputStream(new File(getClass().getResource("toys.xml").getFile())));
+            EventReaderDelegate delegate = new EventReaderDelegate(reader);
+            while (delegate.hasNext()) {
+                XMLEvent event = (XMLEvent) delegate.next();
+                switch (event.getEventType()) {
+                    case XMLStreamConstants.START_ELEMENT: {
+                        String name = event.asStartElement().getName().toString();
+                        if (name.equals("name") || name.equals("price")) {
+                            System.out.println(delegate.getElementText());
+                        } else {
+                            try {
+                                delegate.getElementText();
+                            } catch (XMLStreamException e) {
+                                System.out.println("Expected XMLStreamException in getElementText()");
+                            }
+                        }
+
+                    }
+                }
+            }
+            delegate.close();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+            Assert.fail("FileNotFoundException in testGetElementText()");
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            Assert.fail("XMLStreamException in testGetElementText()");
+        } catch (FactoryConfigurationError e) {
+            e.printStackTrace();
+            Assert.fail("FactoryConfigurationError in testGetElementText()");
+        }
+
+    }
+
+    @Test
+    public void testRemove() {
+        try {
+            XMLInputFactory ifac = XMLInputFactory.newFactory();
+            XMLEventReader reader = ifac.createXMLEventReader(new FileInputStream(new File(getClass().getResource("toys.xml").getFile())));
+            EventReaderDelegate delegate = new EventReaderDelegate(reader);
+            delegate.remove();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+            Assert.fail("FileNotFoundException in testRemove()");
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            Assert.fail("XMLStreamException in testRemove()");
+        } catch (FactoryConfigurationError e) {
+            e.printStackTrace();
+            Assert.fail("FactoryConfigurationError in testRemove()");
+        } catch (UnsupportedOperationException e) {
+            System.out.println("Expected exception in remove()");
+        }
+
+    }
+
+    @Test
+    public void testPeek() {
+        try {
+            XMLInputFactory ifac = XMLInputFactory.newFactory();
+            XMLEventReader reader = ifac.createXMLEventReader(new FileInputStream(new File(getClass().getResource("toys.xml").getFile())));
+            EventReaderDelegate delegate = new EventReaderDelegate();
+            delegate.setParent(reader);
+            while (delegate.hasNext()) {
+                XMLEvent peekevent = delegate.peek();
+                XMLEvent event = (XMLEvent) delegate.next();
+                if (peekevent != event) {
+                    Assert.fail("peek() does not return same XMLEvent with next()");
+                }
+            }
+            delegate.close();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+            Assert.fail("FileNotFoundException in testPeek()");
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            Assert.fail("XMLStreamException in testPeek()");
+        } catch (FactoryConfigurationError e) {
+            e.printStackTrace();
+            Assert.fail("FactoryConfigurationError in testPeek()");
+        }
+    }
+
+    @Test
+    public void testNextTag() {
+        try {
+            XMLInputFactory ifac = XMLInputFactory.newFactory();
+            ifac.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
+            XMLEventReader reader = ifac.createXMLEventReader(new FileInputStream(new File(getClass().getResource("toys.xml").getFile())));
+            EventReaderDelegate delegate = new EventReaderDelegate(reader);
+            if ((Boolean) (delegate.getProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)) != Boolean.FALSE) {
+                Assert.fail("getProperty() does not return correct value");
+            }
+            while (delegate.hasNext()) {
+                XMLEvent event = delegate.peek();
+                if (event.isEndElement() || event.isStartElement()) {
+                    XMLEvent nextevent = delegate.nextTag();
+                    if (!(nextevent.getEventType() == XMLStreamConstants.START_ELEMENT || nextevent.getEventType() == XMLStreamConstants.END_ELEMENT)) {
+                        Assert.fail("nextTag() does not return correct event type");
+                    }
+                } else {
+                    delegate.next();
+                }
+            }
+            delegate.close();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+            Assert.fail("FileNotFoundException in testNextTag()");
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            Assert.fail("XMLStreamException in testNextTag()");
+        } catch (FactoryConfigurationError e) {
+            e.printStackTrace();
+            Assert.fail("FactoryConfigurationError in testNextTag()");
+        }
+    }
+
+    @Test
+    public void testNextEvent() {
+        try {
+            XMLInputFactory ifac = XMLInputFactory.newFactory();
+            ifac.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
+            XMLEventReader reader = ifac.createXMLEventReader(new FileInputStream(new File(getClass().getResource("toys.xml").getFile())));
+            EventReaderDelegate delegate = new EventReaderDelegate();
+            delegate.setParent(reader);
+            if ((Boolean) (delegate.getParent().getProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)) != Boolean.FALSE) {
+                Assert.fail("XMLEventReader.getProperty() does not return correct value");
+            }
+            if ((Boolean) (delegate.getProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES)) != Boolean.FALSE) {
+                Assert.fail("EventReaderDelegate.getProperty() does not return correct value");
+            }
+            while (delegate.hasNext()) {
+                XMLEvent event = delegate.nextEvent();
+                switch (event.getEventType()) {
+                    case XMLStreamConstants.START_ELEMENT: {
+                        System.out.println(event.asStartElement().getName());
+                        break;
+                    }
+                    case XMLStreamConstants.END_ELEMENT: {
+                        System.out.println(event.asEndElement().getName());
+                        break;
+                    }
+                    case XMLStreamConstants.END_DOCUMENT: {
+                        System.out.println(event.isEndDocument());
+                        break;
+                    }
+                    case XMLStreamConstants.START_DOCUMENT: {
+                        System.out.println(event.isStartDocument());
+                        break;
+                    }
+                    case XMLStreamConstants.CHARACTERS: {
+                        System.out.println(event.asCharacters().getData());
+                        break;
+                    }
+                    case XMLStreamConstants.COMMENT: {
+                        System.out.println(event.toString());
+                        break;
+                    }
+                }
+
+            }
+            delegate.close();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+            Assert.fail("FileNotFoundException in testNextEvent()");
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            Assert.fail("XMLStreamException in testNextEvent()");
+        } catch (FactoryConfigurationError e) {
+            e.printStackTrace();
+            Assert.fail("FactoryConfigurationError in testNextEvent()");
+        }
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue41Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue41Test.java
new file mode 100644
index 00000000000..87d3ad41587
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue41Test.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.Events;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventFactory;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.Attribute;
+import javax.xml.stream.events.Characters;
+import javax.xml.stream.events.Comment;
+import javax.xml.stream.events.DTD;
+import javax.xml.stream.events.EndDocument;
+import javax.xml.stream.events.EndElement;
+import javax.xml.stream.events.Namespace;
+import javax.xml.stream.events.ProcessingInstruction;
+import javax.xml.stream.events.StartDocument;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6631268
+ * @summary Test XMLEvent.writeAsEncodedUnicode can output the event content.
+ */
+public class Issue41Test {
+
+    public java.io.File input;
+    public final String filesDir = "./";
+    protected XMLInputFactory inputFactory;
+    protected XMLOutputFactory outputFactory;
+
+    @Test
+    public void testEvents() {
+        XMLEventFactory f = XMLEventFactory.newInstance();
+        final String contents = "test <some> text & more! [[]] --";
+        final String prefix = "prefix";
+        final String uri = "http://foo";
+        final String localName = "elem";
+
+        try {
+            StartDocument sd = f.createStartDocument();
+            writeAsEncodedUnicode(sd);
+
+            Comment c = f.createComment("some comments");
+            writeAsEncodedUnicode(c);
+
+            StartElement se = f.createStartElement(prefix, uri, localName);
+
+            ProcessingInstruction pi = f.createProcessingInstruction("target", "data");
+            writeAsEncodedUnicode(pi);
+
+            Namespace ns = f.createNamespace(prefix, uri);
+            writeAsEncodedUnicode(ns);
+
+            Characters characters = f.createCharacters(contents);
+            writeAsEncodedUnicode(characters);
+            // CData
+            Characters cdata = f.createCData(contents);
+            writeAsEncodedUnicode(cdata);
+
+            // Attribute
+            QName attrName = new QName("http://test.com", "attr", "ns");
+            Attribute attr = f.createAttribute(attrName, "value");
+            writeAsEncodedUnicode(attr);
+
+            // prefix, uri, localName
+            EndElement ee = f.createEndElement(prefix, uri, localName);
+            writeAsEncodedUnicode(ee);
+
+            EndDocument ed = f.createEndDocument();
+            writeAsEncodedUnicode(ed);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+
+    }
+
+    /**
+     * DTDEvent instances constructed via event reader are missing the notation
+     * and entity declaration information
+     */
+    @Test
+    public void testDTDEvent() {
+        String XML = "<?xml version='1.0' ?>" + "<!DOCTYPE root [\n" + "<!ENTITY intEnt 'internal'>\n" + "<!ENTITY extParsedEnt SYSTEM 'url:dummy'>\n"
+                + "<!NOTATION notation PUBLIC 'notation-public-id'>\n" + "<!NOTATION notation2 SYSTEM 'url:dummy'>\n"
+                + "<!ENTITY extUnparsedEnt SYSTEM 'url:dummy2' NDATA notation>\n" + "]>" + "<root />";
+
+        try {
+            XMLEventReader er = getReader(XML);
+            XMLEvent evt = er.nextEvent(); // StartDocument
+            evt = er.nextEvent(); // DTD
+            if (evt.getEventType() != XMLStreamConstants.DTD) {
+                Assert.fail("Expected DTD event");
+            }
+            DTD dtd = (DTD) evt;
+            writeAsEncodedUnicode(dtd);
+            List entities = dtd.getEntities();
+            if (entities == null) {
+                Assert.fail("No entity found. Expected 3.");
+            } else {
+                writeAsEncodedUnicode((XMLEvent) entities.get(0));
+                writeAsEncodedUnicode((XMLEvent) entities.get(1));
+                writeAsEncodedUnicode((XMLEvent) entities.get(2));
+            }
+
+            List notations = dtd.getNotations();
+            if (notations == null) {
+                Assert.fail("No notation found. Expected 2.");
+            } else {
+                writeAsEncodedUnicode((XMLEvent) notations.get(0));
+                writeAsEncodedUnicode((XMLEvent) notations.get(1));
+            }
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    private XMLEventReader getReader(String XML) throws Exception {
+        inputFactory = XMLInputFactory.newInstance();
+
+        // Check if event reader returns the correct event
+        XMLEventReader er = inputFactory.createXMLEventReader(new StringReader(XML));
+        return er;
+    }
+
+
+
+    /**
+     * The return of XMLEvent writeAsEncodedUnicode method is not defined This
+     * method merely tests that the output exists
+     */
+    public void writeAsEncodedUnicode(XMLEvent evt) throws XMLStreamException {
+        if (evt.getEventType() == XMLStreamConstants.END_DOCUMENT) {
+            return;
+        }
+        StringWriter sw = new StringWriter();
+        evt.writeAsEncodedUnicode(sw);
+
+        Assert.assertTrue(sw.toString().length() > 0);
+        System.out.println(sw.toString());
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue48Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue48Test.java
new file mode 100644
index 00000000000..b10b6cd92c0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue48Test.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.Events;
+
+import java.io.StringReader;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.events.DTD;
+import javax.xml.stream.events.EntityDeclaration;
+import javax.xml.stream.events.NotationDeclaration;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6620632
+ * @summary Test XMLEventReader can parse notation and entity information from DTD Event.
+ */
+public class Issue48Test {
+
+    public java.io.File input;
+    public final String filesDir = "./";
+    protected XMLInputFactory inputFactory;
+    protected XMLOutputFactory outputFactory;
+
+    /**
+     * DTDEvent instances constructed via event reader are missing the notation
+     * and entity declaration information
+     */
+    @Test
+    public void testDTDEvent() {
+        String XML = "<?xml version='1.0' ?>" + "<!DOCTYPE root [\n" + "<!ENTITY intEnt 'internal'>\n" + "<!ENTITY extParsedEnt SYSTEM 'url:dummy'>\n"
+                + "<!NOTATION notation PUBLIC 'notation-public-id'>\n" + "<!NOTATION notation2 SYSTEM 'url:dummy'>\n"
+                + "<!ENTITY extUnparsedEnt SYSTEM 'url:dummy2' NDATA notation>\n" + "]>" + "<root />";
+
+        try {
+            XMLEventReader er = getReader(XML);
+            XMLEvent evt = er.nextEvent(); // StartDocument
+            evt = er.nextEvent(); // DTD
+            if (evt.getEventType() != XMLStreamConstants.DTD) {
+                Assert.fail("Expected DTD event");
+            }
+            DTD dtd = (DTD) evt;
+            List entities = dtd.getEntities();
+            if (entities == null) {
+                Assert.fail("No entity found. Expected 3.");
+            } else {
+                Assert.assertEquals(entities.size(), 3);
+            }
+            // Let's also verify they are all of right type...
+            testListElems(entities, EntityDeclaration.class);
+
+            List notations = dtd.getNotations();
+            if (notations == null) {
+                Assert.fail("No notation found. Expected 2.");
+            } else {
+                Assert.assertEquals(notations.size(), 2);
+            }
+            // Let's also verify they are all of right type...
+            testListElems(notations, NotationDeclaration.class);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    private XMLEventReader getReader(String XML) throws Exception {
+        inputFactory = XMLInputFactory.newInstance();
+
+        // Check if event reader returns the correct event
+        XMLEventReader er = inputFactory.createXMLEventReader(new StringReader(XML));
+        return er;
+    }
+
+
+    private void testListElems(List l, Class expType) {
+        Iterator it = l.iterator();
+        while (it.hasNext()) {
+            Object o = it.next();
+            Assert.assertNotNull(o);
+            Assert.assertTrue(expType.isAssignableFrom(o.getClass()));
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue53Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue53Test.java
new file mode 100644
index 00000000000..c9c1deeac13
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue53Test.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.Events;
+
+import javax.xml.stream.XMLEventFactory;
+import javax.xml.stream.events.StartDocument;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test encodingSet/standaloneSet returns correct result in case encoding/standalone is set when constructing StartDocument.
+ */
+public class Issue53Test {
+
+    @Test
+    public void testEncodingSet() {
+        XMLEventFactory f = XMLEventFactory.newInstance();
+
+        try {
+            StartDocument sd = f.createStartDocument("UTF-8");
+            System.out.println("Encoding: " + sd.getCharacterEncodingScheme());
+            System.out.println("Encoding set: " + sd.encodingSet());
+            Assert.assertTrue(sd.encodingSet(), "encoding is set, should return true.");
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+
+    }
+
+    @Test
+    public void testStandaloneSet() {
+        XMLEventFactory f = XMLEventFactory.newInstance();
+
+        try {
+            StartDocument sd = f.createStartDocument("UTF-8", "1.0", true);
+            System.out.println(sd.isStandalone());
+            System.out.println(sd.standaloneSet());
+            Assert.assertTrue(sd.standaloneSet(), "standalone is set, should return true.");
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue58Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue58Test.java
new file mode 100644
index 00000000000..30ce60028dd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/Events/Issue58Test.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.Events;
+
+import java.io.StringReader;
+
+import javax.xml.stream.Location;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLEvent.getLocation() returns a non-volatile Location.
+ */
+public class Issue58Test {
+
+    public java.io.File input;
+    public final String filesDir = "./";
+    protected XMLInputFactory inputFactory;
+    protected XMLOutputFactory outputFactory;
+
+    @Test
+    public void testLocation() {
+        String XML = "<?xml version='1.0' ?>" + "<!DOCTYPE root [\n" + "<!ENTITY intEnt 'internal'>\n" + "<!ENTITY extParsedEnt SYSTEM 'url:dummy'>\n"
+                + "<!NOTATION notation PUBLIC 'notation-public-id'>\n" + "<!NOTATION notation2 SYSTEM 'url:dummy'>\n"
+                + "<!ENTITY extUnparsedEnt SYSTEM 'url:dummy2' NDATA notation>\n" + "]>\n" + "<root />";
+
+        try {
+            XMLEventReader er = getReader(XML);
+            XMLEvent evt = er.nextEvent(); // StartDocument
+            Location loc1 = evt.getLocation();
+            System.out.println("Location 1: " + loc1.getLineNumber() + "," + loc1.getColumnNumber());
+            evt = er.nextEvent(); // DTD
+            // loc1 should not change so its line number should still be 1
+            Assert.assertTrue(loc1.getLineNumber() == 1);
+            Location loc2 = evt.getLocation();
+            System.out.println("Location 2: " + loc2.getLineNumber() + "," + loc2.getColumnNumber());
+            evt = er.nextEvent(); // root
+            System.out.println("Location 1: " + loc1.getLineNumber() + "," + loc1.getColumnNumber());
+            Assert.assertTrue(loc1.getLineNumber() == 1);
+            Assert.assertTrue(loc2.getLineNumber() == 7);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    private XMLEventReader getReader(String XML) throws Exception {
+        inputFactory = XMLInputFactory.newInstance();
+
+        // Check if event reader returns the correct event
+        XMLEventReader er = inputFactory.createXMLEventReader(new StringReader(XML));
+        return er;
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/FactoryFindTest.java
new file mode 100644
index 00000000000..555c8a8a565
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/FactoryFindTest.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLClassLoader;
+import java.util.Properties;
+
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test SaTX factory using factory property and using ContextClassLoader.
+ */
+public class FactoryFindTest {
+
+    boolean myClassLoaderUsed = false;
+
+    final static String FACTORY_KEY = "javax.xml.stream.XMLInputFactory";
+
+    @BeforeClass
+    public void setup(){
+        policy.PolicyUtil.changePolicy(getClass().getResource("FactoryFindTest.policy").getFile());
+    }
+
+    @Test
+    public void testFactoryFindUsingStaxProperties() {
+        // If property is defined, will take precendence so this test
+        // is ignored :(
+        if (System.getProperty(FACTORY_KEY) != null) {
+            return;
+        }
+
+        Properties props = new Properties();
+        String configFile = System.getProperty("java.home") + File.separator + "lib" + File.separator + "stax.properties";
+
+        File f = new File(configFile);
+        if (f.exists()) {
+            try {
+                FileInputStream fis = new FileInputStream(f);
+                props.load(fis);
+                fis.close();
+            } catch (FileNotFoundException e) {
+                return;
+            } catch (IOException e) {
+                return;
+            }
+        } else {
+            props.setProperty(FACTORY_KEY, "com.sun.xml.internal.stream.XMLInputFactoryImpl");
+            try {
+                FileOutputStream fos = new FileOutputStream(f);
+                props.store(fos, null);
+                fos.close();
+                f.deleteOnExit();
+            } catch (FileNotFoundException e) {
+                return;
+            } catch (IOException e) {
+                return;
+            }
+        }
+
+        XMLInputFactory factory = XMLInputFactory.newInstance();
+        Assert.assertTrue(factory.getClass().getName().equals(props.getProperty(FACTORY_KEY)));
+    }
+
+    @Test
+    public void testFactoryFind() {
+        try {
+            // System.setProperty("jaxp.debug", "true");
+
+            XMLInputFactory factory = XMLInputFactory.newInstance();
+            Assert.assertTrue(factory.getClass().getClassLoader() == null);
+
+            Thread.currentThread().setContextClassLoader(null);
+            factory = XMLInputFactory.newInstance();
+            Assert.assertTrue(factory.getClass().getClassLoader() == null);
+
+            Thread.currentThread().setContextClassLoader(new MyClassLoader());
+            factory = XMLInputFactory.newInstance();
+            if (System.getSecurityManager() == null)
+                Assert.assertTrue(myClassLoaderUsed);
+            else
+                Assert.assertFalse(myClassLoaderUsed);
+
+            XMLOutputFactory ofactory = XMLOutputFactory.newInstance();
+            Assert.assertTrue(ofactory.getClass().getClassLoader() == null);
+
+            Thread.currentThread().setContextClassLoader(null);
+            ofactory = XMLOutputFactory.newInstance();
+            Assert.assertTrue(ofactory.getClass().getClassLoader() == null);
+
+            Thread.currentThread().setContextClassLoader(new MyClassLoader());
+            ofactory = XMLOutputFactory.newInstance();
+            if (System.getSecurityManager() == null)
+                Assert.assertTrue(myClassLoaderUsed);
+            else
+                Assert.assertFalse(myClassLoaderUsed);
+        } catch (Exception ex) {
+            throw new RuntimeException(ex);
+        }
+    }
+
+    class MyClassLoader extends URLClassLoader {
+
+        public MyClassLoader() {
+            super(new URL[0]);
+        }
+
+        public Class loadClass(String name) throws ClassNotFoundException {
+            myClassLoaderUsed = true;
+            return super.loadClass(name);
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/FactoryFindTest.policy b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/FactoryFindTest.policy
new file mode 100644
index 00000000000..8e53b53169e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/FactoryFindTest.policy
@@ -0,0 +1,23 @@
+grant {
+	permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+	permission java.lang.RuntimePermission "accessDeclaredMembers";
+	
+	permission java.io.FilePermission "${test.classes}/../../-", "read, write, delete";
+	permission java.io.FilePermission ".", "read, write, delete";
+	permission java.util.PropertyPermission "*", "read, write";
+	
+    permission java.lang.RuntimePermission "setSecurityManager";
+    permission java.lang.RuntimePermission "createSecurityManager";
+    permission java.lang.RuntimePermission "createClassLoader";
+    permission java.lang.RuntimePermission "setIO";
+	permission java.lang.RuntimePermission "setContextClassLoader"; 
+	permission java.security.SecurityPermission "getPolicy";
+    
+    permission java.io.FilePermission "${test.src}/-", "read, write, delete";
+    permission java.io.FilePermission "${user.dir}/-", "read, write, delete";
+    permission java.io.FilePermission "${java.io.tmpdir}/-", "read, write, delete";
+    
+    
+    permission java.io.FilePermission "${java.home}/lib/stax.properties", "read, write, delete";
+
+};
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/IgnoreExternalDTDTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/IgnoreExternalDTDTest.java
new file mode 100644
index 00000000000..79b6c89603c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/IgnoreExternalDTDTest.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream;
+
+import java.io.StringReader;
+
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test feature ignore-external-dtd.
+ */
+public class IgnoreExternalDTDTest {
+
+    final static String FACTORY_KEY = "javax.xml.stream.XMLInputFactory";
+    static final String IGNORE_EXTERNAL_DTD = "ignore-external-dtd";
+    static final String ZEPHYR_PROPERTY_PREFIX = "http://java.sun.com/xml/stream/properties/";
+
+    @Test
+    public void testFeaturePositive() throws Exception {
+        XMLInputFactory xif = XMLInputFactory.newInstance();
+        xif.setProperty(ZEPHYR_PROPERTY_PREFIX + IGNORE_EXTERNAL_DTD, Boolean.TRUE);
+        parse(xif);
+    }
+
+    @Test
+    public void testFeatureNegative() throws Exception {
+        XMLInputFactory xif = XMLInputFactory.newInstance();
+        xif.setProperty(ZEPHYR_PROPERTY_PREFIX + IGNORE_EXTERNAL_DTD, Boolean.FALSE);
+        try {
+            parse(xif);
+            // refer to 6440324, absent of that change, an exception would be
+            // thrown;
+            // due to the change made for 6440324, parsing will continue without
+            // exception
+            // fail();
+        } catch (XMLStreamException e) {
+            // the error is expected that no DTD was found
+        }
+    }
+
+    private void parse(XMLInputFactory xif) throws XMLStreamException {
+        XMLStreamReader xsr = xif.createXMLStreamReader(new StringReader("<?xml version='1.0'?><!DOCTYPE root PUBLIC 'abc' 'def'><abc />"));
+        while (xsr.next() != XMLStreamConstants.END_DOCUMENT)
+            ;
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/ProcessingInstruction/ProcessingInstructionTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/ProcessingInstruction/ProcessingInstructionTest.java
new file mode 100644
index 00000000000..9dc297f9761
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/ProcessingInstruction/ProcessingInstructionTest.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.ProcessingInstruction;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamReader parses Processing Instruction.
+ */
+public class ProcessingInstructionTest {
+
+    @Test
+    public void testPITargetAndData() {
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            String PITarget = "soffice";
+            String PIData = "WebservicesArchitecture";
+            String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<?" + PITarget + " " + PIData + "?>" + "<foo></foo>";
+            // System.out.println("XML = " + xml) ;
+            InputStream is = new java.io.ByteArrayInputStream(xml.getBytes());
+            XMLStreamReader sr = xif.createXMLStreamReader(is);
+            while (sr.hasNext()) {
+                int eventType = sr.next();
+                if (eventType == XMLStreamConstants.PROCESSING_INSTRUCTION) {
+                    String target = sr.getPITarget();
+                    String data = sr.getPIData();
+                    Assert.assertTrue(target.equals(PITarget) && data.equals(PIData));
+                }
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/StreamReaderDelegateTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/StreamReaderDelegateTest.java
new file mode 100644
index 00000000000..b1f76f9672b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/StreamReaderDelegateTest.java
@@ -0,0 +1,374 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.Iterator;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.util.StreamReaderDelegate;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test StreamReaderDelegate.
+ */
+public class StreamReaderDelegateTest {
+
+    /**
+     * Tested xml file looks as below: <?xml version="1.0" standalone="no" ?>
+     * <ns1:foo attr1="defaultAttr1" ns1:attr1="ns1Attr1" ns2:attr1="ns2Attr1"
+     * attr2="defaultAttr2" attr3="defaultAttr3" xmlns:ns1="http://ns1.java.com"
+     * xmlns:ns2="http://ns2.java.com"> <!--description--> content text
+     * <![CDATA[<greeting>Hello</greeting>]]> other content </ns1:foo>
+     **/
+    @Test
+    public void testAttribute() {
+        StreamReaderDelegate delegate = null;
+        try {
+            System.out.println("===in testAttribute()===");
+            XMLInputFactory ifac = XMLInputFactory.newFactory();
+            XMLStreamReader reader = ifac.createXMLStreamReader(new FileInputStream(new File(getClass().getResource("testfile1.xml").getFile())));
+            delegate = new StreamReaderDelegate(reader);
+
+            Assert.assertTrue(delegate.standaloneSet());
+            Assert.assertFalse(delegate.isStandalone());
+            while (delegate.hasNext()) {
+                delegate.next();
+                if (delegate.getEventType() == XMLStreamConstants.START_ELEMENT || delegate.getEventType() == XMLStreamConstants.ATTRIBUTE) {
+                    if (delegate.getLocalName().equals("foo")) {
+                        Assert.assertTrue(delegate.getAttributeCount() == 5);
+                        Assert.assertTrue(delegate.getAttributeType(1) == "CDATA");
+
+                        Assert.assertTrue(delegate.getAttributeValue(0).equals("defaultAttr1"));
+                        Assert.assertTrue(delegate.getAttributeValue(delegate.getAttributeCount() - 2).equals("defaultAttr2"));
+                        Assert.assertTrue(delegate.getAttributeValue(delegate.getAttributeCount() - 1).equals("defaultAttr3"));
+
+                        Assert.assertTrue(delegate.getAttributeValue("http://ns1.java.com", "attr1").equals("ns1Attr1"));
+                        Assert.assertTrue(delegate.getAttributeValue("http://ns2.java.com", "attr1").equals("ns2Attr1"));
+
+                        Assert.assertTrue(delegate.getAttributeValue(null, "attr2").equals("defaultAttr2"));
+                        Assert.assertTrue(delegate.getAttributeValue(null, "attr3").equals("defaultAttr3"));
+
+                        Assert.assertTrue(delegate.getAttributeNamespace(0) == null);
+                        Assert.assertTrue(delegate.getAttributeNamespace(1).equals("http://ns1.java.com"));
+                        Assert.assertTrue(delegate.getAttributePrefix(1).equals("ns1"));
+                        Assert.assertTrue(delegate.getAttributeName(1).toString()
+                                .equals("{" + delegate.getAttributeNamespace(1) + "}" + delegate.getAttributeLocalName(1)));
+                        Assert.assertTrue(delegate.getAttributeLocalName(1).equals("attr1"));
+
+                        // negative test. Should return null for out of
+                        // attribute array index
+                        Assert.assertTrue(delegate.getAttributeNamespace(delegate.getAttributeCount()) == null);
+                        Assert.assertTrue(delegate.getAttributePrefix(delegate.getAttributeCount()) == null);
+                        Assert.assertTrue(delegate.getAttributeName(delegate.getAttributeCount()) == null);
+                        Assert.assertTrue(delegate.getAttributeLocalName(delegate.getAttributeCount()) == null);
+                        Assert.assertTrue(delegate.getAttributeType(delegate.getAttributeCount()) == null);
+                    }
+                } else {
+                    try {
+                        delegate.getAttributeCount();
+                    } catch (IllegalStateException e) {
+                        System.out.println("expected exception for incorrect event type");
+                    }
+                }
+
+            }
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+            Assert.fail("FileNotFoundException in testAttribute()");
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            System.out.println(delegate.getLocation());
+            Assert.fail("XMLStreamException in testAttribute()");
+        } catch (FactoryConfigurationError e) {
+            e.printStackTrace();
+            Assert.fail("FactoryConfigurationError in testAttribute()");
+        } finally {
+            try {
+                delegate.close();
+            } catch (XMLStreamException e) {
+                e.printStackTrace();
+                Assert.fail("XMLStreamException in testAttribute()");
+            }
+        }
+    }
+
+    /**
+     * Tested xml file looks as below: <?xml version="1.0" encoding="UTF-8"?>
+     * <ns1:foo xmlns:ns="http://ns1.java.com" xmlns:ns1="http://ns1.java.com"
+     * xmlns:ns2="http://ns2.java.com" > <!--description-->content text
+     * <![CDATA[<greeting>Hello</greeting>]]> other content </ns1:foo>
+     **/
+    @Test
+    public void testNamespace() {
+        StreamReaderDelegate delegate = null;
+        try {
+            System.out.println("===in testNamespace()===");
+            XMLStreamReader reader = XMLInputFactory.newFactory().createXMLStreamReader(
+                    new FileInputStream(new File(getClass().getResource("testfile2.xml").getFile())));
+            delegate = new StreamReaderDelegate();
+            delegate.setParent(reader);
+            while (delegate.hasNext()) {
+                delegate.next();
+                if (delegate.getEventType() == XMLStreamConstants.START_ELEMENT || delegate.getEventType() == XMLStreamConstants.ATTRIBUTE) {
+
+                    if (delegate.getName().getLocalPart().equals("foo")) {
+                        Assert.assertTrue(("{" + delegate.getNamespaceURI(delegate.getPrefix()) + "}" + delegate.getLocalName()).equals(delegate.getName()
+                                .toString()));
+                        System.out.println(delegate.getLocation());
+
+                        Assert.assertTrue(delegate.getNamespaceCount() == 3);
+                        Assert.assertTrue(delegate.getNamespaceURI().equals("http://ns1.java.com"));
+                        Assert.assertTrue(delegate.getNamespaceURI(2).equals("http://ns2.java.com"));
+                        Assert.assertTrue(delegate.getNamespaceURI("ns").equals("http://ns1.java.com"));
+
+                        Assert.assertTrue(delegate.getNamespacePrefix(1).equals("ns1"));
+
+                        NamespaceContext nsCtx = delegate.getNamespaceContext();
+                        nsCtx.getNamespaceURI("ns");
+                        Iterator prefixes = nsCtx.getPrefixes("http://ns1.java.com");
+                        boolean hasns = false;
+                        boolean hasns1 = false;
+                        while (prefixes.hasNext()) {
+                            String prefix = (String) prefixes.next();
+                            if (prefix.equals("ns")) {
+                                hasns = true;
+                            } else if (prefix.equals("ns1")) {
+                                hasns1 = true;
+                            }
+                        }
+                        Assert.assertTrue(hasns && hasns1);
+                    }
+                }
+            }
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+            Assert.fail("FileNotFoundException in testNamespace()");
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            System.out.println(delegate.getLocation());
+            Assert.fail("XMLStreamException in testNamespace()");
+        } catch (FactoryConfigurationError e) {
+            e.printStackTrace();
+            Assert.fail("FactoryConfigurationError in testNamespace()");
+        } finally {
+            try {
+                delegate.close();
+            } catch (XMLStreamException e) {
+                e.printStackTrace();
+                Assert.fail("XMLStreamException in testNamespace()");
+            }
+        }
+    }
+
+    /**
+     * <?xml version="1.0" encoding="utf-8" ?> <ns1:foo
+     * xmlns:ns1="http://ns1.java.com" xmlns:ns2="http://ns2.java.com">
+     * <!--description--> content text <![CDATA[<greeting>Hello</greeting>]]>
+     * other content </ns1:foo>
+     **/
+    @Test
+    public void testText() {
+        String property = "javax.xml.stream.isCoalescing";
+        System.out.println("===in testText()====");
+        StreamReaderDelegate delegate = null;
+        try {
+            XMLInputFactory ifac = XMLInputFactory.newFactory();
+            ifac.setProperty(property, Boolean.TRUE);
+            XMLStreamReader reader = ifac.createXMLStreamReader(new FileInputStream(new File(getClass().getResource("testfile3.xml").getFile())), "iso8859-1");
+            delegate = new StreamReaderDelegate();
+            delegate.setParent(reader);
+
+            Assert.assertTrue(delegate.getParent().equals(reader));
+            Assert.assertTrue(delegate.getProperty(property).equals(Boolean.TRUE));
+            Assert.assertTrue(delegate.getCharacterEncodingScheme().equalsIgnoreCase("utf-8"));
+            Assert.assertTrue(delegate.getEncoding().equalsIgnoreCase("iso8859-1"));
+            Assert.assertTrue(delegate.getVersion().equals("1.0"));
+            while (delegate.hasNext()) {
+                delegate.next();
+                if (delegate.getEventType() == XMLStreamConstants.CHARACTERS) {
+                    char[] target1 = new char[delegate.getTextLength()];
+                    delegate.getTextCharacters(delegate.getTextStart(), target1, 0, target1.length);
+                    char[] target2 = delegate.getTextCharacters();
+
+                    Assert.assertTrue(delegate.getText().trim().equals(new String(target1).trim()));
+                    Assert.assertTrue(delegate.getText().trim().equals(new String(target2).trim()));
+                }
+            }
+
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+            Assert.fail("FileNotFoundException in testText()");
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            System.out.println(delegate.getLocation());
+            Assert.fail("XMLStreamException in testText()");
+        } catch (FactoryConfigurationError e) {
+            e.printStackTrace();
+            Assert.fail("FactoryConfigurationError in testText()");
+        } finally {
+            try {
+                delegate.close();
+            } catch (XMLStreamException e) {
+                e.printStackTrace();
+                Assert.fail("XMLStreamException in testText()");
+            }
+        }
+    }
+
+    @Test
+    public void testWhiteSpace() {
+        System.out.println("===in testWhiteSpace()===");
+        StreamReaderDelegate delegate = null;
+        try {
+            XMLInputFactory ifac = XMLInputFactory.newFactory();
+            ifac.setProperty("javax.xml.stream.isCoalescing", Boolean.TRUE);
+            XMLStreamReader reader = ifac.createXMLStreamReader(new FileInputStream(new File(getClass().getResource("testfile4.xml").getFile())));
+
+            delegate = new StreamReaderDelegate();
+            delegate.setParent(reader);
+            while (delegate.hasNext()) {
+                int i = delegate.next();
+                switch (i) {
+                    case XMLStreamConstants.CHARACTERS: {
+                        Assert.assertTrue(delegate.isCharacters());
+                        Assert.assertTrue(delegate.hasText());
+                        Assert.assertTrue(delegate.isWhiteSpace());
+                        break;
+                    }
+                    case XMLStreamConstants.START_ELEMENT: {
+                        Assert.assertTrue(delegate.isStartElement());
+                        Assert.assertTrue(delegate.isAttributeSpecified(0));
+                        Assert.assertTrue(delegate.hasName());
+                        delegate.require(XMLStreamConstants.START_ELEMENT, delegate.getNamespaceURI(), delegate.getLocalName());
+                        break;
+                    }
+                    case XMLStreamConstants.END_ELEMENT: {
+                        Assert.assertTrue(delegate.isEndElement());
+                        Assert.assertTrue(delegate.hasName());
+                        delegate.require(XMLStreamConstants.END_ELEMENT, delegate.getNamespaceURI(), delegate.getLocalName());
+                        break;
+                    }
+                }
+            }
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+            Assert.fail("FileNotFoundException in testWhiteSpace()");
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            System.out.println(delegate.getLocation());
+            Assert.fail("XMLStreamException in testWhiteSpace()");
+        } catch (FactoryConfigurationError e) {
+            e.printStackTrace();
+            Assert.fail("FactoryConfigurationError in testWhiteSpace()");
+        } finally {
+            try {
+                delegate.close();
+            } catch (XMLStreamException e) {
+                e.printStackTrace();
+                Assert.fail("XMLStreamException in testWhitespace()");
+            }
+        }
+
+    }
+
+    @Test
+    public void testElementText() {
+        System.out.println("===in testElementText()===");
+        StreamReaderDelegate delegate = null;
+        try {
+            XMLInputFactory ifac = XMLInputFactory.newFactory();
+            XMLStreamReader reader = ifac.createXMLStreamReader(new FileInputStream(new File(getClass().getResource("toys.xml").getFile())));
+
+            delegate = new StreamReaderDelegate();
+            delegate.setParent(reader);
+            while (delegate.hasNext()) {
+                if (delegate.getEventType() == XMLStreamConstants.START_ELEMENT) {
+                    if (delegate.getLocalName().equals("name") || delegate.getLocalName().equals("price")) {
+                        System.out.println(delegate.getElementText());
+                    }
+                    delegate.nextTag();
+                } else {
+                    delegate.next();
+                }
+            }
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+            Assert.fail("FileNotFoundException in testElementText()");
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            System.out.println(delegate.getLocation());
+            Assert.fail("XMLStreamException in testElementText()");
+        } catch (FactoryConfigurationError e) {
+            e.printStackTrace();
+            Assert.fail("FactoryConfigurationError in testElementText()");
+        } finally {
+            try {
+                delegate.close();
+            } catch (XMLStreamException e) {
+                e.printStackTrace();
+                Assert.fail("XMLStreamException in testElementText()");
+            }
+        }
+    }
+
+    @Test
+    public void testPITargetAndData() {
+        System.out.println("===in testPITargetAndData()===");
+        StreamReaderDelegate delegate = null;
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            String PITarget = "soffice";
+            String PIData = "WebservicesArchitecture";
+            String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<?" + PITarget + " " + PIData + "?>" + "<foo></foo>";
+            InputStream is = new java.io.ByteArrayInputStream(xml.getBytes());
+            XMLStreamReader sr = xif.createXMLStreamReader(is);
+            delegate = new StreamReaderDelegate(sr);
+            while (delegate.hasNext()) {
+                int eventType = delegate.next();
+                if (eventType == XMLStreamConstants.PROCESSING_INSTRUCTION) {
+                    String target = delegate.getPITarget();
+                    String data = delegate.getPIData();
+                    Assert.assertTrue(target.equals(PITarget));
+                    Assert.assertTrue(data.equals(PIData));
+                }
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail("Exception in testPITargetAndData()");
+        } finally {
+            try {
+                delegate.close();
+            } catch (XMLStreamException e) {
+                e.printStackTrace();
+                Assert.fail("XMLStreamException in testPITargetAndData()");
+            }
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventLocationTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventLocationTest.java
new file mode 100644
index 00000000000..eccc7ff7d0c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventLocationTest.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream;
+
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLEvent Location.
+ */
+public class XMLEventLocationTest {
+
+    @Test
+    public void testNonNullLocation() {
+        XMLEventFactory factory = XMLEventFactory.newInstance();
+        XMLEvent event = factory.createComment("some comment");
+        Assert.assertNotNull(event.getLocation());
+    }
+
+    @Test
+    public void testSetLocation() {
+        XMLEventFactory factory = XMLEventFactory.newInstance();
+        Location loc = new MyLocation();
+        factory.setLocation(loc);
+        XMLEvent event = factory.createComment("some comment");
+        Assert.assertEquals(event.getLocation().getLineNumber(), 15);
+    }
+
+    class MyLocation implements Location {
+        public MyLocation() {
+        }
+
+        public int getCharacterOffset() {
+            return 5;
+        }
+
+        public int getColumnNumber() {
+            return 10;
+        }
+
+        public int getLineNumber() {
+            return 15;
+        }
+
+        public String getPublicId() {
+            return "-//My//DTD Public Id//EN";
+        }
+
+        public String getSystemId() {
+            return "http://example.org/system/id";
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6489890.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6489890.java
new file mode 100644
index 00000000000..84a49f956c4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6489890.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLEventReaderTest;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6489890
+ * @summary Test XMLEventReader's initial state is an undefined state, and nextEvent() is START_DOCUMENT.
+ */
+public class Bug6489890 {
+
+    @Test
+    public void test0() {
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+
+            XMLStreamReader xsr = xif.createXMLStreamReader(getClass().getResource("sgml.xml").toString(), getClass().getResourceAsStream("sgml.xml"));
+
+            XMLEventReader xer = xif.createXMLEventReader(xsr);
+
+            Assert.assertTrue(xer.peek().getEventType() == XMLEvent.START_DOCUMENT);
+            Assert.assertTrue(xer.peek() == xer.nextEvent());
+            xsr.close();
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void test1() {
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+
+            XMLStreamReader xsr = xif.createXMLStreamReader(getClass().getResource("sgml.xml").toString(), getClass().getResourceAsStream("sgml.xml"));
+
+            XMLEventReader xer = xif.createXMLEventReader(xsr);
+
+            Assert.assertTrue(xer.nextEvent().getEventType() == XMLEvent.START_DOCUMENT);
+            xsr.close();
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6555001.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6555001.java
new file mode 100644
index 00000000000..dfd95e3aca2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6555001.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package javax.xml.stream.XMLEventReaderTest;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.events.EntityReference;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6555001
+ * @summary Test StAX parser replaces the entity reference as setting.
+ */
+public class Bug6555001 {
+    private static final String XML = "" + "<!DOCTYPE doc SYSTEM 'file:///tmp/this/does/not/exist/but/that/is/ok' [" + "<!ENTITY def '<para/>'>" + "]>"
+            + "<doc>&def;&undef;</doc>";
+
+    @Test
+    public void testReplacing() throws Exception {
+        XMLInputFactory factory = XMLInputFactory.newInstance();
+        factory.setProperty("javax.xml.stream.isReplacingEntityReferences", true);
+
+        StringReader sr = new StringReader(XML);
+        XMLEventReader reader = factory.createXMLEventReader(sr);
+
+        boolean sawUndef = false;
+        boolean sawDef = false;
+
+        while (reader.hasNext()) {
+            XMLEvent event = reader.nextEvent();
+            // System.out.println("Event: " + event);
+            if (event.isEntityReference()) {
+                EntityReference ref = (EntityReference) event;
+                if ("def".equals(ref.getName())) {
+                    sawDef = true;
+                } else if ("undef".equals(ref.getName())) {
+                    sawUndef = true;
+                } else {
+                    throw new IllegalArgumentException("Unexpected entity name");
+                }
+            }
+        }
+
+        Assert.assertEquals(false, sawDef);
+        Assert.assertEquals(true, sawUndef);
+        reader.close();
+    }
+
+    @Test
+    public void testNotReplacing() throws Exception {
+        XMLInputFactory factory = XMLInputFactory.newInstance();
+        factory.setProperty("javax.xml.stream.isReplacingEntityReferences", false);
+
+        StringReader sr = new StringReader(XML);
+        XMLEventReader reader = factory.createXMLEventReader(sr);
+
+        boolean sawUndef = false;
+        boolean sawDef = false;
+
+        while (reader.hasNext()) {
+            XMLEvent event = reader.nextEvent();
+            // System.out.println("Event: " + event);
+            if (event.isEntityReference()) {
+                EntityReference ref = (EntityReference) event;
+                if ("def".equals(ref.getName())) {
+                    sawDef = true;
+                } else if ("undef".equals(ref.getName())) {
+                    sawUndef = true;
+                } else {
+                    throw new IllegalArgumentException("Unexpected entity name");
+                }
+            }
+        }
+
+        Assert.assertEquals(true, sawDef);
+        Assert.assertEquals(true, sawUndef);
+        reader.close();
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6586466Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6586466Test.java
new file mode 100644
index 00000000000..c3484426bad
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6586466Test.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLEventReaderTest;
+
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import java.io.ByteArrayInputStream;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.XMLEvent;
+
+/*
+ * @bug 6586466
+ * @summary Test XMLEventReader.nextTag() shall update internal event state.
+ */
+public class Bug6586466Test {
+
+    @Test
+    public void test() {
+        String xmlData = "<?xml version=\"1.0\"?><Test>Hello</Test>";
+        try {
+            XMLEventReader xmlReader = XMLInputFactory.newInstance().createXMLEventReader(new ByteArrayInputStream(xmlData.getBytes()));
+
+            XMLEvent event = xmlReader.nextEvent();
+            System.out.println(event.getClass());
+
+            // xmlReader.peek(); // error in both cases with/without peek()
+            event = xmlReader.nextTag(); // nextEvent() would work fine
+            // nextTag() forgets to set fLastEvent
+            System.out.println(event.getClass());
+
+            String text = xmlReader.getElementText();
+            System.out.println(text);
+        } catch (XMLStreamException e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6613059Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6613059Test.java
new file mode 100644
index 00000000000..73fe8c4c61e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6613059Test.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLEventReaderTest;
+
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.XMLEvent;
+
+/*
+ * @bug 6613059
+ * @summary Test XMLEventReader.nextTag() shall update internal event state, same as 6586466.
+ */
+public class Bug6613059Test {
+
+    @Test
+    public void test() {
+        String xmlFile = "bug6613059.xml";
+        XMLEventReader xer = null;
+        XMLInputFactory xif = XMLInputFactory.newInstance();
+        try {
+            xer = xif.createXMLEventReader(xif.createXMLStreamReader(getClass().getResource(xmlFile).getFile(), getClass().getResourceAsStream(xmlFile)));
+        } catch (XMLStreamException e) {
+            System.out.println("Error while reading XML: " + e.getClass().getName() + " " + e.getMessage());
+        }
+
+        try {
+            while (xer.hasNext()) {
+                XMLEvent event = xer.nextTag();
+                if (event.isEndElement() && event.asEndElement().getName().equals(new QName("menubar"))) {
+                    break;
+                }
+
+                if (event.asStartElement().getName().equals(new QName("menu"))) {
+                    // nextTag should be used when processing element-only
+                    // content, assuming "addMenu" in
+                    // the user's code handles the menu part properly
+                    addMenu(xer, event);
+                }
+
+            }
+        } catch (XMLStreamException e) {
+            Assert.fail("Exception while reading " + xmlFile + ": " + e.getClass().getName() + " " + e.getMessage());
+        }
+    }
+
+    void addMenu(XMLEventReader xer, XMLEvent event) throws XMLStreamException {
+        // user did not submit this part of code, just jump to the end of menu
+        // element
+        int eventType = 0;
+        while (true) {
+            event = xer.nextEvent();
+            // System.out.println("event: " + event);
+            eventType = event.getEventType();
+            if (eventType == XMLStreamConstants.END_ELEMENT && event.asEndElement().getName().equals(new QName("menu"))) {
+                break;
+            }
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6668115Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6668115Test.java
new file mode 100644
index 00000000000..a66ec748058
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6668115Test.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLEventReaderTest;
+
+import java.io.File;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6668115
+ * @summary Test XMLEventReader.getElementText() shall update last event even if no peek.
+ */
+public class Bug6668115Test {
+
+    public java.io.File input;
+    public final String filesDir = "./";
+    protected XMLInputFactory inputFactory;
+    protected XMLOutputFactory outputFactory;
+
+    /**
+     * The reason the following call sequence is a problem is that with a
+     * peekevent, getElementText calls nextEvent which does properly update the
+     * lastEvent
+     */
+    @Test
+    public void testNextTag() {
+        try {
+            XMLEventReader er = getReader();
+            er.nextTag();
+            er.nextTag();
+
+            System.out.println(er.getElementText());
+            er.nextTag();
+            System.out.println(er.getElementText());
+
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testNextTagWPeek() {
+        try {
+            XMLEventReader er = getReader();
+            er.nextTag();
+            er.nextTag();
+
+            XMLEvent event = er.peek();
+            System.out.println(er.getElementText());
+            er.nextTag();
+            System.out.println(er.getElementText());
+
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    private XMLEventReader getReader() throws Exception {
+        inputFactory = XMLInputFactory.newInstance();
+        input = new File(getClass().getResource("play2.xml").getFile());
+        // Check if event reader returns the correct event
+        XMLEventReader er = inputFactory.createXMLEventReader(inputFactory.createXMLStreamReader(new java.io.FileInputStream(input), "UTF-8"));
+        return er;
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6846133Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6846133Test.java
new file mode 100644
index 00000000000..0470a6bf441
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Bug6846133Test.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLEventReaderTest;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6846133
+ * @summary Test method getDocumentTypeDeclaration() of DTD Event returns a valid value.
+ */
+public class Bug6846133Test {
+    private static final String xml = "<!DOCTYPE html PUBLIC \"-//W3C//DTDXHTML 1.0 Transitional//EN\" "
+            + "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">" + "<html><body><p>I am some simple html</p></body> </html>";
+
+    @Test
+    public void test() {
+        try {
+            javax.xml.stream.XMLInputFactory factory = javax.xml.stream.XMLInputFactory.newInstance();
+            factory.setXMLResolver(new DTDResolver());
+            factory.setProperty(javax.xml.stream.XMLInputFactory.SUPPORT_DTD, true);
+            factory.setProperty(javax.xml.stream.XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, true);
+            java.io.ByteArrayInputStream is = new java.io.ByteArrayInputStream(xml.getBytes("UTF-8"));
+
+            // createXMLEventReader (source) not supported
+            // javax.xml.transform.stream.StreamSource source = new
+            // javax.xml.transform.stream.StreamSource (is);
+            // javax.xml.stream.XMLEventReader reader =
+            // factory.createXMLEventReader (source);
+
+            javax.xml.stream.XMLEventReader reader = factory.createXMLEventReader(is);
+            while (reader.hasNext()) {
+                javax.xml.stream.events.XMLEvent event = reader.nextEvent();
+                if (event.getEventType() == javax.xml.stream.XMLStreamConstants.DTD) {
+                    String temp = ((javax.xml.stream.events.DTD) event).getDocumentTypeDeclaration();
+                    if (temp.length() < 120) {
+                        Assert.fail("DTD truncated");
+                    }
+                    System.out.println(temp);
+                }
+            }
+        } catch (XMLStreamException xe) {
+            Assert.fail(xe.getMessage());
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    class DTDResolver implements javax.xml.stream.XMLResolver {
+        public Object resolveEntity(String arg0, String arg1, String arg2, String arg3) throws XMLStreamException {
+            System.out.println("DTD is parsed");
+            return new java.io.ByteArrayInputStream(new byte[0]);
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Issue40Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Issue40Test.java
new file mode 100644
index 00000000000..48ecebcae90
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/Issue40Test.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLEventReaderTest;
+
+import java.io.File;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLEventReader.getElementText() works after calling peek().
+ */
+public class Issue40Test {
+
+    public java.io.File input;
+    public final String filesDir = "./";
+    protected XMLInputFactory inputFactory;
+    protected XMLOutputFactory outputFactory;
+
+    /**
+     * test without peek
+     */
+    @Test
+    public void testWOPeek() {
+        try {
+            XMLEventReader er = getReader();
+            XMLEvent e = er.nextEvent();
+            Assert.assertEquals(e.getEventType(), XMLStreamConstants.START_DOCUMENT);
+            // we have two start elements in this file
+            Assert.assertEquals(er.nextEvent().getEventType(), XMLStreamConstants.START_ELEMENT);
+            Assert.assertEquals(er.nextEvent().getEventType(), XMLStreamConstants.START_ELEMENT);
+            System.out.println(er.getElementText());
+
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    /**
+     * test with peek
+     */
+    @Test
+    public void testWPeek() {
+        try {
+            XMLEventReader er = getReader();
+            XMLEvent e = er.nextEvent();
+            Assert.assertEquals(e.getEventType(), XMLStreamConstants.START_DOCUMENT);
+            // we have two start elements in this file
+            while (er.peek().getEventType() == XMLStreamConstants.START_ELEMENT) {
+                e = er.nextEvent();
+            }
+            Assert.assertEquals(e.getEventType(), XMLStreamConstants.START_ELEMENT);
+            System.out.println(er.getElementText());
+
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    private XMLEventReader getReader() throws Exception {
+        inputFactory = XMLInputFactory.newInstance();
+        input = new File(getClass().getResource("play.xml").getFile());
+
+        // Check if event reader returns the correct event
+        XMLEventReader er = inputFactory.createXMLEventReader(inputFactory.createXMLStreamReader(new java.io.FileInputStream(input), "UTF-8"));
+        return er;
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/bug6613059.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/bug6613059.xml
new file mode 100644
index 00000000000..320a3cc5780
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/bug6613059.xml
@@ -0,0 +1,20 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<menubar>
+	<menu>
+		<id>file</id>
+		<item>
+			<id>exit</id>
+			<method>doExit 0</method>
+			<type>all</type>
+		</item>
+	</menu>
+	<menu>
+		<id>edit</id>
+		<item>
+			<id>prefs</id>
+			<method>showPrefsWindow 0</method>
+			<type>all</type>
+		</item>
+	</menu>
+</menubar>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/play.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/play.xml
new file mode 100644
index 00000000000..01b659f66d1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/play.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"?><PLAY><TITLE>
+    The Tragedy of Hamlet
+    Prince of Denmark</TITLE></PLAY>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/play2.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/play2.xml
new file mode 100644
index 00000000000..ee6ea4682cd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/play2.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?><PLAY><TITLE>
+         The Tragedy of Hamlet
+         Prince of Denmark
+</TITLE>
+<AUTHOR>
+         William Shakespeare
+</AUTHOR>
+</PLAY>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/sgml.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/sgml.xml
new file mode 100644
index 00000000000..21ecc848893
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventReaderTest/sgml.xml
@@ -0,0 +1,100 @@
+<report>
+<title>Getting started with SGML</title>
+<chapter>
+<title>The business challenge</title>
+<intro>
+<para>With the ever-changing and growing global market, companies and
+ large organizations are searching for ways to become more viable and
+ competitive. Downsizing and other cost-cutting measures demand more
+ efficient use of corporate resources. One very important resource is
+ an organization's information.</para>
+<para>As part of the move toward integrated information management,
+whole industries are developing and implementing standards for
+exchanging technical information. This report describes how one such
+standard, the Standard Generalized Markup Language (SGML), works as
+part of an overall information management strategy.</para>
+<graphic graphname="infoflow"/></intro></chapter>
+<chapter>
+<title>Getting to know SGML</title>
+<intro>
+<para>While SGML is a fairly recent technology, the use of
+<emph>markup</emph> in computer-generated documents has existed for a
+while.</para></intro>
+<section shorttitle="What is markup?">
+<title>What is markup, or everything you always wanted to know about
+document preparation but were afraid to ask?</title>
+<intro>
+<para>Markup is everything in a document that is not content. The
+traditional meaning of markup is the manual <emph>marking</emph> up
+of typewritten text to give instructions for a typesetter or
+compositor about how to fit the text on a page and what typefaces to
+use. This kind of markup is known as <emph>procedural markup</emph>.</para></intro>
+<topic topicid="top1">
+<title>Procedural markup</title>
+<para>Most electronic publishing systems today use some form of
+procedural markup. Procedural markup codes are good for one
+presentation of the information.</para></topic>
+<topic topicid="top2">
+<title>Generic markup</title>
+<para>Generic markup (also known as descriptive markup) describes the
+<emph>purpose</emph> of the text in a document. A basic concept of
+generic markup is that the content of a document must be separate from
+the style. Generic markup allows for multiple presentations of the
+information.</para></topic>
+<topic topicid="top3">
+<title>Drawbacks of procedural markup</title>
+<para>Industries involved in technical documentation increasingly
+prefer generic over procedural markup schemes. When a company changes
+software or hardware systems, enormous data translation tasks arise,
+often resulting in errors.</para></topic></section>
+<section shorttitle="What is SGML?">
+<title>What <emph>is</emph> SGML in the grand scheme of the universe, anyway?</title>
+<intro>
+<para>SGML defines a strict markup scheme with a syntax for defining
+document data elements and an overall framework for marking up
+documents.</para>
+<para>SGML can describe and create documents that are not dependent on
+any hardware, software, formatter, or operating system. Since SGML documents
+conform to an international standard, they are portable.</para></intro></section>
+<section shorttitle="How does SGML work?">
+<title>How is SGML and would you recommend it to your grandmother?</title>
+<intro>
+<para>You can break a typical document into three layers: structure,
+content, and style. SGML works by separating these three aspects and
+deals mainly with the relationship between structure and content.</para></intro>
+<topic topicid="top4">
+<title>Structure</title>
+<para>At the heart of an SGML application is a file called the DTD, or
+Document Type Definition. The DTD sets up the structure of a document,
+much like a database schema describes the types of information it
+handles.</para>
+<para>A database schema also defines the relationships between the
+various types of data. Similarly, a DTD specifies <emph>rules</emph>
+to help ensure documents have a consistent, logical structure.</para></topic>
+<topic topicid="top5">
+<title>Content</title>
+<para>Content is the information itself. The method for identifying
+the information and its meaning within this framework is called
+<emph>tagging</emph>. Tagging must
+conform to the rules established in the DTD (see <xref xrefid="top4"/>).</para>
+<graphic graphname="tagexamp"/></topic>
+<topic topicid="top6">
+<title>Style</title>
+<para>SGML does not standardize style or other processing methods for
+information stored in SGML.</para></topic></section></chapter>
+<chapter>
+<title>Resources</title>
+<section>
+<title>Conferences, tutorials, and training</title>
+<intro>
+<para>The Graphic Communications Association has been
+instrumental in the development of SGML. GCA provides conferences,
+tutorials, newsletters, and publication sales for both members and
+non-members.</para>
+<para security="c">Exiled members of the former Soviet Union's secret
+police, the KGB, have infiltrated the upper ranks of the GCA and are
+planning the Final Revolution as soon as DSSSL is completed.</para>
+</intro>
+</section>
+</chapter>
+</report>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.java
new file mode 100644
index 00000000000..9c2df037342
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLEventWriterTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import javax.xml.stream.XMLEventFactory;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLEventWriter.
+ */
+public class ReaderToWriterTest {
+
+    private static final XMLEventFactory XML_EVENT_FACTORY = XMLEventFactory.newInstance();
+    private static final XMLInputFactory XML_INPUT_FACTORY = XMLInputFactory.newInstance();
+    private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance();
+
+    private static final String INPUT_FILE = "W2JDLR4002TestService.wsdl.data";
+    private static final String OUTPUT_FILE = "Encoded.wsdl";
+
+    /**
+     * Unit test for writing namespaces when namespaceURI == null.
+     */
+    @Test
+    public void testWriteNamespace() {
+
+        /** Platform default encoding. */
+        final String DEFAULT_CHARSET = java.nio.charset.Charset.defaultCharset().name();
+        System.out.println("DEFAULT_CHARSET = " + DEFAULT_CHARSET);
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" encoding=\"" + DEFAULT_CHARSET + "\"?><prefix:root xmlns=\"\" xmlns:null=\"\"></prefix:root>";
+        final String EXPECTED_OUTPUT_NO_ENCODING = "<?xml version=\"1.0\"?><prefix:root xmlns=\"\" xmlns:null=\"\"></prefix:root>";
+
+        // new Writer
+        XMLEventWriter xmlEventWriter = null;
+        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
+        try {
+            xmlEventWriter = XML_OUTPUT_FACTORY.createXMLEventWriter(byteArrayOutputStream);
+        } catch (XMLStreamException xmlStreamException) {
+            xmlStreamException.printStackTrace();
+            Assert.fail(xmlStreamException.toString());
+        }
+
+        try {
+            // start a valid event stream
+            XMLEvent startDocumentEvent = XML_EVENT_FACTORY.createStartDocument(DEFAULT_CHARSET);
+            XMLEvent startElementEvent = XML_EVENT_FACTORY.createStartElement("prefix", "http://example.com", "root");
+            xmlEventWriter.add(startDocumentEvent);
+            xmlEventWriter.add(startElementEvent);
+
+            // try using a null default namespaceURI
+            XMLEvent namespaceEvent = XML_EVENT_FACTORY.createNamespace(null);
+            xmlEventWriter.add(namespaceEvent);
+
+            // try using a null prefix'd namespaceURI
+            XMLEvent namespacePrefixEvent = XML_EVENT_FACTORY.createNamespace("null", null);
+            xmlEventWriter.add(namespacePrefixEvent);
+
+            // close event stream
+            XMLEvent endElementEvent = XML_EVENT_FACTORY.createEndElement("prefix", "http://example.com", "root");
+            XMLEvent endDocumentEvent = XML_EVENT_FACTORY.createEndDocument();
+            xmlEventWriter.add(endElementEvent);
+            xmlEventWriter.add(endDocumentEvent);
+            xmlEventWriter.flush();
+        } catch (XMLStreamException xmlStreamException) {
+            xmlStreamException.printStackTrace();
+            Assert.fail(xmlStreamException.toString());
+        }
+
+        // get XML document as String
+        String actualOutput = byteArrayOutputStream.toString();
+
+        // is output as expected?
+        if (!actualOutput.equals(EXPECTED_OUTPUT) && !actualOutput.equals(EXPECTED_OUTPUT_NO_ENCODING)) {
+            Assert.fail("Expected: " + EXPECTED_OUTPUT + ", actual: " + actualOutput);
+        }
+    }
+
+    /**
+     * Test: 6419687 NPE in XMLEventWriterImpl.
+     */
+    @Test
+    public void testCR6419687() {
+
+        try {
+            InputStream in = getClass().getResourceAsStream("ReaderToWriterTest.wsdl");
+            OutputStream out = new FileOutputStream("ReaderToWriterTest-out.xml");
+
+            XMLEventReader reader = XML_INPUT_FACTORY.createXMLEventReader(in);
+            XMLEventWriter writer = XML_OUTPUT_FACTORY.createXMLEventWriter(out, "UTF-8");
+            while (reader.hasNext()) {
+                XMLEvent event = reader.nextEvent();
+                writer.add(event);
+            }
+            reader.close();
+            writer.close();
+        } catch (XMLStreamException xmlStreamException) {
+            xmlStreamException.printStackTrace();
+            Assert.fail(xmlStreamException.toString());
+        } catch (FileNotFoundException fileNotFoundException) {
+            fileNotFoundException.printStackTrace();
+            Assert.fail(fileNotFoundException.toString());
+        }
+    }
+
+    /*
+     * Reads UTF-16 encoding file and writes it to UTF-8 encoded format.
+     */
+    @Test
+    public void testUTF8Encoding() {
+        try {
+            InputStream in = util.BOMInputStream.createStream("UTF-16BE", this.getClass().getResourceAsStream(INPUT_FILE));
+            OutputStream out = new FileOutputStream(OUTPUT_FILE);
+
+            XMLEventReader reader = XML_INPUT_FACTORY.createXMLEventReader(in);
+            XMLEventWriter writer = XML_OUTPUT_FACTORY.createXMLEventWriter(out, "UTF-8");
+
+            writeEvents(reader, writer);
+            checkOutput(OUTPUT_FILE);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        } finally {
+            File file = new File(OUTPUT_FILE);
+            if (file.exists())
+                file.delete();
+        }
+    }
+
+    private void writeEvents(XMLEventReader reader, XMLEventWriter writer) throws XMLStreamException {
+        while (reader.hasNext()) {
+            XMLEvent event = reader.nextEvent();
+            writer.add(event);
+        }
+        reader.close();
+        writer.close();
+    }
+
+    private void checkOutput(String output) throws Exception {
+        InputStream in = new FileInputStream(output);
+        XMLEventReader reader = XML_INPUT_FACTORY.createXMLEventReader(in);
+        while (reader.hasNext()) {
+            reader.next();
+        }
+        reader.close();
+    }
+
+    /*
+     * Reads UTF-16 encoding file and writes it with default encoding.
+     */
+    @Test
+    public void testNoEncoding() {
+        try {
+            InputStream in = util.BOMInputStream.createStream("UTF-16BE", this.getClass().getResourceAsStream(INPUT_FILE));
+            OutputStream out = new FileOutputStream(OUTPUT_FILE);
+
+            XMLEventReader reader = XML_INPUT_FACTORY.createXMLEventReader(in);
+            XMLEventWriter writer = XML_OUTPUT_FACTORY.createXMLEventWriter(out);
+
+            writeEvents(reader, writer);
+            checkOutput(OUTPUT_FILE);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        } finally {
+            File file = new File(OUTPUT_FILE);
+            if (file.exists())
+                file.delete();
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.wsdl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.wsdl
new file mode 100644
index 00000000000..dd005ef00ae
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.wsdl
@@ -0,0 +1,523 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+
+<wsdl:definitions name = "Untitled" targetNamespace = "http://web.services.galileo.someCompany.com/checkAddressImpl" xmlns:ns0 = "http://someCompany.com/fss/services/Portal_checkAddress_request" xmlns:ns1 = "http://someCompany.com/fss/services/Portal_checkAddress_result" xmlns:soap = "http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns = "http://web.services.galileo.someCompany.com/checkAddressImpl" xmlns:tnsi = "http://web.services.galileo.someCompany.com/internal/checkAddress" xmlns:wsdl = "http://schemas.xmlsoap.org/wsdl/" xmlns:xs = "http://www.w3.org/2001/XMLSchema">
+	<wsdl:types>
+		<xsd:schema attributeFormDefault = "unqualified" elementFormDefault = "qualified" targetNamespace = "http://someCompany.com/fss/services/Portal_checkAddress_result" xml:lang = "de" xmlns = "http://someCompany.com/fss/services/Portal_checkAddress_result" xmlns:xsd = "http://www.w3.org/2001/XMLSchema">
+			<!-- commonMessageHeaderResult-->
+			<xsd:element name = "commonMessageHeaderResult">
+				<xsd:annotation xmlns = "">
+					<xsd:documentation>Comment describing your root element</xsd:documentation>
+				</xsd:annotation>
+				<xsd:complexType>
+					<xsd:sequence>
+						<xsd:element name = "sourceSystem" type = "xsd:string"/>
+						<xsd:element name = "eventID">
+							<xsd:simpleType>
+								<xsd:restriction base = "xsd:string">
+									<xsd:minLength value = "1"/>
+									<xsd:maxLength value = "30"/>
+								</xsd:restriction>
+							</xsd:simpleType>
+						</xsd:element>
+						<xsd:element name = "timeStamp" type = "xsd:dateTime"/>
+						<xsd:element minOccurs = "0" name = "eaiErrorID" type = "xsd:string"/>
+						<xsd:element name = "serviceName" type = "xsd:string"/>
+					</xsd:sequence>
+				</xsd:complexType>
+			</xsd:element>
+			<xsd:annotation>
+				<xsd:documentation>Canonical Data Model for service checkAddress (result)</xsd:documentation>
+				<xsd:documentation>Generation Date: 20.12.2005</xsd:documentation>
+				<xsd:documentation>naming convention for prefixes:
+       CDM  - object type
+       DOM  - reference data type
+				</xsd:documentation>
+			</xsd:annotation>
+			<xsd:complexType name = "CDM_Address_Check_Response_Result">
+				<xsd:annotation>
+					<xsd:documentation/>
+				</xsd:annotation>
+				<xsd:sequence>
+					<xsd:element name = "overallResult" type = "xsd:integer"/>
+					<xsd:element name = "overallRemark">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "1000"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element maxOccurs = "unbounded" minOccurs = "0" name = "Single_Checked_Address" type = "ns1:CDM_Single_Checked_Address_Result"/>
+				</xsd:sequence>
+			</xsd:complexType>
+			<xsd:complexType name = "CDM_Location_Address_Result">
+				<xsd:annotation>
+					<xsd:documentation>physical existing postal address</xsd:documentation>
+				</xsd:annotation>
+				<xsd:sequence>
+					<xsd:element minOccurs = "0" name = "zipCode">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "12"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "city">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "30"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "street">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "55"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "houseNumber">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "6"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "POBox">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "10"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "additionalInformation1">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "55"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "additionalInformation2">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "55"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "branch">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "80"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "site">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "50"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "department">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "100"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "validTo" type = "xsd:date"/>
+					<xsd:element minOccurs = "0" name = "checked" type = "xsd:boolean"/>
+					<xsd:element minOccurs = "0" name = "validFrom" type = "xsd:date"/>
+					<xsd:element minOccurs = "0" name = "active" type = "xsd:boolean"/>
+					<xsd:element minOccurs = "0" name = "Country_Code" type = "ns1:DOM_Country_Code_Result"/>
+					<xsd:element minOccurs = "0" name = "Address_Type" type = "ns1:DOM_Address_Type_Result"/>
+					<xsd:element minOccurs = "0" name = "zoneInformation" type = "ns1:CDM_Zone_Information_Result"/>
+					<xsd:element minOccurs = "0" name = "addressee_ref" type = "ns1:foreign_key"/>
+					<xsd:element minOccurs = "0" name = "contactAddressee_ref" type = "ns1:foreign_key"/>
+				</xsd:sequence>
+			</xsd:complexType>
+			<xsd:complexType name = "CDM_Single_Checked_Address_Result">
+				<xsd:annotation>
+					<xsd:documentation/>
+				</xsd:annotation>
+				<xsd:sequence>
+					<xsd:element name = "result" type = "xsd:integer"/>
+					<xsd:element name = "remark">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "1000"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element maxOccurs = "unbounded" minOccurs = "0" name = "Location_Address" type = "ns1:CDM_Location_Address_Result"/>
+				</xsd:sequence>
+			</xsd:complexType>
+			<xsd:complexType name = "CDM_Zone_Information_Result">
+				<xsd:annotation>
+					<xsd:documentation>Address with special geographical information (GIS)</xsd:documentation>
+				</xsd:annotation>
+				<xsd:sequence>
+					<xsd:element minOccurs = "0" name = "intersection1">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "200"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "intersection2">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "200"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "xCoordinate" type = "xsd:integer"/>
+					<xsd:element minOccurs = "0" name = "yCoordinate" type = "xsd:integer"/>
+					<xsd:element minOccurs = "0" name = "radius" type = "xsd:double"/>
+					<xsd:element minOccurs = "0" name = "cells" type = "xsd:integer"/>
+					<xsd:element minOccurs = "0" name = "homezoneCheckPerformed" type = "xsd:boolean"/>
+					<xsd:element minOccurs = "0" name = "highSpeed" type = "xsd:boolean"/>
+					<xsd:element minOccurs = "0" name = "localAreaCode">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "10"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "forecastDate" type = "xsd:date"/>
+					<xsd:element minOccurs = "0" name = "Zone_Type" type = "ns1:DOM_Zone_Type_Result"/>
+					<xsd:element minOccurs = "0" name = "referredLocation_ref" type = "ns1:foreign_key"/>
+				</xsd:sequence>
+			</xsd:complexType>
+			<xsd:simpleType name = "DOM_Address_Type_Result">
+				<xsd:restriction base = "xsd:string">
+					<xsd:enumeration value = "main_address"/>
+					<xsd:enumeration value = "shipping_address"/>
+					<xsd:enumeration value = "billing_address"/>
+					<xsd:enumeration value = "previous_address"/>
+					<xsd:enumeration value = "customer_reward_program"/>
+					<xsd:enumeration value = "Packstation"/>
+				</xsd:restriction>
+			</xsd:simpleType>
+			<xsd:simpleType name = "DOM_Country_Code_Result">
+				<xsd:restriction base = "xsd:string">
+					<xsd:enumeration value = "DEU">
+						<xsd:annotation>
+							<xsd:documentation>Deutschland</xsd:documentation>
+						</xsd:annotation>
+					</xsd:enumeration>
+				</xsd:restriction>
+			</xsd:simpleType>
+			<xsd:simpleType name = "DOM_Zone_Type_Result">
+				<xsd:restriction base = "xsd:string">
+					<xsd:enumeration value = "PWI"/>
+					<xsd:enumeration value = "GEN"/>
+				</xsd:restriction>
+			</xsd:simpleType>
+			<xsd:simpleType name = "NOT_AVAILABLE_YET">
+				<xsd:restriction base = "xsd:string"/>
+			</xsd:simpleType>
+			<xsd:complexType name = "Portal_message_checkAddress_result_type">
+				<xsd:sequence>
+					<xsd:element minOccurs = "0" name = "Address_Check_Response" type = "ns1:CDM_Address_Check_Response_Result"/>
+				</xsd:sequence>
+			</xsd:complexType>
+			<xsd:simpleType name = "foreign_key">
+				<xsd:restriction base = "xsd:string"/>
+			</xsd:simpleType>
+			<xsd:element name = "Portal_message_checkAddress_result" type = "ns1:Portal_message_checkAddress_result_type"/>
+			<!-- Portal_checkAddressResult-->
+			<xsd:complexType name = "Portal_checkAddress_result">
+				<xsd:sequence>
+					<xsd:element ref = "ns1:commonMessageHeaderResult">
+						<xsd:annotation xmlns = "">
+							<xsd:documentation>Comment describing your root element</xsd:documentation>
+						</xsd:annotation>
+					</xsd:element>
+					<xsd:element ref = "ns1:Portal_message_checkAddress_result"/>
+				</xsd:sequence>
+			</xsd:complexType>
+		</xsd:schema>
+		<xsd:schema attributeFormDefault = "unqualified" elementFormDefault = "qualified" targetNamespace = "http://someCompany.com/fss/services/Portal_checkAddress_request" xml:lang = "de" xmlns = "http://someCompany.com/fss/services/Portal_checkAddress_request" xmlns:xsd = "http://www.w3.org/2001/XMLSchema">
+			<!-- commonMessageHeader-->
+			<xsd:element name = "commonMessageHeader">
+				<xsd:annotation xmlns = "">
+					<xsd:documentation>Comment describing your root element</xsd:documentation>
+				</xsd:annotation>
+				<xsd:complexType>
+					<xsd:sequence>
+						<xsd:element name = "sourceSystem" type = "xsd:string"/>
+						<xsd:element name = "eventID">
+							<xsd:simpleType>
+								<xsd:restriction base = "xsd:string">
+									<xsd:minLength value = "1"/>
+									<xsd:maxLength value = "30"/>
+								</xsd:restriction>
+							</xsd:simpleType>
+						</xsd:element>
+						<xsd:element name = "timeStamp" type = "xsd:dateTime"/>
+						<xsd:element minOccurs = "0" name = "eaiErrorID" type = "xsd:string"/>
+						<xsd:element name = "serviceName" type = "xsd:string"/>
+					</xsd:sequence>
+				</xsd:complexType>
+			</xsd:element>
+			<xsd:annotation>
+				<xsd:documentation>Canonical Data Model for service checkAddress</xsd:documentation>
+				<xsd:documentation>Generation Date: 20.12.2005</xsd:documentation>
+				<xsd:documentation>naming convention for prefixes:
+       CDM  - object type
+       DOM  - reference data type
+    
+				</xsd:documentation>
+			</xsd:annotation>
+			<xsd:complexType name = "CDM_Location_Address">
+				<xsd:annotation>
+					<xsd:documentation>physical existing postal address</xsd:documentation>
+				</xsd:annotation>
+				<xsd:sequence>
+					<xsd:element name = "zipCode">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "12"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element name = "city">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "30"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "street">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "55"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "houseNumber">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "6"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "POBox">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "10"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "additionalInformation1">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "55"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "additionalInformation2">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "55"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "branch">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "80"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "site">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "50"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "department">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "100"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "validTo" type = "xsd:date"/>
+					<xsd:element minOccurs = "0" name = "checked" type = "xsd:boolean"/>
+					<xsd:element minOccurs = "0" name = "validFrom" type = "xsd:date"/>
+					<xsd:element minOccurs = "0" name = "active" type = "xsd:boolean"/>
+					<xsd:element name = "Country_Code" type = "ns0:DOM_Country_Code"/>
+					<xsd:element minOccurs = "0" name = "Address_Type" type = "ns0:DOM_Address_Type"/>
+					<xsd:element minOccurs = "0" name = "zoneInformation" type = "ns0:CDM_Zone_Information"/>
+					<xsd:element minOccurs = "0" name = "addressee_ref" type = "ns0:foreign_key"/>
+					<xsd:element minOccurs = "0" name = "contactAddressee_ref" type = "ns0:foreign_key"/>
+				</xsd:sequence>
+			</xsd:complexType>
+			<xsd:complexType name = "CDM_Zone_Information">
+				<xsd:annotation>
+					<xsd:documentation>Address with special geographical information (GIS)</xsd:documentation>
+				</xsd:annotation>
+				<xsd:sequence>
+					<xsd:element minOccurs = "0" name = "intersection1">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "200"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "intersection2">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "200"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "xCoordinate" type = "xsd:integer"/>
+					<xsd:element minOccurs = "0" name = "yCoordinate" type = "xsd:integer"/>
+					<xsd:element minOccurs = "0" name = "radius" type = "xsd:double"/>
+					<xsd:element minOccurs = "0" name = "cells" type = "xsd:integer"/>
+					<xsd:element minOccurs = "0" name = "homezoneCheckPerformed" type = "xsd:boolean"/>
+					<xsd:element minOccurs = "0" name = "highSpeed" type = "xsd:boolean"/>
+					<xsd:element minOccurs = "0" name = "localAreaCode">
+						<xsd:simpleType>
+							<xsd:restriction base = "xsd:string">
+								<xsd:maxLength value = "10"/>
+								<xsd:minLength value = "0"/>
+							</xsd:restriction>
+						</xsd:simpleType>
+					</xsd:element>
+					<xsd:element minOccurs = "0" name = "forecastDate" type = "xsd:date"/>
+					<xsd:element minOccurs = "0" name = "Zone_Type" type = "ns0:DOM_Zone_Type"/>
+					<xsd:element minOccurs = "0" name = "referredLocation_ref" type = "ns0:foreign_key"/>
+				</xsd:sequence>
+			</xsd:complexType>
+			<xsd:simpleType name = "DOM_Address_Type">
+				<xsd:restriction base = "xsd:string">
+					<xsd:enumeration value = "main_address"/>
+					<xsd:enumeration value = "shipping_address"/>
+					<xsd:enumeration value = "billing_address"/>
+					<xsd:enumeration value = "previous_address"/>
+					<xsd:enumeration value = "customer_reward_program"/>
+					<xsd:enumeration value = "Packstation"/>
+				</xsd:restriction>
+			</xsd:simpleType>
+			<xsd:simpleType name = "DOM_Country_Code">
+				<xsd:restriction base = "xsd:string">
+					<xsd:enumeration value = "DEU">
+						<xsd:annotation>
+							<xsd:documentation>Deutschland</xsd:documentation>
+						</xsd:annotation>
+					</xsd:enumeration>
+				</xsd:restriction>
+			</xsd:simpleType>
+			<xsd:simpleType name = "DOM_Zone_Type">
+				<xsd:restriction base = "xsd:string">
+					<xsd:enumeration value = "PWI"/>
+					<xsd:enumeration value = "GEN"/>
+				</xsd:restriction>
+			</xsd:simpleType>
+			<xsd:simpleType name = "NOT_AVAILABLE_YET">
+				<xsd:restriction base = "xsd:string"/>
+			</xsd:simpleType>
+			<xsd:complexType name = "Portal_message_checkAddress_type">
+				<xsd:sequence>
+					<xsd:element minOccurs = "0" name = "Location_Address" type = "ns0:CDM_Location_Address"/>
+				</xsd:sequence>
+			</xsd:complexType>
+			<xsd:simpleType name = "foreign_key">
+				<xsd:restriction base = "xsd:string"/>
+			</xsd:simpleType>
+			<xsd:element name = "Portal_message_checkAddress" type = "ns0:Portal_message_checkAddress_type"/>
+			<!-- Portal_checkAddress-->
+			<xsd:complexType name = "Portal_checkAddress">
+				<xsd:sequence>
+					<xsd:element ref = "ns0:commonMessageHeader">
+						<xsd:annotation xmlns = "">
+							<xsd:documentation>Comment describing your root element</xsd:documentation>
+						</xsd:annotation>
+					</xsd:element>
+					<xsd:element ref = "ns0:Portal_message_checkAddress"/>
+				</xsd:sequence>
+			</xsd:complexType>
+		</xsd:schema>
+		<xsd:schema attributeFormDefault = "unqualified" elementFormDefault = "qualified" targetNamespace = "http://web.services.galileo.someCompany.com/internal/checkAddress" xml:lang = "de" xmlns = "http://someCompany.com/fss/services/Portal_internal" xmlns:xsd = "http://www.w3.org/2001/XMLSchema">
+			<xsd:element name = "HeaderMsg" type = "xsd:string"/>
+			<xsd:element name = "ErrorMsg" type = "xsd:string"/>
+		</xsd:schema>
+	</wsdl:types>
+	<wsdl:message name = "checkAddress">
+		<wsdl:part name = "checkAddress" type = "ns0:Portal_checkAddress"/>
+	</wsdl:message>
+	<wsdl:message name = "checkAddressResult">
+		<wsdl:part name = "checkAddressResult" type = "ns1:Portal_checkAddress_result"/>
+	</wsdl:message>
+	<wsdl:message name = "GenericException">
+		<wsdl:part element = "tnsi:ErrorMsg" name = "error"/>
+	</wsdl:message>
+	<wsdl:message name = "Header">
+		<wsdl:part element = "tnsi:HeaderMsg" name = "HeaderPart"/>
+	</wsdl:message>
+	<wsdl:message name = "HeaderFault">
+		<wsdl:part element = "tnsi:ErrorMsg" name = "HeaderFaultPart"/>
+	</wsdl:message>
+	<wsdl:portType name = "PortType">
+		<wsdl:operation name = "checkAddress">
+			<wsdl:input message = "tns:checkAddress"/>
+			<wsdl:output message = "tns:checkAddressResult"/>
+			<wsdl:fault message = "tns:GenericException" name = "GenericException"/>
+		</wsdl:operation>
+	</wsdl:portType>
+	<wsdl:binding name = "Portal__Portal2BPM__checkAddressBinding" type = "tns:PortType">
+		<soap:binding style = "rpc" transport = "http://schemas.xmlsoap.org/soap/http"/>
+		<wsdl:operation name = "checkAddress">
+			<wsdl:documentation>The operation has no documentation</wsdl:documentation>
+			<soap:operation soapAction = "Portal_Portal2BPM_checkAddress" style = "rpc"/>
+			<wsdl:input>
+				<soap:body namespace = "http://InputMessageNamespace" use = "literal"/>
+				<soap:header message = "tns:Header" part = "HeaderPart" use = "literal">
+					<soap:headerfault message = "tns:HeaderFault" part = "HeaderFaultPart" use = "literal"/>
+				</soap:header>
+			</wsdl:input>
+			<wsdl:output>
+				<soap:body namespace = "http://OutputMessageNamespace" use = "literal"/>
+			</wsdl:output>
+			<wsdl:fault name = "GenericException">
+				<soap:fault name = "GenericException" use = "literal"/>
+			</wsdl:fault>
+		</wsdl:operation>
+	</wsdl:binding>
+	<wsdl:service name = "Portal__Portal2BPM__checkAddress">
+		<wsdl:port binding = "tns:Portal__Portal2BPM__checkAddressBinding" name = "Portal__Portal2BPM__checkAddressHttpPort">
+			<soap:address location = "http://tibco13413008:2020/Business__Processes/Adapter__Services/Portal/Inbound__Processes/Portal__Portal2BPM__checkAddress"/>
+		</wsdl:port>
+	</wsdl:service>
+</wsdl:definitions>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.xml
new file mode 100644
index 00000000000..93d53e5a814
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/ReaderToWriterTest.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<root xmlns="" />
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/W2JDLR4002TestService.wsdl.data b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/W2JDLR4002TestService.wsdl.data
new file mode 100644
index 00000000000..b56821f8fe0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/W2JDLR4002TestService.wsdl.data
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-16"?>
+<definitions
+    xmlns="http://schemas.xmlsoap.org/wsdl/"
+    name="W2JDLR4002TestService"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+    targetNamespace="http://w2jdlr4002testservice.org/W2JDLR4002TestService.wsdl"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:tns="http://w2jdlr4002testservice.org/W2JDLR4002TestService.wsdl"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsd1="http://w2jdlr4002testservice.org/xsd">
+
+    <types>
+        <schema targetNamespace="http://w2jdlr4002testservice.org/xsd"
+            xmlns="http://www.w3.org/2001/XMLSchema"
+            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+            elementFormDefault="qualified">
+
+            <element name="echoStringParam" type="xsd:string"/>
+
+            <element name="echoStringReturn" type="xsd:string"/>
+            
+        </schema>
+    </types>
+
+    <message name="echoString">
+        <part element="xsd1:echoStringParam" name="str"/>
+    </message>
+    <message name="echoStringResponse">
+        <part element="xsd1:echoStringReturn" name="result"/>
+    </message>
+
+    <portType name="W2JDLR4002Test">
+    	<operation name="echoString">
+            <input message="tns:echoString"/>
+            <output message="tns:echoStringResponse"/>
+    	</operation>
+    </portType>
+    
+    <binding name="W2JDLR4002TestBinding" type="tns:W2JDLR4002Test">
+    	<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    	<operation name="echoString">
+    		<soap:operation/>
+            <input>
+                <soap:body use="literal"/>
+            </input>
+            <output>
+                <soap:body use="literal"/>
+            </output>
+    	</operation>
+    </binding>
+
+    <service name="W2JDLR4002TestService">
+        <port binding="tns:W2JDLR4002TestBinding"
+            name="W2JDLR4002TestPort">
+            <soap:address
+                location="http://w2jdlr4002testservice.org/W2JDLR4002TestService.wsdl"/>
+        </port>
+    </service>
+    
+</definitions>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/XMLEventWriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/XMLEventWriterTest.java
new file mode 100644
index 00000000000..d12ca93b4a9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/XMLEventWriterTest.java
@@ -0,0 +1,152 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLEventWriterTest;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.events.XMLEvent;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLEventWriter.
+ */
+public class XMLEventWriterTest {
+
+    /**
+     * Test XMLStreamWriter parsing a file with an external entity reference.
+     */
+    @Test
+    public void testXMLStreamWriter() {
+
+        try {
+            XMLOutputFactory outputFactory = XMLOutputFactory.newInstance();
+            XMLEventWriter eventWriter = outputFactory.createXMLEventWriter(System.out);
+            XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+            String file = getClass().getResource("XMLEventWriterTest.xml").getPath();
+            XMLEventReader eventReader = inputFactory.createXMLEventReader(new StreamSource(new File(file)));
+
+            // adds the event to the consumer.
+            eventWriter.add(eventReader);
+            eventWriter.flush();
+            eventWriter.close();
+
+            // expected success
+        } catch (Exception exception) {
+            exception.printStackTrace();
+            Assert.fail(exception.toString());
+        }
+    }
+
+    /**
+     * Inspired by CR 6245284 Sun Stax /sjsxp.jar does not behave properly
+     * during merge of xml files.
+     */
+    @Test
+    public void testMerge() {
+
+        try {
+            // Create the XML input factory
+            XMLInputFactory factory = XMLInputFactory.newInstance();
+
+            // Create XML event reader 1
+            InputStream inputStream1 = new FileInputStream(new File(XMLEventWriterTest.class.getResource("merge-1.xml").toURI()));
+            XMLEventReader r1 = factory.createXMLEventReader(inputStream1);
+
+            // Create XML event reader 2
+            InputStream inputStream2 = new FileInputStream(new File(XMLEventWriterTest.class.getResource("merge-2.xml").toURI()));
+            XMLEventReader r2 = factory.createXMLEventReader(inputStream2);
+
+            // Create the output factory
+            XMLOutputFactory xmlof = XMLOutputFactory.newInstance();
+
+            // Create XML event writer
+            XMLEventWriter xmlw = xmlof.createXMLEventWriter(System.out);
+
+            // Read to first <product> element in document 1
+            // and output to result document
+            QName bName = new QName("b");
+
+            while (r1.hasNext()) {
+                // Read event to be written to result document
+                XMLEvent event = r1.nextEvent();
+
+                if (event.getEventType() == XMLEvent.END_ELEMENT) {
+
+                    // Start element - stop at <product> element
+                    QName name = event.asEndElement().getName();
+                    if (name.equals(bName)) {
+
+                        QName zName = new QName("z");
+
+                        boolean isZr = false;
+
+                        while (r2.hasNext()) {
+                            // Read event to be written to result document
+                            XMLEvent event2 = r2.nextEvent();
+                            // Output event
+                            if (event2.getEventType() == XMLEvent.START_ELEMENT && event2.asStartElement().getName().equals(zName)) {
+                                isZr = true;
+                            }
+
+                            if (xmlw != null && isZr) {
+                                xmlw.add(event2);
+                            }
+
+                            // stop adding events after </z>
+                            // i.e. do not write END_DOCUMENT :)
+                            if (isZr && event2.getEventType() == XMLEvent.END_ELEMENT && event2.asEndElement().getName().equals(zName)) {
+                                isZr = false;
+                            }
+                        }
+                        xmlw.flush();
+                    }
+                }
+
+                // Output event
+                if (xmlw != null) {
+                    xmlw.add(event);
+                }
+            }
+
+            // Read to first <product> element in document 1
+            // without writing to result document
+            xmlw.close();
+
+            // expected success
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail(ex.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/XMLEventWriterTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/XMLEventWriterTest.xml
new file mode 100644
index 00000000000..840671395c7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/XMLEventWriterTest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright (c) 2014, 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.
+ */
+-->
+<!DOCTYPE root [
+    <!ENTITY replace SYSTEM 'replace1.txt'>
+]>
+<root>&replace;</root>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/merge-1.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/merge-1.xml
new file mode 100644
index 00000000000..6aea32bc84c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/merge-1.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright (c) 2014, 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.
+ */
+-->
+<a>
+    <b>
+        <d></d>
+        <e></e>
+    </b>
+    <c>ccccccc</c>
+</a>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/merge-2.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/merge-2.xml
new file mode 100644
index 00000000000..ee6fb95fe3d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/merge-2.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright (c) 2014, 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.
+ */
+-->
+<z>zzzzzzzzz</z>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/replace1.txt b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/replace1.txt
new file mode 100644
index 00000000000..bad3db38def
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLEventWriterTest/replace1.txt
@@ -0,0 +1,2 @@
+replace1
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/Bug6756677Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/Bug6756677Test.java
new file mode 100644
index 00000000000..569d6c5f5f9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/Bug6756677Test.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLInputFactoryTest;
+
+import javax.xml.stream.XMLInputFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6756677
+ * @summary Test XMLInputFactory.newFactory(String factoryId, ClassLoader classLoader).
+ */
+public class Bug6756677Test {
+
+    @Test
+    public void testNewInstance() {
+        String myFactory = "javax.xml.stream.XMLInputFactoryTest.MyInputFactory";
+        try {
+            System.setProperty("MyInputFactory", myFactory);
+            XMLInputFactory xif = XMLInputFactory.newInstance("MyInputFactory", null);
+            System.out.println(xif.getClass().getName());
+            Assert.assertTrue(xif.getClass().getName().equals(myFactory));
+
+        } catch (UnsupportedOperationException oe) {
+            Assert.fail(oe.getMessage());
+        }
+
+    }
+
+    // newFactory was added in StAX 1.2
+    @Test
+    public void testNewFactory() {
+        String myFactory = "javax.xml.stream.XMLInputFactoryTest.MyInputFactory";
+        ClassLoader cl = null;
+        try {
+            System.setProperty("MyInputFactory", myFactory);
+            XMLInputFactory xif = XMLInputFactory.newFactory("MyInputFactory", cl);
+            System.out.println(xif.getClass().getName());
+            Assert.assertTrue(xif.getClass().getName().equals(myFactory));
+
+        } catch (UnsupportedOperationException oe) {
+            Assert.fail(oe.getMessage());
+        }
+
+    }
+
+    String Temp_Result = "";
+    boolean PASSED = true;
+    boolean FAILED = false;
+
+    String XMLInputFactoryClassName = "com.sun.xml.internal.stream.XMLInputFactoryImpl";
+    String XMLInputFactoryID = "javax.xml.stream.XMLInputFactory";
+    ClassLoader CL = null;
+
+    // jaxp-test jaxp-product-tests javax.xml.jaxp14.ptests.FactoryTest
+    @Test
+    public void test() {
+        if (!test29()) {
+            Assert.fail(Temp_Result);
+        }
+        if (!test31()) {
+            Assert.fail(Temp_Result);
+        }
+    }
+
+    /*
+     * test for XMLInputFactory.newInstance(java.lang.String factoryClassName,
+     * java.lang.ClassLoader classLoader) classloader is null and
+     * factoryClassName points to correct implementation of
+     * javax.xml.stream.XMLInputFactory , should return newInstance of
+     * XMLInputFactory
+     */
+    @Test
+    public boolean test29() {
+        try {
+            System.setProperty(XMLInputFactoryID, XMLInputFactoryClassName);
+            XMLInputFactory xif = XMLInputFactory.newInstance(XMLInputFactoryID, CL);
+            if (xif instanceof XMLInputFactory) {
+                System.out.println(" test29() passed");
+                return PASSED;
+            } else {
+                System.out.println(" test29() failed");
+                Temp_Result = "test29() failed: xif not an instance of XMLInputFactory ";
+                return FAILED;
+            }
+        } catch (javax.xml.stream.FactoryConfigurationError fce) {
+            System.out.println("Failed : FactoryConfigurationError in test29 " + fce);
+            Temp_Result = "test29() failed ";
+            return FAILED;
+        } catch (Exception e) {
+            System.out.println("Failed : Exception in test29 " + e);
+            Temp_Result = "test29() failed ";
+            return FAILED;
+        }
+    }
+
+    /*
+     * test for XMLInputFactory.newInstance(java.lang.String factoryClassName,
+     * java.lang.ClassLoader classLoader) classloader is
+     * default(Class.getClassLoader()) and factoryClassName points to correct
+     * implementation of javax.xml.stream.XMLInputFactory , should return
+     * newInstance of XMLInputFactory
+     */
+    @Test
+    public boolean test31() {
+        try {
+            Bug6756677Test test3 = new Bug6756677Test();
+            ClassLoader cl = (test3.getClass()).getClassLoader();
+            System.setProperty(XMLInputFactoryID, XMLInputFactoryClassName);
+            XMLInputFactory xif = XMLInputFactory.newInstance(XMLInputFactoryID, cl);
+            if (xif instanceof XMLInputFactory) {
+                System.out.println(" test31() passed");
+                return PASSED;
+            } else {
+                System.out.println(" test31() failed");
+                Temp_Result = "test31() failed: xif not an instance of XMLInputFactory ";
+                return FAILED;
+            }
+        } catch (javax.xml.stream.FactoryConfigurationError fce) {
+            System.out.println("Failed : FactoryConfigurationError in test31 " + fce);
+            Temp_Result = "test31() failed ";
+            return FAILED;
+        } catch (Exception e) {
+            System.out.println("Failed : Exception in test31 " + e);
+            Temp_Result = "test31() failed ";
+            return FAILED;
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/Bug6909759Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/Bug6909759Test.java
new file mode 100644
index 00000000000..1c699c83323
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/Bug6909759Test.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLInputFactoryTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6909759
+ * @summary Test createXMLStreamReader with StreamSource.
+ */
+public class Bug6909759Test {
+
+
+    @Test
+    public void testCreateXMLStreamReader() {
+
+        try {
+            StreamSource ss = new StreamSource(getClass().getResourceAsStream("play.xml"));
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            // File file = new File("./tests/XMLStreamReader/sgml.xml");
+            // FileInputStream inputStream = new FileInputStream(file);
+            XMLStreamReader xsr;
+            xsr = xif.createXMLStreamReader(ss);
+
+            while (xsr.hasNext()) {
+                int eventType = xsr.next();
+            }
+
+        } catch (UnsupportedOperationException oe) {
+            Assert.fail("StreamSource should be supported");
+        } catch (XMLStreamException ex) {
+            Assert.fail("fix the test");
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/IssueTracker38.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/IssueTracker38.java
new file mode 100644
index 00000000000..f468d7a0f41
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/IssueTracker38.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLInputFactoryTest;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test createXMLEventReader from DOM or SAX source is unsupported.
+ */
+public class IssueTracker38 {
+
+    @Test
+    public void testXMLEventReaderFromDOMSource() throws Exception {
+        try {
+                createEventReaderFromSource(new DOMSource());
+            Assert.fail("Expected UnsupportedOperationException not thrown");
+        } catch (UnsupportedOperationException e) {
+        }
+    }
+
+    @Test
+    public void testXMLStreamReaderFromDOMSource() throws Exception {
+        try {
+                createStreamReaderFromSource(new DOMSource());
+            Assert.fail("Expected UnsupportedOperationException not thrown");
+        } catch (UnsupportedOperationException oe) {
+        }
+    }
+
+    @Test
+    public void testXMLEventReaderFromSAXSource() throws Exception {
+        try {
+                createEventReaderFromSource(new SAXSource());
+            Assert.fail("Expected UnsupportedOperationException not thrown");
+        } catch (UnsupportedOperationException e) {
+        }
+    }
+
+    @Test
+    public void testXMLStreamReaderFromSAXSource() throws Exception {
+        try {
+                createStreamReaderFromSource(new SAXSource());
+            Assert.fail("Expected UnsupportedOperationException not thrown");
+        } catch (UnsupportedOperationException oe) {
+        }
+    }
+
+    private void createEventReaderFromSource(Source source) throws Exception {
+        XMLInputFactory xIF = XMLInputFactory.newInstance();
+        xIF.createXMLEventReader(source);
+    }
+
+    private void createStreamReaderFromSource(Source source) throws Exception {
+        XMLInputFactory xIF = XMLInputFactory.newInstance();
+        xIF.createXMLStreamReader(source);
+    }
+
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/MyInputFactory.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/MyInputFactory.java
new file mode 100644
index 00000000000..581c122585c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/MyInputFactory.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLInputFactoryTest;
+
+import java.io.InputStream;
+import java.io.Reader;
+
+import javax.xml.stream.EventFilter;
+import javax.xml.stream.StreamFilter;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLReporter;
+import javax.xml.stream.XMLResolver;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.util.XMLEventAllocator;
+import javax.xml.transform.Source;
+
+public class MyInputFactory extends javax.xml.stream.XMLInputFactory {
+
+    @Override
+    public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLStreamReader createXMLStreamReader(InputStream stream) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLStreamReader createXMLStreamReader(InputStream stream, String encoding) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLStreamReader createXMLStreamReader(String systemId, InputStream stream) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLStreamReader createXMLStreamReader(String systemId, Reader reader) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLEventReader createXMLEventReader(Reader reader) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLEventReader createXMLEventReader(String systemId, Reader reader) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLEventReader createXMLEventReader(XMLStreamReader reader) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLEventReader createXMLEventReader(Source source) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLEventReader createXMLEventReader(InputStream stream) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLEventReader createXMLEventReader(InputStream stream, String encoding) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLEventReader createXMLEventReader(String systemId, InputStream stream) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter) throws XMLStreamException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLResolver getXMLResolver() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setXMLResolver(XMLResolver resolver) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLReporter getXMLReporter() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setXMLReporter(XMLReporter reporter) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setProperty(String name, Object value) throws IllegalArgumentException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Object getProperty(String name) throws IllegalArgumentException {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isPropertySupported(String name) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void setEventAllocator(XMLEventAllocator allocator) {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public XMLEventAllocator getEventAllocator() {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/play.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/play.xml
new file mode 100644
index 00000000000..2d37d28bb8a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLInputFactoryTest/play.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0"?><PLAY><TITLE>
+         The Tragedy of Hamlet
+           Prince of Denmark
+</TITLE>
+</PLAY>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/Bug6846132Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/Bug6846132Test.java
new file mode 100644
index 00000000000..9e5093d35e6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/Bug6846132Test.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLOutputFactoryTest;
+
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.sax.SAXResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6846132
+ * @summary Test createXMLStreamWriter with SAXResult won't throw a NullPointerException.
+ */
+public class Bug6846132Test {
+
+    @Test
+    public void testSAXResult() {
+        DefaultHandler handler = new DefaultHandler();
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\"?><root></root>";
+        try {
+            SAXResult saxResult = new SAXResult(handler);
+            // saxResult.setSystemId("jaxp-ri/unit-test/javax/xml/stream/XMLOutputFactoryTest/cr6846132.xml");
+            XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+            XMLStreamWriter writer = ofac.createXMLStreamWriter(saxResult);
+            writer.writeStartDocument("1.0");
+            writer.writeStartElement("root");
+            writer.writeEndElement();
+            writer.writeEndDocument();
+            writer.flush();
+            writer.close();
+        } catch (Exception e) {
+            if (e instanceof UnsupportedOperationException) {
+                // expected
+            } else {
+                e.printStackTrace();
+                Assert.fail(e.toString());
+            }
+        }
+    }
+
+    @Test
+    public void testSAXResult1() {
+        DefaultHandler handler = new DefaultHandler();
+
+        try {
+            SAXResult saxResult = new SAXResult(handler);
+            XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+            XMLEventWriter writer = ofac.createXMLEventWriter(saxResult);
+        } catch (Exception e) {
+            if (e instanceof UnsupportedOperationException) {
+                // expected
+            } else {
+                e.printStackTrace();
+                Assert.fail(e.toString());
+            }
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java
new file mode 100644
index 00000000000..64517c363ed
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/DuplicateNSDeclarationTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLOutputFactoryTest;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test the writing of duplicate namespace declarations when IS_REPAIRING_NAMESPACES is ture.
+ */
+public class DuplicateNSDeclarationTest {
+
+    @Test
+    public void testDuplicateNSDeclaration() {
+
+        // expect only 1 Namespace Declaration
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<ns1:foo" + " xmlns:ns1=\"http://example.com/\">" + "</ns1:foo>";
+
+        // have XMLOutputFactory repair Namespaces
+        XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+        ofac.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+
+        // send output to a Stream
+        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+        StreamResult sr = new StreamResult(buffer);
+        XMLStreamWriter w = null;
+
+        // write a duplicate Namespace Declaration
+        try {
+            w = ofac.createXMLStreamWriter(sr);
+            w.writeStartDocument();
+            w.writeStartElement("ns1", "foo", "http://example.com/");
+            w.writeNamespace("ns1", "http://example.com/");
+            w.writeNamespace("ns1", "http://example.com/");
+            w.writeEndElement();
+            w.writeEndDocument();
+            w.close();
+        } catch (XMLStreamException xmlStreamException) {
+            xmlStreamException.printStackTrace();
+            Assert.fail(xmlStreamException.toString());
+        }
+
+        // debugging output for humans
+        System.out.println();
+        System.out.println("actual:   \"" + buffer.toString() + "\"");
+        System.out.println("expected: \"" + EXPECTED_OUTPUT + "\"");
+
+        // are results as expected?
+        Assert.assertEquals(EXPECTED_OUTPUT, buffer.toString());
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/StreamResultTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/StreamResultTest.java
new file mode 100644
index 00000000000..368c80c1b0d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLOutputFactoryTest/StreamResultTest.java
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLOutputFactoryTest;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.stream.XMLEventFactory;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.stax.StAXResult;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test create XMLWriter with variant Result.
+ */
+public class StreamResultTest {
+
+    @Test
+    public void testStreamResult() {
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\"?><root></root>";
+        try {
+            XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+            StreamResult sr = new StreamResult(buffer);
+            XMLStreamWriter writer = ofac.createXMLStreamWriter(sr);
+            writer.writeStartDocument("1.0");
+            writer.writeStartElement("root");
+            writer.writeEndElement();
+            writer.writeEndDocument();
+            writer.close();
+            Assert.assertEquals(buffer.toString(), EXPECTED_OUTPUT);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+
+    @Test
+    public void testStreamWriterWithStAXResultNStreamWriter() {
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\"?><root></root>";
+
+        try {
+            XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+            XMLStreamWriter writer = ofac.createXMLStreamWriter(buffer);
+            StAXResult res = new StAXResult(writer);
+            writer = ofac.createXMLStreamWriter(res);
+            writer.writeStartDocument("1.0");
+            writer.writeStartElement("root");
+            writer.writeEndElement();
+            writer.writeEndDocument();
+            writer.close();
+            Assert.assertEquals(buffer.toString(), EXPECTED_OUTPUT);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+
+    @Test
+    public void testEventWriterWithStAXResultNStreamWriter() {
+        String encoding = "";
+        if (System.getProperty("file.encoding").equals("UTF-8")) {
+            encoding = " encoding=\"UTF-8\"";
+        }
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\"" + encoding + "?><root></root>";
+
+        try {
+            XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+            XMLStreamWriter swriter = ofac.createXMLStreamWriter(buffer);
+            StAXResult res = new StAXResult(swriter);
+            XMLEventWriter writer = ofac.createXMLEventWriter(res);
+
+            XMLEventFactory efac = XMLEventFactory.newInstance();
+            writer.add(efac.createStartDocument(null, "1.0"));
+            writer.add(efac.createStartElement("", "", "root"));
+            writer.add(efac.createEndElement("", "", "root"));
+            writer.add(efac.createEndDocument());
+            writer.close();
+
+            Assert.assertEquals(buffer.toString(), EXPECTED_OUTPUT);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+
+    @Test
+    public void testEventWriterWithStAXResultNEventWriter() {
+        String encoding = "";
+        if (System.getProperty("file.encoding").equals("UTF-8")) {
+            encoding = " encoding=\"UTF-8\"";
+        }
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\"" + encoding + "?><root></root>";
+
+        try {
+            XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+            XMLEventWriter writer = ofac.createXMLEventWriter(buffer);
+            StAXResult res = new StAXResult(writer);
+            writer = ofac.createXMLEventWriter(res);
+
+            XMLEventFactory efac = XMLEventFactory.newInstance();
+            writer.add(efac.createStartDocument(null, "1.0"));
+            writer.add(efac.createStartElement("", "", "root"));
+            writer.add(efac.createEndElement("", "", "root"));
+            writer.add(efac.createEndDocument());
+            writer.close();
+
+            Assert.assertEquals(buffer.toString(), EXPECTED_OUTPUT);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+
+    @Test
+    public void testStreamWriterWithStAXResultNEventWriter() throws Exception {
+        try {
+            XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+            ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+            XMLEventWriter writer = ofac.createXMLEventWriter(buffer);
+            StAXResult res = new StAXResult(writer);
+            XMLStreamWriter swriter = ofac.createXMLStreamWriter(res);
+            Assert.fail("Expected an Exception as XMLStreamWriter can't be created " + "with a StAXResult which has EventWriter.");
+        } catch (Exception e) {
+            System.out.println(e.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/XMLResolverTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/XMLResolverTest.java
new file mode 100644
index 00000000000..9d4ca307fff
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/XMLResolverTest.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLResolverTest;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLResolver;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLResolver.
+ */
+public class XMLResolverTest {
+
+    @Test
+    public void testXMLResolver() {
+        try {
+            XMLInputFactory xifactory = XMLInputFactory.newInstance();
+            xifactory.setProperty(XMLInputFactory.RESOLVER, new MyStaxResolver());
+            File file = new File(getClass().getResource("XMLResolverTest.xml").getFile());
+            String systemId = file.toURI().toString();
+            InputStream entityxml = new FileInputStream(file);
+            XMLStreamReader streamReader = xifactory.createXMLStreamReader(systemId, entityxml);
+            while (streamReader.hasNext()) {
+                int eventType = streamReader.next();
+                if (eventType == XMLStreamConstants.START_ELEMENT) {
+                    eventType = streamReader.next();
+                    if (eventType == XMLStreamConstants.CHARACTERS) {
+                        String text = streamReader.getText();
+                        Assert.assertTrue(text.contains("replace2"));
+                    }
+                }
+            }
+        } catch (XMLStreamException ex) {
+
+            if (ex.getNestedException() != null) {
+                ex.getNestedException().printStackTrace();
+            }
+            // ex.printStackTrace() ;
+        } catch (Exception io) {
+            io.printStackTrace();
+        }
+    }
+
+    class MyStaxResolver implements XMLResolver {
+
+        public MyStaxResolver() {
+
+        }
+
+        public Object resolveEntity(String publicId, String systemId, String baseURI, String namespace) throws javax.xml.stream.XMLStreamException {
+
+            Object object = null;
+            try {
+                object = new FileInputStream(getClass().getResource("replace2.txt").getFile());
+            } catch (Exception ex) {
+                ex.printStackTrace();
+            }
+            return object;
+        }
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/XMLResolverTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/XMLResolverTest.xml
new file mode 100644
index 00000000000..6d1d62f6da0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/XMLResolverTest.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Document   : XMLResolverTest.xml
+    Created on : April 6, 2004, 3:41 PM
+    Author     : neeraj
+    Description:
+        Purpose of the document follows.
+-->
+<!DOCTYPE root [
+    <!ENTITY replace SYSTEM 'replace1.txt'>
+]>
+<root>&replace;</root>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/replace1.txt b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/replace1.txt
new file mode 100644
index 00000000000..bad3db38def
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/replace1.txt
@@ -0,0 +1,2 @@
+replace1
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/replace2.txt b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/replace2.txt
new file mode 100644
index 00000000000..c80a0962715
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLResolverTest/replace2.txt
@@ -0,0 +1,2 @@
+replace2
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamExceptionTest/ExceptionTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamExceptionTest/ExceptionTest.java
new file mode 100644
index 00000000000..a64d93f1dd8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamExceptionTest/ExceptionTest.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamExceptionTest;
+
+import java.io.IOException;
+
+import javax.xml.stream.XMLStreamException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamException contains the message of the wrapped exception.
+ */
+public class ExceptionTest {
+
+    @Test
+    public void testException() {
+
+        final String EXPECTED_OUTPUT = "Test XMLStreamException";
+        try {
+            Exception ex = new IOException("Test XMLStreamException");
+            throw new XMLStreamException(ex);
+        } catch (XMLStreamException e) {
+            Assert.assertTrue(e.getMessage().contains(EXPECTED_OUTPUT), "XMLStreamException does not contain the message " + "of the wrapped exception");
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/Bug6481615.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/Bug6481615.java
new file mode 100644
index 00000000000..25bc88d22d6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/Bug6481615.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamFilterTest;
+
+import java.io.StringReader;
+
+import javax.xml.stream.StreamFilter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6481615
+ * @summary Test Filtered XMLStreamReader can return the event type if current state is START_ELEMENT.
+ */
+public class Bug6481615 {
+
+    static final String XML = "<?xml version=\"1.0\"?>" + "<S:Envelope foo=\"bar\" xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"></S:Envelope>";
+
+    private XMLInputFactory factory = XMLInputFactory.newInstance();
+
+    @Test
+    public void test() {
+        try {
+            XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(XML));
+            reader.next(); // advance to START_ELEMENT
+            XMLStreamReader filter = factory.createFilteredReader(reader, new Filter());
+            Assert.assertTrue(filter.getEventType() != -1);
+        } catch (Exception e) {
+            e.printStackTrace();
+            // Assert.fail("Unexpected Exception: " + e.getMessage());
+        }
+    }
+
+    class Filter implements StreamFilter {
+
+        public boolean accept(XMLStreamReader reader) {
+            return true;
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/Bug6481678.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/Bug6481678.java
new file mode 100644
index 00000000000..1f697b775a5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/Bug6481678.java
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamFilterTest;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.EventFilter;
+import javax.xml.stream.StreamFilter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6481678
+ * @summary Test Filtered XMLStreamReader parses namespace correctly.
+ */
+public class Bug6481678 {
+
+    String rootElement = "fruits";
+    String childElement = "varieties";
+    String prefixApple = "a";
+    String namespaceURIApple = "apple.fruit";
+    String prefixOrange = "o";
+    String namespaceURIOrange = "orange.fruit";
+    String namespaceURIBanana = "banana.fruit";
+
+    TypeFilter filter;
+    XMLInputFactory factory;
+    InputStream is;
+
+    /** Creates a new instance of NamespaceTest */
+    public Bug6481678(java.lang.String testName) {
+        init();
+    }
+
+    private void init() {
+        factory = XMLInputFactory.newInstance();
+        factory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+        filter = createFilter();
+    }
+
+    String getXML() {
+        StringBuffer sbuffer = new StringBuffer();
+        sbuffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+        sbuffer.append("<" + rootElement + " state=\"WA\"");
+        sbuffer.append(" xmlns:" + prefixApple + "=\"" + namespaceURIApple + "\"");
+        sbuffer.append(" xmlns:" + prefixOrange + "=\"" + namespaceURIOrange + "\"");
+        sbuffer.append(" xmlns=\"" + namespaceURIBanana + "\">");
+        sbuffer.append("<" + prefixApple + ":" + childElement + ">");
+        sbuffer.append("<" + prefixApple + ":fuji/>");
+        sbuffer.append("<" + prefixApple + ":gala/>");
+        sbuffer.append("</" + prefixApple + ":" + childElement + ">");
+        sbuffer.append("</" + rootElement + ">");
+        // System.out.println("XML = " + sbuffer.toString()) ;
+        return sbuffer.toString();
+    }
+
+    public TypeFilter createFilter() {
+
+        TypeFilter f = new TypeFilter();
+
+        f.addType(XMLEvent.START_ELEMENT);
+        f.addType(XMLEvent.END_ELEMENT);
+        f.addType(XMLEvent.PROCESSING_INSTRUCTION);
+        f.addType(XMLEvent.CHARACTERS);
+        f.addType(XMLEvent.COMMENT);
+        f.addType(XMLEvent.SPACE);
+        f.addType(XMLEvent.START_DOCUMENT);
+        f.addType(XMLEvent.END_DOCUMENT);
+        return f;
+    }
+
+    /*
+     * testcase for cr6481678 in our current impl (using cache), the reader
+     * would read from cache when getters are called before next() is. refter to
+     * testRootElementNamespace.
+     */
+    @Test
+    public void testReadingNamespace() {
+        is = new java.io.ByteArrayInputStream(getXML().getBytes());
+        try {
+            XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
+
+            while (sr.hasNext()) {
+                int eventType = sr.getEventType();
+                if (eventType == XMLStreamConstants.START_ELEMENT) {
+                    if (sr.getLocalName().equals(rootElement)) {
+                        Assert.assertTrue(sr.getNamespacePrefix(0).equals(prefixApple) && sr.getNamespaceURI(0).equals(namespaceURIApple));
+                    }
+                }
+                eventType = sr.next();
+            }
+        } catch (Exception ex) {
+            Assert.fail("Exception: " + ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testRootElementNamespace() {
+        is = new java.io.ByteArrayInputStream(getXML().getBytes());
+        try {
+            XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
+
+            while (sr.hasNext()) {
+                int eventType = sr.next();
+                if (eventType == XMLStreamConstants.START_ELEMENT) {
+                    if (sr.getLocalName().equals(rootElement)) {
+                        Assert.assertTrue(sr.getNamespacePrefix(0).equals(prefixApple) && sr.getNamespaceURI(0).equals(namespaceURIApple));
+                    }
+                }
+            }
+        } catch (Exception ex) {
+            Assert.fail("Exception: " + ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testChildElementNamespace() {
+        is = new java.io.ByteArrayInputStream(getXML().getBytes());
+        try {
+            XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
+            while (sr.hasNext()) {
+                int eventType = sr.next();
+                if (eventType == XMLStreamConstants.START_ELEMENT) {
+                    if (sr.getLocalName().equals(childElement)) {
+                        QName qname = sr.getName();
+                        Assert.assertTrue(qname.getPrefix().equals(prefixApple) && qname.getNamespaceURI().equals(namespaceURIApple)
+                                && qname.getLocalPart().equals(childElement));
+                    }
+                }
+            }
+        } catch (Exception ex) {
+            Assert.fail("Exception: " + ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testNamespaceContext() {
+        is = new java.io.ByteArrayInputStream(getXML().getBytes());
+        try {
+            XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
+            while (sr.hasNext()) {
+                int eventType = sr.next();
+                if (eventType == XMLStreamConstants.START_ELEMENT) {
+                    if (sr.getLocalName().equals(childElement)) {
+                        NamespaceContext context = sr.getNamespaceContext();
+                        Assert.assertTrue(context.getPrefix(namespaceURIApple).equals(prefixApple));
+                    }
+                }
+            }
+        } catch (Exception ex) {
+            Assert.fail("Exception: " + ex.getMessage());
+        }
+    }
+
+    @Test
+    public void testNamespaceCount() {
+        is = new java.io.ByteArrayInputStream(getXML().getBytes());
+        try {
+            XMLStreamReader sr = factory.createFilteredReader(factory.createXMLStreamReader(is), (StreamFilter) filter);
+            while (sr.hasNext()) {
+                int eventType = sr.next();
+                if (eventType == XMLStreamConstants.START_ELEMENT) {
+                    if (sr.getLocalName().equals(rootElement)) {
+                        int count = sr.getNamespaceCount();
+                        Assert.assertTrue(count == 3);
+                    }
+                }
+            }
+        } catch (Exception ex) {
+            Assert.fail("Exception: " + ex.getMessage());
+        }
+    }
+
+    class TypeFilter implements EventFilter, StreamFilter {
+
+        protected boolean[] types = new boolean[20];
+
+        public TypeFilter() {
+        }
+
+        public void addType(int type) {
+            types[type] = true;
+        }
+
+        public boolean accept(XMLEvent e) {
+            return types[e.getEventType()];
+        }
+
+        public boolean accept(XMLStreamReader r) {
+            return types[r.getEventType()];
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTest.java
new file mode 100644
index 00000000000..5625f78177f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTest.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamFilterTest;
+
+import javax.xml.stream.StreamFilter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test Filtered XMLStreamReader hasNext() always return the correct value if repeat to call it.
+ */
+public class HasNextTest {
+
+    private static String INPUT_FILE = "HasNextTest.xml";
+
+    private HasNextTypeFilter createFilter() {
+
+        HasNextTypeFilter f = new HasNextTypeFilter();
+
+        f.addType(XMLEvent.START_ELEMENT);
+        f.addType(XMLEvent.END_ELEMENT);
+        f.addType(XMLEvent.PROCESSING_INSTRUCTION);
+        f.addType(XMLEvent.CHARACTERS);
+        f.addType(XMLEvent.COMMENT);
+        f.addType(XMLEvent.SPACE);
+        f.addType(XMLEvent.START_DOCUMENT);
+        f.addType(XMLEvent.END_DOCUMENT);
+        return f;
+    }
+
+    private XMLStreamReader createStreamReader(HasNextTypeFilter f) {
+
+        try {
+            XMLInputFactory factory = XMLInputFactory.newInstance();
+            factory = XMLInputFactory.newInstance();
+            return factory.createFilteredReader(factory.createXMLStreamReader(this.getClass().getResourceAsStream(INPUT_FILE)), (StreamFilter) f);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Unexpected Exception: " + e.getMessage());
+            return null;
+        }
+    }
+
+    private void checkHasNext(XMLStreamReader r1) throws XMLStreamException {
+
+        // try asking 3 times, insure all results are the same
+        boolean hasNext_1 = r1.hasNext();
+        boolean hasNext_2 = r1.hasNext();
+        boolean hasNext_3 = r1.hasNext();
+
+        System.out.println("XMLStreamReader.hasNext() (1): " + hasNext_1);
+        System.out.println("XMLStreamReader.hasNext() (2): " + hasNext_2);
+        System.out.println("XMLStreamReader.hasNext() (3): " + hasNext_3);
+
+        Assert.assertTrue((hasNext_1 == hasNext_2) && (hasNext_1 == hasNext_3),
+                "XMLStreamReader.hasNext() returns inconsistent values for each subsequent call: " + hasNext_1 + ", " + hasNext_2 + ", " + hasNext_3);
+    }
+
+    @Test
+    public void testFilterUsingNextTag() {
+
+        try {
+            HasNextTypeFilter f = createFilter();
+            XMLStreamReader r1 = createStreamReader(f);
+
+            while (r1.hasNext()) {
+                try {
+                    r1.nextTag();
+                } catch (Exception e) {
+                    System.err.println("Expected Exception: " + e.getMessage());
+                    e.printStackTrace();
+                }
+
+                checkHasNext(r1);
+            }
+
+        } catch (XMLStreamException e) {
+            System.err.println("Unexpected Exception: " + e.getMessage());
+            e.printStackTrace();
+            Assert.fail("Unexpected Exception: " + e.toString());
+        } catch (Exception e) {
+            // if this is END_DOCUMENT, it is expected
+            if (e.toString().indexOf("END_DOCUMENT") != -1) {
+                // expected
+                System.err.println("Expected Exception:");
+                e.printStackTrace();
+            } else {
+                // unexpected
+                System.err.println("Unexpected Exception: " + e.getMessage());
+                e.printStackTrace();
+                Assert.fail("Unexpected Exception: " + e.toString());
+            }
+        }
+    }
+
+    @Test
+    public void testFilterUsingNext() {
+
+        try {
+            HasNextTypeFilter f = createFilter();
+            XMLStreamReader r1 = createStreamReader(f);
+
+            while (r1.hasNext()) {
+                r1.next();
+                checkHasNext(r1);
+            }
+
+        } catch (Exception e) {
+            // unexpected
+            System.err.println("Unexpected Exception: " + e.getMessage());
+            e.printStackTrace();
+            Assert.fail("Unexpected Exception: " + e.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTest.xml
new file mode 100644
index 00000000000..7b91e3cc71b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTest.xml
@@ -0,0 +1,9 @@
+<?xml version='1.0' encoding='utf-8'?><!-- DTD for a "product information". --><mytext>
+this is some text
+</mytext><!--
+<product
+    name="BEA Weblogic Server 6.0"
+    date="Date of Release 12/18/2000"
+    copyrite="2000-2001 BEA Systems, Inc." />
+--><?process me?>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTypeFilter.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTypeFilter.java
new file mode 100644
index 00000000000..95b3f505a27
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamFilterTest/HasNextTypeFilter.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamFilterTest;
+
+import javax.xml.stream.EventFilter;
+import javax.xml.stream.StreamFilter;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.XMLEvent;
+
+public class HasNextTypeFilter implements EventFilter, StreamFilter {
+
+    protected boolean[] types = new boolean[20];
+
+    public HasNextTypeFilter() {
+    }
+
+    public void addType(int type) {
+        types[type] = true;
+    }
+
+    public boolean accept(XMLEvent e) {
+        return types[e.getEventType()];
+    }
+
+    public boolean accept(XMLStreamReader r) {
+        return types[r.getEventType()];
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/BOMTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/BOMTest.java
new file mode 100644
index 00000000000..eb7c3b44770
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/BOMTest.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6218794
+ * @summary Test XMLStreamReader parses BOM UTF-8 and BOM UTF-16 big endian stream.
+ */
+public class BOMTest {
+    // UTF-8 BOM test file
+    private static final String INPUT_FILE1 = "UTF8-BOM.xml.data";
+    // UTF-16 Big Endian test file
+    private static final String INPUT_FILE2 = "UTF16-BE.wsdl.data";
+
+    @Test
+    public void testBOM() {
+        XMLInputFactory ifac = XMLInputFactory.newInstance();
+        try {
+            XMLStreamReader re = ifac.createXMLStreamReader(this.getClass().getResource(INPUT_FILE1).toExternalForm(),
+                        util.BOMInputStream.createStream("UTF-8", this.getClass().getResourceAsStream(INPUT_FILE1)));
+            while (re.hasNext()) {
+                int event = re.next();
+            }
+            XMLStreamReader re2 = ifac.createXMLStreamReader(this.getClass().getResource(INPUT_FILE2).toExternalForm(),
+                        util.BOMInputStream.createStream("UTF-16BE", this.getClass().getResourceAsStream(INPUT_FILE2)));
+            while (re2.hasNext()) {
+
+                int event = re2.next();
+
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6388460.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6388460.java
new file mode 100644
index 00000000000..4d6b58ad41a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6388460.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 6388460
+ * @summary Test StAX parser can parse UTF-16 wsdl.
+ */
+public class Bug6388460 {
+
+    @Test
+    public void test() {
+        try {
+
+            Source source = new StreamSource(util.BOMInputStream.createStream("UTF-16BE", this.getClass().getResourceAsStream("Hello.wsdl.data")),
+                        this.getClass().getResource("Hello.wsdl.data").toExternalForm());
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            TransformerFactory factory = TransformerFactory.newInstance();
+            Transformer transformer = factory.newTransformer();
+            transformer.transform(source, new StreamResult(baos));
+            System.out.println(new String(baos.toByteArray()));
+            ByteArrayInputStream bis = new ByteArrayInputStream(baos.toByteArray());
+            InputSource inSource = new InputSource(bis);
+
+            XMLInputFactory xmlInputFactory = XMLInputFactory.newInstance();
+            xmlInputFactory.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+            XMLStreamReader reader = xmlInputFactory.createXMLStreamReader(inSource.getSystemId(), inSource.getByteStream());
+            while (reader.hasNext()) {
+                reader.next();
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace(System.err);
+            Assert.fail("Exception occured: " + ex.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6472982Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6472982Test.java
new file mode 100644
index 00000000000..830718fe175
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6472982Test.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6472982
+ * @summary Test XMLStreamReader.getNamespaceContext().getPrefix("") won't throw IllegalArgumentException.
+ */
+public class Bug6472982Test {
+    String namespaceURI = "foobar.com";
+    String rootElement = "foo";
+    String childElement = "foochild";
+    String prefix = "a";
+
+    @Test
+    public void testNamespaceContext() {
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            xif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+            InputStream is = new java.io.ByteArrayInputStream(getXML().getBytes());
+            XMLStreamReader sr = xif.createXMLStreamReader(is);
+            NamespaceContext context = sr.getNamespaceContext();
+            Assert.assertTrue(context.getPrefix("") == null);
+
+        } catch (IllegalArgumentException iae) {
+            Assert.fail("NamespacePrefix#getPrefix() should not throw an IllegalArgumentException for empty uri. ");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    String getXML() {
+        StringBuffer sbuffer = new StringBuffer();
+        sbuffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+        sbuffer.append("<" + rootElement + " xmlns:");
+        sbuffer.append(prefix);
+        sbuffer.append("=\"" + namespaceURI + "\">");
+        sbuffer.append("<" + prefix + ":" + childElement + ">");
+        sbuffer.append("blahblah");
+        sbuffer.append("</" + prefix + ":" + childElement + ">");
+        sbuffer.append("</" + rootElement + ">");
+        // System.out.println("XML = " + sbuffer.toString()) ;
+        return sbuffer.toString();
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6767322.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6767322.xml
new file mode 100644
index 00000000000..6cb07c7f317
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6767322.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<IsValidating>
+    Hello World!
+</IsValidating>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6767322Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6767322Test.java
new file mode 100644
index 00000000000..fe0da552cc8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6767322Test.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6767322
+ * @summary Test XMLStreamReader.getVersion() returns null if a version isn't declared.
+ */
+public class Bug6767322Test {
+    private static final String INPUT_FILE = "Bug6767322.xml";
+
+    @Test
+    public void testVersionSet() {
+        try {
+            XMLStreamReader r = XMLInputFactory.newInstance().createXMLStreamReader(this.getClass().getResource(INPUT_FILE).toExternalForm(),
+                    this.getClass().getResourceAsStream(INPUT_FILE));
+
+            String version = r.getVersion();
+            System.out.println("Bug6767322.xml: " + version);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testVersionNotSet() {
+        try {
+            String xmlText = "Version not declared";
+            XMLStreamReader r = XMLInputFactory.newInstance().createXMLStreamReader(new ByteArrayInputStream(xmlText.getBytes()));
+            String version = r.getVersion();
+            System.out.println("Version for text \"" + xmlText + "\": " + version);
+            if (version != null) {
+                Assert.fail("getVersion should return null");
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6847819Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6847819Test.java
new file mode 100644
index 00000000000..c9211c06781
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Bug6847819Test.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+
+/*
+ * @bug 6847819
+ * @summary Test StAX parser shall throw XMLStreamException for illegal xml declaration.
+ */
+public class Bug6847819Test {
+
+    @Test
+    public void testIllegalDecl() throws XMLStreamException {
+        String xml = "<?xml ?><root>abc]]>xyz</root>";
+        String msg = "illegal declaration";
+        try {
+            XMLInputFactory inputFactory = XMLInputFactory.newInstance();
+            inputFactory.createXMLStreamReader(new StringReader(xml));
+            Assert.fail("Expected an exception for " + msg);
+        } catch (XMLStreamException ex) { // good
+            System.out.println("Expected failure: '" + ex.getMessage() + "' " + "(matching message: '" + msg + "')");
+        } catch (Exception ex2) { // ok; iff links to XMLStreamException
+            Throwable t = ex2;
+            while (t.getCause() != null && !(t instanceof XMLStreamException)) {
+                t = t.getCause();
+            }
+            if (t instanceof XMLStreamException) {
+                System.out.println("Expected failure: '" + ex2.getMessage() + "' " + "(matching message: '" + msg + "')");
+            }
+            if (t == ex2) {
+                Assert.fail("Expected an XMLStreamException (either direct, or getCause() of a primary exception) for " + msg + ", got: " + ex2);
+            }
+            Assert.fail("Expected an XMLStreamException (either direct, or getCause() of a primary exception) for " + msg + ", got: " + ex2 + " (root: " + t + ")");
+        }
+
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/BugTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/BugTest.java
new file mode 100644
index 00000000000..2499a07db4a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/BugTest.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test StAX parser can parse xml without declaration.
+ */
+public class BugTest {
+
+    @Test
+    public static void test1() throws Exception {
+        XMLInputFactory xif = XMLInputFactory.newInstance(); // new
+                                                             // com.sun.xml.stream.ZephyrParserFactory();
+        XMLStreamReader r = xif.createXMLStreamReader(new StringReader("<foo/>"));
+        Assert.assertEquals(XMLStreamConstants.START_DOCUMENT, r.getEventType());
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/DefaultAttributeTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/DefaultAttributeTest.java
new file mode 100644
index 00000000000..33e8c5b9353
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/DefaultAttributeTest.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.util.Iterator;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.StartElement;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test StAX parses namespace and attribute.
+ */
+public class DefaultAttributeTest {
+
+    private static final String INPUT_FILE = "ExternalDTD.xml";
+
+    @Test
+    public void testStreamReader() {
+        XMLInputFactory ifac = XMLInputFactory.newInstance();
+        XMLOutputFactory ofac = XMLOutputFactory.newInstance();
+
+        try {
+            ifac.setProperty(ifac.IS_REPLACING_ENTITY_REFERENCES, new Boolean(false));
+
+            XMLStreamReader re = ifac.createXMLStreamReader(this.getClass().getResource(INPUT_FILE).toExternalForm(),
+                    this.getClass().getResourceAsStream(INPUT_FILE));
+
+            while (re.hasNext()) {
+                int event = re.next();
+                if (event == XMLStreamConstants.START_ELEMENT && re.getLocalName().equals("bookurn")) {
+                    Assert.assertTrue(re.getAttributeCount() == 0, "No attributes are expected for <bookurn> ");
+                    Assert.assertTrue(re.getNamespaceCount() == 2, "Two namespaces are expected for <bookurn> ");
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testEventReader() {
+        try {
+            XMLInputFactory ifac = XMLInputFactory.newInstance();
+            XMLEventReader read = ifac.createXMLEventReader(this.getClass().getResource(INPUT_FILE).toExternalForm(),
+                    this.getClass().getResourceAsStream(INPUT_FILE));
+            while (read.hasNext()) {
+                XMLEvent event = read.nextEvent();
+                if (event.isStartElement()) {
+                    StartElement startElement = event.asStartElement();
+                    if (startElement.getName().getLocalPart().equals("bookurn")) {
+                        Iterator iterator = startElement.getNamespaces();
+                        int count = 0;
+                        while (iterator.hasNext()) {
+                            iterator.next();
+                            count++;
+                        }
+                        Assert.assertTrue(count == 2, "Two namespaces are expected for <bookurn> ");
+
+                        Iterator attributes = startElement.getAttributes();
+                        count = 0;
+                        while (attributes.hasNext()) {
+                            iterator.next();
+                            count++;
+                        }
+                        Assert.assertTrue(count == 0, "Zero attributes are expected for <bookurn> ");
+                    }
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/DoubleXmlnsTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/DoubleXmlnsTest.java
new file mode 100644
index 00000000000..da73bd6cc91
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/DoubleXmlnsTest.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test double namespaces and nested namespaces.
+ */
+public class DoubleXmlnsTest {
+
+    @Test
+    public void testDoubleNS() throws Exception {
+
+        final String INVALID_XML = "<foo xmlns:xmli='http://www.w3.org/XML/1998/namespacei' xmlns:xmli='http://www.w3.org/XML/1998/namespacei' />";
+
+        try {
+            XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(INVALID_XML));
+
+            while (xsr.hasNext()) {
+                xsr.next();
+            }
+
+            Assert.fail("Wellformedness error expected: " + INVALID_XML);
+        } catch (XMLStreamException e) {
+            ; // this is expected
+        }
+    }
+
+    @Test
+    public void testNestedNS() throws Exception {
+
+        final String VALID_XML = "<foo xmlns:xmli='http://www.w3.org/XML/1998/namespacei'><bar xmlns:xmli='http://www.w3.org/XML/1998/namespaceii'></bar></foo>";
+
+        try {
+            XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(VALID_XML));
+
+            while (xsr.hasNext()) {
+                xsr.next();
+            }
+
+            // expected success
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+
+            Assert.fail("Wellformedness error is not expected: " + VALID_XML + ", " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testDoubleXmlns() throws Exception {
+
+        final String INVALID_XML = "<foo xmlns:xml='http://www.w3.org/XML/1998/namespace' xmlns:xml='http://www.w3.org/XML/1998/namespace' ></foo>";
+
+        try {
+            XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(INVALID_XML));
+
+            while (xsr.hasNext()) {
+                xsr.next();
+            }
+
+            Assert.fail("Wellformedness error expected :" + INVALID_XML);
+        } catch (XMLStreamException e) {
+            ; // this is expected
+        }
+    }
+
+    @Test
+    public void testNestedXmlns() throws Exception {
+
+        final String VALID_XML = "<foo xmlns:xml='http://www.w3.org/XML/1998/namespace'><bar xmlns:xml='http://www.w3.org/XML/1998/namespace'></bar></foo>";
+
+        try {
+            XMLStreamReader xsr = XMLInputFactory.newInstance().createXMLStreamReader(new StringReader(VALID_XML));
+
+            while (xsr.hasNext()) {
+                xsr.next();
+            }
+
+            // expected success
+        } catch (XMLStreamException e) {
+            e.printStackTrace();
+            Assert.fail("Wellformedness error is not expected: " + VALID_XML + ", " + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.dtd
new file mode 100644
index 00000000000..6fbfdfeb67b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.dtd
@@ -0,0 +1,13 @@
+<!ELEMENT document ANY>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT publisher (#PCDATA)>
+<!ELEMENT book (#PCDATA)>
+<!ELEMENT bookurn (#PCDATA)>
+<!ELEMENT xmlns:pages (#PCDATA)>
+<!ATTLIST book price CDATA "$100">
+<!ATTLIST book author CDATA "Herold">
+<!ATTLIST book number ID #REQUIRED>
+<!ATTLIST bookurn xmlns CDATA "10">
+<!ATTLIST bookurn xmlns:isbn CDATA "10">
+<!ENTITY mkm "I am Krishna">
+<!ENTITY km "I am KrishnaMohan">
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.dtd.bak b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.dtd.bak
new file mode 100644
index 00000000000..6fbfdfeb67b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.dtd.bak
@@ -0,0 +1,13 @@
+<!ELEMENT document ANY>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT publisher (#PCDATA)>
+<!ELEMENT book (#PCDATA)>
+<!ELEMENT bookurn (#PCDATA)>
+<!ELEMENT xmlns:pages (#PCDATA)>
+<!ATTLIST book price CDATA "$100">
+<!ATTLIST book author CDATA "Herold">
+<!ATTLIST book number ID #REQUIRED>
+<!ATTLIST bookurn xmlns CDATA "10">
+<!ATTLIST bookurn xmlns:isbn CDATA "10">
+<!ENTITY mkm "I am Krishna">
+<!ENTITY km "I am KrishnaMohan">
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.xml
new file mode 100644
index 00000000000..c4fab83ca91
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding ="utf-8"?>
+<!DOCTYPE document SYSTEM "ExternalDTD.dtd" [
+<!ENTITY max "Substituted text">
+]>
+<!-- ExternalDTD throws a Negative array size Exception when 
+trying to parse with the above DTD reference AND an entity declaration-->
+<document>
+	<title>The Publishers </title>
+	<publisher>        
+	Alfred Publishing
+	15535 Morrison
+	South Oaks CA 91403
+        &max;
+	</publisher>
+	<book price="$100" author = "Herold" number = "no_11">eXtensible Markup Language</book>
+  	<bookurn xmlns='urn:loc.gov:books' xmlns:isbn='urn:ISBN:0-395-36341-6'/> 
+        <pb/>
+	<pages />
+</document>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.xml.bak b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.xml.bak
new file mode 100644
index 00000000000..c4fab83ca91
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.xml.bak
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding ="utf-8"?>
+<!DOCTYPE document SYSTEM "ExternalDTD.dtd" [
+<!ENTITY max "Substituted text">
+]>
+<!-- ExternalDTD throws a Negative array size Exception when 
+trying to parse with the above DTD reference AND an entity declaration-->
+<document>
+	<title>The Publishers </title>
+	<publisher>        
+	Alfred Publishing
+	15535 Morrison
+	South Oaks CA 91403
+        &max;
+	</publisher>
+	<book price="$100" author = "Herold" number = "no_11">eXtensible Markup Language</book>
+  	<bookurn xmlns='urn:loc.gov:books' xmlns:isbn='urn:ISBN:0-395-36341-6'/> 
+        <pb/>
+	<pages />
+</document>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Hello.wsdl.data b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Hello.wsdl.data
new file mode 100644
index 00000000000..15db4aa7ebf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Hello.wsdl.data
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-16"?>
+<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+	xmlns:tns="http://www.example.org/Hello/"
+	xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+	xmlns:xsd="http://www.w3.org/2001/XMLSchema" name="Hello"
+	targetNamespace="http://www.example.org/Hello/">
+	
+	<wsdl:message name="SayHelloResponse">
+		<wsdl:part name="SayHelloResponse" type="xsd:string" />
+	</wsdl:message>
+	<wsdl:message name="SayHelloRequest">
+		<wsdl:part name="SayHelloRequest" type="xsd:string" />
+	</wsdl:message>
+	<wsdl:portType name="Hello">
+		<wsdl:operation name="SayHello">
+			<wsdl:input message="tns:SayHelloRequest" />
+			<wsdl:output message="tns:SayHelloResponse" />
+		</wsdl:operation>
+	</wsdl:portType>
+	
+	<wsdl:binding name="HelloSOAP" type="tns:Hello">
+		<soap:binding style="rpc"
+			transport="http://schemas.xmlsoap.org/soap/http" />
+		<wsdl:operation name="SayHello">
+			<soap:operation
+				soapAction="http://www.example.org/Hello/SayHello" />
+			<wsdl:input>
+				<soap:body namespace="http://www.example.org/Hello/"
+					parts="SayHelloRequest" use="literal" />
+			</wsdl:input>
+			<wsdl:output>
+				<soap:body namespace="http://www.example.org/Hello/"
+					parts="SayHelloResponse" use="literal" />
+			</wsdl:output>
+		</wsdl:operation>
+	</wsdl:binding>
+	<wsdl:service name="Hello">
+		<wsdl:port binding="tns:HelloSOAP" name="HelloSOAP">
+			<soap:address location="http://www.example.org/" />
+		</wsdl:port>
+	</wsdl:service>
+</wsdl:definitions>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTest.java
new file mode 100644
index 00000000000..dcd2d39b2bb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTest.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6440324
+ * @summary Test StAX can accept non-existent DTD if IS_VALIDATING if false.
+ */
+public class IsValidatingTest {
+
+    /**
+     * File with non-existent DTD.
+     */
+    private static final String INPUT_FILE = "IsValidatingTest.xml";
+    /**
+     * File with internal subset and non-existent DTD.
+     */
+    private static final String INPUT_FILE_INTERNAL_SUBSET = "IsValidatingTestInternalSubset.xml";
+
+    /**
+     * Test StAX with IS_VALIDATING = false and a non-existent DTD.
+     * Test should pass.
+     *
+     * Try to parse an XML file that references a a non-existent DTD.
+     * Desired behavior:
+     *     If IS_VALIDATING == false, then continue processing.
+     *
+     * Note that an attempt is made to read the DTD even if IS_VALIDATING == false.
+     * This is not required for DTD validation, but for entity resolution.
+     * The XML specification allows the optional reading of an external DTD
+     * even for non-validating processors.
+     *
+     */
+    @Test
+    public void testStAXIsValidatingFalse() {
+
+        XMLStreamReader reader = null;
+        Boolean isValidating = null;
+        String propertyValues = null;
+        boolean dtdEventOccured = false;
+
+        XMLInputFactory xif = XMLInputFactory.newInstance();
+        xif.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
+
+        try {
+            reader = xif.createXMLStreamReader(this.getClass().getResource(INPUT_FILE).toExternalForm(), this.getClass().getResourceAsStream(INPUT_FILE));
+
+            isValidating = (Boolean) reader.getProperty(XMLInputFactory.IS_VALIDATING);
+            propertyValues = "IS_VALIDATING=" + isValidating;
+
+            while (reader.hasNext()) {
+                int e = reader.next();
+                if (e == XMLEvent.DTD) {
+                    dtdEventOccured = true;
+                    System.out.println("testStAXIsValidatingFalse(): " + "reader.getText() with Event == DTD: " + reader.getText());
+                }
+            }
+
+            // expected success
+
+            // should have see DTD Event
+            if (!dtdEventOccured) {
+                Assert.fail("Unexpected failure: did not see DTD event");
+            }
+        } catch (Exception e) {
+            // unexpected failure
+            System.err.println("Exception with reader.getEventType(): " + reader.getEventType());
+            e.printStackTrace();
+            Assert.fail("Unexpected failure with " + propertyValues + ", " + e.toString());
+        }
+    }
+
+    /**
+     * Test StAX with IS_VALIDATING = false, an internal subset and a
+     * non-existent DTD.
+     *
+     * Test should pass.
+     */
+    @Test
+    public void testStAXIsValidatingFalseInternalSubset() {
+
+        XMLStreamReader reader = null;
+        Boolean isValidating = null;
+        String propertyValues = null;
+        boolean dtdEventOccured = false;
+        boolean entityReferenceEventOccured = false;
+
+        XMLInputFactory xif = XMLInputFactory.newInstance();
+        xif.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.FALSE);
+        xif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.FALSE);
+
+        try {
+            reader = xif.createXMLStreamReader(this.getClass().getResource(INPUT_FILE).toExternalForm(),
+                    this.getClass().getResourceAsStream(INPUT_FILE_INTERNAL_SUBSET));
+
+            isValidating = (Boolean) reader.getProperty(XMLInputFactory.IS_VALIDATING);
+            propertyValues = "IS_VALIDATING=" + isValidating;
+
+            while (reader.hasNext()) {
+                int e = reader.next();
+                if (e == XMLEvent.DTD) {
+                    dtdEventOccured = true;
+                    System.out.println("testStAXIsValidatingFalseInternalSubset(): " + "reader.getText() with Event == DTD: " + reader.getText());
+                } else if (e == XMLEvent.ENTITY_REFERENCE) {
+                    // expected ENTITY_REFERENCE values?
+                    if (reader.getLocalName().equals("foo") && reader.getText().equals("bar")) {
+                        entityReferenceEventOccured = true;
+                    }
+
+                    System.out.println("testStAXIsValidatingFalseInternalSubset(): " + "reader.get(LocalName, Text)() with Event " + " == ENTITY_REFERENCE: "
+                            + reader.getLocalName() + " = " + reader.getText());
+                }
+            }
+
+            // expected success
+
+            // should have see DTD Event
+            if (!dtdEventOccured) {
+                Assert.fail("Unexpected failure: did not see DTD event");
+            }
+
+            // should have seen an ENITY_REFERENCE Event
+            if (!entityReferenceEventOccured) {
+                Assert.fail("Unexpected failure: did not see ENTITY_REFERENCE event");
+            }
+        } catch (Exception e) {
+            // unexpected failure
+            System.err.println("Exception with reader.getEventType(): " + reader.getEventType());
+            e.printStackTrace();
+            Assert.fail("Unexpected failure with " + propertyValues + ", " + e.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTest.xml
new file mode 100644
index 00000000000..cc50489b199
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTest.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright (c) 2014, 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.
+ */
+-->
+
+<!DOCTYPE IsValidating SYSTEM 'IsValidating.dtd'>
+<IsValidating>
+    Hello World!
+</IsValidating>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTestInternalSubset.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTestInternalSubset.xml
new file mode 100644
index 00000000000..1de5c8446d6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IsValidatingTestInternalSubset.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright (c) 2014, 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.
+ */
+-->
+
+<!DOCTYPE IsValidating SYSTEM 'IsValidating.dtd' [
+    <!ENTITY foo "bar">
+]>
+<IsValidating>
+    Hello &foo; World!
+</IsValidating>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Issue44Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Issue44Test.java
new file mode 100644
index 00000000000..47ed0bc9ff9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Issue44Test.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6631262
+ * @summary Test XMLStreamReader.getName() shall throw IllegalStateException if current event is not start/end element.
+ */
+public class Issue44Test {
+
+    @Test
+    public void testStartElement() {
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            // File file = new File("./tests/XMLStreamReader/sgml.xml");
+            // FileInputStream inputStream = new FileInputStream(file);
+            XMLStreamReader xsr = xif.createXMLStreamReader(this.getClass().getResourceAsStream("sgml.xml"));
+
+            xsr.getName();
+        } catch (IllegalStateException ise) {
+            // expected
+            System.out.println(ise.getMessage());
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Issue47Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Issue47Test.java
new file mode 100644
index 00000000000..736971d1f5a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Issue47Test.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.AssertJUnit;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6631265
+ * @summary Test XMLStreamReader.standaloneSet() presents if input document has a value for "standalone" attribute in xml declaration.
+ */
+public class Issue47Test {
+
+    @Test
+    public void testStandaloneSet() {
+        final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><prefix:root xmlns=\"\" xmlns:null=\"\"></prefix:root>";
+
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            XMLStreamReader r = xif.createXMLStreamReader(new StringReader(xml));
+            Assert.assertTrue(!r.standaloneSet() && !r.isStandalone());
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testStandaloneSet1() {
+        final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?><prefix:root xmlns=\"\" xmlns:null=\"\"></prefix:root>";
+
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            XMLStreamReader r = xif.createXMLStreamReader(new StringReader(xml));
+            Assert.assertTrue(r.standaloneSet() && !r.isStandalone());
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testStandaloneSet2() {
+        final String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><prefix:root xmlns=\"\" xmlns:null=\"\"></prefix:root>";
+
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            XMLStreamReader r = xif.createXMLStreamReader(new StringReader(xml));
+            AssertJUnit.assertTrue(r.standaloneSet() && r.isStandalone());
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker24.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker24.java
new file mode 100644
index 00000000000..0d2f723fcd1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker24.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.StringReader;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test no prefix is represented by "", not null.
+ */
+public class IssueTracker24 {
+
+    @Test
+    public void testInconsistentGetPrefixBehaviorWhenNoPrefix() throws Exception {
+        String xml = "<root><child xmlns='foo'/><anotherchild/></root>";
+
+        XMLInputFactory factory = XMLInputFactory.newInstance();
+        XMLStreamReader r = factory.createXMLStreamReader(new StringReader(xml));
+        r.require(XMLStreamReader.START_DOCUMENT, null, null);
+        r.next();
+        r.require(XMLStreamReader.START_ELEMENT, null, "root");
+        Assert.assertEquals(r.getPrefix(), "", "prefix should be empty string");
+        r.next();
+        r.require(XMLStreamReader.START_ELEMENT, null, "child");
+        r.next();
+        r.next();
+        r.require(XMLStreamReader.START_ELEMENT, null, "anotherchild");
+        Assert.assertEquals(r.getPrefix(), "", "prefix should be empty string");
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker35.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker35.java
new file mode 100644
index 00000000000..2f93c9810b6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker35.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.InputStream;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test StAX parse xsd document including external DTD.
+ */
+public class IssueTracker35 {
+
+    @Test
+    public void testSkippingExternalDTD() throws Exception {
+        XMLInputFactory xif = XMLInputFactory.newInstance();
+        try(
+                InputStream is= getClass().getResourceAsStream("XMLSchema.xsd");
+        ) {
+                XMLStreamReader reader = xif.createXMLStreamReader(getClass().getResource("XMLSchema.xsd").getFile(), is);
+                int e;
+                while ((e = reader.next()) == XMLStreamConstants.COMMENT);
+
+                Assert.assertEquals(e, XMLStreamConstants.DTD, "should be DTD");
+                reader.nextTag();
+                Assert.assertEquals(reader.getLocalName(), "schema", "next tag should be schema");
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker70.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker70.java
new file mode 100644
index 00000000000..ed9dc284943
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker70.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.function.Consumer;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test it can retrieve attribute with null or empty name space.
+ */
+public class IssueTracker70 {
+
+    static private final File testFile = new File(IssueTracker70.class.getResource("IssueTracker70.xml").getFile());
+
+    @Test
+    public void testGetAttributeValueWithNullNs() throws Exception {
+        testGetAttributeValueWithNs(null, "attribute2", this::checkNull);
+    }
+
+    @Test
+    public void testGetAttributeValueWithEmptyNs() throws Exception {
+        testGetAttributeValueWithNs("", "attribute1", this::checkNull);
+    }
+
+
+    private void testGetAttributeValueWithNs(String nameSpace, String attrName, Consumer<String> checker) throws Exception {
+        XMLInputFactory xif = XMLInputFactory.newInstance();
+        XMLStreamReader xsr = xif.createXMLStreamReader(new FileInputStream(testFile));
+
+        while (xsr.hasNext()) {
+            xsr.next();
+            if (xsr.isStartElement()) {
+                String v;
+                v = xsr.getAttributeValue(nameSpace, attrName);
+                checker.accept(v);
+            }
+        }
+    }
+
+    private void checkNull(String value)
+    {
+        Assert.assertNotNull(value, "should have attribute value");
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker70.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker70.xml
new file mode 100644
index 00000000000..2cfeba3fa48
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/IssueTracker70.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<element xmlns:space="foo" 
+    attribute1="value1" space:attribute2="value2" attribute3="value3"/>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req5.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req5.xml
new file mode 100644
index 00000000000..7c4f7dacff5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req5.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding ="utf-8"?>
+<foo attr1="bar" xmlns="foo.com" xmlns:pre="somefix"/>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java
new file mode 100644
index 00000000000..c58fd03908d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req5Test.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamReader parses namespace declaration within element when NamespaceAware turns off and on.
+ */
+public class Jsr173MR1Req5Test {
+
+    private static final String INPUT_FILE1 = "Jsr173MR1Req5.xml";
+
+    @Test
+    public void testAttributeCountNoNS() {
+        XMLInputFactory ifac = XMLInputFactory.newInstance();
+
+        try {
+            // Turn off NS awareness to count xmlns as attributes
+            ifac.setProperty("javax.xml.stream.isNamespaceAware", Boolean.FALSE);
+
+            XMLStreamReader re = ifac.createXMLStreamReader(getClass().getResource(INPUT_FILE1).toExternalForm(),
+                    this.getClass().getResourceAsStream(INPUT_FILE1));
+            while (re.hasNext()) {
+                int event = re.next();
+                if (event == XMLStreamConstants.START_ELEMENT) {
+                    // System.out.println("#attrs = " + re.getAttributeCount());
+                    Assert.assertTrue(re.getAttributeCount() == 3);
+                }
+            }
+            re.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testAttributeCountNS() {
+        XMLInputFactory ifac = XMLInputFactory.newInstance();
+
+        try {
+            // Turn on NS awareness to not count xmlns as attributes
+            ifac.setProperty("javax.xml.stream.isNamespaceAware", Boolean.TRUE);
+
+            XMLStreamReader re = ifac.createXMLStreamReader(getClass().getResource(INPUT_FILE1).toExternalForm(),
+                    this.getClass().getResourceAsStream(INPUT_FILE1));
+            while (re.hasNext()) {
+                int event = re.next();
+                if (event == XMLStreamConstants.START_ELEMENT) {
+                    // System.out.println("#attrs = " + re.getAttributeCount());
+                    Assert.assertTrue(re.getAttributeCount() == 1);
+                }
+            }
+            re.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req8.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req8.xml
new file mode 100644
index 00000000000..3bc4dbf5e2c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req8.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding ="utf-8"?>
+<foo attr1="pass" pre:attr1="fail" xmlns="foo.com" xmlns:pre="somefix"/>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java
new file mode 100644
index 00000000000..c39106f24bc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/Jsr173MR1Req8Test.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamReader parses attribute with namespace aware.
+ */
+public class Jsr173MR1Req8Test {
+
+    private static final String INPUT_FILE1 = "Jsr173MR1Req8.xml";
+
+    @Test
+    public void testDefaultAttrNS() {
+        XMLInputFactory ifac = XMLInputFactory.newInstance();
+
+        try {
+            XMLStreamReader re = ifac.createXMLStreamReader(getClass().getResource(INPUT_FILE1).toExternalForm(),
+                    this.getClass().getResourceAsStream(INPUT_FILE1));
+            while (re.hasNext()) {
+                int event = re.next();
+                if (event == XMLStreamConstants.START_ELEMENT) {
+                    // System.out.println("#attrs = " + re.getAttributeCount());
+                    Assert.assertTrue(re.getAttributeCount() == 2);
+                    // This works if "" is replaced by null too
+                    // System.out.println("attr1 = " + re.getAttributeValue("",
+                    // "attr1"));
+                    Assert.assertTrue(re.getAttributeValue("", "attr1").equals("pass"));
+                }
+            }
+            re.close();
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/NamespaceTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/NamespaceTest.java
new file mode 100644
index 00000000000..75d32705daf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/NamespaceTest.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.InputStream;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test StAX parser processes namespace.
+ */
+public class NamespaceTest {
+
+    String namespaceURI = "foobar.com";
+    String rootElement = "foo";
+    String childElement = "foochild";
+    String prefix = "a";
+
+    // Add test methods here, they have to start with 'test' name.
+    // for example:
+    // public void testHello() {}
+
+    String getXML() {
+        StringBuffer sbuffer = new StringBuffer();
+        sbuffer.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");
+        sbuffer.append("<" + rootElement + " xmlns:");
+        sbuffer.append(prefix);
+        sbuffer.append("=\"" + namespaceURI + "\">");
+        sbuffer.append("<" + prefix + ":" + childElement + ">");
+        sbuffer.append("blahblah");
+        sbuffer.append("</" + prefix + ":" + childElement + ">");
+        sbuffer.append("</" + rootElement + ">");
+        // System.out.println("XML = " + sbuffer.toString()) ;
+        return sbuffer.toString();
+    }
+
+    @Test
+    public void testRootElementNamespace() {
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            xif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+            InputStream is = new java.io.ByteArrayInputStream(getXML().getBytes());
+            XMLStreamReader sr = xif.createXMLStreamReader(is);
+            while (sr.hasNext()) {
+                int eventType = sr.next();
+                if (eventType == XMLStreamConstants.START_ELEMENT) {
+                    if (sr.getLocalName().equals(rootElement)) {
+                        Assert.assertTrue(sr.getNamespacePrefix(0).equals(prefix) && sr.getNamespaceURI(0).equals(namespaceURI));
+                    }
+                }
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testChildElementNamespace() {
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            xif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+            InputStream is = new java.io.ByteArrayInputStream(getXML().getBytes());
+            XMLStreamReader sr = xif.createXMLStreamReader(is);
+            while (sr.hasNext()) {
+                int eventType = sr.next();
+                if (eventType == XMLStreamConstants.START_ELEMENT) {
+                    if (sr.getLocalName().equals(childElement)) {
+                        QName qname = sr.getName();
+                        Assert.assertTrue(qname.getPrefix().equals(prefix) && qname.getNamespaceURI().equals(namespaceURI)
+                                && qname.getLocalPart().equals(childElement));
+                    }
+                }
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testNamespaceContext() {
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            xif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+            InputStream is = new java.io.ByteArrayInputStream(getXML().getBytes());
+            XMLStreamReader sr = xif.createXMLStreamReader(is);
+            while (sr.hasNext()) {
+                int eventType = sr.next();
+                if (eventType == XMLStreamConstants.START_ELEMENT) {
+                    if (sr.getLocalName().equals(childElement)) {
+                        NamespaceContext context = sr.getNamespaceContext();
+                        Assert.assertTrue(context.getPrefix(namespaceURI).equals(prefix));
+                    }
+                }
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testNamespaceCount() {
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            xif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+            InputStream is = new java.io.ByteArrayInputStream(getXML().getBytes());
+            XMLStreamReader sr = xif.createXMLStreamReader(is);
+            while (sr.hasNext()) {
+                int eventType = sr.next();
+                if (eventType == XMLStreamConstants.START_ELEMENT) {
+                    if (sr.getLocalName().equals(rootElement)) {
+                        int count = sr.getNamespaceCount();
+                        Assert.assertTrue(count == 1);
+                    }
+                }
+            }
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/StreamReaderTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/StreamReaderTest.java
new file mode 100644
index 00000000000..8b7475db66a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/StreamReaderTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamReader.hasName() returns false for ENTITY_REFERENCE.
+ */
+public class StreamReaderTest {
+
+    /**
+     * CR 6631264 / sjsxp Issue 45:
+     * https://sjsxp.dev.java.net/issues/show_bug.cgi?id=45
+     * XMLStreamReader.hasName() should return false for ENTITY_REFERENCE
+     */
+    @Test
+    public void testHasNameOnEntityEvent() throws Exception {
+        XMLInputFactory xif = XMLInputFactory.newInstance();
+        xif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, false);
+        XMLStreamReader r = xif.createXMLStreamReader(this.getClass().getResourceAsStream("ExternalDTD.xml"));
+        while (r.next() != XMLStreamConstants.ENTITY_REFERENCE) {
+            System.out.println("event type: " + r.getEventType());
+            continue;
+        }
+        if (r.hasName()) {
+            System.out.println("hasName returned true on ENTITY_REFERENCE event.");
+        }
+        Assert.assertFalse(r.hasName()); // fails
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/SupportDTDTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/SupportDTDTest.java
new file mode 100644
index 00000000000..7b8e28e8a01
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/SupportDTDTest.java
@@ -0,0 +1,284 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.StringReader;
+import java.util.List;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.events.Characters;
+import javax.xml.stream.events.DTD;
+import javax.xml.stream.events.EntityDeclaration;
+import javax.xml.stream.events.EntityReference;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test SUPPORT_DTD and IS_REPLACING_ENTITY_REFERENCES.
+ */
+
+/**
+*
+* SUPPORT_DTD behavior:
+* Regardless of supportDTD, always report a DTD event () and throw an
+* exception if an entity reference is found when supportDTD is false
+*
+* The behavior is related to property IS_REPLACING_ENTITY_REFERENCES.
+*
+* SUPPORT_DTD      Replace Entity   DTD                    ENTITY_REFERENCE
+* true (default)   true (default)   yes, has entities      no, return Characters
+* true (default)   false            yes, has entities      yes, can print entity name
+* false            true (default)   yes, but no entity     Exception: Undeclared general entity
+* false            false            yes, but no entity     yes, can print entity name
+*
+* Two patches related:
+* sjsxp issue 9: XMLDocumentScannerImpl.java rev 1.6
+* If the supportDTD property is set to FALSE, external and internal subsets
+* are now ignored, rather than an error being reported. In particular, with
+* this property set to FALSE, no error is reported if an external subset cannot
+* be found. Note that the internal subset is still parsed (and errors could be
+* reported here) but no events are returned by the parser. This fixes SJSXP
+* issue 9 from Java.net.
+* Note: SAX and DOM report fatal errors:
+*       If either SAX or DOM is used, turning on http://apache.org/xml/features/disallow-doctype-decl [1] effectively disables DTD,
+*       according to the spec: A fatal error is thrown if the incoming document contains a DOCTYPE declaration.
+*       The current jaxp implementation actually throws a nullpointexception. A better error message could be used.
+*
+*/
+public class SupportDTDTest {
+    final boolean DEBUG = false;
+    final String _file = "ExternalDTD.xml";
+    final String XML = "<?xml version='1.0' ?>" + "<!DOCTYPE root [\n" + "<!ENTITY intEnt 'internal entity'>\n" + "<!ENTITY extParsedEnt SYSTEM 'url:dummy'>\n"
+            + "<!NOTATION notation PUBLIC 'notation-public-id'>\n" + "<!NOTATION notation2 SYSTEM 'url:dummy'>\n"
+            + "<!ENTITY extUnparsedEnt SYSTEM 'url:dummy2' NDATA notation>\n" + "]>" + "<root>&intEnt;</root>";
+
+    final String XML1 = "<?xml version='1.0' encoding ='utf-8'?>" + "<!DOCTYPE document SYSTEM \"" + this.getClass().getResource("ExternalDTD.dtd").getFile()
+            + "\">" + "<document>" + "<name>&mkm;</name>" + "</document>";
+
+   // final String XML1 = "<?xml version='1.0' encoding ='utf-8'?>" + "<!DOCTYPE document SYSTEM \"/home/oracle/repo/xmlwork/dev/jdk/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/ExternalDTD.dtd\">" + "<document>"
+   //         + "<name>&mkm;</name>" + "</document>";
+
+    final int ENTITY_INTERNAL_ONLY = 1;
+    final int ENTITY_EXTERNAL_ONLY = 2;
+    final int ENTITY_BOTH = 3;
+
+    boolean _DTDReturned = false;
+    boolean _EntityEventReturned = false;
+    boolean _hasEntityDelaration = false;
+    boolean _exceptionThrown = false;
+
+    /** Creates a new instance of StreamReader */
+    public SupportDTDTest(String name) {
+    }
+
+    void reset() {
+        _DTDReturned = false;
+        _EntityEventReturned = false;
+        _hasEntityDelaration = false;
+        _exceptionThrown = false;
+    }
+
+    // tests 1-4 test internal entities only
+    @Test
+    public void test1() {
+        supportDTD(true, true, ENTITY_INTERNAL_ONLY);
+        Assert.assertEquals(true, _DTDReturned);
+        Assert.assertEquals(true, _hasEntityDelaration);
+        Assert.assertEquals(false, _EntityEventReturned);
+    }
+
+    @Test
+    public void test2() {
+        supportDTD(true, false, ENTITY_INTERNAL_ONLY);
+        Assert.assertEquals(true, _DTDReturned);
+        Assert.assertEquals(true, _hasEntityDelaration);
+        Assert.assertEquals(true, _EntityEventReturned);
+    }
+
+    @Test
+    public void test3() {
+        supportDTD(false, true, ENTITY_INTERNAL_ONLY);
+        Assert.assertEquals(true, _DTDReturned);
+        Assert.assertEquals(false, _hasEntityDelaration);
+        Assert.assertEquals(true, _exceptionThrown);
+    }
+
+    @Test
+    public void test4() {
+        supportDTD(false, false, ENTITY_INTERNAL_ONLY);
+        Assert.assertEquals(true, _DTDReturned);
+        Assert.assertEquals(false, _hasEntityDelaration);
+        Assert.assertEquals(true, _EntityEventReturned);
+    }
+
+    // tests 5-8 test external entities only
+    @Test
+    public void test5() {
+        supportDTD(true, true, ENTITY_EXTERNAL_ONLY);
+        Assert.assertEquals(true, _DTDReturned);
+        Assert.assertEquals(true, _hasEntityDelaration);
+        Assert.assertEquals(false, _EntityEventReturned);
+    }
+
+    @Test
+    public void test6() {
+        supportDTD(true, false, ENTITY_EXTERNAL_ONLY);
+        Assert.assertEquals(true, _DTDReturned);
+        Assert.assertEquals(true, _hasEntityDelaration);
+        Assert.assertEquals(true, _EntityEventReturned);
+    }
+
+    @Test
+    public void test7() {
+        supportDTD(false, true, ENTITY_EXTERNAL_ONLY);
+        Assert.assertEquals(true, _DTDReturned);
+        Assert.assertEquals(false, _hasEntityDelaration);
+        Assert.assertEquals(true, _exceptionThrown);
+    }
+
+    @Test
+    public void test8() {
+        supportDTD(false, false, ENTITY_EXTERNAL_ONLY);
+        Assert.assertEquals(true, _DTDReturned);
+        Assert.assertEquals(false, _hasEntityDelaration);
+        Assert.assertEquals(true, _EntityEventReturned);
+    }
+
+    // tests 9-12 test both internal and external entities
+    @Test
+    public void test9() {
+        supportDTD(true, true, ENTITY_BOTH);
+        Assert.assertEquals(true, _DTDReturned);
+        Assert.assertEquals(true, _hasEntityDelaration);
+        Assert.assertEquals(false, _EntityEventReturned);
+    }
+
+    @Test
+    public void test10() {
+        supportDTD(true, false, ENTITY_BOTH);
+        Assert.assertEquals(true, _DTDReturned);
+        Assert.assertEquals(true, _hasEntityDelaration);
+        Assert.assertEquals(true, _EntityEventReturned);
+    }
+
+    @Test
+    public void test11() {
+        supportDTD(false, true, ENTITY_BOTH);
+        Assert.assertEquals(true, _DTDReturned);
+        Assert.assertEquals(false, _hasEntityDelaration);
+        Assert.assertEquals(true, _exceptionThrown);
+    }
+
+    @Test
+    public void test12() {
+        supportDTD(false, false, ENTITY_BOTH);
+        Assert.assertEquals(true, _DTDReturned);
+        Assert.assertEquals(false, _hasEntityDelaration);
+        Assert.assertEquals(true, _EntityEventReturned);
+    }
+
+    public void supportDTD(boolean supportDTD, boolean replaceEntity, int inputType) {
+        reset();
+        print("\n");
+        print((supportDTD ? "SupportDTD=true" : "SupportDTD=false") + ", " + (replaceEntity ? "replaceEntity=true" : "replaceEntity=false"));
+        try {
+            XMLInputFactory xif = getFactory(supportDTD, replaceEntity);
+            XMLEventReader r = getEventReader(xif, inputType);
+            int eventType = 0;
+            int count = 0;
+            while (r.hasNext()) {
+                XMLEvent event = r.nextEvent();
+                eventType = event.getEventType();
+                print("Event " + ++count + ": " + eventType);
+                switch (eventType) {
+                    case XMLStreamConstants.DTD:
+                        DisplayEntities((DTD) event);
+                        _DTDReturned = true;
+                        break;
+                    case XMLStreamConstants.ENTITY_REFERENCE:
+                        print("Entity Name: " + ((EntityReference) event).getName());
+                        _EntityEventReturned = true;
+                        break;
+                    case XMLStreamConstants.CHARACTERS:
+                        print("Text: " + ((Characters) event).getData());
+                }
+            }
+
+        } catch (Exception e) {
+            _exceptionThrown = true;
+            if (DEBUG)
+                e.printStackTrace();
+        }
+    }
+
+    XMLInputFactory getFactory(boolean supportDTD, boolean replaceEntity) {
+        XMLInputFactory xif = XMLInputFactory.newInstance();
+        xif.setProperty(XMLInputFactory.SUPPORT_DTD, (supportDTD) ? Boolean.TRUE : Boolean.FALSE);
+        xif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, (replaceEntity) ? Boolean.TRUE : Boolean.FALSE);
+        // xif.setProperty(XMLInputFactory.IS_VALIDATING, Boolean.TRUE);
+        return xif;
+    }
+
+    private XMLEventReader getEventReader(XMLInputFactory inputFactory, int input) throws Exception {
+        XMLEventReader er = null;
+        if (input == ENTITY_INTERNAL_ONLY) {
+            er = inputFactory.createXMLEventReader(new StringReader(XML));
+        } else if (input == ENTITY_EXTERNAL_ONLY) {
+            er = inputFactory.createXMLEventReader(new StringReader(XML1));
+        } else {
+            File file = new File(this.getClass().getResource(_file).getFile());
+            FileInputStream inputStream = new FileInputStream(file);
+            // XMLStreamReader r = xif.createXMLStreamReader(inputStream);
+            er = inputFactory.createXMLEventReader(inputStream);
+        }
+        return er;
+    }
+
+    void DisplayEntities(DTD event) {
+        List entities = event.getEntities();
+        if (entities == null) {
+            _hasEntityDelaration = false;
+            print("No entity found.");
+        } else {
+            _hasEntityDelaration = true;
+            for (int i = 0; i < entities.size(); i++) {
+                EntityDeclaration entity = (EntityDeclaration) entities.get(i);
+                print(entity.getName());
+            }
+        }
+
+    }
+
+    void print(String s) {
+        if (DEBUG)
+            System.out.println(s);
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/UTF16-BE.wsdl.data b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/UTF16-BE.wsdl.data
new file mode 100644
index 00000000000..b56821f8fe0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/UTF16-BE.wsdl.data
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-16"?>
+<definitions
+    xmlns="http://schemas.xmlsoap.org/wsdl/"
+    name="W2JDLR4002TestService"
+    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+    targetNamespace="http://w2jdlr4002testservice.org/W2JDLR4002TestService.wsdl"
+    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+    xmlns:tns="http://w2jdlr4002testservice.org/W2JDLR4002TestService.wsdl"
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    xmlns:xsd1="http://w2jdlr4002testservice.org/xsd">
+
+    <types>
+        <schema targetNamespace="http://w2jdlr4002testservice.org/xsd"
+            xmlns="http://www.w3.org/2001/XMLSchema"
+            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
+            elementFormDefault="qualified">
+
+            <element name="echoStringParam" type="xsd:string"/>
+
+            <element name="echoStringReturn" type="xsd:string"/>
+            
+        </schema>
+    </types>
+
+    <message name="echoString">
+        <part element="xsd1:echoStringParam" name="str"/>
+    </message>
+    <message name="echoStringResponse">
+        <part element="xsd1:echoStringReturn" name="result"/>
+    </message>
+
+    <portType name="W2JDLR4002Test">
+    	<operation name="echoString">
+            <input message="tns:echoString"/>
+            <output message="tns:echoStringResponse"/>
+    	</operation>
+    </portType>
+    
+    <binding name="W2JDLR4002TestBinding" type="tns:W2JDLR4002Test">
+    	<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    	<operation name="echoString">
+    		<soap:operation/>
+            <input>
+                <soap:body use="literal"/>
+            </input>
+            <output>
+                <soap:body use="literal"/>
+            </output>
+    	</operation>
+    </binding>
+
+    <service name="W2JDLR4002TestService">
+        <port binding="tns:W2JDLR4002TestBinding"
+            name="W2JDLR4002TestPort">
+            <soap:address
+                location="http://w2jdlr4002testservice.org/W2JDLR4002TestService.wsdl"/>
+        </port>
+    </service>
+    
+</definitions>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/UTF8-BOM.xml.data b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/UTF8-BOM.xml.data
new file mode 100644
index 00000000000..00f80fa80e0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/UTF8-BOM.xml.data
@@ -0,0 +1 @@
+<ns0:Envelope xmlns:nasp="urn:hl7-org:v3" xmlns:ns0="http://schemas.xmlsoap.org/soap/envelope/"><ns0:Header><nasp:naspHeader type="Message"><nasp:id root="aa910964-898e-4802-8f6e-d1be452639cd"></nasp:id><nasp:interactionId root="2.16.840.1.113883.2.1.3.2.4.12" extension="QUPA_IN010000UK01"></nasp:interactionId><nasp:communicationFunctionRcv type="CommunicationFunction" typeCode="RCV"><nasp:device type="Device" classCode="DEV" determinerCode="INSTANCE"><nasp:id root="2.16.840.1.113883.2.1.4.11" extension="NASPTestEndpoint"></nasp:id></nasp:device></nasp:communicationFunctionRcv><nasp:communicationFunctionSnd type="CommunicationFunction" typeCode="SND"><nasp:device type="Device" classCode="DEV" determinerCode="INSTANCE"><nasp:id root="2.16.840.1.113883.2.1.4.11" extension="F81079-00093"></nasp:id></nasp:device></nasp:communicationFunctionSnd><nasp:ControlActProcess type="ControlAct" classCode="CACT" moodCode="RQO"><nasp:author type="Participation" typeCode="AUT"><nasp:assignedEntity type="RoleHeir" classCode="ASSIGNED"><nasp:representedOrganization type="Organization" classCode="ORG" determinerCode="INSTANCE"></nasp:representedOrganization></nasp:assignedEntity></nasp:author></nasp:ControlActProcess></nasp:naspHeader></ns0:Header><ns0:Body><m:QUPA_IN010000UK01 xsi:schemaLocation="urn:hl7-org:v3 ../Schemas/QUPA_IN010000UK01.xsd" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:schemaLocation="http://schemas.xmlsoap.org/soap/envelope/" xmlns="urn:hl7-org:v3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:m="urn:hl7-org:v3"><m:id root="11111112-65D4-EC43-BC31-62522532BC6E" /><m:creationTime value="200405051115" /><m:versionCode code="V3NPfIT2.0" /><m:interactionId root="2.16.840.1.113883.2.1.3.2.4.12" extension="QUPA_IN010000UK01" /><m:processingCode code="P" /><m:processingModeCode code="T" /><m:acceptAckCode code="NE" /><m:communicationFunctionRcv><m:device><m:id root="2.16.840.1.113883.2.1.4.11" extension="NASP" /><m:id root="2.16.840.1.113883.2.1.4.10" extension="100000000900001" /></m:device></m:communicationFunctionRcv><m:communicationFunctionSnd><m:device><m:id root="2.16.840.1.113883.2.1.4.11" extension="ISOFT_001_001" /><m:id root="2.16.840.1.113883.2.1.4.10" extension="100000000800001" /></m:device></m:communicationFunctionSnd><m:ControlActProcess xsi:schemaLocation="urn:hl7-org:v3 ../Schemas/QUPA_MT010101UK02.xsd" classCode="CACT" moodCode="RQO" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:msg="urn:hl7-org:v3/mif" xmlns:voc="urn:hl7-org:v3/voc"><m:author typeCode="AUT"><m:assignedEntity classCode="ASSIGNED"><m:id root="2.16.840.1.113883.2.1.4.4" extension="G0000017" /><m:code code="011" /><m:representedOrganization classCode="ORG" determinerCode="INSTANCE"><m:id root="2.16.840.1.113883.2.1.4.3" extension="Z99993" /><m:code code="001" /></m:representedOrganization></m:assignedEntity></m:author><m:pdsTraceQuery><m:queryId root="BBBBQ01B-A9D1-A411-F824-9F7A00A33757" /><m:person.address><m:value use="H"><m:addressKey> 12345678 </m:addressKey></m:value><m:semanticsText>person.address</m:semanticsText></m:person.address><m:person.administrativeGenderCode><m:value code="2" /><m:semanticsText>person.administrativeGenderCode</m:semanticsText></m:person.administrativeGenderCode><m:person.birthTime><m:value value="19810303" /><m:semanticsText>person.birthTime</m:semanticsText></m:person.birthTime><m:person.name><m:value use="L"><m:given>Matthew</m:given><m:family>Barrow</m:family></m:value><m:semanticsText>person.name</m:semanticsText></m:person.name></m:pdsTraceQuery></m:ControlActProcess></m:QUPA_IN010000UK01></ns0:Body></ns0:Envelope>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java
new file mode 100644
index 00000000000..5e193f667fa
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/VoiceXMLDTDTest.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamReader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test parsing Voice XML DTD.
+ */
+public class VoiceXMLDTDTest {
+
+    private static final String INPUT_FILE1 = "voicexml.xml";
+
+    @Test
+    public void test() {
+        XMLInputFactory ifac = XMLInputFactory.newInstance();
+
+        try {
+            XMLStreamReader re = ifac.createXMLStreamReader(getClass().getResource(INPUT_FILE1).toExternalForm(),
+                    this.getClass().getResourceAsStream(INPUT_FILE1));
+            while (re.hasNext()) {
+                int event = re.next();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XML11Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XML11Test.java
new file mode 100644
index 00000000000..2293aaca37a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XML11Test.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamReaderTest;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test parsing xml 1.1.
+ */
+public class XML11Test {
+
+    @Test
+    public void test() {
+        try {
+            XMLInputFactory xif = XMLInputFactory.newInstance();
+            XMLEventReader reader = xif.createXMLEventReader(this.getClass().getResourceAsStream("xml11.xml.data"));
+            while (reader.hasNext())
+                reader.next();
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XMLSchema.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XMLSchema.dtd
new file mode 100644
index 00000000000..45c04bc8062
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XMLSchema.dtd
@@ -0,0 +1,402 @@
+<!-- DTD for XML Schemas: Part 1: Structures
+     Public Identifier: "-//W3C//DTD XMLSCHEMA 200102//EN"
+     Official Location: http://www.w3.org/2001/XMLSchema.dtd -->
+<!-- $Id: XMLSchema.dtd,v 1.3 2007-07-19 21:56:49 ofung Exp $ -->
+<!-- Note this DTD is NOT normative, or even definitive. -->           <!--d-->
+<!-- prose copy in the structures REC is the definitive version -->    <!--d-->
+<!-- (which shouldn't differ from this one except for this -->         <!--d-->
+<!-- comment and entity expansions, but just in case) -->              <!--d-->
+<!-- With the exception of cases with multiple namespace
+     prefixes for the XML Schema namespace, any XML document which is
+     not valid per this DTD given redefinitions in its internal subset of the
+     'p' and 's' parameter entities below appropriate to its namespace
+     declaration of the XML Schema namespace is almost certainly not
+     a valid schema. -->
+
+<!-- The simpleType element and its constituent parts
+     are defined in XML Schema: Part 2: Datatypes -->
+<!ENTITY % xs-datatypes PUBLIC 'datatypes' 'datatypes.dtd' >
+
+<!ENTITY % p 'xs:'> <!-- can be overriden in the internal subset of a
+                         schema document to establish a different
+                         namespace prefix -->
+<!ENTITY % s ':xs'> <!-- if %p is defined (e.g. as foo:) then you must
+                         also define %s as the suffix for the appropriate
+                         namespace declaration (e.g. :foo) -->
+<!ENTITY % nds 'xmlns%s;'>
+
+<!-- Define all the element names, with optional prefix -->
+<!ENTITY % schema "%p;schema">
+<!ENTITY % complexType "%p;complexType">
+<!ENTITY % complexContent "%p;complexContent">
+<!ENTITY % simpleContent "%p;simpleContent">
+<!ENTITY % extension "%p;extension">
+<!ENTITY % element "%p;element">
+<!ENTITY % unique "%p;unique">
+<!ENTITY % key "%p;key">
+<!ENTITY % keyref "%p;keyref">
+<!ENTITY % selector "%p;selector">
+<!ENTITY % field "%p;field">
+<!ENTITY % group "%p;group">
+<!ENTITY % all "%p;all">
+<!ENTITY % choice "%p;choice">
+<!ENTITY % sequence "%p;sequence">
+<!ENTITY % any "%p;any">
+<!ENTITY % anyAttribute "%p;anyAttribute">
+<!ENTITY % attribute "%p;attribute">
+<!ENTITY % attributeGroup "%p;attributeGroup">
+<!ENTITY % include "%p;include">
+<!ENTITY % import "%p;import">
+<!ENTITY % redefine "%p;redefine">
+<!ENTITY % notation "%p;notation">
+
+<!-- annotation elements -->
+<!ENTITY % annotation "%p;annotation">
+<!ENTITY % appinfo "%p;appinfo">
+<!ENTITY % documentation "%p;documentation">
+
+<!-- Customisation entities for the ATTLIST of each element type.
+     Define one of these if your schema takes advantage of the
+     anyAttribute='##other' in the schema for schemas -->
+
+<!ENTITY % schemaAttrs ''>
+<!ENTITY % complexTypeAttrs ''>
+<!ENTITY % complexContentAttrs ''>
+<!ENTITY % simpleContentAttrs ''>
+<!ENTITY % extensionAttrs ''>
+<!ENTITY % elementAttrs ''>
+<!ENTITY % groupAttrs ''>
+<!ENTITY % allAttrs ''>
+<!ENTITY % choiceAttrs ''>
+<!ENTITY % sequenceAttrs ''>
+<!ENTITY % anyAttrs ''>
+<!ENTITY % anyAttributeAttrs ''>
+<!ENTITY % attributeAttrs ''>
+<!ENTITY % attributeGroupAttrs ''>
+<!ENTITY % uniqueAttrs ''>
+<!ENTITY % keyAttrs ''>
+<!ENTITY % keyrefAttrs ''>
+<!ENTITY % selectorAttrs ''>
+<!ENTITY % fieldAttrs ''>
+<!ENTITY % includeAttrs ''>
+<!ENTITY % importAttrs ''>
+<!ENTITY % redefineAttrs ''>
+<!ENTITY % notationAttrs ''>
+<!ENTITY % annotationAttrs ''>
+<!ENTITY % appinfoAttrs ''>
+<!ENTITY % documentationAttrs ''>
+
+<!ENTITY % complexDerivationSet "CDATA">
+      <!-- #all or space-separated list drawn from derivationChoice -->
+<!ENTITY % blockSet "CDATA">
+      <!-- #all or space-separated list drawn from
+                      derivationChoice + 'substitution' -->
+
+<!ENTITY % mgs '%all; | %choice; | %sequence;'>
+<!ENTITY % cs '%choice; | %sequence;'>
+<!ENTITY % formValues '(qualified|unqualified)'>
+
+
+<!ENTITY % attrDecls    '((%attribute;| %attributeGroup;)*,(%anyAttribute;)?)'>
+
+<!ENTITY % particleAndAttrs '((%mgs; | %group;)?, %attrDecls;)'>
+
+<!-- This is used in part2 -->
+<!ENTITY % restriction1 '((%mgs; | %group;)?)'>
+
+%xs-datatypes;
+
+<!-- the duplication below is to produce an unambiguous content model
+     which allows annotation everywhere -->
+<!ELEMENT %schema; ((%include; | %import; | %redefine; | %annotation;)*,
+                    ((%simpleType; | %complexType;
+                      | %element; | %attribute;
+                      | %attributeGroup; | %group;
+                      | %notation; ),
+                     (%annotation;)*)* )>
+<!ATTLIST %schema;
+   targetNamespace      %URIref;               #IMPLIED
+   version              CDATA                  #IMPLIED
+   %nds;                %URIref;               #FIXED 'http://www.w3.org/2001/XMLSchema'
+   xmlns                CDATA                  #IMPLIED
+   finalDefault         %complexDerivationSet; ''
+   blockDefault         %blockSet;             ''
+   id                   ID                     #IMPLIED
+   elementFormDefault   %formValues;           'unqualified'
+   attributeFormDefault %formValues;           'unqualified'
+   xml:lang             CDATA                  #IMPLIED
+   %schemaAttrs;>
+<!-- Note the xmlns declaration is NOT in the Schema for Schemas,
+     because at the Infoset level where schemas operate,
+     xmlns(:prefix) is NOT an attribute! -->
+<!-- The declaration of xmlns is a convenience for schema authors -->
+ 
+<!-- The id attribute here and below is for use in external references
+     from non-schemas using simple fragment identifiers.
+     It is NOT used for schema-to-schema reference, internal or
+     external. -->
+
+<!-- a type is a named content type specification which allows attribute
+     declarations-->
+<!-- -->
+
+<!ELEMENT %complexType; ((%annotation;)?,
+                         (%simpleContent;|%complexContent;|
+                          %particleAndAttrs;))>
+
+<!ATTLIST %complexType;
+          name      %NCName;                        #IMPLIED
+          id        ID                              #IMPLIED
+          abstract  %boolean;                       #IMPLIED
+          final     %complexDerivationSet;          #IMPLIED
+          block     %complexDerivationSet;          #IMPLIED
+          mixed (true|false) 'false'
+          %complexTypeAttrs;>
+
+<!-- particleAndAttrs is shorthand for a root type -->
+<!-- mixed is disallowed if simpleContent, overriden if complexContent
+     has one too. -->
+
+<!-- If anyAttribute appears in one or more referenced attributeGroups
+     and/or explicitly, the intersection of the permissions is used -->
+
+<!ELEMENT %complexContent; ((%annotation;)?, (%restriction;|%extension;))>
+<!ATTLIST %complexContent;
+          mixed (true|false) #IMPLIED
+          id    ID           #IMPLIED
+          %complexContentAttrs;>
+
+<!-- restriction should use the branch defined above, not the simple
+     one from part2; extension should use the full model  -->
+
+<!ELEMENT %simpleContent; ((%annotation;)?, (%restriction;|%extension;))>
+<!ATTLIST %simpleContent;
+          id    ID           #IMPLIED
+          %simpleContentAttrs;>
+
+<!-- restriction should use the simple branch from part2, not the 
+     one defined above; extension should have no particle  -->
+
+<!ELEMENT %extension; ((%annotation;)?, (%particleAndAttrs;))>
+<!ATTLIST %extension;
+          base  %QName;      #REQUIRED
+          id    ID           #IMPLIED
+          %extensionAttrs;>
+
+<!-- an element is declared by either:
+ a name and a type (either nested or referenced via the type attribute)
+ or a ref to an existing element declaration -->
+
+<!ELEMENT %element; ((%annotation;)?, (%complexType;| %simpleType;)?,
+                     (%unique; | %key; | %keyref;)*)>
+<!-- simpleType or complexType only if no type|ref attribute -->
+<!-- ref not allowed at top level -->
+<!ATTLIST %element;
+            name               %NCName;               #IMPLIED
+            id                 ID                     #IMPLIED
+            ref                %QName;                #IMPLIED
+            type               %QName;                #IMPLIED
+            minOccurs          %nonNegativeInteger;   #IMPLIED
+            maxOccurs          CDATA                  #IMPLIED
+            nillable           %boolean;              #IMPLIED
+            substitutionGroup  %QName;                #IMPLIED
+            abstract           %boolean;              #IMPLIED
+            final              %complexDerivationSet; #IMPLIED
+            block              %blockSet;             #IMPLIED
+            default            CDATA                  #IMPLIED
+            fixed              CDATA                  #IMPLIED
+            form               %formValues;           #IMPLIED
+            %elementAttrs;>
+<!-- type and ref are mutually exclusive.
+     name and ref are mutually exclusive, one is required -->
+<!-- In the absence of type AND ref, type defaults to type of
+     substitutionGroup, if any, else the ur-type, i.e. unconstrained -->
+<!-- default and fixed are mutually exclusive -->
+
+<!ELEMENT %group; ((%annotation;)?,(%mgs;)?)>
+<!ATTLIST %group; 
+          name        %NCName;               #IMPLIED
+          ref         %QName;                #IMPLIED
+          minOccurs   %nonNegativeInteger;   #IMPLIED
+          maxOccurs   CDATA                  #IMPLIED
+          id          ID                     #IMPLIED
+          %groupAttrs;>
+
+<!ELEMENT %all; ((%annotation;)?, (%element;)*)>
+<!ATTLIST %all;
+          minOccurs   (1)                    #IMPLIED
+          maxOccurs   (1)                    #IMPLIED
+          id          ID                     #IMPLIED
+          %allAttrs;>
+
+<!ELEMENT %choice; ((%annotation;)?, (%element;| %group;| %cs; | %any;)*)>
+<!ATTLIST %choice;
+          minOccurs   %nonNegativeInteger;   #IMPLIED
+          maxOccurs   CDATA                  #IMPLIED
+          id          ID                     #IMPLIED
+          %choiceAttrs;>
+
+<!ELEMENT %sequence; ((%annotation;)?, (%element;| %group;| %cs; | %any;)*)>
+<!ATTLIST %sequence;
+          minOccurs   %nonNegativeInteger;   #IMPLIED
+          maxOccurs   CDATA                  #IMPLIED
+          id          ID                     #IMPLIED
+          %sequenceAttrs;>
+
+<!-- an anonymous grouping in a model, or
+     a top-level named group definition, or a reference to same -->
+
+<!-- Note that if order is 'all', group is not allowed inside.
+     If order is 'all' THIS group must be alone (or referenced alone) at
+     the top level of a content model -->
+<!-- If order is 'all', minOccurs==maxOccurs==1 on element/any inside -->
+<!-- Should allow minOccurs=0 inside order='all' . . . -->
+
+<!ELEMENT %any; (%annotation;)?>
+<!ATTLIST %any;
+            namespace       CDATA                  '##any'
+            processContents (skip|lax|strict)      'strict'
+            minOccurs       %nonNegativeInteger;   '1'
+            maxOccurs       CDATA                  '1'
+            id              ID                     #IMPLIED
+            %anyAttrs;>
+
+<!-- namespace is interpreted as follows:
+                  ##any      - - any non-conflicting WFXML at all
+
+                  ##other    - - any non-conflicting WFXML from namespace other
+                                  than targetNamespace
+
+                  ##local    - - any unqualified non-conflicting WFXML/attribute
+                  one or     - - any non-conflicting WFXML from
+                  more URI        the listed namespaces
+                  references
+
+                  ##targetNamespace ##local may appear in the above list,
+                    with the obvious meaning -->
+
+<!ELEMENT %anyAttribute; (%annotation;)?>
+<!ATTLIST %anyAttribute;
+            namespace       CDATA              '##any'
+            processContents (skip|lax|strict)  'strict'
+            id              ID                 #IMPLIED
+            %anyAttributeAttrs;>
+<!-- namespace is interpreted as for 'any' above -->
+
+<!-- simpleType only if no type|ref attribute -->
+<!-- ref not allowed at top level, name iff at top level -->
+<!ELEMENT %attribute; ((%annotation;)?, (%simpleType;)?)>
+<!ATTLIST %attribute;
+          name      %NCName;      #IMPLIED
+          id        ID            #IMPLIED
+          ref       %QName;       #IMPLIED
+          type      %QName;       #IMPLIED
+          use       (prohibited|optional|required) #IMPLIED
+          default   CDATA         #IMPLIED
+          fixed     CDATA         #IMPLIED
+          form      %formValues;  #IMPLIED
+          %attributeAttrs;>
+<!-- type and ref are mutually exclusive.
+     name and ref are mutually exclusive, one is required -->
+<!-- default for use is optional when nested, none otherwise -->
+<!-- default and fixed are mutually exclusive -->
+<!-- type attr and simpleType content are mutually exclusive -->
+
+<!-- an attributeGroup is a named collection of attribute decls, or a
+     reference thereto -->
+<!ELEMENT %attributeGroup; ((%annotation;)?,
+                       (%attribute; | %attributeGroup;)*,
+                       (%anyAttribute;)?) >
+<!ATTLIST %attributeGroup;
+                 name       %NCName;       #IMPLIED
+                 id         ID             #IMPLIED
+                 ref        %QName;        #IMPLIED
+                 %attributeGroupAttrs;>
+
+<!-- ref iff no content, no name.  ref iff not top level -->
+
+<!-- better reference mechanisms -->
+<!ELEMENT %unique; ((%annotation;)?, %selector;, (%field;)+)>
+<!ATTLIST %unique;
+          name     %NCName;       #REQUIRED
+	  id       ID             #IMPLIED
+	  %uniqueAttrs;>
+
+<!ELEMENT %key;    ((%annotation;)?, %selector;, (%field;)+)>
+<!ATTLIST %key;
+          name     %NCName;       #REQUIRED
+	  id       ID             #IMPLIED
+	  %keyAttrs;>
+
+<!ELEMENT %keyref; ((%annotation;)?, %selector;, (%field;)+)>
+<!ATTLIST %keyref;
+          name     %NCName;       #REQUIRED
+	  refer    %QName;        #REQUIRED
+	  id       ID             #IMPLIED
+	  %keyrefAttrs;>
+
+<!ELEMENT %selector; ((%annotation;)?)>
+<!ATTLIST %selector;
+          xpath %XPathExpr; #REQUIRED
+          id    ID          #IMPLIED
+          %selectorAttrs;>
+<!ELEMENT %field; ((%annotation;)?)>
+<!ATTLIST %field;
+          xpath %XPathExpr; #REQUIRED
+          id    ID          #IMPLIED
+          %fieldAttrs;>
+
+<!-- Schema combination mechanisms -->
+<!ELEMENT %include; (%annotation;)?>
+<!ATTLIST %include;
+          schemaLocation %URIref; #REQUIRED
+          id             ID       #IMPLIED
+          %includeAttrs;>
+
+<!ELEMENT %import; (%annotation;)?>
+<!ATTLIST %import;
+          namespace      %URIref; #IMPLIED
+          schemaLocation %URIref; #IMPLIED
+          id             ID       #IMPLIED
+          %importAttrs;>
+
+<!ELEMENT %redefine; (%annotation; | %simpleType; | %complexType; |
+                      %attributeGroup; | %group;)*>
+<!ATTLIST %redefine;
+          schemaLocation %URIref; #REQUIRED
+          id             ID       #IMPLIED
+          %redefineAttrs;>
+
+<!ELEMENT %notation; (%annotation;)?>
+<!ATTLIST %notation;
+	  name        %NCName;    #REQUIRED
+	  id          ID          #IMPLIED
+	  public      CDATA       #REQUIRED
+	  system      %URIref;    #IMPLIED
+	  %notationAttrs;>
+
+<!-- Annotation is either application information or documentation -->
+<!-- By having these here they are available for datatypes as well
+     as all the structures elements -->
+
+<!ELEMENT %annotation; (%appinfo; | %documentation;)*>
+<!ATTLIST %annotation; %annotationAttrs;>
+
+<!-- User must define annotation elements in internal subset for this
+     to work -->
+<!ELEMENT %appinfo; ANY>   <!-- too restrictive -->
+<!ATTLIST %appinfo;
+          source     %URIref;      #IMPLIED
+          id         ID         #IMPLIED
+          %appinfoAttrs;>
+<!ELEMENT %documentation; ANY>   <!-- too restrictive -->
+<!ATTLIST %documentation;
+          source     %URIref;   #IMPLIED
+          id         ID         #IMPLIED
+          xml:lang   CDATA      #IMPLIED
+          %documentationAttrs;>
+
+<!NOTATION XMLSchemaStructures PUBLIC
+           'structures' 'http://www.w3.org/2001/XMLSchema.xsd' >
+<!NOTATION XML PUBLIC
+           'REC-xml-1998-0210' 'http://www.w3.org/TR/1998/REC-xml-19980210' >
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XMLSchema.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XMLSchema.xsd
new file mode 100644
index 00000000000..2e9a2729ec5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/XMLSchema.xsd
@@ -0,0 +1,2534 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- XML Schema schema for XML Schemas: Part 1: Structures -->
+<!-- Note this schema is NOT the normative structures schema. -->
+<!-- The prose copy in the structures REC is the normative -->
+<!-- version (which shouldn't differ from this one except for -->
+<!-- this comment and entity expansions, but just in case -->
+<!DOCTYPE xs:schema PUBLIC "-//W3C//DTD XMLSCHEMA 200102//EN" "XMLSchema.dtd" [
+
+<!-- provide ID type information even for parsers which only read the
+     internal subset -->
+<!ATTLIST xs:schema          id  ID  #IMPLIED>
+<!ATTLIST xs:complexType     id  ID  #IMPLIED>
+<!ATTLIST xs:complexContent  id  ID  #IMPLIED>
+<!ATTLIST xs:simpleContent   id  ID  #IMPLIED>
+<!ATTLIST xs:extension       id  ID  #IMPLIED>
+<!ATTLIST xs:element         id  ID  #IMPLIED>
+<!ATTLIST xs:group           id  ID  #IMPLIED> 
+<!ATTLIST xs:all             id  ID  #IMPLIED>
+<!ATTLIST xs:choice          id  ID  #IMPLIED>
+<!ATTLIST xs:sequence        id  ID  #IMPLIED>
+<!ATTLIST xs:any             id  ID  #IMPLIED>
+<!ATTLIST xs:anyAttribute    id  ID  #IMPLIED>
+<!ATTLIST xs:attribute       id  ID  #IMPLIED>
+<!ATTLIST xs:attributeGroup  id  ID  #IMPLIED>
+<!ATTLIST xs:unique          id  ID  #IMPLIED>
+<!ATTLIST xs:key             id  ID  #IMPLIED>
+<!ATTLIST xs:keyref          id  ID  #IMPLIED>
+<!ATTLIST xs:selector        id  ID  #IMPLIED>
+<!ATTLIST xs:field           id  ID  #IMPLIED>
+<!ATTLIST xs:include         id  ID  #IMPLIED>
+<!ATTLIST xs:import          id  ID  #IMPLIED>
+<!ATTLIST xs:redefine        id  ID  #IMPLIED>
+<!ATTLIST xs:notation        id  ID  #IMPLIED>
+<!--
+     keep this schema XML1.0 DTD valid
+  -->
+        <!ENTITY % schemaAttrs 'xmlns:hfp CDATA #IMPLIED'>
+
+        <!ELEMENT hfp:hasFacet EMPTY>
+        <!ATTLIST hfp:hasFacet
+                name NMTOKEN #REQUIRED>
+
+        <!ELEMENT hfp:hasProperty EMPTY>
+        <!ATTLIST hfp:hasProperty
+                name NMTOKEN #REQUIRED
+                value CDATA #REQUIRED>
+<!--
+        Make sure that processors that do not read the external
+        subset will know about the various IDs we declare
+  -->
+        <!ATTLIST xs:simpleType id ID #IMPLIED>
+        <!ATTLIST xs:maxExclusive id ID #IMPLIED>
+        <!ATTLIST xs:minExclusive id ID #IMPLIED>
+        <!ATTLIST xs:maxInclusive id ID #IMPLIED>
+        <!ATTLIST xs:minInclusive id ID #IMPLIED>
+        <!ATTLIST xs:totalDigits id ID #IMPLIED>
+        <!ATTLIST xs:fractionDigits id ID #IMPLIED>
+        <!ATTLIST xs:length id ID #IMPLIED>
+        <!ATTLIST xs:minLength id ID #IMPLIED>
+        <!ATTLIST xs:maxLength id ID #IMPLIED>
+        <!ATTLIST xs:enumeration id ID #IMPLIED>
+        <!ATTLIST xs:pattern id ID #IMPLIED>
+        <!ATTLIST xs:appinfo id ID #IMPLIED>
+        <!ATTLIST xs:documentation id ID #IMPLIED>
+        <!ATTLIST xs:list id ID #IMPLIED>
+        <!ATTLIST xs:union id ID #IMPLIED>
+        ]>
+<xs:schema targetNamespace="http://www.w3.org/2001/XMLSchema" blockDefault="#all" elementFormDefault="qualified" version="1.0" xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="EN" xmlns:hfp="http://www.w3.org/2001/XMLSchema-hasFacetAndProperty">
+ <xs:annotation>
+  <xs:documentation>
+    Part 1 version: Id: structures.xsd,v 1.2 2004/01/15 11:34:25 ht Exp 
+    Part 2 version: Id: datatypes.xsd,v 1.3 2004/01/23 18:11:13 ht Exp 
+  </xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/2004/PER-xmlschema-1-20040318/structures.html">
+   The schema corresponding to this document is normative,
+   with respect to the syntactic constraints it expresses in the
+   XML Schema language.  The documentation (within &lt;documentation> elements)
+   below, is not normative, but rather highlights important aspects of
+   the W3C Recommendation of which this is a part</xs:documentation>
+ </xs:annotation>
+
+ <xs:annotation>
+   <xs:documentation>
+   The simpleType element and all of its members are defined
+      towards the end of this schema document</xs:documentation>
+ </xs:annotation>
+
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd">
+   <xs:annotation>
+     <xs:documentation>
+       Get access to the xml: attribute groups for xml:lang
+       as declared on 'schema' and 'documentation' below
+     </xs:documentation>
+   </xs:annotation>
+ </xs:import>
+
+ <xs:complexType name="openAttrs">
+   <xs:annotation>
+     <xs:documentation>
+       This type is extended by almost all schema types
+       to allow attributes from other namespaces to be
+       added to user schemas.
+     </xs:documentation>
+   </xs:annotation>
+   <xs:complexContent>
+     <xs:restriction base="xs:anyType">
+       <xs:anyAttribute namespace="##other" processContents="lax"/>
+     </xs:restriction>
+   </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="annotated">
+   <xs:annotation>
+     <xs:documentation>
+       This type is extended by all types which allow annotation
+       other than &lt;schema&gt; itself
+     </xs:documentation>
+   </xs:annotation>
+   <xs:complexContent>
+     <xs:extension base="xs:openAttrs">
+       <xs:sequence>
+         <xs:element ref="xs:annotation" minOccurs="0"/>
+       </xs:sequence>
+       <xs:attribute name="id" type="xs:ID"/>
+     </xs:extension>
+   </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="schemaTop">
+  <xs:annotation>
+   <xs:documentation>
+   This group is for the
+   elements which occur freely at the top level of schemas.
+   All of their types are based on the "annotated" type by extension.</xs:documentation>
+  </xs:annotation>
+  <xs:choice>
+   <xs:group ref="xs:redefinable"/>
+   <xs:element ref="xs:element"/>
+   <xs:element ref="xs:attribute"/>
+   <xs:element ref="xs:notation"/>
+  </xs:choice>
+ </xs:group>
+ 
+ <xs:group name="redefinable">
+  <xs:annotation>
+   <xs:documentation>
+   This group is for the
+   elements which can self-redefine (see &lt;redefine> below).</xs:documentation>
+  </xs:annotation>
+  <xs:choice>
+   <xs:element ref="xs:simpleType"/>
+   <xs:element ref="xs:complexType"/>
+   <xs:element ref="xs:group"/>
+   <xs:element ref="xs:attributeGroup"/>
+  </xs:choice>
+ </xs:group>
+
+ <xs:simpleType name="formChoice">
+  <xs:annotation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+  </xs:annotation>
+  <xs:restriction base="xs:NMTOKEN">
+   <xs:enumeration value="qualified"/>
+   <xs:enumeration value="unqualified"/>
+  </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="reducedDerivationControl">
+  <xs:annotation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+  </xs:annotation>
+  <xs:restriction base="xs:derivationControl">
+   <xs:enumeration value="extension"/>
+   <xs:enumeration value="restriction"/>
+  </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="derivationSet">
+  <xs:annotation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+   <xs:documentation>
+   #all or (possibly empty) subset of {extension, restriction}</xs:documentation>
+  </xs:annotation>
+  <xs:union>
+   <xs:simpleType>    
+    <xs:restriction base="xs:token">
+     <xs:enumeration value="#all"/>
+    </xs:restriction>
+   </xs:simpleType>
+   <xs:simpleType>
+    <xs:list itemType="xs:reducedDerivationControl"/>
+   </xs:simpleType>
+  </xs:union>
+ </xs:simpleType>
+
+ <xs:simpleType name="typeDerivationControl">
+  <xs:annotation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+  </xs:annotation>
+  <xs:restriction base="xs:derivationControl">
+   <xs:enumeration value="extension"/>
+   <xs:enumeration value="restriction"/>
+   <xs:enumeration value="list"/>
+   <xs:enumeration value="union"/>
+  </xs:restriction>
+ </xs:simpleType>
+
+  <xs:simpleType name="fullDerivationSet">
+  <xs:annotation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+   <xs:documentation>
+   #all or (possibly empty) subset of {extension, restriction, list, union}</xs:documentation>
+  </xs:annotation>
+  <xs:union>
+   <xs:simpleType>    
+    <xs:restriction base="xs:token">
+     <xs:enumeration value="#all"/>
+    </xs:restriction>
+   </xs:simpleType>
+   <xs:simpleType>
+    <xs:list itemType="xs:typeDerivationControl"/>
+   </xs:simpleType>
+  </xs:union>
+ </xs:simpleType>
+
+ <xs:element name="schema" id="schema">
+  <xs:annotation>
+    <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-schema"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:openAttrs">
+     <xs:sequence>
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+       <xs:element ref="xs:include"/>
+       <xs:element ref="xs:import"/>
+       <xs:element ref="xs:redefine"/>
+       <xs:element ref="xs:annotation"/>
+      </xs:choice>
+      <xs:sequence minOccurs="0" maxOccurs="unbounded">
+       <xs:group ref="xs:schemaTop"/>
+       <xs:element ref="xs:annotation" minOccurs="0" maxOccurs="unbounded"/>
+      </xs:sequence>
+     </xs:sequence>
+     <xs:attribute name="targetNamespace" type="xs:anyURI"/>
+     <xs:attribute name="version" type="xs:token"/>
+     <xs:attribute name="finalDefault" type="xs:fullDerivationSet" use="optional" default=""/>
+     <xs:attribute name="blockDefault" type="xs:blockSet" use="optional" default=""/>
+     <xs:attribute name="attributeFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+     <xs:attribute name="elementFormDefault" type="xs:formChoice" use="optional" default="unqualified"/>
+     <xs:attribute name="id" type="xs:ID"/>
+     <xs:attribute ref="xml:lang"/>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+
+  <xs:key name="element">
+   <xs:selector xpath="xs:element"/>
+   <xs:field xpath="@name"/>
+  </xs:key>
+
+  <xs:key name="attribute">
+   <xs:selector xpath="xs:attribute"/>
+   <xs:field xpath="@name"/>
+  </xs:key>
+
+  <xs:key name="type">
+   <xs:selector xpath="xs:complexType|xs:simpleType"/>
+   <xs:field xpath="@name"/>
+  </xs:key>
+ 
+  <xs:key name="group">
+   <xs:selector xpath="xs:group"/>
+   <xs:field xpath="@name"/>
+  </xs:key>
+ 
+  <xs:key name="attributeGroup">
+   <xs:selector xpath="xs:attributeGroup"/>
+   <xs:field xpath="@name"/>
+  </xs:key>
+ 
+  <xs:key name="notation">
+   <xs:selector xpath="xs:notation"/>
+   <xs:field xpath="@name"/>
+  </xs:key>
+
+  <xs:key name="identityConstraint">
+   <xs:selector xpath=".//xs:key|.//xs:unique|.//xs:keyref"/>
+   <xs:field xpath="@name"/>
+  </xs:key>
+
+ </xs:element>
+
+ <xs:simpleType name="allNNI">
+  <xs:annotation><xs:documentation>
+   for maxOccurs</xs:documentation></xs:annotation>
+  <xs:union memberTypes="xs:nonNegativeInteger">
+   <xs:simpleType>
+    <xs:restriction base="xs:NMTOKEN">
+     <xs:enumeration value="unbounded"/>
+    </xs:restriction>
+   </xs:simpleType>
+  </xs:union>
+ </xs:simpleType>
+
+ <xs:attributeGroup name="occurs">
+  <xs:annotation><xs:documentation>
+   for all particles</xs:documentation></xs:annotation>
+  <xs:attribute name="minOccurs" type="xs:nonNegativeInteger" use="optional" default="1"/>
+  <xs:attribute name="maxOccurs" type="xs:allNNI" use="optional" default="1"/>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="defRef">
+  <xs:annotation><xs:documentation>
+   for element, group and attributeGroup,
+   which both define and reference</xs:documentation></xs:annotation>
+  <xs:attribute name="name" type="xs:NCName"/>
+  <xs:attribute name="ref" type="xs:QName"/>
+ </xs:attributeGroup>
+
+ <xs:group name="typeDefParticle">
+  <xs:annotation>
+    <xs:documentation>
+   'complexType' uses this</xs:documentation></xs:annotation>
+  <xs:choice>
+   <xs:element name="group" type="xs:groupRef"/>
+   <xs:element ref="xs:all"/>
+   <xs:element ref="xs:choice"/>
+   <xs:element ref="xs:sequence"/>
+  </xs:choice>
+ </xs:group>
+ 
+ 
+
+ <xs:group name="nestedParticle">
+  <xs:choice>
+   <xs:element name="element" type="xs:localElement"/>
+   <xs:element name="group" type="xs:groupRef"/>
+   <xs:element ref="xs:choice"/>
+   <xs:element ref="xs:sequence"/>
+   <xs:element ref="xs:any"/>
+  </xs:choice>
+ </xs:group>
+ 
+ <xs:group name="particle">
+  <xs:choice>
+   <xs:element name="element" type="xs:localElement"/>
+   <xs:element name="group" type="xs:groupRef"/>
+   <xs:element ref="xs:all"/>
+   <xs:element ref="xs:choice"/>
+   <xs:element ref="xs:sequence"/>
+   <xs:element ref="xs:any"/>
+  </xs:choice>
+ </xs:group>
+ 
+ <xs:complexType name="attribute">
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:sequence>
+     <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
+    </xs:sequence>
+    <xs:attributeGroup ref="xs:defRef"/>
+    <xs:attribute name="type" type="xs:QName"/>
+    <xs:attribute name="use" use="optional" default="optional">
+     <xs:simpleType>
+      <xs:restriction base="xs:NMTOKEN">
+       <xs:enumeration value="prohibited"/>
+       <xs:enumeration value="optional"/>
+       <xs:enumeration value="required"/>
+      </xs:restriction>
+     </xs:simpleType>
+    </xs:attribute>
+    <xs:attribute name="default" type="xs:string"/>
+    <xs:attribute name="fixed" type="xs:string"/>
+    <xs:attribute name="form" type="xs:formChoice"/>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="topLevelAttribute">
+  <xs:complexContent>
+   <xs:restriction base="xs:attribute">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:element name="simpleType" minOccurs="0" type="xs:localSimpleType"/>
+    </xs:sequence>
+    <xs:attribute name="ref" use="prohibited"/>
+    <xs:attribute name="form" use="prohibited"/>
+    <xs:attribute name="use" use="prohibited"/>
+    <xs:attribute name="name" use="required" type="xs:NCName"/>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="attrDecls">
+  <xs:sequence>
+   <xs:choice minOccurs="0" maxOccurs="unbounded">
+    <xs:element name="attribute" type="xs:attribute"/>
+    <xs:element name="attributeGroup" type="xs:attributeGroupRef"/>
+   </xs:choice>
+   <xs:element ref="xs:anyAttribute" minOccurs="0"/>
+  </xs:sequence>
+ </xs:group>
+
+ <xs:element name="anyAttribute" type="xs:wildcard" id="anyAttribute">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-anyAttribute"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:group name="complexTypeModel">
+  <xs:choice>
+      <xs:element ref="xs:simpleContent"/>
+      <xs:element ref="xs:complexContent"/>
+      <xs:sequence>
+       <xs:annotation>
+        <xs:documentation>
+   This branch is short for
+   &lt;complexContent>
+   &lt;restriction base="xs:anyType">
+   ...
+   &lt;/restriction>
+   &lt;/complexContent></xs:documentation>
+       </xs:annotation>
+       <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+       <xs:group ref="xs:attrDecls"/>
+      </xs:sequence>
+  </xs:choice>
+ </xs:group>
+
+ <xs:complexType name="complexType" abstract="true">
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:group ref="xs:complexTypeModel"/>
+    <xs:attribute name="name" type="xs:NCName">
+     <xs:annotation>
+      <xs:documentation>
+      Will be restricted to required or forbidden</xs:documentation>
+     </xs:annotation>
+    </xs:attribute>
+    <xs:attribute name="mixed" type="xs:boolean" use="optional" default="false">
+     <xs:annotation>
+      <xs:documentation>
+      Not allowed if simpleContent child is chosen.
+      May be overriden by setting on complexContent child.</xs:documentation>
+    </xs:annotation>
+    </xs:attribute>
+    <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+    <xs:attribute name="final" type="xs:derivationSet"/>
+    <xs:attribute name="block" type="xs:derivationSet"/>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="topLevelComplexType">
+  <xs:complexContent>
+   <xs:restriction base="xs:complexType">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:group ref="xs:complexTypeModel"/>
+    </xs:sequence>
+    <xs:attribute name="name" type="xs:NCName" use="required"/>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="localComplexType">
+  <xs:complexContent>
+   <xs:restriction base="xs:complexType">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:group ref="xs:complexTypeModel"/>
+    </xs:sequence>
+    <xs:attribute name="name" use="prohibited"/>
+    <xs:attribute name="abstract" use="prohibited"/>
+    <xs:attribute name="final" use="prohibited"/>
+    <xs:attribute name="block" use="prohibited"/>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="restrictionType">
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:sequence>
+     <xs:choice minOccurs="0">
+      <xs:group ref="xs:typeDefParticle"/>
+      <xs:group ref="xs:simpleRestrictionModel"/>
+     </xs:choice>
+     <xs:group ref="xs:attrDecls"/>
+    </xs:sequence>
+    <xs:attribute name="base" type="xs:QName" use="required"/>
+   </xs:extension>
+  </xs:complexContent>       
+ </xs:complexType>
+
+ <xs:complexType name="complexRestrictionType">
+  <xs:complexContent>
+   <xs:restriction base="xs:restrictionType">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:choice minOccurs="0">
+      <xs:annotation>
+       <xs:documentation>This choice is added simply to
+                   make this a valid restriction per the REC</xs:documentation>
+      </xs:annotation>
+      <xs:group ref="xs:typeDefParticle"/>
+     </xs:choice>
+     <xs:group ref="xs:attrDecls"/>
+    </xs:sequence>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>       
+ </xs:complexType>
+
+ <xs:complexType name="extensionType">
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:sequence>
+     <xs:group ref="xs:typeDefParticle" minOccurs="0"/>
+     <xs:group ref="xs:attrDecls"/>
+    </xs:sequence>
+    <xs:attribute name="base" type="xs:QName" use="required"/>
+   </xs:extension>
+  </xs:complexContent>       
+ </xs:complexType>
+
+ <xs:element name="complexContent" id="complexContent">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexContent"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:annotated">
+     <xs:choice>
+      <xs:element name="restriction" type="xs:complexRestrictionType"/>
+      <xs:element name="extension" type="xs:extensionType"/>
+     </xs:choice>     
+     <xs:attribute name="mixed" type="xs:boolean">
+      <xs:annotation>
+       <xs:documentation>
+       Overrides any setting on complexType parent.</xs:documentation>
+      </xs:annotation>
+    </xs:attribute>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="simpleRestrictionType">
+  <xs:complexContent>
+   <xs:restriction base="xs:restrictionType">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:choice minOccurs="0">
+      <xs:annotation>
+       <xs:documentation>This choice is added simply to
+                   make this a valid restriction per the REC</xs:documentation>
+      </xs:annotation>
+      <xs:group ref="xs:simpleRestrictionModel"/>
+     </xs:choice>
+     <xs:group ref="xs:attrDecls"/>
+    </xs:sequence>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="simpleExtensionType">
+  <xs:complexContent>
+   <xs:restriction base="xs:extensionType">
+    <xs:sequence>
+     <xs:annotation>
+      <xs:documentation>
+      No typeDefParticle group reference</xs:documentation>
+     </xs:annotation>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:group ref="xs:attrDecls"/>
+    </xs:sequence>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="simpleContent" id="simpleContent">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-simpleContent"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:annotated">
+     <xs:choice>
+      <xs:element name="restriction" type="xs:simpleRestrictionType"/>
+      <xs:element name="extension" type="xs:simpleExtensionType"/>
+     </xs:choice>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+ 
+ <xs:element name="complexType" type="xs:topLevelComplexType" id="complexType">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-complexType"/>
+  </xs:annotation>
+ </xs:element>
+
+
+  <xs:simpleType name="blockSet">
+   <xs:annotation>
+    <xs:documentation>
+    A utility type, not for public use</xs:documentation>
+    <xs:documentation>
+    #all or (possibly empty) subset of {substitution, extension,
+    restriction}</xs:documentation>
+   </xs:annotation>
+   <xs:union>
+    <xs:simpleType>    
+     <xs:restriction base="xs:token">
+      <xs:enumeration value="#all"/>
+     </xs:restriction>
+    </xs:simpleType>
+    <xs:simpleType>
+     <xs:list>
+      <xs:simpleType>
+       <xs:restriction base="xs:derivationControl">
+        <xs:enumeration value="extension"/>
+        <xs:enumeration value="restriction"/>
+        <xs:enumeration value="substitution"/>
+       </xs:restriction>
+      </xs:simpleType>
+     </xs:list>
+    </xs:simpleType>
+   </xs:union>  
+  </xs:simpleType>
+
+ <xs:complexType name="element" abstract="true">
+  <xs:annotation>
+   <xs:documentation>
+   The element element can be used either
+   at the top level to define an element-type binding globally,
+   or within a content model to either reference a globally-defined
+   element or type or declare an element-type binding locally.
+   The ref form is not allowed at the top level.</xs:documentation>
+  </xs:annotation>
+
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:sequence>
+     <xs:choice minOccurs="0">
+      <xs:element name="simpleType" type="xs:localSimpleType"/>
+      <xs:element name="complexType" type="xs:localComplexType"/>
+     </xs:choice>
+     <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attributeGroup ref="xs:defRef"/>
+    <xs:attribute name="type" type="xs:QName"/>
+    <xs:attribute name="substitutionGroup" type="xs:QName"/>
+    <xs:attributeGroup ref="xs:occurs"/>
+    <xs:attribute name="default" type="xs:string"/>
+    <xs:attribute name="fixed" type="xs:string"/>
+    <xs:attribute name="nillable" type="xs:boolean" use="optional" default="false"/>
+    <xs:attribute name="abstract" type="xs:boolean" use="optional" default="false"/>
+    <xs:attribute name="final" type="xs:derivationSet"/>
+    <xs:attribute name="block" type="xs:blockSet"/>
+    <xs:attribute name="form" type="xs:formChoice"/>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="topLevelElement">
+  <xs:complexContent>
+   <xs:restriction base="xs:element">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:choice minOccurs="0">
+      <xs:element name="simpleType" type="xs:localSimpleType"/>
+      <xs:element name="complexType" type="xs:localComplexType"/>
+     </xs:choice>
+     <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attribute name="ref" use="prohibited"/>
+    <xs:attribute name="form" use="prohibited"/>
+    <xs:attribute name="minOccurs" use="prohibited"/>
+    <xs:attribute name="maxOccurs" use="prohibited"/>
+    <xs:attribute name="name" use="required" type="xs:NCName"/>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="localElement">
+  <xs:complexContent>
+   <xs:restriction base="xs:element">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:choice minOccurs="0">
+      <xs:element name="simpleType" type="xs:localSimpleType"/>
+      <xs:element name="complexType" type="xs:localComplexType"/>
+     </xs:choice>
+     <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attribute name="substitutionGroup" use="prohibited"/>
+    <xs:attribute name="final" use="prohibited"/>
+    <xs:attribute name="abstract" use="prohibited"/>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="element" type="xs:topLevelElement" id="element">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-element"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="group" abstract="true">
+  <xs:annotation>
+   <xs:documentation>
+   group type for explicit groups, named top-level groups and
+   group references</xs:documentation>
+  </xs:annotation>
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:group ref="xs:particle" minOccurs="0" maxOccurs="unbounded"/>
+    <xs:attributeGroup ref="xs:defRef"/>
+    <xs:attributeGroup ref="xs:occurs"/>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="realGroup">
+  <xs:complexContent>
+   <xs:restriction base="xs:group">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:choice minOccurs="0" maxOccurs="1">
+      <xs:element ref="xs:all"/>
+      <xs:element ref="xs:choice"/>
+      <xs:element ref="xs:sequence"/>
+     </xs:choice>
+    </xs:sequence>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="namedGroup">
+  <xs:complexContent>
+   <xs:restriction base="xs:realGroup">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:choice minOccurs="1" maxOccurs="1">
+      <xs:element name="all">
+       <xs:complexType>
+        <xs:complexContent>
+         <xs:restriction base="xs:all">
+          <xs:group ref="xs:allModel"/>
+          <xs:attribute name="minOccurs" use="prohibited"/>
+          <xs:attribute name="maxOccurs" use="prohibited"/>
+          <xs:anyAttribute namespace="##other" processContents="lax"/>
+         </xs:restriction>
+        </xs:complexContent>
+       </xs:complexType>
+      </xs:element>
+      <xs:element name="choice" type="xs:simpleExplicitGroup"/>
+      <xs:element name="sequence" type="xs:simpleExplicitGroup"/>
+     </xs:choice>
+    </xs:sequence>
+    <xs:attribute name="name" use="required" type="xs:NCName"/>
+    <xs:attribute name="ref" use="prohibited"/>
+    <xs:attribute name="minOccurs" use="prohibited"/>
+    <xs:attribute name="maxOccurs" use="prohibited"/>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="groupRef">
+  <xs:complexContent>
+   <xs:restriction base="xs:realGroup">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+    </xs:sequence>
+    <xs:attribute name="ref" use="required" type="xs:QName"/>
+    <xs:attribute name="name" use="prohibited"/>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="explicitGroup">
+  <xs:annotation>
+   <xs:documentation>
+   group type for the three kinds of group</xs:documentation>
+  </xs:annotation>
+  <xs:complexContent>
+   <xs:restriction base="xs:group">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attribute name="name" type="xs:NCName" use="prohibited"/>
+    <xs:attribute name="ref" type="xs:QName" use="prohibited"/>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="simpleExplicitGroup">
+  <xs:complexContent>
+   <xs:restriction base="xs:explicitGroup">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:group ref="xs:nestedParticle" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attribute name="minOccurs" use="prohibited"/>
+    <xs:attribute name="maxOccurs" use="prohibited"/>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:group name="allModel">
+  <xs:sequence>
+      <xs:element ref="xs:annotation" minOccurs="0"/>
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+       <xs:annotation>
+        <xs:documentation>This choice with min/max is here to
+                          avoid a pblm with the Elt:All/Choice/Seq
+                          Particle derivation constraint</xs:documentation>
+       </xs:annotation>
+       <xs:element name="element" type="xs:narrowMaxMin"/>
+      </xs:choice>
+     </xs:sequence>
+ </xs:group>
+ 
+ 
+ <xs:complexType name="narrowMaxMin">
+  <xs:annotation>
+   <xs:documentation>restricted max/min</xs:documentation>
+  </xs:annotation>
+  <xs:complexContent>
+   <xs:restriction base="xs:localElement">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:choice minOccurs="0">
+      <xs:element name="simpleType" type="xs:localSimpleType"/>
+      <xs:element name="complexType" type="xs:localComplexType"/>
+     </xs:choice>
+     <xs:group ref="xs:identityConstraint" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attribute name="minOccurs" use="optional" default="1">
+     <xs:simpleType>
+      <xs:restriction base="xs:nonNegativeInteger">
+       <xs:enumeration value="0"/>
+       <xs:enumeration value="1"/>
+      </xs:restriction>
+     </xs:simpleType>
+    </xs:attribute>
+    <xs:attribute name="maxOccurs" use="optional" default="1">
+     <xs:simpleType>
+      <xs:restriction base="xs:allNNI">
+       <xs:enumeration value="0"/>
+       <xs:enumeration value="1"/>
+      </xs:restriction>
+     </xs:simpleType>
+    </xs:attribute>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+  <xs:complexType name="all">
+   <xs:annotation>
+    <xs:documentation>
+   Only elements allowed inside</xs:documentation>
+   </xs:annotation>
+   <xs:complexContent>
+    <xs:restriction base="xs:explicitGroup">
+     <xs:group ref="xs:allModel"/>
+     <xs:attribute name="minOccurs" use="optional" default="1">
+      <xs:simpleType>
+       <xs:restriction base="xs:nonNegativeInteger">
+        <xs:enumeration value="0"/>
+        <xs:enumeration value="1"/>
+       </xs:restriction>
+      </xs:simpleType>
+     </xs:attribute>
+     <xs:attribute name="maxOccurs" use="optional" default="1">
+      <xs:simpleType>
+       <xs:restriction base="xs:allNNI">
+        <xs:enumeration value="1"/>
+       </xs:restriction>
+      </xs:simpleType>
+     </xs:attribute>
+     <xs:anyAttribute namespace="##other" processContents="lax"/>
+    </xs:restriction>
+   </xs:complexContent>
+  </xs:complexType>
+
+ <xs:element name="all" id="all" type="xs:all">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-all"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:element name="choice" type="xs:explicitGroup" id="choice">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-choice"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:element name="sequence" type="xs:explicitGroup" id="sequence">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-sequence"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:element name="group" type="xs:namedGroup" id="group">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-group"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="wildcard">
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:attribute name="namespace" type="xs:namespaceList" use="optional" default="##any"/>
+    <xs:attribute name="processContents" use="optional" default="strict">
+     <xs:simpleType>
+      <xs:restriction base="xs:NMTOKEN">
+       <xs:enumeration value="skip"/>
+       <xs:enumeration value="lax"/>
+       <xs:enumeration value="strict"/>
+      </xs:restriction>
+     </xs:simpleType>
+    </xs:attribute>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="any" id="any">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-any"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:wildcard">
+     <xs:attributeGroup ref="xs:occurs"/>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+
+  <xs:annotation>
+   <xs:documentation>
+   simple type for the value of the 'namespace' attr of
+   'any' and 'anyAttribute'</xs:documentation>
+  </xs:annotation>
+  <xs:annotation>
+   <xs:documentation>
+   Value is
+              ##any      - - any non-conflicting WFXML/attribute at all
+
+              ##other    - - any non-conflicting WFXML/attribute from
+                              namespace other than targetNS
+
+              ##local    - - any unqualified non-conflicting WFXML/attribute 
+
+              one or     - - any non-conflicting WFXML/attribute from
+              more URI        the listed namespaces
+              references
+              (space separated)
+
+    ##targetNamespace or ##local may appear in the above list, to
+        refer to the targetNamespace of the enclosing
+        schema or an absent targetNamespace respectively</xs:documentation>
+  </xs:annotation>
+
+ <xs:simpleType name="namespaceList">
+  <xs:annotation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+  </xs:annotation>
+  <xs:union>
+   <xs:simpleType>
+    <xs:restriction base="xs:token">
+     <xs:enumeration value="##any"/>
+     <xs:enumeration value="##other"/>
+    </xs:restriction>
+   </xs:simpleType>
+   <xs:simpleType>
+    <xs:list>
+     <xs:simpleType>
+      <xs:union memberTypes="xs:anyURI">
+       <xs:simpleType>
+        <xs:restriction base="xs:token">
+         <xs:enumeration value="##targetNamespace"/>
+         <xs:enumeration value="##local"/>
+        </xs:restriction>
+       </xs:simpleType>
+      </xs:union>
+     </xs:simpleType>
+    </xs:list>
+   </xs:simpleType>
+  </xs:union>
+ </xs:simpleType>
+
+ <xs:element name="attribute" type="xs:topLevelAttribute" id="attribute">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attribute"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:complexType name="attributeGroup" abstract="true">
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:group ref="xs:attrDecls"/>
+    <xs:attributeGroup ref="xs:defRef"/>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+ 
+ <xs:complexType name="namedAttributeGroup">
+  <xs:complexContent>
+   <xs:restriction base="xs:attributeGroup">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+     <xs:group ref="xs:attrDecls"/>
+    </xs:sequence>
+    <xs:attribute name="name" use="required" type="xs:NCName"/>
+    <xs:attribute name="ref" use="prohibited"/>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:complexType name="attributeGroupRef">
+  <xs:complexContent>
+   <xs:restriction base="xs:attributeGroup">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+    </xs:sequence>
+    <xs:attribute name="ref" use="required" type="xs:QName"/>
+    <xs:attribute name="name" use="prohibited"/>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:element name="attributeGroup" type="xs:namedAttributeGroup" id="attributeGroup">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-attributeGroup"/>
+  </xs:annotation>
+ </xs:element>
+
+ <xs:element name="include" id="include">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-include"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:annotated">
+     <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+
+ <xs:element name="redefine" id="redefine">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-redefine"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:openAttrs">
+     <xs:choice minOccurs="0" maxOccurs="unbounded">
+      <xs:element ref="xs:annotation"/>
+      <xs:group ref="xs:redefinable"/>
+     </xs:choice>
+     <xs:attribute name="schemaLocation" type="xs:anyURI" use="required"/>
+     <xs:attribute name="id" type="xs:ID"/>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+
+ <xs:element name="import" id="import">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-import"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:annotated">
+     <xs:attribute name="namespace" type="xs:anyURI"/>
+     <xs:attribute name="schemaLocation" type="xs:anyURI"/>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+
+ <xs:element name="selector" id="selector">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-selector"/>
+  </xs:annotation>
+  <xs:complexType>
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+     <xs:attribute name="xpath" use="required">
+      <xs:simpleType>
+       <xs:annotation>
+        <xs:documentation>A subset of XPath expressions for use
+in selectors</xs:documentation>
+        <xs:documentation>A utility type, not for public
+use</xs:documentation>
+       </xs:annotation>
+       <xs:restriction base="xs:token">
+        <xs:annotation>
+         <xs:documentation>The following pattern is intended to allow XPath
+                           expressions per the following EBNF:
+          Selector    ::=    Path ( '|' Path )*  
+          Path    ::=    ('.//')? Step ( '/' Step )*  
+          Step    ::=    '.' | NameTest  
+          NameTest    ::=    QName | '*' | NCName ':' '*'  
+                           child:: is also allowed
+         </xs:documentation>
+        </xs:annotation>
+        <xs:pattern value="(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*(\|(\.//)?(((child::)?((\i\c*:)?(\i\c*|\*)))|\.)(/(((child::)?((\i\c*:)?(\i\c*|\*)))|\.))*)*">
+        </xs:pattern>
+       </xs:restriction>
+      </xs:simpleType>
+     </xs:attribute>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="field" id="field">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-field"/>
+  </xs:annotation>
+  <xs:complexType>
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+     <xs:attribute name="xpath" use="required">
+      <xs:simpleType>
+       <xs:annotation>
+        <xs:documentation>A subset of XPath expressions for use
+in fields</xs:documentation>
+        <xs:documentation>A utility type, not for public
+use</xs:documentation>
+       </xs:annotation>
+       <xs:restriction base="xs:token">
+        <xs:annotation>
+         <xs:documentation>The following pattern is intended to allow XPath
+                           expressions per the same EBNF as for selector,
+                           with the following change:
+          Path    ::=    ('.//')? ( Step '/' )* ( Step | '@' NameTest ) 
+         </xs:documentation>
+        </xs:annotation>
+        <xs:pattern value="(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*))))(\|(\.//)?((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)/)*((((child::)?((\i\c*:)?(\i\c*|\*)))|\.)|((attribute::|@)((\i\c*:)?(\i\c*|\*)))))*">
+        </xs:pattern>
+       </xs:restriction>
+      </xs:simpleType>
+     </xs:attribute>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:complexType name="keybase">
+  <xs:complexContent>
+   <xs:extension base="xs:annotated">
+    <xs:sequence>
+     <xs:element ref="xs:selector"/>
+     <xs:element ref="xs:field" minOccurs="1" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attribute name="name" type="xs:NCName" use="required"/>
+   </xs:extension>
+  </xs:complexContent>
+ </xs:complexType>
+
+ <xs:group name="identityConstraint">
+  <xs:annotation>
+   <xs:documentation>The three kinds of identity constraints, all with
+                     type of or derived from 'keybase'.
+   </xs:documentation>
+  </xs:annotation>
+  <xs:choice>
+   <xs:element ref="xs:unique"/>
+   <xs:element ref="xs:key"/>
+   <xs:element ref="xs:keyref"/>
+  </xs:choice>
+ </xs:group>
+
+ <xs:element name="unique" type="xs:keybase" id="unique">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-unique"/>
+  </xs:annotation>
+ </xs:element>
+ <xs:element name="key" type="xs:keybase" id="key">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-key"/>
+  </xs:annotation>
+ </xs:element>
+ <xs:element name="keyref" id="keyref">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-keyref"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:keybase">
+     <xs:attribute name="refer" type="xs:QName" use="required"/>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+
+ <xs:element name="notation" id="notation">
+  <xs:annotation>
+   <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-notation"/>
+  </xs:annotation>
+  <xs:complexType>
+   <xs:complexContent>
+    <xs:extension base="xs:annotated">
+     <xs:attribute name="name" type="xs:NCName" use="required"/>
+     <xs:attribute name="public" type="xs:public"/>
+     <xs:attribute name="system" type="xs:anyURI"/>
+    </xs:extension>
+   </xs:complexContent>
+  </xs:complexType>
+ </xs:element>
+
+ <xs:simpleType name="public">
+  <xs:annotation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+   <xs:documentation>
+   A public identifier, per ISO 8879</xs:documentation>
+  </xs:annotation>
+  <xs:restriction base="xs:token"/>
+ </xs:simpleType>
+
+ <xs:element name="appinfo" id="appinfo">
+   <xs:annotation>
+     <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-appinfo"/>
+   </xs:annotation>
+   <xs:complexType mixed="true">
+    <xs:sequence minOccurs="0" maxOccurs="unbounded">
+     <xs:any processContents="lax"/>
+    </xs:sequence>
+    <xs:attribute name="source" type="xs:anyURI"/>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:complexType>
+ </xs:element>
+
+ <xs:element name="documentation" id="documentation">
+   <xs:annotation>
+     <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-documentation"/>
+   </xs:annotation>
+   <xs:complexType mixed="true">
+    <xs:sequence minOccurs="0" maxOccurs="unbounded">
+     <xs:any processContents="lax"/>
+    </xs:sequence>
+    <xs:attribute name="source" type="xs:anyURI"/>
+    <xs:attribute ref="xml:lang"/>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:complexType>
+ </xs:element>
+
+ <xs:element name="annotation" id="annotation">
+   <xs:annotation>
+     <xs:documentation source="http://www.w3.org/TR/xmlschema-1/#element-annotation"/>
+   </xs:annotation>
+   <xs:complexType>
+    <xs:complexContent>
+     <xs:extension base="xs:openAttrs">
+      <xs:choice minOccurs="0" maxOccurs="unbounded">
+       <xs:element ref="xs:appinfo"/>
+       <xs:element ref="xs:documentation"/>
+      </xs:choice>
+      <xs:attribute name="id" type="xs:ID"/>
+     </xs:extension>
+    </xs:complexContent>
+   </xs:complexType>
+ </xs:element>
+
+ <xs:annotation>
+  <xs:documentation>
+   notations for use within XML Schema schemas</xs:documentation>
+ </xs:annotation>
+
+ <xs:notation name="XMLSchemaStructures" public="structures" system="http://www.w3.org/2000/08/XMLSchema.xsd"/>
+ <xs:notation name="XML" public="REC-xml-19980210" system="http://www.w3.org/TR/1998/REC-xml-19980210"/>
+  
+ <xs:complexType name="anyType" mixed="true">
+  <xs:annotation>
+   <xs:documentation>
+   Not the real urType, but as close an approximation as we can
+   get in the XML representation</xs:documentation>
+  </xs:annotation>
+  <xs:sequence>
+   <xs:any minOccurs="0" maxOccurs="unbounded" processContents="lax"/>
+  </xs:sequence>
+  <xs:anyAttribute processContents="lax"/>
+ </xs:complexType>
+
+  <xs:annotation>
+    <xs:documentation>
+      First the built-in primitive datatypes.  These definitions are for
+      information only, the real built-in definitions are magic.
+    </xs:documentation>
+
+    <xs:documentation>
+      For each built-in datatype in this schema (both primitive and
+      derived) can be uniquely addressed via a URI constructed
+      as follows:
+        1) the base URI is the URI of the XML Schema namespace
+        2) the fragment identifier is the name of the datatype
+
+      For example, to address the int datatype, the URI is:
+
+        http://www.w3.org/2001/XMLSchema#int
+
+      Additionally, each facet definition element can be uniquely
+      addressed via a URI constructed as follows:
+        1) the base URI is the URI of the XML Schema namespace
+        2) the fragment identifier is the name of the facet
+
+      For example, to address the maxInclusive facet, the URI is:
+
+        http://www.w3.org/2001/XMLSchema#maxInclusive
+
+      Additionally, each facet usage in a built-in datatype definition
+      can be uniquely addressed via a URI constructed as follows:
+        1) the base URI is the URI of the XML Schema namespace
+        2) the fragment identifier is the name of the datatype, followed
+           by a period (".") followed by the name of the facet
+
+      For example, to address the usage of the maxInclusive facet in
+      the definition of int, the URI is:
+
+        http://www.w3.org/2001/XMLSchema#int.maxInclusive
+
+    </xs:documentation>
+  </xs:annotation>
+
+  <xs:simpleType name="string" id="string">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality" value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+                source="http://www.w3.org/TR/xmlschema-2/#string"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="preserve" id="string.preserve"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="boolean" id="boolean">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality" value="finite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#boolean"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse" fixed="true"
+        id="boolean.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="float" id="float">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="total"/>
+        <hfp:hasProperty name="bounded" value="true"/>
+        <hfp:hasProperty name="cardinality" value="finite"/>
+        <hfp:hasProperty name="numeric" value="true"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#float"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse" fixed="true"
+        id="float.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="double" id="double">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="total"/>
+        <hfp:hasProperty name="bounded" value="true"/>
+        <hfp:hasProperty name="cardinality" value="finite"/>
+        <hfp:hasProperty name="numeric" value="true"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#double"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="double.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="decimal" id="decimal">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="totalDigits"/>
+        <hfp:hasFacet name="fractionDigits"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="total"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="true"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#decimal"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="decimal.whiteSpace"/>
+    </xs:restriction>
+   </xs:simpleType>
+
+   <xs:simpleType name="duration" id="duration">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#duration"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="duration.whiteSpace"/>
+    </xs:restriction>
+   </xs:simpleType>
+
+ <xs:simpleType name="dateTime" id="dateTime">
+    <xs:annotation>
+    <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#dateTime"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="dateTime.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="time" id="time">
+    <xs:annotation>
+    <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#time"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="time.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="date" id="date">
+   <xs:annotation>
+    <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#date"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="date.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="gYearMonth" id="gYearMonth">
+   <xs:annotation>
+    <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#gYearMonth"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="gYearMonth.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="gYear" id="gYear">
+    <xs:annotation>
+    <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#gYear"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="gYear.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+ <xs:simpleType name="gMonthDay" id="gMonthDay">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+       <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#gMonthDay"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+         <xs:whiteSpace value="collapse" fixed="true"
+                id="gMonthDay.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="gDay" id="gDay">
+    <xs:annotation>
+  <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#gDay"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+         <xs:whiteSpace value="collapse"  fixed="true"
+                id="gDay.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+ <xs:simpleType name="gMonth" id="gMonth">
+    <xs:annotation>
+  <xs:appinfo>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="maxInclusive"/>
+        <hfp:hasFacet name="maxExclusive"/>
+        <hfp:hasFacet name="minInclusive"/>
+        <hfp:hasFacet name="minExclusive"/>
+        <hfp:hasProperty name="ordered" value="partial"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#gMonth"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+         <xs:whiteSpace value="collapse"  fixed="true"
+                id="gMonth.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+   <xs:simpleType name="hexBinary" id="hexBinary">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#binary"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse" fixed="true"
+        id="hexBinary.whiteSpace"/>
+    </xs:restriction>
+   </xs:simpleType>
+
+ <xs:simpleType name="base64Binary" id="base64Binary">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+                source="http://www.w3.org/TR/xmlschema-2/#base64Binary"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse" fixed="true"
+        id="base64Binary.whiteSpace"/>
+    </xs:restriction>
+   </xs:simpleType>
+
+   <xs:simpleType name="anyURI" id="anyURI">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#anyURI"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="anyURI.whiteSpace"/>
+    </xs:restriction>
+   </xs:simpleType>
+
+  <xs:simpleType name="QName" id="QName">
+    <xs:annotation>
+        <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#QName"/>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="QName.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+   <xs:simpleType name="NOTATION" id="NOTATION">
+    <xs:annotation>
+        <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#NOTATION"/>
+      <xs:documentation>
+        NOTATION cannot be used directly in a schema; rather a type
+        must be derived from it by specifying at least one enumeration
+        facet whose value is the name of a NOTATION declared in the
+        schema.
+      </xs:documentation>
+    </xs:annotation>
+    <xs:restriction base="xs:anySimpleType">
+      <xs:whiteSpace value="collapse"  fixed="true"
+        id="NOTATION.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:annotation>
+    <xs:documentation>
+      Now the derived primitive types
+    </xs:documentation>
+  </xs:annotation>
+
+  <xs:simpleType name="normalizedString" id="normalizedString">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#normalizedString"/>
+    </xs:annotation>
+    <xs:restriction base="xs:string">
+      <xs:whiteSpace value="replace"
+        id="normalizedString.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="token" id="token">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#token"/>
+    </xs:annotation>
+    <xs:restriction base="xs:normalizedString">
+      <xs:whiteSpace value="collapse" id="token.whiteSpace"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="language" id="language">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#language"/>
+    </xs:annotation>
+    <xs:restriction base="xs:token">
+      <xs:pattern
+        value="[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})*"
+                id="language.pattern">
+        <xs:annotation>
+          <xs:documentation
+                source="http://www.ietf.org/rfc/rfc3066.txt">
+            pattern specifies the content of section 2.12 of XML 1.0e2
+            and RFC 3066 (Revised version of RFC 1766).
+          </xs:documentation>
+        </xs:annotation>
+      </xs:pattern>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="IDREFS" id="IDREFS">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#IDREFS"/>
+    </xs:annotation>
+    <xs:restriction>
+      <xs:simpleType>
+        <xs:list itemType="xs:IDREF"/>
+      </xs:simpleType>
+        <xs:minLength value="1" id="IDREFS.minLength"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="ENTITIES" id="ENTITIES">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#ENTITIES"/>
+    </xs:annotation>
+    <xs:restriction>
+      <xs:simpleType>
+        <xs:list itemType="xs:ENTITY"/>
+      </xs:simpleType>
+        <xs:minLength value="1" id="ENTITIES.minLength"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="NMTOKEN" id="NMTOKEN">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#NMTOKEN"/>
+    </xs:annotation>
+    <xs:restriction base="xs:token">
+      <xs:pattern value="\c+" id="NMTOKEN.pattern">
+        <xs:annotation>
+          <xs:documentation
+                source="http://www.w3.org/TR/REC-xml#NT-Nmtoken">
+            pattern matches production 7 from the XML spec
+          </xs:documentation>
+        </xs:annotation>
+      </xs:pattern>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="NMTOKENS" id="NMTOKENS">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasFacet name="length"/>
+        <hfp:hasFacet name="minLength"/>
+        <hfp:hasFacet name="maxLength"/>
+        <hfp:hasFacet name="enumeration"/>
+        <hfp:hasFacet name="whiteSpace"/>
+        <hfp:hasFacet name="pattern"/>
+        <hfp:hasProperty name="ordered" value="false"/>
+        <hfp:hasProperty name="bounded" value="false"/>
+        <hfp:hasProperty name="cardinality"
+                value="countably infinite"/>
+        <hfp:hasProperty name="numeric" value="false"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#NMTOKENS"/>
+    </xs:annotation>
+    <xs:restriction>
+      <xs:simpleType>
+        <xs:list itemType="xs:NMTOKEN"/>
+      </xs:simpleType>
+        <xs:minLength value="1" id="NMTOKENS.minLength"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="Name" id="Name">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#Name"/>
+    </xs:annotation>
+    <xs:restriction base="xs:token">
+      <xs:pattern value="\i\c*" id="Name.pattern">
+        <xs:annotation>
+          <xs:documentation
+                        source="http://www.w3.org/TR/REC-xml#NT-Name">
+            pattern matches production 5 from the XML spec
+          </xs:documentation>
+        </xs:annotation>
+      </xs:pattern>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="NCName" id="NCName">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#NCName"/>
+    </xs:annotation>
+    <xs:restriction base="xs:Name">
+      <xs:pattern value="[\i-[:]][\c-[:]]*" id="NCName.pattern">
+        <xs:annotation>
+          <xs:documentation
+                source="http://www.w3.org/TR/REC-xml-names/#NT-NCName">
+            pattern matches production 4 from the Namespaces in XML spec
+          </xs:documentation>
+        </xs:annotation>
+      </xs:pattern>
+    </xs:restriction>
+  </xs:simpleType>
+
+   <xs:simpleType name="ID" id="ID">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#ID"/>
+    </xs:annotation>
+    <xs:restriction base="xs:NCName"/>
+   </xs:simpleType>
+
+   <xs:simpleType name="IDREF" id="IDREF">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#IDREF"/>
+    </xs:annotation>
+    <xs:restriction base="xs:NCName"/>
+   </xs:simpleType>
+
+   <xs:simpleType name="ENTITY" id="ENTITY">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#ENTITY"/>
+    </xs:annotation>
+    <xs:restriction base="xs:NCName"/>
+   </xs:simpleType>
+
+  <xs:simpleType name="integer" id="integer">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#integer"/>
+    </xs:annotation>
+    <xs:restriction base="xs:decimal">
+      <xs:fractionDigits value="0" fixed="true" id="integer.fractionDigits"/>
+      <xs:pattern value="[\-+]?[0-9]+"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="nonPositiveInteger" id="nonPositiveInteger">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#nonPositiveInteger"/>
+    </xs:annotation>
+    <xs:restriction base="xs:integer">
+      <xs:maxInclusive value="0" id="nonPositiveInteger.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="negativeInteger" id="negativeInteger">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#negativeInteger"/>
+    </xs:annotation>
+    <xs:restriction base="xs:nonPositiveInteger">
+      <xs:maxInclusive value="-1" id="negativeInteger.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="long" id="long">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasProperty name="bounded" value="true"/>
+        <hfp:hasProperty name="cardinality" value="finite"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#long"/>
+    </xs:annotation>
+    <xs:restriction base="xs:integer">
+      <xs:minInclusive value="-9223372036854775808" id="long.minInclusive"/>
+      <xs:maxInclusive value="9223372036854775807" id="long.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="int" id="int">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#int"/>
+    </xs:annotation>
+    <xs:restriction base="xs:long">
+      <xs:minInclusive value="-2147483648" id="int.minInclusive"/>
+      <xs:maxInclusive value="2147483647" id="int.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="short" id="short">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#short"/>
+    </xs:annotation>
+    <xs:restriction base="xs:int">
+      <xs:minInclusive value="-32768" id="short.minInclusive"/>
+      <xs:maxInclusive value="32767" id="short.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="byte" id="byte">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#byte"/>
+    </xs:annotation>
+    <xs:restriction base="xs:short">
+      <xs:minInclusive value="-128" id="byte.minInclusive"/>
+      <xs:maxInclusive value="127" id="byte.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="nonNegativeInteger" id="nonNegativeInteger">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#nonNegativeInteger"/>
+    </xs:annotation>
+    <xs:restriction base="xs:integer">
+      <xs:minInclusive value="0" id="nonNegativeInteger.minInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="unsignedLong" id="unsignedLong">
+    <xs:annotation>
+      <xs:appinfo>
+        <hfp:hasProperty name="bounded" value="true"/>
+        <hfp:hasProperty name="cardinality" value="finite"/>
+      </xs:appinfo>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#unsignedLong"/>
+    </xs:annotation>
+    <xs:restriction base="xs:nonNegativeInteger">
+      <xs:maxInclusive value="18446744073709551615"
+        id="unsignedLong.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="unsignedInt" id="unsignedInt">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#unsignedInt"/>
+    </xs:annotation>
+    <xs:restriction base="xs:unsignedLong">
+      <xs:maxInclusive value="4294967295"
+        id="unsignedInt.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="unsignedShort" id="unsignedShort">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#unsignedShort"/>
+    </xs:annotation>
+    <xs:restriction base="xs:unsignedInt">
+      <xs:maxInclusive value="65535"
+        id="unsignedShort.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="unsignedByte" id="unsignedByte">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#unsignedByte"/>
+    </xs:annotation>
+    <xs:restriction base="xs:unsignedShort">
+      <xs:maxInclusive value="255" id="unsignedByte.maxInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+  <xs:simpleType name="positiveInteger" id="positiveInteger">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#positiveInteger"/>
+    </xs:annotation>
+    <xs:restriction base="xs:nonNegativeInteger">
+      <xs:minInclusive value="1" id="positiveInteger.minInclusive"/>
+    </xs:restriction>
+  </xs:simpleType>
+
+ <xs:simpleType name="derivationControl">
+  <xs:annotation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+  </xs:annotation>
+  <xs:restriction base="xs:NMTOKEN">
+   <xs:enumeration value="substitution"/>
+   <xs:enumeration value="extension"/>
+   <xs:enumeration value="restriction"/>
+   <xs:enumeration value="list"/>
+   <xs:enumeration value="union"/>
+  </xs:restriction>
+ </xs:simpleType>
+
+ <xs:group name="simpleDerivation">
+  <xs:choice>
+    <xs:element ref="xs:restriction"/>
+    <xs:element ref="xs:list"/>
+    <xs:element ref="xs:union"/>
+  </xs:choice>
+ </xs:group>
+
+ <xs:simpleType name="simpleDerivationSet">
+  <xs:annotation>
+   <xs:documentation>
+   #all or (possibly empty) subset of {restriction, union, list}
+   </xs:documentation>
+   <xs:documentation>
+   A utility type, not for public use</xs:documentation>
+  </xs:annotation>
+  <xs:union>
+   <xs:simpleType>
+    <xs:restriction base="xs:token">
+     <xs:enumeration value="#all"/>
+    </xs:restriction>
+   </xs:simpleType>
+   <xs:simpleType>
+    <xs:list>
+     <xs:simpleType>
+      <xs:restriction base="xs:derivationControl">
+       <xs:enumeration value="list"/>
+       <xs:enumeration value="union"/>
+       <xs:enumeration value="restriction"/>
+      </xs:restriction>
+     </xs:simpleType>
+    </xs:list>
+   </xs:simpleType>
+  </xs:union>
+ </xs:simpleType>
+
+  <xs:complexType name="simpleType" abstract="true">
+    <xs:complexContent>
+      <xs:extension base="xs:annotated">
+        <xs:group ref="xs:simpleDerivation"/>
+        <xs:attribute name="final" type="xs:simpleDerivationSet"/>
+        <xs:attribute name="name" type="xs:NCName">
+          <xs:annotation>
+            <xs:documentation>
+              Can be restricted to required or forbidden
+            </xs:documentation>
+          </xs:annotation>
+        </xs:attribute>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:complexType name="topLevelSimpleType">
+    <xs:complexContent>
+      <xs:restriction base="xs:simpleType">
+        <xs:sequence>
+          <xs:element ref="xs:annotation" minOccurs="0"/>
+          <xs:group ref="xs:simpleDerivation"/>
+        </xs:sequence>
+        <xs:attribute name="name" use="required"
+             type="xs:NCName">
+          <xs:annotation>
+            <xs:documentation>
+              Required at the top level
+            </xs:documentation>
+          </xs:annotation>
+        </xs:attribute>
+       <xs:anyAttribute namespace="##other" processContents="lax"/>
+      </xs:restriction>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:complexType name="localSimpleType">
+    <xs:complexContent>
+      <xs:restriction base="xs:simpleType">
+        <xs:sequence>
+          <xs:element ref="xs:annotation" minOccurs="0"/>
+          <xs:group ref="xs:simpleDerivation"/>
+        </xs:sequence>
+        <xs:attribute name="name" use="prohibited">
+          <xs:annotation>
+            <xs:documentation>
+              Forbidden when nested
+            </xs:documentation>
+          </xs:annotation>
+        </xs:attribute>
+        <xs:attribute name="final" use="prohibited"/>
+       <xs:anyAttribute namespace="##other" processContents="lax"/>
+      </xs:restriction>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:element name="simpleType" type="xs:topLevelSimpleType" id="simpleType">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-simpleType"/>
+    </xs:annotation>
+  </xs:element>
+
+  <xs:group name="facets">
+   <xs:annotation>
+    <xs:documentation>
+       We should use a substitution group for facets, but
+       that's ruled out because it would allow users to
+       add their own, which we're not ready for yet.
+    </xs:documentation>
+   </xs:annotation>
+   <xs:choice>
+    <xs:element ref="xs:minExclusive"/>
+    <xs:element ref="xs:minInclusive"/>
+    <xs:element ref="xs:maxExclusive"/>
+    <xs:element ref="xs:maxInclusive"/>
+    <xs:element ref="xs:totalDigits"/>
+    <xs:element ref="xs:fractionDigits"/>
+    <xs:element ref="xs:length"/>
+    <xs:element ref="xs:minLength"/>
+    <xs:element ref="xs:maxLength"/>
+    <xs:element ref="xs:enumeration"/>
+    <xs:element ref="xs:whiteSpace"/>
+    <xs:element ref="xs:pattern"/>
+   </xs:choice>
+  </xs:group>
+
+  <xs:group name="simpleRestrictionModel">
+   <xs:sequence>
+    <xs:element name="simpleType" type="xs:localSimpleType" minOccurs="0"/>
+    <xs:group ref="xs:facets" minOccurs="0" maxOccurs="unbounded"/>
+   </xs:sequence>
+  </xs:group>
+
+  <xs:element name="restriction" id="restriction">
+   <xs:complexType>
+    <xs:annotation>
+      <xs:documentation
+                source="http://www.w3.org/TR/xmlschema-2/#element-restriction">
+          base attribute and simpleType child are mutually
+          exclusive, but one or other is required
+        </xs:documentation>
+      </xs:annotation>
+      <xs:complexContent>
+        <xs:extension base="xs:annotated">
+         <xs:group ref="xs:simpleRestrictionModel"/>
+         <xs:attribute name="base" type="xs:QName" use="optional"/>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="list" id="list">
+   <xs:complexType>
+    <xs:annotation>
+      <xs:documentation
+                source="http://www.w3.org/TR/xmlschema-2/#element-list">
+          itemType attribute and simpleType child are mutually
+          exclusive, but one or other is required
+        </xs:documentation>
+      </xs:annotation>
+      <xs:complexContent>
+        <xs:extension base="xs:annotated">
+          <xs:sequence>
+            <xs:element name="simpleType" type="xs:localSimpleType"
+                minOccurs="0"/>
+          </xs:sequence>
+          <xs:attribute name="itemType" type="xs:QName" use="optional"/>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="union" id="union">
+   <xs:complexType>
+    <xs:annotation>
+      <xs:documentation
+                source="http://www.w3.org/TR/xmlschema-2/#element-union">
+          memberTypes attribute must be non-empty or there must be
+          at least one simpleType child
+        </xs:documentation>
+      </xs:annotation>
+      <xs:complexContent>
+        <xs:extension base="xs:annotated">
+          <xs:sequence>
+            <xs:element name="simpleType" type="xs:localSimpleType"
+                minOccurs="0" maxOccurs="unbounded"/>
+          </xs:sequence>
+          <xs:attribute name="memberTypes" use="optional">
+            <xs:simpleType>
+              <xs:list itemType="xs:QName"/>
+            </xs:simpleType>
+          </xs:attribute>
+        </xs:extension>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:complexType name="facet">
+    <xs:complexContent>
+      <xs:extension base="xs:annotated">
+        <xs:attribute name="value" use="required"/>
+        <xs:attribute name="fixed" type="xs:boolean" use="optional"
+                      default="false"/>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+ <xs:complexType name="noFixedFacet">
+  <xs:complexContent>
+   <xs:restriction base="xs:facet">
+    <xs:sequence>
+     <xs:element ref="xs:annotation" minOccurs="0"/>
+    </xs:sequence>
+    <xs:attribute name="fixed" use="prohibited"/>
+    <xs:anyAttribute namespace="##other" processContents="lax"/>
+   </xs:restriction>
+  </xs:complexContent>
+ </xs:complexType>
+
+  <xs:element name="minExclusive" id="minExclusive" type="xs:facet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-minExclusive"/>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="minInclusive" id="minInclusive" type="xs:facet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-minInclusive"/>
+    </xs:annotation>
+  </xs:element>
+
+  <xs:element name="maxExclusive" id="maxExclusive" type="xs:facet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-maxExclusive"/>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="maxInclusive" id="maxInclusive" type="xs:facet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-maxInclusive"/>
+    </xs:annotation>
+  </xs:element>
+
+  <xs:complexType name="numFacet">
+    <xs:complexContent>
+      <xs:restriction base="xs:facet">
+       <xs:sequence>
+         <xs:element ref="xs:annotation" minOccurs="0"/>
+       </xs:sequence>
+       <xs:attribute name="value" type="xs:nonNegativeInteger" use="required"/>
+       <xs:anyAttribute namespace="##other" processContents="lax"/>
+      </xs:restriction>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:element name="totalDigits" id="totalDigits">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-totalDigits"/>
+    </xs:annotation>
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:restriction base="xs:numFacet">
+          <xs:sequence>
+            <xs:element ref="xs:annotation" minOccurs="0"/>
+          </xs:sequence>
+          <xs:attribute name="value" type="xs:positiveInteger" use="required"/>
+         <xs:anyAttribute namespace="##other" processContents="lax"/>
+        </xs:restriction>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+  <xs:element name="fractionDigits" id="fractionDigits" type="xs:numFacet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-fractionDigits"/>
+    </xs:annotation>
+  </xs:element>
+
+  <xs:element name="length" id="length" type="xs:numFacet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-length"/>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="minLength" id="minLength" type="xs:numFacet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-minLength"/>
+    </xs:annotation>
+  </xs:element>
+  <xs:element name="maxLength" id="maxLength" type="xs:numFacet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-maxLength"/>
+    </xs:annotation>
+  </xs:element>
+
+  <xs:element name="enumeration" id="enumeration" type="xs:noFixedFacet">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-enumeration"/>
+    </xs:annotation>
+  </xs:element>
+
+  <xs:element name="whiteSpace" id="whiteSpace">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-whiteSpace"/>
+    </xs:annotation>
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:restriction base="xs:facet">
+          <xs:sequence>
+            <xs:element ref="xs:annotation" minOccurs="0"/>
+          </xs:sequence>
+          <xs:attribute name="value" use="required">
+            <xs:simpleType>
+              <xs:restriction base="xs:NMTOKEN">
+                <xs:enumeration value="preserve"/>
+                <xs:enumeration value="replace"/>
+                <xs:enumeration value="collapse"/>
+              </xs:restriction>
+            </xs:simpleType>
+          </xs:attribute>
+         <xs:anyAttribute namespace="##other" processContents="lax"/>
+        </xs:restriction>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+
+  <xs:element name="pattern" id="pattern">
+    <xs:annotation>
+      <xs:documentation
+        source="http://www.w3.org/TR/xmlschema-2/#element-pattern"/>
+    </xs:annotation>
+    <xs:complexType>
+      <xs:complexContent>
+        <xs:restriction base="xs:noFixedFacet">
+          <xs:sequence>
+            <xs:element ref="xs:annotation" minOccurs="0"/>
+          </xs:sequence>
+          <xs:attribute name="value" type="xs:string" use="required"/>
+         <xs:anyAttribute namespace="##other" processContents="lax"/>
+        </xs:restriction>
+      </xs:complexContent>
+    </xs:complexType>
+  </xs:element>
+
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/datatypes.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/datatypes.dtd
new file mode 100644
index 00000000000..91cfb34135c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/datatypes.dtd
@@ -0,0 +1,203 @@
+<!--
+        DTD for XML Schemas: Part 2: Datatypes
+        $Id: datatypes.dtd,v 1.3 2007-07-19 21:56:49 ofung Exp $
+        Note this DTD is NOT normative, or even definitive. - - the
+        prose copy in the datatypes REC is the definitive version
+        (which shouldn't differ from this one except for this comment
+        and entity expansions, but just in case)
+  -->
+
+<!--
+        This DTD cannot be used on its own, it is intended
+        only for incorporation in XMLSchema.dtd, q.v.
+  -->
+
+<!-- Define all the element names, with optional prefix -->
+<!ENTITY % simpleType "%p;simpleType">
+<!ENTITY % restriction "%p;restriction">
+<!ENTITY % list "%p;list">
+<!ENTITY % union "%p;union">
+<!ENTITY % maxExclusive "%p;maxExclusive">
+<!ENTITY % minExclusive "%p;minExclusive">
+<!ENTITY % maxInclusive "%p;maxInclusive">
+<!ENTITY % minInclusive "%p;minInclusive">
+<!ENTITY % totalDigits "%p;totalDigits">
+<!ENTITY % fractionDigits "%p;fractionDigits">
+<!ENTITY % length "%p;length">
+<!ENTITY % minLength "%p;minLength">
+<!ENTITY % maxLength "%p;maxLength">
+<!ENTITY % enumeration "%p;enumeration">
+<!ENTITY % whiteSpace "%p;whiteSpace">
+<!ENTITY % pattern "%p;pattern">
+
+<!--
+        Customisation entities for the ATTLIST of each element
+        type. Define one of these if your schema takes advantage
+        of the anyAttribute='##other' in the schema for schemas
+  -->
+
+<!ENTITY % simpleTypeAttrs "">
+<!ENTITY % restrictionAttrs "">
+<!ENTITY % listAttrs "">
+<!ENTITY % unionAttrs "">
+<!ENTITY % maxExclusiveAttrs "">
+<!ENTITY % minExclusiveAttrs "">
+<!ENTITY % maxInclusiveAttrs "">
+<!ENTITY % minInclusiveAttrs "">
+<!ENTITY % totalDigitsAttrs "">
+<!ENTITY % fractionDigitsAttrs "">
+<!ENTITY % lengthAttrs "">
+<!ENTITY % minLengthAttrs "">
+<!ENTITY % maxLengthAttrs "">
+<!ENTITY % enumerationAttrs "">
+<!ENTITY % whiteSpaceAttrs "">
+<!ENTITY % patternAttrs "">
+
+<!-- Define some entities for informative use as attribute
+        types -->
+<!ENTITY % URIref "CDATA">
+<!ENTITY % XPathExpr "CDATA">
+<!ENTITY % QName "NMTOKEN">
+<!ENTITY % QNames "NMTOKENS">
+<!ENTITY % NCName "NMTOKEN">
+<!ENTITY % nonNegativeInteger "NMTOKEN">
+<!ENTITY % boolean "(true|false)">
+<!ENTITY % simpleDerivationSet "CDATA">
+<!--
+        #all or space-separated list drawn from derivationChoice
+  -->
+
+<!--
+        Note that the use of 'facet' below is less restrictive
+        than is really intended:  There should in fact be no
+        more than one of each of minInclusive, minExclusive,
+        maxInclusive, maxExclusive, totalDigits, fractionDigits,
+        length, maxLength, minLength within datatype,
+        and the min- and max- variants of Inclusive and Exclusive
+        are mutually exclusive. On the other hand,  pattern and
+        enumeration may repeat.
+  -->
+<!ENTITY % minBound "(%minInclusive; | %minExclusive;)">
+<!ENTITY % maxBound "(%maxInclusive; | %maxExclusive;)">
+<!ENTITY % bounds "%minBound; | %maxBound;">
+<!ENTITY % numeric "%totalDigits; | %fractionDigits;">
+<!ENTITY % ordered "%bounds; | %numeric;">
+<!ENTITY % unordered
+   "%pattern; | %enumeration; | %whiteSpace; | %length; |
+   %maxLength; | %minLength;">
+<!ENTITY % facet "%ordered; | %unordered;">
+<!ENTITY % facetAttr 
+        "value CDATA #REQUIRED
+        id ID #IMPLIED">
+<!ENTITY % fixedAttr "fixed %boolean; #IMPLIED">
+<!ENTITY % facetModel "(%annotation;)?">
+<!ELEMENT %simpleType;
+        ((%annotation;)?, (%restriction; | %list; | %union;))>
+<!ATTLIST %simpleType;
+    name      %NCName; #IMPLIED
+    final     %simpleDerivationSet; #IMPLIED
+    id        ID       #IMPLIED
+    %simpleTypeAttrs;>
+<!-- name is required at top level -->
+<!ELEMENT %restriction; ((%annotation;)?,
+                         (%restriction1; |
+                          ((%simpleType;)?,(%facet;)*)),
+                         (%attrDecls;))>
+<!ATTLIST %restriction;
+    base      %QName;                  #IMPLIED
+    id        ID       #IMPLIED
+    %restrictionAttrs;>
+<!--
+        base and simpleType child are mutually exclusive,
+        one is required.
+
+        restriction is shared between simpleType and
+        simpleContent and complexContent (in XMLSchema.xsd).
+        restriction1 is for the latter cases, when this
+        is restricting a complex type, as is attrDecls.
+  -->
+<!ELEMENT %list; ((%annotation;)?,(%simpleType;)?)>
+<!ATTLIST %list;
+    itemType      %QName;             #IMPLIED
+    id        ID       #IMPLIED
+    %listAttrs;>
+<!--
+        itemType and simpleType child are mutually exclusive,
+        one is required
+  -->
+<!ELEMENT %union; ((%annotation;)?,(%simpleType;)*)>
+<!ATTLIST %union;
+    id            ID       #IMPLIED
+    memberTypes   %QNames;            #IMPLIED
+    %unionAttrs;>
+<!--
+        At least one item in memberTypes or one simpleType
+        child is required
+  -->
+
+<!ELEMENT %maxExclusive; %facetModel;>
+<!ATTLIST %maxExclusive;
+        %facetAttr;
+        %fixedAttr;
+        %maxExclusiveAttrs;>
+<!ELEMENT %minExclusive; %facetModel;>
+<!ATTLIST %minExclusive;
+        %facetAttr;
+        %fixedAttr;
+        %minExclusiveAttrs;>
+
+<!ELEMENT %maxInclusive; %facetModel;>
+<!ATTLIST %maxInclusive;
+        %facetAttr;
+        %fixedAttr;
+        %maxInclusiveAttrs;>
+<!ELEMENT %minInclusive; %facetModel;>
+<!ATTLIST %minInclusive;
+        %facetAttr;
+        %fixedAttr;
+        %minInclusiveAttrs;>
+
+<!ELEMENT %totalDigits; %facetModel;>
+<!ATTLIST %totalDigits;
+        %facetAttr;
+        %fixedAttr;
+        %totalDigitsAttrs;>
+<!ELEMENT %fractionDigits; %facetModel;>
+<!ATTLIST %fractionDigits;
+        %facetAttr;
+        %fixedAttr;
+        %fractionDigitsAttrs;>
+
+<!ELEMENT %length; %facetModel;>
+<!ATTLIST %length;
+        %facetAttr;
+        %fixedAttr;
+        %lengthAttrs;>
+<!ELEMENT %minLength; %facetModel;>
+<!ATTLIST %minLength;
+        %facetAttr;
+        %fixedAttr;
+        %minLengthAttrs;>
+<!ELEMENT %maxLength; %facetModel;>
+<!ATTLIST %maxLength;
+        %facetAttr;
+        %fixedAttr;
+        %maxLengthAttrs;>
+
+<!-- This one can be repeated -->
+<!ELEMENT %enumeration; %facetModel;>
+<!ATTLIST %enumeration;
+        %facetAttr;
+        %enumerationAttrs;>
+
+<!ELEMENT %whiteSpace; %facetModel;>
+<!ATTLIST %whiteSpace;
+        %facetAttr;
+        %fixedAttr;
+        %whiteSpaceAttrs;>
+
+<!-- This one can be repeated -->
+<!ELEMENT %pattern; %facetModel;>
+<!ATTLIST %pattern;
+        %facetAttr;
+        %patternAttrs;>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/report.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/report.dtd
new file mode 100644
index 00000000000..0de99798748
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/report.dtd
@@ -0,0 +1,31 @@
+<!NOTATION cgm PUBLIC "Computer Graphics Metafile">

+ <!NOTATION ccitt PUBLIC "CCITT group 4 raster">

+

+ <!ENTITY % text "(#PCDATA | emph)*">

+ <!ENTITY infoflow SYSTEM "infoflow.ccitt" NDATA ccitt>

+ <!ENTITY tagexamp SYSTEM "tagexamp.cgm"   NDATA cgm>

+

+ <!ELEMENT report (title, chapter+)>

+ <!ELEMENT title %text;>

+ <!ELEMENT chapter (title, intro?, section*)>

+ <!ATTLIST chapter

+               shorttitle CDATA #IMPLIED>

+ <!ELEMENT intro (para | graphic)+>

+ <!ELEMENT section (title, intro?, topic*)>

+ <!ATTLIST section

+               shorttitle CDATA #IMPLIED

+               sectid ID #IMPLIED>

+ <!ELEMENT topic (title, (para | graphic)+)>

+ <!ATTLIST topic

+               shorttitle CDATA #IMPLIED

+               topicid ID #IMPLIED>

+ <!ELEMENT para (#PCDATA | emph | xref)*>

+ <!ATTLIST para

+               security (u | c | s | ts) "u">

+ <!ELEMENT emph %text;>

+ <!ELEMENT graphic EMPTY>

+ <!ATTLIST graphic

+               graphname ENTITY #REQUIRED>

+ <!ELEMENT xref EMPTY>

+ <!ATTLIST xref

+               xrefid IDREF #IMPLIED>

diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/sgml.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/sgml.xml
new file mode 100644
index 00000000000..58a1817a1b8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/sgml.xml
@@ -0,0 +1,101 @@
+<!DOCTYPE report SYSTEM "report.dtd">
+<report>
+<title>Getting started with SGML</title>
+<chapter>
+<title>The business challenge</title>
+<intro>
+<para>With the ever-changing and growing global market, companies and
+ large organizations are searching for ways to become more viable and
+ competitive. Downsizing and other cost-cutting measures demand more
+ efficient use of corporate resources. One very important resource is
+ an organization's information.</para>
+<para>As part of the move toward integrated information management,
+whole industries are developing and implementing standards for
+exchanging technical information. This report describes how one such
+standard, the Standard Generalized Markup Language (SGML), works as
+part of an overall information management strategy.</para>
+<graphic graphname="infoflow"/></intro></chapter>
+<chapter>
+<title>Getting to know SGML</title>
+<intro>
+<para>While SGML is a fairly recent technology, the use of
+<emph>markup</emph> in computer-generated documents has existed for a
+while.</para></intro>
+<section shorttitle="What is markup?">
+<title>What is markup, or everything you always wanted to know about
+document preparation but were afraid to ask?</title>
+<intro>
+<para>Markup is everything in a document that is not content. The
+traditional meaning of markup is the manual <emph>marking</emph> up
+of typewritten text to give instructions for a typesetter or
+compositor about how to fit the text on a page and what typefaces to
+use. This kind of markup is known as <emph>procedural markup</emph>.</para></intro>
+<topic topicid="top1">
+<title>Procedural markup</title>
+<para>Most electronic publishing systems today use some form of
+procedural markup. Procedural markup codes are good for one
+presentation of the information.</para></topic>
+<topic topicid="top2">
+<title>Generic markup</title>
+<para>Generic markup (also known as descriptive markup) describes the
+<emph>purpose</emph> of the text in a document. A basic concept of
+generic markup is that the content of a document must be separate from
+the style. Generic markup allows for multiple presentations of the
+information.</para></topic>
+<topic topicid="top3">
+<title>Drawbacks of procedural markup</title>
+<para>Industries involved in technical documentation increasingly
+prefer generic over procedural markup schemes. When a company changes
+software or hardware systems, enormous data translation tasks arise,
+often resulting in errors.</para></topic></section>
+<section shorttitle="What is SGML?">
+<title>What <emph>is</emph> SGML in the grand scheme of the universe, anyway?</title>
+<intro>
+<para>SGML defines a strict markup scheme with a syntax for defining
+document data elements and an overall framework for marking up
+documents.</para>
+<para>SGML can describe and create documents that are not dependent on
+any hardware, software, formatter, or operating system. Since SGML documents
+conform to an international standard, they are portable.</para></intro></section>
+<section shorttitle="How does SGML work?">
+<title>How is SGML and would you recommend it to your grandmother?</title>
+<intro>
+<para>You can break a typical document into three layers: structure,
+content, and style. SGML works by separating these three aspects and
+deals mainly with the relationship between structure and content.</para></intro>
+<topic topicid="top4">
+<title>Structure</title>
+<para>At the heart of an SGML application is a file called the DTD, or
+Document Type Definition. The DTD sets up the structure of a document,
+much like a database schema describes the types of information it
+handles.</para>
+<para>A database schema also defines the relationships between the
+various types of data. Similarly, a DTD specifies <emph>rules</emph>
+to help ensure documents have a consistent, logical structure.</para></topic>
+<topic topicid="top5">
+<title>Content</title>
+<para>Content is the information itself. The method for identifying
+the information and its meaning within this framework is called
+<emph>tagging</emph>. Tagging must
+conform to the rules established in the DTD (see <xref xrefid="top4"/>).</para>
+<graphic graphname="tagexamp"/></topic>
+<topic topicid="top6">
+<title>Style</title>
+<para>SGML does not standardize style or other processing methods for
+information stored in SGML.</para></topic></section></chapter>
+<chapter>
+<title>Resources</title>
+<section>
+<title>Conferences, tutorials, and training</title>
+<intro>
+<para>The Graphic Communications Association has been
+instrumental in the development of SGML. GCA provides conferences,
+tutorials, newsletters, and publication sales for both members and
+non-members.</para>
+<para security="c">Exiled members of the former Soviet Union's secret
+police, the KGB, have infiltrated the upper ranks of the GCA and are
+planning the Final Revolution as soon as DSSSL is completed.</para>
+</intro>
+</section>
+</chapter>
+</report>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/voicexml.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/voicexml.xml
new file mode 100644
index 00000000000..68116e00089
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/voicexml.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding ="utf-8"?>
+<!DOCTYPE document SYSTEM "vxml.dtd">
+<vxml/>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/vxml.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/vxml.dtd
new file mode 100644
index 00000000000..7eb8e8011ee
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/vxml.dtd
@@ -0,0 +1,474 @@
+<!-- 
+VoiceXML 2.1 DTD (20060322)
+
+Copyright 1998-2006 W3C (MIT, ERCIM, Keio), All Rights Reserved. 
+
+Permission to use, copy, modify and distribute the VoiceXML DTD and 
+its accompanying documentation for any purpose and without fee is 
+hereby granted in perpetuity, provided that the above copyright 
+notice and this paragraph appear in all copies.  
+
+The copyright holders make no representation about the suitability 
+of the DTD for any purpose. It is provided "as is" without expressed 
+or implied warranty.
+-->
+
+<!ENTITY % audio "#PCDATA | audio | enumerate | value">
+<!ENTITY % bargeintype "( speech | hotword )">
+<!ENTITY % boolean "(true|false)">
+<!ENTITY % content.type "CDATA">
+<!ENTITY % duration "CDATA">
+<!ENTITY % event.handler "catch | help | noinput | nomatch | error">
+<!ENTITY % event.name "NMTOKEN">
+<!ENTITY % event.names "NMTOKENS">
+<!ENTITY % executable.content "%audio; | assign | clear | data | disconnect | 
+    exit | foreach |goto | if | log | prompt | 
+    reprompt | return | script | submit | throw | var ">
+<!ENTITY % expression "CDATA">
+<!ENTITY % restrictedvariable.name "CDATA">
+<!ENTITY % variable.name "CDATA">
+<!ENTITY % restrictedvariable.names "CDATA">
+<!ENTITY % variable.names "CDATA">
+<!ENTITY % integer "CDATA">
+<!ENTITY % item.attrs "name     %restrictedvariable.name; #IMPLIED 
+    cond        %expression;    #IMPLIED
+    expr        %expression;    #IMPLIED ">
+<!ENTITY % uri "CDATA">
+<!ENTITY % cache.attrs "fetchhint   (prefetch|safe) #IMPLIED
+    fetchtimeout    %duration;  #IMPLIED
+    maxage      %integer;   #IMPLIED
+    maxstale    %integer;   #IMPLIED">
+<!ENTITY % next.attrs "next     %uri;       #IMPLIED
+    expr        %expression;    #IMPLIED ">
+<!ENTITY % submit.attrs "method     (get|post)  'get'
+    enctype     %content.type;  'application/x-www-form-urlencoded'
+    namelist    %variable.names;    #IMPLIED">
+<!ENTITY % throw.attrs "event       %event.name;    #IMPLIED
+    eventexpr   %expression;    #IMPLIED
+    message     CDATA       #IMPLIED
+    messageexpr %expression;    #IMPLIED">
+<!ENTITY % variable "block | data | field | var">
+<!--================================= Root ================================-->
+<!ELEMENT vxml (%event.handler; | data | form | link | menu | meta | metadata | 
+                property | script | var)+>
+<!ATTLIST vxml
+    application %uri; #IMPLIED
+    xml:base %uri; #IMPLIED
+    xml:lang NMTOKEN #IMPLIED
+    xmlns CDATA #FIXED 'http://www.w3.org/2001/vxml'
+    xmlns:xsi CDATA #IMPLIED
+    xsi:schemaLocation CDATA #IMPLIED
+    version CDATA #REQUIRED
+>
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+    name NMTOKEN #IMPLIED
+    content CDATA #REQUIRED
+    http-equiv NMTOKEN #IMPLIED
+>
+
+<!ELEMENT metadata ANY>
+
+<!--================================ Prompts ==============================-->
+<!-- definitions adapted from SSML 1.0 DTD -->
+<!ENTITY % structure "p | s">
+<!ENTITY % sentence-elements "break | emphasis | mark | phoneme | prosody | 
+                              say-as | voice | sub">
+<!-- addition of enumerate and value elements as 'allowed-within-sentence' 
+     audio elements -->
+<!ENTITY % allowed-within-sentence " %audio; | %sentence-elements; ">
+
+<!-- Prompt is modelled on SSML 1.0 DTD speak element:
+- addition of 'bargein', 'bargeintype', 'cond', 'count' and 'timeout' attributes
+- removal of xmlns, xmlns:xsi, and xsi:schemaLocation attributes
+- version attribute fixed as "1.0"
+-->
+<!ELEMENT prompt (%allowed-within-sentence; | foreach | %structure; | lexicon 
+                  | metadata | meta )*>
+<!ATTLIST prompt
+    bargein %boolean; #IMPLIED
+    bargeintype %bargeintype; #IMPLIED
+    cond %expression; #IMPLIED
+    count %integer; #IMPLIED
+    xml:lang NMTOKEN #IMPLIED
+    timeout %duration; #IMPLIED
+    xml:base %uri; #IMPLIED
+    version CDATA #FIXED "1.0"
+>
+<!ELEMENT enumerate (%allowed-within-sentence; | %structure;)*>
+<!ELEMENT reprompt EMPTY>
+
+<!--================================= Dialogs =============================-->
+<!ENTITY % input "grammar">
+<!ENTITY % scope "(document | dialog)">
+<!ELEMENT form (%input; | %event.handler; | filled | initial | object | link |
+              property | record | script | subdialog | transfer | %variable;)*>
+<!ATTLIST form
+    id ID #IMPLIED
+    scope %scope; "dialog"
+>
+<!ENTITY % accept.attrs "accept     (exact | approximate)   'exact'">
+<!ELEMENT menu (%audio; | choice | %event.handler; | prompt | property)*>
+<!ATTLIST menu
+    id ID #IMPLIED
+    scope %scope; "dialog"
+    %accept.attrs; 
+    dtmf %boolean; "false"
+>
+<!ELEMENT choice ( #PCDATA | %input; )*>
+<!ATTLIST choice
+    %cache.attrs; 
+    accept  (exact | approximate) #IMPLIED
+    dtmf CDATA #IMPLIED
+    %throw.attrs; 
+    fetchaudio %uri; #IMPLIED
+    %next.attrs; 
+>
+<!--================================ Audio Output ==============================-->
+<!-- definitions adapted from SSML 1.0 DTD -->
+<!ELEMENT p (%allowed-within-sentence; | s)*>
+<!ATTLIST p
+    xml:lang NMTOKEN #IMPLIED
+>
+<!ELEMENT s (%allowed-within-sentence;)*>
+<!ATTLIST s
+    xml:lang NMTOKEN #IMPLIED
+>
+<!ELEMENT voice (%allowed-within-sentence; | %structure;)*>
+<!ATTLIST voice
+    xml:lang NMTOKEN #IMPLIED
+    gender (male | female | neutral) #IMPLIED
+    age %integer; #IMPLIED
+    variant %integer; #IMPLIED
+    name CDATA #IMPLIED
+>
+<!ELEMENT prosody (%allowed-within-sentence; | %structure;)*>
+<!ATTLIST prosody
+    pitch CDATA #IMPLIED
+    contour CDATA #IMPLIED
+    range CDATA #IMPLIED
+    rate CDATA #IMPLIED
+    duration %duration; #IMPLIED
+    volume CDATA #IMPLIED
+>
+<!-- Changes to SSML 1.0 DTD audio element:
+- src not obligatory, addition of 'expr' and caching attributes
+-->
+<!ELEMENT audio (%allowed-within-sentence; | %structure; | desc)*>
+<!ATTLIST audio
+    src %uri; #IMPLIED
+    expr %expression; #IMPLIED
+    %cache.attrs; 
+>
+<!ELEMENT desc (#PCDATA)>
+<!ATTLIST desc
+    xml:lang NMTOKEN #IMPLIED
+>
+<!ELEMENT emphasis (%allowed-within-sentence;)*>
+<!ATTLIST emphasis
+    level (strong | moderate | none | reduced) "moderate"
+>
+<!-- Changes to SSML 1.0 DTD say-as element:
+- allows value element as child
+-->
+<!ELEMENT say-as (#PCDATA | value )*>
+<!ATTLIST say-as
+    interpret-as NMTOKEN #REQUIRED
+    format NMTOKEN #IMPLIED
+    detail NMTOKEN #IMPLIED
+>
+<!ELEMENT sub (#PCDATA)>
+<!ATTLIST sub
+    alias CDATA #REQUIRED
+>
+<!ELEMENT phoneme (#PCDATA)>
+<!ATTLIST phoneme
+    ph CDATA #REQUIRED
+    alphabet CDATA #IMPLIED
+>
+<!ELEMENT break EMPTY>
+<!ATTLIST break
+    time CDATA #IMPLIED
+    strength  (none | x-weak | weak  | medium | strong | x-strong) "medium"
+>
+<!ELEMENT mark EMPTY>
+<!ATTLIST mark
+    name ID #IMPLIED
+    nameexpr %expression; #IMPLIED
+>
+<!--================================ Fields ===============================-->
+<!ELEMENT field (%audio; | %event.handler; | filled | %input; | link | option |
+                 prompt | property)*>
+<!ATTLIST field
+    %item.attrs; 
+    type CDATA #IMPLIED
+    slot NMTOKEN #IMPLIED
+    modal %boolean; "false"
+>
+<!ELEMENT option (#PCDATA)>
+<!ATTLIST option
+    %accept.attrs; 
+    dtmf CDATA #IMPLIED
+    value CDATA #IMPLIED
+>
+<!ELEMENT var EMPTY>
+<!ATTLIST var
+    name %restrictedvariable.name; #REQUIRED
+    expr %expression; #IMPLIED
+>
+<!ELEMENT initial (%audio; | %event.handler; | link | prompt | property)*>
+<!ATTLIST initial
+    %item.attrs; 
+>
+<!ELEMENT block (%executable.content;)*>
+<!ATTLIST block
+    %item.attrs; 
+>
+<!ELEMENT assign EMPTY>
+<!ATTLIST assign
+    name %variable.name; #REQUIRED
+    expr %expression; #REQUIRED
+>
+<!ELEMENT clear EMPTY>
+<!ATTLIST clear
+    namelist %variable.names; #IMPLIED
+>
+<!ELEMENT value EMPTY>
+<!ATTLIST value
+    expr %expression; #REQUIRED
+>
+<!--================================== Events =============================-->
+<!ENTITY % event.handler.attrs "count       %integer;   #IMPLIED
+    cond        %expression;    #IMPLIED">
+<!ELEMENT catch (%executable.content;)*>
+<!ATTLIST catch
+    event %event.names; #IMPLIED
+    %event.handler.attrs; 
+>
+<!ELEMENT error (%executable.content;)*>
+<!ATTLIST error
+    %event.handler.attrs; 
+>
+<!ELEMENT help (%executable.content;)*>
+<!ATTLIST help
+    %event.handler.attrs; 
+>
+<!ELEMENT link (%input;)*>
+<!ATTLIST link
+    %cache.attrs; 
+    %next.attrs; 
+    fetchaudio %uri; #IMPLIED
+    dtmf CDATA #IMPLIED
+    %throw.attrs; 
+>
+<!ELEMENT noinput (%executable.content;)*>
+<!ATTLIST noinput
+    %event.handler.attrs; 
+>
+<!ELEMENT nomatch (%executable.content;)*>
+<!ATTLIST nomatch
+    %event.handler.attrs; 
+>
+<!ELEMENT throw EMPTY>
+<!ATTLIST throw
+    %throw.attrs; 
+>
+<!--============================= Grammar Input =============================-->
+<!-- definitions adapted from SRGS 1.0 DTD -->
+<!ENTITY % rule-expansion "#PCDATA | token | ruleref
+                              | item | one-of | tag ">
+<!ELEMENT ruleref EMPTY>
+<!ATTLIST ruleref
+    uri %uri; #IMPLIED
+    type CDATA #IMPLIED
+    special (NULL | VOID | GARBAGE) #IMPLIED
+>
+<!ELEMENT token (#PCDATA)>
+<!ATTLIST token
+    xml:lang NMTOKEN #IMPLIED
+>
+<!ELEMENT tag (#PCDATA)>
+<!ELEMENT one-of (item)+>
+<!ATTLIST one-of
+    xml:lang NMTOKEN #IMPLIED
+>
+<!ELEMENT item (%rule-expansion;)*>
+<!ATTLIST item
+    repeat NMTOKEN #IMPLIED
+    repeat-prob NMTOKEN #IMPLIED
+    weight NMTOKEN #IMPLIED
+    xml:lang NMTOKEN #IMPLIED
+>
+<!ELEMENT rule (%rule-expansion; | example)*>
+<!ATTLIST rule
+    id ID #REQUIRED
+    scope (private | public) "private"
+>
+<!ELEMENT example (#PCDATA)>
+<!ELEMENT lexicon EMPTY>
+<!ATTLIST lexicon
+    uri %uri; #REQUIRED
+    type CDATA #IMPLIED
+>
+<!-- Changes to SRGS 1.0 DTD grammar element:
+- mixed, unordered content model 
+- addition of 'scope', 'src', 'type', 'weight' and caching attributes
+- 'version' attribute is optional
+- removal of xmlns, xmlns:xsi, and xsi:schemaLocation attributes
+-->
+<!ELEMENT grammar (#PCDATA | meta | metadata | lexicon | rule | tag)*>
+<!ATTLIST grammar
+    scope %scope; #IMPLIED
+    src %uri; #IMPLIED
+    srcexpr %expression; #IMPLIED
+    type CDATA #IMPLIED
+    weight CDATA #IMPLIED
+    %cache.attrs; 
+    tag-format %uri; #IMPLIED
+    xml:base %uri; #IMPLIED
+    version NMTOKEN #IMPLIED
+    xml:lang NMTOKEN #IMPLIED
+    root IDREF #IMPLIED
+    mode (voice | dtmf) "voice"
+>
+<!--============================= Audio Input =============================-->
+<!ELEMENT record (%audio; | %event.handler; | filled | %input; | prompt | 
+                  property)*>
+<!ATTLIST record
+    %item.attrs; 
+    type CDATA #IMPLIED
+    beep %boolean; "false"
+    maxtime %duration; #IMPLIED
+    modal %boolean; "true"
+    finalsilence %duration; #IMPLIED
+    dtmfterm %boolean; "true"
+>
+<!--============================ Call Control ============================-->
+<!ELEMENT disconnect EMPTY>
+<!ATTLIST disconnect
+    namelist %variable.names; #IMPLIED
+>
+
+<!ELEMENT transfer (%audio; | %event.handler; | filled | %input; | prompt | 
+                    property)*>
+<!ATTLIST transfer
+    %item.attrs; 
+    dest %uri; #IMPLIED
+    destexpr %expression; #IMPLIED
+    bridge %boolean; #IMPLIED
+    type NMTOKEN #IMPLIED
+    connecttimeout %duration; #IMPLIED
+    maxtime %duration; #IMPLIED
+    transferaudio %uri; #IMPLIED
+    aai CDATA #IMPLIED
+    aaiexpr %expression; #IMPLIED
+>
+<!--============================ Control Flow ============================-->
+<!ENTITY % if.attrs "cond       %expression;    #REQUIRED">
+<!ELEMENT if (%executable.content; | elseif | else)*>
+<!ATTLIST if
+    %if.attrs; 
+>
+<!ELEMENT elseif EMPTY>
+<!ATTLIST elseif
+    %if.attrs; 
+>
+<!ELEMENT else EMPTY>
+<!ELEMENT exit EMPTY>
+<!ATTLIST exit
+    expr %expression; #IMPLIED
+    namelist %variable.names; #IMPLIED
+>
+<!ELEMENT filled (%executable.content;)*>
+<!ATTLIST filled
+    mode (any | all) #IMPLIED
+    namelist %restrictedvariable.names; #IMPLIED
+>
+
+<!-- executable content + contents of prompt  -->
+<!ELEMENT foreach (%executable.content; | %sentence-elements; | 
+    %structure; )*
+>
+<!ATTLIST foreach
+    item %restrictedvariable.name; #REQUIRED
+    array CDATA #REQUIRED
+>
+
+<!ELEMENT goto EMPTY>
+<!ATTLIST goto
+    %cache.attrs; 
+    %next.attrs; 
+    fetchaudio %uri; #IMPLIED
+    expritem %expression; #IMPLIED
+    nextitem %restrictedvariable.name; #IMPLIED
+>
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+    name NMTOKEN #REQUIRED
+    expr %expression; #IMPLIED
+    value CDATA #IMPLIED
+    valuetype (data | ref) "data"
+    type CDATA #IMPLIED
+>
+<!ELEMENT return EMPTY>
+<!ATTLIST return
+    namelist %variable.names; #IMPLIED
+    %throw.attrs; 
+>
+<!ELEMENT subdialog (%audio; | %event.handler; | filled | param | prompt | 
+                     property)*>
+<!ATTLIST subdialog
+    %item.attrs; 
+    src %uri; #IMPLIED
+    srcexpr %expression; #IMPLIED
+    %cache.attrs; 
+    fetchaudio %uri; #IMPLIED
+    %submit.attrs; 
+>
+<!ELEMENT submit EMPTY>
+<!ATTLIST submit
+    %cache.attrs; 
+    %next.attrs; 
+    fetchaudio %uri; #IMPLIED
+    %submit.attrs; 
+>
+<!--========================== Miscellaneous ==============================-->
+<!ELEMENT data EMPTY>
+<!ATTLIST data
+    name %restrictedvariable.name; #IMPLIED
+    src %uri; #IMPLIED
+    srcexpr %expression; #IMPLIED 
+    fetchaudio  %uri;       #IMPLIED
+    %submit.attrs;
+    %cache.attrs;
+>
+
+<!ELEMENT log (#PCDATA | value)*>
+<!ATTLIST log
+    label CDATA #IMPLIED
+    expr %expression; #IMPLIED
+>
+<!ELEMENT object (%audio; | %event.handler; | filled | param | prompt | 
+                  property)*>
+<!ATTLIST object
+    %item.attrs; 
+    %cache.attrs; 
+    classid %uri; #IMPLIED
+    codebase %uri; #IMPLIED
+    data %uri; #IMPLIED
+    type CDATA #IMPLIED
+    codetype CDATA #IMPLIED
+    archive %uri; #IMPLIED
+>
+<!ELEMENT property EMPTY>
+<!ATTLIST property
+    name NMTOKEN #REQUIRED
+    value CDATA #REQUIRED
+>
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+    src %uri; #IMPLIED
+    srcexpr %expression; #IMPLIED
+    charset CDATA #IMPLIED
+    %cache.attrs; 
+>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/xml11.xml.data b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/xml11.xml.data
new file mode 100644
index 00000000000..16069b9dc1f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamReaderTest/xml11.xml.data
@@ -0,0 +1,23 @@
+<?xml version="1.1" encoding="UTF-8" ?>
+<!DOCTYPE root [
+<!ELEMENT root ANY>
+<!-- This test case covers legal character ranges plus
+     discrete legal characters for production 02 of the 
+     XML1.1 specification. -->
+<?NAME_09-	_0A-
+_0D-
+_20- _D7FF-퟿_6c0f-氏_E000-_FFFD-�_effe-_010000-𐀀_10FFFF-􏿿_08ffff-򏿿 This is a PI target ?>
+]>
+<root>
+x9 : 	
+xA : 
+
+xD : 
+x20 to x7E :   ! " # $ % ' ( ) * + , - . / 0 1 2 3 4 5 6 7 8 9 : ; = > ? @ A B C D E F G H I J K L M N O P Q R S T U V W X Y Z [ \ ] ^ _ ` a b c d e f g h i j k l m n o p q r s t u v w x y z { | } ~ 
+x85 : …
+x2028 : 

+xA0-xD7FF :   ŀ ʀ Ԁ ਀ ᐀ ⠀ 倀 ꀀ 
+xE000-xFFFD : � 
+x10000-x10FFFF : က0က1ခ1ကFဂ7ဏ1၂1Ⴋ1ἀ1ᓰ5᫰5ᬀ0᳿7ᷲ9ỿ1ဏA0ဏ08ဏABဟ08ီCD၊AAၖ78ႫCDჿ05ჿFAჿFF 
+</root>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/AttributeEscapeTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/AttributeEscapeTest.java
new file mode 100644
index 00000000000..0cd9466dbf3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/AttributeEscapeTest.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test XMLStreamWriter shall escape the illegal characters.
+ */
+public class AttributeEscapeTest {
+
+    /**
+     * XML content for testing the escaping of <, >, &, ', ".
+     */
+    private static final String XML_CONTENT = "Testing escaping: lt=<, gt=>, amp=&, apos=', dquote=\"";
+
+    @Test
+    public void testCR6420953() {
+
+        try {
+            XMLOutputFactory xof = XMLOutputFactory.newInstance();
+            StringWriter sw = new StringWriter();
+            XMLStreamWriter w = xof.createXMLStreamWriter(sw);
+
+            w.writeStartDocument();
+            w.writeStartElement("element");
+
+            w.writeDefaultNamespace(XML_CONTENT);
+            w.writeNamespace("prefix", XML_CONTENT);
+
+            w.writeAttribute("attribute", XML_CONTENT);
+            w.writeAttribute(XML_CONTENT, "attribute2", XML_CONTENT);
+            w.writeAttribute("prefix", XML_CONTENT, "attribute3", XML_CONTENT);
+
+            w.writeCharacters("\n");
+            w.writeCharacters(XML_CONTENT);
+            w.writeCharacters("\n");
+            w.writeCharacters(XML_CONTENT.toCharArray(), 0, XML_CONTENT.length());
+            w.writeCharacters("\n");
+
+            w.writeEndElement();
+            w.writeEndDocument();
+            w.flush();
+
+            System.out.println(sw);
+
+            // make sure that the generated XML parses
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            dbf.newDocumentBuilder().parse(new InputSource(new StringReader(sw.toString())));
+        } catch (XMLStreamException xmlStreamException) {
+            xmlStreamException.printStackTrace();
+            Assert.fail(xmlStreamException.toString());
+        } catch (SAXException saxException) {
+            saxException.printStackTrace();
+            Assert.fail(saxException.toString());
+        } catch (ParserConfigurationException parserConfigurationException) {
+            parserConfigurationException.printStackTrace();
+            Assert.fail(parserConfigurationException.toString());
+        } catch (IOException ioException) {
+            ioException.printStackTrace();
+            Assert.fail(ioException.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6452107.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6452107.java
new file mode 100644
index 00000000000..2d45aa2f603
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6452107.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.OutputStream;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6452107
+ * @summary Test StAX can write ISO-8859-1 encoding XML.
+ */
+public class Bug6452107 {
+
+    /**
+     * Ensure that charset aliases are checked. The encoding ISO-8859-1 is
+     * returned as ISO8859_1 by the underlying writer. Thus, if alias are not
+     * inspected, this test throws an exception.
+     */
+    @Test
+    public void test() {
+        final String ENCODING = "ISO-8859-1";
+
+        try {
+            OutputStream out = new ByteArrayOutputStream();
+            XMLOutputFactory factory = XMLOutputFactory.newInstance();
+            XMLStreamWriter writer = factory.createXMLStreamWriter(out, ENCODING);
+            writer.writeStartDocument(ENCODING, "1.0");
+        } catch (XMLStreamException e) {
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6600882Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6600882Test.java
new file mode 100644
index 00000000000..3b22705100a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6600882Test.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6600882
+ * @summary Test toString(), hashCode() of XMLStreamWriter .
+ */
+public class Bug6600882Test {
+
+
+    @Test
+    public void test() {
+        try {
+            XMLOutputFactory of = XMLOutputFactory.newInstance();
+            XMLStreamWriter w = of.createXMLStreamWriter(new ByteArrayOutputStream());
+            XMLStreamWriter w1 = of.createXMLStreamWriter(new ByteArrayOutputStream());
+            System.out.println(w);
+            Assert.assertTrue(w.equals(w) && w.hashCode() == w.hashCode());
+            Assert.assertFalse(w1.equals(w));
+        } catch (Throwable ex) {
+            Assert.fail(ex.toString());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6675332Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6675332Test.java
new file mode 100644
index 00000000000..a22580670a0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug6675332Test.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import util.BaseStAXUT;
+
+/*
+ * @bug 6675332
+ * @summary Test XMLStreamWriter writeAttribute when IS_REPAIRING_NAMESPACES is true.
+ */
+public class Bug6675332Test extends BaseStAXUT {
+
+    private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance();
+
+    @Test
+    public void test() {
+        final String URL_P1 = "http://p1.org";
+        final String URL_DEF = "urn:default";
+        final String ATTR_VALUE = "'value\"";
+        final String ATTR_VALUE2 = "<tag>";
+
+        final String TEXT = "  some text\n";
+        XML_OUTPUT_FACTORY.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root></root>";
+        XMLStreamWriter w = null;
+        StringWriter strw = new StringWriter();
+        try {
+            w = XML_OUTPUT_FACTORY.createXMLStreamWriter(strw);
+
+            w.writeStartDocument();
+
+            /*
+             * Calling this method should be optional; but if we call it,
+             * exceptation is that it does properly bind the prefix and URL as
+             * the 'preferred' combination. In this case we'll just try to make
+             * URL bound as the default namespace
+             */
+            w.setDefaultNamespace(URL_DEF);
+            w.writeStartElement(URL_DEF, "test"); // root
+
+            /*
+             * And let's further make element and attribute(s) belong to that
+             * same namespace
+             */
+            w.writeStartElement("", "leaf", URL_DEF); // 1st leaf
+            w.writeAttribute("", URL_DEF, "attr", ATTR_VALUE);
+            w.writeAttribute(URL_DEF, "attr2", ATTR_VALUE);
+            w.writeEndElement();
+
+            // w.writeEmptyElement("", "leaf"); // 2nd leaf; in empty/no
+            // namespace!
+
+            w.writeStartElement(URL_DEF, "leaf"); // 3rd leaf
+            // w.writeAttribute("", "attr2", ATTR_VALUE2); // in empty/no
+            // namespace
+            w.writeEndElement();
+
+            w.writeEndElement(); // root elem
+            w.writeEndDocument();
+            w.close();
+            System.out.println("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\\n");
+            System.out.println(strw.toString());
+
+            // And then let's parse and verify it all:
+            // System.err.println("testAttributes: doc = '"+strw+"'");
+
+            XMLStreamReader sr = constructNsStreamReader(strw.toString());
+            assertTokenType(START_DOCUMENT, sr.getEventType(), sr);
+
+            // root element
+            assertTokenType(START_ELEMENT, sr.next(), sr);
+            Assert.assertEquals("test", sr.getLocalName());
+            Assert.assertEquals(URL_DEF, sr.getNamespaceURI());
+
+            // first leaf:
+            assertTokenType(START_ELEMENT, sr.next(), sr);
+            Assert.assertEquals("leaf", sr.getLocalName());
+            Assert.assertEquals(URL_DEF, sr.getNamespaceURI());
+            System.out.println(sr.getAttributeLocalName(0));
+            System.out.println(sr.getAttributeLocalName(1));
+            Assert.assertEquals(2, sr.getAttributeCount());
+            Assert.assertEquals("attr", sr.getAttributeLocalName(0));
+
+            String uri = sr.getAttributeNamespace(0);
+            if (!URL_DEF.equals(uri)) {
+                Assert.fail("Expected attribute 'attr' to have NS '" + URL_DEF + "', was " + valueDesc(uri) + "; input = '" + strw + "'");
+            }
+            Assert.assertEquals(ATTR_VALUE, sr.getAttributeValue(0));
+            assertTokenType(END_ELEMENT, sr.next(), sr);
+            Assert.assertEquals("leaf", sr.getLocalName());
+            Assert.assertEquals(URL_DEF, sr.getNamespaceURI());
+
+            // 2nd/empty leaf
+            /**
+             * assertTokenType(START_ELEMENT, sr.next(), sr);
+             * assertEquals("leaf", sr.getLocalName()); assertNoNsURI(sr);
+             * assertTokenType(END_ELEMENT, sr.next(), sr); assertEquals("leaf",
+             * sr.getLocalName()); assertNoNsURI(sr);
+             */
+            // third leaf
+            assertTokenType(START_ELEMENT, sr.next(), sr);
+            Assert.assertEquals("leaf", sr.getLocalName());
+            Assert.assertEquals(URL_DEF, sr.getNamespaceURI());
+
+            /*
+             * attr in 3rd leaf, in empty/no namespace assertEquals(1,
+             * sr.getAttributeCount()); assertEquals("attr2",
+             * sr.getAttributeLocalName(0));
+             * assertNoAttrNamespace(sr.getAttributeNamespace(0));
+             * assertEquals(ATTR_VALUE2, sr.getAttributeValue(0));
+             */
+            assertTokenType(END_ELEMENT, sr.next(), sr);
+            Assert.assertEquals("leaf", sr.getLocalName());
+            Assert.assertEquals(URL_DEF, sr.getNamespaceURI());
+
+            // closing root element
+            assertTokenType(END_ELEMENT, sr.next(), sr);
+            Assert.assertEquals("test", sr.getLocalName());
+            Assert.assertEquals(URL_DEF, sr.getNamespaceURI());
+
+            assertTokenType(END_DOCUMENT, sr.next(), sr);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug7037352Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug7037352Test.java
new file mode 100644
index 00000000000..a15b7a6142f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/Bug7037352Test.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 7037352
+ * @summary Test XMLStreamWriter.getNamespaceContext().getPrefix with XML_NS_URI and XMLNS_ATTRIBUTE_NS_URI.
+ */
+public class Bug7037352Test {
+
+    @Test
+    public void test() {
+        try {
+            XMLOutputFactory xof = XMLOutputFactory.newInstance();
+            StreamResult sr = new StreamResult();
+            XMLStreamWriter xsw = xof.createXMLStreamWriter(sr);
+            NamespaceContext nc = xsw.getNamespaceContext();
+            System.out.println(nc.getPrefix(XMLConstants.XML_NS_URI));
+            System.out.println("  expected result: " + XMLConstants.XML_NS_PREFIX);
+            System.out.println(nc.getPrefix(XMLConstants.XMLNS_ATTRIBUTE_NS_URI));
+            System.out.println("  expected result: " + XMLConstants.XMLNS_ATTRIBUTE);
+
+            Assert.assertTrue(nc.getPrefix(XMLConstants.XML_NS_URI) == XMLConstants.XML_NS_PREFIX);
+            Assert.assertTrue(nc.getPrefix(XMLConstants.XMLNS_ATTRIBUTE_NS_URI) == XMLConstants.XMLNS_ATTRIBUTE);
+
+        } catch (Throwable ex) {
+            Assert.fail(ex.toString());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/DOMUtil.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/DOMUtil.java
new file mode 100644
index 00000000000..674e00dc193
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/DOMUtil.java
@@ -0,0 +1,223 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+public class DOMUtil {
+
+    private static DocumentBuilder db;
+
+    private static String fixNull(String s) {
+        if (s == null)
+            return "";
+        else
+            return s;
+    }
+
+    /**
+     * Creates a new DOM document.
+     */
+    public static Document createDom() {
+        synchronized (DOMUtil.class) {
+            if (db == null) {
+                try {
+                    DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+                    dbf.setNamespaceAware(true);
+                    db = dbf.newDocumentBuilder();
+                } catch (ParserConfigurationException e) {
+                    throw new FactoryConfigurationError(e);
+                }
+            }
+            return db.newDocument();
+        }
+    }
+
+    public static Node createDOMNode(InputStream inputStream) {
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setValidating(false);
+        try {
+            DocumentBuilder builder = dbf.newDocumentBuilder();
+            try {
+                return builder.parse(inputStream);
+            } catch (SAXException e) {
+                e.printStackTrace(); // To change body of catch statement use
+                                     // File | Settings | File Templates.
+            } catch (IOException e) {
+                e.printStackTrace(); // To change body of catch statement use
+                                     // File | Settings | File Templates.
+            }
+        } catch (ParserConfigurationException pce) {
+            IllegalArgumentException iae = new IllegalArgumentException(pce.getMessage());
+            iae.initCause(pce);
+            throw iae;
+        }
+        return null;
+    }
+
+    public static void serializeNode(Element node, XMLStreamWriter writer) throws XMLStreamException {
+        String nodePrefix = fixNull(node.getPrefix());
+        String nodeNS = fixNull(node.getNamespaceURI());
+
+        // See if nodePrefix:nodeNS is declared in writer's NamespaceContext
+        // before writing start element
+        // Writing start element puts nodeNS in NamespaceContext even though
+        // namespace declaration not written
+        boolean prefixDecl = isPrefixDeclared(writer, nodeNS, nodePrefix);
+
+        writer.writeStartElement(nodePrefix, node.getLocalName(), nodeNS);
+
+        if (node.hasAttributes()) {
+            NamedNodeMap attrs = node.getAttributes();
+            int numOfAttributes = attrs.getLength();
+            // write namespace declarations first.
+            // if we interleave this with attribue writing,
+            // Zephyr will try to fix it and we end up getting inconsistent
+            // namespace bindings.
+            for (int i = 0; i < numOfAttributes; i++) {
+                Node attr = attrs.item(i);
+                String nsUri = fixNull(attr.getNamespaceURI());
+                if (nsUri.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) {
+                    // handle default ns declarations
+                    String local = attr.getLocalName().equals(XMLConstants.XMLNS_ATTRIBUTE) ? "" : attr.getLocalName();
+                    if (local.equals(nodePrefix) && attr.getNodeValue().equals(nodeNS)) {
+                        prefixDecl = true;
+                    }
+                    // this is a namespace declaration, not an attribute
+                    writer.setPrefix(attr.getLocalName(), attr.getNodeValue());
+                    writer.writeNamespace(attr.getLocalName(), attr.getNodeValue());
+                }
+            }
+        }
+        // node's namespace is not declared as attribute, but declared on
+        // ancestor
+        if (!prefixDecl) {
+            writer.writeNamespace(nodePrefix, nodeNS);
+        }
+
+        // Write all other attributes which are not namespace decl.
+        if (node.hasAttributes()) {
+            NamedNodeMap attrs = node.getAttributes();
+            int numOfAttributes = attrs.getLength();
+
+            for (int i = 0; i < numOfAttributes; i++) {
+                Node attr = attrs.item(i);
+                String attrPrefix = fixNull(attr.getPrefix());
+                String attrNS = fixNull(attr.getNamespaceURI());
+                if (!attrNS.equals(XMLConstants.XMLNS_ATTRIBUTE_NS_URI)) {
+                    String localName = attr.getLocalName();
+                    if (localName == null) {
+                        // TODO: this is really a bug in the caller for not
+                        // creating proper DOM tree.
+                        // will remove this workaround after plugfest
+                        localName = attr.getNodeName();
+                    }
+                    boolean attrPrefixDecl = isPrefixDeclared(writer, attrNS, attrPrefix);
+                    if (!attrPrefix.equals("") && !attrPrefixDecl) {
+                        // attr has namespace but namespace decl is there in
+                        // ancestor node
+                        // So write the namespace decl before writing the attr
+                        writer.setPrefix(attr.getLocalName(), attr.getNodeValue());
+                        writer.writeNamespace(attrPrefix, attrNS);
+                    }
+                    writer.writeAttribute(attrPrefix, attrNS, localName, attr.getNodeValue());
+                }
+            }
+        }
+
+        if (node.hasChildNodes()) {
+            NodeList children = node.getChildNodes();
+            for (int i = 0; i < children.getLength(); i++) {
+                Node child = children.item(i);
+                switch (child.getNodeType()) {
+                    case Node.PROCESSING_INSTRUCTION_NODE:
+                        writer.writeProcessingInstruction(child.getNodeValue());
+                    case Node.DOCUMENT_TYPE_NODE:
+                        break;
+                    case Node.CDATA_SECTION_NODE:
+                        writer.writeCData(child.getNodeValue());
+                        break;
+                    case Node.COMMENT_NODE:
+                        writer.writeComment(child.getNodeValue());
+                        break;
+                    case Node.TEXT_NODE:
+                        writer.writeCharacters(child.getNodeValue());
+                        break;
+                    case Node.ELEMENT_NODE:
+                        serializeNode((Element) child, writer);
+                        break;
+                }
+            }
+        }
+        writer.writeEndElement();
+    }
+
+    private static boolean isPrefixDeclared(XMLStreamWriter writer, String nsUri, String prefix) {
+        boolean prefixDecl = false;
+        NamespaceContext nscontext = writer.getNamespaceContext();
+        Iterator prefixItr = nscontext.getPrefixes(nsUri);
+        while (prefixItr.hasNext()) {
+            if (prefix.equals(prefixItr.next())) {
+                prefixDecl = true;
+                break;
+            }
+        }
+        return prefixDecl;
+    }
+
+    /**
+     * Gets the first child of the given name, or null.
+     */
+    public static Element getFirstChild(Element e, String nsUri, String local) {
+        for (Node n = e.getFirstChild(); n != null; n = n.getNextSibling()) {
+            if (n.getNodeType() == Node.ELEMENT_NODE) {
+                Element c = (Element) n;
+                if (c.getLocalName().equals(local) && c.getNamespaceURI().equals(nsUri))
+                    return c;
+            }
+        }
+        return null;
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/DomUtilTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/DomUtilTest.java
new file mode 100644
index 00000000000..76d5c981bd3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/DomUtilTest.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test XMLStreamWriter writes a soap message.
+ */
+public class DomUtilTest {
+
+    private XMLOutputFactory staxOut;
+    final File folder = new File(System.getProperty("tempdir") + "/classes/soapmessages");
+    private static final String INPUT_FILE1 = "message_12.xml";
+
+    public void setup() {
+        this.staxOut = XMLOutputFactory.newInstance();
+        staxOut.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, true);
+    }
+
+    @Test
+    public void testSOAPEnvelope1() throws Exception {
+        setup();
+
+        File f = new File(this.getClass().getResource(INPUT_FILE1).getFile());
+        System.out.println("***********" + f.getName() + "***********");
+        DOMSource src = makeDomSource(f);
+        Node node = src.getNode();
+        XMLStreamWriter writer = staxOut.createXMLStreamWriter(new PrintStream(System.out));
+        DOMUtil.serializeNode((Element) node.getFirstChild(), writer);
+        writer.close();
+        assert (true);
+        System.out.println("*****************************************");
+
+    }
+
+    public static DOMSource makeDomSource(File f) throws Exception {
+        InputStream is = new FileInputStream(f);
+        DOMSource domSource = new DOMSource(createDOMNode(is));
+        return domSource;
+    }
+
+    public static void printNode(Node node) {
+        DOMSource source = new DOMSource(node);
+        String msgString = null;
+        try {
+            Transformer xFormer = TransformerFactory.newInstance().newTransformer();
+            xFormer.setOutputProperty("omit-xml-declaration", "yes");
+            ByteArrayOutputStream outStream = new ByteArrayOutputStream();
+            Result result = new StreamResult(outStream);
+            xFormer.transform(source, result);
+            outStream.writeTo(System.out);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+    }
+
+    public static Node createDOMNode(InputStream inputStream) {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setValidating(false);
+        try {
+            DocumentBuilder builder = dbf.newDocumentBuilder();
+            try {
+                return builder.parse(inputStream);
+            } catch (SAXException e) {
+                e.printStackTrace();
+            } catch (IOException e) {
+                e.printStackTrace();
+            }
+        } catch (ParserConfigurationException pce) {
+            IllegalArgumentException iae = new IllegalArgumentException(pce.getMessage());
+            iae.initCause(pce);
+            throw iae;
+        }
+        return null;
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/EmptyElementTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/EmptyElementTest.java
new file mode 100644
index 00000000000..475c3edb323
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/EmptyElementTest.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamWriter writes namespace and attribute after writeEmptyElement.
+ */
+public class EmptyElementTest {
+
+    // expected output
+    private static final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<hello xmlns=\"http://hello\">"
+            + "<world xmlns=\"http://world\" prefixes=\"foo bar\"/>" + "</hello>";
+
+    XMLStreamWriter xmlStreamWriter;
+    ByteArrayOutputStream byteArrayOutputStream;
+    XMLOutputFactory xmlOutputFactory;
+
+    @Test
+    public void testWriterOnLinux() throws Exception {
+
+        // setup XMLStreamWriter
+        try {
+            byteArrayOutputStream = new ByteArrayOutputStream();
+            xmlOutputFactory = XMLOutputFactory.newInstance();
+            xmlOutputFactory.setProperty(xmlOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+            xmlStreamWriter = xmlOutputFactory.createXMLStreamWriter(byteArrayOutputStream);
+        } catch (Exception e) {
+            System.err.println("Unexpected Exception: " + e.toString());
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+
+        // create & write a document
+        try {
+            xmlStreamWriter.writeStartDocument();
+            xmlStreamWriter.writeStartElement("hello");
+            xmlStreamWriter.writeDefaultNamespace("http://hello");
+            xmlStreamWriter.writeEmptyElement("world");
+            xmlStreamWriter.writeDefaultNamespace("http://world");
+            xmlStreamWriter.writeAttribute("prefixes", "foo bar");
+            xmlStreamWriter.writeEndElement();
+            xmlStreamWriter.writeEndDocument();
+            xmlStreamWriter.flush();
+            String actualOutput = byteArrayOutputStream.toString();
+            Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+        } catch (Exception e) {
+            System.err.println("Unexpected Exception: " + e.toString());
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/EncodingTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/EncodingTest.java
new file mode 100644
index 00000000000..d79a2331374
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/EncodingTest.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamWriter writes a document with encoding setting.
+ */
+public class EncodingTest {
+
+    private static final XMLOutputFactory XML_OUTPUT_FACTORY = XMLOutputFactory.newInstance();
+
+    /*
+     * Tests writing a document with UTF-8 encoding, by setting UTF-8 on writer.
+     */
+    @Test
+    public void testWriteStartDocumentUTF8() {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><root></root>";
+        XMLStreamWriter writer = null;
+        ByteArrayOutputStream byteArrayOutputStream = null;
+
+        try {
+            byteArrayOutputStream = new ByteArrayOutputStream();
+            writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(byteArrayOutputStream, "UTF-8");
+
+            writer.writeStartDocument("UTF-8", "1.0");
+            writer.writeStartElement("root");
+            writer.writeEndElement();
+            writer.writeEndDocument();
+            writer.flush();
+
+            String actualOutput = byteArrayOutputStream.toString();
+            Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+
+    }
+
+    /*
+     * Tests writing a document with UTF-8 encoding on default enocding writer.
+     * This scenario should result in an exception as default encoding is ASCII.
+     */
+    @Test
+    public void testWriteStartDocumentUTF8Fail() {
+
+        XMLStreamWriter writer = null;
+        ByteArrayOutputStream byteArrayOutputStream = null;
+
+        // pick a different encoding to use v. default encoding
+        String defaultCharset = java.nio.charset.Charset.defaultCharset().name();
+        String useCharset = "UTF-8";
+        if (useCharset.equals(defaultCharset)) {
+            useCharset = "US-ASCII";
+        }
+
+        System.out.println("defaultCharset = " + defaultCharset + ", useCharset = " + useCharset);
+
+        try {
+            byteArrayOutputStream = new ByteArrayOutputStream();
+            writer = XML_OUTPUT_FACTORY.createXMLStreamWriter(byteArrayOutputStream);
+
+            writer.writeStartDocument(useCharset, "1.0");
+            writer.writeStartElement("root");
+            writer.writeEndElement();
+            writer.writeEndDocument();
+            writer.flush();
+
+            Assert.fail("Expected XMLStreamException as default underlying stream encoding of " + defaultCharset
+                    + " differs from explicitly specified encoding of " + useCharset);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NamespaceTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NamespaceTest.java
new file mode 100644
index 00000000000..25fd9d0fa0b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NamespaceTest.java
@@ -0,0 +1,1439 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.sun.xml.internal.stream.writers.XMLStreamWriterImpl;
+
+/*
+ * @summary Test the writing of Namespaces.
+ */
+public class NamespaceTest {
+
+    /** debug output? */
+    private static final boolean DEBUG = true;
+
+    /** Factory to reuse. */
+    XMLOutputFactory xmlOutputFactory = null;
+
+    /** Writer to reuse. */
+    XMLStreamWriter xmlStreamWriter = null;
+
+    /** OutputStream to reuse. */
+    ByteArrayOutputStream byteArrayOutputStream = null;
+
+    @BeforeMethod
+    public void setUp() {
+
+        // want a Factory that repairs Namespaces
+        xmlOutputFactory = XMLOutputFactory.newInstance();
+        xmlOutputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+
+        // new OutputStream
+        byteArrayOutputStream = new ByteArrayOutputStream();
+
+        // new Writer
+        try {
+            xmlStreamWriter = xmlOutputFactory.createXMLStreamWriter(byteArrayOutputStream, "utf-8");
+
+        } catch (XMLStreamException xmlStreamException) {
+            Assert.fail(xmlStreamException.toString());
+        }
+    }
+
+    /**
+     * Reset Writer for reuse.
+     */
+    private void resetWriter() {
+        // reset the Writer
+        try {
+            xmlStreamWriter.flush();
+            xmlStreamWriter.close();
+            ((XMLStreamWriterImpl) xmlStreamWriter).reset();
+            byteArrayOutputStream.reset();
+            ((XMLStreamWriterImpl) xmlStreamWriter).setOutput(new StreamResult(byteArrayOutputStream), "utf-8");
+        } catch (XMLStreamException xmlStreamException) {
+            Assert.fail(xmlStreamException.toString());
+        } catch (IOException ioException) {
+            Assert.fail(ioException.toString());
+        }
+    }
+
+    @Test
+    public void testDoubleXmlNs() {
+        try {
+
+            xmlStreamWriter.writeStartDocument();
+            xmlStreamWriter.writeStartElement("foo");
+            xmlStreamWriter.writeNamespace("xml", XMLConstants.XML_NS_URI);
+            xmlStreamWriter.writeAttribute("xml", XMLConstants.XML_NS_URI, "lang", "ja_JP");
+            xmlStreamWriter.writeCharacters("Hello");
+            xmlStreamWriter.writeEndElement();
+            xmlStreamWriter.writeEndDocument();
+
+            xmlStreamWriter.flush();
+            String actualOutput = byteArrayOutputStream.toString();
+
+            if (DEBUG) {
+                System.out.println("testDoubleXmlNs(): actualOutput: " + actualOutput);
+            }
+
+            // there should be no xmlns:xml
+            Assert.assertTrue(actualOutput.split("xmlns:xml").length == 1, "Expected 0 xmlns:xml, actual output: " + actualOutput);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testDuplicateNamespaceURI() throws Exception {
+
+        xmlStreamWriter.writeStartDocument();
+        xmlStreamWriter.writeStartElement(new String(""), "localName", new String("nsUri"));
+        xmlStreamWriter.writeNamespace(new String(""), new String("nsUri"));
+        xmlStreamWriter.writeEndElement();
+        xmlStreamWriter.writeEndDocument();
+
+        xmlStreamWriter.flush();
+        String actualOutput = byteArrayOutputStream.toString();
+
+        if (DEBUG) {
+            System.out.println("testDuplicateNamespaceURI(): actualOutput: " + actualOutput);
+        }
+
+        // there must be only 1 xmlns=...
+        Assert.assertTrue(actualOutput.split("xmlns").length == 2, "Expected 1 xmlns=, actual output: " + actualOutput);
+    }
+
+    // TODO: test with both "" & null
+    // NDW: There's no distinction in XML between a "null" namespace URI and one
+    // with a URI of "" (the empty string) so I haven't tried to call out any
+    // such distinctions.
+
+    // ---------------- Current default namespace is "" ----------------
+
+    private void startDocumentEmptyDefaultNamespace(XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
+
+        xmlStreamWriter.writeStartDocument();
+        xmlStreamWriter.writeStartElement("root");
+        xmlStreamWriter.writeDefaultNamespace("");
+    }
+
+    private String endDocumentEmptyDefaultNamespace(XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
+
+        xmlStreamWriter.writeEndDocument();
+
+        xmlStreamWriter.flush();
+
+        return byteArrayOutputStream.toString();
+    }
+
+    /**
+     * Current default namespace is "".
+     * writeStartElement("", "localName"", "")
+     * requires no fixup
+     */
+    @Test
+    public void testEmptyDefaultEmptyPrefix() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"\">" + "<localName>" + "requires no fixup" + "</localName>" + "</root>";
+
+        startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeStartElement("", "localName", "");
+        xmlStreamWriter.writeCharacters("requires no fixup");
+
+        String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testEmptyDefaultEmptyPrefix(): actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    /**
+     * Current default namespace is "".
+     *
+     * writeStartElement("prefix", "localName", "http://example.org/myURI")
+     *
+     * requires no fixup, but should generate a declaration for "prefix":
+     * xmlns:prefix="http://example.org/myURI" if necessary
+     *
+     * necessary to generate a declaration in this test case.
+     */
+    @Test
+    public void testEmptyDefaultSpecifiedPrefix() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"\">" + "<prefix:localName xmlns:prefix=\"http://example.org/myURI\">"
+                + "generate xmlns:prefix" + "</prefix:localName>" + "</root>";
+
+        startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeStartElement("prefix", "localName", "http://example.org/myURI");
+        xmlStreamWriter.writeCharacters("generate xmlns:prefix");
+
+        String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testEmptyDefaultSpecifiedPrefix(): actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    /**
+     * Current default namespace is "".
+     *
+     * writeStartElement("prefix", "localName", "http://example.org/myURI")
+     *
+     * requires no fixup, but should generate a declaration for "prefix":
+     * xmlns:prefix="http://example.org/myURI" if necessary
+     *
+     * not necessary to generate a declaration in this test case.
+     */
+    @Test
+    public void testEmptyDefaultSpecifiedPrefixNoDeclarationGeneration() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"\"" + " xmlns:prefix=\"http://example.org/myURI\">" + "<prefix:localName>"
+                + "not necessary to generate a declaration" + "</prefix:localName>" + "</root>";
+
+        startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeNamespace("prefix", "http://example.org/myURI");
+
+        xmlStreamWriter.writeStartElement("prefix", "localName", "http://example.org/myURI");
+        xmlStreamWriter.writeCharacters("not necessary to generate a declaration");
+
+        String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testEmptyDefaultSpecifiedPrefixNoDeclarationGeneration(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testEmptyDefaultSpecifiedPrefixNoDeclarationGeneration():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    /**
+     * Current default namespace is "".
+     *
+     * writeStartElement("", "localName", "http://example.org/myURI")
+     *
+     * should "fixup" the declaration for the default namespace:
+     * xmlns="http://example.org/myURI"
+     */
+    @Test
+    public void testEmptyDefaultSpecifiedDefault() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"\">" + "<localName xmlns=\"http://example.org/myURI\">" + "generate xmlns"
+                + "</localName>" + "</root>";
+
+        startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeStartElement("", "localName", "http://example.org/myURI");
+        xmlStreamWriter.writeCharacters("generate xmlns");
+
+        String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testEmptyDefaultSpecifiedDefault(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testEmptyDefaultSpecifiedDefault():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    /**
+     * Current default namespace is "".
+     *
+     * writeAttribute("", "", "attrName", "value")
+     *
+     * requires no fixup
+     */
+    @Test
+    public void testEmptyDefaultEmptyPrefixWriteAttribute() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"\" attrName=\"value\">" + "requires no fixup" + "</root>";
+
+        startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeAttribute("", "", "attrName", "value");
+        xmlStreamWriter.writeCharacters("requires no fixup");
+
+        String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testEmptyDefaultEmptyPrefixWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testEmptyDefaultEmptyPrefixWriteAttribute():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    /**
+     * Current default namespace is "".
+     *
+     * writeAttribute("p", "http://example.org/myURI", "attrName", "value")
+     *
+     * requires no fixup, but should generate a declaration for "p":
+     * xmlns:p="http://example.org/myURI" if necessary
+     *
+     * necessary to generate a declaration in this test case.
+     */
+    @Test
+    public void testEmptyDefaultSpecifiedPrefixWriteAttribute() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"\" xmlns:p=\"http://example.org/myURI\" p:attrName=\"value\">"
+                + "generate xmlns:p=\"http://example.org/myURI\"" + "</root>";
+
+        startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeAttribute("p", "http://example.org/myURI", "attrName", "value");
+        xmlStreamWriter.writeCharacters("generate xmlns:p=\"http://example.org/myURI\"");
+
+        String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testEmptyDefaultSpecifiedPrefixWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testEmptyDefaultSpecifiedPrefixWriteAttribute():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    /**
+     * Current default namespace is "".
+     *
+     * writeAttribute("p", "http://example.org/myURI", "attrName", "value")
+     *
+     * requires no fixup, but should generate a declaration for "p":
+     * xmlns:p="http://example.org/myURI" if necessary
+     *
+     * not necessary to generate a declaration in this test case.
+     */
+    @Test
+    public void testEmptyDefaultSpecifiedPrefixWriteAttributeNoDeclarationGeneration() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"\" xmlns:p=\"http://example.org/myURI\" p:attrName=\"value\">"
+                + "not necessary to generate a declaration" + "</root>";
+
+        startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+
+        xmlStreamWriter.writeAttribute("p", "http://example.org/myURI", "attrName", "value");
+        xmlStreamWriter.writeCharacters("not necessary to generate a declaration");
+
+        String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testEmptyDefaultSpecifiedPrefixWriteAttributeNoDeclarationGeneration(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testEmptyDefaultSpecifiedPrefixWriteAttributeNoDeclarationGeneration():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    /**
+     * Current default namespace is "".
+     *
+     * writeAttribute("", "http://example.org/myURI", "attrName", "value")
+     *
+     * XMLOutputFactory (Javadoc) : "If a writer isRepairingNamespaces it will
+     * create a namespace declaration on the current StartElement for any
+     * attribute that does not currently have a namespace declaration in scope.
+     * If the StartElement has a uri but no prefix specified a prefix will be
+     * assigned, if the prefix has not been declared in a parent of the current
+     * StartElement it will be declared on the current StartElement. If the
+     * defaultNamespace is bound and in scope and the default namespace matches
+     * the URI of the attribute or StartElement QName no prefix will be
+     * assigned."
+     *
+     * prefix needs to be assigned for this test case.
+     */
+    @Test
+    public void testEmptyDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttribute() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>"
+                + "<root xmlns=\"\" xmlns:{generated prefix}=\"http://example.org/myURI\" {generated prefix}:attrName=\"value\">"
+                + "generate xmlns declaration {generated prefix}=\"http://example.org/myURI\"" + "</root>";
+
+        startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeAttribute("", "http://example.org/myURI", "attrName", "value");
+        xmlStreamWriter.writeCharacters("generate xmlns declaration {generated prefix}=\"http://example.org/myURI\"");
+
+        String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testEmptyDefaultUnspecifiedPrefixWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testEmptyDefaultUnspecifiedPrefixWriteAttribute():   actualOutput: " + actualOutput);
+        }
+
+        // there must be one xmlns=
+        Assert.assertTrue(actualOutput.split("xmlns=").length == 2, "Expected 1 xmlns=, actual output: " + actualOutput);
+
+        // there must be one xmlns:{generated prefix}="..."
+        Assert.assertTrue(actualOutput.split("xmlns:").length == 2, "Expected 1 xmlns:{generated prefix}=\"\", actual output: " + actualOutput);
+
+        // there must be one {generated prefix}:attrName="value"
+        Assert.assertTrue(actualOutput.split(":attrName=\"value\"").length == 2, "Expected 1 {generated prefix}:attrName=\"value\", actual output: "
+                + actualOutput);
+    }
+
+    /**
+     * Current default namespace is "".
+     *
+     * writeAttribute("", "http://example.org/myURI", "attrName", "value")
+     *
+     * XMLOutputFactory (Javadoc) : "If a writer isRepairingNamespaces it will
+     * create a namespace declaration on the current StartElement for any
+     * attribute that does not currently have a namespace declaration in scope.
+     * If the StartElement has a uri but no prefix specified a prefix will be
+     * assigned, if the prefix has not been declared in a parent of the current
+     * StartElement it will be declared on the current StartElement. If the
+     * defaultNamespace is bound and in scope and the default namespace matches
+     * the URI of the attribute or StartElement QName no prefix will be
+     * assigned."
+     *
+     * no prefix needs to be assigned for this test case
+     */
+    @Test
+    public void testEmptyDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttributeNoPrefixGeneration() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"\" xmlns:p=\"http://example.org/myURI\" p:attrName=\"value\">"
+                + "no prefix generation" + "</root>";
+
+        startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+
+        xmlStreamWriter.writeAttribute("", "http://example.org/myURI", "attrName", "value");
+        xmlStreamWriter.writeCharacters("no prefix generation");
+
+        String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testEmptyDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttributeNoPrefixGeneration(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testEmptyDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttributeNoPrefixGeneration():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    // ---------------- Current default namespace is
+    // "http://example.org/uniqueURI" ----------------
+
+    private void startDocumentSpecifiedDefaultNamespace(XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
+
+        xmlStreamWriter.writeStartDocument();
+        xmlStreamWriter.writeStartElement("root");
+        xmlStreamWriter.writeDefaultNamespace("http://example.org/uniqueURI");
+    }
+
+    private String endDocumentSpecifiedDefaultNamespace(XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
+
+        xmlStreamWriter.writeEndDocument();
+
+        xmlStreamWriter.flush();
+
+        return byteArrayOutputStream.toString();
+    }
+
+    /**
+     * Current default namespace is "http://example.org/uniqueURI".
+     *
+     * writeElement("", "localName", "")
+     *
+     * should "fixup" the declaration for the default namespace: xmlns=""
+     */
+    @Test
+    public void testSpecifiedDefaultEmptyPrefix() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"http://example.org/uniqueURI\">" + "<localName xmlns=\"\">"
+                + "generate xmlns=\"\"" + "</localName>" + "</root>";
+
+        startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeStartElement("", "localName", "");
+        xmlStreamWriter.writeCharacters("generate xmlns=\"\"");
+
+        String actualOutput = endDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testSpecifiedDefaultEmptyPrefix(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testSpecifiedDefaultEmptyPrefix():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    /**
+     * Current default namespace is "http://example.org/uniqueURI".
+     *
+     * writeStartElement("p", "localName", "http://example.org/myURI")
+     *
+     * requires no fixup, but should generate a declaration for "p":
+     * xmlns:p="http://example.org/myURI" if necessary
+     *
+     * test case where it is necessary to generate a declaration.
+     */
+    @Test
+    public void testSpecifiedDefaultSpecifiedPrefix() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"http://example.org/uniqueURI\">"
+                + "<p:localName xmlns:p=\"http://example.org/myURI\">" + "generate xmlns:p=\"http://example.org/myURI\"" + "</p:localName>" + "</root>";
+
+        startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/myURI");
+        xmlStreamWriter.writeCharacters("generate xmlns:p=\"http://example.org/myURI\"");
+
+        String actualOutput = endDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testSpecifiedDefaultSpecifiedPrefix(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testSpecifiedDefaultSpecifiedPrefix():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    /**
+     * Current default namespace is "http://example.org/uniqueURI".
+     *
+     * writeStartElement("p", "localName", "http://example.org/myURI")
+     *
+     * requires no fixup, but should generate a declaration for "p":
+     * xmlns:p="http://example.org/myURI" if necessary
+     *
+     * test case where it is not necessary to generate a declaration.
+     */
+    @Test
+    public void testSpecifiedDefaultSpecifiedPrefixNoPrefixGeneration() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root" + " xmlns=\"http://example.org/uniqueURI\""
+                + " xmlns:p=\"http://example.org/myURI\">" + "<p:localName>" + "not necessary to generate a declaration" + "</p:localName>" + "</root>";
+
+        startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+
+        xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/myURI");
+        xmlStreamWriter.writeCharacters("not necessary to generate a declaration");
+
+        String actualOutput = endDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testSpecifiedDefaultSpecifiedPrefixNoPrefixGeneration(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testSpecifiedDefaultSpecifiedPrefixNoPrefixGeneration():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    /**
+     * Current default namespace is "http://example.org/uniqueURI".
+     *
+     * writeStartElement("", "localName", "http://example.org/myURI")
+     *
+     * should "fixup" the declaration for the default namespace:
+     * xmlns="http://example.org/myURI"
+     */
+    @Test
+    public void testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURI() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"http://example.org/uniqueURI\">"
+                + "<localName xmlns=\"http://example.org/myURI\">" + "generate xmlns=\"http://example.org/myURI\"" + "</localName>" + "</root>";
+
+        startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeStartElement("", "localName", "http://example.org/myURI");
+        xmlStreamWriter.writeCharacters("generate xmlns=\"http://example.org/myURI\"");
+
+        String actualOutput = endDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURI(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURI():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    /**
+     * Current default namespace is "http://example.org/uniqueURI".
+     *
+     * writeAttribute("", "", "attrName", "value")
+     *
+     * requires no fixup
+     */
+    @Test
+    public void testSpecifiedDefaultEmptyPrefixWriteAttribute() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"http://example.org/uniqueURI\" attrName=\"value\">" + "requires no fixup"
+                + "</root>";
+
+        startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeAttribute("", "", "attrName", "value");
+        xmlStreamWriter.writeCharacters("requires no fixup");
+
+        String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testSpecifiedDefaultEmptyPrefixWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testSpecifiedDefaultEmptyPrefixWriteAttribute():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    /**
+     * Current default namespace is "http://example.org/uniqueURI".
+     *
+     * writeAttribute("p", "http://example.org/myURI", "attrName", "value")
+     *
+     * requires no fixup, but should generate a declaration for "p":
+     * xmlns:p="http://example.org/myURI" if necessary
+     *
+     * test case where it is necessary to generate a declaration.
+     */
+    @Test
+    public void testSpecifiedDefaultSpecifiedPrefixWriteAttribute() throws Exception { // want
+                                                                                       // to
+                                                                                       // test
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>"
+                + "<root xmlns=\"http://example.org/uniqueURI\" xmlns:p=\"http://example.org/myURI\" p:attrName=\"value\">"
+                + "generate xmlns:p=\"http://example.org/myURI\"" + "</root>";
+
+        startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeAttribute("p", "http://example.org/myURI", "attrName", "value");
+        xmlStreamWriter.writeCharacters("generate xmlns:p=\"http://example.org/myURI\"");
+
+        String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testSpecifiedDefaultSpecifiedPrefixWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testSpecifiedDefaultSpecifiedPrefixWriteAttribute():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    /**
+     * Current default namespace is "http://example.org/uniqueURI".
+     *
+     * writeAttribute("p", "http://example.org/myURI", "attrName", "value")
+     *
+     * requires no fixup, but should generate a declaration for "p":
+     * xmlns:p="http://example.org/myURI" if necessary
+     *
+     * test case where it is not necessary to generate a declaration.
+     */
+    @Test
+    public void testSpecifiedDefaultSpecifiedPrefixWriteAttributeNoDeclarationGeneration() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>"
+                + "<root xmlns=\"http://example.org/uniqueURI\" xmlns:p=\"http://example.org/myURI\" p:attrName=\"value\">"
+                + "not necessary to generate a declaration" + "</root>";
+
+        startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+
+        xmlStreamWriter.writeAttribute("p", "http://example.org/myURI", "attrName", "value");
+        xmlStreamWriter.writeCharacters("not necessary to generate a declaration");
+
+        String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testSpecifiedDefaultSpecifiedPrefixWriteAttributeNoDeclarationGeneration(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testSpecifiedDefaultSpecifiedPrefixWriteAttributeNoDeclarationGeneration():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    /**
+     * Current default namespace is "http://example.org/uniqueURI".
+     *
+     * writeAttribute("p", "http://example.org/uniqueURI", "attrName", "value")
+     *
+     * requires no fixup, but should generate a declaration for "p":
+     * xmlns:p="http://example.org/uniqueURI" if necessary. (Note that this will
+     * potentially produce two namespace bindings with the same URI, xmlns="xxx"
+     * and xmlns:p="xxx", but that's perfectly legal.)
+     */
+    @Test
+    public void testSpecifiedDefaultSpecifiedPrefixSpecifiedNamespaceURIWriteAttribute() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"http://example.org/uniqueURI\" attrName=\"value\">" + "requires no fixup"
+                + "</root>";
+        final String EXPECTED_OUTPUT_2 = "<?xml version=\"1.0\" ?>"
+                + "<root xmlns=\"http://example.org/uniqueURI\" xmlns:p=\"http://example.org/uniqueURI\" p:attrName=\"value\">" + "requires no fixup"
+                + "</root>";
+
+        startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeAttribute("p", "http://example.org/uniqueURI", "attrName", "value");
+        xmlStreamWriter.writeCharacters("requires no fixup");
+
+        String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testSpecifiedDefaultSpecifiedPrefixSpecifiedNamespaceURIWriteAttribute: expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testSpecifiedDefaultSpecifiedPrefixSpecifiedNamespaceURIWriteAttribute: expectedOutput: " + EXPECTED_OUTPUT_2);
+            System.out.println("testSpecifiedDefaultSpecifiedPrefixSpecifiedNamespaceURIWriteAttribute:   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertTrue(actualOutput.equals(EXPECTED_OUTPUT) || actualOutput.equals(EXPECTED_OUTPUT_2), "Expected: " + EXPECTED_OUTPUT + "\n" + "Actual: "
+                + actualOutput);
+    }
+
+    /**
+     * Current default namespace is "http://example.org/uniqueURI".
+     *
+     * writeAttribute("", "http://example.org/myURI", "attrName", "value")
+     *
+     * XMLOutputFactory (Javadoc) : "If a writer isRepairingNamespaces it will
+     * create a namespace declaration on the current StartElement for any
+     * attribute that does not currently have a namespace declaration in scope.
+     * If the StartElement has a uri but no prefix specified a prefix will be
+     * assigned, if the prefix has not been declared in a parent of the current
+     * StartElement it will be declared on the current StartElement. If the
+     * defaultNamespace is bound and in scope and the default namespace matches
+     * the URI of the attribute or StartElement QName no prefix will be
+     * assigned."
+     *
+     * test case where prefix needs to be assigned.
+     */
+    @Test
+    public void testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttribute() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root" + " xmlns=\"http://example.org/uniqueURI\""
+                + " xmlns:{generated prefix}=\"http://example.org/myURI\"" + " {generated prefix}:attrName=\"value\">"
+                + "generate xmlns declaration {generated prefix}=\"http://example.org/myURI\"" + "</root>";
+
+        startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeAttribute("", "http://example.org/myURI", "attrName", "value");
+        xmlStreamWriter.writeCharacters("generate xmlns declaration {generated prefix}=\"http://example.org/myURI\"");
+
+        String actualOutput = endDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttribute():   actualOutput: " + actualOutput);
+        }
+
+        // there must be one xmlns=
+        Assert.assertTrue(actualOutput.split("xmlns=").length == 2, "Expected 1 xmlns=, actual output: " + actualOutput);
+
+        // there must be one xmlns:{generated prefix}="..."
+        Assert.assertTrue(actualOutput.split("xmlns:").length == 2, "Expected 1 xmlns:{generated prefix}=\"\", actual output: " + actualOutput);
+
+        // there must be one {generated prefix}:attrName="value"
+        Assert.assertTrue(actualOutput.split(":attrName=\"value\"").length == 2, "Expected 1 {generated prefix}:attrName=\"value\", actual output: "
+                + actualOutput);
+    }
+
+    /**
+     * Current default namespace is "http://example.org/uniqueURI".
+     *
+     * writeAttribute("", "http://example.org/myURI", "attrName", "value")
+     *
+     * XMLOutputFactory (Javadoc) : "If a writer isRepairingNamespaces it will
+     * create a namespace declaration on the current StartElement for any
+     * attribute that does not currently have a namespace declaration in scope.
+     * If the StartElement has a uri but no prefix specified a prefix will be
+     * assigned, if the prefix has not been declared in a parent of the current
+     * StartElement it will be declared on the current StartElement. If the
+     * defaultNamespace is bound and in scope and the default namespace matches
+     * the URI of the attribute or StartElement QName no prefix will be
+     * assigned."
+     *
+     * test case where no prefix needs to be assigned.
+     */
+    @Test
+    public void testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttributeNoPrefixGeneration() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root" + " xmlns=\"http://example.org/uniqueURI\""
+                + " xmlns:p=\"http://example.org/myURI\"" + " p:attrName=\"value\">" + "no prefix needs to be assigned" + "</root>";
+
+        startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+
+        xmlStreamWriter.writeAttribute("", "http://example.org/myURI", "attrName", "value");
+        xmlStreamWriter.writeCharacters("no prefix needs to be assigned");
+
+        String actualOutput = endDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttributeNoPrefixGeneration(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testSpecifiedDefaultEmptyPrefixSpecifiedNamespaceURIWriteAttributeNoPrefixGeneration():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    // --------------- Serializations, sequences ---------------
+
+    // Unfortunately, the nature of the StAX API makes it possible for the
+    // programmer to generate events that cannot be serialized in XML.
+
+    /**
+     * Current default namespace is "".
+     *
+     * write*("p", "myuri", ...); write*("p", "otheruri", ...);
+     *
+     * XMLOutputFactory (Javadoc) (If repairing of namespaces is enabled): "If
+     * element and/or attribute names in the same start or empty-element tag are
+     * bound to different namespace URIs and are using the same prefix then the
+     * element or the first occurring attribute retains the original prefix and
+     * the following attributes have their prefixes replaced with a new prefix
+     * that is bound to the namespace URIs of those attributes."
+     */
+    @Test
+    public void testSamePrefixDifferentURI() throws Exception {
+
+        /**
+         * writeAttribute("p", "http://example.org/URI-ONE", "attr1", "value");
+         * writeAttribute("p", "http://example.org/URI-TWO", "attr2", "value");
+         */
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root" + " xmlns=\"\"" + " xmlns:p=\"http://example.org/URI-ONE\"" + " p:attr1=\"value\">"
+                + " xmlns:{generated prefix}=\"http://example.org/URI-TWO\"" + " {generated prefix}:attr2=\"value\">"
+                + "remap xmlns declaration {generated prefix}=\"http://example.org/URI-TWO\"" + "</root>";
+
+        startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeAttribute("p", "http://example.org/URI-ONE", "attr1", "value");
+        xmlStreamWriter.writeAttribute("p", "http://example.org/URI-TWO", "attr2", "value");
+        xmlStreamWriter.writeCharacters("remap xmlns declaration {generated prefix}=\"http://example.org/URI-TWO\"");
+
+        String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testSamePrefixDifferentURI(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testSamePrefixDifferentURI():   actualOutput: " + actualOutput);
+        }
+
+        // there must be 1 xmlns=
+        Assert.assertTrue(actualOutput.split("xmlns=").length == 2, "Expected 1 xmlns=, actual output: " + actualOutput);
+
+        // there must be 2 xmlns:
+        Assert.assertTrue(actualOutput.split("xmlns:").length == 3, "Expected 2 xmlns:, actual output: " + actualOutput);
+
+        // there must be 2 :attr
+        Assert.assertTrue(actualOutput.split(":attr").length == 3, "Expected 2 :attr, actual output: " + actualOutput);
+
+        /**
+         * writeStartElement("p", "localName", "http://example.org/URI-ONE");
+         * writeAttribute("p", "http://example.org/URI-TWO", "attrName",
+         * "value");
+         */
+        final String EXPECTED_OUTPUT_2 = "<?xml version=\"1.0\" ?>" + "<root" + " xmlns=\"\">" + "<p:localName" + " xmlns:p=\"http://example.org/URI-ONE\""
+                + " xmlns:{generated prefix}=\"http://example.org/URI-TWO\"" + " {generated prefix}:attrName=\"value\">" + "</p:localName>" + "</root>";
+
+        // reset to known state
+        resetWriter();
+        startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/URI-ONE");
+        xmlStreamWriter.writeAttribute("p", "http://example.org/URI-TWO", "attrName", "value");
+
+        actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testSamePrefixDifferentURI(): expectedOutput: " + EXPECTED_OUTPUT_2);
+            System.out.println("testSamePrefixDifferentURI():   actualOutput: " + actualOutput);
+        }
+
+        // there must be 1 xmlns=
+        Assert.assertTrue(actualOutput.split("xmlns=").length == 2, "Expected 1 xmlns=, actual output: " + actualOutput);
+
+        // there must be 2 xmlns:
+        Assert.assertTrue(actualOutput.split("xmlns:").length == 3, "Expected 2 xmlns:, actual output: " + actualOutput);
+
+        // there must be 2 p:localName
+        Assert.assertTrue(actualOutput.split("p:localName").length == 3, "Expected 2 p:localName, actual output: " + actualOutput);
+
+        // there must be 1 :attrName
+        Assert.assertTrue(actualOutput.split(":attrName").length == 2, "Expected 1 :attrName, actual output: " + actualOutput);
+
+        /**
+         * writeNamespace("p", "http://example.org/URI-ONE");
+         * writeAttribute("p", "http://example.org/URI-TWO", "attrName",
+         * "value");
+         */
+        final String EXPECTED_OUTPUT_3 = "<?xml version=\"1.0\" ?>" + "<root" + " xmlns=\"\"" + " xmlns:p=\"http://example.org/URI-ONE\""
+                + " xmlns:{generated prefix}=\"http://example.org/URI-TWO\"" + " {generated prefix}:attrName=\"value\">" + "</root>";
+
+        // reset to known state
+        resetWriter();
+        startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeNamespace("p", "http://example.org/URI-ONE");
+        xmlStreamWriter.writeAttribute("p", "http://example.org/URI-TWO", "attrName", "value");
+
+        actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testSamePrefixDifferentURI(): expectedOutput: " + EXPECTED_OUTPUT_3);
+            System.out.println("testSamePrefixDifferentURI():   actualOutput: " + actualOutput);
+        }
+
+        // there must be 1 xmlns=
+        Assert.assertTrue(actualOutput.split("xmlns=").length == 2, "Expected 1 xmlns=, actual output: " + actualOutput);
+
+        // there must be 2 xmlns:
+        Assert.assertTrue(actualOutput.split("xmlns:").length == 3, "Expected 2 xmlns:, actual output: " + actualOutput);
+
+        // there must be 1 :attrName
+        Assert.assertTrue(actualOutput.split(":attrName").length == 2, "Expected a :attrName, actual output: " + actualOutput);
+
+        /**
+         * writeNamespace("xmlns", ""); writeStartElement("", "localName",
+         * "http://example.org/URI-TWO");
+         */
+        final String EXPECTED_OUTPUT_4 = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"\">" + "<localName xmlns=\"http://example.org/URI-TWO\">"
+                + "xmlns declaration =\"http://example.org/URI-TWO\"" + "</localName" + "</root>";
+
+        // reset to known state
+        resetWriter();
+        startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        // writeNamespace("xmlns", ""); already done by
+        // startDocumentEmptyDefaultNamespace above
+        xmlStreamWriter.writeStartElement("", "localName", "http://example.org/URI-TWO");
+        xmlStreamWriter.writeCharacters("remap xmlns declaration {generated prefix}=\"http://example.org/URI-TWO\"");
+
+        actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testSamePrefixDifferentURI(): expectedOutput: " + EXPECTED_OUTPUT_4);
+            System.out.println("testSamePrefixDifferentURI():   actualOutput: " + actualOutput);
+        }
+
+        // there must be 2 xmlns=
+        Assert.assertTrue(actualOutput.split("xmlns=").length == 3, "Expected 2 xmlns=, actual output: " + actualOutput);
+
+        // there must be 0 xmlns:
+        Assert.assertTrue(actualOutput.split("xmlns:").length == 1, "Expected 0 xmlns:, actual output: " + actualOutput);
+
+        // there must be 0 :localName
+        Assert.assertTrue(actualOutput.split(":localName").length == 1, "Expected 0 :localName, actual output: " + actualOutput);
+    }
+
+    // ---------------- Misc ----------------
+
+    /**
+     * The one case where you don't have to worry about fixup is on attributes
+     * that do not have a prefix. Irrespective of the current namespace
+     * bindings,
+     *
+     * writeAttribute("", "", "attrName", "value")
+     *
+     * is always correct and never requires fixup.
+     */
+    @Test
+    public void testEmptyDefaultEmptyPrefixEmptyNamespaceURIWriteAttribute() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"\" attrName=\"value\">" + "never requires fixup" + "</root>";
+
+        startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeAttribute("", "", "attrName", "value");
+        xmlStreamWriter.writeCharacters("never requires fixup");
+
+        String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testEmptyDefaultEmptyPrefixEmptyNamespaceURIWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testEmptyDefaultEmptyPrefixEmptyNamespaceURIWriteAttribute():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    @Test
+    public void testSpecifiedDefaultEmptyPrefixEmptyNamespaceURIWriteAttribute() throws Exception {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"http://example.org/uniqueURI\" attrName=\"value\">" + "never requires fixup"
+                + "</root>";
+
+        startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        xmlStreamWriter.writeAttribute("", "", "attrName", "value");
+        xmlStreamWriter.writeCharacters("never requires fixup");
+
+        String actualOutput = endDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+
+        if (DEBUG) {
+            System.out.println("testSpecifiedDefaultEmptyPrefixEmptyNamespaceURIWriteAttribute(): expectedOutput: " + EXPECTED_OUTPUT);
+            System.out.println("testSpecifiedDefaultEmptyPrefixEmptyNamespaceURIWriteAttribute():   actualOutput: " + actualOutput);
+        }
+
+        Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+    }
+
+    /*--------------- Negative tests with isRepairingNamespaces as FALSE ---------------------- */
+
+    private void setUpForNoRepair() {
+
+        xmlOutputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.FALSE);
+
+        // new Writer
+        try {
+            xmlStreamWriter = xmlOutputFactory.createXMLStreamWriter(byteArrayOutputStream);
+
+        } catch (XMLStreamException xmlStreamException) {
+            xmlStreamException.printStackTrace();
+            Assert.fail(xmlStreamException.toString());
+        }
+    }
+
+    /*
+     * Tries to assign default namespace to empty URI and again to a different
+     * uri in element and attribute. Expects XMLStreamException .
+     * writeNamespace("",""); writeAttribute("", "http://example.org/myURI",
+     * "attrName", "value");
+     */
+    @Test
+    public void testEmptyDefaultEmptyPrefixSpecifiedURIWriteAttributeNoRepair() {
+        try {
+            setUpForNoRepair();
+            startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            xmlStreamWriter.writeAttribute("", "http://example.org/myURI", "attrName", "value");
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            Assert.fail("XMLStreamException is expected, actualOutput: " + actualOutput);
+        } catch (Exception e) {
+            System.out.println("PASS: caught an expected exception" + e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    /*
+     * Tries to assign default namespace to different uris in element and
+     * attribute and expects XMLStreamException.
+     * writeNamespace("","http://example.org/uniqueURI"); writeAttribute("",
+     * "http://example.org/myURI", "attrName", "value");
+     */
+    @Test
+    public void testSpecifiedDefaultEmptyPrefixSpecifiedURIWriteAttributeNoRepair() {
+        try {
+            setUpForNoRepair();
+            startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+            xmlStreamWriter.writeAttribute("", "http://example.org/uniqueURI", "attrName", "value");
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            Assert.fail("XMLStreamException is expected, actualOutput: " + actualOutput);
+        } catch (Exception e) {
+            System.out.println("PASS: caught an expected exception" + e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    /*
+     * Tries to assign default namespace to same uri twice in element and
+     * attribute and expects XMLStreamException.
+     * writeNamespace("","http://example.org/uniqueURI"); writeAttribute("",
+     * "http://example.org/uniqueURI", "attrName", "value");
+     */
+    @Test
+    public void testSpecifiedDefaultEmptyPrefixSpecifiedDifferentURIWriteAttributeNoRepair() {
+        try {
+            setUpForNoRepair();
+            startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+            xmlStreamWriter.writeAttribute("", "http://example.org/myURI", "attrName", "value");
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            Assert.fail("XMLStreamException is expected, actualOutput: " + actualOutput);
+        } catch (Exception e) {
+            System.out.println("PASS: caught an expected exception" + e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    /*
+     * Tries to assign prefix 'p' to different uris to attributes of the same
+     * element and expects XMLStreamException. writeAttribute("p",
+     * "http://example.org/URI-ONE", "attr1", "value"); writeAttribute("p",
+     * "http://example.org/URI-TWO", "attr2", "value");
+     */
+    @Test
+    public void testSamePrefixDiffrentURIWriteAttributeNoRepair() {
+        try {
+            setUpForNoRepair();
+            startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            xmlStreamWriter.writeAttribute("p", "http://example.org/URI-ONE", "attr1", "value");
+            xmlStreamWriter.writeAttribute("p", "http://example.org/URI-TWO", "attr2", "value");
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            Assert.fail("XMLStreamException is expected, actualOutput: " + actualOutput);
+        } catch (Exception e) {
+            System.out.println("PASS: caught an expected exception" + e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    /*
+     * Tries to assign prefix 'p' to different uris in element and attribute and
+     * expects XMLStreamException.
+     * writeStartElement("p","localName","http://example.org/URI-ONE")
+     * writeAttribute("p", "http://example.org/URI-TWO", "attrName", "value")
+     */
+    @Test
+    public void testSamePrefixDiffrentURIWriteElemAndWriteAttributeNoRepair() {
+        try {
+            setUpForNoRepair();
+            startDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/URI-ONE");
+            xmlStreamWriter.writeAttribute("p", "http://example.org/URI-TWO", "attrName", "value");
+            xmlStreamWriter.writeEndElement();
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            Assert.fail("XMLStreamException is expected, actualOutput: " + actualOutput);
+        } catch (Exception e) {
+            System.out.println("PASS: caught an expected exception" + e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    /*
+     * Tries to write following and expects a StreamException. <root
+     * xmlns=""http://example.org/uniqueURI"" xmlns=""http://example.org/myURI""
+     * />
+     */
+    @Test
+    public void testDefaultNamespaceDiffrentURIWriteElementNoRepair() {
+        try {
+            System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+            setUpForNoRepair();
+            startDocumentSpecifiedDefaultNamespace(xmlStreamWriter);
+            xmlStreamWriter.writeNamespace("", "http://example.org/myURI");
+            xmlStreamWriter.writeEndElement();
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            System.out.println("+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
+            Assert.fail("XMLStreamException is expected, actualOutput: " + actualOutput);
+        } catch (Exception e) {
+            System.out.println("PASS: caught an expected exception" + e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    /*--------------------------------------------------------------------------
+     Miscelleneous tests for writeStartElement() & writeAttribute() methods
+     in case of NOREPAIR
+     --------------------------------------------------------------------------*/
+
+    private void startDocument(XMLStreamWriter xmlStreamWriter) throws XMLStreamException {
+        xmlStreamWriter.writeStartDocument();
+        xmlStreamWriter.writeStartElement("root");
+    }
+
+    @Test
+    public void testSpecifiedPrefixSpecifiedURIWriteElementNoRepair() {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root>" + "<p:localName></p:localName>" + "</root>";
+        try {
+            setUpForNoRepair();
+            startDocument(xmlStreamWriter);
+            xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/myURI");
+            xmlStreamWriter.writeEndElement();
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            System.out.println("actualOutput: " + actualOutput);
+            Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Caught an unexpected exception" + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSpecifiedPrefixSpecifiedURIWriteAttributeNoRepair() {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root p:attrName=\"value\">" + "</root>";
+        try {
+            setUpForNoRepair();
+            startDocument(xmlStreamWriter);
+            xmlStreamWriter.writeAttribute("p", "http://example.org/myURI", "attrName", "value");
+            xmlStreamWriter.writeEndElement();
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            System.out.println("actualOutput: " + actualOutput);
+            Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Caught an unexpected exception" + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSpecifiedPrefixSpecifiedURISpecifiedNamespcaeWriteElementNoRepair() {
+
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root>" + "<p:localName xmlns:p=\"http://example.org/myURI\"></p:localName>" + "</root>";
+        try {
+            setUpForNoRepair();
+            startDocument(xmlStreamWriter);
+
+            xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/myURI");
+            xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+            xmlStreamWriter.writeEndElement();
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            System.out.println("actualOutput: " + actualOutput);
+            Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Caught an unexpected exception" + e.getMessage());
+        }
+    }
+
+    /*
+     * writeStartElement("p","localName", "http://example.org/myURI")
+     * writeNamespace("p","http://example.org/uniqueURI") This sequence of calls
+     * should generate an error as prefix 'p' is binded to different namespace
+     * URIs in same namespace context and repairing is disabled.
+     */
+
+    @Test
+    public void testSpecifiedPrefixSpecifiedURISpecifiedDifferentNamespcaeWriteElementNoRepair() {
+
+        try {
+            setUpForNoRepair();
+            startDocument(xmlStreamWriter);
+            xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/myURI");
+            xmlStreamWriter.writeNamespace("p", "http://example.org/uniqueURI");
+            xmlStreamWriter.writeEndElement();
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            System.out.println("actualOutput: " + actualOutput);
+            Assert.fail("XMLStreamException is expected as 'p' is rebinded to a different URI in same namespace context");
+        } catch (Exception e) {
+            System.out.println("Caught an expected exception" + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testEmptyPrefixEmptyURIWriteAttributeNoRepair() {
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root>" + "<localName attrName=\"value\"></localName>" + "</root>";
+        try {
+            setUpForNoRepair();
+            startDocument(xmlStreamWriter);
+            xmlStreamWriter.writeStartElement("localName");
+            xmlStreamWriter.writeAttribute("", "", "attrName", "value");
+            xmlStreamWriter.writeEndElement();
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            System.out.println("actualOutput: " + actualOutput);
+            Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Caught an unexpected exception" + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testEmptyPrefixNullURIWriteAttributeNoRepair() {
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root>" + "<localName attrName=\"value\"></localName>" + "</root>";
+        try {
+            setUpForNoRepair();
+            startDocument(xmlStreamWriter);
+            xmlStreamWriter.writeStartElement("localName");
+            xmlStreamWriter.writeAttribute(null, null, "attrName", "value");
+            xmlStreamWriter.writeEndElement();
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            System.out.println("actualOutput: " + actualOutput);
+            Assert.fail("XMLStreamException is expected, actualOutput: " + actualOutput);
+        } catch (Exception e) {
+            System.out.println("PASS: caught an expected exception" + e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    @Test
+    public void testDoubleXmlNsNoRepair() {
+        try {
+            // reset to known state
+            setUpForNoRepair();
+
+            xmlStreamWriter.writeStartDocument();
+            xmlStreamWriter.writeStartElement("foo");
+            xmlStreamWriter.writeNamespace("xml", XMLConstants.XML_NS_URI);
+            xmlStreamWriter.writeAttribute("xml", XMLConstants.XML_NS_URI, "lang", "ja_JP");
+            xmlStreamWriter.writeCharacters("Hello");
+            xmlStreamWriter.writeEndElement();
+            xmlStreamWriter.writeEndDocument();
+
+            xmlStreamWriter.flush();
+            String actualOutput = byteArrayOutputStream.toString();
+
+            if (DEBUG) {
+                System.out.println("testDoubleXmlNsNoRepair(): actualOutput: " + actualOutput);
+            }
+
+            // there should be no xmlns:xml
+            Assert.assertTrue(actualOutput.split("xmlns:xml").length == 1, "Expected 0 xmlns:xml, actual output: " + actualOutput);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSpecifiedURIWriteAttributeNoRepair() {
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root>" + "<p:localName p:attrName=\"value\"></p:localName>" + "</root>";
+        try {
+            setUpForNoRepair();
+            startDocument(xmlStreamWriter);
+            xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/myURI");
+            xmlStreamWriter.writeAttribute("http://example.org/myURI", "attrName", "value");
+            xmlStreamWriter.writeEndElement();
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            System.out.println("actualOutput: " + actualOutput);
+            Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+        } catch (Exception e) {
+            System.out.println("Caught an expected exception" + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSpecifiedURIWriteAttributeWithRepair() {
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root>"
+                + "<p:localName xmlns:p=\"http://example.org/myURI\" p:attrName=\"value\"></p:localName>" + "</root>";
+        try {
+            startDocument(xmlStreamWriter);
+            xmlStreamWriter.writeStartElement("p", "localName", "http://example.org/myURI");
+            xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+            xmlStreamWriter.writeAttribute("http://example.org/myURI", "attrName", "value");
+            xmlStreamWriter.writeEndElement();
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            System.out.println("actualOutput: " + actualOutput);
+            Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSpecifiedDefaultInDifferentElementsNoRepair() {
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root>" + "<localName xmlns=\"http://example.org/myURI\">"
+                + "<child xmlns=\"http://example.org/uniqueURI\"></child>" + "</localName>" + "</root>";
+        try {
+            setUpForNoRepair();
+            startDocument(xmlStreamWriter);
+            xmlStreamWriter.writeStartElement("localName");
+            xmlStreamWriter.writeDefaultNamespace("http://example.org/myURI");
+            xmlStreamWriter.writeStartElement("child");
+            xmlStreamWriter.writeDefaultNamespace("http://example.org/uniqueURI");
+            xmlStreamWriter.writeEndElement();
+            xmlStreamWriter.writeEndElement();
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            System.out.println("actualOutput: " + actualOutput);
+            Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    /*------------- Tests for setPrefix() and setDefaultNamespace() methods --------------------*/
+
+    @Test
+    public void testSetPrefixWriteNamespaceNoRepair() {
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns:p=\"http://example.org/myURI\">" + "</root>";
+        try {
+            setUpForNoRepair();
+            startDocument(xmlStreamWriter);
+            xmlStreamWriter.setPrefix("p", "http://example.org/myURI");
+            xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+            xmlStreamWriter.writeEndElement();
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            System.out.println("actualOutput: " + actualOutput);
+            Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+        } catch (Exception e) {
+            System.out.println("Caught an expected exception" + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSetPrefixWriteNamespaceWithRepair() {
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns:p=\"http://example.org/myURI\">" + "</root>";
+        try {
+            startDocument(xmlStreamWriter);
+            xmlStreamWriter.setPrefix("p", "http://example.org/myURI");
+            xmlStreamWriter.writeNamespace("p", "http://example.org/myURI");
+            xmlStreamWriter.writeEndElement();
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            System.out.println("actualOutput: " + actualOutput);
+            Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+        } catch (Exception e) {
+            System.out.println("Caught an expected exception" + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSetDefaultNamespaceWriteNamespaceNoRepair() {
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"http://example.org/myURI\">" + "</root>";
+        try {
+            setUpForNoRepair();
+            startDocument(xmlStreamWriter);
+            xmlStreamWriter.setDefaultNamespace("http://example.org/myURI");
+            xmlStreamWriter.writeNamespace("", "http://example.org/myURI");
+            xmlStreamWriter.writeEndElement();
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            System.out.println("actualOutput: " + actualOutput);
+            Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+        } catch (Exception e) {
+            System.out.println("Caught an expected exception" + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSetDefaultNamespaceWriteNamespaceWithRepair() {
+        final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<root xmlns=\"http://example.org/myURI\">" + "</root>";
+        try {
+            startDocument(xmlStreamWriter);
+            xmlStreamWriter.setDefaultNamespace("http://example.org/myURI");
+            xmlStreamWriter.writeNamespace("", "http://example.org/myURI");
+            xmlStreamWriter.writeEndElement();
+            String actualOutput = endDocumentEmptyDefaultNamespace(xmlStreamWriter);
+            System.out.println("actualOutput: " + actualOutput);
+            Assert.assertEquals(EXPECTED_OUTPUT, actualOutput);
+        } catch (Exception e) {
+            System.out.println("Caught an expected exception" + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NullUriDetectionTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NullUriDetectionTest.java
new file mode 100644
index 00000000000..9dbb40cec11
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/NullUriDetectionTest.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6391922
+ * @summary Test XMLStreamWriter can writeDefaultNamespace(null).
+ */
+public class NullUriDetectionTest {
+    @Test
+    public void test1() throws Exception {
+        XMLOutputFactory xof = XMLOutputFactory.newInstance();
+        xof.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, Boolean.TRUE);
+
+        StringWriter sw = new StringWriter();
+        XMLStreamWriter w = xof.createXMLStreamWriter(sw);
+        w.writeStartDocument();
+        w.writeStartElement("foo", "bar", "zot");
+        w.writeDefaultNamespace(null);
+        w.writeCharacters("---");
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/SqeLinuxTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/SqeLinuxTest.java
new file mode 100644
index 00000000000..fa53214f633
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/SqeLinuxTest.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamWriter can output multiple declarations if IS_REPAIRING_NAMESPACES is false.
+ */
+public class SqeLinuxTest {
+
+    // note that expected output will have multiple declarations,
+    // StAX does not do well formedness checking
+    private static final String EXPECTED_OUTPUT = "<?xml version=\"1.0\" ?>" + "<?xml version=\"wStDoc_ver\"?>"
+            + "<?xml version=\"wStDoc_ver2\" encoding=\"ASCII\"?>" + "<?xml version=\"1.0\" ?>";
+
+    XMLStreamWriter xmlStreamWriter;
+    ByteArrayOutputStream byteArrayOutputStream;
+    XMLOutputFactory xmlOutputFactory;
+
+    @Test
+    public void testWriterOnLinux() throws Exception {
+
+        // setup XMLStreamWriter
+        try {
+            byteArrayOutputStream = new ByteArrayOutputStream();
+            xmlOutputFactory = XMLOutputFactory.newInstance();
+            xmlOutputFactory.setProperty(xmlOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(false));
+            xmlStreamWriter = xmlOutputFactory.createXMLStreamWriter(byteArrayOutputStream, "ASCII");
+        } catch (Exception e) {
+            System.err.println("Unexpected Exception: " + e.toString());
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+
+        // create & write a document
+        try {
+            xmlStreamWriter.writeStartDocument();
+            xmlStreamWriter.writeStartDocument("wStDoc_ver");
+            xmlStreamWriter.writeStartDocument("ASCII", "wStDoc_ver2");
+            xmlStreamWriter.writeStartDocument(null, null);
+
+            // orignal SQE test used reset() before flush()
+            // believe this is false as reset() throws away output before
+            // flush() writes any cached output
+            // it is valid for a XMLStreamWriter to write its output at any
+            // time, flush() just garuntees it
+            // byteArrayOutputStream.reset();
+            xmlStreamWriter.flush();
+            Assert.assertEquals(EXPECTED_OUTPUT, byteArrayOutputStream.toString());
+        } catch (Exception e) {
+            System.err.println("Unexpected Exception: " + e.toString());
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/UnprefixedNameTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/UnprefixedNameTest.java
new file mode 100644
index 00000000000..c4174cf10fa
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/UnprefixedNameTest.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6394074
+ * @summary Test XMLStreamWriter namespace prefix with writeDefaultNamespace.
+ */
+public class UnprefixedNameTest {
+
+    @Test
+    public void testUnboundPrefix() throws Exception {
+
+        try {
+            XMLOutputFactory xof = XMLOutputFactory.newInstance();
+            XMLStreamWriter w = xof.createXMLStreamWriter(System.out);
+            // here I'm trying to write
+            // <bar xmlns="foo" />
+            w.writeStartDocument();
+            w.writeStartElement("foo", "bar");
+            w.writeDefaultNamespace("foo");
+            w.writeCharacters("---");
+            w.writeEndElement();
+            w.writeEndDocument();
+            w.close();
+
+            // Unexpected success
+            String FAIL_MSG = "Unexpected success.  Expected: " + "XMLStreamException - " + "if the namespace URI has not been bound to a prefix "
+                    + "and javax.xml.stream.isPrefixDefaulting has not been " + "set to true";
+            System.err.println(FAIL_MSG);
+            Assert.fail(FAIL_MSG);
+        } catch (XMLStreamException xmlStreamException) {
+            // Expected Exception
+            System.out.println("Expected XMLStreamException: " + xmlStreamException.toString());
+        }
+    }
+
+    @Test
+    public void testBoundPrefix() throws Exception {
+
+        try {
+            XMLOutputFactory xof = XMLOutputFactory.newInstance();
+            XMLStreamWriter w = xof.createXMLStreamWriter(System.out);
+            // here I'm trying to write
+            // <bar xmlns="foo" />
+            w.writeStartDocument();
+            w.writeStartElement("foo", "bar", "http://namespace");
+            w.writeCharacters("---");
+            w.writeEndElement();
+            w.writeEndDocument();
+            w.close();
+
+            // Expected success
+            System.out.println("Expected success.");
+        } catch (Exception exception) {
+            // Unexpected Exception
+            String FAIL_MSG = "Unexpected Exception: " + exception.toString();
+            System.err.println(FAIL_MSG);
+            Assert.fail(FAIL_MSG);
+        }
+    }
+
+    @Test
+    public void testRepairingPrefix() throws Exception {
+
+        try {
+
+            // repair namespaces
+            // use new XMLOutputFactory as changing its property settings
+            XMLOutputFactory xof = XMLOutputFactory.newInstance();
+            xof.setProperty(xof.IS_REPAIRING_NAMESPACES, new Boolean(true));
+            XMLStreamWriter w = xof.createXMLStreamWriter(System.out);
+
+            // here I'm trying to write
+            // <bar xmlns="foo" />
+            w.writeStartDocument();
+            w.writeStartElement("foo", "bar");
+            w.writeDefaultNamespace("foo");
+            w.writeCharacters("---");
+            w.writeEndElement();
+            w.writeEndDocument();
+            w.close();
+
+            // Expected success
+            System.out.println("Expected success.");
+        } catch (Exception exception) {
+            // Unexpected Exception
+            String FAIL_MSG = "Unexpected Exception: " + exception.toString();
+            System.err.println(FAIL_MSG);
+            Assert.fail(FAIL_MSG);
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/WriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/WriterTest.java
new file mode 100644
index 00000000000..05f777d9327
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/WriterTest.java
@@ -0,0 +1,780 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.LineNumberReader;
+import java.io.Reader;
+import java.net.URL;
+import java.util.Iterator;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XMLStreamWriter functionality.
+ */
+public class WriterTest {
+
+    final String ENCODING = "UTF-8";
+    XMLOutputFactory outputFactory = null;
+    XMLInputFactory inputFactory = null;
+    XMLStreamWriter xtw = null;
+    String[] files = new String[] { "testOne.xml", "testTwo.xml", "testThree.xml", "testFour.xml", "testFive.xml", "testSix.xml", "testSeven.xml",
+            "testEight.xml", "testNine.xml", "testTen.xml", "testEleven.xml", "testTwelve.xml", "testDefaultNS.xml", null, "testFixAttr.xml" };
+
+    String output = "";
+
+    @BeforeMethod
+    protected void setUp() {
+        try {
+            outputFactory = XMLOutputFactory.newInstance();
+            inputFactory = XMLInputFactory.newInstance();
+        } catch (Exception ex) {
+            Assert.fail("Could not create XMLInputFactory");
+        }
+    }
+
+    @AfterMethod
+    protected void tearDown() {
+        outputFactory = null;
+        inputFactory = null;
+    }
+
+    @Test
+    public void testOne() {
+
+        System.out.println("Test StreamWriter with out any namespace functionality");
+
+        try {
+            String outputFile = files[0] + ".out";
+            System.out.println("Writing output to " + outputFile);
+
+            xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+            xtw.writeStartDocument("utf-8", "1.0");
+            xtw.writeStartElement("elmeOne");
+            xtw.writeStartElement("elemTwo");
+            xtw.writeStartElement("elemThree");
+            xtw.writeStartElement("elemFour");
+            xtw.writeStartElement("elemFive");
+            xtw.writeEndDocument();
+            xtw.flush();
+            xtw.close();
+
+            Assert.assertTrue(checkResults(files[0] + ".out", files[0] + ".org"));
+
+        } catch (Exception ex) {
+            Assert.fail("testOne Failed " + ex);
+            ex.printStackTrace();
+        }
+
+    }
+
+    @Test
+    public void testTwo() {
+
+        System.out.println("Test StreamWriter's Namespace Context");
+
+        try {
+            String outputFile = files[1] + ".out";
+            System.out.println("Writing output to " + outputFile);
+
+            xtw = outputFactory.createXMLStreamWriter(System.out);
+            xtw.writeStartDocument();
+            xtw.writeStartElement("elemTwo");
+            xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+            xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+            xtw.writeEndDocument();
+            NamespaceContext nc = xtw.getNamespaceContext();
+            // Got a Namespace Context.class
+
+            XMLStreamWriter xtw1 = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+
+            xtw1.writeComment("all elements here are explicitly in the HTML namespace");
+            xtw1.setNamespaceContext(nc);
+            xtw1.writeStartDocument("utf-8", "1.0");
+            xtw1.setPrefix("htmlOne", "http://www.w3.org/TR/REC-html40");
+            NamespaceContext nc1 = xtw1.getNamespaceContext();
+            xtw1.close();
+            Iterator it = nc1.getPrefixes("http://www.w3.org/TR/REC-html40");
+
+            // FileWriter fw = new FileWriter(outputFile);
+            while (it.hasNext()) {
+                System.out.println("Prefixes :" + it.next());
+                // fw.write((String)it.next());
+                // fw.write(";");
+            }
+            // fw.close();
+            // assertTrue(checkResults(testTwo+".out", testTwo+".org"));
+            System.out.println("Done");
+        } catch (Exception ex) {
+            Assert.fail("testTwo Failed " + ex);
+            ex.printStackTrace();
+        }
+
+    }
+
+    @Test
+    public void testThree() {
+
+        System.out.println("Test StreamWriter for proper element sequence.");
+
+        try {
+            String outputFile = files[2] + ".out";
+            System.out.println("Writing output to " + outputFile);
+
+            xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+            xtw.writeStartDocument("utf-8", "1.0");
+            xtw.writeStartElement("elmeOne");
+            xtw.writeStartElement("elemTwo");
+            xtw.writeEmptyElement("emptyElem");
+            xtw.writeStartElement("elemThree");
+            xtw.writeStartElement("elemFour");
+            xtw.writeStartElement("elemFive");
+            xtw.writeEndDocument();
+            xtw.flush();
+            xtw.close();
+
+            Assert.assertTrue(checkResults(files[2] + ".out", files[2] + ".org"));
+
+        } catch (Exception ex) {
+            Assert.fail("testThree Failed " + ex);
+            ex.printStackTrace();
+        }
+
+    }
+
+    @Test
+    public void testFour() {
+
+        System.out.println("Test StreamWriter with elements,attribute and element content.");
+
+        try {
+
+            String outputFile = files[3] + ".out";
+            System.out.println("Writing output to " + outputFile);
+
+            xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+            xtw.writeStartDocument("utf-8", "1.0");
+            xtw.writeStartElement("elmeOne");
+            xtw.writeStartElement("elemTwo");
+            xtw.writeEmptyElement("emptyElem");
+            xtw.writeAttribute("testAttr", "testValue");
+            xtw.writeStartElement("elemThree");
+            xtw.writeStartElement("elemFour");
+            xtw.writeCharacters("TestCharacterData");
+            xtw.writeStartElement("elemFive");
+            xtw.writeEndDocument();
+            xtw.flush();
+            xtw.close();
+
+            Assert.assertTrue(checkResults(files[3] + ".out", files[3] + ".org"));
+
+        } catch (Exception ex) {
+            Assert.fail("testFour Failed " + ex);
+            ex.printStackTrace();
+        }
+
+    }
+
+    @Test
+    public void testFive() {
+
+        System.out.println("Test StreamWriter's Namespace Context.");
+
+        try {
+
+            String outputFile = files[4] + ".out";
+            System.out.println("Writing output to " + outputFile);
+
+            xtw = outputFactory.createXMLStreamWriter(System.out);
+            xtw.writeStartDocument();
+            xtw.writeStartElement("elemTwo");
+            xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+            xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+            // xtw.writeEndDocument();
+            NamespaceContext nc = xtw.getNamespaceContext();
+            // Got a Namespace Context.class
+
+            xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+
+            xtw.writeComment("all elements here are explicitly in the HTML namespace");
+            xtw.setNamespaceContext(nc);
+            xtw.writeStartDocument("utf-8", "1.0");
+            // xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+            // xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+            xtw.writeCharacters("Frobnostication");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+            xtw.writeCharacters("Moved to");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+            xtw.writeAttribute("href", "http://frob.com");
+
+            xtw.writeCharacters("here");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeEndElement();
+
+            xtw.writeEndDocument();
+            xtw.flush();
+            xtw.close();
+            Assert.assertTrue(checkResults(files[4] + ".out", files[4] + ".org"));
+            System.out.println("Done");
+        } catch (Exception ex) {
+            Assert.fail("testFive Failed " + ex);
+            ex.printStackTrace();
+        }
+
+    }
+
+    @Test
+    public void testSix() {
+
+        System.out.println("Test StreamWriter, uses the Namespace Context set by the user to resolve namespaces.");
+
+        try {
+
+            String outputFile = files[5] + ".out";
+            System.out.println("Writing output to " + outputFile);
+
+            xtw = outputFactory.createXMLStreamWriter(System.out);
+            xtw.writeStartDocument();
+            xtw.writeStartElement("elemTwo");
+            xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+            xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+            xtw.writeEndDocument();
+            NamespaceContext nc = xtw.getNamespaceContext();
+            // Got a Namespace Context information.
+
+            xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+
+            xtw.writeComment("all elements here are explicitly in the HTML namespace");
+            xtw.setNamespaceContext(nc);
+            xtw.writeStartDocument("utf-8", "1.0");
+            xtw.setPrefix("htmlNewPrefix", "http://www.w3.org/TR/REC-html40");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+            // xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+            xtw.writeCharacters("Frobnostication");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+            xtw.writeCharacters("Moved to");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+            xtw.writeAttribute("href", "http://frob.com");
+
+            xtw.writeCharacters("here");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeEndElement();
+
+            xtw.writeEndDocument();
+            xtw.flush();
+            xtw.close();
+            Assert.assertTrue(checkResults(files[5] + ".out", files[5] + ".org"));
+            System.out.println("Done");
+        } catch (Exception ex) {
+            Assert.fail("testSix Failed " + ex);
+            ex.printStackTrace();
+        }
+
+    }
+
+    @Test
+    public void testSeven() {
+
+        System.out.println("Test StreamWriter supplied with correct namespace information");
+
+        try {
+
+            String outputFile = files[6] + ".out";
+            System.out.println("Writing output to " + outputFile);
+
+            xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+            xtw.writeComment("all elements here are explicitly in the HTML namespace");
+            xtw.writeStartDocument("utf-8", "1.0");
+            xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+            xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+            xtw.writeCharacters("Frobnostication");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+            xtw.writeCharacters("Moved to");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+            xtw.writeAttribute("href", "http://frob.com");
+
+            xtw.writeCharacters("here");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeEndElement();
+
+            xtw.writeEndDocument();
+            xtw.flush();
+            xtw.close();
+            Assert.assertTrue(checkResults(files[6] + ".out", files[6] + ".org"));
+            System.out.println("Done");
+        } catch (Exception ex) {
+            Assert.fail("testSeven Failed " + ex);
+            ex.printStackTrace();
+        }
+
+    }
+
+    @Test
+    public void testEight() {
+
+        System.out.println("Test StreamWriter supplied with correct namespace information and" + "isRepairingNamespace is set to true.");
+
+        try {
+
+            String outputFile = files[7] + ".out";
+            System.out.println("Writing output to " + outputFile);
+            outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+            xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+            xtw.writeComment("all elements here are explicitly in the HTML namespace");
+            xtw.writeStartDocument("utf-8", "1.0");
+            xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+            xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+            xtw.writeCharacters("Frobnostication");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+            xtw.writeCharacters("Moved to");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+            xtw.writeAttribute("href", "http://frob.com");
+
+            xtw.writeCharacters("here");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeEndElement();
+
+            xtw.writeEndDocument();
+            xtw.flush();
+            xtw.close();
+            // check against testSeven.xml.org
+            Assert.assertTrue(checkResults(files[7] + ".out", files[7] + ".org"));
+            System.out.println("Done");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail("testEight Failed " + ex);
+
+        }
+
+    }
+
+    @Test
+    public void testNine() {
+
+        System.out.println("Test StreamWriter supplied with correct namespace information and" + "isRepairingNamespace is set to true."
+                + "pass namespace information using" + "writenamespace function");
+
+        try {
+
+            String outputFile = files[8] + ".out";
+            System.out.println("Writing output to " + outputFile);
+            outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+            xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+            xtw.writeComment("all elements here are explicitly in the HTML namespace");
+            xtw.writeStartDocument("utf-8", "1.0");
+            // xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+            xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+            xtw.writeCharacters("Frobnostication");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+            xtw.writeCharacters("Moved to");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+            xtw.writeAttribute("href", "http://frob.com");
+
+            xtw.writeCharacters("here");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeEndElement();
+
+            xtw.writeEndDocument();
+            xtw.flush();
+            xtw.close();
+            // check against testSeven.xml.org
+            Assert.assertTrue(checkResults(files[8] + ".out", files[7] + ".org"));
+            System.out.println("Done");
+        } catch (Exception ex) {
+            Assert.fail("testNine Failed " + ex);
+            ex.printStackTrace();
+        }
+
+    }
+
+    @Test
+    public void testTen() {
+
+        System.out.println("Test StreamWriter supplied with no namespace information and" + "isRepairingNamespace is set to true.");
+        try {
+
+            String outputFile = files[9] + ".out";
+            System.out.println("Writing output to " + outputFile);
+            outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+            xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+            xtw.writeComment("all elements here are explicitly in the HTML namespace");
+            xtw.writeStartDocument("utf-8", "1.0");
+            // xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+            // xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+            xtw.writeCharacters("Frobnostication");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+            xtw.writeCharacters("Moved to");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+            xtw.writeAttribute("href", "http://frob.com");
+
+            xtw.writeCharacters("here");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeEndElement();
+
+            xtw.writeEndDocument();
+            xtw.flush();
+            xtw.close();
+            // check against testSeven.xml.org
+            // prefix is generated while it was defined in the 'org' file, the
+            // following comparison method needs a rewrite.
+            // assertTrue(checkResults(files[9]+".out",files[7]+".org"));
+            System.out.println("Done");
+        } catch (Exception ex) {
+            Assert.fail("testTen Failed " + ex);
+            ex.printStackTrace();
+        }
+
+    }
+
+    @Test
+    public void testEleven() {
+
+        System.out.println("Test StreamWriter supplied with  namespace information passed through startElement and" + "isRepairingNamespace is set to true.");
+        try {
+
+            String outputFile = files[10] + ".out";
+            System.out.println("Writing output to " + outputFile);
+            outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+            xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+            xtw.writeComment("all elements here are explicitly in the HTML namespace");
+            xtw.writeStartDocument("utf-8", "1.0");
+            // xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+            xtw.writeStartElement("html", "html", "http://www.w3.org/TR/REC-html40");
+            // xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+            xtw.writeCharacters("Frobnostication");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+            xtw.writeCharacters("Moved to");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+            xtw.writeAttribute("href", "http://frob.com");
+
+            xtw.writeCharacters("here");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeEndElement();
+
+            xtw.writeEndDocument();
+            xtw.flush();
+            xtw.close();
+            // check against testSeven.xml.org
+            Assert.assertTrue(checkResults(files[10] + ".out", files[7] + ".org"));
+            System.out.println("Done");
+        } catch (Exception ex) {
+            Assert.fail("testEleven Failed " + ex);
+            ex.printStackTrace();
+        }
+
+    }
+
+    @Test
+    public void testTwelve() {
+
+        System.out.println("Test StreamWriter supplied with  namespace information set at few places");
+
+        try {
+
+            String outputFile = files[11] + ".out";
+            System.out.println("Writing output to " + outputFile);
+            outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+            xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+            xtw.writeComment("all elements here are explicitly in the HTML namespace");
+            xtw.writeStartDocument("utf-8", "1.0");
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+            // xtw.writeNamespace("html", "http://www.w3.org/TR/REC-html40");
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+            xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+            xtw.writeCharacters("Frobnostication");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+            xtw.writeCharacters("Moved to");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+            xtw.writeAttribute("href", "http://frob.com");
+
+            xtw.writeCharacters("here");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeEndElement();
+
+            xtw.writeEndDocument();
+            xtw.flush();
+            xtw.close();
+            // check against testSeven.xml.org
+            // assertTrue(checkResults(files[10]+".out",files[7]+".org"));
+            System.out.println("Done");
+        } catch (Exception ex) {
+            Assert.fail("testtwelve Failed " + ex);
+            ex.printStackTrace();
+        }
+
+    }
+
+    @Test
+    public void testDefaultNamespace() {
+
+        System.out.println("Test StreamWriter supplied with  namespace information set at few places");
+
+        try {
+
+            String outputFile = files[12] + ".out";
+            System.out.println("Writing output to " + outputFile);
+            outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+            xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+            xtw.writeComment("all elements here are explicitly in the HTML namespace");
+            xtw.writeStartDocument("utf-8", "1.0");
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "html");
+            xtw.writeDefaultNamespace("http://www.w3.org/TR/REC-html40");
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+            // xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+            xtw.writeCharacters("Frobnostication");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+            xtw.writeCharacters("Moved to");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+            xtw.writeAttribute("href", "http://frob.com");
+
+            xtw.writeCharacters("here");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeEndElement();
+
+            xtw.writeEndDocument();
+            xtw.flush();
+            xtw.close();
+            // check against testSeven.xml.org
+            // assertTrue(checkResults(files[10]+".out",files[7]+".org"));
+            System.out.println("Done");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail("testDefaultNamespace Failed " + ex);
+
+        }
+
+    }
+
+    @Test
+    public void testRepairNamespace() {
+
+        System.out.println("Test StreamWriter supplied with  namespace information set at few places");
+
+        try {
+
+            String outputFile = files[14] + ".out";
+            System.out.println("Writing output to " + outputFile);
+            outputFactory.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES, new Boolean(true));
+            xtw = outputFactory.createXMLStreamWriter(new FileOutputStream(outputFile), ENCODING);
+            xtw.writeComment("all elements here are explicitly in the HTML namespace");
+            xtw.writeStartDocument("utf-8", "1.0");
+            xtw.writeStartElement("html", "html", "http://www.w3.org/TR/REC-html40");
+            // xtw.writeStartElement("http://www.w3.org/TR/REC-html40","html");
+            // xtw.writeDefaultNamespace("http://www.w3.org/TR/REC-html40");
+            xtw.writeAttribute("html", "testPrefix", "attr1", "http://frob.com");
+            xtw.writeAttribute("html", "testPrefix", "attr2", "http://frob2.com");
+            xtw.writeAttribute("html", "http://www.w3.org/TR/REC-html40", "attr4", "http://frob4.com");
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "head");
+            xtw.setPrefix("html", "http://www.w3.org/TR/REC-html40");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "title");
+
+            xtw.writeCharacters("Frobnostication");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "body");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "p");
+            xtw.writeCharacters("Moved to");
+            xtw.writeStartElement("http://www.w3.org/TR/REC-html40", "a");
+            xtw.writeAttribute("href", "http://frob.com");
+
+            xtw.writeCharacters("here");
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+            xtw.writeEndElement();
+
+            xtw.writeEndElement();
+
+            xtw.writeEndDocument();
+            xtw.flush();
+            xtw.close();
+            // check against testSeven.xml.org
+            // assertTrue(checkResults(files[10]+".out",files[7]+".org"));
+            System.out.println("Done");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail("testDefaultNamespace Failed " + ex);
+
+        }
+
+    }
+
+    protected boolean checkResults(String checkFile, String orgFile) {
+        try {
+            URL fileName = WriterTest.class.getResource(orgFile);
+            // URL outputFileName = WriterTest.class.getResource(checkFile);
+            return compareOutput(new InputStreamReader(fileName.openStream()), new InputStreamReader(new FileInputStream(checkFile)));
+
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail(ex.getMessage());
+        }
+        return false;
+    }
+
+    protected boolean compareOutput(Reader expected, Reader actual) throws IOException {
+        LineNumberReader expectedOutput = null;
+        LineNumberReader actualOutput = null;
+        try {
+            expectedOutput = new LineNumberReader(expected);
+            actualOutput = new LineNumberReader(actual);
+
+            while (expectedOutput.ready() && actualOutput.ready()) {
+                String expectedLine = expectedOutput.readLine();
+                String actualLine = actualOutput.readLine();
+                if (!expectedLine.equals(actualLine)) {
+                    System.out.println("Entityreference expansion failed, line no: " + expectedOutput.getLineNumber());
+                    System.out.println("Expected: " + expectedLine);
+                    System.out.println("Actual  : " + actualLine);
+                    return false;
+                }
+            }
+            return true;
+        } catch (IOException ex) {
+            System.err.println("Error  occured while comparing results.");
+            throw ex;
+        } finally {
+            expectedOutput.close();
+            actualOutput.close();
+
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/XMLStreamWriterTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/XMLStreamWriterTest.java
new file mode 100644
index 00000000000..4fa782130f9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/XMLStreamWriterTest.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.stream.XMLStreamWriterTest;
+
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6347190
+ * @summary Test StAX Writer won't insert comment into element inside.
+ */
+public class XMLStreamWriterTest {
+
+    @BeforeMethod
+    protected void setUp() throws Exception {
+    }
+
+    @AfterMethod
+    protected void tearDown() throws Exception {
+    }
+
+    /**
+     * Test of main method, of class TestXMLStreamWriter.
+     */
+    @Test
+    public void testWriteComment() {
+        try {
+            String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><a:html href=\"http://java.sun.com\"><!--This is comment-->java.sun.com</a:html>";
+            XMLOutputFactory f = XMLOutputFactory.newInstance();
+            // f.setProperty(XMLOutputFactory.IS_REPAIRING_NAMESPACES,
+            // Boolean.TRUE);
+            StringWriter sw = new StringWriter();
+            XMLStreamWriter writer = f.createXMLStreamWriter(sw);
+            writer.writeStartDocument("UTF-8", "1.0");
+            writer.writeStartElement("a", "html", "http://www.w3.org/TR/REC-html40");
+            writer.writeAttribute("href", "http://java.sun.com");
+            writer.writeComment("This is comment");
+            writer.writeCharacters("java.sun.com");
+            writer.writeEndElement();
+            writer.writeEndDocument();
+            writer.flush();
+            sw.flush();
+            StringBuffer sb = sw.getBuffer();
+            System.out.println("sb:" + sb.toString());
+            Assert.assertTrue(sb.toString().equals(xml));
+        } catch (Exception ex) {
+            Assert.fail("Exception: " + ex.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/message_12.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/message_12.xml
new file mode 100644
index 00000000000..6dd4c28a0a0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/message_12.xml
@@ -0,0 +1,287 @@
+      <S:Envelope xmlns:S="http://www.w3.org/2003/05/soap-envelope">
+      <S:Header>
+      <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" S:mustUnderstand="1">
+      <wsu:Timestamp xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="3">
+      <wsu:Created>2006-07-20T22:57:12Z</wsu:Created>
+      <wsu:Expires>2006-07-20T23:02:12Z</wsu:Expires>
+      </wsu:Timestamp>
+      <Assertion xmlns="urn:oasis:names:tc:SAML:1.0:assertion" xmlns:ns2="http://www.w3.org/20
+00/09/xmldsig#" xmlns:ns3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext
+-1.0.xsd" xmlns:ns4="http://www.w3.org/2005/08/addressing" xmlns:ns5="http://schemas.xmlsoap.org/ws/
+2005/02/sc" xmlns:ns6="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsu="http://docs.oasis-op
+en.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:xs="http://www.w3.org/2001/XML
+Schema" AssertionID="uuid-96df98ce-5d8e-4855-a4ab-3232ca88e6df" IssueInstant="2006-07-20T15:57:09.99
+6-07:00" Issuer="TestSTS" MajorVersion="1" MinorVersion="1">
+      <Conditions NotBefore="2006-07-20T15:57:09.996-07:00" NotOnOrAfter="2006-07-20T15:57:45.
+996-07:00"></Conditions>
+      <Advice></Advice>
+      <AttributeStatement>
+      <Subject>
+      <NameIdentifier>principal</NameIdentifier>
+      <SubjectConfirmation>
+      <ConfirmationMethod>urn:oasis:names:tc:SAML:1.0:cm:holder-of-key</ConfirmationMethod>
+      <ns2:KeyInfo>
+      <xenc:EncryptedKey xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
+      <xenc:EncryptionMethod xmlns="" xmlns:ns4="urn:oasis:names:tc:SAML:1.0:assertion" Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"></xenc:EncryptionMethod>
+      <ns2:KeyInfo>
+      <ns3:SecurityTokenReference xmlns:ns5="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:ns6="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ns8
+="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:ns9="http://schemas.xmlsoap.org/ws/2004/09/policy">
+      <ns3:KeyIdentifier xmlns="" xmlns:ns10="urn:oasis:names:tc:SAML:1.0:assertion" ValueType
+="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier">Xeg55vRyK3ZhAEhEf+YT0z986L0=</ns3:KeyIdentifier></ns3:SecurityTokenReference>
+      </ns2:KeyInfo>
+      <xenc:CipherData>
+      <xenc:CipherValue>sPVCOcRVBGYDmnBAjnxoe5LfqAumazmxygPnFbSxGL35e90e1KurbODwNj5fmHxz9CkwAf8VQL8U
+      ESF3jDRbew4EbdE726uRFKGhK8Xt5G3Mzwo8PCxIcLKmxwwJYc3tpXaE94x937YLzv+Rp6i+sfPe
+      7aNcDTMuQUmmDMujQcM=</xenc:CipherValue></xenc:CipherData></xenc:EncryptedKey></ns2:KeyInfo></SubjectConfirmation></Subject>
+      <Attribute AttributeName="name" AttributeNamespace="http://sun.com">
+      <AttributeValue xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="xs:string">value</AttributeValue></Attribute></AttributeStatement>
+      <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+      <ds:SignedInfo>
+      <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:CanonicalizationMethod>
+      <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"></ds:SignatureMethod>
+      <ds:Reference URI="#uuid-96df98ce-5d8e-4855-a4ab-3232ca88e6df">
+      <ds:Transforms>
+      <ds:Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"></ds:Transform>
+      <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"></ds:Transform></ds:Transforms>
+      <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"></ds:DigestMethod>
+      <ds:DigestValue>+6+meGLSaVyDUa0jzlDJaRTyuCI=</ds:DigestValue></ds:Reference></ds:SignedInfo>
+      <ds:SignatureValue>X0kmFj+HnmVgC71G69wsfSHS7bQ2E+bFl0lLg7McFAcQW8GVFv/ekHpctySndRPLVFiu1AnRcPM5
+      t/uRwQmbov6T0lJwP09rcgxwPVKPVycFHM8HLNOFA5L2MNpqGuKDSOyOXLDqba32BTxLGFyaJzCx
+      M/mH3WaZgiRDkWaeYUw=</ds:SignatureValue>
+      <ds:KeyInfo>
+      <wsse:SecurityTokenReference>
+      <wsse:KeyIdentifier EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-20
+0401-wss-x509-token-profile-1.0#X509SubjectKeyIdentifier">G9QGBPj/Lnv/Km4FCTiqMg1xamk=</wsse:KeyIdentifier>
+      </wsse:SecurityTokenReference></ds:KeyInfo></ds:Signature></Assertion>
+      <wsc:DerivedKeyToken xmlns:wsc="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="XWSSGID-115
+3436232269143755810">
+      <ns3:SecurityTokenReference xmlns:ns3="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns="http://schemas.xmlsoap.org/ws/2005/02/trust" xmlns:ns2="htt
+p://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" xmlns:ns4="http://www.w3.org/2005/08/addressing" xmlns:ns5="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:ns6="http:/
+/schemas.xmlsoap.org/ws/2004/09/policy">
+      <ns3:KeyIdentifier ValueType="http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.0#SAMLAssertionID">uuid-96df98ce-5d8e-4855-a4ab-3232ca88e6df</ns3:KeyIdentifier>
+      </ns3:SecurityTokenReference>
+      <wsc:Offset>0</wsc:Offset>
+      <wsc:Length>24</wsc:Length>
+      <wsc:Nonce>1NJRlYY/gA54WTvInE3VuJ13</wsc:Nonce>
+      </wsc:DerivedKeyToken>
+      <xenc:EncryptedKey xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Id="XWSSGID-1153436232
+219-1223114149">
+      <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#rsa-oaep-mgf1p"/>
+      <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+      <wsse:SecurityTokenReference>
+      <wsse:KeyIdentifier EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-ws
+s-soap-message-security-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/oasis-wss-soap-m
+essage-security-1.1#ThumbprintSHA1">NQM0IBvuplAtETQvk+6gn8C13wE=</wsse:KeyIdentifier>
+      </wsse:SecurityTokenReference>
+      </ds:KeyInfo>
+      <xenc:CipherData>
+      <xenc:CipherValue>NHjIM/BMwNP+XSrgyCE1MKYxwNoqSMX5WEVxABsyUzveDJr8kEmYdlXE4GiWsnJpuxHrYm
+437yIq
+      Qjn/xR9TZI/iOvrM+f1JkeLBRtvl83ZrB6tfEIhH+hXUeOddx+LX0uQAIsamJL+chNS4V4inojsE
+      00uFjPnq8JoJ9lI5nmA=</xenc:CipherValue>
+      </xenc:CipherData>
+      </xenc:EncryptedKey>
+      <wsc:DerivedKeyToken xmlns:wsc="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:wsu="htt
+p://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="XWSSGID-115
+3436232279-1717841759">
+      <wsse:SecurityTokenReference>
+      <wsse:Reference URI="#XWSSGID-1153436232219-1223114149" ValueType="http://docs.oasis-ope
+n.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKey"/>
+      </wsse:SecurityTokenReference>
+      <wsc:Offset>0</wsc:Offset>
+      <wsc:Length>32</wsc:Length>
+      <wsc:Nonce>FXNiOAEmn2Ndwvy3y5+/RJDM</wsc:Nonce>
+      </wsc:DerivedKeyToken>
+      <xenc:ReferenceList xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
+      <xenc:DataReference URI="#XWSSGID-11534362322891411385080"/>
+      <xenc:DataReference URI="#XWSSGID-11534362322791556489723"/>
+      </xenc:ReferenceList>
+      <wsc:DerivedKeyToken xmlns:wsc="http://schemas.xmlsoap.org/ws/2005/02/sc" xmlns:wsu="htt
+p://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="XWSSGID-115
+3436232209273494521">
+      <wsse:SecurityTokenReference>
+      <wsse:Reference URI="#XWSSGID-1153436232219-1223114149" ValueType="http://docs.oasis-ope
+n.org/wss/oasis-wss-soap-message-security-1.1#EncryptedKey"/>
+      </wsse:SecurityTokenReference>
+      <wsc:Offset>0</wsc:Offset>
+      <wsc:Length>24</wsc:Length>
+      <wsc:Nonce>cEhhCfrmBzyXdkkBxxHNp+0b</wsc:Nonce>
+      </wsc:DerivedKeyToken>
+      <xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Id="XWSSGID-115343623
+22891411385080" Type="http://www.w3.org/2001/04/xmlenc#Element">
+          <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc"/>
+          <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+      <wsse:SecurityTokenReference>
+      <wsse:Reference URI="#XWSSGID-1153436232279-1717841759"/>
+      </wsse:SecurityTokenReference>
+      </ds:KeyInfo>
+          <xenc:CipherData>
+      <xenc:CipherValue>6WZAPXqUx+Lx4T3o13a4DaZtf6iPmNEKNO997ZSfw9JafTnn/3L5VOU3tpAm/BfYODiR1C
+TSt/7V
+      JHVIMauBz/KE3ZjDKED33XR0jVWAMifNXMtcd4+tTYr8JWfT0aHGFuKXZlK1WdOI+4o7O5zHVcEP
+      b0O117p10DROF9tdQHQsmUJBiUcyMwCvY7LsFECRN6Ur9EKkkv8GR6ux4zuYcEFmLGWHVwywINAj
+      RFeLrtNtaV3ScB/eb1tnkvjEsqXJ+/H2o0saYgRShwQLR2+/3w0vCz4Hxd2PsU9yLi3AeeNApIzV
+      7/GFrFRIFA1PMwFn+CUID96wqb1GgZ+E+kwi/5VnTxQp+Frr+GWMGhBNqiEfy5m1GkeRXZyiWENl
+      3XUwChS59D/PB2ey6ioPOqyl7m2DuMfFLzJkYBPHiFpvyRYMxBafm3NMl+W9C+hIfVfCym7PpMAH
+      nlUz7oEKKtjjxgNBM+UWtr5DqQC3WKXDhOhZqomDRflshKkrjA+Xkxz+D4S44CK4nxGuHbesy4Tn
+      FutOWmfOvP5C3K9athS44nwm2kY7h+TrM4gs35RBMDrPFcrJGclA9umT2Ph2XvqDO/pQSQqV4r0X
+      pqwikAajgTKty3SJmHAhF2+ONB3ufdrlyJwM7fGIf2bGCCXbB4s6QrO6+8EvOZo/wk6uWnVj7t5F
+      meWNHCmhsnzPhlqnD6/OPxxWpG4UROfS6XbcHAnAbzSNpLPuxtdGILzBNSHB1r/Va3dGsae72ZtV
+      ULiJ+jVClNpxWhBsGUM1s9CXJN7uH5HIp/0cHh2X4OK80sReyqTMTiV+4/BYBZU6rJAIdI1GJLqB
+      p1mwaKzNR/IkwtCuMsua1IVJScGsGACppEa4g0fZhWr8D88Kc5UbqCgFuSddtONqFhDLYaSxjmgA
+      sT2CT+JLCPnPgb2KY6cqaNoceP3D6HyuvHU8B1/vJksjYmrZdeDCW5HZlIg3udK/OWY6xMgU6WP3
+      R7ZoENrmS7RyCRhdVpGMjFvNmxfTSWKyZ/Yf+xhXBWwG0k4K7cp5HL/kBTVNhLRACHk9aNGJf/V0
+      KK5eR61vLUE/bja5LwjKpmoFU5Y1S5sBxkaY623VlpHDBo8DRfNVcEYX3LRvf+Lxt7NX3Lvc3qxg
+      qrr1zWUznjOM81dcF1CxQWj4sPKIHFON7vVRkiUxA2V/py7yTKPlYofSr4KYF4Jye5GlROLVBucf
+      5eswQH8t7iHvJmnX+PF7blil0L5N8igi1uS7kzTeJsbcfxYh08elNUCZTb6x5/X9CjQ4zxsAaRFB
+      4ZaCog3Hj+jyh8pZl3iCmTm9qFwLF3CtA69VVtFZRtLBz6qsK+UwzG6u8RRDlvXSO2Bt5TcCG+mD
+      dfXCPILtPSaJvQykZFT+qirs2Fq1b9xTBjWtMZTCHJkuKFr+F61RZZiQRpw7mVyO+90yVA2i+bfk
+      ELMCPyL8Dg5MGUCDytPelRNziWAXkW1C7NK+iMv+tunkg/M/tSMlDM7a0GOZodwn0ls8Fa3Jx3Xm
+      aNLXDKZai9waq1LF/Waka9mo15y2y858Swb7/HdGOcXeLh1Ym1HFLEzjjYxSiaDYPHZMxPcC8OY9
+      Yva5ufMt09jBsOiOuiKS8I570A5jTV32xAFjEMQ8oSt4L/6J9Pb8ov6kjUCJxZGAkiMkg3o37BQl
+      fSTqq5vVAq72dFSa0jWroHLOmM0pfrqJ8uI6Y/5w6WD1WfMh11YFxJQJF6c92mPQVijPHZHQlVC0
+      7+9EaOC2KAc1fOCoeRS7QBCM6wWWVznFrkbhLi/p3c8QUzRuocL4vYv/aJWLeRBSjQbX/QtIliEx
+      fITDI0qt1cwjVxqfonvG5tNhelK8KijEH3x7bJ4GCYd4vl3p0+5u+rr3A0i7kEOxsrprOFJieSQ7
+      QBvv+hJeF/px+7vhjLYbYwfKq0Hi5R9rMYiXAHWB7JUJUAubYeKy+i/urkfuhaZJilgX20eLspGA
+      LO39AvHOc2ZXXO+HiH0qgUjMF/RS3GVXmiZg+r3LRviwuhcS5AUI1ZfXaoCNBi7Gyg/adUy9PQKJ
+      qjpbzdklY7PCVlt8bnXyrSpRuUwWbHyLVY1r4A/Qor2d2vXKkAZsYsLrKYieAMbgXSUcpiJmOfFn
+      jhELCkAONNyA86yLCi4gLElFkqkrEYowBLo3scQ+/x/718Gj49RCseebBbZtOc6Gr43ibhfjv1ph
+      QjMZv3fZaybxIULGum7tUQBZ/r67C3C6QYuW/KV/t/kV5oTk5N21BaMEBHYLBJIQFBgA3xpFpKfs
+      Tcaw8bW2UdHK4aC7Wo28K8RckCmcqX3KMStxzmVUWrOyLOrWLsL4Ul0AewFXy3mRTY0RIFy3WVgr
+      /BTIg+h5BePTzLMCwkScpGVrqQ8sdljbrD+PO40Hq+YQzkX7RVUvUUFK2+eQunscRPGHWk3PT1J5
+      JaDH5u8dvbx5lOqiMHYRof4GHgKS/PI+AalvWQ8ZwS9p6ptoJpoRD0JS+Wl1DFrstWPDgo3OfO9i
+      qMK4qfsJQtBBV40lXJz5OmmlcGqbVS0r6HhkCLh1wd3sAwnNGIf6veGj/x8k8gwEBLwfF8dpva4u
+      CvT3N6i0hWjlN8DCHKrMgE/s6TVIQJ5ZmVUzlwMR4IBFE0iC89YbThm3o63GETVRr+oTQXgNQrhG
+      heJNrfITdG8S6bA1x/JXsGK8J0uGnmyLRQjU9QjF3zJ9ktro7SeNb7OE5MvTaa0wWNqjn8BnmoEF
+      gFtCrBa7nXafGgWY+YIK5t6uJRORbUeRiXVAqSsHD/ETM3bs3waSKYDJqzgN/6vEoQ2MhOHw40tY
+      /szX/IIXt1LrTxiNrIFh9EoocIq8taKcn4Pe0Kv45rImUgOQqRHhx2NWJFpkkdTPiBKPVoGnqJvc
+      xQ4rqMm9BNVewRBoGNZdbqZOcx+RbsPR0ImF42dpo45ExovgbC3Qx28B3abBI8+PUNxe3XT1nMMt
+      A8+zqmWMsTY13j+FL2etx4kZgQ1OTrFLgyGL17+N394SDdLp/aWuXrDVIUVtgV1oBw8h+AEFT51A
+      AXadUu3TnOSpDjAVUooE3dAwmgnGxN+gzjmrdU80i9/xYddDfhtuMSYgHy1hjZ17H8aOUUl4U3p1
+      7QYNdW0OLPQcnWeiiICU93ctovgdwkkssOfcVbmuaEDbCTLF275VURSwSYHcWHaRPOcsur+9WROK
+      5AAIIQ18ac+G5e1eah4s/SCGbVL/3FJi92L1zbL0ycOIiJIDsIjGrz/PP/ITxNBBM7incG5RIfdD
+      vOR/Id4yJd/4VY8jqrNTKp3QEJ+BbSg5f7MpiFy5J4Usv7IpJNs8HM4/JO9J40YGQQ9v4jooOxPK
+      rED8zWonQppM/6VdVf07WCV7BquTurQLv9nixpL6gxreOjjdwBz4OL4SkALXTqrDGB+wgRN2NjmM
+      NTHah6SsekhNknrWx8bESZfnb0ZeVGvnw/cIssoLtDUOPHgE1f7lGTDsxDsjJ+LConImhFXOAVzv
+      77RWjV/UWkhwX6RkTe3p7cbXDfKk16ExJznYWkRUtoU8Ez3yfe5BKliDIbdDfZQr5ozFR+nHkDX9
+      kvwtI49JMGBHMaYW2wk53Mkv3T7siXt/XuNKciiCrsrBIraL6Ms+slb1Y5Eirnw0/sEwAX78uVwa
+      1hjWNRHADL4jnNDGB3wSAFWS3JklMht8kQDJX0k1po9Qypb1/B/2EPKrLRZ0QC2T2ced0/7H9/iT
+      s3Xp8qx8YYFQwSXRO3QozUEnHUlV+CC6YOxU8tzi9n6SYrxlMjezZWlxYybw6JArNY8pU8Nzjmv6
+      4R5mzLbyg99mv0tappIQd3UnZwBmpuHNZnqYoAgXaTtXdbkcWwFXMi98E4BSZkPzYmdiD+kfhf1y
+      swZxjZIb+L/ft9AKBOWMMeq7IrUaPMAlMQeEBW94/IDiI57LokiTqQO8ZLsAp4K978qLlz5f3vuj
+      wvU+v5PUtZOEuCSPzv8lMk2mswk8RF9FR5ATHsHfl7wG7mm6UczQRlDkKiRZi7stznLLy5OOcL6m
+      bBq21ZULx7fkTZssDTafxas/0JOvw38LBjS3wztxQzU4xnrdHAULWe+PRm9AGCvHyWugJrzu09AI
+      FG9M+EqqZYw/NqaKd1k+ucAfUExqUryC4JdnNI5WvQ7DgzgganJtmls/Sc7Yyed/xKGulyJcwnh3
+      3FdpL6ZBFTrAATSnvpmAOBexndu/GjRCvfj70OTdf8rqk2k/48KJlGp3mm5EI8SbemqU+3Ufxc4P
+      Z9pyRo0IhcuyPojZK2KU4B+rfZA29RjA87/Ru/4HNS3MQzkV0Rip3Q6qG7vXnIvcWdtva70EAba/
+      JrKPZcvNI2/ef2K4OIKwiHcck479YERscZ8zEcuC7gQEHnRaefGLDNC6bdUIZXpDha9ZEHhtJU8j
+      L+pwkMruIDnNbm4xIvoQPM34jtrbvsmZCf14RsG0gMwINR7zQnOH42+EpYgysvw0X7heD/EJvov/
+      81n8LaRg54LKgQ6O13mpCeW/lycyJKhm0hegIifWH8sS8EkESRB0SwP/eKqTWurvZKsVgYo6y5Bv
+      IC7DlIIWmpCD0WWbuqops/c6p2qcMPQJm65lU/4rIcez6bgUbcIQXjVjohu/hMTmGuII5nYCR+0a
+      9nWIqorlAQ/eMPejDZw8wNOdvkq1zPKbkgJke6Rg7qmQe4+p8HCMHahL0HKQyiW4vV2CztgoYp0H
+      KDIRGYZvaP3STR2iNVXu+8R4VoSiCroiMlz74qbEhAjg/XKPd/OYUM2rZK61Cmh5db8d7DYw00i0
+      XxmB0OWa920UndlK5uewuK+m8jvfyxYwEflUQEnkiahBFKZik7hqMFdkmh4oyGbSIUda6CA/V33C
+      xpJpZjO27pLI3jukOx4TtmU8MH/l7d0sqvRPRuHFjmsQvCOLIm3NTa4ZOM/4pj3uW53NJkBNx8eE
+      XIBvYY+CxrMblIvLSvGmpUds+8quW46iu/4LFyO2Jp2qK/oYVizcgYSik58mxrdM+sLKZs5FHP4J
+      O6QSV+ySwGKabaWLhB7+1B/oOOl/8lRfvIGGBXUXidextmXCq2r8P5lPgsYgd5Aq0RAalOsQCQhB
+      1UPSsSrZvP4hbHrv4EwKWvRWlOwZUzioag7lijoPUN82sB2aYMB7Mr1dwC3KR8fAydkaMuG+UVEO
+      6JPs23Sp69u8oNizkktrh8rG9J6P8V9Opl0vN1ajvM0jHQHxDHEO8YqBTamMg4UmCfEmsDK4wqmM
+      IrTg0WxwOSNVhHR7FcN5Uk7Hmt3PLeFW4sx6tYFv01LvzoclyWdUS8fxvtC5OCj70A110zdlpb+3
+      2mQ6vL7tphvUB1pBEI/AzsS4REBUZNYM1htlhsn0y3WJg8xyleSNK6lAEzN3DtgozTrgUKxO/d3T
+      xFoXap6D+jK9SILLcab7vLcxOI2k9xdbPbrnWC9BS6OLSm+JVO0mfUuE46qnICREZoUxf9WjnLQ1
+      D7IZ46dQyPYcvwkDuF8gOY+yk7VjiqijFqEDXjQ8qBpzEanzMCMbiv1MEFJNcahtkT7lqTooWokT
+      2SP+TmmcWWfI8PeOkGPC6LbsJu/sKicQAbn11OgYhL3JIob51YD09XH6IxQMfIdlyd4dsQZCQw1y
+      4nOnGjJBzwRwytYloQqOT+mqe0QInb2UyiG1gXPaAFw94/pt1lO2o0bhc5GgYUz+RmxdFiWkZlta
+      071rKmaQYvEfGaLhBXppx+imxfOcvinaTF7GGKdFkhv7AzCEr5ZxtccIZgU07XSkd43zWDO5s2M2
+      MwzOczzt+ZRxcbigUwAULbA2DyNNU9CczfkFqf2At426dEJJWaLwwDb4mieJfh5O6ZL8blORDry6
+      AuWULCrHWj2Uy6o/995P/FvJwu95djJLfTkk6UaCL4pgBYH9wVipbOE1pCHy5/B60OC28uqpo7+t
+      anBmIrxyrb92W8SjfPxIIRB7voSHYoUVvK5nmAr1q1Q+uY1ueCUtBtUB01XKleNe+plvRR19MTEa
+      6jFNo0C/qZBX0F82uQcNerda/rQnXhJULnTbDWr9Rft1GNT3ZRpTxqIP5+DwMD3mneiJjgFM3+Vg
+      +Mrj3trDBTQhQyTk0p+i0Ugz8K+Es8q1wMgbH9PNHuhop3rDFEMM3VfJ7NNtEaTLhSq0Sx30Se4A
+      pT+m/TMTny1g/WEQdMv49A+wslatBjnWXO4cKUHpB2RNtLq4Ms9xlCe1Puy8HySXcGlaJM69Rqmu
+      /sEGUaxwfEq0w6xIyyTFV2a89+M4OC12furqHlSwA439fCEeuxXZggWDq4NNKRQnwB0kSOm3kER0
+      X2xepHxXzahbjTcAVmH9phDW/1Epq8hN6dssslrz3jqRrQO8PmQ6AvxHkPfXjpwHbZf8KjQSeck6
+      x8+a8m09AmN79baCisysWT2M6NVJyTrfo1jqfFzSW8azHaMSACMO0bLu0Oco471xmA048KF+gFzg
+      bAyDKWHpvYm4wS2Qi+ciH1cgMyxXklkiL4pQySmOWLRKs3K7FAyF+5k8mqsrYSLiHtdqFhd1wj+v
+      axcD5vCWEPpy/fD336A27jZKs7hlKrScIxbGEPecVcuzzXYgQOFHV9GMUkNeTUOpvZs0ybVeNGky
+      vrlA3/groJS8Dc2uEv1LJQ1Z+r1dvh57qHMAHVeozL1sEQtVMp7kjT00BHmd56mcvF4PFc1wGR9T
+      Og0X31UzSGI2+LrnJNyM9llLaCdP3hbP8BokcsWKBuIppOGbs5JtfN0745txQ/ULPMH5izc6z6Tf
+      f7W2Q7RW9mbXI+dQ0hTwYWZBEgoqeLFlkR3IzBcr53Ci4eoxYPMZhgDnwjV6DPs=</xenc:CipherValue>
+      </xenc:CipherData>
+          </xenc:EncryptedData>
+      <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#" Id="4">
+      <ds:SignedInfo>
+      <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
+      <InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="wsse S"/>
+      </ds:CanonicalizationMethod>
+      <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#hmac-sha1"/>
+      <ds:Reference URI="#1">
+      <ds:Transforms>
+      <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#">
+      <InclusiveNamespaces xmlns="http://www.w3.org/2001/10/xml-exc-c14n#" PrefixList="ds wsse S"/>
+      </ds:Transform>
+      </ds:Transforms>
+      <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
+      <ds:DigestValue>cHmTDN6hwJkJ7ZQ4K5jfDBX2EAg=</ds:DigestValue>
+      </ds:Reference>
+      </ds:SignedInfo>
+      <ds:SignatureValue>eUX07YDVpq71fQ43a+dqq3Te+V0=</ds:SignatureValue>
+      <ds:KeyInfo>
+      <wsse:SecurityTokenReference>
+      <wsse:Reference URI="#XWSSGID-1153436232269143755810"/>
+      </wsse:SecurityTokenReference>
+      </ds:KeyInfo>
+      </ds:Signature>
+      </wsse:Security>
+      <To xmlns="http://www.w3.org/2005/08/addressing" xmlns:wsu="http://docs.oasis-open.org/w
+ss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="XWSSGID-1153436232219296575118">http
+://131.107.72.15/Security_Federation_FederatedService_Indigo/Symmetric.svc/Scenario_6_IssuedTokenFor
+CertificateSecureConversation_MutualCertificate11</To>
+      <MessageID xmlns="http://www.w3.org/2005/08/addressing" xmlns:wsu="http://docs.oasis-ope
+n.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="XWSSGID-1153436232219-1738014
+962">uuid:85e2ee55-ad08-4f23-9146-de477243f284</MessageID>
+      <ReplyTo xmlns="http://www.w3.org/2005/08/addressing" xmlns:wsu="http://docs.oasis-open.
+org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="XWSSGID-11534362322191988867143
+">
+      <Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
+      </ReplyTo>
+      <Action xmlns="http://www.w3.org/2005/08/addressing" xmlns:wsu="http://docs.oasis-open.o
+rg/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" wsu:Id="XWSSGID-1153436232219414195439">
+http://schemas.xmlsoap.org/ws/2005/02/trust/RST/SCT</Action>
+      </S:Header>
+      <S:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-ut
+ility-1.0.xsd" wsu:Id="XWSSGID-11534362322191212975073">
+      <xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" Id="XWSSGID-115343623
+22791556489723" Type="http://www.w3.org/2001/04/xmlenc#Content">
+          <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#aes256-cbc"/>
+          <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+      <wsse:SecurityTokenReference xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-20
+0401-wss-wssecurity-secext-1.0.xsd">
+      <wsse:Reference URI="#XWSSGID-1153436232279-1717841759"/>
+      </wsse:SecurityTokenReference>
+      </ds:KeyInfo>
+          <xenc:CipherData>
+      <xenc:CipherValue>nLnBkO5jNjQx7cnO4/ven6FmZ6THe73S/V6/tsZdfYuUI7saLrNf/dj/AFBRQhgr949gJ1
+GMuj04
+      +ZJ6ES891qroekDApSF4Bby38Nu5hL6vGLunEMofwyhcReqhTqlvpc4WqzVSQXC4FLudRjBrPGzY
+      2ezbPWSxn68QhsDo1vE9hAoWlPpuyi0TRmSlnn/P1Z0RPzXY4GcYXvwUOohx8TmwmDOeXTbReKXd
+      klpWOdOwjVxprK5UxOPne2K0qvZX9ciRsXJyv7Yt4FAtuT32R2b8aajEsmSB6EdzXCxNVZZw5knw
+      el6rHdJ3dG6lxcT6+IVuk2iHg+jk53I382z2x+hfHv3l7+dJyulfIp2k9XXIcBhyvkWP+1ZWtfeD
+      MzHoPj1JmZG7/NHd20BwNVNKxZwuv/qK09Ok6AoHwOfCwssx3rXKlkBJ+9mvG5SIGnOZ8u1TGfP6
+      7+Dq8cbdOVxbIvvw2N8Pm7/9Jr9oWLvCdmo0QuwLEH7PHzg0NZsPcdkX1Z7zpyZKixFQaXCczF2W
+      yq7hWP12nUw3hTBhA3CYL/Y05Ter/+D6wyBG6KLF0xFksg9Dm7GioGBhgpzY1exu7vbAKohwUJ+H
+      mQlr6cvi6RWcxB6VIMGEnZUKLJK2+F7ym60/gAEbBXQrVp8UndTV/Ut3wJcIisEs7uHZKI7WZUK9
+      Z8sZO4Lcl0ngnTXV5CYGfStw+uVWttJV1kjRkmzLNmYSDYuZ59bLgrKU5duA1OkGX+Q2Kejdc/Sg
+      GU5/wlufV+y2Qamwot0DSPNWAHUWZZSciLSbPSKSkk4FExj1o+ohDfvIRdvt4vXPzTHyEt0gvYh6
+      9vPzgVWsBjeETMTH88VPJoUeC0zfOROqYFHB51hRo7+VzRCsd3Q/ghFY5ai1xr5c5fKjuhcWMFDq
+      Caught Exception: javax.xml.stream.XMLStreamException: xmlns has been already bound to u
+rn:oasis:names:tc:SAML:1.0:assertion. Rebinding it to  is an error
+      fnHGPO5z4Ffv+10rd353oB9d+TVRFItlnDImYY/1Hd5bfKfFeaImxgdE3SfhusDet6edXnnPswHt
+      4h0rpMUHAB1hvGjQFv/YJv/Bxjr0fzNTrY69UUXO9Oqge26+xYGzgM2JBYDTs2Pee48RhkXa8Ee7
+      94WNNKweAtWm3IEoZWrnIyvxTbT3e9Hq07VVNLbak/pDzp1053UE71vv4poGd1eE3ZFZ88+X90tG
+      0F5l9Fi8X3iovnLt4+OeE5XV4FxeLxU8Je/SVb9adEKeRHJS4w6jtepNBrrQQBKLCQaZ3e4NglfL
+      61uf7m+wW+ASpL9a5MfeSw==</xenc:CipherValue>
+      </xenc:CipherData>
+          </xenc:EncryptedData>
+      </S:Body>
+          </S:Envelope>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testEight.xml.org b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testEight.xml.org
new file mode 100644
index 00000000000..31e39cbb959
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testEight.xml.org
@@ -0,0 +1,2 @@
+<!--all elements here are explicitly in the HTML namespace--><?xml version="1.0" encoding="utf-8"?><html:html xmlns:html="http://www.w3.org/TR/REC-html40"><html:head><html:title>Frobnostication</html:title></html:head><html:body><html:p>Moved to<html:a href="http://frob.com">here</html:a></html:p></html:body></html:html>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testFive.xml.org b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testFive.xml.org
new file mode 100644
index 00000000000..30272b09b07
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testFive.xml.org
@@ -0,0 +1,2 @@
+<!--all elements here are explicitly in the HTML namespace--><?xml version="1.0" encoding="utf-8"?><html:html><html:head><html:title>Frobnostication</html:title></html:head><html:body><html:p>Moved to<html:a href="http://frob.com">here</html:a></html:p></html:body></html:html>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testFour.xml.org b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testFour.xml.org
new file mode 100644
index 00000000000..ed5bd1c6339
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testFour.xml.org
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?><elmeOne><elemTwo><emptyElem testAttr="testValue"/><elemThree><elemFour>TestCharacterData<elemFive></elemFive></elemFour></elemThree></elemTwo></elmeOne>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testOne.xml.org b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testOne.xml.org
new file mode 100644
index 00000000000..271766bca52
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testOne.xml.org
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?><elmeOne><elemTwo><elemThree><elemFour><elemFive></elemFive></elemFour></elemThree></elemTwo></elmeOne>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testSeven.xml.org b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testSeven.xml.org
new file mode 100644
index 00000000000..31e39cbb959
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testSeven.xml.org
@@ -0,0 +1,2 @@
+<!--all elements here are explicitly in the HTML namespace--><?xml version="1.0" encoding="utf-8"?><html:html xmlns:html="http://www.w3.org/TR/REC-html40"><html:head><html:title>Frobnostication</html:title></html:head><html:body><html:p>Moved to<html:a href="http://frob.com">here</html:a></html:p></html:body></html:html>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testSix.xml.org b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testSix.xml.org
new file mode 100644
index 00000000000..7eded36f66b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testSix.xml.org
@@ -0,0 +1,2 @@
+<!--all elements here are explicitly in the HTML namespace--><?xml version="1.0" encoding="utf-8"?><htmlNewPrefix:html><htmlNewPrefix:head><htmlNewPrefix:title>Frobnostication</htmlNewPrefix:title></htmlNewPrefix:head><htmlNewPrefix:body><htmlNewPrefix:p>Moved to<htmlNewPrefix:a href="http://frob.com">here</htmlNewPrefix:a></htmlNewPrefix:p></htmlNewPrefix:body></htmlNewPrefix:html>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testThree.xml.org b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testThree.xml.org
new file mode 100644
index 00000000000..9e767939b59
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/XMLStreamWriterTest/testThree.xml.org
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="utf-8"?><elmeOne><elemTwo><emptyElem/><elemThree><elemFour><elemFive></elemFive></elemFour></elemThree></elemTwo></elmeOne>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/basic-form.vxml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/basic-form.vxml
new file mode 100644
index 00000000000..0bf33fc3ba0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/basic-form.vxml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE vxml PUBLIC "-//W3C//DTD VOICEXML 2.0//EN" "vxml.dtd">
+
+<vxml version="2.0"
+	xmlns="http://www.w3.org/2001/vxml"
+	xml:lang="en-US">
+
+	<form>
+		<field name="selection">
+			<prompt>
+				Please choose News, Weather, or Sports.
+			</prompt>
+			
+			<grammar type="application/x-nuance-gsl">
+				[ news weather sports ]
+			</grammar>
+		</field>
+
+		<block>
+			<submit next="select.jsp"/>
+			<prompt>Form is being submited.</prompt>
+		</block>
+	</form>
+
+</vxml>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/report.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/report.dtd
new file mode 100644
index 00000000000..f48deb021aa
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/report.dtd
@@ -0,0 +1,31 @@
+<!NOTATION cgm PUBLIC "Computer Graphics Metafile">
+ <!NOTATION ccitt PUBLIC "CCITT group 4 raster">
+
+ <!ENTITY % text "(#PCDATA | emph)*">
+ <!ENTITY infoflow SYSTEM "infoflow.ccitt" NDATA ccitt>
+ <!ENTITY tagexamp SYSTEM "tagexamp.cgm"   NDATA cgm>
+
+ <!ELEMENT report (title, chapter+)>
+ <!ELEMENT title %text;>
+ <!ELEMENT chapter (title, intro?, section*)>
+ <!ATTLIST chapter
+               shorttitle CDATA #IMPLIED>
+ <!ELEMENT intro (para | graphic)+>
+ <!ELEMENT section (title, intro?, topic*)>
+ <!ATTLIST section
+               shorttitle CDATA #IMPLIED
+               sectid ID #IMPLIED>
+ <!ELEMENT topic (title, (para | graphic)+)>
+ <!ATTLIST topic
+               shorttitle CDATA #IMPLIED
+               topicid ID #IMPLIED>
+ <!ELEMENT para (#PCDATA | emph | xref)*>
+ <!ATTLIST para
+               security (u | c | s | ts) "u">
+ <!ELEMENT emph %text;>
+ <!ELEMENT graphic EMPTY>
+ <!ATTLIST graphic
+               graphname ENTITY #REQUIRED>
+ <!ELEMENT xref EMPTY>
+ <!ATTLIST xref
+               xrefid IDREF #IMPLIED>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml-bad-systemId.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml-bad-systemId.xml
new file mode 100644
index 00000000000..38b60c600f7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml-bad-systemId.xml
@@ -0,0 +1,103 @@
+<!DOCTYPE report SYSTEM "report-does-not-exist.dtd" [
+    <!ENTITY foo "bar">
+]>
+<report>
+<title>Getting started with SGML</title>
+<chapter>
+<title>The business challenge</title>
+<intro>
+<para>With the ever-changing and growing global market, companies and
+ large organizations are searching for ways to become more viable and
+ competitive. Downsizing and other cost-cutting measures demand more
+ efficient use of corporate resources. One very important resource is
+ an organization's information.</para>
+<para>As part of the move toward integrated information management,
+whole industries are developing and implementing standards for
+exchanging technical information. This report describes how one such
+standard, the Standard Generalized Markup Language (SGML), works as
+part of an overall information management strategy.</para>
+<graphic graphname="infoflow"/></intro></chapter>
+<chapter>
+<title>Getting to know SGML</title>
+<intro>
+<para>While SGML is a fairly recent technology, the use of
+<emph>markup</emph> in computer-generated documents has existed for a
+while.</para></intro>
+<section shorttitle="What is markup?">
+<title>What is markup, or everything you always wanted to know about
+document preparation but were afraid to ask?</title>
+<intro>
+<para>Markup is everything in a document that is not content. The
+traditional meaning of markup is the manual <emph>marking</emph> up
+of typewritten text to give instructions for a typesetter or
+compositor about how to fit the text on a page and what typefaces to
+use. This kind of markup is known as <emph>procedural markup</emph>.</para></intro>
+<topic topicid="top1">
+<title>Procedural markup</title>
+<para>Most electronic publishing systems today use some form of
+procedural markup. Procedural markup codes are good for one
+presentation of the information.</para></topic>
+<topic topicid="top2">
+<title>Generic markup</title>
+<para>Generic markup (also known as descriptive markup) describes the
+<emph>purpose</emph> of the text in a document. A basic concept of
+generic markup is that the content of a document must be separate from
+the style. Generic markup allows for multiple presentations of the
+information.</para></topic>
+<topic topicid="top3">
+<title>Drawbacks of procedural markup</title>
+<para>Industries involved in technical documentation increasingly
+prefer generic over procedural markup schemes. When a company changes
+software or hardware systems, enormous data translation tasks arise,
+often resulting in errors.</para></topic></section>
+<section shorttitle="What is SGML?">
+<title>What <emph>is</emph> SGML in the grand scheme of the universe, anyway?</title>
+<intro>
+<para>SGML defines a strict markup scheme with a syntax for defining
+document data elements and an overall framework for marking up
+documents.</para>
+<para>SGML can describe and create documents that are not dependent on
+any hardware, software, formatter, or operating system. Since SGML documents
+conform to an international standard, they are portable.</para></intro></section>
+<section shorttitle="How does SGML work?">
+<title>How is SGML and would you recommend it to your grandmother?</title>
+<intro>
+<para>You can break a typical document into three layers: structure,
+content, and style. SGML works by separating these three aspects and
+deals mainly with the relationship between structure and content.</para></intro>
+<topic topicid="top4">
+<title>Structure</title>
+<para>At the heart of an SGML application is a file called the DTD, or
+Document Type Definition. The DTD sets up the structure of a document,
+much like a database schema describes the types of information it
+handles.</para>
+<para>A database schema also defines the relationships between the
+various types of data. Similarly, a DTD specifies <emph>rules</emph>
+to help ensure documents have a consistent, logical structure.</para></topic>
+<topic topicid="top5">
+<title>Content</title>
+<para>Content is the information itself. The method for identifying
+the information and its meaning within this framework is called
+<emph>tagging</emph>. Tagging must
+conform to the rules established in the DTD (see <xref xrefid="top4"/>).</para>
+<graphic graphname="tagexamp"/></topic>
+<topic topicid="top6">
+<title>Style</title>
+<para>SGML does not standardize style or other processing methods for
+information stored in SGML.</para></topic></section></chapter>
+<chapter>
+<title>Resources</title>
+<section>
+<title>Conferences, tutorials, and training</title>
+<intro>
+<para>The Graphic Communications Association has been
+instrumental in the development of SGML. GCA provides conferences,
+tutorials, newsletters, and publication sales for both members and
+non-members.</para>
+<para security="c">Exiled members of the former Soviet Union's secret
+police, the KGB, have infiltrated the upper ranks of the GCA and are
+planning the Final Revolution as soon as DSSSL is completed.</para>
+</intro>
+</section>
+</chapter>
+</report>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml.xml
new file mode 100644
index 00000000000..65d1ae49e02
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml.xml
@@ -0,0 +1,101 @@
+<!DOCTYPE report SYSTEM "report.dtd">
+<report>
+<title>Getting started with SGML</title>
+<chapter>
+<title>The business challenge</title>
+<intro>
+<para>With the ever-changing and growing global market, companies and
+ large organizations are searching for ways to become more viable and
+ competitive. Downsizing and other cost-cutting measures demand more
+ efficient use of corporate resources. One very important resource is
+ an organization's information.</para>
+<para>As part of the move toward integrated information management,
+whole industries are developing and implementing standards for
+exchanging technical information. This report describes how one such
+standard, the Standard Generalized Markup Language (SGML), works as
+part of an overall information management strategy.</para>
+<graphic graphname="infoflow"/></intro></chapter>
+<chapter>
+<title>Getting to know SGML</title>
+<intro>
+<para>While SGML is a fairly recent technology, the use of
+<emph>markup</emph> in computer-generated documents has existed for a
+while.</para></intro>
+<section shorttitle="What is markup?">
+<title>What is markup, or everything you always wanted to know about
+document preparation but were afraid to ask?</title>
+<intro>
+<para>Markup is everything in a document that is not content. The
+traditional meaning of markup is the manual <emph>marking</emph> up
+of typewritten text to give instructions for a typesetter or
+compositor about how to fit the text on a page and what typefaces to
+use. This kind of markup is known as <emph>procedural markup</emph>.</para></intro>
+<topic topicid="top1">
+<title>Procedural markup</title>
+<para>Most electronic publishing systems today use some form of
+procedural markup. Procedural markup codes are good for one
+presentation of the information.</para></topic>
+<topic topicid="top2">
+<title>Generic markup</title>
+<para>Generic markup (also known as descriptive markup) describes the
+<emph>purpose</emph> of the text in a document. A basic concept of
+generic markup is that the content of a document must be separate from
+the style. Generic markup allows for multiple presentations of the
+information.</para></topic>
+<topic topicid="top3">
+<title>Drawbacks of procedural markup</title>
+<para>Industries involved in technical documentation increasingly
+prefer generic over procedural markup schemes. When a company changes
+software or hardware systems, enormous data translation tasks arise,
+often resulting in errors.</para></topic></section>
+<section shorttitle="What is SGML?">
+<title>What <emph>is</emph> SGML in the grand scheme of the universe, anyway?</title>
+<intro>
+<para>SGML defines a strict markup scheme with a syntax for defining
+document data elements and an overall framework for marking up
+documents.</para>
+<para>SGML can describe and create documents that are not dependent on
+any hardware, software, formatter, or operating system. Since SGML documents
+conform to an international standard, they are portable.</para></intro></section>
+<section shorttitle="How does SGML work?">
+<title>How is SGML and would you recommend it to your grandmother?</title>
+<intro>
+<para>You can break a typical document into three layers: structure,
+content, and style. SGML works by separating these three aspects and
+deals mainly with the relationship between structure and content.</para></intro>
+<topic topicid="top4">
+<title>Structure</title>
+<para>At the heart of an SGML application is a file called the DTD, or
+Document Type Definition. The DTD sets up the structure of a document,
+much like a database schema describes the types of information it
+handles.</para>
+<para>A database schema also defines the relationships between the
+various types of data. Similarly, a DTD specifies <emph>rules</emph>
+to help ensure documents have a consistent, logical structure.</para></topic>
+<topic topicid="top5">
+<title>Content</title>
+<para>Content is the information itself. The method for identifying
+the information and its meaning within this framework is called
+<emph>tagging</emph>. Tagging must
+conform to the rules established in the DTD (see <xref xrefid="top4"/>).</para>
+<graphic graphname="tagexamp"/></topic>
+<topic topicid="top6">
+<title>Style</title>
+<para>SGML does not standardize style or other processing methods for
+information stored in SGML.</para></topic></section></chapter>
+<chapter>
+<title>Resources</title>
+<section>
+<title>Conferences, tutorials, and training</title>
+<intro>
+<para>The Graphic Communications Association has been
+instrumental in the development of SGML. GCA provides conferences,
+tutorials, newsletters, and publication sales for both members and
+non-members.</para>
+<para security="c">Exiled members of the former Soviet Union's secret
+police, the KGB, have infiltrated the upper ranks of the GCA and are
+planning the Final Revolution as soon as DSSSL is completed.</para>
+</intro>
+</section>
+</chapter>
+</report>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml_Bug6509774.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml_Bug6509774.xml
new file mode 100644
index 00000000000..952624a46af
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/sgml_Bug6509774.xml
@@ -0,0 +1,103 @@
+<!DOCTYPE report SYSTEM "report.dtd" [
+    <!ENTITY foo "bar">
+]>
+<report>
+<title>Getting started with SGML</title>
+<chapter>
+<title>The business challenge</title>
+<intro>
+<para>With the ever-changing and growing global market, companies and
+ large organizations are searching for ways to become more viable and
+ competitive. Downsizing and other cost-cutting measures demand more
+ efficient use of corporate resources. One very important resource is
+ an organization's information.</para>
+<para>As part of the move toward integrated information management,
+whole industries are developing and implementing standards for
+exchanging technical information. This report describes how one such
+standard, the Standard Generalized Markup Language (SGML), works as
+part of an overall information management strategy.</para>
+<graphic graphname="infoflow"/></intro></chapter>
+<chapter>
+<title>Getting to know SGML</title>
+<intro>
+<para>While SGML is a fairly recent technology, the use of
+<emph>markup</emph> in computer-generated documents has existed for a
+while.</para></intro>
+<section shorttitle="What is markup?">
+<title>What is markup, or everything you always wanted to know about
+document preparation but were afraid to ask?</title>
+<intro>
+<para>Markup is everything in a document that is not content. The
+traditional meaning of markup is the manual <emph>marking</emph> up
+of typewritten text to give instructions for a typesetter or
+compositor about how to fit the text on a page and what typefaces to
+use. This kind of markup is known as <emph>procedural markup</emph>.</para></intro>
+<topic topicid="top1">
+<title>Procedural markup</title>
+<para>Most electronic publishing systems today use some form of
+procedural markup. Procedural markup codes are good for one
+presentation of the information.</para></topic>
+<topic topicid="top2">
+<title>Generic markup</title>
+<para>Generic markup (also known as descriptive markup) describes the
+<emph>purpose</emph> of the text in a document. A basic concept of
+generic markup is that the content of a document must be separate from
+the style. Generic markup allows for multiple presentations of the
+information.</para></topic>
+<topic topicid="top3">
+<title>Drawbacks of procedural markup</title>
+<para>Industries involved in technical documentation increasingly
+prefer generic over procedural markup schemes. When a company changes
+software or hardware systems, enormous data translation tasks arise,
+often resulting in errors.</para></topic></section>
+<section shorttitle="What is SGML?">
+<title>What <emph>is</emph> SGML in the grand scheme of the universe, anyway?</title>
+<intro>
+<para>SGML defines a strict markup scheme with a syntax for defining
+document data elements and an overall framework for marking up
+documents.</para>
+<para>SGML can describe and create documents that are not dependent on
+any hardware, software, formatter, or operating system. Since SGML documents
+conform to an international standard, they are portable.</para></intro></section>
+<section shorttitle="How does SGML work?">
+<title>How is SGML and would you recommend it to your grandmother?</title>
+<intro>
+<para>You can break a typical document into three layers: structure,
+content, and style. SGML works by separating these three aspects and
+deals mainly with the relationship between structure and content.</para></intro>
+<topic topicid="top4">
+<title>Structure</title>
+<para>At the heart of an SGML application is a file called the DTD, or
+Document Type Definition. The DTD sets up the structure of a document,
+much like a database schema describes the types of information it
+handles.</para>
+<para>A database schema also defines the relationships between the
+various types of data. Similarly, a DTD specifies <emph>rules</emph>
+to help ensure documents have a consistent, logical structure.</para></topic>
+<topic topicid="top5">
+<title>Content</title>
+<para>Content is the information itself. The method for identifying
+the information and its meaning within this framework is called
+<emph>tagging</emph>. Tagging must
+conform to the rules established in the DTD (see <xref xrefid="top4"/>).</para>
+<graphic graphname="tagexamp"/></topic>
+<topic topicid="top6">
+<title>Style</title>
+<para>SGML does not standardize style or other processing methods for
+information stored in SGML.</para></topic></section></chapter>
+<chapter>
+<title>Resources</title>
+<section>
+<title>Conferences, tutorials, and training</title>
+<intro>
+<para>The Graphic Communications Association has been
+instrumental in the development of SGML. GCA provides conferences,
+tutorials, newsletters, and publication sales for both members and
+non-members.</para>
+<para security="c">Exiled members of the former Soviet Union's secret
+police, the KGB, have infiltrated the upper ranks of the GCA and are
+planning the Final Revolution as soon as DSSSL is completed.</para>
+</intro>
+</section>
+</chapter>
+</report>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile1.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile1.xml
new file mode 100644
index 00000000000..170cdacc3b6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile1.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" standalone="no" ?>
+<ns1:foo  attr1="defaultAttr1" ns1:attr1="ns1Attr1" ns2:attr1="ns2Attr1" attr2="defaultAttr2" attr3="defaultAttr3" xmlns:ns1="http://ns1.java.com"  xmlns:ns2="http://ns2.java.com">
+<!--description-->
+    content text
+    <![CDATA[<greeting>Hello</greeting>]]>
+    other content
+</ns1:foo>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile2.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile2.xml
new file mode 100644
index 00000000000..926d21157ee
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile2.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns1:foo xmlns:ns="http://ns1.java.com" xmlns:ns1="http://ns1.java.com"  xmlns:ns2="http://ns2.java.com" >
+ <!--description-->content text
+    <![CDATA[<greeting>Hello</greeting>]]>
+    other content
+</ns1:foo>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile3.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile3.xml
new file mode 100644
index 00000000000..c104c228f54
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile3.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0"  encoding="utf-8" ?>
+<ns1:foo  xmlns:ns1="http://ns1.java.com"  xmlns:ns2="http://ns2.java.com">                  
+<!--description-->
+content text
+    <![CDATA[<greeting>Hello</greeting>]]>
+    other content
+</ns1:foo>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile4.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile4.xml
new file mode 100644
index 00000000000..45cbf6a7474
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/testfile4.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"  encoding="utf-8" ?>
+<ns1:foo  attr1="defaultAttr1" xmlns:ns1="http://ns1.java.com"  xmlns:ns2="http://ns2.java.com">
+</ns1:foo>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/toys.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/toys.xml
new file mode 100644
index 00000000000..1d9fbe2df66
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/toys.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Document   : toys.xml
+    Created on : August 11, 2003, 6:42 PM
+    Author     : Prasad Subramanian
+    Description:
+-->
+
+<toys>
+    <toy>
+        <name>Lego-Model01</name>
+        <price>65.99</price>
+    </toy>
+    <toy>
+        <name>Lego-Model2</name>
+        <price>69.99</price>
+    </toy>
+    <toy>
+        <name>Lego-Model3</name>
+        <price>14.99</price>
+    </toy>
+    <toy>
+        <name>Barbie-Pink</name>
+        <price>12.99</price>
+    </toy>
+    <toy>
+        <name>Barbie-Blue</name>
+        <price>13.99</price>
+    </toy>        
+    <toy>
+        <name>Barbie-White</name>
+        <price>13.99</price>
+    </toy>   
+    <toy>
+        <name>Barbie-Plain</name>
+        <price>13.99</price>
+    </toy>           
+</toys>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/vxml.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/vxml.dtd
new file mode 100644
index 00000000000..d866c12b38e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/stream/vxml.dtd
@@ -0,0 +1,479 @@
+<!-- 
+VoiceXML 2.1 DTD (20031228)
+
+Copyright 1998-2003 W3C (MIT, ERCIM, Keio), All Rights Reserved. 
+
+Permission to use, copy, modify and distribute the VoiceXML DTD and 
+its accompanying documentation for any purpose and without fee is 
+hereby granted in perpetuity, provided that the above copyright 
+notice and this paragraph appear in all copies.  
+
+The copyright holders make no representation about the suitability 
+of the DTD for any purpose. It is provided "as is" without expressed 
+or implied warranty.
+-->
+
+<!ENTITY % audio "#PCDATA | audio | enumerate | value">
+<!ENTITY % bargeintype "( speech | hotword )">
+<!ENTITY % boolean "(true|false)">
+<!ENTITY % content.type "CDATA">
+<!ENTITY % duration "CDATA">
+<!ENTITY % event.handler "catch | help | noinput | nomatch | error">
+<!ENTITY % event.name "NMTOKEN">
+<!ENTITY % event.names "NMTOKENS">
+<!ENTITY % executable.content "%audio; | assign | clear | data | disconnect | 
+    exit | foreach |goto | if | log | prompt | 
+	reprompt | return | script | submit | throw | var ">
+<!ENTITY % expression "CDATA">
+<!ENTITY % restrictedvariable.name "NMTOKEN">
+<!ENTITY % variable.name "CDATA">
+<!ENTITY % restrictedvariable.names "NMTOKENS">
+<!ENTITY % variable.names "CDATA">
+<!ENTITY % integer "CDATA">
+<!ENTITY % item.attrs "name		%restrictedvariable.name; #IMPLIED 
+	cond		%expression;	#IMPLIED
+	expr		%expression;	#IMPLIED ">
+<!ENTITY % uri "CDATA">
+<!ENTITY % cache.attrs "fetchhint	(prefetch|safe)	#IMPLIED
+	fetchtimeout	%duration;	#IMPLIED
+	maxage		%integer;	#IMPLIED
+	maxstale	%integer;	#IMPLIED">
+<!ENTITY % next.attrs "next		%uri;		#IMPLIED
+	expr		%expression;	#IMPLIED ">
+<!ENTITY % submit.attrs "method		(get|post)	'get'
+	enctype		%content.type;	'application/x-www-form-urlencoded'
+	namelist	%variable.names;	#IMPLIED">
+<!ENTITY % throw.attrs "event		%event.name;	#IMPLIED
+	eventexpr	%expression;	#IMPLIED
+	message		CDATA		#IMPLIED
+	messageexpr	%expression;	#IMPLIED">
+<!ENTITY % variable "block | data | field | var">
+<!--================================= Root ================================-->
+<!ELEMENT vxml (%event.handler; | data | form | link | menu | meta | metadata | 
+                property | script | var)+>
+<!ATTLIST vxml
+	application %uri; #IMPLIED
+	xml:base %uri; #IMPLIED
+	xml:lang NMTOKEN #IMPLIED
+	xmlns CDATA #REQUIRED
+	xmlns:xsi CDATA #IMPLIED
+	xsi:schemaLocation CDATA #IMPLIED
+	version CDATA #REQUIRED
+>
+<!ELEMENT meta EMPTY>
+<!ATTLIST meta
+	name NMTOKEN #IMPLIED
+	content CDATA #REQUIRED
+	http-equiv NMTOKEN #IMPLIED
+>
+
+<!ELEMENT metadata ANY>
+
+<!--================================ Prompts ==============================-->
+<!-- definitions adapted from SSML 1.0 DTD -->
+<!ENTITY % structure "p | s">
+<!ENTITY % sentence-elements "break | emphasis | mark | phoneme | prosody | 
+                              say-as | voice | sub">
+<!-- addition of enumerate and value elements as 'allowed-within-sentence' 
+     audio elements -->
+<!ENTITY % allowed-within-sentence " %audio; | %sentence-elements; ">
+
+<!-- Prompt is modelled on SSML 1.0 DTD speak element:
+- addition of 'bargein', 'bargeintype', 'cond', 'count' and 'timeout' attributes
+- removal of xmlns, xmlns:xsi, and xsi:schemaLocation attributes
+- version attribute fixed as "1.0"
+-->
+<!ELEMENT prompt (%allowed-within-sentence; | foreach | %structure; | lexicon 
+                  | metadata )*>
+<!ATTLIST prompt
+	bargein %boolean; #IMPLIED
+	bargeintype %bargeintype; #IMPLIED
+	cond %expression; #IMPLIED
+	count %integer; #IMPLIED
+	xml:lang NMTOKEN #IMPLIED
+	timeout %duration; #IMPLIED
+	xml:base %uri; #IMPLIED
+	version CDATA #FIXED "1.0"
+>
+<!ELEMENT enumerate (%allowed-within-sentence; | %structure;)*>
+<!ELEMENT reprompt EMPTY>
+
+<!--================================= Dialogs =============================-->
+<!ENTITY % input "grammar">
+<!ENTITY % scope "(document | dialog)">
+<!ELEMENT form (%input; | %event.handler; | filled | initial | object | link |
+              property | record | script | subdialog | transfer | %variable;)*>
+<!ATTLIST form
+	id ID #IMPLIED
+	scope %scope; "dialog"
+>
+<!ENTITY % accept.attrs "accept		(exact | approximate)	'exact'">
+<!ELEMENT menu (%audio; | choice | data | %event.handler; | prompt | property)*>
+<!ATTLIST menu
+	id ID #IMPLIED
+	scope %scope; "dialog"
+	%accept.attrs; 
+	dtmf %boolean; "false"
+>
+<!ELEMENT choice ( #PCDATA | %input; )*>
+<!ATTLIST choice
+	%cache.attrs; 
+	%accept.attrs; 
+	dtmf CDATA #IMPLIED
+	%throw.attrs; 
+	fetchaudio %uri; #IMPLIED
+	%next.attrs; 
+>
+<!--================================ Audio Output ==============================-->
+<!-- definitions adapted from SSML 1.0 DTD -->
+<!ELEMENT paragraph (%allowed-within-sentence; | sentence | s)*>
+<!ATTLIST paragraph
+	xml:lang NMTOKEN #IMPLIED
+>
+<!ELEMENT sentence (%allowed-within-sentence;)*>
+<!ATTLIST sentence
+	xml:lang NMTOKEN #IMPLIED
+>
+<!ELEMENT p (%allowed-within-sentence; | sentence | s)*>
+<!ATTLIST p
+	xml:lang NMTOKEN #IMPLIED
+>
+<!ELEMENT s (%allowed-within-sentence;)*>
+<!ATTLIST s
+	xml:lang NMTOKEN #IMPLIED
+>
+<!ELEMENT voice (%allowed-within-sentence; | %structure;)*>
+<!ATTLIST voice
+	xml:lang NMTOKEN #IMPLIED
+	gender (male | female | neutral) #IMPLIED
+	age %integer; #IMPLIED
+	variant %integer; #IMPLIED
+	name CDATA #IMPLIED
+>
+<!ELEMENT prosody (%allowed-within-sentence; | %structure;)*>
+<!ATTLIST prosody
+	pitch CDATA #IMPLIED
+	contour CDATA #IMPLIED
+	range CDATA #IMPLIED
+	rate CDATA #IMPLIED
+	duration %duration; #IMPLIED
+	volume CDATA #IMPLIED
+>
+<!-- Changes to SSML 1.0 DTD audio element:
+- src not obligatory, addition of 'expr' and caching attributes
+-->
+<!ELEMENT audio (%allowed-within-sentence; | %structure; | desc)*>
+<!ATTLIST audio
+	src %uri; #IMPLIED
+	expr %expression; #IMPLIED
+	%cache.attrs; 
+>
+<!ELEMENT desc (#PCDATA)>
+<!ELEMENT emphasis (%allowed-within-sentence;)*>
+<!ATTLIST emphasis
+	level (strong | moderate | none | reduced) "moderate"
+>
+<!-- Changes to SSML 1.0 DTD say-as element:
+- allows value element as child
+-->
+<!ELEMENT say-as (#PCDATA | value )*>
+<!ATTLIST say-as
+	interpret-as NMTOKEN #REQUIRED
+	format NMTOKEN #IMPLIED
+	detail NMTOKEN #IMPLIED
+>
+<!ELEMENT sub (#PCDATA)>
+<!ATTLIST sub
+	alias CDATA #REQUIRED
+>
+<!ELEMENT phoneme (#PCDATA)>
+<!ATTLIST phoneme
+	ph CDATA #REQUIRED
+	alphabet CDATA #IMPLIED
+>
+<!ELEMENT break EMPTY>
+<!ATTLIST break
+	time CDATA "medium"
+>
+<!ELEMENT mark EMPTY>
+<!ATTLIST mark
+	name ID #IMPLIED
+	nameexpr %expression; #IMPLIED
+>
+<!--================================ Fields ===============================-->
+<!ELEMENT field (%audio; | %event.handler; | filled | %input; | link | option |
+                 prompt | property)*>
+<!ATTLIST field
+	%item.attrs; 
+	type CDATA #IMPLIED
+	slot NMTOKEN #IMPLIED
+	modal %boolean; "false"
+>
+<!ELEMENT option (#PCDATA)>
+<!ATTLIST option
+	%accept.attrs; 
+	dtmf CDATA #IMPLIED
+	value CDATA #IMPLIED
+>
+<!ELEMENT var EMPTY>
+<!ATTLIST var
+	name %restrictedvariable.name; #REQUIRED
+	expr %expression; #IMPLIED
+>
+<!ELEMENT initial (%audio; | %event.handler; | link | prompt | property)*>
+<!ATTLIST initial
+	%item.attrs; 
+>
+<!ELEMENT block (%executable.content;)*>
+<!ATTLIST block
+	%item.attrs; 
+>
+<!ELEMENT assign EMPTY>
+<!ATTLIST assign
+	name %variable.name; #REQUIRED
+	expr %expression; #REQUIRED
+>
+<!ELEMENT clear EMPTY>
+<!ATTLIST clear
+	namelist %variable.names; #IMPLIED
+>
+<!ELEMENT value EMPTY>
+<!ATTLIST value
+	expr %expression; #REQUIRED
+>
+<!--================================== Events =============================-->
+<!ENTITY % event.handler.attrs "count		%integer;	#IMPLIED
+	cond		%expression;	#IMPLIED">
+<!ELEMENT catch (%executable.content;)*>
+<!ATTLIST catch
+	event %event.names; #IMPLIED
+	%event.handler.attrs; 
+>
+<!ELEMENT error (%executable.content;)*>
+<!ATTLIST error
+	%event.handler.attrs; 
+>
+<!ELEMENT help (%executable.content;)*>
+<!ATTLIST help
+	%event.handler.attrs; 
+>
+<!ELEMENT link (%input;)*>
+<!ATTLIST link
+	%cache.attrs; 
+	%next.attrs; 
+	fetchaudio %uri; #IMPLIED
+	dtmf CDATA #IMPLIED
+	%throw.attrs; 
+>
+<!ELEMENT noinput (%executable.content;)*>
+<!ATTLIST noinput
+	%event.handler.attrs; 
+>
+<!ELEMENT nomatch (%executable.content;)*>
+<!ATTLIST nomatch
+	%event.handler.attrs; 
+>
+<!ELEMENT throw EMPTY>
+<!ATTLIST throw
+	%throw.attrs; 
+>
+<!--============================= Grammar Input =============================-->
+<!-- definitions adapted from SRGS 1.0 DTD -->
+<!ENTITY % rule-expansion "#PCDATA | token | ruleref
+                              | item | one-of | tag ">
+<!ELEMENT ruleref EMPTY>
+<!ATTLIST ruleref
+	uri %uri; #IMPLIED
+	type CDATA #IMPLIED
+	special (NULL | VOID | GARBAGE) #IMPLIED
+	xml:lang NMTOKEN #IMPLIED
+>
+<!ELEMENT token (#PCDATA)>
+<!ATTLIST token
+	xml:lang NMTOKEN #IMPLIED
+>
+<!ELEMENT tag (#PCDATA)>
+<!ELEMENT one-of (item)+>
+<!ATTLIST one-of
+	xml:lang NMTOKEN #IMPLIED
+>
+<!ELEMENT item (%rule-expansion;)*>
+<!ATTLIST item
+	repeat NMTOKEN #IMPLIED
+	repeat-prob NMTOKEN #IMPLIED
+	weight NMTOKEN #IMPLIED
+	xml:lang NMTOKEN #IMPLIED
+>
+<!ELEMENT rule (%rule-expansion; | example)*>
+<!ATTLIST rule
+	id ID #REQUIRED
+	scope (private | public) "private"
+>
+<!ELEMENT example (#PCDATA)>
+<!ELEMENT lexicon EMPTY>
+<!ATTLIST lexicon
+	uri %uri; #REQUIRED
+	type CDATA #IMPLIED
+>
+<!-- Changes to SRGS 1.0 DTD grammar element:
+- mixed, unordered content model 
+- addition of 'scope', 'src', 'type', 'weight' and caching attributes
+- 'version' attribute is optional
+- removal of xmlns, xmlns:xsi, and xsi:schemaLocation attributes
+-->
+<!ELEMENT grammar (#PCDATA | meta | metadata | lexicon | rule)*>
+<!ATTLIST grammar
+	scope %scope; #IMPLIED
+	src %uri; #IMPLIED
+	srcexpr %expression; #IMPLIED
+	type CDATA #IMPLIED
+	weight CDATA #IMPLIED
+	%cache.attrs; 
+	tag-format %uri; #IMPLIED
+	xml:base %uri; #IMPLIED
+	version NMTOKEN #IMPLIED
+	xml:lang NMTOKEN #IMPLIED
+	root IDREF #IMPLIED
+	mode (voice | dtmf) "voice"
+>
+<!--============================= Audio Input =============================-->
+<!ELEMENT record (%audio; | %event.handler; | filled | %input; | prompt | 
+                  property)*>
+<!ATTLIST record
+	%item.attrs; 
+	type CDATA #IMPLIED
+	beep %boolean; "false"
+	maxtime %duration; #IMPLIED
+	modal %boolean; "true"
+	finalsilence %duration; #IMPLIED
+	dtmfterm %boolean; "true"
+>
+<!--============================ Call Control ============================-->
+<!ELEMENT disconnect EMPTY>
+<!ATTLIST disconnect
+	namelist %variable.names; #IMPLIED
+>
+
+<!ELEMENT transfer (%audio; | %event.handler; | filled | %input; | prompt | 
+                    property)*>
+<!ATTLIST transfer
+	%item.attrs; 
+	dest %uri; #IMPLIED
+	destexpr %expression; #IMPLIED
+	bridge %boolean; "false"
+	type NMTOKEN #IMPLIED
+	connecttimeout %duration; #IMPLIED
+	maxtime %duration; #IMPLIED
+	transferaudio %uri; #IMPLIED
+	aai CDATA #IMPLIED
+	aaiexpr %expression; #IMPLIED
+>
+<!--============================ Control Flow ============================-->
+<!ENTITY % if.attrs "cond		%expression;	#REQUIRED">
+<!ELEMENT if (%executable.content; | elseif | else)*>
+<!ATTLIST if
+	%if.attrs; 
+>
+<!ELEMENT elseif EMPTY>
+<!ATTLIST elseif
+	%if.attrs; 
+>
+<!ELEMENT else EMPTY>
+<!ELEMENT exit EMPTY>
+<!ATTLIST exit
+	expr %expression; #IMPLIED
+	namelist %variable.names; #IMPLIED
+>
+<!ELEMENT filled (%executable.content;)*>
+<!ATTLIST filled
+	mode (any | all) #IMPLIED
+	namelist %restrictedvariable.names; #IMPLIED
+>
+
+<!-- executable content + contents of prompt  -->
+<!ELEMENT foreach (%executable.content; | %sentence-elements; | 
+    %structure; | metadata)*
+>
+<!ATTLIST foreach
+    item %restrictedvariable.name; #REQUIRED
+    array CDATA #REQUIRED
+>
+
+<!ELEMENT goto EMPTY>
+<!ATTLIST goto
+	%cache.attrs; 
+	%next.attrs; 
+	fetchaudio %uri; #IMPLIED
+	expritem %expression; #IMPLIED
+	nextitem %restrictedvariable.name; #IMPLIED
+>
+<!ELEMENT param EMPTY>
+<!ATTLIST param
+	name NMTOKEN #REQUIRED
+	expr %expression; #IMPLIED
+	value CDATA #IMPLIED
+	valuetype (data | ref) "data"
+	type CDATA #IMPLIED
+>
+<!ELEMENT return EMPTY>
+<!ATTLIST return
+	namelist %variable.names; #IMPLIED
+	%throw.attrs; 
+>
+<!ELEMENT subdialog (%audio; | %event.handler; | filled | param | prompt | 
+                     property)*>
+<!ATTLIST subdialog
+	%item.attrs; 
+	src %uri; #IMPLIED
+	srcexpr %expression; #IMPLIED
+	%cache.attrs; 
+	fetchaudio %uri; #IMPLIED
+	%submit.attrs; 
+>
+<!ELEMENT submit EMPTY>
+<!ATTLIST submit
+	%cache.attrs; 
+	%next.attrs; 
+	fetchaudio %uri; #IMPLIED
+	%submit.attrs; 
+>
+<!--========================== Miscellaneous ==============================-->
+<!ELEMENT data EMPTY >
+<!ATTLIST data
+    name %restrictedvariable.name; #IMPLIED
+    src %uri; #IMPLIED
+    srcexpr %expression; #IMPLIED 
+    fetchaudio  %uri;       #IMPLIED
+    %submit.attrs;
+    %cache.attrs;
+>
+
+<!ELEMENT log (#PCDATA | value)*>
+<!ATTLIST log
+	label CDATA #IMPLIED
+	expr %expression; #IMPLIED
+>
+<!ELEMENT object (%audio; | %event.handler; | filled | param | prompt | 
+                  property)*>
+<!ATTLIST object
+	%item.attrs; 
+	%cache.attrs; 
+	classid %uri; #IMPLIED
+	codebase %uri; #IMPLIED
+	data %uri; #IMPLIED
+	type CDATA #IMPLIED
+	codetype CDATA #IMPLIED
+	archive %uri; #IMPLIED
+>
+<!ELEMENT property EMPTY>
+<!ATTLIST property
+	name NMTOKEN #REQUIRED
+	value CDATA #REQUIRED
+>
+<!ELEMENT script (#PCDATA)>
+<!ATTLIST script
+	src %uri; #IMPLIED
+	srcexpr %expression; #IMPLIED
+	charset CDATA #IMPLIED
+	%cache.attrs; 
+>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/5368141.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/5368141.xml
new file mode 100644
index 00000000000..3edd30468de
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/5368141.xml
@@ -0,0 +1,329 @@
+<?xml version="1.0" standalone="no" ?>
+<!DOCTYPE message PUBLIC "-//TSN//DTD Statistics 1.0/EN" "NCAA_Conference_Schedule_XML.dtd"> 
+<message>
+<XML_File_ID>5368141</XML_File_ID>
+<heading>AEX%06ATLANTICSUN-SKED</heading>
+<category>Statistics</category>
+<sport>CBASK</sport>
+<Title>2006-2007 Atlantic Sun Basketball Schedule/Results</Title>
+<Conference_Schedule>
+<Team fullname="Belmont Bruins">
+<Listing>Nov 13-L at  UNC-Wilmington, 83-88</Listing>
+<Listing>Nov 14-W vs. Fordham, 56-49</Listing>
+<Listing>Nov 18-W at  IUPUI, 67-61</Listing>
+<Listing>Nov 20-W vs. Fisk, 83-54</Listing>
+<Listing>Nov 27-L at  Middle Tennessee, 57-64</Listing>
+<Listing>Nov 30-W vs. North Florida, 87-32</Listing>
+<Listing>Dec  2-W vs. Jacksonville, 76-62</Listing>
+<Listing>Dec  4-W vs. IUPUI, 76-66</Listing>
+<Listing>Dec 13-W at  Ark-Little Rock, 72-57</Listing>
+<Listing>Dec 17-L at  Illinois, 51-77</Listing>
+<Listing>Dec 19-L at  Michigan State, 58-67</Listing>
+<Listing>Dec 28-W at  Rice, 87-85</Listing>
+<Listing>Dec 29-L at  St Marys-CA, 60-71</Listing>
+<Listing>Jan  2-W at  East Tenn St, 75-74 OT</Listing>
+<Listing>Jan  4-W at  Kennesaw St, 63-45</Listing>
+<Listing>Jan  7-W vs. Mercer, 72-47</Listing>
+<Listing>Jan  9-W vs. Stetson, 73-71</Listing>
+<Listing>Jan 12-L vs. Lipscomb, 50-55</Listing>
+<Listing>Jan 18- at  Campbell, 7:00 PM</Listing>
+<Listing>Jan 20- at  Gardner-Webb, 6:00 PM</Listing>
+<Listing>Jan 25- vs. East Tenn St, 7:00 PM</Listing>
+<Listing>Jan 27- vs. Kennesaw St, 7:00 PM</Listing>
+<Listing>Feb  1- at  Stetson, 6:00 PM</Listing>
+<Listing>Feb  3- at  Mercer, 6:00 PM</Listing>
+<Listing>Feb  9- at  Lipscomb, 6:30 PM</Listing>
+<Listing>Feb 15- vs. Gardner-Webb, 7:00 PM</Listing>
+<Listing>Feb 17- vs. Campbell, 7:30 PM</Listing>
+<Listing>Feb 22- at  Jacksonville, 6:00 PM</Listing>
+<Listing>Feb 24- at  North Florida, 7:00 PM</Listing>
+</Team>
+<Team fullname="Campbell Fighting Camels">
+<Listing>Nov 11-W vs. UNC-Pembroke, 106-66</Listing>
+<Listing>Nov 16-W vs. Coastal Carolina, 83-63</Listing>
+<Listing>Nov 20-W vs. UNC-Wilmington, 100-94</Listing>
+<Listing>Nov 25-L at  Radford, 80-87</Listing>
+<Listing>Nov 27-L at  Appalachian St, 71-84</Listing>
+<Listing>Dec 12-L at  San Diego St, 82-119</Listing>
+<Listing>Dec 14-L at  San Diego, 69-81</Listing>
+<Listing>Dec 18-W vs. Radford, 101-88</Listing>
+<Listing>Dec 23-L at  Virginia Tech, 70-94</Listing>
+<Listing>Dec 30-W vs. Ohio Valley, 107-65</Listing>
+<Listing>Jan  2-W at  North Florida, 78-48</Listing>
+<Listing>Jan  4-L at  Jacksonville, 71-90</Listing>
+<Listing>Jan  6-W vs. Kennesaw St, 88-85 2OT</Listing>
+<Listing>Jan  9-L vs. East Tenn St, 76-100</Listing>
+<Listing>Jan 13-L at  Mercer, 93-94</Listing>
+<Listing>Jan 15-L at  Stetson, 73-82</Listing>
+<Listing>Jan 18- vs. Belmont, 7:00 PM</Listing>
+<Listing>Jan 20- vs. Lipscomb, 1:00 PM</Listing>
+<Listing>Jan 25- vs. North Florida, 8:00 PM</Listing>
+<Listing>Jan 27- vs. Jacksonville, 4:00 PM</Listing>
+<Listing>Jan 30- at  Gardner-Webb, 7:00 PM</Listing>
+<Listing>Feb  2- at  Kennesaw St, 7:30 PM</Listing>
+<Listing>Feb  5- at  East Tenn St, 7:00 PM</Listing>
+<Listing>Feb  8- vs. Stetson, 7:00 PM</Listing>
+<Listing>Feb 10- vs. Mercer, 7:00 PM</Listing>
+<Listing>Feb 15- at  Lipscomb, 8:00 PM</Listing>
+<Listing>Feb 17- at  Belmont, 7:30 PM</Listing>
+<Listing>Feb 22- vs. Longwood, 7:00 PM</Listing>
+<Listing>Feb 24- vs. Gardner-Webb, 6:00 PM</Listing>
+</Team>
+<Team fullname="East Tennessee State Buccaneers">
+<Listing>Nov 10-W vs. Virginia-Wise, 90-43</Listing>
+<Listing>Nov 13-L at  Eastern Ky, 53-70</Listing>
+<Listing>Nov 15-W vs. Chattanooga, 71-70 OT</Listing>
+<Listing>Nov 19-L at  Auburn, 58-64</Listing>
+<Listing>Nov 21-L at  Morehead State, 56-77</Listing>
+<Listing>Nov 24-L vs. Sam Houston St, 61-72</Listing>
+<Listing>Nov 25-W at  Southern U, 66-52</Listing>
+<Listing>Nov 30-W at  Mercer, 76-70</Listing>
+<Listing>Dec  2-W at  Stetson, 75-61</Listing>
+<Listing>Dec  5-L at  Vanderbilt, 62-104</Listing>
+<Listing>Dec  9-W vs. Milligan, 73-47</Listing>
+<Listing>Dec 19-W vs. UNC-Asheville, 73-65</Listing>
+<Listing>Dec 21-W vs. Radford, 71-51</Listing>
+<Listing>Dec 30-L at  Tennessee, 88-93</Listing>
+<Listing>Jan  2-L vs. Belmont, 74-75 OT</Listing>
+<Listing>Jan  4-W vs. Lipscomb, 75-72 OT</Listing>
+<Listing>Jan  7-W at  Gardner-Webb, 66-63</Listing>
+<Listing>Jan  9-W at  Campbell, 100-76</Listing>
+<Listing>Jan 13-W vs. North Florida, 77-58</Listing>
+<Listing>Jan 15-W vs. Jacksonville, 71-59</Listing>
+<Listing>Jan 19- vs. Kennesaw St, 7:30 PM</Listing>
+<Listing>Jan 25- at  Belmont, 7:00 PM</Listing>
+<Listing>Jan 27- at  Lipscomb, 5:00 PM</Listing>
+<Listing>Feb  2- vs. Gardner-Webb, 7:00 PM</Listing>
+<Listing>Feb  5- vs. Campbell, 7:00 PM</Listing>
+<Listing>Feb  8- at  Jacksonville, 7:00 PM</Listing>
+<Listing>Feb 10- at  North Florida, 4:00 PM</Listing>
+<Listing>Feb 17- at  Kennesaw St, 7:30 PM</Listing>
+<Listing>Feb 23- vs. Stetson, 7:30 PM</Listing>
+<Listing>Feb 25- vs. Mercer, 2:00 PM</Listing>
+</Team>
+<Team fullname="Gardner-Webb Bulldogs">
+<Listing>Nov 13-L at  Texas Tech, 74-86</Listing>
+<Listing>Nov 14-L vs. Akron, 61-89</Listing>
+<Listing>Nov 19-L at  North Carolina, 50-103</Listing>
+<Listing>Nov 21-L vs. UNC Greensboro, 67-79</Listing>
+<Listing>Nov 24-L at  NC State, 76-88</Listing>
+<Listing>Nov 29-W vs. Ferrum, 70-53</Listing>
+<Listing>Dec  5-L at  Georgia, 67-96</Listing>
+<Listing>Dec  9-W vs. Western Carolina, 74-73 O</Listing>
+<Listing>Dec 16-L at  High Point, 51-65</Listing>
+<Listing>Dec 19-L at  Wake Forest, 60-92</Listing>
+<Listing>Dec 27-L at  Wisconsin, 40-98</Listing>
+<Listing>Jan  2-L at  Jacksonville, 64-73</Listing>
+<Listing>Jan  4-W at  North Florida, 72-52</Listing>
+<Listing>Jan  7-L vs. East Tenn St, 63-66</Listing>
+<Listing>Jan 10-L vs. Kennesaw St, 60-77</Listing>
+<Listing>Jan 13-W at  Stetson, 77-64</Listing>
+<Listing>Jan 15-L at  Mercer, 74-85</Listing>
+<Listing>Jan 18- vs. Lipscomb, 7:00 PM</Listing>
+<Listing>Jan 20- vs. Belmont, 6:00 PM</Listing>
+<Listing>Jan 25- vs. Jacksonville, 6:00 PM</Listing>
+<Listing>Jan 27- vs. North Florida, 8:15 PM</Listing>
+<Listing>Jan 30- vs. Campbell, 7:00 PM</Listing>
+<Listing>Feb  2- at  East Tenn St, 7:00 PM</Listing>
+<Listing>Feb  4- at  Kennesaw St, 2:00 PM</Listing>
+<Listing>Feb  8- vs. Mercer, 7:00 PM</Listing>
+<Listing>Feb 10- vs. Stetson, 7:00 PM</Listing>
+<Listing>Feb 15- at  Belmont, 7:00 PM</Listing>
+<Listing>Feb 17- at  Lipscomb, 3:00 PM</Listing>
+<Listing>Feb 24- at  Campbell, 6:00 PM</Listing>
+</Team>
+<Team fullname="Jacksonville Dolphins">
+<Listing>Nov 12-L at  Savannah State, 64-67</Listing>
+<Listing>Nov 14-W vs. Saint Leo, 77-73</Listing>
+<Listing>Nov 16-L at  Florida, 61-90</Listing>
+<Listing>Nov 22-W vs. Florida Tech, 89-60</Listing>
+<Listing>Nov 25-W vs. SC State, 87-74</Listing>
+<Listing>Nov 27-L at  U-C-F, 62-99</Listing>
+<Listing>Nov 30-L at  Lipscomb, 61-73</Listing>
+<Listing>Dec  2-L at  Belmont, 62-76</Listing>
+<Listing>Dec 10-W vs. Coastal Carolina, 85-72</Listing>
+<Listing>Dec 16-L at  Texas A&amp;M, 58-97</Listing>
+<Listing>Dec 19-L at  Georgia, 77-93</Listing>
+<Listing>Dec 29-L at  South Carolina, 73-80</Listing>
+<Listing>Jan  2-W vs. Gardner-Webb, 73-64</Listing>
+<Listing>Jan  4-W vs. Campbell, 90-71</Listing>
+<Listing>Jan  9-W at  North Florida, 64-60</Listing>
+<Listing>Jan 13-L at  Kennesaw St, 76-83</Listing>
+<Listing>Jan 15-L at  East Tenn St, 59-71</Listing>
+<Listing>Jan 18- vs. Mercer, 7:00 PM</Listing>
+<Listing>Jan 20- vs. Stetson, 7:00 PM</Listing>
+<Listing>Jan 25- at  Gardner-Webb, 6:00 PM</Listing>
+<Listing>Jan 27- at  Campbell, 4:00 PM</Listing>
+<Listing>Feb  3- vs. North Florida, 6:00 PM</Listing>
+<Listing>Feb  8- vs. East Tenn St, 7:00 PM</Listing>
+<Listing>Feb 10- vs. Kennesaw St, 7:00 PM</Listing>
+<Listing>Feb 16- at  Mercer, 7:30 PM</Listing>
+<Listing>Feb 18- at  Stetson, 5:00 PM</Listing>
+<Listing>Feb 22- vs. Belmont, 6:00 PM</Listing>
+<Listing>Feb 24- vs. Lipscomb, 6:00 PM</Listing>
+<Listing></Listing>
+<Listing></Listing>
+<Listing></Listing>
+</Team>
+<Team fullname="Kennesaw Fighting Owls">
+<Listing>Nov 11-L vs. Western Ky, 55-96</Listing>
+<Listing>Nov 17-W at  St Peters, 67-60</Listing>
+<Listing>Nov 18-L at  Columbia, 51-63</Listing>
+<Listing>Nov 21-L vs. George Washington, 52-69</Listing>
+<Listing>Nov 25-L vs. Florida Intl, 68-70</Listing>
+<Listing>Nov 28-W vs. Newberry, 68-55</Listing>
+<Listing>Nov 30-L at  Stetson, 56-61</Listing>
+<Listing>Dec  2-L at  Mercer, 77-84 OT</Listing>
+<Listing>Dec 17-L at  Kansas State, 54-82</Listing>
+<Listing>Dec 19-L at  Wichita State, 65-74</Listing>
+<Listing>Dec 22-W at  MD-Eastern Shore, 67-49</Listing>
+<Listing>Dec 23-L at  Longwood, 85-87 OT</Listing>
+<Listing>Dec 29-L at  Chattanooga, 67-83</Listing>
+<Listing>Dec 30-W vs. Alabama State, 78-72</Listing>
+<Listing>Jan  2-W vs. Lipscomb, 66-55</Listing>
+<Listing>Jan  4-L vs. Belmont, 45-63</Listing>
+<Listing>Jan  6-L at  Campbell, 85-88 2OT</Listing>
+<Listing>Jan 10-W at  Gardner-Webb, 77-60</Listing>
+<Listing>Jan 13-W vs. Jacksonville, 83-76</Listing>
+<Listing>Jan 15-W vs. North Florida, 77-57</Listing>
+<Listing>Jan 19- at  East Tenn St, 7:30 PM</Listing>
+<Listing>Jan 25- at  Lipscomb, 8:00 PM</Listing>
+<Listing>Jan 27- at  Belmont, 7:00 PM</Listing>
+<Listing>Feb  2- vs. Campbell, 7:30 PM</Listing>
+<Listing>Feb  4- vs. Gardner-Webb, 2:00 PM</Listing>
+<Listing>Feb  8- at  North Florida, 7:00 PM</Listing>
+<Listing>Feb 10- at  Jacksonville, 7:00 PM</Listing>
+<Listing>Feb 14- at  Georgia, 7:30 PM</Listing>
+<Listing>Feb 17- vs. East Tenn St, 7:30 PM</Listing>
+<Listing>Feb 22- vs. Mercer, 7:30 PM</Listing>
+<Listing>Feb 24- vs. Stetson, 2:00 PM</Listing>
+</Team>
+<Team fullname="Lipscomb Bison">
+<Listing>Nov 11-W vs. Tusculum, 70-67</Listing>
+<Listing>Nov 13-W vs. Evansville, 67-64</Listing>
+<Listing>Nov 16-L at  Missouri, 69-89</Listing>
+<Listing>Nov 19-L at  South Carolina, 68-75</Listing>
+<Listing>Nov 25-W vs. Fisk, 80-68</Listing>
+<Listing>Nov 27-W vs. Winston-Salem St, 62-46</Listing>
+<Listing>Nov 30-W vs. Jacksonville, 73-61</Listing>
+<Listing>Dec  2-W vs. North Florida, 68-54</Listing>
+<Listing>Dec  7-L at  Vanderbilt, 50-59</Listing>
+<Listing>Dec 14-W vs. Nicholls State, 75-55</Listing>
+<Listing>Dec 16-L at  Evansville, 73-80</Listing>
+<Listing>Dec 21-W at  Liberty, 66-61</Listing>
+<Listing>Dec 29-L at  Alabama, 58-80</Listing>
+<Listing>Jan  2-L at  Kennesaw St, 55-66</Listing>
+<Listing>Jan  4-L at  East Tenn St, 72-75 OT</Listing>
+<Listing>Jan  7-W vs. Stetson, 79-68</Listing>
+<Listing>Jan  9-W vs. Mercer, 89-68</Listing>
+<Listing>Jan 12-W at  Belmont, 55-50</Listing>
+<Listing>Jan 18- at  Gardner-Webb, 7:00 PM</Listing>
+<Listing>Jan 20- at  Campbell, 1:00 PM</Listing>
+<Listing>Jan 25- vs. Kennesaw St, 8:00 PM</Listing>
+<Listing>Jan 27- vs. East Tenn St, 5:00 PM</Listing>
+<Listing>Feb  1- at  Mercer, 7:00 PM</Listing>
+<Listing>Feb  3- at  Stetson, 7:00 PM</Listing>
+<Listing>Feb  9- vs. Belmont, 6:30 PM</Listing>
+<Listing>Feb 15- vs. Campbell, 8:00 PM</Listing>
+<Listing>Feb 17- vs. Gardner-Webb, 3:00 PM</Listing>
+<Listing>Feb 22- at  North Florida, 7:00 PM</Listing>
+<Listing>Feb 24- at  Jacksonville, 6:00 PM</Listing>
+</Team>
+<Team fullname="Mercer Bears">
+<Listing>Nov 12-L at  Wisconsin, 48-72</Listing>
+<Listing>Nov 14-L at  Savannah State, 61-71</Listing>
+<Listing>Nov 18-W vs. Emory, 89-71</Listing>
+<Listing>Nov 27-L vs. Ga Southern, 59-61</Listing>
+<Listing>Nov 30-L vs. East Tenn St, 70-76</Listing>
+<Listing>Dec  2-W vs. Kennesaw St, 84-77 OT</Listing>
+<Listing>Dec  4-W vs. Char Southern, 78-59</Listing>
+<Listing>Dec  7-W vs. Fort Valley St, 79-74</Listing>
+<Listing>Dec  9-W at  Va Military, 105-103</Listing>
+<Listing>Dec 21-L at  Oregon State, 62-93</Listing>
+<Listing>Dec 23-L at  Oregon, 64-84</Listing>
+<Listing>Dec 30-L at  Furman, 69-83</Listing>
+<Listing>Jan  2-W vs. Stetson, 84-63</Listing>
+<Listing>Jan  7-L at  Belmont, 47-72</Listing>
+<Listing>Jan  9-L at  Lipscomb, 68-89</Listing>
+<Listing>Jan 13-W vs. Campbell, 94-93</Listing>
+<Listing>Jan 15-W vs. Gardner-Webb, 85-74</Listing>
+<Listing>Jan 18- at  Jacksonville, 7:00 PM</Listing>
+<Listing>Jan 20- at  North Florida, 4:00 PM</Listing>
+<Listing>Jan 24- vs. Savannah State, 7:00 PM</Listing>
+<Listing>Jan 26- at  Stetson, 7:30 PM</Listing>
+<Listing>Feb  1- vs. Lipscomb, 7:00 PM</Listing>
+<Listing>Feb  3- vs. Belmont, 6:00 PM</Listing>
+<Listing>Feb  8- at  Gardner-Webb, 7:00 PM</Listing>
+<Listing>Feb 10- at  Campbell, 7:00 PM</Listing>
+<Listing>Feb 16- vs. Jacksonville, 7:30 PM</Listing>
+<Listing>Feb 18- vs. North Florida, 2:00 PM</Listing>
+<Listing>Feb 22- at  Kennesaw St, 7:30 PM</Listing>
+<Listing>Feb 25- at  East Tenn St, 2:00 PM</Listing>
+</Team>
+<Team fullname="North Florida Ospreys">
+<Listing>Nov 10-L at  St Johns, 53-74</Listing>
+<Listing>Nov 11-L vs. Loyola-Maryland, 50-65</Listing>
+<Listing>Nov 14-L at  Florida, 40-86</Listing>
+<Listing>Nov 19-W vs. Concordia (NY), 77-72</Listing>
+<Listing>Nov 22-L vs. Fla Atlantic, 44-59</Listing>
+<Listing>Nov 25-L at  Northwestern, 39-40</Listing>
+<Listing>Nov 30-L at  Belmont, 32-87</Listing>
+<Listing>Dec  2-L at  Lipscomb, 54-68</Listing>
+<Listing>Dec  8-L at  William &amp; Mary, 44-61</Listing>
+<Listing>Dec 18-L vs. Binghamton, 61-79</Listing>
+<Listing>Dec 20-L vs. Florida A&amp;M, 65-66</Listing>
+<Listing>Dec 28-W vs. Skidmore, 70-43</Listing>
+<Listing>Jan  2-L vs. Campbell, 48-78</Listing>
+<Listing>Jan  4-L vs. Gardner-Webb, 52-72</Listing>
+<Listing>Jan  9-L vs. Jacksonville, 60-64</Listing>
+<Listing>Jan 13-L at  East Tenn St, 58-77</Listing>
+<Listing>Jan 15-L at  Kennesaw St, 57-77</Listing>
+<Listing>Jan 18- vs. Stetson, 7:00 PM</Listing>
+<Listing>Jan 20- vs. Mercer, 4:00 PM</Listing>
+<Listing>Jan 25- at  Campbell, 8:00 PM</Listing>
+<Listing>Jan 27- at  Gardner-Webb, 8:15 PM</Listing>
+<Listing>Jan 30- at  Savannah State, 7:00 PM</Listing>
+<Listing>Feb  3- at  Jacksonville, 6:00 PM</Listing>
+<Listing>Feb  8- vs. Kennesaw St, 7:00 PM</Listing>
+<Listing>Feb 10- vs. East Tenn St, 4:00 PM</Listing>
+<Listing>Feb 15- at  Stetson, 7:00 PM</Listing>
+<Listing>Feb 18- at  Mercer, 2:00 PM</Listing>
+<Listing>Feb 22- vs. Lipscomb, 7:00 PM</Listing>
+<Listing>Feb 24- vs. Belmont, 7:00 PM</Listing>
+<Listing></Listing>
+</Team>
+<Team fullname="Stetson Hatters">
+<Listing>Nov 10-L at  Army, 68-80</Listing>
+<Listing>Nov 11-W at  NC A&amp;T, 72-69</Listing>
+<Listing>Nov 12-L at  Missouri, 45-66</Listing>
+<Listing>Nov 18-L at  U-C-F, 60-73</Listing>
+<Listing>Nov 20-W vs. Palm Beach Atlantic, 80-6</Listing>
+<Listing>Nov 27-L at  South Florida, 72-77 2OT</Listing>
+<Listing>Nov 30-W vs. Kennesaw St, 61-56</Listing>
+<Listing>Dec  2-L vs. East Tenn St, 61-75</Listing>
+<Listing>Dec  5-L vs. Florida State, 63-82</Listing>
+<Listing>Dec 16-L at  Miami-Florida, 64-89</Listing>
+<Listing>Dec 20-L at  Florida, 67-88</Listing>
+<Listing>Dec 23-W at  Savannah State, 58-46</Listing>
+<Listing>Dec 30-W vs. Skidmore, 85-55</Listing>
+<Listing>Jan  2-L at  Mercer, 63-84</Listing>
+<Listing>Jan  7-L at  Lipscomb, 68-79</Listing>
+<Listing>Jan  9-L at  Belmont, 71-73</Listing>
+<Listing>Jan 13-L vs. Gardner-Webb, 64-77</Listing>
+<Listing>Jan 15-W vs. Campbell, 82-73</Listing>
+<Listing>Jan 18- at  North Florida, 7:00 PM</Listing>
+<Listing>Jan 20- at  Jacksonville, 7:00 PM</Listing>
+<Listing>Jan 26- vs. Mercer, 7:30 PM</Listing>
+<Listing>Feb  1- vs. Belmont, 6:00 PM</Listing>
+<Listing>Feb  3- vs. Lipscomb, 7:00 PM</Listing>
+<Listing>Feb  8- at  Campbell, 7:00 PM</Listing>
+<Listing>Feb 10- at  Gardner-Webb, 7:00 PM</Listing>
+<Listing>Feb 13- vs. Savannah State, 7:00 PM</Listing>
+<Listing>Feb 15- vs. North Florida, 7:00 PM</Listing>
+<Listing>Feb 18- vs. Jacksonville, 5:00 PM</Listing>
+<Listing>Feb 23- at  East Tenn St, 7:30 PM</Listing>
+<Listing>Feb 24- at  Kennesaw St, 2:00 PM</Listing>
+</Team>
+</Conference_Schedule>
+<time_stamp> January 18, 2007, at 03:41 AM ET </time_stamp>
+</message>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.dtd
new file mode 100644
index 00000000000..9e4dd578483
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.dtd
@@ -0,0 +1,39 @@
+<!ELEMENT SupplierOrder (OrderId, OrderDate, ShippingAddress, LineItems)>
+
+<!ELEMENT OrderId (#PCDATA)>
+
+<!ELEMENT OrderDate (#PCDATA)>
+
+<!ELEMENT ShippingAddress (FirstName, LastName, Street, City, State, Country, ZipCode, Email, Phone)>
+
+<!ELEMENT FirstName (#PCDATA)>
+
+<!ELEMENT LastName (#PCDATA)>
+
+<!ELEMENT Street (#PCDATA)>
+
+<!ELEMENT City (#PCDATA)>
+
+<!ELEMENT State (#PCDATA)>
+
+<!ELEMENT Country (#PCDATA)>
+
+<!ELEMENT ZipCode (#PCDATA)>
+
+<!ELEMENT Email (#PCDATA)>
+
+<!ELEMENT Phone (#PCDATA)>
+
+<!ELEMENT LineItems (LineItem+)>
+
+<!ELEMENT LineItem EMPTY>
+
+<!ATTLIST LineItem
+     categoryId CDATA #REQUIRED
+     productId CDATA #REQUIRED
+     itemId CDATA #REQUIRED
+     lineNo CDATA #REQUIRED
+     quantity CDATA #REQUIRED
+     unitPrice CDATA #REQUIRED
+>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.out b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.out
new file mode 100644
index 00000000000..e946a45a944
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.out
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE SupplierOrder SYSTEM "Bug4693341.dtd">
+<SupplierOrder>
+<OrderId>10016</OrderId>
+<OrderDate>Wed May 29 12:45:00 PDT 2002</OrderDate>
+<ShippingAddress>
+<FirstName>ABC</FirstName>
+<LastName>XYZ</LastName>
+<Street>1234 Anywhere Street</Street>
+<City>Palo Alto</City>
+<State>California</State>
+<Country>USA</Country>
+<ZipCode>94303</ZipCode>
+<Email>NULL</Email>
+<Phone>NULL</Phone>
+</ShippingAddress>
+<LineItems>
+<LineItem categoryId="BIRDS" itemId="EST-18" lineNo="0" productId="AV-CB-01" quantity="1" unitPrice="193.5"/>
+</LineItems>
+</SupplierOrder>
\ No newline at end of file
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.xml
new file mode 100644
index 00000000000..13f72a5693f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE SupplierOrder SYSTEM "Bug4693341.dtd" >
+<SupplierOrder>
+<OrderId>10016</OrderId>
+<OrderDate>Wed May 29 12:45:00 PDT 2002</OrderDate>
+<ShippingAddress>
+<FirstName>ABC</FirstName>
+<LastName>XYZ</LastName>
+<Street>1234 Anywhere Street</Street>
+<City>Palo Alto</City>
+<State>California</State>
+<Country>USA</Country>
+<ZipCode>94303</ZipCode>
+<Email>NULL</Email>
+<Phone>NULL</Phone>
+</ShippingAddress>
+<LineItems>
+<LineItem categoryId="BIRDS" itemId="EST-18" lineNo="0" productId="AV-CB-01" quantity="1" unitPrice="193.5"/>
+</LineItems>
+</SupplierOrder>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341Test.java
new file mode 100644
index 00000000000..605baf81ef5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341Test.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.net.URL;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4693341
+ * @summary Test transform with external dtd.
+ */
+public class Bug4693341Test {
+
+    @Test
+    public void test() {
+        boolean status = false;
+
+        try {
+            Transformer transformer = TransformerFactory.newInstance().newTransformer();
+
+            String out = getClass().getResource("Bug4693341.out").getPath();
+            StreamResult result = new StreamResult(new FileOutputStream(out));
+
+            String in = getClass().getResource("Bug4693341.xml").getPath();
+            File file = new File(in);
+            StreamSource source = new StreamSource(new FileInputStream(file), ("file://" + in));
+
+            transformer.transform(source, result);
+
+            //URL inputsource = new URL("file", "", golden);
+            URL output = new URL("file", "", out);
+
+            // error happens when trying to parse output
+            String systemId = output.toExternalForm();
+            System.out.println("systemId: " + systemId);
+            InputSource is = new InputSource(systemId);
+            SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
+            parser.parse(is, new DefaultHandler());
+
+        } catch (Exception ex) {
+            Assert.fail(ex.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341_golden.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341_golden.dtd
new file mode 100644
index 00000000000..9e4dd578483
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341_golden.dtd
@@ -0,0 +1,39 @@
+<!ELEMENT SupplierOrder (OrderId, OrderDate, ShippingAddress, LineItems)>
+
+<!ELEMENT OrderId (#PCDATA)>
+
+<!ELEMENT OrderDate (#PCDATA)>
+
+<!ELEMENT ShippingAddress (FirstName, LastName, Street, City, State, Country, ZipCode, Email, Phone)>
+
+<!ELEMENT FirstName (#PCDATA)>
+
+<!ELEMENT LastName (#PCDATA)>
+
+<!ELEMENT Street (#PCDATA)>
+
+<!ELEMENT City (#PCDATA)>
+
+<!ELEMENT State (#PCDATA)>
+
+<!ELEMENT Country (#PCDATA)>
+
+<!ELEMENT ZipCode (#PCDATA)>
+
+<!ELEMENT Email (#PCDATA)>
+
+<!ELEMENT Phone (#PCDATA)>
+
+<!ELEMENT LineItems (LineItem+)>
+
+<!ELEMENT LineItem EMPTY>
+
+<!ATTLIST LineItem
+     categoryId CDATA #REQUIRED
+     productId CDATA #REQUIRED
+     itemId CDATA #REQUIRED
+     lineNo CDATA #REQUIRED
+     quantity CDATA #REQUIRED
+     unitPrice CDATA #REQUIRED
+>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341_golden.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341_golden.xml
new file mode 100644
index 00000000000..5c0928e85ab
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4693341_golden.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE SupplierOrder SYSTEM "Bug4693341_golden.dtd" >
+<SupplierOrder>
+<OrderId>10016</OrderId>
+<OrderDate>Wed May 29 12:45:00 PDT 2002</OrderDate>
+<ShippingAddress>
+<FirstName>ABC</FirstName>
+<LastName>XYZ</LastName>
+<Street>1234 Anywhere Street</Street>
+<City>Palo Alto</City>
+<State>California</State>
+<Country>USA</Country>
+<ZipCode>94303</ZipCode>
+<Email>NULL</Email>
+<Phone>NULL</Phone>
+</ShippingAddress>
+<LineItems>
+<LineItem categoryId="BIRDS" itemId="EST-18" lineNo="0" productId="AV-CB-01" quantity="1" unitPrice="193.5"/>
+</LineItems>
+</SupplierOrder>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4892774.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4892774.java
new file mode 100644
index 00000000000..c4b54f80cd0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug4892774.java
@@ -0,0 +1,372 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.stax.StAXResult;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.util.DOMUtil;
+import javax.xml.transform.util.SAXUtil;
+import javax.xml.transform.util.StAXUtil;
+import javax.xml.transform.util.StreamUtil;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4892774
+ * @summary Test identity transformer with all possible types of Source and Result combinations for doucment version and encoding information.
+ */
+
+public class Bug4892774 {
+
+    private final String XML_FILE = "catalog.xml";
+    private final String XML10_FILE = "catalog_10.xml"; // 1.0 version document
+    private final String TEMP_FILE = "tmp.xml";
+    private final String EXPECTED_VERSION = "1.1";
+    static private Transformer idTransform = null;
+
+    private static DOMUtil domUtil = null;
+    private static StreamUtil streamUtil = null;
+    private static SAXUtil saxUtil = null;
+    private static StAXUtil staxUtil = null;
+
+    @BeforeMethod
+    protected void setUp() {
+        File tmpFile = new File(TEMP_FILE);
+        if (tmpFile.exists())
+            tmpFile.delete();
+        try {
+
+            if (idTransform == null)
+                idTransform = getIdTransformer();
+            else
+                idTransform.reset();
+
+            initializeUtils();
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured during setUp(): " + e.getMessage());
+        }
+    }
+
+    @AfterMethod
+    protected void tearDown() {
+        File tmpFile = new File(TEMP_FILE);
+        if (tmpFile.exists())
+            tmpFile.delete();
+    }
+
+    private void initializeUtils() throws Exception {
+        if (domUtil == null)
+            domUtil = (DOMUtil) TransformerUtilFactory.getUtil(TransformerUtilFactory.DOM);
+        if (saxUtil == null)
+            saxUtil = (SAXUtil) TransformerUtilFactory.getUtil(TransformerUtilFactory.SAX);
+        if (streamUtil == null)
+            streamUtil = (StreamUtil) TransformerUtilFactory.getUtil(TransformerUtilFactory.STREAM);
+        if (staxUtil == null)
+            staxUtil = (StAXUtil) TransformerUtilFactory.getUtil(TransformerUtilFactory.StAX);
+    }
+
+    @Test
+    public void testDOM2DOM() {
+        try {
+            Source input = domUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+            DOMResult domResult = (DOMResult) domUtil.prepareResult();
+            idTransform.transform(input, domResult);
+            domUtil.checkResult(domResult, EXPECTED_VERSION);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    private Transformer getIdTransformer() throws Exception {
+        return TransformerFactory.newInstance().newTransformer();
+    }
+
+    @Test
+    public void testDOM2Stream() {
+        try {
+
+            Source input = domUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+            StreamResult strResult = (StreamResult) streamUtil.prepareResult();
+            idTransform.transform(input, strResult);
+            streamUtil.checkResult(strResult, EXPECTED_VERSION, "UTF-8");
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testDOM2SAX() {
+        try {
+            Source input = domUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+            SAXResult saxResult = (SAXResult) saxUtil.prepareResult();
+            idTransform.transform(input, saxResult);
+            saxUtil.checkResult(saxResult, EXPECTED_VERSION, "UTF-8");
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testDOM2StAX() {
+        try {
+            Source input = domUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+            StAXResult staxResult = (StAXResult) staxUtil.prepareResult();
+            idTransform.transform(input, staxResult);
+            staxUtil.checkResult(staxResult, EXPECTED_VERSION, "UTF-8");
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testDOM2StAXStream() {
+        try {
+            Source input = domUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+            StAXResult staxResult = (StAXResult) staxUtil.prepareStreamResult();
+            idTransform.transform(input, staxResult);
+            staxUtil.checkStreamResult(staxResult, EXPECTED_VERSION);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSAX2DOM() {
+        try {
+            Source input = saxUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+            DOMResult domResult = (DOMResult) domUtil.prepareResult();
+            idTransform.transform(input, domResult);
+            domUtil.checkResult(domResult, EXPECTED_VERSION);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSAX2SAX() {
+        try {
+            Source input = saxUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+            SAXResult saxResult = (SAXResult) saxUtil.prepareResult();
+            idTransform.transform(input, saxResult);
+            saxUtil.checkResult(saxResult, EXPECTED_VERSION, "UTF-8");
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSAX2Stream() {
+        try {
+            Source input = saxUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+            StreamResult strResult = (StreamResult) streamUtil.prepareResult();
+            idTransform.transform(input, strResult);
+            streamUtil.checkResult(strResult, EXPECTED_VERSION, "UTF-8");
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSAX2StAX() {
+        try {
+            Source input = saxUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+            StAXResult staxResult = (StAXResult) staxUtil.prepareResult();
+            idTransform.transform(input, staxResult);
+            staxUtil.checkResult(staxResult, EXPECTED_VERSION, "UTF-8");
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testSAX2StAXStream() {
+        try {
+            Source input = saxUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+            StAXResult staxResult = (StAXResult) staxUtil.prepareStreamResult();
+            idTransform.transform(input, staxResult);
+            staxUtil.checkStreamResult(staxResult, EXPECTED_VERSION);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testStream2DOM() {
+        try {
+            Source input = streamUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+            DOMResult domResult = (DOMResult) domUtil.prepareResult();
+            idTransform.transform(input, domResult);
+            domUtil.checkResult(domResult, EXPECTED_VERSION);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testStream2Stream() {
+        try {
+            Source input = streamUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+            StreamResult strResult = (StreamResult) streamUtil.prepareResult();
+            idTransform.transform(input, strResult);
+            streamUtil.checkResult(strResult, EXPECTED_VERSION, "UTF-8");
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testStream2Stax() {
+        try {
+            Source input = streamUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+            StAXResult staxResult = (StAXResult) staxUtil.prepareResult();
+            idTransform.transform(input, staxResult);
+            staxUtil.checkResult(staxResult, EXPECTED_VERSION, "UTF-8");
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testStream2StaxStream() {
+        try {
+            Source input = streamUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+            StAXResult staxResult = (StAXResult) staxUtil.prepareStreamResult();
+            idTransform.transform(input, staxResult);
+            staxUtil.checkStreamResult(staxResult, EXPECTED_VERSION);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testStream2SAX() {
+        try {
+            Source input = streamUtil.prepareSource(this.getClass().getResourceAsStream(XML_FILE));
+            SAXResult saxResult = (SAXResult) saxUtil.prepareResult();
+            idTransform.transform(input, saxResult);
+            saxUtil.checkResult(saxResult, EXPECTED_VERSION, "UTF-8");
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testStAX2DOM() {
+        try {
+            Source input = staxUtil.prepareStreamSource(this.getClass().getResourceAsStream(XML10_FILE));
+            DOMResult domResult = (DOMResult) domUtil.prepareResult();
+            idTransform.transform(input, domResult);
+            domUtil.checkResult(domResult, "1.0");
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testStAX2Stream() {
+        try {
+            Source input = staxUtil.prepareStreamSource(this.getClass().getResourceAsStream(XML10_FILE));
+            StreamResult strResult = (StreamResult) streamUtil.prepareResult();
+            idTransform.transform(input, strResult);
+            streamUtil.checkResult(strResult, "1.0", "UTF-8");
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testStAX2StAX() {
+        try {
+            Source input = staxUtil.prepareStreamSource(this.getClass().getResourceAsStream(XML10_FILE));
+            StAXResult staxResult = (StAXResult) staxUtil.prepareResult();
+            idTransform.transform(input, staxResult);
+            staxUtil.checkResult(staxResult, "1.0", "UTF-8");
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testStAXEvent2DOM() {
+        try {
+            Source input = staxUtil.prepareSource(this.getClass().getResourceAsStream(XML10_FILE));
+            DOMResult domResult = (DOMResult) domUtil.prepareResult();
+            idTransform.transform(input, domResult);
+            domUtil.checkResult(domResult, "1.0");
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testStAXEvent2Stream() {
+        try {
+            Source input = staxUtil.prepareSource(this.getClass().getResourceAsStream(XML10_FILE));
+            StreamResult strResult = (StreamResult) streamUtil.prepareResult();
+            idTransform.transform(input, strResult);
+            streamUtil.checkResult(strResult, "1.0", "UTF-8");
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug5073477.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug5073477.java
new file mode 100644
index 00000000000..7d061c2c2c0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug5073477.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMResult;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+
+/*
+ * @bug 5073477
+ * @summary Test DOMResult.setNextSibling works correctly.
+ */
+public class Bug5073477 {
+
+    @Test
+    public void test1() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder parser = dbf.newDocumentBuilder();
+        Document dom = parser.parse(Bug5073477.class.getResourceAsStream("Bug5073477.xml"));
+
+        DOMResult r = new DOMResult();
+
+        r.setNode(dom.getDocumentElement());
+        r.setNextSibling(r.getNode().getFirstChild());
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug5073477.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug5073477.xml
new file mode 100644
index 00000000000..fd275a92046
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug5073477.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<root>
+  <f1/>
+  <f2/>
+  <f3/>
+</root>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6175602.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6175602.java
new file mode 100644
index 00000000000..ae568341344
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6175602.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+
+import javax.xml.transform.Templates;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6175602
+ * @summary Test compilation of MsWordXMLImport.xsl.
+ */
+public class Bug6175602 {
+
+    public Bug6175602() {
+    }
+
+    @Test
+    public void test926007_1() throws Exception {
+        TransformerFactory factory = TransformerFactory.newInstance();
+        File f = new File(getClass().getResource("MsWordXMLImport.xsl.data").getPath());
+        Templates t = factory.newTemplates(new StreamSource(f));
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.java
new file mode 100644
index 00000000000..9b508796ac9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6206491
+ * @summary Test key searches over more than one document.
+ */
+public class Bug6206491 {
+
+    private String getResource(String s) {
+        return getClass().getResource(s).toString();
+
+    }
+
+    @Test
+    public void test() {
+        try {
+            Document document = getNewXmlDoc(new File(getClass().getResource("Bug6206491.xml").getFile()));
+
+            xmlxsl2html(TransformerFactory.newInstance(), new File(getClass().getResource("Bug6206491.xsl").getFile()), document);
+        } catch (Exception ex) {
+            System.err.println(ex.getMessage());
+            ex.printStackTrace(System.err);
+            Assert.fail(ex.toString());
+        }
+    }
+
+    void xmlxsl2html(TransformerFactory tFactory, File xslFile, Document document) throws Exception {
+        try {
+            // tFactory.setAttribute("generate-translet", Boolean.TRUE);
+        } catch (Exception e) {
+            // Ignore
+        }
+
+        try {
+            StreamSource stylesource = new StreamSource(xslFile);
+            Transformer transformer = tFactory.newTransformer(stylesource);
+
+            transformer.clearParameters();
+
+            DOMSource source = new DOMSource(document);
+
+            StringWriter sw = new StringWriter();
+            StreamResult result = new StreamResult(sw);
+            transformer.transform(source, result);
+            String s = sw.toString();
+            Assert.assertFalse(s.contains("<must-be-one>0</must-be-one>"));
+        } catch (TransformerConfigurationException ex) {
+            throw ex;
+
+        } catch (TransformerException ex) {
+            throw ex;
+        }
+    }
+
+    Document getNewXmlDoc(File xmlFile) throws Exception {
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        factory.setNamespaceAware(true);
+        factory.setValidating(true);
+
+        try {
+            DocumentBuilder builder = factory.newDocumentBuilder();
+            builder.setErrorHandler(new org.xml.sax.helpers.DefaultHandler() {
+                public void fatalError(SAXParseException e) throws SAXParseException {
+                    throw e;
+                }
+
+                public void error(SAXParseException e) throws SAXParseException {
+                    throw e;
+                }
+
+                public void warning(SAXParseException e) throws SAXParseException {
+                    throw e;
+                }
+            });
+            return builder.parse(xmlFile);
+
+        } catch (SAXException ex) {
+            throw ex;
+        } catch (ParserConfigurationException ex) {
+            throw ex;
+        } catch (IOException ex) {
+            throw ex;
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.xml
new file mode 100644
index 00000000000..7415fa8208b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE organization [
+    <!ELEMENT organization (company*,ids)>
+    <!ELEMENT company (#PCDATA | department | equipment:instance)*>
+    <!ELEMENT ids (id*)>
+    <!ELEMENT id EMPTY>
+    <!ELEMENT department EMPTY>
+    <!ELEMENT equipment:instance EMPTY>
+
+    <!ATTLIST organization  id              ID  #IMPLIED
+                            xmlns:equipment CDATA  #FIXED "http://namespaces.tksoft.com/equipment/"
+    >
+    <!ATTLIST company   id                  ID  #REQUIRED
+                        count               CDATA  #REQUIRED
+    >
+    <!ATTLIST department    id              ID  #REQUIRED
+    >
+    <!ATTLIST equipment:instance    id          ID  #REQUIRED
+    >
+    <!ATTLIST id
+        value       IDREF   #REQUIRED
+    >
+]>
+<organization>
+    <company id="ca" count="2">
+        <department id="da"/>
+        <equipment:instance id="ea"/>
+        <equipment:instance id="eb"/>
+    </company>
+    <company id="cb" count="0"/>
+    <company id="cc" count="5"/>
+    <ids>
+        <id value="ca"/>
+        <id value="cb"/>
+    </ids>
+</organization>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.xsl
new file mode 100644
index 00000000000..33bb901a3f8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491.xsl
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+    
+    <xsl:output method="xml" indent="yes"/>
+    
+    <xsl:variable name="ids" select="//ids//id"/>
+    <xsl:variable name="dummy" select="document('Bug6206491_2.xml')"/>
+    
+    <xsl:template match="/"> 
+        <test1><xsl:apply-templates select="$ids"/></test1>
+        <test2><xsl:apply-templates select="$dummy//ids/id"/></test2>
+    </xsl:template>
+    
+    <xsl:template match="id">
+        <xsl:variable name="entity" select="id(@value)"/> 
+        <must-be-one><xsl:value-of select="count($entity)"/></must-be-one>
+    </xsl:template>
+    
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491_2.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491_2.xml
new file mode 100644
index 00000000000..0d21ad499b9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6206491_2.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE organization2 [
+    <!ELEMENT organization2 (company*,ids)>
+    <!ELEMENT company (#PCDATA | department)*>
+    <!ELEMENT ids (id*)>
+    <!ELEMENT id EMPTY>
+    <!ELEMENT department EMPTY>
+    
+    <!ATTLIST organization  id              ID  #IMPLIED
+    >
+    <!ATTLIST company   id                  ID  #REQUIRED
+                        count               CDATA  #REQUIRED
+    >
+    <!ATTLIST department    id              ID  #REQUIRED
+    >
+    <!ATTLIST id
+        value       IDREF   #REQUIRED
+    >
+]>
+<organization2>
+    <company id="xca" count="2">
+        <department id="xda"/>
+    </company>
+    <company id="xcb" count="0"/>
+    <company id="xcc" count="5"/>
+    <ids>
+        <id value="xca"/>
+        <id value="xcb"/>
+    </ids>
+</organization2>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6216226Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6216226Test.java
new file mode 100644
index 00000000000..ec856b7116f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6216226Test.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+import java.io.StringReader;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6216226
+ * @summary Test StreamResult(File) is closed after transform().
+ */
+public class Bug6216226Test {
+
+    @Test
+    public final void test() {
+        try {
+            File test = new File("bug6216226.txt");
+            TransformerFactory tf = TransformerFactory.newInstance();
+            Transformer xformer = tf.newTransformer();
+            StringReader st = new StringReader("<?xml version=\"1.0\" encoding=\"UTF-8\"?><doc></doc>");
+            StreamSource s = new StreamSource(st);
+            StreamResult r = new StreamResult(test);
+            xformer.transform(s, r);
+            if (!test.delete()) {
+                Assert.fail("cannot delete file: " + test.getPath());
+            }
+        } catch (Exception e) {
+            // unexpected failure
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6311448.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6311448.java
new file mode 100644
index 00000000000..5b395170918
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6311448.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/*
+ * @bug 6311448
+ * @summary Test XML transformer can output Unicode surrorate pair.
+ */
+public class Bug6311448 {
+
+    @Test
+    public void test01() {
+        try {
+            String attrKey = "key";
+            String attrValue = "\ud800\udc00"; // 17-bit code point in UTF-16
+
+            // Some obvious assertions for documentation purposes
+            Assert.assertTrue(Character.isSurrogatePair('\ud800', '\udc00'));
+            Assert.assertTrue(Character.toCodePoint('\ud800', '\udc00') == 65536);
+            Assert.assertTrue(Character.charCount(Character.toCodePoint('\ud800', '\udc00')) == 2);
+
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            Transformer t = TransformerFactory.newInstance().newTransformer();
+
+            // Create a DOM with 'attrValue' in it
+            Document doc = dbf.newDocumentBuilder().getDOMImplementation().createDocument(null, null, null);
+            Element xmlRoot = doc.createElement("root");
+            xmlRoot.setAttribute(attrKey, attrValue);
+            doc.appendChild(xmlRoot);
+
+            // Serialize DOM into a byte array
+            ByteArrayOutputStream baos = new ByteArrayOutputStream();
+            t.setOutputProperty("encoding", "utf-8");
+            t.transform(new DOMSource(doc), new StreamResult(baos));
+
+            // Re-parse byte array back into a DOM
+            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
+            doc = dbf.newDocumentBuilder().parse(bais);
+            String newValue = doc.getDocumentElement().getAttribute(attrKey);
+            Assert.assertTrue(newValue.charAt(0) == '\ud800' && newValue.charAt(1) == '\udc00');
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6384805.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6384805.java
new file mode 100644
index 00000000000..c59b9555f0a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6384805.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.util.Iterator;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6384805
+ * @summary Test XSLTC can parse XML namespace when nodeset is created within a template.
+ */
+public class Bug6384805 {
+
+    @Test
+    public void test0() {
+        try {
+            TransformerFactory tf = TransformerFactory.newInstance();
+
+            try {
+                // tf.setAttribute("generate-translet", Boolean.TRUE);
+            } catch (IllegalArgumentException e) {
+                // ignore
+            }
+
+            Transformer t = tf.newTransformer(new StreamSource(getClass().getResourceAsStream("tigertest.xsl"), getClass().getResource("tigertest.xsl")
+                    .toString()));
+
+            StreamSource src = new StreamSource(getClass().getResourceAsStream("tigertest-in.xml"));
+            DOMResult res = new DOMResult();
+            t.transform(src, res);
+
+            // Verify output of transformation
+            XPath query = XPathFactory.newInstance().newXPath();
+
+            query.setNamespaceContext(new NamespaceContext() {
+                public String getNamespaceURI(String prefix) {
+                    return prefix.equals("style") ? "http://openoffice.org/2000/style" : prefix.equals("office") ? "http://openoffice.org/2000/office" : null;
+                }
+
+                public String getPrefix(String namespaceURI) {
+                    return null;
+                }
+
+                public Iterator getPrefixes(String namespaceURI) {
+                    return null;
+                }
+            });
+
+            // Find the value of the style:family attribute
+            Object o1 = query.evaluate("/test/office:document/office:styles/style:default-style/@style:family", res.getNode(), XPathConstants.STRING);
+
+            Assert.assertTrue(o1.equals("graphics"));
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6465722.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6465722.java
new file mode 100644
index 00000000000..3a261092f0e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6465722.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+
+/*
+ * @bug 6465722
+ * @summary Test Transformer can transform the node attribute prefixed with a namespace.
+ */
+public class Bug6465722 {
+
+    public Bug6465722(String name) {
+    }
+
+    private static final String IDENTITY_XSLT = "<xsl:stylesheet version='1.0' " + "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>"
+            + "<xsl:template match='@*|node()'>" + "<xsl:copy>" + "<xsl:apply-templates select='@*|node()'/>" + "</xsl:copy>" + "</xsl:template>"
+            + "</xsl:stylesheet>";
+
+    @Test
+    public void test() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            Document d = dbf.newDocumentBuilder().getDOMImplementation().createDocument(null, "r", null);
+            d.getDocumentElement().setAttributeNS("http://nowhere.net/", "id", "1");
+
+            Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(new StringReader(IDENTITY_XSLT)));
+            t.transform(new DOMSource(d), new StreamResult(new StringWriter()));
+        } catch (Throwable ex) {
+            Assert.fail("Exception: " + ex.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6467808.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6467808.java
new file mode 100644
index 00000000000..e32947c1814
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6467808.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6467808
+ * @summary Test Transformer can parse re-declare prefixed namespace mappings.
+ */
+public class Bug6467808 {
+
+    private static final String TESTXML = "<?xml version='1.0' ?>\n"
+            + "<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:ns1='http://faulttestservice.org/wsdl'>\n"
+            + "<soapenv:Body>\n" + "<soapenv:Fault xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/'>\n" + "<faultcode>\n"
+            + "soapenv:Server</faultcode>\n" + "<faultstring>\n" + "com.sun.ts.tests.jaxws.sharedwebservices.faultservice.DummyException</faultstring>\n"
+            + "<detail>\n" + "<ns1:DummyException>\n" + "<dummyField1>\n" + "dummyString1</dummyField1>\n" + "<dummyField2>\n" + "dummyString2</dummyField2>\n"
+            + "</ns1:DummyException>\n" + "</detail>\n" + "</soapenv:Fault>\n" + "</soapenv:Body>\n" + "</soapenv:Envelope>\n";
+
+    // simplest XML to re-declare same prefix/namespace mappings
+    private static final String SIMPLE_TESTXML = "<?xml version='1.0' ?>\n" + "<prefix:ElementName xmlns:prefix='URI'>\n"
+            + "<prefix:ElementName xmlns:prefix='URI'>\n" + "</prefix:ElementName>\n" + "</prefix:ElementName>\n";
+
+    @Test
+    public void test() {
+        try {
+            SAXParserFactory fac = SAXParserFactory.newInstance();
+            fac.setNamespaceAware(true);
+            SAXParser saxParser = fac.newSAXParser();
+
+            StreamSource src = new StreamSource(new StringReader(SIMPLE_TESTXML));
+            Transformer transformer = TransformerFactory.newInstance().newTransformer();
+            DOMResult result = new DOMResult();
+            transformer.transform(src, result);
+        } catch (Throwable ex) {
+            // unexpected failure
+            ex.printStackTrace();
+            Assert.fail(ex.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6490380.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6490380.java
new file mode 100644
index 00000000000..5ec65e81110
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6490380.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringWriter;
+import java.net.URL;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6490380
+ * @summary Test only a single DOCTYPE declaration is generated through transforming.
+ */
+public class Bug6490380 {
+
+    @Test
+    public void test() {
+        try {
+            Transformer transformer = TransformerFactory.newInstance().newTransformer();
+            URL input = Bug6490380.class.getResource("Bug4693341.xml");
+            StreamSource source = new StreamSource(input.openStream(), input.toString());
+            StringWriter sw = new StringWriter();
+            transformer.transform(source, new StreamResult(sw));
+            String s = sw.toString();
+            Assert.assertEquals(s.indexOf("!DOCTYPE"), s.lastIndexOf("!DOCTYPE"));
+        } catch (Exception ex) {
+            Assert.fail(ex.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6490921.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6490921.java
new file mode 100644
index 00000000000..b8ec881fdc6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6490921.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.XMLFilterImpl;
+
+/*
+ * @bug 6490921
+ * @summary Test property org.xml.sax.driver is always applied in transformer API.
+ */
+public class Bug6490921 {
+
+    public static class ReaderStub extends XMLFilterImpl {
+        static boolean used = false;
+
+        public ReaderStub() throws ParserConfigurationException, SAXException {
+            super();
+            super.setParent(SAXParserFactory.newInstance().newSAXParser().getXMLReader());
+        }
+
+        public void parse(InputSource input) throws SAXException, IOException {
+            used = true;
+            super.parse(input);
+        }
+
+        public void parse(String systemId) throws SAXException, IOException {
+            used = true;
+            super.parse(systemId);
+        }
+    }
+
+    @Test
+    public void test01() {
+        String xml = "<?xml version='1.0'?><root/>";
+        ReaderStub.used = false;
+        System.setProperty("org.xml.sax.driver", "");
+
+        // Don't set 'org.xml.sax.driver' here, just use default
+        try {
+            TransformerFactory transFactory = TransformerFactory.newInstance();
+            Transformer transformer = transFactory.newTransformer();
+            InputSource in = new InputSource(new StringReader(xml));
+            SAXSource source = new SAXSource(in);
+            StreamResult result = new StreamResult(new StringWriter());
+            transformer.transform(source, result);
+            Assert.assertTrue(!printWasReaderStubCreated());
+        } catch (Exception ex) {
+            Assert.fail(ex.getMessage());
+        }
+    }
+
+    @Test
+    public void test02() {
+        String xml = "<?xml version='1.0'?><root/>";
+        ReaderStub.used = false;
+        System.setProperty("org.xml.sax.driver", ReaderStub.class.getName());
+        try {
+            TransformerFactory transFactory = TransformerFactory.newInstance();
+            Transformer transformer = transFactory.newTransformer();
+            InputSource in = new InputSource(new StringReader(xml));
+            SAXSource source = new SAXSource(in);
+            StreamResult result = new StreamResult(new StringWriter());
+            transformer.transform(source, result);
+            Assert.assertTrue(printWasReaderStubCreated());
+        } catch (Exception ex) {
+            Assert.fail(ex.getMessage());
+        }
+    }
+
+    @Test
+    public void test03() {
+        String xsl = "<?xml version='1.0'?>\n" + "<xsl:stylesheet" + " xmlns:xsl='http://www.w3.org/1999/XSL/Transform'" + " version='1.0'>\n"
+                + "   <xsl:template match='/'>Hello World!</xsl:template>\n" + "</xsl:stylesheet>\n";
+
+        ReaderStub.used = false;
+        System.setProperty("org.xml.sax.driver", ReaderStub.class.getName());
+        try {
+            TransformerFactory transFactory = TransformerFactory.newInstance();
+            if (transFactory.getFeature(SAXTransformerFactory.FEATURE) == false) {
+                System.out.println("SAXTransformerFactory not supported");
+            }
+            InputSource in = new InputSource(new StringReader(xsl));
+            SAXSource source = new SAXSource(in);
+
+            transFactory.newTransformer(source);
+            Assert.assertTrue(printWasReaderStubCreated());
+        } catch (TransformerException e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    private static boolean printWasReaderStubCreated() {
+        if (ReaderStub.used) {
+            System.out.println("\tReaderStub is used.");
+            return ReaderStub.used;
+        } else {
+            System.out.println("\tReaderStub is not used.");
+            return ReaderStub.used;
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6505031.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6505031.java
new file mode 100644
index 00000000000..931bf6dc34b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6505031.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringWriter;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6505031
+ * @summary Test transformer parses keys and their values coming from different xml documents.
+ */
+public class Bug6505031 {
+
+    private String getResource(String s) {
+        return getClass().getResource(s).toString();
+
+    }
+
+    @Test
+    public void test() {
+        Map params = new HashMap();
+
+        params.put("config", getResource("config.xml"));
+        params.put("mapsFile", getResource("maps.xml"));
+        generate(getResource("template.xml"), getResource("transform.xsl"), params);
+    }
+
+    private void generate(String in, String xsl, Map params) {
+        try {
+            Transformer transformer = getTransformer(xsl);
+
+            for (Iterator i = params.entrySet().iterator(); i.hasNext();) {
+                Map.Entry entry = (Map.Entry) i.next();
+
+                transformer.setParameter((String) entry.getKey(), entry.getValue());
+            }
+            transform(in, transformer);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    private Transformer getTransformer(String transform) throws Exception {
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+
+        try {
+            // tfactory.setAttribute("generate-translet", Boolean.TRUE);
+        } catch (Exception e) {
+            // Ignore
+        }
+
+        Transformer transformer = tfactory.newTransformer(new StreamSource(transform));
+        return (transformer);
+    }
+
+    private void transform(String in, Transformer transformer) throws Exception {
+        StringWriter sw = new StringWriter();
+        transformer.transform(new StreamSource(in), new StreamResult(sw));
+        String s = sw.toString();
+        Assert.assertTrue(s.contains("map1key1value") && s.contains("map2key1value"));
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6513892.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6513892.java
new file mode 100644
index 00000000000..ac9fab16438
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6513892.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+
+/*
+ * @bug 6513892
+ * @summary Test the output encoding of the transform is the same as that of the redirect extension.
+ */
+public class Bug6513892 {
+    @BeforeClass
+    public void setup(){
+        if (System.getSecurityManager() != null)
+            System.setSecurityManager(null);
+    }
+
+    @Test
+    public void test0() {
+        try {
+            TransformerFactory tf = TransformerFactory.newInstance();
+            Transformer t = tf.newTransformer(new StreamSource(getClass().getResourceAsStream("redirect.xsl"), getClass().getResource("redirect.xsl")
+                    .toString()));
+
+            StreamSource src1 = new StreamSource(getClass().getResourceAsStream("redirect.xml"));
+            t.transform(src1, new StreamResult("redirect1.xml"));
+
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+
+            Document d1 = db.parse(new File("redirect1.xml"));
+            Document d2 = db.parse(new File("redirect2.xml"));
+
+            Assert.assertTrue(d1.getDocumentElement().getFirstChild().getNodeValue().equals(d2.getDocumentElement().getFirstChild().getNodeValue()));
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6537167.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6537167.java
new file mode 100644
index 00000000000..f64c67213b5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6537167.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Templates;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6537167
+ * @summary Test transforming for particular xsl files.
+ */
+public class Bug6537167 {
+
+    @Test
+    public void test926007_1() throws Exception {
+        TransformerFactory factory = TransformerFactory.newInstance();
+        File f = new File(getClass().getResource("logon.xsl").getPath());
+        Templates t = factory.newTemplates(new StreamSource(f));
+        Transformer transformer = t.newTransformer();
+        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
+
+        transformer.transform(new StreamSource(getClass().getResourceAsStream("src.xml")), new StreamResult(System.out));
+    }
+
+    @Test
+    public void test926007_2() throws Exception {
+        TransformerFactory factory = TransformerFactory.newInstance();
+        // factory.setAttribute("generate-translet", Boolean.TRUE);
+        File f = new File(getClass().getResource("home.xsl").getPath());
+        Templates t = factory.newTemplates(new StreamSource(f));
+        Transformer transformer = t.newTransformer();
+        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
+
+        transformer.transform(new StreamSource(getClass().getResourceAsStream("src.xml")), new StreamResult(System.out));
+    }
+
+    @Test
+    public void test926007_3() throws Exception {
+        TransformerFactory factory = TransformerFactory.newInstance();
+        // factory.setAttribute("generate-translet", Boolean.TRUE);
+        File f = new File(getClass().getResource("upload-media.xsl").getPath());
+        Templates t = factory.newTemplates(new StreamSource(f));
+        Transformer transformer = t.newTransformer();
+        transformer.setOutputProperty(OutputKeys.INDENT, "yes");
+        transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
+
+        transformer.transform(new StreamSource(getClass().getResourceAsStream("src.xml")), new StreamResult(System.out));
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6540545.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6540545.java
new file mode 100644
index 00000000000..e9ddaee53a7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6540545.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringWriter;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6540545
+ * @summary Test XSLT as expected.
+ */
+public class Bug6540545 {
+
+    @Test
+    public void test() {
+        try {
+            String xmlFile = "numbering63.xml";
+            String xslFile = "numbering63.xsl";
+
+            TransformerFactory tFactory = TransformerFactory.newInstance();
+            // tFactory.setAttribute("generate-translet", Boolean.TRUE);
+            Transformer t = tFactory.newTransformer(new StreamSource(getClass().getResourceAsStream(xslFile), getClass().getResource(xslFile).toString()));
+            StringWriter sw = new StringWriter();
+            t.transform(new StreamSource(getClass().getResourceAsStream(xmlFile)), new StreamResult(sw));
+            String s = sw.getBuffer().toString();
+            Assert.assertFalse(s.contains("1: Level A"));
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6551616.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6551616.java
new file mode 100644
index 00000000000..c6ab3d4625f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6551616.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.StringBufferInputStream;
+import java.security.Policy;
+
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLOutputFactory;
+
+import com.sun.org.apache.xalan.internal.xsltc.trax.SAX2StAXEventWriter;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6551616
+ * @summary Test SAX2StAXEventWriter.
+ */
+public class Bug6551616 {
+    String _cache = "";
+
+
+    @Test
+    public void test() throws Exception {
+        final String XML = "" + "<?xml version='1.0'?>" + "<doc xmlns:foo='http://example.com/foo/' xml:lang='us-en'><p>Test</p></doc>";
+
+        javax.xml.parsers.SAXParserFactory saxFactory = javax.xml.parsers.SAXParserFactory.newInstance();
+
+        javax.xml.parsers.SAXParser parser = saxFactory.newSAXParser();
+
+        XMLOutputFactory outFactory = XMLOutputFactory.newInstance();
+        XMLEventWriter writer = outFactory.createXMLEventWriter(System.out);
+
+        SAX2StAXEventWriter handler = new SAX2StAXEventWriter(writer);
+
+        InputStream is = new StringBufferInputStream(XML);
+
+        parser.parse(is, handler);
+
+        // if it doesn't blow up, it succeeded.
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6559595.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6559595.java
new file mode 100644
index 00000000000..1c568b1b86c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6559595.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6559595
+ * @summary Test ampersand in href attribute is not handled specially even if output is set to HTML.
+ */
+public class Bug6559595 {
+
+    @Test
+    public void test() {
+        try {
+            String xml = "<html><body><a href='http://example.com/bla?x&amp;y'>" + "</a></body></html>";
+
+            Source src = new StreamSource(new StringReader(xml));
+            StringWriter stringWriter = new StringWriter();
+            Result res = new StreamResult(stringWriter);
+            TransformerFactory tf = TransformerFactory.newInstance();
+            Transformer t = tf.newTransformer();
+            t.setOutputProperty(OutputKeys.METHOD, "html");
+            t.transform(src, res);
+
+            // System.out.println("s = " + stringWriter.toString());
+            Assert.assertTrue(stringWriter.toString().contains("&amp;"));
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6565260.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6565260.java
new file mode 100644
index 00000000000..d6a548bff68
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6565260.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringWriter;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6565260
+ * @summary Test use-attribute-sets attribute is not used for the root node.
+ */
+public class Bug6565260 {
+
+    @Test
+    public void test() {
+        try {
+            String xmlFile = "attribset27.xml";
+            String xslFile = "attribset27.xsl";
+
+            TransformerFactory tFactory = TransformerFactory.newInstance();
+            // tFactory.setAttribute("generate-translet", Boolean.TRUE);
+            Transformer t = tFactory.newTransformer(new StreamSource(getClass().getResourceAsStream(xslFile)));
+            StringWriter sw = new StringWriter();
+            t.transform(new StreamSource(getClass().getResourceAsStream(xmlFile)), new StreamResult(sw));
+            String s = sw.getBuffer().toString();
+            Assert.assertFalse(s.contains("color") || s.contains("font-size"));
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6940416.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6940416.java
new file mode 100644
index 00000000000..5c881e10089
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Bug6940416.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.StringWriter;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.SourceLocator;
+import javax.xml.transform.Templates;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6940416
+ * @summary Test transforming correctly.
+ */
+public class Bug6940416 {
+
+    @Test
+    public void test() {
+        String xslFilename = getClass().getResource("ViewEditor1.xsl").getFile();
+        String inFilename = getClass().getResource("in.xml").getFile();
+        // String outFilename =
+        // getClass().getResource("out-6u17.xml").getFile();
+        // the xml result
+        StringWriter xmlResultString = new StringWriter();
+        try {
+            // Create transformer factory
+            TransformerFactory factory = TransformerFactory.newInstance();
+            factory.setAttribute("debug", true);
+            // Use the factory to create a template containing the xsl file
+            Templates template = factory.newTemplates(new StreamSource(new FileInputStream(xslFilename)));
+            // Use the template to create a transformer
+            Transformer xformer = template.newTransformer();
+            // Prepare the input and output files
+            Source source = new StreamSource(new FileInputStream(inFilename));
+            // Result result = new StreamResult(new
+            // FileOutputStream(outFilename));
+            Result result = new StreamResult(xmlResultString);
+            // Apply the xsl file to the source file and write the result to the
+            // output file
+            xformer.transform(source, result);
+
+            // 6u17 results contain the following:
+            /**
+             * var g_strInitialTabID = "VIEWEDITOR_TAB_FIELDS";
+             *
+             * var g_strCurrentDataEditorTabID = "DATA_OBJECTS"; var
+             * g_strCurrentPropertyEditorTabID = "VIEWEDITOR_TAB_GENERAL";
+             *
+             * while 6u18: var g_strInitialTabID = "";
+             *
+             * var g_strCurrentDataEditorTabID = ""; var
+             * g_strCurrentPropertyEditorTabID = "VIEWEDITOR_TAB_GENERAL";
+             */
+            System.out.println(xmlResultString.toString());
+            if (xmlResultString.toString().indexOf("VIEWEDITOR_TAB_FIELDS") == -1) {
+                Assert.fail("regression from 6u17");
+            }
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        } catch (TransformerConfigurationException e) {
+            // An error occurred in the XSL file
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        } catch (TransformerException e) {
+            e.printStackTrace();
+            // An error occurred while applying the XSL file
+            // Get location of error in input file
+            SourceLocator locator = e.getLocator();
+            int col = locator.getColumnNumber();
+            int line = locator.getLineNumber();
+            String publicId = locator.getPublicId();
+            String systemId = locator.getSystemId();
+            Assert.fail("error while applying the XSL file." + "systemId : " + systemId + ". publicId : " + publicId + ". col : " + col + ". line : " + line);
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704.xml
new file mode 100644
index 00000000000..0fcaf61021b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="utf-8"?>
+<survey><ratingfactor><q1>1 </q1><q02>1 </q02><q03>0 </q03><q04>0 </q04><q05>0 </q05><q06>0 </q06><q07>0 </q07><q08>0 </q08><q09>0 </q09><q10>0 </q10><q11>0 </q11><q12>0 </q12><q13>0 </q13><q14>0 </q14><q15>0 </q15><q16>0 </q16><q17>0 </q17><q18>0 </q18><q19>0 </q19><q20>0 </q20><q21>0 </q21><q22>0 </q22><q23>0 </q23><q24>0 </q24><q25_biproposal>0 </q25_biproposal><q26>0 </q26><q27>0 </q27><id_4dd20c2384ef12e0e10080000ab5dd78>0 </id_4dd20c2384ef12e0e10080000ab5dd78><id_4dd111b255800ff0e10080000ab5dd78>0 </id_4dd111b255800ff0e10080000ab5dd78><id_4dd1111d55800ff0e10080000ab5dd78>0 </id_4dd1111d55800ff0e10080000ab5dd78><id_4dd20b5c84ef12e0e10080000ab5dd78>0 </id_4dd20b5c84ef12e0e10080000ab5dd78><q28>0 </q28></ratingfactor><rating><q1><a01_bimos rating="1 ">init_01_InitialDummy</a01_bimos><a01_bimos rating="1 ">MOS</a01_bimos><a01_bimos rating="1 ">MES</a01_bimos><a01_bimos rating="1 ">NN</a01_bimos></q1><q02><a02 rating="1 ">init_02_InitialDummy</a02><a02 rating="1 ">X</a02><a02 rating="1 ">id_4dd1acc6337e11d0e10080000ab5dd78</a02></q02><q03><a03 rating="0 ">init_03_InitialDummy</a03><a03 rating="0 ">id_4dd1ad48337e11d0e10080000ab5dd78</a03><a03 rating="0 ">id_4dd1ad8a337e11d0e10080000ab5dd78</a03><a03 rating="0 ">id_4dd1add2337e11d0e10080000ab5dd78</a03><a03 rating="0 ">id_4dd1ae1a337e11d0e10080000ab5dd78</a03></q03><q04><a04 rating="0 ">init_04_InitialDummy</a04><a04 rating="0 ">id_4dd1af06337e11d0e10080000ab5dd78</a04><a04 rating="0 ">id_4dd1af58337e11d0e10080000ab5dd78</a04></q04><q05><a05 rating="0 ">init_05_InitialDummy</a05><a05 rating="0 ">id_4dd1b05d337e11d0e10080000ab5dd78</a05><a05 rating="0 ">id_4dd1b0b9337e11d0e10080000ab5dd78</a05></q05><q06><a06 rating="0 ">init_06_InitialDummy</a06><a06 rating="0 ">id_4dd1b1da337e11d0e10080000ab5dd78</a06><a06 rating="0 ">id_4dd1b240337e11d0e10080000ab5dd78</a06></q06><q07><a07 rating="0 ">init_07_InitialDummy</a07><a07 rating="0 ">id_4dd1b320337e11d0e10080000ab5dd78</a07><a07 rating="0 ">id_4dd1b390337e11d0e10080000ab5dd78</a07></q07><q08><a08 rating="0 "/></q08><q09><a09 rating="0 ">init_09_InitialDummy</a09><a09 rating="0 ">id_4dd225b0770407c0e10080000ab5dd78</a09><a09 rating="0 ">id_4dd2262e770407c0e10080000ab5dd78</a09><a09 rating="0 ">id_4dd226af770407c0e10080000ab5dd78</a09></q09><q10><a10 rating="0 ">init_10_InitialDummy</a10><a10 rating="0 ">id_4dd2280f770407c0e10080000ab5dd78</a10><a10 rating="0 ">id_4dd20ac184ef12e0e10080000ab5dd78</a10></q10><q11><a11 rating="0 ">init_11_InitialDummy</a11><a11 rating="0 ">id_4dd2240285141030e10080000ab5dd78</a11><a11 rating="0 ">id_4dd2250885141030e10080000ab5dd78</a11></q11><q12><a12 rating="0 ">init_12_InitialDummy</a12><a12 rating="0 ">id_4dd2271585141030e10080000ab5dd78</a12><a12 rating="0 ">id_4dd2281485141030e10080000ab5dd78</a12></q12><q13><a13_matnr rating="0 "/><a13_matdesc rating="0 "/></q13><q14><a14 rating="0 ">init_14_InitialDummy</a14><a14 rating="0 ">id_4dd22d8585141030e10080000ab5dd78</a14><a14 rating="0 ">id_4dd22e9685141030e10080000ab5dd78</a14></q14><q15><a15 rating="0 ">init_15_InitialDummy</a15><a15 rating="0 ">id_4dd231ea85141030e10080000ab5dd78</a15><a15 rating="0 ">id_4dd2331685141030e10080000ab5dd78</a15></q15><q16><a16 rating="0 ">init_16_InitialDummy</a16><a16 rating="0 ">id_4dd2367685141030e10080000ab5dd78</a16><a16 rating="0 ">id_4dd2379b85141030e10080000ab5dd78</a16></q16><q17><a17 rating="0 ">init_17_InitialDummy</a17><a17 rating="0 ">id_4dd23b1f85141030e10080000ab5dd78</a17><a17 rating="0 ">id_4dd23c5f85141030e10080000ab5dd78</a17></q17><q18><a18 rating="0 ">init_18_InitialDummy</a18><a18 rating="0 ">id_4dd20e5685071800e10080000ab5dd78</a18><a18 rating="0 ">id_4dd20f8f85071800e10080000ab5dd78</a18></q18><q19><a19 rating="0 ">init_19_InitialDummy</a19><a19 rating="0 ">id_4dd2134985071800e10080000ab5dd78</a19><a19 rating="0 ">id_4dd2148c85071800e10080000ab5dd78</a19><a19 rating="0 ">id_4dd215d285071800e10080000ab5dd78</a19><a19 rating="0 ">id_4dd2172285071800e10080000ab5dd78</a19><a19 rating="0 ">id_4dd2186e85071800e10080000ab5dd78</a19></q19><q20><a20 rating="0 ">init_20_InitialDummy</a20><a20 rating="0 ">id_4dd21c6385071800e10080000ab5dd78</a20><a20 rating="0 ">id_4dd21db985071800e10080000ab5dd78</a20><a20 rating="0 ">id_4dd21f1285071800e10080000ab5dd78</a20><a20 rating="0 ">id_4dd2206e85071800e10080000ab5dd78</a20><a20 rating="0 ">id_4dd221cd85071800e10080000ab5dd78</a20><a20 rating="0 ">id_4dd2232f85071800e10080000ab5dd78</a20><a20 rating="0 ">id_4dd2249485071800e10080000ab5dd78</a20></q20><q21><a21 rating="0 ">init_21_InitialDummy</a21><a21 rating="0 ">id_4dd228d085071800e10080000ab5dd78</a21><a21 rating="0 ">id_4dd22a3f85071800e10080000ab5dd78</a21><a21 rating="0 ">id_4dd22bb185071800e10080000ab5dd78</a21></q21><q22><a22 rating="0 "/></q22><q23><a23 rating="0 "/></q23><q24><a24 rating="0 "/></q24><q25_biproposal><a25_biproposal_matnr rating="0 "/><a25_biproposal_matdesc rating="0 "/></q25_biproposal><q26><a26 rating="0 "/></q26><q27><a27 rating="0 "/></q27><id_4dd20c2384ef12e0e10080000ab5dd78><a30_biprodext rating="0 ">id_4dd209ce85141030e10080000ab5dd78</a30_biprodext><a30_biprodext rating="0 ">CUSTOMER_WISH</a30_biprodext><a30_biprodext rating="0 ">DEALER_WISH</a30_biprodext></id_4dd20c2384ef12e0e10080000ab5dd78><id_4dd111b255800ff0e10080000ab5dd78><id_4dd210d485141030e10080000ab5dd78 rating="0 "/></id_4dd111b255800ff0e10080000ab5dd78><id_4dd1111d55800ff0e10080000ab5dd78><a31_bimosdealer rating="0 ">id_4dd20ced85141030e10080000ab5dd78</a31_bimosdealer><a31_bimosdealer rating="0 ">Y</a31_bimosdealer><a31_bimosdealer rating="0 ">N</a31_bimosdealer></id_4dd1111d55800ff0e10080000ab5dd78><id_4dd20b5c84ef12e0e10080000ab5dd78><a29_birefund rating="0 ">id_4dd112db55800ff0e10080000ab5dd78</a29_birefund><a29_birefund rating="0 ">Y</a29_birefund><a29_birefund rating="0 ">N</a29_birefund><a29_birefundreason rating="0 ">id_4dd114c155800ff0e10080000ab5dd78</a29_birefundreason><a29_birefundreason rating="0 ">TEL_CUSTOMER</a29_birefundreason><a29_birefundreason rating="0 ">TEL_DEALER</a29_birefundreason><a29_birefundreason rating="0 ">TECHNICIAN</a29_birefundreason><a29_birefundreason rating="0 ">ORDER</a29_birefundreason></id_4dd20b5c84ef12e0e10080000ab5dd78><q28><a28 rating="0 "/></q28></rating><result><q1><a01_bimos>init_01_InitialDummy</a01_bimos></q1><q02><a02>init_02_InitialDummy</a02></q02><q03><a03>init_03_InitialDummy</a03></q03><q04><a04>init_04_InitialDummy</a04></q04><q05><a05>init_05_InitialDummy</a05></q05><q06><a06>init_06_InitialDummy</a06></q06><q07><a07>init_07_InitialDummy</a07></q07><q08><a08/></q08><q09><a09>init_09_InitialDummy</a09></q09><q10><a10>init_10_InitialDummy</a10></q10><q11><a11>init_11_InitialDummy</a11></q11><q12><a12>init_12_InitialDummy</a12></q12><q13><a13_matnr/><a13_matdesc/></q13><q14><a14>init_14_InitialDummy</a14></q14><q15><a15>init_15_InitialDummy</a15></q15><q16><a16>init_16_InitialDummy</a16></q16><q17><a17>init_17_InitialDummy</a17></q17><q18><a18>init_18_InitialDummy</a18></q18><q19><a19>init_19_InitialDummy</a19></q19><q20><a20>init_20_InitialDummy</a20></q20><q21><a21>init_21_InitialDummy</a21></q21><q22><a22/></q22><q23><a23/></q23><q24><a24/></q24><q25_biproposal><a25_biproposal_matnr/><a25_biproposal_matdesc/></q25_biproposal><q26><a26/></q26><q27><a27/></q27><id_4dd20c2384ef12e0e10080000ab5dd78><a30_biprodext>id_4dd209ce85141030e10080000ab5dd78</a30_biprodext></id_4dd20c2384ef12e0e10080000ab5dd78><id_4dd111b255800ff0e10080000ab5dd78><id_4dd210d485141030e10080000ab5dd78/></id_4dd111b255800ff0e10080000ab5dd78><id_4dd1111d55800ff0e10080000ab5dd78><a31_bimosdealer>id_4dd20ced85141030e10080000ab5dd78</a31_bimosdealer></id_4dd1111d55800ff0e10080000ab5dd78><id_4dd20b5c84ef12e0e10080000ab5dd78><a29_birefund>id_4dd112db55800ff0e10080000ab5dd78</a29_birefund><a29_birefundreason>id_4dd114c155800ff0e10080000ab5dd78</a29_birefundreason></id_4dd20b5c84ef12e0e10080000ab5dd78><q28><a28/></q28></result><mandatory><q08><a08/></q08></mandatory></survey>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704.xsl
new file mode 100644
index 00000000000..f7611754b28
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704.xsl
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wff="http://www.mysap.com/wff/2001" version="1.0" exclude-result-prefixes="wff">
+    <xsl:output encoding="UTF-8" indent="yes" method="html" version="4.01" doctype-system="http://www.w3.org/TR/html4/loose.dtd" doctype-public="-//W3C//DTD HTML 4.01 Transitional//EN"/>
+    <xsl:template match="/">
+        <html>
+            <xsl:variable name="enterValidDate">Bitte geben Sie ein gültiges Datum ein!</xsl:variable>
+            <xsl:variable name="enterValidNumber">Bitte geben Sie eine Zahl ein!</xsl:variable>
+            <xsl:variable name="enterValidTime">Bitte geben Sie eine gültige Uhrzeit ein!</xsl:variable>
+            <xsl:variable name="enterMandatoryField">Bitte machen Sie Eingaben in alle Mussfelder!</xsl:variable>
+            <xsl:variable name="C_Mode" select="//processing/@Mode"/>
+            <head><title/><meta name="save" content="snapshot"/><style type="text/css"></style>
+                <xsl:for-each select="//script/*">
+                    <xsl:element name="script">
+                        <xsl:attribute name="language">
+                            <xsl:apply-templates select="@language"/>
+                        </xsl:attribute>
+                        <xsl:text>&#xD;&lt;!--&#xD;</xsl:text>
+                            <xsl:apply-templates select="."/>
+                            <xsl:text>&#xD;//--&gt;</xsl:text>
+                    </xsl:element>
+                </xsl:for-each>
+            </head>
+            <body><xsl:for-each select="//onEvent/html/body/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each><xsl:if test="count(/wff:envelope/wff:header/wff:message) > 0"><div class="Message"><xsl:value-of select="/wff:envelope/wff:header/wff:message"/></div></xsl:if><xsl:for-each select="/wff:envelope/wff:messages/wff:message/wff:text"><div class="Message"><xsl:value-of select="."/></div></xsl:for-each><xsl:for-each select="//message"><div class="Message"><xsl:variable name="source"><xsl:value-of select="//message/text()"/></xsl:variable><xsl:call-template name="getLineBreak"><xsl:with-param name="source" select="$source"/></xsl:call-template></div></xsl:for-each><div class="Title"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Geräteaustauschanforderung (GAF)'"/></xsl:call-template></div><form class="saveSnapshot" id="SAPSurvey" onSubmit="return check(this)" method="post"><xsl:if test="count(/wff:envelope/wff:header/wff:server_url) > 0"><xsl:attribute name="action"><xsl:value-of select="/wff:envelope/wff:header/wff:server_url"/></xsl:attribute></xsl:if><xsl:if test="count(/wff:envelope/wff:header/wff:server_url) = 0"><xsl:attribute name="action">SAPEVENT:WFF_EVENT</xsl:attribute><xsl:attribute name="enctype"/></xsl:if><xsl:if test="count(//survey/systemparamlocation) > 0"><xsl:variable name="X1" select="document(//survey/systemparamlocation[1])"/><xsl:attribute name="method"><xsl:value-of select="$X1/SurveySystemParam/@Method"/></xsl:attribute><xsl:attribute name="action"><xsl:value-of select="$X1/SurveySystemParam/@Action"/></xsl:attribute><xsl:attribute name="enctype"><xsl:value-of select="$X1/SurveySystemParam/@Enctype"/></xsl:attribute></xsl:if><xsl:for-each select="//onEvent/html/form/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each><input type="hidden" name="svyApplicationId" value="CRM_SURVEY_SERVICE"/><input type="hidden" name="SurveyId" value="Z002_AER_AWASCHAUTOMAT"/><input type="hidden" name="svySurveyId" value="Z002_AER_AWASCHAUTOMAT"/><input type="hidden" name="svyVersion" value="0000000003"/><input type="hidden" name="SchemaVersion" value="1 "/><input type="hidden" name="svySchemaVersion" value="1 "/><input type="hidden" name="svyLanguage" value="DE"/><xsl:if test="count(//survey/systemparamlocation) > 0"><xsl:variable name="X1" select="document(//survey/systemparamlocation[1])"/><xsl:if test="$X1/SurveySystemParam/@ReplyDest"><xsl:element name="input"><xsl:attribute name="type">hidden</xsl:attribute><xsl:attribute name="name">svyReplyDest1</xsl:attribute><xsl:attribute name="value"><xsl:value-of select="$X1/SurveySystemParam/@ReplyDest"/></xsl:attribute></xsl:element></xsl:if></xsl:if><xsl:element name="input"><xsl:attribute name="type">hidden</xsl:attribute><xsl:attribute name="name">conid</xsl:attribute><xsl:attribute name="value"/><xsl:if test="count(//survey/systemparamlocation) > 0"><xsl:variable name="X1" select="document(//survey/systemparamlocation[1])"/><xsl:if test="$X1/SurveySystemParam/@ConnectorId"><xsl:attribute name="value"><xsl:value-of select="$X1/SurveySystemParam/@ConnectorId"/></xsl:attribute></xsl:if></xsl:if></xsl:element><xsl:for-each select="//hidden/*"><input type="hidden"><xsl:attribute name="name"><xsl:value-of select="name(.)"/></xsl:attribute><xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute></input></xsl:for-each><!--Begin of Section--><div Id="" class="Section1"><div class="SectionText1"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Waschautomaten'"/></xsl:call-template></div><xsl:if test="not((count(//noDisplay/q1)) + (count(//noDisplay/q1/*))= 1)"><div class="Question" Id="q1"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'01. Verantwortlich'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q1/a01_bimos)"><tr><td class="ListAnswerListbox"><select class="AnswerListboxRW" name="survey/result/q1/a01_bimos" size="1"><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q1/a01_bimos"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerListboxRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q1/a01_bimos/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each><option value="init_01_InitialDummy"><xsl:if test="//survey/result/q1/a01_bimos[. = 'init_01_InitialDummy']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></option><option value="MOS"><xsl:if test="//survey/result/q1/a01_bimos[. = 'MOS']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'MOS'"/></xsl:call-template></option><option value="MES"><xsl:if test="//survey/result/q1/a01_bimos[. = 'MES']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'MES'"/></xsl:call-template></option><option value="NN"><xsl:if test="//survey/result/q1/a01_bimos[. = 'NN']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'keine Zuordnung'"/></xsl:call-template></option></select><xsl:for-each select="//readOnly/q1/a01_bimos"><xsl:for-each select="//survey/result/q1/a01_bimos"><input type="hidden"><xsl:attribute name="name">survey/result/q1/<xsl:value-of select="name(.)"/></xsl:attribute><xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute></input></xsl:for-each></xsl:for-each></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q02)) + (count(//noDisplay/q02/*))= 1)"><div class="Question" Id="q02"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'02. Offerte Ausführen'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q02/a02)"><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q02/a02" value="init_02_InitialDummy"><xsl:if test="//survey/result/q02/a02[. ='init_02_InitialDummy']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q02/a02"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q02/a02/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q02/a02"><xsl:if test="//survey/result/q02/a02[. = 'init_02_InitialDummy']"><input type="hidden"><xsl:attribute name="name">survey/result/q02/a02</xsl:attribute><xsl:attribute name="value">init_02_InitialDummy</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q02/a02" value="X"><xsl:if test="//survey/result/q02/a02[. ='X']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q02/a02"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q02/a02/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q02/a02"><xsl:if test="//survey/result/q02/a02[. = 'X']"><input type="hidden"><xsl:attribute name="name">survey/result/q02/a02</xsl:attribute><xsl:attribute name="value">X</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ja'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q02/a02" value="id_4dd1acc6337e11d0e10080000ab5dd78"><xsl:if test="//survey/result/q02/a02[. ='id_4dd1acc6337e11d0e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q02/a02"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q02/a02/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q02/a02"><xsl:if test="//survey/result/q02/a02[. = 'id_4dd1acc6337e11d0e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q02/a02</xsl:attribute><xsl:attribute name="value">id_4dd1acc6337e11d0e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Nein'"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q03)) + (count(//noDisplay/q03/*))= 1)"><div class="Question" Id="q03"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'03. Elektrischer Anschluss'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q03/a03)"><tr><td class="ListAnswerListbox"><select class="AnswerListboxRW" name="survey/result/q03/a03" size="1"><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q03/a03"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerListboxRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q03/a03/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each><option value="init_03_InitialDummy"><xsl:if test="//survey/result/q03/a03[. = 'init_03_InitialDummy']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></option><option value="id_4dd1ad48337e11d0e10080000ab5dd78"><xsl:if test="//survey/result/q03/a03[. = 'id_4dd1ad48337e11d0e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'230 Volt'"/></xsl:call-template></option><option value="id_4dd1ad8a337e11d0e10080000ab5dd78"><xsl:if test="//survey/result/q03/a03[. = 'id_4dd1ad8a337e11d0e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'400 Volt 2N'"/></xsl:call-template></option><option value="id_4dd1add2337e11d0e10080000ab5dd78"><xsl:if test="//survey/result/q03/a03[. = 'id_4dd1add2337e11d0e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'400 Volt 3N'"/></xsl:call-template></option><option value="id_4dd1ae1a337e11d0e10080000ab5dd78"><xsl:if test="//survey/result/q03/a03[. = 'id_4dd1ae1a337e11d0e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'keine Zuordnung'"/></xsl:call-template></option></select><xsl:for-each select="//readOnly/q03/a03"><xsl:for-each select="//survey/result/q03/a03"><input type="hidden"><xsl:attribute name="name">survey/result/q03/<xsl:value-of select="name(.)"/></xsl:attribute><xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute></input></xsl:for-each></xsl:for-each></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q04)) + (count(//noDisplay/q04/*))= 1)"><div class="Question" Id="q04"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'04. Nullleiter vorhanden'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q04/a04)"><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q04/a04" value="init_04_InitialDummy"><xsl:if test="//survey/result/q04/a04[. ='init_04_InitialDummy']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q04/a04"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q04/a04/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q04/a04"><xsl:if test="//survey/result/q04/a04[. = 'init_04_InitialDummy']"><input type="hidden"><xsl:attribute name="name">survey/result/q04/a04</xsl:attribute><xsl:attribute name="value">init_04_InitialDummy</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q04/a04" value="id_4dd1af06337e11d0e10080000ab5dd78"><xsl:if test="//survey/result/q04/a04[. ='id_4dd1af06337e11d0e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q04/a04"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q04/a04/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q04/a04"><xsl:if test="//survey/result/q04/a04[. = 'id_4dd1af06337e11d0e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q04/a04</xsl:attribute><xsl:attribute name="value">id_4dd1af06337e11d0e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ja'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q04/a04" value="id_4dd1af58337e11d0e10080000ab5dd78"><xsl:if test="//survey/result/q04/a04[. ='id_4dd1af58337e11d0e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q04/a04"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q04/a04/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q04/a04"><xsl:if test="//survey/result/q04/a04[. = 'id_4dd1af58337e11d0e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q04/a04</xsl:attribute><xsl:attribute name="value">id_4dd1af58337e11d0e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Nein'"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q05)) + (count(//noDisplay/q05/*))= 1)"><div class="Question" Id="q05"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'05. Via Münzwerk'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q05/a05)"><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q05/a05" value="init_05_InitialDummy"><xsl:if test="//survey/result/q05/a05[. ='init_05_InitialDummy']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q05/a05"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q05/a05/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q05/a05"><xsl:if test="//survey/result/q05/a05[. = 'init_05_InitialDummy']"><input type="hidden"><xsl:attribute name="name">survey/result/q05/a05</xsl:attribute><xsl:attribute name="value">init_05_InitialDummy</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q05/a05" value="id_4dd1b05d337e11d0e10080000ab5dd78"><xsl:if test="//survey/result/q05/a05[. ='id_4dd1b05d337e11d0e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q05/a05"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q05/a05/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q05/a05"><xsl:if test="//survey/result/q05/a05[. = 'id_4dd1b05d337e11d0e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q05/a05</xsl:attribute><xsl:attribute name="value">id_4dd1b05d337e11d0e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ja'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q05/a05" value="id_4dd1b0b9337e11d0e10080000ab5dd78"><xsl:if test="//survey/result/q05/a05[. ='id_4dd1b0b9337e11d0e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q05/a05"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q05/a05/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q05/a05"><xsl:if test="//survey/result/q05/a05[. = 'id_4dd1b0b9337e11d0e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q05/a05</xsl:attribute><xsl:attribute name="value">id_4dd1b0b9337e11d0e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Nein'"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q06)) + (count(//noDisplay/q06/*))= 1)"><div class="Question" Id="q06"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'06. Adapter Steuerausgang'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q06/a06)"><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q06/a06" value="init_06_InitialDummy"><xsl:if test="//survey/result/q06/a06[. ='init_06_InitialDummy']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q06/a06"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q06/a06/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q06/a06"><xsl:if test="//survey/result/q06/a06[. = 'init_06_InitialDummy']"><input type="hidden"><xsl:attribute name="name">survey/result/q06/a06</xsl:attribute><xsl:attribute name="value">init_06_InitialDummy</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q06/a06" value="id_4dd1b1da337e11d0e10080000ab5dd78"><xsl:if test="//survey/result/q06/a06[. ='id_4dd1b1da337e11d0e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q06/a06"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q06/a06/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q06/a06"><xsl:if test="//survey/result/q06/a06[. = 'id_4dd1b1da337e11d0e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q06/a06</xsl:attribute><xsl:attribute name="value">id_4dd1b1da337e11d0e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ja'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q06/a06" value="id_4dd1b240337e11d0e10080000ab5dd78"><xsl:if test="//survey/result/q06/a06[. ='id_4dd1b240337e11d0e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q06/a06"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q06/a06/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q06/a06"><xsl:if test="//survey/result/q06/a06[. = 'id_4dd1b240337e11d0e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q06/a06</xsl:attribute><xsl:attribute name="value">id_4dd1b240337e11d0e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Nein'"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q07)) + (count(//noDisplay/q07/*))= 1)"><div class="Question" Id="q07"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'07. Auf Betonsockel'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q07/a07)"><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q07/a07" value="init_07_InitialDummy"><xsl:if test="//survey/result/q07/a07[. ='init_07_InitialDummy']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q07/a07"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q07/a07/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q07/a07"><xsl:if test="//survey/result/q07/a07[. = 'init_07_InitialDummy']"><input type="hidden"><xsl:attribute name="name">survey/result/q07/a07</xsl:attribute><xsl:attribute name="value">init_07_InitialDummy</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q07/a07" value="id_4dd1b320337e11d0e10080000ab5dd78"><xsl:if test="//survey/result/q07/a07[. ='id_4dd1b320337e11d0e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q07/a07"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q07/a07/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q07/a07"><xsl:if test="//survey/result/q07/a07[. = 'id_4dd1b320337e11d0e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q07/a07</xsl:attribute><xsl:attribute name="value">id_4dd1b320337e11d0e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ja'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q07/a07" value="id_4dd1b390337e11d0e10080000ab5dd78"><xsl:if test="//survey/result/q07/a07[. ='id_4dd1b390337e11d0e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q07/a07"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q07/a07/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q07/a07"><xsl:if test="//survey/result/q07/a07[. = 'id_4dd1b390337e11d0e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q07/a07</xsl:attribute><xsl:attribute name="value">id_4dd1b390337e11d0e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Nein'"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q08)) + (count(//noDisplay/q08/*))= 1)"><div class="Question" Id="q08"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'08. Grösse: Breite x Tiefe'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q08/a08)"><tr><td class="ListAnswerField"><input class="AnswerFieldRW" type="text" name="survey/result/q08/a08" size="48 " maxlength="48 "><xsl:attribute name="value"><xsl:value-of select="//survey/result/q08/a08"/></xsl:attribute><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q08/a08"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q08/a08/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input></td><td class="ListAnswerFieldText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="''"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q09)) + (count(//noDisplay/q09/*))= 1)"><div class="Question" Id="q09"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'09. Ablauf'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q09/a09)"><tr><td class="ListAnswerListbox"><select class="AnswerListboxRW" name="survey/result/q09/a09" size="1"><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q09/a09"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerListboxRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q09/a09/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each><option value="init_09_InitialDummy"><xsl:if test="//survey/result/q09/a09[. = 'init_09_InitialDummy']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></option><option value="id_4dd225b0770407c0e10080000ab5dd78"><xsl:if test="//survey/result/q09/a09[. = 'id_4dd225b0770407c0e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Pumpe'"/></xsl:call-template></option><option value="id_4dd2262e770407c0e10080000ab5dd78"><xsl:if test="//survey/result/q09/a09[. = 'id_4dd2262e770407c0e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ventil'"/></xsl:call-template></option><option value="id_4dd226af770407c0e10080000ab5dd78"><xsl:if test="//survey/result/q09/a09[. = 'id_4dd226af770407c0e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'keine Zuordnung'"/></xsl:call-template></option></select><xsl:for-each select="//readOnly/q09/a09"><xsl:for-each select="//survey/result/q09/a09"><input type="hidden"><xsl:attribute name="name">survey/result/q09/<xsl:value-of select="name(.)"/></xsl:attribute><xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute></input></xsl:for-each></xsl:for-each></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q10)) + (count(//noDisplay/q10/*))= 1)"><div class="Question" Id="q10"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'10. Normale Länge der Schläuche und Kabel'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q10/a10)"><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q10/a10" value="init_10_InitialDummy"><xsl:if test="//survey/result/q10/a10[. ='init_10_InitialDummy']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q10/a10"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q10/a10/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q10/a10"><xsl:if test="//survey/result/q10/a10[. = 'init_10_InitialDummy']"><input type="hidden"><xsl:attribute name="name">survey/result/q10/a10</xsl:attribute><xsl:attribute name="value">init_10_InitialDummy</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q10/a10" value="id_4dd2280f770407c0e10080000ab5dd78"><xsl:if test="//survey/result/q10/a10[. ='id_4dd2280f770407c0e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q10/a10"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q10/a10/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q10/a10"><xsl:if test="//survey/result/q10/a10[. = 'id_4dd2280f770407c0e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q10/a10</xsl:attribute><xsl:attribute name="value">id_4dd2280f770407c0e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ja'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q10/a10" value="id_4dd20ac184ef12e0e10080000ab5dd78"><xsl:if test="//survey/result/q10/a10[. ='id_4dd20ac184ef12e0e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q10/a10"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q10/a10/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q10/a10"><xsl:if test="//survey/result/q10/a10[. = 'id_4dd20ac184ef12e0e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q10/a10</xsl:attribute><xsl:attribute name="value">id_4dd20ac184ef12e0e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Nein'"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q11)) + (count(//noDisplay/q11/*))= 1)"><div class="Question" Id="q11"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'11. Anschluss mit Waterproof-Ventil möglich'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q11/a11)"><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q11/a11" value="init_11_InitialDummy"><xsl:if test="//survey/result/q11/a11[. ='init_11_InitialDummy']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q11/a11"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q11/a11/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q11/a11"><xsl:if test="//survey/result/q11/a11[. = 'init_11_InitialDummy']"><input type="hidden"><xsl:attribute name="name">survey/result/q11/a11</xsl:attribute><xsl:attribute name="value">init_11_InitialDummy</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q11/a11" value="id_4dd2240285141030e10080000ab5dd78"><xsl:if test="//survey/result/q11/a11[. ='id_4dd2240285141030e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q11/a11"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q11/a11/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q11/a11"><xsl:if test="//survey/result/q11/a11[. = 'id_4dd2240285141030e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q11/a11</xsl:attribute><xsl:attribute name="value">id_4dd2240285141030e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ja'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q11/a11" value="id_4dd2250885141030e10080000ab5dd78"><xsl:if test="//survey/result/q11/a11[. ='id_4dd2250885141030e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q11/a11"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q11/a11/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q11/a11"><xsl:if test="//survey/result/q11/a11[. = 'id_4dd2250885141030e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q11/a11</xsl:attribute><xsl:attribute name="value">id_4dd2250885141030e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Nein'"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q12)) + (count(//noDisplay/q12/*))= 1)"><div class="Question" Id="q12"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'12. Wasch-Trocken-Turm'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q12/a12)"><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q12/a12" value="init_12_InitialDummy"><xsl:if test="//survey/result/q12/a12[. ='init_12_InitialDummy']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q12/a12"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q12/a12/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q12/a12"><xsl:if test="//survey/result/q12/a12[. = 'init_12_InitialDummy']"><input type="hidden"><xsl:attribute name="name">survey/result/q12/a12</xsl:attribute><xsl:attribute name="value">init_12_InitialDummy</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q12/a12" value="id_4dd2271585141030e10080000ab5dd78"><xsl:if test="//survey/result/q12/a12[. ='id_4dd2271585141030e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q12/a12"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q12/a12/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q12/a12"><xsl:if test="//survey/result/q12/a12[. = 'id_4dd2271585141030e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q12/a12</xsl:attribute><xsl:attribute name="value">id_4dd2271585141030e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ja'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q12/a12" value="id_4dd2281485141030e10080000ab5dd78"><xsl:if test="//survey/result/q12/a12[. ='id_4dd2281485141030e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q12/a12"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q12/a12/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q12/a12"><xsl:if test="//survey/result/q12/a12[. = 'id_4dd2281485141030e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q12/a12</xsl:attribute><xsl:attribute name="value">id_4dd2281485141030e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Nein'"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q13)) + (count(//noDisplay/q13/*))= 1)"><div class="Question" Id="q13"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'13. Anderes Gerät im Turm'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q13/a13_matnr)"><tr><td class="ListAnswerFieldText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Produktnummer:'"/></xsl:call-template></td><td class="ListAnswerField"><input class="AnswerFieldRW" type="text" name="survey/result/q13/a13_matnr" size="30 " maxlength="30 "><xsl:attribute name="value"><xsl:value-of select="//survey/result/q13/a13_matnr"/></xsl:attribute><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q13/a13_matnr"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q13/a13_matnr/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input></td></tr></xsl:if><xsl:if test="not(//noDisplay/q13/a13_matdesc)"><tr><td class="ListAnswerFieldText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Bezeichnung:'"/></xsl:call-template></td><td class="ListAnswerField"><input class="AnswerFieldRW" type="text" name="survey/result/q13/a13_matdesc" size="30 " maxlength="50 "><xsl:attribute name="value"><xsl:value-of select="//survey/result/q13/a13_matdesc"/></xsl:attribute><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q13/a13_matdesc"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q13/a13_matdesc/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q14)) + (count(//noDisplay/q14/*))= 1)"><div class="Question" Id="q14"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'14. WTV mit Auszug vorhanden'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q14/a14)"><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q14/a14" value="init_14_InitialDummy"><xsl:if test="//survey/result/q14/a14[. ='init_14_InitialDummy']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q14/a14"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q14/a14/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q14/a14"><xsl:if test="//survey/result/q14/a14[. = 'init_14_InitialDummy']"><input type="hidden"><xsl:attribute name="name">survey/result/q14/a14</xsl:attribute><xsl:attribute name="value">init_14_InitialDummy</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q14/a14" value="id_4dd22d8585141030e10080000ab5dd78"><xsl:if test="//survey/result/q14/a14[. ='id_4dd22d8585141030e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q14/a14"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q14/a14/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q14/a14"><xsl:if test="//survey/result/q14/a14[. = 'id_4dd22d8585141030e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q14/a14</xsl:attribute><xsl:attribute name="value">id_4dd22d8585141030e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ja'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q14/a14" value="id_4dd22e9685141030e10080000ab5dd78"><xsl:if test="//survey/result/q14/a14[. ='id_4dd22e9685141030e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q14/a14"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q14/a14/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q14/a14"><xsl:if test="//survey/result/q14/a14[. = 'id_4dd22e9685141030e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q14/a14</xsl:attribute><xsl:attribute name="value">id_4dd22e9685141030e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Nein'"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q15)) + (count(//noDisplay/q15/*))= 1)"><div class="Question" Id="q15"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'15. Eingebaut'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q15/a15)"><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q15/a15" value="init_15_InitialDummy"><xsl:if test="//survey/result/q15/a15[. ='init_15_InitialDummy']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q15/a15"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q15/a15/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q15/a15"><xsl:if test="//survey/result/q15/a15[. = 'init_15_InitialDummy']"><input type="hidden"><xsl:attribute name="name">survey/result/q15/a15</xsl:attribute><xsl:attribute name="value">init_15_InitialDummy</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q15/a15" value="id_4dd231ea85141030e10080000ab5dd78"><xsl:if test="//survey/result/q15/a15[. ='id_4dd231ea85141030e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q15/a15"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q15/a15/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q15/a15"><xsl:if test="//survey/result/q15/a15[. = 'id_4dd231ea85141030e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q15/a15</xsl:attribute><xsl:attribute name="value">id_4dd231ea85141030e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ja'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q15/a15" value="id_4dd2331685141030e10080000ab5dd78"><xsl:if test="//survey/result/q15/a15[. ='id_4dd2331685141030e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q15/a15"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q15/a15/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q15/a15"><xsl:if test="//survey/result/q15/a15[. = 'id_4dd2331685141030e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q15/a15</xsl:attribute><xsl:attribute name="value">id_4dd2331685141030e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Nein'"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q16)) + (count(//noDisplay/q16/*))= 1)"><div class="Question" Id="q16"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'16. Integriert'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q16/a16)"><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q16/a16" value="init_16_InitialDummy"><xsl:if test="//survey/result/q16/a16[. ='init_16_InitialDummy']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q16/a16"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q16/a16/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q16/a16"><xsl:if test="//survey/result/q16/a16[. = 'init_16_InitialDummy']"><input type="hidden"><xsl:attribute name="name">survey/result/q16/a16</xsl:attribute><xsl:attribute name="value">init_16_InitialDummy</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q16/a16" value="id_4dd2367685141030e10080000ab5dd78"><xsl:if test="//survey/result/q16/a16[. ='id_4dd2367685141030e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q16/a16"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q16/a16/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q16/a16"><xsl:if test="//survey/result/q16/a16[. = 'id_4dd2367685141030e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q16/a16</xsl:attribute><xsl:attribute name="value">id_4dd2367685141030e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ja'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q16/a16" value="id_4dd2379b85141030e10080000ab5dd78"><xsl:if test="//survey/result/q16/a16[. ='id_4dd2379b85141030e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q16/a16"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q16/a16/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q16/a16"><xsl:if test="//survey/result/q16/a16[. = 'id_4dd2379b85141030e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q16/a16</xsl:attribute><xsl:attribute name="value">id_4dd2379b85141030e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Nein'"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q17)) + (count(//noDisplay/q17/*))= 1)"><div class="Question" Id="q17"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'17. Untergebaut'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q17/a17)"><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q17/a17" value="init_17_InitialDummy"><xsl:if test="//survey/result/q17/a17[. ='init_17_InitialDummy']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q17/a17"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q17/a17/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q17/a17"><xsl:if test="//survey/result/q17/a17[. = 'init_17_InitialDummy']"><input type="hidden"><xsl:attribute name="name">survey/result/q17/a17</xsl:attribute><xsl:attribute name="value">init_17_InitialDummy</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q17/a17" value="id_4dd23b1f85141030e10080000ab5dd78"><xsl:if test="//survey/result/q17/a17[. ='id_4dd23b1f85141030e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q17/a17"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q17/a17/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q17/a17"><xsl:if test="//survey/result/q17/a17[. = 'id_4dd23b1f85141030e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q17/a17</xsl:attribute><xsl:attribute name="value">id_4dd23b1f85141030e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ja'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q17/a17" value="id_4dd23c5f85141030e10080000ab5dd78"><xsl:if test="//survey/result/q17/a17[. ='id_4dd23c5f85141030e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q17/a17"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q17/a17/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q17/a17"><xsl:if test="//survey/result/q17/a17[. = 'id_4dd23c5f85141030e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q17/a17</xsl:attribute><xsl:attribute name="value">id_4dd23c5f85141030e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Nein'"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q18)) + (count(//noDisplay/q18/*))= 1)"><div class="Question" Id="q18"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'18. Freistehend'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q18/a18)"><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q18/a18" value="init_18_InitialDummy"><xsl:if test="//survey/result/q18/a18[. ='init_18_InitialDummy']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q18/a18"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q18/a18/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q18/a18"><xsl:if test="//survey/result/q18/a18[. = 'init_18_InitialDummy']"><input type="hidden"><xsl:attribute name="name">survey/result/q18/a18</xsl:attribute><xsl:attribute name="value">init_18_InitialDummy</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q18/a18" value="id_4dd20e5685071800e10080000ab5dd78"><xsl:if test="//survey/result/q18/a18[. ='id_4dd20e5685071800e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q18/a18"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q18/a18/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q18/a18"><xsl:if test="//survey/result/q18/a18[. = 'id_4dd20e5685071800e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q18/a18</xsl:attribute><xsl:attribute name="value">id_4dd20e5685071800e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ja'"/></xsl:call-template></td></tr><tr><td class="ListAnswerRadioButton"><input class="AnswerRadioButtonRW" type="radio" name="survey/result/q18/a18" value="id_4dd20f8f85071800e10080000ab5dd78"><xsl:if test="//survey/result/q18/a18[. ='id_4dd20f8f85071800e10080000ab5dd78']"><xsl:attribute name="checked">checked</xsl:attribute></xsl:if><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q18/a18"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerRadioButtonRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q18/a18/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input><xsl:for-each select="//readOnly/q18/a18"><xsl:if test="//survey/result/q18/a18[. = 'id_4dd20f8f85071800e10080000ab5dd78']"><input type="hidden"><xsl:attribute name="name">survey/result/q18/a18</xsl:attribute><xsl:attribute name="value">id_4dd20f8f85071800e10080000ab5dd78</xsl:attribute></input></xsl:if></xsl:for-each></td><td class="ListAnswerRadioButtonText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Nein'"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q19)) + (count(//noDisplay/q19/*))= 1)"><div class="Question" Id="q19"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'19. Einbauvarianten'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q19/a19)"><tr><td class="ListAnswerListbox"><select class="AnswerListboxRW" name="survey/result/q19/a19" size="1"><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q19/a19"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerListboxRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q19/a19/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each><option value="init_19_InitialDummy"><xsl:if test="//survey/result/q19/a19[. = 'init_19_InitialDummy']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></option><option value="id_4dd2134985071800e10080000ab5dd78"><xsl:if test="//survey/result/q19/a19[. = 'id_4dd2134985071800e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'GDU'"/></xsl:call-template></option><option value="id_4dd2148c85071800e10080000ab5dd78"><xsl:if test="//survey/result/q19/a19[. = 'id_4dd2148c85071800e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Montage-Set'"/></xsl:call-template></option><option value="id_4dd215d285071800e10080000ab5dd78"><xsl:if test="//survey/result/q19/a19[. = 'id_4dd215d285071800e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Integriert'"/></xsl:call-template></option><option value="id_4dd2172285071800e10080000ab5dd78"><xsl:if test="//survey/result/q19/a19[. = 'id_4dd2172285071800e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Normal'"/></xsl:call-template></option><option value="id_4dd2186e85071800e10080000ab5dd78"><xsl:if test="//survey/result/q19/a19[. = 'id_4dd2186e85071800e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'keine Zuordnung'"/></xsl:call-template></option></select><xsl:for-each select="//readOnly/q19/a19"><xsl:for-each select="//survey/result/q19/a19"><input type="hidden"><xsl:attribute name="name">survey/result/q19/<xsl:value-of select="name(.)"/></xsl:attribute><xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute></input></xsl:for-each></xsl:for-each></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q20)) + (count(//noDisplay/q20/*))= 1)"><div class="Question" Id="q20"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'20. Farbe'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q20/a20)"><tr><td class="ListAnswerListbox"><select class="AnswerListboxRW" name="survey/result/q20/a20" size="1"><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q20/a20"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerListboxRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q20/a20/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each><option value="init_20_InitialDummy"><xsl:if test="//survey/result/q20/a20[. = 'init_20_InitialDummy']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></option><option value="id_4dd21c6385071800e10080000ab5dd78"><xsl:if test="//survey/result/q20/a20[. = 'id_4dd21c6385071800e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'braun'"/></xsl:call-template></option><option value="id_4dd21db985071800e10080000ab5dd78"><xsl:if test="//survey/result/q20/a20[. = 'id_4dd21db985071800e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'weiss'"/></xsl:call-template></option><option value="id_4dd21f1285071800e10080000ab5dd78"><xsl:if test="//survey/result/q20/a20[. = 'id_4dd21f1285071800e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'schwarz'"/></xsl:call-template></option><option value="id_4dd2206e85071800e10080000ab5dd78"><xsl:if test="//survey/result/q20/a20[. = 'id_4dd2206e85071800e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'edelstahl'"/></xsl:call-template></option><option value="id_4dd221cd85071800e10080000ab5dd78"><xsl:if test="//survey/result/q20/a20[. = 'id_4dd221cd85071800e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'aluminium'"/></xsl:call-template></option><option value="id_4dd2232f85071800e10080000ab5dd78"><xsl:if test="//survey/result/q20/a20[. = 'id_4dd2232f85071800e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'andere'"/></xsl:call-template></option><option value="id_4dd2249485071800e10080000ab5dd78"><xsl:if test="//survey/result/q20/a20[. = 'id_4dd2249485071800e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'keine Zuordnung'"/></xsl:call-template></option></select><xsl:for-each select="//readOnly/q20/a20"><xsl:for-each select="//survey/result/q20/a20"><input type="hidden"><xsl:attribute name="name">survey/result/q20/<xsl:value-of select="name(.)"/></xsl:attribute><xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute></input></xsl:for-each></xsl:for-each></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q21)) + (count(//noDisplay/q21/*))= 1)"><div class="Question" Id="q21"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'21. Bandung'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q21/a21)"><tr><td class="ListAnswerListbox"><select class="AnswerListboxRW" name="survey/result/q21/a21" size="1"><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q21/a21"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerListboxRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q21/a21/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each><option value="init_21_InitialDummy"><xsl:if test="//survey/result/q21/a21[. = 'init_21_InitialDummy']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Auswahl erforderlich'"/></xsl:call-template></option><option value="id_4dd228d085071800e10080000ab5dd78"><xsl:if test="//survey/result/q21/a21[. = 'id_4dd228d085071800e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'rechts'"/></xsl:call-template></option><option value="id_4dd22a3f85071800e10080000ab5dd78"><xsl:if test="//survey/result/q21/a21[. = 'id_4dd22a3f85071800e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'links'"/></xsl:call-template></option><option value="id_4dd22bb185071800e10080000ab5dd78"><xsl:if test="//survey/result/q21/a21[. = 'id_4dd22bb185071800e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'keine Zuordnung'"/></xsl:call-template></option></select><xsl:for-each select="//readOnly/q21/a21"><xsl:for-each select="//survey/result/q21/a21"><input type="hidden"><xsl:attribute name="name">survey/result/q21/<xsl:value-of select="name(.)"/></xsl:attribute><xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute></input></xsl:for-each></xsl:for-each></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q22)) + (count(//noDisplay/q22/*))= 1)"><div class="Question" Id="q22"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'22. Nischen-Breite'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q22/a22)"><tr><td class="ListAnswerField"><input class="AnswerFieldRW" type="text" name="survey/result/q22/a22" size="48 " maxlength="48 "><xsl:attribute name="value"><xsl:value-of select="//survey/result/q22/a22"/></xsl:attribute><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q22/a22"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q22/a22/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input></td><td class="ListAnswerFieldText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="''"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q23)) + (count(//noDisplay/q23/*))= 1)"><div class="Question" Id="q23"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'23. Nischen-Höhe'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q23/a23)"><tr><td class="ListAnswerField"><input class="AnswerFieldRW" type="text" name="survey/result/q23/a23" size="48 " maxlength="48 "><xsl:attribute name="value"><xsl:value-of select="//survey/result/q23/a23"/></xsl:attribute><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q23/a23"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q23/a23/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input></td><td class="ListAnswerFieldText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="''"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q24)) + (count(//noDisplay/q24/*))= 1)"><div class="Question" Id="q24"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'24. Sockel-Höhe'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q24/a24)"><tr><td class="ListAnswerField"><input class="AnswerFieldRW" type="text" name="survey/result/q24/a24" size="48 " maxlength="48 "><xsl:attribute name="value"><xsl:value-of select="//survey/result/q24/a24"/></xsl:attribute><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q24/a24"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q24/a24/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input></td><td class="ListAnswerFieldText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="''"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q25_biproposal)) + (count(//noDisplay/q25_biproposal/*))= 1)"><div class="Question" Id="q25_biproposal"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'25. Neugeräte Vorschlag'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q25_biproposal/a25_biproposal_matnr)"><tr><td class="ListAnswerFieldText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Produktnummer:'"/></xsl:call-template></td><td class="ListAnswerField"><input class="AnswerFieldRW" type="text" name="survey/result/q25_biproposal/a25_biproposal_matnr" size="30 " maxlength="30 "><xsl:attribute name="value"><xsl:value-of select="//survey/result/q25_biproposal/a25_biproposal_matnr"/></xsl:attribute><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q25_biproposal/a25_biproposal_matnr"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q25_biproposal/a25_biproposal_matnr/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input></td></tr></xsl:if><xsl:if test="not(//noDisplay/q25_biproposal/a25_biproposal_matdesc)"><tr><td class="ListAnswerFieldText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Bezeichnung:'"/></xsl:call-template></td><td class="ListAnswerField"><input class="AnswerFieldRW" type="text" name="survey/result/q25_biproposal/a25_biproposal_matdesc" size="30 " maxlength="50 "><xsl:attribute name="value"><xsl:value-of select="//survey/result/q25_biproposal/a25_biproposal_matdesc"/></xsl:attribute><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q25_biproposal/a25_biproposal_matdesc"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q25_biproposal/a25_biproposal_matdesc/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q26)) + (count(//noDisplay/q26/*))= 1)"><div class="Question" Id="q26"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'26. Grund der Störung'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q26/a26)"><tr><td class="ListAnswerText"><textarea class="AnswerTextRW" name="survey/result/q26/a26" rows="3 " cols="41 "><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerTextRO</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q26/a26"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerTextRO</xsl:attribute></xsl:for-each><xsl:value-of select="//survey/result/q26/a26"/><xsl:text/><xsl:for-each select="//onEvent/q26/a26/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></textarea></td><td class="ListAnswerTextText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="''"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q27)) + (count(//noDisplay/q27/*))= 1)"><div class="Question" Id="q27"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'27. Bemerkung'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q27/a27)"><tr><td class="ListAnswerText"><textarea class="AnswerTextRW" name="survey/result/q27/a27" rows="3 " cols="41 "><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerTextRO</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q27/a27"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerTextRO</xsl:attribute></xsl:for-each><xsl:value-of select="//survey/result/q27/a27"/><xsl:text/><xsl:for-each select="//onEvent/q27/a27/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></textarea></td><td class="ListAnswerTextText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="''"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/id_4dd20c2384ef12e0e10080000ab5dd78)) + (count(//noDisplay/id_4dd20c2384ef12e0e10080000ab5dd78/*))= 1)"><div class="Question" Id="id_4dd20c2384ef12e0e10080000ab5dd78"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Grund Fremdproduktekauf'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/id_4dd20c2384ef12e0e10080000ab5dd78/a30_biprodext)"><tr><td class="ListAnswerListbox"><select class="AnswerListboxRW" name="survey/result/id_4dd20c2384ef12e0e10080000ab5dd78/a30_biprodext" size="1"><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/id_4dd20c2384ef12e0e10080000ab5dd78/a30_biprodext"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerListboxRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/id_4dd20c2384ef12e0e10080000ab5dd78/a30_biprodext/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each><option value="id_4dd209ce85141030e10080000ab5dd78"><xsl:if test="//survey/result/id_4dd20c2384ef12e0e10080000ab5dd78/a30_biprodext[. = 'id_4dd209ce85141030e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="''"/></xsl:call-template></option><option value="CUSTOMER_WISH"><xsl:if test="//survey/result/id_4dd20c2384ef12e0e10080000ab5dd78/a30_biprodext[. = 'CUSTOMER_WISH']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Kundenwunsch'"/></xsl:call-template></option><option value="DEALER_WISH"><xsl:if test="//survey/result/id_4dd20c2384ef12e0e10080000ab5dd78/a30_biprodext[. = 'DEALER_WISH']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Händlerwunsch'"/></xsl:call-template></option></select><xsl:for-each select="//readOnly/id_4dd20c2384ef12e0e10080000ab5dd78/a30_biprodext"><xsl:for-each select="//survey/result/id_4dd20c2384ef12e0e10080000ab5dd78/a30_biprodext"><input type="hidden"><xsl:attribute name="name">survey/result/id_4dd20c2384ef12e0e10080000ab5dd78/<xsl:value-of select="name(.)"/></xsl:attribute><xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute></input></xsl:for-each></xsl:for-each></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/id_4dd111b255800ff0e10080000ab5dd78)) + (count(//noDisplay/id_4dd111b255800ff0e10080000ab5dd78/*))= 1)"><div class="Question" Id="id_4dd111b255800ff0e10080000ab5dd78"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Interne Bemerkung'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/id_4dd111b255800ff0e10080000ab5dd78/id_4dd210d485141030e10080000ab5dd78)"><tr><td class="ListAnswerText"><textarea class="AnswerTextRW" name="survey/result/id_4dd111b255800ff0e10080000ab5dd78/id_4dd210d485141030e10080000ab5dd78" rows="3 " cols="41 "><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerTextRO</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/id_4dd111b255800ff0e10080000ab5dd78/id_4dd210d485141030e10080000ab5dd78"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerTextRO</xsl:attribute></xsl:for-each><xsl:value-of select="//survey/result/id_4dd111b255800ff0e10080000ab5dd78/id_4dd210d485141030e10080000ab5dd78"/><xsl:text/><xsl:for-each select="//onEvent/id_4dd111b255800ff0e10080000ab5dd78/id_4dd210d485141030e10080000ab5dd78/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></textarea></td><td class="ListAnswerTextText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="''"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/id_4dd1111d55800ff0e10080000ab5dd78)) + (count(//noDisplay/id_4dd1111d55800ff0e10080000ab5dd78/*))= 1)"><div class="Question" Id="id_4dd1111d55800ff0e10080000ab5dd78"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Händlerauswahl durch MES/MOS'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/id_4dd1111d55800ff0e10080000ab5dd78/a31_bimosdealer)"><tr><td class="ListAnswerListbox"><select class="AnswerListboxRW" name="survey/result/id_4dd1111d55800ff0e10080000ab5dd78/a31_bimosdealer" size="1"><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/id_4dd1111d55800ff0e10080000ab5dd78/a31_bimosdealer"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerListboxRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/id_4dd1111d55800ff0e10080000ab5dd78/a31_bimosdealer/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each><option value="id_4dd20ced85141030e10080000ab5dd78"><xsl:if test="//survey/result/id_4dd1111d55800ff0e10080000ab5dd78/a31_bimosdealer[. = 'id_4dd20ced85141030e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="''"/></xsl:call-template></option><option value="Y"><xsl:if test="//survey/result/id_4dd1111d55800ff0e10080000ab5dd78/a31_bimosdealer[. = 'Y']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ja'"/></xsl:call-template></option><option value="N"><xsl:if test="//survey/result/id_4dd1111d55800ff0e10080000ab5dd78/a31_bimosdealer[. = 'N']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Nein'"/></xsl:call-template></option></select><xsl:for-each select="//readOnly/id_4dd1111d55800ff0e10080000ab5dd78/a31_bimosdealer"><xsl:for-each select="//survey/result/id_4dd1111d55800ff0e10080000ab5dd78/a31_bimosdealer"><input type="hidden"><xsl:attribute name="name">survey/result/id_4dd1111d55800ff0e10080000ab5dd78/<xsl:value-of select="name(.)"/></xsl:attribute><xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute></input></xsl:for-each></xsl:for-each></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/id_4dd20b5c84ef12e0e10080000ab5dd78)) + (count(//noDisplay/id_4dd20b5c84ef12e0e10080000ab5dd78/*))= 1)"><div class="Question" Id="id_4dd20b5c84ef12e0e10080000ab5dd78"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Rückerstattungsbeleg'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefund)"><tr><td class="ListAnswerListbox"><select class="AnswerListboxRW" name="survey/result/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefund" size="1"><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefund"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerListboxRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefund/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each><option value="id_4dd112db55800ff0e10080000ab5dd78"><xsl:if test="//survey/result/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefund[. = 'id_4dd112db55800ff0e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="''"/></xsl:call-template></option><option value="Y"><xsl:if test="//survey/result/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefund[. = 'Y']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Ja'"/></xsl:call-template></option><option value="N"><xsl:if test="//survey/result/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefund[. = 'N']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'Nein'"/></xsl:call-template></option></select><xsl:for-each select="//readOnly/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefund"><xsl:for-each select="//survey/result/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefund"><input type="hidden"><xsl:attribute name="name">survey/result/id_4dd20b5c84ef12e0e10080000ab5dd78/<xsl:value-of select="name(.)"/></xsl:attribute><xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute></input></xsl:for-each></xsl:for-each></td></tr></xsl:if><xsl:if test="not(//noDisplay/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefundreason)"><tr><td class="ListAnswerListbox"><select class="AnswerListboxRW" name="survey/result/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefundreason" size="1"><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="disabled">disabled</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefundreason"><xsl:attribute name="disabled">disabled</xsl:attribute><xsl:attribute name="class">AnswerListboxRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefundreason/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each><option value="id_4dd114c155800ff0e10080000ab5dd78"><xsl:if test="//survey/result/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefundreason[. = 'id_4dd114c155800ff0e10080000ab5dd78']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="''"/></xsl:call-template></option><option value="TEL_CUSTOMER"><xsl:if test="//survey/result/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefundreason[. = 'TEL_CUSTOMER']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'gemäss Telefonat mit Kunde'"/></xsl:call-template></option><option value="TEL_DEALER"><xsl:if test="//survey/result/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefundreason[. = 'TEL_DEALER']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'gemäss Telefonat mit Händler'"/></xsl:call-template></option><option value="TECHNICIAN"><xsl:if test="//survey/result/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefundreason[. = 'TECHNICIAN']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'gemäss Techniker'"/></xsl:call-template></option><option value="ORDER"><xsl:if test="//survey/result/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefundreason[. = 'ORDER']"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'gemäss Bestellung'"/></xsl:call-template></option></select><xsl:for-each select="//readOnly/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefundreason"><xsl:for-each select="//survey/result/id_4dd20b5c84ef12e0e10080000ab5dd78/a29_birefundreason"><input type="hidden"><xsl:attribute name="name">survey/result/id_4dd20b5c84ef12e0e10080000ab5dd78/<xsl:value-of select="name(.)"/></xsl:attribute><xsl:attribute name="value"><xsl:value-of select="."/></xsl:attribute></input></xsl:for-each></xsl:for-each></td></tr></xsl:if></tbody></table></div></xsl:if><xsl:if test="not((count(//noDisplay/q28)) + (count(//noDisplay/q28/*))= 1)"><div class="Question" Id="q28"><div class="QuestionText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="'28. Maschinenalter'"/></xsl:call-template></div><table summary="Survey Questions" class="QuestionList"><tbody><xsl:if test="not(//noDisplay/q28/a28)"><tr><td class="ListAnswerField"><input class="AnswerFieldRW" type="text" name="survey/result/q28/a28" size="50 " maxlength="50 "><xsl:attribute name="value"><xsl:value-of select="//survey/result/q28/a28"/></xsl:attribute><xsl:if test="$C_Mode='DISPLAY'"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:if><xsl:for-each select="//readOnly/q28/a28"><xsl:attribute name="readonly">readonly</xsl:attribute><xsl:attribute name="class">AnswerFieldRO</xsl:attribute></xsl:for-each><xsl:for-each select="//onEvent/q28/a28/*"><xsl:attribute name="{@Name}"><xsl:value-of select="@CallFunction"/></xsl:attribute></xsl:for-each></input></td><td class="ListAnswerFieldText"><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="''"/></xsl:call-template></td></tr></xsl:if></tbody></table></div></xsl:if><div class="Event"><xsl:if test="not($C_Mode='DISPLAY')"><input type="submit" class="ButtonInside" name="onInputProcessing(SUBMIT)" value="Sichern"/></xsl:if><xsl:if test="not($C_Mode='DISPLAY')"><input type="reset" class="ButtonInside" value="Eingaben zurücksetzen"/></xsl:if></div></div><!--End of Section--></form></body></html></xsl:template><xsl:template name="getLineBreak"><xsl:param name="source"/><xsl:variable name="sourceTextBR" select="string($source)"/><xsl:variable name="findBR">&lt;BR&gt;</xsl:variable><xsl:choose><xsl:when test="contains($sourceTextBR, $findBR)"><xsl:value-of select="substring-before($sourceTextBR,$findBR)"/><br/><xsl:call-template name="getLineBreak"><xsl:with-param name="source" select="substring-after($sourceTextBR,$findBR)"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:value-of select="$sourceTextBR"/></xsl:otherwise></xsl:choose></xsl:template><xsl:template name="getCRLF"><xsl:param name="source"/><xsl:variable name="sourceTextCRLF" select="string($source)"/><xsl:variable name="findCRLF">&amp;#013;&amp;#010;</xsl:variable><xsl:choose><xsl:when test="contains($sourceTextCRLF, $findCRLF)"><xsl:value-of select="substring-before($sourceTextCRLF,$findCRLF)"/>
+						&lt;BR&gt;
+						<xsl:call-template name="getCRLF"><xsl:with-param name="source" select="substring-after($sourceTextCRLF,$findCRLF)"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:value-of select="$sourceTextCRLF"/></xsl:otherwise></xsl:choose></xsl:template><xsl:template name="getCOMMENT"><xsl:param name="source"/><xsl:variable name="sourceTextCMNT" select="string($source)"/><xsl:variable name="findCOMMENT">&lt;COMMENT&gt;</xsl:variable><xsl:choose><xsl:when test="contains($sourceTextCMNT, $findCOMMENT)"><xsl:call-template name="getLineBreak"><xsl:with-param name="source" select="substring-before($sourceTextCMNT,$findCOMMENT)"/></xsl:call-template><xsl:element name="div"><xsl:attribute name="name">Comment</xsl:attribute><xsl:attribute name="class">Comment</xsl:attribute><xsl:call-template name="getLineBreak"><xsl:with-param name="source" select="substring-after($sourceTextCMNT,$findCOMMENT)"/></xsl:call-template></xsl:element></xsl:when><xsl:otherwise><xsl:call-template name="getLineBreak"><xsl:with-param name="source" select="$sourceTextCMNT"/></xsl:call-template></xsl:otherwise></xsl:choose></xsl:template><xsl:template name="replaceString"><xsl:param name="source"/><xsl:param name="find"/><xsl:param name="replace"/><xsl:variable name="sourceText" select="string($source)"/><xsl:choose><xsl:when test="contains($sourceText, $find)"><xsl:value-of select="substring-before($sourceText,$find)"/><xsl:value-of select="$replace"/><xsl:call-template name="replaceString"><xsl:with-param name="source" select="substring-after($sourceText,$find)"/><xsl:with-param name="find" select="$find"/><xsl:with-param name="replace" select="$replace"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:value-of select="$sourceText"/></xsl:otherwise></xsl:choose></xsl:template><xsl:template name="replaceParams"><xsl:param name="source"/><xsl:param name="index" select="1"/><xsl:variable name="sourceText" select="$source"/><xsl:variable name="indexSource" select="$index - 1"/><xsl:choose><xsl:when test="count(//replaceables/*) > $indexSource"><xsl:for-each select="//replaceables/*[$index]"><xsl:variable name="find"><xsl:value-of select="name()"/></xsl:variable><xsl:variable name="replace"><xsl:value-of select="."/></xsl:variable><xsl:choose><xsl:when test="contains($sourceText, $find)"><xsl:call-template name="replaceParams"><xsl:with-param name="source"><xsl:call-template name="replaceString"><xsl:with-param name="source" select="$sourceText"/><xsl:with-param name="find" select="$find"/><xsl:with-param name="replace" select="$replace"/></xsl:call-template></xsl:with-param><xsl:with-param name="index" select="$index+1"/></xsl:call-template></xsl:when><xsl:otherwise><xsl:call-template name="replaceParams"><xsl:with-param name="source" select="$sourceText"/><xsl:with-param name="index" select="$index+1"/></xsl:call-template></xsl:otherwise></xsl:choose></xsl:for-each></xsl:when><xsl:otherwise><xsl:call-template name="getCOMMENT"><xsl:with-param name="source"><xsl:call-template name="getCRLF"><xsl:with-param name="source" select="$sourceText"/></xsl:call-template></xsl:with-param></xsl:call-template></xsl:otherwise></xsl:choose></xsl:template></xsl:stylesheet>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704Test.java
new file mode 100644
index 00000000000..6099296b73f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/BugDB12665704Test.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.BufferedReader;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6935697
+ * @summary Test Transformer can compile large xsl file.
+ */
+public class BugDB12665704Test {
+
+    @Test
+    public final void testTransform() {
+
+        try {
+            String str = new String();
+            ByteArrayOutputStream byte_stream = new ByteArrayOutputStream();
+            File inputFile = new File(getClass().getResource("BugDB12665704.xml").getPath());
+            FileReader in = new FileReader(inputFile);
+            int c;
+
+            while ((c = in.read()) != -1) {
+                str = str + new Character((char) c).toString();
+            }
+
+            in.close();
+
+            System.out.println(str);
+            byte buf[] = str.getBytes();
+            byte_stream.write(buf);
+            String style_sheet_uri = "BugDB12665704.xsl";
+            byte[] xml_byte_array = byte_stream.toByteArray();
+            InputStream xml_input_stream = new ByteArrayInputStream(xml_byte_array);
+
+            Source xml_source = new StreamSource(xml_input_stream);
+
+            TransformerFactory tFactory = TransformerFactory.newInstance();
+            Transformer transformer = tFactory.newTransformer();
+            StreamSource source = new StreamSource(getClass().getResource(style_sheet_uri).toString());
+            transformer = tFactory.newTransformer(source);
+
+            ByteArrayOutputStream result_output_stream = new ByteArrayOutputStream();
+            Result result = new StreamResult(result_output_stream);
+            transformer.transform(xml_source, result);
+            result_output_stream.close();
+
+            // expected success
+        } catch (Exception e) {
+            // unexpected failure
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+
+    @Test
+    public void testSAPTransform() {
+        StringWriter out = new StringWriter();
+        try {
+            String xml = getXML(getClass().getResource("BugDB12665704.xml").getPath());
+            getTransformer().transform(new StreamSource(new StringReader(xml)), new StreamResult(out));
+        } catch (TransformerConfigurationException ex) {
+            // Trace.dump(xslt);
+            // Trace.dump(xml);
+            System.err.println("can't process xslt: " + ex.getMessage() + " (" + ex + ")");
+        } catch (TransformerException ex) {
+            // Trace.dump(xslt);
+            // Trace.dump(xml);
+            System.err.println("can't process xml: " + ex.getMessage() + " (" + ex + ")");
+        } catch (Exception ex) {
+            // Trace.dump(xslt);
+            // Trace.dump(xml);
+            System.err.println("can't create processor: " + ex.getMessage() + " (" + ex + ")");
+        }
+    }
+
+    Transformer getTransformer() {
+        Transformer transformer = null;
+        try {
+            InputStream xin = this.getClass().getResourceAsStream("BugDB12665704.xsl");
+            StreamSource xslt = new StreamSource(xin);
+            TransformerFactory fc = TransformerFactory.newInstance();
+            transformer = fc.newTransformer(xslt);
+
+        } catch (Exception e) {
+            // unexpected failure
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+
+        return transformer;
+    }
+
+    String getXML(String sourceFile) throws IOException {
+        BufferedReader inputStream = null;
+        StringBuilder sb = new StringBuilder();
+        try {
+            inputStream = new BufferedReader(new FileReader(sourceFile));
+            String l;
+
+            while ((l = inputStream.readLine()) != null) {
+                sb.append(l);
+            }
+
+        } finally {
+            if (inputStream != null) {
+                inputStream.close();
+            }
+        }
+        return sb.toString();
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CLITest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CLITest.java
new file mode 100644
index 00000000000..de8139a8267
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CLITest.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test internal transform CLI.
+ */
+public class CLITest {
+
+    @Test
+    public void testCLI() {
+        try {
+            String[] args = new String[] { "-XSLTC", "-XSL", getClass().getResource("tigertest.xsl").toString(), "-IN",
+                    getClass().getResource("tigertest-in.xml").toString(), };
+            com.sun.org.apache.xalan.internal.xslt.Process._main(args);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137.xml
new file mode 100644
index 00000000000..e1dc62dde21
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<ObjectSetRoot>
+<Object>
+</Object>
+</ObjectSetRoot>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137.xsl
new file mode 100644
index 00000000000..96caed83357
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137.xsl
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+
+<xsl:stylesheet version="1.0"
+      xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:variable name="validAffectsRelClasses">
+</xsl:variable>
+
+<xsl:key name="UniqueAffectsRelObjects"
+      match="/ObjectSetRoot/Object[
+      contains($validAffectsRelClasses, @Class)]"
+      use="not(@OBID=preceding-sibling::Object[
+      contains($validAffectsRelClasses, @Class)]/@OBID)"/>
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137Test.java
new file mode 100644
index 00000000000..c74fb355e89
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6401137Test.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.FileReader;
+import java.io.InputStream;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6401137
+ * @summary Test transform certain xsl.
+ */
+public class CR6401137Test {
+
+    @Test
+    public final void testTransform() {
+
+        try {
+            String str = new String();
+            ByteArrayOutputStream byte_stream = new ByteArrayOutputStream();
+            File inputFile = new File(getClass().getResource("CR6401137.xml").getPath());
+            FileReader in = new FileReader(inputFile);
+            int c;
+
+            while ((c = in.read()) != -1) {
+                str = str + new Character((char) c).toString();
+            }
+
+            in.close();
+
+            System.out.println(str);
+            byte buf[] = str.getBytes();
+            byte_stream.write(buf);
+            String style_sheet_uri = "CR6401137.xsl";
+            byte[] xml_byte_array = byte_stream.toByteArray();
+            InputStream xml_input_stream = new ByteArrayInputStream(xml_byte_array);
+
+            Source xml_source = new StreamSource(xml_input_stream);
+
+            TransformerFactory tFactory = TransformerFactory.newInstance();
+            Transformer transformer = tFactory.newTransformer();
+            StreamSource source = new StreamSource(getClass().getResourceAsStream(style_sheet_uri));
+            transformer = tFactory.newTransformer(source);
+
+            ByteArrayOutputStream result_output_stream = new ByteArrayOutputStream();
+            Result result = new StreamResult(result_output_stream);
+            transformer.transform(xml_source, result);
+            result_output_stream.close();
+
+            // expected success
+        } catch (Exception e) {
+            // unexpected failure
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6551600.policy b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6551600.policy
new file mode 100644
index 00000000000..381c067b376
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6551600.policy
@@ -0,0 +1,22 @@
+grant {
+	permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+	permission java.lang.RuntimePermission "accessDeclaredMembers";
+	
+	permission java.io.FilePermission "${test.classes}/../../-", "read, write, delete";
+	permission java.io.FilePermission ".", "read, write, delete";
+	permission java.util.PropertyPermission "*", "read, write";
+	
+    permission java.lang.RuntimePermission "setSecurityManager";
+    permission java.lang.RuntimePermission "createSecurityManager";
+    permission java.lang.RuntimePermission "createClassLoader";
+    permission java.lang.RuntimePermission "setIO";
+	permission java.lang.RuntimePermission "setContextClassLoader"; 
+	permission java.security.SecurityPermission "getPolicy";
+    
+    permission java.io.FilePermission "${test.src}/-", "read, write, delete";
+    permission java.io.FilePermission "${user.dir}/-", "read, write, delete";
+    permission java.io.FilePermission "${java.io.tmpdir}/-", "read, write, delete";
+    
+    permission java.io.FilePermission "//localhost/C$/xslt_unc_test.xml", "read, write, delete";
+    
+};
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6551600Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6551600Test.java
new file mode 100644
index 00000000000..4211bdf5d8d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6551600Test.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/*
+ * @bug 6551600
+ * @summary Test using UNC path as StreamResult.
+ */
+public class CR6551600Test {
+
+    @Test
+    public final void testUNCPath() {
+        String hostName = "";
+        try {
+            hostName = java.net.InetAddress.getLocalHost().getHostName();
+        } catch (java.net.UnknownHostException e) {
+            // falls through
+        }
+
+        String path = "\\\\" + hostName + "\\C$\\xslt_unc_test.xml";
+        String os = System.getProperty("os.name");
+        if (os.indexOf("Windows") < 0) {
+            path = "///tmp/test.xml";
+        }
+        else {
+                policy.PolicyUtil.changePolicy(getClass().getResource("CR6551600.policy").getFile());
+        }
+
+        try {
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            DocumentBuilder builder = factory.newDocumentBuilder();
+            Document doc = builder.newDocument();
+            Element root = doc.createElement("test");
+            doc.appendChild(root);
+            // create an identity transform
+            Transformer t = TransformerFactory.newInstance().newTransformer();
+            File f = new File(path);
+            StreamResult result = new StreamResult(f);
+            DOMSource source = new DOMSource(doc);
+            System.out.println("Writing to " + f);
+            t.transform(source, result);
+        } catch (Exception e) {
+            // unexpected failure
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+
+        File file = new File(path);
+        if (file.exists()) {
+            file.deleteOnExit();
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6577667.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6577667.xsl
new file mode 100644
index 00000000000..9bb96c30417
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6577667.xsl
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+      xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+      xmlns:xlink="http://www.w3.org/1999/xlink"
+   >
+      <xsl:output omit-xml-declaration = "yes" />
+<xsl:template match="mo" >
+   <xsl:choose>
+      <xsl:when test="and * and" ></xsl:when>
+      <xsl:when test="and and and" ></xsl:when>
+      <xsl:when test="* and *" ></xsl:when>
+      <xsl:when test="not(preceding-sibling::elem1 and following-sibling::elem2)"></xsl:when>
+      <xsl:when test="not(preceding-sibling::* and following-sibling::*)"></xsl:when>
+      <xsl:when test="or * or" ></xsl:when>
+      <xsl:when test="and or or" ></xsl:when>
+      <xsl:when test="* or *" ></xsl:when>
+      <xsl:when test="not(preceding-sibling::elem1 or following-sibling::elem2)"></xsl:when>
+      <xsl:when test="not(preceding-sibling::* or following-sibling::*)"></xsl:when>
+      <xsl:when test="and | and" ></xsl:when>
+      <xsl:when test="* | *" ></xsl:when>
+      <xsl:when test="not(preceding-sibling::elem1 | following-sibling::elem2)"></xsl:when>
+      <xsl:when test="not(preceding-sibling::* | following-sibling::*)"></xsl:when>
+    </xsl:choose>
+</xsl:template>
+</xsl:stylesheet>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6577667Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6577667Test.java
new file mode 100644
index 00000000000..b6039c120e1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6577667Test.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.InputStream;
+
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6577667
+ * @summary Test XSLT can parse statement "not(preceding-sibling::* or following-sibling::*)" in stylesheet file.
+ */
+public class CR6577667Test {
+
+    @Test
+    public final void testTransform() {
+        try {
+            InputStream xin = this.getClass().getResourceAsStream("CR6577667.xsl");
+            StreamSource xslt = new StreamSource(xin);
+            TransformerFactory fc = TransformerFactory.newInstance();
+            Transformer transformer = fc.newTransformer(xslt);
+        } catch (Exception e) {
+            // unexpected failure
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6652519Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6652519Test.java
new file mode 100644
index 00000000000..afec16489fd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6652519Test.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+
+/*
+ * @bug 6652519
+ * @summary Test transfoming from StreamSource to DOMResult.
+ */
+public class CR6652519Test {
+
+    @Test
+    public final void test1() {
+        try {
+            long start = System.currentTimeMillis();
+            Transformer t = TransformerFactory.newInstance().newTransformer();
+            File file = new File(getClass().getResource("msgAttach.xml").getFile());
+            StreamSource source = new StreamSource(file);
+            DOMResult result = new DOMResult();
+            t.transform(source, result);
+
+            long end = System.currentTimeMillis();
+            System.out.println("Test2:Total Time Taken=" + (end - start));
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    public final void xtest2() {
+        try {
+            long start = System.currentTimeMillis();
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            Document doc = db.parse(new File(getClass().getResource("msgAttach.xml").getFile()));
+            long end = System.currentTimeMillis();
+            System.out.println("Test1: Total Time Taken=" + (end - start));
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6689809Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6689809Test.java
new file mode 100644
index 00000000000..dec6b4eb799
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6689809Test.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.CharArrayWriter;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6689809
+ * @summary Test Transformer can handle XPath predicates in xsl:key elements.
+ */
+public class CR6689809Test {
+
+    @Test
+    public final void testTransform() {
+
+        try {
+            StreamSource input = new StreamSource(getClass().getResourceAsStream("PredicateInKeyTest.xml"));
+            StreamSource stylesheet = new StreamSource(getClass().getResourceAsStream("PredicateInKeyTest.xsl"));
+            CharArrayWriter buffer = new CharArrayWriter();
+            StreamResult output = new StreamResult(buffer);
+
+            TransformerFactory.newInstance().newTransformer(stylesheet).transform(input, output);
+
+            Assert.assertEquals(buffer.toString(), "0|1|2|3", "XSLT xsl:key implementation is broken!");
+            // expected success
+        } catch (Exception e) {
+            // unexpected failure
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829.xml
new file mode 100644
index 00000000000..fe3bc3f76c0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" ?>
+<catalog>
+  <book>
+    <title>Java</title>
+  </book>
+</catalog>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829.xsl
new file mode 100644
index 00000000000..96ce42aae9a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829.xsl
@@ -0,0 +1,22 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template match="book">
+  <h1><xsl:value-of select="title"/></h1>
+  <xsl:call-template name="MyTemplate"/>
+
+<!--
+  <xsl:call-template name="MyTemplate">
+  <xsl:with-param name="x" select="2"/>
+  </xsl:call-template>
+-->
+</xsl:template>
+
+<xsl:template name="MyTemplate">
+  <xsl:param name="x" select="1"/>
+  <p>MyTemplate has been called. param x=<xsl:value-of select="$x"/>.</p>
+</xsl:template>
+
+<xsl:include href="CR6905829Inc.xsl"/>
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829Inc.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829Inc.xsl
new file mode 100644
index 00000000000..eab2accae26
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829Inc.xsl
@@ -0,0 +1,10 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+
+<xsl:template name="Dummy">
+  <p>Dummy has been called.</p>
+</xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829Test.java
new file mode 100644
index 00000000000..9a77ed1a1bf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6905829Test.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+import java.io.StringWriter;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6905829
+ * @summary Test XSLT can parse certain xsl.
+ */
+public class CR6905829Test {
+
+    @Test
+    public final void testTransform() {
+        try {
+            String file = getClass().getResource("CR6905829.xsl").getFile();
+            Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(new File(file)));
+
+            System.out.printf("transformer: %s%n", t.getClass().getName());
+
+            StringWriter streamResult = new StringWriter();
+            t.transform(new StreamSource(getClass().getResourceAsStream("CR6905829.xml")), new StreamResult(streamResult));
+
+            // expected success
+        } catch (Exception e) {
+            // unexpected failure
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6935697.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6935697.xml
new file mode 100644
index 00000000000..ebf4097a8bd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6935697.xml
@@ -0,0 +1,158 @@
+<Iteration><ViewEditor  ViewType='PieChart' DataSet='_Employees' ModifierID='undefined' Context='Data' Page='chartFields' ViewName='Pie Chart' bViewEditorAnimation="false" ><Translated><String name="DATA_OBJECTS">Data Objects</String>
+<String name="DATA_FIELDS">Data Fields</String>
+<String name="SELECT_ALL">select all</String>
+<String name="SELECT_NONE">select none</String>
+<String name="CHOOSE_DATA_OBJECT">Choose Data Object</String>
+<String name="CHOOSE_DATA_FIELDS">Choose Data Fields</String>
+<String name="MORE_OPTIONS">More Options, or Finish</String>
+<String name="NEXT">Next</String>
+<String name="BACK">Back</String>
+<String name="FINISH">Finish</String>
+<String name="APPLY">Apply</String>
+<String name="SORT_DIRECTION">Sort Direction</String>
+<String name="VIEW_FIELDS">View Fields</String>
+<String name="SORTED_FIELDS">Sorted Fields</String>
+<String name="ASCENDING">Ascending</String>
+<String name="DESCENDING">Descending</String>
+<String name="OK">OK</String>
+<String name="CANCEL">Cancel</String>
+<String name="REPORT_GROUPS">Report Groups</String>
+<String name="REPORT_GROUP">Report Group</String>
+<String name="REPORT_FIELDS">Report Fields</String>
+<String name="GROUP_PROPERTIES">Group Properties</String>
+<String name="DISPLAY_HEADER_FOOTER">Display Group Header/Footer</String>
+<String name="GROUP_SORT_DIRECTION">Group Sort Direction</String>
+<String name="GROUP_TYPE">Group Type</String>
+<String name="VIEWEDITOR_TAB_SURFACE_PROMPTS">Surface Prompts</String>
+<String name="HEADER">Header</String>
+<String name="FOOTER">Footer</String>
+<String name="DISPLAY_IN">Display in</String>
+<String name="ROW_FILTER_TAB">Row Filter</String>
+<String name="GROUP_FILTER_TAB">Group Filter</String>
+<String name="SUMMARY_FUNCTIONS">Summary Function(s)</String>
+<String name="REPORT_FOOTER">Report Footer</String>
+<String name="GROUP_FOOTER">Group Footer</String>
+<String name="DETAIL">Detail</String>
+<String name="SAME_VALUE">Same Value</String>
+<String name="CHOOSE_CONTENT_TYPE">Choose Content Type</String>
+<String name="PIE_GROUPS_AND_MULTIPLE_SERIES">If you group by a field, you can only choose one Summary Function for one Chart Value.</String>
+<String name="CHART_FIELDS_WITHOUT_AGGREGATES">You must select at least one summary function for each chart value.</String>
+<String name="AGGREGATE_SUM">Sum</String>
+<String name="AGGREGATE_AVERAGE">Average</String>
+<String name="AGGREGATE_MINIMUM">Minimum</String>
+<String name="AGGREGATE_MAXIMUM">Maximum</String>
+<String name="AGGREGATE_COUNT">Count</String>
+<String name="AGGREGATE_COUNTDISTINCT">Count Distinct</String>
+<String name="CHOOSE_GROUPS">Group</String>
+<String name="CHOOSE_SUMMARY">Summary</String>
+<String name="COLUMNS">Columns</String>
+<String name="ROWS">rows</String>
+<String name="VALUES">Values</String>
+<String name="SHOW_INTERMEDIATE_SUMMARY_FUNCTIONS">Show intermediate summary functions</String>
+<String name="SUMMARY_LEVELS">Summary Levels</String>
+<String name="HIDE">Hide</String>
+<String name="ARRANGE">Arrange</String>
+<String name="DATA_OBJECT">data object</String>
+<String name="FILTER_NAV_WARNING">You must click Add/Update Entry to apply the filter</String>
+<String name="FILTER_NAV_WARNING_TITLE">Filter Entry</String>
+<String name="CROSSTAB_EDITOR">Crosstab Editor</String>
+<String name="CROSSTAB_ROW_HELP_TEXT">Drag fields here to put the values on the row axis.</String>
+<String name="CROSSTAB_ERROR_NO_ROWS_OR_COLUMNS">There must be at least one field in either rows or columns.</String>
+<String name="CROSSTAB_ERROR_NO_VALUES">There must be at least one field selected for values.</String>
+<String name="CROSSTAB_ERROR_BUCKET">Invalid value for Time Group quantity. Year should be a perfect divisor of 10, Month of 12, Week of 52, and Hour of 24. Minute and Second should be a perfect divisor of 60. Quarter and Day of Year/Month/Week values can only be 1.</String>
+<String name="VIEWEDITOR_TAB_FIELDS">Fields</String>
+<String name="VIEWEDITOR_TAB_SORT">Sort</String>
+<String name="VIEWEDITOR_TAB_DATA_OBJECTS">Data Objects</String>
+<String name="VIEWEDITOR_TAB_ACTIONS">Actions</String>
+<String name="VIEWEDITOR_TAB_EDITABLEFIELDS">Editable Fields</String>
+<String name="VIEWEDITOR_TAB_FILTER">Filter</String>
+<String name="VIEWEDITOR_TAB_TOPN">Top N</String>
+<String name="VIEWEDITOR_TAB_DRILLING">Drilling</String>
+<String name="VIEWEDITOR_TAB_CALCULATION">Calculation</String>
+<String name="VIEWEDITOR_TAB_SUMMARY">Summary</String>
+<String name="VIEWEDITOR_TAB_GROUP">Group</String>
+<String name="VIEWEDITOR_TAB_DRIVING">Driving</String>
+<String name="VIEWEDITOR_TAB_GENERAL">General</String>
+<String name="VIEWEDITOR_TAB_CONTENT">Content</String>
+<String name="VIEWEDITOR_TAB_SHADING">Shading</String>
+<String name="VIEWEDITOR_TAB_TEXT">Text</String>
+<String name="VIEWEDITOR_TAB_ALIGN">Align</String>
+<String name="VIEWEDITOR_TAB_CONDITIONAL_FORMAT">Cond Format</String>
+<String name="VIEWEDITOR_TAB_VALUE_FORMAT">Value Format</String>
+<String name="VIEWEDITOR_TAB_DATALABELS">Data Labels</String>
+<String name="VIEWEDITOR_TAB_FONT">Font</String>
+<String name="VIEWEDITOR_TAB_ACTIVE_DATA">Active Data</String>
+<String name="VIEWEDITOR_TAB_AXIS">Axis</String>
+<String name="VIEWEDITOR_TAB_ACTION_FORM_CONTENT_TYPE">Content Type</String>
+<String name="VIEWEDITOR_TAB_ACTION_FORM_INPUTS">Inputs</String>
+<String name="VIEWEDITOR_TAB_ACTION_FORM_ASSOCIATIONS">Associations</String>
+<String name="VIEWEDITOR_TAB_GAUGE_STYLE">Gauge Styles</String>
+<String name="VIEWEDITOR_TAB_THEMES">Themes</String>
+<String name="BACKGROUND_COLOR">Background color</String>
+<String name="VIEWEDITOR_COLLAPSE_TIP_TEXT">Collapse Edit Pane</String>
+<String name="VIEWEDITOR_EXPAND_TIP_TEXT">Expand Edit Pane</String>
+<String name="VIEWEDITOR_MOVE_TIP_TEXT">Move Edit Pane</String>
+<String name="TOPN_TITLE_BARCHART">Display the Top N based on the first series of the chart</String>
+<String name="TOPN_TITLE_STACKEDBARCHART">Display the Top N based on the sum of the series of the chart</String>
+<String name="TOPN_TITLE_UPDATINGORDEREDLIST">Display the Top N based on the current sort criteria</String>
+<String name="VIEWEDITOR_TAB_LAYOUT">Layout</String>
+<String name="TOPN_QUANTITY">Quantity</String>
+<String name="TOPN_ADD_RANK_FIELD">Add a field displaying the rank number</String>
+<String name="TOPN_FIELD_NAME">Field Name</String>
+<String name="RANK_COLUMN">Rank Field</String>
+<String name="SELECT_STYLE">Select Style</String>
+<String name="STYLE1">High Performance</String>
+<String name="STYLE2">Horizon</String>
+<String name="MEDALLION">Medallion</String>
+<String name="VIEWEDITOR_TAB_MACROS">Macro Options</String>
+<String name="VIEWEDITOR_TAB_DATA_TRANSFER">Data Transfer</String>
+<String name="VIEWEDITOR_MACRO_BEFORE">Run this macro before</String>
+<String name="VIEWEDITOR_MACRO_AFTER">Run this macro after</String>
+<String name="VIEWEDITOR_EXCEL_NAME">Name</String>
+<String name="EXCEL_PROPERTIES_MACRO_STRING1">Run on data transfer</String>
+<String name="EXCEL_PROPERTIES_DATA_STRING1">Name definition for data</String>
+<String name="VIEWEDITOR_UOL_TOPN_NO_SORT">For Updating Ordered List views, apply a sort for Top N to display.</String>
+<String name="VIEWEDITOR_UOL_RANKCOLORS_NO_SORT">For Updating Ordered List views, apply a sort for Rank Colors to display.</String>
+<String name="VIEWEDITOR_UOL_TOPN_NO_SORT_TITLE">View Editor</String>
+<String name="SUMMARIZE">Summarize</String>
+<String name="SHOULD_COLLAPSE_WITH_NO_AGGREGATES">You must choose an aggregate function to Summarize a List.</String>
+<String name="VIEWEDITOR_UOL_SORTFIELD_NOT_SELECTED">For Updating Ordered List views, a field must be selected in the Fields page if you want to sort on it.</String>
+<String name="VIEWEDITOR_TAB_PATTERNS">Patterns</String>
+<String name="TIMEBUCKETS_NEGATIVEORZERO">Cannot create a negative or zero grouped time bucket.</String>
+<String name="TIMEBUCKETS_NONTIMEBASEDFUNCTION">Cannot create time buckets with a non time based function.</String>
+<String name="TIMEBUCKETS_NOTDIVISIBLE">is not a supported quantity for this time unit. \nSelect a quantity that divides evenly into</String>
+<String name="TIMEBUCKETS_CONTINUOUSSINGLE">Cannot create a continuous time series with multiple groupings or units.</String>
+<String name="VIEWEDITOR_TAB_TARGET">Target</String>
+<String name="AGGREGATE_NOOP">Calculation</String>
+<String name="AGGREGATE_PERCENTOFTOTAL">Percent Of Total</String>
+<String name="TAB_CONTENTS">Tab Contents</String>
+<String name="DASHBOARD_TOOLBAR">Toolbar</String>
+<String name="DASHBOARD_CONTENTS">Dashboard Contents</String>
+<String name="TIMEBUCKETS_NOTDIVISIBLE_QUARTER">is not a supported quantity for Quarters. \nQuarters can only use a quantity of</String>
+<String name="CHART_FIELDS_MODIFIERS_GROUPLEVELS">You must group by the same number of fields for all Data Objects.</String>
+<String name="CHART_FIELDS_MODIFIERS_GROUPLEVELS_TYPE">You must group by the same type of fields for all Data Objects.</String>
+<String name="CHART_DATA_FIELDS">Chart Data Fields</String>
+<String name="CHART_DATA_FIELDS_INDEX_MEASURE_SELECT">A field cannot be selected as an index and a measure.</String>
+<String name="CHART_DATA_FIELDS_SELECT_INDEX">Please select an Index</String>
+<String name="CHART_DATA_FIELDS_SELECT_MEASURE">Please select a Measure</String>
+<String name="CHART_DATA_FIELDS_PASS_FILTER">Please type in a Pass Filter</String>
+<String name="CHART_INDEX">Index</String>
+<String name="CHART_SPC_MEASURES">SPC Chart Measures</String>
+<String name="VIEWEDITOR_TAB_3D_VIEW">3D View</String>
+<String name="VIEW_EDITOR_DATA_ICON_TEXT">Data</String>
+<String name="VIEW_EDITOR_PROPERTIES_ICON_TEXT">Properties</String></Translated><Translated><String name="TIME_GROUP_TIME_UNIT">Time Unit</String>
+<String name="TIME_GROUP_QUANTITY">Quantity</String>
+<String name="TIME_BUCKETS">Time Groups</String>
+<String name="TIME_BUCKET_YEAR">Year</String>
+<String name="TIME_BUCKET_QUARTER">Quarter</String>
+<String name="TIME_BUCKET_MONTH">Month</String>
+<String name="TIME_BUCKET_WEEK">Week</String>
+<String name="TIME_BUCKET_DAYOFYEAR">Day of Year</String>
+<String name="TIME_BUCKET_DAYOFMONTH">Day of Month</String>
+<String name="TIME_BUCKET_DAYOFWEEK">Day of Week</String>
+<String name="TIME_BUCKET_HOUR">Hour</String>
+<String name="TIME_BUCKET_MINUTE">Minute</String>
+<String name="TIME_BUCKET_SECOND">Second</String>
+<String name="USE_TIME_SERIES">Use time series</String>
+<String name="CONTINUOUS_TIME_SERIES">Continuous time series</String>
+<String name="USE_TIME_GROUPS">Use time groups</String></Translated></ViewEditor><HelpTopicId>bam_as_viewedit_doselect</HelpTopicId></Iteration>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6935697.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6935697.xsl
new file mode 100644
index 00000000000..037e2084113
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6935697.xsl
@@ -0,0 +1,1452 @@
+<?xml version="1.0"?>
+
+<xsl:stylesheet version="2.0"
+  xmlns:Iteration="http://www.iterationsoftware.com"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+  xmlns:xalan="http://xml.apache.org/xalan"
+  xmlns:HTML="http://www.w3.org/Profiles/XHTML-transitional"
+  xmlns:v="urn:schemas-microsoft-com:vml"
+  xmlns:local="#local-functions">
+
+  <xsl:output method="xml" encoding="UTF-8" cdata-section-elements="CalcExpression Value"/>
+
+  <xsl:variable name="TabRowHeight">21</xsl:variable>
+
+  <xsl:variable name="DataEditor">
+      <xsl:call-template name="DataEditor"/>
+  </xsl:variable>
+
+  <xsl:variable name="PropertyEditor">
+    <PropertyEditor>
+      <View>
+        <ContentType>StreamingList</ContentType>
+        <ContentType>UpdatesList</ContentType>
+        <ContentType>List</ContentType>
+        <ContentType>UpdatingOrderedList</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTIVE_DATA" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTIVE_DATA']"/></xsl:attribute>
+          <Event>ActiveData</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRIVING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRIVING']"/></xsl:attribute>
+          <Event>Driving</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>CollapsedList</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTIVE_DATA" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTIVE_DATA']"/></xsl:attribute>
+          <Event>ActiveData</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRIVING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRIVING']"/></xsl:attribute>
+          <Event>Driving</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>ActionList</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTIONS" path="/activestudio/stylesheets/xsl/vieweditor/views/list">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTIONS']"/></xsl:attribute>
+          <Event>Actions</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_EDITABLEFIELDS" path="/activestudio/stylesheets/xsl/vieweditor/views/list">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_EDITABLEFIELDS']"/></xsl:attribute>
+          <Event>EditableFields</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTIVE_DATA" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTIVE_DATA']"/></xsl:attribute>
+          <Event>ActiveData</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRIVING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRIVING']"/></xsl:attribute>
+          <Event>Driving</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>OWCSpreadsheet</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL" path="/activestudio/stylesheets/xsl/vieweditor/views/owcspreadsheet">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTIVE_DATA" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTIVE_DATA']"/></xsl:attribute>
+          <Event>ActiveData</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>ExcelSpreadsheet</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL" path="/activestudio/stylesheets/xsl/vieweditor/views/excelspreadsheet">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_MACROS" path="/activestudio/stylesheets/xsl/vieweditor/views/excelspreadsheet">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_MACROS']"/></xsl:attribute>
+          <Event>Macros</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DATA_TRANSFER" path="/activestudio/stylesheets/xsl/vieweditor/views/excelspreadsheet">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DATA_TRANSFER']"/></xsl:attribute>
+          <Event>DataTransfer</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>Columnar</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTIVE_DATA" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTIVE_DATA']"/></xsl:attribute>
+          <Event>ActiveData</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>DialGauge</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>GeneralDial</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_GAUGE_STYLE">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GAUGE_STYLE']"/></xsl:attribute>
+          <Event>Styles</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>Arrow</ContentType>
+        <ContentType>MarketArrow</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL" path="/activestudio/stylesheets/xsl/vieweditor/views/kpi/arrow">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>GeneralArrow</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>RangeGauge</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>GeneralRange</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_GAUGE_STYLE">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GAUGE_STYLE']"/></xsl:attribute>
+          <Event>Styles</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+      </View>
+
+      <View>
+        <ContentType>SurfacePrompts</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL" path="/activestudio/stylesheets/xsl/vieweditor/views/surfaceprompts">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SURFACE_PROMPTS" path="/activestudio/stylesheets/xsl/vieweditor/views/surfaceprompts">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SURFACE_PROMPTS']"/></xsl:attribute>
+          <Event>SurfacePrompts</Event>
+        </Page>
+      </View>
+
+      <View>
+        <ContentType>Container</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL" path="/activestudio/stylesheets/xsl/vieweditor/views/surfaceprompts">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRILLING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRILLING']"/></xsl:attribute>
+          <Event>Drilling</Event>
+        </Page>
+      </View>
+
+      <View>
+        <ContentType>RowGroup</ContentType>
+        <ContentType>ColumnGroup</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_LAYOUT" path="/activestudio/stylesheets/xsl/vieweditor/views/group">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_LAYOUT']"/></xsl:attribute>
+          <Event>Layout</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+      </View>
+
+      <View>
+        <ContentType>CustomContent</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_CONTENT">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_CONTENT']"/></xsl:attribute>
+          <Event>ChooseContentType</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+      </View>
+
+      <View>
+        <ContentType>TabGroup</ContentType>
+        <Page id="TAB_CONTENTS">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='TAB_CONTENTS']"/>
+          </xsl:attribute>
+          <Event>TabContents</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_GENERAL" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+      </View>
+
+      <View>
+        <ContentType>Dashboard</ContentType>
+        <Page id="DASHBOARD_CONTENTS">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='DASHBOARD_CONTENTS']"/>
+          </xsl:attribute>
+          <Event>DashboardContents</Event>
+        </Page>
+        <Page id="DASHBOARD_TOOLBAR">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='DASHBOARD_TOOLBAR']"/>
+          </xsl:attribute>
+          <Event>DashboardToolbar</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_GENERAL" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+      </View>
+
+      <View>
+        <ContentType>ActionForm</ContentType>
+        <Page id="VIEWEDITOR_TAB_ACTION_FORM_CONTENT_TYPE">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTION_FORM_CONTENT_TYPE']"/></xsl:attribute>
+          <Event>chooseActionFormType</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTION_FORM_INPUTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTION_FORM_INPUTS']"/></xsl:attribute>
+          <Event>inputs</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTION_FORM_ASSOCIATIONS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTION_FORM_ASSOCIATIONS']"/></xsl:attribute>
+          <Event>associations</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_GENERAL" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+      </View>
+
+      <View>
+        <ContentType>BarChart</ContentType>
+        <ContentType>LineChart</ContentType>
+        <ContentType>AreaChart</ContentType>
+        <ContentType>ComboChart</ContentType>
+        <ContentType>StackedBarChart</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_AXIS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_AXIS']"/></xsl:attribute>
+          <Event>Axis</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DATALABELS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DATALABELS']"/></xsl:attribute>
+          <Event>DataLabels</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_THEMES">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_THEMES']"/></xsl:attribute>
+          <Event>Themes</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTIVE_DATA">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTIVE_DATA']"/></xsl:attribute>
+          <Event>ActiveData</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_PATTERNS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_PATTERNS']"/></xsl:attribute>
+          <Event>Patterns</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TARGET">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TARGET']"/></xsl:attribute>
+          <Event>Target</Event>
+        </Page>
+      </View>
+
+      <View>
+        <ContentType>ThreeDBarChart</ContentType>
+        <ContentType>ThreeDLineChart</ContentType>
+        <ContentType>ThreeDAreaChart</ContentType>
+        <ContentType>ThreeDComboChart</ContentType>
+        <ContentType>ThreeDStackedBarChart</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_AXIS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_AXIS']"/></xsl:attribute>
+          <Event>Axis</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DATALABELS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DATALABELS']"/></xsl:attribute>
+          <Event>DataLabels</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_THEMES">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_THEMES']"/></xsl:attribute>
+          <Event>Themes</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTIVE_DATA">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTIVE_DATA']"/></xsl:attribute>
+          <Event>ActiveData</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_PATTERNS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_PATTERNS']"/></xsl:attribute>
+          <Event>Patterns</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TARGET">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TARGET']"/></xsl:attribute>
+          <Event>Target</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_3DVIEW">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_3D_VIEW']"/></xsl:attribute>
+          <Event>3DView</Event>
+        </Page>
+      </View>
+      <View>
+
+        <Page id="VIEWEDITOR_TAB_GENERAL">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DATALABELS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DATALABELS']"/></xsl:attribute>
+          <Event>DataLabels</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+
+      </View>
+      <View>
+        <ContentType>RChart</ContentType>
+        <ContentType>SChart</ContentType>
+        <ContentType>PChart</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_AXIS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_AXIS']"/></xsl:attribute>
+          <Event>Axis</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_THEMES">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_THEMES']"/></xsl:attribute>
+          <Event>Themes</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTIVE_DATA">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTIVE_DATA']"/></xsl:attribute>
+          <Event>ActiveData</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>PieChart</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DATALABELS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DATALABELS']"/></xsl:attribute>
+          <Event>DataLabels</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_THEMES" path="/activestudio/stylesheets/xsl/vieweditor/views/chart">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_THEMES']"/></xsl:attribute>
+          <Event>Themes</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTIVE_DATA">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTIVE_DATA']"/></xsl:attribute>
+          <Event>ActiveData</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_PATTERNS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_PATTERNS']"/></xsl:attribute>
+          <Event>Patterns</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>ThreeDPieChart</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DATALABELS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DATALABELS']"/></xsl:attribute>
+          <Event>DataLabels</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_THEMES" path="/activestudio/stylesheets/xsl/vieweditor/views/chart">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_THEMES']"/></xsl:attribute>
+          <Event>Themes</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTIVE_DATA">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTIVE_DATA']"/></xsl:attribute>
+          <Event>ActiveData</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_PATTERNS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_PATTERNS']"/></xsl:attribute>
+          <Event>Patterns</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_3DVIEW">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_3D_VIEW']"/></xsl:attribute>
+          <Event>3DView</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>CrossTab</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_THEMES" path="/activestudio/stylesheets/xsl/vieweditor/views/crosstab">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_THEMES']"/></xsl:attribute>
+          <Event>Themes</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTIVE_DATA" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTIVE_DATA']"/></xsl:attribute>
+          <Event>ActiveData</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRIVING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRIVING']"/></xsl:attribute>
+          <Event>Driving</Event>
+        </Page>
+      </View>
+
+      <View>
+        <ContentType>Matrix</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_CONDITIONAL_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_CONDITIONAL_FORMAT']"/></xsl:attribute>
+          <Event>ConditionalFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_THEMES" path="/activestudio/stylesheets/xsl/vieweditor/views/crosstab">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_THEMES']"/></xsl:attribute>
+          <Event>Themes</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTIVE_DATA" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTIVE_DATA']"/></xsl:attribute>
+          <Event>ActiveData</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRIVING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRIVING']"/></xsl:attribute>
+          <Event>Driving</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>SummaryCrosstab</ContentType>
+        <Page id="VIEWEDITOR_TAB_GENERAL">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GENERAL']"/></xsl:attribute>
+          <Event>General</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SHADING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SHADING']"/></xsl:attribute>
+          <Event>BordersAndShading</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TEXT_AND_ALIGN" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TEXT']"/>
+            <xsl:text> &amp; </xsl:text>
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ALIGN']"/>
+          </xsl:attribute>
+          <Event>TextAndAlignment</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FONT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FONT']"/></xsl:attribute>
+          <Event>Font</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_VALUE_FORMAT" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_VALUE_FORMAT']"/></xsl:attribute>
+          <Event>ValueFormat</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_ACTIVE_DATA" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_ACTIVE_DATA']"/></xsl:attribute>
+          <Event>ActiveData</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRIVING" path="/activestudio/stylesheets/xsl/vieweditor">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRIVING']"/></xsl:attribute>
+          <Event>Driving</Event>
+        </Page>
+      </View>
+
+    </PropertyEditor>
+  </xsl:variable>
+
+  <xsl:variable name="view_type"><xsl:value-of select="//ViewEditor/@ViewType"/></xsl:variable>
+  <xsl:variable name="InitialTabEvent"><xsl:value-of select="//ViewEditor/@Page"/></xsl:variable>
+
+  <xsl:template match="/">
+    <xsl:apply-templates select="Iteration"/>
+  </xsl:template>
+
+  <xsl:template match="Iteration">
+
+
+
+    <script>
+
+	  var g_strInitialTabID = "<xsl:choose>
+        <xsl:when test="//ViewEditor/@Context = 'Data'">
+          <xsl:value-of select="xalan:nodeset($DataEditor)/DataEditor/View[ContentType=$view_type]/Page[Event = $InitialTabEvent]/@id"/>
+        </xsl:when>
+        <xsl:otherwise>
+          <xsl:value-of select="xalan:nodeset($PropertyEditor)/PropertyEditor/View[ContentType=$view_type]/Page[Event = $InitialTabEvent]/@id"/>
+        </xsl:otherwise>
+      </xsl:choose>";
+
+      var g_strCurrentDataEditorTabID = "<xsl:value-of select="xalan:nodeset($DataEditor)/DataEditor/View[ContentType=$view_type]/Page[1]/@id"/>";
+      var g_strCurrentPropertyEditorTabID = "<xsl:value-of select="xalan:nodeset($PropertyEditor)/PropertyEditor/View[ContentType=$view_type]/Page[1]/@id"/>";
+
+    </script>
+
+      <xsl:apply-templates select="ViewEditor"/>
+  </xsl:template>
+
+  <xsl:template match="ViewEditor">
+    <Iteration:viewEditor id="viewEditor" mode="editor">
+      <xsl:attribute name="bAnimate"><xsl:value-of select="@bViewEditorAnimation"/></xsl:attribute>
+
+
+
+
+
+    <tbody id="viewEditorBody">
+      <tr>
+        <td><xsl:call-template name="Content"/></td>
+        </tr>
+    </tbody>
+
+
+
+    </Iteration:viewEditor>
+  </xsl:template>
+
+  <xsl:template name="Content">
+          <xsl:attribute name="height"><xsl:value-of select="$TabRowHeight"/></xsl:attribute>
+          <xsl:call-template name="ContentScroller">
+            <xsl:with-param name="UniqueScrollerID">DataTabsScroller</xsl:with-param>
+            <xsl:with-param name="ScrolledRegionHeight"><xsl:value-of select="$TabRowHeight"/></xsl:with-param>
+            <xsl:with-param name="ScrolledContentTop">2</xsl:with-param>
+            <xsl:with-param name="HTMLContent">
+              <Iteration:TabBar id="ViewEditorDataTabBar" TabStyle="Editor">
+                <xml id="TabsXML">
+                  <Tabs>
+                    <xsl:apply-templates select="xalan:nodeset($DataEditor)/DataEditor/View[ContentType=$view_type]/Page"></xsl:apply-templates>
+                  </Tabs>
+                </xml>
+              </Iteration:TabBar>
+            </xsl:with-param>
+          </xsl:call-template>
+    </xsl:template>
+
+  <xsl:template match="Page">
+    <Tab>
+      <xsl:attribute name="TabID"><xsl:value-of select="@id"/></xsl:attribute>
+      <TabText>
+        <xsl:attribute name="strText"><xsl:value-of select="@label"/></xsl:attribute>
+      </TabText>
+      <Description>
+        <xsl:attribute name="strDescription"><xsl:value-of select="@label"/></xsl:attribute>
+      </Description>
+      <OnClick bCheckForSuccess="true">
+        <xsl:attribute name="onclick">viewEditor.SelectTab('<xsl:value-of select="@id"/>');</xsl:attribute>
+      </OnClick>
+      <TabProperties>
+        <TabProperty name="label">
+          <xsl:attribute name="value"><xsl:value-of select="@label"/></xsl:attribute>
+        </TabProperty>
+        <TabProperty name="event">
+          <xsl:attribute name="value"><xsl:value-of select="Event"/></xsl:attribute>
+        </TabProperty>
+        <TabProperty name="path">
+          <xsl:attribute name="value"><xsl:value-of select="@path"/></xsl:attribute>
+        </TabProperty>
+      </TabProperties>
+    </Tab>
+  </xsl:template>
+
+  <xsl:template name="ContentScroller">
+    <xsl:param name="UniqueScrollerID"/>
+    <xsl:param name="ClassName"/>
+    <xsl:param name="ScrolledRegionHeight"/>
+    <xsl:param name="ScrolledContentTop"/>
+    <xsl:param name="AttachResize">true</xsl:param>
+    <xsl:param name="HTMLContent"/>
+
+    <Iteration:ContentScroller>
+      <xsl:attribute name="id"><xsl:value-of select="$UniqueScrollerID"/></xsl:attribute>
+
+      <table cellspacing="0" cellpadding="0" border="0" width="100%" style="margin:0;">
+        <xsl:attribute name="class"><xsl:value-of select="$ClassName"/></xsl:attribute>
+        <tr>
+          <td id="LeftScrollerButton" style="padding-right:5px;padding-left:2px;display:none;">
+            <img src="../shared/images/scroller_leftarrow.gif">
+              <xsl:attribute name="onmousedown"><xsl:value-of select="$UniqueScrollerID"/>.StartScrollLeft();</xsl:attribute>
+              <xsl:attribute name="onmouseout"><xsl:value-of select="$UniqueScrollerID"/>.EndScroll();</xsl:attribute>
+              <xsl:attribute name="onmouseup"><xsl:value-of select="$UniqueScrollerID"/>.EndScroll();</xsl:attribute>
+            </img>
+          </td>
+
+          <td width="100%">
+            <div id="OuterScrollDiv">
+              <xsl:if test="$AttachResize = 'true'">
+                <xsl:attribute name="onresize"><xsl:value-of select="$UniqueScrollerID"/>.OnResize();</xsl:attribute>
+              </xsl:if>
+              <xsl:attribute name="style">
+                position:relative;overflow:hidden;width:100%;height:<xsl:value-of select="$ScrolledRegionHeight"/>px;
+              </xsl:attribute>
+              <div id="ScrollDiv">
+                <xsl:attribute name="style">
+                  position:absolute;width:100%;left:0px;top:<xsl:value-of select="$ScrolledContentTop"/>px;
+                </xsl:attribute>
+                <xsl:copy-of select="$HTMLContent"/>
+              </div>
+            </div>
+          </td>
+
+        </tr>
+      </table>
+    </Iteration:ContentScroller>
+
+  </xsl:template>
+
+
+  <xsl:template name="DataEditor">
+    <DataEditor>
+      <View>
+        <ContentType>UpdatingOrderedList</ContentType>
+        <ContentType>ActionList</ContentType>
+        <Page id="DATA_OBJECTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='DATA_OBJECTS']"/></xsl:attribute>
+          <Event>datasets</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FIELDS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FIELDS']"/></xsl:attribute>
+          <Event>fields</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SORT">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SORT']"/></xsl:attribute>
+          <Event>sort</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FILTER">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FILTER']"/></xsl:attribute>
+          <Event>rowFilter</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TOPN">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TOPN']"/></xsl:attribute>
+          <Event>topN</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_CALCULATION">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_CALCULATION']"/></xsl:attribute>
+          <Event>calculations</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRILLING">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRILLING']"/></xsl:attribute>
+          <Event>drilling</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SURFACE_PROMPTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SURFACE_PROMPTS']"/></xsl:attribute>
+          <Event>surfacePrompts</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>CollapsedList</ContentType>
+        <ContentType>List</ContentType>
+        <ContentType>OWCSpreadsheet</ContentType>
+        <ContentType>ExcelSpreadsheet</ContentType>
+        <Page id="DATA_OBJECTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='DATA_OBJECTS']"/></xsl:attribute>
+          <Event>datasets</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FIELDS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FIELDS']"/></xsl:attribute>
+          <Event>fields</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SORT">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SORT']"/></xsl:attribute>
+          <Event>sort</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FILTER">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FILTER']"/></xsl:attribute>
+          <Event>rowFilter</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_CALCULATION">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_CALCULATION']"/></xsl:attribute>
+          <Event>calculations</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRILLING">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRILLING']"/></xsl:attribute>
+          <Event>drilling</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SURFACE_PROMPTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SURFACE_PROMPTS']"/></xsl:attribute>
+          <Event>surfacePrompts</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>StreamingList</ContentType>
+        <ContentType>UpdatesList</ContentType>
+        <Page id="DATA_OBJECTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='DATA_OBJECTS']"/></xsl:attribute>
+          <Event>datasets</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FIELDS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FIELDS']"/></xsl:attribute>
+          <Event>fields</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FILTER">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FILTER']"/></xsl:attribute>
+          <Event>rowFilter</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_CALCULATION">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_CALCULATION']"/></xsl:attribute>
+          <Event>calculations</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRILLING">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRILLING']"/></xsl:attribute>
+          <Event>drilling</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SURFACE_PROMPTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SURFACE_PROMPTS']"/></xsl:attribute>
+          <Event>surfacePrompts</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>CrossTab</ContentType>
+        <Page id="DATA_OBJECTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='DATA_OBJECTS']"/></xsl:attribute>
+          <Event>datasets</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FIELDS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FIELDS']"/></xsl:attribute>
+          <Event>crosstabFields</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SUMMARY">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SUMMARY']"/></xsl:attribute>
+          <Event>aggregate</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FILTER">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FILTER']"/></xsl:attribute>
+          <Event>rowFilter</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_CALCULATION">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_CALCULATION']"/></xsl:attribute>
+          <Event>calculations</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRILLING">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRILLING']"/></xsl:attribute>
+          <Event>drilling</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SURFACE_PROMPTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SURFACE_PROMPTS']"/></xsl:attribute>
+          <Event>surfacePrompts</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>Matrix</ContentType>
+        <Page id="DATA_OBJECTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='DATA_OBJECTS']"/></xsl:attribute>
+          <Event>datasets</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FIELDS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FIELDS']"/></xsl:attribute>
+          <Event>crosstabFields</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FILTER">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FILTER']"/></xsl:attribute>
+          <Event>rowFilter</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRILLING">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRILLING']"/></xsl:attribute>
+          <Event>drilling</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_CALCULATION">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_CALCULATION']"/></xsl:attribute>
+          <Event>calculations</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SURFACE_PROMPTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SURFACE_PROMPTS']"/></xsl:attribute>
+          <Event>surfacePrompts</Event>
+        </Page>
+     </View>
+     <View>
+        <ContentType>SummaryCrosstab</ContentType>
+        <Page id="DATA_OBJECTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='DATA_OBJECTS']"/></xsl:attribute>
+          <Event>datasets</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FIELDS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FIELDS']"/></xsl:attribute>
+          <Event>crosstabFields</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SUMMARY">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SUMMARY']"/></xsl:attribute>
+          <Event>aggregate</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FILTER">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FILTER']"/></xsl:attribute>
+          <Event>rowFilter</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_CALCULATION">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_CALCULATION']"/></xsl:attribute>
+          <Event>calculations</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRILLING">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRILLING']"/></xsl:attribute>
+          <Event>drilling</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SURFACE_PROMPTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SURFACE_PROMPTS']"/></xsl:attribute>
+          <Event>surfacePrompts</Event>
+        </Page>
+     </View>
+     <View>
+        <ContentType>Columnar</ContentType>
+        <Page id="DATA_OBJECTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='DATA_OBJECTS']"/></xsl:attribute>
+          <Event>datasets</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FIELDS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FIELDS']"/></xsl:attribute>
+          <Event>fields</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_GROUP">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_GROUP']"/></xsl:attribute>
+          <Event>group</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SUMMARY">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SUMMARY']"/></xsl:attribute>
+          <Event>aggregate</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FILTER">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FILTER']"/></xsl:attribute>
+          <Event>rowFilter</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_CALCULATION">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_CALCULATION']"/></xsl:attribute>
+          <Event>calculations</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRILLING">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRILLING']"/></xsl:attribute>
+          <Event>drilling</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>StackedBarChart</ContentType>
+        <ContentType>LineChart</ContentType>
+        <ContentType>AreaChart</ContentType>
+        <ContentType>ComboChart</ContentType>
+        <ContentType>ThreeDStackedBarChart</ContentType>
+        <ContentType>ThreeDLineChart</ContentType>
+        <ContentType>ThreeDAreaChart</ContentType>
+        <ContentType>ThreeDComboChart</ContentType>
+        <Page id="DATA_OBJECTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='DATA_OBJECTS']"/></xsl:attribute>
+          <Event>datasets</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FIELDS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FIELDS']"/></xsl:attribute>
+          <Event>chartFields</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FILTER">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FILTER']"/></xsl:attribute>
+          <Event>rowFilter</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TOPN">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TOPN']"/></xsl:attribute>
+          <Event>topN</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_CALCULATION">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_CALCULATION']"/></xsl:attribute>
+          <Event>calculations</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRILLING">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRILLING']"/></xsl:attribute>
+          <Event>drilling</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SURFACE_PROMPTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SURFACE_PROMPTS']"/></xsl:attribute>
+          <Event>surfacePrompts</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>RChart</ContentType>
+        <ContentType>SChart</ContentType>
+        <ContentType>PChart</ContentType>
+        <Page id="DATA_OBJECTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='DATA_OBJECTS']"/></xsl:attribute>
+          <Event>datasets</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FIELDS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FIELDS']"/></xsl:attribute>
+          <Event>chartFields</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FILTER">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FILTER']"/></xsl:attribute>
+          <Event>rowFilter</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_CALCULATION">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_CALCULATION']"/></xsl:attribute>
+          <Event>calculations</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRILLING">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRILLING']"/></xsl:attribute>
+          <Event>drilling</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SURFACE_PROMPTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SURFACE_PROMPTS']"/></xsl:attribute>
+          <Event>surfacePrompts</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>BarChart</ContentType>
+        <ContentType>ThreeDBarChart</ContentType>
+        <Page id="DATA_OBJECTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='DATA_OBJECTS']"/></xsl:attribute>
+          <Event>datasets</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FIELDS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FIELDS']"/></xsl:attribute>
+          <Event>chartFields</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FILTER">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FILTER']"/></xsl:attribute>
+          <Event>rowFilter</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_TOPN">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_TOPN']"/></xsl:attribute>
+          <Event>topN</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_CALCULATION">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_CALCULATION']"/></xsl:attribute>
+          <Event>calculations</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRILLING">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRILLING']"/></xsl:attribute>
+          <Event>drilling</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SURFACE_PROMPTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SURFACE_PROMPTS']"/></xsl:attribute>
+          <Event>surfacePrompts</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>PieChart</ContentType>
+        <ContentType>ThreeDPieChart</ContentType>
+
+        <Page id="DATA_OBJECTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='DATA_OBJECTS']"/></xsl:attribute>
+          <Event>datasets</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FIELDS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FIELDS']"/></xsl:attribute>
+          <Event>chartFields</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FILTER">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FILTER']"/></xsl:attribute>
+          <Event>rowFilter</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_CALCULATION">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_CALCULATION']"/></xsl:attribute>
+          <Event>calculations</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRILLING">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRILLING']"/></xsl:attribute>
+          <Event>drilling</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SURFACE_PROMPTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SURFACE_PROMPTS']"/></xsl:attribute>
+          <Event>surfacePrompts</Event>
+        </Page>
+      </View>
+      <View>
+        <ContentType>Arrow</ContentType>
+        <ContentType>MarketArrow</ContentType>
+        <ContentType>RangeGauge</ContentType>
+        <ContentType>DialGauge</ContentType>
+        <Page id="DATA_OBJECTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='DATA_OBJECTS']"/></xsl:attribute>
+          <Event>datasets</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FIELDS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FIELDS']"/></xsl:attribute>
+          <Event>kPIFields</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FILTER">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FILTER']"/></xsl:attribute>
+          <Event>rowFilter</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_CALCULATION">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_CALCULATION']"/></xsl:attribute>
+          <Event>calculations</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_DRILLING">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_DRILLING']"/></xsl:attribute>
+          <Event>drilling</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_SURFACE_PROMPTS">
+          <xsl:attribute name="label"><xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_SURFACE_PROMPTS']"/></xsl:attribute>
+          <Event>surfacePrompts</Event>
+        </Page>
+      </View>
+    </DataEditor>
+  </xsl:template>
+
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6935697Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6935697Test.java
new file mode 100644
index 00000000000..646043feaa6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6935697Test.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.FileOutputStream;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6935697
+ * @summary Test XSLT can parse the certain xsl.
+ */
+public class CR6935697Test {
+
+    @Test
+    public final void testTransform() {
+
+        try {
+
+            String inFilename = "CR6935697.xml";
+            String xslFilename = "CR6935697.xsl";
+            String outFilename = "CR6935697.out";
+
+            // Create transformer factory
+            TransformerFactory factory = TransformerFactory.newInstance();
+            // Use the factory to create a template containing the xsl file
+            Templates template = factory.newTemplates(new StreamSource(getClass().getResourceAsStream(xslFilename)));
+            // Use the template to create a transformer
+            Transformer xformer = template.newTransformer();
+            // Prepare the input and output files
+            Source source = new StreamSource(getClass().getResourceAsStream(inFilename));
+            Result result = new StreamResult(new FileOutputStream(outFilename));
+            // Apply the xsl file to the source file and write the result to the
+            // output file
+            xformer.transform(source, result);
+
+        } catch (Exception e) {
+            // unexpected failure
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869.xml
new file mode 100644
index 00000000000..3c702592100
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869.xml
@@ -0,0 +1,21 @@
+<a>
+  <b>
+    <c>
+      <d>
+        <e attr="foo">
+	  E3
+        </e>
+      </d>
+    </c>
+  </b>
+  <b>
+    <c>
+      <d>
+        <e attr="bar">
+	  E3
+        </e>
+      </d>
+    </c>
+  </b>
+</a>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869.xsl
new file mode 100644
index 00000000000..37e9659f03e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869.xsl
@@ -0,0 +1,49 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <!-- Xalan 2.6 contained in the Sun JDK 1.5 u12 and newer has issues with
+       evaluating grouping nodes according the Muenchian Method (by Steve Muench),
+       where nodes are stored in a key data structure for the group key, and later
+       a group start is checked by checking for the first node retrieved for a key.
+       The nodes are compared using a set union, where the size of the set should
+       be 1 when the nodes are identical, and different to 1 when the nodes are
+       different.
+       The issue with Xalan 2.6 as part of the JDK is, that it does not evaluate the
+       expression "count(.|key('props', subexpr)[1])" correctly. It always returns
+       "1". If the argument expression of count() is stored in a variable first,
+       and the variable is used as argument for count(), then everything works fine.
+  -->
+
+
+
+  <xsl:key name="props" match="c" use="d/e"/>
+  <xsl:template match="a">
+
+    Working (by replacing the count() argument with a variable):
+    <xsl:for-each select="b">
+      <xsl:for-each select="c">
+        <xsl:variable name="tNodeSet" select=".|key('props', d/e)[1]"/>
+        <xsl:for-each select="$tNodeSet">
+        Node <xsl:value-of select="d/e/@attr"/>;
+        </xsl:for-each>
+        count = <xsl:value-of select="count($tNodeSet)"/>
+      </xsl:for-each>
+        ---------
+    </xsl:for-each>
+    Not working in the 2nd loop iteration (by using the union expression as count() argument):
+    <xsl:for-each select="b">
+      <xsl:for-each select="c">
+        <!-- We replaced the variable "tNodeSet" by the related union expression.
+             The for-each loop will work correctly, but the count() will
+             always return "1" instead of first "1" and then "2".
+        -->
+
+        <xsl:for-each select=".|key('props', d/e)[1]">
+        Node <xsl:value-of select="d/e/@attr"/>;
+        </xsl:for-each>
+        count = <xsl:value-of select="count(.|key('props', d/e)[1])"/>
+      </xsl:for-each>
+        ---------
+    </xsl:for-each>
+
+  </xsl:template>
+</xsl:stylesheet>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869Test.java
new file mode 100644
index 00000000000..d2e6eba9b41
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6941869Test.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+import java.io.StringWriter;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6941869
+ * @summary Test XSLT evaluate "count(.|key('props', d/e)[1])" correctly.
+ */
+public class CR6941869Test {
+
+    @Test
+    public final void testTransform() {
+        File xml = new File(getClass().getResource("CR6941869.xml").getFile());
+        File xsl = new File(getClass().getResource("CR6941869.xsl").getFile());
+        try {
+            TransformerFactory tFactory = TransformerFactory.newInstance();
+            Transformer transformer = tFactory.newTransformer();
+            StreamSource source = new StreamSource(xsl);
+            transformer = tFactory.newTransformer(source);
+            // the xml result
+            StringWriter xmlResultString = new StringWriter();
+            StreamResult xmlResultStream = new StreamResult(xmlResultString);
+
+            transformer.transform(new StreamSource(xml), xmlResultStream);
+            System.out.println(xmlResultString.toString());
+            String temp = xmlResultString.toString();
+            int pos = temp.lastIndexOf("count");
+            if (temp.substring(pos + 8, pos + 9).equals("1")) {
+                Assert.fail("count=1");
+            } else if (temp.substring(pos + 8, pos + 9).equals("2")) {
+                // expected success
+                System.out.println("count=2");
+            }
+        } catch (Exception e) {
+            // unexpected failure
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215.xml
new file mode 100644
index 00000000000..d59b2a4d45f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<aaa name="aaa-name" package="aaa-package">
+  <bbb name="bbb-name" />
+</aaa>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215.xsl
new file mode 100644
index 00000000000..33a7cd47235
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215.xsl
@@ -0,0 +1,19 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <xsl:output method="xml" indent="yes" />
+  <xsl:template match="aaa">
+    <xsl:copy>
+      <xsl:copy-of select="@*" />
+      <xsl:element name="aaa-ref">
+        <xsl:attribute name="name">namevalue</xsl:attribute>
+        <xsl:attribute name="package">packagevalue</xsl:attribute>
+      </xsl:element>
+    </xsl:copy>
+  </xsl:template>
+  <xsl:variable name="this">
+    <xsl:apply-templates select="aaa" />
+  </xsl:variable>
+  <xsl:template match="/">
+    <xsl:copy-of select="$this" />
+  </xsl:template>
+</xsl:stylesheet>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215Test.java
new file mode 100644
index 00000000000..2a8460a10a7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR6957215Test.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.StringWriter;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6957215
+ * @summary Test XSLT generates the element content using xsl:attribute instructions.
+ */
+public class CR6957215Test {
+
+    @Test
+    public final void testTransform() {
+        xsl(getClass().getResource("CR6957215.xml").getFile(), getClass().getResource("CR6957215.xsl").getFile());
+    }
+
+    public static void xsl(String inFilename, String xslFilename) {
+        try {
+            // Create transformer factory
+            TransformerFactory factory = TransformerFactory.newInstance();
+
+            // Use the factory to create a template containing the xsl file
+            Templates template = factory.newTemplates(new StreamSource(new FileInputStream(xslFilename)));
+
+            // Use the template to create a transformer
+            Transformer xformer = template.newTransformer();
+
+            // Prepare the input and output files
+            Source source = new StreamSource(new FileInputStream(inFilename));
+
+            StringWriter strResult = new StringWriter();
+            Result result = new StreamResult(strResult);
+
+            // Apply the xsl file to the source file and write the result to the
+            // output file
+            xformer.transform(source, result);
+            String resultString = strResult.toString();
+            System.out.println(resultString);
+            if (resultString.indexOf("aaa-ref/") > 0)
+                Assert.fail("missing attributes");
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (TransformerConfigurationException e) {
+            // An error occurred in the XSL file
+            e.printStackTrace();
+        } catch (TransformerException e) {
+            e.printStackTrace();
+            // An error occurred while applying the XSL file
+            // Get location of error in input file
+            SourceLocator locator = e.getLocator();
+            int col = locator.getColumnNumber();
+            int line = locator.getLineNumber();
+            String publicId = locator.getPublicId();
+            String systemId = locator.getSystemId();
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746.xml
new file mode 100644
index 00000000000..a48aae54a35
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<?xml-stylesheet type="text/xsl" href="../resources/style/page.xsl"?>
+
+<my:doc xmlns:my="http://www.jenitennison.com/" xmlns="http://www.w3.org/1999/xhtml">
+
+   <p>
+	These pages are all about XSLT, an XML-based language for translating one set of XML into another set of XML, or into HTML.  Of course, there are all sorts of <my:link href="#links">other pages</my:link>	around that cover XSLT.  Jeni's XSLT Pages, though, are dedicated to helping people understand and make the most of using XSLT.
+</p>
+   <p>
+	My warmest thanks to all those people who post interesting problems on <my:link href="http://www.mulberytech.com/xsl/xsl-list/">XSL-List</my:link>, and 	especially to those of you that have encouraged me to set up this site through your kind emails.
+</p>
+
+</my:doc>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746.xsl
new file mode 100644
index 00000000000..cd9e0698a33
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746.xsl
@@ -0,0 +1,618 @@
+<?xml version="1.0" encoding='UTF-8'?>
+
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                version="1.0"
+                xmlns:my="http://www.jenitennison.com/"
+                xmlns="http://www.w3.org/1999/xhtml"
+                xmlns:html="http://www.w3.org/1999/xhtml"
+                xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+                xmlns:dc="http://purl.org/dc/elements/1.1/"
+                xmlns:dcq="http://purl.org/dc/qualifiers/1.0/"
+                xmlns:vcf="http://www.ietf.org/internet-drafts/draft-dawson-vcard-xml-dtd-03.txt"
+                xmlns:msxsl="urn:schemas-microsoft-com:xslt"
+                exclude-result-prefixes="rdf dc dcq my html vcf msxsl">
+
+<xsl:output doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+            cdata-section-elements="script"
+            indent="no"
+            method="xml"
+            encoding='UTF-8'/>
+
+<xsl:param name="dynamic" select="'true'" />
+<xsl:param name="base" select="'/'" />
+
+<xsl:variable name="supports-document" select="function-available('document')" />
+<xsl:variable name="supports-keys" select="function-available('key')" />
+
+<xsl:variable name="default-title" select='"Jeni&apos;s XML Site"' />
+
+<xsl:template match="my:doc">
+  <xsl:variable name="metadata" select="/*/rdf:RDF" />
+  <xsl:variable name="uri" select="$metadata/rdf:Description[1]/@about" />
+	<html>
+		<head>
+			<title>
+				<xsl:call-template name="get-metadata">
+					<xsl:with-param name="what" select="'title'" />
+				  <xsl:with-param name="about" select="$uri" />
+				</xsl:call-template>
+			</title>
+			<xsl:call-template name="get-metadata">
+				<xsl:with-param name="what" select="'link'" />
+				<xsl:with-param name="about" select="$uri" />
+			</xsl:call-template>
+			<link rel="alternate" type="text/xml" href="{$uri}" />
+			<xsl:call-template name="get-metadata">
+			  <xsl:with-param name="what" select="'rights'" />
+			  <xsl:with-param name="about" select="$uri" />
+			</xsl:call-template>
+		</head>
+		<body>
+			<xsl:if test="$dynamic = 'false'">
+				<p id="xml-link">
+					Try the <a href="{$uri}">XML version</a> of this page.
+					If you have problems with it, consult the
+					<a href="/compatibility.html">compatibility page</a>.
+				</p>
+			</xsl:if>
+			<xsl:apply-templates />
+			<xsl:apply-templates select="." mode="colophon" />
+		</body>
+	</html>
+</xsl:template>
+
+<xsl:template match="html:h1">
+  <h1>
+    <xsl:apply-templates />
+    <xsl:call-template name="insert-navigation" />
+  </h1>
+</xsl:template>
+
+<xsl:template name="insert-navigation">
+  <xsl:variable name="metadata" select="/*/rdf:RDF" />
+  <xsl:variable name="uri" select="$metadata/rdf:Description[1]/@about" />
+	<xsl:if test="$uri != concat($base, 'index.xml')">
+	<span id="link-top">
+		<a class="img">
+		  <xsl:attribute name="href">
+			  <xsl:choose>
+			    <xsl:when test="$dynamic = 'true'">/index.xml</xsl:when>
+
+			    <xsl:otherwise>/index.html</xsl:otherwise>
+			  </xsl:choose>
+		  </xsl:attribute>
+			<img src="{$base}resources/icons/top.gif" width="29" height="29" />
+		</a>
+	</span>
+  <span id="link-up">
+		<a class="img">
+			<xsl:attribute name="href">
+				<xsl:choose>
+					<xsl:when test="contains($uri, 'index.xml')">
+					  <xsl:choose>
+					    <xsl:when test="$dynamic = 'true'">../index.xml</xsl:when>
+					    <xsl:otherwise>../index.html</xsl:otherwise>
+					  </xsl:choose>						  
+					</xsl:when>
+					<xsl:otherwise>
+					  <xsl:choose>
+					    <xsl:when test="$dynamic = 'true'">index.xml</xsl:when>
+					    <xsl:otherwise>index.html</xsl:otherwise>
+					  </xsl:choose>
+					</xsl:otherwise>
+				</xsl:choose>
+			</xsl:attribute>
+			<img src="{$base}resources/icons/up.gif" width="29" height="29" />
+		</a>
+  </span>
+</xsl:if>
+</xsl:template>
+
+
+<xsl:template match="rdf:RDF" />
+
+<xsl:template name="get-metadata">
+	<xsl:param name="what" />
+	<xsl:param name="about" select="/*/rdf:RDF/rdf:Description/@about" />
+  <xsl:variable name="metadata" select="/*/rdf:RDF" />
+	<xsl:variable name="type">
+		<xsl:choose>
+			<xsl:when test="contains($what, '::')">
+				<xsl:value-of select="substring-before($what, '::')" />
+			</xsl:when>
+			<xsl:otherwise><xsl:value-of select="$what" /></xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:variable name="mode">
+		<xsl:choose>
+			<xsl:when test="contains($what, '::')">
+				<xsl:value-of select="substring-after($what, '::')" />
+			</xsl:when>
+			<xsl:otherwise />
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:apply-templates select="$metadata/rdf:Description[@about = $about or
+	                                                       (@aboutEachPrefix != '' and starts-with($about, @aboutEachPrefix))]/*[local-name() = $type]">
+		<xsl:with-param name="mode" select="$mode" />
+	</xsl:apply-templates>
+</xsl:template>
+
+<xsl:template match="rdf:Description/*">
+	<xsl:param name="mode" />
+	<xsl:choose>
+		<xsl:when test="@rdf:resource != ''">
+			<xsl:call-template name="get-metadata">
+				<xsl:with-param name="about" select="@rdf:resource" />
+				<xsl:with-param name="what" select="$mode" />
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:when test="$mode = '' and @rdf:value != ''">
+			<xsl:value-of select="@rdf:value" />
+		</xsl:when>
+		<xsl:when test="$mode = '' and *">
+			<xsl:apply-templates />
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:apply-templates select="." mode="get-metadata">
+				<xsl:with-param name="mode" select="$mode" />
+			</xsl:apply-templates>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="html:link" mode="get-metadata">
+	<link>
+		<xsl:copy-of select="@*" />
+	</link>
+</xsl:template>
+
+<xsl:template match="dc:rights" mode="get-metadata">
+  <xsl:comment>
+    <xsl:value-of select="." />
+  </xsl:comment>
+</xsl:template>
+
+<xsl:template match="dc:date" mode="get-metadata">
+	<xsl:param name="mode" select="''" />
+	<xsl:if test="$mode = @dcq:dateType">
+		<xsl:value-of select="@rdf:value" />
+	</xsl:if>
+</xsl:template>
+
+<xsl:template match="vcf:vCard" mode="get-metadata">
+	<xsl:param name="mode" select="''" />
+	<xsl:choose>
+		<xsl:when test="$mode = 'mailto-link'">
+			<xsl:call-template name="link">
+				<xsl:with-param name="link">
+					<xsl:choose>
+						<xsl:when test="vcf:email[contains(@email.type, 'PREF')]">
+							<xsl:value-of select="vcf:email[contains(@email.type, 'PREF')]" />
+						</xsl:when>
+						<xsl:otherwise><xsl:value-of select="vcf:email[1]" /></xsl:otherwise>
+					</xsl:choose>
+				</xsl:with-param>
+				<xsl:with-param name="value">
+					<xsl:apply-templates select="vcf:n" mode="full" />
+				</xsl:with-param>
+			</xsl:call-template>
+		</xsl:when>
+		<xsl:when test="$mode = 'name'">
+			<xsl:apply-templates select="vcf:n" mode="full" />
+		</xsl:when>
+		<xsl:otherwise />
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="vcf:n" mode="full">
+	<xsl:if test="vcf:prefix">
+		<xsl:value-of select="vcf:prefix" /><xsl:text> </xsl:text>
+	</xsl:if>
+	<xsl:choose>
+		<xsl:when test="../vcf:nickname">
+			<xsl:value-of select="../vcf:nickname" />
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:value-of select="vcf:given" />
+		</xsl:otherwise>
+	</xsl:choose>
+	<xsl:text> </xsl:text>
+	<xsl:value-of select="vcf:family" />
+</xsl:template>
+
+<xsl:template match="html:*">
+	<xsl:element name="{local-name()}">
+		<xsl:copy-of select="@*" />
+		<xsl:apply-templates />
+	</xsl:element>
+</xsl:template>
+
+<xsl:template match="my:vars">
+  <dl>
+    <xsl:apply-templates />
+  </dl>
+</xsl:template>
+
+<xsl:template match="my:var">
+  <dt id="{translate(my:name, ' ', '-')}">
+    <xsl:text/>$<xsl:value-of select="my:name" />
+    <xsl:choose>
+      <xsl:when test="my:value">
+        <xsl:text/> = <xsl:apply-templates select="my:value" />
+      </xsl:when>
+      <xsl:when test="my:default">
+        <xsl:text/> [= <xsl:apply-templates select="my:default" />]<xsl:text/>
+      </xsl:when>
+    </xsl:choose>
+  </dt>
+  <dd>
+    <xsl:if test="my:desc"><xsl:apply-templates select="my:desc" /></xsl:if>
+    <xsl:if test="my:option">
+      <ul>
+        <xsl:apply-templates select="my:option" />
+      </ul>
+    </xsl:if>
+    <xsl:apply-templates select="my:defn" />
+  </dd>
+</xsl:template>
+
+<xsl:template match="my:option">
+  <li><xsl:apply-templates select="my:value" />: <xsl:apply-templates select="my:desc" /></li>
+</xsl:template>
+
+<xsl:template match="my:value | my:default">
+  <xsl:choose>
+    <xsl:when test="@type">
+      <span class="{@type}">
+        <xsl:choose>
+          <xsl:when test="@type = 'string'">'<xsl:value-of select="." />'</xsl:when>
+          <xsl:when test="@type = 'rtf'">"<xsl:value-of select="." />"</xsl:when>
+          <xsl:otherwise><xsl:value-of select="." /></xsl:otherwise>
+        </xsl:choose>
+      </span>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:value-of select="." />
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="my:post">
+	<div class="post">
+		<xsl:apply-templates />
+	</div>
+</xsl:template>
+
+<xsl:template match="my:response">
+	<div class="response">
+		<xsl:apply-templates />
+	</div>
+</xsl:template>
+
+<xsl:template match="my:question">
+	<div class="question">
+		<p>
+			<xsl:call-template name="insert-icon">
+				<xsl:with-param name="icon" select="'question'" />
+				<xsl:with-param name="active" select="false()" />
+			</xsl:call-template>
+			<xsl:text> </xsl:text>
+			<xsl:apply-templates select="*[1]/node()" />
+		</p>
+		<xsl:apply-templates select="*[position() > 1]"/>
+	</div>
+</xsl:template>
+
+<xsl:template match="my:example | my:defn">
+	<pre>
+		<xsl:apply-templates />
+	</pre>
+</xsl:template>
+
+<xsl:template match="my:example[parent::my:aside and ancestor::my:example]">
+  <xsl:choose>
+    <xsl:when test="$dynamic = 'true'">
+      <pre>
+        <xsl:apply-templates />
+      </pre>
+    </xsl:when>
+    <xsl:otherwise>
+      <span class="example">
+        <xsl:apply-templates />
+      </span>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="my:example[parent::my:aside and not(ancestor::my:example)]">
+  <xsl:call-template name="split-and-code">
+    <xsl:with-param name="text" select="string(.)" />
+  </xsl:call-template>
+</xsl:template>
+
+<xsl:template name="split-and-code">
+  <xsl:param name="text" />
+  <br />
+  <xsl:choose>
+    <xsl:when test="contains($text, '&#x0A;')">
+      <code><xsl:value-of select="substring-before($text, '&#x0A;')" /></code>
+      <xsl:call-template name="split-and-code">
+        <xsl:with-param name="text" select="substring-after($text, '&#x0A;')" />
+      </xsl:call-template>
+    </xsl:when>
+    <xsl:otherwise>
+      <code><xsl:value-of select="$text" /></code>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="my:aside">
+  <xsl:choose>
+    <xsl:when test="$dynamic = 'true'">
+    	<span class="note"
+    	><img src="{$base}resources/icons/note.gif" height="17" width="13" border="0"
+    		    style="z-index: 2;"
+    		    onmouseover="javascript:{generate-id()}.style.visibility='visible';"
+    	      onmouseout="javascript:{generate-id()}.style.visibility='hidden';"
+    	/><span class="popup" id="{generate-id()}"
+    		      onmouseover="javascript:{generate-id()}.style.visibility='visible';"
+    	        onmouseout="javascript:{generate-id()}.style.visibility='hidden';">
+    			<xsl:apply-templates />
+    		</span
+    	></span>
+    </xsl:when>
+    <xsl:otherwise>
+      <xsl:text> </xsl:text>
+      <span class="note">[<xsl:apply-templates />]</span>
+      <xsl:text> </xsl:text>
+    </xsl:otherwise>
+  </xsl:choose>
+</xsl:template>
+
+<xsl:template match="my:quote">
+  <blockquote uri="{@href}">
+    <xsl:apply-templates />
+  </blockquote>
+  <p class="byline">
+    <xsl:text>[From </xsl:text>
+    <xsl:call-template name="link">
+      <xsl:with-param name="link" select="@href" />
+      <xsl:with-param name="value">
+        <xsl:value-of select="@href" />
+      </xsl:with-param>
+    </xsl:call-template>
+    <xsl:text>]</xsl:text>
+  </p>
+</xsl:template>
+
+<xsl:template match="my:icon">
+	<xsl:call-template name="insert-icon">
+		<xsl:with-param name="icon" select="@name" />
+	</xsl:call-template>
+</xsl:template>
+
+<xsl:template name="insert-icon">
+	<xsl:param name="icon" select="'goto'" />
+	<xsl:param name="active" select="true()" />
+	<img src="{$base}resources/icons/{$icon}.gif" height="28" width="28" border="0">
+		<xsl:attribute name="src">
+			<xsl:value-of select="$base" />
+			<xsl:text>resources/icons/</xsl:text>
+			<xsl:if test="not($active)">click-</xsl:if>
+			<xsl:value-of select="$icon" />
+			<xsl:text>.gif</xsl:text>
+		</xsl:attribute>
+		<xsl:if test="$active">
+			<xsl:attribute name="onmouseover">javascript:this.src='<xsl:value-of select="$base" />resources/icons/over-<xsl:value-of select="$icon" />.gif'</xsl:attribute>
+			<xsl:attribute name="onclick">javascript:this.src='<xsl:value-of select="$base" />resources/icons/click-<xsl:value-of select="$icon" />.gif'</xsl:attribute>
+			<xsl:attribute name="onmouseout">javascript:this.src='<xsl:value-of select="$base" />resources/icons/<xsl:value-of select="$icon" />.gif'</xsl:attribute>
+		</xsl:if>
+	</img>
+</xsl:template>
+
+<xsl:template match="my:links">
+	<xsl:choose>
+		<xsl:when test="parent::html:dd">
+			<xsl:apply-templates select="my:link" mode="list" />			
+		</xsl:when>
+		<xsl:otherwise>
+			<xsl:call-template name="columnise">
+				<xsl:with-param name="max-height" select="3" />
+			</xsl:call-template>
+		</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="columnise">
+	<xsl:param name="max-height" select="5" />
+	<xsl:param name="max-width" select="3" />
+	<xsl:variable name="no-items" select="count(*)" />
+	<xsl:variable name="width">
+		<xsl:choose>
+			<xsl:when test="$no-items > $max-height * $max-width">
+				<xsl:value-of select="$max-width" />
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:value-of select="ceiling($no-items div $max-height)" />
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:variable name="height" select="ceiling($no-items div $width)" />
+	<table>
+		<colgroup span="{$width}" />
+		<tr>
+			<xsl:for-each select="*[position() = 1 or position() mod $height = 1]">
+				<td>
+					<xsl:apply-templates select=". | following-sibling::*[position() &lt; $height]" mode="list" />
+				</td>
+			</xsl:for-each>
+		</tr>
+	</table>
+</xsl:template>
+
+<xsl:template match="my:link" mode="list">
+	<p class="link">
+		<xsl:call-template name="link">
+			<xsl:with-param name="link" select="@href" />
+			<xsl:with-param name="value">
+				<xsl:value-of select="." />
+			</xsl:with-param>
+			<xsl:with-param name="addicon" select="true()" />
+		</xsl:call-template>
+	</p>
+</xsl:template>
+
+<xsl:template match="my:link">
+	<xsl:apply-templates select="." mode="link" />
+</xsl:template>
+
+<xsl:template match="*[@href][. != '']" mode="link">
+	<xsl:call-template name="link">
+		<xsl:with-param name="link" select="@href" />
+		<xsl:with-param name="value">
+			<xsl:apply-templates />
+		</xsl:with-param>
+		<xsl:with-param name="addicon" select="@addicon" />
+	</xsl:call-template>
+</xsl:template>
+
+<xsl:template match="*[@href][. = '']" mode="link">
+	<xsl:call-template name="link">
+		<xsl:with-param name="link" select="@href" />
+		<xsl:with-param name="value">
+			<xsl:value-of select="@href" />
+		</xsl:with-param>
+		<xsl:with-param name="addicon" select="@addicon" />
+	</xsl:call-template>
+</xsl:template>
+
+<xsl:template match="text()|@*" mode="link">
+	<xsl:call-template name="link">
+		<xsl:with-param name="link" select="." />
+		<xsl:with-param name="value">
+			<xsl:value-of select="." />
+		</xsl:with-param>
+	</xsl:call-template>
+</xsl:template>
+
+<xsl:template name="link">
+	<xsl:param name="link" />
+	<xsl:param name="value" />
+	<xsl:param name="addicon" select="''" />
+	<xsl:variable name="uri">
+		<xsl:call-template name="full-uri">
+			<xsl:with-param name="uri" select="$link" />
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:variable name="class">
+		<xsl:call-template name="uri-class">
+			<xsl:with-param name="uri" select="$uri" />
+		</xsl:call-template>
+	</xsl:variable>
+	<xsl:if test="$addicon">
+		<a href="{$uri}">
+			<xsl:attribute name="class">
+				<xsl:text>img </xsl:text>
+				<xsl:value-of select="$class" />
+			</xsl:attribute>
+			<xsl:call-template name="insert-icon">
+				<xsl:with-param name="icon">
+					<xsl:call-template name="icon-type">
+						<xsl:with-param name="uri" select="$uri" />
+					</xsl:call-template>
+				</xsl:with-param>
+			</xsl:call-template>
+		</a>
+		<xsl:text> </xsl:text>
+	</xsl:if>
+	<a href="{$uri}">
+		<xsl:if test="$class != ''">
+			<xsl:attribute name="class">
+				<xsl:value-of select="$class" />
+			</xsl:attribute>
+		</xsl:if>
+		<xsl:copy-of select="$value" />
+	</a>
+</xsl:template>
+
+<xsl:template name="full-uri">
+	<xsl:param name="uri" />
+	<xsl:variable name="partial-uri">
+		<xsl:choose>
+			<xsl:when test="$dynamic='false' and
+			                substring($uri, string-length($uri) - 3, 4) = '.xml'">
+				<xsl:value-of select="concat(substring($uri, 1, string-length($uri) - 4), '.html')" />
+			</xsl:when>
+			<xsl:otherwise><xsl:value-of select="$uri" /></xsl:otherwise>
+		</xsl:choose>
+	</xsl:variable>
+	<xsl:choose>
+		<xsl:when test="starts-with($partial-uri, 'www')">
+			<xsl:text>http://</xsl:text><xsl:value-of select="$partial-uri" />
+		</xsl:when>
+		<xsl:when test="contains($partial-uri, '@') and not(starts-with($partial-uri, 'mailto:'))">
+			<xsl:text>mailto:</xsl:text><xsl:value-of select="$partial-uri" />
+		</xsl:when>
+		<xsl:otherwise><xsl:value-of select="$partial-uri" /></xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="uri-class">
+	<xsl:param name="uri" />
+	<xsl:choose>
+		<xsl:when test="starts-with($uri, 'http://') and not(starts-with($uri, $base))">offsite</xsl:when>
+		<xsl:when test="starts-with($uri, 'mailto:')">mailto</xsl:when>
+		<xsl:when test="starts-with($uri, '#')">local</xsl:when>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template name="icon-type">
+	<xsl:param name="uri" />
+	<xsl:variable name="url">
+	  <xsl:choose>
+	    <xsl:when test="starts-with($uri, 'http://')"><xsl:value-of select="substring-after($uri, 'http://')" /></xsl:when>
+	    <xsl:otherwise><xsl:value-of select="$uri" /></xsl:otherwise>
+	  </xsl:choose>
+	</xsl:variable>
+	<xsl:choose>
+		<xsl:when test="(not(contains($url, '/')) and starts-with($url, 'www.')) or (contains($url, '/') and not(substring-after($url, '/')))">home</xsl:when>
+		<xsl:when test="contains($url, '@')">mail</xsl:when>
+		<xsl:otherwise>goto</xsl:otherwise>
+	</xsl:choose>
+</xsl:template>
+
+<xsl:template match="/*" mode="colophon">
+  <xsl:variable name="metadata" select="/*/rdf:RDF" />
+  <xsl:variable name="uri" select="$metadata/rdf:Description[1]/@about" />
+	<div id="colophon">
+		<hr class="final" />
+		<p>
+			<xsl:apply-templates select="$uri" mode="link" />
+			<xsl:variable name="modified">
+				<xsl:call-template name="get-metadata">
+					<xsl:with-param name="what" select="'date::modified'" />
+				</xsl:call-template>
+			</xsl:variable>
+			<xsl:if test="string($modified)">
+				<xsl:text> last modified </xsl:text>
+				<xsl:copy-of select="$modified" />
+			</xsl:if>
+			<xsl:variable name="creator">
+				<xsl:call-template name="get-metadata">
+					<xsl:with-param name="what" select="'creator::vCard::mailto-link'" />
+				</xsl:call-template>
+			</xsl:variable>
+			<xsl:text> by </xsl:text>
+			<xsl:choose>
+  			<xsl:when test="string($creator)">
+  				<xsl:copy-of select="$creator" />
+  			</xsl:when>
+  			<xsl:otherwise>
+  			  <a href="mailto:mail@jenitennison.com" class="mailto">Jeni Tennison</a>
+  			</xsl:otherwise>
+  		</xsl:choose>		  
+		</p>
+	</div>
+</xsl:template>
+
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746Test.java
new file mode 100644
index 00000000000..5b3e71c18a2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/CR7098746Test.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringWriter;
+
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 7098746
+ * @summary Test transforming as expected.
+ */
+public class CR7098746Test {
+
+    @Test
+    public final void testTransform() {
+
+        try {
+
+            String inFilename = "CR7098746.xml";
+            String xslFilename = "CR7098746.xsl";
+
+            StringWriter sw = new StringWriter();
+            // Create transformer factory
+            TransformerFactory factory = TransformerFactory.newInstance();
+            // set the translet name
+            // factory.setAttribute("translet-name", "myTranslet");
+
+            // set the destination directory
+            // factory.setAttribute("destination-directory", "c:\\temp");
+            // factory.setAttribute("generate-translet", Boolean.TRUE);
+
+            // Use the factory to create a template containing the xsl file
+            Templates template = factory.newTemplates(new StreamSource(getClass().getResourceAsStream(xslFilename)));
+            // Use the template to create a transformer
+            Transformer xformer = template.newTransformer();
+            // Prepare the input and output files
+            Source source = new StreamSource(getClass().getResourceAsStream(inFilename));
+            // Result result = new StreamResult(new
+            // FileOutputStream(outFilename));
+            Result result = new StreamResult(sw);
+            // Apply the xsl file to the source file and write the result to the
+            // output file
+            xformer.transform(source, result);
+
+            String out = sw.toString();
+            if (out.indexOf("<p>") < 0) {
+                Assert.fail(out);
+            }
+        } catch (Exception e) {
+            // unexpected failure
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/DOMResultTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/DOMResultTest.java
new file mode 100644
index 00000000000..b08d532bd09
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/DOMResultTest.java
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test DOMResult.
+ */
+public class DOMResultTest {
+
+    @Test
+    public void testDOMResult1() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            String xml = this.getClass().getResource("toys.xml").getFile();
+            Document doc = db.parse(new FileInputStream(new File(xml)));
+            TransformerFactory tff = TransformerFactory.newInstance();
+            Transformer tf = tff.newTransformer();
+            // get <toys> element node
+            Node toys = doc.getChildNodes().item(1);
+            // supposed to insert new node at index=4
+            int index = 4;
+            String systemId = "customSysId";
+            DOMResult result = new DOMResult(toys, systemId);
+            result.setNextSibling(result.getNode().getChildNodes().item(index));
+            int length = result.getNode().getChildNodes().getLength();
+            // copy the first <toy> element node and insert it to position
+            // marked by index
+            Node source = doc.getLastChild().getChildNodes().item(1);
+            tf.transform(new DOMSource(source), result);
+
+            // document length verification
+            if (result.getNode().getChildNodes().getLength() != length + 1) {
+                Assert.fail("incorrect nodes length");
+            }
+            // element content verification
+            Node newnode = result.getNode().getChildNodes().item(index);
+            System.out.println(newnode.getTextContent());
+            if (!source.getTextContent().equals(newnode.getTextContent())) {
+                Assert.fail("target node content is not matched with source");
+            }
+            // element systemid verification
+            if (!result.getSystemId().equals(systemId)) {
+                Assert.fail("systemId is not matched");
+            }
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (SAXException e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        } catch (IOException e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        } catch (TransformerConfigurationException e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        } catch (TransformerException e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testDOMResult2() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            String xml = this.getClass().getResource("toys.xml").getFile();
+            Document doc = db.parse(new FileInputStream(new File(xml)));
+            TransformerFactory tff = TransformerFactory.newInstance();
+            Transformer tf = tff.newTransformer();
+            // get <toys> element node
+            Node toys = doc.getChildNodes().item(1);
+            // supposed to insert new node at index=4
+            int index = 4;
+            String systemId = "customSysId";
+            DOMResult result = new DOMResult(toys, toys.getChildNodes().item(index), systemId);
+            int length = result.getNode().getChildNodes().getLength();
+            // copy the first <toy> element node and insert it to position
+            // marked by index
+            Node source = doc.getLastChild().getChildNodes().item(1);
+            tf.transform(new DOMSource(source), result);
+
+            // document length verification
+            if (result.getNode().getChildNodes().getLength() != length + 1) {
+                Assert.fail("incorrect nodes length");
+            }
+            // element content verification
+            Node newnode = result.getNode().getChildNodes().item(index);
+            System.out.println(newnode.getTextContent());
+            if (!source.getTextContent().equals(newnode.getTextContent())) {
+                Assert.fail("target node content is not matched with source");
+            }
+            // element systemid verification
+            if (!result.getSystemId().equals(systemId)) {
+                Assert.fail("systemId is not matched");
+            }
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (SAXException e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        } catch (IOException e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        } catch (TransformerConfigurationException e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        } catch (TransformerException e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testDOMResult3() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            String xml = this.getClass().getResource("toys.xml").getFile();
+            Document doc = db.parse(new FileInputStream(new File(xml)));
+            TransformerFactory tff = TransformerFactory.newInstance();
+            Transformer tf = tff.newTransformer();
+            // get <toys> element node
+            Node toys = doc.getChildNodes().item(1);
+            // supposed to insert new node at index=4
+            int index = 4;
+            DOMResult result = new DOMResult(toys, toys.getChildNodes().item(index));
+            int length = result.getNode().getChildNodes().getLength();
+            // copy the first <toy> element node and insert it to position
+            // marked by index
+            Node source = doc.getLastChild().getChildNodes().item(1);
+            tf.transform(new DOMSource(source), result);
+
+            // document length verification
+            if (result.getNode().getChildNodes().getLength() != length + 1) {
+                Assert.fail("incorrect nodes length");
+            }
+            // element content verification
+            Node newnode = result.getNode().getChildNodes().item(index);
+            System.out.println(newnode.getTextContent());
+            if (!source.getTextContent().equals(newnode.getTextContent())) {
+                Assert.fail("target node content is not matched with source");
+            }
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+        } catch (FileNotFoundException e) {
+            e.printStackTrace();
+        } catch (SAXException e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        } catch (IOException e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        } catch (TransformerConfigurationException e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        } catch (TransformerException e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/FactoryFindTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/FactoryFindTest.java
new file mode 100644
index 00000000000..370f0fff2ac
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/FactoryFindTest.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.net.URL;
+import java.net.URLClassLoader;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test creating TransformerFactory with ContextClassLoader.
+ */
+public class FactoryFindTest {
+
+    boolean myClassLoaderUsed = false;
+
+    @Test
+    public void testFactoryFind() {
+        try {
+            // System.setProperty("jaxp.debug", "true");
+
+            TransformerFactory factory = TransformerFactory.newInstance();
+            Assert.assertTrue(factory.getClass().getClassLoader() == null);
+
+            Thread.currentThread().setContextClassLoader(null);
+            factory = TransformerFactory.newInstance();
+            Assert.assertTrue(factory.getClass().getClassLoader() == null);
+
+            Thread.currentThread().setContextClassLoader(new MyClassLoader());
+            factory = TransformerFactory.newInstance();
+            if (System.getSecurityManager() == null)
+                Assert.assertTrue(myClassLoaderUsed);
+            else
+                Assert.assertFalse(myClassLoaderUsed);
+        } catch (Exception ex) {
+            Assert.fail(ex.toString());
+        }
+
+    }
+
+    class MyClassLoader extends URLClassLoader {
+
+        public MyClassLoader() {
+            super(new URL[0]);
+        }
+
+        public Class loadClass(String name) throws ClassNotFoundException {
+            myClassLoaderUsed = true;
+            return super.loadClass(name);
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204.xml
new file mode 100644
index 00000000000..240730ae3fc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" ?><A><B>1</B><B>2</B></A>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204.xsl
new file mode 100644
index 00000000000..f2a05292905
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204.xsl
@@ -0,0 +1,10 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+<xsl:variable name="XML" select="/A"/>
+    <xsl:template match="/">
+        First:<xsl:value-of select="count($XML[B=1])"/>
+        Second:<xsl:value-of select="count($XML[B=1])"/>
+        Third:<xsl:value-of select="count($XML[B=1])"/>
+    </xsl:template>
+</xsl:stylesheet>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204Test.java
new file mode 100644
index 00000000000..35bcab3dc23
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2204Test.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringWriter;
+
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6905829
+ * @summary Test XSLT can work against the certain xsl.
+ */
+public class Issue2204Test {
+
+    @Test
+    public final void testTransform() {
+        try {
+            Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(getClass().getResourceAsStream("Issue2204.xsl")));
+
+            System.out.printf("transformer: %s%n", t.getClass().getName());
+
+            StringWriter streamResult = new StringWriter();
+            t.transform(new StreamSource(getClass().getResourceAsStream("Issue2204.xml")), new StreamResult(streamResult));
+
+            System.out.println(streamResult.toString());
+            if (streamResult.toString().indexOf("3") > 0) {
+                Assert.fail("Function Count on variable modifies number of nodes in variable.");
+            }
+            // expected success
+        } catch (Exception e) {
+            // unexpected failure
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2290.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2290.xsl
new file mode 100644
index 00000000000..701eb05ab99
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2290.xsl
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" exclude-result-prefixes="xps" extension-element-prefixes="xps" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xps="xalan://com.xx.TestExt" xmlns:lxslt="http://xml.apache.org/xslt">
+    <xsl:template match="/">
+        <xsl:variable name="lang">
+        <xps:getAttribute pathDoc="test" attName="keymask"/>
+        </xsl:variable>
+    </xsl:template>
+</xsl:stylesheet>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2290Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2290Test.java
new file mode 100644
index 00000000000..1c63d974bb0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/Issue2290Test.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+import java.util.Properties;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.OutputKeys;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.DocumentFragment;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test XSL extension for RTF works, for https://issues.apache.org/jira/i#browse/XALANJ-2290.
+ */
+public class Issue2290Test {
+
+    @Test
+    public final void testTransform() throws Exception {
+        DocumentFragment outNode = null;
+        DocumentBuilder docBuilder = null;
+        Document outDoc = null;
+        // TransformerImpl transformer = null;
+        StringReader execReaderXML = null;
+        Properties propFormat = null;
+        StringWriter sw = null;
+
+        try {
+            // template = TransformerFactory.newInstance().newTemplates(new
+            // StreamSource("D:/Work/Apache/TestVar.xsl"));
+            // transformer = (TransformerImpl) template.newTransformer();
+            Transformer t = TransformerFactory.newInstance().newTransformer(new StreamSource(getClass().getResourceAsStream("Issue2290.xsl")));
+            System.out.print("Created Transformer");
+            execReaderXML = new StringReader("<?xml version=\"1.0\"?> <doc>Stuff</doc>");
+
+
+            docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+            outDoc = docBuilder.newDocument();
+            outNode = outDoc.createDocumentFragment();
+            System.out.println("Created Fragment");
+            System.out.println("execute transformer.");
+            // transformer.transform(new StreamSource(execReaderXML),new
+            // DOMResult(outNode));
+            t.transform(new StreamSource(execReaderXML), new DOMResult(outNode));
+            System.out.println("Finsished transformer.");
+            sw = new StringWriter();
+
+            StreamResult sr = new StreamResult(sw);
+            t = TransformerFactory.newInstance().newTransformer();
+            t.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
+            t.transform(new DOMSource(outNode), sr);
+            System.out.println(sw.toString());
+        } catch (Exception e) {
+            Assert.fail(e.toString());
+        } finally {
+        }
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/MsWordXMLImport.xsl.data b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/MsWordXMLImport.xsl.data
new file mode 100644
index 00000000000..9ba08025521
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/MsWordXMLImport.xsl.data
@@ -0,0 +1,3156 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ *
+ * Copyright (c) 2014, 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.
+ *
+ -->
+ 
+<!-- Start of OOo2.0 import/wordml/wordml2ooo.xsl stylesheet  -->
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:v="urn:schemas-microsoft-com:vml" 
+    xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" 
+    xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" 
+    xmlns:o="urn:schemas-microsoft-com:office:office" 
+    xmlns:aml="http://schemas.microsoft.com/aml/2001/core"
+    xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" 
+    xmlns:dc="http://purl.org/dc/elements/1.1/"    
+    xmlns:office="http://openoffice.org/2000/office"
+    xmlns:style="http://openoffice.org/2000/style"
+    xmlns:text="http://openoffice.org/2000/text"
+    xmlns:table="http://openoffice.org/2000/table"
+    xmlns:draw="http://openoffice.org/2000/drawing"
+    xmlns:fo="http://www.w3.org/1999/XSL/Format"
+    xmlns:xlink="http://www.w3.org/1999/xlink"
+    xmlns:number="http://openoffice.org/2000/datastyle"
+    xmlns:svg="http://www.w3.org/2000/svg"
+    xmlns:chart="http://openoffice.org/2000/chart"
+    xmlns:dr3d="http://openoffice.org/2000/dr3d"
+    xmlns:math="http://www.w3.org/1998/Math/MathML"
+    xmlns:form="http://openoffice.org/2000/form"
+    xmlns:script="http://openoffice.org/2000/script"
+    xmlns:meta="http://openoffice.org/2000/meta"
+    xmlns:config="http://openoffice.org/2001/config"
+    xmlns:help="http://openoffice.org/2000/help"
+    exclude-result-prefixes="v w wx aml o aml dt" 
+    office:version="1.0"
+    >
+    <xsl:output method="xml" indent="no" encoding="UTF-8" version="1.0"/>
+    <!--
+    <xsl:include href="../../common/measure_conversion.xsl"/>
+    <xsl:include href="../common/ms2ooo_docpr.xsl"/>
+    <xsl:include href="wordml2ooo_text.xsl"/>
+    <xsl:include href="wordml2ooo_settings.xsl"/>
+    <xsl:include href="wordml2ooo_table.xsl"/>
+    <xsl:include href="wordml2ooo_page.xsl"/>
+    <xsl:include href="wordml2ooo_list.xsl"/>
+    <xsl:include href="wordml2ooo_draw.xsl"/>
+    -->
+    <xsl:key name="paragraph-style" match="w:style[@w:type = 'paragraph']" use="@w:styleId"/>
+    <xsl:key name="heading-style" match="w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl]" use="@w:styleId"/>
+    <xsl:template match="/">
+        <xsl:apply-templates select="w:wordDocument"/>
+    </xsl:template>
+    <xsl:template match="w:wordDocument">
+        <office:document office:class="text" office:version="1.0">
+            <xsl:apply-templates select="o:DocumentProperties"/>
+            <xsl:apply-templates select="w:docPr"/>
+            <xsl:apply-templates select="w:fonts"/>
+            <xsl:apply-templates select="w:styles"/>
+            <xsl:apply-templates select="w:body"/>
+        </office:document>
+    </xsl:template>
+    <xsl:template match="w:fonts">
+        <xsl:element name="office:font-decls">
+            <!-- MS Word's default font declaration, added for Writer automatically. glu -->
+            <style:font-decl style:name="Arial" fo:font-family="Arial" style:font-family-generic="roman" style:font-pitch="variable"/>
+            <style:font-decl style:name="Times New Roman" fo:font-family="'Times New Roman'" style:font-family-generic="roman" style:font-pitch="variable"/>
+            <style:font-decl style:name="Symbol" fo:font-family="Symbol" style:font-family-generic="roman" style:font-pitch="variable" style:font-charset="x-symbol"/>
+            <style:font-decl style:name="Courier New" fo:font-family="'Courier New'" style:font-family-generic="modern" style:font-pitch="fixed"/>
+            <xsl:if test="not(w:font[@w:name='StarSymbol'])">
+                <style:font-decl style:name="StarSymbol" fo:font-family="StarSymbol" style:font-charset="x-symbol"/>
+            </xsl:if>
+            <xsl:for-each select="w:font">
+                <xsl:element name="style:font-decl">
+                    <xsl:attribute name="style:name"><xsl:value-of select="@w:name"/></xsl:attribute>
+                    <xsl:attribute name="fo:font-family"><xsl:value-of select="@w:name"/></xsl:attribute>
+                    <!-- added by glu, for process special fonts e.g. Marlett, -->
+                    <xsl:if test="w:charset/@w:val = '02'">
+                        <xsl:attribute name="style:font-charset">x-symbol</xsl:attribute>
+                    </xsl:if>
+                    <xsl:if test="w:family">
+                        <xsl:choose>
+                            <xsl:when test="w:family/@w:val = 'Swiss'">
+                                <xsl:attribute name="style:font-family-generic">swiss</xsl:attribute>
+                            </xsl:when>
+                            <xsl:when test="w:family/@w:val='Modern'">
+                                <xsl:attribute name="style:font-family-generic">modern</xsl:attribute>
+                            </xsl:when>
+                            <xsl:when test="w:family/@w:val='Roman'">
+                                <xsl:attribute name="style:font-family-generic">roman</xsl:attribute>
+                            </xsl:when>
+                            <xsl:when test="w:family/@w:val='Script'">
+                                <xsl:attribute name="style:font-family-generic">script</xsl:attribute>
+                            </xsl:when>
+                            <xsl:when test="w:family/@w:val='Decorative'">
+                                <xsl:attribute name="style:font-family-generic">decorative</xsl:attribute>
+                            </xsl:when>
+                            <xsl:when test="w:family/@w:val='System'">
+                                <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="style:font-family-generic">system</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:if>
+                    <xsl:if test="w:pitch">
+                        <xsl:attribute name="style:font-pitch"><xsl:value-of select="w:pitch/@w:val"/></xsl:attribute>
+                    </xsl:if>
+                </xsl:element>
+            </xsl:for-each>
+        </xsl:element>
+    </xsl:template>
+    <xsl:template match="w:styles">
+        <office:styles>
+            <xsl:call-template name="create-default-paragraph-styles"/>
+            <xsl:call-template name="create-default-text-styles"/>
+            <xsl:call-template name="create-default-frame-style"/>
+            <!-- StarWriter has no default style family 'list'. glu -->
+            <xsl:if test="w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl and w:pPr/w:listPr]">
+                <xsl:call-template name="create-outline-style"/>
+            </xsl:if>
+            <xsl:apply-templates select="w:style[@w:type='list']" mode="list"/>
+            <xsl:apply-templates select="w:style[@w:type!='list']"/>
+        </office:styles>
+        <office:automatic-styles>
+            <xsl:apply-templates select="/w:wordDocument/w:body//w:p" mode="style"/>
+            <xsl:apply-templates select="/w:wordDocument/w:body//w:rPr[not(parent::w:pPr)]" mode="style"/>
+            <xsl:apply-templates select="/w:wordDocument/w:body//w:tblPr" mode="style"/>
+            <xsl:apply-templates select="/w:wordDocument/w:body//w:gridCol" mode="style"/>
+            <xsl:apply-templates select="/w:wordDocument/w:body//w:trHeight" mode="style"/>
+            <xsl:apply-templates select="/w:wordDocument/w:body//w:tcPr" mode="style"/>
+            <xsl:apply-templates select="/w:wordDocument/w:body//w:listPr" mode="style"/>
+            <xsl:apply-templates select="/w:wordDocument/w:body//w:sectPr" mode="page-master"/>
+        </office:automatic-styles>
+        <office:master-styles>
+            <xsl:apply-templates select="/w:wordDocument/w:body//w:sectPr" mode="master-page"/>
+        </office:master-styles>
+    </xsl:template>
+    <xsl:template match="w:style">
+        <style:style>
+            <xsl:attribute name="style:name"><xsl:value-of select="@w:styleId"/></xsl:attribute>
+            <xsl:if test="w:basedOn">
+                <xsl:attribute name="style:parent-style-name"><xsl:value-of select="w:basedOn/@w:val"/></xsl:attribute>
+            </xsl:if>
+            <xsl:if test="w:next">
+                <xsl:attribute name="style:next-style-name"><xsl:value-of select="w:next/@w:val"/></xsl:attribute>
+            </xsl:if>
+            <xsl:choose>
+                <xsl:when test="@w:type = 'character'">
+                    <xsl:attribute name="style:family">text</xsl:attribute>
+                </xsl:when>
+                <!-- table, paragraph are the same as in Writer . glu -->
+                <xsl:when test="@w:type">
+                    <xsl:attribute name="style:family"><xsl:value-of select="@w:type"/></xsl:attribute>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:attribute name="style:family">text</xsl:attribute>
+                </xsl:otherwise>
+            </xsl:choose>
+            <xsl:element name="style:properties">
+                <xsl:apply-templates select="w:pPr"/>
+                <xsl:apply-templates select="w:rPr"/>
+            </xsl:element>
+        </style:style>
+    </xsl:template>
+    <xsl:template match="w:body">
+        <xsl:element name="office:body">
+            <xsl:apply-templates/>
+        </xsl:element>
+    </xsl:template>
+    <xsl:template name="create-default-frame-style">
+        <!--add for default frame style -->
+        <style:style style:name="Frame" style:family="graphics">
+            <style:properties text:anchor-type="paragraph" svg:x="0inch" svg:y="0inch" style:wrap="parallel" style:number-wrapped-paragraphs="no-limit" style:wrap-contour="false" style:vertical-pos="top" style:vertical-rel="paragraph-content" style:horizontal-pos="center" style:horizontal-rel="paragraph-content"/>
+        </style:style>
+    </xsl:template>
+    
+<!-- End of OOo2.0 import/wordml/wordml2ooo.xsl stylesheet  -->
+<!-- Start of OOo2.0 import/wordml/wordml2ooo_draw.xsl stylesheet  -->
+    <xsl:template match="w:pict">
+        <xsl:choose>
+            <xsl:when test="descendant::w:binData">
+                <!-- Cannot load zipped Wmf file. glu <xsl:if test="not(contains(w:binData/@w:name,'.wmz'))"> -->
+                <xsl:element name="draw:image">
+                    <xsl:if test="v:shape/@style">
+                        <xsl:if test="contains( v:shape/@style, 'margin-left:')">
+                            <xsl:attribute name="svg:x"><xsl:value-of select="concat( number(substring-before( substring-after( v:shape/@style, 'margin-left:'), 'pt'))*0.0353, 'cm')"/></xsl:attribute>
+                        </xsl:if>
+                        <xsl:if test="contains( v:shape/@style, 'margin-top:')">
+                            <xsl:attribute name="svg:y"><xsl:value-of select="concat( number(substring-before( substring-after( v:shape/@style, 'margin-top:'), 'pt'))*0.0353, 'cm')"/></xsl:attribute>
+                        </xsl:if>
+                        <xsl:attribute name="svg:width"><xsl:value-of select="concat( number(substring-before( substring-after( v:shape/@style, 'width:'), 'pt'))*0.0353, 'cm')"/></xsl:attribute>
+                        <xsl:attribute name="svg:height"><xsl:value-of select="concat( number(substring-before( substring-after( v:shape/@style, 'height:'), 'pt'))*0.0353, 'cm')"/></xsl:attribute>
+                        <xsl:variable name="anchor-type">
+                            <xsl:if test="contains( v:shape/@style, 'mso-position-horizontal-relative')">
+                                <xsl:value-of select="substring-before( substring-after( v:shape/@style, 'mso-position-horizontal-relative:'), ';')"/>
+                            </xsl:if>
+                        </xsl:variable>
+                        <xsl:choose>
+                            <xsl:when test="$anchor-type = 'margin'">
+                                <xsl:attribute name="text:anchor-type">frame</xsl:attribute>
+                            </xsl:when>
+                            <xsl:when test="$anchor-type = 'page'">
+                                <xsl:attribute name="text:anchor-type">page</xsl:attribute>
+                            </xsl:when>
+                            <xsl:when test="$anchor-type = 'char'">
+                                <xsl:attribute name="text:anchor-type">as-char</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="text:anchor-type">paragraph</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                        <xsl:if test="v:shape/v:imagedata/@o:title">
+                            <xsl:attribute name="draw:name"><xsl:value-of select="v:shape/v:imagedata/@o:title"/></xsl:attribute>
+                        </xsl:if>
+                        <xsl:element name="office:binary-data">
+                            <xsl:value-of select="w:binData"/>
+                        </xsl:element>
+                    </xsl:if>
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:apply-templates/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <xsl:template match="w:binData">
+        <xsl:element name="office:binary-data">
+            <xsl:value-of select="."/>
+        </xsl:element>
+    </xsl:template>
+    <xsl:template match="v:group">
+        <xsl:apply-templates/>
+    </xsl:template>
+    <xsl:template match="v:oval">
+        <xsl:element name="draw:ellipse">
+            <xsl:variable name="style" select="@style"/>
+            <xsl:variable name="position" select="substring-after($style,'position:')"/>
+            <xsl:variable name="positionval" select="substring-before($position,';')"/>
+            <xsl:variable name="left" select="substring-after($style,'left:')"/>
+            <xsl:variable name="leftval" select="substring-before($left,';')"/>
+            <xsl:variable name="top" select="substring-after($style,'top:')"/>
+            <xsl:variable name="topval" select="substring-before($top,';')"/>
+            <xsl:variable name="width" select="substring-after($style,'width:')"/>
+            <xsl:variable name="widthval" select="substring-before($width,';')"/>
+            <xsl:variable name="height" select="substring-after($style,'height:')"/>
+            <xsl:variable name="heightval" select="$height"/>
+            <xsl:if test="$positionval = 'absolute'">
+                <xsl:variable name="parentgroup" select="parent::v:group"/>
+                <xsl:variable name="origin" select="$parentgroup/@coordorigin"/>
+                <xsl:variable name="groupleft" select="substring-before($origin,',')"/>
+                <xsl:variable name="grouptop" select="substring-after($origin,',')"/>
+                <xsl:variable name="currsect" select="ancestor::wx:sect"/>
+                <xsl:variable name="currsectPr" select="$currsect/descendant::w:sectPr/w:pgMar"/>
+                <xsl:variable name="leftmar" select="$currsectPr/@w:left"/>
+                <xsl:variable name="topmar" select="$currsectPr/@w:top"/>
+                <xsl:attribute name="text:anchor-type">page</xsl:attribute>
+                <xsl:attribute name="svg:width"><xsl:value-of select="(number($widthval) div 1440) * 2.54"/>cm</xsl:attribute>
+                <xsl:attribute name="svg:height"><xsl:value-of select="(number($heightval) div 1440) * 2.54"/>cm</xsl:attribute>
+                <xsl:attribute name="svg:x"><xsl:value-of select="(number($topval + $topmar) div 1440) * 2.54"/>cm</xsl:attribute>
+                <xsl:attribute name="svg:y"><xsl:value-of select="(number($leftval + $leftmar) div 1440) * 2.54"/>cm</xsl:attribute>
+            </xsl:if>
+        </xsl:element>
+    </xsl:template>
+    <xsl:template match="v:rect">
+        <xsl:element name="draw:rect">
+            <xsl:variable name="style" select="@style"/>
+            <xsl:variable name="position" select="substring-after($style,'position:')"/>
+            <xsl:variable name="positionval" select="substring-before($position,';')"/>
+            <xsl:variable name="left" select="substring-after($style,'left:')"/>
+            <xsl:variable name="leftval" select="substring-before($left,';')"/>
+            <xsl:variable name="top" select="substring-after($style,'top:')"/>
+            <xsl:variable name="topval" select="substring-before($top,';')"/>
+            <xsl:variable name="width" select="substring-after($style,'width:')"/>
+            <xsl:variable name="widthval" select="substring-before($width,';')"/>
+            <xsl:variable name="height" select="substring-after($style,'height:')"/>
+            <xsl:variable name="heightval" select="$height"/>
+            <xsl:if test="$positionval = 'absolute'">
+                <xsl:variable name="parentgroup" select="parent::v:group"/>
+                <xsl:variable name="origin" select="$parentgroup/@coordorigin"/>
+                <xsl:variable name="groupleft" select="substring-before($origin,',')"/>
+                <xsl:variable name="grouptop" select="substring-after($origin,',')"/>
+                <xsl:variable name="currsect" select="ancestor::wx:sect"/>
+                <xsl:variable name="currsectPr" select="$currsect/descendant::w:sectPr/w:pgMar"/>
+                <xsl:variable name="leftmar" select="$currsectPr/@w:left"/>
+                <xsl:variable name="topmar" select="$currsectPr/@w:top"/>
+                <xsl:attribute name="text:anchor-type">page</xsl:attribute>
+                <xsl:attribute name="svg:width"><xsl:value-of select="(number($widthval) div 1440) * 2.54"/>cm</xsl:attribute>
+                <xsl:attribute name="svg:height"><xsl:value-of select="(number($heightval) div 1440) * 2.54"/>cm</xsl:attribute>
+                <xsl:attribute name="svg:x"><xsl:value-of select="(number($topval + $topmar) div 1440) * 2.54"/>cm</xsl:attribute>
+                <xsl:attribute name="svg:y"><xsl:value-of select="(number($leftval + $leftmar) div 1440) * 2.54"/>cm</xsl:attribute>
+            </xsl:if>
+        </xsl:element>
+    </xsl:template>
+<!-- End of OOo2.0 import/wordml/wordml2ooo_draw.xsl stylesheet  -->
+<!-- Start of OOo2.0 import/wordml/wordml2ooo_list.xsl stylesheet  -->
+    <xsl:template match="w:listPr" mode="style">
+        <xsl:variable name="currlistid" select="w:ilfo/@w:val"/>
+        <xsl:variable name="currlist" select="."/>
+        <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
+        <xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/>
+        <xsl:if test="not(ancestor::w:p/preceding-sibling::w:p/w:pPr/w:listPr[1]/w:ilfo/@w:val= $currlistid) and $rootlist/w:lvl ">
+            <xsl:element name="text:list-style">
+                <xsl:attribute name="style:name">List<xsl:value-of select="count(preceding::w:listPr)"/></xsl:attribute>
+                <xsl:apply-templates select="$rootlist/w:lvl"/>
+            </xsl:element>
+        </xsl:if>
+    </xsl:template>
+    <xsl:template match="w:lvl">
+        <xsl:variable name="listtype">
+            <xsl:choose>
+                <xsl:when test="w:nfc/@w:val">
+                    <xsl:value-of select="w:nfc/@w:val"/>
+                </xsl:when>
+                <xsl:otherwise>0</xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:choose>
+            <xsl:when test="$listtype =23 and w:lvlPicBulletId">
+                <!-- image characters. wym -->
+                <xsl:element name="text:list-level-style-image">
+                    <xsl:call-template name="list-styles-image"/>
+                </xsl:element>
+            </xsl:when>
+            <xsl:when test="$listtype =23">
+                <!-- nfcBullet: Bullet character. glu -->
+                <xsl:element name="text:list-level-style-bullet">
+                    <xsl:call-template name="list-styles-common">
+                        <xsl:with-param name="listtype" select="$listtype"/>
+                        <xsl:with-param name="currlevel" select="number(@w:ilvl)+1"/>
+                    </xsl:call-template>
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <!-- all kinds of numbering characters. glu :( -->
+                <xsl:element name="text:list-level-style-number">
+                    <xsl:call-template name="list-styles-common">
+                        <xsl:with-param name="listtype" select="$listtype"/>
+                        <xsl:with-param name="currlevel" select="number(@w:ilvl)+1"/>
+                    </xsl:call-template>
+                </xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <xsl:template name="list-styles-common">
+        <xsl:param name="listtype"/>
+        <xsl:param name="currlevel"/>
+        <xsl:variable name="startval" select="w:start/@w:val"/>
+        <xsl:attribute name="text:level"><xsl:value-of select="$currlevel"/></xsl:attribute>
+        <xsl:choose>
+            <xsl:when test="$listtype = 23">
+                <!-- bullet character. glu -->
+                <xsl:attribute name="text:style-name">Bullet Symbols</xsl:attribute>
+                <xsl:attribute name="text:bullet-char"><xsl:value-of select="w:lvlText/@w:val"/></xsl:attribute>
+            </xsl:when>
+            <xsl:when test="($listtype &gt;= 0) and ($listtype &lt; 60)">
+                <xsl:attribute name="text:style-name">Numbering Symbols</xsl:attribute>
+                <xsl:if test="$startval">
+                    <xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute>
+                </xsl:if>
+                <xsl:attribute name="text:display-levels"><xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') )"/></xsl:attribute>
+                <xsl:call-template name="nfc2numformat">
+                    <xsl:with-param name="nfcvalue" select="$listtype"/>
+                    <xsl:with-param name="prefix" select="substring-before(w:lvlText/@w:val, '%')"/>
+                    <xsl:with-param name="suffix" select="substring-after(w:lvlText/@w:val, concat('%', $currlevel) )"/>
+                </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:attribute name="text:style-name">Numbering Symbols</xsl:attribute>
+                <xsl:if test="$startval">
+                    <xsl:attribute name="text:start-value"><xsl:value-of select="$startval"/></xsl:attribute>
+                </xsl:if>
+                <xsl:attribute name="text:display-levels"><xsl:value-of select="string-length(w:lvlText/@w:val) - string-length(translate(w:lvlText/@w:val,'%','') )"/></xsl:attribute>
+                <!-- 'none' in Word 2003. wym -->
+                <xsl:attribute name="style:num-format"/>
+                <xsl:attribute name="style:num-prefix"><xsl:value-of select="substring-before(w:lvlText/@w:val, '%')"/></xsl:attribute>
+                <xsl:attribute name="style:num-suffix"><xsl:value-of select="substring-after(w:lvlText/@w:val, concat('%', $currlevel + 1) )"/></xsl:attribute>
+            </xsl:otherwise>
+        </xsl:choose>
+        <xsl:element name="style:properties">
+            <xsl:choose>
+                <xsl:when test="w:lvlJc/@w:val='right'">
+                    <xsl:attribute name="fo:text-align">end</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:lvlJc/@w:val='center'">
+                    <xsl:attribute name="fo:text-align">center</xsl:attribute>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:attribute name="fo:text-align">start</xsl:attribute>
+                </xsl:otherwise>
+            </xsl:choose>
+            <xsl:variable name="labelwidth">
+                <xsl:choose>
+                    <xsl:when test="w:pPr/w:ind/@w:hanging">
+                        <xsl:call-template name="convert2cm">
+                            <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'dxa')"/>
+                        </xsl:call-template>
+                    </xsl:when>
+                    <xsl:when test="w:pPr/w:ind/@w:first-line">
+                        <xsl:call-template name="convert2cm">
+                            <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'dxa')"/>
+                        </xsl:call-template>
+                    </xsl:when>
+                    <xsl:otherwise>0</xsl:otherwise>
+                </xsl:choose>
+            </xsl:variable>
+            <xsl:variable name="leftwidth">
+                <xsl:call-template name="convert2cm">
+                    <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'dxa')"/>
+                </xsl:call-template>
+            </xsl:variable>
+            <xsl:attribute name="text:space-before"><xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/></xsl:attribute>
+            <xsl:attribute name="text:min-label-width"><xsl:choose><xsl:when test="$labelwidth &gt; 0"><xsl:value-of select="concat($labelwidth,'cm')"/></xsl:when><xsl:otherwise>0cm</xsl:otherwise></xsl:choose></xsl:attribute>
+            <!-- In binary word translation, text:min-label-distance do not generate. So, the width of number-symbol will not effect the start position of text. But first line always start same position of second line, no indent. If text:min-label-distance generate, the look of list will change because of uncountable number-symbol's width, now use 0.25cm as default width-->
+            <xsl:choose>
+                <xsl:when test="w:suff/@w:val='Space'">
+                    <xsl:attribute name="text:min-label-distance">0.20cm</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:pPr/w:tabs/w:tab/@w:pos">
+                    <xsl:variable name="tabpos">
+                        <xsl:call-template name="convert2cm">
+                            <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'dxa')"/>
+                        </xsl:call-template>
+                    </xsl:variable>
+                    <xsl:if test="number($tabpos) &gt; (number($leftwidth)-number($labelwidth))">
+                        <xsl:attribute name="text:min-label-distance"><xsl:value-of select="concat(number($tabpos)+number($labelwidth)-number($leftwidth)-0.25,'cm')"/></xsl:attribute>
+                    </xsl:if>
+                </xsl:when>
+            </xsl:choose>
+            <!-- Find the node that corresponds to the level being processed. We can use this to determine the indentation to be used
+            <xsl:variable name="currNode" select="/w:wordDocument/w:body//w:listPr[w:ilvl/@w:val = $currlevel][w:ilfo/@w:val = $currlist/w:ilfo/@w:val]"/>
+            <xsl:choose>
+                <xsl:when test="($currNode/wx:t/@wx:wTabBefore ) and ($currNode/wx:t/@wx:wTabAfter ) and (not($currNode/following-sibling::w:jc) or $currNode/following-sibling::w:jc/@w:val = 'left')">
+                    <xsl:attribute name="text:space-before"><xsl:value-of select="(number($currNode/wx:t/@wx:wTabBefore)div 1440) * 2.54"/>cm</xsl:attribute>
+                    <xsl:attribute name="text:min-label-distance"><xsl:value-of select="(number($currNode/wx:t/@wx:wTabAfter)div 1440) * 2.54"/>cm</xsl:attribute>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:attribute name="text:space-before"><xsl:value-of select="((number(w:pPr/w:ind/@w:left)  div 1440) * 2.54) "/>cm</xsl:attribute>
+                    <xsl:attribute name="text:min-label-distance"><xsl:value-of select="(number($currlist/wx:t/@wx:wTabAfter) div 1440) * 2.54"/>cm</xsl:attribute>
+                </xsl:otherwise>
+            </xsl:choose>-->
+            <xsl:if test="w:rPr/w:rFonts">
+                <xsl:if test="w:rPr/w:rFonts/@w:ascii">
+                    <xsl:attribute name="style:font-name"><xsl:value-of select="w:rPr/w:rFonts/@w:ascii"/></xsl:attribute>
+                </xsl:if>
+                <xsl:if test="w:rPr/w:rFonts/@w:fareast">
+                    <xsl:attribute name="style:font-name-asian"><xsl:value-of select="w:rPr/w:rFonts/@w:fareast"/></xsl:attribute>
+                </xsl:if>
+                <xsl:if test="w:rPr/w:rFonts/@w:cs">
+                    <xsl:attribute name="style:font-name-complex"><xsl:value-of select="w:rPr/w:rFonts/@w:cs"/></xsl:attribute>
+                </xsl:if>
+            </xsl:if>
+        </xsl:element>
+    </xsl:template>
+    <xsl:template name="list-styles-image">
+        <xsl:variable name="currlevel" select="number(@w:ilvl)"/>
+        <xsl:attribute name="text:level"><xsl:value-of select="$currlevel+1"/></xsl:attribute>
+        <xsl:variable name="picid" select="w:lvlPicBulletId/@w:val"/>
+        <xsl:element name="style:properties">
+            <xsl:attribute name="style:vertical-pos">middle</xsl:attribute>
+            <xsl:attribute name="style:vertical-rel">line</xsl:attribute>
+            <xsl:variable name="picsize" select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/v:shape/@style"/>
+            <xsl:attribute name="fo:width"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="substring-before(substring-after($picsize,'width:'), ';')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+            <xsl:attribute name="fo:height"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="substring-after($picsize,'height:')"/></xsl:call-template><xsl:text>cm</xsl:text></xsl:attribute>
+            <xsl:variable name="labelwidth">
+                <xsl:choose>
+                    <xsl:when test="w:pPr/w:ind/@w:hanging">
+                        <xsl:call-template name="convert2cm">
+                            <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:hanging,'dxa')"/>
+                        </xsl:call-template>
+                    </xsl:when>
+                    <xsl:when test="w:pPr/w:ind/@w:first-line">
+                        <xsl:call-template name="convert2cm">
+                            <xsl:with-param name="value" select="concat('-',w:pPr/w:ind/@w:first-line,'dxa')"/>
+                        </xsl:call-template>
+                    </xsl:when>
+                    <xsl:otherwise>0</xsl:otherwise>
+                </xsl:choose>
+            </xsl:variable>
+            <xsl:variable name="leftwidth">
+                <xsl:call-template name="convert2cm">
+                    <xsl:with-param name="value" select="concat(w:pPr/w:ind/@w:left,'dxa')"/>
+                </xsl:call-template>
+            </xsl:variable>
+            <xsl:attribute name="text:space-before"><xsl:value-of select="concat(number($leftwidth)-number($labelwidth),'cm')"/></xsl:attribute>
+            <xsl:attribute name="text:min-label-width"><xsl:choose><xsl:when test="$labelwidth &gt; 0"><xsl:value-of select="concat($labelwidth,'cm')"/></xsl:when><xsl:otherwise>0cm</xsl:otherwise></xsl:choose></xsl:attribute>
+            <xsl:choose>
+                <xsl:when test="w:suff/@w:val='Space'">
+                    <xsl:attribute name="text:min-label-distance">0.20cm</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:pPr/w:tabs/w:tab/@w:pos">
+                    <xsl:variable name="tabpos">
+                        <xsl:call-template name="convert2cm">
+                            <xsl:with-param name="value" select="concat(w:pPr/w:tabs/w:tab/@w:pos,'dxa')"/>
+                        </xsl:call-template>
+                    </xsl:variable>
+                    <xsl:if test="number($tabpos) &gt; (number($leftwidth)-number($labelwidth))">
+                        <xsl:attribute name="text:min-label-distance"><xsl:value-of select="concat(number($tabpos)+number($labelwidth)-number($leftwidth),'cm')"/></xsl:attribute>
+                    </xsl:if>
+                </xsl:when>
+            </xsl:choose>
+        </xsl:element>
+        <office:binary-data>
+            <xsl:value-of select="/descendant::w:lists/w:listPicBullet[@w:listPicBulletId=$picid]/w:pict/w:binData"/>
+        </office:binary-data>
+    </xsl:template>
+    <!-- avoid listPr in textbox. :( glu -->
+    <xsl:template match="w:p[w:pPr/w:listPr[w:ilvl and w:ilfo]]">
+        <xsl:call-template name="genlist"/>
+    </xsl:template>
+    <xsl:template name="genlist">
+        <xsl:variable name="currlistid" select="w:pPr/w:listPr/w:ilfo/@w:val"/>
+        <xsl:variable name="currlistlvl" select="w:pPr/w:listPr/w:ilvl/@w:val"/>
+        <xsl:variable name="firstoccur" select="/descendant::w:pPr[w:listPr/w:ilfo/@w:val = $currlistid][1]"/>
+        <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
+        <xsl:variable name="rootlistname" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]/w:listStyleLink/@w:val"/>
+        <xsl:element name="text:ordered-list">
+            <xsl:attribute name="text:style-name"><xsl:choose><xsl:when test="string-length($rootlistname) &gt; 0"><xsl:value-of select="$rootlistname"/></xsl:when><xsl:otherwise>List<xsl:value-of select="count($firstoccur/preceding::w:listPr)"/></xsl:otherwise></xsl:choose></xsl:attribute>
+            <xsl:choose>
+                <xsl:when test="preceding::w:pPr/w:listPr/w:ilfo/@w:val = w:pPr/w:listPr/w:ilfo/@w:val">
+                    <xsl:attribute name="text:continue-numbering">true</xsl:attribute>
+                    <xsl:element name="text:list-item">
+                        <xsl:call-template name="levels">
+                            <xsl:with-param name="level" select="$currlistlvl"/>
+                        </xsl:call-template>
+                    </xsl:element>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:element name="text:list-item">
+                        <xsl:call-template name="levels">
+                            <xsl:with-param name="level" select="$currlistlvl"/>
+                        </xsl:call-template>
+                    </xsl:element>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:element>
+    </xsl:template>
+    <xsl:template name="levels">
+        <xsl:param name="level"/>
+        <xsl:choose>
+            <xsl:when test="$level = '0'">
+                <xsl:call-template name="process-common-paragraph"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:element name="text:ordered-list">
+                    <xsl:element name="text:list-item">
+                        <xsl:call-template name="levels">
+                            <xsl:with-param name="level" select="$level -1"/>
+                        </xsl:call-template>
+                    </xsl:element>
+                </xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <xsl:template match="w:style" mode="list">
+        <xsl:variable name="listname" select="@w:styleId"/>
+        <xsl:if test="/w:wordDocument/w:lists/w:listDef[w:styleLink/@w:val=$listname]">
+            <text:list-style style:name="{$listname}">
+                <xsl:apply-templates select="/w:wordDocument/w:lists/w:listDef[w:styleLink/@w:val=$listname]/w:lvl"/>
+            </text:list-style>
+        </xsl:if>
+    </xsl:template>
+    <!-- for create outline style in office:styles -->
+    <xsl:template name="create-outline-style">
+        <xsl:element name="text:outline-style">
+            <xsl:call-template name="outline-level-style">
+                <xsl:with-param name="level" select="1"/>
+            </xsl:call-template>
+            <xsl:call-template name="outline-level-style">
+                <xsl:with-param name="level" select="2"/>
+            </xsl:call-template>
+            <xsl:call-template name="outline-level-style">
+                <xsl:with-param name="level" select="3"/>
+            </xsl:call-template>
+            <xsl:call-template name="outline-level-style">
+                <xsl:with-param name="level" select="4"/>
+            </xsl:call-template>
+            <xsl:call-template name="outline-level-style">
+                <xsl:with-param name="level" select="5"/>
+            </xsl:call-template>
+            <xsl:call-template name="outline-level-style">
+                <xsl:with-param name="level" select="6"/>
+            </xsl:call-template>
+            <xsl:call-template name="outline-level-style">
+                <xsl:with-param name="level" select="7"/>
+            </xsl:call-template>
+            <xsl:call-template name="outline-level-style">
+                <xsl:with-param name="level" select="8"/>
+            </xsl:call-template>
+            <xsl:call-template name="outline-level-style">
+                <xsl:with-param name="level" select="9"/>
+            </xsl:call-template>
+            <xsl:call-template name="outline-level-style">
+                <xsl:with-param name="level" select="10"/>
+            </xsl:call-template>
+        </xsl:element>
+    </xsl:template>
+    <xsl:template name="outline-level-style">
+        <xsl:param name="level"/>
+        <xsl:element name="text:outline-level-style">
+            <xsl:choose>
+                <xsl:when test="w:style[@w:type = 'paragraph' and (w:pPr/w:outlineLvl/@w:val = $level -1) and w:pPr/w:listPr]">
+                    <xsl:apply-templates select="(w:style[@w:type = 'paragraph' and w:pPr/w:outlineLvl/@w:val = $level -1 and w:pPr/w:listPr ]/w:pPr/w:listPr)[position()=1]" mode="outline">
+                        <xsl:with-param name="outlinelevel" select="$level"/>
+                    </xsl:apply-templates>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:attribute name="text:level"><xsl:value-of select="$level"/></xsl:attribute>
+                    <xsl:attribute name="style:num-format"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:element>
+    </xsl:template>
+    <xsl:template match="w:listPr" mode="outline">
+        <xsl:param name="outlinelevel"/>
+        <xsl:variable name="currlistid" select="w:ilfo/@w:val"/>
+        <xsl:variable name="currlistlevel">
+            <xsl:choose>
+                <xsl:when test="w:ilvl">
+                    <xsl:value-of select="w:ilvl/@w:val"/>
+                </xsl:when>
+                <xsl:otherwise>0</xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="rootlistid" select="/w:wordDocument/w:lists/w:list[@w:ilfo=$currlistid]/w:ilst/@w:val"/>
+        <xsl:variable name="rootlist" select="/w:wordDocument/w:lists/w:listDef[@w:listDefId =$rootlistid ]"/>
+        <xsl:for-each select="$rootlist/w:lvl[@w:ilvl=$currlistlevel]">
+            <xsl:call-template name="list-styles-common">
+                <xsl:with-param name="listtype">
+                    <xsl:choose>
+                        <xsl:when test="w:nfc/@w:val">
+                            <xsl:value-of select="w:nfc/@w:val"/>
+                        </xsl:when>
+                        <xsl:otherwise>0</xsl:otherwise>
+                    </xsl:choose>
+                </xsl:with-param>
+                <xsl:with-param name="currlevel" select="$outlinelevel"/>
+            </xsl:call-template>
+        </xsl:for-each>
+    </xsl:template>
+    <xsl:template name="nfc2numformat">
+        <xsl:param name="nfcvalue"/>
+        <xsl:param name="prefix"/>
+        <xsl:param name="suffix"/>
+        <xsl:choose>
+            <xsl:when test="$nfcvalue=0">
+                <xsl:attribute name="style:num-format">1</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=1">
+                <xsl:attribute name="style:num-format">I</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=2">
+                <xsl:attribute name="style:num-format">i</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=3">
+                <xsl:attribute name="style:num-format">A</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=4">
+                <xsl:attribute name="style:num-format">a</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=10 or $nfcvalue=11 or $nfcvalue=17 or $nfcvalue=29 or $nfcvalue=33 or $nfcvalue=35 or $nfcvalue=36 or $nfcvalue=37 or $nfcvalue=39 or $nfcvalue=44">
+                <xsl:attribute name="style:num-format">一, 二, 三, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=12">
+                <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=13">
+                <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=14 or $nfcvalue=19">
+                <xsl:attribute name="style:num-format">1, 2, 3, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=16">
+                <xsl:attribute name="style:num-format">壱, 弐, 参, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=18 or $nfcvalue=28">
+                <xsl:attribute name="style:num-format">①, ②, ③, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=20">
+                <xsl:attribute name="style:num-format">ア, イ, ウ, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=21">
+                <xsl:attribute name="style:num-format">イ, ロ, ハ, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=24">
+                <xsl:attribute name="style:num-format">가, 나, 다, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=25">
+                <xsl:attribute name="style:num-format">ㄱ, ㄴ, ㄷ, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=30">
+                <xsl:attribute name="style:num-format">甲, 乙, 丙, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=31">
+                <xsl:attribute name="style:num-format">子, 丑, 寅, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=34">
+                <xsl:attribute name="style:num-format">壹, 貳, 參, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=38">
+                <xsl:attribute name="style:num-format">壹, 贰, 叁, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=41 or $nfcvalue=42 or $nfcvalue=43">
+                <xsl:attribute name="style:num-format">일, 이, 삼, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=45 or $nfcvalue=47">
+                <xsl:attribute name="style:num-format">א, ב, ג, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=46 or $nfcvalue=48">
+                <xsl:attribute name="style:num-format">أ, ب, ت, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=53">
+                <xsl:attribute name="style:num-format">ก, ข, ฃ, ...</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue!=57 and $nfcvalue &gt; 48 and $nfcvalue &lt; 60">
+                <xsl:attribute name="style:num-format">Native Numbering</xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:attribute name="style:num-format">1</xsl:attribute>
+            </xsl:otherwise>
+        </xsl:choose>
+        <xsl:choose>
+            <xsl:when test="$nfcvalue=26">
+                <xsl:attribute name="style:num-prefix"><xsl:value-of select="$prefix"/></xsl:attribute>
+                <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( '.' , $suffix )"/></xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=27 or $nfcvalue=29">
+                <xsl:attribute name="style:num-prefix"><xsl:value-of select="concat( $prefix, '(' )"/></xsl:attribute>
+                <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( ')' , $suffix )"/></xsl:attribute>
+            </xsl:when>
+            <xsl:when test="$nfcvalue=57">
+                <xsl:attribute name="style:num-prefix"><xsl:value-of select="concat( $prefix, '- ' )"/></xsl:attribute>
+                <xsl:attribute name="style:num-suffix"><xsl:value-of select="concat( ' -' , $suffix )"/></xsl:attribute>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:attribute name="style:num-prefix"><xsl:value-of select="$prefix"/></xsl:attribute>
+                <xsl:attribute name="style:num-suffix"><xsl:value-of select="$suffix"/></xsl:attribute>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+<!-- End of OOo2.0 import/wordml/wordml2ooo_list.xsl stylesheet  -->
+<!-- Start of OOo2.0 import/wordml/wordml2ooo_page.xsl stylesheet  -->
+    <xsl:template match="w:sectPr" mode="page-master">
+        <style:page-master>
+            <xsl:attribute name="style:name">pm<xsl:number from="/w:wordDocument/w:body" level="any" count="w:sectPr"/></xsl:attribute>
+            <style:properties>
+                <xsl:attribute name="fo:page-width"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pgSz/@w:w,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                <xsl:attribute name="fo:page-height"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pgSz/@w:h,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                <xsl:choose>
+                    <xsl:when test="/w:wordDocument/w:docPr/w:gutterAtTop">
+                        <xsl:attribute name="fo:margin-top"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pgMar/@w:top + w:pgMar/@w:gutter,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                        <xsl:attribute name="fo:margin-left"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pgMar/@w:left,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                        <xsl:attribute name="fo:margin-right"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pgMar/@w:right,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="w:rtlGutter">
+                        <xsl:attribute name="fo:margin-top"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pgMar/@w:top,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                        <xsl:attribute name="fo:margin-left"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pgMar/@w:left,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                        <xsl:attribute name="fo:margin-right"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pgMar/@w:right + w:pgMar/@w:gutter,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:attribute name="fo:margin-top"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pgMar/@w:top,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                        <xsl:attribute name="fo:margin-left"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pgMar/@w:left + w:pgMar/@w:gutter,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                        <xsl:attribute name="fo:margin-right"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pgMar/@w:right,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                    </xsl:otherwise>
+                </xsl:choose>
+                <xsl:attribute name="fo:margin-bottom"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pgMar/@w:bottom,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                <xsl:attribute name="style:footnote-max-height"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pgMar/@w:footer,'dxa')"/></xsl:call-template></xsl:attribute>
+                <xsl:if test="w:pgSz/@w:orient">
+                    <xsl:attribute name="style:print-orientation"><xsl:value-of select="w:pgSz/@w:orient"/></xsl:attribute>
+                </xsl:if>
+                <xsl:if test="w:cols/@w:num">
+                    <!-- create sction property-->
+                    <style:columns>
+                        <xsl:attribute name="fo:column-count"><xsl:value-of select="w:cols/@w:num"/></xsl:attribute>
+                        <xsl:attribute name="fo:column-gap"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:cols/@w:space,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                    </style:columns>
+                </xsl:if>
+            </style:properties>
+        </style:page-master>
+    </xsl:template>
+    <xsl:template match="w:sectPr" mode="master-page">
+        <!-- style:page-master style:style-->
+        <style:master-page>
+            <xsl:variable name="master-page-name">
+                <xsl:number count="w:sectPr" from="/w:wordDocument/w:body" level="any"/>
+            </xsl:variable>
+            <xsl:attribute name="style:name">Standard<xsl:value-of select="$master-page-name"/></xsl:attribute>
+            <xsl:attribute name="style:page-master-name"><xsl:value-of select="concat('pm', $master-page-name)"/></xsl:attribute>
+            <!-- Headers and footers-->
+            <style:header-style>
+                <style:properties>
+                    <xsl:attribute name="fo:min-height"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pgMar/@w:header,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                    <xsl:attribute name="fo:margin-bottom">0.792cm</xsl:attribute>
+                    <xsl:attribute name="style:dynamic-spacing">true</xsl:attribute>
+                </style:properties>
+            </style:header-style>
+            <style:footer-style>
+                <style:properties>
+                    <xsl:attribute name="fo:min-height"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pgMar/@w:footer,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                    <xsl:attribute name="fo:margin-top">0.792cm</xsl:attribute>
+                    <xsl:attribute name="style:dynamic-spacing">true</xsl:attribute>
+                </style:properties>
+            </style:footer-style>
+            <xsl:if test="not(w:titlePg)">
+                <xsl:apply-templates select="w:hdr[@w:type='odd']"/>
+                <xsl:apply-templates select="w:hdr[@w:type='even']"/>
+                <xsl:apply-templates select="w:ftr[@w:type='odd']"/>
+                <xsl:apply-templates select="w:ftr[@w:type='even']"/>
+            </xsl:if>
+        </style:master-page>
+    </xsl:template>
+    <xsl:template match="w:hdr">
+        <xsl:choose>
+            <xsl:when test="@w:type = 'odd'">
+                <style:header>
+                    <xsl:apply-templates/>
+                </style:header>
+            </xsl:when>
+            <xsl:when test="@w:type = 'even'">
+                <style:header-left>
+                    <xsl:apply-templates/>
+                </style:header-left>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+    <xsl:template match="w:ftr">
+        <xsl:choose>
+            <xsl:when test="@w:type = 'odd'">
+                <style:footer>
+                    <xsl:apply-templates/>
+                </style:footer>
+            </xsl:when>
+            <xsl:when test="@w:type = 'even'">
+                <style:footer-left>
+                    <xsl:apply-templates/>
+                </style:footer-left>
+            </xsl:when>
+        </xsl:choose>
+    </xsl:template>
+<!-- End of OOo2.0 import/wordml/wordml2ooo_page.xsl stylesheet  -->
+<!-- Start of OOo2.0 import/wordml/wordml2ooo_settings.xsl stylesheet  -->
+    <xsl:template match="w:docPr">
+        <office:settings>
+            <config:config-item-set config:name="view-settings">
+                <config:config-item config:name="InBrowseMode" config:type="boolean">
+                    <xsl:choose>
+                        <xsl:when test="w:view/@w:val = 'outline'">true</xsl:when>
+                        <xsl:when test="w:view/@w:val = 'print'">false</xsl:when>
+                        <!-- others: web, reading, normal, master-pages, none. glu -->
+                        <xsl:otherwise>true</xsl:otherwise>
+                    </xsl:choose>
+                </config:config-item>
+                <config:config-item-map-indexed config:name="Views">
+                    <config:config-item-map-entry>
+                        <xsl:if test="w:zoom">
+                            <!-- VisibleRight and VisibleBottom are arbitrary positive numbers. ;) glu -->
+                            <config:config-item config:name="VisibleRight" config:type="int">1</config:config-item>
+                            <config:config-item config:name="VisibleBottom" config:type="int">1</config:config-item>
+                            <xsl:choose>
+                                <xsl:when test="w:zoom/@w:val = 'best-fit'">
+                                    <config:config-item config:name="ZoomType" config:type="short">3</config:config-item>
+                                </xsl:when>
+                                <xsl:when test="w:zoom/@w:val = 'full-page'">
+                                    <config:config-item config:name="ZoomType" config:type="short">2</config:config-item>
+                                </xsl:when>
+                                <xsl:when test="w:zoom/@w:val = 'text-fit'">
+                                    <config:config-item config:name="ZoomType" config:type="short">1</config:config-item>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <config:config-item config:name="ZoomType" config:type="short">0</config:config-item>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                            <config:config-item config:name="ZoomFactor" config:type="short">
+                                <xsl:value-of select="w:zoom/@w:percent"/>
+                            </config:config-item>
+                        </xsl:if>
+                    </config:config-item-map-entry>
+                </config:config-item-map-indexed>
+            </config:config-item-set>
+        </office:settings>
+    </xsl:template>
+<!-- End of OOo2.0 import/wordml/wordml2ooo_settings.xsl stylesheet  -->
+<!-- Start of OOo2.0 import/wordml/wordml2ooo_table.xsl stylesheet  -->
+    <xsl:template match="w:tblPr" mode="style">
+        <xsl:element name="style:style">
+            <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any"/></xsl:attribute>
+            <xsl:attribute name="style:family">table</xsl:attribute>
+            <xsl:if test="w:tblStyle">
+                <xsl:attribute name="style:parent-style-name"><xsl:value-of select="w:tblStyle/@w:val"/></xsl:attribute>
+            </xsl:if>
+            <xsl:element name="style:properties">
+                <xsl:choose>
+                    <xsl:when test="w:jc/@w:val = 'left' or w:jc/@w:val = 'center' or w:jc/@w:val = 'right'">
+                        <xsl:attribute name="table:align"><xsl:value-of select="w:jc/@w:val"/></xsl:attribute>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:attribute name="table:align">margins</xsl:attribute>
+                    </xsl:otherwise>
+                </xsl:choose>
+                <!-- adopt the width of table and column corresponding the width of page and margins. . -->
+                <xsl:variable name="sectPr" select="following::w:sectPr[1]"/>
+                <xsl:variable name="total-page-size" select="$sectPr/w:pgSz/@w:w"/>
+                <xsl:variable name="page-left-mar" select="$sectPr/w:pgMar/@w:left"/>
+                <xsl:variable name="page-right-mar" select="$sectPr/w:pgMar/@w:right"/>
+                <xsl:variable name="page-size-value" select="$total-page-size - $page-left-mar - $page-right-mar"/>
+                <xsl:variable name="page-size-inch">
+                    <xsl:call-template name="convert2in">
+                        <xsl:with-param name="value" select="concat($page-size-value, 'dxa') "/>
+                    </xsl:call-template>
+                </xsl:variable>
+                <xsl:variable name="gridcols" select="../w:tblGrid/w:gridCol"/>
+                <xsl:variable name="tblsize" select="sum($gridcols/@w:w)"/>
+                <xsl:variable name="table_indent">
+                    <xsl:choose>
+                        <xsl:when test="w:tblInd and  w:tblInd/@w:w &gt; 0 ">
+                            <xsl:call-template name="convert2in">
+                                <xsl:with-param name="value" select="concat(w:tblInd/@w:w, 'dxa') "/>
+                            </xsl:call-template>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:value-of select="number( '0') "/>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:variable name="rel-tblsize">
+                    <xsl:choose>
+                        <xsl:when test="w:tblW/@w:type = 'pct'">
+                            <xsl:value-of select="(number(w:tblW/@w:w  ) div 5000) * $page-size-inch"/>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:call-template name="convert2in">
+                                <xsl:with-param name="value" select="concat($tblsize, 'dxa')"/>
+                            </xsl:call-template>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:attribute name="style:width"><xsl:value-of select="concat($rel-tblsize, 'inch' )"/></xsl:attribute>
+                <xsl:variable name="tbl_margin_left">
+                    <xsl:choose>
+                        <xsl:when test="not(w:tblpPr ) ">
+                            <xsl:choose>
+                                <xsl:when test="w:bidiVisual">
+                                    <xsl:choose>
+                                        <xsl:when test=" number($page-size-inch - $table_indent - $rel-tblsize) &gt; 0">
+                                            <xsl:value-of select="$page-size-inch - $table_indent - $rel-tblsize"/>
+                                        </xsl:when>
+                                        <xsl:otherwise>
+                                            <xsl:text>0</xsl:text>
+                                        </xsl:otherwise>
+                                    </xsl:choose>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:value-of select="$table_indent"/>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:when>
+                        <xsl:when test="w:tblpPr">
+                            <!-- if the table is  put into a draw:text-box,  fo:margin-left and fo:margin-right should be 0 -->
+                            <xsl:text>0</xsl:text>
+                        </xsl:when>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:variable name="tbl_margin_right">
+                    <xsl:choose>
+                        <xsl:when test="not(w:tblpPr ) ">
+                            <xsl:choose>
+                                <xsl:when test="w:bidiVisual">
+                                    <xsl:value-of select="$table_indent"/>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:choose>
+                                        <xsl:when test=" number($page-size-inch - $table_indent - $rel-tblsize) &gt; 0">
+                                            <xsl:value-of select="$page-size-inch - $table_indent - $rel-tblsize"/>
+                                        </xsl:when>
+                                        <xsl:otherwise>
+                                            <xsl:text>0</xsl:text>
+                                        </xsl:otherwise>
+                                    </xsl:choose>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:when>
+                        <xsl:when test="w:tblpPr">
+                            <!-- if the table is  put into a draw:text-box,  fo:margin-left and fo:margin-right should be 0 -->
+                            <xsl:text>0</xsl:text>
+                        </xsl:when>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat( $tbl_margin_left, 'inch')"/></xsl:attribute>
+                <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat($tbl_margin_right, 'inch')"/></xsl:attribute>
+                <!-- If previous w:p has a page break, the table must have the page break attribute applied to it	 May need this for tables starting on new pages -->
+                <!--	<xsl:if test="parent::w:tbl/preceding-sibling::w:p[1][descendant::w:br/@w:type='page']">
+							<xsl:attribute name="fo:break-before">page</xsl:attribute></xsl:if>	-->
+                <!-- initial values for tables-->
+            </xsl:element>
+        </xsl:element>
+        <!-- the following style is for conveting Word table text wrapping to SO Writer. Since SO Writer has no table text wrapping feature, so we use the draw:text-box as a container and put the table in draw:text-box -->
+        <xsl:if test="w:tblpPr">
+            <xsl:element name="style:style">
+                <xsl:attribute name="style:name">TableFrame<xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any"/></xsl:attribute>
+                <xsl:attribute name="style:family">graphics</xsl:attribute>
+                <xsl:attribute name="style:parent-style-name"><xsl:value-of select=" 'Frame' "/></xsl:attribute>
+                <xsl:element name="style:properties">
+                    <xsl:if test="w:tblpPr/@w:leftFromText">
+                        <xsl:variable name="left_margin_from_text">
+                            <xsl:call-template name="convert2in">
+                                <xsl:with-param name="value" select="concat (w:tblpPr/@w:leftFromText, 'dxa') "/>
+                            </xsl:call-template>
+                        </xsl:variable>
+                        <xsl:attribute name="fo:margin-left"><xsl:value-of select="concat( $left_margin_from_text, 'inch') "/></xsl:attribute>
+                    </xsl:if>
+                    <xsl:if test="w:tblpPr/@w:rightFromText">
+                        <xsl:variable name="right_margin_from_text">
+                            <xsl:call-template name="convert2in">
+                                <xsl:with-param name="value" select="concat (w:tblpPr/@w:rightFromText, 'dxa') "/>
+                            </xsl:call-template>
+                        </xsl:variable>
+                        <xsl:attribute name="fo:margin-right"><xsl:value-of select="concat( $right_margin_from_text, 'inch') "/></xsl:attribute>
+                    </xsl:if>
+                    <xsl:if test="w:tblpPr/@w:topFromText">
+                        <xsl:variable name="top_margin_from_text">
+                            <xsl:call-template name="convert2in">
+                                <xsl:with-param name="value" select="concat (w:tblpPr/@w:topFromText, 'dxa') "/>
+                            </xsl:call-template>
+                        </xsl:variable>
+                        <xsl:attribute name="fo:margin-top"><xsl:value-of select="concat( $top_margin_from_text, 'inch') "/></xsl:attribute>
+                    </xsl:if>
+                    <xsl:if test="w:tblpPr/@w:bottomFromText">
+                        <xsl:variable name="bottom_margin_from_text">
+                            <xsl:call-template name="convert2in">
+                                <xsl:with-param name="value" select="concat (w:tblpPr/@w:bottomFromText, 'dxa') "/>
+                            </xsl:call-template>
+                        </xsl:variable>
+                        <xsl:attribute name="fo:margin-bottom"><xsl:value-of select="concat( $bottom_margin_from_text, 'inch') "/></xsl:attribute>
+                    </xsl:if>
+                    <xsl:attribute name="style:number-wrapped-paragraphs"><xsl:text>no-limit</xsl:text></xsl:attribute>
+                    <!--xsl:if test="w:tblpPr/@w:tblpYSpec" to get the vertical alignment-->
+                    <xsl:variable name="vertical_alignment">
+                        <xsl:choose>
+                            <xsl:when test="w:tblpPr/@w:tblpYSpec = 'top' ">
+                                <xsl:text>top</xsl:text>
+                            </xsl:when>
+                            <xsl:when test="w:tblpPr/@w:tblpYSpec = 'center' ">
+                                <xsl:text>middle</xsl:text>
+                            </xsl:when>
+                            <xsl:when test="w:tblpPr/@w:tblpYSpec= 'bottom' ">
+                                <xsl:text>bottom</xsl:text>
+                            </xsl:when>
+                            <xsl:when test="w:tblpPr/@w:tblpYSpec = 'inside' ">
+                                <xsl:text>from-top</xsl:text>
+                            </xsl:when>
+                            <xsl:when test="w:tblpPr/@w:tblpYSpec= 'outside' ">
+                                <xsl:text>top</xsl:text>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:text>from-top</xsl:text>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:variable>
+                    <xsl:attribute name="style:vertical-pos"><xsl:value-of select="$vertical_alignment"/></xsl:attribute>
+                    <!--/xsl:if-->
+                    <!--xsl:if test="w:tblpPr/@w:vertAnchor" to get the vertical anchor related area type -->
+                    <xsl:variable name="frame_v_anchor">
+                        <xsl:choose>
+                            <xsl:when test="w:tblpPr/@w:vertAnchor = 'text' ">
+                                <xsl:value-of select=" 'paragraph' "/>
+                            </xsl:when>
+                            <xsl:when test="w:tblpPr/@w:vertAnchor = 'margin' ">
+                                <xsl:value-of select=" 'paragraph-content' "/>
+                            </xsl:when>
+                            <xsl:when test="w:tblpPr/@w:vertAnchor = 'page' ">
+                                <xsl:value-of select="w:tblpPr/@w:vertAnchor"/>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:value-of select=" 'page-content' "/>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:variable>
+                    <xsl:attribute name="style:vertical-rel"><xsl:value-of select="$frame_v_anchor"/></xsl:attribute>
+                    <!--/xsl:if-->
+                    <!--xsl:if test="w:tblpPr/@w:tblpXSpec" to get the horizntal alignment-->
+                    <xsl:variable name="horizental_alignment">
+                        <xsl:choose>
+                            <xsl:when test="w:tblpPr/@w:tblpXSpec = 'left' ">
+                                <xsl:text>left</xsl:text>
+                            </xsl:when>
+                            <xsl:when test="w:tblpPr/@w:tblpXSpec = 'center' ">
+                                <xsl:text>center</xsl:text>
+                            </xsl:when>
+                            <xsl:when test="w:tblpPr/@w:tblpXSpec = 'right' ">
+                                <xsl:text>right</xsl:text>
+                            </xsl:when>
+                            <xsl:when test="w:tblpPr/@w:tblpXSpec = 'inside' ">
+                                <xsl:text>from-left</xsl:text>
+                            </xsl:when>
+                            <xsl:when test="w:tblpPr/@w:tblpXSpec = 'outside' ">
+                                <xsl:text>outside</xsl:text>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:text>left</xsl:text>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:variable>
+                    <xsl:attribute name="style:horizontal-pos"><xsl:value-of select="$horizental_alignment"/></xsl:attribute>
+                    <!--/xsl:if-->
+                    <!--xsl:if test="w:tblpPr/@w:horzAnchor" to get the horizental anchor related area type-->
+                    <xsl:variable name="frame_h_anchor">
+                        <xsl:choose>
+                            <xsl:when test="w:tblpPr/@w:horzAnchor = 'text' ">
+                                <xsl:value-of select=" 'paragraph' "/>
+                            </xsl:when>
+                            <xsl:when test="w:tblpPr/@w:horzAnchor = 'margin' ">
+                                <xsl:value-of select=" 'page-content' "/>
+                            </xsl:when>
+                            <xsl:when test="w:tblpPr/@w:horzAnchor = 'page' ">
+                                <xsl:value-of select="w:tblpPr/@w:horzAnchor"/>
+                            </xsl:when>
+                            <xsl:when test="w:tblpPr/@w:horzAnchor= 'inside' ">
+                                <xsl:value-of select=" 'paragraph-start-margin' "/>
+                            </xsl:when>
+                            <xsl:when test="w:tblpPr/@w:horzAnchor= 'outside' ">
+                                <xsl:value-of select=" 'paragraph-end-margin' "/>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:value-of select=" 'paragraph-content' "/>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:variable>
+                    <xsl:attribute name="style:horizontal-rel"><xsl:value-of select="$frame_h_anchor"/></xsl:attribute>
+                    <!--/xsl:if-->
+                    <xsl:attribute name="fo:background-color"><xsl:text>#ffffff</xsl:text></xsl:attribute>
+                    <xsl:attribute name="style:background-transparency"><xsl:text>100%</xsl:text></xsl:attribute>
+                    <xsl:attribute name="style:wrap"><xsl:text>parallel</xsl:text></xsl:attribute>
+                </xsl:element>
+            </xsl:element>
+        </xsl:if>
+    </xsl:template>
+    <xsl:template match="w:gridCol" mode="style">
+        <xsl:element name="style:style">
+            <xsl:attribute name="style:family">table-column</xsl:attribute>
+            <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any"/>.C<xsl:number count="w:gridCol" from="/w:wordDocument/w:body" level="single"/></xsl:attribute>
+            <xsl:element name="style:properties">
+                <xsl:variable name="column_width">
+                    <xsl:call-template name="convert2in">
+                        <xsl:with-param name="value" select="concat(@w:w, 'dxa') "/>
+                    </xsl:call-template>
+                </xsl:variable>
+                <xsl:attribute name="style:column-width"><xsl:value-of select="concat($column_width,'inch') "/></xsl:attribute>
+            </xsl:element>
+        </xsl:element>
+    </xsl:template>
+    <xsl:template match="w:trPr" mode="style">
+        <!-- to generate style:style of table-row height.  -->
+        <xsl:element name="style:style">
+            <xsl:attribute name="style:family">table-row</xsl:attribute>
+            <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single"/></xsl:attribute>
+            <xsl:element name="style:properties">
+                <xsl:choose>
+                    <xsl:when test="w:trHeight/@w:val">
+                        <xsl:variable name="tbl_row_height">
+                            <xsl:call-template name="convert2in">
+                                <xsl:with-param name="value" select="concat(w:trHeight/@w:val, 'dxa') "/>
+                            </xsl:call-template>
+                        </xsl:variable>
+                        <xsl:attribute name="style:row-height"><xsl:value-of select="concat($tbl_row_height, 'inch' )"/></xsl:attribute>
+                    </xsl:when>
+                </xsl:choose>
+            </xsl:element>
+        </xsl:element>
+    </xsl:template>
+    <xsl:template match="w:tcPr" mode="style">
+        <style:style>
+            <xsl:attribute name="style:name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single"/>C<xsl:number count="w:tc" from="/w:wordDocument/w:body" level="single"/></xsl:attribute>
+            <xsl:attribute name="style:family">table-cell</xsl:attribute>
+            <xsl:variable name="rootStyle" select="ancestor::w:tbl/w:tblPr/w:tblStyle/@w:val"/>
+            <xsl:variable name="rootStyleNode" select="/w:wordDocument/w:styles/w:style[@w:styleId = $rootStyle]"/>
+            <xsl:element name="style:properties">
+                <!-- cell background color start -->
+                <xsl:variable name="tbl_cell_background_color">
+                    <xsl:choose>
+                        <xsl:when test="w:shd/@w:fill">
+                            <xsl:value-of select="w:shd/@w:fill"/>
+                        </xsl:when>
+                        <xsl:when test="$rootStyleNode/w:tblpr/w:shd/@w:fill">
+                            <xsl:value-of select="$rootStyleNode/w:tblpr/w:shd/@w:fill"/>
+                        </xsl:when>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:attribute name="fo:background-color"><xsl:value-of select="concat('#',$tbl_cell_background_color)"/></xsl:attribute>
+                <!--cell background color end -->
+                <!-- table cell vertical alignment start -->
+                <xsl:if test="w:vAlign">
+                    <xsl:variable name="tbl_cell_alignment">
+                        <xsl:choose>
+                            <xsl:when test="w:vAlign/@w:val = 'top' ">
+                                <xsl:text>top</xsl:text>
+                            </xsl:when>
+                            <xsl:when test="w:vAlign/@w:val = 'center' ">
+                                <xsl:text>middle</xsl:text>
+                            </xsl:when>
+                            <xsl:when test="w:vAlign/@w:val = 'bottom' ">
+                                <xsl:text>bottom</xsl:text>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:text>automatic</xsl:text>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:variable>
+                    <xsl:attribute name="fo:vertical-align"><xsl:value-of select="$tbl_cell_alignment"/></xsl:attribute>
+                </xsl:if>
+                <!--table cell alignment end -->
+                <!-- cell margin start -->
+                <xsl:variable name="tblcell_leftmargin">
+                    <xsl:choose>
+                        <xsl:when test="w:tcMar/w:left">
+                            <xsl:call-template name="convert2in">
+                                <xsl:with-param name="value" select="concat(w:tcMar/w:left/@w:w , w:tcMar/w:left/@w:type) "/>
+                            </xsl:call-template>
+                        </xsl:when>
+                        <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:left">
+                            <xsl:call-template name="convert2in">
+                                <xsl:with-param name="value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:left/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:left/@w:type)"/>
+                            </xsl:call-template>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:text>0</xsl:text>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:variable name="tblcell_rightmargin">
+                    <xsl:choose>
+                        <xsl:when test="w:tcMar/w:right">
+                            <xsl:call-template name="convert2in">
+                                <xsl:with-param name="value" select="concat(w:tcMar/w:right/@w:w , w:tcMar/w:right/@w:type) "/>
+                            </xsl:call-template>
+                        </xsl:when>
+                        <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:right">
+                            <xsl:call-template name="convert2in">
+                                <xsl:with-param name="value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:right/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:right/@w:type)"/>
+                            </xsl:call-template>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:text>0</xsl:text>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:variable name="tblcell_topmargin">
+                    <xsl:choose>
+                        <xsl:when test="w:tcMar/w:top">
+                            <xsl:call-template name="convert2in">
+                                <xsl:with-param name="value" select="concat(w:tcMar/w:top/@w:w , w:tcMar/w:top/@w:type) "/>
+                            </xsl:call-template>
+                        </xsl:when>
+                        <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:top">
+                            <xsl:call-template name="convert2in">
+                                <xsl:with-param name="value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:top/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:top/@w:type)"/>
+                            </xsl:call-template>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:text>0</xsl:text>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:variable name="tblcell_bottommargin">
+                    <xsl:choose>
+                        <xsl:when test="w:tcMar/w:bottom">
+                            <xsl:call-template name="convert2in">
+                                <xsl:with-param name="value" select="concat(w:tcMar/w:bottom/@w:w , w:tcMar/w:bottom/@w:type) "/>
+                            </xsl:call-template>
+                        </xsl:when>
+                        <xsl:when test="$rootStyleNode/w:tblPr/w:tblCellMar/w:bottom">
+                            <xsl:call-template name="convert2in">
+                                <xsl:with-param name="value" select="concat($rootStyleNode/w:tblPr/w:tblCellMar/w:bottom/@w:w , $rootStyleNode/w:tblPr/w:tblCellMar/w:bottom/@w:type)"/>
+                            </xsl:call-template>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:text>0</xsl:text>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:variable>
+                <xsl:attribute name="fo:padding-left"><xsl:value-of select="concat($tblcell_leftmargin, 'inch' )"/></xsl:attribute>
+                <xsl:attribute name="fo:padding-right"><xsl:value-of select="concat($tblcell_rightmargin, 'inch' )"/></xsl:attribute>
+                <xsl:attribute name="fo:padding-top"><xsl:value-of select="concat($tblcell_topmargin, 'inch' )"/></xsl:attribute>
+                <xsl:attribute name="fo:padding-bottom"><xsl:value-of select="concat($tblcell_bottommargin, 'inch' )"/></xsl:attribute>
+                <!-- cell margin end -->
+                <xsl:variable name="row-position">
+                    <xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single"/>
+                </xsl:variable>
+                <!-- cell borders should be carefully converted. a little complex. glu :( -->
+                <xsl:variable name="Borders" select="ancestor::w:tbl/w:tblPr/w:tblBorders"/>
+                <xsl:choose>
+                    <xsl:when test="$row-position &gt; 1">
+                        <xsl:call-template name="get-table-border">
+                            <xsl:with-param name="style-pos" select="'top'"/>
+                            <xsl:with-param name="style-position-0" select="w:tcBorders/w:top"/>
+                            <xsl:with-param name="style-position-1" select="$Borders/w:insideH"/>
+                            <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideH"/>
+                        </xsl:call-template>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:call-template name="get-table-border">
+                            <xsl:with-param name="style-pos" select="'top'"/>
+                            <xsl:with-param name="style-position-0" select="w:tcBorders/w:top"/>
+                            <xsl:with-param name="style-position-1" select="$Borders/w:top"/>
+                            <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:top"/>
+                        </xsl:call-template>
+                    </xsl:otherwise>
+                </xsl:choose>
+                <xsl:choose>
+                    <xsl:when test="count(ancestor::w:tr/following-sibling::w:tr) &gt; 0">
+                        <xsl:call-template name="get-table-border">
+                            <xsl:with-param name="style-pos" select="'bottom'"/>
+                            <xsl:with-param name="style-position-0" select="w:tcBorders/w:bottom"/>
+                            <xsl:with-param name="style-position-1" select="$Borders/w:insideH"/>
+                            <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideH"/>
+                        </xsl:call-template>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:call-template name="get-table-border">
+                            <xsl:with-param name="style-pos" select="'bottom'"/>
+                            <xsl:with-param name="style-position-0" select="w:tcBorders/w:bottom"/>
+                            <xsl:with-param name="style-position-1" select="$Borders/w:bottom"/>
+                            <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:bottom"/>
+                        </xsl:call-template>
+                    </xsl:otherwise>
+                </xsl:choose>
+                <xsl:choose>
+                    <xsl:when test="count(ancestor::w:tc/preceding-sibling::w:tc) &gt; 0">
+                        <xsl:call-template name="get-table-border">
+                            <xsl:with-param name="style-pos" select="'left'"/>
+                            <xsl:with-param name="style-position-0" select="w:tcBorders/w:left"/>
+                            <xsl:with-param name="style-position-1" select="$Borders/w:insideV"/>
+                            <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideV"/>
+                        </xsl:call-template>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:call-template name="get-table-border">
+                            <xsl:with-param name="style-pos" select="'left'"/>
+                            <xsl:with-param name="style-position-0" select="w:tcBorders/w:left"/>
+                            <xsl:with-param name="style-position-1" select="$Borders/w:left"/>
+                            <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:left"/>
+                        </xsl:call-template>
+                    </xsl:otherwise>
+                </xsl:choose>
+                <xsl:choose>
+                    <xsl:when test="count(ancestor::w:tc/following-sibling::w:tc) &gt; 0">
+                        <xsl:call-template name="get-table-border">
+                            <xsl:with-param name="style-pos" select="'right'"/>
+                            <xsl:with-param name="style-position-0" select="w:tcBorders/w:right"/>
+                            <xsl:with-param name="style-position-1" select="$Borders/w:insideV"/>
+                            <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:insideV"/>
+                        </xsl:call-template>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:call-template name="get-table-border">
+                            <xsl:with-param name="style-pos" select="'right'"/>
+                            <xsl:with-param name="style-position-0" select="w:tcBorders/w:right"/>
+                            <xsl:with-param name="style-position-1" select="$Borders/w:right"/>
+                            <xsl:with-param name="style-position-2" select="$rootStyleNode/w:tblPr/w:tblBorders/w:right"/>
+                        </xsl:call-template>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:element>
+        </style:style>
+    </xsl:template>
+    <xsl:template name="get-table-border">
+        <xsl:param name="style-pos"/>
+        <xsl:param name="style-position-0"/>
+        <xsl:param name="style-position-1"/>
+        <xsl:param name="style-position-2"/>
+        <xsl:variable name="size-style">
+            <xsl:choose>
+                <xsl:when test="$style-position-0">
+                    <xsl:value-of select="$style-position-0/@w:sz"/>
+                </xsl:when>
+                <xsl:when test="$style-position-1">
+                    <xsl:value-of select="$style-position-1/@w:sz"/>
+                </xsl:when>
+                <xsl:when test="$style-position-2">
+                    <xsl:value-of select="$style-position-2/@w:sz"/>
+                </xsl:when>
+                <xsl:otherwise>2</xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="border-style">
+            <xsl:choose>
+                <xsl:when test="$style-position-0">
+                    <xsl:value-of select="$style-position-0/@w:val"/>
+                </xsl:when>
+                <xsl:when test="$style-position-1">
+                    <xsl:value-of select="$style-position-1/@w:val"/>
+                </xsl:when>
+                <xsl:when test="$style-position-2">
+                    <xsl:value-of select="$style-position-2/@w:val"/>
+                </xsl:when>
+                <xsl:otherwise>single</xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <!-- totally basic Word table border styles: nil, none, single, thick, double, dotted, dashed, dot-dash, dot-dot-dash, triple, thin-thick-small-gap, thick-thin-small-gap, thin-thick-thin-small-gap, thin-thick-medium-gap, thick-thin-medium-gap, thin-thick-thin-medium-gap, thin-thick-large-gap, thick-thin-large-gap, thin-thick-thin-large-gap, wave, double-wave, dash-small-gap, dash-dot-stroked, three-d-emboss, three-d-engrave, outset, inset. Others are advanced graphical table border styles. glu -->
+        <xsl:variable name="style-border">
+            <xsl:choose>
+                <xsl:when test="$border-style = 'nil' or $border-style ='none'">hidden</xsl:when>
+                <xsl:when test="$border-style = 'single' or $border-style = 'thick' or $border-style = 'dotted' or $border-style = 'dashed' or $border-style = 'dot-dash' or $border-style = 'dot-dot-dash' or $border-style = 'wave' or $border-style = 'dash-small-gap' or $border-style = 'dash-dot-stroked'">solid</xsl:when>
+                <xsl:otherwise>double</xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:variable name="color-border">
+            <xsl:choose>
+                <xsl:when test="$style-position-0 and string-length($style-position-0/@w:color) = 6">
+                    <xsl:value-of select="$style-position-0/@w:color"/>
+                </xsl:when>
+                <xsl:when test="$style-position-0 and $style-position-0/@w:color = 'auto' and contains($border-style, 'set')">
+                    <xsl:text>c0c0c0</xsl:text>
+                </xsl:when>
+                <xsl:when test="$style-position-1 and string-length($style-position-1/@w:color) = 6">
+                    <xsl:value-of select="$style-position-1/@w:color"/>
+                </xsl:when>
+                <xsl:when test="$style-position-1 and $style-position-1/@w:color = 'auto' and contains($border-style, 'set')">
+                    <xsl:text>c0c0c0</xsl:text>
+                </xsl:when>
+                <xsl:when test="$style-position-2 and string-length($style-position-2/@w:color) = 6">
+                    <xsl:value-of select="$style-position-2/@w:color"/>
+                </xsl:when>
+                <xsl:when test="$style-position-2 and $style-position-2/@w:color = 'auto' and contains($border-style, 'set')">
+                    <xsl:text>c0c0c0</xsl:text>
+                </xsl:when>
+                <xsl:otherwise>000000</xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <!-- mapping border line widths. glu -->
+        <xsl:choose>
+            <xsl:when test="$border-style = 'single'">
+                <xsl:choose>
+                    <xsl:when test="$size-style &lt; 7">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.002cm solid #', $color-border)"/></xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 20">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.035cm solid #', $color-border)"/></xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 30">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.088cm solid #', $color-border)"/></xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 40">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.141cm solid #', $color-border)"/></xsl:attribute>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.176cm solid #', $color-border)"/></xsl:attribute>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:when test="$border-style = 'double'">
+                <xsl:choose>
+                    <xsl:when test="$size-style &lt; 10">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.039cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 15">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.092cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 20">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.106cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.265cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:when test="$border-style = 'triple'">
+                <xsl:choose>
+                    <xsl:when test="$size-style &lt; 5">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.039cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 10">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.092cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">.002cm 0.088cm 0.002cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 15">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.106cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.265cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:when test="$border-style = 'thin-thick-small-gap' or $border-style = 'thick-thin-small-gap'">
+                <xsl:choose>
+                    <xsl:when test="($border-style = 'thin-thick-small-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-small-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+                        <xsl:choose>
+                            <xsl:when test="$size-style &lt; 20">
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.125cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:when test="$size-style &lt; 30">
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.178cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.231cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.159cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:when test="$border-style = 'thin-thick-thin-small-gap'">
+                <xsl:choose>
+                    <xsl:when test="$size-style &lt; 20">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.178cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 40">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.231cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.318cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:when test="$border-style = 'thin-thick-medium-gap' or $border-style = 'thick-thin-medium-gap'">
+                <xsl:choose>
+                    <xsl:when test="$size-style &lt; 10">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.039cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 15">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.106cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 30">
+                        <xsl:choose>
+                            <xsl:when test="($border-style = 'thin-thick-medium-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-medium-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.212cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.088cm 0.088cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.159cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.318cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:choose>
+                            <xsl:when test="($border-style = 'thin-thick-medium-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-medium-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:when test="$border-style = 'thin-thick-thin-medium-gap'">
+                <xsl:choose>
+                    <xsl:when test="$size-style &lt; 10">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.039cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.035cm 0.002cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 15">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.106cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 30">
+                        <xsl:choose>
+                            <xsl:when test="$style-pos = 'left' or $style-pos = 'top'">
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.159cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.212cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.088cm 0.088cm</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.318cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:choose>
+                            <xsl:when test="$style-pos = 'left' or $style-pos = 'top'">
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:when test="$border-style = 'thin-thick-large-gap' or $border-style = 'thick-thin-large-gap'">
+                <xsl:choose>
+                    <xsl:when test="$size-style &lt; 7">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.092cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 10">
+                        <xsl:choose>
+                            <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.125cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.092cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 15">
+                        <xsl:choose>
+                            <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.125cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.159cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 30">
+                        <xsl:choose>
+                            <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.178cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.159cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 40">
+                        <xsl:choose>
+                            <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.231cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.159cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.318cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:choose>
+                            <xsl:when test="($border-style = 'thin-thick-large-gap' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'thick-thin-large-gap' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:when test="$border-style = 'thin-thick-thin-large-gap'">
+                <xsl:choose>
+                    <xsl:when test="$size-style &lt; 5">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.125cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 10">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.178cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 20">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.231cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.318cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:when test="contains( $border-style, 'wave') or $border-style = 'dash-dot-stroked'">
+                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.106cm double #', $color-border)"/></xsl:attribute>
+                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.035cm 0.035cm 0.035cm</xsl:attribute>
+            </xsl:when>
+            <xsl:when test="contains( $border-style, 'three-d')">
+                <xsl:choose>
+                    <xsl:when test="$size-style &lt; 10">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.035cm solid #', $color-border)"/></xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 20">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.088cm solid #', $color-border)"/></xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 30">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.176cm solid #', $color-border)"/></xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 40">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.265cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.088cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.318cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:when test="contains( $border-style, 'set')">
+                <xsl:choose>
+                    <xsl:when test="$size-style &lt; 7">
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.092cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 10">
+                        <xsl:choose>
+                            <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.092cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.002cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.125cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 15">
+                        <xsl:choose>
+                            <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.159cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.125cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.035cm</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 30">
+                        <xsl:choose>
+                            <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.159cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.178cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.088cm</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:when test="$size-style &lt; 40">
+                        <xsl:choose>
+                            <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.159cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.035cm 0.035cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.231cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.002cm 0.088cm 0.141cm</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.318cm double #', $color-border)"/></xsl:attribute>
+                        <xsl:choose>
+                            <xsl:when test="($border-style = 'outset' and ($style-pos = 'left' or $style-pos = 'top')) or ($border-style = 'inset' and ($style-pos = 'right' or $style-pos = 'bottom'))">
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.141cm 0.088cm 0.088cm</xsl:attribute>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="{concat('fo:border-', $style-pos)}"><xsl:value-of select="concat('0.231cm double #', $color-border)"/></xsl:attribute>
+                                <xsl:attribute name="{concat('style:border-line-width-',$style-pos)}">0.088cm 0.088cm 0.141cm</xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                    </xsl:otherwise>
+                </xsl:choose>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:attribute name="{concat('fo:border-', $style-pos)}">0.002cm solid #000000</xsl:attribute>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <xsl:template match="w:tbl">
+        <xsl:choose>
+            <xsl:when test="w:tblPr/w:tblpPr">
+                <!-- if the table is surrounded by text then put the table into a draw:text-box -->
+                <xsl:element name="text:p">
+                    <xsl:element name="draw:text-box">
+                        <xsl:attribute name="draw:style-name"><xsl:text>TableFrame</xsl:text><xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any"/></xsl:attribute>
+                        <xsl:attribute name="draw:name">TableFr<xsl:number count="w:tblpPr" from="/w:wordDocument/w:body" level="any"/></xsl:attribute>
+                        <xsl:variable name="tbl_anchor_type">
+                            <xsl:choose>
+                                <xsl:when test="name(..) = 'w:tc' ">
+                                    <xsl:text>as-char</xsl:text>
+                                </xsl:when>
+                                <xsl:otherwise>
+                                    <xsl:text>paragraph</xsl:text>
+                                </xsl:otherwise>
+                            </xsl:choose>
+                        </xsl:variable>
+                        <xsl:attribute name="text:anchor-type"><xsl:value-of select="$tbl_anchor_type"/></xsl:attribute>
+                        <xsl:variable name="tbl_draw_textbox_width">
+                            <xsl:call-template name="convert2in">
+                                <!--  adjust the width of draw:text-box containing a table with 20dxa + table-width -->
+                                <xsl:with-param name="value" select="concat(string(number(sum(w:tblGrid/w:gridCol/@w:w) +20)), 'dxa' )"/>
+                            </xsl:call-template>
+                        </xsl:variable>
+                        <xsl:attribute name="svg:width"><xsl:value-of select="concat ($tbl_draw_textbox_width, 'inch') "/></xsl:attribute>
+                        <xsl:if test="w:tblPr/w:tblpPr/@w:tblpX">
+                            <xsl:variable name="x_distance_from_anchor">
+                                <xsl:call-template name="convert2in">
+                                    <xsl:with-param name="value" select="concat(w:tblPr/w:tblpPr/@w:tblpX, 'dxa' ) "/>
+                                </xsl:call-template>
+                            </xsl:variable>
+                            <xsl:attribute name="svg:x"><xsl:value-of select="concat ($x_distance_from_anchor, 'inch' )"/></xsl:attribute>
+                        </xsl:if>
+                        <xsl:if test="w:tblPr/w:tblpPr/@w:tblpY">
+                            <xsl:variable name="y_distance_from_anchor">
+                                <xsl:call-template name="convert2in">
+                                    <xsl:with-param name="value" select="concat(w:tblPr/w:tblpPr/@w:tblpY, 'dxa' ) "/>
+                                </xsl:call-template>
+                            </xsl:variable>
+                            <xsl:attribute name="svg:y"><xsl:value-of select="concat ($y_distance_from_anchor, 'inch' )"/></xsl:attribute>
+                        </xsl:if>
+                        <!--create table in draw:text-box to produce table wrapping text effect-->
+                        <xsl:element name="table:table">
+                            <xsl:if test="w:tblPr">
+                                <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any"/></xsl:attribute>
+                            </xsl:if>
+                            <xsl:apply-templates select="w:tblGrid | w:tr"/>
+                        </xsl:element>
+                    </xsl:element>
+                    <!--draw:text-box end  -->
+                </xsl:element>
+                <!-- text:p end -->
+            </xsl:when>
+            <xsl:otherwise>
+                <!-- if the table is not surrounded by text then put the table into a draw:text-box -->
+                <xsl:element name="table:table">
+                    <xsl:if test="w:tblPr">
+                        <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any"/></xsl:attribute>
+                    </xsl:if>
+                    <xsl:apply-templates select="w:tblGrid | w:tr"/>
+                </xsl:element>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <xsl:template match="w:tblGrid">
+        <xsl:apply-templates select="w:gridCol"/>
+    </xsl:template>
+    <xsl:template match="w:gridCol">
+        <xsl:element name="table:table-column">
+            <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any"/>.C<xsl:number count="w:gridCol" from="/w:wordDocument/w:body" level="single"/></xsl:attribute>
+        </xsl:element>
+    </xsl:template>
+    <xsl:template match="w:tr">
+        <xsl:element name="table:table-row">
+            <!-- generate row in table and add attribute of table:style-name if the style:style exists. cp tom chen. -->
+            <xsl:if test="w:trPr/w:trHeight">
+                <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single"/></xsl:attribute>
+            </xsl:if>
+            <xsl:apply-templates select="w:tc"/>
+        </xsl:element>
+    </xsl:template>
+    <xsl:template match="w:tc">
+        <xsl:element name="table:table-cell">
+            <xsl:attribute name="table:style-name">Table<xsl:number count="w:tbl" from="/w:wordDocument/w:body" level="any"/>.R<xsl:number count="w:tr" from="/w:wordDocument/w:body" level="single"/>C<xsl:number count="w:tc" from="/w:wordDocument/w:body" level="single"/></xsl:attribute>
+            <xsl:if test="w:tcPr/w:gridSpan">
+                <xsl:attribute name="table:number-columns-spanned"><xsl:value-of select="w:tcPr/w:gridSpan/@w:val"/></xsl:attribute>
+            </xsl:if>
+            <xsl:apply-templates select="w:p | w:tbl"/>
+        </xsl:element>
+    </xsl:template>
+<!-- End of OOo2.0 import/wordml/wordml2ooo_table.xsl stylesheet  -->
+<!-- Start of OOo2.0 import/wordml/wordml2ooo_text.xsl stylesheet  -->
+    <xsl:template name="create-default-paragraph-styles">
+        <xsl:variable name="default-paragraph-style" select="w:style[@w:default = 'on' and @w:type = 'paragraph']"/>
+        <xsl:if test="$default-paragraph-style">
+            <style:default-style style:family="paragraph">
+                <style:properties>
+                    <xsl:choose>
+                        <xsl:when test="/w:wordDocument/w:fonts/w:defaultFonts">
+                            <xsl:attribute name="style:font-name"><xsl:value-of select="/w:wordDocument/w:fonts/w:defaultFonts/@w:ascii"/></xsl:attribute>
+                            <xsl:attribute name="style:font-name-asian"><xsl:value-of select="/w:wordDocument/w:fonts/w:defaultFonts/@w:fareast"/></xsl:attribute>
+                            <xsl:attribute name="style:font-name-complex"><xsl:value-of select="/w:wordDocument/w:fonts/w:defaultFonts/@w:cs"/></xsl:attribute>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:attribute name="style:font-name">Times New Roman</xsl:attribute>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                    <xsl:if test="$default-paragraph-style/w:rPr/w:sz">
+                        <xsl:attribute name="fo:font-size"><xsl:value-of select="$default-paragraph-style/w:rPr/w:sz/@w:val div 2"/>pt</xsl:attribute>
+                        <xsl:attribute name="fo:font-size-asian"><xsl:value-of select="$default-paragraph-style/w:rPr/w:sz/@w:val div 2"/>pt</xsl:attribute>
+                    </xsl:if>
+                    <xsl:if test="$default-paragraph-style/w:rPr/w:sz-cs">
+                        <xsl:attribute name="fo:font-size-complex"><xsl:value-of select="$default-paragraph-style/w:rPr/w:sz-cs/@w:val div 2"/>pt</xsl:attribute>
+                    </xsl:if>
+                    <!-- if not defined default font size in Word, make it out as 10pt. glu -->
+                    <xsl:if test="not($default-paragraph-style/w:rPr/w:sz or w:rPr/w:sz-cs)">
+                        <xsl:attribute name="fo:font-size">10pt</xsl:attribute>
+                        <xsl:attribute name="fo:font-size-asian">10pt</xsl:attribute>
+                        <xsl:attribute name="fo:font-size-complex">10pt</xsl:attribute>
+                    </xsl:if>
+                    <xsl:if test="$default-paragraph-style/w:rPr/w:lang">
+                        <xsl:if test="$default-paragraph-style/w:rPr/w:lang/@w:val">
+                            <xsl:attribute name="fo:language"><xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/></xsl:attribute>
+                            <xsl:attribute name="fo:country"><xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:val, '-')"/></xsl:attribute>
+                        </xsl:if>
+                        <xsl:if test="$default-paragraph-style/w:rPr/w:lang/@w:fareast">
+                            <xsl:attribute name="fo:language-asian"><xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/></xsl:attribute>
+                            <xsl:attribute name="fo:country-asian"><xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:fareast, '-')"/></xsl:attribute>
+                        </xsl:if>
+                        <xsl:if test="$default-paragraph-style/w:rPr/w:lang/@w:bidi">
+                            <xsl:attribute name="fo:language-complex"><xsl:value-of select="substring-before( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/></xsl:attribute>
+                            <xsl:attribute name="fo:country-complex"><xsl:value-of select="substring-after( $default-paragraph-style/w:rPr/w:lang/@w:bidi, '-')"/></xsl:attribute>
+                        </xsl:if>
+                    </xsl:if>
+                    <xsl:attribute name="style:tab-stop-distance"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(/w:wordDocument/w:docPr/w:defaultTabStop/@w:val,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                </style:properties>
+            </style:default-style>
+        </xsl:if>
+    </xsl:template>
+    <xsl:template name="create-default-text-styles">
+        <style:style style:name="Numbering Symbols" style:family="text"/>
+        <style:style style:name="Bullet Symbols" style:family="text">
+            <style:properties style:font-name="StarSymbol" fo:font-size="12pt" style:font-name-asian="StarSymbol" style:font-size-asian="12pt" style:font-name-complex="StarSymbol" style:font-size-complex="12pt"/>
+        </style:style>
+    </xsl:template>
+    <xsl:template match="w:p" mode="style">
+        <xsl:variable name="paragraph-number">
+            <xsl:number from="/w:wordDocument/w:body" level="any" count="w:p"/>
+        </xsl:variable>
+        <xsl:variable name="section-property-number" select="count(preceding::w:sectPr)"/>
+        <xsl:variable name="last-section-property" select="preceding::w:pPr/w:sectPr[1]"/>
+        <style:style style:family="paragraph" style:name="P{$paragraph-number}">
+            <xsl:if test="w:pPr/w:pStyle">
+                <xsl:attribute name="style:parent-style-name"><xsl:value-of select="w:pPr/w:pStyle/@w:val"/></xsl:attribute>
+            </xsl:if>
+            <xsl:choose>
+                <xsl:when test="generate-id($last-section-property[last()]/following::w:p[1]) = generate-id(.) and not(ancestor::w:sectPr)">
+                    <xsl:attribute name="style:master-page-name">Standard<xsl:value-of select="$section-property-number + 1"/></xsl:attribute>
+                </xsl:when>
+                <xsl:when test="$paragraph-number = 1">
+                    <xsl:attribute name="style:master-page-name">Standard1</xsl:attribute>
+                </xsl:when>
+            </xsl:choose>
+            <style:properties>
+                <xsl:apply-templates select="w:pPr"/>
+            </style:properties>
+        </style:style>
+        <xsl:if test="w:r/w:br/@w:type='page'">
+            <style:style style:family="paragraph" style:name="P{$paragraph-number}page-break">
+                <xsl:if test="w:pPr/w:pStyle">
+                    <xsl:attribute name="style:parent-style-name"><xsl:value-of select="w:pPr/w:pStyle/@w:val"/></xsl:attribute>
+                </xsl:if>
+                <xsl:choose>
+                    <xsl:when test="generate-id($last-section-property[last()]/following::w:p[1]) = generate-id(.) and not(ancestor::w:sectPr)">
+                        <xsl:attribute name="style:master-page-name">Standard<xsl:value-of select="$section-property-number + 1"/></xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$paragraph-number = 1">
+                        <xsl:attribute name="style:master-page-name">Standard1</xsl:attribute>
+                    </xsl:when>
+                </xsl:choose>
+                <style:properties fo:break-before="page">
+                    <xsl:apply-templates select="w:pPr"/>
+                </style:properties>
+            </style:style>
+        </xsl:if>
+        <xsl:if test="w:r/w:br/@w:type='column'">
+            <style:style style:family="paragraph" style:name="P{$paragraph-number}column-break">
+                <xsl:if test="w:pPr/w:pStyle">
+                    <xsl:attribute name="style:parent-style-name"><xsl:value-of select="w:pPr/w:pStyle/@w:val"/></xsl:attribute>
+                </xsl:if>
+                <xsl:choose>
+                    <xsl:when test="generate-id($last-section-property[last()]/following::w:p[1]) = generate-id(.) and not(ancestor::w:sectPr)">
+                        <xsl:attribute name="style:master-page-name">Standard<xsl:value-of select="$section-property-number + 1"/></xsl:attribute>
+                    </xsl:when>
+                    <xsl:when test="$paragraph-number = 1">
+                        <xsl:attribute name="style:master-page-name">Standard1</xsl:attribute>
+                    </xsl:when>
+                </xsl:choose>
+                <style:properties fo:break-before="column">
+                    <xsl:apply-templates select="w:pPr"/>
+                </style:properties>
+            </style:style>
+        </xsl:if>
+    </xsl:template>
+    <xsl:template match="w:pPr">
+        <xsl:if test="w:ind/@w:left">
+            <xsl:attribute name="fo:margin-left"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:ind/@w:left, 'dxa')"/></xsl:call-template>cm</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:ind/@w:right">
+            <xsl:attribute name="fo:margin-right"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:ind/@w:right, 'dxa')"/></xsl:call-template>cm</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:ind/@w:first-line">
+            <xsl:attribute name="fo:text-indent"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:ind/@w:first-line, 'dxa')"/></xsl:call-template>cm</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:ind/@w:hanging">
+            <xsl:attribute name="fo:text-indent"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat('-',w:ind/@w:hanging, 'dxa')"/></xsl:call-template>cm</xsl:attribute>
+        </xsl:if>
+        <!-- bi-directional support-->
+        <xsl:if test="w:bidi">
+            <xsl:attribute name="style:writing-mode">rl-tb</xsl:attribute>
+            <xsl:attribute name="fo:text-align">end</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:jc">
+            <xsl:choose>
+                <xsl:when test="w:jc/@w:val = 'center'">
+                    <xsl:attribute name="fo:text-align">center</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:jc/@w:val = 'left'">
+                    <xsl:choose>
+                        <xsl:when test="w:bidi">
+                            <xsl:attribute name="fo:text-align">end</xsl:attribute>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:attribute name="fo:text-align">start</xsl:attribute>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:when>
+                <xsl:when test="w:jc/@w:val = 'right'">
+                    <xsl:choose>
+                        <xsl:when test="w:bidi">
+                            <xsl:attribute name="fo:text-align">start</xsl:attribute>
+                        </xsl:when>
+                        <xsl:otherwise>
+                            <xsl:attribute name="fo:text-align">end</xsl:attribute>
+                        </xsl:otherwise>
+                    </xsl:choose>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:attribute name="fo:text-align">justify</xsl:attribute>
+                    <xsl:attribute name="style:justify-single-word">false</xsl:attribute>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:if>
+        <xsl:attribute name="style:auto-text-indent">false</xsl:attribute>
+        <xsl:if test="w:spacing">
+            <xsl:choose>
+                <xsl:when test="w:spacing/@w:line-rule = 'at-least'">
+                    <xsl:attribute name="style:line-height-at-least"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:spacing/@w:line, 'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:spacing/@w:line-rule = 'auto'">
+                    <xsl:attribute name="fo:line-height"><xsl:value-of select="round(w:spacing/@w:line div 240 * 100)"/>%</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:spacing/@w:line-rule = 'exact'">
+                    <xsl:attribute name="fo:line-height"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:spacing/@w:line, 'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                </xsl:when>
+            </xsl:choose>
+            <xsl:if test="w:spacing/@w:before">
+                <xsl:attribute name="fo:margin-top"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:spacing/@w:before, 'dxa')"/></xsl:call-template>cm</xsl:attribute>
+            </xsl:if>
+            <xsl:if test="w:spacing/@w:after">
+                <xsl:attribute name="fo:margin-bottom"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:spacing/@w:after, 'dxa')"/></xsl:call-template>cm</xsl:attribute>
+            </xsl:if>
+        </xsl:if>
+        <xsl:if test="w:shd">
+            <xsl:variable name="background-color">
+                <xsl:choose>
+                    <xsl:when test="string-length(w:shd/@w:fill) = 6">
+                        <xsl:value-of select="concat('#', w:shd/@w:fill)"/>
+                    </xsl:when>
+                    <xsl:otherwise>#000000</xsl:otherwise>
+                </xsl:choose>
+            </xsl:variable>
+            <xsl:choose>
+                <xsl:when test="w:shd/@w:val = 'solid'">
+                    <xsl:attribute name="fo:background-color"><xsl:value-of select="$background-color"/></xsl:attribute>
+                </xsl:when>
+                <!-- patterns are necessary in the future. glu -->
+                <xsl:otherwise/>
+            </xsl:choose>
+        </xsl:if>
+        <xsl:if test="w:pageBreakBefore">
+            <xsl:attribute name="fo:break-before">page</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:tabs">
+            <xsl:element name="style:tab-stops">
+                <xsl:for-each select="w:tabs/w:tab">
+                    <xsl:element name="style:tab-stop">
+                        <xsl:attribute name="style:position"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(@w:pos, 'dxa')"/></xsl:call-template>cm</xsl:attribute>
+                        <xsl:choose>
+                            <xsl:when test="@w:val = 'decimal'">
+                                <xsl:attribute name="style:type">char</xsl:attribute>
+                                <xsl:attribute name="style:char"/>
+                            </xsl:when>
+                            <xsl:otherwise>
+                                <xsl:attribute name="style:type"><xsl:value-of select="@w:val"/></xsl:attribute>
+                            </xsl:otherwise>
+                        </xsl:choose>
+                        <xsl:if test="@w:leader">
+                            <xsl:attribute name="style:leader-char"><xsl:choose><xsl:when test="hyphen">-</xsl:when><xsl:when test="underscore">_</xsl:when><xsl:when test="dot">.</xsl:when></xsl:choose></xsl:attribute>
+                        </xsl:if>
+                        <xsl:if test="@style:leader-char">
+                            <xsl:choose>
+                                <xsl:when test="@style:leader-char='-'">
+                                    <xsl:attribute name="w:leader">hyphen</xsl:attribute>
+                                </xsl:when>
+                                <xsl:when test="@style:leader-char='_'">
+                                    <xsl:attribute name="w:leader">underscore</xsl:attribute>
+                                </xsl:when>
+                                <xsl:when test="@style:leader-char='.'">
+                                    <xsl:attribute name="w:leader">dot</xsl:attribute>
+                                </xsl:when>
+                                <xsl:when test="@style:leader-char='·'">
+                                    <xsl:attribute name="w:leader">middle-dot</xsl:attribute>
+                                </xsl:when>
+                            </xsl:choose>
+                        </xsl:if>
+                    </xsl:element>
+                </xsl:for-each>
+            </xsl:element>
+        </xsl:if>
+        <xsl:if test="w:keepNext">
+            <xsl:attribute name="fo:keep-with-next">true</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:keepLines">
+            <xsl:attribute name="style:break-inside">avoid</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:widowControl='on'">
+            <xsl:attribute name="fo:widows">2</xsl:attribute>
+            <xsl:attribute name="fo:orphans">2</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:suppressAutoHyphens">
+            <xsl:attribute name="fo:hyphenate">false</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:kinsoku/@w:val='off'">
+            <xsl:attribute name="style:line-break">normal</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:overflowPunct/@w:val='off'">
+            <xsl:attribute name="style:punctuation-wrap">simple</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:autoSpaceDE/@w:val='off' or w:autoSpaceDN/@w:val='off'">
+            <xsl:attribute name="style:text-autospace">none</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:textAlignment">
+            <xsl:choose>
+                <xsl:when test="w:textAlignment/@w:val='center'">
+                    <xsl:attribute name="style:vertical-align">middle</xsl:attribute>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:attribute name="style:vertical-align"><xsl:value-of select="w:textAlignment/@w:val"/></xsl:attribute>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:if>
+        <xsl:if test="w:pBdr">
+            <xsl:if test="w:pBdr/w:top">
+                <xsl:call-template name="get-table-border">
+                    <xsl:with-param name="style-pos" select="'top'"/>
+                    <xsl:with-param name="style-position-0" select="w:pBdr/w:top"/>
+                </xsl:call-template>
+                <xsl:attribute name="fo:padding-top"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pBdr/w:top/@w:space,'pt')"/></xsl:call-template>cm</xsl:attribute>
+            </xsl:if>
+            <xsl:if test="w:pBdr/w:left">
+                <xsl:call-template name="get-table-border">
+                    <xsl:with-param name="style-pos" select="'left'"/>
+                    <xsl:with-param name="style-position-0" select="w:pBdr/w:left"/>
+                </xsl:call-template>
+                <xsl:attribute name="fo:padding-left"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pBdr/w:left/@w:space,'pt')"/></xsl:call-template>cm</xsl:attribute>
+            </xsl:if>
+            <xsl:if test="w:pBdr/w:right">
+                <xsl:call-template name="get-table-border">
+                    <xsl:with-param name="style-pos" select="'right'"/>
+                    <xsl:with-param name="style-position-0" select="w:pBdr/w:right"/>
+                </xsl:call-template>
+                <xsl:attribute name="fo:padding-right"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pBdr/w:right/@w:space,'pt')"/></xsl:call-template>cm</xsl:attribute>
+            </xsl:if>
+            <xsl:if test="w:pBdr/w:bottom">
+                <xsl:call-template name="get-table-border">
+                    <xsl:with-param name="style-pos" select="'bottom'"/>
+                    <xsl:with-param name="style-position-0" select="w:pBdr/w:bottom"/>
+                </xsl:call-template>
+                <xsl:attribute name="fo:padding-bottom"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:pBdr/w:bottom/@w:space,'pt')"/></xsl:call-template>cm</xsl:attribute>
+            </xsl:if>
+            <xsl:if test="w:pBdr/*/@w:shadow='on'">
+                <xsl:attribute name="style:shadow">#000000 0.15cm 0.15cm</xsl:attribute>
+            </xsl:if>
+        </xsl:if>
+         <xsl:if test="w:snapToGrid/@w:val='off'">
+            <xsl:attribute name="style:snap-to-layout-grid">false</xsl:attribute>
+        </xsl:if>
+        <xsl:apply-templates select="w:rPr"/>
+    </xsl:template>
+    <xsl:template match="w:rPr" mode="style">
+        <xsl:element name="style:style">
+            <xsl:attribute name="style:name">T<xsl:number from="/w:wordDocument/w:body" level="any" count="w:rPr"/></xsl:attribute>
+            <xsl:attribute name="style:family">text</xsl:attribute>
+            <xsl:if test="w:rStyle">
+                <xsl:attribute name="style:parent-style-name"><xsl:value-of select="w:rStyle/@w:val"/></xsl:attribute>
+            </xsl:if>
+            <xsl:element name="style:properties">
+                <xsl:apply-templates select="current()"/>
+            </xsl:element>
+        </xsl:element>
+    </xsl:template>
+    <xsl:template match="w:rPr">
+        <xsl:if test="w:rFonts">
+            <xsl:if test="w:rFonts/@w:ascii">
+                <xsl:attribute name="style:font-name"><xsl:value-of select="w:rFonts/@w:ascii"/></xsl:attribute>
+                <xsl:if test="ancestor::w:body">
+                    <xsl:attribute name="style:font-name-asian"><xsl:value-of select="w:rFonts/@w:ascii"/></xsl:attribute>
+                    <xsl:attribute name="style:font-name-complex"><xsl:value-of select="w:rFonts/@w:ascii"/></xsl:attribute>
+                </xsl:if>
+            </xsl:if>
+            <xsl:if test="ancestor::w:styles">
+                <xsl:if test="w:rFonts/@w:fareast">
+                    <xsl:attribute name="style:font-name-asian"><xsl:value-of select="w:rFonts/@w:fareast"/></xsl:attribute>
+                </xsl:if>
+                <xsl:if test="w:rFonts/@w:cs">
+                    <xsl:attribute name="style:font-name-complex"><xsl:value-of select="w:rFonts/@w:cs"/></xsl:attribute>
+                </xsl:if>
+            </xsl:if>
+        </xsl:if>
+        <xsl:if test="w:b">
+            <xsl:attribute name="fo:font-weight">bold</xsl:attribute>
+            <xsl:attribute name="fo:font-weight-asian">bold</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:b-cs">
+            <xsl:attribute name="fo:font-weight-complex">bold</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:i">
+            <xsl:attribute name="fo:font-style">italic</xsl:attribute>
+            <xsl:attribute name="fo:font-style-asian">italic</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:i-cs">
+            <xsl:attribute name="fo:font-style-complex">italic</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:caps">
+            <xsl:attribute name="fo:text-transform">uppercase</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:smallCaps">
+            <xsl:attribute name="fo:font-variant">small-caps</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:strike">
+            <xsl:attribute name="style:text-crossing-out">single-line</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:dstrike">
+            <xsl:attribute name="style:text-crossing-out">double-line</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:outline">
+            <xsl:attribute name="style:text-outline">true</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:shadow">
+            <xsl:attribute name="style:text-shadow">1pt 1pt</xsl:attribute>
+            <xsl:attribute name="fo:text-shadow">1pt 1pt</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:imprint">
+            <xsl:attribute name="style:font-relief">engraved</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:emboss">
+            <xsl:attribute name="style:font-relief">embossed</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:vanish">
+            <xsl:attribute name="text:display">true</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:color[not(@w:val = 'auto')]">
+            <xsl:attribute name="fo:color">#<xsl:value-of select="w:color/@w:val"/></xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:spacing">
+            <xsl:attribute name="fo:letter-spacing"><xsl:call-template name="convert2cm"><xsl:with-param name="value" select="concat(w:spacing/@w:val,'dxa')"/></xsl:call-template>cm</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:w/@w:val">
+            <xsl:attribute name="style:text-scale"><xsl:value-of select="w:w/@w:val"/></xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:vertAlign or w:position">
+            <xsl:variable name="height">
+                <xsl:choose>
+                    <xsl:when test="w:vertAlign[@w:val = 'superscript' or @w:val = 'subscript']">58%</xsl:when>
+                    <xsl:otherwise>100%</xsl:otherwise>
+                </xsl:choose>
+            </xsl:variable>
+            <xsl:variable name="position">
+                <xsl:choose>
+                    <xsl:when test="w:position">
+                        <!-- con't get font height easily, so just set w:val as percentage. glu -->
+                        <xsl:value-of select="concat( w:position/@w:val, '%')"/>
+                    </xsl:when>
+                    <xsl:when test="w:vertAlign[@w:val = 'superscript']">super</xsl:when>
+                    <xsl:when test="w:vertAlign[@w:val = 'subscript']">sub</xsl:when>
+                </xsl:choose>
+            </xsl:variable>
+            <xsl:attribute name="style:text-position"><xsl:value-of select="concat($position, ' ', $height)"/></xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:sz">
+            <xsl:attribute name="fo:font-size"><xsl:value-of select="w:sz/@w:val div 2"/>pt</xsl:attribute>
+            <xsl:attribute name="fo:font-size-asian"><xsl:value-of select="w:sz/@w:val div 2"/>pt</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:sz-cs">
+            <xsl:attribute name="fo:font-size-complex"><xsl:value-of select="w:sz-cs/@w:val div 2"/>pt</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:highlight">
+            <xsl:choose>
+                <xsl:when test="w:highlight/@w:val='black'">
+                    <xsl:attribute name="style:text-background-color">#000000</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:highlight/@w:val='yellow'">
+                    <xsl:attribute name="style:text-background-color">#ffff00</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:highlight/@w:val='green'">
+                    <xsl:attribute name="style:text-background-color">#00ff00</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:highlight/@w:val='cyan'">
+                    <xsl:attribute name="style:text-background-color">#00ffff</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:highlight/@w:val='magenta'">
+                    <xsl:attribute name="style:text-background-color">#ff00ff</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:highlight/@w:val='blue'">
+                    <xsl:attribute name="style:text-background-color">#0000ff</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:highlight/@w:val='red'">
+                    <xsl:attribute name="style:text-background-color">#ff0000</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:highlight/@w:val='dark-blue'">
+                    <xsl:attribute name="style:text-background-color">#000080</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:highlight/@w:val='dark-cyan'">
+                    <xsl:attribute name="style:text-background-color">#008080</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:highlight/@w:val='dark-green'">
+                    <xsl:attribute name="style:text-background-color">#008000</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:highlight/@w:val='dark-magenta'">
+                    <xsl:attribute name="style:text-background-color">#800080</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:highlight/@w:val='dark-red'">
+                    <xsl:attribute name="style:text-background-color">#800000</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:highlight/@w:val='dark-yellow'">
+                    <xsl:attribute name="style:text-background-color">#808000</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:highlight/@w:val='dark-gray'">
+                    <xsl:attribute name="style:text-background-color">#808080</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:highlight/@w:val='light-gray'">
+                    <xsl:attribute name="style:text-background-color">#c0c0c0</xsl:attribute>
+                </xsl:when>
+            </xsl:choose>
+        </xsl:if>
+        <xsl:if test="w:u">
+            <xsl:choose>
+                <xsl:when test="w:u/@w:val = 'words'">
+                    <xsl:attribute name="style:text-underline">single</xsl:attribute>
+                    <xsl:attribute name="fo:score-spaces">false</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:u/@w:val = 'thick'">
+                    <xsl:attribute name="style:text-underline">bold</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:u/@w:val = 'dotted-heavy'">
+                    <xsl:attribute name="style:text-underline">bold-dotted</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:u/@w:val = 'dashed-heavy'">
+                    <xsl:attribute name="style:text-underline">bold-dash</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:u/@w:val = 'dash-long'">
+                    <xsl:attribute name="style:text-underline">long-dash</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:u/@w:val = 'dash-long-heavy'">
+                    <xsl:attribute name="style:text-underline">bold-long-dash</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:u/@w:val = 'dash-dot-heavy'">
+                    <xsl:attribute name="style:text-underline">bold-dot-dash</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:u/@w:val = 'dash-dot-dot-heavy'">
+                    <xsl:attribute name="style:text-underline">bold-dot-dot-dash</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:u/@w:val = 'wavy-heavy'">
+                    <xsl:attribute name="style:text-underline">bold-wave</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:u/@w:val = 'wavy-double'">
+                    <xsl:attribute name="style:text-underline">double-wave</xsl:attribute>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:attribute name="style:text-underline"><xsl:value-of select="w:u/@w:val"/></xsl:attribute>
+                </xsl:otherwise>
+            </xsl:choose>
+            <xsl:if test="w:u/@w:color and not(w:u/@w:color = 'auto')">
+                <xsl:attribute name="style:text-underline-color">#<xsl:value-of select="w:u/@w:color"/></xsl:attribute>
+            </xsl:if>
+        </xsl:if>
+        <xsl:if test="w:effect[@w:val = 'blink-background']">
+            <xsl:attribute name="style:text-blinking">true</xsl:attribute>
+            <xsl:attribute name="style:text-background-color">#000000</xsl:attribute>
+        </xsl:if>
+        <xsl:if test="w:shd and not(w:highlight)">
+            <xsl:if test="string-length(w:shd/@w:fill) = 6">
+                <xsl:attribute name="style:text-background-color">#<xsl:value-of select="w:shd/@w:fill"/></xsl:attribute>
+            </xsl:if>
+        </xsl:if>
+        <xsl:if test="w:em">
+            <xsl:choose>
+                <xsl:when test="w:em/@w:val = 'comma'">
+                    <xsl:attribute name="style:text-emphasize">accent below</xsl:attribute>
+                </xsl:when>
+                <xsl:when test="w:em/@w:val = 'under-dot'">
+                    <xsl:attribute name="style:text-emphasize">disc below</xsl:attribute>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:attribute name="style:text-emphasize"><xsl:value-of select="concat( w:em/@w:val, ' below')"/></xsl:attribute>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:if>
+        <xsl:if test="w:lang">
+            <xsl:if test="w:lang/@w:val">
+                <xsl:attribute name="fo:language"><xsl:value-of select="substring-before( w:lang/@w:val, '-')"/></xsl:attribute>
+                <xsl:attribute name="fo:country"><xsl:value-of select="substring-after( w:lang/@w:val, '-')"/></xsl:attribute>
+            </xsl:if>
+            <xsl:if test="w:lang/@w:fareast">
+                <xsl:attribute name="fo:language-asian"><xsl:value-of select="substring-before( w:lang/@w:fareast, '-')"/></xsl:attribute>
+                <xsl:attribute name="fo:country-asian"><xsl:value-of select="substring-after( w:lang/@w:fareast, '-')"/></xsl:attribute>
+            </xsl:if>
+            <xsl:if test="w:lang/@w:bidi">
+                <xsl:attribute name="fo:language-complex"><xsl:value-of select="substring-before( w:lang/@w:bidi, '-')"/></xsl:attribute>
+                <xsl:attribute name="fo:country-complex"><xsl:value-of select="substring-after( w:lang/@w:bidi, '-')"/></xsl:attribute>
+            </xsl:if>
+        </xsl:if>
+    </xsl:template>
+    <xsl:template match="w:p">
+        <xsl:choose>
+            <!-- because word treats page breaks as separate tags, we must split some paragraphs up so that we can 
+			give the sub para a fo:break-before ="page" or column attribute. -->
+            <xsl:when test="w:r[w:br/@w:type='page' or w:br/@w:type='column']">
+                <xsl:call-template name="process-breaks-in-paragraph"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:call-template name="process-common-paragraph"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <xsl:template name="process-breaks-in-paragraph">
+        <xsl:variable name="textruns-with-break" select="w:r[w:br/@w:type='page' or w:br/@w:type='column']"/>
+        <xsl:call-template name="create-sub-paragraph">
+            <xsl:with-param name="textruns" select="$textruns-with-break[1]/preceding-sibling::w:r"/>
+        </xsl:call-template>
+        <xsl:for-each select="$textruns-with-break">
+            <xsl:variable name="break-position" select="position()"/>
+            <xsl:call-template name="create-sub-paragraph">
+                <xsl:with-param name="textruns" select="following-sibling::w:r[not(w:br/@w:type='page' or w:br/@w:type='column') and (count(preceding::w:r[w:br/@w:type='page' or w:br/@w:type='column']) = $break-position)]"/>
+                <xsl:with-param name="textruns-with-break" select="current()"/>
+            </xsl:call-template>
+        </xsl:for-each>
+    </xsl:template>
+    <xsl:template name="create-sub-paragraph">
+        <xsl:param name="textruns"/>
+        <xsl:param name="textruns-with-break"/>
+        <xsl:if test="$textruns or $textruns-with-break">
+            <xsl:variable name="curr-num">
+                <xsl:number from="/w:wordDocument/w:body" level="any" count="w:p"/>
+            </xsl:variable>
+            <text:p>
+                <xsl:choose>
+                    <xsl:when test="$textruns-with-break">
+                        <xsl:attribute name="text:style-name"><xsl:value-of select="concat('P',$curr-num,w:br/@w:type, '-break')"/></xsl:attribute>
+                        <xsl:apply-templates select="$textruns-with-break"/>
+                    </xsl:when>
+                    <xsl:otherwise>
+                        <xsl:attribute name="text:style-name"><xsl:value-of select="concat( 'P', $curr-num)"/></xsl:attribute>
+                    </xsl:otherwise>
+                </xsl:choose>
+                <xsl:if test="$textruns">
+                    <xsl:apply-templates select="$textruns"/>
+                </xsl:if>
+            </text:p>
+        </xsl:if>
+    </xsl:template>
+    <xsl:template name="process-common-paragraph">
+        <xsl:variable name="heading-or-paragraph">
+            <xsl:choose>
+                <xsl:when test="key('heading-style', w:pPr/w:pStyle/@w:val)">text:h</xsl:when>
+                <xsl:otherwise>text:p</xsl:otherwise>
+            </xsl:choose>
+        </xsl:variable>
+        <xsl:element name="{$heading-or-paragraph}">
+            <xsl:if test="$heading-or-paragraph = 'text:h'">
+                <xsl:attribute name="text:level"><xsl:value-of select="key('heading-style',w:pPr/w:pStyle/@w:val)/w:pPr/w:outlineLvl/@w:val + 1"/></xsl:attribute>
+            </xsl:if>
+            <xsl:variable name="curr-num">
+                <xsl:number from="/w:wordDocument/w:body" level="any" count="w:p"/>
+            </xsl:variable>
+            <xsl:attribute name="text:style-name"><xsl:value-of select="concat( 'P', $curr-num)"/></xsl:attribute>
+            <!-- call the template to generate bookmark-start matching nodes before current. cp tom chen. -->
+            <xsl:variable name="bm-node" select="preceding::aml:annotation[@w:type = 'Word.Bookmark.Start']"/>
+            <xsl:variable name="wp-node" select="preceding::w:p[1]"/>
+            <xsl:call-template name="start-end-bookmark">
+                <xsl:with-param name="type" select="'start'"/>
+                <xsl:with-param name="bm-node" select="$bm-node"/>
+                <xsl:with-param name="wp-node" select="$wp-node"/>
+            </xsl:call-template>
+            <xsl:apply-templates select=".//w:r | w:fldSimple | w:hlink"/>
+            <xsl:variable name="bm-node2" select="following::aml:annotation[@w:type = 'Word.Bookmark.End']"/>
+            <xsl:variable name="wp-node2" select="following::w:p[position() = 1]"/>
+            <xsl:call-template name="start-end-bookmark">
+                <xsl:with-param name="type" select="'end'"/>
+                <xsl:with-param name="bm-node" select="$bm-node2"/>
+                <xsl:with-param name="wp-node" select="$wp-node2"/>
+            </xsl:call-template>
+        </xsl:element>
+    </xsl:template>
+    <!-- WordML contains multiple w:t within one w:r, so in Star Writer text:span should correspond to w:t glu -->
+    <xsl:template match="w:r">
+        <!-- handling another type of Hyperlink address in w:body.cp tom chen. 
+            Acutally they're from Field features, a complex one. glu 
+            <xsl:when test="w:r/w:instrText and contains(w:r/w:instrText , 'HYPERLINK')">
+                <xsl:variable name="hyper-str" select="normalize-space(w:r/w:instrText)"/>
+                <xsl:variable name="hyper-dest" select="substring-before( substring($hyper-str, 12), '&quot;')"/>
+                <xsl:variable name="hyper-bookmark">
+                    <xsl:choose>
+                        <xsl:when test="contains( $hyper-str, ' \l ')">
+                            <xsl:value-of select="concat( '#', substring-before( substring-after( substring-after( $hyper-str, ' \l '), '&quot;'), '&quot;') )"/>
+                        </xsl:when>
+                        <xsl:otherwise/>
+                    </xsl:choose>
+                </xsl:variable>
+                <text:p>
+                    <text:a>
+                        <xsl:attribute name="xlink:type">simple</xsl:attribute>
+                        <xsl:attribute name="xlink:href"><xsl:value-of select="concat( $hyper-dest, $hyper-bookmark)"/></xsl:attribute>
+                        <xsl:apply-templates/>
+                    </text:a>
+                </text:p>
+            </xsl:when>
+            -->
+        <xsl:if test="w:br[@w:type='text-wrapping' or not(@w:type)]">
+            <text:line-break/>
+        </xsl:if>
+        <xsl:choose>
+            <xsl:when test="aml:annotation/@w:type = 'Word.Comment'">
+                <office:annotation office:author="{aml:annotation/@aml:author}" office:create-date="{substring(aml:annotation/@aml:createdate,1,10)}" office:display="true">
+                    <xsl:apply-templates/>
+                </office:annotation>
+            </xsl:when>
+            <xsl:when test="(preceding-sibling::w:r) or (w:rPr)">
+                <xsl:element name="text:span">
+                    <xsl:choose>
+                        <xsl:when test="w:rPr/w:rStyle">
+                            <xsl:attribute name="text:style-name"><xsl:value-of select="w:rPr/w:rStyle/@w:val"/></xsl:attribute>
+                        </xsl:when>
+                        <xsl:when test="w:rPr">
+                            <xsl:variable name="position">
+                                <xsl:number from="/w:wordDocument/w:body" level="any" count="w:rPr"/>
+                            </xsl:variable>
+                            <xsl:attribute name="text:style-name">T<xsl:value-of select="$position + 1"/></xsl:attribute>
+                        </xsl:when>
+                    </xsl:choose>
+                    <xsl:apply-templates/>
+                </xsl:element>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:apply-templates/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <!-- strange enough, WordML allows bookmarks out of w:p, but this isn't supported by StarWriter. To be patched. :( glu -->
+    <xsl:template match="aml:annotation[@w:type = 'Word.Bookmark.Start']">
+        <xsl:variable name="id" select="@aml:id"/>
+        <text:bookmark-start text:name="{@w:name}"/>
+    </xsl:template>
+    <xsl:template match="aml:annotation[@w:type = 'Word.Bookmark.End']">
+        <xsl:variable name="id" select="@aml:id"/>
+        <text:bookmark-end text:name="{preceding::aml:annotation[@aml:id = $id]/@w:name}"/>
+    </xsl:template>
+    <xsl:template match="w:hlink">
+        <xsl:element name="text:a">
+            <xsl:attribute name="xlink:type">simple</xsl:attribute>
+            <xsl:choose>
+                <xsl:when test="@w:dest and @w:bookmark">
+                    <xsl:attribute name="xlink:href"><xsl:value-of select="concat( @w:dest, concat('#', @w:bookmark) )"/></xsl:attribute>
+                </xsl:when>
+                <xsl:when test="@w:dest">
+                    <xsl:attribute name="xlink:href"><xsl:value-of select="@w:dest"/></xsl:attribute>
+                </xsl:when>
+                <xsl:when test="@w:bookmark">
+                    <xsl:attribute name="xlink:href"><xsl:value-of select="concat('#', @w:bookmark)"/></xsl:attribute>
+                </xsl:when>
+            </xsl:choose>
+            <xsl:if test="@w:target">
+                <xsl:attribute name="office:target-frame-name"><xsl:value-of select="@w:target"/></xsl:attribute>
+            </xsl:if>
+            <xsl:apply-templates/>
+        </xsl:element>
+    </xsl:template>
+    <xsl:template name="start-end-bookmark">
+        <!--?? generate bookmark before/after the tag w:p by recursion untill another type of aml:annotation. type: start/end. cp tom chen. -->
+        <xsl:param name="type"/>
+        <xsl:param name="bm-node"/>
+        <xsl:param name="wp-node"/>
+        <xsl:for-each select="$bm-node">
+            <xsl:variable name="curr" select="."/>
+            <xsl:for-each select="$wp-node[1]">
+                <xsl:if test="not(preceding::aml:annotation/@aml:id = $curr/@aml:id) and not(./aml:annotation[@aml:id = $curr/@aml:id]) and ($type = 'start')">
+                    <text:bookmark-start text:name="{$bm-node[@aml:id = $curr/@aml:id]/@w:name}"/>
+                </xsl:if>
+                <xsl:if test="not(following::aml:annotation/@aml:id = $curr/@aml:id) and not(./aml:annotation[@aml:id = $curr/@aml:id]) and ($type = 'end')">
+                    <text:bookmark-end text:name="{preceding::aml:annotation[@aml:id = $curr/@aml:id]/@w:name}"/>
+                </xsl:if>
+            </xsl:for-each>
+        </xsl:for-each>
+    </xsl:template>
+    <xsl:template match="w:t">
+        <xsl:choose>
+            <xsl:when test="string(.) = ' ' ">
+                <xsl:element name="text:s"/>
+            </xsl:when>
+            <xsl:when test="contains(.,'  ')">
+                <xsl:call-template name="replace-spaces">
+                    <xsl:with-param name="curr-string" select="."/>
+                </xsl:call-template>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:apply-templates/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <xsl:template name="replace-spaces">
+        <xsl:param name="curr-string"/>
+        <xsl:if test="contains($curr-string,'  ')">
+            <xsl:value-of select="substring-before($curr-string,'  ')"/>
+            <text:s text:c="2"/>
+            <xsl:variable name="next-string" select="substring-after($curr-string,'  ')"/>
+            <xsl:choose>
+                <xsl:when test="contains($next-string, '  ')">
+                    <xsl:call-template name="replace-spaces">
+                        <xsl:with-param name="curr-string" select="$next-string"/>
+                    </xsl:call-template>
+                </xsl:when>
+                <xsl:otherwise>
+                    <xsl:value-of select="$next-string"/>
+                </xsl:otherwise>
+            </xsl:choose>
+        </xsl:if>
+    </xsl:template>
+    <xsl:template match="w:tab">
+        <xsl:element name="text:tab-stop"/>
+    </xsl:template>
+    <xsl:template match="w:instrText"/>
+    <xsl:template match="w:fldChar"/>
+<!-- End of OOo2.0 import/wordml/wordml2ooo_text.xsl stylesheet  -->
+<!-- Start of OOo2.0 import/common/ms2ooo_docpr.xsl stylesheet  -->
+    <xsl:template match="o:DocumentProperties">
+        <office:meta>
+            <meta:generator>Microsoft Word 2003</meta:generator>
+            <dc:title>
+                <xsl:value-of select="o:Title"/>
+            </dc:title>
+            <dc:description>
+                <xsl:value-of select="o:Description"/>
+            </dc:description>
+            <dc:subject>
+                <xsl:value-of select="o:Subject"/>
+            </dc:subject>
+            <meta:initial-creator>
+                <xsl:value-of select="o:Author"/>
+            </meta:initial-creator>
+            <meta:creation-date>
+                <xsl:value-of select="substring-before( o:Created, 'Z')"/>
+            </meta:creation-date>
+            <dc:creator>
+                <xsl:value-of select="o:LastAuthor"/>
+            </dc:creator>
+            <dc:date>
+                <xsl:value-of select="substring-before( o:LastSaved, 'Z')"/>
+            </dc:date>
+            <meta:printed-by/>
+            <meta:print-date>
+                <xsl:value-of select="substring-before( o:LastPrinted, 'Z')"/>
+            </meta:print-date>
+            <meta:keywords>
+                <meta:keyword>
+                    <xsl:value-of select="o:Keywords"/>
+                </meta:keyword>
+            </meta:keywords>
+            <dc:language/>
+            <meta:editing-cycles>
+                <xsl:value-of select="o:Revision"/>
+            </meta:editing-cycles>
+            <meta:editing-duration>
+                <xsl:if test="o:TotalTime">
+                    <xsl:value-of select="concat('PT', floor(o:TotalTime div 60), 'H', o:TotalTime mod 60, 'M0S')"/>
+                </xsl:if>
+            </meta:editing-duration>
+            <meta:user-defined meta:name="Category">
+                <xsl:value-of select="o:Category"/>
+            </meta:user-defined>
+            <meta:user-defined meta:name="Manager">
+                <xsl:value-of select="o:Manager"/>
+            </meta:user-defined>
+            <meta:user-defined meta:name="Company">
+                <xsl:value-of select="o:Company"/>
+            </meta:user-defined>
+            <meta:user-defined meta:name="Version">
+                <xsl:value-of select="o:Version"/>
+            </meta:user-defined>
+            <meta:user-defined meta:name="HyperlinkBase">
+                <xsl:value-of select="o:HyperlinkBase"/>
+            </meta:user-defined>
+            <xsl:apply-templates select="../o:CustomDocumentProperties"/>
+            <meta:document-statistic meta:page-count="{o:Pages}" meta:paragraph-count="{o:Paragraphs}" meta:word-count="{o:Words}" meta:character-count="{o:Characters}"/>
+        </office:meta>
+    </xsl:template>
+    <xsl:template match="o:CustomDocumentProperties">
+        <xsl:for-each select="node()[@dt:dt]">
+            <meta:user-defined meta:name="{local-name()}">
+                <xsl:value-of select="."/>
+            </meta:user-defined>
+        </xsl:for-each>
+    </xsl:template>
+<!-- End of OOo2.0 import/common/ms2ooo_docpr.xsl stylesheet  -->
+<!-- Start of OOo2.0 common/measure_conversion.xsl stylesheet  -->
+    <!-- DPI (dots per inch) the standard resolution of given pictures (necessary for the conversion of 'cm' into 'pixel')
+         Although many pictures have a 96 dpi resolution, a higher resoltion give better results for common browsers -->
+    <xsl:param name="dpi" select="111"/>
+    <xsl:param name="centimeter-in-mm" select="10"/>
+    <xsl:param name="inch-in-mm" select="25.4"/>
+    <xsl:param name="didot-point-in-mm" select="0.376065"/>
+    <xsl:param name="pica-in-mm" select="4.2333333"/>
+    <xsl:param name="point-in-mm" select="0.3527778"/>
+    <xsl:param name="twip-in-mm" select="0.017636684"/>
+    <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/>
+    <!-- ***** MEASUREMENT CONVERSIONS *****
+      PARAM 'value'
+        The measure to be converted.
+        The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
+        directly added to the number.
+
+      PARAM 'rounding-factor'
+        Is used for the rounding of decimal places.
+        The parameter number is the product of 1 and some '10', where
+        every zero represents a decimal place.
+
+        For example, providing as parameter:
+            <xsl:param name="rounding-factor" select="10000" />
+        Gives by default four decimal places.
+
+        To round two decimal places, basically the following is done:
+            <xsl:value-of select="round(100 * value) div 100"/>
+
+      RETURN    The converted number, by default rounded to four decimal places.
+                In case the input measure could not be matched the same value is
+                returned and a warning message is written out.
+
+
+
+     MEASURE LIST:
+     * 1 milimeter (mm), the basic measure
+
+     * 1 centimeter (cm) = 10 mm
+
+     * 1 inch (in) = 25.4 mm
+        While the English have already seen the light (read: the metric system), the US
+        remains loyal to this medieval system.
+
+     * 1 point (pt) = 0.35277777.. mm
+        Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
+        There are exactly 72 PostScript points in 1 inch.
+
+     * 1 twip = twentieth of a (PostScript) point
+        A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
+
+     * 1 didot point (dpt) = 0.376065 mm
+        Didot point after the French typographer Firmin Didot (1764-1836).
+
+        More details under
+        http://www.unc.edu/~rowlett/units/dictP.html:
+        "A unit of length used by typographers and printers. When printing was done
+        from hand-set metal type, one point represented the smallest element of type
+        that could be handled, roughly 1/64 inch. Eventually, the point was standardized
+        in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
+        about 0.35 mm (351.46 micrometers). In continental Europe, typographers
+        traditionally used a slightly larger point of 0.014 83 inch (about
+        1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
+        after the French typographer Firmin Didot (1764-1836). In the U.S.,
+        Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
+        or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
+        of 0.351 459 8035 mm. The German standards agency DIN has proposed that
+        all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
+
+     * 1 pica = 4.233333 mm
+        1/6 inch or 12 points
+
+     * 1 pixel (px) = 0.26458333.. mm   (relative to 'DPI', here: 96 dpi)
+        Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter
+
+
+    -->
+    <!-- changing measure to mm -->
+    <xsl:template name="convert2mm">
+        <xsl:param name="value"/>
+        <xsl:param name="rounding-factor" select="10000"/>
+        <xsl:choose>
+            <xsl:when test="contains($value, 'mm')">
+                <xsl:value-of select="substring-before($value, 'mm')"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'cm')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm' ) * $centimeter-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'in')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in' ) * $inch-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pt')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') * $point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'twip')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') * $twip-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dxa')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dxa') * $twip-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+
+            <xsl:when test="contains($value, 'dpt')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') * $didot-point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pica')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') * $pica-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'px')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message>
+                <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <!-- changing measure to cm -->
+    <xsl:template name="convert2cm">
+        <xsl:param name="value"/>
+        <xsl:param name="rounding-factor" select="10000"/>
+        <xsl:choose>
+            <xsl:when test="contains($value, 'mm')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'cm')">
+                <xsl:value-of select="substring-before($value, 'cm')"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'in')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pt')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dpt')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pica')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'twip')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+             <xsl:when test="contains($value, 'dxa')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dxa') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+
+            <xsl:when test="contains($value, 'px')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
+                <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <!-- changing measure to inch (cp. section comment) -->
+    <xsl:template name="convert2in">
+        <xsl:param name="value"/>
+        <xsl:param name="rounding-factor" select="10000"/>
+        <xsl:choose>
+            <xsl:when test="contains($value, 'mm')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $inch-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'cm')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $inch-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'in')">
+                <xsl:value-of select="substring-before($value, 'in')"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pt')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $inch-in-mm * $point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dpt')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $inch-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pica')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $inch-in-mm * $pica-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'twip')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+             <xsl:when test="contains($value, 'dxa')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dxa') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+
+            <xsl:when test="contains($value, 'px')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message>
+                <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <!-- changing measure to dpt (cp. section comment) -->
+    <xsl:template name="convert2dpt">
+        <xsl:param name="value"/>
+        <xsl:param name="rounding-factor" select="10000"/>
+        <xsl:choose>
+            <xsl:when test="contains($value, 'mm')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $didot-point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'cm')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $didot-point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'in')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $didot-point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pt')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $didot-point-in-mm * $point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dpt')">
+                <xsl:value-of select="substring-before($value, 'dpt')"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pica')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $didot-point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'twip')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+             <xsl:when test="contains($value, 'dxa')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dxa') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+
+            <xsl:when test="contains($value, 'px')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message>
+                <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <!-- changing measure to pica (cp. section comment) -->
+    <xsl:template name="convert2pica">
+        <xsl:param name="value"/>
+        <xsl:param name="rounding-factor" select="10000"/>
+        <xsl:choose>
+            <xsl:when test="contains($value, 'mm')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $pica-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'cm')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $pica-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'in')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $pica-in-mm * $inch-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pt')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $pica-in-mm * $point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dpt')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $pica-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pica')">
+                <xsl:value-of select="substring-before($value, 'pica')"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'twip')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+             <xsl:when test="contains($value, 'dxa')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dxa') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+
+            <xsl:when test="contains($value, 'px')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message>
+                <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <!-- changing measure to pt (cp. section comment) -->
+    <xsl:template name="convert2pt">
+        <xsl:param name="value"/>
+        <xsl:param name="rounding-factor" select="10000"/>
+        <xsl:choose>
+            <xsl:when test="contains($value, 'mm')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'cm')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'in')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $point-in-mm * $inch-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pt')">
+                <xsl:value-of select="substring-before($value, 'pt')"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dpt')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $point-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pica')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $point-in-mm * $pica-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'twip')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+             <xsl:when test="contains($value, 'dxa')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dxa') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+
+            <xsl:when test="contains($value, 'px')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message>
+                <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <!-- changing measure to pt (cp. section comment) -->
+    <xsl:template name="convert2twip">
+        <xsl:param name="value"/>
+        <xsl:param name="rounding-factor" select="10000"/>
+        <xsl:choose>
+            <xsl:when test="contains($value, 'mm')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'cm')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'in')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pt')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dpt')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pica')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'twip')">
+                <xsl:value-of select="substring-before($value, 'twip')"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dxa')">
+                <xsl:value-of select="substring-before($value, 'dxa')"/>
+            </xsl:when>
+
+            <xsl:when test="contains($value, 'px')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message>
+                <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+    <!-- changing measure to pixel by via parameter provided dpi (dots per inch) standard factor (cp. section comment) -->
+    <xsl:template name="convert2px">
+        <xsl:param name="value"/>
+        <xsl:choose>
+            <xsl:when test="contains($value, 'mm')">
+                <xsl:value-of select="round(number(substring-before($value, 'mm')) div $pixel-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'cm')">
+                <xsl:value-of select="round(number(substring-before($value, 'cm')) div $pixel-in-mm * $centimeter-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'in')">
+                <xsl:value-of select="round(number(substring-before($value, 'in')) div $pixel-in-mm * $inch-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pt')">
+                <xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dpt')">
+                <xsl:value-of select="round(number(substring-before($value, 'dpt')) div $pixel-in-mm * $didot-point-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pica')">
+                <xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'twip')">
+                <xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dxa')">
+                <xsl:value-of select="round(number(substring-before($value, 'dxa')) div $pixel-in-mm * $twip-in-mm)"/>
+            </xsl:when>
+
+            <xsl:when test="contains($value, 'px')">
+                <xsl:value-of select="$value"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message>
+                <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+        <xsl:template name="convert2dxa">
+        <!-- this template is the same as the template of convert2twip because M$ word uses the dxa to represent twip-->
+        <xsl:param name="value"/>
+        <xsl:param name="rounding-factor" select="10000"/>
+        <xsl:choose>
+            <xsl:when test="contains($value, 'mm')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'cm')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'in')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pt')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dpt')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'pica')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'twip')">
+                <xsl:value-of select="substring-before($value, 'twip')"/>
+            </xsl:when>
+            <xsl:when test="contains($value, 'dxa')">
+                <xsl:value-of select="substring-before($value, 'dxa')"/>
+            </xsl:when>
+
+            <xsl:when test="contains($value, 'px')">
+                <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/>
+            </xsl:when>
+            <xsl:otherwise>
+                <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message>
+                <xsl:value-of select="$value"/>
+            </xsl:otherwise>
+        </xsl:choose>
+    </xsl:template>
+<!-- End of OOo2.0 common/measure_conversion.xsl stylesheet  -->
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/NCAA_Conference_Schedule_XML.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/NCAA_Conference_Schedule_XML.dtd
new file mode 100644
index 00000000000..600d23a8593
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/NCAA_Conference_Schedule_XML.dtd
@@ -0,0 +1,20 @@
+<!ELEMENT message  (XML_File_ID , heading , category , sport , Title , Conference_Schedule , time_stamp )>
+
+<!ELEMENT XML_File_ID  (#PCDATA )>
+
+<!ELEMENT heading  (#PCDATA )>
+
+<!ELEMENT category  (#PCDATA )>
+
+<!ELEMENT sport  (#PCDATA )>
+
+<!ELEMENT Title  (#PCDATA )>
+
+<!ELEMENT Conference_Schedule  (Team+ )>
+
+<!ELEMENT Team  (Listing+ )>
+<!ATTLIST Team  fullname CDATA  #REQUIRED >
+<!ELEMENT Listing  (#PCDATA )>
+
+<!ELEMENT time_stamp  (#PCDATA )>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/OpenJDK100017Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/OpenJDK100017Test.java
new file mode 100644
index 00000000000..b7bb1ac75ab
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/OpenJDK100017Test.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.IOException;
+
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6883209
+ * @summary Test XSLT won't cause StackOverflow when it handle many characters.
+ */
+public class OpenJDK100017Test {
+
+    @Test
+    public final void testXMLStackOverflowBug() throws TransformerConfigurationException, IOException, SAXException {
+        try {
+            SAXTransformerFactory stf = (SAXTransformerFactory) TransformerFactory.newInstance();
+            TransformerHandler ser = stf.newTransformerHandler();
+            ser.setResult(new StreamResult(System.out));
+
+            StringBuilder sb = new StringBuilder(4096);
+            for (int x = 4096; x > 0; x--) {
+                sb.append((char) x);
+            }
+            ser.characters(sb.toString().toCharArray(), 0, sb.toString().toCharArray().length);
+            ser.endDocument();
+        } catch (StackOverflowError se) {
+            se.printStackTrace();
+            Assert.fail("StackOverflow");
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/PredicateInKeyTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/PredicateInKeyTest.xml
new file mode 100644
index 00000000000..10886c5c88c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/PredicateInKeyTest.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!--
+  * PredicateInKeyTest.xml - XSLT test input file for PredicatInKeyTest.xsl
+  *
+ *
+ * Copyright (c) 2014, 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.
+ *
+  -->
+<document><t>0</t><t>1</t><t>2</t><t>3</t></document>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/PredicateInKeyTest.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/PredicateInKeyTest.xsl
new file mode 100644
index 00000000000..77d3095de68
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/PredicateInKeyTest.xsl
@@ -0,0 +1,49 @@
+<?xml version="1.0"?>
+<!--
+ *
+ * Copyright (c) 2014, 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.
+ *
+  -->
+<xsl:stylesheet
+   version="1.0"
+   xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+>
+
+   <xsl:output method="text"/>
+   
+   <xsl:key name="key" match="t[1]" use="0"/>
+   <xsl:key name="key" match="t[2]" use="1"/>
+   <xsl:key name="key" match="t[following-sibling::t[1] = 3]" use="2"/>
+   <xsl:key name="key" match="t[preceding-sibling::t[. = 2]]" use="3"/>
+   
+   <xsl:template match="/">
+      <xsl:copy-of select="key('key', 0)/text()"/> <!-- 0 -->
+      <xsl:text>|</xsl:text>
+      <xsl:copy-of select="key('key', 1)/text()"/> <!-- 1 -->
+      <xsl:text>|</xsl:text>
+      <xsl:copy-of select="key('key', 2)/text()"/> <!-- 2 -->
+      <xsl:text>|</xsl:text>
+      <xsl:copy-of select="key('key', 3)/text()"/> <!-- 3 -->
+   </xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SAX2DOMTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SAX2DOMTest.java
new file mode 100644
index 00000000000..fb480e11a29
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SAX2DOMTest.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.LexicalHandler;
+import org.xml.sax.helpers.AttributesImpl;
+import org.xml.sax.helpers.XMLFilterImpl;
+
+/*
+ * @summary Test Transforming from SAX to DOM.
+ */
+public class SAX2DOMTest {
+
+    @Test
+    public void test() throws Exception {
+        SAXParserFactory fac = SAXParserFactory.newInstance();
+        fac.setNamespaceAware(true);
+        SAXParser saxParser = fac.newSAXParser();
+
+        StreamSource sr = new StreamSource(this.getClass().getResourceAsStream("SAX2DOMTest.xml"));
+        InputSource is = SAXSource.sourceToInputSource(sr);
+        RejectDoctypeSaxFilter rf = new RejectDoctypeSaxFilter(saxParser);
+        SAXSource src = new SAXSource(rf, is);
+        Transformer transformer = TransformerFactory.newInstance().newTransformer();
+        DOMResult result = new DOMResult();
+        transformer.transform(src, result);
+
+        Document doc = (Document) result.getNode();
+        System.out.println("Name" + doc.getDocumentElement().getLocalName());
+
+        String id = "XWSSGID-11605791027261938254268";
+        Element selement = doc.getElementById(id);
+        if (selement == null) {
+            System.out.println("getElementById returned null");
+        }
+
+    }
+
+    public static class RejectDoctypeSaxFilter extends XMLFilterImpl implements XMLReader, LexicalHandler {
+
+        /** Standard SAX 2.0 ext property */
+        static final String LEXICAL_HANDLER_PROP = "http://xml.org/sax/properties/lexical-handler";
+
+        static final String WSU_NS = "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd".intern();
+        static final String SIGNATURE_LNAME = "Signature".intern();
+        static final String ENCRYPTED_DATA_LNAME = "EncryptedData".intern();
+        static final String DSIG_NS = "http://www.w3.org/2000/09/xmldsig#".intern();
+        static final String XENC_NS = "http://www.w3.org/2001/04/xmlenc#".intern();
+        static final String ID_NAME = "ID".intern();
+
+        /** LexicalHandler to forward events to, if any */
+        private LexicalHandler lexicalHandler;
+
+        public RejectDoctypeSaxFilter(SAXParser saxParser) throws Exception {
+            XMLReader xmlReader;
+            try {
+                xmlReader = saxParser.getXMLReader();
+            } catch (Exception e) {
+                throw new Exception("Couldn't get an XMLReader while constructing a RejectDoctypeSaxFilter", e);
+            }
+
+            // Set ourselves up to be the SAX LexicalHandler
+            try {
+                xmlReader.setProperty(LEXICAL_HANDLER_PROP, this);
+            } catch (Exception e) {
+                throw new Exception("Couldn't set the lexical handler property while constructing a RejectDoctypeSaxFilter", e);
+            }
+
+            // Set the parent XMLReader of this SAX filter
+            setParent(xmlReader);
+        }
+
+        /*
+         * Override setProperty() to capture any LexicalHandler that is set for
+         * forwarding of events.
+         */
+        public void setProperty(String name, Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
+            if (LEXICAL_HANDLER_PROP.equals(name)) {
+                lexicalHandler = (LexicalHandler) value;
+            } else {
+                super.setProperty(name, value);
+            }
+        }
+
+        //
+        // Beginning of SAX LexicalHandler callbacks...
+        //
+
+        public void startDTD(String name, String publicId, String systemId) throws SAXException {
+            throw new SAXException("Document Type Declaration is not allowed");
+        }
+
+        public void endDTD() throws SAXException {
+        }
+
+        public void startEntity(String name) throws SAXException {
+            if (lexicalHandler != null) {
+                lexicalHandler.startEntity(name);
+            }
+        }
+
+        public void endEntity(String name) throws SAXException {
+            if (lexicalHandler != null) {
+                lexicalHandler.endEntity(name);
+            }
+        }
+
+        public void startCDATA() throws SAXException {
+            if (lexicalHandler != null) {
+                lexicalHandler.startCDATA();
+            }
+        }
+
+        public void endCDATA() throws SAXException {
+            if (lexicalHandler != null) {
+                lexicalHandler.endCDATA();
+            }
+        }
+
+        public void comment(char[] ch, int start, int length) throws SAXException {
+            if (lexicalHandler != null) {
+                lexicalHandler.comment(ch, start, length);
+            }
+        }
+
+        //
+        // End of SAX LexicalHandler callbacks
+        //
+
+        public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException {
+            if (atts != null) {
+                boolean eos = false;
+                if (namespaceURI == DSIG_NS || XENC_NS == namespaceURI) {
+                    eos = true;
+                }
+                int length = atts.getLength();
+                AttributesImpl attrImpl = new AttributesImpl();
+                for (int i = 0; i < length; i++) {
+                    String name = atts.getLocalName(i);
+                    if (name != null && (name.equals("Id"))) {
+                        if (eos || atts.getURI(i) == WSU_NS) {
+                            attrImpl.addAttribute(atts.getURI(i), atts.getLocalName(i), atts.getQName(i), ID_NAME, atts.getValue(i));
+                        } else {
+                            attrImpl.addAttribute(atts.getURI(i), atts.getLocalName(i), atts.getQName(i), atts.getType(i), atts.getValue(i));
+                        }
+                    } else {
+                        attrImpl.addAttribute(atts.getURI(i), atts.getLocalName(i), atts.getQName(i), atts.getType(i), atts.getValue(i));
+                    }
+                }
+                super.startElement(namespaceURI, localName, qName, attrImpl);
+            } else {
+                super.startElement(namespaceURI, localName, qName, atts);
+            }
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SAX2DOMTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SAX2DOMTest.xml
new file mode 100644
index 00000000000..6114221d769
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SAX2DOMTest.xml
@@ -0,0 +1,109 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"  
+    xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"  
+    xmlns:ns0="http://tax.org/wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
+    env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
+    <env:Header>
+        <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/ 
+            oasis-200401-wss-wssecurity-secext-1.0.xsd" env:mustUnderstand="1">
+            <wsse:BinarySecurityToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"  
+                EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary" 
+                ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"  
+                wsu:Id="XWSSGID-1160579093284-731518813">MIICvjCCAicCBEUKVsswDQYJKoZIhvc 
+                NAQEEBQAwgaUxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpD
+                YWxpZm9ybmlhMRQwEgYDVQQHEwtTYW50YSBDbGFyYTEZMBcGA1UEChMQU3VuIE1pY3Jvc3lz 
+                dGVt
+                czErMCkGA1UECxMiU3VuIEphdmEgU3lzdGVtIEFwcGxpY2F0aW9uIFNlcnZlcjEjMCEGA1UE 
+                AxMa
+                a3VtYXJqYXlhbnRpLmluZGlhLnN1bi5jb20wHhcNMDYwOTE1MDczMTIzWhcNMTYwOTEyMDcz 
+                MTIz
+                WjCBpTELMAkGA1UEBhMCVVMxEzARBgNVBAgTCkNhbGlmb3JuaWExFDASBgNVBAcTC1NhbnRh 
+                IENs
+                YXJhMRkwFwYDVQQKExBTdW4gTWljcm9zeXN0ZW1zMSswKQYDVQQLEyJTdW4gSmF2YSBTeXN0 
+                ZW0g
+                QXBwbGljYXRpb24gU2VydmVyMSMwIQYDVQQDExprdW1hcmpheWFudGkuaW5kaWEuc3VuLmNv 
+                bTCB
+                nzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEArvcLWMmE7KUE+QJhhv 
+                +sNEpsVnOgDQ8Q2Q7WUUHh
+                psY/o059aaurJT6GpmBL8fOoVRw08hsRN5B1rBUSjEQhlVNP/RM5tKow/hdXNt 
+                +zBhQ11d8Kocvd
+                VJcTSsuLCQombPJj0gzVeu3UOa0n290YvakbDxpBLoA14d4K/ 
+                lA6BOsCAwEAATANBgkqhkiG9w0B
+                AQQFAAOBgQCWxwpM2eVlE2mG6rsnrhJMQdtaLIoEilh6xtUTkFgLW 
+                +H6rRSFAr7pxCO2OiwWWzRa
+                FQuuigYlhDpTcCcQARElhlL5ZHLP84cgp/ 
+                2KfFKXBphOx9xNoThFLDuh2ExUUydfqZMXYhpN39fe
+            ziQeqggTVsTKHTfFsNpAW09ZoXx5ug==</wsse:BinarySecurityToken>
+            <xenc:EncryptedKey xmlns:xenc="http://www.w3.org/2001/04/xmlenc#">
+                <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/ 
+                xmlenc#rsa-1_5"/>
+                <ds:KeyInfo xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
+                    <wsse:SecurityTokenReference>
+                        <wsse:Reference URI="#XWSSGID-1160579093284-731518813"  
+                        ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/>
+                    </wsse:SecurityTokenReference>
+                </ds:KeyInfo>
+                <xenc:CipherData>
+                    <xenc:CipherValue>elU7zQXCWw3VUeb7CRRhm2Qc0HTF6tQz4MAaLDrlw60oBi0bHi2npe 
+                        vNuhQuDIMBcqA4U9f51zK7
+                        /tR8602YjpMETlby/w01yLGb2IvzKsFAL02NilRUT4o1Jj2PiLibcbVonzuye/ 
+                        dfoNKi5dNeQY6k
+                    In3JurQmap8QEEpEoIM=</xenc:CipherValue>
+                </xenc:CipherData>
+                <xenc:ReferenceList>
+                    <xenc:DataReference URI="#XWSSGID-11605791027261938254268"/>
+                </xenc:ReferenceList>
+            </xenc:EncryptedKey>
+            <wsse:UsernameToken xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/ 
+                oasis-200401-wss-wssecurity-utility-1.0.xsd"  
+                wsu:Id="XWSSGID-11605790933402107175190">
+                <xenc:EncryptedData xmlns:xenc="http://www.w3.org/2001/04/xmlenc#"  
+                    Id="XWSSGID-11605791027261938254268" Type="http://www.w3.org/2001/04/xmlenc#Content">
+                    <xenc:EncryptionMethod Algorithm="http://www.w3.org/2001/04/xmlenc#tripledes-cbc"/>
+                    <xenc:CipherData>
+                        <xenc:CipherValue>ZnUgV0uixMVhb7LYujc+vGwlnZdfG7c9MtI3+M8P92Oyh2Mk 
+                            +xfQsADTlk2Gqux6gRLAeKjafdXG
+                            gVsdZvWkc9+tvKE9cGRv8Gm2d7ephTdSDwKRX1m7I8Q52U87MCrBWPfWEZAhm/ 
+                            UE8RfZf54YHFB6
+                            AA2gIrQQF1qYprX6eyHzaLdZe2iVRs5wXD2uRr1C3e1F6HbftGVc8gGMcsClXXzrSu3wMzJ7 
+                            CIRH
+                            tGg8R/Xoghj2KHwv4p4FGOBQ4AT3F54I3/ 
+                            wcfFLawPLH40wwjDuHK9ufRWIrkn4VYTUrWfZoUxMV
+                            ZSaUkGeLi1d55IeWJhjQwwktYFd/KKe79qHLbc5IMzrVNbK7yKpxvQ25/CL+6lHVmPAd 
+                            +RrLtopX
+                            qBhSRGVwHUHoLl7lAZX7q+x4AbO0x6ftib/5ytRgIBhpZWo6/ 
+                            WvVYAQrV5Fw1e5OYZq1kkWuq3XO
+                            jJuBU7x4vCTXlUphe9aDMJV/K7mTXwrgzRXFxSkUS/ 
+                            L1q8EfCTT73aFyGuRQmFK9ZTyXuZtg4E1V
+                            ooxYuOwvAQZfp49lj39+oieNP4q24/I2tcflA+blHjSrV/ 
+                            8CqrRLZfMnGzTAW4rA3JPzQcwexuAv
+                            bkUdMF8GU8XzfGDWSiPz0EDLV0dBOPPL6Da6IH1sWXXegSBnblxRDWZ4XGC5lGXErs7wo9Yo 
+                            NaNN
+                            Y2C3TEfgchGMbg0JvQ7JytKWfKcfjL0A7DoP1ChIbh4JC3rTpRbGvqbAgs7zyS+NyZ06/ 
+                            s4m4s34
+                            U4HcILs+lkZUszRAXwKhc9th6KoFl7i+q1UoiOfxFbf/ 
+                            RsIwDg5ULIHRJS7AJrm703jn7OUKalrB
+                            a8d5vm0b6PFMQx8eD7 
+                            +7HaXpBn9GJ5RubfB94QB3BUuy0av8INHtmYpvzcIwTLYmuGYcg7UnvJ6I
+                            8qjagbc67eSNC+vnKQHPrOyrqvY44R5qzfij+rp9k1vp4an/ys5db9P 
+                            +igwmyH3BTXC3rqjbgO7i
+                            tuv5Kw/H8mfl2VKme13VyWry6zCCNo8ug8O7YE0M/ 
+                            lhjb0SCDyz8Rfxp7zApgGXDjrx4TNlBf+Jj
+                            Ys4QVbDA8EQf6Ku3ZYfLGM+eFFSguR0OiCWb6pOD8AWxIv4yq6d6hA3pE5/ 
+                            okvOmHl2BpElpyePb
+                            lbeOuU8DrmceetMTL+U5QOUYSvYpMPop20QDUNje7 
+                            +SIDcHG3xp9Vx78gI7HOqmeBzFla49wXJxF
+                        ffK86OmEV14=</xenc:CipherValue>
+                    </xenc:CipherData>
+                </xenc:EncryptedData>
+            </wsse:UsernameToken>
+        </wsse:Security>
+    </env:Header>
+    <env:Body>
+        <ns0:getFedTax>
+            <double_1 xsi:type="xsd:double">97000.0</double_1>
+            <double_2 xsi:type="xsd:double">7000.0</double_2>
+        </ns0:getFedTax>
+    </env:Body>
+</env:Envelope>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.java
new file mode 100644
index 00000000000..c158d7a85be
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test XSLT shall report TransformerException for unsafe xsl when FEATURE_SECURE_PROCESSING is true.
+ */
+public class SecureProcessingTest {
+    static boolean _isSecureMode = false;
+    static {
+        if (System.getSecurityManager() != null) {
+            _isSecureMode = true;
+            System.out.println("Security Manager is present");
+        } else {
+            System.out.println("Security Manager is NOT present");
+        }
+    }
+
+
+
+    @Test
+    public final void testSecureProcessing() {
+
+        // SECURE_PROCESSING == false
+
+        // the style sheet
+        InputStream xslStream = this.getClass().getResourceAsStream("SecureProcessingTest.xsl");
+        StreamSource xslSource = new StreamSource(xslStream);
+
+        // the xml source
+        InputStream xmlStream = this.getClass().getResourceAsStream("SecureProcessingTest.xml");
+        StreamSource xmlSource = new StreamSource(xmlStream);
+
+        // the xml result
+        StringWriter xmlResultString = new StringWriter();
+        StreamResult xmlResultStream = new StreamResult(xmlResultString);
+
+        // the transformer
+        TransformerFactory transformerFactory = null;
+        Transformer transformer = null;
+
+        // transform with a non-secure Transformer
+        // expect success
+        String xmlResult;
+        if (!_isSecureMode) { // jaxp secure feature can not be turned off when
+                              // security manager is present
+            try {
+                transformerFactory = TransformerFactory.newInstance();
+                transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+                transformer = transformerFactory.newTransformer(xslSource);
+                transformer.transform(xmlSource, xmlResultStream);
+            } catch (TransformerConfigurationException ex) {
+                ex.printStackTrace();
+                Assert.fail(ex.toString());
+            } catch (TransformerException ex) {
+                ex.printStackTrace();
+                Assert.fail(ex.toString());
+            }
+
+            // expected success
+            // and the result is ...
+            xmlResult = xmlResultString.toString();
+            System.out.println("Transformation result (SECURE_PROCESSING == false) = \"" + xmlResult + "\"");
+        }
+
+        // now do same transformation but with SECURE_PROCESSING == true
+        // expect Exception
+        boolean exceptionCaught = false;
+
+        // the style sheet
+        xslStream = this.getClass().getResourceAsStream("SecureProcessingTest.xsl");
+        xslSource = new StreamSource(xslStream);
+
+        // the xml source
+        xmlStream = this.getClass().getResourceAsStream("SecureProcessingTest.xml");
+        xmlSource = new StreamSource(xmlStream);
+
+        // the xml result
+        xmlResultString = new StringWriter();
+        xmlResultStream = new StreamResult(xmlResultString);
+
+        // the transformer
+        transformerFactory = null;
+        transformer = null;
+
+        // transform with a secure Transformer
+        try {
+            transformerFactory = TransformerFactory.newInstance();
+            transformerFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+            transformer = transformerFactory.newTransformer(xslSource);
+            transformer.transform(xmlSource, xmlResultStream);
+        } catch (TransformerConfigurationException ex) {
+            ex.printStackTrace();
+            Assert.fail(ex.toString());
+        } catch (TransformerException ex) {
+            // expected failure
+            System.out.println("expected failure: " + ex.toString());
+            ex.printStackTrace(System.out);
+            exceptionCaught = true;
+        }
+
+        // unexpected success?
+        if (!exceptionCaught) {
+            // and the result is ...
+            xmlResult = xmlResultString.toString();
+            System.err.println("Transformation result (SECURE_PROCESSING == true) = \"" + xmlResult + "\"");
+            Assert.fail("SECURITY_PROCESSING == true, expected failure but got result: \"" + xmlResult + "\"");
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.xml
new file mode 100644
index 00000000000..bc916a958f9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<helloWorld/>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.xsl
new file mode 100644
index 00000000000..b9f73fb25db
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SecureProcessingTest.xsl
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:java="http://xml.apache.org/xslt/java"
+                version="1.0">
+    <xsl:template
+        match="/helloWorld"
+        xmlns:java="http://xml.apache.org/xslt/java">
+      <int>
+        <xsl:value-of
+            select="java:java.lang.String.valueOf(0)"
+        />
+      </int>
+    </xsl:template>
+</xsl:stylesheet>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.java
new file mode 100644
index 00000000000..142fbd2fc37
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.File;
+import java.io.StringWriter;
+
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test Sources.
+ */
+public class SourceTest {
+
+    @Test
+    public final void testDOMSource() {
+        String xml = getClass().getResource("SourceTest.xml").getFile();
+        xml = "file://" + xml;
+        File xsl = new File(getClass().getResource("SourceTest.xsl").getFile());
+        try {
+            TransformerFactory tFactory = TransformerFactory.newInstance();
+            Transformer transformer = tFactory.newTransformer();
+            StreamSource source = new StreamSource(xsl);
+            transformer = tFactory.newTransformer(source);
+            // the xml result
+            StringWriter xmlResultString = new StringWriter();
+            StreamResult xmlResultStream = new StreamResult(xmlResultString);
+
+            Source xmlSource = new DOMSource();
+            xmlSource.setSystemId(xml);
+
+            transformer.transform(xmlSource, xmlResultStream);
+            System.out.println(xmlResultString.toString());
+            String temp = xmlResultString.toString();
+            int pos = temp.lastIndexOf("count");
+            if (temp.substring(pos + 8, pos + 9).equals("1")) {
+                Assert.fail("count=1");
+            } else if (temp.substring(pos + 8, pos + 9).equals("2")) {
+                // expected success
+                System.out.println("count=2");
+            }
+        } catch (Exception e) {
+            // unexpected failure
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+
+    @Test
+    public final void testSAXSource() {
+        String xml = getClass().getResource("SourceTest.xml").getFile();
+        File xsl = new File(getClass().getResource("SourceTest.xsl").getFile());
+        try {
+            TransformerFactory tFactory = TransformerFactory.newInstance();
+            Transformer transformer = tFactory.newTransformer();
+            StreamSource source = new StreamSource(xsl);
+            transformer = tFactory.newTransformer(source);
+            // the xml result
+            StringWriter xmlResultString = new StringWriter();
+            StreamResult xmlResultStream = new StreamResult(xmlResultString);
+
+            Source xmlSource = new SAXSource();
+            xmlSource.setSystemId(xml);
+
+            transformer.transform(xmlSource, xmlResultStream);
+            System.out.println(xmlResultString.toString());
+            String temp = xmlResultString.toString();
+            int pos = temp.lastIndexOf("count");
+            if (temp.substring(pos + 8, pos + 9).equals("1")) {
+                Assert.fail("count=1");
+            } else if (temp.substring(pos + 8, pos + 9).equals("2")) {
+                // expected success
+                System.out.println("count=2");
+            }
+        } catch (Exception e) {
+            // unexpected failure
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+
+    @Test
+    public final void testStreamSource() {
+        String xml = getClass().getResource("SourceTest.xml").getFile();
+        File xsl = new File(getClass().getResource("SourceTest.xsl").getFile());
+        try {
+            TransformerFactory tFactory = TransformerFactory.newInstance();
+            Transformer transformer = tFactory.newTransformer();
+            StreamSource source = new StreamSource(xsl);
+            transformer = tFactory.newTransformer(source);
+            // the xml result
+            StringWriter xmlResultString = new StringWriter();
+            StreamResult xmlResultStream = new StreamResult(xmlResultString);
+
+            Source xmlSource = new StreamSource();
+            xmlSource.setSystemId(xml);
+
+            transformer.transform(xmlSource, xmlResultStream);
+            System.out.println(xmlResultString.toString());
+            String temp = xmlResultString.toString();
+            int pos = temp.lastIndexOf("count");
+            if (temp.substring(pos + 8, pos + 9).equals("1")) {
+                Assert.fail("count=1");
+            } else if (temp.substring(pos + 8, pos + 9).equals("2")) {
+                // expected success
+                System.out.println("count=2");
+            }
+        } catch (Exception e) {
+            // unexpected failure
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.xml
new file mode 100644
index 00000000000..3c702592100
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.xml
@@ -0,0 +1,21 @@
+<a>
+  <b>
+    <c>
+      <d>
+        <e attr="foo">
+	  E3
+        </e>
+      </d>
+    </c>
+  </b>
+  <b>
+    <c>
+      <d>
+        <e attr="bar">
+	  E3
+        </e>
+      </d>
+    </c>
+  </b>
+</a>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.xsl
new file mode 100644
index 00000000000..247042a40f1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/SourceTest.xsl
@@ -0,0 +1,52 @@
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
+  <!-- Xalan 2.6 contained in the Sun JDK 1.5 u12 and newer has issues with
+       evaluating grouping nodes according the Muenchian Method (by Steve Muench),
+       where nodes are stored in a key data structure for the group key, and later
+       a group start is checked by checking for the first node retrieved for a key.
+       The nodes are compared using a set union, where the size of the set should
+       be 1 when the nodes are identical, and different to 1 when the nodes are
+       different.
+       The issue with Xalan 2.6 as part of the JDK is, that it does not evaluate the
+       expression "count(.|key('props', subexpr)[1])" correctly. It always returns
+       "1". If the argument expression of count() is stored in a variable first,
+       and the variable is used as argument for count(), then everything works fine.
+  -->
+
+
+
+  <xsl:key name="props" match="c" use="d/e"/>
+  <xsl:template match="a">
+
+    Working (by replacing the count() argument with a variable):
+    <xsl:for-each select="b">
+      <xsl:for-each select="c">
+        <xsl:variable name="tNodeSet" select=".|key('props', d/e)[1]"/>
+        <xsl:for-each select="$tNodeSet">
+        Node <xsl:value-of select="d/e/@attr"/>;
+        </xsl:for-each>
+        count = <xsl:value-of select="count($tNodeSet)"/>
+      </xsl:for-each>
+        ---------
+    </xsl:for-each>
+
+    Not working in the 2nd loop iteration (by using the union expression as count() argument):
+    <xsl:for-each select="b">
+      <xsl:for-each select="c">
+
+        <!-- We replaced the variable "tNodeSet" by the related union expression.
+             The for-each loop will work correctly, but the count() will
+             always return "1" instead of first "1" and then "2".
+        -->
+
+        <xsl:for-each select=".|key('props', d/e)[1]">
+        Node <xsl:value-of select="d/e/@attr"/>;
+        </xsl:for-each>
+
+        count = <xsl:value-of select="count(.|key('props', d/e)[1])"/>
+      </xsl:for-each>
+        ---------
+    </xsl:for-each>
+
+  </xsl:template>
+</xsl:stylesheet>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/StAXSourceTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/StAXSourceTest.java
new file mode 100644
index 00000000000..a1b9bc242e0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/StAXSourceTest.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.stax.StAXResult;
+import javax.xml.transform.stax.StAXSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test parsing from StAXSource.
+ */
+public class StAXSourceTest {
+
+    @Test
+    public final void testStAXSource() throws XMLStreamException {
+        XMLInputFactory ifactory = XMLInputFactory.newInstance();
+        XMLOutputFactory ofactory = XMLOutputFactory.newInstance();
+
+        String xslStylesheet = "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'>"
+                + "  <xsl:output method='xml' encoding='utf-8' indent='no'/>" + "  <xsl:preserve-space elements='*'/>" + "  <xsl:template match='*'>"
+                + "    <xsl:copy><xsl:copy-of select='@*'/><xsl:apply-templates/></xsl:copy>" + "  </xsl:template>"
+                + "  <xsl:template match='comment()|processing-instruction()|text()'>" + "    <xsl:copy/>" + "  </xsl:template>" + "</xsl:stylesheet>";
+        StringReader xslStringReader = new StringReader(xslStylesheet);
+        StringReader xmlStringReader = new StringReader(xslStylesheet); // identity
+                                                                        // on
+                                                                        // itself,
+        StringWriter xmlStringWriter = new StringWriter();
+
+        XMLEventReader styleReader = ifactory.createXMLEventReader(xslStringReader);
+        XMLEventReader docReader = ifactory.createXMLEventReader(xmlStringReader);
+        XMLEventWriter writer = ofactory.createXMLEventWriter(xmlStringWriter);
+
+        StAXSource stylesheet = new StAXSource(styleReader);
+        StAXSource document = new StAXSource(docReader);
+        StAXResult result = new StAXResult(writer);
+
+        try {
+            document.setSystemId("sourceSystemId");
+        } catch (UnsupportedOperationException e) {
+            System.out.println("Expected UnsupportedOperationException in StAXSource.setSystemId()");
+        } catch (Exception e) {
+            Assert.fail("StAXSource.setSystemId() does not throw java.lang.UnsupportedOperationException");
+        }
+
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+        try {
+            Transformer transformer = tfactory.newTransformer(stylesheet);
+            transformer.transform(document, result);
+        } catch (TransformerConfigurationException tce) {
+            throw new XMLStreamException(tce);
+        } catch (TransformerException te) {
+            throw new XMLStreamException(te);
+        } finally {
+            styleReader.close();
+            docReader.close();
+            writer.close();
+        }
+
+        try {
+            result.setSystemId("systemId");
+        } catch (UnsupportedOperationException e) {
+            System.out.println("Expected UnsupportedOperationException in StAXResult.setSystemId()");
+        } catch (Exception e) {
+            Assert.fail("StAXResult.setSystemId() does not throw java.lang.UnsupportedOperationException");
+        }
+
+        if (result.getSystemId() != null) {
+            Assert.fail("StAXResult.getSystemId() does not return null");
+        }
+    }
+
+    @Test
+    public final void testStAXSource2() throws XMLStreamException {
+        XMLInputFactory ifactory = XMLInputFactory.newInstance();
+        ifactory.setProperty("javax.xml.stream.supportDTD", Boolean.TRUE);
+
+        StAXSource ss = new StAXSource(ifactory.createXMLStreamReader(getClass().getResource("5368141.xml").toString(),
+                getClass().getResourceAsStream("5368141.xml")));
+        DOMResult dr = new DOMResult();
+
+        TransformerFactory tfactory = TransformerFactory.newInstance();
+        try {
+            Transformer transformer = tfactory.newTransformer();
+            transformer.transform(ss, dr);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerFactoryTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerFactoryTest.java
new file mode 100644
index 00000000000..16f94995c3c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerFactoryTest.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stax.StAXResult;
+import javax.xml.transform.stax.StAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test TransformerFactory.
+ */
+public class TransformerFactoryTest {
+
+    private static URIResolver resolver = new URIResolver() {
+
+        private int n = 0;
+
+        public Source resolve(String href, String base) throws TransformerException {
+
+            System.out.println("resolving: " + href);
+
+            if (n++ > 10) {
+                Assert.fail("Nesting too deep when resolving: " + href);
+            }
+
+            return new StreamSource(this.getClass().getResourceAsStream(href));
+        }
+    };
+
+    private static Document load(InputStream in) throws IOException {
+
+        Document document = null;
+
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            document = db.parse(in);
+        } catch (ParserConfigurationException parserConfigurationException) {
+            parserConfigurationException.printStackTrace();
+            Assert.fail(parserConfigurationException.toString());
+        } catch (SAXException saxException) {
+            saxException.printStackTrace();
+            Assert.fail(saxException.toString());
+        }
+
+        return document;
+    }
+
+    /**
+     * <p>
+     * Test stylesheets that import other stylesheets.
+     * </p>
+     *
+     * <p>
+     * Inspired by: CR 6236727-2125981 XSLTC never stops resolving imported
+     * stylesheets when outer stylesheet is a DOMSource
+     * </p>
+     */
+    @Test
+    public final void testImport() {
+
+        TransformerFactory tff = TransformerFactory.newInstance();
+        tff.setURIResolver(resolver);
+        Templates tt = null;
+        Transformer tf = null;
+
+        // work-a-round is to use a StreamSource.
+        // test should complete
+        System.out.println("StreamSource: pre-Transformer creation");
+        System.out.flush(); // in case import hangs
+        try {
+            InputStream xin = this.getClass().getResourceAsStream("outer.xsl");
+            tt = tff.newTemplates(new StreamSource(xin));
+            tf = tt.newTransformer();
+        } catch (TransformerConfigurationException ex) {
+            ex.printStackTrace();
+            Assert.fail(ex.toString());
+        }
+        System.out.println("StreamSource: post-Transformer creation");
+
+        // CR is that DOMSource never stops resolving
+        System.out.println("DOMSource: pre-Transformer creation");
+        System.out.flush(); // in case import hangs
+        try {
+            InputStream xin = this.getClass().getResourceAsStream("outer.xsl");
+            tt = tff.newTemplates(new DOMSource(load(xin)));
+            tf = tt.newTransformer();
+        } catch (TransformerConfigurationException ex) {
+            ex.printStackTrace();
+            Assert.fail(ex.toString());
+        } catch (IOException ioException) {
+            ioException.printStackTrace();
+            Assert.fail(ioException.toString());
+        }
+        System.out.println("DOMSource: post-Transformer creation");
+    }
+
+    /**
+     * Refer to 6631168 : StAXSource & StAXResult support in JavaSE6
+     */
+    @Test
+    public final void testFeatures() {
+        TransformerFactory tff = TransformerFactory.newInstance();
+        Assert.assertTrue(tff.getFeature(StAXSource.FEATURE));
+        Assert.assertTrue(tff.getFeature(StAXResult.FEATURE));
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerTest.java
new file mode 100644
index 00000000000..d331d2af5a0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerTest.java
@@ -0,0 +1,269 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+import java.io.StringWriter;
+
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.AssertJUnit;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.DTDHandler;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.AttributesImpl;
+
+/*
+ * @summary Test Transformer.
+ */
+public class TransformerTest {
+
+    private static final String LINE_SEPARATOR = System.getProperty("line.separator");
+
+    private static final String XML_DOCUMENT = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<prefix:localName xmlns:prefix=\"namespaceUri\"/>";
+
+    //Test for JDK-6305029
+    @Test
+    public final void testTransform() throws TransformerException {
+
+        // test SAXSource
+        SAXSource saxSource = new SAXSource(new MyXMLReader(), new InputSource());
+
+        StringWriter builder = new StringWriter();
+        TransformerFactory.newInstance().newTransformer().transform(saxSource, new StreamResult(builder));
+
+        AssertJUnit.assertEquals("Identity transform of SAXSource", XML_DOCUMENT, builder.toString());
+
+        // test StreamSource
+        StreamSource streamSource = new StreamSource(new StringReader(XML_DOCUMENT));
+
+        StringWriter streamResult = new StringWriter();
+
+        TransformerFactory.newInstance().newTransformer().transform(streamSource, new StreamResult(streamResult));
+
+        AssertJUnit.assertEquals("Identity transform of StreamSource", XML_DOCUMENT, streamResult.toString());
+    }
+
+    private static class MyXMLReader implements XMLReader {
+
+        private static final String NAMESPACES = "http://xml.org/sax/features/namespaces";
+
+        private static final String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes";
+
+        private boolean namespaces = true;
+
+        private boolean namespacePrefixes = false;
+
+        private EntityResolver resolver;
+
+        private DTDHandler dtdHandler;
+
+        private ContentHandler contentHandler;
+
+        private ErrorHandler errorHandler;
+
+        public boolean getFeature(final String name) throws SAXNotRecognizedException, SAXNotSupportedException {
+
+            if (name.equals(NAMESPACES)) {
+                return namespaces;
+            } else if (name.equals(NAMESPACE_PREFIXES)) {
+                return namespacePrefixes;
+            } else {
+                throw new SAXNotRecognizedException();
+            }
+        }
+
+        public void setFeature(final String name, final boolean value) throws SAXNotRecognizedException, SAXNotSupportedException {
+
+            if (name.equals(NAMESPACES)) {
+                namespaces = value;
+            } else if (name.equals(NAMESPACE_PREFIXES)) {
+                namespacePrefixes = value;
+            } else {
+                throw new SAXNotRecognizedException();
+            }
+        }
+
+        public Object getProperty(final String name) throws SAXNotRecognizedException, SAXNotSupportedException {
+            return null;
+        }
+
+        public void setProperty(final String name, final Object value) throws SAXNotRecognizedException, SAXNotSupportedException {
+        }
+
+        public void setEntityResolver(final EntityResolver theResolver) {
+            this.resolver = theResolver;
+        }
+
+        public EntityResolver getEntityResolver() {
+            return resolver;
+        }
+
+        public void setDTDHandler(final DTDHandler theHandler) {
+            dtdHandler = theHandler;
+        }
+
+        public DTDHandler getDTDHandler() {
+            return dtdHandler;
+        }
+
+        public void setContentHandler(final ContentHandler handler) {
+            contentHandler = handler;
+        }
+
+        public ContentHandler getContentHandler() {
+            return contentHandler;
+        }
+
+        public void setErrorHandler(final ErrorHandler handler) {
+            errorHandler = handler;
+        }
+
+        public ErrorHandler getErrorHandler() {
+            return errorHandler;
+        }
+
+        public void parse(final InputSource input) throws IOException, SAXException {
+
+            parse();
+        }
+
+        public void parse(final String systemId) throws IOException, SAXException {
+
+            parse();
+        }
+
+        private void parse() throws SAXException {
+            contentHandler.startDocument();
+            contentHandler.startPrefixMapping("prefix", "namespaceUri");
+
+            AttributesImpl atts = new AttributesImpl();
+            if (namespacePrefixes) {
+                atts.addAttribute("", "xmlns:prefix", "xmlns:prefix", "CDATA", "namespaceUri");
+            }
+
+            contentHandler.startElement("namespaceUri", "localName", namespacePrefixes ? "prefix:localName" : "", atts);
+            contentHandler.endElement("namespaceUri", "localName", namespacePrefixes ? "prefix:localName" : "");
+            contentHandler.endPrefixMapping("prefix");
+            contentHandler.endDocument();
+        }
+    }
+
+    @Test
+    public final void testCR6272879() {
+
+        final String xsl = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" + LINE_SEPARATOR
+                + "<xsl:stylesheet version=\"1.0\" xmlns:xsl=\"http://www.w3.org/1999/XSL/Transform\">" + LINE_SEPARATOR
+                + "<xsl:output method=\"xml\" indent=\"no\" encoding=\"ISO-8859-1\"/>" + LINE_SEPARATOR + "<xsl:template match=\"/\">" + LINE_SEPARATOR
+                + "<xsl:element name=\"TransformateurXML\">" + LINE_SEPARATOR + "  <xsl:for-each select=\"XMLUtils/test\">" + LINE_SEPARATOR
+                + "  <xsl:element name=\"test2\">" + LINE_SEPARATOR + "    <xsl:element name=\"valeur2\">" + LINE_SEPARATOR
+                + "      <xsl:attribute name=\"attribut2\">" + LINE_SEPARATOR + "        <xsl:value-of select=\"valeur/@attribut\"/>" + LINE_SEPARATOR
+                + "      </xsl:attribute>" + LINE_SEPARATOR + "      <xsl:value-of select=\"valeur\"/>" + LINE_SEPARATOR + "    </xsl:element>"
+                + LINE_SEPARATOR + "  </xsl:element>" + LINE_SEPARATOR + "  </xsl:for-each>" + LINE_SEPARATOR + "</xsl:element>" + LINE_SEPARATOR
+                + "</xsl:template>" + LINE_SEPARATOR + "</xsl:stylesheet>";
+
+        final String sourceXml = "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>"
+                + LINE_SEPARATOR
+                // "<!DOCTYPE XMLUtils [" + LINE_SEPARATOR +
+                // "<!ELEMENT XMLUtils (test*)>" + LINE_SEPARATOR +
+                // "<!ELEMENT test (valeur*)>" + LINE_SEPARATOR +
+                // "<!ELEMENT valeur (#PCDATA)>" + LINE_SEPARATOR +
+                // "<!ATTLIST valeur attribut CDATA #REQUIRED>]>" +
+                // LINE_SEPARATOR +
+                + "<XMLUtils>" + LINE_SEPARATOR + "  <test>" + LINE_SEPARATOR + "    <valeur attribut=\"Attribut 1\">Valeur 1</valeur>" + LINE_SEPARATOR
+                + "  </test>" + LINE_SEPARATOR + "  <test>" + LINE_SEPARATOR + "    <valeur attribut=\"Attribut 2\">Valeur 2</valeur>" + LINE_SEPARATOR
+                + "  </test>" + LINE_SEPARATOR + "</XMLUtils>";
+
+        Document document;
+        Node node;
+
+        System.out.println("Stylesheet:");
+        System.out.println("==================================");
+        System.out.println(xsl);
+        System.out.println();
+
+        System.out.println("Source file before transformation:");
+        System.out.println("==================================");
+        System.out.println(sourceXml);
+        System.out.println();
+
+        System.out.println("Source file after transformation:");
+        System.out.println("=================================");
+        document = getTransformation(xsl, sourceXml);
+
+        System.out.println(document);
+
+        System.out.println("Node content for element valeur2:");
+        System.out.println("=================================");
+        NodeList nodes = document.getElementsByTagName("valeur2");
+        nodes = document.getElementsByTagName("valeur2");
+        for (int i = 0; i < nodes.getLength(); i++) {
+            node = nodes.item(i);
+            System.out.println("  Node value: " + node.getFirstChild().getNodeValue());
+            System.out.println("  Node attribute: " + node.getAttributes().item(0).getNodeValue());
+
+            AssertJUnit.assertEquals("Node value mismatch", "Valeur " + (i + 1), node.getFirstChild().getNodeValue());
+            AssertJUnit.assertEquals("Node attribute mismatch", "Attribut " + (i + 1), node.getAttributes().item(0).getNodeValue());
+        }
+    }
+
+    private static Document getTransformation(final String xsl, final String sourceXml) {
+
+        Transformer transformer;
+        DOMResult reponse;
+        Document document = null;
+
+        try {
+            InputStream in = new ByteArrayInputStream(xsl.getBytes());
+            transformer = TransformerFactory.newInstance().newTransformer(new StreamSource(in));
+
+            reponse = new DOMResult();
+            transformer.transform(new StreamSource(new ByteArrayInputStream(sourceXml.getBytes())), reponse);
+            document = (Document) reponse.getNode();
+        } catch (Exception e) {
+            String msg = "Exception in getTransformation: " + e;
+            System.err.println(msg);
+            Assert.fail(msg);
+        }
+
+        return (document);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerUtilFactory.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerUtilFactory.java
new file mode 100644
index 00000000000..a234aa0f356
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/TransformerUtilFactory.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import javax.xml.transform.util.DOMUtil;
+import javax.xml.transform.util.SAXUtil;
+import javax.xml.transform.util.StAXUtil;
+import javax.xml.transform.util.StreamUtil;
+import javax.xml.transform.util.TransformerUtil;
+
+public class TransformerUtilFactory {
+
+    public final static String DOM = "dom";
+
+    public final static String SAX = "sax";
+
+    public final static String StAX = "stax";
+
+    public final static String STREAM = "stream";
+
+    /** Creates a new instance of TransformerUtilFactory */
+    private TransformerUtilFactory() {
+    }
+
+    public static TransformerUtil getUtil(String type) throws Exception {
+        if (type.equals(DOM)) {
+            return DOMUtil.getInstance();
+        } else if (type.equals(STREAM))
+            return StreamUtil.getInstance();
+        else if (type.equals(SAX))
+            return SAXUtil.getInstance();
+        else if (type.equals(StAX))
+            return StAXUtil.getInstance();
+        else
+            return null;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/VersionDefaultHandler.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/VersionDefaultHandler.java
new file mode 100644
index 00000000000..26bda31979b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/VersionDefaultHandler.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+public class VersionDefaultHandler extends DefaultHandler {
+
+    private String version = null;
+
+    private String encoding = null;
+
+    /** Creates a new instance of VersionDefaultHandler */
+    public VersionDefaultHandler() {
+    }
+
+    Locator saxLocator = null;
+
+    public void setDocumentLocator(Locator locator) {
+        saxLocator = locator;
+    }
+
+    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+        version = ((org.xml.sax.ext.Locator2) saxLocator).getXMLVersion();
+        encoding = ((org.xml.sax.ext.Locator2) saxLocator).getEncoding();
+    }
+
+    public void error(SAXParseException e) throws SAXException {
+        e.printStackTrace();
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public String getEncoding() {
+        return encoding;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/VersionEventWriter.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/VersionEventWriter.java
new file mode 100644
index 00000000000..c7589da5c32
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/VersionEventWriter.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform;
+
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLEventWriter;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.events.StartDocument;
+import javax.xml.stream.events.XMLEvent;
+
+public class VersionEventWriter implements XMLEventWriter {
+
+    private String version = null;
+
+    private String encoding = null;
+
+    /** Creates a new instance of VersionEventWriter */
+    public VersionEventWriter() {
+    }
+
+    public void add(XMLEvent event) throws XMLStreamException {
+        if (event.getEventType() == XMLStreamConstants.START_DOCUMENT) {
+            version = ((StartDocument) event).getVersion();
+            encoding = ((StartDocument) event).getCharacterEncodingScheme();
+        }
+    }
+
+    public void flush() throws XMLStreamException {
+    }
+
+    public void close() throws XMLStreamException {
+    }
+
+    public void add(XMLEventReader reader) throws XMLStreamException {
+    }
+
+    public java.lang.String getPrefix(java.lang.String uri) throws XMLStreamException {
+        return null;
+    }
+
+    public void setPrefix(java.lang.String prefix, java.lang.String uri) throws XMLStreamException {
+    }
+
+    public void setDefaultNamespace(java.lang.String uri) throws XMLStreamException {
+    }
+
+    public void setNamespaceContext(NamespaceContext context) throws XMLStreamException {
+    }
+
+    public NamespaceContext getNamespaceContext() {
+        return null;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public String getEncoding() {
+        return encoding;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/ViewEditor1.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/ViewEditor1.xsl
new file mode 100644
index 00000000000..f79ca565b63
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/ViewEditor1.xsl
@@ -0,0 +1,50 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="2.0" xmlns:Iteration="http://www.iterationsoftware.com"
+  xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:xalan="http://xml.apache.org/xalan"
+  xmlns:HTML="http://www.w3.org/Profiles/XHTML-transitional" xmlns:v="urn:schemas-microsoft-com:vml"
+  xmlns:local="#local-functions">
+
+  <xsl:output method="xml" encoding="UTF-8" cdata-section-elements="CalcExpression Value"/>
+
+  <xsl:variable name="TabRowHeight">21</xsl:variable>
+
+  <xsl:variable name="DataEditor">
+    <xsl:call-template name="DataEditor"/>
+  </xsl:variable>
+
+  <xsl:variable name="view_type">
+    <xsl:value-of select="//ViewEditor/@ViewType"/>
+  </xsl:variable>
+
+  <xsl:variable name="InitialTabEvent">
+    <xsl:value-of select="//ViewEditor/@Page"/>
+  </xsl:variable>
+
+  <xsl:template match="Iteration">
+    <id>
+      <xsl:value-of
+        select="xalan:nodeset($DataEditor)/DataEditor/View[ContentType=$view_type]/Page[Event=$InitialTabEvent]/@id"/>
+    </id>
+  </xsl:template>
+
+  <xsl:template name="DataEditor">
+    <DataEditor>
+      <View>
+        <ContentType>PieChart</ContentType>
+        <ContentType>ThreeDPieChart</ContentType>
+        <Page id="DATA_OBJECTS">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='DATA_OBJECTS']"/>
+          </xsl:attribute>
+          <Event>datasets</Event>
+        </Page>
+        <Page id="VIEWEDITOR_TAB_FIELDS">
+          <xsl:attribute name="label">
+            <xsl:value-of select="//Translated/String[@name='VIEWEDITOR_TAB_FIELDS']"/>
+          </xsl:attribute>
+          <Event>chartFields</Event>
+        </Page>
+      </View>
+    </DataEditor>
+  </xsl:template>
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/attribset27.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/attribset27.xml
new file mode 100644
index 00000000000..7928e1d0c3b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/attribset27.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<doc>
+  <foo>a</foo>
+</doc>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/attribset27.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/attribset27.xsl
new file mode 100644
index 00000000000..b0b30ab18b4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/attribset27.xsl
@@ -0,0 +1,32 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+  <!-- FileName: attribset27 -->
+  <!-- Document: http://www.w3.org/TR/xslt -->
+  <!-- DocVersion: 19991116 -->
+  <!-- Section: 7.1.4 Named Attribute Sets -->
+  <!-- Purpose: Use xsl:copy with multiple attribute sets with conflicting set name,
+    then reset one attribute with xsl:attribute. -->
+  <!-- Author: Carmelo Montanez --><!-- ResultTree004 in NIST suite -->
+
+<xsl:template match="/">
+  <out>
+    <xsl:copy use-attribute-sets="set1">
+      <xsl:attribute name="text-decoration">none</xsl:attribute>
+    </xsl:copy>
+  </out>
+</xsl:template>
+
+<xsl:attribute-set name="set1">
+  <xsl:attribute name="text-decoration">underline</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:attribute-set name="set1">
+  <xsl:attribute name="color">black</xsl:attribute>
+</xsl:attribute-set>
+
+<xsl:attribute-set name="set1">
+  <xsl:attribute name="font-size">14pt</xsl:attribute>
+</xsl:attribute-set>
+
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog.xml
new file mode 100644
index 00000000000..0fa5eb7ab58
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog.xml
@@ -0,0 +1,2 @@
+<?xml version="1.1" encoding="UTF-8"?>
+<stardb xmlns="http://www.astro.com/astro" xmlns:astro="http://www.astro.com/astro" xsi:schemaLocation="http://www.astro.com/astro catalog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><_test01></_test01><test-02 xmlns:xsi=""></test-02><test.03></test.03><_test-04>T%e!s#t$</_test-04><star><hr>1</hr><constellation/><fullname/><ra><h>00</h><m>05</m><s>09.9</s><dv>0.08608333333333333</dv></ra><dec><sgn/><d>45</d><m>13</m><s>45</s><dv>45.22916666666667</dv></dec><glng>114.44</glng><glat>-16.88</glat><vmag>6.70</vmag><spec>A1Vn</spec></star><star><hr>2</hr><constellation/><fullname/><ra><h>00</h><m>05</m><s>03.8</s><dv>0.08438888888888889</dv></ra><dec><sgn>-</sgn><d>00</d><m>30</m><s>11</s><dv>-0.5030555555555556</dv></dec><glng>98.33</glng><glat>-61.14</glat><vmag>6.29</vmag><spec>gG9</spec></star><star><hr>3</hr><constellation>Psc</constellation><fullname>33    Psc</fullname><ra><h>00</h><m>05</m><s>20.1</s><dv>0.08891666666666666</dv></ra><dec><sgn>-</sgn><d>05</d><m>42</m><s>27</s><dv>-5.7075000000000005</dv></dec><glng>93.75</glng><glat>-65.93</glat><vmag>4.61</vmag><spec>K0IIIbCN-0.5</spec></star><star><hr>4</hr><constellation>Peg</constellation><fullname>86    Peg</fullname><ra><h>00</h><m>05</m><s>42.0</s><dv>0.095</dv></ra><dec><sgn/><d>13</d><m>23</m><s>46</s><dv>13.39611111111111</dv></dec><glng>106.19</glng><glat>-47.98</glat><vmag>5.51</vmag><spec>G5III</spec></star><star><hr>5</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>16.0</s><dv>0.10444444444444445</dv></ra><dec><sgn/><d>58</d><m>26</m><s>12</s><dv>58.43666666666666</dv></dec><glng>117.03</glng><glat>-03.92</glat><vmag>5.96</vmag><spec>G5V</spec></star><star><hr>6</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>19.0</s><dv>0.10527777777777779</dv></ra><dec><sgn>-</sgn><d>49</d><m>04</m><s>30</s><dv>-49.075</dv></dec><glng>321.61</glng><glat>-66.38</glat><vmag>5.70</vmag><spec>G1IV</spec></star><star><hr>7</hr><constellation>Cas</constellation><fullname>10    Cas</fullname><ra><h>00</h><m>06</m><s>26.5</s><dv>0.10736111111111112</dv></ra><dec><sgn/><d>64</d><m>11</m><s>46</s><dv>64.19611111111111</dv></dec><glng>118.06</glng><glat>1.75</glat><vmag>5.59</vmag><spec>B9III</spec></star><star><hr>8</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>36.8</s><dv>0.11022222222222222</dv></ra><dec><sgn/><d>29</d><m>01</m><s>17</s><dv>29.02138888888889</dv></dec><glng>111.26</glng><glat>-32.83</glat><vmag>6.13</vmag><spec>K0V</spec></star><star><hr>9</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>50.1</s><dv>0.11391666666666667</dv></ra><dec><sgn>-</sgn><d>23</d><m>06</m><s>27</s><dv>-23.1075</dv></dec><glng>52.21</glng><glat>-79.14</glat><vmag>6.18</vmag><spec>A7V</spec></star><star><hr>10</hr><constellation/><fullname/><ra><h>00</h><m>07</m><s>18.2</s><dv>0.12172222222222222</dv></ra><dec><sgn>-</sgn><d>17</d><m>23</m><s>11</s><dv>-17.386388888888888</dv></dec><glng>74.36</glng><glat>-75.90</glat><vmag>6.19</vmag><spec>A6Vn</spec></star></stardb>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog.xsd
new file mode 100644
index 00000000000..6e95cb8e31f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog.xsd
@@ -0,0 +1,122 @@
+<xs:schema 
+    xmlns:xs="http://www.w3.org/2001/XMLSchema"
+    targetNamespace="http://www.astro.com/astro" 
+    xmlns:astro="http://www.astro.com/astro"
+    elementFormDefault="qualified"
+    attributeFormDefault="qualified"
+>
+    <!-- Star Identification String Type  -->
+    <xs:simpleType name="staridType">
+	<xs:restriction base="xs:string">
+	    <xs:maxLength value="4"/>
+	</xs:restriction>
+    </xs:simpleType>
+
+    <!-- Hour Type -->
+    <xs:simpleType name="hourType">
+	<xs:restriction base="xs:decimal">
+	    <xs:minInclusive value="0.0"/>
+	    <xs:maxInclusive value="24.0"/>
+	</xs:restriction>
+    </xs:simpleType>
+
+    <!-- Minute Type -->
+    <xs:simpleType name="minuteType">
+	<xs:restriction base="xs:decimal">
+	    <xs:minInclusive value="0.0"/>
+	    <xs:maxInclusive value="60.0"/>
+	</xs:restriction>
+    </xs:simpleType>
+
+    <!-- Second Type -->
+    <xs:simpleType name="secondType">
+	<xs:restriction base="xs:decimal">
+	    <xs:minInclusive value="0.0"/>
+	    <xs:maxInclusive value="60.0"/>
+	</xs:restriction>
+    </xs:simpleType>
+
+    <xs:simpleType name="decimalValueType">
+	<xs:restriction base="xs:decimal">
+	</xs:restriction>
+    </xs:simpleType> 
+
+    <xs:simpleType name="degType">
+	<xs:restriction base="xs:decimal">
+	    <xs:minInclusive value="-90.0"/>
+	    <xs:maxInclusive value="90.0"/>
+	</xs:restriction>
+    </xs:simpleType> 
+
+    <xs:simpleType name="vmagType">
+	<xs:restriction base="xs:decimal">
+	    <xs:minInclusive value="-3.0"/>
+	    <xs:maxInclusive value="12.0"/>
+	</xs:restriction>
+    </xs:simpleType> 
+
+
+    <xs:simpleType name="signType">
+	<xs:restriction base="xs:string">
+	    <xs:enumeration value="+"/>
+	    <xs:enumeration value="-"/>
+	    <xs:enumeration value=""/>
+	</xs:restriction>
+    </xs:simpleType> 
+
+    <xs:complexType name="raType">
+	<xs:sequence>
+	    <xs:element name="h"  type="astro:hourType"/>
+	    <xs:element name="m"  type="astro:minuteType"/>
+	    <xs:element name="s"  type="astro:secondType"/>
+	    <xs:element name="dv" type="astro:decimalValueType"/>
+	</xs:sequence>
+    </xs:complexType>
+
+    <xs:complexType name="decType">
+	<xs:sequence>
+	    <xs:element name="sgn" type="astro:signType"/>
+	    <xs:element name="d"   type="astro:degType"/>
+	    <xs:element name="m"   type="astro:minuteType"/>
+	    <xs:element name="s"   type="astro:secondType"/>
+	    <xs:element name="dv"  type="astro:decimalValueType"/>
+	</xs:sequence>
+    </xs:complexType>
+
+
+    <xs:complexType name="starType">
+	<xs:sequence>
+	    <xs:element name="hr"            type="astro:staridType"/>
+	    <xs:element name="constellation" type="xs:string"/>
+	    <xs:element name="fullname"      type="xs:string"/>
+	    <xs:element name="ra"            type="astro:raType"/>
+	    <xs:element name="dec"           type="astro:decType"/>
+	    <xs:element name="glng"          type="xs:decimal"/>
+	    <xs:element name="glat"          type="xs:decimal"/>
+	    <xs:element name="vmag"          type="astro:vmagType"/>
+	    <xs:element name="spec"          type="xs:string"/>
+	</xs:sequence>
+    </xs:complexType>
+
+
+    <!-- The real part of the catalog starts here -->
+    <xs:element name="stardb">
+       <xs:complexType>
+          <xs:sequence>
+
+	     <!-- for testing purposes -->
+	     <xs:element name="_test01" type="xs:string"
+		minOccurs="0" maxOccurs="1"/>
+	     <xs:element name="test-02" type="xs:string"/>
+	     <xs:element name="test.03" type="xs:string"/>
+	     <xs:element name="_test-04" type="xs:string"/>
+
+	     <!-- astro data elements -->
+             <xs:element name="star" type="astro:starType"
+	        minOccurs="0" maxOccurs="unbounded"/>
+          </xs:sequence>
+       </xs:complexType>
+    </xs:element>
+    <!-- The real part of the catalog ends here -->
+
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog_10.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog_10.xml
new file mode 100644
index 00000000000..6e64e81e8c4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/catalog_10.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<stardb xmlns="http://www.astro.com/astro" xmlns:astro="http://www.astro.com/astro" xsi:schemaLocation="http://www.astro.com/astro catalog.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><_test01></_test01><test-02></test-02><test.03></test.03><_test-04>T%e!s#t$</_test-04><star><hr>1</hr><constellation/><fullname/><ra><h>00</h><m>05</m><s>09.9</s><dv>0.08608333333333333</dv></ra><dec><sgn/><d>45</d><m>13</m><s>45</s><dv>45.22916666666667</dv></dec><glng>114.44</glng><glat>-16.88</glat><vmag>6.70</vmag><spec>A1Vn</spec></star><star><hr>2</hr><constellation/><fullname/><ra><h>00</h><m>05</m><s>03.8</s><dv>0.08438888888888889</dv></ra><dec><sgn>-</sgn><d>00</d><m>30</m><s>11</s><dv>-0.5030555555555556</dv></dec><glng>98.33</glng><glat>-61.14</glat><vmag>6.29</vmag><spec>gG9</spec></star><star><hr>3</hr><constellation>Psc</constellation><fullname>33    Psc</fullname><ra><h>00</h><m>05</m><s>20.1</s><dv>0.08891666666666666</dv></ra><dec><sgn>-</sgn><d>05</d><m>42</m><s>27</s><dv>-5.7075000000000005</dv></dec><glng>93.75</glng><glat>-65.93</glat><vmag>4.61</vmag><spec>K0IIIbCN-0.5</spec></star><star><hr>4</hr><constellation>Peg</constellation><fullname>86    Peg</fullname><ra><h>00</h><m>05</m><s>42.0</s><dv>0.095</dv></ra><dec><sgn/><d>13</d><m>23</m><s>46</s><dv>13.39611111111111</dv></dec><glng>106.19</glng><glat>-47.98</glat><vmag>5.51</vmag><spec>G5III</spec></star><star><hr>5</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>16.0</s><dv>0.10444444444444445</dv></ra><dec><sgn/><d>58</d><m>26</m><s>12</s><dv>58.43666666666666</dv></dec><glng>117.03</glng><glat>-03.92</glat><vmag>5.96</vmag><spec>G5V</spec></star><star><hr>6</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>19.0</s><dv>0.10527777777777779</dv></ra><dec><sgn>-</sgn><d>49</d><m>04</m><s>30</s><dv>-49.075</dv></dec><glng>321.61</glng><glat>-66.38</glat><vmag>5.70</vmag><spec>G1IV</spec></star><star><hr>7</hr><constellation>Cas</constellation><fullname>10    Cas</fullname><ra><h>00</h><m>06</m><s>26.5</s><dv>0.10736111111111112</dv></ra><dec><sgn/><d>64</d><m>11</m><s>46</s><dv>64.19611111111111</dv></dec><glng>118.06</glng><glat>1.75</glat><vmag>5.59</vmag><spec>B9III</spec></star><star><hr>8</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>36.8</s><dv>0.11022222222222222</dv></ra><dec><sgn/><d>29</d><m>01</m><s>17</s><dv>29.02138888888889</dv></dec><glng>111.26</glng><glat>-32.83</glat><vmag>6.13</vmag><spec>K0V</spec></star><star><hr>9</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>50.1</s><dv>0.11391666666666667</dv></ra><dec><sgn>-</sgn><d>23</d><m>06</m><s>27</s><dv>-23.1075</dv></dec><glng>52.21</glng><glat>-79.14</glat><vmag>6.18</vmag><spec>A7V</spec></star><star><hr>10</hr><constellation/><fullname/><ra><h>00</h><m>07</m><s>18.2</s><dv>0.12172222222222222</dv></ra><dec><sgn>-</sgn><d>17</d><m>23</m><s>11</s><dv>-17.386388888888888</dv></dec><glng>74.36</glng><glat>-75.90</glat><vmag>6.19</vmag><spec>A6Vn</spec></star></stardb>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/config.dtd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/config.dtd
new file mode 100644
index 00000000000..35a0568076c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/config.dtd
@@ -0,0 +1,2 @@
+<!ELEMENT config (subConfig)*>
+<!ATTLIST config type CDATA #REQUIRED>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/config.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/config.xml
new file mode 100644
index 00000000000..04be32e7ad6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/config.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE configDescription SYSTEM "config.dtd">
+<config type="key1">
+</config>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/default-layout.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/default-layout.xsl
new file mode 100644
index 00000000000..ab50d03bca7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/default-layout.xsl
@@ -0,0 +1,280 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+	xmlns:m="http://msqr.us/xsd/matte"
+	xmlns:x="http://msqr.us/xsd/jaxb-web"
+	exclude-result-prefixes="m x">
+
+	<xsl:import href="global.xsl"/>
+	
+	<xsl:output method="xml" omit-xml-declaration="no" 
+		doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" 
+		doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
+		media-type="text/xml"/>
+    
+	<!-- 
+		Layout Stylesheet
+		
+		This stylesheet is not designed to be used directly, rather it should be 
+		imported or included into another stylesheet. That stylesheet must define
+		the following variables:
+		
+		layout.global.nav.page: the current global nav page
+		
+		The layout of this template is as roughly as follows:
+		
+		+============================================================+
+		| PAGE-HEAD-CONTENT, PAGE-BODY-CLASS                         |
+		+============================================================+
+		| PAGE-TITLE                                 PAGE-GLOBAL-NAV |
+		| - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  |
+		| PAGE-SUB-NAV-DATA                             PAGE-SUB-NAV |
+		| - - - - - - - - - - - - - - - - - - - - - - - - - - - - -  |
+		| PAGE-BODY                                                  |
+		|                                                            |
+		| PAGE-FOOTER                                                |
+		+============================================================+
+		
+		Thus implementing stylesheets should define templates that match 
+		the x:x-data element for the mode of the elements outlined 
+		above (the modes should be lower-case). This stylesheet does 
+		provide defaults for some of these elements, so to override 
+		those defaults you must import this stylesheet rather than 
+		include it.
+	-->
+	<xsl:template match="x:x-data">
+		<xsl:variable name="layout.page.title">
+			<xsl:apply-templates select="." mode="page-title"/>
+		</xsl:variable>
+		<xsl:variable name="layout.body.class">
+			<xsl:apply-templates select="." mode="page-body-class"/>
+		</xsl:variable>
+		<!--html xmlns="http://www.w3.org/1999/xhtml"-->
+		<html>
+			<head>
+				<meta http-equiv="content-type" content="text/html; charset=utf-8" />
+				<title><xsl:value-of select="$layout.page.title"/></title>
+				<link rel="stylesheet" type="text/css" href="{$web-context}/css/matte-global.css" media="screen,print"/>
+				<script type="text/javascript" src="{$web-context}/js/sniff.js"><xsl:text> </xsl:text></script>
+				<script type="text/javascript" src="{$web-context}/js/prototype.js"><xsl:text> </xsl:text></script>
+				<script type="text/javascript" src="{$web-context}/js/behaviour.js"><xsl:text> </xsl:text></script>
+				<script type="text/javascript" src="{$web-context}/js/scriptaculous.js"><xsl:text> </xsl:text></script>
+				<script type="text/javascript" src="{$web-context}/js/xslt/misc.js"><xsl:text> </xsl:text></script>
+				<script type="text/javascript" src="{$web-context}/js/xslt/dom.js"><xsl:text> </xsl:text></script>
+				<script type="text/javascript" src="{$web-context}/js/xslt/xpath.js"><xsl:text> </xsl:text></script>
+				<script type="text/javascript" src="{$web-context}/js/xpath.js"><xsl:text> </xsl:text></script>
+				<script id="matte-classes-js" type="text/javascript" src="{$web-context}/js/matte-classes.js?context={$web-context}"><xsl:text> </xsl:text></script>
+				<script type="text/javascript" src="{$web-context}/js/matte-global.js"><xsl:text> </xsl:text></script>
+				<script id="locale-js" type="text/javascript" src="{$web-context}/js/matte-locale.js?lang={$ctx/x:user-locale}"><xsl:text> </xsl:text></script>
+				<xsl:apply-templates select="." mode="page-head-content"/>
+			</head>
+			<body>
+				<xsl:if test="string($layout.body.class)">
+					<xsl:attribute name="class">
+						<xsl:value-of select="$layout.body.class"/>
+					</xsl:attribute>
+				</xsl:if>
+				
+				<h1><xsl:value-of select="$layout.page.title"/></h1>
+                
+				<xsl:apply-templates select="." mode="page-main-nav"/>
+				
+				<!-- Only output the sub-nav <div> if some content is generated for it -->
+				<xsl:variable name="layout.page.sub.nav">
+					<xsl:apply-templates select="." mode="page-sub-nav"/>
+				</xsl:variable>
+				<xsl:if test="string($layout.page.sub.nav)">
+					<div id="sub-nav">
+						<xsl:copy-of select="$layout.page.sub.nav"/>
+					</div>
+				</xsl:if>
+				
+				<!-- Only output the sub-nav-data <div> if some content is generated for it -->
+				<xsl:variable name="layout.page.sub.nav.data">
+					<xsl:apply-templates select="." mode="page-sub-nav-data"/>
+				</xsl:variable>
+				<xsl:if test="string($layout.page.sub.nav.data)">
+					<div id="sub-nav-data">
+						<xsl:copy-of select="$layout.page.sub.nav.data"/>
+					</div>
+				</xsl:if>
+				
+				<xsl:call-template name="error-intro">
+					<xsl:with-param name="errors-node" select="x:x-errors"/>
+				</xsl:call-template>
+
+                <xsl:apply-templates select="." mode="page-body"/>
+                
+			</body>
+		</html>
+	</xsl:template>
+
+	<!-- 
+		PAGE-TITLE
+		
+		Render the browser page title as well as the main heading. This should 
+		return a simple string, without any markup.
+	-->
+	<xsl:template match="x:x-data" mode="page-title">
+		<xsl:value-of select="key('i18n','title')"/>
+	</xsl:template>
+	
+	<!--
+		PAGE-MAIN-NAV
+		
+		Default implementation: calls "global-nav" template with $page = 'home'.
+	-->
+	<xsl:template match="x:x-data" mode="page-main-nav">
+		<xsl:call-template name="main-nav">
+			<xsl:with-param name="page" select="'home'"/>
+		</xsl:call-template>
+	</xsl:template>
+	
+	<!--
+		MAIN-NAV
+		
+		Global vars:
+		acting-user: the logged in user, if logged in
+		web-context: the web context
+	-->
+	<xsl:template name="main-nav">
+		<xsl:param name="page"/>
+		<div id="main-nav">
+			<xsl:if test="$acting-user">
+				<xsl:choose>
+					<xsl:when test="$page = 'home'">
+						<xsl:value-of select="key('i18n','link.home')"/>
+					</xsl:when>
+					<xsl:otherwise>
+						<a href="{$web-context}/home.do" title="{key('i18n','link.home.title')}"
+							alt="{key('i18n','link.home.title')}">
+							<xsl:value-of select="key('i18n','link.home')"/>
+						</a>
+					</xsl:otherwise>
+				</xsl:choose>
+				<xsl:text> - </xsl:text>
+				<xsl:choose>
+					<xsl:when test="$page = 'upload'">
+						<xsl:value-of select="key('i18n','link.upload')"/>
+					</xsl:when>
+					<xsl:otherwise>
+						<a href="{$web-context}/add.do" title="{key('i18n','link.upload.title')}"
+							alt="{key('i18n','link.upload')}">
+							<xsl:attribute name="href">
+								<xsl:value-of select="$web-context"/>
+								<xsl:text>/add.do</xsl:text>
+								<xsl:if test="/x:x-data/x:x-request/x:param[@key='collectionId']">
+									<xsl:text>?collectionId=</xsl:text>
+									<xsl:value-of select="/x:x-data/x:x-request/x:param[@key='collectionId']"/>
+								</xsl:if>
+							</xsl:attribute>
+							<xsl:value-of select="key('i18n','link.upload')"/>
+						</a>
+					</xsl:otherwise>
+				</xsl:choose>
+				<!--xsl:text> - </xsl:text>
+				<xsl:choose>
+					<xsl:when test="$page = 'search'">
+						<xsl:value-of select="key('i18n','link.search')"/>
+					</xsl:when>
+					<xsl:otherwise>
+						<a href="{$web-context}/search.do" title="{key('i18n','link.search.title')}"
+							alt="{key('i18n','link.search.title')}">
+							<xsl:value-of select="key('i18n','link.search')"/>
+						</a>
+					</xsl:otherwise>
+				</xsl:choose>
+				<xsl:text> - </xsl:text>
+				<xsl:choose>
+					<xsl:when test="$page = 'settings'">
+						<xsl:value-of select="key('i18n','link.settings')"/>
+					</xsl:when>
+					<xsl:otherwise>
+						<a href="{$web-context}/settings.do" title="{key('i18n','link.settings.title')}"
+							alt="{key('i18n','link.settings.title')}">
+							<xsl:value-of select="key('i18n','link.settings')"/>
+						</a>
+					</xsl:otherwise>
+				</xsl:choose>
+				<xsl:text> - </xsl:text>
+				<xsl:choose>
+					<xsl:when test="$page = 'themes'">
+						<xsl:value-of select="key('i18n','link.themes')"/>
+					</xsl:when>
+					<xsl:otherwise>
+						<a href="{$web-context}/themes.do" title="{key('i18n','link.themes.title')}"
+							alt="{key('i18n','link.themes.title')}">
+							<xsl:value-of select="key('i18n','link.themes')"/>
+						</a>
+					</xsl:otherwise>
+				</xsl:choose-->
+			</xsl:if>
+			<xsl:if test="$acting-user">
+				<xsl:text> - </xsl:text>
+			</xsl:if>
+			<xsl:choose>
+				<xsl:when test="$acting-user">
+					<xsl:if test="$acting-user/../@admin = 'true'">
+						<xsl:choose>
+							<xsl:when test="$page = 'admin'">
+								<xsl:value-of select="key('i18n','link.admin')"/>
+							</xsl:when>
+							<xsl:otherwise>
+								<a href="{$web-context}/admin.do" title="{key('i18n','link.admin.title')}">
+									<xsl:value-of select="key('i18n','link.admin')"/>
+								</a>
+							</xsl:otherwise>
+						</xsl:choose>
+						<xsl:text> - </xsl:text>
+					</xsl:if>
+					<a href="{$web-context}/logoff.do" title="{key('i18n','link.logout.title')}">
+						<xsl:value-of select="key('i18n','link.logout')"/>
+					</a>
+					<xsl:text> (</xsl:text>
+					<xsl:value-of select="$acting-user/@name"/>
+					<xsl:text>)</xsl:text>
+				</xsl:when>
+				<xsl:when test="$page = 'logon'">
+					<xsl:value-of select="key('i18n','link.logon')"/>
+				</xsl:when>
+				<xsl:otherwise>
+					<a href="{$web-context}/logon.do" title="{key('i18n','link.logon.title')}">
+						<xsl:value-of select="key('i18n','link.logon')"/>
+					</a>
+				</xsl:otherwise>
+			</xsl:choose>
+		</div>
+	</xsl:template>
+	
+	<!--
+		PAGE-HEAD-CONTENT (empty implementation)
+		
+		Can be used to insert more links (CSS, JavaScript) into <head> section.
+	-->
+	<xsl:template match="x:x-data" mode="page-head-content"/>
+	
+	<!--
+		PAGE-SUB-NAV (empty implementation)
+	-->
+	<xsl:template match="x:x-data" mode="page-sub-nav"/>
+	
+	<!--
+		PAGE-SUB-NAV-DATA (empty implementation)
+	-->
+	<xsl:template match="x:x-data" mode="page-sub-nav-data"/>
+	
+	<!-- 
+		PAGE-BODY-CLASS
+		
+		Add a "class" attribute to the <body> tag. Default implementation 
+		does not specify any value, so no class attribute added.
+	-->
+	<xsl:template match="x:x-data" mode="page-body-class"/>
+	
+	<!--
+		PAGE-BODY (empty implementation)
+		
+		Main page content.
+	-->
+	<xsl:template match="x:x-data" mode="page-body"/>
+	
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/global-variables.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/global-variables.xsl
new file mode 100644
index 00000000000..9f7098544a2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/global-variables.xsl
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:m="http://msqr.us/xsd/matte"
+	xmlns:x="http://msqr.us/xsd/jaxb-web"
+	version="1.0">
+
+	<!-- standard data vars -->
+	<xsl:variable name="aux" select="x:x-data/x:x-auxillary"/>
+	<xsl:variable name="ctx" select="x:x-data/x:x-context"/>
+	<xsl:variable name="err" select="x:x-data/x:x-errors/x:error[@field]"/>
+	<xsl:variable name="req" select="x:x-data/x:x-request/x:param"/>
+	<xsl:variable name="ses" select="x:x-data/x:x-session"/>
+	
+	<!-- helper vars -->
+	<xsl:variable name="acting-user" select="x:x-data/x:x-session[1]/m:session[1]/m:acting-user[1]"/>
+	<xsl:variable name="server-name" select="string($ctx/x:server-name)"/>
+	<xsl:variable name="server-port" select="string($ctx/x:server-port)"/>
+	<xsl:variable name="user-locale" select="string($ctx/x:user-locale)"/>
+	<xsl:variable name="web-context" select="string($ctx/x:web-context)"/>
+	<xsl:variable name="web-path" select="string($ctx/x:path)"/>
+	
+	<!-- application context defined as key for quick lookup -->
+	<xsl:key name="appenv" match="x:x-data/x:x-auxillary/m:app-context/m:meta" use="@key"/>
+	
+	<!-- auxillaray params defined as key for quick lookup -->
+	<xsl:key name="aux-param" match="x:x-data/x:x-auxillary/x:x-param" use="@key"/>
+	
+	<!-- message resource bundle defined as key for quick lookup -->
+	<xsl:key name="i18n" match="x:x-data/x:x-msg/x:msg" use="@key"/>
+	
+	<!-- request params defined as key for quick lookup -->
+	<xsl:key name="req-param" match="x:x-data/x:x-request/x:param" use="@key"/>
+	
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/global.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/global.xsl
new file mode 100644
index 00000000000..6896e7e0849
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/global.xsl
@@ -0,0 +1,272 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:m="http://msqr.us/xsd/matte"
+	xmlns:x="http://msqr.us/xsd/jaxb-web"
+	exclude-result-prefixes="m x">
+	
+	<xsl:import href="global-variables.xsl"/>
+	<xsl:import href="util.xsl"/>
+	
+	<!-- 
+		Generate <div> with error messages, if errors present.
+		
+		@param errors-node the x:errors element (optional)
+	  -->
+ 	<xsl:template name="error-intro">
+ 		<xsl:param name="errors-node" select="/x:x-data/x:x-errors"/>
+		<xsl:if test="$errors-node/x:error">
+			<div class="error-intro">
+				<xsl:if test="$errors-node/x:error[not(@field)]">
+					<!--<xsl:value-of select="$messages[@key='global.error.intro']"/>
+					<xsl:text> </xsl:text>-->
+					<xsl:apply-templates select="$errors-node/x:error[not(@field)]"/>
+				</xsl:if>
+				<xsl:if test="$errors-node/x:error[@field]">
+					<xsl:value-of select="key('i18n','field.error.intro')"/>
+					<ul>
+						<xsl:for-each select="$errors-node/x:error[@field]">
+							<li><xsl:value-of select="."/></li>
+						</xsl:for-each>
+					</ul>
+				</xsl:if>
+			</div>
+		</xsl:if>
+	</xsl:template>
+	
+	<!--
+		Generate a server URL, eg. http://myhost
+	 -->
+	<xsl:template name="server-url">
+		<xsl:variable name="port" select="$ctx/x:server-port"/>
+		<xsl:text>http</xsl:text>
+		<xsl:if test="$port = '443'">
+			<xsl:text>s</xsl:text>
+		</xsl:if>
+		<xsl:text>://</xsl:text>
+		<xsl:value-of select="$ctx/x:server-name"/>
+		<xsl:if test="$port != '80' and $port != '443'">
+			<xsl:text>:</xsl:text>
+			<xsl:value-of select="$port"/>
+		</xsl:if>
+	</xsl:template>
+
+	<!--
+		Generate the public absolute URL for viewing an album.
+	  -->
+	<xsl:template match="m:album" mode="view.album.absolute.url">
+		<xsl:call-template name="server-url"/>
+		<xsl:apply-templates select="." mode="view.album.relative.url"/>
+	</xsl:template>
+	
+	<!--
+		Generate the public relative URL for viewing an album.
+	-->
+	<xsl:template match="m:album" mode="view.album.relative.url">
+		<xsl:value-of select="$web-context"/>
+		<xsl:text>/album.do?key=</xsl:text>
+		<xsl:value-of select="@anonymous-key"/>
+	</xsl:template>
+	
+
+	<!--
+		Named Template: render-media-server-url
+		
+		Generate the URL for an image for the MediaServer server. For example:
+		
+		render-media-server-url(item = $MediaItem{id = 1565}, quality = 'GOOD', size = 'THUMB_NORMAL')
+		
+		=> media.do?id=1565&size=THUMB_NORMAL&quality=GOOD
+		
+		Parameters:
+		item - a MediaItem node
+		quality (opt) - value to use for the MediaServer quality parameter
+		size (opt) - value to use for the MediaServer size parameter
+		download (opt) - if set, add download=true flag
+		album-key (opt) - if set and original = true, then add for original downloading
+		original (opt) - if set, then generate URL for downloading original media
+		web-context - the web context
+	-->
+	<xsl:template name="render-media-server-url">
+		<xsl:param name="item"/>
+		<xsl:param name="quality"/>
+		<xsl:param name="size"/>
+		<xsl:param name="download"/>
+		<xsl:param name="album-key"/>
+		<xsl:param name="original"/>
+		<xsl:param name="web-context"/>
+		
+		<xsl:value-of select="$web-context"/>
+		<xsl:text>/media.do?id=</xsl:text>
+		<xsl:value-of select="$item/@item-id"/>
+		<xsl:if test="$album-key">
+			<xsl:text>&amp;albumKey=</xsl:text>
+			<xsl:value-of select="$album-key"/>
+		</xsl:if>
+		<xsl:choose>
+			<xsl:when test="$original">
+				<xsl:text>&amp;original=true</xsl:text>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:text>&amp;size=</xsl:text>
+				<xsl:value-of select="$size"/>
+				<xsl:if test="$quality">
+					<xsl:text>&amp;quality=</xsl:text>
+					<xsl:value-of select="$quality"/>
+				</xsl:if>
+			</xsl:otherwise>
+		</xsl:choose>
+		<xsl:if test="$download">
+			<xsl:text>&amp;download=true</xsl:text>
+		</xsl:if>
+	</xsl:template>
+
+
+	<!--
+		Named Template: render-view-album-url
+		
+		Generate the URL for viewing a public album.
+		
+		=> /viewAlbum.do?key=ABC
+		
+		Parameters:
+		album - an Album
+		web-context - the web context
+		item-id - (opt) the ID of an item to display
+	-->
+	<xsl:template name="render-shared-album-url">
+		<xsl:param name="album"/>
+		<xsl:param name="web-context"/>
+		<xsl:param name="item-id"/>
+		<xsl:value-of select="$web-context"/>
+		<xsl:text>/album.do?key=</xsl:text>
+		<xsl:value-of select="$album/@anonymous-key"/>
+		<xsl:if test="$item-id">
+			<xsl:text>&amp;itemId=</xsl:text>
+			<xsl:value-of select="$item-id"/>
+		</xsl:if>
+	</xsl:template>
+
+	<!--
+		Named Template: render-file-size
+		
+		Generate text representation of the size of a file. For example:
+		
+		render-file-size(size = 14875) => 14.53 KB
+		
+		Parameters:
+		size - an integer, assumed to be the number of bytes of the file
+	-->
+	<xsl:template name="render-file-size">
+		<xsl:param name="size"/>
+		<xsl:choose>
+			<xsl:when test="$size &gt; 1048576">
+				<xsl:value-of select="format-number($size div 1048576,'#,##0.##')"/>
+				<xsl:text> MB</xsl:text>
+			</xsl:when>
+			<xsl:when test="$size &gt; 1024">
+				<xsl:value-of select="format-number($size div 1024,'#,##0.##')"/>
+				<xsl:text> KB</xsl:text>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:value-of select="format-number($size div 1024,'#,##0')"/>
+				<xsl:text> bytes</xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+
+	<!--
+		Named Template: render-download-album-url
+		
+		Generate the URL to download an album.
+		
+		Parameters:
+		key - the album anonymous key
+		albumId - (optional) the album ID
+		orig - if true, download original media items
+	-->
+	<xsl:template name="render-download-album-url">
+		<xsl:param name="quality"/>
+		<xsl:param name="size"/>
+		<xsl:param name="download"/>
+		<xsl:param name="album-key"/>
+		<xsl:param name="original"/>
+		<xsl:param name="web-context"/>
+		<xsl:value-of select="$web-context"/>
+		
+		<xsl:text>/downloadAlbum.do?albumKey=</xsl:text>
+		<xsl:value-of select="$album-key"/>
+		<xsl:choose>
+			<xsl:when test="$original">
+				<xsl:text>&amp;original=true</xsl:text>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:if test="$size">
+					<xsl:text>&amp;size=</xsl:text>
+					<xsl:value-of select="$size"/>
+				</xsl:if>
+				<xsl:if test="$quality">
+					<xsl:text>&amp;quality=</xsl:text>
+					<xsl:value-of select="$quality"/>
+				</xsl:if>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	
+	<!--
+		Named Template: render-i18n-options
+		
+		Render a set of <option> elements for a list of items, 
+		using i18n keys for the display values.
+		
+		Parameters:
+		content-key-prefix: the prefix for the i18n key values, to prepend to 
+		                    each item in the value-list
+		value-list:         a comma-delimited list of key values
+		selected-value:     the value to mark as selected
+	-->
+	<xsl:template name="render-i18n-options">
+		<xsl:param name="content-key-prefix"/>
+		<xsl:param name="selected-value"/>
+		<xsl:param name="value-list"/>
+		
+		<xsl:variable name="first" select="substring-before($value-list,',')"/>
+		<xsl:variable name="rest" select="substring-after($value-list,',')"/>
+		
+		<option value="{$first}">
+			<xsl:if test="$first = $selected-value">
+				<xsl:attribute name="selected">selected</xsl:attribute>
+			</xsl:if>
+			<xsl:value-of select="key('i18n',concat($content-key-prefix,$first))"/>
+		</option>
+		
+		<xsl:if test="$rest">
+			<xsl:call-template name="render-i18n-options">
+				<xsl:with-param name="selected-value" select="$selected-value"/>
+				<xsl:with-param name="value-list" select="$rest"/>
+				<xsl:with-param name="content-key-prefix" select="$content-key-prefix"/>
+			</xsl:call-template>
+		</xsl:if>
+		
+	</xsl:template>
+	
+	<xsl:template name="render-id3-genre">
+		<xsl:param name="genre"/>
+		<xsl:choose>
+			<xsl:when test="starts-with($genre,'(')">
+				<xsl:variable name="code" select="concat('id3.',substring-before(substring-after($genre,'('),')'))"/>
+				<xsl:choose>
+					<xsl:when test="key('i18n',$code)">
+						<xsl:value-of select="key('i18n',$code)"/>
+					</xsl:when>
+					<xsl:otherwise>
+						<xsl:value-of select="$genre"/>
+					</xsl:otherwise>
+				</xsl:choose>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:value-of select="$genre"/>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+		
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/home.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/home.xsl
new file mode 100644
index 00000000000..d34a91ee6a0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/home.xsl
@@ -0,0 +1,514 @@
+<?xml version="1.0"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:m="http://msqr.us/xsd/matte"
+	xmlns:x="http://msqr.us/xsd/jaxb-web"
+	xmlns:date="http://exslt.org/dates-and-times"
+	exclude-result-prefixes="m x date">
+	
+	<!-- imports -->
+	<xsl:import href="default-layout.xsl"/>
+        
+        <!-- auxillaray params defined as key for quick lookup -->
+	<xsl:key name="aux-param" match="x:x-data/x:x-auxillary/x:x-param" use="@key"/>
+	
+	<!-- Selected items -->
+	<xsl:variable name="display.items" select="x:x-data/x:x-model/m:model/m:item"/>
+	
+	<!-- Are there any items to display? -->
+	<xsl:variable name="display.items.count" select="count($display.items)"/>
+	
+	<!-- Selected Collection -->
+	<xsl:variable name="display.collection.id" select="x:x-data/x:x-request/x:param[@key='collectionId']"/>
+	<xsl:variable name="display.collection" select="x:x-data/x:x-model/m:model/m:collection[@collection-id = $display.collection.id]"/>
+	
+	<!-- Selected Album -->
+	<xsl:variable name="display.album.id" select="x:x-data/x:x-request/x:param[@key='albumId']"/>
+	<xsl:variable name="display.album" select="x:x-data/x:x-model/m:model/m:album[@album-id = $display.album.id]"/>
+	
+	<!-- Alert message, work ticket -->
+	<xsl:variable name="alert.message" select="x:x-data/x:x-messages[1]/x:msg[1]"/>
+	<xsl:variable name="work.ticket">
+		<xsl:choose>
+			<xsl:when test="key('aux-param','work.ticket')">
+				<xsl:value-of select="'aux-param'"/>
+			</xsl:when>
+			<xsl:when test="key('req-param','work.ticket')">
+				<xsl:value-of select="'req-param'"/>
+			</xsl:when>
+		</xsl:choose>
+	</xsl:variable>
+	
+	<!-- MediaSpec -->
+	<xsl:variable name="mediaspec.thumb" select="$acting-user/m:thumbnail-setting"/>
+	<xsl:variable name="mediaspec.view" select="$acting-user/m:view-setting"/>
+	
+	<xsl:template match="x:x-data" mode="page-head-content">
+		<link rel="stylesheet" type="text/css" href="{$web-context}/css/listmenu.css" media="screen"><xsl:text> </xsl:text></link>
+		<script type="text/javascript" src="{$web-context}/js/fsmenu.js"><xsl:text> </xsl:text></script>
+		<script type="text/javascript" src="{$web-context}/js/date.js"><xsl:text> </xsl:text></script>
+		<script id="behaviour-js" type="text/javascript" src="{$web-context}/js/matte-behaviours.js"><xsl:text> </xsl:text></script>
+		<script id="app-js" type="text/javascript" xml:space="preserve">
+			var APP_INFO = new Object();
+			
+			<xsl:if test="string-length($work.ticket) &gt; 0">
+				APP_INFO.workTicket = <xsl:value-of 
+					select="key($work.ticket,'work.ticket')"/>;
+				APP_INFO.workDisplayName = "<xsl:value-of 
+					select="key($work.ticket,'work.displayName')"/>";
+				APP_INFO.workSubmitTime = "<xsl:value-of 
+					select="key($work.ticket,'work.submitTime')"/>";
+				APP_INFO.workCompleted = <xsl:value-of 
+					select="key($work.ticket,'work.completed')"/>;
+				APP_INFO.workMessage = "<xsl:value-of 
+					select="key($work.ticket,'work.message')"/>";
+			</xsl:if>
+
+			<xsl:if test="$alert.message">
+				APP_INFO.alertMessage = "<xsl:value-of select="$alert.message"/>";
+			</xsl:if>
+			<xsl:if test="$display.collection.id">
+				APP_INFO.displayCollectionId = <xsl:value-of select="$display.collection.id"/>;
+			</xsl:if>
+			<xsl:if test="$display.album.id">
+				APP_INFO.displayAlbumId = <xsl:value-of select="$display.album.id"/>;
+			</xsl:if>
+			APP_INFO.thumbSpec = {
+				size : "<xsl:value-of select="$mediaspec.thumb/@size"/>",
+				quality : "<xsl:value-of select="$mediaspec.thumb/@quality"/>"};
+			APP_INFO.viewSpec = {
+				size : "<xsl:value-of select="$mediaspec.view/@size"/>",
+				quality : "<xsl:value-of select="$mediaspec.view/@quality"/>"};
+		</script>
+	</xsl:template>
+        
+	<!--xsl:template match="x:x-data" mode="page-body-class">
+		<xsl:if test="$display.items.count = 0">
+			<xsl:text>no-sub-nav</xsl:text>
+		</xsl:if>
+	</xsl:template-->
+	
+	<xsl:template match="x:x-data" mode="page-main-nav">
+		<xsl:call-template name="main-nav">
+			<xsl:with-param name="page" select="'home'"/>
+		</xsl:call-template>
+	</xsl:template>	
+	
+	<xsl:template match="x:x-data" mode="page-sub-nav">
+		<xsl:comment>SUB NAV</xsl:comment>
+		<ul class="menulist" id="listMenuRoot">
+			<li class="action-action">
+				<a href="#"><xsl:value-of select="key('i18n','link.select')"/></a>
+				<ul>
+					<li>
+						<a href="#" title="{key('i18n','link.select.all.title')}"
+								class="link-select-all">
+							<xsl:value-of select="key('i18n','link.select.all')"/>
+						</a>
+					</li>
+					<li>
+						<a href="#" title="{key('i18n','link.select.none.title')}"
+								class="link-select-none">
+							<xsl:value-of select="key('i18n','link.select.none')"/>
+						</a>
+					</li>
+				</ul>
+			</li>
+			<li>
+				<a href="#"><xsl:value-of select="key('i18n','link.actions')"/></a>
+				<ul>
+					<li>
+						<a title="{key('i18n','link.search.items.title')}" href="#" 
+							class="link-search-item">
+							<xsl:value-of select="key('i18n','link.search.items')"/>
+						</a>
+					</li>
+					<li class="action-album">
+						<a title="{key('i18n','link.delete.album.title')}" href="#" 
+								class="link-delete-album">
+							<xsl:value-of select="key('i18n','link.delete.album')"/>
+						</a>
+					</li>
+					<li class="action-album">
+						<a title="{key('i18n','link.share.album.title')}" href="#" 
+							class="link-share-album">
+							<xsl:value-of select="key('i18n','link.share.album')"/>
+						</a>
+					</li>
+					<li class="action-item context-album">
+						<a title="{key('i18n','link.removefrom.album.title')}" href="#" 
+							class="link-removefrom-album">
+							<xsl:value-of select="key('i18n','link.removefrom.album')"/>
+						</a>
+					</li>
+					<li class="action-item context-album">
+						<a title="{key('i18n','link.set.album.poster.title')}" href="#" 
+							class="link-setposter-album">
+							<xsl:value-of select="key('i18n','link.set.album.poster')"/>
+						</a>
+					</li>
+					<li class="action-collection">
+						<a title="{key('i18n','link.upload.collection.title')}" href="#" 
+							class="link-upload-collection">
+							<xsl:value-of select="key('i18n','link.upload.collection')"/>
+						</a>
+					</li>
+					<li class="action-collection">
+						<a title="{key('i18n','link.delete.collection.title')}" href="#" 
+								class="link-delete-collection">
+							<xsl:value-of select="key('i18n','link.delete.collection')"/>
+						</a>
+					</li>
+					<li class="action-item context-collection">
+						<a title="{key('i18n','link.removefrom.collection.title')}" href="#" 
+							class="link-removefrom-collection">
+							<xsl:value-of select="key('i18n','link.removefrom.collection')"/>
+						</a>
+					</li>
+					<li>
+						<a title="{key('i18n','link.new.album.title')}" href="#" 
+								class="link-add-album">
+							<xsl:value-of select="key('i18n','link.new.album')"/>
+						</a>
+					</li>
+					<li class="action-album">
+						<a title="{key('i18n','link.update.album.title')}" href="#" 
+							class="link-update-album">
+							<xsl:value-of select="key('i18n','link.update.album')"/>
+						</a>
+					</li>
+					<li>
+						<a title="{key('i18n','link.new.collection.title')}" href="#" 
+								class="link-add-collection">
+							<xsl:value-of select="key('i18n','link.new.collection')"/>
+						</a>
+					</li>
+					<li class="action-collection">
+						<a title="{key('i18n','link.update.collection.title')}" href="#" 
+							class="link-update-collection">
+							<xsl:value-of select="key('i18n','link.update.collection')"/>
+						</a>
+					</li>
+					<li>
+						<a title="{key('i18n','link.user.prefs.title')}" href="#" 
+							class="link-user-prefs">
+							<xsl:value-of select="key('i18n','link.user.prefs')"/>
+						</a>
+					</li>
+				</ul>
+			</li>
+		</ul>
+		<xsl:if test="$display.items.count != 0">
+			<!-- TODO -->
+		</xsl:if>
+	</xsl:template>	
+	
+	<xsl:template match="x:x-data" mode="page-sub-nav-data">
+		<xsl:text> </xsl:text>
+		<xsl:comment>
+			<xsl:text>sub nav data: collection = [</xsl:text>
+			<xsl:value-of select="$display.collection.id"/>
+			<xsl:text>]; album = [</xsl:text>
+			<xsl:value-of select="$display.album.id"/>
+			<xsl:text>]</xsl:text>
+		</xsl:comment>
+	</xsl:template>	
+	
+	<xsl:template match="x:x-data" mode="page-body">
+		<div id="left-pane">
+			<!--xsl:if test="$display.items.count = 0">
+				<xsl:attribute name="class">
+					<xsl:text>no-sub-nav</xsl:text>
+				</xsl:attribute>
+			</xsl:if-->
+			<img id="left-pane-tab" src="img/left-pane-tab.png" alt="Tab"/>
+			<div id="progress-pane" style="display: none;">
+				<h2><xsl:value-of select="key('i18n','progress.displayName')"/></h2>
+				<ol id="progress-list" class="collapsing">
+					<!-- progress items populate here -->
+				</ol>
+			</div>
+			<div id="info-pane">
+				<h2><xsl:value-of select="key('i18n','info.displayName')"/></h2>
+				<form id="info-form" action="{$web-context}/saveMediaInfo.do" 
+					method="post" class="collapsing">
+					<div class="single">
+						<label for="item-name">
+							<xsl:value-of select="key('i18n','item.name')"/>
+						</label>
+						<input type="text" id="item-name" name="name"/>
+					</div>
+					<div class="single">
+						<label for="item-date">
+							<xsl:value-of select="key('i18n','item.date')"/>
+						</label>
+						<input type="text" id="item-date" name="date"/>
+					</div>
+					<div class="single">
+						<label for="item-comments">
+							<xsl:value-of select="key('i18n','item.comments')"/>
+						</label>
+						<textarea id="item-comments" name="comments">
+							<xsl:text> </xsl:text>
+						</textarea>
+					</div>
+					<div class="single multi">
+						<label for="item-tags"><xsl:value-of select="key('i18n','meta.tags')"/></label>
+						<textarea id="item-tags" name="tags">
+							<xsl:text> </xsl:text>
+						</textarea>
+					</div>
+					<div class="single multi">
+						<label for="item-copyright">
+							<xsl:value-of select="key('i18n','item.copyright')"/>
+						</label>
+						<input type="text" id="item-copyright" name="copyright"/>
+					</div>
+					<div class="submit">
+						<input value="{key('i18n','save.displayName')}" type="submit" />
+					</div>
+					<hr />
+					<div class="single multi">
+						<label for="item-tags">
+							<xsl:value-of select="key('i18n','item.rating')"/>
+						</label>
+						<span class="rating-stars" id="item-rating"/>
+					</div>
+					<div><xsl:comment>This is here to "clear" the floats.</xsl:comment></div>
+				</form>
+			</div>
+			<h2><xsl:value-of select="key('i18n','collections.displayName')"/></h2>
+			<ol id="collection-list" class="collapsing">
+				<xsl:apply-templates select="x:x-model/m:model/m:collection" mode="collection.list"/>
+				<xsl:if test="count(x:x-model/m:model/m:collection) = 0">
+					<xsl:comment>There are no collections.</xsl:comment>
+				</xsl:if>
+			</ol>
+			<h2><xsl:value-of select="key('i18n','albums.displayName')"/></h2>
+			<ol id="album-list" class="collapsing">
+				<xsl:apply-templates select="x:x-model/m:model/m:album" mode="album.list"/>
+				<xsl:if test="count(x:x-model/m:model/m:album) = 0">
+					<xsl:comment>There are no albums.</xsl:comment>
+				</xsl:if>
+			</ol>
+		</div>
+		
+		<div id="search-pane" style="display: none;">
+			<div class="close-x">
+				<span class="alt-hide"><xsl:value-of select="key('i18n','close')"/></span>
+			</div>
+			<form id="search-item-form" action="{$web-context}/find.do" 
+					method="post" class="simple-form">
+				<!--p style="max-width: 300px;">
+					<xsl:value-of select="key('i18n','share.album.intro')"
+						disable-output-escaping="yes"/>
+				</p-->
+				<div>
+					<label for="quick-search">
+						<xsl:value-of select="key('i18n','search.items.quick.displayName')"/>
+					</label>
+					<div>
+						<input type="text" name="quickSearch" id="quick-search"/>
+						<input value="{key('i18n','find.displayName')}" type="submit" />
+					</div>
+				</div>
+				<div><xsl:comment>This is here to "clear" the floats.</xsl:comment></div>
+			</form>
+		</div>
+		
+		<div id="main-pane" class="main-pane-normal">
+			<xsl:comment>main-pane content here</xsl:comment>
+		</div>
+	
+		<div id="message-pane" style="display: none;">
+			<div class="close-x">
+				<span class="alt-hide"><xsl:value-of select="key('i18n','close')"/></span>
+			</div>
+			<div id="message-content-pane" class="message-box">
+				<xsl:text> </xsl:text>
+			</div>
+		</div>
+		
+		<div id="dialog-pane" style="display: none;">
+			<div class="close-x">
+				<span class="alt-hide"><xsl:value-of select="key('i18n','close')"/></span>
+			</div>
+			<div id="dialog-content-pane" class="dialog-box">
+				<xsl:text> </xsl:text>
+			</div>
+		</div>
+		
+		<div id="system-working" style="display: none;">
+			<xsl:value-of select="key('i18n','working.displayName')"/>
+		</div>
+		
+		<div id="ui-elements">
+			<!-- Dialog: delete album form -->
+			<form id="delete-album-form" action="{$web-context}/deleteAlbum.do" method="post" 
+					class="simple-form-validate">
+				<p style="max-width: 300px;">
+					<xsl:value-of select="key('i18n','delete.album.intro')"/>
+				</p>
+				<div>
+					<div class="label"><xsl:value-of select="key('i18n','album.name.displayName')"/></div>
+					<div id="delete-album-name" style="max-width: 240px;">
+						<xsl:value-of select="$display.album/@name"/>
+						<xsl:text> </xsl:text>
+					</div>
+				</div>
+				<div class="submit">
+					<input type="hidden" name="albumId" id="delete-album-id" value="{$display.album.id}" />
+					<input value="{key('i18n','delete.displayName')}" type="submit" />
+				</div>
+				<div><xsl:comment>This is here to "clear" the floats.</xsl:comment></div>
+			</form>
+			
+			<!-- Dialog: delete collection form -->
+			<form id="delete-collection-form" action="{$web-context}/deleteCollection.do" method="post" 
+				class="simple-form-validate">
+				<p style="max-width: 300px;">
+					<xsl:value-of select="key('i18n','delete.collection.intro')" 
+						disable-output-escaping="yes"/>
+				</p>
+				<div>
+					<div class="label"><xsl:value-of select="key('i18n','collection.name.displayName')"/></div>
+					<div id="delete-collection-name" style="max-width: 240px;">
+						<xsl:value-of select="$display.collection/@name"/>
+						<xsl:text> </xsl:text>
+					</div>
+				</div>
+				<div class="submit">
+					<input type="hidden" name="collectionId" id="delete-collection-id" 
+						value="{$display.collection/@collection-id}" />
+					<input value="{key('i18n','delete.displayName')}" type="submit" />
+				</div>
+				<div><xsl:comment>This is here to "clear" the floats.</xsl:comment></div>
+			</form>
+
+			<!-- Dialog: remove from album form -->
+			<form id="removefrom-album-form" action="{$web-context}/removeFromAlbum.do" method="post" class="simple-form">
+				<p style="max-width: 300px;">
+					<xsl:value-of select="key('i18n','removefrom.album.intro')"/>
+				</p>
+				<div class="submit">
+					<input type="hidden" name="albumId" id="removefrom-album-id" 
+						value="{$display.album/@album-id}"/>
+					<input value="{key('i18n','remove.displayName')}" type="submit" />
+				</div>
+				<div><xsl:comment>This is here to "clear" the floats.</xsl:comment></div>
+			</form>
+			
+			<!-- Dialog: remove from collection form -->
+			<form id="removefrom-collection-form" action="{$web-context}/deleteItems.do" method="post" class="simple-form">
+				<p style="max-width: 300px;">
+					<xsl:value-of select="key('i18n','removefrom.collection.intro')"
+						disable-output-escaping="yes"/>
+				</p>
+				<div class="submit">
+					<input type="hidden" name="collectionId" id="removefrom-collection-id" 
+						value="{$display.collection/@collection-id}"/>
+					<input value="{key('i18n','delete.displayName')}" type="submit" />
+				</div>
+				<div><xsl:comment>This is here to "clear" the floats.</xsl:comment></div>
+			</form>
+			
+			<!-- Dialog: share album form -->
+			<form id="share-album-form" action="{$web-context}/shareAlbum.do" method="post" class="simple-form">
+				<p style="max-width: 300px;">
+					<xsl:value-of select="key('i18n','share.album.intro')"
+						disable-output-escaping="yes"/>
+				</p>
+				<div>
+					<label for="shared">
+						<xsl:value-of select="key('i18n','share.album.shared.displayName')"/>
+					</label>
+					<div>
+						<input type="checkbox" name="shared" id="share-album-shared" 
+							value="true"/>
+						<span style="max-width: 300px;"><xsl:value-of 
+							select="key('i18n','share.album.shared.caption')" 
+							disable-output-escaping="yes"/></span>
+					</div>
+				</div>
+				<div>
+					<label for="feed">
+						<xsl:value-of select="key('i18n','share.album.feed.displayName')"/>
+					</label>
+					<div>
+						<input type="checkbox" name="feed" id="share-album-feed" 
+							value="true"/>
+						<span style="max-width: 300px;"><xsl:value-of 
+							select="key('i18n','share.album.feed.caption')" 
+							disable-output-escaping="yes"/></span>
+					</div>
+				</div>
+				<div>
+					<label for="theme">
+						<xsl:value-of select="key('i18n','theme.displayName')"/>
+					</label>
+					<div>
+						<select name="themeId" id="share-album-theme">
+							<xsl:comment>themes populated here</xsl:comment>
+							<xsl:for-each select="x:x-model/m:model/m:theme">
+								<option value="{@theme-id}">
+									<xsl:value-of select="@name"/>
+								</option>
+							</xsl:for-each>
+						</select>
+					</div>
+				</div>
+				<div class="submit">
+					<input type="hidden" name="albumId" id="share-album-id" 
+						value="{$display.album/@album-id}"/>
+					<input value="{key('i18n','share.displayName')}" type="submit" />
+				</div>
+				<div><xsl:comment>This is here to "clear" the floats.</xsl:comment></div>
+			</form>
+			
+			<div id="service-dialog-container">
+				<xsl:text> </xsl:text>
+			</div>
+
+		</div>
+		
+	</xsl:template>
+	
+	<!-- Generate the list of albums -->
+	<xsl:template match="m:album" mode="album.list">
+		<li>
+			<xsl:if test="@album-id = $display.album.id">
+				<xsl:attribute name="class">selected</xsl:attribute>
+			</xsl:if>
+			<a href="{$web-context}/home.do?albumId={@album-id}" title="{@name}">
+				<xsl:value-of select="@name"/>
+			</a>
+			<!-- TODO: nested albums, selected album? -->
+		</li>
+		<!--li><a href="#?albumId=101" title="Default">Default</a></li>
+		<li><a href="#?albumId=105" title="Default">Bar Foo</a></li>
+		<li>
+			<a href="#?albumId=106" title="Default">La te da</a>
+			<ol class="collapsing">
+				<li><a href="#?albumId=113" title="Default">More La te da</a></li>
+			</ol>
+		</li-->
+	</xsl:template>
+	
+	<!-- Generate the list of collections -->
+	<xsl:template match="m:collection" mode="collection.list">
+		<li>
+			<xsl:if test="@collection-id = $display.collection.id">
+				<xsl:attribute name="class">selected</xsl:attribute>
+			</xsl:if>
+			<a href="{$web-context}/home.do?collectionId={@collection-id}" title="{@name}">
+				<xsl:value-of select="@name"/>
+			</a>
+		</li>
+	</xsl:template>
+	
+	<!-- Generate main display items -->
+	<xsl:template match="m:item" mode="main.items">
+		<!-- FIXME: get the thumb size from user prefs -->
+		<img class="thumb" src="{$web-context}/media.do?id={@item-id}&amp;size=THUMB_SMALL" alt="{@name}"/>
+	</xsl:template>
+	
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/in.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/in.xml
new file mode 100644
index 00000000000..2a82713bbd5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/in.xml
@@ -0,0 +1,3 @@
+<Iteration><ViewEditor  ViewType='PieChart' DataSet='_Employees' ModifierID='undefined' Context='Data' Page='chartFields' ViewName='Pie Chart' bViewEditorAnimation="false" ><Translated><String name="DATA_OBJECTS">Data Objects</String>
+<String name="VIEWEDITOR_TAB_FIELDS">Fields</String>
+</Translated></ViewEditor><HelpTopicId>bam_as_viewedit_doselect</HelpTopicId></Iteration>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/inner.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/inner.xsl
new file mode 100644
index 00000000000..83feef8dce5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/inner.xsl
@@ -0,0 +1 @@
+<s:stylesheet xmlns:s="http://www.w3.org/1999/XSL/Transform" version="1.0"/>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/logon.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/logon.xsl
new file mode 100644
index 00000000000..5d8a8d413b4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/logon.xsl
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:m="http://msqr.us/xsd/matte"
+	xmlns:xweb="http://msqr.us/xsd/jaxb-web"
+	exclude-result-prefixes="m xweb">
+	
+    <!-- imports -->
+	<xsl:import href="default-layout.xsl"/>
+		
+	<xsl:template match="xweb:x-data" mode="page-title">
+		<xsl:value-of select="key('i18n','logon.title')"/>
+	</xsl:template>
+	
+	<xsl:template match="xweb:x-data" mode="page-body-class">
+		<xsl:text>no-sub-nav</xsl:text>
+	</xsl:template>
+	
+	<xsl:template match="xweb:x-data" mode="page-main-nav">
+		<xsl:call-template name="main-nav">
+			<xsl:with-param name="page" select="'logon'"/>
+		</xsl:call-template>
+	</xsl:template>	
+	
+	<xsl:template match="xweb:x-data" mode="page-body">
+		<div class="intro">
+			<xsl:value-of select="key('i18n','logon.intro')"/>
+
+			<!--xsl:if test="key('appenv','feature.registration') = 'true'"-->
+				<xsl:text> </xsl:text>
+				<xsl:value-of select="key('i18n','logon.intro.register')"/>
+				<xsl:text> </xsl:text>
+				<a href="{$web-context}/register.do">
+				    <xsl:value-of select="key('i18n','logon.intro.register.link')"/>
+				</a>
+				<xsl:value-of select="key('i18n','logon.intro.register.close')"/>
+			<!--/xsl:if-->
+			
+			<!--xsl:text> </xsl:text>
+			<a href="{$web-context}/forgotPassword.do" title="{key('i18n','link.forgot-password.title')}">
+			    <xsl:value-of select="key('i18n','link.forgot-password')"/>
+			</a-->
+		</div>
+        
+		<form method="post" class="simple-form" action="{$web-context}{$ctx/xweb:path}">
+			<div>
+				<label for="login">
+					<xsl:value-of select="key('i18n','login.displayName')"/>
+				</label>
+				<div>
+					<input type="text" name="login" maxlength="64"/>
+				</div>
+			</div>
+			<div>
+				<label for="password">
+					<xsl:value-of select="key('i18n','password.displayName')"/>
+				</label>
+				<div>
+					<input type="password" name="password" maxlength="64"/>
+				</div>
+			</div>
+			<div class="submit">
+				<input type="submit" value="{key('i18n','logon.displayName')}"/>
+			</div>
+		</form>
+		<script type="text/javascript" xml:space="preserve">
+			document.forms[0].elements['login'].focus();
+		</script>
+	</xsl:template>
+	
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/maps.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/maps.xml
new file mode 100644
index 00000000000..e5d3508b395
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/maps.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE stylesheet []>
+
+<maps>
+	<map1 type="key1">map1key1value</map1>
+	<map1 type="key2">map1key2value</map1>
+
+	<map2 type="key1">map2key1value</map2>
+	<map2 type="key2">map2key2value</map2>
+</maps>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/msgAttach.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/msgAttach.xml
new file mode 100644
index 00000000000..a6a980f501f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/msgAttach.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope"><env:Body><nfeRecepcaoLote xmlns="http://www.portalfiscal.inf.br/nfe/wsdl/NfeRecepcao"><nfeCabecMsg>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;cabecMsg xmlns="http://www.portalfiscal.inf.br/nfe" versao="1.09"&gt;&lt;versaoDados&gt;1.03&lt;/versaoDados&gt;&lt;/cabecMsg&gt;</nfeCabecMsg><nfeDadosMsg>&lt;enviNFe xmlns="http://www.portalfiscal.inf.br/nfe" versao="1.09"&gt;&lt;idLote&gt;200602220000001&lt;/idLote&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110809" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110809"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;zYASgizMNBAzgn+ot4ejStxDPTA=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;WnrapbX3Ewvi10agoVw2ZXl2drRxQdEbe3AHEXwIcr3LbDKGsMhqQusQGgifJkEbLL+IKC2kE9BE/HVFLxhFN9zj7zasTo6voeRApftKmibfASYcLSMTMkRcE97qU7BKQveBb0rYtKoumF020DUofx4TQlq0XhXHwQRSMfjU+PI=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110801" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110801"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;eDf91anljJDYxbEccusEuMITI6w=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;1l8xkXfjmhtrkFMXXHxyS2FQ7jM1hBIeqAxk/zVVgaAhAUvOnyqvt6EnIkbkqo+4uRyASFjhr5oFUHz5ryj9oSz+wW2Si95QIXUciWvDSAw2vbWaeusHI4fpJYqjyhUlXAelmQtgl9lkBaXhWrHkyLxTYZuUS0VHyu3SoqlY8L4=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110802" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110802"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;KgIkUWcNbSYo+9i4n1Wib3gggRI=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;BrV4+H1tm4SN9sjNT2ICKOfNsVGeMAsQilsuqIwflhGJxUVxaCEn8DJ7XaUQkh+Bw1HVd4nyR6XZHVJBtUssK2rN2B24boptcBbBlEs5Q91Guq3lSmWp8lORAf5UTVUuftsrllTmmjsSSgWVB5xog+lQI5/ULX8s+xI05OgFkDE=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110803" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110803"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;fJTDfYgu7OhtAEucE40612pj8yo=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;ROGdT3yu5ZbkhXNyn650tfD1bhNo33tYKfH1Ayp+syUJGIRfuepP58gaH8fJbuM4vU8LJozcK87tOaXc0EwM5mej6f+wZ2sv1DPglrt7Bb6Vs8j4v1HPvp7EUYoGYD8cq0IDC32h9ItHlg4H1oTxeM6U7xFMPjEndCRm7Hcym1Y=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110804" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110804"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;Omf325HzAlgBnP9MoAA2Gbf4vbo=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;vzjdVi3qU160PgIsCX9Qq07JVy98gwmtFZud6Unkn9uozWVgXGm9V2V3NJ67ke7pkcYZonXHrOTmOGTpuoaW0ZiQ55Mo50zlDS5TCBWn26stI12ecYwrqpgDENpoCKBRa5ZCa7GMaWZZyEgAYYQ8YeI9BtMqaKJnjhuXVaJErdw=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110805" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110805"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;ctmsHHDqE+E+UssdsL4jajRQVWk=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;nCoM230bM4Befsnpl3w5/G0ocn1MVkGoqIMIFkcijK7QzBY7n3tK2B9tr9dFv1mN+y/WFZ6+66tKYefaioSNiI0QLVIXfrdYMtZ4+Ewe1N/1xHKlGqujglkmNRF17KH106lBxOltsuxZd5AsyxZ+nF37GIjWzpY/0jOJD4c+OO8=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110806" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110806"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;UVJeRp5XuzdojbAnEjuohV8NFO8=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;5Zm+uGuO/xHT/CwgUIWobkM+JaAaYCym4/Kr4goBugykbLXyxXpHAvO4bYN050usn5kMGfELISipAVoaHXvrZ67FgaHkcKGHkymHGS+f8wLLL5TsNVRtZomdJjEy3GVQic8xpU4HUYrgOGktWpOnblaVzir0lZPeuRdkLbRe2y8=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110807" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110807"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;U+jxoc1fo7d4WXa0CrvP1YBQwgA=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;QAYBZN3c09rcoVij+fkp4lahEAD5cZV3zjdqvNEE2lzTbzqonHgdT5GyO9VRCikUNm0f3gAbwjyQnSmvTqw4YfVCf6ZYlFBAZ+pOkGdVsOkJ4QArZiU1+hSnLo5iN3WW7b5E7vw0EMv55nGW1zF0ghajClPBsQ+nbUSyYZ09ujk=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110808" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110808"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;rNWb1uYrH9oj+IaQzAQgBgoNJ1Q=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;NyJKj4su571ckKVCMK1Ki9QcpKBKczzxIs71nsxH4dZSCG3TUWycHoCsMjRUa7/REKoq1au1TmoZYAIYqZytyQYZ9m+Y+V8HDgGLde3Ymarz5X43MRIVsalGDSw1ukCYQptSLihiOUAT2hd8HYI1DAVWnqHnqDHvJ/wIcH9c44w=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110810" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110810"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;g3nEVfyjf0bEYF0+TFE+f8I0Ekg=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;VnwKnzSdKtp2i8rqNAFNc5NPrh1YWRTy4xvlSkcCdxHX0RAwlQ1mFL0wFUVOjNvt3KUVn9d4X5x76yjFbnXDPkcOrf/mpFl5JMhy2oruovcC0MtWrnvguSM/Ujyyl2p4MPLT1lzcUHAFPijh4MPOX694EX+KXxMW8jz9UqpXfn0=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110811" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110811"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;nhhsoA1RmioP/vXoARwWijDfkAg=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;SNh8Aa27uDRSZRe7nhkEa6ZTVfJV3ljwUSlwikYTMiEMk+B6/62IQqIyfVhfSN1Lx1grYgUfrzoNRanYZWQEUcIk07ENQcIS5KgY9ydSSuuOFVuiRsk/6INm1gjR4XCq4F/tWAdenasZCtZ0DPRNH5la4GSuKevNfoLOGbKgC00=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110812" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110812"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;DFhT+RWH4lqQbbUvFNAXv/GseL0=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;250R3TBs7J3uMUiLMywVtlIqn9PpB9Z9vH2vRQtcalB/Jx6bZbhYgRX6GhfVH7wrGfmtfU694g5sKm3447afm74mGV/5rvUlmECOnozuKv+SvXRK0wFvogaaXo5qCYlAqh9rOCa3W4RfVbq9TWfGevyKA7e0uKsjPctcKR/L4xg=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110813" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110813"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;Al5DzbSR6cps7LzToU+cyzc51GY=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;bGf13rBYoifk5Z2e97D/TiS8oy7qjB+TAfd0ECwgtn0VlWI0z8V9QQWaShjHI6sV5EVJEZlx3s/3HeFPFRiv12d5466EuzI5ftJpZNqAOS+CMkFeRFVGazaIcRY2ncw7wKNsaEmfEn+cnIAgfmXozI34q41R+bG6a/sPcLVJf3k=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110814" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110814"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;0VdDjtU1ZtFc2w5EQU9FWV276ao=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;oAAW20eP5P/wuxppPwQVmbrMwCaxAZhHJTGN2bL4GfWuTUhfSwUOxZjKTeSwlPUILU6MU3wMxj3QsIphfVTqRPKtxT19z31L6x8zAx5qV7Vgz+0PDnGsTutPYKxF5XWhHu7zRTTM3TdGKLujqp5jxwDBrM1qbBbYmfN6mxWhmqg=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110815" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110815"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;P+vIva8ejzq9bYhM1xL46vbdbEE=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;tod/k9ZRlFEMakj89FM12YkHFvBJ2m4wDJwq9bPe6X3CKbv1mYIUAXTkasJL1BF5aJa/z+V0pvK2xTSOznvF1Y5H+TpdaToiZtMeFCbRF+nTqW+cudA3KsgSCjQs2U2kid4BWUNID9hCQHSCUoHsoVbsXDeD0Lbu6r/B0IB8FDU=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110816" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110816"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;llPDkiDAQfwf0brph3hhqCNXliI=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;uFDUFef+q2r65uDmR8hS2DR+PAxVBtifJrOdVGmrdA0zQojPYziTlR0kZN/JIkBUkPklz9ejKoxx+XjVhZhu3OgI1ceHya0smOJEMDLfIJ0vHO7WmkunNl0/SBeR4yEGtjm7UxQ55/ZEHU0N/+cDn3iyzOB9t4wabUn5txA9JiA=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110817" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110817"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;qjS8ay1R+Kl2cRxAcxet6HZdt4M=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;HoafBrpcYfLjXnH9GHUoZIuxjIhrpLyQeiM3KQMaWx6uyS7c2oXPtVs80L49S7i1CMma+RAywTiGf79RzI95mBy/Vlk4wa51m5h6qizT8NZMP3Pa2ern9+mDhDV7kNgvNl7JDi7hCPvACpGZy54TuzXs2luH5O8iUVYR+g2jD7Y=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110818" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110818"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;xgoWPViXwimNipoyKVr8h/69A7I=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;bvGpF6fK/R2srzaaqG3XVDFxkvcvZ97MxAT4CBoezfiQywHPjXaEzmUXF/LMGjfbV1UEjFdoE+ZlPRU1F6Y3IreJvfQNLvXoGlnKASSHIZYWq/HCuv2q5DlUfw916LjUgygRbuPLaF8YJdqS+HxYsWJFxQu9ZChtb+rWYjCiCkw=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110819" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110819"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;YTY3upEgZtcegklKapx3PmBt1eI=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;Nma+uO1zfJMPDGNgg2tRR43CQJCalIvz1uEHfWx9xUWzRQt3SZXr/Paemn/8EvmRJ1EkL2v1oZNWH5B/WvEQfWW/m2yL5CHmW1/xFXjkbfsFJ6Dd3irQSiuy+16BNiPl0yJyV3Om+zANm1zepEbAzt1yldOsMInoWTeIcOA33rg=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110820" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110820"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;hZA9ZbAfkJ1gGw/5zgVaFfXmuz4=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;WUC6gHMQLuJa73yxDSuSzxVqds5ZBjl5OqtzOTLEEp83mKZwkako1zIhF59D2JXh5TnhwulWv7xqDzf3CxELf/rhftYIh108zFR7DDKMim2ofDcJ0ibWwBYYduVydpLQ37nGb0Cs8E8hVf5FDSamauvJhrXfC2jLfPQk1OCOmLc=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110821" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110821"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;mcwN77/JOXRmUj3Un5rnQukgOCk=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;fDXHeIDC4hz/dpsT66Mi1aPryUrpuCISosHapZ7VKsvjeC+y4jFAXEXR5+9OuJr1SPzhKyhwbr8do3K6spTKYkOOZFZ4Ujk9xhGIXabtK/WLt6FuIuk98xXZVOtzwU3IyYeObkaJg1SzAKwq0qIW4rkfmn/4uJfayXNXaseJnhc=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110822" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110822"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;1a2RQgN0sJrLDRPQHR59US0EYT0=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;jcNqHv8KDQKkcbov9Ffsix5qssBSMdx1kuM2AO3YjbjNOoJgSb+GmMy/j/iVnANeVDNLM4vjapHrPxCEFIG4E1ZuA7hId7JFajNDN1oXa32TtBfThJ27Rw35NJUcWI+YA+8JDnPa2qQCdxUWkiXvwyJ21zQzIZsw5UdvuQUqxm4=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110823" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110823"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;XmVTTTXirQvExYZ4yHj2Bz0bw/c=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;1RNe6RLJyXBr3/lGcqLipxwcUvUIYznpp8cwEsIPMhVnVK+250ZGyy3ap2NvgnLDvXlmQOVUu6xUthwF8ll58dspBFIfHAqoww/KojAg+6V3Wwm+DwVc7222KbJ6eu451iqI68cUaRYQiciPTa2Y9DfDtxoprKBN488/PkOYyhY=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110824" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110824"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;YauB6rHbqykRGk5K/ESVswxJpvs=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;iBHHYQzntaGIOO62UUQ/p2svvoR8XjDoO8es7vyJ35PmrFWtocWdM9FEUW1Vp4ql7qmtzXascvw86JdPwZ0UjhPO9qKIIYk8XrzG9AY4SqF99gf1POWHK7xxmk3K3a9GivyQFwQlvNkWHmZJqdOv+s5ezUrQc+Keybnio5+cy0o=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110825" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110825"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;sBG0b72pNgwjtyk2sCcr2SOPgyo=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;EMAWKqa79y8wFYN1TProwZcZO20OCPU6rSm41Z+QN5QdT1DcU823Lu+aNfPv70SY9ra5/6kOO1uE4My5UXsyawjPDY5EZV8di9Goyebg27DgDLWcpvwZfrBUOwGo3Q9x/VpWI5qY9OHaWpwxttIIuo2PbZl4k3+VVAkeCdeo7Q0=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110826" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110826"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;gDyFrITIpGqBPPeUls+UoQ1eFFw=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;p3lSbnCBYnKbz6rpghVwsRzjIleu8R4dlvexNH+lxtYMPMSEll1C6qMHFo393SpKJu0Yufb7NRfDBhQFBYWwHJ5/GDchagr79ihn0hVRo58wDIbWwpHPqP5QlyGttdUm2BMTXaNsvwzJWycZqkkLwvjRO1M+5CD91pYYAB27u2A=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110827" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110827"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;nq3klXHixnYIhGVm/zzRuGSMwv0=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;QPp1qTof2JWZjqlWtMLOW2Hz0XrMqMd+Gp+kKqLZDBGbqQ/YCUKXnGjUiEPoO2Zy96Y98JlLaC7yFWkeslM2wMxmQEQoAFlWp5gdtjmzhFBPpuHYsS8WAz2VJVDlGik02JkXDKG/6sbHrxTQkq9ksp5ijygmRSvlxNBnG7AS9oM=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110828" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110828"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;KxutkHGJ8tvxNtSAy8N4b7sgfOU=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;GZ9XS/REkXN97VEYMz1AAPZ4J9Lb08TNhsloCuH8QaTaPqIIuT4dlcQgdBX7oysVc1NXUoSxFKUeej2ZMdD/J2EPxPacM8S3XlbZe5CoHKaxqR3hqPW5ANxzN61ldjDKPz+mY7dmgVttyEYQKdy44rt3lf0TqcdWfBiucZYylAM=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110829" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110829"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;9eOPR0G4en+2xpr+R6nlm83gxVM=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;t/Iwe+qlyWyuQpAHWdK//Lm+sRes/6EQb3I3XpFId+Xo4b8bdbcqv+Wlb7oPT5He654Yeg88z1mpHSZdtV5fdrr1dlKflrLT9AGKyYGiPcOpH2sUdQ655kJBtu/ByT6gQ8qaA+aufHmEL1CEUA5AbYAWk9CYzOi8BTs5zdsbDCA=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110830" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110830"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;PKubq8TelaLWOEu6e2hUS7KlvBA=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;jQPSq10OxqJKbEwlQuW+RqQGV5a9iKKuc2+BZ8Qa1S9hQyg/PjtQHQYBR2LARUZIzfocfGb5+8HyGVxijtuIj2KPIH/8QGoqSHC0Ngtl9VCc7YCnOP10DOsasc6FynGZpa+0LOV+zJO119syZY4feIc67Py84fku/GJ8M1spOzg=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110831" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110831"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;fSUS3zUG0gFM15Rb5Xeuowu5q8Y=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;WnN/escY4TTLdqKWdlhl9VCaotMF1lkFjxSx32va5+nFXr/gYY+bZw7tYMPq8q0glhE3i5tG08Ai3zewmIIYGLbraf/2HSogXeYbM9PfoNPwlP2tXMWbvwWqg8sm5JviGS/P7kKcbKxtB35oUk0lCo0m72Kt6vaY3bmYRsv/VNQ=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110832" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110832"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;ShPPZLiE8+w2+TYc4IbHUFAJtew=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;rQgO5c6bD+bB3WyRfrCb/96/JkH0bjMARhL0Rh744IdvLX+DL/u8+n/F3bTuM5nMg2MxqiCM5dJVhjfBZ8HlpUn2Ed6gTMRGRufrHEYq4Vb8CYiloLQBkXBt1Adf31Rwo1H+ASTu+GrCQyypTSJjlDy0R2+E8keWfabj15xjyts=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110833" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110833"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;vH6jMKDthPy/f/oqcOu3Kl9jQIM=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;Cv24RtVaYwqxTJBFFkoji77H/x76K1jKIbuulbZ0Nm9lcYk4sz14YT5ewKlmpbypuUtbl5NCSkSPsWZ4y7QCTpbddmtUX1ZPcbRLPg9I8xWG1NbcyQqlCkpS0h76163wLFjzQp4gf+a9aSVzTkw9r/URj/0m4RcmiA4UhC+mhg4=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110834" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110834"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;p7hP4H+8hnM91WiYpcftVEgr+Cw=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;FvsM3yhnphCD3/KOg9beknJx1+kcw4RWNJQbXsWUvwQOa6uz6PFuKjHeDdUSa0tTRoRQ8t15TfP38SyOco/DmoMfBmCuj70tQxk78BZ/Z+UjESdaHgv2GSB3TBAVe2GaT6JYAKUSSCAFPY7GfgAQhOPEuk89ztQx7s4qB69IKZA=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110835" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110835"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;VCjVED64OxI7juJhG+0yWNlXusg=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;NnmraR5m+J0bapZxL+8xsruVjidhmHqFrQwhHG4xeXeIytfQ3GgtLpaMYWO+Y+U/TrP1wKz10blLRfLa3vSuYEDuy1TI5tNjwPdmdLDXc+65YkYlO1rBYXuYHm0KIf61GPHIhvay5XUnV8VhzS7Utv2lT8p8/JyxqMHKEdg/FPY=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110836" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110836"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;9+uhMXb1wz6fc3iQbovsGOoMKC4=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;tW1I5Ai8xb3GMGxkjJLpraqQLKp2dJxfdLUmm8vlpJtlFdAT4S2EYQftsiRI05ojjOrYBWb+pWemZtNhbEHSeGDMzZ6YNJwN6r7sGaRVH8IdM/2j1U87qc6jBok85nAOvAr+qoLNV4rLAca8HdqwX+evgECCvIvPuOFMovCFyi0=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110837" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110837"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;pzvez2i5zHJO5NK7aGrsXzawOKM=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;qJlA6hsqLbKMrjDavcfvaxG1q5OfvmeU7hVUmhJ2ipn3dKI6VpOuXaepFTA/hDz9+S1P7uc7UZj9tc/ndcUMEY1Fu97KbYpo9wyOZcKc2roxvwFlVah/3dIm3W2aH/nzanOXfx6hWCRzVyFpWlHnfkWiqsFbdyD9Y+dkiaJ6EBg=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110838" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110838"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;YjkOrMdDzFQvTy/lqIxwm4HXEZU=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;5OfLaCwWLSOr1PPrj8mm6TYFynD2TJlsvmontCO2+lZ83GvHCmv/o/az72L4zTJLA+7EjWLXyVDaniVLz0KT580yAAVETdy7Am+ZGWSNgEyp+Fwc5eL4AiHtMPABnhdY1Y7GIZ+m74XPJLW31ybwH8G8tJEkib9bmVUK6LLcal8=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110839" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110839"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;mpqSlfCCvmFn5WrxQ9Dfl5uWuPU=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;yISvrdTREuQiZ1uA4dl1HrIuk1VpcYc5bWYWa7Te01UMXNZ/bmqz0LH8oFiVoqPRnHHTSJ7NvgHC79z9z+EuDbrga1uTvLlY7CvtbxD1AuChyPc7IbkM5PGIS2EMuLI74y3FpjXPLf9ZanXisSLLVc7OhbrnCTzS5YsXLSGImyk=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110840" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110840"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;9IyNbREn2DYaDA6UUVNTmUx7Pdo=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;MkQ4Ors8jwGneaOz+4cbbyL8u/kBUyx26JXe0skHJmKYq08uvihpylT7DHPr3ysXwMMhjsE5uuQQnKh48JpxmIkOXFTEzKvKnliiIsjFb5ENA+QG66Ae4Wmzt1z0CeUaGLf12qzAHJfxiNklvl1vSS7Gdxt9jGN1p8sm1ziqXU4=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110841" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110841"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;KBQvgLVJ/pHIs2mchbP6r+XUV3w=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;sTwck2qlVfUm+txPJzt7BshWT3zyUGYiLG4MR0RH2zm/DcjsBj/679m1/7k8lrt2E83jCSwZq8y6lVTSzJJlmXW+TVLyH3wCirheAXsWdCxQaYSeOilCPqb1kgB/qNcPReadT421qJfRGO3nMmd89HI4pCjHH1aYQPeGgytkcm4=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110842" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110842"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;3g5AU6Z5Pat0IPL/OYpTRwx4taQ=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;VmXtcslq9V5bKh+ZzPRl9o+h9E04S2XiUwxvz605kN8hzCOPUTNzEMBlm1eiXKg9UAsRrFhCtJcUyqZdwN2ldVN57lxwZlPQ1Qj5DDyhG4MYtynBXNI5DhlrBb0xKOHFxsUJ4YkgtNGxwDfUyUlKwpNrgBABrbxe4W1Ibf/aX7M=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110843" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110843"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;h9UKsUjSbe8JbvsUApBt2psKKAU=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;TVt205QhgqS2gZc9S0IxRbgc5x+d/iXhpCQpwYpGHbsVfvjmAPl3+zRKscTC3asPH8Nf2+6IGHwtElFqF2tE9c1RrS3cDuyjiXfKaGC5KmZ/5teXuGN1l4WF4/jitaSLu0nHcfmwxVQj3XH25+gHNXBAZXJCj1mHQO0jsmgDEz0=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110844" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110844"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;HbZModFP0Iui9gfuR7n/4sHi024=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;WPU7Sj9DeVV91fBDnlAM/JKlKaC57/ID4/jbFYkcX4uO/tf0fpVUkOEwhxDUKldf/REsxKzOy3LAs/VoOLgqh3PmMBOZkTGWQjasY150ZCZHOIPuUk6wrObozuI+V0g3Xfff6pxId+t7Z3sLMWMggSSKG8+Qs27XJmODe08l+Zg=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110845" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110845"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;t72hWlvvtDZ6wNPjniZ2pDoTj/w=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;XnKgmioztIbSGyiwYq0Xc5jGA5bxvoqGaNfWSulvY/e4CM6KY95fwMS9GYbEjTxMB8wcIZpziq8jlEMRnNkF+yHn/4QI+8y8K17EF7pebG4XHUuOGAditKlHbC85Fehj40+/+S0kc2iSe2D+FzY1TGe/2B7x78u45LaUtLT9sXE=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110846" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110846"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;YsqTqpi1W7aZmk0w4pmyS9ICgIs=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;NgHBGSEmJP4tPp4LViQYbDLfs7fQti90qvTJJ8KR2N0N8SPbmldwI8JRZyTldlQwUlRyaUqEE6OwFPW0vA0b4Upqqyl6p+MM7/ax+pU6PT7c/5xRzpSyPpvbLAYyMDA6dyQwfGgnxw+R1wRlZidxjyU+qX+C6xKc9/EhGC1MUOY=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110847" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110847"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;gjvLgyWmYcXiyBgjtBHrmH3do0E=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;wQxpEm1stUvHMiMUQxMVzQlh/GKqusqgA3UGiVHDmFhnx4Fe9m7Kbp8iPzD5zhcRbFl2hVYJa1+2L0tL78unUO60uEjIFt47d/5F++rCgHkfcQAK2mdR4rl51tof8T75lvH/YJWqATZBcm7nyXEUyNlMBTyXt3NbZ4pkvjZPADU=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110848" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110848"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;JxHrYj68TOJrQDYwbNRgpcd31wk=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;WC86hQyLd3romAna+vQgzS4Y+6p6qGIzNMKyye3MJU8YWb8NzycRTqXdzmV3vTc1f7JRHZxv7OotOYGkdgO9WQtuqNmy7bUlpTw+VHDaLYk0IKODNS3AalvJ34cEYeERrWJ46VkOeTAGkA0SvO8nheChrUg9316VpQ99PJnxT2M=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110849" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110849"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;SXeCCjCKON99cwODW7wBGEO1vnk=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;hlSBLj1DztVcfDubBVkCJ1Tgm5nvAqJF01lK2fbNzYRBozUwd7nQ+fvnHK+UI9OaR7wJKJwSY/nqK7OV1Iz1h+Nu/zFg/YV3hrG+mV+EvOzJEKhp0c7+NO45FQKhB5a+jLFCFCypOJW0OyyVGe1inhI6mC8iCCBy08LElb3x3vg=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;NFe&gt;&lt;infNFe Id="NFe28070413349550000324550010000109000000110850" versao="1.09"&gt;&lt;ide&gt;&lt;cUF&gt;28&lt;/cUF&gt;&lt;cNF&gt;000011080&lt;/cNF&gt;&lt;natOp&gt;VENDAS PRODUCAO PROPRIA&lt;/natOp&gt;&lt;indPag&gt;0&lt;/indPag&gt;&lt;mod&gt;55&lt;/mod&gt;&lt;serie&gt;1&lt;/serie&gt;&lt;nNF&gt;10900&lt;/nNF&gt;&lt;dEmi&gt;2007-04-18&lt;/dEmi&gt;&lt;dSaiEnt&gt;2007-04-18&lt;/dSaiEnt&gt;&lt;tpNF&gt;1&lt;/tpNF&gt;&lt;cMunFG&gt;0352050&lt;/cMunFG&gt;&lt;tpImp&gt;2&lt;/tpImp&gt;&lt;tpEmis&gt;1&lt;/tpEmis&gt;&lt;cDV&gt;9&lt;/cDV&gt;&lt;tpAmb&gt;2&lt;/tpAmb&gt;&lt;tpNFe&gt;1&lt;/tpNFe&gt;&lt;/ide&gt;&lt;emit&gt;&lt;CNPJ&gt;13349550000324&lt;/CNPJ&gt;&lt;xNome&gt;TOYOTA DO BRASIL LTDA&lt;/xNome&gt;&lt;xFant&gt;TDB IDT&lt;/xFant&gt;&lt;enderEmit&gt;&lt;xLgr&gt;RODOVIA SP75&lt;/xLgr&gt;&lt;nro&gt;S/N&lt;/nro&gt;&lt;xCpl&gt;KM 48&lt;/xCpl&gt;&lt;xBairro&gt;CALDEIRA&lt;/xBairro&gt;&lt;cMun&gt;0352050&lt;/cMun&gt;&lt;xMun&gt;INDAIATUBA&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;13330000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;1938857000&lt;/fone&gt;&lt;/enderEmit&gt;&lt;!--IE&gt;353080289118&lt;/IE--&gt;&lt;IE&gt;270621458&lt;/IE&gt;&lt;IEST&gt;270969918&lt;/IEST&gt;&lt;/emit&gt;&lt;dest&gt;&lt;CNPJ&gt;07234453001446&lt;/CNPJ&gt;&lt;xNome&gt;BENARROS VEICULOS LTDA&lt;/xNome&gt;&lt;enderDest&gt;&lt;xLgr&gt;AVENIDA TANCREDO NEVES&lt;/xLgr&gt;&lt;nro&gt;5121&lt;/nro&gt;&lt;xBairro&gt;JABOTIANA&lt;/xBairro&gt;&lt;cMun&gt;0280030&lt;/cMun&gt;&lt;xMun&gt;ARACAJU&lt;/xMun&gt;&lt;UF&gt;SE&lt;/UF&gt;&lt;CEP&gt;49097000&lt;/CEP&gt;&lt;cPais&gt;105&lt;/cPais&gt;&lt;xPais&gt;BRASIL&lt;/xPais&gt;&lt;fone&gt;7932595252&lt;/fone&gt;&lt;/enderDest&gt;&lt;IE&gt;270832980&lt;/IE&gt;&lt;/dest&gt;&lt;det nItem="1"&gt;&lt;prod&gt;&lt;cProd&gt;62&lt;/cProd&gt;&lt;cEAN&gt;&lt;/cEAN&gt;&lt;xProd&gt;COROLLA SE-G,A/T,1.8L GAS,A/C AUT.&lt;/xProd&gt;&lt;NCM&gt;87032310&lt;/NCM&gt;&lt;EXTIPI&gt;01&lt;/EXTIPI&gt;&lt;CFOP&gt;6401&lt;/CFOP&gt;&lt;uCom&gt;TESTE&lt;/uCom&gt;&lt;qCom&gt;1&lt;/qCom&gt;&lt;vUnCom&gt;99999&lt;/vUnCom&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;cEANTrib&gt;12345678901234&lt;/cEANTrib&gt;&lt;uTrib&gt;PC&lt;/uTrib&gt;&lt;qTrib&gt;1.000&lt;/qTrib&gt;&lt;vUnTrib&gt;88888&lt;/vUnTrib&gt;&lt;veicProd&gt;&lt;tpOp&gt;1&lt;/tpOp&gt;&lt;chassi&gt;9BR53ZEC278678265&lt;/chassi&gt;&lt;cCor&gt;205&lt;/cCor&gt;&lt;xCor&gt;PRETO PEROLA METALICO&lt;/xCor&gt;&lt;pot&gt;136&lt;/pot&gt;&lt;CM3&gt;1794&lt;/CM3&gt;&lt;pesoL&gt;1185&lt;/pesoL&gt;&lt;pesoB&gt;1185&lt;/pesoB&gt;&lt;nSerie&gt;000678265&lt;/nSerie&gt;&lt;tpComb&gt;GASOLINA&lt;/tpComb&gt;&lt;nMotor&gt;4650701&lt;/nMotor&gt;&lt;CMKG&gt;0&lt;/CMKG&gt;&lt;dist&gt;2600&lt;/dist&gt;&lt;RENAVAM&gt;000000000&lt;/RENAVAM&gt;&lt;anoMod&gt;2007&lt;/anoMod&gt;&lt;anoFab&gt;2007&lt;/anoFab&gt;&lt;tpPint&gt;M&lt;/tpPint&gt;&lt;tpVeic&gt;06&lt;/tpVeic&gt;&lt;espVeic&gt;1&lt;/espVeic&gt;&lt;VIN&gt;N&lt;/VIN&gt;&lt;condVeic&gt;1&lt;/condVeic&gt;&lt;cMod&gt;114810&lt;/cMod&gt;&lt;/veicProd&gt;&lt;/prod&gt;&lt;imposto&gt;&lt;ICMS&gt;&lt;ICMS70&gt;&lt;orig&gt;0&lt;/orig&gt;&lt;CST&gt;70&lt;/CST&gt;&lt;modBC&gt;2&lt;/modBC&gt;&lt;pRedBC&gt;5.16&lt;/pRedBC&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;pICMS&gt;7.00&lt;/pICMS&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;modBCST&gt;0&lt;/modBCST&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;pICMSST&gt;12.00&lt;/pICMSST&gt;&lt;vICMSST&gt;5735.62&lt;/vICMSST&gt;&lt;/ICMS70&gt;&lt;/ICMS&gt;&lt;IPI&gt;&lt;cEnq&gt;999&lt;/cEnq&gt;&lt;IPITrib&gt;&lt;CST&gt;50&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pIPI&gt;13.00&lt;/pIPI&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;/IPITrib&gt;&lt;/IPI&gt;&lt;PIS&gt;&lt;PISAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pPIS&gt;2.00&lt;/pPIS&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;/PISAliq&gt;&lt;/PIS&gt;&lt;COFINS&gt;&lt;COFINSAliq&gt;&lt;CST&gt;01&lt;/CST&gt;&lt;vBC&gt;56361.43&lt;/vBC&gt;&lt;pCOFINS&gt;9.60&lt;/pCOFINS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;/COFINSAliq&gt;&lt;/COFINS&gt;&lt;/imposto&gt;&lt;/det&gt;&lt;total&gt;&lt;ICMSTot&gt;&lt;vBC&gt;53453.46&lt;/vBC&gt;&lt;vICMS&gt;3741.74&lt;/vICMS&gt;&lt;vBCST&gt;78978.00&lt;/vBCST&gt;&lt;vST&gt;5735.62&lt;/vST&gt;&lt;vProd&gt;56157.87&lt;/vProd&gt;&lt;vFrete&gt;0.00&lt;/vFrete&gt;&lt;vSeg&gt;0.00&lt;/vSeg&gt;&lt;vDesc&gt;0.00&lt;/vDesc&gt;&lt;vII&gt;0&lt;/vII&gt;&lt;vIPI&gt;7326.98&lt;/vIPI&gt;&lt;vPIS&gt;1127.23&lt;/vPIS&gt;&lt;vCOFINS&gt;5410.70&lt;/vCOFINS&gt;&lt;vOutro&gt;0.00&lt;/vOutro&gt;&lt;vNF&gt;69220.47&lt;/vNF&gt;&lt;/ICMSTot&gt;&lt;/total&gt;&lt;transp&gt;&lt;modFrete&gt;0&lt;/modFrete&gt;&lt;transporta&gt;&lt;CNPJ&gt;60395589000104&lt;/CNPJ&gt;&lt;xNome&gt;BRAZUL TRANSP.DE VEICULOS LTDA&lt;/xNome&gt;&lt;IE&gt;635024834114&lt;/IE&gt;&lt;xEnder&gt;AV. MARIA SERVIDEI DEMARCHI, 1420,&lt;/xEnder&gt;&lt;xMun&gt;SAO BERNARDO DO CAMPO&lt;/xMun&gt;&lt;UF&gt;SP&lt;/UF&gt;&lt;/transporta&gt;&lt;vol&gt;&lt;qVol&gt;1&lt;/qVol&gt;&lt;esp&gt;VEICULO&lt;/esp&gt;&lt;marca&gt;TOYOTA&lt;/marca&gt;&lt;pesoL&gt;1185.000&lt;/pesoL&gt;&lt;pesoB&gt;1185.000&lt;/pesoB&gt;&lt;/vol&gt;&lt;/transp&gt;&lt;infAdic&gt;&lt;infCpl&gt;MARCA TOYOTA, MOTOR TOYOTA GASOLINA 4 TEMPOS, COM SISTEMA DE INJECAO ELETRONICA DE COMBUSTIVEL COMBUSTIVEL GASOLINA, TIPO AUTOMOVEL, 136CV, 4 CILINDROS, 4 PORTAS, TRANSM. AUT. DE 4 VEL. 1.794 CM3, 6.000 RPM,16 VALVULAS, ANO FAB. 2007, ANO MODELO 2007 CAPACIDADE: 5 PASSAGEIROS, COR: PRETO PEROLA METALICO COD.MARCA/MODELO RENAVAM: 114810 TOYOTA/COROLLA SEG18VVT NRO DO CHASSIS: 9BR53ZEC278678265, NRO DO MOTOR: 4650701, NUMERO DA CHAVE: T09175 EQUIPAMENTOS OBRIGATORIOS : 01 EXTINTOR(ES) 01 TRIANGULO(S) 01 MACACO(S) C/CABO, 01 CHAVE(S) DE RODAS OPCIONAIS: PINTURA METALICA/PEROLIZADA - TERMO DE PENHOR MERCANTIL: - VEICULO EM GARANTIA DE PENHOR MERCANTIL, CONFORME CONTRATO DE ABERTURA DE CREDITO ROTATIVO PARA FINANCIAMENTO DE AQUISICAO DE VEICULOS FIRMADO COM BANCO TOYOTA DO BRASIL S/A. ESTA NOTA FISCAL E PARTE INTEGRANTE E COMPLEMENTAR DO REFERIDO CONTRATO, PARA FINS DE CONSTITUICAO DO PENHOR MERCANTIL. ACOMPANHA VEICULO: TERMO DE GARANTIA, MANUAL DO PROPRIETARIO, ACENDEDOR. BASE DE CALCULO REDUZIDA CONFORME. ITEM IV PARAGRAFO 2 DO CONVENIO ICMS 133/02 VALOR SEGURO INCLUSO NO VALOR UNITARIO - BASE DE CALCULO E ALIQUOTA ICMS CONF.CONV.132/92 E DECRETO 45490/00 FRETE JA INCLUSO NO PRECO DO VEICULO. VIA TRANSPORTE: TERRESTRE ORDEM PRODUCAO: 294020 CONSORCIO: PATIO: 1 BASE CALC ICMS/IPI : 56.361,43 BASE RED/VALOR ICMS: 53.453,46/3.741,74&lt;/infCpl&gt;&lt;/infAdic&gt;&lt;/infNFe&gt;&lt;Signature xmlns="http://www.w3.org/2000/09/xmldsig#"&gt;&lt;SignedInfo&gt;&lt;CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/CanonicalizationMethod&gt;&lt;SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"&gt;&lt;/SignatureMethod&gt;&lt;Reference URI="#NFe28070413349550000324550010000109000000110850"&gt;&lt;Transforms&gt;&lt;Transform Algorithm="http://www.w3.org/2000/09/xmldsig#enveloped-signature"&gt;&lt;/Transform&gt;&lt;Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"&gt;&lt;/Transform&gt;&lt;/Transforms&gt;&lt;DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"&gt;&lt;/DigestMethod&gt;&lt;DigestValue&gt;I58ROhWJ1+GlmoKlUDAbplxrJ8w=&lt;/DigestValue&gt;&lt;/Reference&gt;&lt;/SignedInfo&gt;&lt;SignatureValue&gt;jb3X9Sh3OvC+EGDdH3crhS9l1TJbiIpkQ0oPbXDWLnyOCMRx3QoXC6AEqhDqP6M0eiumhDIZr4AtL96gL0KdUedTuoH1e/CV0uOvvKrz0ZQex/6grLG195lm1wiZPk4T6+OzVjez0rOmyB4BQxtC26ER0OlXrJj9uNI4bG0neCQ=&lt;/SignatureValue&gt;&lt;KeyInfo&gt;&lt;X509Data&gt;&lt;X509Certificate&gt;MIIDpzCCAxCgAwIBAgIBBDANBgkqhkiG9w0BAQUFADBzMQswCQYDVQQGEwJCUjEQMA4GA1UECBMHU0VSR0lQRTEQMA4GA1UEBxMHQVJBQ0FKVTEOMAwGA1UEChMFU0VGQVoxDzANBgNVBAsTBkdFUlRFQzEfMB0GA1UEAxMWQUMgSU5URVJNIFNFRkFaIERFU0VOVjAeFw0wNzA5MTgxMzE5MjdaFw0wODA5MTcxMzE5MjdaMHwxCzAJBgNVBAYTAkJSMRAwDgYDVQQIEwdTRVJHSVBFMRAwDgYDVQQHEwdBUkFDQUpVMQ8wDQYDVQQKEwZHRVJURUMxDzANBgNVBAsTBkdFUlRFQzEnMCUGA1UEAxMeREVTRU5WT0xWSU1FTlRPOjEzMzQ5NTUwMDAwMzI0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDlzjg0NkHlxB24FS2fI4h+knKEwh3v5hYRtWGZvYVlMxMU5F9AAAXIaDltPrCp0dETRKYhAVGVAUuHaPHEFiJO5uhFUT6JJEy6ppYN3oH4xNijk/SaJL8yL1hQm8cvc0LNJadnHHLiFlpISTiZK6eX7gjOW6iIFRl44OoYMUtPWQIDAQABo4IBQDCCATwwCQYDVR0TBAIwADBHBgNVHR8EQDA+MDygOqA4hjZodHRwOi8vbmZlZC5zZWZhei5zZS5nb3YuYnIvbmZlL2xjci9JbnRTRUZBWkRlc2Vudi5jcmwwEQYJYIZIAYb4QgEBBAQDAgeAMB0GA1UdJQQWMBQGCCsGAQUFBwMCBggrBgEFBQcDBDAkBgNVHREEHTAboBkGBWBMAQMDoBAMDjEzMzQ5NTUwMDAwMzI0MBMGA1UdIAQMMAowCAYGYEwBAgEQMAsGA1UdDwQEAwIF4DAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFCbkjsXo4Zjm3aujOOFXRnhhesTXMB8GA1UdIwQYMBaAFCdUULrpSDfI6YnadWVtjen7d/NYMA0GCSqGSIb3DQEBBQUAA4GBAJCV67LXSw37DGcMDxOWn97wrpawYzW9EIFRn0ymeYgz5RNHVeFQNpCbrJHiSgTr6UsghqdQT+QZm94XZmqMp7S5oiCYY69uz8ulsZ6BZWFdCnsSO+Ab3HAbBQX+XhJ72KffwHhZDGtcoLALlakT0Ugqkow1ztw4GB+JAowrnzgq&lt;/X509Certificate&gt;&lt;/X509Data&gt;&lt;/KeyInfo&gt;&lt;/Signature&gt;&lt;/NFe&gt;&lt;/enviNFe&gt;</nfeDadosMsg></nfeRecepcaoLote></env:Body></env:Envelope>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/numbering63.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/numbering63.xml
new file mode 100644
index 00000000000..42f08bbee66
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/numbering63.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0"?>
+<doc>
+  <title>Test for source tree numbering</title>
+  <a>
+      <title>Level A</title>
+    <b>
+      <title>Level B</title>
+    </b>
+    <b>
+      <title>Level B</title>
+      <c>
+        <title>Level C</title>
+      </c>
+    </b>
+    <b>
+      <title>Level B</title>
+      <c>
+        <title>Level C</title>
+        <d>
+          <title>Level D</title>
+        </d>
+      </c>
+    </b>
+  </a>
+  <a>
+    <title>Level A</title>
+    <b>
+      <title>Level B</title>
+      <c>
+        <title>Level C</title>
+        <d>
+          <title>Level D</title>
+          <e>
+            <title>Level E</title>
+          </e>
+        </d>
+      </c>
+    </b>
+  </a>
+  <a>
+    <title>Level A</title>
+    <b>
+      <title>Level B</title>
+      <c>
+        <title>Level C</title>
+        <d>
+          <title>Level D</title>
+          <e>
+            <title>Level E</title>
+          </e>
+        </d>
+        <d>
+          <title>Level D</title>
+          <e>
+            <title>Level E</title>
+          </e>
+        </d>
+      </c>
+      <c>
+        <title>Level C</title>
+        <d>
+          <title>Level D</title>
+        </d>
+      </c>
+    </b>
+    <b>
+      <title>Level B</title>
+    </b>
+  </a>
+</doc>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/numbering63.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/numbering63.xsl
new file mode 100644
index 00000000000..36117c16a74
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/numbering63.xsl
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+
+  <!-- CaseName: numbering63 -->
+  <!-- Author: David Marston -->
+  <!-- Purpose: Count all levels of changes and number by level, level=single. -->
+  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1" place="id(number)/ulist[2]/item[1]/p[1]/text()[5]" -->
+  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1" place="id(number)/ulist[1]/item[2]/p[1]/text()[1]" -->
+  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1" place="id(number)/ulist[1]/item[3]/p[1]/text()[1]" -->
+  <!-- SpecCitation: Rec="XSLT" Version="1.0" type="OASISptr1" place="id(convert)/ulist[1]/item[1]/p[1]/text()[1]" -->
+  <!-- Scenario: operation="standard-XML" -->
+
+<xsl:template match="doc">
+  <out><xsl:apply-templates/></out>
+</xsl:template>
+
+<xsl:template match="title">
+  <xsl:number level="single" from="a" count="a|b|c|d|e" format="1"/><xsl:text>: </xsl:text><xsl:value-of select="."/><xsl:text>
+</xsl:text>
+</xsl:template>
+
+<xsl:template match="text()"><!-- To suppress empty lines --><xsl:apply-templates/></xsl:template>
+
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/outer.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/outer.xsl
new file mode 100644
index 00000000000..bdf6a4a9005
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/outer.xsl
@@ -0,0 +1,3 @@
+<s:stylesheet xmlns:s="http://www.w3.org/1999/XSL/Transform" version="1.0">
+  <s:include href="inner.xsl"/>
+</s:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/redirect.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/redirect.xml
new file mode 100644
index 00000000000..ee6a09c1d5a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/redirect.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<foo/>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/redirect.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/redirect.xsl
new file mode 100644
index 00000000000..32f4cb360dc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/redirect.xsl
@@ -0,0 +1,18 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" 
+    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+    xmlns:redirect="http://xml.apache.org/xalan/redirect">
+    
+    <xsl:output method="xml" indent="no" encoding="UTF-8"/>
+    
+    <xsl:template match="/">
+        <redirect:write file="redirect2.xml">
+            <out>
+                <xsl:text disable-output-escaping="yes">Euro 1: &#8364; </xsl:text>
+            </out>
+        </redirect:write>
+        <out>
+            <xsl:text disable-output-escaping="yes">Euro 1: &#8364; </xsl:text>
+        </out>
+    </xsl:template>
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/sax/Bug6451633.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/sax/Bug6451633.java
new file mode 100644
index 00000000000..855fa6ee1e6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/sax/Bug6451633.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform.sax;
+
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.helpers.AttributesImpl;
+
+/*
+ * @bug 6451633
+ * @summary Test TransformerHandler ignores empty text node.
+ */
+public class Bug6451633 {
+
+    @Test
+    public void test() throws Exception {
+        TransformerHandler th = ((SAXTransformerFactory) TransformerFactory.newInstance()).newTransformerHandler();
+
+        DOMResult result = new DOMResult();
+        th.setResult(result);
+
+        th.startDocument();
+        th.startElement("", "root", "root", new AttributesImpl());
+        th.characters(new char[0], 0, 0);
+        th.endElement("", "root", "root");
+        th.endDocument();
+
+        // there's no point in having empty text --- we should remove it
+        Assert.assertEquals(0, ((Document) result.getNode()).getDocumentElement().getChildNodes().getLength());
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/src.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/src.xml
new file mode 100644
index 00000000000..a76af7c89f5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/src.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<x:x-data xmlns:x="http://msqr.us/xsd/jaxb-web" xmlns:m="http://msqr.us/xsd/matte">
+	<x:x-context>
+		<x:server-name>localhost</x:server-name>
+		<x:server-port>8484</x:server-port>
+		<x:user-agent>Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3</x:user-agent>
+		<x:user-locale>en</x:user-locale>
+		<x:web-context>/matte</x:web-context>
+		<x:path>/logon.do</x:path>
+	</x:x-context>
+	<x:x-auxillary>
+		<x:x-param key="magoffin.matt.xweb.REQ">org.springframework.web.servlet.support.RequestContext@4bf0ff</x:x-param>
+	</x:x-auxillary>
+	<x:x-messages>
+		<x:msg key="">You must be logged in and have sufficient access privileges to view the requested page.</x:msg>
+	</x:x-messages>
+	<x:x-session>
+		<x:x-param key="magoffin.matt.xweb.URL">http://localhost:8484/matte/home.do</x:x-param>
+	</x:x-session>
+	<x:x-request/>
+	<x:x-request-headers>
+		<x:param key="accept">*/*</x:param>
+		<x:param key="accept-language">en</x:param>
+		<x:param key="accept-encoding">gzip, deflate</x:param>
+		<x:param key="cookie">JSESSIONID=42E37E740D15356C0E861590CEA4A421; JSESSIONID=5647B2F0C0A7E5E673970E4A21D2F3FD</x:param>
+		<x:param key="user-agent">Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en) AppleWebKit/419 (KHTML, like Gecko) Safari/419.3</x:param>
+		<x:param key="connection">keep-alive</x:param>
+		<x:param key="host">localhost:8484</x:param>
+	</x:x-request-headers>
+	<x:x-model>
+		<x:x-param key="no.model">no model</x:x-param>
+	</x:x-model>
+</x:x-data>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/template.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/template.xml
new file mode 100644
index 00000000000..954260ef2ff
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/template.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<process><map1/>
+<map2/>
+</process>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tigertest-in.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tigertest-in.xml
new file mode 100644
index 00000000000..eeb3723c2bc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tigertest-in.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<office:document xmlns:office="http://openoffice.org/2000/office" xmlns:style="http://openoffice.org/2000/style"  office:class="text" office:version="1.0">
+	<office:styles>
+		<style:default-style style:family="graphics"/>
+		<style:default-style style:family="paragraph"/>
+	</office:styles>
+</office:document>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tigertest.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tigertest.xsl
new file mode 100644
index 00000000000..5b10fc88769
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tigertest.xsl
@@ -0,0 +1,21 @@
+<?xml version='1.0' encoding="UTF-8"?>
+<xsl:stylesheet version="1.0"
+		xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+		xmlns:office="http://openoffice.org/2000/office"
+		xmlns:style="http://openoffice.org/2000/style">
+
+	<xsl:output method="xml" encoding="UTF-8"/>
+
+	<xsl:template match="/">
+		<xsl:variable name="copyData">
+			<xsl:call-template name="copy-by-template" />
+		</xsl:variable>
+		<test>
+  		   <xsl:copy-of select="$copyData"/>
+		</test>
+	</xsl:template>
+
+	<xsl:template name="copy-by-template">
+		<xsl:copy-of select="/"/>
+	</xsl:template>
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tmp.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tmp.xml
new file mode 100644
index 00000000000..86dd86d875b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/tmp.xml
@@ -0,0 +1 @@
+<?xml version="1.0" encoding="UTF-8"?><stardb xmlns="http://www.astro.com/astro" xsi:schemaLocation="http://www.astro.com/astro catalog.xsd" xmlns:astro="http://www.astro.com/astro" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><_test01/><test-02/><test.03/><_test-04>T%e!s#t$</_test-04><star><hr>1</hr><constellation/><fullname/><ra><h>00</h><m>05</m><s>09.9</s><dv>0.08608333333333333</dv></ra><dec><sgn/><d>45</d><m>13</m><s>45</s><dv>45.22916666666667</dv></dec><glng>114.44</glng><glat>-16.88</glat><vmag>6.70</vmag><spec>A1Vn</spec></star><star><hr>2</hr><constellation/><fullname/><ra><h>00</h><m>05</m><s>03.8</s><dv>0.08438888888888889</dv></ra><dec><sgn>-</sgn><d>00</d><m>30</m><s>11</s><dv>-0.5030555555555556</dv></dec><glng>98.33</glng><glat>-61.14</glat><vmag>6.29</vmag><spec>gG9</spec></star><star><hr>3</hr><constellation>Psc</constellation><fullname>33    Psc</fullname><ra><h>00</h><m>05</m><s>20.1</s><dv>0.08891666666666666</dv></ra><dec><sgn>-</sgn><d>05</d><m>42</m><s>27</s><dv>-5.7075000000000005</dv></dec><glng>93.75</glng><glat>-65.93</glat><vmag>4.61</vmag><spec>K0IIIbCN-0.5</spec></star><star><hr>4</hr><constellation>Peg</constellation><fullname>86    Peg</fullname><ra><h>00</h><m>05</m><s>42.0</s><dv>0.095</dv></ra><dec><sgn/><d>13</d><m>23</m><s>46</s><dv>13.39611111111111</dv></dec><glng>106.19</glng><glat>-47.98</glat><vmag>5.51</vmag><spec>G5III</spec></star><star><hr>5</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>16.0</s><dv>0.10444444444444445</dv></ra><dec><sgn/><d>58</d><m>26</m><s>12</s><dv>58.43666666666666</dv></dec><glng>117.03</glng><glat>-03.92</glat><vmag>5.96</vmag><spec>G5V</spec></star><star><hr>6</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>19.0</s><dv>0.10527777777777779</dv></ra><dec><sgn>-</sgn><d>49</d><m>04</m><s>30</s><dv>-49.075</dv></dec><glng>321.61</glng><glat>-66.38</glat><vmag>5.70</vmag><spec>G1IV</spec></star><star><hr>7</hr><constellation>Cas</constellation><fullname>10    Cas</fullname><ra><h>00</h><m>06</m><s>26.5</s><dv>0.10736111111111112</dv></ra><dec><sgn/><d>64</d><m>11</m><s>46</s><dv>64.19611111111111</dv></dec><glng>118.06</glng><glat>1.75</glat><vmag>5.59</vmag><spec>B9III</spec></star><star><hr>8</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>36.8</s><dv>0.11022222222222222</dv></ra><dec><sgn/><d>29</d><m>01</m><s>17</s><dv>29.02138888888889</dv></dec><glng>111.26</glng><glat>-32.83</glat><vmag>6.13</vmag><spec>K0V</spec></star><star><hr>9</hr><constellation/><fullname/><ra><h>00</h><m>06</m><s>50.1</s><dv>0.11391666666666667</dv></ra><dec><sgn>-</sgn><d>23</d><m>06</m><s>27</s><dv>-23.1075</dv></dec><glng>52.21</glng><glat>-79.14</glat><vmag>6.18</vmag><spec>A7V</spec></star><star><hr>10</hr><constellation/><fullname/><ra><h>00</h><m>07</m><s>18.2</s><dv>0.12172222222222222</dv></ra><dec><sgn>-</sgn><d>17</d><m>23</m><s>11</s><dv>-17.386388888888888</dv></dec><glng>74.36</glng><glat>-75.90</glat><vmag>6.19</vmag><spec>A6Vn</spec></star></stardb>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/toys.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/toys.xml
new file mode 100644
index 00000000000..1d9fbe2df66
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/toys.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Document   : toys.xml
+    Created on : August 11, 2003, 6:42 PM
+    Author     : Prasad Subramanian
+    Description:
+-->
+
+<toys>
+    <toy>
+        <name>Lego-Model01</name>
+        <price>65.99</price>
+    </toy>
+    <toy>
+        <name>Lego-Model2</name>
+        <price>69.99</price>
+    </toy>
+    <toy>
+        <name>Lego-Model3</name>
+        <price>14.99</price>
+    </toy>
+    <toy>
+        <name>Barbie-Pink</name>
+        <price>12.99</price>
+    </toy>
+    <toy>
+        <name>Barbie-Blue</name>
+        <price>13.99</price>
+    </toy>        
+    <toy>
+        <name>Barbie-White</name>
+        <price>13.99</price>
+    </toy>   
+    <toy>
+        <name>Barbie-Plain</name>
+        <price>13.99</price>
+    </toy>           
+</toys>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/transform.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/transform.xsl
new file mode 100644
index 00000000000..10143526639
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/transform.xsl
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE stylesheet []>
+
+<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
+
+	<xsl:param name="config"/>
+	<xsl:param name="mapsFile"/>
+
+	<xsl:output method="text"/>
+
+	<xsl:key name="key1" match="map1" use="@type"/>
+	<xsl:key name="key2" match="map2" use="@type"/>
+        
+	<xsl:variable name="maps" select="document($mapsFile)"/>
+	<xsl:variable name="type" select="document($config)/config/@type"/>
+
+	<xsl:template match="map1">
+		<xsl:for-each select="$maps">
+			<xsl:value-of select="key('key1', $type)"/>
+		</xsl:for-each>
+	</xsl:template>
+
+	<xsl:template match="map2">
+		<xsl:for-each select="$maps">
+			<xsl:value-of select="key('key2',$type)"/>
+		</xsl:for-each>
+	</xsl:template>
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/upload-media-form.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/upload-media-form.xsl
new file mode 100644
index 00000000000..3d6de738469
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/upload-media-form.xsl
@@ -0,0 +1,126 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:m="http://msqr.us/xsd/matte"
+	xmlns:x="http://msqr.us/xsd/jaxb-web"
+	exclude-result-prefixes="m x">
+	
+	<!-- <xsl:import href="global-variables.xsl"/> -->
+
+	<!-- helper vars -->
+	<xsl:variable name="form.collectionId" 
+		select="x:x-data/x:x-auxillary[1]/x:x-param[@key='collectionId']"/>
+	<xsl:variable name="form.localTz" 
+		select="x:x-data/x:x-auxillary[1]/x:x-param[@key='localTz']"/>
+	<xsl:variable name="form.mediaTz" 
+		select="x:x-data/x:x-auxillary[1]/x:x-param[@key='mediaTz']"/>
+	
+	<xsl:template match="x:x-data" mode="add-media-form">
+		
+		<form id="upload-media-form" method="post" class="simple-form" 
+			action="{$web-context}{$ctx/x:path}" enctype="multipart/form-data">
+			<p>
+				<xsl:value-of select="key('i18n','upload.media.intro')"/>
+			</p>
+			<div>
+				<label for="tempFile">
+					<xsl:value-of select="key('i18n','file.displayName')"/>
+				</label>
+				<div>
+					<input type="file" name="tempFile" id="tempFile"/>
+					<div class="caption"><xsl:value-of 
+						select="key('i18n','upload.media.file.caption')" 
+						disable-output-escaping="yes"/></div>
+				</div>
+			</div>
+			<div>
+				<label for="collectionId">
+					<xsl:value-of select="key('i18n','collection.displayName')"/>
+				</label>
+				<div>
+					<select name="collectionId" id="collectionId">
+						<xsl:apply-templates select="$aux/m:model/m:collection"/>
+					</select>
+				</div>
+			</div>
+			<div>
+				<label for="mediaTz">
+					<xsl:if test="$err[@field='mediaTz']">
+						<xsl:attribute name="class">error</xsl:attribute>
+					</xsl:if>
+					<xsl:value-of select="key('i18n','upload.media.timeZone.displayName')"/>
+				</label>
+				<div>
+					<select name="mediaTz" id="mediaTz">
+						<xsl:for-each select="$aux/m:model/m:time-zone">
+							<option value="{@code}">
+								<xsl:if test="$form.mediaTz = @code">
+									<xsl:attribute name="selected">
+										<xsl:text>selected</xsl:text>
+									</xsl:attribute>
+								</xsl:if>
+								<xsl:value-of select="@name"/>
+							</option>
+						</xsl:for-each>
+					</select>
+					<div class="caption">
+						<xsl:value-of select="key('i18n','upload.media.timeZone.caption')"/>
+					</div>
+				</div>
+			</div>
+			<div>
+				<label for="localTz">
+					<xsl:if test="$err[@field='localTz']">
+						<xsl:attribute name="class">error</xsl:attribute>
+					</xsl:if>
+					<xsl:value-of select="key('i18n','upload.media.localTimeZone.displayName')"/>
+				</label>
+				<div>
+					<select name="localTz" id="localTz">
+						<xsl:for-each select="$aux/m:model/m:time-zone">
+							<option value="{@code}">
+								<xsl:if test="$form.localTz = @code">
+									<xsl:attribute name="selected">
+										<xsl:text>selected</xsl:text>
+									</xsl:attribute>
+								</xsl:if>
+								<xsl:value-of select="@name"/>
+							</option>
+						</xsl:for-each>
+					</select>
+					<div class="caption">
+						<xsl:value-of select="key('i18n','upload.media.localTimeZone.caption')"/>
+					</div>
+				</div>
+			</div>
+			<div>
+				<label for="autoAlbum">
+					<xsl:if test="$err[@field='autoAlbum']">
+						<xsl:attribute name="class">error</xsl:attribute>
+					</xsl:if>
+					<xsl:value-of select="key('i18n','upload.media.autoAlbum.displayName')"/>
+				</label>
+				<div>
+					<input type="checkbox" name="autoAlbum" id="autoAlbum" value="true"/>
+					<div class="caption">
+						<xsl:value-of select="key('i18n','upload.media.autoAlbum.caption')"/>
+					</div>
+				</div>
+			</div>
+			<div class="submit">
+				<input type="submit" value="{key('i18n','add.displayName')}"/>
+			</div>
+		</form>
+	</xsl:template>
+	
+	<xsl:template match="m:collection">
+		<option value="{@collection-id}">
+			<xsl:if test="$form.collectionId = @collection-id">
+				<xsl:attribute name="selected">
+					<xsl:text>selected</xsl:text>
+				</xsl:attribute>
+			</xsl:if>
+			<xsl:value-of select="@name"/>
+		</option>
+	</xsl:template>
+	
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/upload-media.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/upload-media.xsl
new file mode 100644
index 00000000000..a89c42156b3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/upload-media.xsl
@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:m="http://msqr.us/xsd/matte"
+	xmlns:xweb="http://msqr.us/xsd/jaxb-web"
+	exclude-result-prefixes="m xweb">
+	
+    <!-- imports -->
+	<xsl:import href="default-layout.xsl"/>
+	<xsl:import href="upload-media-form.xsl"/>
+
+        
+	<!-- helper vars -->
+	<xsl:variable name="form.collectionId" 
+		select="xweb:x-data/xweb:x-auxillary[1]/xweb:x-param[@key='collectionId']"/>
+	<xsl:variable name="form.localTz" 
+		select="xweb:x-data/xweb:x-auxillary[1]/xweb:x-param[@key='localTz']"/>
+	<xsl:variable name="form.mediaTz" 
+		select="xweb:x-data/xweb:x-auxillary[1]/xweb:x-param[@key='mediaTz']"/>
+	
+	<xsl:template match="xweb:x-data" mode="page-title">
+		<xsl:value-of select="key('i18n','upload.media.title')"/>
+	</xsl:template>
+	
+	<xsl:template match="xweb:x-data" mode="page-body-class">
+		<xsl:text>no-sub-nav</xsl:text>
+	</xsl:template>
+	
+	<xsl:template match="xweb:x-data" mode="page-main-nav">
+		<xsl:call-template name="main-nav">
+			<xsl:with-param name="page" select="'upload'"/>
+		</xsl:call-template>
+	</xsl:template>	
+	
+	<xsl:template match="xweb:x-data" mode="page-body">
+		<xsl:apply-templates select="." mode="add-media-form"/>
+		<script type="text/javascript" xml:space="preserve">
+			<xsl:comment>
+			document.forms[0].elements['tempFile'].focus();
+			//</xsl:comment>
+		</script>
+	</xsl:template>
+	
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util.xsl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util.xsl
new file mode 100644
index 00000000000..6db5619a4cf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util.xsl
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
+	xmlns:xweb="http://msqr.us/xsd/jaxb-web"
+	exclude-result-prefixes="xweb">
+	
+	<!--
+		Named Template: javascript-string
+		
+		Replace occurances of " in a string with \".
+		
+		Parameters:
+			output-string	- the text to seach/replace in
+	-->
+	<xsl:template name="javascript-string">
+		<xsl:param name="output-string"/>
+		<xsl:call-template name="global-replace">
+			<xsl:with-param name="output-string" select="$output-string"/>
+			<xsl:with-param name="target"><xsl:text>"</xsl:text></xsl:with-param>
+			<xsl:with-param name="replacement"><xsl:text>\"</xsl:text></xsl:with-param>
+		</xsl:call-template>
+	</xsl:template>
+	
+	<!--
+		Named Template: single-quote-string
+		
+		Replace occurances of ' in a string with \'.
+		
+		Parameters:
+			output-string	- the text to seach/replace in
+	-->
+	<xsl:template name="single-quote-string">
+		<xsl:param name="output-string"/>
+		<xsl:call-template name="global-replace">
+			<xsl:with-param name="output-string" select="$output-string"/>
+			<xsl:with-param name="target"><xsl:text>'</xsl:text></xsl:with-param>
+			<xsl:with-param name="replacement"><xsl:text>\'</xsl:text></xsl:with-param>
+		</xsl:call-template>
+	</xsl:template>
+	
+	<!--
+		Named Template: escape-string
+		
+		Replace occurances of a string with that string preceeded by a '\' 
+		character.
+		
+		Parameters:
+			output-string	- the text to seach/replace in
+			target			- the text to search for
+	-->
+	<xsl:template name="escape-string">
+		<xsl:param name="output-string"/>
+		<xsl:param name="target"/>
+		<xsl:call-template name="global-replace">
+			<xsl:with-param name="output-string" select="$output-string"/>
+			<xsl:with-param name="target" select="$target"/>
+			<xsl:with-param name="replacement">
+				<xsl:text>\</xsl:text>
+				<xsl:value-of select="$target"/>
+			</xsl:with-param>
+		</xsl:call-template>
+	</xsl:template>
+	
+	<!--
+		Named Template: global-replace
+		
+		Replace occurances of one string with another.
+		
+		Parameters:
+			output-string	- the text to seach/replace in
+			target			- the text to search for
+			replacement		- the text to replace occurances of 'target' with
+	-->
+	<xsl:template name="global-replace">
+		<xsl:param name="output-string"/>
+		<xsl:param name="target"/>
+		<xsl:param name="replacement"/>
+		<xsl:choose>
+			<xsl:when test="contains($output-string,$target)">
+
+				<xsl:value-of select=
+					"concat(substring-before($output-string,$target), $replacement)"/>
+				<xsl:call-template name="global-replace">
+					<xsl:with-param name="output-string" 
+						 select="substring-after($output-string,$target)"/>
+					<xsl:with-param name="target" select="$target"/>
+					<xsl:with-param name="replacement" 
+						 select="$replacement"/>
+				</xsl:call-template>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:value-of select="$output-string"/>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	
+	<!--
+		Named Template: truncate-at-word
+		
+		Truncate a string at a word break (space). If the input text
+		is shorter than max-length the text is returned unchanged.
+		Otherwise the text is truncated at the max-length plus any 
+		characters up to the next space, and a ellipsis character is
+		appended.
+		
+		Parameters:
+			text       - the text to truncate
+			max-length - the maximum number of characters to allow
+	-->
+	<xsl:template name="truncate-at-word">
+		<xsl:param name="text"/>
+		<xsl:param name="max-length">350</xsl:param>
+		<xsl:choose>
+			<xsl:when test="string-length($text) &lt; $max-length">
+				<xsl:value-of select="$text" disable-output-escaping="yes"/>
+			</xsl:when>
+			<xsl:otherwise>
+				<xsl:variable name="start" select="substring($text,1,$max-length)"/>
+				<xsl:variable name="after" select="substring($text,($max-length+1))"/>
+				<xsl:variable name="word" select="substring-before($after,' ')"/>
+				<xsl:value-of select="$start" disable-output-escaping="yes"/>
+				<xsl:value-of select="$word" disable-output-escaping="yes"/>
+				<xsl:text>&#x2026;</xsl:text>
+			</xsl:otherwise>
+		</xsl:choose>
+	</xsl:template>
+	
+
+</xsl:stylesheet>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/DOMUtil.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/DOMUtil.java
new file mode 100644
index 00000000000..1881299a7c6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/DOMUtil.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform.util;
+
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+
+import org.testng.Assert;
+import org.w3c.dom.Document;
+
+public class DOMUtil extends TransformerUtil {
+
+    DocumentBuilder docBuilder = null;
+
+    private static DOMUtil instance = null;
+
+    /** Creates a new instance of DOMUtil */
+    private DOMUtil() throws Exception {
+        if (docBuilder == null)
+            docBuilder = getDomParser();
+    }
+
+    public static synchronized DOMUtil getInstance() throws Exception {
+        if (instance == null)
+            instance = new DOMUtil();
+        return instance;
+    }
+
+    public Source prepareSource(InputStream is) throws Exception {
+        docBuilder.reset();
+        Document doc1 = docBuilder.parse(is);
+        return new DOMSource(doc1);
+    }
+
+    public Result prepareResult() {
+        Document target = docBuilder.newDocument();
+        return new DOMResult(target);
+    }
+
+    public void checkResult(Result result, String version) {
+        String resultVersion = ((Document) ((DOMResult) result).getNode()).getXmlVersion();
+        Assert.assertTrue(version.equals(resultVersion), "Expected XML Version is 1.1, but actual version " + resultVersion);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/SAXUtil.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/SAXUtil.java
new file mode 100644
index 00000000000..fd7421c23ff
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/SAXUtil.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform.util;
+
+import java.io.InputStream;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.VersionDefaultHandler;
+import javax.xml.transform.sax.SAXResult;
+import javax.xml.transform.sax.SAXSource;
+
+import org.testng.Assert;
+import org.xml.sax.InputSource;
+
+public class SAXUtil extends TransformerUtil {
+
+    private static SAXUtil instance = null;
+
+    /** Creates a new instance of SAXUtil */
+    private SAXUtil() {
+
+    }
+
+    public static synchronized SAXUtil getInstance() throws Exception {
+        if (instance == null)
+            instance = new SAXUtil();
+        return instance;
+    }
+
+    public Source prepareSource(InputStream is) throws Exception {
+        return new SAXSource(new InputSource(is));
+    }
+
+    public Result prepareResult() throws Exception {
+        VersionDefaultHandler dh = new VersionDefaultHandler();
+        return new SAXResult(dh);
+    }
+
+    public void checkResult(Result result, String inputVersion) throws Exception {
+        String version = ((VersionDefaultHandler) ((SAXResult) result).getHandler()).getVersion();
+        Assert.assertTrue(inputVersion.equals(version), "Expected XML Version is 1.1, but actual version " + version);
+    }
+
+    public void checkResult(Result result, String inputVersion, String encoding) throws Exception {
+        checkResult(result, inputVersion);
+        String resultEncoding = ((VersionDefaultHandler) ((SAXResult) result).getHandler()).getEncoding();
+        Assert.assertTrue(encoding.equals(resultEncoding), "Expected XML Version is " + encoding + " , but actual  encoding " + resultEncoding);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/StAXUtil.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/StAXUtil.java
new file mode 100644
index 00000000000..6c17ffa7829
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/StAXUtil.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform.util;
+
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.TransformerUtilFactory;
+import javax.xml.transform.VersionEventWriter;
+import javax.xml.transform.stax.StAXResult;
+import javax.xml.transform.stax.StAXSource;
+
+import org.testng.Assert;
+
+public class StAXUtil extends TransformerUtil {
+
+    private static StAXUtil instance = null;
+
+    /** Creates a new instance of StAXUtil */
+    private StAXUtil() {
+    }
+
+    public static synchronized StAXUtil getInstance() throws Exception {
+        if (instance == null)
+            instance = new StAXUtil();
+        return instance;
+    }
+
+    public Source prepareSource(InputStream is) throws Exception {
+        XMLEventReader reader = XMLInputFactory.newInstance().createXMLEventReader(is);
+        return new StAXSource(reader);
+    }
+
+    public Result prepareResult() throws Exception {
+        VersionEventWriter writer = new VersionEventWriter();
+        return new StAXResult(writer);
+    }
+
+    public void checkResult(Result staxResult, String version) throws Exception {
+        VersionEventWriter writer = (VersionEventWriter) ((StAXResult) staxResult).getXMLEventWriter();
+        Assert.assertTrue(writer.getVersion().equals(version), "Expected XML Version is 1.1, but actual version " + writer.getVersion());
+    }
+
+    public void checkResult(Result staxResult, String version, String encoding) throws Exception {
+        VersionEventWriter writer = (VersionEventWriter) ((StAXResult) staxResult).getXMLEventWriter();
+        Assert.assertTrue(writer.getVersion().equals(version), "Expected XML Version is 1.1, but actual version " + writer.getVersion());
+        Assert.assertTrue(writer.getEncoding().equals(encoding), "Expected encoding is " + encoding + ", but actual encoding " + writer.getEncoding());
+    }
+
+    public Source prepareStreamSource(InputStream is) throws Exception {
+        XMLStreamReader reader = XMLInputFactory.newInstance().createXMLStreamReader(is);
+        return new StAXSource(reader);
+    }
+
+    public Result prepareStreamResult() throws Exception {
+        XMLStreamWriter writer = XMLOutputFactory.newInstance().createXMLStreamWriter(new FileOutputStream(TEMP_FILE));
+        return new StAXResult(writer);
+    }
+
+    public void checkStreamResult(Result staxResult, String version) throws Exception {
+        ((StAXResult) staxResult).getXMLStreamWriter().close();
+        ((StreamUtil) TransformerUtilFactory.getUtil(TransformerUtilFactory.STREAM)).checkStream(new FileInputStream(TEMP_FILE), version);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/StreamUtil.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/StreamUtil.java
new file mode 100644
index 00000000000..7bbf93f4359
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/StreamUtil.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform.util;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.VersionDefaultHandler;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.w3c.dom.Document;
+
+public class StreamUtil extends TransformerUtil {
+
+    DocumentBuilder docBuilder = null;
+
+    private static StreamUtil instance = null;
+
+    /** Creates a new instance of StreamUtil */
+    private StreamUtil() throws Exception {
+        if (docBuilder == null)
+            docBuilder = getDomParser();
+    }
+
+    public static synchronized StreamUtil getInstance() throws Exception {
+        if (instance == null)
+            instance = new StreamUtil();
+        return instance;
+    }
+
+    public Source prepareSource(InputStream is) throws Exception {
+        return new StreamSource(is);
+    }
+
+    public Result prepareResult() throws Exception {
+        FileOutputStream fos = new FileOutputStream(TEMP_FILE);
+        return new StreamResult(fos);
+    }
+
+    public void checkResult(Result result, String inputVersion) throws Exception {
+        ((StreamResult) result).getOutputStream().close();
+        FileInputStream fis = new FileInputStream(TEMP_FILE);
+        checkStream(fis, inputVersion);
+    }
+
+    public void checkStream(FileInputStream fis, String inputVersion) throws Exception {
+        docBuilder.reset();
+        Document output = docBuilder.parse(fis);
+        String version = output.getXmlVersion();
+        Assert.assertTrue(inputVersion.equals(version), "Expected XML Version is 1.1, but actual version " + version);
+    }
+
+    public void checkResult(Result result, String version, String encoding) throws Exception {
+        // use sax parser, as encoding info cannot be set on DOM document
+        SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
+        VersionDefaultHandler dh = new VersionDefaultHandler();
+        parser.parse(new File(TEMP_FILE), dh);
+        Assert.assertTrue(dh.getVersion().equals(version), "Expected version is " + version + " actual version " + dh.getVersion());
+        Assert.assertTrue(dh.getEncoding().equals(encoding), "Expected version is " + encoding + " actual version " + dh.getEncoding());
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/TransformerUtil.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/TransformerUtil.java
new file mode 100644
index 00000000000..5a92fe77069
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/transform/util/TransformerUtil.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.transform.util;
+
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+
+public abstract class TransformerUtil {
+
+    protected String type;
+
+    protected final String TEMP_FILE = "tmp.xml";
+
+    public abstract Source prepareSource(InputStream is) throws Exception;
+
+    public abstract Result prepareResult() throws Exception;
+
+    public abstract void checkResult(Result result, String version) throws Exception;
+
+    public void checkResult(Result result, String version, String encoding) throws Exception {
+        checkResult(result, version);
+    }
+
+    public DocumentBuilder getDomParser() throws Exception {
+        DocumentBuilderFactory docBF = DocumentBuilderFactory.newInstance();
+        return docBF.newDocumentBuilder();
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/6773084.policy b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/6773084.policy
new file mode 100644
index 00000000000..b4547934b44
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/6773084.policy
@@ -0,0 +1,23 @@
+grant {
+	permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+	permission java.lang.RuntimePermission "accessDeclaredMembers";
+	
+	permission java.io.FilePermission "${test.classes}/../../-", "read, write, delete";
+	permission java.io.FilePermission ".", "read, write, delete";
+	permission java.util.PropertyPermission "*", "read, write";
+	
+    permission java.lang.RuntimePermission "setSecurityManager";
+    permission java.lang.RuntimePermission "createSecurityManager";
+    permission java.lang.RuntimePermission "createClassLoader";
+    permission java.lang.RuntimePermission "setIO";
+	permission java.lang.RuntimePermission "setContextClassLoader"; 
+	permission java.security.SecurityPermission "getPolicy";
+    
+    permission java.io.FilePermission "${test.src}/-", "read, write, delete";
+    permission java.io.FilePermission "${user.dir}/-", "read, write, delete";
+    permission java.io.FilePermission "${java.io.tmpdir}/-", "read, write, delete";
+    
+    
+    permission java.lang.RuntimePermission "modifyThread";
+
+};
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966232.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966232.java
new file mode 100644
index 00000000000..925bf2c9123
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966232.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 4966232
+ * @summary Test SchemaFactory.newSchema(Source) returns a Schema instance for DOMSource & SAXSource.
+ */
+public class Bug4966232 {
+
+    // test for W3C XML Schema 1.0 - newSchema(Source schema)
+    // supports and return a valid Schema instance
+    // SAXSource - valid schema
+
+    @Test
+    public void testSchemaFactory01() throws Exception {
+        SchemaFactory sf = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+        InputSource is = new InputSource(Bug4966232.class.getResourceAsStream("test.xsd"));
+        SAXSource ss = new SAXSource(is);
+        Schema s = sf.newSchema(ss);
+        Assert.assertNotNull(s);
+    }
+
+    // test for W3C XML Schema 1.0 - newSchema(Source schema)
+    // supports and return a valid Schema instance
+    // DOMSource - valid schema
+
+    @Test
+    public void testSchemaFactory02() throws Exception {
+        Document doc = null;
+        SchemaFactory sf = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        doc = dbf.newDocumentBuilder().parse(Bug4966232.class.getResource("test.xsd").toExternalForm());
+        DOMSource ds = new DOMSource(doc);
+        Schema s = sf.newSchema(ds);
+        Assert.assertNotNull(s);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.java
new file mode 100644
index 00000000000..6d1f0ad2374
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+import util.DraconianErrorHandler;
+
+/*
+ * @bug 4966254
+ * @summary Test validate(StreamSource) & validate(StreamSource,null) works instead of throws IOException.
+ */
+public class Bug4966254 {
+
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void testValidator01() throws Exception {
+        getValidator().validate(getInstance());
+    }
+
+    @Test
+    public void testValidator02() throws Exception {
+        getValidator().validate(getInstance(), null);
+    }
+
+    private StreamSource getInstance() {
+        return new StreamSource(Bug4966254.class.getResource(("Bug4966254.xml")).toExternalForm());
+    }
+
+    private Validator getValidator() throws SAXException {
+        Schema s = getSchema();
+        Validator v = s.newValidator();
+        Assert.assertNotNull(v);
+        v.setErrorHandler(new DraconianErrorHandler());
+        return v;
+    }
+
+    private Schema getSchema() throws SAXException {
+        SchemaFactory sf = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+        Schema s = sf.newSchema(Bug4966254.class.getResource("Bug4966254.xsd"));
+        Assert.assertNotNull(s);
+        return s;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.xml
new file mode 100644
index 00000000000..251af32866d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.xml
@@ -0,0 +1,2 @@
+<?xml version='1.0'?>
+<test6 xmlns="testNS" attr="x"><code/></test6>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.xsd
new file mode 100644
index 00000000000..88a29ef37bc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4966254.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns:testNS="testNS"
+            targetNamespace="testNS" elementFormDefault="qualified">
+    
+    <xsd:element name="test6">
+        <xsd:complexType>
+            <xsd:complexContent>
+                <xsd:extension base="testNS:Test">
+                    <xsd:attribute name="attr" />
+                </xsd:extension>
+            </xsd:complexContent>
+        </xsd:complexType>
+    </xsd:element>
+
+    <xsd:complexType name="Test">
+        <xsd:sequence>
+            <xsd:element name="description" minOccurs="0"/>
+            <xsd:element name="code"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969042.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969042.java
new file mode 100644
index 00000000000..71ad30d61c9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969042.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4969042
+ * @summary Test ValidationHandler shall invoke ignorableWhitespace() of the
+ * user-defined ContentHandler once the validator detects any ignorable whitespaces.
+ */
+public class Bug4969042 {
+
+    public static final String XSD = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n" + "        xmlns:test='jaxp13_test'\n"
+            + "        targetNamespace='jaxp13_test'\n" + "        elementFormDefault='qualified'>\n" + "    <element name='test'>\n"
+            + "        <complexType>\n" + "            <sequence>\n" + "                <element name='child' type='string'/>\n" + "            </sequence>\n"
+            + "        </complexType>\n" + "    </element>\n" + "</schema>\n";
+
+    public static final String XML = "<?xml version='1.0'?>\n" + "<ns:test xmlns:ns='jaxp13_test'>\n" + "  <ns:child>\n" + "      123abc\n" + "  </ns:child>\n"
+            + "</ns:test>\n";
+
+    private ValidatorHandler createValidatorHandler(String xsd) throws SAXException {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+        StringReader reader = new StringReader(xsd);
+        StreamSource xsdSource = new StreamSource(reader);
+
+        Schema schema = schemaFactory.newSchema(xsdSource);
+        return schema.newValidatorHandler();
+    }
+
+    private XMLReader createXMLReader() throws ParserConfigurationException, SAXException {
+        SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+        if (!parserFactory.isNamespaceAware()) {
+            parserFactory.setNamespaceAware(true);
+        }
+
+        return parserFactory.newSAXParser().getXMLReader();
+    }
+
+    private void parse(XMLReader xmlReader, String xml) throws SAXException, IOException {
+        StringReader reader = new StringReader(xml);
+        InputSource inSource = new InputSource(reader);
+
+        xmlReader.parse(inSource);
+    }
+
+    @Test
+    public void test() throws SAXException, ParserConfigurationException, IOException {
+        XMLReader xmlReader = createXMLReader();
+        ValidatorHandler validatorHandler = createValidatorHandler(XSD);
+        xmlReader.setContentHandler(validatorHandler);
+
+        final boolean[] invoked = { false, false };
+        DefaultHandler contentHandler = new DefaultHandler() {
+            public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
+                invoked[0] = true;
+            }
+
+            public void characters(char[] ch, int start, int length) throws SAXException {
+                invoked[1] = true;
+            }
+        };
+        validatorHandler.setContentHandler(contentHandler);
+
+        parse(xmlReader, XML);
+
+        Assert.assertTrue(invoked[0], "Method ignorableWhitespace() was not invoked.");
+        Assert.assertTrue(invoked[1], "Method characters() was not invoked.");
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969089.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969089.java
new file mode 100644
index 00000000000..d0d28122c47
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969089.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.StringReader;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4969089
+ * @summary Test when an ErrorHandler is set for a SchemaFactory, SchemaFactory.newSchema(Source[])
+ * method throws an exception that is not equal to the exception thrown from the ErrorHandler.
+ */
+public class Bug4969089 {
+
+    @Test
+    public void test1() {
+        String xsd1 = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n" + "        xmlns:test='jaxp13_test1'\n"
+                + "        targetNamespace='jaxp13_test1'\n" + "        elementFormDefault='qualified'>\n" + "    <element name='test'>\n" + "</schema>\n";
+
+        final SAXException EUREKA = new SAXException("NewSchema007");
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+        StringReader reader = new StringReader(xsd1);
+        StreamSource source = new StreamSource(reader);
+        DefaultHandler errorHandler = new DefaultHandler() {
+            public void fatalError(SAXParseException _) throws SAXException {
+                throw EUREKA;
+            }
+
+            public void error(SAXParseException _) throws SAXException {
+                throw EUREKA;
+            }
+        };
+        schemaFactory.setErrorHandler(errorHandler);
+
+        try {
+            schemaFactory.newSchema(new Source[] { source });
+            Assert.fail("SAXException was not thrown.");
+        } catch (SAXException e) {
+            Assert.assertSame(e, EUREKA);
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969110.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969110.java
new file mode 100644
index 00000000000..f9fb0f4adb9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969110.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+
+/*
+ * @bug 4969110
+ * @summary Test ValidationHandler.set/getProperty() throws a correct exception
+ * instead of a sun internal exception in case the "property name" parameter is invalid.
+ */
+public class Bug4969110 {
+
+    SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+    @Test
+    public void test1() throws SAXException {
+        try {
+            ValidatorHandler validatorHandler = schemaFactory.newSchema().newValidatorHandler();
+            validatorHandler.getProperty("unknown1234");
+            Assert.fail("SAXNotRecognizedException was not thrown.");
+        } catch (SAXNotRecognizedException e) {
+        }
+    }
+
+    @Test
+    public void test2() throws SAXException {
+        try {
+            doTest(null);
+            Assert.fail("NullPointerException was not thrown.");
+        } catch (NullPointerException e) {
+        }
+    }
+
+    @Test
+    public void test3() throws SAXException {
+        try {
+            doTest("unknown1234");
+            Assert.fail("SAXNotRecognizedException was not thrown.");
+        } catch (SAXNotRecognizedException e) {
+        }
+    }
+
+    public void doTest(String name) throws SAXException {
+        ValidatorHandler validatorHandler = schemaFactory.newSchema().newValidatorHandler();
+        validatorHandler.setProperty(name, "123");
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969689.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969689.java
new file mode 100644
index 00000000000..6790321bdbf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969689.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+
+
+/*
+ * @bug 4969689
+ * @summary Test SchemaFactory.get/setFeature() throw NullPointerException
+ * instead of SAXNotRecognizedException in case the "feature name" parameter is null.
+ */
+public class Bug4969689 {
+
+    SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+    @Test
+    public void test01() throws SAXNotRecognizedException, SAXNotSupportedException {
+        try {
+            schemaFactory.getFeature(null);
+            Assert.fail("exception expected");
+        } catch (NullPointerException e) {
+            ; // expected
+        }
+    }
+
+    @Test
+    public void test() throws SAXNotRecognizedException, SAXNotSupportedException {
+        try {
+            schemaFactory.setFeature(null, false);
+            Assert.fail("exception expected");
+        } catch (NullPointerException e) {
+            ; // as expected
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969692.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969692.java
new file mode 100644
index 00000000000..e19372242a3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969692.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 4969692
+ * @summary Test Validator.get/setFeature() throw NullPointerException
+ * instead of SAXNotRecognizedException in case the "feature name" parameter is null.
+ */
+public class Bug4969692 {
+
+    SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+    @Test
+    public void test01() throws SAXException {
+        Validator validator = schemaFactory.newSchema().newValidator();
+        try {
+            validator.getFeature(null);
+            Assert.fail("exception expected");
+        } catch (NullPointerException e) {
+            ;
+        }
+    }
+
+    @Test
+    public void test02() throws SAXException {
+        Validator validator = schemaFactory.newSchema().newValidator();
+        try {
+            validator.setFeature(null, false);
+            Assert.fail("exception expected");
+        } catch (NullPointerException e) {
+            ;
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969693.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969693.java
new file mode 100644
index 00000000000..026da4a3ebf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969693.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 4969693
+ * @summary Test Validator.get/setProperty() throw NullPointerException
+ * instead of SAXNotRecognizedException in case the "property name" parameter is null.
+ */
+public class Bug4969693 {
+
+    SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+    @Test
+    public void test01() throws SAXException {
+        Validator validator = schemaFactory.newSchema().newValidator();
+        try {
+            validator.getProperty(null);
+            Assert.fail("exception expected");
+        } catch (NullPointerException e) {
+            ;
+        }
+    }
+
+    @Test
+    public void test02() throws SAXException {
+        Validator validator = schemaFactory.newSchema().newValidator();
+        try {
+            validator.setProperty(null, "abc");
+            Assert.fail("exception expected");
+        } catch (NullPointerException e) {
+            ;
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969695.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969695.java
new file mode 100644
index 00000000000..39ea1b7be03
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969695.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+
+/*
+ * @bug 4969695
+ * @summary Test SchemaFactory.get/setProperty() throw NullPointerException
+ * instead of SAXNotRecognizedException in case the "property name" parameter is null.
+ */
+public class Bug4969695 {
+
+    SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+    @Test
+    public void test01() throws SAXNotRecognizedException, SAXNotSupportedException {
+        try {
+            schemaFactory.getProperty(null);
+            Assert.fail("exception expected");
+        } catch (NullPointerException e) {
+            ; // expected
+        }
+    }
+
+    @Test
+    public void test() throws SAXNotRecognizedException, SAXNotSupportedException {
+        try {
+            schemaFactory.setProperty(null, "123");
+            Assert.fail("exception expected");
+        } catch (NullPointerException e) {
+            ; // as expected
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969732.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969732.java
new file mode 100644
index 00000000000..5f298af454d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969732.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.TypeInfoProvider;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4969732
+ * @summary Test TypeInfoProvider.getElementTypeInfo() throws IllegalStateException
+ * in case the method is not called from method startElement() or endElement().
+ */
+public class Bug4969732 {
+
+    public static final String XSD = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n" + "        xmlns:test='jaxp13_test'\n"
+            + "        targetNamespace='jaxp13_test'\n" + "        elementFormDefault='qualified'>\n" + "    <element name='test' type='string'/>\n"
+            + "</schema>\n";
+
+    public static final String XML = "<?xml version='1.0'?>\n" + "<ns:test xmlns:ns='jaxp13_test'>1234abc</ns:test>\n";
+
+    private ValidatorHandler createValidatorHandler(String xsd) throws SAXException {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+        StringReader reader = new StringReader(xsd);
+        StreamSource xsdSource = new StreamSource(reader);
+
+        Schema schema = schemaFactory.newSchema(xsdSource);
+        return schema.newValidatorHandler();
+    }
+
+    private XMLReader createXMLReader() throws Exception {
+        SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+        parserFactory.setNamespaceAware(true);
+
+        return parserFactory.newSAXParser().getXMLReader();
+    }
+
+    private void parse(XMLReader xmlReader, String xml) throws Exception {
+        StringReader reader = new StringReader(xml);
+        InputSource inSource = new InputSource(reader);
+
+        xmlReader.parse(inSource);
+    }
+
+    @Test
+    public void test1() throws Exception {
+        XMLReader xmlReader = createXMLReader();
+        final ValidatorHandler validatorHandler = createValidatorHandler(XSD);
+        xmlReader.setContentHandler(validatorHandler);
+
+        DefaultHandler handler = new DefaultHandler() {
+            public void characters(char[] ch, int start, int length) throws SAXException {
+                TypeInfoProvider infoProvider = null;
+                synchronized (validatorHandler) {
+                    infoProvider = validatorHandler.getTypeInfoProvider();
+                }
+                if (infoProvider == null) {
+                    Assert.fail("Can't obtain TypeInfo object.");
+                }
+
+                try {
+                    infoProvider.getElementTypeInfo();
+                    Assert.fail("IllegalStateException was not thrown.");
+                } catch (IllegalStateException e) {
+                    // as expected
+                    System.out.println("OK");
+                }
+            }
+        };
+        validatorHandler.setContentHandler(handler);
+
+        parse(xmlReader, XML);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970380.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970380.java
new file mode 100644
index 00000000000..b9a0656b002
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970380.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXNotRecognizedException;
+
+/*
+ * @bug 4970380
+ * @summary Test validatorHandler.getFeature(...) with unknown name and "http://xml.org/sax/features/namespace-prefixes".
+ */
+public class Bug4970380 {
+
+    @Test
+    public void test1() throws Exception {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+        ValidatorHandler validatorHandler = schemaFactory.newSchema().newValidatorHandler();
+
+        try {
+            validatorHandler.getFeature("unknown1234");
+            Assert.fail("SAXNotRecognizedException was not thrown.");
+        } catch (SAXNotRecognizedException e) {
+            ; // expected
+        }
+
+        if (!validatorHandler.getFeature("http://xml.org/sax/features/namespace-prefixes")) {
+            // as expected
+            System.out.println("getFeature(namespace-prefixes): OK");
+        } else {
+            Assert.fail("Expected false, returned true.");
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970383.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970383.java
new file mode 100644
index 00000000000..3ac15277ec4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970383.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4970383
+ * @summary Test validatorHandler.setFeature throws NullPointerException if name parameter is null.
+ */
+public class Bug4970383 {
+
+    @Test
+    public void test() throws Exception {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+        ValidatorHandler validatorHandler = schemaFactory.newSchema().newValidatorHandler();
+        try {
+            validatorHandler.setFeature(null, false);
+            Assert.fail("should report an error");
+        } catch (NullPointerException e) {
+            ; // expected
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970400.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970400.java
new file mode 100644
index 00000000000..d0c57b20765
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970400.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4970400
+ * @summary Test ValidatorHandler recognizes namespace-prefixes feature.
+ */
+public class Bug4970400 {
+
+    @Test
+    public void test1() throws Exception {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+        ValidatorHandler validatorHandler = schemaFactory.newSchema().newValidatorHandler();
+        validatorHandler.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
+        validatorHandler.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970402.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970402.java
new file mode 100644
index 00000000000..55f3d1d9d3d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970402.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.TypeInfoProvider;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4970402
+ * @summary Test TypeInfoProvider's attribute accessing methods throw IndexOutOfBoundsException when index parameter is invalid.
+ */
+public class Bug4970402 {
+
+    public static final String XSD = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n" + "        xmlns:test='jaxp13_test'\n"
+            + "        targetNamespace='jaxp13_test'\n" + "        elementFormDefault='qualified'>\n" + "    <element name='test'>\n"
+            + "        <complexType>\n" + "            <sequence>\n" + "                <element name='child' type='string'/>\n" + "            </sequence>\n"
+            + "            <attribute name='id' />\n" + "        </complexType>\n" + "    </element>\n" + "</schema>\n";
+
+    public static final String XML = "<?xml version='1.0'?>\n" + "<ns:test xmlns:ns='jaxp13_test' id='2003-12-02'>\n" + "  <ns:child>123abc</ns:child>\n"
+            + "</ns:test>\n";
+
+    private ValidatorHandler createValidatorHandler(String xsd) throws SAXException {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+        StringReader reader = new StringReader(xsd);
+        StreamSource xsdSource = new StreamSource(reader);
+
+        Schema schema = schemaFactory.newSchema(xsdSource);
+        return schema.newValidatorHandler();
+    }
+
+    private XMLReader createXMLReader() throws ParserConfigurationException, SAXException {
+        SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+        parserFactory.setNamespaceAware(true);
+        return parserFactory.newSAXParser().getXMLReader();
+    }
+
+    private void parse(XMLReader xmlReader, String xml) throws SAXException, IOException {
+        StringReader reader = new StringReader(xml);
+        InputSource inSource = new InputSource(reader);
+
+        xmlReader.parse(inSource);
+    }
+
+    @Test
+    public void test() throws Exception {
+        XMLReader xmlReader = createXMLReader();
+        final ValidatorHandler validatorHandler = createValidatorHandler(XSD);
+        xmlReader.setContentHandler(validatorHandler);
+
+        DefaultHandler handler = new DefaultHandler() {
+            public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+                if (!"ns:test".equals(qName)) {
+                    return;
+                }
+
+                TypeInfoProvider infoProvider = null;
+                synchronized (validatorHandler) {
+                    infoProvider = validatorHandler.getTypeInfoProvider();
+                }
+                Assert.assertTrue(infoProvider != null, "Can't obtain TypeInfoProvider object.");
+
+                try {
+                    infoProvider.getAttributeTypeInfo(-1);
+                    Assert.fail("IndexOutOfBoundsException was not thrown.");
+                } catch (IndexOutOfBoundsException e) {
+                    ; // as expected
+                }
+
+                try {
+                    infoProvider.isIdAttribute(-1);
+                    Assert.fail("IndexOutOfBoundsException was not thrown.");
+                } catch (IndexOutOfBoundsException e) {
+                    ; // as expected
+                }
+            }
+        };
+        validatorHandler.setContentHandler(handler);
+
+        parse(xmlReader, XML);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970951.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970951.java
new file mode 100644
index 00000000000..4f986a8920a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4970951.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.TypeInfoProvider;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4970951
+ * @summary Test TypeInfoProvider.isSpecified(...) return true if the attribute was originally present.
+ */
+public class Bug4970951 {
+
+    public static final String XSD = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n" + "        xmlns:test='jaxp13_test'\n"
+            + "        targetNamespace='jaxp13_test'\n" + "        elementFormDefault='qualified'>\n" + "    <element name='test'>\n"
+            + "        <complexType>\n" + "            <sequence>\n" + "                <element name='child' type='string'/>\n" + "            </sequence>\n"
+            + "            <attribute name='id' />\n" + "            <attribute name='date' default='2003-12-04'/>\n" + "        </complexType>\n"
+            + "    </element>\n" + "</schema>\n";
+
+    public static final String XML = "<?xml version='1.0'?>\n" + "<ns:test xmlns:ns='jaxp13_test' id='i001'>\n" + "  <ns:child>123abc</ns:child>\n"
+            + "</ns:test>\n";
+
+    private ValidatorHandler createValidatorHandler(String xsd) throws SAXException {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+        StringReader reader = new StringReader(xsd);
+        StreamSource xsdSource = new StreamSource(reader);
+
+        Schema schema = schemaFactory.newSchema(xsdSource);
+        return schema.newValidatorHandler();
+    }
+
+    private XMLReader createXMLReader() throws ParserConfigurationException, SAXException {
+        SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+        parserFactory.setNamespaceAware(true);
+
+        return parserFactory.newSAXParser().getXMLReader();
+    }
+
+    private void parse(XMLReader xmlReader, String xml) throws SAXException, IOException {
+        StringReader reader = new StringReader(xml);
+        InputSource inSource = new InputSource(reader);
+
+        xmlReader.parse(inSource);
+    }
+
+    @Test
+    public void test() throws Exception {
+        XMLReader xmlReader = createXMLReader();
+        final ValidatorHandler validatorHandler = createValidatorHandler(XSD);
+        xmlReader.setContentHandler(validatorHandler);
+
+        DefaultHandler handler = new DefaultHandler() {
+            public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+                if (!"ns:test".equals(qName)) {
+                    return;
+                }
+
+                TypeInfoProvider infoProvider = validatorHandler.getTypeInfoProvider();
+                if (infoProvider == null) {
+                    throw new SAXException("Can't obtain TypeInfoProvider object.");
+                }
+
+                int index = attributes.getIndex("id");
+                if (index == -1) {
+                    throw new SAXException("The attribute 'id' is not in the list.");
+                }
+
+                Assert.assertTrue(infoProvider.isSpecified(index));
+
+                index = attributes.getIndex("date");
+                if (index == -1) {
+                    throw new SAXException("The attribute 'date' is not in the list.");
+                }
+
+                Assert.assertFalse(infoProvider.isSpecified(index));
+
+                System.out.println("OK");
+            }
+        };
+        validatorHandler.setContentHandler(handler);
+
+        parse(xmlReader, XML);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4971605.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4971605.java
new file mode 100644
index 00000000000..09cd588489a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4971605.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 4971605
+ * @summary Test SchemaFactory.newSchema(Source) returns a Schema instance for DOMSource.
+ */
+public class Bug4971605 {
+
+    @Test
+    public void test1() throws Exception {
+        String xsd = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n" + "        xmlns:test='jaxp13_test1'\n"
+                + "        targetNamespace='jaxp13_test1'\n" + "        elementFormDefault='qualified'>\n" + "    <element name='test'/>\n" + "</schema>\n";
+
+        DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+        docBuilderFactory.setNamespaceAware(true);
+        DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
+
+        Node document = docBuilder.parse(new InputSource(new StringReader(xsd)));
+        Assert.assertNotNull(document);
+
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+        Schema schema = schemaFactory.newSchema(new Source[] { new DOMSource(document) });
+        Assert.assertNotNull(schema, "Failed: newSchema returned null.");
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4971607.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4971607.java
new file mode 100644
index 00000000000..e33b040a778
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4971607.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4971607
+ * @summary Test ValidatorHandler.getFeature(...) throws NullPointerException when name parameter is null.
+ */
+public class Bug4971607 {
+
+    @Test
+    public void test1() throws Exception {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+        ValidatorHandler validatorHandler = schemaFactory.newSchema().newValidatorHandler();
+
+        try {
+            validatorHandler.getFeature(null);
+            Assert.fail();
+        } catch (NullPointerException e) {
+            e.printStackTrace();
+            ; // as expected
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4972882.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4972882.java
new file mode 100644
index 00000000000..8e84e840626
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4972882.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+import util.DraconianErrorHandler;
+
+/*
+ * @bug 4972882
+ * @summary Test Validator throws Exception when two identity-constraints are defined with the same {name} and {target namespace}.
+ */
+public class Bug4972882 {
+
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test1() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setValidating(true);
+        dbf.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        dbf.setAttribute(SCHEMA_SOURCE, Bug4972882.class.getResource("targetNS00101m2_stub.xsd").toExternalForm());
+
+        DocumentBuilder builder = dbf.newDocumentBuilder();
+        builder.setErrorHandler(new DraconianErrorHandler());
+
+        try {
+            builder.parse(Bug4972882.class.getResource("targetNS00101m2_stub.xml").toExternalForm());
+            Assert.fail("failure expected");
+        } catch (SAXException e) {
+            Assert.assertTrue(e.getMessage().indexOf("sch-props-correct.2") != -1);
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4986844.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4986844.java
new file mode 100644
index 00000000000..73049545f24
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4986844.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 4986844
+ * @summary Test SchemaFactory can detect particle restriction.
+ */
+public class Bug4986844 {
+
+    @Test
+    public void test1() throws Exception {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+        try {
+            schemaFactory.newSchema(Bug4986844.class.getResource("Bug4986844.xsd"));
+            Assert.fail("should report an error");
+        } catch (SAXException e) {
+            if (e.getMessage().startsWith("rcase-RecurseUnordered.2"))
+                ; // as expected
+            else
+                throw e;
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4986844.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4986844.xsd
new file mode 100644
index 00000000000..fe8354c5abd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4986844.xsd
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+            targetNamespace="http://xsdtesting" 
+            xmlns:x="http://xsdtesting">
+	<xsd:complexType name="B">
+		<xsd:all>
+			<xsd:element name="e1" minOccurs="1" maxOccurs="1"/>
+			<xsd:element name="e2" minOccurs="1" maxOccurs="1"/>
+		</xsd:all>
+	</xsd:complexType>
+	<xsd:complexType name="R">
+		<xsd:complexContent>
+			<xsd:restriction base="x:B">
+				<xsd:sequence>
+					<xsd:element name="e1" minOccurs="1" maxOccurs="1"/>
+					<xsd:element name="e2" minOccurs="1" maxOccurs="2"/>
+				</xsd:sequence>
+			</xsd:restriction>
+		</xsd:complexContent>
+	</xsd:complexType>
+	<xsd:element name="doc">
+		<xsd:complexType>
+			<xsd:choice>
+				<xsd:element name="elem" type="x:R"/>
+			</xsd:choice>
+		</xsd:complexType>
+	</xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4987574.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4987574.java
new file mode 100644
index 00000000000..a56806a61c8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4987574.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4987574
+ * @summary Test schemaFactory.newSchema doesn't throw NullPointerExceptio for empty schema.
+ */
+public class Bug4987574 {
+
+    @Test
+    public void test1() throws Exception {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+        File tmpFile = File.createTempFile("jaxpri", "bug");
+        tmpFile.deleteOnExit();
+        {
+            PrintWriter pw = new PrintWriter(new FileWriter(tmpFile));
+            pw.println("<schema xmlns='http://www.w3.org/2001/XMLSchema'/>");
+            pw.close();
+        }
+
+        schemaFactory.newSchema(tmpFile);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988267.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988267.java
new file mode 100644
index 00000000000..4c372f5ad7a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988267.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 4988267
+ * @summary Test SchemaFactory can detect particle restriction.
+ */
+public class Bug4988267 {
+
+    @Test
+    public void test1() throws Exception {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+        try {
+            schemaFactory.newSchema(Bug4988267.class.getResource("Bug4988267.xsd"));
+            Assert.fail("should report an error");
+        } catch (SAXException e) {
+            if (e.getMessage().startsWith("cos-nonambig"))
+                ; // as expected
+            else
+                throw e;
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988267.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988267.xsd
new file mode 100644
index 00000000000..85923c0c861
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988267.xsd
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            targetNamespace="http://xsdtesting">
+  <xsd:element name="foo">
+    <xsd:complexType>
+      <xsd:choice maxOccurs="10">
+        <xsd:any namespace="A" processContents="lax"/>
+        <xsd:any namespace="A"/>
+      </xsd:choice>
+    </xsd:complexType>
+  </xsd:element>
+  
+  <xsd:element name="bar"/>
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988268.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988268.java
new file mode 100644
index 00000000000..d99960674b0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988268.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4988268
+ * @summary Test the schema is valid.
+ */
+public class Bug4988268 {
+
+    @Test
+    public void test1() throws Exception {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+        schemaFactory.newSchema(Bug4988268.class.getResource("Bug4988268.xsd"));
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988268.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988268.xsd
new file mode 100644
index 00000000000..e0d14a9f185
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988268.xsd
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
+            targetNamespace="http://xsdtesting" 
+            xmlns:x="http://xsdtesting" 
+            elementFormDefault="qualified">
+        <xsd:group name="G">
+                <xsd:all>
+                        <xsd:element name="a1"/>
+                        <xsd:element name="a2"/>
+                </xsd:all>
+        </xsd:group>
+        <xsd:element name="doc">
+                <xsd:complexType>
+                        <xsd:group ref="x:G" minOccurs="0"/>
+                </xsd:complexType>
+        </xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988387.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988387.java
new file mode 100644
index 00000000000..9ca25216ec6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988387.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 4988387
+ * @summary Test SchemaFactory can detect invalid XPath expressions.
+ */
+public class Bug4988387 {
+
+    @Test
+    public void test1() throws Exception {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+        try {
+            schemaFactory.newSchema(Bug4988387.class.getResource("Bug4988387.xsd"));
+            Assert.fail("incorrect XPath processed");
+        } catch (SAXException e) {
+            Assert.assertTrue(e.getMessage().startsWith("c-general-xpath"));
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988387.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988387.xsd
new file mode 100644
index 00000000000..6dce12a48ff
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4988387.xsd
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+        <xsd:element name="root">
+                <xsd:complexType>
+                        <xsd:sequence>
+                                <xsd:element ref="tid" maxOccurs="unbounded"/>
+                        </xsd:sequence>
+                </xsd:complexType>
+                <xsd:unique name="uid">
+                        <xsd:selector xpath=".//tid"/>
+                        <xsd:field xpath="./ /."/>
+                </xsd:unique>
+        </xsd:element>
+        <xsd:element name="tid" type="xsd:string"/>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4996446.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4996446.java
new file mode 100644
index 00000000000..e381e65f59c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4996446.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.net.URL;
+
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 4996446
+ * @summary Test SchemaFactory can detect violations of the "Schema Component Constraint: Element Declarations Consistent".
+ */
+public class Bug4996446 {
+
+    SchemaFactory schemaFactory = null;
+
+    @BeforeMethod
+    protected void setUp() {
+        schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+    }
+
+    @AfterMethod
+    protected void tearDown() {
+        schemaFactory = null;
+    }
+
+    @Test
+    public void testOne() {
+
+        ErrorHandler errorHandler = new ErrorHandler();
+        schemaFactory.setErrorHandler(errorHandler);
+        URL fileName = Bug4996446.class.getResource("Bug4996446.xsd");
+        try {
+            schemaFactory.newSchema(fileName);
+        } catch (SAXException e) {
+        }
+
+        if (errorHandler.errorCounter == 0) {
+            Assert.fail(" No Errors reported: " + errorHandler.errorCounter);
+        }
+        return;
+    }
+}
+
+class ErrorHandler extends DefaultHandler {
+    public int errorCounter = 0;
+
+    public void error(SAXParseException e) throws SAXException {
+        // System.out.println(e);
+        errorCounter++;
+    }
+
+    public void fatalError(SAXParseException e) throws SAXException {
+        // System.out.println(e);
+        errorCounter++;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4996446.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4996446.xsd
new file mode 100644
index 00000000000..07f9a64b903
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4996446.xsd
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+        <xsd:element name="doc" type="foo"/>
+        <xsd:complexType name="foo">
+                <xsd:all>
+                        <xsd:element name="e1" type="xsd:string"/>
+                        <xsd:element name="e1" type="bar"/>
+                </xsd:all>
+        </xsd:complexType>
+        <xsd:complexType name="bar">
+                <xsd:sequence>
+                        <xsd:choice>
+                                <xsd:choice>
+                                        <xsd:element name="e1" type="xsd:string"/>
+                                </xsd:choice>
+                        </xsd:choice>
+                </xsd:sequence>
+        </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4997818.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4997818.java
new file mode 100644
index 00000000000..7330d49358b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4997818.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.StringReader;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSResourceResolver;
+
+/*
+ * @bug 4997818
+ * @summary Test SchemaFactory.newSchema(...) throws an exception, which is thrown from LSResourceResolver.
+ */
+
+public class Bug4997818 {
+
+    @Test
+    public void test1() throws Exception {
+        String xsd1 = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n" + "        xmlns:test='jaxp13_test1'\n"
+                + "        targetNamespace='jaxp13_test1'\n" + "        elementFormDefault='qualified'>\n" + "    <import namespace='jaxp13_test2'/>\n"
+                + "    <element name='test'/>\n" + "    <element name='child1'/>\n" + "</schema>\n";
+
+        final NullPointerException EUREKA = new NullPointerException("NewSchema015");
+
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+        StringReader reader = new StringReader(xsd1);
+        StreamSource source = new StreamSource(reader);
+        LSResourceResolver resolver = new LSResourceResolver() {
+            public LSInput resolveResource(String type, String namespaceURI, String publicId, String systemId, String baseURI) {
+                LSInput input;
+                if (namespaceURI != null && namespaceURI.endsWith("jaxp13_test2")) {
+                    throw EUREKA;
+                } else {
+                    input = null;
+                }
+
+                return input;
+            }
+        };
+        schemaFactory.setResourceResolver(resolver);
+
+        try {
+            schemaFactory.newSchema(new Source[] { source });
+            Assert.fail("NullPointerException was not thrown.");
+        } catch (RuntimeException e) {
+            if (e != EUREKA)
+                throw e;
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5011500.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5011500.java
new file mode 100644
index 00000000000..bc65b4de23b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5011500.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStreamReader;
+
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 5011500
+ * @summary Test ValidatorHanlder and Validator can work for the xml document.
+ */
+public class Bug5011500 {
+
+    public static final String XSD = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n" + "        xmlns:test='jaxp13_test'\n"
+            + "        targetNamespace='jaxp13_test'>\n" + "    <element name='test'>\n" + "        <complexType>\n" + "            <sequence>\n"
+            + "                <element name='child' type='string'/>\n" + "            </sequence>\n" + "            <attribute name='id' type='ID'/>\n"
+            + "        </complexType>\n" + "    </element>\n" + "</schema>\n";
+
+    public static final String XML = "<?xml version='1.0'?>\n" + "<?test v01?>\n" + "<ns:test xmlns:ns='jaxp13_test' id='i001'>\n"
+            + "  <child>123abc</child>\n" + "</ns:test>\n";
+
+    private ValidatorHandler validatorHandler;
+    private Validator validator;
+
+    private XMLReader createXMLReader() throws Exception {
+        SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+        parserFactory.setNamespaceAware(true);
+
+        return parserFactory.newSAXParser().getXMLReader();
+    }
+
+    private void parse(XMLReader xmlReader, String xml) throws Exception {
+        InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(xml.getBytes()));
+        InputSource inSource = new InputSource(reader);
+
+        xmlReader.parse(inSource);
+    }
+
+    @BeforeMethod
+    public void setUp() throws Exception {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+        InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(XSD.getBytes()));
+        StreamSource xsdSource = new StreamSource(reader);
+
+        Schema schema = schemaFactory.newSchema(xsdSource);
+
+        this.validatorHandler = schema.newValidatorHandler();
+        this.validator = schema.newValidator();
+    }
+
+    @Test
+    public void test1() throws Exception {
+        DefaultHandler contentHandler = new DefaultHandler();
+        validatorHandler.setContentHandler(contentHandler);
+        validatorHandler.setErrorHandler(contentHandler);
+
+        XMLReader xmlReader = createXMLReader();
+        xmlReader.setContentHandler(validatorHandler);
+        parse(xmlReader, XML);
+    }
+
+    @Test
+    public void test2() throws Exception {
+        InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(XML.getBytes()));
+        StreamSource xmlSource = new StreamSource(reader);
+
+        validator.validate(xmlSource);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.java
new file mode 100644
index 00000000000..327a387e51a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXTransformerFactory;
+import javax.xml.transform.sax.TransformerHandler;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/*
+ * @bug 5072946
+ * @summary Test Validator.validate(DOMSource,DOMResult) outputs to the result.
+ */
+public class Bug5072946 {
+
+    @Test
+    public void test1() throws Exception {
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder parser = dbf.newDocumentBuilder();
+        Document dom = parser.parse(Bug5072946.class.getResourceAsStream("Bug5072946.xml"));
+
+        SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Schema s = sf.newSchema(Bug5072946.class.getResource("Bug5072946.xsd"));
+        Validator v = s.newValidator();
+
+        DOMResult r = new DOMResult();
+        // r.setNode(dbf.newDocumentBuilder().newDocument());
+        v.validate(new DOMSource(dom), r);
+
+        Node node = r.getNode();
+        Assert.assertNotNull(node);
+        Node fc = node.getFirstChild();
+        Assert.assertTrue(fc instanceof Element);
+        Element e = (Element) fc;
+
+        Assert.assertEquals("value", e.getAttribute("foo"));
+    }
+
+    /**
+     * Tests if the identity transformer correctly sets the output node.
+     */
+    @Test
+    public void test2() throws Exception {
+        SAXTransformerFactory sf = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
+        TransformerHandler th = sf.newTransformerHandler();
+        DOMResult r = new DOMResult();
+        th.setResult(r);
+
+        XMLReader reader = XMLReaderFactory.createXMLReader();
+        reader.setContentHandler(th);
+        reader.parse(new InputSource(Bug5072946.class.getResourceAsStream("Bug5072946.xml")));
+
+        Assert.assertNotNull(r.getNode());
+    }
+
+    @Test
+    public void test3() throws Exception {
+        SAXTransformerFactory sf = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
+        Transformer t = sf.newTransformer();
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        DocumentBuilder parser = dbf.newDocumentBuilder();
+        Document dom = parser.parse(Bug5072946.class.getResourceAsStream("Bug5072946.xml"));
+
+        DOMResult r = new DOMResult();
+
+        t.transform(new DOMSource(dom), r);
+        Assert.assertNotNull(r.getNode());
+
+        Node n = r.getNode().getFirstChild();
+        r.setNode(n);
+        t.transform(new DOMSource(dom), r);
+        Assert.assertNotNull(r.getNode());
+        Assert.assertSame(r.getNode(), n);
+
+        r.setNextSibling(r.getNode().getFirstChild());
+        t.transform(new DOMSource(dom), r);
+        Assert.assertNotNull(r.getNode());
+        Assert.assertSame(r.getNode(), n);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.xml
new file mode 100644
index 00000000000..fe6ba3f75f9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<root />
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.xsd
new file mode 100644
index 00000000000..fa9638b380f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug5072946.xsd
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+     <xsd:element name="root">
+         <xsd:complexType>
+           <xsd:attribute name="foo" type="xsd:string" default="value"/>
+         </xsd:complexType>
+     </xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6378043.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6378043.java
new file mode 100644
index 00000000000..6078724f89c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6378043.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6378043
+ * @summary Test XPath expression "child::" can be parsed.
+ */
+public class Bug6378043 {
+
+    static String SCHEMA_LANG = "http://www.w3.org/2001/XMLSchema";
+
+    @Test
+    public void testSelectorXPath() {
+        try {
+            Schema schema = SchemaFactory.newInstance(SCHEMA_LANG).newSchema(this.getClass().getResource("idI009.xsd"));
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6449797.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6449797.java
new file mode 100644
index 00000000000..ca24b94281f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6449797.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package javax.xml.validation;
+
+import javax.xml.XMLConstants;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6449797
+ * @summary Test SchemaFactory can parse the specified attribute value with a specified namespace.
+ */
+public class Bug6449797 {
+
+    @Test
+    public void test() throws SAXException {
+        // this shouldn't fail
+        SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(getClass().getResource("Bug6449797.xsd"));
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6449797.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6449797.xsd
new file mode 100644
index 00000000000..73f653f9672
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6449797.xsd
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<xs:schema version="1.0" targetNamespace="http://ttri.ossj/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+  <xs:complexType name="troubleTicketValueImpl">
+    <xs:complexContent>
+      <xs:extension base="ns3:attributeAccessImpl" xmlns:ns3="http://ttri.ossj/">
+        <xs:sequence>
+          <xs:element name="accountOwner" type="ns3:personReachImpl" minOccurs="0"/>
+        </xs:sequence>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:complexType name="attributeAccessImpl" abstract="true"/>
+
+  <xs:complexType name="personReachImpl">
+    <xs:sequence>
+      <xs:element name="email" type="xs:string" minOccurs="0"/>
+    </xs:sequence>
+  </xs:complexType>
+
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6457662.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6457662.java
new file mode 100644
index 00000000000..84bfa2681f3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6457662.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.StringReader;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6457662
+ * @summary Test a Validator checks sequence maxOccurs correctly when it validates document repeatedly.
+ */
+public class Bug6457662 {
+
+    public static final String xml = "<ACL xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" + "<Tokens access=\"full\">" + "<Token>CheetahTech</Token>"
+            + "<Token>CheetahView</Token>" + "</Tokens>" + "</ACL>";
+    /** Schema */
+    public static final String schema = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+            + "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\" elementFormDefault=\"qualified\" attributeFormDefault=\"unqualified\">"
+            + "<xs:element name=\"ACL\">" + "<xs:complexType mixed=\"false\">" + "<xs:sequence><xs:element ref=\"Tokens\" maxOccurs=\"3\"/></xs:sequence>"
+            + "<xs:attribute name=\"ACL\" type=\"xs:string\" use=\"optional\"/>" + "</xs:complexType>" + "</xs:element><xs:element name=\"Tokens\">"
+            + "<xs:complexType mixed=\"false\">" + "<xs:sequence><xs:element ref=\"Token\" maxOccurs=\"unbounded\"/></xs:sequence>"
+            + "<xs:attribute name=\"access\" type=\"xs:string\" use=\"required\"/>" + "</xs:complexType></xs:element><xs:element name=\"Token\"/>"
+            + "</xs:schema>";
+    /** Schema factory */
+    private static final SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+    @Test
+    public void test() {
+        try {
+            final Schema sc = factory.newSchema(writeSchema());
+            final Validator validator = sc.newValidator();
+            validator.validate(new StreamSource(new StringReader(xml)));
+            validator.validate(new StreamSource(new StringReader(xml)));
+            validator.validate(new StreamSource(new StringReader(xml)));
+            validator.validate(new StreamSource(new StringReader(xml)));
+        } catch (Throwable ex) {
+            Assert.fail("Exception: " + ex.getMessage());
+        }
+    }
+
+    private File writeSchema() throws IOException {
+        final File rtn = File.createTempFile("scheam", "xsd");
+        final OutputStream out = new FileOutputStream(rtn);
+        final OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");
+        writer.write(schema);
+        writer.close();
+        out.close();
+        return rtn;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424.xml
new file mode 100644
index 00000000000..2d42d364da4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--A OnJava Journal Catalog-->
+
+<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  
+   xsi:noNamespaceSchemaLocation=
+ "file://./unit-test/javax/xml/validation/catalog.xsd" title="OnJava.com" publisher="O'Reilly">
+ <journal date="April 2004">
+   <article>
+    <title></title>
+    <author>Narayanan Jayaratchagan</author>
+   </article>
+ </journal>
+ <journal date="January 2004">
+   <article>
+    <title></title>
+    <author>Daniel Steinberg</author>
+   </article>
+ </journal>
+</catalog>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424.xsd
new file mode 100644
index 00000000000..194829f6d26
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424.xsd
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="catalog">
+   <xs:complexType>
+    <xs:sequence>
+     <xs:element ref="journal" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attribute name="title" type="xs:string"/>
+    <xs:attribute name="publisher"  type="xs:string"/>
+   </xs:complexType>
+  </xs:element>
+  <xs:element name="journal">
+   <xs:complexType>
+    <xs:sequence>
+     <xs:element ref="article" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+    <xs:attribute name="date" type="xs:string"/>
+   </xs:complexType>
+  </xs:element>
+  <xs:element name="article">
+   <xs:complexType>
+    <xs:sequence>
+     <xs:element name="title" type="xs:string" minOccurs="1" default="Schema Validation"/>
+     <xs:element ref="author" minOccurs="0" maxOccurs="unbounded"/>
+    </xs:sequence>
+   </xs:complexType>
+  </xs:element>
+  <xs:element name="author" type="xs:string"/>
+</xs:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424Test.java
new file mode 100644
index 00000000000..76cf2a30699
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6467424Test.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.StringWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6467424
+ * @summary Test Validator augments the default delement value if feature element-default is on.
+ */
+public class Bug6467424Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test() {
+        // System.setSecurityManager(new SecurityManager());
+        try {
+            SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+            File schemaLocation = new File(getClass().getResource("Bug6467424.xsd").getFile());
+            Schema schema = factory.newSchema(schemaLocation);
+            Validator validator = schema.newValidator();
+
+            DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+            domFactory.setNamespaceAware(true); // never forget this
+            DocumentBuilder builder = domFactory.newDocumentBuilder();
+            Document doc = builder.parse(new File(getClass().getResource("Bug6467424.xml").getFile()));
+
+            DOMSource source = new DOMSource(doc);
+            DOMResult result = new DOMResult();
+
+            validator.validate(source, result);
+            Document augmented = (Document) result.getNode();
+
+            TransformerFactory tFactory = TransformerFactory.newInstance();
+
+            Transformer transformer = tFactory.newTransformer();
+
+            DOMSource domSource = new DOMSource(augmented);
+            StringWriter sw = new StringWriter();
+            // StreamResult streamResult = new StreamResult(System.out);
+            StreamResult streamResult = new StreamResult(sw);
+            transformer.transform(domSource, streamResult);
+            String s = sw.toString();
+            if (s.indexOf("Schema Validation") == -1) {
+                Assert.fail("Failed: result is expected to be augmented");
+            }
+        }
+
+        catch (TransformerConfigurationException e) {
+            // e.printStackTrace();
+            System.out.println(e.getMessage());
+        } catch (TransformerException e) {
+            System.out.println(e.getMessage());
+        } catch (SAXException e) {
+            System.out.println(e.getMessage());
+        } catch (ParserConfigurationException e) {
+            System.out.println(e.getMessage());
+        } catch (IOException e) {
+            System.out.println(e.getMessage());
+        }
+    }
+
+    /**
+     * this test is to make sure the element-default feature works for
+     * validation using DOM parser reference: parser feature:
+     * http://xerces.apache.org/xerces2-j/feature.html#validation
+     */
+    @Test
+    public void testDOMValidation() throws Exception {
+        try {
+            DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+            // domFactory.setFeature("http://xml.org/sax/features/validation",
+            // true);
+            domFactory.setNamespaceAware(true); // never forget this
+            domFactory.setValidating(true);
+
+            domFactory.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            domFactory.setAttribute(SCHEMA_SOURCE, Bug6467424Test.class.getResource("Bug6467424.xsd").toExternalForm());
+
+            domFactory.setFeature("http://apache.org/xml/features/validation/schema", true);
+            domFactory.setFeature("http://apache.org/xml/features/validation/schema/element-default", true);
+            DocumentBuilder builder = domFactory.newDocumentBuilder();
+            Document doc = builder.parse(new File(getClass().getResource("Bug6467424.xml").getFile()));
+
+            TransformerFactory tFactory = TransformerFactory.newInstance();
+
+            Transformer transformer = tFactory.newTransformer();
+            DOMSource domSource = new DOMSource(doc);
+            StringWriter sw = new StringWriter();
+            // StreamResult streamResult = new StreamResult(System.out);
+            StreamResult streamResult = new StreamResult(sw);
+            transformer.transform(domSource, streamResult);
+            String s = sw.toString();
+            if (s.indexOf("Schema Validation") == -1) {
+                Assert.fail("Failed: result is expected to be augmented");
+            }
+
+        }
+
+        catch (TransformerConfigurationException e) {
+            System.out.println(e.getMessage());
+        } catch (TransformerException e) {
+            System.out.println(e.getMessage());
+        } catch (SAXException e) {
+            System.out.println(e.getMessage());
+        } catch (ParserConfigurationException e) {
+            System.out.println(e.getMessage());
+        } catch (IOException e) {
+            System.out.println(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testDOMValidation1() throws Exception {
+        try {
+            DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance();
+            // domFactory.setFeature("http://xml.org/sax/features/validation",
+            // true);
+            domFactory.setNamespaceAware(true); // never forget this
+            domFactory.setValidating(true);
+
+            domFactory.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            domFactory.setAttribute(SCHEMA_SOURCE, Bug6467424Test.class.getResource("Bug6467424.xsd").toExternalForm());
+
+            domFactory.setFeature("http://apache.org/xml/features/validation/schema", true);
+            domFactory.setFeature("http://apache.org/xml/features/validation/schema/element-default", false);
+            DocumentBuilder builder = domFactory.newDocumentBuilder();
+            Document doc = builder.parse(new File(getClass().getResource("Bug6467424.xml").getFile()));
+
+            TransformerFactory tFactory = TransformerFactory.newInstance();
+
+            Transformer transformer = tFactory.newTransformer();
+            DOMSource domSource = new DOMSource(doc);
+            StringWriter sw = new StringWriter();
+            // StreamResult streamResult = new StreamResult(System.out);
+            StreamResult streamResult = new StreamResult(sw);
+            transformer.transform(domSource, streamResult);
+            String s = sw.toString();
+            if (s.indexOf("Schema Validation") > 0) {
+                Assert.fail("Failed: result is not expected to be augmented");
+            }
+
+        }
+
+        catch (TransformerConfigurationException e) {
+            System.out.println(e.getMessage());
+        } catch (TransformerException e) {
+            System.out.println(e.getMessage());
+        } catch (SAXException e) {
+            System.out.println(e.getMessage());
+        } catch (ParserConfigurationException e) {
+            System.out.println(e.getMessage());
+        } catch (IOException e) {
+            System.out.println(e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6483188.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6483188.java
new file mode 100644
index 00000000000..848a545bec8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6483188.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.net.URL;
+
+import javax.xml.XMLConstants;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6483188
+ * @summary Test Schema Validator can handle element with having large maxOccurs, but doesn't accept sequence with having large maxOccurs in FEATURE_SECURE_PROCESSING mode.
+ */
+public class Bug6483188 {
+    static boolean _isSecureMode = false;
+    static {
+        if (System.getSecurityManager() != null) {
+            _isSecureMode = true;
+            System.out.println("Security Manager is present");
+        } else {
+            System.out.println("Security Manager is NOT present");
+        }
+    }
+
+    SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+    @Test
+    public void testLargeElementNoSecurity() {
+        if (_isSecureMode)
+            return; // jaxp secure feature can not be turned off when security
+                    // manager is present
+        try {
+            sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.FALSE);
+            URL url = getClass().getResource("test-element.xsd");
+            Schema s = sf.newSchema(url);
+            Validator v = s.newValidator();
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testLargeElementWithSecurity() {
+        try {
+            sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+            URL url = getClass().getResource("test-element.xsd");
+            Schema s = sf.newSchema(url);
+            Validator v = s.newValidator();
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testLargeSequenceWithSecurity() {
+        try {
+            sf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, Boolean.TRUE);
+            URL url = getClass().getResource("test-sequence.xsd");
+            Schema s = sf.newSchema(url);
+            Validator v = s.newValidator();
+            Assert.fail("Schema was accepted even with secure processing enabled.");
+        } catch (SAXParseException e) {
+            // falls through - exception expected
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.java
new file mode 100644
index 00000000000..5034d3d29f6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+
+/*
+ * @bug 6493687
+ * @summary Test validator.validate(new DOMSource(node)) without any exception.
+ */
+public class Bug6493687 {
+
+    @Test
+    public void test() throws Exception {
+        System.out.println("Got here");
+        Document doc = new XMLDocBuilder("Bug6493687.xml", "UTF-8", "Bug6493687.xsd").getDocument();
+        System.out.println("Got here2");
+        System.out.println(doc);
+        System.out.println(doc.getDocumentElement().getNodeName());
+        System.out.println("Got here3");
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.xml
new file mode 100644
index 00000000000..2b5d6e07758
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ROOT Typ="Contents" Version="1.0">
+	<LINKS>
+		<LINK>
+			<TARGET template="a.xml" Version="1">
+				<INFO Description="test1" Theme="b"/>
+			</TARGET>
+		</LINK>
+		<LINK>
+			<TARGET template="b.xml" Version="2">
+				<INFO Description="test2" Theme="b"/>
+			</TARGET>
+		</LINK>
+	</LINKS>
+</ROOT>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.xsd
new file mode 100644
index 00000000000..1907e8a8648
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6493687.xsd
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+	<xs:element name="INFO">
+		<xs:complexType>
+			<xs:attribute name="Description" type="xs:NMTOKEN" use="required"/>
+			<xs:attribute name="Theme" type="xs:NMTOKEN" use="required"/>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="LINK">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element ref="TARGET"/>
+			</xs:sequence>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="LINKS">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element ref="LINK" maxOccurs="unbounded"/>
+			</xs:sequence>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="ROOT">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element ref="LINKS"/>
+			</xs:sequence>
+			<xs:attribute name="Typ" type="xs:NMTOKEN" use="required"/>
+			<xs:attribute name="Version" type="xs:decimal" use="required"/>
+		</xs:complexType>
+	</xs:element>
+	<xs:element name="TARGET">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element ref="INFO"/>
+			</xs:sequence>
+			<xs:attribute name="Version" type="xs:integer" use="required"/>
+			<xs:attribute name="template" type="xs:NMTOKEN" use="required"/>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6509668.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6509668.java
new file mode 100644
index 00000000000..094c8a6eac9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6509668.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.TypeInfoProvider;
+import javax.xml.validation.ValidatorHandler;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.TypeInfo;
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6509668
+ * @summary Test TypeInfoProvider.getElementTypeInfo() for union type when startElement and endElement.
+ */
+public class Bug6509668 {
+
+    public static final String XSD = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n"
+            + "  xmlns:ns='http://example.org/jaxp13_test'\n" + "    targetNamespace='http://example.org/jaxp13_test'\n" + "    elementFormDefault='qualified'>\n"
+            + "  <simpleType name='intOrString'>\n" + "    <union memberTypes='int string'/>\n" + "  </simpleType>\n"
+            + "  <element name='test' type='ns:intOrString'/>\n" + "</schema>\n";
+
+    public static final String XML = "<?xml version='1.0'?>\n" + "<ns:test xmlns:ns='http://example.org/jaxp13_test'>abc</ns:test>\n";
+
+    private ValidatorHandler createValidatorHandler(String xsd) throws SAXException {
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+        InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(xsd.getBytes()));
+        StreamSource xsdSource = new StreamSource(reader);
+
+        Schema schema = schemaFactory.newSchema(xsdSource);
+        return schema.newValidatorHandler();
+    }
+
+    private XMLReader createXMLReader() throws ParserConfigurationException, SAXException {
+        SAXParserFactory parserFactory = SAXParserFactory.newInstance();
+        if (!parserFactory.isNamespaceAware()) {
+            parserFactory.setNamespaceAware(true);
+        }
+
+        return parserFactory.newSAXParser().getXMLReader();
+    }
+
+    private void parse(XMLReader xmlReader, String xml) throws SAXException, IOException {
+        InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(xml.getBytes()));
+        InputSource inSource = new InputSource(reader);
+
+        xmlReader.parse(inSource);
+    }
+
+    @Test
+    public void testGetElementTypeInfo() throws ParserConfigurationException, SAXException, IOException {
+        XMLReader xmlReader;
+        xmlReader = createXMLReader();
+
+        final ValidatorHandler validatorHandler;
+        validatorHandler = createValidatorHandler(XSD);
+
+        xmlReader.setContentHandler(validatorHandler);
+
+        DefaultHandler handler = new DefaultHandler() {
+            public void startElement(String uri, String localName, String qName, Attributes attr) throws SAXException {
+                TypeInfoProvider infoProvider = null;
+                synchronized (validatorHandler) {
+                    infoProvider = validatorHandler.getTypeInfoProvider();
+                }
+                if (infoProvider == null) {
+                    throw new SAXException("Can't obtain TypeInfoProvider object.");
+                }
+
+                try {
+                    TypeInfo typeInfo = infoProvider.getElementTypeInfo();
+                    Assert.assertEquals(typeInfo.getTypeName(), "intOrString");
+                } catch (IllegalStateException e) {
+                    System.out.println(e);
+                    throw new SAXException("Unexpected IllegalStateException was thrown.");
+                }
+            }
+
+            public void endElement(String uri, String localName, String qName) throws SAXException {
+                TypeInfoProvider infoProvider = null;
+                synchronized (validatorHandler) {
+                    infoProvider = validatorHandler.getTypeInfoProvider();
+                }
+                if (infoProvider == null) {
+                    throw new SAXException("Can't obtain TypeInfoProvider object.");
+                }
+
+                try {
+                    TypeInfo typeInfo = infoProvider.getElementTypeInfo();
+                    Assert.assertEquals(typeInfo.getTypeName(), "string");
+                } catch (IllegalStateException e) {
+                    System.out.println(e);
+                    throw new SAXException("Unexpected IllegalStateException was thrown.");
+                }
+            }
+        };
+        validatorHandler.setContentHandler(handler);
+
+        parse(xmlReader, XML);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.java
new file mode 100644
index 00000000000..dfbf550e560
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6526547
+ * @summary Test document parsed without setting NamespaceAware can be validated with a Schema.
+ */
+public class Bug6526547 {
+
+    @Test
+    public void test() {
+        try {
+            // parse an XML document into a DOM tree
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder parser = dbf.newDocumentBuilder();
+            Assert.assertFalse(parser.isNamespaceAware());
+            Document document = parser.parse(getClass().getResourceAsStream("Bug6526547.xml"));
+
+            // create a SchemaFactory capable of understanding WXS schemas
+            SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+            // load a WXS schema, represented by a Schema instance
+            Source schemaFile = new StreamSource(getClass().getResourceAsStream("Bug6526547.xsd"));
+            Schema schema = factory.newSchema(schemaFile);
+
+            // create a Validator instance, which can be used to validate an
+            // instance document
+            Validator validator = schema.newValidator();
+
+            // validate the DOM tree
+            try {
+                validator.validate(new DOMSource(document));
+            } catch (SAXException e) {
+                e.printStackTrace();
+                Assert.fail("Document is reported as invalid but it is not!");
+            }
+        } catch (Exception e) {
+            Assert.fail("Unable to configure validator");
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.xml
new file mode 100644
index 00000000000..fe6ba3f75f9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<root />
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.xsd
new file mode 100644
index 00000000000..fa9638b380f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6526547.xsd
@@ -0,0 +1,8 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+     <xsd:element name="root">
+         <xsd:complexType>
+           <xsd:attribute name="foo" type="xsd:string" default="value"/>
+         </xsd:complexType>
+     </xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6531160.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6531160.java
new file mode 100644
index 00000000000..7c682dbd4fb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6531160.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.StringReader;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6531160
+ * @summary Test document generated by newDocument() can be validated with a Schema.
+ */
+public class Bug6531160 {
+
+    private static final String XSD = "<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'>\n" + "  <xs:element name='root' type='xs:string'/>\n"
+            + "</xs:schema>";
+
+    @Test
+    public void testDOMLevel1Validation() throws Exception {
+        SchemaFactory fact = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Schema schema = fact.newSchema(new StreamSource(new StringReader(XSD)));
+        DocumentBuilderFactory docfact = DocumentBuilderFactory.newInstance();
+        docfact.setNamespaceAware(true);
+
+        Document doc = docfact.newDocumentBuilder().newDocument();
+        doc.appendChild(doc.createElement("root"));
+
+        try {
+            schema.newValidator().validate(new DOMSource(doc));
+        } catch (SAXParseException e) {
+            Assert.fail("Validation failed: " + e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843.xml
new file mode 100644
index 00000000000..2bb4ff1e66b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843.xml
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="ASCII"?>
+<root>
+    <comment language="English">
+        commentZZZZZZZZZZZZZZZZZZ
+    </comment>
+</root>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843.xsd
new file mode 100644
index 00000000000..b8e96c44372
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843.xsd
@@ -0,0 +1,44 @@
+<xsd:schema
+    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+    elementFormDefault="qualified">
+  <xsd:element name="root">
+   <xsd:complexType>
+    <xsd:sequence>
+     <xsd:element name="comment" type="Comment2Type" />
+    </xsd:sequence>
+   </xsd:complexType>
+  </xsd:element>
+    
+    <xsd:simpleType name="AsciiStringType">
+        <xsd:restriction base="xsd:string">
+            <xsd:pattern value="\p{IsBasicLatin}*" />
+        </xsd:restriction>
+    </xsd:simpleType>
+
+    <xsd:complexType name="CommentType">
+        <xsd:simpleContent>
+            <xsd:extension base="AsciiStringType">
+                <xsd:attribute name="language" use="optional">
+                    <xsd:simpleType>
+                        <xsd:restriction base="xsd:string">
+                            <xsd:enumeration value="English" />
+                            <xsd:enumeration value="French" />
+                            <xsd:enumeration value="Spanish" />
+                        </xsd:restriction>
+                    </xsd:simpleType>
+                </xsd:attribute>
+            </xsd:extension>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+
+    <xsd:complexType name="Comment2Type">
+        <xsd:simpleContent>
+            <xsd:restriction base="CommentType">
+                <xsd:minLength value="0" />
+                <xsd:maxLength value="20" />
+            </xsd:restriction>
+        </xsd:simpleContent>
+    </xsd:complexType>
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843Test.java
new file mode 100644
index 00000000000..fde9fb2e420
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6695843Test.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.dom.DOMSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6695843
+ * @summary Test Validator should report accurate element type if there is a violation on a complexType with simpleContent that extends a base complexType.
+ */
+public class Bug6695843Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void testValidateComplexTypeWithSimpleContent() throws IOException, ParserConfigurationException, SAXException {
+        try {
+            DocumentBuilderFactory dFactory = DocumentBuilderFactory.newInstance();
+            dFactory.setNamespaceAware(true);
+
+            DocumentBuilder dBuilder = dFactory.newDocumentBuilder();
+            Document document = dBuilder.parse(getClass().getResourceAsStream("Bug6695843.xsd"));
+            DOMSource domSource = new DOMSource(document);
+
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            Schema schema = schemaFactory.newSchema(domSource);
+
+            String xmlFileName = "Bug6695843.xml";
+            Document document1 = dBuilder.parse(getClass().getResourceAsStream(xmlFileName));
+            DOMSource domSource1 = new DOMSource(document1);
+
+            Validator validator = schema.newValidator();
+            validator.validate(domSource1);
+        } catch (Exception e) {
+            String msg = e.getMessage();
+            System.out.println(e.getMessage());
+            if (msg.indexOf("maxLength '20' for type 'null'") > 0) {
+                Assert.fail("vague error message");
+            }
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084.xsd
new file mode 100644
index 00000000000..1fbb8726d6b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084.xsd
@@ -0,0 +1,178 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
+    <xs:element name="eOtherPayment">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="OtherPaymentSerialID"/>
+                <xs:element ref="CustomsCode"/>
+                <xs:element ref="DeclarantCode"/>
+                <xs:element ref="CompanyCode"/>
+                <xs:element ref="BankCode"/>
+                <xs:element ref="Transactions"/>
+                <xs:element ref="Payments"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="OtherPaymentSerialID">
+        <xs:simpleType>
+            <xs:restriction base="xs:string">
+                <xs:maxLength value="50"/>
+            </xs:restriction>
+        </xs:simpleType>
+    </xs:element>
+
+    <xs:element name="CustomsCode">
+        <xs:simpleType>
+            <xs:restriction base="xs:string">
+                <xs:pattern value="[A-Z0-9]{4}"/>
+            </xs:restriction>
+        </xs:simpleType>
+    </xs:element>
+
+    <xs:element name="DeclarantCode">
+        <xs:simpleType>
+            <xs:restriction base="U">
+                <xs:minLength value="0"/>
+                <xs:maxLength value="17"/>
+            </xs:restriction>
+        </xs:simpleType>
+    </xs:element>
+
+    <xs:element name="CompanyCode">
+        <xs:simpleType>
+            <xs:restriction base="U">
+                <xs:minLength value="0"/>
+                <xs:maxLength value="17"/>
+            </xs:restriction>
+        </xs:simpleType>
+    </xs:element>
+
+    <xs:element name="BankCode">
+        <xs:simpleType>
+            <xs:restriction base="U">
+                <xs:minLength value="1"/>
+                <xs:maxLength value="17"/>
+            </xs:restriction>
+        </xs:simpleType>
+    </xs:element>
+
+    <xs:element name="Transactions">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element maxOccurs="10" ref="TransactionRecord"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="TransactionRecord">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="Code">
+                    <xs:simpleType>
+                        <xs:restriction base="xs:string">
+                            <xs:pattern value="[A-Z0-9]{1,3}"/>
+                        </xs:restriction>
+                    </xs:simpleType>
+                </xs:element>
+                <xs:element ref="RefOffice"/>
+                <xs:element ref="RefYear"/>
+                <xs:element ref="RefSerial"/>
+                <xs:element ref="RefNumber"/>
+                <xs:element ref="TransactionReference"/>
+                <xs:element name="Amount" type="NMU"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="RefOffice">
+        <xs:simpleType>
+            <xs:restriction base="xs:string">
+                <xs:pattern value="[A-Z0-9]{0,4}"/>
+            </xs:restriction>
+        </xs:simpleType>
+    </xs:element>
+
+    <xs:element name="RefYear">
+        <xs:simpleType>
+            <xs:restriction base="xs:string">
+                <xs:pattern value="([0-9]){0}|([0-9]){4}"/>
+            </xs:restriction>
+        </xs:simpleType>
+    </xs:element>
+
+    <xs:element name="RefSerial">
+        <xs:simpleType>
+            <xs:restriction base="xs:string">
+                <xs:pattern value="[A-Z]{0,1}"/>
+            </xs:restriction>
+        </xs:simpleType>
+    </xs:element>
+
+    <xs:element name="RefNumber">
+        <xs:simpleType>
+            <xs:restriction base="xs:string">
+                <xs:pattern value="([0-9])*"/>
+            </xs:restriction>
+        </xs:simpleType>
+    </xs:element>
+
+    <xs:element name="TransactionReference">
+        <xs:simpleType>
+            <xs:restriction base="xs:string">
+                <xs:minLength value="1"/>
+                <xs:maxLength value="35"/>
+            </xs:restriction>
+        </xs:simpleType>
+    </xs:element>
+
+    <xs:element name="Payments">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element maxOccurs="10" ref="MeansOfPayment"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="MeansOfPayment">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element ref="Code"/>
+                <xs:element ref="Reference"/>
+                <xs:element name="Amount" type="NMU"/>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="Code">
+        <xs:simpleType>
+            <xs:restriction base="xs:string">
+                <xs:pattern value="[A-Z0-9]{2}"/>
+            </xs:restriction>
+        </xs:simpleType>
+    </xs:element>
+
+    <xs:element name="Reference">
+        <xs:simpleType>
+            <xs:restriction base="U">
+                <xs:minLength value="1"/>
+                <xs:maxLength value="17"/>
+            </xs:restriction>
+        </xs:simpleType>
+    </xs:element>
+
+    <xs:simpleType name="NMU">
+        <xs:restriction base="xs:decimal">
+            <xs:minInclusive value="0"/>
+            <xs:fractionDigits value="2"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+    <xs:simpleType name="U">
+        <xs:restriction base="xs:string">
+            <xs:pattern value="([!-`]|[{-~])*"/>
+        </xs:restriction>
+    </xs:simpleType>
+
+</xs:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_1.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_1.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_1.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_10.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_10.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_10.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_11.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_11.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_11.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_12.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_12.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_12.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_13.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_13.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_13.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_14.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_14.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_14.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_15.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_15.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_15.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_16.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_16.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_16.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_17.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_17.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_17.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_18.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_18.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_18.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_19.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_19.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_19.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_2.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_2.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_2.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_20.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_20.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_20.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_21.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_21.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_21.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_22.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_22.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_22.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_23.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_23.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_23.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_24.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_24.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_24.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_25.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_25.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_25.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_3.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_3.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_3.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_4.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_4.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_4.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_5.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_5.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_5.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_6.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_6.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_6.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_7.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_7.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_7.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_8.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_8.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_8.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_9.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_9.xml
new file mode 100644
index 00000000000..aaef453696f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084In/Bug6773084_9.xml
@@ -0,0 +1,78 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<eOtherPayment>
+  <OtherPaymentSerialID>b972115d-829e-43ff-aebb-c7157ef25c71</OtherPaymentSerialID>
+  <CustomsCode>01AP</CustomsCode>
+  <DeclarantCode>A9901017</DeclarantCode>
+  <CompanyCode>A0500823</CompanyCode>
+  <BankCode>221</BankCode>
+  <Transactions>
+    <TransactionRecord>
+      <Code>89</Code>
+      <RefOffice>01AP</RefOffice>
+      <RefYear>2008</RefYear>
+      <RefSerial>A</RefSerial>
+      <RefNumber>68</RefNumber>
+      <TransactionReference>KJ091</TransactionReference>
+      <Amount>5000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>97</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>LL091</TransactionReference>
+      <Amount>68700</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>98</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>HH098</TransactionReference>
+      <Amount>8000</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>96</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>PO091</TransactionReference>
+      <Amount>7500</Amount>
+    </TransactionRecord>
+    <TransactionRecord>
+      <Code>92</Code>
+      <RefOffice/>
+      <RefYear/>
+      <RefSerial/>
+      <RefNumber/>
+      <TransactionReference>098</TransactionReference>
+      <Amount>14000</Amount>
+    </TransactionRecord>
+  </Transactions>
+  <Payments>
+    <MeansOfPayment>
+      <Code>21</Code>
+      <Reference>EF01</Reference>
+      <Amount>26800</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>22</Code>
+      <Reference>G</Reference>
+      <Amount>15000</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>HH</Reference>
+      <Amount>9810</Amount>
+    </MeansOfPayment>
+    <MeansOfPayment>
+      <Code>20</Code>
+      <Reference>DEE</Reference>
+      <Amount>51590</Amount>
+    </MeansOfPayment>
+  </Payments>
+</eOtherPayment>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084Test.java
new file mode 100644
index 00000000000..41103d20b13
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6773084Test.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.IOException;
+import java.util.concurrent.BrokenBarrierException;
+import java.util.concurrent.CyclicBarrier;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6773084
+ * @summary Test Schema object is thread safe.
+ */
+public class Bug6773084Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    private static final int NTHREADS = 25;
+    private static final ExecutorService EXEC = Executors.newCachedThreadPool();
+
+    private static final CyclicBarrier BARRIER = new CyclicBarrier(NTHREADS);
+
+    public static final String IN_FOLDER = Bug6773084Test.class.getResource("Bug6773084In").getPath();
+    public static final String XSD_PATH = Bug6773084Test.class.getResource("Bug6773084.xsd").getPath();
+
+    private static Schema schema;
+
+    @BeforeClass
+    public void setup(){
+        policy.PolicyUtil.changePolicy(getClass().getResource("6773084.policy").getFile());
+    }
+
+    @Test
+    public void test() throws Exception {
+        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Source schemaFile = new StreamSource(XSD_PATH);
+        try {
+            schema = factory.newSchema(schemaFile);
+        } catch (SAXException e) {
+            e.printStackTrace();
+            System.exit(-1);
+        }
+
+        File incoming = new File(IN_FOLDER);
+        File[] files = incoming.listFiles(new FileFilter() {
+            public boolean accept(File file) {
+                return file.isFile() && file.getName().endsWith(".xml");
+            }
+        });
+
+        for (int i = 0; i < files.length; i++) {
+            EXEC.execute(new XMLValiddator(files[i], i));
+        }
+        EXEC.shutdown();
+
+    }
+
+    private static class XMLValiddator implements Runnable {
+
+        private File file;
+        private int index;
+
+        public XMLValiddator(File file, int index) {
+            this.file = file;
+            this.index = index;
+        }
+
+        public void run() {
+
+            try {
+                System.out.printf("Waiting for barrier: %s%n", index);
+                BARRIER.await();
+                System.out.println("Validating....");
+
+                DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+                factory.setNamespaceAware(true);
+
+                DocumentBuilder builder = factory.newDocumentBuilder();
+                Document document = builder.parse(file);
+
+                Validator validator = schema.newValidator();
+                validator.setErrorHandler(new ErrorHandlerImpl());
+                validator.validate(new DOMSource(document));
+
+            } catch (IOException e) {
+                e.printStackTrace();
+            } catch (SAXException e) {
+                e.printStackTrace();
+                Assert.fail("Test failed.");
+            } catch (ParserConfigurationException e) {
+                e.printStackTrace();
+            } catch (BrokenBarrierException e) {
+                e.printStackTrace();
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+
+        }
+    }
+
+    private static class ErrorHandlerImpl implements ErrorHandler {
+
+        public void warning(SAXParseException exception) throws SAXException {
+            System.out
+                    .printf("**Parsing Warning. Line: %s  URI: %s  Message: %s%n", exception.getLineNumber(), exception.getSystemId(), exception.getMessage());
+        }
+
+        public void error(SAXParseException exception) throws SAXException {
+            String msg = String.format("**Parsing Error. Line: %s  URI: %s  Message: %s%n", exception.getLineNumber(), exception.getSystemId(),
+                    exception.getMessage());
+            System.out.println(msg);
+            throw new SAXException(msg);
+        }
+
+        public void fatalError(SAXParseException exception) throws SAXException {
+            String msg = String.format("**Parsing Fatal Error. Line: %s  URI: %s  Message: %s%n", exception.getLineNumber(), exception.getSystemId(),
+                    exception.getMessage());
+            System.out.println(msg);
+            throw new SAXException(msg);
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6859210.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6859210.java
new file mode 100644
index 00000000000..322a7dc4fa2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6859210.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6859210
+ * @summary Test Schema Validator can parse xml when maxOccurs is large.
+ */
+public class Bug6859210 {
+
+    boolean errorFound;
+
+    DocumentBuilder documentBuilder;
+
+    private void printMethodName() {
+        StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+        System.out.println(stack[2].getMethodName());
+    }
+
+    public Bug6859210() throws Exception {
+        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Schema schema = factory.newSchema(new File(getClass().getResource("CREMAS01.xsd").getFile()));
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setSchema(schema);
+
+        documentBuilder = dbf.newDocumentBuilder();
+        documentBuilder.setErrorHandler(new ErrorHandler() {
+            public void error(SAXParseException e) throws SAXException {
+                System.out.println("Error: " + e.getMessage());
+                errorFound = true;
+            }
+
+            public void fatalError(SAXParseException e) throws SAXException {
+                System.out.println("Fatal error: " + e.getMessage());
+            }
+
+            public void warning(SAXParseException e) throws SAXException {
+                System.out.println("Warning: " + e.getMessage());
+            }
+        });
+    }
+
+    @Test
+    public void testGeneratedSample() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("CREMAS01.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (errorFound) {
+            Assert.fail("Unexpected validation error reported");
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6925531Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6925531Test.java
new file mode 100644
index 00000000000..03b2efd3a53
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6925531Test.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.security.AccessController;
+import java.security.AllPermission;
+import java.security.Permission;
+import java.security.Permissions;
+import java.security.PrivilegedAction;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.sax.SAXSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+
+/*
+ * @bug 6925531
+ * @summary Test Validator can validate SAXSource when SecurityManager is set or FEATURE_SECURE_PROCESSING is on.
+ */
+public class Bug6925531Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+    String xsd = "<?xml version='1.0'?>\n" + "<schema xmlns='http://www.w3.org/2001/XMLSchema'\n" + "        xmlns:test='jaxp13_test'\n"
+            + "        targetNamespace='jaxp13_test'\n" + "        elementFormDefault='qualified'>\n" + "    <element name='test' type='string'/>\n"
+            + "</schema>\n";
+
+    String xml = "<?xml version='1.0'?>\n" + "<ns:test xmlns:ns='jaxp13_test'>\n" + "    abc\n" + "</ns:test>\n";
+
+    StreamSource xsdSource;
+    SAXSource xmlSource;
+
+    public void init() {
+        InputStreamReader reader = new InputStreamReader(new ByteArrayInputStream(xsd.getBytes()));
+        xsdSource = new StreamSource(reader);
+        reader = new InputStreamReader(new ByteArrayInputStream(xml.getBytes()));
+        InputSource inSource = new InputSource(reader);
+        xmlSource = new SAXSource(inSource);
+    }
+
+    /**
+     * when security manager is present, secure feature is on automatically
+     */
+    @Test
+    public void test_SM() {
+        init();
+        Permissions granted = new java.security.Permissions();
+        granted.add(new AllPermission());
+
+        System.setSecurityManager(new MySM(granted));
+
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+        Schema schema = null;
+        try {
+            schema = schemaFactory.newSchema(xsdSource);
+        } catch (SAXException e) {
+            Assert.fail(e.toString());
+        }
+
+        Validator validator = schema.newValidator();
+
+        try {
+            validator.validate(xmlSource, null);
+        } catch (SAXException e) {
+            Assert.fail(e.toString());
+        } catch (IOException e) {
+            Assert.fail(e.toString());
+        } finally {
+            System.setSecurityManager(null);
+        }
+
+        System.out.println("OK");
+    }
+
+    /**
+     * set secure feature on SchemaFactory
+     */
+    @Test
+    public void test_SF() {
+        init();
+        AccessController.doPrivileged(new PrivilegedAction() {
+            public Object run() {
+                System.setSecurityManager(null);
+                return null; // nothing to return
+            }
+        });
+
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+        try {
+            schemaFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+        } catch (SAXNotRecognizedException ex) {
+            System.out.println(ex.getMessage());
+        } catch (SAXNotSupportedException ex) {
+            System.out.println(ex.getMessage());
+        }
+
+        Schema schema = null;
+        try {
+            schema = schemaFactory.newSchema(xsdSource);
+        } catch (SAXException e) {
+            Assert.fail(e.toString());
+        }
+
+        Validator validator = schema.newValidator();
+
+        try {
+            validator.validate(xmlSource, null);
+        } catch (SAXException e) {
+            Assert.fail(e.toString());
+        } catch (IOException e) {
+            Assert.fail(e.toString());
+        }
+        System.out.println("OK");
+    }
+
+    /**
+     * set secure feature on the Validator
+     */
+    @Test
+    public void test_Val() {
+        init();
+        System.setSecurityManager(null);
+        SchemaFactory schemaFactory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+
+        Schema schema = null;
+        try {
+            schema = schemaFactory.newSchema(xsdSource);
+        } catch (SAXException e) {
+            Assert.fail(e.toString());
+        }
+
+        Validator validator = schema.newValidator();
+        try {
+            validator.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+        } catch (SAXNotRecognizedException ex) {
+            System.out.println(ex.getMessage());
+        } catch (SAXNotSupportedException ex) {
+            System.out.println(ex.getMessage());
+        }
+
+        try {
+            validator.validate(xmlSource, null);
+        } catch (SAXException e) {
+            Assert.fail(e.toString());
+        } catch (IOException e) {
+            Assert.fail(e.toString());
+        }
+        System.out.println("OK");
+    }
+
+    class MySM extends SecurityManager {
+        Permissions granted;
+
+        public MySM(Permissions perms) {
+            granted = perms;
+        }
+
+        /**
+         * The central point in checking permissions. Overridden from
+         * java.lang.SecurityManager
+         *
+         * @param perm The permission requested.
+         */
+        @Override
+        public void checkPermission(Permission perm) {
+            if (granted.implies(perm)) {
+                return;
+            }
+            super.checkPermission(perm);
+        }
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6946312.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6946312.xml
new file mode 100644
index 00000000000..ffe59835074
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6946312.xml
@@ -0,0 +1,4 @@
+<root>
+<foo>text<bar/></foo>
+</root>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6946312Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6946312Test.java
new file mode 100644
index 00000000000..b93c1ac8f62
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6946312Test.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.StringReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.Attributes;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+
+/*
+ * @bug 6946312
+ * @summary Test XML parser shall callback to ContentHandler when receiving characters data.
+ */
+public class Bug6946312Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+    String xmlSchema = "<xs:schema xmlns:xs=\"http://www.w3.org/2001/XMLSchema\">\n" + "<xs:element name=\"root\">\n" + "<xs:complexType>\n"
+            + "<xs:sequence>\n" + "<xs:any namespace=\"##any\"  processContents=\"skip\"/>\n" + "</xs:sequence>\n" + "</xs:complexType>\n" + "</xs:element>\n"
+            + "</xs:schema>";
+
+    boolean charEvent = false;
+
+    @Test
+    public void test() throws SAXException, ParserConfigurationException, IOException {
+        Schema schema = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema").newSchema(new StreamSource(new StringReader(xmlSchema)));
+
+        SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+        saxParserFactory.setNamespaceAware(true);
+        saxParserFactory.setSchema(schema);
+        // saxParserFactory.setFeature("http://java.sun.com/xml/schema/features/report-ignored-element-content-whitespace",
+        // true);
+
+        SAXParser saxParser = saxParserFactory.newSAXParser();
+
+        XMLReader xmlReader = saxParser.getXMLReader();
+
+        xmlReader.setContentHandler(new MyContentHandler());
+
+        // InputStream input =
+        // ClassLoader.getSystemClassLoader().getResourceAsStream("test/test.xml");
+
+        InputStream input = getClass().getResourceAsStream("Bug6946312.xml");
+        System.out.println("Parse InputStream:");
+        xmlReader.parse(new InputSource(input));
+        if (!charEvent) {
+            Assert.fail("missing character event");
+        }
+    }
+
+    public class MyContentHandler implements ContentHandler {
+        public void characters(char[] ch, int start, int length) {
+            charEvent = true;
+            System.out.println("Characters called: " + new String(ch, start, length));
+        }
+
+        public void endDocument() throws SAXException {
+        }
+
+        public void endElement(String arg0, String arg1, String arg2) throws SAXException {
+        }
+
+        public void endPrefixMapping(String arg0) throws SAXException {
+        }
+
+        public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException {
+            System.out.println("ignorableWhitespace called: " + new String(ch, start, length));
+        }
+
+        public void processingInstruction(String arg0, String arg1) throws SAXException {
+        }
+
+        public void setDocumentLocator(Locator arg0) {
+        }
+
+        public void skippedEntity(String arg0) throws SAXException {
+        }
+
+        public void startDocument() throws SAXException {
+        }
+
+        public void startElement(String arg0, String arg1, String arg2, Attributes arg3) throws SAXException {
+        }
+
+        public void startPrefixMapping(String arg0, String arg1) throws SAXException {
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738.xml
new file mode 100644
index 00000000000..a1e5e69cbe0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Document xmlns="bug.report" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="bug.report C:\temp\sun\bug.xsd">
+    <Bug>01234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789</Bug>
+</Document>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738.xsd
new file mode 100644
index 00000000000..596513f3471
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738.xsd
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--W3C Schema generated by XMLSpy v2007 sp2 (http://www.altova.com)-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="bug.report" targetNamespace="bug.report">
+    <xs:complexType name="T_Document">
+        <xs:sequence>
+            <xs:element ref="Bug"/>
+        </xs:sequence>
+    </xs:complexType>
+    <xs:element name="Document" type="T_Document"/>
+    <xs:element name="Bug" type="Text"/>
+    <xs:simpleType name="Text">
+		<xs:restriction base="xs:string">
+			<xs:pattern value="[0-9A-Za-z ]{1,8000}"/>
+		</xs:restriction>
+	</xs:simpleType>
+</xs:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738_Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738_Test.java
new file mode 100644
index 00000000000..da5bb1a4cab
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug6954738_Test.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6954738
+ * @summary Test Validator can process a XML document containing an element with 8000 characters.
+ */
+public class Bug6954738_Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test() {
+        //if StackOverflowError is thrown, it shall escape from both the ErrorHandler and catch block
+        try {
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+            Schema schema = schemaFactory.newSchema(new StreamSource(Bug6954738_Test.class.getResourceAsStream("Bug6954738.xsd")));
+            Validator validator = schema.newValidator();
+            validator.setErrorHandler(new ErrorHandler() {
+                public void error(SAXParseException exception) throws SAXException {
+                    exception.printStackTrace();
+                }
+
+                public void fatalError(SAXParseException exception) throws SAXException {
+                    exception.printStackTrace();
+                }
+
+                public void warning(SAXParseException exception) throws SAXException {
+                    exception.printStackTrace();
+                }
+            });
+            validator.validate(new StreamSource(Bug6954738_Test.class.getResourceAsStream("Bug6954738.xml")));
+
+        } catch (SAXException e) {
+            System.out.println(e.getMessage());
+
+        } catch (IOException e) {
+            e.printStackTrace();
+            System.out.println(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6708840Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6708840Test.java
new file mode 100644
index 00000000000..932c8fb43b8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6708840Test.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+import java.io.FileWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.stax.StAXSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6708840
+ * @summary Test Validator can process StAXSource.
+ */
+public class CR6708840Test {
+
+    @Test
+    public final void testStream() {
+        try {
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            Schema schemaGrammar = schemaFactory.newSchema(new File(getClass().getResource("gMonths.xsd").getFile()));
+
+            Validator schemaValidator = schemaGrammar.newValidator();
+            Source xmlSource = new javax.xml.transform.stream.StreamSource(new File(CR6708840Test.class.getResource("gMonths.xml").toURI()));
+            schemaValidator.validate(xmlSource);
+
+        } catch (NullPointerException ne) {
+            Assert.fail("NullPointerException when result is not specified.");
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * refer to http://forums.java.net/jive/thread.jspa?threadID=41626&tstart=0
+     */
+    @Test
+    public final void testStAX() {
+        try {
+            XMLInputFactory xmlif = XMLInputFactory.newInstance();
+
+            // XMLStreamReader staxReader =
+            // xmlif.createXMLStreamReader((Source)new
+            // StreamSource(getClass().getResource("Forum31576.xml").getFile()));
+            XMLStreamReader staxReader = xmlif.createXMLStreamReader(this.getClass().getResourceAsStream("gMonths.xml"));
+
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            Schema schemaGrammar = schemaFactory.newSchema(new File(getClass().getResource("gMonths.xsd").getFile()));
+
+            Validator schemaValidator = schemaGrammar.newValidator();
+
+            Source staxSrc = new StAXSource(staxReader);
+            schemaValidator.validate(staxSrc);
+
+            while (staxReader.hasNext()) {
+                int eventType = staxReader.next();
+                System.out.println("Event of type: " + eventType);
+            }
+        } catch (NullPointerException ne) {
+            Assert.fail("NullPointerException when result is not specified.");
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * workaround before the fix: provide a result
+     */
+    @Test
+    public final void testStAXWResult() {
+        try {
+            XMLInputFactory xmlif = XMLInputFactory.newInstance();
+
+            // XMLStreamReader staxReader =
+            // xmlif.createXMLStreamReader((Source)new
+            // StreamSource(getClass().getResource("Forum31576.xml").getFile()));
+            XMLStreamReader staxReader = xmlif.createXMLStreamReader(this.getClass().getResourceAsStream("gMonths.xml"));
+
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            Schema schemaGrammar = schemaFactory.newSchema(new File(getClass().getResource("gMonths.xsd").getFile()));
+
+            Validator schemaValidator = schemaGrammar.newValidator();
+
+            Source staxSrc = new StAXSource(staxReader);
+            File resultFile = new File("gMonths.result.xml");
+            if (resultFile.exists()) {
+                resultFile.delete();
+            }
+
+            Result xmlResult = new javax.xml.transform.stax.StAXResult(XMLOutputFactory.newInstance().createXMLStreamWriter(new FileWriter(resultFile)));
+            schemaValidator.validate(staxSrc, xmlResult);
+
+            while (staxReader.hasNext()) {
+                int eventType = staxReader.next();
+                System.out.println("Event of type: " + eventType);
+            }
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+            e.printStackTrace();
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.java
new file mode 100644
index 00000000000..7ef779eb0a9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import org.w3c.dom.Document;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @bug 6740048
+ * @summary Test DocumentBuilder can be reused when the DocumentBuilderFactory sets schema.
+ */
+public class CR6740048 {
+    private static final String TAG_INFO = "containerInfo";
+    private static final String SCHEMA_LANGUAGE_URL = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    private static final String SCHEMA_SOURCE_URL = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+    private static final String XML_SCHEMA_URL = "http://www.w3.org/2001/XMLSchema";
+
+    @Test
+    public final void testReusingDocumentBuilder() {
+
+        try {
+            //ClassLoader loader = CR6740048.class.getClassLoader();
+
+            // Object xsd = loader.getResourceAsStream("CR6740048.xsd");
+            InputStream xsd = this.getClass().getResourceAsStream("CR6740048.xsd");
+            // create document builder
+            DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
+            docBuilderFactory.setNamespaceAware(true);
+
+            if (xsd != null) {
+                docBuilderFactory.setValidating(true);
+                docBuilderFactory.setAttribute(SCHEMA_LANGUAGE_URL, XML_SCHEMA_URL);
+                docBuilderFactory.setAttribute(SCHEMA_SOURCE_URL, xsd);
+            }
+
+            final DocumentBuilder documentBuilder = docBuilderFactory.newDocumentBuilder();
+            documentBuilder.setErrorHandler(new ErrorHandler() {
+
+                public void error(SAXParseException exception) throws SAXException {
+                    throw exception;
+                }
+
+                public void fatalError(SAXParseException exception) throws SAXException {
+                    throw exception;
+                }
+
+                public void warning(SAXParseException exception) throws SAXException {
+                    throw exception;
+                }
+            });
+
+            // TODO set the system properties in order to match the ones from
+            // the server environment
+            /**
+             * Properties props = new Properties();
+             * props.load(loader.getResourceAsStream("sysprops.properties"));
+             * System.setProperties(props);
+             */
+
+            // now parse the document
+            // InputStream is = loader.getResourceAsStream("CR6740048.xml");
+            InputStream is = this.getClass().getResourceAsStream("CR6740048.xml");
+            try {
+                Document doc = documentBuilder.parse(is);
+            } catch (Exception se) {
+
+                se.printStackTrace();
+                Assert.fail(se.getMessage());
+
+            } finally {
+                is.close();
+            }
+
+            // now use the parser object as second time
+            // is = loader.getResourceAsStream("CR6740048.xml");
+            is = this.getClass().getResourceAsStream("CR6740048.xml");
+            try {
+                Document doc = documentBuilder.parse(is);
+            } catch (Exception se) {
+
+                se.printStackTrace();
+                Assert.fail(se.getMessage());
+
+            } finally {
+                is.close();
+            }
+
+            System.err.println("Parse successful");
+
+            is.close();
+        } catch (ParserConfigurationException pce) {
+            pce.printStackTrace();
+        } catch (IOException ioe) {
+            ioe.printStackTrace();
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.xml
new file mode 100644
index 00000000000..5ac7d14055b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.xml
@@ -0,0 +1,3 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<containers><containerInfo name="Stopped Test Container"><isJ2EEContainer>false</isJ2EEContainer><moduleName>resource</moduleName><priority>80</priority><fileExtensions><name>.stopped</name></fileExtensions><softwareTypes><name>J2EE</name></softwareTypes><supportsLazyStart>true</supportsLazyStart><supportingParallelism>true</supportingParallelism><supportsSingleFileUpdate>false</supportsSingleFileUpdate></containerInfo></containers>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.xsd
new file mode 100644
index 00000000000..426858ff03d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CR6740048.xsd
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"><xs:element name="containers"><xs:complexType><xs:sequence><xs:element name="containerInfo"><xs:complexType><xs:all><xs:element name="isJ2EEContainer" type="xs:boolean" minOccurs="0" maxOccurs="1"/><xs:element name="moduleName" type="xs:string" minOccurs="0" maxOccurs="1"/><xs:element name="priority" type="xs:decimal" minOccurs="0" maxOccurs="1"/><xs:element name="classLoadPriority" type="xs:decimal" minOccurs="0" maxOccurs="1"/><xs:element name="fileNames" type="string-listType" minOccurs="0" maxOccurs="1"/><xs:element name="fileExtensions" type="string-listType" minOccurs="0" maxOccurs="1"/><xs:element name="resourceTypes" type="string-listType" minOccurs="0" maxOccurs="1"/><xs:element name="softwareTypes" type="string-listType" minOccurs="0" maxOccurs="1"/><xs:element name="hasGenerator" type="xs:boolean" minOccurs="0" maxOccurs="1"/><xs:element name="hasModuleDetector" type="xs:boolean" minOccurs="0" maxOccurs="1"/><xs:element name="supportsSingleFileUpdate" type="xs:boolean" minOccurs="0" maxOccurs="1"/><xs:element name="supportsLazyStart" type="xs:boolean" minOccurs="0" maxOccurs="1"/><xs:element name="supportingParallelism" type="xs:boolean" minOccurs="0" maxOccurs="1"/><xs:element name="needStartInitially" type="xs:boolean" minOccurs="0" maxOccurs="1"/><xs:element name="forceServiceStart" type="xs:boolean" minOccurs="0" maxOccurs="1"/></xs:all><xs:attribute name="name" type="xs:string" use="required"/></xs:complexType></xs:element></xs:sequence></xs:complexType></xs:element><xs:complexType name="string-listType"><xs:sequence><xs:element name="name" type="xs:string" minOccurs="1" maxOccurs="unbounded"/></xs:sequence></xs:complexType></xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CREMAS01.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CREMAS01.xml
new file mode 100644
index 00000000000..5a88686f115
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CREMAS01.xml
@@ -0,0 +1,1138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!--
+    Document   : CREMAS01.xml
+    Created on : July 28, 2009, 10:49 AM
+    Author     : sp106478
+    Description:
+        Purpose of the document follows.
+-->
+
+<CREMAS01  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+   xsi:schemaLocation='CREMAS01 CREMAS01.xsd'>
+    <IDOC BEGIN="1">
+        <EDI_DC40 SEGMENT="1">
+            <TABNAM>EDI_DC40</TABNAM>
+            <MANDT></MANDT>
+            <DOCNUM></DOCNUM>
+            <DOCREL></DOCREL>
+            <STATUS></STATUS>
+            <DIRECT>1</DIRECT>
+            <OUTMOD></OUTMOD>
+            <EXPRSS></EXPRSS>
+            <TEST></TEST>
+            <IDOCTYP>CREMAS01</IDOCTYP>
+            <CIMTYP></CIMTYP>
+            <MESTYP>CREMAS</MESTYP>
+            <MESCOD></MESCOD>
+            <MESFCT></MESFCT>
+            <STD></STD>
+            <STDVRS></STDVRS>
+            <STDMES></STDMES>
+            <SNDPOR></SNDPOR>
+            <SNDPRT></SNDPRT>
+            <SNDPFC></SNDPFC>
+            <SNDPRN></SNDPRN>
+            <SNDSAD></SNDSAD>
+            <SNDLAD></SNDLAD>
+            <RCVPOR></RCVPOR>
+            <RCVPRT></RCVPRT>
+            <RCVPFC></RCVPFC>
+            <RCVPRN></RCVPRN>
+            <RCVSAD></RCVSAD>
+            <RCVLAD></RCVLAD>
+            <CREDAT></CREDAT>
+            <CRETIM></CRETIM>
+            <REFINT></REFINT>
+            <REFGRP></REFGRP>
+            <REFMES></REFMES>
+            <ARCKEY></ARCKEY>
+            <SERIAL></SERIAL>
+        </EDI_DC40>
+        <E1LFA1M SEGMENT="1">
+            <MSGFN></MSGFN>
+            <LIFNR></LIFNR>
+            <ANRED></ANRED>
+            <BAHNS></BAHNS>
+            <BBBNR></BBBNR>
+            <BBSNR></BBSNR>
+            <BEGRU></BEGRU>
+            <BRSCH></BRSCH>
+            <BUBKZ></BUBKZ>
+            <DATLT></DATLT>
+            <DTAMS></DTAMS>
+            <DTAWS></DTAWS>
+            <ERDAT></ERDAT>
+            <ERNAM></ERNAM>
+            <ESRNR></ESRNR>
+            <KONZS></KONZS>
+            <KTOKK></KTOKK>
+            <KUNNR></KUNNR>
+            <LAND1></LAND1>
+            <LNRZA></LNRZA>
+            <LOEVM></LOEVM>
+            <NAME1></NAME1>
+            <NAME2></NAME2>
+            <NAME3></NAME3>
+            <NAME4></NAME4>
+            <ORT01></ORT01>
+            <ORT02></ORT02>
+            <PFACH></PFACH>
+            <PSTL2></PSTL2>
+            <PSTLZ></PSTLZ>
+            <REGIO></REGIO>
+            <SORTL></SORTL>
+            <SPERR></SPERR>
+            <SPERM></SPERM>
+            <SPRAS></SPRAS>
+            <STCD1></STCD1>
+            <STCD2></STCD2>
+            <STKZA></STKZA>
+            <STKZU></STKZU>
+            <STRAS></STRAS>
+            <TELBX></TELBX>
+            <TELF1></TELF1>
+            <TELF2></TELF2>
+            <TELFX></TELFX>
+            <TELTX></TELTX>
+            <TELX1></TELX1>
+            <XCPDK></XCPDK>
+            <XZEMP></XZEMP>
+            <VBUND></VBUND>
+            <FISKN></FISKN>
+            <STCEG></STCEG>
+            <STKZN></STKZN>
+            <SPERQ></SPERQ>
+            <ADRNR></ADRNR>
+            <MCOD1></MCOD1>
+            <MCOD2></MCOD2>
+            <MCOD3></MCOD3>
+            <GBORT></GBORT>
+            <GBDAT></GBDAT>
+            <SEXKZ></SEXKZ>
+            <KRAUS></KRAUS>
+            <REVDB></REVDB>
+            <QSSYS></QSSYS>
+            <KTOCK></KTOCK>
+            <PFORT></PFORT>
+            <WERKS></WERKS>
+            <LTSNA></LTSNA>
+            <WERKR></WERKR>
+            <PLKAL></PLKAL>
+            <DUEFL></DUEFL>
+            <TXJCD></TXJCD>
+            <E1LFB1M SEGMENT="1">
+                <MSGFN></MSGFN>
+                <LIFNR></LIFNR>
+                <BUKRS></BUKRS>
+                <ERDAT></ERDAT>
+                <ERNAM></ERNAM>
+                <SPERR></SPERR>
+                <LOEVM></LOEVM>
+                <ZUAWA></ZUAWA>
+                <AKONT></AKONT>
+                <BEGRU></BEGRU>
+                <VZSKZ></VZSKZ>
+                <ZWELS></ZWELS>
+                <XVERR></XVERR>
+                <ZAHLS></ZAHLS>
+                <ZTERM></ZTERM>
+                <EIKTO></EIKTO>
+                <ZSABE></ZSABE>
+                <KVERM></KVERM>
+                <FDGRV></FDGRV>
+                <BUSAB></BUSAB>
+                <LNRZE></LNRZE>
+                <LNRZB></LNRZB>
+                <ZINDT></ZINDT>
+                <ZINRT></ZINRT>
+                <DATLZ></DATLZ>
+                <XDEZV></XDEZV>
+                <WEBTR></WEBTR>
+                <KULTG></KULTG>
+                <REPRF></REPRF>
+                <TOGRU></TOGRU>
+                <HBKID></HBKID>
+                <XPORE></XPORE>
+                <QSZNR></QSZNR>
+                <QSZDT></QSZDT>
+                <QSSKZ></QSSKZ>
+                <BLNKZ></BLNKZ>
+                <MINDK></MINDK>
+                <ALTKN></ALTKN>
+                <ZGRUP></ZGRUP>
+                <MGRUP></MGRUP>
+                <UZAWE></UZAWE>
+                <QSREC></QSREC>
+                <QSBGR></QSBGR>
+                <QLAND></QLAND>
+                <XEDIP></XEDIP>
+                <FRGRP></FRGRP>
+                <TLFXS></TLFXS>
+                <E1LFB5M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <BUKRS></BUKRS>
+                    <MABER></MABER>
+                    <MAHNA></MAHNA>
+                    <MANSP></MANSP>
+                    <MADAT></MADAT>
+                    <MAHNS></MAHNS>
+                    <LFRMA></LFRMA>
+                    <GMVDT></GMVDT>
+                    <BUSAB></BUSAB>
+                </E1LFB5M>
+                <E1LFB5M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <BUKRS></BUKRS>
+                    <MABER></MABER>
+                    <MAHNA></MAHNA>
+                    <MANSP></MANSP>
+                    <MADAT></MADAT>
+                    <MAHNS></MAHNS>
+                    <LFRMA></LFRMA>
+                    <GMVDT></GMVDT>
+                    <BUSAB></BUSAB>
+                </E1LFB5M>
+                <E1LFB5M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <BUKRS></BUKRS>
+                    <MABER></MABER>
+                    <MAHNA></MAHNA>
+                    <MANSP></MANSP>
+                    <MADAT></MADAT>
+                    <MAHNS></MAHNS>
+                    <LFRMA></LFRMA>
+                    <GMVDT></GMVDT>
+                    <BUSAB></BUSAB>
+                </E1LFB5M>
+            </E1LFB1M>
+            <E1LFB1M SEGMENT="1">
+                <MSGFN></MSGFN>
+                <LIFNR></LIFNR>
+                <BUKRS></BUKRS>
+                <ERDAT></ERDAT>
+                <ERNAM></ERNAM>
+                <SPERR></SPERR>
+                <LOEVM></LOEVM>
+                <ZUAWA></ZUAWA>
+                <AKONT></AKONT>
+                <BEGRU></BEGRU>
+                <VZSKZ></VZSKZ>
+                <ZWELS></ZWELS>
+                <XVERR></XVERR>
+                <ZAHLS></ZAHLS>
+                <ZTERM></ZTERM>
+                <EIKTO></EIKTO>
+                <ZSABE></ZSABE>
+                <KVERM></KVERM>
+                <FDGRV></FDGRV>
+                <BUSAB></BUSAB>
+                <LNRZE></LNRZE>
+                <LNRZB></LNRZB>
+                <ZINDT></ZINDT>
+                <ZINRT></ZINRT>
+                <DATLZ></DATLZ>
+                <XDEZV></XDEZV>
+                <WEBTR></WEBTR>
+                <KULTG></KULTG>
+                <REPRF></REPRF>
+                <TOGRU></TOGRU>
+                <HBKID></HBKID>
+                <XPORE></XPORE>
+                <QSZNR></QSZNR>
+                <QSZDT></QSZDT>
+                <QSSKZ></QSSKZ>
+                <BLNKZ></BLNKZ>
+                <MINDK></MINDK>
+                <ALTKN></ALTKN>
+                <ZGRUP></ZGRUP>
+                <MGRUP></MGRUP>
+                <UZAWE></UZAWE>
+                <QSREC></QSREC>
+                <QSBGR></QSBGR>
+                <QLAND></QLAND>
+                <XEDIP></XEDIP>
+                <FRGRP></FRGRP>
+                <TLFXS></TLFXS>
+                <E1LFB5M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <BUKRS></BUKRS>
+                    <MABER></MABER>
+                    <MAHNA></MAHNA>
+                    <MANSP></MANSP>
+                    <MADAT></MADAT>
+                    <MAHNS></MAHNS>
+                    <LFRMA></LFRMA>
+                    <GMVDT></GMVDT>
+                    <BUSAB></BUSAB>
+                </E1LFB5M>
+                <E1LFB5M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <BUKRS></BUKRS>
+                    <MABER></MABER>
+                    <MAHNA></MAHNA>
+                    <MANSP></MANSP>
+                    <MADAT></MADAT>
+                    <MAHNS></MAHNS>
+                    <LFRMA></LFRMA>
+                    <GMVDT></GMVDT>
+                    <BUSAB></BUSAB>
+                </E1LFB5M>
+                <E1LFB5M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <BUKRS></BUKRS>
+                    <MABER></MABER>
+                    <MAHNA></MAHNA>
+                    <MANSP></MANSP>
+                    <MADAT></MADAT>
+                    <MAHNS></MAHNS>
+                    <LFRMA></LFRMA>
+                    <GMVDT></GMVDT>
+                    <BUSAB></BUSAB>
+                </E1LFB5M>
+            </E1LFB1M>
+            <E1LFB1M SEGMENT="1">
+                <MSGFN></MSGFN>
+                <LIFNR></LIFNR>
+                <BUKRS></BUKRS>
+                <ERDAT></ERDAT>
+                <ERNAM></ERNAM>
+                <SPERR></SPERR>
+                <LOEVM></LOEVM>
+                <ZUAWA></ZUAWA>
+                <AKONT></AKONT>
+                <BEGRU></BEGRU>
+                <VZSKZ></VZSKZ>
+                <ZWELS></ZWELS>
+                <XVERR></XVERR>
+                <ZAHLS></ZAHLS>
+                <ZTERM></ZTERM>
+                <EIKTO></EIKTO>
+                <ZSABE></ZSABE>
+                <KVERM></KVERM>
+                <FDGRV></FDGRV>
+                <BUSAB></BUSAB>
+                <LNRZE></LNRZE>
+                <LNRZB></LNRZB>
+                <ZINDT></ZINDT>
+                <ZINRT></ZINRT>
+                <DATLZ></DATLZ>
+                <XDEZV></XDEZV>
+                <WEBTR></WEBTR>
+                <KULTG></KULTG>
+                <REPRF></REPRF>
+                <TOGRU></TOGRU>
+                <HBKID></HBKID>
+                <XPORE></XPORE>
+                <QSZNR></QSZNR>
+                <QSZDT></QSZDT>
+                <QSSKZ></QSSKZ>
+                <BLNKZ></BLNKZ>
+                <MINDK></MINDK>
+                <ALTKN></ALTKN>
+                <ZGRUP></ZGRUP>
+                <MGRUP></MGRUP>
+                <UZAWE></UZAWE>
+                <QSREC></QSREC>
+                <QSBGR></QSBGR>
+                <QLAND></QLAND>
+                <XEDIP></XEDIP>
+                <FRGRP></FRGRP>
+                <TLFXS></TLFXS>
+                <E1LFB5M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <BUKRS></BUKRS>
+                    <MABER></MABER>
+                    <MAHNA></MAHNA>
+                    <MANSP></MANSP>
+                    <MADAT></MADAT>
+                    <MAHNS></MAHNS>
+                    <LFRMA></LFRMA>
+                    <GMVDT></GMVDT>
+                    <BUSAB></BUSAB>
+                </E1LFB5M>
+                <E1LFB5M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <BUKRS></BUKRS>
+                    <MABER></MABER>
+                    <MAHNA></MAHNA>
+                    <MANSP></MANSP>
+                    <MADAT></MADAT>
+                    <MAHNS></MAHNS>
+                    <LFRMA></LFRMA>
+                    <GMVDT></GMVDT>
+                    <BUSAB></BUSAB>
+                </E1LFB5M>
+                <E1LFB5M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <BUKRS></BUKRS>
+                    <MABER></MABER>
+                    <MAHNA></MAHNA>
+                    <MANSP></MANSP>
+                    <MADAT></MADAT>
+                    <MAHNS></MAHNS>
+                    <LFRMA></LFRMA>
+                    <GMVDT></GMVDT>
+                    <BUSAB></BUSAB>
+                </E1LFB5M>
+            </E1LFB1M>
+            <E1LFM1M SEGMENT="1">
+                <MSGFN></MSGFN>
+                <LIFNR></LIFNR>
+                <EKORG></EKORG>
+                <ERDAT></ERDAT>
+                <ERNAM></ERNAM>
+                <SPERM></SPERM>
+                <LOEVM></LOEVM>
+                <LFABC></LFABC>
+                <WAERS></WAERS>
+                <VERKF></VERKF>
+                <TELF1></TELF1>
+                <MINBW></MINBW>
+                <ZTERM></ZTERM>
+                <INCO1></INCO1>
+                <INCO2></INCO2>
+                <WEBRE></WEBRE>
+                <KZABS></KZABS>
+                <KALSK></KALSK>
+                <KZAUT></KZAUT>
+                <EXPVZ></EXPVZ>
+                <ZOLLA></ZOLLA>
+                <MEPRF></MEPRF>
+                <EKGRP></EKGRP>
+                <BOLRE></BOLRE>
+                <UMSAE></UMSAE>
+                <XERSY></XERSY>
+                <PLIFZ></PLIFZ>
+                <MRPPP></MRPPP>
+                <LFRHY></LFRHY>
+                <LIEFR></LIEFR>
+                <LIBES></LIBES>
+                <LIPRE></LIPRE>
+                <LISER></LISER>
+                <BOIND></BOIND>
+                <E1LFM2M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <ERDAT></ERDAT>
+                    <ERNAM></ERNAM>
+                    <SPERM></SPERM>
+                    <LOEVM></LOEVM>
+                    <LFABC></LFABC>
+                    <WAERS></WAERS>
+                    <VERKF></VERKF>
+                    <TELF1></TELF1>
+                    <MINBW></MINBW>
+                    <ZTERM></ZTERM>
+                    <INCO1></INCO1>
+                    <INCO2></INCO2>
+                    <WEBRE></WEBRE>
+                    <KZABS></KZABS>
+                    <KALSK></KALSK>
+                    <KZAUT></KZAUT>
+                    <EXPVZ></EXPVZ>
+                    <ZOLLA></ZOLLA>
+                    <MEPRF></MEPRF>
+                    <EKGRP></EKGRP>
+                    <BOLRE></BOLRE>
+                    <UMSAE></UMSAE>
+                    <XERSY></XERSY>
+                    <PLIFZ></PLIFZ>
+                    <MRPPP></MRPPP>
+                    <LFRHY></LFRHY>
+                    <LIEFR></LIEFR>
+                    <LIBES></LIBES>
+                    <LIPRE></LIPRE>
+                    <LISER></LISER>
+                    <DISPO></DISPO>
+                </E1LFM2M>
+                <E1LFM2M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <ERDAT></ERDAT>
+                    <ERNAM></ERNAM>
+                    <SPERM></SPERM>
+                    <LOEVM></LOEVM>
+                    <LFABC></LFABC>
+                    <WAERS></WAERS>
+                    <VERKF></VERKF>
+                    <TELF1></TELF1>
+                    <MINBW></MINBW>
+                    <ZTERM></ZTERM>
+                    <INCO1></INCO1>
+                    <INCO2></INCO2>
+                    <WEBRE></WEBRE>
+                    <KZABS></KZABS>
+                    <KALSK></KALSK>
+                    <KZAUT></KZAUT>
+                    <EXPVZ></EXPVZ>
+                    <ZOLLA></ZOLLA>
+                    <MEPRF></MEPRF>
+                    <EKGRP></EKGRP>
+                    <BOLRE></BOLRE>
+                    <UMSAE></UMSAE>
+                    <XERSY></XERSY>
+                    <PLIFZ></PLIFZ>
+                    <MRPPP></MRPPP>
+                    <LFRHY></LFRHY>
+                    <LIEFR></LIEFR>
+                    <LIBES></LIBES>
+                    <LIPRE></LIPRE>
+                    <LISER></LISER>
+                    <DISPO></DISPO>
+                </E1LFM2M>
+                <E1LFM2M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <ERDAT></ERDAT>
+                    <ERNAM></ERNAM>
+                    <SPERM></SPERM>
+                    <LOEVM></LOEVM>
+                    <LFABC></LFABC>
+                    <WAERS></WAERS>
+                    <VERKF></VERKF>
+                    <TELF1></TELF1>
+                    <MINBW></MINBW>
+                    <ZTERM></ZTERM>
+                    <INCO1></INCO1>
+                    <INCO2></INCO2>
+                    <WEBRE></WEBRE>
+                    <KZABS></KZABS>
+                    <KALSK></KALSK>
+                    <KZAUT></KZAUT>
+                    <EXPVZ></EXPVZ>
+                    <ZOLLA></ZOLLA>
+                    <MEPRF></MEPRF>
+                    <EKGRP></EKGRP>
+                    <BOLRE></BOLRE>
+                    <UMSAE></UMSAE>
+                    <XERSY></XERSY>
+                    <PLIFZ></PLIFZ>
+                    <MRPPP></MRPPP>
+                    <LFRHY></LFRHY>
+                    <LIEFR></LIEFR>
+                    <LIBES></LIBES>
+                    <LIPRE></LIPRE>
+                    <LISER></LISER>
+                    <DISPO></DISPO>
+                </E1LFM2M>
+                <E1WYT3M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <PARVW></PARVW>
+                    <PARZA></PARZA>
+                    <ERNAM></ERNAM>
+                    <ERDAT></ERDAT>
+                    <LIFN2></LIFN2>
+                    <DEFPA></DEFPA>
+                </E1WYT3M>
+                <E1WYT3M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <PARVW></PARVW>
+                    <PARZA></PARZA>
+                    <ERNAM></ERNAM>
+                    <ERDAT></ERDAT>
+                    <LIFN2></LIFN2>
+                    <DEFPA></DEFPA>
+                </E1WYT3M>
+                <E1WYT3M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <PARVW></PARVW>
+                    <PARZA></PARZA>
+                    <ERNAM></ERNAM>
+                    <ERDAT></ERDAT>
+                    <LIFN2></LIFN2>
+                    <DEFPA></DEFPA>
+                </E1WYT3M>
+            </E1LFM1M>
+            <E1LFM1M SEGMENT="1">
+                <MSGFN></MSGFN>
+                <LIFNR></LIFNR>
+                <EKORG></EKORG>
+                <ERDAT></ERDAT>
+                <ERNAM></ERNAM>
+                <SPERM></SPERM>
+                <LOEVM></LOEVM>
+                <LFABC></LFABC>
+                <WAERS></WAERS>
+                <VERKF></VERKF>
+                <TELF1></TELF1>
+                <MINBW></MINBW>
+                <ZTERM></ZTERM>
+                <INCO1></INCO1>
+                <INCO2></INCO2>
+                <WEBRE></WEBRE>
+                <KZABS></KZABS>
+                <KALSK></KALSK>
+                <KZAUT></KZAUT>
+                <EXPVZ></EXPVZ>
+                <ZOLLA></ZOLLA>
+                <MEPRF></MEPRF>
+                <EKGRP></EKGRP>
+                <BOLRE></BOLRE>
+                <UMSAE></UMSAE>
+                <XERSY></XERSY>
+                <PLIFZ></PLIFZ>
+                <MRPPP></MRPPP>
+                <LFRHY></LFRHY>
+                <LIEFR></LIEFR>
+                <LIBES></LIBES>
+                <LIPRE></LIPRE>
+                <LISER></LISER>
+                <BOIND></BOIND>
+                <E1LFM2M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <ERDAT></ERDAT>
+                    <ERNAM></ERNAM>
+                    <SPERM></SPERM>
+                    <LOEVM></LOEVM>
+                    <LFABC></LFABC>
+                    <WAERS></WAERS>
+                    <VERKF></VERKF>
+                    <TELF1></TELF1>
+                    <MINBW></MINBW>
+                    <ZTERM></ZTERM>
+                    <INCO1></INCO1>
+                    <INCO2></INCO2>
+                    <WEBRE></WEBRE>
+                    <KZABS></KZABS>
+                    <KALSK></KALSK>
+                    <KZAUT></KZAUT>
+                    <EXPVZ></EXPVZ>
+                    <ZOLLA></ZOLLA>
+                    <MEPRF></MEPRF>
+                    <EKGRP></EKGRP>
+                    <BOLRE></BOLRE>
+                    <UMSAE></UMSAE>
+                    <XERSY></XERSY>
+                    <PLIFZ></PLIFZ>
+                    <MRPPP></MRPPP>
+                    <LFRHY></LFRHY>
+                    <LIEFR></LIEFR>
+                    <LIBES></LIBES>
+                    <LIPRE></LIPRE>
+                    <LISER></LISER>
+                    <DISPO></DISPO>
+                </E1LFM2M>
+                <E1LFM2M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <ERDAT></ERDAT>
+                    <ERNAM></ERNAM>
+                    <SPERM></SPERM>
+                    <LOEVM></LOEVM>
+                    <LFABC></LFABC>
+                    <WAERS></WAERS>
+                    <VERKF></VERKF>
+                    <TELF1></TELF1>
+                    <MINBW></MINBW>
+                    <ZTERM></ZTERM>
+                    <INCO1></INCO1>
+                    <INCO2></INCO2>
+                    <WEBRE></WEBRE>
+                    <KZABS></KZABS>
+                    <KALSK></KALSK>
+                    <KZAUT></KZAUT>
+                    <EXPVZ></EXPVZ>
+                    <ZOLLA></ZOLLA>
+                    <MEPRF></MEPRF>
+                    <EKGRP></EKGRP>
+                    <BOLRE></BOLRE>
+                    <UMSAE></UMSAE>
+                    <XERSY></XERSY>
+                    <PLIFZ></PLIFZ>
+                    <MRPPP></MRPPP>
+                    <LFRHY></LFRHY>
+                    <LIEFR></LIEFR>
+                    <LIBES></LIBES>
+                    <LIPRE></LIPRE>
+                    <LISER></LISER>
+                    <DISPO></DISPO>
+                </E1LFM2M>
+                <E1LFM2M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <ERDAT></ERDAT>
+                    <ERNAM></ERNAM>
+                    <SPERM></SPERM>
+                    <LOEVM></LOEVM>
+                    <LFABC></LFABC>
+                    <WAERS></WAERS>
+                    <VERKF></VERKF>
+                    <TELF1></TELF1>
+                    <MINBW></MINBW>
+                    <ZTERM></ZTERM>
+                    <INCO1></INCO1>
+                    <INCO2></INCO2>
+                    <WEBRE></WEBRE>
+                    <KZABS></KZABS>
+                    <KALSK></KALSK>
+                    <KZAUT></KZAUT>
+                    <EXPVZ></EXPVZ>
+                    <ZOLLA></ZOLLA>
+                    <MEPRF></MEPRF>
+                    <EKGRP></EKGRP>
+                    <BOLRE></BOLRE>
+                    <UMSAE></UMSAE>
+                    <XERSY></XERSY>
+                    <PLIFZ></PLIFZ>
+                    <MRPPP></MRPPP>
+                    <LFRHY></LFRHY>
+                    <LIEFR></LIEFR>
+                    <LIBES></LIBES>
+                    <LIPRE></LIPRE>
+                    <LISER></LISER>
+                    <DISPO></DISPO>
+                </E1LFM2M>
+                <E1WYT3M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <PARVW></PARVW>
+                    <PARZA></PARZA>
+                    <ERNAM></ERNAM>
+                    <ERDAT></ERDAT>
+                    <LIFN2></LIFN2>
+                    <DEFPA></DEFPA>
+                </E1WYT3M>
+                <E1WYT3M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <PARVW></PARVW>
+                    <PARZA></PARZA>
+                    <ERNAM></ERNAM>
+                    <ERDAT></ERDAT>
+                    <LIFN2></LIFN2>
+                    <DEFPA></DEFPA>
+                </E1WYT3M>
+                <E1WYT3M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <PARVW></PARVW>
+                    <PARZA></PARZA>
+                    <ERNAM></ERNAM>
+                    <ERDAT></ERDAT>
+                    <LIFN2></LIFN2>
+                    <DEFPA></DEFPA>
+                </E1WYT3M>
+            </E1LFM1M>
+            <E1LFM1M SEGMENT="1">
+                <MSGFN></MSGFN>
+                <LIFNR></LIFNR>
+                <EKORG></EKORG>
+                <ERDAT></ERDAT>
+                <ERNAM></ERNAM>
+                <SPERM></SPERM>
+                <LOEVM></LOEVM>
+                <LFABC></LFABC>
+                <WAERS></WAERS>
+                <VERKF></VERKF>
+                <TELF1></TELF1>
+                <MINBW></MINBW>
+                <ZTERM></ZTERM>
+                <INCO1></INCO1>
+                <INCO2></INCO2>
+                <WEBRE></WEBRE>
+                <KZABS></KZABS>
+                <KALSK></KALSK>
+                <KZAUT></KZAUT>
+                <EXPVZ></EXPVZ>
+                <ZOLLA></ZOLLA>
+                <MEPRF></MEPRF>
+                <EKGRP></EKGRP>
+                <BOLRE></BOLRE>
+                <UMSAE></UMSAE>
+                <XERSY></XERSY>
+                <PLIFZ></PLIFZ>
+                <MRPPP></MRPPP>
+                <LFRHY></LFRHY>
+                <LIEFR></LIEFR>
+                <LIBES></LIBES>
+                <LIPRE></LIPRE>
+                <LISER></LISER>
+                <BOIND></BOIND>
+                <E1LFM2M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <ERDAT></ERDAT>
+                    <ERNAM></ERNAM>
+                    <SPERM></SPERM>
+                    <LOEVM></LOEVM>
+                    <LFABC></LFABC>
+                    <WAERS></WAERS>
+                    <VERKF></VERKF>
+                    <TELF1></TELF1>
+                    <MINBW></MINBW>
+                    <ZTERM></ZTERM>
+                    <INCO1></INCO1>
+                    <INCO2></INCO2>
+                    <WEBRE></WEBRE>
+                    <KZABS></KZABS>
+                    <KALSK></KALSK>
+                    <KZAUT></KZAUT>
+                    <EXPVZ></EXPVZ>
+                    <ZOLLA></ZOLLA>
+                    <MEPRF></MEPRF>
+                    <EKGRP></EKGRP>
+                    <BOLRE></BOLRE>
+                    <UMSAE></UMSAE>
+                    <XERSY></XERSY>
+                    <PLIFZ></PLIFZ>
+                    <MRPPP></MRPPP>
+                    <LFRHY></LFRHY>
+                    <LIEFR></LIEFR>
+                    <LIBES></LIBES>
+                    <LIPRE></LIPRE>
+                    <LISER></LISER>
+                    <DISPO></DISPO>
+                </E1LFM2M>
+                <E1LFM2M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <ERDAT></ERDAT>
+                    <ERNAM></ERNAM>
+                    <SPERM></SPERM>
+                    <LOEVM></LOEVM>
+                    <LFABC></LFABC>
+                    <WAERS></WAERS>
+                    <VERKF></VERKF>
+                    <TELF1></TELF1>
+                    <MINBW></MINBW>
+                    <ZTERM></ZTERM>
+                    <INCO1></INCO1>
+                    <INCO2></INCO2>
+                    <WEBRE></WEBRE>
+                    <KZABS></KZABS>
+                    <KALSK></KALSK>
+                    <KZAUT></KZAUT>
+                    <EXPVZ></EXPVZ>
+                    <ZOLLA></ZOLLA>
+                    <MEPRF></MEPRF>
+                    <EKGRP></EKGRP>
+                    <BOLRE></BOLRE>
+                    <UMSAE></UMSAE>
+                    <XERSY></XERSY>
+                    <PLIFZ></PLIFZ>
+                    <MRPPP></MRPPP>
+                    <LFRHY></LFRHY>
+                    <LIEFR></LIEFR>
+                    <LIBES></LIBES>
+                    <LIPRE></LIPRE>
+                    <LISER></LISER>
+                    <DISPO></DISPO>
+                </E1LFM2M>
+                <E1LFM2M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <ERDAT></ERDAT>
+                    <ERNAM></ERNAM>
+                    <SPERM></SPERM>
+                    <LOEVM></LOEVM>
+                    <LFABC></LFABC>
+                    <WAERS></WAERS>
+                    <VERKF></VERKF>
+                    <TELF1></TELF1>
+                    <MINBW></MINBW>
+                    <ZTERM></ZTERM>
+                    <INCO1></INCO1>
+                    <INCO2></INCO2>
+                    <WEBRE></WEBRE>
+                    <KZABS></KZABS>
+                    <KALSK></KALSK>
+                    <KZAUT></KZAUT>
+                    <EXPVZ></EXPVZ>
+                    <ZOLLA></ZOLLA>
+                    <MEPRF></MEPRF>
+                    <EKGRP></EKGRP>
+                    <BOLRE></BOLRE>
+                    <UMSAE></UMSAE>
+                    <XERSY></XERSY>
+                    <PLIFZ></PLIFZ>
+                    <MRPPP></MRPPP>
+                    <LFRHY></LFRHY>
+                    <LIEFR></LIEFR>
+                    <LIBES></LIBES>
+                    <LIPRE></LIPRE>
+                    <LISER></LISER>
+                    <DISPO></DISPO>
+                </E1LFM2M>
+                <E1WYT3M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <PARVW></PARVW>
+                    <PARZA></PARZA>
+                    <ERNAM></ERNAM>
+                    <ERDAT></ERDAT>
+                    <LIFN2></LIFN2>
+                    <DEFPA></DEFPA>
+                </E1WYT3M>
+                <E1WYT3M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <PARVW></PARVW>
+                    <PARZA></PARZA>
+                    <ERNAM></ERNAM>
+                    <ERDAT></ERDAT>
+                    <LIFN2></LIFN2>
+                    <DEFPA></DEFPA>
+                </E1WYT3M>
+                <E1WYT3M SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <LIFNR></LIFNR>
+                    <EKORG></EKORG>
+                    <LTSNR></LTSNR>
+                    <WERKS></WERKS>
+                    <PARVW></PARVW>
+                    <PARZA></PARZA>
+                    <ERNAM></ERNAM>
+                    <ERDAT></ERDAT>
+                    <LIFN2></LIFN2>
+                    <DEFPA></DEFPA>
+                </E1WYT3M>
+            </E1LFM1M>
+            <E1LFBKM SEGMENT="1">
+                <MSGFN></MSGFN>
+                <LIFNR></LIFNR>
+                <BANKS></BANKS>
+                <BANKL></BANKL>
+                <BANKN></BANKN>
+                <BKONT></BKONT>
+                <BVTYP></BVTYP>
+                <XEZER></XEZER>
+                <BANKA></BANKA>
+                <PROVZ></PROVZ>
+                <STRAS></STRAS>
+                <ORT01></ORT01>
+                <SWIFT></SWIFT>
+                <BGRUP></BGRUP>
+                <XPGRO></XPGRO>
+                <BNKLZ></BNKLZ>
+                <PSKTO></PSKTO>
+                <BKREF></BKREF>
+                <BRNCH></BRNCH>
+                <PROV2></PROV2>
+                <STRA2></STRA2>
+                <ORT02></ORT02>
+            </E1LFBKM>
+            <E1LFBKM SEGMENT="1">
+                <MSGFN></MSGFN>
+                <LIFNR></LIFNR>
+                <BANKS></BANKS>
+                <BANKL></BANKL>
+                <BANKN></BANKN>
+                <BKONT></BKONT>
+                <BVTYP></BVTYP>
+                <XEZER></XEZER>
+                <BANKA></BANKA>
+                <PROVZ></PROVZ>
+                <STRAS></STRAS>
+                <ORT01></ORT01>
+                <SWIFT></SWIFT>
+                <BGRUP></BGRUP>
+                <XPGRO></XPGRO>
+                <BNKLZ></BNKLZ>
+                <PSKTO></PSKTO>
+                <BKREF></BKREF>
+                <BRNCH></BRNCH>
+                <PROV2></PROV2>
+                <STRA2></STRA2>
+                <ORT02></ORT02>
+            </E1LFBKM>
+            <E1LFBKM SEGMENT="1">
+                <MSGFN></MSGFN>
+                <LIFNR></LIFNR>
+                <BANKS></BANKS>
+                <BANKL></BANKL>
+                <BANKN></BANKN>
+                <BKONT></BKONT>
+                <BVTYP></BVTYP>
+                <XEZER></XEZER>
+                <BANKA></BANKA>
+                <PROVZ></PROVZ>
+                <STRAS></STRAS>
+                <ORT01></ORT01>
+                <SWIFT></SWIFT>
+                <BGRUP></BGRUP>
+                <XPGRO></XPGRO>
+                <BNKLZ></BNKLZ>
+                <PSKTO></PSKTO>
+                <BKREF></BKREF>
+                <BRNCH></BRNCH>
+                <PROV2></PROV2>
+                <STRA2></STRA2>
+                <ORT02></ORT02>
+            </E1LFBKM>
+            <E1LFASM SEGMENT="1">
+                <MSGFN></MSGFN>
+                <LIFNR></LIFNR>
+                <LAND1></LAND1>
+                <STCEG></STCEG>
+            </E1LFASM>
+            <E1LFASM SEGMENT="1">
+                <MSGFN></MSGFN>
+                <LIFNR></LIFNR>
+                <LAND1></LAND1>
+                <STCEG></STCEG>
+            </E1LFASM>
+            <E1LFASM SEGMENT="1">
+                <MSGFN></MSGFN>
+                <LIFNR></LIFNR>
+                <LAND1></LAND1>
+                <STCEG></STCEG>
+            </E1LFASM>
+            <E1WYT1M SEGMENT="1">
+                <MSGFN></MSGFN>
+                <LIFNR></LIFNR>
+                <LTSNR></LTSNR>
+                <ERNAM></ERNAM>
+                <ERDAT></ERDAT>
+                <SPRAS></SPRAS>
+                <LTSBZ></LTSBZ>
+                <E1WYTTM SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <SPRAS></SPRAS>
+                    <LIFNR></LIFNR>
+                    <LTSNR></LTSNR>
+                    <LTSBZ></LTSBZ>
+                </E1WYTTM>
+                <E1WYTTM SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <SPRAS></SPRAS>
+                    <LIFNR></LIFNR>
+                    <LTSNR></LTSNR>
+                    <LTSBZ></LTSBZ>
+                </E1WYTTM>
+                <E1WYTTM SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <SPRAS></SPRAS>
+                    <LIFNR></LIFNR>
+                    <LTSNR></LTSNR>
+                    <LTSBZ></LTSBZ>
+                </E1WYTTM>
+            </E1WYT1M>
+            <E1WYT1M SEGMENT="1">
+                <MSGFN></MSGFN>
+                <LIFNR></LIFNR>
+                <LTSNR></LTSNR>
+                <ERNAM></ERNAM>
+                <ERDAT></ERDAT>
+                <SPRAS></SPRAS>
+                <LTSBZ></LTSBZ>
+                <E1WYTTM SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <SPRAS></SPRAS>
+                    <LIFNR></LIFNR>
+                    <LTSNR></LTSNR>
+                    <LTSBZ></LTSBZ>
+                </E1WYTTM>
+                <E1WYTTM SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <SPRAS></SPRAS>
+                    <LIFNR></LIFNR>
+                    <LTSNR></LTSNR>
+                    <LTSBZ></LTSBZ>
+                </E1WYTTM>
+                <E1WYTTM SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <SPRAS></SPRAS>
+                    <LIFNR></LIFNR>
+                    <LTSNR></LTSNR>
+                    <LTSBZ></LTSBZ>
+                </E1WYTTM>
+            </E1WYT1M>
+            <E1WYT1M SEGMENT="1">
+                <MSGFN></MSGFN>
+                <LIFNR></LIFNR>
+                <LTSNR></LTSNR>
+                <ERNAM></ERNAM>
+                <ERDAT></ERDAT>
+                <SPRAS></SPRAS>
+                <LTSBZ></LTSBZ>
+                <E1WYTTM SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <SPRAS></SPRAS>
+                    <LIFNR></LIFNR>
+                    <LTSNR></LTSNR>
+                    <LTSBZ></LTSBZ>
+                </E1WYTTM>
+                <E1WYTTM SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <SPRAS></SPRAS>
+                    <LIFNR></LIFNR>
+                    <LTSNR></LTSNR>
+                    <LTSBZ></LTSBZ>
+                </E1WYTTM>
+                <E1WYTTM SEGMENT="1">
+                    <MSGFN></MSGFN>
+                    <SPRAS></SPRAS>
+                    <LIFNR></LIFNR>
+                    <LTSNR></LTSNR>
+                    <LTSBZ></LTSBZ>
+                </E1WYTTM>
+            </E1WYT1M>
+        </E1LFA1M>
+    </IDOC>
+
+</CREMAS01>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CREMAS01.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CREMAS01.xsd
new file mode 100644
index 00000000000..18d63291d62
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/CREMAS01.xsd
@@ -0,0 +1,3541 @@
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+   <xsd:element name="CREMAS01">
+      <xsd:complexType>
+         <xsd:sequence>
+            <xsd:element name="IDOC" type="CREMAS.CREMAS01" />
+         </xsd:sequence>
+      </xsd:complexType>
+   </xsd:element>
+   <xsd:complexType name="CREMAS01.E1LFA1M">
+      <xsd:annotation>
+         <xsd:documentation>
+         Segment for general vendor data
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:sequence>
+         <xsd:element name="MSGFN" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Function
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIFNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Account number of the vendor or creditor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ANRED" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Title
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="15" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BAHNS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Train station
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="25" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BBBNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               International location number  (part 1)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="7" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BBSNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               International location number (part 2)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="5" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BEGRU" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Authorization group
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BRSCH" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Industry key
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BUBKZ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Check digit for the international location number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="DATLT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Number of data communication line
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="14" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="DTAMS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator &apos;report to Central Bank&apos; for data medium exchange
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="DTAWS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Instruction key for data medium exchange
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ERDAT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Date on which the record was created
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="8" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ERNAM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Name of person who created object
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="12" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ESRNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               POR subscriber number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="11" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="KONZS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Group key
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="KTOKK" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Vendor account group
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="KUNNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Customer number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LAND1" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Country of company
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LNRZA" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Account number of the vendor or creditor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LOEVM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Central deletion flag for master record
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="NAME1" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Last name of employee
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="35" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="NAME2" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Last name of employee
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="35" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="NAME3" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Last name of employee
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="35" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="NAME4" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Last name of employee
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="35" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ORT01" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               City
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="35" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ORT02" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               District
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="35" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="PFACH" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Post office box
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="PSTL2" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Postal code
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="PSTLZ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Postal code
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="REGIO" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Region (State, Province, County)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SORTL" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Character field length = 10
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SPERR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Central posting block
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SPERM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Centrally imposed purchasing block
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SPRAS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Language keys
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="STCD1" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Tax number 1
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="16" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="STCD2" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Tax number 2
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="11" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="STKZA" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: Business partner subject to equalization tax ?
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="STKZU" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: Business partner subject to tax on sales/purch. ?
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="STRAS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Street and house number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="35" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="TELBX" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Telebox number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="15" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="TELF1" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               First telephone number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="16" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="TELF2" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Second telephone number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="16" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="TELFX" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Fax number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="31" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="TELTX" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Teletex number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="30" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="TELX1" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Telex number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="30" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="XCPDK" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: Is the account a one-time account?
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="XZEMP" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: Alternative payee in document allowed ?
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="VBUND" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Company ID of trading partner
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="FISKN" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Account number of the master record with fiscal address
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="STCEG" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               VAT registration number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="20" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="STKZN" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: Business partner a sole proprietor ?
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SPERQ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Functions that will be blocked
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ADRNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Address
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MCOD1" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Search string for matchcode usage
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="25" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MCOD2" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Search string for using matchcodes
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="25" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MCOD3" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Search string for matchcode usage
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="25" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="GBORT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Place of birth of the person subject to withholding tax
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="25" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="GBDAT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Date of birth
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="8" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SEXKZ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Key for the sex of the person subject to withholding tax
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="KRAUS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Credit information number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="11" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="REVDB" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Last review (external)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="8" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="QSSYS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Vendor&apos;s QM system
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="KTOCK" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Reference account group for one-time account (vendor)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="PFORT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               PO box city
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="35" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="WERKS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Plant
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LTSNA" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: vendor sub-range relevant
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="WERKR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: plant level relevant
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="PLKAL" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Factory calendar key
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="DUEFL" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Status of data transfer into subsequent release
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="TXJCD" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Jurisdiction for tax calculation - tax jurisdiction code
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="15" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="E1LFB1M" type="CREMAS01.E1LFB1M" minOccurs="0" maxOccurs="999" />
+         <xsd:element name="E1LFM1M" type="CREMAS01.E1LFM1M" minOccurs="0" maxOccurs="999" />
+         <xsd:element name="E1LFBKM" type="CREMAS01.E1LFBKM" minOccurs="0" maxOccurs="999" />
+         <xsd:element name="E1LFASM" type="CREMAS01.E1LFASM" minOccurs="0" maxOccurs="999" />
+         <xsd:element name="E1WYT1M" type="CREMAS01.E1WYT1M" minOccurs="0" maxOccurs="999" />
+      </xsd:sequence>
+      <xsd:attribute name="SEGMENT" type="xsd:string" fixed="1" use="required" />
+   </xsd:complexType>
+   <xsd:complexType name="CREMAS01.E1LFBKM">
+      <xsd:annotation>
+         <xsd:documentation>
+         Segment for bank details of vendor SMD
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:sequence>
+         <xsd:element name="MSGFN" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Function
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIFNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Account number of the vendor or creditor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BANKS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Bank country key
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BANKL" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Bank key
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="15" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BANKN" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Bank account number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="18" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BKONT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Bank control key
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BVTYP" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Partner bank type
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="XEZER" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: Is there collection authorization ?
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BANKA" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Name of the bank
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="60" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="PROVZ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Region (no longer used as of release 3.0D!!!)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="STRAS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Street (no longer used as of release 3.0D!!!)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="30" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ORT01" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Location
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="25" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SWIFT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               SWIFT code for international payments
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="11" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BGRUP" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Bank group (bank network)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="XPGRO" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Checkbox
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BNKLZ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Bank number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="15" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="PSKTO" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Post office bank current account number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="16" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BKREF" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Reference specifications for bank details
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="20" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BRNCH" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Bank branch
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="40" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="PROV2" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Region (State, Province, County)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="STRA2" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Street and house number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="35" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ORT02" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               City
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="35" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+      </xsd:sequence>
+      <xsd:attribute name="SEGMENT" type="xsd:string" fixed="1" use="required" />
+   </xsd:complexType>
+   <xsd:complexType name="CREMAS01.E1LFB5M">
+      <xsd:annotation>
+         <xsd:documentation>
+         Reminder data for vendor SMD
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:sequence>
+         <xsd:element name="MSGFN" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Function
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIFNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Account number of the vendor or creditor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BUKRS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Company code
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MABER" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Dunning area
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MAHNA" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Dunning procedure
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MANSP" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Dunning block
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MADAT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Last dunned on
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="8" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MAHNS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Character field of length 1
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LFRMA" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Account number of the dunning recipient
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="GMVDT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Date of the legal dunning proceedings
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="8" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BUSAB" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Accounting clerk
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+      </xsd:sequence>
+      <xsd:attribute name="SEGMENT" type="xsd:string" fixed="1" use="required" />
+   </xsd:complexType>
+   <xsd:complexType name="EDI_DC40.CREMAS.CREMAS01">
+      <xsd:sequence>
+         <xsd:element name="TABNAM" type="xsd:string" fixed="EDI_DC40">
+            <xsd:annotation>
+               <xsd:documentation>
+               TABNAM
+               </xsd:documentation>
+            </xsd:annotation>
+         </xsd:element>
+         <xsd:element name="MANDT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               MANDT
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="DOCNUM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               DOCNUM
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="16" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="DOCREL" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               DOCREL
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="STATUS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               STATUS
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="DIRECT">
+            <xsd:annotation>
+               <xsd:documentation>
+               DIRECT
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:enumeration value="1">
+                     <xsd:annotation>
+                        <xsd:documentation>
+                        Outbound
+                        </xsd:documentation>
+                     </xsd:annotation>
+                  </xsd:enumeration>
+                  <xsd:enumeration value="2">
+                     <xsd:annotation>
+                        <xsd:documentation>
+                        Inbound
+                        </xsd:documentation>
+                     </xsd:annotation>
+                  </xsd:enumeration>
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="OUTMOD" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               OUTMOD
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="EXPRSS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               EXPRSS
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="TEST" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               TEST
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="IDOCTYP" type="xsd:string" fixed="CREMAS01">
+            <xsd:annotation>
+               <xsd:documentation>
+               IDOCTYP
+               </xsd:documentation>
+            </xsd:annotation>
+         </xsd:element>
+         <xsd:element name="CIMTYP" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               CIMTYP
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="30" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MESTYP" type="xsd:string" fixed="CREMAS">
+            <xsd:annotation>
+               <xsd:documentation>
+               MESTYP
+               </xsd:documentation>
+            </xsd:annotation>
+         </xsd:element>
+         <xsd:element name="MESCOD" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               MESCOD
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MESFCT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               MESFCT
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="STD" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               STD
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="STDVRS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               STDVRS
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="STDMES" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               STDMES
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SNDPOR">
+            <xsd:annotation>
+               <xsd:documentation>
+               SNDPOR
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SNDPRT">
+            <xsd:annotation>
+               <xsd:documentation>
+               SNDPRT
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SNDPFC" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               SNDPFC
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SNDPRN">
+            <xsd:annotation>
+               <xsd:documentation>
+               SNDPRN
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SNDSAD" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               SNDSAD
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="21" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SNDLAD" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               SNDLAD
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="70" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="RCVPOR">
+            <xsd:annotation>
+               <xsd:documentation>
+               RCVPOR
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="RCVPRT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               RCVPRT
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="RCVPFC" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               RCVPFC
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="RCVPRN">
+            <xsd:annotation>
+               <xsd:documentation>
+               RCVPRN
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="RCVSAD" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               RCVSAD
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="21" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="RCVLAD" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               RCVLAD
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="70" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="CREDAT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               CREDAT
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="8" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="CRETIM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               CRETIM
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="REFINT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               REFINT
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="14" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="REFGRP" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               REFGRP
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="14" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="REFMES" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               REFMES
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="14" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ARCKEY" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               ARCKEY
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="70" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SERIAL" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               SERIAL
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="20" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+      </xsd:sequence>
+      <xsd:attribute name="SEGMENT" type="xsd:string" fixed="1" use="required" />
+   </xsd:complexType>
+   <xsd:complexType name="CREMAS01.E1LFASM">
+      <xsd:annotation>
+         <xsd:documentation>
+         Segment for EU tax numbers vendors
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:sequence>
+         <xsd:element name="MSGFN" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Function
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIFNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Account number of the vendor or creditor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LAND1" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Country key
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="STCEG" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               VAT registration number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="20" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+      </xsd:sequence>
+      <xsd:attribute name="SEGMENT" type="xsd:string" fixed="1" use="required" />
+   </xsd:complexType>
+   <xsd:complexType name="CREMAS01.E1WYTTM">
+      <xsd:annotation>
+         <xsd:documentation>
+         Segment for vendor sub-range identification SMD
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:sequence>
+         <xsd:element name="MSGFN" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Function
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SPRAS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Language keys
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIFNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Account number of the vendor or creditor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LTSNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Vendor sub-range
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LTSBZ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Description
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="20" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+      </xsd:sequence>
+      <xsd:attribute name="SEGMENT" type="xsd:string" fixed="1" use="required" />
+   </xsd:complexType>
+   <xsd:complexType name="CREMAS01.E1LFM2M">
+      <xsd:annotation>
+         <xsd:documentation>
+         Segment purchasing data for vendor MMS SMD
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:sequence>
+         <xsd:element name="MSGFN" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Function
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIFNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Account number of the vendor or creditor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="EKORG" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Purchasing organization
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LTSNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Vendor sub-range
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="WERKS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Plant
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ERDAT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Date on which the record was created
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="8" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ERNAM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Name of person who created object
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="12" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SPERM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Purchasing block at purchasing organization level
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LOEVM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Deletion indicator
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LFABC" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               ABC indicator
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="WAERS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Purchase order currency
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="13" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="VERKF" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Responsible salesperson at vendor&apos;s office
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="30" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="TELF1" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Vendor&apos;s telephone number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="16" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MINBW" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Minimum order value
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="13" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ZTERM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Terms of payment key
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="INCO1" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Incoterms (part 1)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="INCO2" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Incoterms (part 2)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="28" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="WEBRE" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: GR-based invoice verification
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="KZABS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: acknowledgment required
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="KALSK" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Group for calculation schema (vendor)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="KZAUT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Automatic generation of purchase order allowed
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="EXPVZ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Mode of transport (when goods cross border)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ZOLLA" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Customs office
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MEPRF" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Pricing date control
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="EKGRP" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Purchasing group
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BOLRE" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: vendor subject to subseq. settlement accounting
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="UMSAE" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Comparison/agreement of business volumes necessary
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="XERSY" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Evaluated receipt settlement (ERS)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="PLIFZ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Planned delivery time in days
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="5" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MRPPP" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Planning calendar
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LFRHY" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Planning cycle
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIEFR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Delivery cycle
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIBES" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Purchase order entry: vendor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIPRE" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Price marking, vendor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LISER" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Rack-jobbing: vendor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="DISPO" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               MRP controller
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+      </xsd:sequence>
+      <xsd:attribute name="SEGMENT" type="xsd:string" fixed="1" use="required" />
+   </xsd:complexType>
+   <xsd:complexType name="CREMAS01.E1LFB1M">
+      <xsd:annotation>
+         <xsd:documentation>
+         Segment for company code data for vendors SMD
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:sequence>
+         <xsd:element name="MSGFN" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Function
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIFNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Account number of the vendor or creditor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BUKRS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Company code
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ERDAT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Date on which the record was created
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="8" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ERNAM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Name of person who created object
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="12" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SPERR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Posting block for company code
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LOEVM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Deletion flag for master record (company code level)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ZUAWA" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Key for sorting according to allocation numbers
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="AKONT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Reconciliation account in general ledger
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BEGRU" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Authorization group
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="VZSKZ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Interest calculation indicator
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ZWELS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               List of the payment methods to be considered
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="XVERR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: Clearing between customer and vendor?
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ZAHLS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Block key for payment
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ZTERM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Terms of payment key
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="EIKTO" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Our account number at the customer or vendor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="12" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ZSABE" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               User at vendor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="15" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="KVERM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Memo
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="30" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="FDGRV" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Planning group
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BUSAB" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Accounting clerk
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LNRZE" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Head office account number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LNRZB" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Account number of the alternative payee
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ZINDT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Key date of the last interest calculation
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="8" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ZINRT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Interest calculation frequency in months
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="8" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="DATLZ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Date of the last interest calculation run
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="8" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="XDEZV" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: local processing?
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="WEBTR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Bill of exchange limit (in local currency)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="15" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="KULTG" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Probable time until check is paid
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="REPRF" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Check flag for double invoices or credit memos
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="TOGRU" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Tolerance group for the business partner
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="HBKID" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Short key for a house bank
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="5" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="XPORE" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: Pay all items separately ?
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="QSZNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Certificate number of the withholding tax exemption
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="QSZDT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Validity date for withholding tax exemption certificate
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="8" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="QSSKZ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Withholding tax code
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BLNKZ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Subsidy indicator for determining the reduction rates
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MINDK" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Minority indicators
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ALTKN" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Previous master record number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ZGRUP" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Key for payment grouping
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MGRUP" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Key for dunning notice grouping
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="UZAWE" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Payment method supplement
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="QSREC" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Vendor recipient type
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="QSBGR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Authority for exemption from withholding tax
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="QLAND" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Withholding tax country key
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="XEDIP" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: send payment advices by EDI
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="FRGRP" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Release approval group
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="TLFXS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Accounting clerk&apos;s fax number at the customer/vendor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="31" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="E1LFB5M" type="CREMAS01.E1LFB5M" minOccurs="0" maxOccurs="999" />
+      </xsd:sequence>
+      <xsd:attribute name="SEGMENT" type="xsd:string" fixed="1" use="required" />
+   </xsd:complexType>
+   <xsd:complexType name="CREMAS01.E1LFM1M">
+      <xsd:annotation>
+         <xsd:documentation>
+         Segment for purchasing organization data vendor SMD
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:sequence>
+         <xsd:element name="MSGFN" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Function
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIFNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Vendor&apos;s account number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="EKORG" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Purchasing organization
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ERDAT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Date on which the record was created
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="8" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ERNAM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Name of person who created object
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="12" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SPERM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Purchasing block at purchasing organization level
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LOEVM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Delete flag for vendor at purchasing level
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LFABC" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               ABC indicator
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="WAERS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Purchase order currency
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="5" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="VERKF" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Responsible salesperson at vendor&apos;s office
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="30" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="TELF1" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Vendor&apos;s telephone number
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="16" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MINBW" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Minimum order value
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="13" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ZTERM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Terms of payment key
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="INCO1" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Incoterms (part 1)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="INCO2" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Incoterms (part 2)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="28" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="WEBRE" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: GR-based invoice verification
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="KZABS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: acknowledgment required
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="KALSK" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Group for calculation schema (vendor)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="KZAUT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Automatic generation of purchase order allowed
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="EXPVZ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Mode of transport (when goods cross border)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ZOLLA" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Customs office
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MEPRF" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Pricing date control
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="EKGRP" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Purchasing group
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BOLRE" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: vendor subject to subseq. settlement accounting
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="UMSAE" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Comparison/agreement of business volumes necessary
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="XERSY" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Evaluated receipt settlement (ERS)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="PLIFZ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Planned delivery time in days
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="5" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="MRPPP" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Planning calendar
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LFRHY" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Planning cycle
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIEFR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Delivery cycle
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="4" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIBES" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Purchase order entry: vendor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIPRE" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Price marking, vendor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LISER" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Rack-jobbing: vendor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="BOIND" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Indicator: index compilation for subseq. settlement active
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="E1LFM2M" type="CREMAS01.E1LFM2M" minOccurs="0" maxOccurs="999" />
+         <xsd:element name="E1WYT3M" type="CREMAS01.E1WYT3M" minOccurs="0" maxOccurs="999" />
+      </xsd:sequence>
+      <xsd:attribute name="SEGMENT" type="xsd:string" fixed="1" use="required" />
+   </xsd:complexType>
+   <xsd:complexType name="CREMAS01.E1WYT1M">
+      <xsd:annotation>
+         <xsd:documentation>
+         Segment for vendor sub-range MMS SMD
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:sequence>
+         <xsd:element name="MSGFN" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Function
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIFNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Account number of the vendor or creditor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LTSNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Vendor sub-range
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ERNAM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Name of person who created object
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="12" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ERDAT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Date on which the record was created
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="8" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="SPRAS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Language keys
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LTSBZ" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Description
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="20" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="E1WYTTM" type="CREMAS01.E1WYTTM" minOccurs="0" maxOccurs="999" />
+      </xsd:sequence>
+      <xsd:attribute name="SEGMENT" type="xsd:string" fixed="1" use="required" />
+   </xsd:complexType>
+   <xsd:complexType name="CREMAS.CREMAS01">
+      <xsd:annotation>
+         <xsd:documentation>
+         Vendor master data distribution ALE
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:sequence>
+         <xsd:element name="EDI_DC40" type="EDI_DC40.CREMAS.CREMAS01" />
+         <xsd:element name="E1LFA1M" type="CREMAS01.E1LFA1M" />
+      </xsd:sequence>
+      <xsd:attribute name="BEGIN" type="xsd:string" fixed="1" use="required" />
+   </xsd:complexType>
+   <xsd:complexType name="CREMAS01.E1WYT3M">
+      <xsd:annotation>
+         <xsd:documentation>
+         Segment for addresses of vendors MMS SMD
+         </xsd:documentation>
+      </xsd:annotation>
+      <xsd:sequence>
+         <xsd:element name="MSGFN" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Function
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIFNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Account number of the vendor or creditor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="EKORG" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Purchasing organization
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LTSNR" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Vendor sub-range
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="WERKS" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Plant
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="6" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="PARVW" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Partner function ID (e.g. SH for ship-to party)
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="2" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="PARZA" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Partner counter
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="3" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ERNAM" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Name of person who created object
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="12" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="ERDAT" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Date on which the record was created
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="8" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="LIFN2" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Reference to other vendor
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="10" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+         <xsd:element name="DEFPA" minOccurs="0">
+            <xsd:annotation>
+               <xsd:documentation>
+               Default partner
+               </xsd:documentation>
+            </xsd:annotation>
+            <xsd:simpleType>
+               <xsd:restriction base="xsd:string">
+                  <xsd:maxLength value="1" />
+               </xsd:restriction>
+            </xsd:simpleType>
+         </xsd:element>
+      </xsd:sequence>
+      <xsd:attribute name="SEGMENT" type="xsd:string" fixed="1" use="required" />
+   </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ErrorHandlerImpl.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ErrorHandlerImpl.java
new file mode 100644
index 00000000000..6fbd8570d88
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ErrorHandlerImpl.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class ErrorHandlerImpl implements ErrorHandler {
+   /** Creates a new instance of ErrorHandlerImpl */
+    public ErrorHandlerImpl() {
+    }
+
+    public void error(SAXParseException sAXParseException) throws SAXException {
+        throw new SAXException(sAXParseException);
+    }
+
+    public void fatalError(SAXParseException sAXParseException) throws SAXException {
+        throw new SAXException(sAXParseException);
+    }
+
+    public void warning(SAXParseException sAXParseException) throws SAXException {
+        throw new SAXException(sAXParseException);
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682.xml
new file mode 100644
index 00000000000..fe4f3df7e3e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+
+<root xmlns="http://unique/test"
+xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+xsi:schemaLocation="http://unique/test unique.xsd">
+
+    <node>
+        <module name="test2"/>
+    </node>
+
+    <node name="router">
+        <module name="test1"/>
+    </node>
+
+</root>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682.xsd
new file mode 100644
index 00000000000..279b01f7de5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0"?>
+
+<xsd:schema xmlns:ipm="http://unique/test"
+xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+targetNamespace="http://unique/test"
+elementFormDefault="qualified">
+
+<xsd:element name="root">
+    <xsd:complexType>
+        <xsd:sequence>
+            <xsd:element ref="ipm:node" minOccurs="0" maxOccurs="unbounded"/>
+        </xsd:sequence>
+    </xsd:complexType>
+    <xsd:unique name="uniqueNode">
+        <xsd:selector xpath="ipm:node"/>
+        <xsd:field xpath="@name"/>
+        <xsd:field xpath="ipm:module/@name"/>
+    </xsd:unique>
+</xsd:element>
+
+<xsd:element name="node">
+    <xsd:complexType>
+        <xsd:sequence>
+            <xsd:element name="module" minOccurs="0" maxOccurs="1">
+                <xsd:complexType>
+                    <xsd:attribute name="name" type="xsd:string"/>
+                </xsd:complexType>
+            </xsd:element>
+        </xsd:sequence>
+        <xsd:attribute name="name" type="xsd:string"/>
+    </xsd:complexType>
+</xsd:element>
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682Test.java
new file mode 100644
index 00000000000..9301f3bd6b8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Issue682Test.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+import java.io.InputStream;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import org.xml.sax.InputSource;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @summary Test comination of fields in <xsd:unique>, for https://issues.apache.org/jira/browse/XERCESJ-682.
+ */
+public class Issue682Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    File testFile = new File(getClass().getResource("Issue682.xsd").getFile());
+
+    @Test
+    public void test() {
+        try {
+            Schema schema = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema").newSchema(new StreamSource(testFile));
+            SAXParserFactory saxParserFactory = SAXParserFactory.newInstance();
+            saxParserFactory.setNamespaceAware(true);
+            saxParserFactory.setSchema(schema);
+            // saxParserFactory.setFeature("http://java.sun.com/xml/schema/features/report-ignored-element-content-whitespace",
+            // true);
+            SAXParser saxParser = saxParserFactory.newSAXParser();
+            XMLReader xmlReader = saxParser.getXMLReader();
+            xmlReader.setContentHandler(new DefaultHandler());
+            // InputStream input =
+            // ClassLoader.getSystemClassLoader().getResourceAsStream("test/test.xml");
+            InputStream input = getClass().getResourceAsStream("Issue682.xml");
+            System.out.println("Parse InputStream:");
+            xmlReader.parse(new InputSource(input));
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail(ex.toString());
+        }
+
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30.java
new file mode 100644
index 00000000000..afde0f092a4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30.java
@@ -0,0 +1,128 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test maxOccurs validation.
+ */
+public class IssueTracker30 {
+
+    boolean errorFound;
+
+    @Test
+    public void testMaxOccursErrorNoOptimization() throws Exception {
+
+        // Parsing this document should result in an error
+        try {
+                if (!testMaxOccurs("IssueTracker30_occurs-error.xml", "IssueTracker30_occurs.xsd"))
+                        Assert.fail("Expected validation error not reported");
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage(), ex);
+        }
+    }
+
+    @Test
+    public void testMaxOccursOKNoOptimization() throws Exception {
+
+        // Parsing this document should *not* result in an error
+        try {
+                if (testMaxOccurs("IssueTracker30_occurs-ok.xml", "IssueTracker30_occurs.xsd"))
+                        Assert.fail("Unexpected validation error reported");
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage(), ex);
+        }
+    }
+
+    @Test
+    public void testMaxOccursErrorOptimization() throws Exception {
+
+        // Parsing this document should result in an error
+        try {
+                if (!testMaxOccurs("IssueTracker30_occurs-optimize-error.xml", "IssueTracker30_occurs-optimize.xsd"))
+                        Assert.fail("Expected validation error not reported");
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage(), ex);
+        }
+    }
+
+    @Test
+    public void testMaxOccursOKOptimization() throws Exception {
+
+        // Parsing this document should *not* result in an error
+        try {
+                if (testMaxOccurs("IssueTracker30_occurs-optimize-ok.xml", "IssueTracker30_occurs-optimize.xsd"))
+                        Assert.fail("Unexpected validation error reported");
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage(), ex);
+        }
+    }
+
+
+    private boolean testMaxOccurs(String xmlFileName, String xsdFileName) throws Exception {
+        File xmlFile = new File(getClass().getResource(xmlFileName).getFile());
+
+        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Schema schema = factory.newSchema(new File(getClass().getResource(xsdFileName).getFile()));
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setSchema(schema);
+
+        DocumentBuilder documentBuilder = dbf.newDocumentBuilder();
+        documentBuilder.setErrorHandler(new ErrorHandler() {
+            public void error(SAXParseException e) throws SAXException {
+                System.out.println("Error: " + e.getMessage());
+                errorFound = true;
+            }
+
+            public void fatalError(SAXParseException e) throws SAXException {
+                System.out.println("Fatal error: " + e.getMessage());
+                throw e;
+            }
+
+            public void warning(SAXParseException e) throws SAXException {
+                System.out.println("Warning: " + e.getMessage());
+            }
+        });
+
+        errorFound = false;
+        documentBuilder.parse(xmlFile);
+        return errorFound;
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-error.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-error.xml
new file mode 100644
index 00000000000..b987f12d68d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-error.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <child_name>Cecilie</child_name>
+    </person>
+    <person>
+        <full_name>Tove Refsnes</full_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Jim</child_name>
+        <child_name>Borge</child_name>
+    </person>
+    <person>
+        <full_name>Stale Refsnes</full_name>
+    </person>
+</persons>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-ok.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-ok.xml
new file mode 100644
index 00000000000..1c74eb70f4d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-ok.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <child_name>Cecilie</child_name>
+    </person>
+    <person>
+        <full_name>Tove Refsnes</full_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Jim</child_name>
+    </person>
+    <person>
+        <full_name>Stale Refsnes</full_name>
+    </person>
+</persons>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize-error.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize-error.xml
new file mode 100644
index 00000000000..5e1b1eac0b2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize-error.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Jim</child_name>
+        <child_name>Borge</child_name>
+    </person>
+</persons>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize-ok.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize-ok.xml
new file mode 100644
index 00000000000..00cb274e909
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize-ok.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Jim</child_name>
+    </person>
+</persons>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize.xsd
new file mode 100644
index 00000000000..e77fc023340
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs-optimize.xsd
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+    
+    <xs:element name="persons">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="person" maxOccurs="unbounded">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="child_name" type="xs:string" minOccurs="0"
+                                        maxOccurs="3"/>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs.xsd
new file mode 100644
index 00000000000..a1a8ca39381
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/IssueTracker30_occurs.xsd
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+    
+    <xs:element name="persons">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="person" maxOccurs="unbounded">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="full_name" type="xs:string"/>
+                            <xs:element name="child_name" type="xs:string" minOccurs="0"
+                                        maxOccurs="3"/>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue43Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue43Test.java
new file mode 100644
index 00000000000..5a451ca7a6e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue43Test.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.FileInputStream;
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+/*
+ * @bug 6631318
+ * @summary Test creating schema from a DOM fragment with namespace.
+ */
+public class JaxpIssue43Test {
+
+    @Test
+    public void test() throws Exception {
+        SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Source[] sources = getSchemaSources();
+        Schema schema = sf.newSchema(sources);
+        Validator validator = schema.newValidator();
+    }
+
+    private Source[] getSchemaSources() throws Exception {
+        List<Source> list = new ArrayList<Source>();
+        String file = getClass().getResource("hello_literal.wsdl").getFile();
+        Source source = new StreamSource(new FileInputStream(file), file);
+
+        Transformer trans = TransformerFactory.newInstance().newTransformer();
+        DOMResult result = new DOMResult();
+        trans.transform(source, result);
+
+        // Look for <xsd:schema> element in wsdl
+        Element e = ((Document) result.getNode()).getDocumentElement();
+        NodeList typesList = e.getElementsByTagNameNS("http://schemas.xmlsoap.org/wsdl/", "types");
+        NodeList schemaList = ((Element) typesList.item(0)).getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "schema");
+        Element elem = (Element) schemaList.item(0);
+        list.add(new DOMSource(elem, file + "#schema0"));
+
+        // trans.transform(new DOMSource(elem), new StreamResult(System.out));
+
+        return list.toArray(new Source[list.size()]);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue49.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue49.java
new file mode 100644
index 00000000000..85522e9503d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue49.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.FileInputStream;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMResult;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamResult;
+import javax.xml.transform.stream.StreamSource;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Node;
+
+/*
+ * @bug 6684227
+ * @summary Test property current-element-node works.
+ */
+public class JaxpIssue49 {
+
+    private Schema schema;
+    private Validator validator;
+
+    @Test
+    public void testValidatorTest() throws Exception {
+        try {
+            SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            String file = getClass().getResource("types.xsd").getFile();
+            Source[] sources = new Source[] { new StreamSource(new FileInputStream(file), file) };
+            Schema schema = sf.newSchema(sources);
+            validator = schema.newValidator();
+            validate();
+        } catch (Exception e) {
+            Node node = (Node) validator.getProperty("http://apache.org/xml/properties/dom/current-element-node");
+            if (node != null) {
+                System.out.println("Node: " + node.getLocalName());
+            } else
+                Assert.fail("No node returned");
+        }
+    }
+
+    public void validate() throws Exception {
+        validator.reset();
+        Source source = new StreamSource(getClass().getResourceAsStream("JaxpIssue49.xml"));
+        // If you comment the following line, it works
+        source = toDOMSource(source);
+        validator.validate(source);
+    }
+
+    DOMSource toDOMSource(Source source) throws Exception {
+        if (source instanceof DOMSource) {
+            return (DOMSource) source;
+        }
+        Transformer trans = TransformerFactory.newInstance().newTransformer();
+        DOMResult result = new DOMResult();
+        trans.transform(source, result);
+        trans.transform(new DOMSource(result.getNode()), new StreamResult(System.out));
+        return new DOMSource(result.getNode());
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue49.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue49.xml
new file mode 100644
index 00000000000..f4b8398f19b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/JaxpIssue49.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<ns1:getSedansResponse xmlns:ns1="http://server.type_substitution.fromjava/">
+    <return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:toyota">
+        <make>Toyota</make><model>Camry</model><year>1998</year><color>white</color>
+    </return>
+    <!-- specify wrong xsi type to introduce a validation error -->
+    <return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="ns1:car">
+        <make>Toyota</make><model>Corolla</model><year>1999</year><color>red</color>
+    </return>
+</ns1:getSedansResponse>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/LargeMaxOccursTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/LargeMaxOccursTest.java
new file mode 100644
index 00000000000..4a4e06235d2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/LargeMaxOccursTest.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test Validator shall report error for maxOccurs > 5000 when FEATURE_SECURE_PROCESSING is on, except the schema can be applied for constant-space algorithm.
+ */
+public class LargeMaxOccursTest {
+
+    @Test
+    public void testParticlesR005() {
+        try {
+            SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            String xsdFile = "particlesR005.xsd";
+            Schema schema = sf.newSchema(new File(getClass().getResource(xsdFile).toURI()));
+            Validator validator = schema.newValidator();
+        } catch (Exception ex) {
+            return; // expected
+        }
+        Assert.fail("Parser configuration error expected since maxOccurs > 5000 " + "and constant-space optimization does not apply");
+    }
+
+    @Test
+    public void testParticlesIe003() {
+        try {
+            SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            String xsdFile = "particlesIe003.xsd";
+            Schema schema = sf.newSchema(new File(getClass().getResource(xsdFile).toURI()));
+            Validator validator = schema.newValidator();
+        } catch (Exception ex) {
+            return; // expected
+        }
+        Assert.fail("Parser configuration error expected since maxOccurs > 5000 " + "and constant-space optimization does not apply");
+    }
+
+    @Test
+    public void testmgG014() {
+        try {
+            SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            String xsdFile = "mgG014.xsd";
+            Schema schema = sf.newSchema(new File(getClass().getResource(xsdFile).toURI()));
+            Validator validator = schema.newValidator();
+        } catch (Exception ex) {
+            return; // expected
+        }
+        Assert.fail("Parser configuration error expected since maxOccurs > 5000 " + "and constant-space optimization does not apply");
+    }
+
+    @Test
+    public void testmgJ014() {
+        try {
+            SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            String xsdFile = "mgJ014.xsd";
+            Schema schema = sf.newSchema(new File(getClass().getResource(xsdFile).toURI()));
+            Validator validator = schema.newValidator();
+        } catch (Exception ex) {
+            return; // expected
+        }
+        Assert.fail("Parser configuration error expected since maxOccurs > 5000 " + "and constant-space optimization does not apply");
+    }
+
+    // particlesOptimize.xsd missing.
+    @Test
+    public void testParticlesOptimize() {
+        try {
+            SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            String xsdFile = "particlesOptimize.xsd";
+            Schema schema = sf.newSchema(new File(getClass().getResource(xsdFile).toURI()));
+            Validator validator = schema.newValidator();
+        } catch (Exception ex) {
+            Assert.fail("Parser configuration error not expected since maxOccurs " + "> 5000 but constant-space optimization applies");
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/MultiOccursTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/MultiOccursTest.java
new file mode 100644
index 00000000000..7f0dbddebee
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/MultiOccursTest.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class MultiOccursTest {
+
+    boolean errorFound;
+
+    DocumentBuilder documentBuilder;
+
+    private void printMethodName() {
+        StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+        System.out.println(stack[2].getMethodName());
+    }
+
+    public MultiOccursTest() throws Exception {
+        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Schema schema = factory.newSchema(new File(getClass().getResource("multi-occurs.xsd").getFile()));
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setSchema(schema);
+
+        documentBuilder = dbf.newDocumentBuilder();
+        documentBuilder.setErrorHandler(new ErrorHandler() {
+            public void error(SAXParseException e) throws SAXException {
+                System.out.println("Error: " + e.getMessage());
+                errorFound = true;
+            }
+
+            public void fatalError(SAXParseException e) throws SAXException {
+                System.out.println("Fatal error: " + e.getMessage());
+            }
+
+            public void warning(SAXParseException e) throws SAXException {
+                System.out.println("Warning: " + e.getMessage());
+            }
+        });
+    }
+
+    @Test
+    public void testMultiOccursMaxMinOk() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("multi-occurs-ok.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (errorFound) {
+            Assert.fail("Unexpected validation error reported");
+        }
+    }
+
+    @Test
+    public void testMultiOccursMaxMinErrorMin() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("multi-occurs-error-min.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (!errorFound) {
+            Assert.fail("Expected validation error not reported");
+        }
+    }
+
+    @Test
+    public void testMultiOccursMaxMinErrorMax() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("multi-occurs-error-max.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (!errorFound) {
+            Assert.fail("Expected validation error not reported");
+        }
+    }
+
+    @Test
+    public void testMultiOccursMaxMinErrorMinMax() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("multi-occurs-error-min-max.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (!errorFound) {
+            Assert.fail("Expected validation error not reported");
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/MultiOccursUnboundedTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/MultiOccursUnboundedTest.java
new file mode 100644
index 00000000000..8d7d5163756
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/MultiOccursUnboundedTest.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class MultiOccursUnboundedTest {
+
+    boolean errorFound;
+
+    DocumentBuilder documentBuilder;
+
+    private void printMethodName() {
+        StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+        System.out.println(stack[2].getMethodName());
+    }
+
+    public MultiOccursUnboundedTest() throws Exception {
+        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Schema schema = factory.newSchema(new File(getClass().getResource("multi-occurs-unbounded.xsd").getFile()));
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setSchema(schema);
+
+        documentBuilder = dbf.newDocumentBuilder();
+        documentBuilder.setErrorHandler(new ErrorHandler() {
+            public void error(SAXParseException e) throws SAXException {
+                System.out.println("Error: " + e.getMessage());
+                errorFound = true;
+            }
+
+            public void fatalError(SAXParseException e) throws SAXException {
+                System.out.println("Fatal error: " + e.getMessage());
+            }
+
+            public void warning(SAXParseException e) throws SAXException {
+                System.out.println("Warning: " + e.getMessage());
+            }
+        });
+    }
+
+    @Test
+    public void testMultiOccursMaxMinOk() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("multi-occurs-unbounded-ok.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (errorFound) {
+            Assert.fail("Unexpected validation error reported");
+        }
+    }
+
+    @Test
+    public void testMultiOccursMaxMinErrorMin() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("multi-occurs-unbounded-error-min.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (!errorFound) {
+            Assert.fail("Expected validation error not reported");
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursTest.java
new file mode 100644
index 00000000000..be3ed12bf0f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursTest.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class OccursTest {
+
+    boolean errorFound;
+
+    DocumentBuilder documentBuilder;
+
+    private void printMethodName() {
+        StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+        System.out.println(stack[2].getMethodName());
+    }
+
+    public OccursTest() throws Exception {
+        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Schema schema = factory.newSchema(new File(getClass().getResource("occurs.xsd").getFile()));
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setSchema(schema);
+
+        documentBuilder = dbf.newDocumentBuilder();
+        documentBuilder.setErrorHandler(new ErrorHandler() {
+            public void error(SAXParseException e) throws SAXException {
+                System.out.println("Error: " + e.getMessage());
+                errorFound = true;
+            }
+
+            public void fatalError(SAXParseException e) throws SAXException {
+                System.out.println("Fatal error: " + e.getMessage());
+            }
+
+            public void warning(SAXParseException e) throws SAXException {
+                System.out.println("Warning: " + e.getMessage());
+            }
+        });
+    }
+
+    @Test
+    public void testOccursMaxMinOk() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("occurs-ok.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (errorFound) {
+            Assert.fail("Unexpected validation error reported");
+        }
+    }
+
+    @Test
+    public void testOccursMaxMinErrorMin() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("occurs-error-min.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (!errorFound) {
+            Assert.fail("Expected validation error not reported");
+        }
+    }
+
+    @Test
+    public void testOccursMaxMinErrorMax() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("occurs-error-max.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (!errorFound) {
+            Assert.fail("Expected validation error not reported");
+        }
+    }
+
+    @Test
+    public void testOccursMaxMinErrorMinMax() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("occurs-error-min-max.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (!errorFound) {
+            Assert.fail("Expected validation error not reported");
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursUnboundedTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursUnboundedTest.java
new file mode 100644
index 00000000000..47d1ba9af91
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursUnboundedTest.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class OccursUnboundedTest {
+
+    boolean errorFound;
+
+    DocumentBuilder documentBuilder;
+
+    private void printMethodName() {
+        StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+        System.out.println(stack[2].getMethodName());
+    }
+
+    public OccursUnboundedTest() throws Exception {
+        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Schema schema = factory.newSchema(new File(getClass().getResource("occurs-unbounded.xsd").getFile()));
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setSchema(schema);
+
+        documentBuilder = dbf.newDocumentBuilder();
+        documentBuilder.setErrorHandler(new ErrorHandler() {
+            public void error(SAXParseException e) throws SAXException {
+                System.out.println("Error: " + e.getMessage());
+                errorFound = true;
+            }
+
+            public void fatalError(SAXParseException e) throws SAXException {
+                System.out.println("Fatal error: " + e.getMessage());
+            }
+
+            public void warning(SAXParseException e) throws SAXException {
+                System.out.println("Warning: " + e.getMessage());
+            }
+        });
+    }
+
+    @Test
+    public void testOccursUnboundedMaxMinOk() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("occurs-unbounded-ok.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (errorFound) {
+            Assert.fail("Unexpected validation error reported");
+        }
+    }
+
+    @Test
+    public void testOccursUnboundedMaxMinErrorMin() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("occurs-unbounded-error-min.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (!errorFound) {
+            Assert.fail("Expected validation error not reported");
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursWildcardTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursWildcardTest.java
new file mode 100644
index 00000000000..36b21cdf8bd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursWildcardTest.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class OccursWildcardTest {
+
+    boolean errorFound;
+
+    DocumentBuilder documentBuilder;
+
+    private void printMethodName() {
+        StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+        System.out.println(stack[2].getMethodName());
+    }
+
+    public OccursWildcardTest() throws Exception {
+        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Schema schema = factory.newSchema(new File(getClass().getResource("occurs-wildcard.xsd").getFile()));
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setSchema(schema);
+
+        documentBuilder = dbf.newDocumentBuilder();
+        documentBuilder.setErrorHandler(new ErrorHandler() {
+            public void error(SAXParseException e) throws SAXException {
+                System.out.println("Error: " + e.getMessage());
+                errorFound = true;
+            }
+
+            public void fatalError(SAXParseException e) throws SAXException {
+                System.out.println("Fatal error: " + e.getMessage());
+            }
+
+            public void warning(SAXParseException e) throws SAXException {
+                System.out.println("Warning: " + e.getMessage());
+            }
+        });
+    }
+
+    @Test
+    public void testOccursMaxMinOk() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("occurs-ok.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (errorFound) {
+            Assert.fail("Unexpected validation error reported");
+        }
+    }
+
+    @Test
+    public void testOccursMaxMinErrorMin() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("occurs-error-min.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (!errorFound) {
+            Assert.fail("Expected validation error not reported");
+        }
+    }
+
+    @Test
+    public void testOccursMaxMinErrorMax() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("occurs-error-max.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (!errorFound) {
+            Assert.fail("Expected validation error not reported");
+        }
+    }
+
+    @Test
+    public void testOccursMaxMinErrorMinMax() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("occurs-error-min-max.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (!errorFound) {
+            Assert.fail("Expected validation error not reported");
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursWildcardUnbounded.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursWildcardUnbounded.java
new file mode 100644
index 00000000000..e11fa92fd47
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/OccursWildcardUnbounded.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class OccursWildcardUnbounded {
+
+    boolean errorFound;
+
+    DocumentBuilder documentBuilder;
+
+    private void printMethodName() {
+        StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+        System.out.println(stack[2].getMethodName());
+    }
+
+    public OccursWildcardUnbounded() throws Exception {
+        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Schema schema = factory.newSchema(new File(getClass().getResource("occurs-wildcard-unbounded.xsd").getFile()));
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setSchema(schema);
+
+        documentBuilder = dbf.newDocumentBuilder();
+        documentBuilder.setErrorHandler(new ErrorHandler() {
+            public void error(SAXParseException e) throws SAXException {
+                System.out.println("Error: " + e.getMessage());
+                errorFound = true;
+            }
+
+            public void fatalError(SAXParseException e) throws SAXException {
+                System.out.println("Fatal error: " + e.getMessage());
+            }
+
+            public void warning(SAXParseException e) throws SAXException {
+                System.out.println("Warning: " + e.getMessage());
+            }
+        });
+    }
+
+    @Test
+    public void testOccursUnboundedMaxMinOk() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("occurs-unbounded-ok.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (errorFound) {
+            Assert.fail("Unexpected validation error reported");
+        }
+    }
+
+    @Test
+    public void testOccursUnboundedMaxMinErrorMin() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("occurs-unbounded-error-min.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (!errorFound) {
+            Assert.fail("Expected validation error not reported");
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesId005Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesId005Test.java
new file mode 100644
index 00000000000..429ea2d9d83
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesId005Test.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class ParticlesId005Test {
+
+    boolean errorFound;
+
+    DocumentBuilder documentBuilder;
+
+    private void printMethodName() {
+        StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+        System.out.println(stack[2].getMethodName());
+    }
+
+    public ParticlesId005Test() throws Exception {
+        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Schema schema = factory.newSchema(new File(getClass().getResource("particlesId005.xsd").getFile()));
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setSchema(schema);
+
+        documentBuilder = dbf.newDocumentBuilder();
+        documentBuilder.setErrorHandler(new ErrorHandler() {
+            public void error(SAXParseException e) throws SAXException {
+                System.out.println("Error: " + e.getMessage());
+                errorFound = true;
+            }
+
+            public void fatalError(SAXParseException e) throws SAXException {
+                System.out.println("Fatal error: " + e.getMessage());
+            }
+
+            public void warning(SAXParseException e) throws SAXException {
+                System.out.println("Warning: " + e.getMessage());
+            }
+        });
+    }
+
+    @Test
+    public void testNoOptimizationWithChoice() throws Exception {
+        printMethodName();
+
+        File xmlFile = new File(getClass().getResource("particlesId005.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (errorFound) {
+            Assert.fail("Unexpected validation error reported");
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesIg004Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesIg004Test.java
new file mode 100644
index 00000000000..c1618505e34
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesIg004Test.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @summary Test particlesIg004.xsd.
+ */
+public class ParticlesIg004Test {
+
+    @Test
+    public void testParticleslg004() {
+        try {
+            SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            String xsdFile = "particlesIg004.xsd";
+            Schema schema = sf.newSchema(new File(getClass().getResource(xsdFile).toURI()));
+            Validator validator = schema.newValidator();
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail(ex.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesQ013Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesQ013Test.java
new file mode 100644
index 00000000000..ef589d13847
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ParticlesQ013Test.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+/*
+ * @summary Test Schema Validator can parse multiple or unbounded occurs.
+ */
+public class ParticlesQ013Test {
+
+    boolean errorFound;
+
+    DocumentBuilder documentBuilder;
+
+    private void printMethodName() {
+        StackTraceElement[] stack = Thread.currentThread().getStackTrace();
+        System.out.println(stack[2].getMethodName());
+    }
+
+    public ParticlesQ013Test() throws Exception {
+        SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        Schema schema = factory.newSchema(new File(getClass().getResource("particlesQ013.xsd").getFile()));
+
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setSchema(schema);
+
+        documentBuilder = dbf.newDocumentBuilder();
+        documentBuilder.setErrorHandler(new ErrorHandler() {
+            public void error(SAXParseException e) throws SAXException {
+                System.out.println("Error: " + e.getMessage());
+                errorFound = true;
+            }
+
+            public void fatalError(SAXParseException e) throws SAXException {
+                System.out.println("Fatal error: " + e.getMessage());
+            }
+
+            public void warning(SAXParseException e) throws SAXException {
+                System.out.println("Warning: " + e.getMessage());
+            }
+        });
+    }
+
+    @Test
+    public void testNoOptimizationWithChoice() throws Exception {
+        printMethodName();
+        File xmlFile = new File(getClass().getResource("particlesQ013.xml").getFile());
+        try {
+            errorFound = false;
+            documentBuilder.parse(xmlFile);
+        } catch (SAXException ex) {
+            Assert.fail(ex.getMessage());
+        }
+        if (errorFound) {
+            Assert.fail("Unexpected validation error reported");
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/TCKGroupA008Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/TCKGroupA008Test.java
new file mode 100644
index 00000000000..e097422fbdf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/TCKGroupA008Test.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test groupA008.xsd.
+ */
+public class TCKGroupA008Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test() {
+        // System.setSecurityManager(new SecurityManager());
+        try {
+            SchemaFactory factory = SchemaFactory.newInstance("http://www.w3.org/2001/XMLSchema");
+            File schemaLocation = new File(getClass().getResource("groupA008.xsd").getFile());
+            Schema schema = factory.newSchema(schemaLocation);
+            Validator validator = schema.newValidator();
+        } catch (SAXException e) {
+            System.out.println(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ValidatorTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ValidatorTest.java
new file mode 100644
index 00000000000..5a84c5211a7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/ValidatorTest.java
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileWriter;
+
+import javax.xml.XMLConstants;
+import javax.xml.stream.XMLEventReader;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.transform.Result;
+import javax.xml.transform.Source;
+import javax.xml.transform.stax.StAXResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+
+/*
+ * @summary Test Validator.validate(Source, Result).
+ */
+public class ValidatorTest {
+
+    @Test
+    public void testValidateStAX() {
+
+        File resultFile = null;
+        try {
+            resultFile = new File("stax.result");
+            if (resultFile.exists()) {
+                resultFile.delete();
+            }
+
+            Result xmlResult = new javax.xml.transform.stax.StAXResult(XMLOutputFactory.newInstance().createXMLStreamWriter(new FileWriter(resultFile)));
+            Source xmlSource = new javax.xml.transform.stax.StAXSource(getXMLEventReader("toys.xml"));
+            validate("toys.xsd", xmlSource, xmlResult);
+
+            ((StAXResult) xmlResult).getXMLStreamWriter().close();
+            Assert.assertTrue(resultFile.exists(), "result file is not created");
+
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail("Exception : " + ex.getMessage());
+        } finally {
+            if (resultFile != null && resultFile.exists()) {
+                resultFile.delete();
+            }
+        }
+    }
+
+    @Test
+    public void testValidateStream() {
+
+        File resultFile = null;
+        try {
+            resultFile = new File("stax.result");
+            if (resultFile.exists()) {
+                resultFile.delete();
+            }
+
+            // Validate this instance document against the
+            // Instance document supplied
+            Result xmlResult = new javax.xml.transform.stream.StreamResult(resultFile);
+            Source xmlSource = new javax.xml.transform.stream.StreamSource(new File(ValidatorTest.class.getResource("toys.xml").toURI()));
+
+            validate("toys.xsd", xmlSource, xmlResult);
+            Assert.assertTrue(resultFile.exists(), "result file is not created");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail("Exception : " + ex.getMessage());
+        } finally {
+            if (resultFile != null && resultFile.exists()) {
+                resultFile.delete();
+            }
+        }
+    }
+
+    @Test
+    public void testValidateGMonth() {
+
+        // test valid gMonths
+        File resultFile = null;
+        try {
+            resultFile = new File("gMonths.result.xml");
+            if (resultFile.exists()) {
+                resultFile.delete();
+            }
+
+            // Validate this instance document against the
+            // Instance document supplied
+            Result xmlResult = new javax.xml.transform.stream.StreamResult(resultFile);
+            Source xmlSource = new javax.xml.transform.stream.StreamSource(new File(ValidatorTest.class.getResource("gMonths.xml").toURI()));
+
+            validate("gMonths.xsd", xmlSource, xmlResult);
+
+            Assert.assertTrue(resultFile.exists(), "result file is not created");
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail("Exception : " + ex.getMessage());
+        } finally {
+            if (resultFile != null && resultFile.exists()) {
+                resultFile.delete();
+            }
+        }
+
+        // test invalid gMonths
+        File invalidResultFile = null;
+        try {
+            invalidResultFile = new File("gMonths-invalid.result.xml");
+            if (invalidResultFile.exists()) {
+                invalidResultFile.delete();
+            }
+
+            // Validate this instance document against the
+            // Instance document supplied
+            Result xmlResult = new javax.xml.transform.stream.StreamResult(resultFile);
+            Source xmlSource = new javax.xml.transform.stream.StreamSource(new File(ValidatorTest.class.getResource("gMonths-invalid.xml").toURI()));
+
+            validate("gMonths.xsd", xmlSource, xmlResult);
+
+            // should have failed with an Exception due to invalid gMonths
+            Assert.fail("invalid gMonths were accepted as valid in " + ValidatorTest.class.getResource("gMonths-invalid.xml").toURI());
+        } catch (Exception ex) {
+            // expected failure
+            System.out.println("Expected failure: " + ex.toString());
+        } finally {
+            if (invalidResultFile != null && invalidResultFile.exists()) {
+                invalidResultFile.delete();
+            }
+        }
+    }
+
+    private void validate(final String xsdFile, final Source src, final Result result) throws Exception {
+        try {
+            SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            Schema schema = sf.newSchema(new File(ValidatorTest.class.getResource(xsdFile).toURI()));
+
+            // Get a Validator which can be used to validate instance document
+            // against this grammar.
+            Validator validator = schema.newValidator();
+            ErrorHandler eh = new ErrorHandlerImpl();
+            validator.setErrorHandler(eh);
+
+            // Validate this instance document against the
+            // Instance document supplied
+            validator.validate(src, result);
+        } catch (Exception ex) {
+            throw ex;
+        }
+    }
+
+    private XMLEventReader getXMLEventReader(final String filename) {
+
+        XMLInputFactory xmlif = null;
+        XMLEventReader xmlr = null;
+        try {
+            xmlif = XMLInputFactory.newInstance();
+            xmlif.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, Boolean.TRUE);
+            xmlif.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, Boolean.FALSE);
+            xmlif.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, Boolean.TRUE);
+            xmlif.setProperty(XMLInputFactory.IS_COALESCING, Boolean.TRUE);
+
+            // FileInputStream fis = new FileInputStream(filename);
+            FileInputStream fis = new FileInputStream(new File(ValidatorTest.class.getResource(filename).toURI()));
+            xmlr = xmlif.createXMLEventReader(filename, fis);
+        } catch (Exception ex) {
+            ex.printStackTrace();
+            Assert.fail("Exception : " + ex.getMessage());
+        }
+        return xmlr;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/XMLDocBuilder.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/XMLDocBuilder.java
new file mode 100644
index 00000000000..f0513bb3683
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/XMLDocBuilder.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+
+public class XMLDocBuilder {
+
+    private DocumentBuilderFactory factory = null;
+    private DocumentBuilder builder = null;
+    private Document doc = null;
+    private Reader reader = null;
+    private Reader schema = null;
+    private String encoding = null;
+    private String entityPath = null;
+
+    public XMLDocBuilder(String file, String encoding, String schema) {
+        this.encoding = encoding;
+        reader = getReaderFromSystemResource(file, encoding);
+        this.schema = getReaderFromSystemResource(schema, encoding);
+    }
+
+    public Document getDocument() {
+        if (reader == null)
+            return null;
+
+        try {
+            factory = DocumentBuilderFactory.newInstance();
+
+            builder = factory.newDocumentBuilder();
+            builder.setErrorHandler(new myErrorHandler());
+            builder.setEntityResolver(new myEntityResolver());
+
+            InputSource source = new InputSource(reader);
+            source.setEncoding(encoding);
+
+            try {
+                doc = builder.parse(source);
+                new XMLSchemaValidator(doc, schema).validate();
+
+            } catch (SAXException e) {
+                System.err.println(getClass() + " SAXException: " + e.getMessage());
+                return null;
+            } catch (IOException e) {
+                System.err.println(getClass() + " IOException: " + e.getMessage());
+                return null;
+            } catch (OutOfMemoryError e) {
+                e.printStackTrace();
+                System.err.println(e.getCause().getLocalizedMessage());
+                return null;
+            }
+
+        } catch (ParserConfigurationException e) {
+            System.err.println(getClass() + " ParserConfigurationException: " + e.getMessage());
+            return null;
+        }
+        return doc;
+    }
+
+    public Reader getReaderFromSystemResource(String file, String encoding) {
+
+        try {
+            return new InputStreamReader(getClass().getResourceAsStream(file), encoding);
+        } catch (UnsupportedEncodingException e) {
+            System.err.println(getClass() + " UnsupportedEncodingException: " + e.getMessage());
+        } catch (IOException e) {
+            System.err.println(getClass() + " IOException: " + e.getMessage());
+        }
+        return null;
+    }
+
+    public void setEntityPath(String entityPath) {
+        this.entityPath = entityPath;
+    }
+
+    private class myErrorHandler implements ErrorHandler {
+
+        public void warning(SAXParseException e) {
+            showErrorMessage(e);
+        }
+
+        public void error(SAXParseException e) {
+            showErrorMessage(e);
+        }
+
+        public void fatalError(SAXParseException e) {
+            showErrorMessage(e);
+        }
+
+        private void showErrorMessage(SAXParseException e) {
+            System.err.println(getClass() + " SAXParseException" + e.getMessage());
+            System.err.println("Line: " + e.getLineNumber() + " Column: " + e.getColumnNumber());
+        }
+    }
+
+    private class myEntityResolver implements EntityResolver {
+        public InputSource resolveEntity(String publicId, String systemId) {
+            if (entityPath == null)
+                return null;
+
+            systemId = entityPath + systemId.subSequence(systemId.lastIndexOf("/"), systemId.length());
+
+            return new InputSource(systemId);
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/XMLSchemaValidator.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/XMLSchemaValidator.java
new file mode 100644
index 00000000000..c1722a190e5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/XMLSchemaValidator.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation;
+
+import java.io.IOException;
+import java.io.Reader;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.Source;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.w3c.dom.Node;
+import org.xml.sax.SAXException;
+
+public class XMLSchemaValidator {
+
+    private SchemaFactory factory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+    private Node node = null;
+    private Reader schema = null;
+
+    public XMLSchemaValidator(Node doc, Reader schema) {
+        this.node = doc;
+        this.schema = schema;
+    }
+
+    public synchronized void validate() throws SAXException, IOException {
+
+        if (node == null || schema == null)
+            return;
+
+        Source schemaFile = new StreamSource(schema);
+        Schema schema = factory.newSchema(schemaFile);
+        Validator validator = schema.newValidator();
+        validator.validate(new DOMSource(node));
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths-invalid.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths-invalid.xml
new file mode 100644
index 00000000000..a3071b50bab
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths-invalid.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright (c) 2014, 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.
+ */
+-->
+<gMonths>
+    <!-- invalid gMonths -->
+    <gMonth>--01--</gMonth>
+    <gMonth>--01--Z</gMonth>
+    <gMonth>--01---08:00</gMonth>
+    <gMonth>foo</gMonth>
+</gMonths>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths.xml
new file mode 100644
index 00000000000..65020ee63d9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright (c) 2014, 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.
+ */
+-->
+<gMonths>
+    <!-- valid gMonths -->
+    <gMonth>--01</gMonth>
+    <gMonth>--01Z</gMonth>
+    <gMonth>--01-08:00</gMonth>
+</gMonths>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths.xsd
new file mode 100644
index 00000000000..c18b5dc7518
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/gMonths.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0"?>
+<!--
+/*
+ * Copyright (c) 2014, 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.
+ */
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="gMonths">
+     <xs:complexType>
+       <xs:sequence>
+        <xs:element
+            name="gMonth"
+            type="xs:gMonth"
+            maxOccurs="16" />
+       </xs:sequence>
+     </xs:complexType>
+  </xs:element>
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008.xsd
new file mode 100644
index 00000000000..a21071f9529
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008.xsd
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+	<xsd:import schemaLocation="groupA008ea.red"/>
+	<xsd:include schemaLocation="groupA008eb.red"/>
+	<xsd:group name="foo">
+		<xsd:sequence>
+			<xsd:element name="a"/>
+		</xsd:sequence>
+	</xsd:group>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008ea.red b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008ea.red
new file mode 100644
index 00000000000..6349040a5c8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008ea.red
@@ -0,0 +1,7 @@
+<xsd:schema targetNamespace="" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+	<xsd:group name="a" id="foo">
+		<xsd:sequence>
+			<xsd:element name="a"/>
+		</xsd:sequence>
+	</xsd:group>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008eb.red b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008eb.red
new file mode 100644
index 00000000000..87dc2027fdf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/groupA008eb.red
@@ -0,0 +1,7 @@
+<xsd:schema targetNamespace="" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+	<xsd:group name="b" id="foo">
+		<xsd:sequence>
+			<xsd:element name="b"/>
+		</xsd:sequence>
+	</xsd:group>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/hello_literal.wsdl b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/hello_literal.wsdl
new file mode 100644
index 00000000000..20e2e09c16f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/hello_literal.wsdl
@@ -0,0 +1,294 @@
+<definitions
+        name="HelloTest"
+        targetNamespace="urn:test"
+        xmlns="http://schemas.xmlsoap.org/wsdl/"
+        xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+        xmlns:types="urn:test:types"
+        xmlns:tns="urn:test">
+
+    <types>
+        <xsd:schema
+                targetNamespace="urn:test:types"
+                attributeFormDefault="unqualified"
+                elementFormDefault="unqualified">
+
+            <xsd:element name="Hello">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="argument" type="xsd:string"/>
+                        <xsd:element name="extra" type="xsd:string"/>
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+
+            <xsd:complexType name="HelloType">
+                <xsd:sequence>
+                    <xsd:element name="argument" type="xsd:string"/>
+                    <xsd:element name="extra" type="xsd:string"/>
+                </xsd:sequence>
+            </xsd:complexType>
+
+            <xsd:element name="HelloResponse">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:sequence>
+                            <xsd:element name="name" type="xsd:string"/>
+                        </xsd:sequence>
+                        <xsd:element name="argument" type="xsd:string"/>
+                        <xsd:element name="extra" type="xsd:string"/>
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+
+
+            <xsd:element name="VoidTest" type="types:VoidType" nillable="true"/>
+
+            <xsd:complexType name="VoidType">
+                <xsd:sequence>
+                </xsd:sequence>
+            </xsd:complexType>
+
+            <xsd:element name="VoidTestResponse" type="types:VoidType" nillable="true"/>
+
+            <xsd:element name="echoArray" type="types:nameType"/>
+            <xsd:element name="echoArray1" type="types:nameType"/>
+            <xsd:element name="echoArray2" type="types:nameType"/>
+            <xsd:element name="echoArray3" type="types:nameType"/>
+
+            <xsd:element name="echoArray4Body" type="types:nameType1"/>
+
+
+            <xsd:element name="echoArrayResponse" type="types:nameType"/>
+            <xsd:complexType name="nameType">
+                <xsd:sequence>
+                    <xsd:element name="name" type="xsd:string" minOccurs="0" maxOccurs="unbounded"/>
+                </xsd:sequence>
+            </xsd:complexType>
+
+            <xsd:complexType name="nameType1">
+                <xsd:sequence>
+                    <xsd:element name="name" type="types:HelloType" minOccurs="0" maxOccurs="unbounded"/>
+                </xsd:sequence>
+            </xsd:complexType>
+
+            <xsd:element name="testKeyword">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="_this" type="xsd:string"/>
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+
+            <xsd:element name="testKeywordResponse">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="_super" type="xsd:string"/>
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+
+        </xsd:schema>
+    </types>
+
+    <message name="HelloRequest">
+        <part name="parameters" element="types:Hello"/>
+    </message>
+
+    <message name="HelloResponse">
+        <part name="parameters" element="types:HelloResponse"/>
+    </message>
+
+    <message name="MarshallTest_voidTest">
+        <part name="parameters" element="types:VoidTest"/>
+    </message>
+
+    <message name="MarshallTest_voidTestResponse">
+        <part name="result" element="types:VoidTestResponse"/>
+    </message>
+
+    <message name="echoArrayRequest">
+        <part name="body" element="types:echoArray"/>
+    </message>
+
+    <message name="echoArrayResponse">
+        <part name="body" element="types:echoArray"/>
+    </message>
+
+    <message name="echoArrayRequest1">
+        <part name="body" element="types:echoArray1"/>
+    </message>
+
+    <message name="echoArrayResponse1">
+        <part name="body" element="types:echoArray1"/>
+    </message>
+
+    <message name="echoArrayRequest2">
+        <part name="body" element="types:echoArray2"/>
+    </message>
+
+    <message name="echoArrayResponse2">
+        <part name="body" element="types:echoArray2"/>
+    </message>
+
+    <message name="echoArrayRequest3">
+        <part name="body" element="types:echoArray3"/>
+    </message>
+
+    <message name="echoArrayResponse3">
+        <part name="body" element="types:echoArray3"/>
+    </message>
+
+    <message name="echoArrayRequest4">
+        <part name="request" element="types:echoArray4Body"/>
+    </message>
+
+    <message name="echoArrayResponse4">
+        <part name="response" element="types:echoArray4Body"/>
+    </message>
+
+    <message name="testKeywordRequest">
+        <part name="request" element="types:testKeyword"/>
+    </message>
+
+    <message name="testKeywordResponse">
+        <part name="response" element="types:testKeywordResponse"/>
+    </message>
+
+
+    <portType name="Hello">
+        <operation name="hello">
+            <input message="tns:HelloRequest"/>
+            <output message="tns:HelloResponse"/>
+        </operation>
+
+        <!-- this is a regression test for bug 4823861 -->
+        <operation name="voidTest">
+            <input message="tns:MarshallTest_voidTest"/>
+            <output message="tns:MarshallTest_voidTestResponse"/>
+        </operation>
+
+
+        <operation name="echoArray">
+            <input message="tns:echoArrayRequest"/>
+            <output message="tns:echoArrayResponse"/>
+        </operation>
+
+        <operation name="echoArray1">
+            <input message="tns:echoArrayRequest1"/>
+            <output message="tns:echoArrayResponse1"/>
+        </operation>
+
+        <operation name="echoArray2">
+            <input message="tns:echoArrayRequest2"/>
+            <output message="tns:echoArrayResponse2"/>
+        </operation>
+
+        <operation name="echoArray3">
+            <input message="tns:echoArrayRequest3"/>
+            <output message="tns:echoArrayResponse3"/>
+        </operation>
+
+        <operation name="echoArray4">
+            <input message="tns:echoArrayRequest4"/>
+            <output message="tns:echoArrayResponse4"/>
+        </operation>
+
+        <operation name="testKeyword">
+            <input message="tns:testKeywordRequest"/>
+            <output message="tns:testKeywordResponse"/>
+        </operation>
+    </portType>
+
+    <binding name="HelloBinding" type="tns:Hello">
+        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <operation name="hello">
+            <soap:operation soapAction="urn:test:hello"/>
+            <input>
+                <soap:body use="literal"/>
+            </input>
+            <output>
+                <soap:body use="literal"/>
+            </output>
+        </operation>
+        <operation name="voidTest">
+            <input>
+                <soap:body use="literal"/>
+            </input>
+            <output>
+                <soap:body use="literal"/>
+            </output>
+            <soap:operation soapAction=""/>
+        </operation>
+
+        <operation name="echoArray">
+            <soap:operation soapAction="urn:test:hello"/>
+            <input>
+                <soap:body use="literal"/>
+            </input>
+            <output>
+                <soap:body parts="" use="literal"/>
+            </output>
+        </operation>
+
+        <operation name="echoArray1">
+            <soap:operation soapAction="urn:test:hello"/>
+            <input>
+                <soap:body use="literal"/>
+            </input>
+            <output>
+                <soap:body parts="" use="literal"/>
+                <soap:header message="tns:echoArrayResponse1" part="body" use="literal"/>
+            </output>
+        </operation>
+
+        <operation name="echoArray2">
+            <soap:operation soapAction="urn:test:hello"/>
+            <input>
+                <soap:body parts="" use="literal"/>
+                <soap:header message="tns:echoArrayRequest2" part="body" use="literal"/>
+            </input>
+            <output>
+                <soap:body parts="" use="literal"/>
+                <soap:header message="tns:echoArrayResponse2" part="body" use="literal"/>
+            </output>
+        </operation>
+
+        <operation name="echoArray3">
+            <soap:operation soapAction="urn:test:hello"/>
+            <input>
+                <soap:body/>
+            </input>
+            <output>
+                <soap:body/>
+            </output>
+        </operation>
+
+        <operation name="echoArray4">
+            <soap:operation soapAction="urn:test:hello"/>
+            <input>
+                <soap:body/>
+            </input>
+            <output>
+                <soap:body/>
+            </output>
+        </operation>
+
+        <operation name="testKeyword">
+            <soap:operation soapAction="urn:test:hello"/>
+            <input>
+                <soap:body/>
+            </input>
+            <output>
+                <soap:body/>
+            </output>
+        </operation>
+    </binding>
+
+    <service name="Hello">
+        <port name="HelloPort" binding="tns:HelloBinding">
+            <soap:address location="http://test.org/hello"/>
+        </port>
+    </service>
+
+</definitions>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idI009.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idI009.xsd
new file mode 100644
index 00000000000..92d9af034fd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idI009.xsd
@@ -0,0 +1,27 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xpns="xpns.org" xmlns:xpns1="xpns1.org" xmlns:xpns2="xpns2.org" xmlns:imp="importNS">
+	<xsd:import namespace="importNS" schemaLocation="idIimp.xsd"/>
+	<xsd:import namespace="xpns.org" schemaLocation="idIxpns.xsd"/>
+	<xsd:import namespace="xpns1.org" schemaLocation="idIxpns1.xsd"/>
+	<xsd:element name="root">
+		<xsd:complexType>
+			<xsd:sequence>
+				<xsd:element ref="tid" maxOccurs="unbounded"/>
+				<xsd:element ref="imp:iid" maxOccurs="unbounded"/>
+				<xsd:element ref="imp:iid1" maxOccurs="unbounded"/>
+				<xsd:element ref="xpns:xiid" maxOccurs="unbounded"/>
+				<xsd:element ref="xpns1:xiid" maxOccurs="unbounded"/>
+			</xsd:sequence>
+			<xsd:attribute name="val" type="xsd:string"/>
+		</xsd:complexType>
+		<xsd:unique id="foo123" name="uid">
+			<xsd:selector xpath="child::imp:iid"/>
+			<xsd:field xpath="@val"/>
+		</xsd:unique>
+	</xsd:element>
+	<xsd:element name="tid">
+		<xsd:complexType>
+			<xsd:attribute name="val" type="xsd:string"/>
+		</xsd:complexType>
+	</xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIimp.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIimp.xsd
new file mode 100644
index 00000000000..731d8521dfd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIimp.xsd
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="importNS" xmlns:imp="importNS">
+	<xsd:element name="iid">
+		<xsd:complexType>
+			<xsd:attribute name="val" type="xsd:string"/>
+		</xsd:complexType>
+	</xsd:element>
+	<xsd:element name="iid1">
+		<xsd:complexType>
+			<xsd:sequence>
+				<xsd:element name="iid2" maxOccurs="unbounded" form="qualified">
+					<xsd:complexType>
+						<xsd:attribute name="val" type="xsd:string"/>
+					</xsd:complexType>
+				</xsd:element>
+			</xsd:sequence>
+			<xsd:attribute name="val" type="xsd:string"/>
+		</xsd:complexType>
+	</xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIxpns.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIxpns.xsd
new file mode 100644
index 00000000000..941695faf53
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIxpns.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="xpns.org" xmlns:xpns="xpns.org">
+	<xsd:element name="xsid" type="xsd:string"/>
+	<xsd:element name="xiid">
+		<xsd:complexType>
+			<xsd:sequence>
+				<xsd:element name="xiid2" type="xsd:string" maxOccurs="unbounded"/>
+			</xsd:sequence>
+			<xsd:attribute name="val" type="xsd:string"/>
+		</xsd:complexType>
+	</xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIxpns1.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIxpns1.xsd
new file mode 100644
index 00000000000..d0ff89a7805
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/idIxpns1.xsd
@@ -0,0 +1,12 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="xpns1.org" xmlns:xpns="xpns1.org">
+	<xsd:element name="xsid" type="xsd:string"/>
+	<xsd:element name="xiid">
+		<xsd:complexType>
+			<xsd:sequence>
+				<xsd:element name="xiid2" type="xsd:string" maxOccurs="unbounded"/>
+			</xsd:sequence>
+			<xsd:attribute name="val" type="xsd:string"/>
+		</xsd:complexType>
+	</xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/mgG014.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/mgG014.xsd
new file mode 100644
index 00000000000..279372d8402
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/mgG014.xsd
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+	<xsd:element name="doc" type="foo"/>
+	<xsd:complexType name="foo">
+		<xsd:sequence minOccurs="0" maxOccurs="999999999">
+			<xsd:element name="e1"/>
+		</xsd:sequence>
+	</xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/mgJ014.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/mgJ014.xsd
new file mode 100644
index 00000000000..f284389bfcd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/mgJ014.xsd
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+	<xsd:element name="doc" type="foo"/>
+	<xsd:complexType name="foo">
+		<xsd:choice minOccurs="0" maxOccurs="999999999">
+			<xsd:element name="e1"/>
+		</xsd:choice>
+	</xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-max.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-max.xml
new file mode 100644
index 00000000000..e3743f1a2fd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-max.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <!-- Error: Only 5 child_name allowed -->
+        <child_name>Jim</child_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Sheldon</child_name>
+        <child_name>Penny</child_name>
+        <child_name>John</child_name>
+    </person>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <!-- Error: Only 2 midlle_name allowed -->
+        <middle_name>Jim</middle_name>
+        <middle_name>Hege</middle_name>
+        <middle_name>Stale</middle_name>
+    </person>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <!-- Error: Only 2 midlle_name allowed -->
+        <middle_name>Jim</middle_name>
+        <middle_name>Hege</middle_name>
+        <middle_name>Stale</middle_name>
+        <!-- Error: Only 5 child_name allowed -->
+        <child_name>Jim</child_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Sheldon</child_name>
+        <child_name>Penny</child_name>
+        <child_name>John</child_name>
+    </person>
+</persons>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-min-max.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-min-max.xml
new file mode 100644
index 00000000000..aae039cb5b0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-min-max.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <!-- Error: Only 2 midlle_name allowed -->
+        <middle_name>Jim</middle_name>
+        <middle_name>Hege</middle_name>
+        <middle_name>Stale</middle_name>
+        <!-- Error: child_name expected here -->
+    </person>
+    <person>
+        <full_name>Hege Refsnes Jr.</full_name>
+        <!-- Error: Only 2 midlle_name allowed -->
+        <middle_name>Jim</middle_name>
+        <middle_name>Hege</middle_name>
+        <middle_name>Stale</middle_name>
+        <!-- Error: Only 5 child_name allowed -->
+        <child_name>Jim</child_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Sheldon</child_name>
+        <child_name>Penny</child_name>
+        <child_name>John</child_name>
+    </person>
+</persons>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-min.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-min.xml
new file mode 100644
index 00000000000..e52e5266bf4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-error-min.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <!-- Error: child_name expected here -->
+    </person>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <middle_name>John</middle_name>
+        <middle_name>Doe</middle_name>
+        <!-- Error: child_name expected here -->
+    </person>
+</persons>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-ok.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-ok.xml
new file mode 100644
index 00000000000..06f23371e2e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-ok.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <child_name>Cecilie</child_name>
+    </person>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <middle_name>Peter</middle_name>
+        <child_name>Cecilie</child_name>
+        <child_name>Hege</child_name>
+    </person>
+    <person>
+        <full_name>Tove Refsnes</full_name>
+        <middle_name>Peter</middle_name>
+        <middle_name>Pan</middle_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Jim</child_name>
+    </person>
+    <person>
+        <full_name>Tove Refsnes</full_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Jim</child_name>
+        <child_name>Sheldon</child_name>
+    </person>
+    <person>
+        <full_name>Stale Refsnes</full_name>
+        <middle_name>Peter</middle_name>
+        <middle_name>Pan</middle_name>
+        <child_name>Jim</child_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Sheldon</child_name>
+        <child_name>Penny</child_name>
+    </person>
+</persons>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded-error-min.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded-error-min.xml
new file mode 100644
index 00000000000..ba1fc71c28b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded-error-min.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <!-- Error: middle_name expected here -->
+        <!-- Error: child_name expected here -->
+    </person>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <!-- Error: At least 2 middle_name expected -->
+        <middle_name>John</middle_name>
+        <!-- Error: child_name expected here -->
+    </person>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <!-- Error: At least 3 child_name expected -->
+        <child_name>John</child_name>
+        <child_name>Doe</child_name>
+    </person>
+</persons>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded-ok.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded-ok.xml
new file mode 100644
index 00000000000..a9d696e18fa
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded-ok.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <middle_name>Peter</middle_name>
+        <middle_name>Pan</middle_name>
+        <child_name>Cecilie</child_name>
+        <child_name>Hege</child_name>
+        <child_name>Jim</child_name>
+    </person>
+    <person>
+        <full_name>Stale Refsnes</full_name>
+        <middle_name>Peter</middle_name>
+        <middle_name>Pan</middle_name>
+        <middle_name>Jim</middle_name>
+        <middle_name>Morris</middle_name>
+        <child_name>Jim</child_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Sheldon</child_name>
+        <child_name>Penny</child_name>
+        <child_name>Billy</child_name>
+    </person>
+</persons>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded.xsd
new file mode 100644
index 00000000000..d53a8fb98d2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs-unbounded.xsd
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+    
+    <xs:element name="persons">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="person" maxOccurs="unbounded">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="full_name" type="xs:string"/>
+                            <xs:element name="middle_name" type="xs:string" minOccurs="2" maxOccurs="unbounded"/>
+                            <xs:element name="child_name" type="xs:string" minOccurs="3" maxOccurs="unbounded"/>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs.xsd
new file mode 100644
index 00000000000..d6cb815d80d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/multi-occurs.xsd
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+    
+    <xs:element name="persons">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="person" maxOccurs="unbounded">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="full_name" type="xs:string"/>
+                            <xs:element name="middle_name" type="xs:string" minOccurs="0" maxOccurs="2"/>
+                            <xs:element name="child_name" type="xs:string" minOccurs="1" maxOccurs="5"/>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-max.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-max.xml
new file mode 100644
index 00000000000..cd6768d7990
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-max.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <!-- Error: Only 5 child_name allowed -->
+        <child_name>Jim</child_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Sheldon</child_name>
+        <child_name>Penny</child_name>
+        <child_name>John</child_name>
+    </person>
+</persons>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-min-max.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-min-max.xml
new file mode 100644
index 00000000000..bdda93a7f76
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-min-max.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <!-- Error: child_name expected here -->
+    </person>
+    <person>
+        <full_name>Hege Refsnes Jr.</full_name>
+        <!-- Error: Only 5 child_name allowed -->
+        <child_name>Jim</child_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Sheldon</child_name>
+        <child_name>Penny</child_name>
+        <child_name>John</child_name>
+    </person>
+</persons>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-min.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-min.xml
new file mode 100644
index 00000000000..67948360ff3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-error-min.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <!-- Error: child_name expected here -->
+    </person>
+</persons>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-ok.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-ok.xml
new file mode 100644
index 00000000000..29d3f37ccf3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-ok.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <child_name>Cecilie</child_name>
+    </person>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <child_name>Cecilie</child_name>
+        <child_name>Hege</child_name>
+    </person>
+    <person>
+        <full_name>Tove Refsnes</full_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Jim</child_name>
+    </person>
+    <person>
+        <full_name>Tove Refsnes</full_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Jim</child_name>
+        <child_name>Sheldon</child_name>
+    </person>
+    <person>
+        <full_name>Stale Refsnes</full_name>
+        <child_name>Jim</child_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Sheldon</child_name>
+        <child_name>Penny</child_name>
+    </person>
+</persons>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded-error-min.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded-error-min.xml
new file mode 100644
index 00000000000..ba00d962738
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded-error-min.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <full_name>Hege Refsnes</full_name>
+        <!-- Error: Expected at least 3 child_name -->
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+    </person>
+</persons>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded-ok.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded-ok.xml
new file mode 100644
index 00000000000..177b18b2e09
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded-ok.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<persons>
+    <person>
+        <full_name>Tove Refsnes</full_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Jim</child_name>
+    </person>
+    <person>
+        <full_name>Tove Refsnes</full_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Jim</child_name>
+        <child_name>Sheldon</child_name>
+    </person>
+    <person>
+        <full_name>Stale Refsnes</full_name>
+        <child_name>Jim</child_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Sheldon</child_name>
+        <child_name>Penny</child_name>
+    </person>
+    <person>
+        <full_name>Stale Refsnes</full_name>
+        <child_name>Jim</child_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Sheldon</child_name>
+        <child_name>Penny</child_name>
+        <child_name>Jim</child_name>
+        <child_name>Hege</child_name>
+        <child_name>Stale</child_name>
+        <child_name>Sheldon</child_name>
+        <child_name>Penny</child_name>
+    </person>
+</persons>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded.xsd
new file mode 100644
index 00000000000..ae39e098efb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-unbounded.xsd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+    
+    <xs:element name="persons">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="person" maxOccurs="unbounded">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="full_name" type="xs:string"/>
+                            <xs:element name="child_name" type="xs:string" minOccurs="3" maxOccurs="unbounded"/>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-wildcard-unbounded.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-wildcard-unbounded.xsd
new file mode 100644
index 00000000000..5c543cadf52
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-wildcard-unbounded.xsd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+    
+    <xs:element name="persons">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="person" maxOccurs="unbounded">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="full_name" type="xs:string"/>
+                            <xs:any processContents="lax" minOccurs="3" maxOccurs="unbounded"/>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-wildcard.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-wildcard.xsd
new file mode 100644
index 00000000000..a21f20b064d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs-wildcard.xsd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+    
+    <xs:element name="persons">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="person" maxOccurs="unbounded">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="full_name" type="xs:string"/>
+                            <xs:any processContents="lax" minOccurs="1" maxOccurs="5"/>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs.xsd
new file mode 100644
index 00000000000..62a7d2f266c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/occurs.xsd
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+           elementFormDefault="qualified">
+    
+    <xs:element name="persons">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="person" maxOccurs="unbounded">
+                    <xs:complexType>
+                        <xs:sequence>
+                            <xs:element name="full_name" type="xs:string"/>
+                            <xs:element name="child_name" type="xs:string" minOccurs="1" maxOccurs="5"/>
+                        </xs:sequence>
+                    </xs:complexType>
+                </xs:element>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+    
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesId005.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesId005.xml
new file mode 100644
index 00000000000..8b579e2cac1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesId005.xml
@@ -0,0 +1,6 @@
+
+<a:doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xsdtesting particlesId005.xsd" xmlns:a="http://xsdtesting">
+    <a:e1/>
+    <a:e1/>
+    <a:e1/>
+</a:doc>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesId005.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesId005.xsd
new file mode 100644
index 00000000000..58ed89a2473
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesId005.xsd
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting" elementFormDefault="qualified">
+    <xsd:complexType name="base">
+        <xsd:choice>
+            <xsd:element name="e1" minOccurs="1" maxOccurs="3"/>
+            <xsd:element name="e2" minOccurs="1" maxOccurs="unbounded"/>
+        </xsd:choice>
+    </xsd:complexType>
+    <xsd:complexType name="testing">
+        <xsd:complexContent>
+            <xsd:restriction base="x:base">
+                <xsd:choice>
+                    <xsd:element name="e1" minOccurs="2" maxOccurs="3"/>
+                    <xsd:element name="e2" minOccurs="2" maxOccurs="unbounded"/>
+                </xsd:choice>
+            </xsd:restriction>
+        </xsd:complexContent>
+    </xsd:complexType>
+    <xsd:element name="doc" type="x:testing"/>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesIe003.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesIe003.xsd
new file mode 100644
index 00000000000..251c9699b8a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesIe003.xsd
@@ -0,0 +1,20 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting" elementFormDefault="qualified">
+	<xsd:complexType name="base">
+		<xsd:choice>
+			<xsd:element name="e1" minOccurs="0" maxOccurs="unbounded"/>
+			<xsd:element name="e2" minOccurs="0" maxOccurs="unbounded"/>
+		</xsd:choice>
+	</xsd:complexType>
+	<xsd:complexType name="testing">
+		<xsd:complexContent>
+			<xsd:restriction base="x:base">
+				<xsd:choice>
+					<xsd:element name="e1" minOccurs="1" maxOccurs="9999999"/>
+					<xsd:element name="e2" minOccurs="1" maxOccurs="9999999"/>
+				</xsd:choice>
+			</xsd:restriction>
+		</xsd:complexContent>
+	</xsd:complexType>
+	<xsd:element name="doc" type="x:testing"/>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesIg004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesIg004.xsd
new file mode 100644
index 00000000000..2f1f0414135
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesIg004.xsd
@@ -0,0 +1,22 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting" elementFormDefault="qualified">
+	<xsd:complexType name="base">
+		<xsd:choice>
+			<xsd:element name="e1" block="#all"/>
+			<xsd:element name="e3" block="substitution extension restriction"/>
+			<xsd:element name="e4" block="#all"/>
+		</xsd:choice>
+	</xsd:complexType>
+	<xsd:complexType name="testing">
+		<xsd:complexContent>
+			<xsd:restriction base="x:base">
+				<xsd:choice>
+					<xsd:element name="e1" block="substitution extension restriction"/>
+					<xsd:element name="e3" block="substitution extension restriction"/>
+					<xsd:element name="e4" block="#all"/>
+				</xsd:choice>
+			</xsd:restriction>
+		</xsd:complexContent>
+	</xsd:complexType>
+	<xsd:element name="doc" type="x:testing"/>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesOptimize.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesOptimize.xsd
new file mode 100644
index 00000000000..9bffaa06a36
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesOptimize.xsd
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+
+<xsd:schema
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+  xmlns="test"
+  targetNamespace="test">
+
+     <xsd:element name="a" type="A"/>
+     <xsd:complexType name="A">
+          <xsd:sequence>
+	       <xsd:element name="b" type="xsd:string" maxOccurs="30000"/>
+	  </xsd:sequence>
+     </xsd:complexType>
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesQ013.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesQ013.xml
new file mode 100644
index 00000000000..95216a47721
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesQ013.xml
@@ -0,0 +1,14 @@
+
+<a:doc xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xsdtesting particlesQ013.xsd" xmlns:a="http://xsdtesting">
+    <elem>
+        <foo/>
+        <e1/>
+        <e1/>
+        <e2/>
+        <e2/>
+        <e1/>
+        <e1/>
+        <e2/>
+        <e2/>
+    </elem>
+</a:doc>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesQ013.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesQ013.xsd
new file mode 100644
index 00000000000..1fb12be8fad
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesQ013.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting" xmlns:imp="http://importedXSD">
+    <xsd:complexType name="B">
+        <xsd:sequence>
+            <xsd:element name="foo" minOccurs="1" maxOccurs="1"/>
+            <xsd:any namespace="##any" minOccurs="4" maxOccurs="8"/>
+        </xsd:sequence>
+    </xsd:complexType>
+    <xsd:complexType name="R">
+        <xsd:complexContent>
+            <xsd:restriction base="x:B">
+                <xsd:sequence>
+                    <xsd:element name="foo" minOccurs="1" maxOccurs="1"/>
+                    <xsd:sequence minOccurs="1" maxOccurs="2">
+                        <xsd:element name="e1" minOccurs="2" maxOccurs="2"/>
+                        <xsd:element name="e2" minOccurs="2" maxOccurs="2"/>
+                    </xsd:sequence>
+                </xsd:sequence>
+            </xsd:restriction>
+        </xsd:complexContent>
+    </xsd:complexType>
+    <xsd:element name="doc">
+        <xsd:complexType>
+            <xsd:choice>
+                <xsd:element name="elem" type="x:R"/>
+            </xsd:choice>
+        </xsd:complexType>
+    </xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesR005.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesR005.xsd
new file mode 100644
index 00000000000..13b38bffbae
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/particlesR005.xsd
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting" xmlns:imp="http://importedXSD">
+	<xsd:complexType name="B">
+		<xsd:sequence>
+			<xsd:element name="foo" minOccurs="1" maxOccurs="1"/>
+			<xsd:any namespace="##any" minOccurs="0" maxOccurs="unbounded"/>
+		</xsd:sequence>
+	</xsd:complexType>
+	<xsd:complexType name="R">
+		<xsd:complexContent>
+			<xsd:restriction base="x:B">
+				<xsd:sequence>
+					<xsd:element name="foo" minOccurs="1" maxOccurs="1"/>
+					<xsd:choice minOccurs="1" maxOccurs="1">
+						<xsd:element name="e1" minOccurs="1" maxOccurs="30000"/>
+					</xsd:choice>
+				</xsd:sequence>
+			</xsd:restriction>
+		</xsd:complexContent>
+	</xsd:complexType>
+	<xsd:element name="doc">
+		<xsd:complexType>
+			<xsd:choice>
+				<xsd:element name="elem" type="x:R"/>
+			</xsd:choice>
+		</xsd:complexType>
+	</xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2.xsd
new file mode 100644
index 00000000000..21d78ecd0f5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema
+  xmlns="IdConstrDefs/targetNS"
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+  targetNamespace="IdConstrDefs/targetNS">
+
+  <xsd:include schemaLocation="targetNS00101m2a.xsd"/>
+
+  <xsd:element name="root">
+      <xsd:complexType>
+          <xsd:sequence maxOccurs="unbounded">
+              <xsd:element name="person"/>
+          </xsd:sequence>
+      </xsd:complexType>
+      <xsd:key name="KEY">
+          <xsd:selector xpath="./person"/>
+          <xsd:field xpath="."/>
+      </xsd:key>
+      <xsd:keyref name="KEYREF" refer="KEY">
+          <xsd:selector xpath="./person"/>
+          <xsd:field xpath="@parent"/>
+      </xsd:keyref>
+  </xsd:element>
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2_stub.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2_stub.xml
new file mode 100644
index 00000000000..27e01aa3961
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2_stub.xml
@@ -0,0 +1,5 @@
+<?xml version='1.0'?>
+<sb:stub xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+       xsi:schemaLocation='IdConstrDefs/targetNS targetNS00101m2_stub.xsd'
+       xmlns:sb='IdConstrDefs/targetNS'>
+    Stub document</sb:stub>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2_stub.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2_stub.xsd
new file mode 100644
index 00000000000..63b36a95f67
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2_stub.xsd
@@ -0,0 +1,7 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'
+       targetNamespace='IdConstrDefs/targetNS'
+       xmlns:sb='IdConstrDefs/targetNS'>
+    <xsd:include schemaLocation='targetNS00101m2.xsd'/>
+    <xsd:element name='stub' type='xsd:string'/>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2a.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2a.xsd
new file mode 100644
index 00000000000..1a20a499e5c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/targetNS00101m2a.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xsd:schema
+  xmlns="IdConstrDefs/targetNS"
+  xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+  targetNamespace="IdConstrDefs/targetNS">
+
+  <xsd:element name="roota">
+      <xsd:complexType>
+          <xsd:sequence maxOccurs="unbounded">
+              <xsd:element name="person"/>
+          </xsd:sequence>
+      </xsd:complexType>
+      <xsd:key name="KEY">
+          <xsd:selector xpath="./person"/>
+          <xsd:field xpath="."/>
+      </xsd:key>
+      <xsd:keyref name="KEYREF" refer="KEY">
+          <xsd:selector xpath="./person"/>
+          <xsd:field xpath="@parent"/>
+      </xsd:keyref>
+  </xsd:element>
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/byte_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/byte_fractionDigits004.xsd
new file mode 100644
index 00000000000..928815e966c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/byte_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test byte datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:byte">
+            <xsd:fractionDigits value="1"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/byte_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/byte_fractionDigits007.xsd
new file mode 100644
index 00000000000..5614e85ffc1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/byte_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test byte datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:byte">
+            <xsd:fractionDigits value="5"/>
+            <xsd:totalDigits value="5"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/int_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/int_fractionDigits004.xsd
new file mode 100644
index 00000000000..f73163bad45
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/int_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test int datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:int">
+            <xsd:fractionDigits value="1"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/int_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/int_fractionDigits007.xsd
new file mode 100644
index 00000000000..af779fefe18
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/int_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test int datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:int">
+            <xsd:fractionDigits value="5"/>
+            <xsd:totalDigits value="5"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/integer_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/integer_fractionDigits004.xsd
new file mode 100644
index 00000000000..d51cca4e55b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/integer_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test integer datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:integer">
+            <xsd:fractionDigits value="1"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/integer_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/integer_fractionDigits007.xsd
new file mode 100644
index 00000000000..68e3126a8da
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/integer_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test integer datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:integer">
+            <xsd:fractionDigits value="5"/>
+            <xsd:totalDigits value="5"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/long_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/long_fractionDigits004.xsd
new file mode 100644
index 00000000000..e52f98582a4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/long_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test long datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:long">
+            <xsd:fractionDigits value="1"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/long_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/long_fractionDigits007.xsd
new file mode 100644
index 00000000000..a22732c90d1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/long_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test long datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:long">
+            <xsd:fractionDigits value="5"/>
+            <xsd:totalDigits value="5"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/negativeInteger_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/negativeInteger_fractionDigits004.xsd
new file mode 100644
index 00000000000..3f5a859a89d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/negativeInteger_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test negativeInteger datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:negativeInteger">
+            <xsd:fractionDigits value="1"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/negativeInteger_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/negativeInteger_fractionDigits007.xsd
new file mode 100644
index 00000000000..53c04b1cedb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/negativeInteger_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test negativeInteger datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:negativeInteger">
+            <xsd:fractionDigits value="5"/>
+            <xsd:totalDigits value="5"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonNegativeInteger_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonNegativeInteger_fractionDigits004.xsd
new file mode 100644
index 00000000000..067f1775e28
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonNegativeInteger_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test nonNegativeInteger datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:nonNegativeInteger">
+            <xsd:fractionDigits value="1"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonNegativeInteger_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonNegativeInteger_fractionDigits007.xsd
new file mode 100644
index 00000000000..3eeb2d56f2c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonNegativeInteger_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test nonNegativeInteger datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:nonNegativeInteger">
+            <xsd:fractionDigits value="5"/>
+            <xsd:totalDigits value="5"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonPositiveInteger_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonPositiveInteger_fractionDigits004.xsd
new file mode 100644
index 00000000000..044d0093275
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonPositiveInteger_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test nonPositiveInteger datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:nonPositiveInteger">
+            <xsd:fractionDigits value="1"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonPositiveInteger_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonPositiveInteger_fractionDigits007.xsd
new file mode 100644
index 00000000000..fc1a4133338
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/nonPositiveInteger_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test nonPositiveInteger datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:nonPositiveInteger">
+            <xsd:fractionDigits value="5"/>
+            <xsd:totalDigits value="5"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/positiveInteger_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/positiveInteger_fractionDigits004.xsd
new file mode 100644
index 00000000000..3f7cd0e8b20
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/positiveInteger_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test positiveInteger datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:positiveInteger">
+            <xsd:fractionDigits value="1"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/positiveInteger_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/positiveInteger_fractionDigits007.xsd
new file mode 100644
index 00000000000..0a210e57f21
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/positiveInteger_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test positiveInteger datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:positiveInteger">
+            <xsd:fractionDigits value="5"/>
+            <xsd:totalDigits value="5"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/short_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/short_fractionDigits004.xsd
new file mode 100644
index 00000000000..f0a39652a48
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/short_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test short datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:short">
+            <xsd:fractionDigits value="1"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/short_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/short_fractionDigits007.xsd
new file mode 100644
index 00000000000..102f16becaa
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/short_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test short datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:short">
+            <xsd:fractionDigits value="5"/>
+            <xsd:totalDigits value="5"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedByte_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedByte_fractionDigits004.xsd
new file mode 100644
index 00000000000..0691fa47239
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedByte_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test unsignedByte datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:unsignedByte">
+            <xsd:fractionDigits value="1"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedByte_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedByte_fractionDigits007.xsd
new file mode 100644
index 00000000000..e90db8e1b9a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedByte_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test unsignedByte datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:unsignedByte">
+            <xsd:fractionDigits value="5"/>
+            <xsd:totalDigits value="5"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedInt_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedInt_fractionDigits004.xsd
new file mode 100644
index 00000000000..88ba0587162
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedInt_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test unsignedInt datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:unsignedInt">
+            <xsd:fractionDigits value="1"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedInt_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedInt_fractionDigits007.xsd
new file mode 100644
index 00000000000..713f7c728e3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedInt_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test unsignedInt datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:unsignedInt">
+            <xsd:fractionDigits value="5"/>
+            <xsd:totalDigits value="5"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedLong_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedLong_fractionDigits004.xsd
new file mode 100644
index 00000000000..d8d56074dea
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedLong_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test unsignedLong datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:unsignedLong">
+            <xsd:fractionDigits value="1"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedLong_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedLong_fractionDigits007.xsd
new file mode 100644
index 00000000000..e9accfcd561
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedLong_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test unsignedLong datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:unsignedLong">
+            <xsd:fractionDigits value="5"/>
+            <xsd:totalDigits value="5"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedShort_fractionDigits004.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedShort_fractionDigits004.xsd
new file mode 100644
index 00000000000..bf49587c672
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedShort_fractionDigits004.xsd
@@ -0,0 +1,16 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test unsignedShort datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:unsignedShort">
+            <xsd:fractionDigits value="1"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedShort_fractionDigits007.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedShort_fractionDigits007.xsd
new file mode 100644
index 00000000000..9747be35d92
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252In/unsignedShort_fractionDigits007.xsd
@@ -0,0 +1,17 @@
+<?xml version='1.0'?>
+<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema' >
+<!-- Schema to test unsignedShort datatype -->
+  <xsd:element name='test' type='fooType' />
+  <xsd:complexType name='fooType' > 
+    <xsd:sequence>
+      <xsd:element name='foo' >
+        <xsd:simpleType>
+          <xsd:restriction base="xsd:unsignedShort">
+            <xsd:fractionDigits value="5"/>
+            <xsd:totalDigits value="5"/>
+          </xsd:restriction>
+        </xsd:simpleType>
+      </xsd:element>
+    </xsd:sequence>
+  </xsd:complexType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252Test.java
new file mode 100644
index 00000000000..c9de30f5d49
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6943252Test.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation.tck;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6943252
+ * @summary Test Schema doesn't allow to use value more than allowed by base type.
+ */
+public class Bug6943252Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test() {
+
+        String dir = Bug6943252Test.class.getResource("Bug6943252In").getPath();
+        File inputs = new File(dir);
+        File[] files = inputs.listFiles();
+        SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        for (int i = 0; i < files.length; i++) {
+            try {
+                Schema schema = schemaFactory.newSchema(new StreamSource(files[i]));
+                Assert.fail(files[i].getName() + "should fail");
+            } catch (SAXException e) {
+                // expected
+                System.out.println(files[i].getName() + ":");
+                System.out.println(e.getMessage());
+            }
+        }
+
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963124.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963124.xsd
new file mode 100644
index 00000000000..c3e78e12b8d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963124.xsd
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://xsdtesting" xmlns:x="http://xsdtesting" elementFormDefault="qualified">
+	<xsd:group name="G">
+		<xsd:all>
+			<xsd:element name="a1"/>
+			<xsd:element name="a2"/>
+		</xsd:all>
+	</xsd:group>
+	<xsd:element name="doc">
+		<xsd:complexType>
+			<xsd:group ref="x:G" minOccurs="1" maxOccurs="2">
+			</xsd:group>
+		</xsd:complexType>
+	</xsd:element>
+</xsd:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963124Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963124Test.java
new file mode 100644
index 00000000000..fc1f3286e02
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963124Test.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation.tck;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6963124
+ * @summary Test Schema doesn't allow maxOccurs > 1 for reference to all model group.
+ */
+public class Bug6963124Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test() {
+        try {
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+            Schema schema = schemaFactory.newSchema(new StreamSource(Bug6963124Test.class.getResourceAsStream("Bug6963124.xsd")));
+            Assert.fail("JCK negative test");
+        } catch (SAXException e) {
+            // e.printStackTrace();
+            System.out
+                    .println("The XML Schema spec [1] states that if the {term} property of a particle is a model group with {compositor} all then {maxOccurs} of that particle must equal 1.");
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468.xml
new file mode 100644
index 00000000000..8076d953da2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468.xml
@@ -0,0 +1,14 @@
+<x:root
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://xsdtesting Bug6963468.xsd"
+	xmlns:x="http://xsdtesting">
+
+	<x:E1>1</x:E1>
+	<x:E1>true</x:E1>
+	<x:E1>false</x:E1>
+	<x:E1>x</x:E1>
+	<x:E1>y</x:E1>
+	<x:E2>1</x:E2>
+	<x:E3 x:att1="123"/>
+</x:root>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468.xsd
new file mode 100644
index 00000000000..5b2bca83dbf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468.xsd
@@ -0,0 +1,51 @@
+<xsd:schema id="MyXSD" targetNamespace="http://xsdtesting" xmlns="http://xsdtesting" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified">
+
+
+	    <xsd:element name="root">
+	      <xsd:complexType>
+		<xsd:choice maxOccurs="unbounded">
+		    <xsd:element ref="E1" minOccurs="0" maxOccurs="20"/>
+		    <xsd:element ref="E3" minOccurs="0" maxOccurs="20"/>
+		</xsd:choice>
+	      </xsd:complexType>
+	    </xsd:element>
+
+	    <xsd:simpleType name="myType9">
+		  <xsd:list itemType="myType10"/>
+	  </xsd:simpleType>
+
+	  <xsd:simpleType name="myType10">
+        	<xsd:union memberTypes="xsd:float xsd:integer">
+          		<xsd:simpleType>
+		            <xsd:restriction base='xsd:boolean'/>
+		        </xsd:simpleType>
+		        <xsd:simpleType>
+		            <xsd:restriction base='xsd:string'>
+		              <xsd:enumeration value='x'/>
+		              <xsd:enumeration value='y'/>
+		            </xsd:restriction>
+		        </xsd:simpleType>
+	        </xsd:union>
+	 </xsd:simpleType>
+
+	<xsd:simpleType name="DeriveUnion">
+	  <xsd:restriction base="myType10">
+	  </xsd:restriction>
+	</xsd:simpleType>
+	<xsd:complexType name="CT1">
+	  <xsd:attribute name="att1" type="myType10"/>
+	</xsd:complexType>
+
+	<xsd:complexType name="CT2">
+	  <xsd:complexContent>
+	    <xsd:restriction base="CT1">
+		<xsd:attribute name="att1" type="xsd:integer"/>
+	    </xsd:restriction>
+	  </xsd:complexContent>
+	</xsd:complexType>
+
+	<xsd:element name="E1" type="myType10"/>
+	<xsd:element name="E2" substitutionGroup="E1" type="xsd:integer"/>
+	<xsd:element name="E3" type="CT2"/>
+</xsd:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468Test.java
new file mode 100644
index 00000000000..59fab2b21c4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6963468Test.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation.tck;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6963468
+ * @summary Test Validation allows element a is a union type and element b specifies a as its substitution group and b type is or is derived from one of the member types of the union.
+ */
+public class Bug6963468Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test() {
+        try {
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            schemaFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+
+            Schema schema = schemaFactory.newSchema(new StreamSource(Bug6963468Test.class.getResourceAsStream("Bug6963468.xsd")));
+
+            Validator validator = schema.newValidator();
+            validator.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+            validator.setErrorHandler(new ErrorHandler() {
+                public void error(SAXParseException exception) throws SAXException {
+                    exception.printStackTrace();
+                }
+
+                public void fatalError(SAXParseException exception) throws SAXException {
+                    exception.printStackTrace();
+                }
+
+                public void warning(SAXParseException exception) throws SAXException {
+                    exception.printStackTrace();
+                }
+            });
+
+            validator.validate(new StreamSource(Bug6963468Test.class.getResourceAsStream("Bug6963468.xml")));
+
+        } catch (SAXException e) {
+            System.out.println(e.getMessage());
+            // fail(e.getMessage());
+
+        } catch (IOException e) {
+            e.printStackTrace();
+            System.out.println(e.getMessage());
+            // fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testInstance() throws ParserConfigurationException, SAXException, IOException {
+        System.out.println(Bug6963468Test.class.getResource("Bug6963468.xsd").getPath());
+        File schemaFile = new File(Bug6963468Test.class.getResource("Bug6963468.xsd").getPath());
+        SAXParser parser = createParser(schemaFile);
+
+        try {
+            parser.parse(Bug6963468Test.class.getResource("Bug6963468.xml").getPath(), new DefaultHandler());
+        } catch (SAXException e) {
+            e.printStackTrace();
+            Assert.fail("Fatal Error: " + strException(e));
+        }
+
+    }
+
+    protected SAXParser createParser(File schema) throws ParserConfigurationException, SAXException {
+
+        // create and initialize the parser
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.setValidating(true);
+        SAXParser parser = spf.newSAXParser();
+        parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+
+        // set schemaLocation if possible
+        try {
+            parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", schema);
+        } catch (SAXNotRecognizedException e) {
+            System.out.println("Warning: Property 'http://java.sun.com/xml/jaxp/properties/schemaSource' is not recognized.");
+        } catch (SAXNotSupportedException e) {
+            System.out.println("Warning: Property 'http://java.sun.com/xml/jaxp/properties/schemaSource' is not supported.");
+        }
+
+        return parser;
+    }
+
+    protected static String strException(Exception ex) {
+        StringBuffer sb = new StringBuffer();
+
+        while (ex != null) {
+            if (ex instanceof SAXParseException) {
+                SAXParseException e = (SAXParseException) ex;
+                sb.append("" + e.getSystemId() + "(" + e.getLineNumber() + "," + e.getColumnNumber() + "): " + e.getMessage());
+                ex = e.getException();
+            } else {
+                sb.append(ex);
+                ex = null;
+            }
+        }
+        return sb.toString();
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6964720.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6964720.xsd
new file mode 100644
index 00000000000..2b4a00795eb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6964720.xsd
@@ -0,0 +1,53 @@
+<xs:schema elementFormDefault="qualified" xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="a" xmlns:a="a" xmlns:b="b">
+
+ <xs:element name="doc" type="a:derived"/>
+ <xs:complexType name="base">
+     <xs:sequence>
+	<xs:element name="sub" type="a:derived2"/>
+     </xs:sequence>
+     <xs:attributeGroup ref="a:attG-a1"/>
+ </xs:complexType>
+
+ <xs:complexType name="derived">
+    <xs:complexContent>
+	<xs:extension base="a:base">
+     <xs:sequence />
+     <xs:attributeGroup ref="a:attG-a2"/>
+	</xs:extension>
+    </xs:complexContent>
+ </xs:complexType>
+
+<xs:complexType name="base2">
+     <xs:sequence />
+     <xs:attributeGroup ref="a:attG1-54"/>
+ </xs:complexType>
+
+ <xs:complexType name="derived2">
+    <xs:complexContent>
+	<xs:extension base="a:base2">
+     <xs:sequence />
+     <xs:attributeGroup ref="a:attG2-54"/>
+	</xs:extension>
+    </xs:complexContent>
+ </xs:complexType>
+
+
+ <xs:attribute name="attA"/>
+ <xs:attributeGroup name="attG-a1">
+     <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="attG-a2">
+     <xs:anyAttribute namespace="##targetNamespace b c" processContents="lax"/>
+ </xs:attributeGroup>
+
+<xs:attributeGroup name="attG1-54">
+     <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:attributeGroup>
+
+ <xs:attributeGroup name="attG2-54">
+     <xs:anyAttribute namespace="##local b c" processContents="lax"/>
+ </xs:attributeGroup>
+
+</xs:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6964720Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6964720Test.java
new file mode 100644
index 00000000000..4c287f77f35
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6964720Test.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation.tck;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6964720
+ * @summary Test Schema doesn't allow the inexpressible union of two attribute wildcards.
+ */
+public class Bug6964720Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test() {
+        try {
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            Schema schema = schemaFactory.newSchema(new StreamSource(Bug6964720Test.class.getResourceAsStream("Bug6964720.xsd")));
+            Assert.fail("should produce an error message");
+        } catch (SAXException e) {
+            System.out.println(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/RegexTest_1258.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/RegexTest_1258.xsd
new file mode 100644
index 00000000000..1ae5e992989
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/RegexTest_1258.xsd
@@ -0,0 +1,15 @@
+<xs:schema  xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+  
+  <xs:element name='doc'>
+    <xs:complexType>
+      <xs:attribute name='value'>
+        <xs:simpleType>
+          <xs:restriction base='xs:string'>
+            <xs:pattern value='abc)'/>
+          </xs:restriction>
+        </xs:simpleType>
+      </xs:attribute>
+    </xs:complexType>
+  </xs:element>
+
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD10.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD10.xsd
new file mode 100644
index 00000000000..65e32e116f5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD10.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+>
+
+<!-- 
+base='string', pattern='(a))', value='', type='error', RULE='2,3,4,5,6,7,8,9'
+-->
+
+<xsd:element name="doc">
+    <xsd:complexType>
+            <xsd:choice>
+                <xsd:element name="elem" type="Regex" minOccurs="1" maxOccurs="unbounded"/>
+            </xsd:choice>
+    </xsd:complexType>
+</xsd:element>
+
+<xsd:simpleType name="Regex">
+       <xsd:restriction base="xsd:string">
+           <xsd:pattern value="(a))"/>    
+       </xsd:restriction>
+</xsd:simpleType>
+
+
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD11.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD11.xsd
new file mode 100644
index 00000000000..98408c75f3d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD11.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+>
+
+<!-- 
+base='string', pattern='ab|(d))', value='', type='error', RULE='2,3,4,5,6,7,8,9'
+-->
+
+<xsd:element name="doc">
+    <xsd:complexType>
+            <xsd:choice>
+                <xsd:element name="elem" type="Regex" minOccurs="1" maxOccurs="unbounded"/>
+            </xsd:choice>
+    </xsd:complexType>
+</xsd:element>
+
+<xsd:complexType name="Regex">
+   <xsd:attribute name="att">
+       <xsd:simpleType>
+           <xsd:restriction base="xsd:string">
+               <xsd:pattern value="ab|(d))"/>    
+           </xsd:restriction>
+       </xsd:simpleType>
+   </xsd:attribute>
+</xsd:complexType>
+
+
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD12.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD12.xsd
new file mode 100644
index 00000000000..c148d59333c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reD12.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+>
+
+<!-- 
+base='string', pattern='((a*(b*)((a))*(a))))', value='', type='error', RULE='2,3,4,5,6,7,8,9'
+-->
+
+<xsd:element name="doc">
+    <xsd:complexType>
+            <xsd:choice>
+                <xsd:element name="elem" type="Regex" minOccurs="1" maxOccurs="unbounded"/>
+            </xsd:choice>
+    </xsd:complexType>
+</xsd:element>
+
+<xsd:simpleType name="Regex">
+       <xsd:restriction base="xsd:string">
+           <xsd:pattern value="((a*(b*)((a))*(a))))"/>    
+       </xsd:restriction>
+</xsd:simpleType>
+
+
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reE9.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reE9.xsd
new file mode 100644
index 00000000000..907efb9e4fb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214/reE9.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+>
+
+<!-- 
+base='string', pattern=')', value='', type='error', RULE='10'
+-->
+
+<xsd:element name="doc">
+    <xsd:complexType>
+            <xsd:choice>
+                <xsd:element name="elem" type="Regex" minOccurs="1" maxOccurs="unbounded"/>
+            </xsd:choice>
+    </xsd:complexType>
+</xsd:element>
+
+<xsd:complexType name="Regex">
+   <xsd:attribute name="att">
+       <xsd:simpleType>
+           <xsd:restriction base="xsd:string">
+               <xsd:pattern value=")"/>    
+           </xsd:restriction>
+       </xsd:simpleType>
+   </xsd:attribute>
+</xsd:complexType>
+
+
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214Test.java
new file mode 100644
index 00000000000..6f9a81998ce
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6967214Test.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation.tck;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6967214
+ * @summary Test Schema doesn't allow unpaired parenthesises in regex.
+ */
+public class Bug6967214Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test() {
+        try {
+            File dir = new File(Bug6967214Test.class.getResource("Bug6967214").getPath());
+            File files[] = dir.listFiles();
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            for (int i = 0; i < files.length; i++) {
+                try {
+                    System.out.println(files[i].getName());
+                    Schema schema = schemaFactory.newSchema(new StreamSource(files[i]));
+                    Assert.fail("should report error");
+                } catch (org.xml.sax.SAXParseException spe) {
+                    continue;
+                }
+            }
+        } catch (SAXException e) {
+            e.printStackTrace();
+
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890.xsd
new file mode 100644
index 00000000000..c332826ceb8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890.xsd
@@ -0,0 +1,11 @@
+<xs:schema  xmlns:xs='http://www.w3.org/2001/XMLSchema'>
+<xs:element name='doc'><xs:complexType><xs:attribute name='value'>
+  <xs:simpleType>
+    <xs:restriction base='xs:string'>
+      <xs:pattern value='a[-]?c'/>
+    </xs:restriction>
+  </xs:simpleType>
+</xs:attribute></xs:complexType>
+</xs:element>
+</xs:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890Test.java
new file mode 100644
index 00000000000..6daab87a8a2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890Test.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation.tck;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6970890
+ * @summary Test Schema allows [-] in regex.
+ */
+public class Bug6970890Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test_RegexTest_1319() {
+        try {
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            Schema schema = schemaFactory.newSchema(new StreamSource(Bug6970890Test.class.getResourceAsStream("Bug6970890.xsd")));
+
+        } catch (SAXException e) {
+            e.printStackTrace();
+            Assert.fail("The - character is a valid character range at the beginning or end of a positive character group");
+        }
+    }
+
+    @Test
+    public void test_reH16() {
+        try {
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            Schema schema = schemaFactory.newSchema(new StreamSource(Bug6970890Test.class.getResourceAsStream("Bug6970890_1.xsd")));
+
+        } catch (SAXException e) {
+            e.printStackTrace();
+            Assert.fail("The - character is a valid character range at the beginning or end of a positive character group");
+
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890_1.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890_1.xsd
new file mode 100644
index 00000000000..b48c7553b98
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6970890_1.xsd
@@ -0,0 +1,24 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+<!--
+base='string', pattern='[-]', value='-', type='valid', RULE='22'
+-->
+
+<xsd:element name="doc">
+    <xsd:complexType>
+            <xsd:choice>
+                <xsd:element name="elem" type="Regex" minOccurs="1" maxOccurs="unbounded"/>
+            </xsd:choice>
+    </xsd:complexType>
+</xsd:element>
+
+<xsd:simpleType name="Regex">
+       <xsd:restriction base="xsd:string">
+           <xsd:pattern value="[-]"/>
+       </xsd:restriction>
+</xsd:simpleType>
+
+
+</xsd:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190.xml
new file mode 100644
index 00000000000..d8b94d4b31e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190.xml
@@ -0,0 +1,210 @@
+<?xml version="1.0"?>
+<doc  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+    xsi:noNamespaceSchemaLocation='Bug6971190.xsd' >
+
+<!--
+base='string', pattern='\d', value='#x1040;', type='valid', RULE='37'
+-->
+
+<value>&#x0030;</value>
+<value>&#x0031;</value>
+<value>&#x0032;</value>
+<value>&#x0033;</value>
+<value>&#x0034;</value>
+<value>&#x0035;</value>
+<value>&#x0036;</value>
+<value>&#x0037;</value>
+<value>&#x0038;</value>
+<value>&#x0039;</value>
+<value>&#x0660;</value>
+<value>&#x0661;</value>
+<value>&#x0662;</value>
+<value>&#x0663;</value>
+<value>&#x0664;</value>
+<value>&#x0665;</value>
+<value>&#x0666;</value>
+<value>&#x0667;</value>
+<value>&#x0668;</value>
+<value>&#x0669;</value>
+<value>&#x06F0;</value>
+<value>&#x06F1;</value>
+<value>&#x06F2;</value>
+<value>&#x06F3;</value>
+<value>&#x06F4;</value>
+<value>&#x06F5;</value>
+<value>&#x06F6;</value>
+<value>&#x06F7;</value>
+<value>&#x06F8;</value>
+<value>&#x06F9;</value>
+<value>&#x0966;</value>
+<value>&#x0967;</value>
+<value>&#x0968;</value>
+<value>&#x0969;</value>
+<value>&#x096A;</value>
+<value>&#x096B;</value>
+<value>&#x096C;</value>
+<value>&#x096D;</value>
+<value>&#x096E;</value>
+<value>&#x096F;</value>
+<value>&#x09E6;</value>
+<value>&#x09E7;</value>
+<value>&#x09E8;</value>
+<value>&#x09E9;</value>
+<value>&#x09EA;</value>
+<value>&#x09EB;</value>
+<value>&#x09EC;</value>
+<value>&#x09ED;</value>
+<value>&#x09EE;</value>
+<value>&#x09EF;</value>
+<value>&#x0A66;</value>
+<value>&#x0A67;</value>
+<value>&#x0A68;</value>
+<value>&#x0A69;</value>
+<value>&#x0A6A;</value>
+<value>&#x0A6B;</value>
+<value>&#x0A6C;</value>
+<value>&#x0A6D;</value>
+<value>&#x0A6E;</value>
+<value>&#x0A6F;</value>
+<value>&#x0AE6;</value>
+<value>&#x0AE7;</value>
+<value>&#x0AE8;</value>
+<value>&#x0AE9;</value>
+<value>&#x0AEA;</value>
+<value>&#x0AEB;</value>
+<value>&#x0AEC;</value>
+<value>&#x0AED;</value>
+<value>&#x0AEE;</value>
+<value>&#x0AEF;</value>
+<value>&#x0B66;</value>
+<value>&#x0B67;</value>
+<value>&#x0B68;</value>
+<value>&#x0B69;</value>
+<value>&#x0B6A;</value>
+<value>&#x0B6B;</value>
+<value>&#x0B6C;</value>
+<value>&#x0B6D;</value>
+<value>&#x0B6E;</value>
+<value>&#x0B6F;</value>
+<value>&#x0BE7;</value>
+<value>&#x0BE8;</value>
+<value>&#x0BE9;</value>
+<value>&#x0BEA;</value>
+<value>&#x0BEB;</value>
+<value>&#x0BEC;</value>
+<value>&#x0BED;</value>
+<value>&#x0BEE;</value>
+<value>&#x0BEF;</value>
+<value>&#x0C66;</value>
+<value>&#x0C67;</value>
+<value>&#x0C68;</value>
+<value>&#x0C69;</value>
+<value>&#x0C6A;</value>
+<value>&#x0C6B;</value>
+<value>&#x0C6C;</value>
+<value>&#x0C6D;</value>
+<value>&#x0C6E;</value>
+<value>&#x0C6F;</value>
+<value>&#x0CE6;</value>
+<value>&#x0CE7;</value>
+<value>&#x0CE8;</value>
+<value>&#x0CE9;</value>
+<value>&#x0CEA;</value>
+<value>&#x0CEB;</value>
+<value>&#x0CEC;</value>
+<value>&#x0CED;</value>
+<value>&#x0CEE;</value>
+<value>&#x0CEF;</value>
+<value>&#x0D66;</value>
+<value>&#x0D67;</value>
+<value>&#x0D68;</value>
+<value>&#x0D69;</value>
+<value>&#x0D6A;</value>
+<value>&#x0D6B;</value>
+<value>&#x0D6C;</value>
+<value>&#x0D6D;</value>
+<value>&#x0D6E;</value>
+<value>&#x0D6F;</value>
+<value>&#x0E50;</value>
+<value>&#x0E51;</value>
+<value>&#x0E52;</value>
+<value>&#x0E53;</value>
+<value>&#x0E54;</value>
+<value>&#x0E55;</value>
+<value>&#x0E56;</value>
+<value>&#x0E57;</value>
+<value>&#x0E58;</value>
+<value>&#x0E59;</value>
+<value>&#x0ED0;</value>
+<value>&#x0ED1;</value>
+<value>&#x0ED2;</value>
+<value>&#x0ED3;</value>
+<value>&#x0ED4;</value>
+<value>&#x0ED5;</value>
+<value>&#x0ED6;</value>
+<value>&#x0ED7;</value>
+<value>&#x0ED8;</value>
+<value>&#x0ED9;</value>
+<value>&#x0F20;</value>
+<value>&#x0F21;</value>
+<value>&#x0F22;</value>
+<value>&#x0F23;</value>
+<value>&#x0F24;</value>
+<value>&#x0F25;</value>
+<value>&#x0F26;</value>
+<value>&#x0F27;</value>
+<value>&#x0F28;</value>
+<value>&#x0F29;</value>
+<value>&#x1040;</value>
+<value>&#x1041;</value>
+<value>&#x1042;</value>
+<value>&#x1043;</value>
+<value>&#x1044;</value>
+<value>&#x1045;</value>
+<value>&#x1046;</value>
+<value>&#x1047;</value>
+<value>&#x1048;</value>
+<value>&#x1049;</value>
+<value>&#x1369;</value>
+<value>&#x136A;</value>
+<value>&#x136B;</value>
+<value>&#x136C;</value>
+<value>&#x136D;</value>
+<value>&#x136E;</value>
+<value>&#x136F;</value>
+<value>&#x1370;</value>
+<value>&#x1371;</value>
+<value>&#x17E0;</value>
+<value>&#x17E1;</value>
+<value>&#x17E2;</value>
+<value>&#x17E3;</value>
+<value>&#x17E4;</value>
+<value>&#x17E5;</value>
+<value>&#x17E6;</value>
+<value>&#x17E7;</value>
+<value>&#x17E8;</value>
+<value>&#x17E9;</value>
+<value>&#x1810;</value>
+<value>&#x1811;</value>
+<value>&#x1812;</value>
+<value>&#x1813;</value>
+<value>&#x1814;</value>
+<value>&#x1815;</value>
+<value>&#x1816;</value>
+<value>&#x1817;</value>
+<value>&#x1818;</value>
+<value>&#x1819;</value>
+<value>&#xFF10;</value>
+<value>&#xFF11;</value>
+<value>&#xFF12;</value>
+<value>&#xFF13;</value>
+<value>&#xFF14;</value>
+<value>&#xFF15;</value>
+<value>&#xFF16;</value>
+<value>&#xFF17;</value>
+<value>&#xFF18;</value>
+<value>&#xFF19;</value>
+
+<!--reS21--> <value>&#x1D7CE;</value>
+<!--reS42--> <value>&#x1D7FF;</value>
+ </doc>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190.xsd
new file mode 100644
index 00000000000..aaa885040e3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+<!--
+base='string', pattern='\d', value='#x1040;', type='valid', RULE='37'
+-->
+
+<xsd:element name="doc">
+    <xsd:complexType>
+            <xsd:choice>
+                <xsd:element name="value" type="Regex" minOccurs="1" maxOccurs="unbounded"/>
+            </xsd:choice>
+    </xsd:complexType>
+</xsd:element>
+
+<xsd:simpleType name="Regex">
+       <xsd:restriction base="xsd:string">
+           <xsd:pattern value="\d"/>
+       </xsd:restriction>
+</xsd:simpleType>
+
+
+
+</xsd:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190Test.java
new file mode 100644
index 00000000000..0d20968ae0a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190Test.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation.tck;
+
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6971190
+ * @summary Test Validation accepts UTF lexical presentation.
+ */
+public class Bug6971190Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test() {
+        try {
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+            Schema schema = schemaFactory.newSchema(new StreamSource(Bug6971190Test.class.getResourceAsStream("Bug6971190.xsd")));
+            Validator validator = schema.newValidator();
+            /**
+             * validator.setErrorHandler(new ErrorHandler() { public void
+             * error(SAXParseException exception) throws SAXException {
+             * exception.printStackTrace(); }
+             *
+             * public void fatalError(SAXParseException exception) throws
+             * SAXException { exception.printStackTrace(); }
+             *
+             * public void warning(SAXParseException exception) throws
+             * SAXException { exception.printStackTrace(); } });
+             */
+            validator.validate(new StreamSource(Bug6971190Test.class.getResourceAsStream("Bug6971190.xml")));
+
+        } catch (SAXException e) {
+            System.out.println(e.getMessage());
+            Assert.fail(e.getMessage());
+
+        } catch (IOException e) {
+            e.printStackTrace();
+            System.out.println(e.getMessage());
+            Assert.fail(e.getMessage());
+        }
+    }
+
+    // test \W negative tests with positibve \w
+    @Test
+    public void testNegative() {
+        try {
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+            Schema schema = schemaFactory.newSchema(new StreamSource(Bug6971190Test.class.getResourceAsStream("Bug6971190_v.xsd")));
+            Validator validator = schema.newValidator();
+
+            validator.validate(new StreamSource(Bug6971190Test.class.getResourceAsStream("Bug6971190_v.xml")));
+
+        } catch (SAXException e) {
+            e.printStackTrace();
+            Assert.fail(e.getMessage());
+
+        } catch (IOException e) {
+            e.printStackTrace();
+            System.out.println(e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190_v.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190_v.xml
new file mode 100644
index 00000000000..22d377e7e23
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190_v.xml
@@ -0,0 +1,44 @@
+<?xml version="1.0"?>
+<doc  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+    xsi:noNamespaceSchemaLocation='Bug6971190_v.xsd' >
+
+<!--
+negative tests
+-->
+
+<!--reV10--> <elem>&#x2B0;</elem>
+<!--reV11--> <elem>&#x2B0;</elem>
+<!--reV12--> <elem>&#xFF9F;</elem>
+<!--reV15--> <elem>&#x2FA1D;</elem>
+<!--reV16--> <!--elem>&#x64B;</elem  064b is ARABIC FATHATAN, not a letter according to Character.isLetter, the current range \u0641\u064a (Arabic letters) is correct-->
+<!--reV17--> <!-- elem>&#x1D1AD;</elem MUSICAL SYMBOL COMBINING SNAP PIZZICATO, is not a letter-->
+<!--reV18--> <!-- elem>&#x903;</elem  'DEVANAGARI SIGN VISARGA' , not a letter -->
+<!--reV19--> <!-- elem>&#x1D172;</elem 'MUSICAL SYMBOL COMBINING FLAG-5', not a letter -->
+<!--reV20--> <!-- elem>&#x903;</elem -->
+<!--reV21--> <!-- elem>&#x1D172;</elem -->
+<!--reV22 elem text--> <!-- elem>&#x20DD;</elem 'COMBINING ENCLOSING CIRCLE' , not a letter -->
+<!--reV23 attribute--> <!--elem>&#x20DD;</elem-->
+<!--reV24--> <!-- elem>&#x20E2;</elem 'COMBINING ENCLOSING SCREEN' , not a letter -->
+<!--reV26--> <elem>&#x1D7FF;</elem> <!-- 1D7FF 'MATHEMATICAL MONOSPACE DIGIT NINE', added to digit range -->
+<!--reV27--> <!-- elem>&#x1034A;</elem 'GOTHIC LETTER NINE HUNDRED', not a letter -->
+<!--reV28--> <!--elem>&#x1034A;</elem-->
+<!--reV30--> <!-- elem>&#xB2;</elem 'SUPERSCRIPT TWO', not a letter -->
+<!--reV31--> <!-- elem>&#xB2;</elem-->
+<!--reV32--> <!-- elem>&#x10323;</elem OLD ITALIC NUMERAL FIFTY, not a letter. In fact, none of the OLD ITALIC NUMERALs are considered letter -->
+<!--reV33--> <!-- elem>&#x2044;</elem 'FRACTION SLASH' , not a letter -->
+<!--reV34--> <!-- elem>&#xFFE2;</elem 'FULLWIDTH NOT SIGN', not a letter -->
+<!--reV35--> <!-- elem>&#x20A0;</elem 'EURO-CURRENCY SIGN', not a letter -->
+<!--reV36--> <!-- elem>&#x20A0;</elem -->
+<!--reV37--> <!-- elem>&#xFFE6;</elem 'FULLWIDTH WON SIGN' , not a letter -->
+<!--reV38--> <!-- elem>&#x309B;</elem 'KATAKANA-HIRAGANA VOICED SOUND MARK', not a letter -->
+<!--reV39--> <!-- elem>&#x309B;</elem -->
+<!--reV40--> <!-- elem>&#xFFE3;</elem 'FULLWIDTH MACRON', not a letter -->
+<!--reV41--> <!-- elem>&#x3190;</elem 'IDEOGRAPHIC ANNOTATION LINKING MARK', not a letter -->
+<!--reV42--> <!-- elem>&#x3190;</elem-->
+<!--reV43--> <!-- elem>&#x1D1DD;</elem 'MUSICAL SYMBOL PES SUBPUNCTIS', not a letter -->
+<!--reV3--> <elem>&#x1D7A8;</elem>
+<!--reV6--> <elem>&#x1D7C9;</elem>
+<!--reV7--> <elem>&#x1C5;</elem>
+<!--reV8--> <elem>&#x1C5;</elem>
+
+ </doc>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190_v.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190_v.xsd
new file mode 100644
index 00000000000..0ebfd866c04
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6971190_v.xsd
@@ -0,0 +1,30 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+<!--
+base='string', pattern='\d', value='#x1040;', type='valid', RULE='37'
+-->
+
+<xsd:element name="doc">
+    <xsd:complexType>
+            <xsd:choice>
+                <xsd:element name="elem" type="RegexW" minOccurs="1" maxOccurs="unbounded"/>
+            </xsd:choice>
+    </xsd:complexType>
+</xsd:element>
+
+<xsd:simpleType name="Regex">
+       <xsd:restriction base="xsd:string">
+           <xsd:pattern value="\d"/>
+       </xsd:restriction>
+</xsd:simpleType>
+
+<xsd:simpleType name="RegexW">
+       <xsd:restriction base="xsd:string">
+           <xsd:pattern value="\w"/>
+       </xsd:restriction>
+</xsd:simpleType>
+
+
+</xsd:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551.xml
new file mode 100644
index 00000000000..02818c373fd
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Bug6974551.xsd">
+	<fooTest>
+    test
+
+
+
+    information
+	</fooTest>
+</root>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551.xsd
new file mode 100644
index 00000000000..3a4d762f785
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551.xsd
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+	<xs:element name="root">
+		<xs:complexType>
+			<xs:sequence>
+				<xs:element name="fooTest" type="xs:anySimpleType" fixed="test information"/>
+			</xs:sequence>
+		</xs:complexType>
+	</xs:element>
+</xs:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551Test.java
new file mode 100644
index 00000000000..0b4f7e53678
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6974551Test.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation.tck;
+
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6974551
+ * @summary Test Validation for SAXParser can expose whitespace facet for xs:anySimpleType.
+ */
+public class Bug6974551Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    static String _xml = Bug6974551Test.class.getResource("Bug6974551.xml").getPath();
+    static String _xsd = Bug6974551Test.class.getResource("Bug6974551.xsd").getPath();
+
+    @Test
+    public void testSAX() {
+        try {
+            Schema schema = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI).newSchema(new StreamSource(_xsd));
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            spf.setValidating(true);
+            spf.setSchema(schema);
+            SAXParser parser = spf.newSAXParser();
+            MyErrorHandler errorHandler = new MyErrorHandler();
+            parser.parse(_xml, errorHandler);
+            if (!errorHandler.errorOccured) {
+                Assert.fail("should report error");
+            }
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testValidationAPI() {
+        try {
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+            Schema schema = schemaFactory.newSchema(new StreamSource(_xsd));
+            Validator validator = schema.newValidator();
+            validator.validate(new StreamSource(_xml));
+
+            Assert.fail("should report error");
+        } catch (SAXException e) {
+            // expected, pass
+            System.out.println(e.getMessage());
+        } catch (IOException e) {
+            Assert.fail(e.getMessage());
+            System.out.println(e.getMessage());
+        }
+    }
+
+    class MyErrorHandler extends DefaultHandler {
+
+        public boolean errorOccured = false;
+
+        public void error(SAXParseException e) throws SAXException {
+
+            System.err.println("Error: " + "[[" + e.getPublicId() + "]" + "[" + e.getSystemId() + "]]" + "[[" + e.getLineNumber() + "]" + "["
+                    + e.getColumnNumber() + "]] " + e);
+
+            errorOccured = true;
+        }
+
+        public void fatalError(SAXParseException e) throws SAXException {
+
+            System.err.println("Fatal Error: " + e);
+
+            errorOccured = true;
+        }
+
+        public void warning(SAXParseException e) throws SAXException {
+
+            System.err.println("Warning: " + e);
+
+            errorOccured = true;
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF025.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF025.xsd
new file mode 100644
index 00000000000..c1d05fea41e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF025.xsd
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+	<xsd:simpleType name="foo">
+		<xsd:restriction base="xsd:string">
+			<xsd:enumeration value="1 2">
+				<xsd:notation name="jpeg" public="image/jpeg" system="viewer.exe"/>
+			</xsd:enumeration>
+		</xsd:restriction>
+	</xsd:simpleType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF037.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF037.xsd
new file mode 100644
index 00000000000..b5f49849f97
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF037.xsd
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+	<xsd:element name="foo">
+		<xsd:key name="bar">
+			<xsd:notation name="jpeg" public="image/jpeg" system="viewer.exe"/>
+			<xsd:selector xpath="//"/>
+			<xsd:field/>
+		</xsd:key>
+	</xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF041.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF041.xsd
new file mode 100644
index 00000000000..0218d1b9118
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF041.xsd
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+	<xsd:simpleType name="foo">
+		<xsd:restriction base="xsd:string">
+			<xsd:length value="8">
+				<xsd:notation name="jpeg" public="image/jpeg" system="viewer.exe"/>
+			</xsd:length>
+		</xsd:restriction>
+	</xsd:simpleType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF045.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF045.xsd
new file mode 100644
index 00000000000..f4ef36408da
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF045.xsd
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+	<xsd:simpleType name="foo">
+		<xsd:restriction base="xsd:integer">
+			<xsd:maxInclusive value="0">
+				<xsd:notation name="jpeg" public="image/jpeg" system="viewer.exe"/>
+			</xsd:maxInclusive>
+		</xsd:restriction>
+	</xsd:simpleType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF049.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF049.xsd
new file mode 100644
index 00000000000..c7eadd610c1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265/notatF049.xsd
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+	<xsd:simpleType name="foo">
+		<xsd:restriction base="xsd:integer">
+			<xsd:minInclusive value="0">
+				<xsd:notation name="jpeg" public="image/jpeg" system="viewer.exe"/>
+			</xsd:minInclusive>
+		</xsd:restriction>
+	</xsd:simpleType>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265Test.java
new file mode 100644
index 00000000000..8149e386d50
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6975265Test.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation.tck;
+
+import java.io.File;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6975265
+ * @summary Test Schema doesn't allow some Element Information Items contain other element information item.
+ */
+public class Bug6975265Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test() {
+        try {
+            File dir = new File(Bug6975265Test.class.getResource("Bug6975265").getPath());
+            File files[] = dir.listFiles();
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            for (int i = 0; i < files.length; i++) {
+                try {
+                    System.out.println(files[i].getName());
+                    Schema schema = schemaFactory.newSchema(new StreamSource(files[i]));
+                    Assert.fail("should report error");
+                } catch (org.xml.sax.SAXParseException spe) {
+                    System.out.println(spe.getMessage());
+                    continue;
+                }
+            }
+        } catch (SAXException e) {
+            e.printStackTrace();
+
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA2.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA2.xml
new file mode 100644
index 00000000000..7a6886461ad
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA2.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<doc  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+    xsi:noNamespaceSchemaLocation='reA2.xsd' >
+
+<!-- 
+base='string', pattern='', value='a', type='invalid', RULE='1'
+-->
+
+     <elem>a</elem>
+
+ </doc>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA2.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA2.xsd
new file mode 100644
index 00000000000..50ae25d71fa
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA2.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+>
+
+<!-- 
+base='string', pattern='', value='a', type='invalid', RULE='1'
+-->
+
+<xsd:element name="doc">
+    <xsd:complexType>
+            <xsd:choice>
+                <xsd:element name="elem" type="Regex" minOccurs="1" maxOccurs="unbounded"/>
+            </xsd:choice>
+    </xsd:complexType>
+</xsd:element>
+
+<xsd:simpleType name="Regex">
+       <xsd:restriction base="xsd:string">
+           <xsd:pattern value=""/>
+       </xsd:restriction>
+</xsd:simpleType>
+
+
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA3.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA3.xml
new file mode 100644
index 00000000000..0afddb9c781
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA3.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<doc  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+    xsi:noNamespaceSchemaLocation='reA3.xsd' >
+
+<!-- 
+base='string', pattern='', value='#x20;', type='invalid', RULE='1'
+-->
+
+      <elem att='#x20;'/>
+
+ </doc>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA3.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA3.xsd
new file mode 100644
index 00000000000..3df7ad7fe72
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA3.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+>
+
+<!-- 
+base='string', pattern='', value='#x20;', type='invalid', RULE='1'
+-->
+
+<xsd:element name="doc">
+    <xsd:complexType>
+            <xsd:choice>
+                <xsd:element name="elem" type="Regex" minOccurs="1" maxOccurs="unbounded"/>
+            </xsd:choice>
+    </xsd:complexType>
+</xsd:element>
+
+<xsd:complexType name="Regex">
+   <xsd:attribute name="att">
+       <xsd:simpleType>
+           <xsd:restriction base="xsd:string">
+               <xsd:pattern value=""/>    
+           </xsd:restriction>
+       </xsd:simpleType>
+   </xsd:attribute>
+</xsd:complexType>
+
+
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA4.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA4.xml
new file mode 100644
index 00000000000..b4314254a55
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA4.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<doc  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+    xsi:noNamespaceSchemaLocation='reA4.xsd' >
+
+<!-- 
+base='string', pattern='', value='#xD;', type='invalid', RULE='1'
+-->
+
+     <elem>#xD;</elem>
+
+ </doc>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA4.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA4.xsd
new file mode 100644
index 00000000000..30368e846ab
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA4.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+>
+
+<!-- 
+base='string', pattern='', value='#xD;', type='invalid', RULE='1'
+-->
+
+<xsd:element name="doc">
+    <xsd:complexType>
+            <xsd:choice>
+                <xsd:element name="elem" type="Regex" minOccurs="1" maxOccurs="unbounded"/>
+            </xsd:choice>
+    </xsd:complexType>
+</xsd:element>
+
+<xsd:simpleType name="Regex">
+       <xsd:restriction base="xsd:string">
+           <xsd:pattern value=""/>    
+       </xsd:restriction>
+</xsd:simpleType>
+
+
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA5.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA5.xml
new file mode 100644
index 00000000000..04468dbbf60
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA5.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<doc  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+    xsi:noNamespaceSchemaLocation='reA5.xsd' >
+
+<!-- 
+base='string', pattern='', value='#x9;', type='invalid', RULE='1'
+-->
+
+      <elem att='#x9;'/>
+
+ </doc>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA5.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA5.xsd
new file mode 100644
index 00000000000..db8516d06a0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA5.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+>
+
+<!-- 
+base='string', pattern='', value='#x9;', type='invalid', RULE='1'
+-->
+
+<xsd:element name="doc">
+    <xsd:complexType>
+            <xsd:choice>
+                <xsd:element name="elem" type="Regex" minOccurs="1" maxOccurs="unbounded"/>
+            </xsd:choice>
+    </xsd:complexType>
+</xsd:element>
+
+<xsd:complexType name="Regex">
+   <xsd:attribute name="att">
+       <xsd:simpleType>
+           <xsd:restriction base="xsd:string">
+               <xsd:pattern value=""/>    
+           </xsd:restriction>
+       </xsd:simpleType>
+   </xsd:attribute>
+</xsd:complexType>
+
+
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA6.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA6.xml
new file mode 100644
index 00000000000..06d45074c99
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA6.xml
@@ -0,0 +1,11 @@
+<?xml version="1.0"?>
+<doc  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
+    xsi:noNamespaceSchemaLocation='reA6.xsd' >
+
+<!-- 
+base='string', pattern='', value='#xA;', type='invalid', RULE='1'
+-->
+
+     <elem>#xA;</elem>
+
+ </doc>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA6.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA6.xsd
new file mode 100644
index 00000000000..ce66fdbe81b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201/reA6.xsd
@@ -0,0 +1,25 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+>
+
+<!-- 
+base='string', pattern='', value='#xA;', type='invalid', RULE='1'
+-->
+
+<xsd:element name="doc">
+    <xsd:complexType>
+            <xsd:choice>
+                <xsd:element name="elem" type="Regex" minOccurs="1" maxOccurs="unbounded"/>
+            </xsd:choice>
+    </xsd:complexType>
+</xsd:element>
+
+<xsd:simpleType name="Regex">
+       <xsd:restriction base="xsd:string">
+           <xsd:pattern value=""/>    
+       </xsd:restriction>
+</xsd:simpleType>
+
+
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201Test.java
new file mode 100644
index 00000000000..2b886fdc06a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6977201Test.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation.tck;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6977201
+ * @summary Test Validator interprets regex "" correctly.
+ */
+public class Bug6977201Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+
+    @Test
+    public void test() {
+        validate(Bug6977201Test.class.getResource("Bug6977201/reA2.xsd").getPath(), Bug6977201Test.class.getResource("Bug6977201/reA2.xml").getPath());
+        validate(Bug6977201Test.class.getResource("Bug6977201/reA3.xsd").getPath(), Bug6977201Test.class.getResource("Bug6977201/reA3.xml").getPath());
+        validate(Bug6977201Test.class.getResource("Bug6977201/reA4.xsd").getPath(), Bug6977201Test.class.getResource("Bug6977201/reA4.xml").getPath());
+        validate(Bug6977201Test.class.getResource("Bug6977201/reA5.xsd").getPath(), Bug6977201Test.class.getResource("Bug6977201/reA5.xml").getPath());
+        validate(Bug6977201Test.class.getResource("Bug6977201/reA6.xsd").getPath(), Bug6977201Test.class.getResource("Bug6977201/reA6.xml").getPath());
+    }
+
+    // JCK negative test
+    public void validate(String xsd, String xml) {
+        try {
+            Schema schema = schemaFactory.newSchema(new StreamSource(xsd));
+            Validator validator = schema.newValidator();
+            validator.validate(new StreamSource(xml));
+            Assert.fail("should report error");
+        } catch (Exception e) {
+            System.out.println(e.getMessage());
+            // e.printStackTrace();
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956.xml
new file mode 100644
index 00000000000..2a94e7bb546
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956.xml
@@ -0,0 +1,5 @@
+<root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Bug6989956.xsd">
+  <c>1</c>
+  <c>x</c>
+  <c>y</c>
+</root>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956.xsd
new file mode 100644
index 00000000000..971aba3af5f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956.xsd
@@ -0,0 +1,36 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+  <xsd:simpleType name="u1">
+        <xsd:union>
+          <xsd:simpleType>
+            <xsd:restriction base='xsd:nonNegativeInteger'/>
+          </xsd:simpleType>
+          <xsd:simpleType>
+            <xsd:restriction base='xsd:string'>
+              <xsd:enumeration value='x'/>
+              <xsd:enumeration value='y'/>
+            </xsd:restriction>
+          </xsd:simpleType>
+        </xsd:union>
+  </xsd:simpleType>
+
+  <xsd:simpleType name="u3">
+	<xsd:restriction base="u1">
+              <xsd:enumeration value='x'/>
+              <xsd:enumeration value='y'/>
+              <xsd:enumeration value='1'/>
+	</xsd:restriction>
+  </xsd:simpleType>
+  <xsd:element name="root">
+    <xsd:complexType>
+	<xsd:choice maxOccurs="40">
+		<xsd:element name="c" type="u3" minOccurs="0" maxOccurs="100"/>
+	</xsd:choice>
+    </xsd:complexType>
+  </xsd:element>
+
+
+
+</xsd:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956Test.java
new file mode 100644
index 00000000000..82cdf3fabc4
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug6989956Test.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation.tck;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+import javax.xml.validation.Validator;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6989956
+ * @summary Test Validation can process correctly that maxOccurs in Choice less than maxOccurs in Elements contained in the Choice.
+ */
+public class Bug6989956Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test() {
+        try {
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            schemaFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+
+            Schema schema = schemaFactory.newSchema(new StreamSource(Bug6989956Test.class.getResourceAsStream("Bug6989956.xsd")));
+
+            Validator validator = schema.newValidator();
+            validator.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+            validator.setErrorHandler(new ErrorHandler() {
+                public void error(SAXParseException exception) throws SAXException {
+                    exception.printStackTrace();
+                }
+
+                public void fatalError(SAXParseException exception) throws SAXException {
+                    exception.printStackTrace();
+                }
+
+                public void warning(SAXParseException exception) throws SAXException {
+                    exception.printStackTrace();
+                }
+            });
+
+            validator.validate(new StreamSource(Bug6989956Test.class.getResourceAsStream("Bug6989956.xml")));
+
+        } catch (SAXException e) {
+            System.out.println(e.getMessage());
+            // fail(e.getMessage());
+
+        } catch (IOException e) {
+            e.printStackTrace();
+            System.out.println(e.getMessage());
+            // fail(e.getMessage());
+        }
+    }
+
+    @Test
+    public void testInstance() throws ParserConfigurationException, SAXException, IOException {
+        System.out.println(Bug6989956Test.class.getResource("Bug6989956.xsd").getPath());
+        File schemaFile = new File(Bug6989956Test.class.getResource("Bug6989956.xsd").getPath());
+        SAXParser parser = createParser(schemaFile);
+
+        try {
+            parser.parse(Bug6989956Test.class.getResource("Bug6989956.xml").getPath(), new DefaultHandler());
+        } catch (SAXException e) {
+            e.printStackTrace();
+            Assert.fail("Fatal Error: " + strException(e));
+        }
+
+    }
+
+    protected SAXParser createParser(File schema) throws ParserConfigurationException, SAXException {
+
+        // create and initialize the parser
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        spf.setValidating(true);
+        SAXParser parser = spf.newSAXParser();
+        parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+
+        // set schemaLocation if possible
+        try {
+            parser.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource", schema);
+        } catch (SAXNotRecognizedException e) {
+            System.out.println("Warning: Property 'http://java.sun.com/xml/jaxp/properties/schemaSource' is not recognized.");
+        } catch (SAXNotSupportedException e) {
+            System.out.println("Warning: Property 'http://java.sun.com/xml/jaxp/properties/schemaSource' is not supported.");
+        }
+
+        return parser;
+    }
+
+    protected static String strException(Exception ex) {
+        StringBuffer sb = new StringBuffer();
+
+        while (ex != null) {
+            if (ex instanceof SAXParseException) {
+                SAXParseException e = (SAXParseException) ex;
+                sb.append("" + e.getSystemId() + "(" + e.getLineNumber() + "," + e.getColumnNumber() + "): " + e.getMessage());
+                ex = e.getException();
+            } else {
+                sb.append(ex);
+                ex = null;
+            }
+        }
+        return sb.toString();
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug7014246.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug7014246.xsd
new file mode 100644
index 00000000000..5966f8a356a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug7014246.xsd
@@ -0,0 +1,13 @@
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" >
+<xs:simpleType name="base">
+	<xs:restriction base="xs:time">
+		<xs:maxInclusive value="12:00:00-10:00"/>
+	</xs:restriction>
+</xs:simpleType>
+<xs:simpleType name="derived">
+	<xs:restriction base="base">
+		<xs:maxInclusive value="12:00:00-14:00"/>
+	</xs:restriction>
+</xs:simpleType>
+</xs:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug7014246Test.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug7014246Test.java
new file mode 100644
index 00000000000..0da53f664e3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/tck/Bug7014246Test.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.validation.tck;
+
+import javax.xml.XMLConstants;
+import javax.xml.transform.stream.StreamSource;
+import javax.xml.validation.Schema;
+import javax.xml.validation.SchemaFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 7014246
+ * @summary Test Schema doesn't allow maxInclusive of derived time type greater than the base.
+ */
+public class Bug7014246Test {
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test() {
+        try {
+            SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
+            Schema schema = schemaFactory.newSchema(new StreamSource(Bug7014246Test.class.getResourceAsStream("Bug7014246.xsd")));
+            Assert.fail("STATUS:Failed.The negative testcase unexpectedly passed.");
+        } catch (SAXException e) {
+            e.printStackTrace();
+
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test-element.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test-element.xsd
new file mode 100644
index 00000000000..ca1fb690bd5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test-element.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0">
+    <xsd:element name="CREMAS04">
+    <xsd:complexType>
+        <xsd:sequence>
+            <xsd:element name="E1LFA1H" minOccurs="0" maxOccurs="9999">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="MSGFN" minOccurs="0">
+                            <xsd:simpleType>
+                                <xsd:restriction base="xsd:string">
+                                    <xsd:maxLength value="3"/>
+                                </xsd:restriction>
+                            </xsd:simpleType>
+                        </xsd:element>
+                        <xsd:element name="MSGFN2" minOccurs="0">
+                            <xsd:simpleType>
+                                <xsd:restriction base="xsd:string">
+                                    <xsd:maxLength value="3"/>
+                                </xsd:restriction>
+                            </xsd:simpleType>
+                        </xsd:element>
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+        </xsd:sequence>
+    </xsd:complexType>
+    </xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test-sequence.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test-sequence.xsd
new file mode 100644
index 00000000000..649bd0c5886
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test-sequence.xsd
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.0">
+    <xsd:element name="CREMAS04">
+    <xsd:complexType>
+        <xsd:sequence maxOccurs="10000">
+            <xsd:element name="E1LFA1H" minOccurs="0" maxOccurs="9999">
+                <xsd:complexType>
+                    <xsd:sequence>
+                        <xsd:element name="MSGFN" minOccurs="0">
+                            <xsd:simpleType>
+                                <xsd:restriction base="xsd:string">
+                                    <xsd:maxLength value="3"/>
+                                </xsd:restriction>
+                            </xsd:simpleType>
+                        </xsd:element>
+                        <xsd:element name="MSGFN2" minOccurs="0">
+                            <xsd:simpleType>
+                                <xsd:restriction base="xsd:string">
+                                    <xsd:maxLength value="3"/>
+                                </xsd:restriction>
+                            </xsd:simpleType>
+                        </xsd:element>
+                    </xsd:sequence>
+                </xsd:complexType>
+            </xsd:element>
+        </xsd:sequence>
+    </xsd:complexType>
+    </xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test.xsd
new file mode 100644
index 00000000000..d964bf86ff3
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/test.xsd
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns:testNS="testNS"
+            targetNamespace="testNS" elementFormDefault="qualified">
+    <xsd:element name="test5" type="xsd:string"/>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/toys.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/toys.xml
new file mode 100644
index 00000000000..1d9fbe2df66
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/toys.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Document   : toys.xml
+    Created on : August 11, 2003, 6:42 PM
+    Author     : Prasad Subramanian
+    Description:
+-->
+
+<toys>
+    <toy>
+        <name>Lego-Model01</name>
+        <price>65.99</price>
+    </toy>
+    <toy>
+        <name>Lego-Model2</name>
+        <price>69.99</price>
+    </toy>
+    <toy>
+        <name>Lego-Model3</name>
+        <price>14.99</price>
+    </toy>
+    <toy>
+        <name>Barbie-Pink</name>
+        <price>12.99</price>
+    </toy>
+    <toy>
+        <name>Barbie-Blue</name>
+        <price>13.99</price>
+    </toy>        
+    <toy>
+        <name>Barbie-White</name>
+        <price>13.99</price>
+    </toy>   
+    <toy>
+        <name>Barbie-Plain</name>
+        <price>13.99</price>
+    </toy>           
+</toys>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/toys.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/toys.xsd
new file mode 100644
index 00000000000..31df3f1476f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/toys.xsd
@@ -0,0 +1,17 @@
+<?xml version="1.0"?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+  <xs:element name="toys">
+     <xs:complexType>
+       <xs:sequence>
+         <xs:element name="toy" maxOccurs="7">
+           <xs:complexType>
+             <xs:sequence>
+               <xs:element name="name" type="xs:string" minOccurs="0"/>
+               <xs:element name="price" type="xs:string" minOccurs="0"/>
+             </xs:sequence>
+          </xs:complexType>  
+        </xs:element>
+      </xs:sequence>
+    </xs:complexType>  
+  </xs:element>
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/types.xsd b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/types.xsd
new file mode 100644
index 00000000000..4bcc81d97b2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/types.xsd
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<xs:schema version="1.0" targetNamespace="http://server.type_substitution.fromjava/" xmlns:tns="http://server.type_substitution.fromjava/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+
+  <xs:element name="getSedans" type="tns:getSedans"/>
+
+  <xs:element name="getSedansResponse" type="tns:getSedansResponse"/>
+
+  <xs:complexType name="toyota">
+    <xs:complexContent>
+      <xs:extension base="tns:car">
+        <xs:sequence>
+          <xs:element name="color" type="xs:string" minOccurs="0"/>
+        </xs:sequence>
+      </xs:extension>
+    </xs:complexContent>
+  </xs:complexType>
+
+  <xs:complexType name="car" abstract="true">
+    <xs:sequence>
+      <xs:element name="make" type="xs:string" minOccurs="0"/>
+      <xs:element name="model" type="xs:string" minOccurs="0"/>
+      <xs:element name="year" type="xs:string" minOccurs="0"/>
+    </xs:sequence>
+  </xs:complexType>
+
+  <xs:complexType name="getSedans"/>
+
+  <xs:complexType name="getSedansResponse">
+    <xs:sequence>
+      <xs:element name="return" type="tns:car" maxOccurs="unbounded" minOccurs="0"/>
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991857.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991857.java
new file mode 100644
index 00000000000..5cdee0efd79
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991857.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.xpath;
+
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+
+
+/*
+ * @bug 4991857
+ * @summary XPath.evaluate(...) throws XPathExpressionException when context is null and expression refers to the context.
+ */
+public class Bug4991857 {
+
+    Document d = null;
+
+    XPathFactory xpathFactory = XPathFactory.newInstance();
+
+    @Test
+    public void testXPath09() throws Exception {
+        try {
+            XPath xpath = xpathFactory.newXPath();
+            Assert.assertNotNull(xpath);
+
+            Double result = (Double) xpath.evaluate("1+2", d, XPathConstants.NUMBER);
+        } catch (XPathExpressionException _) {
+            Assert.fail("Unexpected XPathExpressionException thrown");
+        }
+    }
+
+    @Test
+    public void testXPath10() throws Exception {
+        try {
+            XPath xpath = xpathFactory.newXPath();
+            Assert.assertNotNull(xpath);
+
+            xpath.evaluate(".", d, XPathConstants.STRING);
+            Assert.fail("XPathExpressionException not thrown");
+        } catch (XPathExpressionException e) {
+            // Expected exception as context node is null
+        }
+    }
+
+    @Test
+    public void testXPath11() throws Exception {
+        try {
+            Document d = null;
+
+            XPathFactory xpathFactory = XPathFactory.newInstance();
+            Assert.assertNotNull(xpathFactory);
+
+            XPath xpath = xpathFactory.newXPath();
+            Assert.assertNotNull(xpath);
+
+            String quantity = (String) xpath.evaluate("/widgets/widget[@name='a']/@quantity", d, XPathConstants.STRING);
+            Assert.fail("XPathExpressionException not thrown");
+        } catch (XPathExpressionException e) {
+            // Expected exception as context node is null
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991939.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991939.java
new file mode 100644
index 00000000000..55ad3df3763
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991939.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.xpath;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.QName;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 4991939
+ * @summary XPath.evaluate(...) throws IllegalArgumentException if returnType is not one of the types defined in XPathConstants.
+ */
+public class Bug4991939 {
+
+    @Test
+    public void testXPath13() throws Exception {
+        QName qname = new QName(XMLConstants.XML_NS_URI, "");
+
+        XPathFactory xpathFactory = XPathFactory.newInstance();
+        Assert.assertNotNull(xpathFactory);
+
+        XPath xpath = xpathFactory.newXPath();
+        Assert.assertNotNull(xpath);
+
+        try {
+            xpath.evaluate("1+1", (Object) null, qname);
+            Assert.fail("failed , expected IAE not thrown");
+        } catch (IllegalArgumentException e) {
+            ; // as expected
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992788.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992788.java
new file mode 100644
index 00000000000..3fe5f923b27
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992788.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.xpath;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+import javax.xml.xpath.XPathFactoryConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 4992788
+ * @summary Test XPath.evaluate(expression,source,returnType) throws NPE if source is null.
+ */
+public class Bug4992788 {
+
+    private static String expression = "/widgets/widget[@name='a']/@quantity";
+
+    // test for XPath.evaluate(java.lang.String expression, InputSource source)
+    // - default returnType is String
+    // source is null , should throw NPE
+    @Test
+    public void testXPath23() throws Exception {
+        try {
+            createXPath().evaluate(expression, (InputSource) null);
+            Assert.fail();
+        } catch (NullPointerException e) {
+            ; // as expected
+        }
+    }
+
+    // test for XPath.evaluate(java.lang.String expression, InputSource source,
+    // QName returnType)
+    // source is null , should throw NPE
+    @Test
+    public void testXPath28() throws Exception {
+        try {
+            createXPath().evaluate(expression, (InputSource) null, XPathConstants.STRING);
+            Assert.fail();
+        } catch (NullPointerException e) {
+            ; // as expected
+        }
+    }
+
+    private XPath createXPath() throws XPathFactoryConfigurationException {
+        XPathFactory xpathFactory = XPathFactory.newInstance();
+        Assert.assertNotNull(xpathFactory);
+        XPath xpath = xpathFactory.newXPath();
+        Assert.assertNotNull(xpath);
+        return xpath;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992793.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992793.java
new file mode 100644
index 00000000000..8552559019e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992793.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.xpath;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathFactory;
+import javax.xml.xpath.XPathFactoryConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 4992793
+ * @summary Test XPath.evaluate(expression,source,returnType) throws NPE if expression is null.
+ */
+public class Bug4992793 {
+
+
+    // test for XPath.evaluate(java.lang.String expression, InputSource source)
+    // - default returnType is String
+    // source is null , should throw NPE
+    @Test
+    public void testXPath24() throws Exception {
+        try {
+            createXPath().evaluate(null, new InputSource(new StringReader("<root/>")));
+            Assert.fail();
+        } catch (NullPointerException e) {
+            ; // as expected
+        }
+    }
+
+    // test for XPath.evaluate(java.lang.String expression, InputSource source,
+    // QName returnType)
+    // source is null , should throw NPE
+    @Test
+    public void testXPath29() throws Exception {
+        try {
+            createXPath().evaluate(null, new InputSource(new StringReader("<root/>")), XPathConstants.STRING);
+            Assert.fail();
+        } catch (NullPointerException e) {
+            ; // as expected
+        }
+    }
+
+    private XPath createXPath() throws XPathFactoryConfigurationException {
+        XPathFactory xpathFactory = XPathFactory.newInstance();
+        Assert.assertNotNull(xpathFactory);
+        XPath xpath = xpathFactory.newXPath();
+        Assert.assertNotNull(xpath);
+        return xpath;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992805.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992805.java
new file mode 100644
index 00000000000..71ab8d6c298
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4992805.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.xpath;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathFactory;
+import javax.xml.xpath.XPathFactoryConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 4992805
+ * @summary Test XPath.evaluate(expression,source,returnType) throws NPE if returnType is null.
+ */
+public class Bug4992805 {
+
+    private static String expression = "/widgets/widget[@name='a']/@quantity";
+
+    // test for XPath.evaluate(java.lang.String expression, InputSource source,
+    // QName returnType)
+    // source is null , should throw NPE
+    @Test
+    public void testXPath30() throws Exception {
+        try {
+            createXPath().evaluate(expression, new InputSource(new StringReader("<root/>")), null);
+            Assert.fail();
+        } catch (NullPointerException e) {
+            ; // as expected
+        }
+    }
+
+    private XPath createXPath() throws XPathFactoryConfigurationException {
+        XPathFactory xpathFactory = XPathFactory.newInstance();
+        Assert.assertNotNull(xpathFactory);
+        XPath xpath = xpathFactory.newXPath();
+        Assert.assertNotNull(xpath);
+        return xpath;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/ClassLoaderTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/ClassLoaderTest.java
new file mode 100644
index 00000000000..3ae3585ec16
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/ClassLoaderTest.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.xpath;
+
+import javax.xml.xpath.XPathFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6354969
+ * @summary Test XPathFactory newInstance() with ContextClassLoader.
+ */
+public class ClassLoaderTest {
+
+    @Test
+    public void testClassLoader() {
+        MyClassLoader cl = new MyClassLoader();
+        Thread.currentThread().setContextClassLoader(cl);
+        XPathFactory xPathFactory = XPathFactory.newInstance();
+
+        if (!cl.isCalled()) {
+            Assert.fail("Context class loader should be used.");
+        }
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/MyClassLoader.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/MyClassLoader.java
new file mode 100644
index 00000000000..73b86547214
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/MyClassLoader.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package javax.xml.xpath;
+
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+
+public class MyClassLoader extends ClassLoader {
+    boolean isCalled = false;
+
+    public URL getResource(String name) {
+        isCalled = true;
+        return super.getResource(name);
+    }
+
+    public Enumeration getResources(String name) throws IOException {
+        isCalled = true;
+        return super.getResources(name);
+    }
+
+    public void reset() {
+        isCalled = false;
+    }
+
+    public boolean isCalled() {
+        return isCalled;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/SecureProcessingTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/SecureProcessingTest.java
new file mode 100644
index 00000000000..50eea2738ed
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/SecureProcessingTest.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.xpath;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.XMLConstants;
+import javax.xml.namespace.NamespaceContext;
+import javax.xml.namespace.QName;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test when FEATURE_SECURE_PROCESSING is true, calling an external function will cause XPathFunctionException.
+ */
+public class SecureProcessingTest {
+    static boolean _isSecureMode = false;
+    static {
+        if (System.getSecurityManager() != null) {
+            _isSecureMode = true;
+            System.out.println("Security Manager is present");
+        } else {
+            System.out.println("Security Manager is NOT present");
+        }
+    }
+
+    @Test
+    public final void testSecureProcessing() {
+
+        final String XPATH_EXPRESSION = "ext:helloWorld()";
+
+        // the xml source
+        InputStream xmlStream = this.getClass().getResourceAsStream("SecureProcessingTest.xml");
+
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder documentBuilder = null;
+        Document document = null;
+
+        try {
+            documentBuilder = documentBuilderFactory.newDocumentBuilder();
+            document = documentBuilder.parse(xmlStream);
+        } catch (ParserConfigurationException parserConfigurationException) {
+            parserConfigurationException.printStackTrace();
+            Assert.fail(parserConfigurationException.toString());
+        } catch (SAXException saxException) {
+            saxException.printStackTrace();
+            Assert.fail(saxException.toString());
+        } catch (IOException ioException) {
+            ioException.printStackTrace();
+            Assert.fail(ioException.toString());
+        }
+
+        // the XPath
+        XPathFactory xPathFactory = null;
+        XPath xPath = null;
+        String xPathResult = null;
+
+        // SECURE_PROCESSING == false
+        // evaluate an expression with a user defined function with a non-secure
+        // XPath
+        // expect success
+        if (!_isSecureMode) { // jaxp secure feature can not be turned off when
+                              // security manager is present
+            try {
+                xPathFactory = xPathFactory.newInstance();
+                xPathFactory.setXPathFunctionResolver(new MyXPathFunctionResolver());
+                xPathFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, false);
+
+                xPath = xPathFactory.newXPath();
+                xPath.setNamespaceContext(new MyNamespaceContext());
+
+                xPathResult = xPath.evaluate(XPATH_EXPRESSION, document);
+            } catch (XPathFactoryConfigurationException xPathFactoryConfigurationException) {
+                xPathFactoryConfigurationException.printStackTrace();
+                Assert.fail(xPathFactoryConfigurationException.toString());
+            } catch (XPathExpressionException xPathExpressionException) {
+                xPathExpressionException.printStackTrace();
+                Assert.fail(xPathExpressionException.toString());
+            }
+
+            // expected success
+            System.out.println("XPath result (SECURE_PROCESSING == false) = \"" + xPathResult + "\"");
+        }
+        // now try with SECURE_PROCESSING == true
+        // evaluate an expression with a user defined function with a secure
+        // XPath
+        // expect Exception
+        boolean securityException = false;
+        try {
+            xPathFactory = xPathFactory.newInstance();
+            xPathFactory.setXPathFunctionResolver(new MyXPathFunctionResolver());
+            xPathFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+
+            xPath = xPathFactory.newXPath();
+            xPath.setNamespaceContext(new MyNamespaceContext());
+
+            xPathResult = xPath.evaluate(XPATH_EXPRESSION, document);
+        } catch (XPathFactoryConfigurationException xPathFactoryConfigurationException) {
+            xPathFactoryConfigurationException.printStackTrace();
+            Assert.fail(xPathFactoryConfigurationException.toString());
+        } catch (XPathFunctionException xPathFunctionException) {
+            // expected security exception
+            securityException = true;
+            xPathFunctionException.printStackTrace(System.out);
+        } catch (XPathExpressionException xPathExpressionException) {
+            xPathExpressionException.printStackTrace();
+            Assert.fail(xPathExpressionException.toString());
+        }
+
+        // expected Exception
+        if (!securityException) {
+            Assert.fail("XPath result (SECURE_PROCESSING == true) = \"" + xPathResult + "\"");
+        }
+    }
+
+    public class MyXPathFunctionResolver implements XPathFunctionResolver {
+
+        public XPathFunction resolveFunction(QName functionName, int arity) {
+
+            // not a real ewsolver, always return a default XPathFunction
+            return new MyXPathFunction();
+        }
+    }
+
+    public class MyXPathFunction implements XPathFunction {
+
+        public Object evaluate(List list) throws XPathFunctionException {
+
+            return "Hello World";
+        }
+    }
+
+    public class MyNamespaceContext implements NamespaceContext {
+
+        public String getNamespaceURI(String prefix) {
+            if (prefix == null) {
+                throw new IllegalArgumentException("The prefix cannot be null.");
+            }
+
+            if (prefix.equals("ext")) {
+                return "http://ext.com";
+            } else {
+                return null;
+            }
+        }
+
+        public String getPrefix(String namespace) {
+
+            if (namespace == null) {
+                throw new IllegalArgumentException("The namespace uri cannot be null.");
+            }
+
+            if (namespace.equals("http://ext.com")) {
+                return "ext";
+            } else {
+                return null;
+            }
+        }
+
+        public Iterator getPrefixes(String namespace) {
+            return null;
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/SecureProcessingTest.xml b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/SecureProcessingTest.xml
new file mode 100644
index 00000000000..bc916a958f9
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/SecureProcessingTest.xml
@@ -0,0 +1,2 @@
+<?xml version="1.0"?>
+<helloWorld/>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/XPathTest.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/XPathTest.java
new file mode 100644
index 00000000000..34fe8e3c4bb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/XPathTest.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.xpath;
+
+import javax.xml.namespace.NamespaceContext;
+
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6376058
+ * @summary Test XPath.getNamespaceContext() is supported.
+ */
+public class XPathTest {
+
+    @Test
+    public void testNamespaceContext() {
+
+        XPathFactory xPathFactory = XPathFactory.newInstance();
+        XPath xPath = xPathFactory.newXPath();
+
+        NamespaceContext namespaceContext = xPath.getNamespaceContext();
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4915524.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4915524.java
new file mode 100644
index 00000000000..f496447619d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4915524.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.xml.sax.InputSource;
+
+/*
+ * @bug 4915524
+ * @summary Test Document.adoptNode() shall not throw Exception when the source document object is created from different implementation.
+ */
+
+public class Bug4915524 {
+
+    String data = "<?xml version=\"1.0\" ?>" + "<!DOCTYPE root [" + "<!ELEMENT root ANY>" + "<!ATTLIST root attr1 ID #FIXED 'xxx'"
+            + "               attr2 CDATA #IMPLIED> " + "]>" + "<root attr2='yyy'/>";
+
+    DocumentBuilder docBuilder = null;
+
+    /*
+     * This method tries to adopt a node from Defered document to non-defered
+     * document.
+     */
+    @Test
+    public void testAdoptNode() {
+        try {
+            DocumentBuilderFactory docBF = DocumentBuilderFactory.newInstance();
+            docBuilder = docBF.newDocumentBuilder();
+
+            Document doc1 = parse(data);
+            Document doc2 = docBuilder.newDocument();
+
+            Node element = doc2.adoptNode(doc1.getDocumentElement());
+
+            System.out.println("OK.");
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Excpetion while adopting node: " + e.getMessage());
+        }
+
+    }
+
+    private Document parse(String xmlData) throws Exception {
+        StringReader in = new StringReader(xmlData);
+        InputSource source = new InputSource(in);
+        return docBuilder.parse(source);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4915748.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4915748.java
new file mode 100644
index 00000000000..9e04b082254
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4915748.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.CDATASection;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMError;
+import org.w3c.dom.DOMErrorHandler;
+import org.w3c.dom.Document;
+
+/*
+ * @bug 4915748
+ * @summary Test DOMErrorHandler is called in case CDATA section is split by termination marker ']]>'.
+ */
+public class Bug4915748 {
+
+    @Test
+    public void testMain() throws Exception {
+
+        final boolean[] hadError = new boolean[1];
+
+        DocumentBuilderFactory docBF = DocumentBuilderFactory.newInstance();
+        DocumentBuilder docBuilder = docBF.newDocumentBuilder();
+
+        Document doc = docBuilder.getDOMImplementation().createDocument("namespaceURI", "ns:root", null);
+
+        CDATASection cdata = doc.createCDATASection("text1]]>text2");
+        doc.getDocumentElement().appendChild(cdata);
+
+        DOMConfiguration config = doc.getDomConfig();
+        DOMErrorHandler erroHandler = new DOMErrorHandler() {
+            public boolean handleError(DOMError error) {
+                System.out.println(error.getMessage());
+                Assert.assertEquals(error.getType(), "cdata-sections-splitted");
+                Assert.assertFalse(hadError[0], "two errors were reported");
+                hadError[0] = true;
+                return false;
+            }
+        };
+        config.setParameter("error-handler", erroHandler);
+        doc.normalizeDocument();
+        Assert.assertTrue(hadError[0]);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966082.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966082.java
new file mode 100644
index 00000000000..3bc3c357443
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966082.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+
+/*
+ * @bug 4966082
+ * @summary Test Element.getSchemaTypeInfo() returns an instance of TypeInfo instead of null when the document's schema is an XML DTD.
+ */
+public class Bug4966082 {
+
+    @Test
+    public void testOne() {
+        try {
+            Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(Bug4966082.class.getResource("Bug4966082.xml").toExternalForm());
+            if (document.getDocumentElement().getSchemaTypeInfo() == null) {
+                Assert.fail("getSchemaTypeInfo returns null");
+            }
+        } catch (Exception ex) {
+            Assert.fail("Unexpected  error" + ex);
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966082.xml b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966082.xml
new file mode 100644
index 00000000000..261e1dc6b95
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966082.xml
@@ -0,0 +1,5 @@
+<?xml version='1.0'?>
+<!DOCTYPE root [
+	<!ELEMENT root (#PCDATA)>
+]>
+<root>xxx</root>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966138.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966138.java
new file mode 100644
index 00000000000..ddd0bf5ff89
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966138.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.TypeInfo;
+
+/*
+ * @bug 4966138
+ * @summary Test Element's TypeInfo.getTypeName() returns a name instead of null in case the element is declared using anonymous simple type.
+ */
+public class Bug4966138 {
+
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test1() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setValidating(true);
+        dbf.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        dbf.setAttribute(SCHEMA_SOURCE, Bug4966138.class.getResource("test.xsd").toExternalForm());
+
+        Document document = dbf.newDocumentBuilder().parse(Bug4966138.class.getResource("test.xml").toExternalForm());
+
+        TypeInfo type = document.getDocumentElement().getSchemaTypeInfo();
+
+        String typeName = type.getTypeName();
+        System.out.println(typeName);
+        Assert.assertNotNull(typeName);
+        Assert.assertTrue(typeName.length() != 0, "returned typeName shouldn't be empty");
+
+        String typeNs = type.getTypeNamespace();
+        System.out.println(typeNs);
+        Assert.assertNotNull(typeNs);
+        Assert.assertTrue(typeNs.length() != 0, "returned typeNamespace shouldn't be empty");
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.java
new file mode 100644
index 00000000000..dd55013d571
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.TypeInfo;
+
+/*
+ * @bug 4966142
+ * @summary Test TypeInfo.isDerivedFrom(...) works instead of throws UnsupportedOperationException when the TypeInfo instance refers to a simple type.
+ */
+public class Bug4966142 {
+
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test1() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setValidating(true);
+        dbf.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        dbf.setAttribute(SCHEMA_SOURCE, Bug4966142.class.getResource("Bug4966142.xsd").toExternalForm());
+
+        Document document = dbf.newDocumentBuilder().parse(Bug4966142.class.getResource("Bug4966142.xml").toExternalForm());
+
+        TypeInfo type = document.getDocumentElement().getSchemaTypeInfo();
+
+        Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_UNION));
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.xml b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.xml
new file mode 100644
index 00000000000..c920ced635d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.xml
@@ -0,0 +1,2 @@
+<?xml version='1.0'?>
+<test5 xmlns="testNS">the test</test5>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.xsd b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.xsd
new file mode 100644
index 00000000000..e295919d57b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966142.xsd
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns:testNS="testNS"
+            targetNamespace="testNS" elementFormDefault="qualified">
+    
+    <xsd:element name="test5">
+        <xsd:simpleType>
+            <xsd:restriction base="xsd:string"/>
+        </xsd:simpleType>
+    </xsd:element>
+
+    <xsd:complexType name="Test">
+        <xsd:sequence>
+            <xsd:element name="description" minOccurs="0"/>
+            <xsd:element name="code"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.java
new file mode 100644
index 00000000000..7133089d296
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.TypeInfo;
+
+/*
+ * @bug 4966143
+ * @summary Test isDerivedFrom(...) returns true only if the parameter is DERIVATION_EXTENSION,
+ * in case TypeInfo instance refers to a complex type derived from another complex type by extension.
+ */
+public class Bug4966143 {
+
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    @Test
+    public void test1() throws Exception {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        dbf.setNamespaceAware(true);
+        dbf.setValidating(true);
+        dbf.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        dbf.setAttribute(SCHEMA_SOURCE, Bug4966143.class.getResource("Bug4966143.xsd").toExternalForm());
+
+        Document document = dbf.newDocumentBuilder().parse(Bug4966143.class.getResource("Bug4966143.xml").toExternalForm());
+
+        TypeInfo type = document.getDocumentElement().getSchemaTypeInfo();
+
+        Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_UNION));
+        Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_LIST));
+        Assert.assertFalse(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_RESTRICTION));
+        Assert.assertTrue(type.isDerivedFrom("testNS", "Test", TypeInfo.DERIVATION_EXTENSION));
+        Assert.assertTrue(type.isDerivedFrom("testNS", "Test", 0));
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.xml b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.xml
new file mode 100644
index 00000000000..251af32866d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.xml
@@ -0,0 +1,2 @@
+<?xml version='1.0'?>
+<test6 xmlns="testNS" attr="x"><code/></test6>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.xsd b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.xsd
new file mode 100644
index 00000000000..88a29ef37bc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug4966143.xsd
@@ -0,0 +1,23 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns:testNS="testNS"
+            targetNamespace="testNS" elementFormDefault="qualified">
+    
+    <xsd:element name="test6">
+        <xsd:complexType>
+            <xsd:complexContent>
+                <xsd:extension base="testNS:Test">
+                    <xsd:attribute name="attr" />
+                </xsd:extension>
+            </xsd:complexContent>
+        </xsd:complexType>
+    </xsd:element>
+
+    <xsd:complexType name="Test">
+        <xsd:sequence>
+            <xsd:element name="description" minOccurs="0"/>
+            <xsd:element name="code"/>
+        </xsd:sequence>
+    </xsd:complexType>
+
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6339023.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6339023.java
new file mode 100644
index 00000000000..273708cc209
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6339023.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.DOMStringList;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSParser;
+import org.w3c.dom.ls.LSSerializer;
+
+/*
+ * @bug 6339023
+ * @summary Test normalize-characters.
+ */
+public class Bug6339023 {
+
+    /*
+     * This test checks DOMConfiguration for DOM Level3 Load and Save
+     * implementation.
+     */
+    @Test
+    public void testLSSerializer() {
+        try {
+            DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+            DOMImplementation impln = parser.getDOMImplementation();
+            DOMImplementationLS lsImpln = (DOMImplementationLS) impln.getFeature("LS", "3.0");
+            LSSerializer serializer = lsImpln.createLSSerializer();
+            DOMConfiguration domConfig = serializer.getDomConfig();
+            System.out.println("DOMConfig: " + domConfig.toString());
+            Assert.assertTrue(domConfig.getParameter("normalize-characters") == null);
+            System.out.println("value: " + domConfig.getParameter("normalize-characters"));
+
+            DOMStringList list = domConfig.getParameterNames();
+            for (int i = 0; i < list.getLength(); i++) {
+                System.out.println("Param Name: " + list.item(i));
+                Assert.assertFalse(list.item(i).equals("normalize-characters"));
+            }
+
+            Assert.assertFalse(domConfig.canSetParameter("normalize-characters", Boolean.FALSE));
+            Assert.assertFalse(domConfig.canSetParameter("normalize-characters", Boolean.TRUE));
+
+            try {
+                domConfig.setParameter("normalize-characters", Boolean.TRUE);
+                Assert.fail("Exception expected as 'normalize-characters' is not supported");
+            } catch (Exception e) {
+            }
+
+            try {
+                domConfig.setParameter("normalize-characters", Boolean.FALSE);
+                Assert.fail("Exception expected as 'normalize-characters' is not supported");
+            } catch (Exception e) {
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception: " + e.getMessage());
+        }
+    }
+
+    /*
+     * This test checks DOMConfiguration for DOM Level3 Core implementation.
+     */
+    @Test
+    public void testLSParser() {
+        try {
+            DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+            DOMImplementation impln = parser.getDOMImplementation();
+            DOMImplementationLS lsImpln = (DOMImplementationLS) impln.getFeature("Core", "3.0");
+            LSParser lsparser = lsImpln.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, "http://www.w3.org/2001/XMLSchema");
+            DOMConfiguration domConfig = lsparser.getDomConfig();
+            System.out.println("DOMConfig: " + domConfig.toString());
+            Assert.assertTrue(domConfig.getParameter("normalize-characters").toString().equalsIgnoreCase("false"));
+            System.out.println("value: " + domConfig.getParameter("normalize-characters"));
+
+            DOMStringList list = domConfig.getParameterNames();
+            boolean flag = false;
+            for (int i = 0; i < list.getLength(); i++) {
+                System.out.println("Param Name: " + list.item(i));
+                if (list.item(i).equals("normalize-characters")) {
+                    flag = true;
+                    break;
+                }
+            }
+            Assert.assertTrue(flag, "'normalize-characters' doesnot exist in the list returned by domConfig.getParameterNames()");
+
+            Assert.assertTrue(domConfig.canSetParameter("normalize-characters", Boolean.FALSE));
+            Assert.assertFalse(domConfig.canSetParameter("normalize-characters", Boolean.TRUE));
+
+            try {
+                domConfig.setParameter("normalize-characters", Boolean.TRUE);
+                Assert.fail("Exception expected as 'normalize-characters' is not supported");
+            } catch (Exception e) {
+            }
+
+            try {
+                domConfig.setParameter("normalize-characters", Boolean.FALSE);
+            } catch (Exception e) {
+                e.printStackTrace();
+                Assert.fail("Exception expected as 'normalize-characters' is not supported");
+            }
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception: " + e.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6355326.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6355326.java
new file mode 100644
index 00000000000..911baf4a07f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6355326.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.StringBufferInputStream;
+import java.io.UnsupportedEncodingException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSParser;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6355326
+ * @summary Test DOM implementation encoding.
+ */
+public class Bug6355326 {
+
+    DOMImplementationLS implLS = null;
+    String encodingXML = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><encodingXML/>";
+
+    @BeforeMethod
+    protected void setUp() {
+        Document doc = null;
+        DocumentBuilder parser = null;
+        String xml1 = "<?xml version=\"1.0\"?><ROOT></ROOT>";
+        try {
+            parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+        }
+        StringBufferInputStream is = new StringBufferInputStream(xml1);
+        try {
+            doc = parser.parse(is);
+        } catch (SAXException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        DOMImplementation impl = doc.getImplementation();
+        implLS = (DOMImplementationLS) impl.getFeature("LS", "3.0");
+    }
+
+    @Test
+    public void testExternalEncoding() {
+
+        try {
+            LSInput src = null;
+            LSParser dp = null;
+
+            src = createLSInputEncoding();
+            dp = createLSParser();
+
+            src.setEncoding("UTF-16");
+            Document doc = dp.parse(src);
+            Assert.assertTrue("encodingXML".equals(doc.getDocumentElement().getNodeName()), "XML document is not parsed correctly");
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    private LSInput createLSInputEncoding() {
+        LSInput src = implLS.createLSInput();
+        Assert.assertFalse(src == null, "Could not create LSInput from DOMImplementationLS");
+
+        try {
+            src.setByteStream(new ByteArrayInputStream(encodingXML.getBytes("UTF-16")));
+        } catch (UnsupportedEncodingException e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+        return src;
+    }
+
+    private LSParser createLSParser() {
+        LSParser p = implLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, "http://www.w3.org/2001/XMLSchema");
+        Assert.assertFalse(p == null, "Could not create Synchronous LSParser from DOMImplementationLS");
+        return p;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6367542.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6367542.java
new file mode 100644
index 00000000000..fa77a70df16
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6367542.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+
+/*
+ * @bug 6367542
+ * @summary Test DOMImplementationRegistry.getDOMImplementation("XML") returns a DOMImplementation instance.
+ */
+public class Bug6367542 {
+
+    @Test
+    public void testDOMImplementationRegistry() {
+        try {
+            DOMImplementationRegistry registry = DOMImplementationRegistry.newInstance();
+            DOMImplementation domImpl = registry.getDOMImplementation("XML");
+            Assert.assertTrue(domImpl != null, "Non null implementation is expected for getDOMImplementation('XML')");
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6520131.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6520131.java
new file mode 100644
index 00000000000..c30f43070da
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6520131.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMError;
+import org.w3c.dom.DOMErrorHandler;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Text;
+
+/*
+ * @bug 6520131
+ * @summary Test DOMErrorHandler reports an error for invalid character.
+ */
+public class Bug6520131 {
+
+    @Test
+    public void test() {
+        String string = new String("\u0001");
+
+        try {
+            // create document
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder documentBuilder = dbf.newDocumentBuilder();
+            Document document = documentBuilder.newDocument();
+
+            DOMConfiguration domConfig = document.getDomConfig();
+            domConfig.setParameter("well-formed", Boolean.TRUE);
+            domConfig.setParameter("error-handler", new DOMErrorHandler() {
+                public boolean handleError(DOMError e) {
+                    throw new RuntimeException(e.getMessage());
+                }
+            });
+
+            // add text element
+            Element textElement = document.createElementNS("", "Text");
+            Text text = document.createTextNode(string);
+            textElement.appendChild(text);
+            document.appendChild(textElement);
+
+            // normalize document
+            document.normalizeDocument();
+
+            Assert.fail("Invalid character exception not thrown");
+        } catch (ParserConfigurationException e) {
+            Assert.fail("Unable to configure parser");
+        } catch (RuntimeException e) {
+            // This exception is expected!
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6521260.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6521260.java
new file mode 100644
index 00000000000..bcfa894ed53
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6521260.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6521260
+ * @summary Test setAttributeNS doesn't result in an unsorted internal list of attributes.
+ */
+public class Bug6521260 {
+
+    @Test
+    public void test() throws ParserConfigurationException, SAXException, IOException {
+        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+        factory.setNamespaceAware(true);
+        DocumentBuilder builder = factory.newDocumentBuilder();
+
+        String docStr = "<system systemId='http://www.w3.org/2001/rddl/rddl-xhtml.dtd'" + " uri='/cache/data/xrc36316.bin'"
+                + " xmlns:xr='urn:oasis:names:tc:entity:xmlns:xml:catalog'" + " xr:systemId='http://www.w3.org/2001/rddl/rddl-xhtml.dtd'"
+                + " xmlns:NS1='http://xmlresolver.org/ns/catalog'" + " NS1:time='1170267571097'/>";
+
+        ByteArrayInputStream bais = new ByteArrayInputStream(docStr.getBytes());
+
+        Document doc = builder.parse(bais);
+
+        Element root = doc.getDocumentElement();
+
+        String systemId = root.getAttribute("systemId");
+
+        // Change the prefix on the "time" attribute so that the list would
+        // become unsorted
+        // before my fix to
+        // xml-xerces/java/src/com/sun/org/apache/xerces/internal/dom/ElementImpl.java
+        root.setAttributeNS("http://xmlresolver.org/ns/catalog", "xc:time", "100");
+
+        String systemId2 = root.getAttribute("systemId");
+
+        Assert.assertEquals(systemId, systemId2);
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6582545.xml b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6582545.xml
new file mode 100644
index 00000000000..8f48009e839
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6582545.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<SimulationIcp Object="Configuration"><!--Configuration ICP-->
+<FWS1
+	KEY_TO_CONFIG="root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_TO_CONFIG"
+	KEY_NORM_C_L="root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_NORM_CL"
+	KEY_VALID_LEFT="root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_VALID1"
+	KEY_VALID_RIGHT="root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_VALID2"
+	KEY_ABN_PROC="root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_ABN_PROC"
+	KEY_EMER_CANC="root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_EMER_CANC"
+	KEY_ARROW_UP="root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_ARROW_UP"
+	KEY_ARROW_DOWN="root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_ARROW_DOWN"
+	KEY_CLR_LEFT="root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_CLR1"
+	KEY_UNDO_CLR="root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_UNDO_CLR"
+	KEY_STS="root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_STS"
+	KEY_MORE="root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_MORE"
+	KEY_RCL="root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_RCL"
+	KEY_CLR_RIGHT="root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_CLR2"
+/>
+</SimulationIcp>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6582545Test.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6582545Test.java
new file mode 100644
index 00000000000..2966d0accc6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6582545Test.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6582545
+ * @summary Test the value is correct when iterating attributes.
+ */
+public class Bug6582545Test {
+    private DocumentBuilder xmlParser = null;
+    private Document document = null;
+    private String FWS1 = "FWS1";
+    private String KEY_ARROW_UP = "KEY_ARROW_UP";
+    private String VALUE_ARROW_UP = "root%LRM%Tmp_CPIOM-C1%VLIN_For_ECP%ECP_IN_Port_1%IOM-A7_Msg_cd30%FDS_1_ECP_to_FWS-1%A31_ECP_ARROW_UP";
+
+    @Test
+    public void testAttributeCaching() {
+
+        File xmlFile = new File(getClass().getResource("Bug6582545.xml").getFile());
+
+        try {
+            DocumentBuilderFactory aDocumentBuilderFactory = DocumentBuilderFactory.newInstance();
+            xmlParser = aDocumentBuilderFactory.newDocumentBuilder();
+
+            // works fine with JDK 1.4.2, 1.5
+            // does not work with JDK 1.6
+            document = xmlParser.parse(xmlFile);
+            printNode(FWS1);
+        } catch (SAXException saxException) {
+            saxException.printStackTrace();
+        } catch (ParserConfigurationException parserConfigurationException) {
+            parserConfigurationException.printStackTrace();
+        } catch (IOException ioException) {
+            ioException.printStackTrace();
+        } catch (IllegalArgumentException illegalArgumentException) {
+            illegalArgumentException.printStackTrace();
+        }
+    }
+
+    private void printNode(String aNode) {
+        boolean error = true;
+        NodeList nodeList;
+        NamedNodeMap attributes;
+
+        nodeList = document.getElementsByTagName(aNode);
+        attributes = nodeList.item(0).getAttributes();
+
+        String name;
+        String value;
+        // Print all nodes
+        for (int k = 0; k < attributes.getLength(); k++) {
+            name = attributes.item(k).getNodeName();
+            value = attributes.item(k).getNodeValue();
+            System.out.println(name + "=" + value);
+        }
+
+        // Test specifique a node
+        String javaSpecificationVersion = System.getProperty("java.specification.version");
+        for (int k = 0; k < attributes.getLength(); k++) {
+            name = attributes.item(k).getNodeName();
+            value = attributes.item(k).getNodeValue();
+            if (KEY_ARROW_UP.equals(name)) {
+                if (VALUE_ARROW_UP.equals(value)) {
+                    // Parser OK
+                    System.out.println("Parser in Java " + javaSpecificationVersion + " returned correct value.");
+                    error = false;
+                } else {
+                    // Parser NOK
+                    System.out.println("Parser in Java " + javaSpecificationVersion + " returned wrong value");
+                }
+                System.out.println("for node         = " + KEY_ARROW_UP);
+                System.out.println("expecting value  =" + VALUE_ARROW_UP);
+                System.out.println("value from parser=" + value);
+            }
+        }
+
+        Assert.assertTrue(!error);
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6879614.xml b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6879614.xml
new file mode 100644
index 00000000000..7de8402eba8
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6879614.xml
@@ -0,0 +1,722 @@
+<?xml version="1.0"?>
+<!DOCTYPE xsl:stylesheet [<!ENTITY nbsp "&#160;">]>
+
+<xsl:stylesheet version='1.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform'>
+  <xsl:output method="html" version="4" encoding="UTF-8"/>
+
+  <!--
+*******************************************************************************
+   * Output HTML fields to keep the current context
+   * @param searchresult The current search result tree
+   * @param expandedgroups A tree representing the groups that have been expanded
+*******************************************************************************
+   -->
+   <xsl:template name="contextKeeper">
+     <xsl:param name="pagedSearch"/>
+
+     <input type="hidden" name="stopsearch" value=""/>
+     <input type="hidden" name="expandgroup" value=""/>
+     <input type="hidden" name="expandselectedgroup" value=""/>
+     <input type="hidden" name="expandonmissing" value=""/>
+     <input type="hidden" name="nextview" value="{/xslui/@nextview}" />
+     <input type="hidden" name="bookid">
+       <xsl:attribute name="value">
+         <xsl:if test="$pagedSearch and $pagedSearch/searchresult and $pagedSearch/searchresult/@bookid">
+           <xsl:value-of select="$pagedSearch/searchresult/@bookid"/>
+         </xsl:if>
+       </xsl:attribute>
+     </input>
+     <input type="hidden" name="actionbookid">
+       <xsl:attribute name="value">
+         <xsl:if test="$pagedSearch and $pagedSearch/searchresult and $pagedSearch/searchresult/@bookid">
+           <xsl:value-of select="$pagedSearch/searchresult/@bookid"/>
+         </xsl:if>
+       </xsl:attribute>
+     </input>
+     <xsl:if test="$pagedSearch/searchresult">
+      <xsl:variable name="searchResult" select="$pagedSearch/searchresult"/>
+
+       <xsl:if test="/xslui/iab/pagedsearch/searchresult/@searchid">
+         <input type="hidden" name="searchid" value="{$searchResult/@searchid}"/>
+       </xsl:if>
+
+       <input type="hidden" name="filter" value="{$searchResult/@filter}"/>
+       <input type="hidden" name="firstentry" value="{$searchResult/@firstentry}"/>
+       <input type="hidden" name="sortby" value="{$searchResult/@sortby}"/>
+
+       <xsl:if test="$pagedSearch/expandedgroups">
+         <xsl:variable name="expandedGroups" select="$pagedSearch/expandedgroups"/>
+         <xsl:if test="$expandedGroups/expandedgroup">
+           <xsl:for-each select="$expandedGroups/expandedgroup">
+             <input type="hidden" name="expandedgroup" value="{@entryID}"/>
+           </xsl:for-each>
+         </xsl:if>
+       </xsl:if>
+     </xsl:if>
+   </xsl:template>
+
+   <!-- template to replace a string with another -->
+   <xsl:template name="replace-string">
+    <xsl:param name="text"/>
+    <xsl:param name="replace"/>
+    <xsl:param name="with"/>
+    <xsl:choose>
+      <xsl:when test="contains($text,$replace)">
+        <xsl:value-of select="substring-before($text,$replace)"/>
+        <xsl:value-of select="$with"/>
+        <xsl:call-template name="replace-string">
+          <xsl:with-param name="text"
+select="substring-after($text,$replace)"/>
+          <xsl:with-param name="replace" select="$replace"/>
+          <xsl:with-param name="with" select="$with"/>
+        </xsl:call-template>
+      </xsl:when>
+      <xsl:otherwise>
+        <xsl:value-of select="$text"/>
+      </xsl:otherwise>
+    </xsl:choose>
+ </xsl:template>
+
+ <!-- escapes quotes -->
+  <xsl:template name="escape">
+     <xsl:param name="text"/>
+     <xsl:call-template name="replace-string">
+       <xsl:with-param name="text" select="$text"/>
+       <xsl:with-param name="replace" select="'&quot;'"/>
+       <xsl:with-param name="with" select="'\&quot;'"/>
+     </xsl:call-template>
+  </xsl:template>
+
+  <!--
+*******************************************************************************
+  * This template displays the banner indicating the user the actual context.
+  * @param text The text to display in the banner
+*******************************************************************************
+  -->
+  <xsl:template name="contextBanner">
+    <xsl:param name="text" select="''" />
+
+    <table width="100&#37;" border="0" cellspacing="0" cellpadding="0" class="first-strip" summary="This table displays the context banner" >
+      <tr>
+        <td>
+          <table border="0" cellspacing="0" cellpadding="0">
+            <tr>
+              <td>
+                <img alt="" src="{$spacer.gif}" width="17" height="25"/>
+              </td>
+              <td>
+                <xsl:attribute name="nowrap"/>
+                <span class="areatitle-large">
+                  <xsl:value-of select="$text" />
+                </span>
+              </td>
+            </tr>
+          </table>
+        </td>
+        <td align="right">&nbsp;</td>
+      </tr>
+    </table>
+  </xsl:template>
+
+  <xsl:template name="uwcbutton">
+    <xsl:param name="class" />
+    <xsl:param name="title"/>
+    <xsl:param name="tabindex" select="1"/>
+    <xsl:param name="type" select="button"/>
+    <xsl:param name="id" />
+    <xsl:param name="name" />
+    <xsl:param name="value" />
+    <xsl:param name="onclick" />
+    <input>
+     <xsl:attribute name="name">
+      <xsl:value-of select="$name" />
+     </xsl:attribute>
+     <xsl:attribute name="class">
+      <xsl:value-of select="$class" />
+     </xsl:attribute>
+     <xsl:attribute name="title">
+      <xsl:value-of select="$title" />
+     </xsl:attribute>
+     <xsl:attribute name="type">
+      <xsl:value-of select="$type" />
+     </xsl:attribute>
+     <xsl:attribute name="id">
+      <xsl:value-of select="$id" />
+     </xsl:attribute>
+     <xsl:attribute name="tabindex">
+      <xsl:value-of select="$tabindex" />
+     </xsl:attribute>
+     <xsl:attribute name="onclick">
+      <xsl:value-of select="$onclick" />
+     </xsl:attribute>
+     <xsl:attribute name="value">
+      <xsl:value-of select="$value" />
+     </xsl:attribute>
+     <xsl:attribute name="onblur">
+       <xsl:text>if (this.disabled==0) this.className='</xsl:text><xsl:value-of select="$class" /><xsl:text>'</xsl:text>
+     </xsl:attribute>
+     <xsl:attribute name="onmouseOver">
+       <xsl:text>if (this.disabled==0) this.className='</xsl:text><xsl:value-of select="$class" /><xsl:text>Hov'</xsl:text>
+     </xsl:attribute>
+    <xsl:attribute name="onFocus">
+       <xsl:text>if (this.disabled==0) this.className='</xsl:text><xsl:value-of select="$class" /><xsl:text>Hov'</xsl:text>
+     </xsl:attribute>
+     <xsl:attribute name="onmouseOut">
+       <xsl:text>if (this.disabled==0) this.className='</xsl:text><xsl:value-of select="$class" /><xsl:text>'</xsl:text>
+     </xsl:attribute>
+    </input>
+ </xsl:template>
+
+
+
+  <!--
+*******************************************************************************
+  * This template prints HTML code for a button
+  * @param label The label of the button
+  * @param href The content of the href represented by the button
+  * @param class [Optional] The css class to use to print the label of the button, default is "button"
+  * @param color [Optional] The color of the button, default is defined by css-select.css depending on the colorset
+  * @param bgColorIndex [Optional] The background color index ('b', 'w' or 'h') on wich the button is going to be output, default is 'b'
+*******************************************************************************
+  -->
+  <xsl:template name="button">
+    <xsl:param name="label" />
+    <xsl:param name="href" select="'javascript:urlNotYetAvailable()'"/>
+    <xsl:param name="target" select="'_self'"/>
+    <xsl:param name="disabled" select="false()" />
+    <xsl:param name="color" select="$buttonColor"/>
+    <xsl:param name="bgColorIndex" select="'b'" />
+
+    <xsl:variable name="path" select="concat('../absimx/', $colorTheme, '/')"/>
+    <xsl:variable name="lowerLeft.gif">
+      <xsl:value-of select="$path" />
+      <xsl:value-of select="'LL_corner_'" />
+      <xsl:if test="not($disabled)">
+        <xsl:value-of select="concat($color, '_')" />
+      </xsl:if>
+      <xsl:value-of select="concat($bgColorIndex,'.gif')" />
+    </xsl:variable>
+    <xsl:variable name="lowerRight.gif">
+      <xsl:value-of select="$path" />
+      <xsl:value-of select="'LR_corner_'" />
+      <xsl:if test="not($disabled)">
+        <xsl:value-of select="concat($color, '_')" />
+      </xsl:if>
+      <xsl:value-of select="concat($bgColorIndex,'.gif')" />
+    </xsl:variable>
+    <xsl:variable name="upperLeft.gif">
+      <xsl:value-of select="$path" />
+      <xsl:value-of select="'UL_corner_'" />
+      <xsl:if test="not($disabled)">
+        <xsl:value-of select="concat($color, '_')" />
+      </xsl:if>
+      <xsl:value-of select="concat($bgColorIndex,'.gif')" />
+    </xsl:variable>
+    <xsl:variable name="upperRight.gif">
+      <xsl:value-of select="$path" />
+      <xsl:value-of select="'UR_corner_'" />
+      <xsl:if test="not($disabled)">
+        <xsl:value-of select="concat($color, '_')" />
+      </xsl:if>
+      <xsl:value-of select="concat($bgColorIndex,'.gif')" />
+    </xsl:variable>
+
+    <table cellspacing="0" cellpadding="0" border="0">
+      <xsl:attribute name="style">
+        <xsl:value-of select="'background-color: #'" />
+        <xsl:choose>
+          <xsl:when test="$disabled">
+            <xsl:value-of select="'999999'" />
+          </xsl:when>
+          <xsl:otherwise>
+            <xsl:value-of select="$color" />
+          </xsl:otherwise>
+        </xsl:choose>
+      </xsl:attribute>
+
+      <tbody>
+        <tr>
+          <!-- Start of button1 TOP -->
+          <td valign="top">
+            <xsl:choose>
+              <xsl:when test="not($disabled)">
+                <a href="{$href}" target="{$target}">
+                  <img height="8" alt=" " src="{$upperLeft.gif}" width="8" border="0"/>
+                </a>
+              </xsl:when>
+              <xsl:otherwise>
+                <img height="8" alt=" " src="{$upperLeft.gif}" width="8" border="0"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </td>
+
+          <td valign="center" align="middle" rowspan="2">
+            <xsl:attribute name="nowrap" />
+            <xsl:choose>
+              <xsl:when test="$disabled">
+                <span class="button-disabled">
+                  <xsl:value-of select="$label" />
+                </span>
+              </xsl:when>
+              <xsl:otherwise>
+                <a target="{$target}" href="{$href}" class="button">
+                  <xsl:value-of select="$label" />
+                </a>
+              </xsl:otherwise>
+            </xsl:choose>
+           </td>
+
+          <td valign="top">
+            <xsl:choose>
+              <xsl:when test="not($disabled)">
+                <a target="{$target}" href="{$href}">
+                  <img height="8" alt=" " src="{$upperRight.gif}" width="8" border="0"/>
+                </a>
+              </xsl:when>
+              <xsl:otherwise>
+                <img height="8" alt=" " src="{$upperRight.gif}" width="8" border="0"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </td>
+          <!-- End of button1 TOP -->
+        </tr>
+        <tr>
+          <!-- Start of button1 BOTTOM -->
+          <td valign="bottom">
+            <xsl:choose>
+              <xsl:when test="not($disabled)">
+                <a target="{$target}" href="{$href}">
+                  <img height="8" alt=" " src="{$lowerLeft.gif}" width="8" border="0"/>
+                </a>
+              </xsl:when>
+              <xsl:otherwise>
+                <img height="8" alt=" " src="{$lowerLeft.gif}" width="8" border="0"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </td>
+          <td valign="bottom">
+            <xsl:choose>
+              <xsl:when test="not($disabled)">
+                <a target="{$target}" href="{$href}">
+                  <img height="8" alt=" " src="{$lowerRight.gif}" width="8" border="0"/>
+                </a>
+              </xsl:when>
+              <xsl:otherwise>
+                <img height="8" alt=" " src="{$lowerRight.gif}" width="8" border="0"/>
+              </xsl:otherwise>
+            </xsl:choose>
+          </td>
+          <!-- End of button1 bottom -->
+        </tr>
+      </tbody>
+    </table>
+  </xsl:template>
+
+  <!--
+*******************************************************************************
+  * This template prints the action buttons Save, Cancel and Help
+  * For each button is called the javascript function of the same name :
+  *   save(), cancel(), help()
+  * The core of those functions must be declared in the main template
+*******************************************************************************
+  -->
+  <xsl:template name="save-cancel-help-bar">
+    <xsl:param name="actionframe"/>
+    <table border="0" cellspacing="0" cellpadding="0" width="100&#37;" summary="This table displays the save, canceland help buttons">
+      <tbody>
+      <tr>
+      <td align="right">
+        <input class="Btn1" type="submit" name="Button5" id="button" onMouseOver="if (this.disabled==0) this.className='Btn1Hov'" onFocus="if (this.disabled==0) this.className='Btn1Hov'" onMouseOut="if (this.disabled==0) this.className='Btn1'" onBlur="if (this.disabled==0) this.className='Btn1'" tabindex="2">
+          <xsl:attribute name="value">
+             <xsl:text>_Save</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+             <xsl:text>_Save</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="onClick">
+            <xsl:text>javascript:</xsl:text>
+            <xsl:if test="string-length($actionframe) &gt; 0">
+              <xsl:text>top.</xsl:text><xsl:value-of select="$actionframe"/><xsl:text>.</xsl:text>
+            </xsl:if>
+            <xsl:text>save()</xsl:text>
+          </xsl:attribute>
+        </input>
+        &nbsp;
+        <input class="Btn2" type="submit" name="Button5" id="button" onMouseOver="if (this.disabled==0) this.className='Btn2Hov'" onFocus="if (this.disabled==0) this.className='Btn2Hov'" onMouseOut="if (this.disabled==0) this.className='Btn2'" onBlur="if (this.disabled==0) this.className='Btn2'" tabindex="3">
+          <xsl:attribute name="value">
+             <xsl:text>_Cancel</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+             <xsl:text>_Cancel</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="onClick">
+            <xsl:text>javascript:</xsl:text>
+            <xsl:if test="string-length($actionframe) &gt; 0">
+              <xsl:text>top.</xsl:text><xsl:value-of select="$actionframe"/><xsl:text>.</xsl:text>
+            </xsl:if>
+            <xsl:text>cancel()</xsl:text>
+          </xsl:attribute>
+        </input>
+        &nbsp;
+        <input class="Btn2" type="submit" name="Button52" id="button" onMouseOver="if (this.disabled==0) this.className='Btn2Hov'" onFocus="if (this.disabled==0) this.className='Btn2Hov'" onMouseOut="if (this.disabled==0) this.className='Btn2'" onBlur="if (this.disabled==0) this.className='Btn2'" tabindex="4">
+         <xsl:attribute name="value">
+             <xsl:text>_Help</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+             <xsl:text>_Help</xsl:text>
+          </xsl:attribute>
+      <xsl:attribute name="onClick">
+                <xsl:text>javascript:</xsl:text>
+                <xsl:if test="string-length($actionframe) &gt; 0">
+<xsl:text>top.</xsl:text><xsl:value-of select="$actionframe"/><xsl:text>.</xsl:text>
+                </xsl:if>
+                <xsl:text>help()</xsl:text>
+              </xsl:attribute>
+            </input>
+      </td>
+     </tr>
+     <tr>
+       <td colspan="3"><img alt="" src="{$spacer.gif}" width="1" height="6"/></td>
+     </tr>
+     </tbody>
+    </table>
+  </xsl:template>
+
+
+<xsl:template name="edit-delete-cancel-help-bar">
+    <xsl:param name="helpurl" select="'javascript:urlNotYetAvailable()'" />
+    <xsl:param name="actionframe"/>
+    <xsl:param name="group"/>
+    <td>
+       <input class="Btn2" id="delete" onblur="if (this.disabled==0) this.className='Btn2'" onmouseover="if (this.disabled==0) this.className='Btn2Hov'" onfocus="if (this.disabled==0) this.className='Btn2Hov'" tabIndex="5" onmouseout="if (this.disabled==0) this.className='Btn2'" type="button" name="delete">
+        <xsl:attribute name="value">
+             <xsl:text>_Delete</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+             <xsl:text>_Delete</xsl:text>
+          </xsl:attribute>
+       <xsl:attribute name="onClick">
+            <xsl:text>javascript:</xsl:text>
+               <xsl:if test="string-length($actionframe) &gt; 0">
+<xsl:text>top.</xsl:text><xsl:value-of select="$actionframe"/><xsl:text>.</xsl:text>
+               </xsl:if>
+<xsl:text>deleteSelectedGroup()</xsl:text>
+          </xsl:attribute>
+        </input>
+        &nbsp;
+       <input class="Btn2" id="edit" onBlur="if (this.disabled==0) this.className='Btn2'" onMouseOver="if (this.disabled==0) this.className='Btn2Hov'" onFocus="if (this.disabled==0) this.className='Btn2Hov'" tabindex="4" onMouseOut="if (this.disabled==0) this.className='Btn2'" type="button" name="edit">
+        <xsl:attribute name="value">
+             <xsl:text>_Edit</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+             <xsl:text>_Edit</xsl:text>
+          </xsl:attribute>
+       <xsl:attribute name="onClick">
+            <xsl:text>javascript:</xsl:text>
+            <xsl:if test="string-length($actionframe) &gt; 0">
+              <xsl:text>top.</xsl:text><xsl:value-of select="$actionframe"/><xsl:text>.</xsl:text>
+            </xsl:if>
+            <xsl:text>editSelectedGroup()</xsl:text>
+        </xsl:attribute>
+       </input>
+       </td>
+      <td align="right">
+      <input class="Btn1" id="save" onblur="if (this.disabled==0) this.className='Btn1'" onmouseover="if (this.disabled==0) this.className='Btn1Hov'" onfocus="if (this.disabled==0) this.className='Btn1Hov'" tabIndex="1" onmouseout="if (this.disabled==0) this.className='Btn1'" type="button" name="close">
+         <xsl:attribute name="value">
+             <xsl:text>_Close</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+             <xsl:text>_Close</xsl:text>
+          </xsl:attribute>
+         <xsl:attribute name="onClick">
+            <xsl:text>javascript:</xsl:text>
+            <xsl:if test="string-length($actionframe) &gt; 0">
+              <xsl:text>top.</xsl:text><xsl:value-of select="$actionframe"/><xsl:text>.</xsl:text>
+            </xsl:if>
+            <xsl:text>cancel()</xsl:text>
+         </xsl:attribute>
+       </input>&nbsp;
+       <input class="Btn2" id="help" onblur="if (this.disabled==0) this.className='Btn2'" onmouseover="if (this.disabled==0) this.className='Btn2Hov'" onfocus="if (this.disabled==0) this.className='Btn2Hov'"  tabIndex="3" onmouseout="if (this.disabled==0) this.className='Btn2'" type="button" name="help">
+          <xsl:attribute name="value">
+             <xsl:text>_Help</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+             <xsl:text>_Help</xsl:text>
+          </xsl:attribute>
+        <xsl:attribute name="onClick">
+         <xsl:text>javascript:</xsl:text>
+            <xsl:if test="string-length($actionframe) &gt; 0">
+              <xsl:text>top.</xsl:text><xsl:value-of select="$actionframe"/><xsl:text>.</xsl:text>
+            </xsl:if>
+            <xsl:text>help()</xsl:text>
+         </xsl:attribute>
+         </input>
+          </td>
+</xsl:template>
+
+
+  <!--
+*******************************************************************************
+  * This template prints the action buttons Save, 'Save and Add Another', Cancel and Help
+  * For each button is called the javascript function of the same name :
+  *   save(), saveAndAddAnother(), cancel(), help()
+  * The core of those functions must be declared in the main template
+*******************************************************************************
+  -->
+  <xsl:template name="save-saveandaddanother-cancel-help-bar">
+    <xsl:param name="actionframe"/>
+    <table border="0" cellspacing="0" cellpadding="0" width="100&#37;" summary="This table displays the save, save-and-add-another,  cancel and help buttons">
+      <tbody>
+      <tr>
+      <td align="right">
+        <input class="Btn1" type="submit" name="Button5" id="button" onMouseOver="if (this.disabled==0) this.className='Btn1Hov'" onFocus="if (this.disabled==0) this.className='Btn1Hov'" onMouseOut="if (this.disabled==0) this.className='Btn1'" onBlur="if (this.disabled==0) this.className='Btn1'" tabindex="2">
+          <xsl:attribute name="value">
+             <xsl:text>_Save</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+             <xsl:text>_Save</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="onClick">
+            <xsl:text>javascript:</xsl:text>
+            <xsl:if test="string-length($actionframe) &gt; 0">
+              <xsl:text>top.</xsl:text><xsl:value-of select="$actionframe"/><xsl:text>.</xsl:text>
+            </xsl:if>
+            <xsl:text>save()</xsl:text>
+          </xsl:attribute>
+        </input>
+        &nbsp;
+        <input class="Btn1" type="submit" name="Button5" id="button" onMouseOver="if (this.disabled==0) this.className='Btn1Hov'" onFocus="if (this.disabled==0) this.className='Btn1Hov'" onMouseOut="if (this.disabled==0) this.className='Btn1'" onBlur="if (this.disabled==0) this.className='Btn1'" tabindex="3">
+            <xsl:attribute name="value">
+             <xsl:text>_Save and Add Another</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+             <xsl:text>_Save and Add Another</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="onClick">
+            <xsl:text>javascript:</xsl:text>
+            <xsl:if test="string-length($actionframe) &gt; 0">
+              <xsl:text>top.</xsl:text><xsl:value-of select="$actionframe"/><xsl:text>.</xsl:text>
+            </xsl:if>
+            <xsl:text>save(true)</xsl:text>
+          </xsl:attribute>
+        </input>
+        &nbsp;
+        <input class="Btn2" type="submit" name="Button51" id="button" onMouseOver="if (this.disabled==0) this.className='Btn2Hov'" onFocus="if (this.disabled==0) this.className='Btn2Hov'" onMouseOut="if (this.disabled==0) this.className='Btn2'" onBlur="if (this.disabled==0) this.className='Btn2'" tabindex="4">
+            <xsl:attribute name="value">
+             <xsl:text>_Cancel</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+             <xsl:text>_Cancel</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="onClick">
+            <xsl:text>javascript:</xsl:text>
+            <xsl:if test="string-length($actionframe) &gt; 0">
+              <xsl:text>top.</xsl:text><xsl:value-of select="$actionframe"/><xsl:text>.</xsl:text>
+            </xsl:if>
+            <xsl:text>cancel()</xsl:text>
+          </xsl:attribute>
+        </input>
+        &nbsp;
+        <input class="Btn2" type="submit" name="Button52" id="button" onMouseOver="if (this.disabled==0) this.className='Btn2Hov'" onFocus="if (this.disabled==0) this.className='Btn2Hov'" onMouseOut="if (this.disabled==0) this.className='Btn2'" onBlur="if (this.disabled==0) this.className='Btn2'" onClick="" tabindex="5">
+         <xsl:attribute name="value">
+             <xsl:text>_Help</xsl:text>
+          </xsl:attribute>
+          <xsl:attribute name="title">
+             <xsl:text>_Help</xsl:text>
+          </xsl:attribute>
+      <xsl:attribute name="onClick">
+                <xsl:text>javascript:</xsl:text>
+                <xsl:if test="string-length($actionframe) &gt; 0">
+<xsl:text>top.</xsl:text><xsl:value-of select="$actionframe"/><xsl:text>.</xsl:text>
+                </xsl:if>
+                <xsl:text>help()</xsl:text>
+              </xsl:attribute>
+            </input>
+      </td>
+     </tr>
+     <tr>
+       <td colspan="3"><img alt="" src="{$spacer.gif}" width="1" height="6"/></td>
+     </tr>
+     </tbody>
+    </table>
+  </xsl:template>
+
+  <!--
+*******************************************************************************
+  * This template prints the action buttons Ok, Cancel and Help
+  * For each button is called the javascript function of the same name :
+  *   ok(), cancel(), help()
+  * The core of those functions must be declared in the main template
+*******************************************************************************
+  -->
+  <xsl:template name="ok-cancel-help-bar">
+    <xsl:param name="buttontext" select="'OK'" />
+    <xsl:param name="buttoncontext" select="'_OK'" />
+    <xsl:param name="language" select="'en'"/>
+    <xsl:param name="actionframe"/>
+    <table border="0" cellspacing="0" cellpadding="0" width="100&#37;" summary="This table displays the ok, cancel and help buttons">
+      <tbody>
+      <tr>
+      <td align="right">
+        <input class="Btn1" type="submit" name="Button" id="button" onmouseover="if (this.disabled==0) this.className='Btn1Hov'" onfocus="if (this.disabled==0) this.className='Btn1Hov'" onmouseout="if (this.disabled==0) this.className='Btn1'" onblur="if (this.disabled==0) this.className='Btn1'" tabindex="1">
+          <xsl:attribute name="value"><xsl:value-of select="$buttontext"/></xsl:attribute>
+          <xsl:attribute name="title"><xsl:value-of select="$buttontext"/></xsl:attribute>
+          <xsl:attribute name="onClick">
+            <xsl:text>javascript:</xsl:text>
+            <xsl:if test="string-length($actionframe) &gt; 0">
+              <xsl:text>top.</xsl:text><xsl:value-of select="$actionframe"/>
+              <xsl:text>.</xsl:text>
+            </xsl:if>
+            <xsl:text>ok()</xsl:text>
+          </xsl:attribute>
+        </input>
+        &nbsp;
+        <input class="Btn2" type="submit" name="Button5" id="button" onMouseOver="if (this.disabled==0) this.className='Btn2Hov'" onFocus="if (this.disabled==0) this.className='Btn2Hov'" onMouseOut="if (this.disabled==0) this.className='Btn2'" onBlur="if (this.disabled==0) this.className='Btn2'" tabindex="3">
+         <xsl:attribute name="value">
+          <xsl:text>_Cancel</xsl:text>
+         </xsl:attribute>
+         <xsl:attribute name="title">
+           <xsl:text>_Cancel</xsl:text>
+         </xsl:attribute>
+          <xsl:attribute name="onClick">
+            <xsl:text>javascript:</xsl:text>
+            <xsl:if test="string-length($actionframe) &gt; 0">
+              <xsl:text>top.</xsl:text><xsl:value-of select="$actionframe"/><xsl:text>.</xsl:text>
+            </xsl:if>
+            <xsl:text>cancel()</xsl:text>
+          </xsl:attribute>
+        </input>
+        &nbsp;
+        <input class="Btn2" type="submit" name="Button52" id="button" onMouseOver="if (this.disabled==0) this.className='Btn2Hov'" onFocus="if (this.disabled==0) this.className='Btn2Hov'" onMouseOut="if (this.disabled==0) this.className='Btn2'" onBlur="if (this.disabled==0) this.className='Btn2'" onClick="" tabindex="4">
+         <xsl:attribute name="value">
+          <xsl:text>_Help</xsl:text>
+         </xsl:attribute>
+         <xsl:attribute name="title">
+           <xsl:text>_Help</xsl:text>
+         </xsl:attribute>
+         <xsl:attribute name="onClick">
+           <xsl:text>javascript:openhelp('</xsl:text>
+           <xsl:choose>
+           <xsl:when test="$buttoncontext='AddInvitees'">
+             <xsl:value-of select="/xslui/@contexturi"/>
+             <xsl:text>/help/</xsl:text><xsl:value-of select="$language"/><xsl:text>/p5.html#aefay');</xsl:text>
+           </xsl:when>
+           <xsl:when test="$buttoncontext='_addaddresses' or $buttoncontext='addaddresses'" >
+            <xsl:value-of select="/xslui/@contexturi"/>
+            <xsl:text>/help/</xsl:text><xsl:value-of select="$language"/><xsl:text>/p5.html#aefaz');</xsl:text>
+           </xsl:when>
+           <xsl:when test="$buttoncontext='_addrecipients'">
+             <xsl:value-of select="/xslui/@contexturi"/>
+             <xsl:text>/help/</xsl:text><xsl:value-of select="$language"/><xsl:text>/p6.html#aefba');</xsl:text>
+           </xsl:when>
+          <xsl:when test="$buttoncontext='Subscribe'">
+             <xsl:value-of select="/xslui/@contexturi"/>
+             <xsl:text>/help/</xsl:text><xsl:value-of select="$language"/><xsl:text>/p9.html#gbmoc');</xsl:text>
+           </xsl:when>
+          <xsl:when test="$buttoncontext='_addaddress'">
+             <xsl:value-of select="/xslui/@contexturi"/>
+             <xsl:text>/help/</xsl:text><xsl:value-of select="$language"/><xsl:text>/p36.html#gbfgy');</xsl:text>
+           </xsl:when>
+         <xsl:otherwise>
+           <xsl:value-of select="/xslui/@contexturi"/>
+           <xsl:text>/help/</xsl:text><xsl:value-of select="$language"/><xsl:text>/p6.html#aefbb');</xsl:text>
+         </xsl:otherwise>
+       </xsl:choose>
+      </xsl:attribute>
+      </input>
+      </td>
+     </tr>
+     <tr>
+       <td colspan="3"><img alt="" src="{$spacer.gif}" width="1" height="6"/></td>
+     </tr>
+     </tbody>
+    </table>
+  </xsl:template>
+
+  <!--
+*******************************************************************************
+  * This template prints the action buttons Return and Help
+  * For each button is called the javascript function of the same name :
+  *   goBack(), help()
+  * The core of those functions must be declared in the main template
+*******************************************************************************
+  -->
+  <xsl:template name="close-help-bar">
+    <xsl:param name="helpurl" select="'javascript:urlNotYetAvailable()'" />
+    <table cellspacing="0" cellpadding="0" border="0" summary="This table displays the goback and help buttons">
+      <tbody>
+        <tr>
+          <td><img alt="" height="9" src="{$spacer.gif}" width="1" /></td>
+        </tr>
+        <tr>
+          <td>
+            <xsl:call-template name="button">
+              <xsl:with-param name="label">
+                <xsl:text>_Close</xsl:text>
+              </xsl:with-param>
+              <xsl:with-param name="href">
+                <xsl:text>javascript:goBack()</xsl:text>
+              </xsl:with-param>
+              <xsl:with-param name="bgColorIndex" select="'w'"/>
+            </xsl:call-template>
+          </td>
+          <td>
+            <img height="1" alt=" " src="{$spacer.gif}" width="5" border="0"/>
+          </td>
+          <td>
+            <xsl:call-template name="button">
+              <xsl:with-param name="label">
+                <xsl:text>_Help</xsl:text>
+              </xsl:with-param>
+              <xsl:with-param name="href">
+<xsl:text>javascript:openhelp('</xsl:text>
+                <xsl:value-of select="$helpurl"/>
+                <xsl:text>')</xsl:text>
+              </xsl:with-param>
+              <xsl:with-param name="bgColorIndex" select="'w'"/>
+            </xsl:call-template>
+          </td>
+        </tr>
+        <tr>
+          <td><img alt="" height="9" src="{$spacer.gif}" width="1" /></td>
+        </tr>
+      </tbody>
+    </table>
+  </xsl:template>
+
+  <!--
+*****************************************************************************
+  * This template prints a legend concerning required info.
+*****************************************************************************
+  -->
+  <xsl:template name="requiredInfo">
+    <table cellspacing="0" cellpadding="0" border="0" bgcolor="#FFFFFF" width="100&#37;" summary="This table contains the legend concerning required info">
+      <tr>
+        <td colspan="3">
+          <img alt="" src="{$spacer.gif}" width="1" height="3" />
+        </td>
+      </tr>
+      <tr>
+      <td>&nbsp;</td>
+      <td>
+        <table cellspacing="0" cellpadding="0" border="0">
+          <tr>
+            <td valign="top">
+              <font color="#0000FF" class="bold">*</font>
+            </td>
+            <td>&nbsp;</td>
+            <td>
+              <span class="reduced-text">
+                <xsl:text>_Indicates required information</xsl:text>
+              </span>
+            </td>
+          </tr>
+        </table>
+      </td>
+      <td>&nbsp;</td>
+      </tr>
+    </table>
+  </xsl:template>
+
+</xsl:stylesheet>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6879614Test.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6879614Test.java
new file mode 100644
index 00000000000..7c669698814
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/Bug6879614Test.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6879614
+ * @summary Test DocumentBuilder can parse the certain xml.
+ */
+public class Bug6879614Test {
+
+    @Test
+    public void testAttributeCaching() {
+        File xmlFile = new File(getClass().getResource("Bug6879614.xml").getFile());
+        DocumentBuilderFactory _documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        _documentBuilderFactory.setValidating(false);
+        _documentBuilderFactory.setIgnoringComments(true);
+        _documentBuilderFactory.setIgnoringElementContentWhitespace(true);
+        _documentBuilderFactory.setCoalescing(true);
+        _documentBuilderFactory.setExpandEntityReferences(true);
+        _documentBuilderFactory.setNamespaceAware(true);
+        DocumentBuilder _documentBuilder = null;
+        try {
+            _documentBuilder = _documentBuilderFactory.newDocumentBuilder();
+        } catch (ParserConfigurationException pce) {
+            pce.printStackTrace();
+        }
+
+        Document xmlDoc = null;
+        try {
+            xmlDoc = _documentBuilder.parse(xmlFile);
+            if (xmlDoc == null) {
+                System.out.println("Hello!!!, there is a problem here");
+            } else {
+                System.out.println("Good, the parsing went through fine.");
+            }
+        } catch (SAXException se) {
+            se.printStackTrace();
+        } catch (IOException ioe) {
+            ioe.printStackTrace();
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6333993Test.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6333993Test.java
new file mode 100644
index 00000000000..b54e9c61de0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6333993Test.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+/*
+ * @bug 6333993
+ * @summary Test NodeList.item(valid index) returns value after NodeList.item(NodeList.getLength()).
+ */
+public class CR6333993Test {
+
+    @Test
+    public void testNodeList() {
+        int n = 5;
+        while (0 != (n--))
+            ;
+        System.out.println("n=" + n);
+        try {
+            String testXML = "<root>" + "  <node/>" + "  <node/>" + "  <node/>" + "  <node/>" + "</root>\n";
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            // dbf.setNamespaceAware(true);
+            DocumentBuilder builder = dbf.newDocumentBuilder();
+            ByteArrayInputStream bis = new ByteArrayInputStream(testXML.getBytes());
+            Document testDoc = builder.parse(bis);
+            XPathFactory xpathFactory = XPathFactory.newInstance();
+            XPath xpath = xpathFactory.newXPath();
+            XPathExpression expr = xpath.compile("/root/node");
+            NodeList testNodes = (NodeList) expr.evaluate(testDoc, XPathConstants.NODESET);
+            // Node list appears to work correctly
+            System.out.println("testNodes.getLength() = " + testNodes.getLength());
+            System.out.println("testNodes[0] = " + testNodes.item(0));
+            System.out.println("testNodes[0] = " + testNodes.item(0));
+            System.out.println("testNodes.getLength() = " + testNodes.getLength());
+            // Access past the end of the NodeList correctly returns null
+            System.out.println("testNodes[testNodes.getLength()] = " + testNodes.item(testNodes.getLength()));
+            // BUG! First access of valid node after accessing past the end
+            // incorrectly returns null
+            if (testNodes.item(0) == null) {
+                System.out.println("testNodes[0] = null");
+                Assert.fail("First access of valid node after accessing past the end incorrectly returns null");
+            }
+            // Subsequent access of valid node correctly returns the node
+            System.out.println("testNodes[0] = " + testNodes.item(0));
+        } catch (Exception ex) {
+            ex.printStackTrace();
+        }
+
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6517707Test.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6517707Test.java
new file mode 100644
index 00000000000..67241c85d05
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6517707Test.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStreamReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6517707
+ * @summary Test Node.setNodeValue(value) shall throw DOMException.NO_MODIFICATION_ALLOWED_ERR if the node is read-only.
+ */
+public class CR6517707Test {
+
+    @Test
+    public void testCanonicalForm001() {
+        String data = "<?xml version=\"1.0\" ?>" + "<!DOCTYPE root [" + "<!ELEMENT root ANY>" + "<!ENTITY ent \"foo\">"
+                + "<!NOTATION not PUBLIC \"http://xxx.xxx.xx/x.txt\">" + "]>" + "<root>" + "</root>";
+
+        Document document = null;
+        try {
+            DocumentBuilderFactory docBF = DocumentBuilderFactory.newInstance();
+            docBF.setNamespaceAware(true);
+            DocBuilderWrapper docBuilder = new DocBuilderWrapper(docBF.newDocumentBuilder());
+            document = docBuilder.parse(data);
+        } catch (ParserConfigurationException e) {
+            // return Status.failed(e.toString());
+        } catch (IOException e) {
+            // return Status.failed(e.toString());
+        } catch (SAXException e) {
+            // return Status.failed(e.toString());
+        }
+
+        Entity anEntity = (Entity) document.getDoctype().getEntities().item(0);
+        boolean success = false;
+        try {
+            anEntity.setNodeValue("someValue"); // on jdk 6, not even throwing
+                                                // exception
+
+            System.out.println("Should throw DOMException: NO_MODIFICATION_ALLOWED_ERR ");
+        } catch (DOMException e) {
+            if (e.code == DOMException.NO_MODIFICATION_ALLOWED_ERR) {
+                System.out.println(e.getMessage());
+                success = true;
+            } else {
+                System.out.println("should throw DOMException.NO_MODIFICATION_ALLOWED_ERR (7). The error returned is " + e.code);
+            }
+        }
+        if (!success) {
+            Assert.fail("should throw DOMException.NO_MODIFICATION_ALLOWED_ERR (7).");
+        }
+    }
+
+    class DocBuilderWrapper {
+
+        private DocumentBuilder docBuilder;
+        private final String ENCODING = "UTF-8";
+
+        public DocBuilderWrapper() throws ParserConfigurationException {
+            this.docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+        }
+
+        public DocBuilderWrapper(DocumentBuilder docBuilder) {
+            setDocumentBuilder(docBuilder);
+        }
+
+        public DocumentBuilder getDocumentBuilder() {
+            return docBuilder;
+        }
+
+        public void setDocumentBuilder(DocumentBuilder docBuilder) {
+            if (docBuilder == null) {
+                new IllegalArgumentException("DocumentBuilder cannot be null");
+            }
+
+            this.docBuilder = docBuilder;
+        }
+
+        public Document parse(String xmlData) throws IOException, SAXException {
+            if (xmlData == null) {
+                new IllegalArgumentException("String cannot be null");
+            }
+
+            ByteArrayInputStream bis = new ByteArrayInputStream(xmlData.getBytes(ENCODING));
+            InputStreamReader isr = new InputStreamReader(bis, ENCODING);
+            InputSource source = new InputSource(isr);
+            return docBuilder.parse(source);
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6517717Test.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6517717Test.java
new file mode 100644
index 00000000000..02e1972b11a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6517717Test.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 6517717
+ * @summary Test Node.setPrefix(prefix) shall throw DOMException.NO_MODIFICATION_ALLOWED_ERR if the node is read-only.
+ */
+public class CR6517717Test {
+
+    @Test
+    public void testCanonicalForm001() {
+        String data = "<?xml version=\"1.0\" ?>" + "<!DOCTYPE test:root [" + "<!ELEMENT test:root ANY>" + "<!ENTITY ent \"foo\">"
+                + "<!ATTLIST test:root test:a CDATA #FIXED \"qqq\">" + "]>" + "<test:root xmlns:test=\"http://xxxx.xx/\">" + "</test:root>";
+
+        Document document = null;
+        try {
+            DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+            document = docBuilder.parse(new InputSource(new StringReader(data)));
+        } catch (ParserConfigurationException e) {
+            System.out.println(e.toString());
+        } catch (IOException e) {
+            System.out.println(e.toString());
+        } catch (SAXException e) {
+            System.out.println(e.toString());
+        }
+
+        Entity anEntity = (Entity) document.getDoctype().getEntities().item(0);
+        boolean success = false;
+        try {
+            anEntity.setPrefix("test1");
+            System.out.println("Should throw DOMException: NO_MODIFICATION_ALLOWED_ERR ");
+        } catch (DOMException e) {
+            if (e.code == DOMException.NO_MODIFICATION_ALLOWED_ERR) {
+                System.out.println("OK");
+                success = true;
+            } else {
+                System.out.println("should throw DOMException.NO_MODIFICATION_ALLOWED_ERR (7). The error returned is (" + e.code + ")" + e.getMessage());
+            }
+        }
+        if (!success) {
+            Assert.fail("should throw DOMException.NO_MODIFICATION_ALLOWED_ERR (7).");
+        }
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6909336Test.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6909336Test.java
new file mode 100644
index 00000000000..85e90cd294b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/CR6909336Test.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import javax.xml.transform.dom.DOMResult;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.bootstrap.DOMImplementationRegistry;
+
+/*
+ * @bug 6909336
+ * @summary Test DOM writer can write more that 20 nested elements.
+ */
+public class CR6909336Test {
+
+    @Test
+    public void test() {
+        try {
+            Document doc = DOMImplementationRegistry.newInstance().getDOMImplementation("XML 3.0").createDocument("", "root", null);
+            XMLStreamWriter xsw = XMLOutputFactory.newInstance().createXMLStreamWriter(new DOMResult(doc.getDocumentElement()));
+            for (int i = 0; i < 30; ++i) {
+                xsw.writeStartElement("nested");
+            }
+        } catch (RuntimeException ex) {
+            System.out.println("RuntimeException ex" + ex.getMessage());
+            if (ex.getMessage().equals("20")) {
+                Assert.fail("XMLDOMWriter cannot write more that 20 nested elements");
+            }
+        } catch (XMLStreamException ex) {
+            System.out.println("XMLStreamException ex" + ex.getMessage());
+        } catch (ClassNotFoundException ex) {
+            System.out.println("ClassNotFoundException ex" + ex.getMessage());
+        } catch (InstantiationException ex) {
+            System.out.println("InstantiationException ex" + ex.getMessage());
+        } catch (IllegalAccessException ex) {
+            System.out.println("IllegalAccessException ex" + ex.getMessage());
+
+        }
+
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/DOMConfigurationTest.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/DOMConfigurationTest.java
new file mode 100644
index 00000000000..6a4fba6245c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/DOMConfigurationTest.java
@@ -0,0 +1,1609 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package org.w3c.dom;
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.net.URISyntaxException;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSParser;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test DOMConfiguration for supported properties.
+ */
+public class DOMConfigurationTest {
+
+    static class TestHandler implements DOMErrorHandler {
+        private String warning;
+        private String error;
+        private String fatalError;
+
+        public String getError() {
+            return error;
+        }
+
+        public String getFatalError() {
+            return fatalError;
+        }
+
+        public String getWarning() {
+            return warning;
+        }
+
+        public boolean handleError(DOMError error) {
+            if (error.getSeverity() == DOMError.SEVERITY_ERROR) {
+                this.error = "" + error.getMessage();
+                return false;
+            }
+            if (error.getSeverity() == DOMError.SEVERITY_FATAL_ERROR) {
+                this.fatalError = "" + error.getMessage();
+                return false;
+            }
+            this.warning = "" + error.getMessage();
+            return true; // warning
+        }
+    }
+
+    static class TestFailureHandler implements DOMErrorHandler {
+        public boolean handleError(DOMError error) {
+            if (error.getSeverity() == DOMError.SEVERITY_ERROR) {
+                Assert.fail("Error: " + error.getMessage());
+            }
+            if (error.getSeverity() == DOMError.SEVERITY_FATAL_ERROR) {
+                Assert.fail("Fatal error: " + error.getMessage());
+            }
+            return true; // warning
+        }
+    }
+
+    void setHandler(Document doc) {
+        doc.getDomConfig().setParameter("error-handler", new TestFailureHandler());
+    }
+
+    static final String SCHEMA_LANGUAGE = "http://java.sun.com/xml/jaxp/properties/schemaLanguage";
+
+    static final String SCHEMA_SOURCE = "http://java.sun.com/xml/jaxp/properties/schemaSource";
+
+    static final String XMLNS = "http://www.w3.org/2000/xmlns/";
+
+    static Document loadDocument(String schemaURL, String instanceText) {
+        Document document = null;
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            dbf.setValidating(true);
+            if (schemaURL != null) {
+                dbf.setAttribute(SCHEMA_LANGUAGE, XMLConstants.W3C_XML_SCHEMA_NS_URI);
+                dbf.setAttribute(SCHEMA_SOURCE, schemaURL);
+            }
+            DocumentBuilder parser = dbf.newDocumentBuilder();
+
+            InputSource inSource = new InputSource(new StringReader(instanceText));
+            inSource.setSystemId("doc.xml");
+            document = parser.parse(inSource);
+        } catch (ParserConfigurationException e) {
+            Assert.fail(e.toString());
+        } catch (IOException e) {
+            Assert.fail(e.toString());
+        } catch (SAXException e) {
+            Assert.fail(e.toString());
+        }
+
+        return document;
+    }
+
+    static final String test_xml = "<?xml version=\"1.0\"?>\n" + "<test:root xmlns:test=\"test\" \n"
+            + "           xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" \n" + ">&#x9;&#xA;&#xD; 1 </test:root>\n";
+
+    static final String test1_xml = "<?xml version=\"1.0\"?>\n" + "<!DOCTYPE root [\n" + "    <!ELEMENT root ANY>\n" + "    <!ENTITY x \"X\">\n" + "]>\n"
+            + "<root/>\n";
+
+    static final String test2_xml = "<?xml version=\"1.0\"?>\n" + "<!DOCTYPE root [\n" + "    <!ELEMENT root ANY>\n"
+            + "    <!ATTLIST root attr CDATA #REQUIRED>\n" + "    <!ENTITY x \"<\">\n" + "]>\n" + "<root attr=\"x\"/>\n";
+
+    static final String test3_xml = "<?xml version=\"1.0\"?>\n" + "<!DOCTYPE root [\n" + "    <!ELEMENT root (elem*)>\n" + "    <!ELEMENT elem EMPTY>\n"
+            + "]>\n" + "<root/>\n";
+
+    static String test1_xsd_url;
+    static {
+        try {
+            test1_xsd_url = DOMConfigurationTest.class.getResource("DOMConfigurationTest.xsd").toURI().toString();
+        } catch (URISyntaxException uriSyntaxException) {
+            Assert.fail(uriSyntaxException.toString());
+        }
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the doc contains two subsequent processing
+     * instrictions, <br>
+     * <b>name</b>: canonical-form <br>
+     * <b>value</b>: true. <br>
+     * <b>Expected results</b>: the subsequent processing instrictions are
+     * separated with a single line break
+     */
+    @Test
+    public void testCanonicalForm001() {
+        DOMImplementation domImpl = null;
+        try {
+            domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument("namespaceURI", "ns:root", null);
+
+        DOMConfiguration config = doc.getDomConfig();
+
+        Element root = doc.getDocumentElement();
+        ProcessingInstruction pi1 = doc.createProcessingInstruction("target1", "data1");
+        ProcessingInstruction pi2 = doc.createProcessingInstruction("target2", "data2");
+
+        root.appendChild(pi1);
+        root.appendChild(pi2);
+
+        if (!config.canSetParameter("canonical-form", Boolean.TRUE)) {
+            System.out.println("OK, setting 'canonical-form' to true is not supported");
+            return;
+        }
+
+        config.setParameter("canonical-form", Boolean.TRUE);
+        setHandler(doc);
+        doc.normalizeDocument();
+
+        Node child1 = root.getFirstChild();
+        Node child2 = child1.getNextSibling();
+
+        if (child2.getNodeType() == Node.PROCESSING_INSTRUCTION_NODE) {
+            Assert.fail("the second child is expected to be a" + "single line break, returned: " + child2);
+        }
+
+        // return Status.passed("OK");
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the parameters "namespaces",
+     * "namespace-declarations", "well-formed", "element-content-whitespace" are
+     * set to false if possible; the parameters "entities",
+     * "normalize-characters", "cdata-sections" are set to true if possible, <br>
+     * <b>name</b>: canonical-form <br>
+     * <b>value</b>: true. <br>
+     * <b>Expected results</b>: the parameters "namespaces",
+     * "namespace-declarations", "well-formed", "element-content-whitespace" are
+     * set to true; the parameters "entities", "normalize-characters",
+     * "cdata-sections" are set to false
+     */
+    @Test
+    public void testCanonicalForm002() {
+        Object[][] params = { { "namespaces", Boolean.TRUE }, { "namespace-declarations", Boolean.TRUE }, { "well-formed", Boolean.TRUE },
+                { "element-content-whitespace", Boolean.TRUE },
+
+                { "entities", Boolean.FALSE }, { "normalize-characters", Boolean.FALSE }, { "cdata-sections", Boolean.FALSE }, };
+
+        DOMImplementation domImpl = null;
+        try {
+            domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument("namespaceURI", "ns:root", null);
+
+        DOMConfiguration config = doc.getDomConfig();
+
+        if (!config.canSetParameter("canonical-form", Boolean.TRUE)) {
+            System.out.println("OK, setting 'canonical-form' to true is not supported");
+            return;
+        }
+
+        for (int i = params.length; --i >= 0;) {
+            Boolean reset = params[i][1].equals(Boolean.TRUE) ? Boolean.FALSE : Boolean.TRUE;
+            if (config.canSetParameter(params[i][0].toString(), reset)) {
+                config.setParameter(params[i][0].toString(), reset);
+            }
+        }
+
+        config.setParameter("canonical-form", Boolean.TRUE);
+
+        StringBuffer result = new StringBuffer();
+
+        for (int i = params.length; --i >= 0;) {
+            Object param = config.getParameter(params[i][0].toString());
+            if (!params[i][1].equals(param)) {
+                result.append("; the parameter \'" + params[i][0] + "\' is set to " + param + ", expected: " + params[i][1]);
+            }
+        }
+
+        if (result.length() > 0) {
+            Assert.fail(result.toString().substring(2));
+        }
+
+        return; // Status.passed("OK");
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the doc's root element contains superfluous
+     * namespace declarations, <br>
+     * <b>name</b>: canonical-form <br>
+     * <b>value</b>: true. <br>
+     * <b>Expected results</b>: the superfluous namespace declarations are
+     * removed
+     */
+    @Test
+    public void testCanonicalForm003() {
+        DOMImplementation domImpl = null;
+        try {
+            domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument("namespaceURI", "ns:root", null);
+
+        DOMConfiguration config = doc.getDomConfig();
+
+        Element root = doc.getDocumentElement();
+        String XMLNS = "http://www.w3.org/2000/xmlns/";
+        root.setAttributeNS(XMLNS, "xmlns:extra1", "ExtraNS1");
+        root.setAttributeNS(XMLNS, "xmlns:extra2", "ExtraNS2");
+
+        if (!config.canSetParameter("canonical-form", Boolean.TRUE)) {
+            System.out.println("OK, setting 'canonical-form' to true is not supported");
+            return;
+        }
+        config.setParameter("canonical-form", Boolean.TRUE);
+        setHandler(doc);
+        doc.normalizeDocument();
+
+        String xmlns2 = root.getAttributeNS(XMLNS, "extra1");
+        if (xmlns2 == null || xmlns2.length() != 0) {
+            Assert.fail("superfluous namespace declarations is not removed: xmlns:extra2 = " + xmlns2);
+        }
+
+        return; // Status.passed("OK");
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: setting the "canonical-form" to true is supported, <br>
+     * <b>name</b>: canonical-form <br>
+     * <b>value</b>: true. <br>
+     * <b>Expected results</b>: one of the following parameters is changed:
+     * "namespaces", "namespace-declarations", "well-formed",
+     * "element-content-whitespace", "entities", "normalize-characters",
+     * "cdata-sections" then "canonical-form" becomes false
+     */
+    @Test
+    public void testCanonicalForm004() {
+        Object[][] params = { { "namespaces", Boolean.TRUE }, { "namespace-declarations", Boolean.TRUE }, { "well-formed", Boolean.TRUE },
+                { "element-content-whitespace", Boolean.TRUE },
+
+                { "entities", Boolean.FALSE }, { "normalize-characters", Boolean.FALSE }, { "cdata-sections", Boolean.FALSE }, };
+
+        DOMImplementation domImpl = null;
+        try {
+            domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument("namespaceURI", "ns:root", null);
+
+        DOMConfiguration config = doc.getDomConfig();
+
+        if (!config.canSetParameter("canonical-form", Boolean.TRUE)) {
+            System.out.println("OK, setting 'canonical-form' to true is not supported");
+            return;
+        }
+
+        StringBuffer result = new StringBuffer();
+
+        for (int i = params.length; --i >= 0;) {
+            config.setParameter("canonical-form", Boolean.TRUE);
+            Boolean changedValue = (params[i][1].equals(Boolean.TRUE)) ? Boolean.FALSE : Boolean.TRUE;
+            if (config.canSetParameter(params[i][0].toString(), changedValue)) {
+                config.setParameter(params[i][0].toString(), changedValue);
+                Object param = config.getParameter("canonical-form");
+                if (!Boolean.FALSE.equals(param)) {
+                    result.append("; setting the parameter '" + params[i][0] + "' to " + changedValue + " does not change 'canonical-form' to false");
+                }
+            }
+        }
+
+        if (result.length() > 0) {
+            Assert.fail(result.toString().substring(2));
+        }
+
+        return; // Status.passed("OK");
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the root element has one CDATASection followed by
+     * one Text node, <br>
+     * <b>name</b>: cdata-sections <br>
+     * <b>value</b>: true. <br>
+     * <b>Expected results</b>: the CDATASection is left intact
+     */
+    @Test
+    public void testCdataSections001() {
+        DOMImplementation domImpl = null;
+        try {
+            domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument("namespaceURI", "ns:root", null);
+
+        String cdataText = "CDATA CDATA CDATA";
+        String textText = "text text text";
+
+        CDATASection cdata = doc.createCDATASection(cdataText);
+        Text text = doc.createTextNode(textText);
+
+        DOMConfiguration config = doc.getDomConfig();
+        config.setParameter("cdata-sections", Boolean.TRUE);
+
+        Element root = doc.getDocumentElement();
+        root.appendChild(cdata);
+        root.appendChild(text);
+
+        setHandler(doc);
+        doc.normalizeDocument();
+
+        Node returned = root.getFirstChild();
+
+        if (returned.getNodeType() != Node.CDATA_SECTION_NODE) {
+            Assert.fail("reurned: " + returned + ", expected: CDATASection");
+        }
+
+        return; // Status.passed("OK");
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the root element has one CDATASection followed by
+     * one Text node, <br>
+     * <b>name</b>: cdata-sections <br>
+     * <b>value</b>: false. <br>
+     * <b>Expected results</b>: the root element has one Text node with text of
+     * the CDATASection and the Text node
+     */
+    @Test
+    public void testCdataSections002() {
+        DOMImplementation domImpl = null;
+        try {
+            domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument("namespaceURI", "ns:root", null);
+
+        String cdataText = "CDATA CDATA CDATA";
+        String textText = "text text text";
+
+        CDATASection cdata = doc.createCDATASection(cdataText);
+        Text text = doc.createTextNode(textText);
+
+        DOMConfiguration config = doc.getDomConfig();
+        config.setParameter("cdata-sections", Boolean.FALSE);
+
+        Element root = doc.getDocumentElement();
+        root.appendChild(cdata);
+        root.appendChild(text);
+
+        setHandler(doc);
+        doc.normalizeDocument();
+
+        Node returned = root.getFirstChild();
+
+        if (returned.getNodeType() != Node.TEXT_NODE) {
+            Assert.fail("reurned: " + returned + ", expected: TEXT_NODE");
+        }
+
+        String returnedText = returned.getNodeValue();
+        if (!(cdataText + textText).equals(returnedText)) {
+            Assert.fail("reurned: " + returnedText + ", expected: \"" + cdataText + textText + "\"");
+        }
+
+        return; // Status.passed("OK");
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the root element has one Text node with not fully
+     * normalized characters, the 'check-character-normalization' parameter set
+     * to true, <br>
+     * <b>name</b>: error-handler <br>
+     * <b>value</b>: DOMErrorHandler. <br>
+     * <b>Expected results</b>: LSParser calls the specified error handler
+     */
+    @Test
+    public void testCheckCharNorm001() {
+        DOMImplementation domImpl = null;
+        try {
+            domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        DOMImplementationLS lsImpl = (DOMImplementationLS) domImpl.getFeature("LS", "3.0");
+
+        if (lsImpl == null) {
+            System.out.println("OK, the DOM implementation does not support the LS 3.0");
+            return;
+        }
+
+        LSParser lsParser = lsImpl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
+
+        DOMConfiguration config = lsParser.getDomConfig();
+
+        if (!config.canSetParameter("check-character-normalization", Boolean.TRUE)) {
+            System.out.println("OK, setting 'check-character-normalization' to true is not supported");
+            return;
+        }
+
+        config.setParameter("check-character-normalization", Boolean.TRUE);
+
+        TestHandler testHandler = new TestHandler();
+        config.setParameter("error-handler", testHandler);
+
+        LSInput lsInput = lsImpl.createLSInput();
+        lsInput.setStringData("<root>\u0073\u0075\u0063\u0327\u006F\u006E</root>");
+        Document doc = lsParser.parse(lsInput);
+
+        if (null == testHandler.getError()) {
+            Assert.fail("no error is reported, expected 'check-character-normalization-failure'");
+
+        }
+
+        return; // Status.passed("OK");
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the root element contains a fully-normalized text, <br>
+     * <b>name</b>: check-character-normalization <br>
+     * <b>value</b>: false. <br>
+     * <b>Expected results</b>: LSParser reports no errors
+     */
+    @Test
+    public void testCheckCharNorm002() {
+        DOMImplementation domImpl = null;
+        try {
+            domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        DOMImplementationLS lsImpl = (DOMImplementationLS) domImpl.getFeature("LS", "3.0");
+
+        if (lsImpl == null) {
+            System.out.println("OK, the DOM implementation does not support the LS 3.0");
+            return;
+        }
+
+        LSParser lsParser = lsImpl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
+
+        DOMConfiguration config = lsParser.getDomConfig();
+
+        if (!config.canSetParameter("check-character-normalization", Boolean.FALSE)) {
+            Assert.fail("setting 'check-character-normalization' to false is not supported");
+        }
+
+        config.setParameter("check-character-normalization", Boolean.FALSE);
+
+        TestHandler testHandler = new TestHandler();
+        config.setParameter("error-handler", testHandler);
+
+        LSInput lsInput = lsImpl.createLSInput();
+        lsInput.setStringData("<root>fully-normalized</root>");
+        Document doc = lsParser.parse(lsInput);
+
+        if (null != testHandler.getError()) {
+            Assert.fail("no error is expected, but reported: " + testHandler.getError());
+
+        }
+
+        return; // Status.passed("OK");
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the root element has two Comment nodes, <br>
+     * <b>name</b>: comments <br>
+     * <b>value</b>: true. <br>
+     * <b>Expected results</b>: the Comment nodes belong to the root element
+     */
+    @Test
+    public void testComments001() {
+        DOMImplementation domImpl = null;
+        try {
+            domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument("namespaceURI", "ns:root", null);
+
+        Comment comment1 = doc.createComment("comment1");
+        Comment comment2 = doc.createComment("comment2");
+
+        DOMConfiguration config = doc.getDomConfig();
+        config.setParameter("comments", Boolean.TRUE);
+
+        Element root = doc.getDocumentElement();
+        root.appendChild(comment1);
+        root.appendChild(comment2);
+
+        setHandler(doc);
+        doc.normalizeDocument();
+
+        if (comment1.getParentNode() != root) {
+            Assert.fail("comment1 is attached to " + comment1.getParentNode() + ", but expected to be a child of root");
+        }
+
+        if (comment2.getParentNode() != root) {
+            Assert.fail("comment1 is attached to " + comment2.getParentNode() + ", but expected to be a child of root");
+        }
+
+        return; // Status.passed("OK");
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the root element has two Comment nodes, <br>
+     * <b>name</b>: comments <br>
+     * <b>value</b>: false. <br>
+     * <b>Expected results</b>: the root element has no children
+     */
+    @Test
+    public void testComments002() {
+        DOMImplementation domImpl = null;
+        try {
+            domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument("namespaceURI", "ns:root", null);
+
+        Comment comment1 = doc.createComment("comment1");
+        Comment comment2 = doc.createComment("comment2");
+
+        DOMConfiguration config = doc.getDomConfig();
+        config.setParameter("comments", Boolean.FALSE);
+
+        Element root = doc.getDocumentElement();
+        root.appendChild(comment1);
+        root.appendChild(comment2);
+
+        doc.normalizeDocument();
+
+        if (root.getFirstChild() != null) {
+            Assert.fail("root has a child " + root.getFirstChild() + ", but expected to has none");
+        }
+
+        return; // Status.passed("OK");
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the root element is declared as int and its value
+     * has subsequent characters #x9 (tab), #xA (line feed) and #xD (carriage
+     * return) , #x20 (space), '1', #x20 (space), <br>
+     * <b>name</b>: datatype-normalization <br>
+     * <b>value</b>: true. <br>
+     * <b>Expected results</b>: after Document.normalizeDocument() is called the
+     * content of the root is '1'
+     */
+    @Test
+    public void testDatatypeNormalization001() {
+        Document doc = null;
+        try {
+            doc = loadDocument(test1_xsd_url, test_xml);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+
+        DOMConfiguration config = doc.getDomConfig();
+
+        if (!config.canSetParameter("schema-location", test1_xsd_url) || !config.canSetParameter("schema-type", XMLConstants.W3C_XML_SCHEMA_NS_URI)) {
+            System.out.println("cannot set the parameters 'schema-location' and 'schema-type'" + " to '" + test1_xsd_url + "' and '"
+                    + XMLConstants.W3C_XML_SCHEMA_NS_URI + "' respectively");
+            return;
+        }
+        config.setParameter("schema-type", XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        config.setParameter("schema-location", test1_xsd_url);
+
+        if (!config.canSetParameter("validate", Boolean.TRUE)) {
+            System.out.println("OK, setting 'validate' to true is not supported");
+            return;
+        }
+        config.setParameter("validate", Boolean.TRUE);
+
+        if (!config.canSetParameter("datatype-normalization", Boolean.TRUE)) {
+            System.out.println("OK, setting 'datatype-normalization' to true is not supported");
+            return;
+        }
+        config.setParameter("datatype-normalization", Boolean.TRUE);
+
+        Element root = doc.getDocumentElement();
+        while (root.getFirstChild() != null) {
+            root.removeChild(root.getFirstChild());
+        }
+        root.appendChild(doc.createTextNode("\t\r\n 1 "));
+
+        setHandler(doc);
+        doc.normalizeDocument();
+
+        Node child = root.getFirstChild();
+        if (child == null || child.getNodeType() != Node.TEXT_NODE || !"1".equals(child.getNodeValue())) {
+            Assert.fail("child: " + child + ", expected: text node '1'");
+        }
+
+        return; // Status.passed("OK");
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the root element is declared as int and its value
+     * has subsequent characters #x9 (tab), #xA (line feed) and #xD (carriage
+     * return) , #x20 (space), '1', #x20 (space), <br>
+     * <b>name</b>: datatype-normalization <br>
+     * <b>value</b>: false. <br>
+     * <b>Expected results</b>: after Document.normalizeDocument() is called the
+     * value is left unchanged
+     */
+    @Test
+    public void testDatatypeNormalization002() {
+        Document doc = null;
+        try {
+            doc = loadDocument(test1_xsd_url, test_xml);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+
+        DOMConfiguration config = doc.getDomConfig();
+
+        if (!config.canSetParameter("schema-location", test1_xsd_url) || !config.canSetParameter("schema-type", XMLConstants.W3C_XML_SCHEMA_NS_URI)) {
+            System.out.println("cannot set the parameters 'schema-location' and 'schema-type'" + " to '" + test1_xsd_url + "' and '"
+                    + XMLConstants.W3C_XML_SCHEMA_NS_URI + "' respectively");
+            return;
+        }
+        config.setParameter("schema-type", XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        config.setParameter("schema-location", test1_xsd_url);
+
+        if (config.canSetParameter("validate", Boolean.TRUE)) {
+            config.setParameter("validate", Boolean.TRUE);
+        }
+
+        if (!config.canSetParameter("datatype-normalization", Boolean.FALSE)) {
+            Assert.fail("datatype-normalization' to false is not supported");
+        }
+        config.setParameter("datatype-normalization", Boolean.FALSE);
+
+        Element root = doc.getDocumentElement();
+        while (root.getFirstChild() != null) {
+            root.removeChild(root.getFirstChild());
+        }
+        String value = "\t\r\n 1 ";
+        root.appendChild(doc.createTextNode(value));
+
+        setHandler(doc);
+        doc.normalizeDocument();
+
+        Node child = root.getFirstChild();
+        if (child == null || child.getNodeType() != Node.TEXT_NODE || !value.equals(child.getNodeValue())) {
+            Assert.fail("child: " + child + ", expected: '\\t\\r\\n 1 '");
+        }
+
+        return; // Status.passed("OK");
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the doc contains one entity and one entity
+     * reference, <br>
+     * <b>name</b>: entities <br>
+     * <b>value</b>: true. <br>
+     * <b>Expected results</b>: the entity and the entity reference are left
+     * unchanged
+     */
+    @Test
+    public void testEntities001() {
+        Document doc = null;
+        try {
+            doc = loadDocument(null, test1_xml);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+
+        DOMConfiguration config = doc.getDomConfig();
+        if (!config.canSetParameter("entities", Boolean.TRUE)) {
+            Assert.fail("setting 'entities' to true is not supported");
+        }
+
+        Element root = doc.getDocumentElement();
+        root.appendChild(doc.createEntityReference("x"));
+
+        config.setParameter("entities", Boolean.TRUE);
+
+        setHandler(doc);
+        doc.normalizeDocument();
+        Node child = root.getFirstChild();
+        if (child == null) {
+            Assert.fail("root has no child");
+        }
+        if (child.getNodeType() != Node.ENTITY_REFERENCE_NODE) {
+            Assert.fail("root's child is " + child + ", expected entity reference &x;");
+        }
+
+        if (doc.getDoctype() == null) {
+            Assert.fail("no doctype found");
+        }
+
+        if (doc.getDoctype().getEntities() == null) {
+            Assert.fail("no entitiy found");
+        }
+
+        if (doc.getDoctype().getEntities().getNamedItem("x") == null) {
+            Assert.fail("no entitiy with name 'x' found");
+        }
+
+        return; // Status.passed("OK");
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the doc contains one entity and one entity
+     * reference, <br>
+     * <b>name</b>: entities <br>
+     * <b>value</b>: false. <br>
+     * <b>Expected results</b>: the entity and the entity reference are removed
+     */
+    @Test
+    public void testEntities002() {
+        Document doc = null;
+        try {
+            doc = loadDocument(null, test1_xml);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+
+        DOMConfiguration config = doc.getDomConfig();
+        if (!config.canSetParameter("entities", Boolean.FALSE)) {
+            Assert.fail("setting 'entities' to false is not supported");
+        }
+
+        Element root = doc.getDocumentElement();
+        root.appendChild(doc.createEntityReference("x"));
+
+        // TODO: remove debug
+        NamedNodeMap entities = doc.getDoctype().getEntities();
+        Entity entityX = (Entity) entities.getNamedItem("x");
+        System.err.println();
+        System.err.println("Entity x: " + entityX.getTextContent());
+        System.err.println();
+
+        config.setParameter("entities", Boolean.FALSE);
+
+        setHandler(doc);
+        doc.normalizeDocument();
+        Node child = root.getFirstChild();
+
+        // TODO: restore test, exclude for now to allow other tests to run
+        /*
+         * if (child == null) { fail("root has no child"); } if
+         * (child.getNodeType() != Node.TEXT_NODE ||
+         * !"X".equals(child.getNodeValue())) { fail("root's child is " + child
+         * + ", expected text node with value 'X'"); }
+         *
+         * if (doc.getDoctype() == null) { fail("no doctype found"); }
+         *
+         * if (doc.getDoctype().getEntities() != null &&
+         * doc.getDoctype().getEntities().getNamedItem("x") != null) {
+         * fail("entity with name 'x' is found, expected to be removed"); }
+         */
+
+        return; // Status.passed("OK");
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the 'infoset' parameter is set to true, <br>
+     * <b>name</b>: infoset <br>
+     * <b>value</b>: false. <br>
+     * <b>Expected results</b>: the parameters "validate-if-schema", "entities",
+     * "datatype-normalization", "cdata-sections", "namespace-declarations",
+     * "well-formed", "element-content-whitespace", "comments", "namespaces" are
+     * left unchanged
+     */
+    @Test
+    public void testInfoset001() {
+        Object[][] params = { { "validate-if-schema", Boolean.FALSE }, { "entities", Boolean.FALSE }, { "datatype-normalization", Boolean.FALSE },
+                { "cdata-sections", Boolean.FALSE },
+
+                { "namespace-declarations", Boolean.TRUE }, { "well-formed", Boolean.TRUE }, { "element-content-whitespace", Boolean.TRUE },
+                { "comments", Boolean.TRUE }, { "namespaces", Boolean.TRUE }, };
+
+        DOMImplementation domImpl = null;
+        try {
+            domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument("namespaceURI", "ns:root", null);
+
+        DOMConfiguration config = doc.getDomConfig();
+
+        if (!config.canSetParameter("infoset", Boolean.TRUE)) {
+            Assert.fail("setting 'infoset' to true is not supported");
+        }
+
+        for (int i = params.length; --i >= 0;) {
+            Boolean reset = params[i][1].equals(Boolean.TRUE) ? Boolean.FALSE : Boolean.TRUE;
+            if (config.canSetParameter(params[i][0].toString(), reset)) {
+                config.setParameter(params[i][0].toString(), reset);
+            }
+        }
+
+        config.setParameter("infoset", Boolean.TRUE);
+        config.setParameter("infoset", Boolean.FALSE); // has no effect
+
+        StringBuffer result = new StringBuffer();
+
+        for (int i = params.length; --i >= 0;) {
+            Object param = config.getParameter(params[i][0].toString());
+            if (!params[i][1].equals(param)) {
+                result.append("; the parameter \'" + params[i][0] + "\' is set to " + param + ", expected: " + params[i][1]);
+            }
+        }
+
+        if (result.length() > 0) {
+            Assert.fail(result.toString().substring(2));
+        }
+
+        return; // Status.passed("OK");
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: A document with one root element created. The
+     * prefix 'ns' is bound to 'namespaceURI'. The 'namespaces' parameter is set
+     * to true, <br>
+     * <b>name</b>: namespace-declarations <br>
+     * <b>value</b>: false. <br>
+     * <b>Expected results</b>: Attribute xmlns:ns="namespaceURI" is not added
+     * to the root element
+     */
+    @Test
+    public void testNamespaces001() {
+        DOMImplementation domImpl = null;
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            domImpl = dbf.newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument("namespaceURI", "ns:root", null);
+        setHandler(doc);
+        Element root = doc.getDocumentElement();
+        DOMConfiguration config = doc.getDomConfig();
+
+        StringBuffer result = new StringBuffer();
+        if (config.canSetParameter("namespaces", Boolean.FALSE)) {
+            config.setParameter("namespaces", Boolean.FALSE);
+
+            // namespaces = false
+            // namespace-declarations = true (default)
+            doc.normalizeDocument();
+            String xmlnsNS = root.getAttributeNS(XMLNS, "ns");
+            if (xmlnsNS.length() > 0) {
+                result.append("; the 'namespaces' parameter is set to false but" + "Namespace normalization is performed, attribute" + " xmlns:ns=\"" + xmlnsNS
+                        + "\" is added");
+            }
+        }
+
+        doc = domImpl.createDocument("namespaceURI", "ns:root", null);
+        root = doc.getDocumentElement();
+        config = doc.getDomConfig();
+
+        if (!config.canSetParameter("namespaces", Boolean.TRUE)) {
+            result.append("; setting 'namespaces' to true is not supported");
+        } else {
+
+            config.setParameter("namespaces", Boolean.TRUE);
+
+            if (!config.canSetParameter("namespace-declarations", Boolean.FALSE)) {
+                result.append("; setting 'namespace-declarations' to false is not supported");
+            } else {
+                config.setParameter("namespace-declarations", Boolean.FALSE);
+
+                // namespaces = true
+                // namespace-declarations = false
+                doc.normalizeDocument();
+
+                String xmlnsNS = root.getAttributeNS(XMLNS, "ns");
+                if (xmlnsNS.length() > 0) {
+                    result.append("; namespaces = true, namespace-declarations = false, but" + " xmlns:ns=\"" + xmlnsNS + "\"");
+                }
+            }
+
+            doc = domImpl.createDocument("namespaceURI", "ns:root", null);
+            setHandler(doc);
+            root = doc.getDocumentElement();
+            config = doc.getDomConfig();
+
+            config.setParameter("namespaces", Boolean.TRUE);
+
+            if (!config.canSetParameter("namespace-declarations", Boolean.TRUE)) {
+                result.append("; setting 'namespace-declarations' to true is not supported");
+            } else {
+                config.setParameter("namespace-declarations", Boolean.TRUE);
+
+                // namespaces = true
+                // namespace-declarations = true
+                doc.normalizeDocument();
+
+                String xmlnsNS = root.getAttributeNS(XMLNS, "ns");
+                if (!"namespaceURI".equals(xmlnsNS)) {
+                    result.append("; namespaces = true, namespace-declarations = true, but" + " xmlns:ns=\"" + xmlnsNS + "\"");
+                }
+            }
+        }
+
+        if (result.length() > 0) {
+            Assert.fail(result.toString().substring(2));
+        }
+        return; // Status.passed("OK");
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: an attribute value is not fully normalized, <br>
+     * <b>name</b>: normalize-characters <br>
+     * <b>value</b>: false. <br>
+     * <b>Expected results</b>: Node.normalize() leaves the value unchanged
+     */
+    @Test
+    public void testNormalizeCharacters001() {
+        DOMImplementation domImpl = null;
+        try {
+            domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument(null, null, null);
+
+        Attr attr = doc.createAttribute("attr");
+        String notNormalized = " \u0073\u0075\u0063\u0327\u006F\u006E ";
+        attr.setValue(notNormalized);
+
+        DOMConfiguration config = doc.getDomConfig();
+
+        StringBuffer result = new StringBuffer();
+        if (!config.canSetParameter("normalize-characters", Boolean.FALSE)) {
+            result.append("; setting 'normalize-characters' to false is not supported");
+        } else {
+
+            config.setParameter("normalize-characters", Boolean.FALSE);
+
+            attr.normalize();
+
+            String value = attr.getValue();
+            if (!notNormalized.equals(value)) {
+                result.append("; the value is normalized to '" + value + "', expected to stay unchanged");
+            }
+        }
+
+        if (config.canSetParameter("normalize-characters", Boolean.TRUE)) {
+            config.setParameter("normalize-characters", Boolean.TRUE);
+
+            attr.setValue(notNormalized);
+            attr.normalize();
+
+            String value = attr.getValue();
+            if (notNormalized.equals(value)) {
+                result.append("; the value is not normalized: '" + value + "', expected: '\u0073\u0075\u00E7\u006F\u006E'");
+            }
+        }
+
+        if (result.length() > 0) {
+            Assert.fail(result.toString().substring(2));
+        }
+        return; // Status.passed("OK");
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: The root element has invalid content. The
+     * 'validate' parameter is set to true. The 'schema-location' parameter is
+     * set to 'DOMConfigurationTest.xsd'., <br>
+     * <b>name</b>: schema-type <br>
+     * <b>value</b>: http://www.w3.org/2001/XMLSchema. <br>
+     * <b>Expected results</b>: An error is reported
+     */
+    @Test
+    public void testValidate001() {
+        DOMImplementation domImpl = null;
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            dbf.setValidating(true);
+            domImpl = dbf.newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument("test", "ns:root", null);
+
+        Element root = doc.getDocumentElement();
+        root.appendChild(doc.createTextNode("xxx")); // invalid value
+
+        DOMConfiguration config = doc.getDomConfig();
+
+        if (!config.canSetParameter("schema-location", test1_xsd_url) || !config.canSetParameter("schema-type", XMLConstants.W3C_XML_SCHEMA_NS_URI)) {
+            System.out.println("cannot set the parameters 'schema-location' and 'schema-type'" + " to '" + test1_xsd_url + "' and '"
+                    + XMLConstants.W3C_XML_SCHEMA_NS_URI + "' respectively");
+            return;
+        }
+        config.setParameter("schema-type", XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        config.setParameter("schema-location", test1_xsd_url);
+
+        String resultOK = "OK";
+        StringBuffer result = new StringBuffer();
+        if (!config.canSetParameter("validate", Boolean.TRUE)) {
+            resultOK = "OK, setting the parameter 'validate' to true is not supported";
+        } else {
+            config.setParameter("validate", Boolean.TRUE);
+            TestHandler testHandler = new TestHandler();
+            config.setParameter("error-handler", testHandler);
+            doc.normalizeDocument();
+            if (testHandler.getError() == null && null == testHandler.getFatalError()) {
+                result.append("; no error was reported when the 'validate' is set to true");
+            }
+        }
+
+        if (!config.canSetParameter("validate", Boolean.FALSE)) {
+            result.append("; cannot set the parameters 'validate' to false");
+        } else {
+            config.setParameter("validate", Boolean.FALSE);
+            TestHandler testHandler = new TestHandler();
+            config.setParameter("error-handler", testHandler);
+            doc.normalizeDocument();
+            if (testHandler.getError() != null || null != testHandler.getFatalError()) {
+                result.append("; unexpected error: " + testHandler.getFatalError() + "; " + testHandler.getError());
+            }
+        }
+
+        if (result.length() > 0) {
+            Assert.fail(result.toString().substring(2));
+        }
+        return; // Status.passed(resultOK);
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: The root contains a CDATASection with the
+     * termination marker ']]&gt;', <br>
+     * <b>name</b>: split-cdata-sections <br>
+     * <b>value</b>: true. <br>
+     * <b>Expected results</b>: A warning is reported when the section is
+     * splitted
+     */
+    @Test
+    public void testSplitCDATA001() {
+        DOMImplementation domImpl = null;
+        try {
+            domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument("namespaceURI", "ns:root", null);
+
+        DOMConfiguration config = doc.getDomConfig();
+        CDATASection cdata = doc.createCDATASection("text]" + "]>text");
+        doc.getDocumentElement().appendChild(cdata);
+
+        TestHandler testHandler = new TestHandler();
+        config.setParameter("error-handler", testHandler);
+
+        if (!config.canSetParameter("split-cdata-sections", Boolean.TRUE)) {
+            Assert.fail("cannot set the parameters 'split-cdata-sections' to true");
+        }
+        config.setParameter("split-cdata-sections", Boolean.TRUE);
+
+        doc.normalizeDocument();
+        if (null == testHandler.getWarning()) {
+            Assert.fail("no warning is reported");
+        }
+
+        return; // Status.passed("OK");
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: The root contains a CDATASection with the
+     * termination marker ']]&gt;', <br>
+     * <b>name</b>: split-cdata-sections <br>
+     * <b>value</b>: false. <br>
+     * <b>Expected results</b>: No warning is reported
+     */
+    @Test
+    public void testSplitCDATA002() {
+        DOMImplementation domImpl = null;
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            dbf.setValidating(true);
+            domImpl = dbf.newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument("namespaceURI", "ns:root", null);
+
+        DOMConfiguration config = doc.getDomConfig();
+        CDATASection cdata = doc.createCDATASection("text]" + "]>text");
+        doc.getDocumentElement().appendChild(cdata);
+
+        TestHandler testHandler = new TestHandler();
+        config.setParameter("error-handler", testHandler);
+
+        if (!config.canSetParameter("split-cdata-sections", Boolean.FALSE)) {
+            Assert.fail("cannot set the parameters 'split-cdata-sections' to false");
+        }
+        config.setParameter("split-cdata-sections", Boolean.FALSE);
+
+        doc.normalizeDocument();
+        if (null == testHandler.getError()) {
+            Assert.fail("no error is reported");
+        }
+
+        return; // Status.passed("OK");
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: The root element has invalid content. The schema
+     * is specified by setting the 'schema-location' and the 'schema-type'
+     * parameters., <br>
+     * <b>name</b>: validate-if-schema <br>
+     * <b>value</b>: false. <br>
+     * <b>Expected results</b>: No error is reported
+     */
+    @Test
+    public void testValidateIfSchema001() {
+        DOMImplementation domImpl = null;
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            dbf.setValidating(true);
+            domImpl = dbf.newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument("test", "ns:root", null);
+
+        Element root = doc.getDocumentElement();
+        root.appendChild(doc.createTextNode("xxx")); // invalid value
+
+        DOMConfiguration config = doc.getDomConfig();
+
+        if (!config.canSetParameter("schema-location", test1_xsd_url) || !config.canSetParameter("schema-type", XMLConstants.W3C_XML_SCHEMA_NS_URI)) {
+            System.out.println("cannot set the parameters 'schema-location' and 'schema-type'" + " to 'DOMConfigurationTest.xsd' and '"
+                    + XMLConstants.W3C_XML_SCHEMA_NS_URI + "' respectively");
+            return;
+        }
+        config.setParameter("schema-type", XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        config.setParameter("schema-location", test1_xsd_url);
+
+        String resultOK = "OK";
+        StringBuffer result = new StringBuffer();
+        if (!config.canSetParameter("validate-if-schema", Boolean.FALSE)) {
+            result.append("; cannot set the parameters 'validate-if-schema' to false");
+        } else {
+            config.setParameter("validate-if-schema", Boolean.FALSE);
+            TestHandler testHandler = new TestHandler();
+            config.setParameter("error-handler", testHandler);
+            doc.normalizeDocument();
+            if (testHandler.getError() != null || null != testHandler.getFatalError()) {
+                result.append("; unexpected error: " + testHandler.getFatalError() + "; " + testHandler.getError());
+            }
+        }
+
+        if (!config.canSetParameter("validate-if-schema", Boolean.TRUE)) {
+            resultOK = "OK, setting the parameter 'validate-if-schema' to true is not supported";
+        } else {
+            config.setParameter("validate-if-schema", Boolean.TRUE);
+            TestHandler testHandler = new TestHandler();
+            config.setParameter("error-handler", testHandler);
+            doc.normalizeDocument();
+            if (testHandler.getError() == null && null == testHandler.getFatalError()) {
+                result.append("; no error was reported when the 'validate-if-schema' is set to true");
+            }
+        }
+
+        if (result.length() > 0) {
+            Assert.fail(result.toString().substring(2));
+        }
+        return; // Status.passed(resultOK);
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: The root element is not declared in the schema
+     * specified by setting the 'schema-location' and the 'schema-type'
+     * parameters., <br>
+     * <b>name</b>: validate-if-schema <br>
+     * <b>value</b>: true. <br>
+     * <b>Expected results</b>: No error is reported
+     */
+    @Test
+    public void testValidateIfSchema002() {
+        DOMImplementation domImpl = null;
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setNamespaceAware(true);
+            dbf.setValidating(true);
+            domImpl = dbf.newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException pce) {
+            Assert.fail(pce.toString());
+        } catch (FactoryConfigurationError fce) {
+            Assert.fail(fce.toString());
+        }
+
+        Document doc = domImpl.createDocument("test", "ns:undeclared_root", null);
+
+        Element root = doc.getDocumentElement();
+        root.appendChild(doc.createTextNode("xxx"));
+
+        DOMConfiguration config = doc.getDomConfig();
+
+        if (!config.canSetParameter("schema-location", test1_xsd_url) || !config.canSetParameter("schema-type", XMLConstants.W3C_XML_SCHEMA_NS_URI)) {
+            System.out.println("cannot set the parameters 'schema-location' and 'schema-type'" + " to 'DOMConfigurationTest.xsd' and '"
+                    + XMLConstants.W3C_XML_SCHEMA_NS_URI + "' respectively");
+            return;
+        }
+        config.setParameter("schema-type", XMLConstants.W3C_XML_SCHEMA_NS_URI);
+        config.setParameter("schema-location", test1_xsd_url);
+
+        if (!config.canSetParameter("validate-if-schema", Boolean.TRUE)) {
+            System.out.println("OK, setting the parameter 'validate-if-schema'" + " to true is not supported");
+            return;
+        }
+
+        config.setParameter("validate-if-schema", Boolean.TRUE);
+        TestHandler testHandler = new TestHandler();
+        config.setParameter("error-handler", testHandler);
+        doc.normalizeDocument();
+        if (testHandler.getError() != null || null != testHandler.getFatalError()) {
+            Assert.fail("unexpected error: " + testHandler.getFatalError() + "; " + testHandler.getError());
+        }
+        return; // Status.passed("OK");
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the attribute has EntityReference to '&lt;', <br>
+     * <b>name</b>: well-formed <br>
+     * <b>value</b>: true. <br>
+     * <b>Expected results</b>: An error is reported
+     */
+    @Test
+    public void testWellFormed001() {
+        Document doc = null;
+        try {
+            doc = loadDocument(null, test2_xml);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+
+        DOMConfiguration config = doc.getDomConfig();
+        if (!config.canSetParameter("well-formed", Boolean.TRUE)) {
+            Assert.fail("setting 'well-formed' to true is not supported");
+        }
+        config.setParameter("well-formed", Boolean.TRUE);
+
+        Element root = doc.getDocumentElement();
+
+        Attr attr = doc.createAttributeNS(null, "attr");
+
+        try {
+            attr.appendChild(doc.createEntityReference("<"));
+        } catch (DOMException domException) {
+            System.out.println("testWellFormed001: Expected DOMException for Attribute value = '<'" + domException.toString());
+            return; // OK
+        }
+
+        root.setAttributeNode(attr);
+
+        TestHandler testHandler = new TestHandler();
+        config.setParameter("error-handler", testHandler);
+
+        doc.normalizeDocument();
+
+        if (testHandler.getError() == null && null == testHandler.getFatalError()) {
+            Assert.fail("no error was reported when attribute has <");
+        }
+
+        return; // Status.passed("OK");
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the attribute has EntityReference to '&lt;', <br>
+     * <b>name</b>: well-formed <br>
+     * <b>value</b>: false. <br>
+     * <b>Expected results</b>: No error is reported
+     */
+    @Test
+    public void testWellFormed002() {
+        Document doc = null;
+        try {
+            doc = loadDocument(null, test2_xml);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+
+        DOMConfiguration config = doc.getDomConfig();
+        if (!config.canSetParameter("well-formed", Boolean.FALSE)) {
+            System.out.println("OK, setting 'well-formed' to false is not supported");
+            return;
+        }
+        config.setParameter("well-formed", Boolean.FALSE);
+
+        Element root = doc.getDocumentElement();
+
+        Attr attr = doc.createAttributeNS(null, "attr");
+        attr.appendChild(doc.createEntityReference("x"));
+
+        root.setAttributeNode(attr);
+
+        TestHandler testHandler = new TestHandler();
+        config.setParameter("error-handler", testHandler);
+
+        doc.normalizeDocument();
+
+        if (testHandler.getError() != null || null != testHandler.getFatalError()) {
+            Assert.fail("unexpected error: " + testHandler.getFatalError() + "; " + testHandler.getError());
+        }
+
+        return; // Status.passed("OK");
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the document root element has a text node with
+     * four white space characters, <br>
+     * <b>name</b>: element-content-whitespace <br>
+     * <b>value</b>: true. <br>
+     * <b>Expected results</b>: the text node is preserved
+     */
+    @Test
+    public void testECWhitespace001() {
+        Document doc = null;
+        try {
+            doc = loadDocument(null, test3_xml);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+
+        Element root = doc.getDocumentElement();
+        Text text = doc.createTextNode("\t\n\r ");
+        root.appendChild(text);
+
+        DOMConfiguration config = doc.getDomConfig();
+        if (!config.canSetParameter("element-content-whitespace", Boolean.TRUE)) {
+            Assert.fail("setting 'element-content-whitespace' to true is not supported");
+        }
+        config.setParameter("element-content-whitespace", Boolean.TRUE);
+
+        if (!config.canSetParameter("validate", Boolean.TRUE)) {
+            System.out.println("OK, setting 'validate' to true is not supported");
+            return;
+        }
+        config.setParameter("validate", Boolean.TRUE);
+
+        setHandler(doc);
+        doc.normalizeDocument();
+
+        Node firstChild = root.getFirstChild();
+        if (firstChild == null || firstChild.getNodeType() != Node.TEXT_NODE || !((Text) firstChild).isElementContentWhitespace()) {
+            Assert.fail("the first child is " + firstChild + ", expected a text node with the four whitespace characters");
+        }
+
+        return; // Status.passed("OK");
+
+    }
+
+    /**
+     * Equivalence class partitioning with state and input values orientation
+     * for public void setParameter(String name, Object value) throws
+     * DOMException, <br>
+     * <b>pre-conditions</b>: the document root element has a text node with
+     * four white space characters, <br>
+     * <b>name</b>: element-content-whitespace <br>
+     * <b>value</b>: false. <br>
+     * <b>Expected results</b>: the text node is discarded
+     */
+    @Test
+    public void testECWhitespace002() {
+        Document doc = null;
+        try {
+            doc = loadDocument(null, test3_xml);
+        } catch (Exception e) {
+            Assert.fail(e.getMessage());
+        }
+
+        Element root = doc.getDocumentElement();
+        Text text = doc.createTextNode("\t\n\r ");
+        root.appendChild(text);
+
+        DOMConfiguration config = doc.getDomConfig();
+        if (!config.canSetParameter("element-content-whitespace", Boolean.FALSE)) {
+            System.out.println("OK, setting 'element-content-whitespace' to false is not supported");
+            return;
+        }
+        config.setParameter("element-content-whitespace", Boolean.FALSE);
+
+        if (!config.canSetParameter("validate", Boolean.TRUE)) {
+            System.out.println("OK, setting 'validate' to true is not supported");
+            return;
+        }
+        config.setParameter("validate", Boolean.TRUE);
+
+        setHandler(doc);
+        doc.normalizeDocument();
+
+        Node firstChild = root.getFirstChild();
+        if (firstChild != null) {
+            Assert.fail("the first child is " + firstChild + ", but no child is expected");
+        }
+
+        return; // Status.passed("OK");
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/DOMConfigurationTest.xsd b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/DOMConfigurationTest.xsd
new file mode 100644
index 00000000000..0a290b98438
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/DOMConfigurationTest.xsd
@@ -0,0 +1,6 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            targetNamespace="test">
+    <xsd:element name="root" type="xsd:int"/>
+</xsd:schema>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/TCKEncodingTest.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/TCKEncodingTest.java
new file mode 100644
index 00000000000..a5148fb563b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/TCKEncodingTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test Document.getInputEncoding().
+ */
+public class TCKEncodingTest {
+
+    /**
+     * Assertion testing
+     * for public String getInputEncoding(),
+     * An attribute specifying the actual encoding of this document..
+     */
+    @Test
+    public void testGetInputEncoding001() {
+        String data = "<?xml version=\"1.0\"?>" + "<!DOCTYPE root [" + "<!ELEMENT root ANY>" + "]>" + "<root/>";
+
+        Document doc = null;
+        try {
+            DocumentBuilder docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+            InputSource inSource = new InputSource(new StringReader(data));
+            inSource.setEncoding("UTF-8");
+            inSource.setSystemId("test.xml");
+            doc = docBuilder.parse(inSource);
+        } catch (ParserConfigurationException e) {
+            Assert.fail(e.toString());
+        } catch (IOException e) {
+            Assert.fail(e.toString());
+        } catch (SAXException e) {
+            Assert.fail(e.toString());
+        }
+
+        String encoding = doc.getInputEncoding();
+        if (encoding == null || !encoding.equals("UTF-8")) {
+            Assert.fail("expected encoding: UTF-8, returned: " + encoding);
+        }
+
+        System.out.println("OK");
+    }
+
+    /**
+     * Assertion testing
+     * for public String getInputEncoding(),
+     * Encoding is not specified. getInputEncoding returns null..
+     */
+    @Test
+    public void testGetInputEncoding002() {
+        Document doc = null;
+        try {
+            DocumentBuilder db = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+            doc = db.newDocument();
+        } catch (ParserConfigurationException e) {
+            Assert.fail(e.toString());
+        }
+
+        String encoding = doc.getInputEncoding();
+        if (encoding != null) {
+            Assert.fail("expected encoding: null, returned: " + encoding);
+        }
+
+        System.out.println("OK");
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug4973153.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug4973153.java
new file mode 100644
index 00000000000..6b9b44ccaac
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug4973153.java
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom.ls;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.StringBufferInputStream;
+import java.io.Writer;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import org.w3c.dom.DOMError;
+import org.w3c.dom.DOMErrorHandler;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSOutput;
+import org.w3c.dom.ls.LSParser;
+import org.w3c.dom.ls.LSSerializer;
+import org.xml.sax.SAXException;
+
+/*
+ * @bug 4973153
+ * @summary Test LSSerialiser.setEncoding() raises 'unsupported-encoding' error if encoding is invalid.
+ */
+public class Bug4973153 {
+
+    DOMImplementationLS implLS = null;
+    public String xml1 = "<?xml version=\"1.0\"?><ROOT><ELEMENT1></ELEMENT1><ELEMENT2></ELEMENT2></ROOT>";
+
+    @Test
+    public void testOne() {
+        LSParser db = createLSParser();
+        if (db == null) {
+            System.out.println("Unable to create LSParser !");
+            return;
+        }
+        LSSerializer dw = createLSSerializer();
+        if (dw == null) {
+            System.out.println("Unable to create LSSerializer!");
+            return;
+        }
+
+        DOMErrorHandlerImpl eh = new DOMErrorHandlerImpl();
+        dw.getDomConfig().setParameter("error-handler", eh);
+        Document doc = db.parse(getXml1Source());
+
+        Output out = new Output();
+        out.setByteStream(new ByteArrayOutputStream());
+        out.setEncoding("WrOnG_EnCoDiNg");
+        try {
+            if (dw.write(doc, out)) {
+                System.out.println("Expected result value - false");
+                return;
+            }
+        } catch (Exception ex) {
+            // This is bad.
+        }
+        if (!eh.WrongEncodingErrorReceived) {
+            Assert.fail("'unsupported-encoding' error was expected ");
+            return;
+        }
+        System.out.println("OKAY");
+        return;
+    }
+
+    @BeforeMethod
+    protected void setUp() {
+        Document doc = null;
+        DocumentBuilder parser = null;
+        try {
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            parser = factory.newDocumentBuilder();
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+        }
+        StringBufferInputStream is = new StringBufferInputStream(xml1);
+        try {
+            doc = parser.parse(is);
+        } catch (SAXException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        DOMImplementation impl = doc.getImplementation();
+        implLS = (DOMImplementationLS) impl.getFeature("LS", "3.0");
+    }
+
+    @AfterMethod
+    protected void tearDown() {
+        implLS = null;
+    }
+
+    public LSParser createLSParser() {
+        return implLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, "http://www.w3.org/2001/XMLSchema");
+    }
+
+    public LSSerializer createLSSerializer() {
+        return implLS.createLSSerializer();
+    }
+
+    public LSInput createLSInput() {
+        return implLS.createLSInput();
+    }
+
+    public LSInput getXml1Source() {
+        LSInput src = createLSInput();
+        src.setStringData(xml1);
+        return src;
+    }
+}
+
+class Output implements LSOutput {
+    OutputStream bs;
+    Writer cs;
+    String sId;
+    String enc;
+
+    public Output() {
+        bs = null;
+        cs = null;
+        sId = null;
+        enc = "UTF-8";
+    }
+
+    public OutputStream getByteStream() {
+        return bs;
+    }
+
+    public void setByteStream(OutputStream byteStream) {
+        bs = byteStream;
+    }
+
+    public Writer getCharacterStream() {
+        return cs;
+    }
+
+    public void setCharacterStream(Writer characterStream) {
+        cs = characterStream;
+    }
+
+    public String getSystemId() {
+        return sId;
+    }
+
+    public void setSystemId(String systemId) {
+        sId = systemId;
+    }
+
+    public String getEncoding() {
+        return enc;
+    }
+
+    public void setEncoding(String encoding) {
+        enc = encoding;
+    }
+}
+
+class DOMErrorHandlerImpl implements DOMErrorHandler {
+    boolean NoOutputSpecifiedErrorReceived = false;
+    boolean WrongEncodingErrorReceived = false;
+
+    public boolean handleError(DOMError error) {
+        if ("no-output-specified".equalsIgnoreCase(error.getType())) {
+            NoOutputSpecifiedErrorReceived = true;
+        } else if ("unsupported-encoding".equalsIgnoreCase(error.getType())) {
+            WrongEncodingErrorReceived = true;
+        }
+        return true;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6290947.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6290947.java
new file mode 100644
index 00000000000..065dfcbe491
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6290947.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom.ls;
+
+import java.io.StringBufferInputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSParser;
+import org.w3c.dom.ls.LSSerializer;
+import org.w3c.dom.ls.LSSerializerFilter;
+import org.w3c.dom.traversal.NodeFilter;
+
+/*
+ * @bug 6290947
+ * @summary Test LSSerializer writes the XML declaration when LSSerializerFilter is set that rejects all nodes and
+ * LSSerializer's configuration set parameter "xml-declaration" to "true".
+ */
+public class Bug6290947 {
+
+    private static String XML_STRING = "<?xml version=\"1.0\"?><ROOT><ELEMENT1><CHILD1/><CHILD1><COC1/></CHILD1></ELEMENT1><ELEMENT2>test1<CHILD2/></ELEMENT2></ROOT>";
+    private static DOMImplementationLS implLS;
+    private final String XML_FILE_INTERNAL_DTD = "note_in_dtd.xml";
+
+    @Test
+    public void testStringSourceWithXmlDecl() {
+        String result = prepare(XML_STRING, true);
+        System.out.println("testStringSource: output: " + result);
+        Assert.assertTrue(result.indexOf("<?xml")>-1, "XML Declaration expected in output");
+    }
+
+    @Test
+    public void testStringSourceWithOutXmlDecl() {
+        String result = prepare(XML_STRING, false);
+        System.out.println("testStringSource: output: " + result);
+        Assert.assertTrue(result.indexOf("<?xml")==-1, "XML Declaration is not expected in output");
+    }
+
+    @Test
+    public void testXmlWithInternalDTD1() {
+        String result = prepare(XML_FILE_INTERNAL_DTD, true);
+        System.out.println("testStringSource: output: " + result);
+        Assert.assertTrue(result.indexOf("<!DOCTYPE")>0, "XML Declaration and DTD are expected in output");
+    }
+
+    @Test
+    public void testXmlWithInternalDTD2() {
+        String result = prepare(XML_FILE_INTERNAL_DTD, false);
+        System.out.println("testStringSource: output: " + result);
+        Assert.assertTrue(result.indexOf("<!DOCTYPE")>-1, "DTD is expected in output");
+    }
+
+    private String prepare(String source, boolean xmlDeclFlag) {
+        Document startDoc = null;
+        DocumentBuilder domParser = null;
+        try {
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            domParser = factory.newDocumentBuilder();
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+
+        final StringBufferInputStream is = new StringBufferInputStream(XML_STRING);
+        try {
+            startDoc = domParser.parse(is);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+
+        DOMImplementation impl = startDoc.getImplementation();
+        implLS = (DOMImplementationLS) impl.getFeature("LS", "3.0");
+        LSParser parser = implLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, "http://www.w3.org/2001/XMLSchema");
+
+        LSInput src = getXmlSource(source);
+
+        LSSerializer writer = implLS.createLSSerializer();
+
+        DOMConfiguration conf = writer.getDomConfig();
+        conf.setParameter("xml-declaration", Boolean.valueOf(xmlDeclFlag));
+
+        // set filter
+        writer.setFilter(new LSSerializerFilter() {
+            public short acceptNode(Node enode) {
+                return FILTER_REJECT;
+
+            }
+
+            public int getWhatToShow() {
+                return NodeFilter.SHOW_ELEMENT;
+            }
+        });
+
+        Document doc = parser.parse(src);
+        return writer.writeToString(doc);
+    }
+
+    private LSInput getXmlSource(String xml1) {
+        LSInput src = implLS.createLSInput();
+        try {
+            if (xml1.endsWith(".xml"))
+                src.setByteStream(this.getClass().getResourceAsStream(XML_FILE_INTERNAL_DTD));
+            else
+                src.setStringData(xml1);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+        return src;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6354955.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6354955.java
new file mode 100644
index 00000000000..d184cf8e6f2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6354955.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom.ls;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.CDATASection;
+import org.w3c.dom.Comment;
+import org.w3c.dom.Document;
+import org.w3c.dom.EntityReference;
+import org.w3c.dom.Node;
+import org.w3c.dom.ProcessingInstruction;
+import org.w3c.dom.Text;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSSerializer;
+
+
+/*
+ * @bug 6354955
+ * @summary Test LSSerializer can writeToString on DOM Text node with white space.
+ */
+public class Bug6354955 {
+
+    @Test
+    public void testTextNode() {
+        try {
+            Document xmlDocument = createNewDocument();
+
+            String whitespace = "\r\n    ";
+            Text textNode = xmlDocument.createTextNode(whitespace);
+
+            System.out.println("original text is:\r\n\"" + whitespace + "\"");
+            String outerXML = getOuterXML(textNode);
+            System.out.println("OuterXML Text Node is:\r\n\"" + outerXML + "\"");
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testCommentNode() {
+        try {
+            Document xmlDocument = createNewDocument();
+            String commentStr = "This is a comment node";
+            Comment cmtNode = xmlDocument.createComment(commentStr);
+            String outerXML = getOuterXML(cmtNode);
+            System.out.println("OuterXML of Comment Node is:" + outerXML);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testPINode() {
+        try {
+            Document xmlDocument = createNewDocument();
+            ProcessingInstruction piNode = xmlDocument.createProcessingInstruction("execute", "test");
+            String outerXML = getOuterXML(piNode);
+            System.out.println("OuterXML of Comment Node is:" + outerXML);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testCDATA() {
+        try {
+            Document xmlDocument = createNewDocument();
+            CDATASection cdataNode = xmlDocument.createCDATASection("See Data!!");
+            String outerXML = getOuterXML(cdataNode);
+            System.out.println("OuterXML of Comment Node is:" + outerXML);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    @Test
+    public void testEntityReference() {
+        try {
+            Document xmlDocument = createNewDocument();
+            EntityReference erefNode = xmlDocument.createEntityReference("entityref");
+            String outerXML = getOuterXML(erefNode);
+            System.out.println("OuterXML of Comment Node is:" + outerXML);
+
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+    }
+
+    private String getOuterXML(Node node) {
+        DOMImplementationLS domImplementation = (DOMImplementationLS) node.getOwnerDocument().getImplementation();
+        LSSerializer lsSerializer = domImplementation.createLSSerializer();
+        if (!(node instanceof Document)) {
+            lsSerializer.getDomConfig().setParameter("xml-declaration", false);
+        }
+        return lsSerializer.writeToString(node);
+    }
+
+    private Document createNewDocument() throws Exception {
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        documentBuilderFactory.setNamespaceAware(true);
+        DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
+        return documentBuilder.newDocument();
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6376823.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6376823.java
new file mode 100644
index 00000000000..f3ba84e2e0e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6376823.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom.ls;
+
+import java.io.StringBufferInputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+import org.w3c.dom.ls.DOMImplementationLS;
+import org.w3c.dom.ls.LSInput;
+import org.w3c.dom.ls.LSParser;
+import org.w3c.dom.ls.LSSerializer;
+import org.w3c.dom.ls.LSSerializerFilter;
+import org.w3c.dom.traversal.NodeFilter;
+
+/*
+ * @bug 6376823
+ * @summary Test LSSerializer works.
+ */
+public class Bug6376823 {
+
+    private static String XML_STRING = "<?xml version=\"1.0\"?><ROOT><ELEMENT1><CHILD1/><CHILD1><COC1/></CHILD1></ELEMENT1><ELEMENT2>test1<CHILD2/></ELEMENT2></ROOT>";
+    private static DOMImplementationLS implLS;
+
+    @Test
+    public void testStringSourceWithXmlDecl() {
+        String result = prepare(XML_STRING, true);
+        System.out.println("testStringSource: output: " + result);
+        Assert.assertTrue(result.indexOf("<?xml", 5) < 0, "XML Declaration expected in output");
+    }
+
+    private String prepare(String source, boolean xmlDeclFlag) {
+        Document startDoc = null;
+        DocumentBuilder domParser = null;
+        try {
+            DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+            domParser = factory.newDocumentBuilder();
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+
+        final StringBufferInputStream is = new StringBufferInputStream(XML_STRING);
+        try {
+            startDoc = domParser.parse(is);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+
+        DOMImplementation impl = startDoc.getImplementation();
+        implLS = (DOMImplementationLS) impl.getFeature("LS", "3.0");
+        LSParser parser = implLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, "http://www.w3.org/2001/XMLSchema");
+
+        LSInput src = getXmlSource(source);
+
+        LSSerializer writer = implLS.createLSSerializer();
+
+        DOMConfiguration conf = writer.getDomConfig();
+        conf.setParameter("xml-declaration", Boolean.valueOf(xmlDeclFlag));
+
+        // set filter
+        writer.setFilter(new LSSerializerFilter() {
+            public short acceptNode(Node enode) {
+                return FILTER_ACCEPT;
+
+            }
+
+            public int getWhatToShow() {
+                return NodeFilter.SHOW_ALL;
+            }
+        });
+
+        Document doc = parser.parse(src);
+        return writer.writeToString(doc);
+    }
+
+    private LSInput getXmlSource(String xml1) {
+        LSInput src = implLS.createLSInput();
+        try {
+            src.setStringData(xml1);
+        } catch (Exception e) {
+            e.printStackTrace();
+            Assert.fail("Exception occured: " + e.getMessage());
+        }
+        return src;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6710741Test.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6710741Test.java
new file mode 100644
index 00000000000..3f70fb7b6bb
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/Bug6710741Test.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom.ls;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+/*
+ * @bug 6710741
+ * @summary Test there should be stack trace information if LSSerializer().writeToString reports an exception.
+ */
+public class Bug6710741Test {
+
+    @Test
+    public final void test() {
+        try {
+            Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+            Element el = doc.createElement("x");
+            DOMImplementationLS ls = (DOMImplementationLS) doc.getImplementation().getFeature("LS", "3.0");
+            System.out.println(ls.createLSSerializer().writeToString(el));
+        } catch (ParserConfigurationException ex) {
+            ex.printStackTrace();
+            Assert.fail(ex.getMessage());
+        } catch (LSException ex) {
+            ex.printStackTrace();
+            System.out.println("cause: " + ex.getCause());
+            if (ex.getCause() == null) {
+                Assert.fail("should set cause.");
+            }
+        }
+    }
+
+    @Test
+    public void testWorkaround() {
+        Document doc;
+        try {
+            doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
+            Element el = doc.createElement("x");
+            doc.appendChild(el);
+            DOMImplementationLS ls = (DOMImplementationLS) doc.getImplementation().getFeature("LS", "3.0");
+            System.out.println(ls.createLSSerializer().writeToString(doc));
+        } catch (ParserConfigurationException ex) {
+            ex.printStackTrace();
+            Assert.fail(ex.getMessage());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSParserTCKTest.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSParserTCKTest.java
new file mode 100644
index 00000000000..69e27e1bb96
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSParserTCKTest.java
@@ -0,0 +1,576 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom.ls;
+
+import java.io.IOException;
+import java.io.StringBufferInputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.Attr;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.w3c.dom.traversal.NodeFilter;
+import org.xml.sax.SAXException;
+
+/*
+ * @summary Test Specifications and Descriptions for LSParser.
+ */
+public class LSParserTCKTest {
+
+    DOMImplementationLS implLS = null;
+    public String xml1 = "<?xml version=\"1.0\"?><ROOT><ELEMENT1><CHILD1/><CHILD1><COC1/></CHILD1></ELEMENT1><ELEMENT2>test1<CHILD2/></ELEMENT2></ROOT>";
+
+    /**
+     * Equivalence class partitioning
+     * with state, input and output values orientation
+     * for public Document parse(LSInput is),
+     * <br><b>pre-conditions</b>: set filter that REJECTs any CHILD* node,
+     * <br><b>is</b>: xml1
+     * <br><b>output</b>: XML document with ELEMNENT1 and ELEMENT2 only.
+     */
+    @Test
+    public void testfilter0001() {
+        LSParser parser = createLSParser();
+        if (parser == null) {
+            Assert.fail("Unable to create LSParser!");
+        }
+        // set filter
+        parser.setFilter(new LSParserFilter() {
+            public short startElement(Element elt) {
+                return FILTER_ACCEPT;
+            }
+
+            public short acceptNode(Node enode) {
+                if (enode.getNodeName().startsWith("CHILD")) {
+                    return FILTER_REJECT;
+                }
+                return FILTER_ACCEPT;
+            }
+
+            public int getWhatToShow() {
+                return NodeFilter.SHOW_ALL;
+            }
+        });
+        String expected = "<?xml version=\"1.0\"?><ROOT><ELEMENT1></ELEMENT1><ELEMENT2>test1</ELEMENT2></ROOT>";
+        Document doc = parser.parse(getXmlSource(xml1));
+        if (!match(expected, doc)) {
+            Assert.fail("DOM structure after parsing is not equal to a structure of XML document, that being parsed");
+        }
+
+        System.out.println("OKAY");
+    }
+
+    public LSParserTCKTest(String name) {
+        init();
+    }
+
+    protected void init() {
+        Document doc = null;
+        DocumentBuilder parser = null;
+        try {
+            parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+        }
+        StringBufferInputStream is = new StringBufferInputStream(xml1);
+        try {
+            doc = parser.parse(is);
+        } catch (SAXException e) {
+            e.printStackTrace();
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        DOMImplementation impl = doc.getImplementation();
+        implLS = (DOMImplementationLS) impl.getFeature("LS", "3.0");
+    }
+
+    public LSInput getXmlSource(String xmldoc) {
+        LSInput srcdoc = createLSInput();
+        srcdoc.setStringData(xmldoc);
+        return srcdoc;
+    }
+
+    public LSInput createLSInput() {
+        return implLS.createLSInput();
+    }
+
+    public LSParser createLSParser() {
+        return implLS.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, "http://www.w3.org/2001/XMLSchema");
+    }
+
+    public boolean match(String template, Node source) {
+        LSParser dp = createLSParser();
+        if (dp == null) {
+            System.out.println("Can not create LSParser.");
+            return false;
+        }
+        LSInput src = getXmlSource(template);
+        Document doc = dp.parse(src);
+        return checkXMLs(doc, source);
+    }
+
+    // ========================== XML comparison code ==============
+    public boolean checkXMLs(Node template, Node source) {
+        if (source == null || template == null) {
+            return template == source;
+        }
+        String tname = template.getLocalName();
+        String tvalue = template.getNodeValue();
+        NamedNodeMap tattr = template.getAttributes();
+        NodeList tchildren = template.getChildNodes();
+
+        String sname = source.getLocalName();
+        String svalue = source.getNodeValue();
+        NamedNodeMap sattr = source.getAttributes();
+        NodeList schildren = source.getChildNodes();
+        if (tname != null && !tname.equals(sname)) {
+            return false;
+        }
+        if (tvalue != null && !tvalue.equals(svalue)) {
+            return false;
+        }
+        if (tattr != null && sattr != null) {
+            if (sattr.getLength() != tattr.getLength()) {
+                return false;
+            }
+            for (int i = 0; i < tattr.getLength(); i++) {
+                Attr t = (Attr) tattr.item(i);
+                Attr s = (Attr) sattr.getNamedItem(t.getName());
+                if (!checkXMLAttrs(t, s)) {
+                    // ref.println(sname+": [expected attr: " + t +
+                    // "; actual attr: " +s+"]");
+                    return false;
+                }
+            }
+        } else if (tattr != null || sattr != null) {
+            return false;
+        }
+
+        for (int i = 0; i < tchildren.getLength(); i++) {
+            if (!checkXMLs(tchildren.item(i), schildren.item(i))) {
+                // ref.println(sname+": [expected node: "+tchildren.item(i)
+                // +"; actual node: "+schildren.item(i)+"]");
+                return false;
+            }
+        }
+        return true;
+    }
+
+    public boolean checkXMLAttrs(Attr template, Attr source) {
+        if (source == null || template == null) {
+            return template == source;
+        }
+        String tname = template.getName();
+        String tvalue = template.getValue();
+        String sname = source.getName();
+        String svalue = source.getValue();
+        System.out.println("Attr:" + tname + "?" + sname);
+        if (tname != null && !tname.equals(sname)) {
+            // ref.println("Attr Name:" + tname + "!=" + sname);
+            return false;
+        }
+        if (tvalue != null && !tvalue.equals(svalue)) {
+            // ref.println("Attr value:" + tvalue + "!=" + svalue);
+            return false;
+        }
+        // ref.println("Attr:" + tname + ":" + tvalue + "=" + sname + ":" +
+        // svalue);
+        return true;
+    }
+
+    /**
+     * Equivalence class partitioning with state, input and output values
+     * orientation for public Document parse(LSInput is), <br>
+     * <b>pre-conditions</b>: set filter that SKIPs ELEMENT1 node, <br>
+     * <b>is</b>: xml1 <br>
+     * <b>output</b>: XML document with CHILD1 and ELEMENT2 only.
+     */
+    @Test
+    public void testFilter0002() {
+        LSParser parser = createLSParser();
+        if (parser == null) {
+            Assert.fail("Unable to create LSParser!");
+        }
+        // set filter
+        parser.setFilter(new LSParserFilter() {
+            public short startElement(Element elt) {
+                return FILTER_ACCEPT;
+            }
+
+            public short acceptNode(Node enode) {
+                if (enode.getNodeName().startsWith("ELEMENT1")) {
+                    return FILTER_SKIP;
+                }
+                return FILTER_ACCEPT;
+            }
+
+            public int getWhatToShow() {
+                return NodeFilter.SHOW_ALL;
+            }
+        });
+        String expected = "<?xml version=\"1.0\"?><ROOT><CHILD1/><CHILD1><COC1/></CHILD1><ELEMENT2>test1<CHILD2/></ELEMENT2></ROOT>";
+        Document doc = parser.parse(getXmlSource(xml1));
+        if (!match(expected, doc)) {
+            Assert.fail("DOM structure after parsing is not equal to a structure of XML document, that being parsed");
+        }
+        System.out.println("OKAY");
+    }
+
+    /**
+     * Equivalence class partitioning with state, input and output values
+     * orientation for public Document parse(LSInput is), <br>
+     * <b>pre-conditions</b>: set filter that SKIPs ELEMENT1 node, <br>
+     * <b>is</b>: xml1 <br>
+     * <b>output</b>: XML document with ELEMENT1 only.
+     */
+    @Test
+    public void testFilter0003() {
+        LSParser parser = createLSParser();
+        if (parser == null) {
+            Assert.fail("Unable to create LSParser!");
+        }
+        // set filter
+        parser.setFilter(new LSParserFilter() {
+            public short startElement(Element elt) {
+                return FILTER_ACCEPT;
+            }
+
+            public short acceptNode(Node enode) {
+                if (enode.getNodeName().startsWith("ELEMENT2")) {
+                    return FILTER_INTERRUPT;
+                }
+                return FILTER_ACCEPT;
+            }
+
+            public int getWhatToShow() {
+                return NodeFilter.SHOW_ALL;
+            }
+        });
+        String expected = "<ROOT><ELEMENT1><CHILD1/><CHILD1><COC1/></CHILD1></ELEMENT1></ROOT>";
+        Document doc = parser.parse(getXmlSource(xml1));
+        if (!match(expected, doc)) {
+            Assert.fail("DOM structure after parsing is not equal to a structure of XML document, that being parsed");
+        }
+        System.out.println("OKAY");
+    }
+
+    /**
+     * Equivalence class partitioning with state, input and output values
+     * orientation for public Document parse(LSInput is), <br>
+     * <b>pre-conditions</b>: set filter that accepts all, <br>
+     * <b>is</b>: xml1 <br>
+     * <b>output</b>: full XML document.
+     */
+    @Test
+    public void testFilter0004() {
+        LSParser parser = createLSParser();
+        if (parser == null) {
+            Assert.fail("Unable to create LSParser!");
+        }
+        // set filter
+        parser.setFilter(new LSParserFilter() {
+            public short startElement(Element elt) {
+                return FILTER_ACCEPT;
+            }
+
+            public short acceptNode(Node enode) {
+                return FILTER_ACCEPT;
+            }
+
+            public int getWhatToShow() {
+                return NodeFilter.SHOW_ALL;
+            }
+        });
+        String expected = "<ROOT><ELEMENT1><CHILD1/><CHILD1><COC1/></CHILD1></ELEMENT1><ELEMENT2>test1<CHILD2/></ELEMENT2></ROOT>";
+        Document doc = parser.parse(getXmlSource(xml1));
+        if (!match(expected, doc)) {
+            Assert.fail("DOM structure after parsing is not equal to a structure of XML document, that being parsed");
+        }
+        System.out.println("OKAY");
+    }
+
+    /**
+     * Equivalence class partitioning with state, input and output values
+     * orientation for public Document parse(LSInput is), <br>
+     * <b>pre-conditions</b>: set filter that REJECTs all, <br>
+     * <b>is</b>: xml1 <br>
+     * <b>output</b>: empty XML document.
+     */
+    @Test
+    public void testFilter0005() {
+        LSParser parser = createLSParser();
+        if (parser == null) {
+            Assert.fail("Unable to create LSParser!");
+        }
+        // set filter
+        parser.setFilter(new LSParserFilter() {
+            public short startElement(Element elt) {
+                return FILTER_ACCEPT;
+            }
+
+            public short acceptNode(Node enode) {
+                return FILTER_REJECT;
+            }
+
+            public int getWhatToShow() {
+                return NodeFilter.SHOW_ALL;
+            }
+        });
+        Document doc = parser.parse(getXmlSource(xml1));
+        NodeList children = doc.getDocumentElement().getChildNodes();
+        if (children.getLength() != 0) {
+            Assert.fail("Not all children skipped");
+        }
+        System.out.println("OKAY");
+    }
+
+    /**
+     * Equivalence class partitioning with state, input and output values
+     * orientation for public Document parse(LSInput is), <br>
+     * <b>pre-conditions</b>: set filter that SKIPs all, <br>
+     * <b>is</b>: xml1 <br>
+     * <b>output</b>: empty XML document.
+     */
+    @Test
+    public void testFilter0006() {
+        LSParser parser = createLSParser();
+        if (parser == null) {
+            Assert.fail("Unable to create LSParser!");
+        }
+        // set filter
+        parser.setFilter(new LSParserFilter() {
+            public short startElement(Element elt) {
+                return FILTER_ACCEPT;
+            }
+
+            public short acceptNode(Node enode) {
+                return FILTER_SKIP;
+            }
+
+            public int getWhatToShow() {
+                return NodeFilter.SHOW_ALL;
+            }
+        });
+        Document doc = parser.parse(getXmlSource(xml1));
+        NodeList children = doc.getDocumentElement().getChildNodes();
+        if (children.getLength() != 0) {
+            Assert.fail("Not all children skipped");
+        }
+        System.out.println("OKAY");
+    }
+
+    /**
+     * Equivalence class partitioning with state, input and output values
+     * orientation for public Document parse(LSInput is), <br>
+     * <b>pre-conditions</b>: set filter that REJECTs any CHILD* start element, <br>
+     * <b>is</b>: xml1 <br>
+     * <b>output</b>: XML document with ELEMENT1 and ELEMENT2 only.
+     */
+    @Test
+    public void testFilter0007() {
+        LSParser parser = createLSParser();
+        if (parser == null) {
+            Assert.fail("Unable to create LSParser!");
+        }
+        // set filter
+        parser.setFilter(new LSParserFilter() {
+            public short startElement(Element elt) {
+                if (elt.getTagName().startsWith("CHILD")) {
+                    return FILTER_REJECT;
+                }
+                return FILTER_ACCEPT;
+            }
+
+            public short acceptNode(Node enode) {
+                return FILTER_ACCEPT;
+            }
+
+            public int getWhatToShow() {
+                return NodeFilter.SHOW_ALL;
+            }
+        });
+        String expected = "<?xml version=\"1.0\"?><ROOT><ELEMENT1></ELEMENT1><ELEMENT2>test1</ELEMENT2></ROOT>";
+        Document doc = parser.parse(getXmlSource(xml1));
+        if (!match(expected, doc)) {
+            Assert.fail("DOM structure after parsing is not equal to a structure of XML document, that being parsed");
+        }
+        System.out.println("OKAY");
+    }
+
+    /**
+     * Equivalence class partitioning with state, input and output values
+     * orientation for public Document parse(LSInput is), <br>
+     * <b>pre-conditions</b>: set filter that SKIPs ELEMENT1 start element, <br>
+     * <b>is</b>: xml1 <br>
+     * <b>output</b>: XML document with CHILD1 and ELEMENT2 only.
+     */
+    @Test
+    public void testFilter0008() {
+        LSParser parser = createLSParser();
+        if (parser == null) {
+            Assert.fail("Unable to create LSParser!");
+        }
+        // set filter
+        parser.setFilter(new LSParserFilter() {
+            public short startElement(Element elt) {
+                if (elt.getTagName().equals("ELEMENT1")) {
+                    return FILTER_SKIP;
+                }
+                return FILTER_ACCEPT;
+            }
+
+            public short acceptNode(Node enode) {
+                return FILTER_ACCEPT;
+            }
+
+            public int getWhatToShow() {
+                return NodeFilter.SHOW_ALL;
+            }
+        });
+        String expected = "<?xml version=\"1.0\"?><ROOT><CHILD1/><CHILD1><COC1/></CHILD1><ELEMENT2>test1<CHILD2/></ELEMENT2></ROOT>";
+        Document doc = parser.parse(getXmlSource(xml1));
+        if (!match(expected, doc)) {
+            Assert.fail("DOM structure after parsing is not equal to a structure of XML document, that being parsed");
+        }
+        System.out.println("OKAY");
+    }
+
+    /**
+     * Equivalence class partitioning with state, input and output values
+     * orientation for public Document parse(LSInput is), <br>
+     * <b>pre-conditions</b>: set filter that SKIPs ELEMENT1 start element, <br>
+     * <b>is</b>: xml1 <br>
+     * <b>output</b>: XML document with ELEMENT1 only.
+     */
+    @Test
+    public void testFilter0009() {
+        LSParser parser = createLSParser();
+        if (parser == null) {
+            Assert.fail("Unable to create LSParser!");
+        }
+        // set filter
+        parser.setFilter(new LSParserFilter() {
+            public short startElement(Element elt) {
+                if (elt.getTagName().startsWith("ELEMENT2")) {
+                    return FILTER_INTERRUPT;
+                }
+                return FILTER_ACCEPT;
+            }
+
+            public short acceptNode(Node enode) {
+                return FILTER_ACCEPT;
+            }
+
+            public int getWhatToShow() {
+                return NodeFilter.SHOW_ALL;
+            }
+        });
+        String expected = "<ROOT><ELEMENT1><CHILD1/><CHILD1><COC1/></CHILD1></ELEMENT1></ROOT>";
+        Document doc = parser.parse(getXmlSource(xml1));
+        if (!match(expected, doc)) {
+            Assert.fail("DOM structure after parsing is not equal to a structure of XML document, that being parsed");
+        }
+        System.out.println("OKAY");
+    }
+
+    /**
+     * Equivalence class partitioning with state, input and output values
+     * orientation for public Document parse(LSInput is), <br>
+     * <b>pre-conditions</b>: set filter that REJECTs all start element, <br>
+     * <b>is</b>: xml1 <br>
+     * <b>output</b>: empty XML document.
+     */
+    @Test
+    public void testFilter0010() {
+        LSParser parser = createLSParser();
+        if (parser == null) {
+            Assert.fail("Unable to create LSParser");
+        }
+        // set filter
+        parser.setFilter(new LSParserFilter() {
+            public short startElement(Element elt) {
+                return FILTER_REJECT;
+            }
+
+            public short acceptNode(Node enode) {
+                return FILTER_ACCEPT;
+            }
+
+            public int getWhatToShow() {
+                return NodeFilter.SHOW_ALL;
+            }
+        });
+        Document doc = parser.parse(getXmlSource(xml1));
+        NodeList children = doc.getDocumentElement().getChildNodes();
+        if (children.getLength() != 0) {
+            Assert.fail("Not all children skipped");
+        }
+        System.out.println("OKAY");
+    }
+
+    /**
+     * Equivalence class partitioning with state, input and output values
+     * orientation for public Document parse(LSInput is), <br>
+     * <b>pre-conditions</b>: set filter that SKIPs all, <br>
+     * <b>is</b>: xml1 <br>
+     * <b>output</b>: empty XML document.
+     */
+    @Test
+    public void testFilter0011() {
+        LSParser parser = createLSParser();
+        if (parser == null) {
+            Assert.fail("Unable to create LSParser");
+        }
+        // set filter
+        parser.setFilter(new LSParserFilter() {
+            public short startElement(Element elt) {
+                return FILTER_SKIP;
+            }
+
+            public short acceptNode(Node enode) {
+                return FILTER_ACCEPT;
+            }
+
+            public int getWhatToShow() {
+                return NodeFilter.SHOW_ALL;
+            }
+        });
+        Document doc = parser.parse(getXmlSource(xml1));
+        NodeList children = doc.getDocumentElement().getChildNodes();
+        if (children.getLength() != 1) {
+            Assert.fail("Not all Element nodes skipped");
+        }
+        System.out.println("OKAY");
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSParserTest.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSParserTest.java
new file mode 100644
index 00000000000..3d0c199ea3f
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSParserTest.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom.ls;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMError;
+import org.w3c.dom.DOMErrorHandler;
+import org.w3c.dom.DOMException;
+import org.w3c.dom.DOMImplementation;
+
+/*
+ * @summary Test LSParser's DOMConfiguration for supported properties.
+ */
+public class LSParserTest {
+
+    @Test
+    public void testDOMConfiguration() {
+
+        final DOMErrorHandler handler = new DOMErrorHandler() {
+            public boolean handleError(final DOMError error) {
+                return false;
+            }
+        };
+
+        final LSResourceResolver resolver = new LSResourceResolver() {
+            public LSInput resolveResource(final String type, final String namespaceURI, final String publicId, final String systemId, final String baseURI) {
+                return null;
+            }
+        };
+
+        final Object[][] values = {
+                // parameter, value
+                { "canonical-form", Boolean.FALSE }, { "cdata-sections", Boolean.FALSE }, { "cdata-sections", Boolean.TRUE },
+                { "check-character-normalization", Boolean.FALSE }, { "comments", Boolean.FALSE }, { "comments", Boolean.TRUE },
+                { "datatype-normalization", Boolean.FALSE }, { "entities", Boolean.FALSE }, { "entities", Boolean.TRUE }, { "error-handler", handler },
+                { "infoset", Boolean.TRUE }, { "namespaces", Boolean.TRUE }, { "namespace-declarations", Boolean.TRUE },
+                { "namespace-declarations", Boolean.FALSE }, { "normalize-characters", Boolean.FALSE }, { "split-cdata-sections", Boolean.TRUE },
+                { "split-cdata-sections", Boolean.FALSE }, { "validate", Boolean.FALSE }, { "validate-if-schema", Boolean.FALSE },
+                { "well-formed", Boolean.TRUE }, { "element-content-whitespace", Boolean.TRUE },
+
+                { "charset-overrides-xml-encoding", Boolean.TRUE }, { "charset-overrides-xml-encoding", Boolean.FALSE }, { "disallow-doctype", Boolean.FALSE },
+                { "ignore-unknown-character-denormalizations", Boolean.TRUE }, { "resource-resolver", resolver }, { "resource-resolver", null },
+                { "supported-media-types-only", Boolean.FALSE }, };
+
+        DOMImplementation domImpl = null;
+        try {
+            domImpl = DocumentBuilderFactory.newInstance().newDocumentBuilder().getDOMImplementation();
+        } catch (ParserConfigurationException parserConfigurationException) {
+            parserConfigurationException.printStackTrace();
+            Assert.fail(parserConfigurationException.toString());
+        }
+
+        DOMImplementationLS lsImpl = (DOMImplementationLS) domImpl.getFeature("LS", "3.0");
+
+        LSParser lsParser = lsImpl.createLSParser(DOMImplementationLS.MODE_SYNCHRONOUS, null);
+
+        DOMConfiguration config = lsParser.getDomConfig();
+
+        for (int i = values.length; --i >= 0;) {
+            Object val = values[i][1];
+            String param = (String) values[i][0];
+            try {
+                config.setParameter(param, val);
+                Object returned = config.getParameter(param);
+                Assert.assertEquals(val, returned, "'" + param + "' is set to " + returned + ", but expected " + val);
+                System.out.println("set '" + param + "'" + " to '" + val + "'" + " and returned '" + returned + "'");
+            } catch (DOMException e) {
+                String settings = "setting '" + param + "' to " + val;
+                System.err.println(settings);
+                e.printStackTrace();
+                Assert.fail(settings + ", " + e.toString());
+            }
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSSerializerTest.java b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSSerializerTest.java
new file mode 100644
index 00000000000..d0152fb03bf
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/LSSerializerTest.java
@@ -0,0 +1,293 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.w3c.dom.ls;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.StringReader;
+import java.io.Writer;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.w3c.dom.DOMConfiguration;
+import org.w3c.dom.DOMError;
+import org.w3c.dom.DOMErrorHandler;
+import org.w3c.dom.DOMImplementation;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+import com.sun.org.apache.xerces.internal.impl.Constants;
+
+/*
+ * @summary Test LSSerializer.
+ */
+public class LSSerializerTest {
+
+    class DOMErrorHandlerImpl implements DOMErrorHandler {
+
+        boolean NoOutputSpecifiedErrorReceived = false;
+
+        public boolean handleError(final DOMError error) {
+            // consume "no-output-specified" errors
+            if ("no-output-specified".equalsIgnoreCase(error.getType())) {
+                NoOutputSpecifiedErrorReceived = true;
+                return true;
+            }
+
+            // unexpected error
+            Assert.fail("Unexpected Error Type: " + error.getType() + " @ (" + error.getLocation().getLineNumber() + ", "
+                    + error.getLocation().getColumnNumber() + ")" + ", " + error.getMessage());
+
+            return false;
+        }
+    }
+
+    class Output implements LSOutput {
+        public OutputStream getByteStream() {
+            return null;
+        }
+
+        public void setByteStream(final OutputStream byteStream) {
+        }
+
+        public Writer getCharacterStream() {
+            return null;
+        }
+
+        public void setCharacterStream(final Writer characterStream) {
+        }
+
+        public String getSystemId() {
+            return null;
+        }
+
+        public void setSystemId(final String systemId) {
+        }
+
+        public String getEncoding() {
+            return "UTF8";
+        }
+
+        public void setEncoding(final String encoding) {
+        }
+    }
+
+    @Test
+    public void testDOMErrorHandler() {
+
+        final String XML_DOCUMENT = "<?xml version=\"1.0\"?>" + "<hello>" + "world" + "</hello>";
+
+        StringReader stringReader = new StringReader(XML_DOCUMENT);
+        InputSource inputSource = new InputSource(stringReader);
+        Document doc = null;
+        try {
+            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+            // LSSerializer defaults to Namespace processing
+            // so parsing must also
+            documentBuilderFactory.setNamespaceAware(true);
+            DocumentBuilder parser = documentBuilderFactory.newDocumentBuilder();
+            doc = parser.parse(inputSource);
+
+        } catch (Throwable e) {
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+
+        DOMImplementation impl = doc.getImplementation();
+        DOMImplementationLS implLS = (DOMImplementationLS) impl.getFeature("LS", "3.0");
+        LSSerializer writer = implLS.createLSSerializer();
+        DOMErrorHandlerImpl eh = new DOMErrorHandlerImpl();
+        writer.getDomConfig().setParameter("error-handler", eh);
+
+        boolean serialized = false;
+        try {
+            serialized = writer.write(doc, new Output());
+
+            // unexpected success
+            Assert.fail("Serialized without raising an LSException due to " + "'no-output-specified'.");
+        } catch (LSException lsException) {
+            // expected exception
+            System.out.println("Expected LSException: " + lsException.toString());
+            // continue processing
+        }
+
+        Assert.assertFalse(serialized, "Expected writer.write(doc, new Output()) == false");
+
+        Assert.assertTrue(eh.NoOutputSpecifiedErrorReceived, "'no-output-specified' error was expected");
+    }
+
+    @Test
+    public void testFormatPrettyPrint() {
+
+        final String XML_DOCUMENT = "<?xml version=\"1.0\" encoding=\"UTF-16\"?>\n" + "<hello>" + "world" + "<child><children/><children/></child>"
+                + "</hello>";
+        /**JDK-8035467
+         * no newline in default output
+         */
+        final String XML_DOCUMENT_DEFAULT_PRINT =
+                "<?xml version=\"1.0\" encoding=\"UTF-16\"?>"
+                + "<hello>"
+                + "world"
+                + "<child><children/><children/></child>"
+                + "</hello>";
+
+        final String XML_DOCUMENT_PRETTY_PRINT = "<?xml version=\"1.0\" encoding=\"UTF-16\"?>" + "<hello>" + "world" + "<child>" + "\n" + "        "
+                + "<children/>" + "\n" + "        " + "<children/>" + "\n" + "    " + "</child>" + "\n" + "</hello>" + "\n";
+
+        // it all begins with a Document
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder documentBuilder = null;
+        try {
+            documentBuilder = documentBuilderFactory.newDocumentBuilder();
+        } catch (ParserConfigurationException parserConfigurationException) {
+            parserConfigurationException.printStackTrace();
+            Assert.fail(parserConfigurationException.toString());
+        }
+        Document document = null;
+
+        StringReader stringReader = new StringReader(XML_DOCUMENT);
+        InputSource inputSource = new InputSource(stringReader);
+        try {
+            document = documentBuilder.parse(inputSource);
+        } catch (SAXException saxException) {
+            saxException.printStackTrace();
+            Assert.fail(saxException.toString());
+        } catch (IOException ioException) {
+            ioException.printStackTrace();
+            Assert.fail(ioException.toString());
+        }
+
+        // query DOM Interfaces to get to a LSSerializer
+        DOMImplementation domImplementation = documentBuilder.getDOMImplementation();
+        DOMImplementationLS domImplementationLS = (DOMImplementationLS) domImplementation;
+        LSSerializer lsSerializer = domImplementationLS.createLSSerializer();
+
+        // get configuration
+        DOMConfiguration domConfiguration = lsSerializer.getDomConfig();
+
+        // query current configuration
+        Boolean defaultFormatPrettyPrint = (Boolean) domConfiguration.getParameter(Constants.DOM_FORMAT_PRETTY_PRINT);
+        Boolean canSetFormatPrettyPrintFalse = (Boolean) domConfiguration.canSetParameter(Constants.DOM_FORMAT_PRETTY_PRINT, Boolean.FALSE);
+        Boolean canSetFormatPrettyPrintTrue = (Boolean) domConfiguration.canSetParameter(Constants.DOM_FORMAT_PRETTY_PRINT, Boolean.TRUE);
+
+        System.out.println(Constants.DOM_FORMAT_PRETTY_PRINT + " default/can set false/can set true = " + defaultFormatPrettyPrint + "/"
+                + canSetFormatPrettyPrintFalse + "/" + canSetFormatPrettyPrintTrue);
+
+        // test values
+        Assert.assertEquals(defaultFormatPrettyPrint, Boolean.FALSE, "Default value of " + Constants.DOM_FORMAT_PRETTY_PRINT + " should be " + Boolean.FALSE);
+
+        Assert.assertEquals(canSetFormatPrettyPrintFalse, Boolean.TRUE, "Can set " + Constants.DOM_FORMAT_PRETTY_PRINT + " to " + Boolean.FALSE + " should be "
+                + Boolean.TRUE);
+
+        Assert.assertEquals(canSetFormatPrettyPrintTrue, Boolean.TRUE, "Can set " + Constants.DOM_FORMAT_PRETTY_PRINT + " to " + Boolean.TRUE + " should be "
+                + Boolean.TRUE);
+
+        // get default serialization
+        String prettyPrintDefault = lsSerializer.writeToString(document);
+        System.out.println("(default) " + Constants.DOM_FORMAT_PRETTY_PRINT + "==" + (Boolean) domConfiguration.getParameter(Constants.DOM_FORMAT_PRETTY_PRINT)
+                + ": \n\"" + prettyPrintDefault + "\"");
+
+        Assert.assertEquals(XML_DOCUMENT_DEFAULT_PRINT, prettyPrintDefault, "Invalid serialization with default value, " + Constants.DOM_FORMAT_PRETTY_PRINT + "=="
+                + (Boolean) domConfiguration.getParameter(Constants.DOM_FORMAT_PRETTY_PRINT));
+
+        // configure LSSerializer to not format-pretty-print
+        domConfiguration.setParameter(Constants.DOM_FORMAT_PRETTY_PRINT, Boolean.FALSE);
+        String prettyPrintFalse = lsSerializer.writeToString(document);
+        System.out.println("(FALSE) " + Constants.DOM_FORMAT_PRETTY_PRINT + "==" + (Boolean) domConfiguration.getParameter(Constants.DOM_FORMAT_PRETTY_PRINT)
+                + ": \n\"" + prettyPrintFalse + "\"");
+
+        Assert.assertEquals(XML_DOCUMENT_DEFAULT_PRINT, prettyPrintFalse, "Invalid serialization with FALSE value, " + Constants.DOM_FORMAT_PRETTY_PRINT + "=="
+                + (Boolean) domConfiguration.getParameter(Constants.DOM_FORMAT_PRETTY_PRINT));
+
+        // configure LSSerializer to format-pretty-print
+        domConfiguration.setParameter(Constants.DOM_FORMAT_PRETTY_PRINT, Boolean.TRUE);
+        String prettyPrintTrue = lsSerializer.writeToString(document);
+        System.out.println("(TRUE) " + Constants.DOM_FORMAT_PRETTY_PRINT + "==" + (Boolean) domConfiguration.getParameter(Constants.DOM_FORMAT_PRETTY_PRINT)
+                + ": \n\"" + prettyPrintTrue + "\"");
+
+        Assert.assertEquals(XML_DOCUMENT_PRETTY_PRINT, prettyPrintTrue, "Invalid serialization with TRUE value, " + Constants.DOM_FORMAT_PRETTY_PRINT + "=="
+                + (Boolean) domConfiguration.getParameter(Constants.DOM_FORMAT_PRETTY_PRINT));
+    }
+
+    @Test
+    public void testXML11() {
+
+        /**
+         * XML 1.1 document to parse.
+         */
+        final String XML11_DOCUMENT = "<?xml version=\"1.1\" encoding=\"UTF-16\"?>\n" + "<hello>" + "world" + "<child><children/><children/></child>"
+                + "</hello>";
+
+        /**JDK-8035467
+         * no newline in default output
+         */
+        final String XML11_DOCUMENT_OUTPUT =
+                "<?xml version=\"1.1\" encoding=\"UTF-16\"?>"
+                + "<hello>"
+                + "world"
+                + "<child><children/><children/></child>"
+                + "</hello>";
+
+        // it all begins with a Document
+        DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+        DocumentBuilder documentBuilder = null;
+        try {
+            documentBuilder = documentBuilderFactory.newDocumentBuilder();
+        } catch (ParserConfigurationException parserConfigurationException) {
+            parserConfigurationException.printStackTrace();
+            Assert.fail(parserConfigurationException.toString());
+        }
+        Document document = null;
+
+        StringReader stringReader = new StringReader(XML11_DOCUMENT);
+        InputSource inputSource = new InputSource(stringReader);
+        try {
+            document = documentBuilder.parse(inputSource);
+        } catch (SAXException saxException) {
+            saxException.printStackTrace();
+            Assert.fail(saxException.toString());
+        } catch (IOException ioException) {
+            ioException.printStackTrace();
+            Assert.fail(ioException.toString());
+        }
+
+        // query DOM Interfaces to get to a LSSerializer
+        DOMImplementation domImplementation = documentBuilder.getDOMImplementation();
+        DOMImplementationLS domImplementationLS = (DOMImplementationLS) domImplementation;
+        LSSerializer lsSerializer = domImplementationLS.createLSSerializer();
+
+        // get default serialization
+        String defaultSerialization = lsSerializer.writeToString(document);
+
+        System.out.println("XML 1.1 serialization = \"" + defaultSerialization + "\"");
+
+        // output should == input
+        Assert.assertEquals(XML11_DOCUMENT_OUTPUT, defaultSerialization, "Invalid serialization of XML 1.1 document: ");
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/note_in_dtd.xml b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/note_in_dtd.xml
new file mode 100644
index 00000000000..e4a0f70ce51
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/ls/note_in_dtd.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<!-- Comment node-->
+<!DOCTYPE note [
+  <!ELEMENT note    (to,from,heading,body)>
+  <!ELEMENT to      (#PCDATA)>
+  <!ELEMENT from    (#PCDATA)>
+  <!ELEMENT heading (#PCDATA)>
+  <!ELEMENT body    (#PCDATA)>
+]>
+<note>
+<to>Tove</to>
+<from>Jani</from>
+<heading>Reminder</heading>
+<body>Don't forget me this weekend!</body>
+</note> 
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/test.xml b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/test.xml
new file mode 100644
index 00000000000..c920ced635d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/test.xml
@@ -0,0 +1,2 @@
+<?xml version='1.0'?>
+<test5 xmlns="testNS">the test</test5>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/test.xsd b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/test.xsd
new file mode 100644
index 00000000000..a1db2331d45
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/w3c/dom/test.xsd
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+            xmlns:testNS="testNS"
+            targetNamespace="testNS" elementFormDefault="qualified">
+    <xsd:element name="test5">
+        <xsd:simpleType>
+            <xsd:restriction base="xsd:string"/>
+        </xsd:simpleType>
+    </xsd:element>
+</xsd:schema>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Attributes2ImplTest.java b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Attributes2ImplTest.java
new file mode 100644
index 00000000000..362440fcf55
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Attributes2ImplTest.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.xml.sax;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ext.Attributes2Impl;
+
+/*
+ * @summary Test Attributes2Impl.
+ */
+public class Attributes2ImplTest {
+
+    @Test
+    public void test01() {
+        System.out.println("===in test01()===");
+        Attributes2Impl impl = new Attributes2Impl();
+        impl.addAttribute("http://www.cars.com/xml", "attr1", "Qname1", "type", "value");
+        impl.addAttribute("http://www.cars.com/xml", "attr2", "Qname2", "type", "value");
+        impl.addAttribute("http://www.cars.com/xml", "attr3", "Qname3", "type", "value");
+
+        Assert.assertTrue(impl.isDeclared(0));
+        impl.setDeclared(0, false);
+        Assert.assertFalse(impl.isDeclared(0));
+
+        Assert.assertTrue(impl.isDeclared("Qname2"));
+        impl.setDeclared(1, false);
+        Assert.assertFalse(impl.isDeclared("Qname2"));
+
+        Assert.assertTrue(impl.isDeclared("http://www.cars.com/xml", "attr3"));
+        impl.setDeclared(2, false);
+        Assert.assertFalse(impl.isDeclared(2));
+
+        try {
+            impl.isDeclared(3);
+        } catch (ArrayIndexOutOfBoundsException e) {
+            System.out.println("Expected ArrayIndexOutOfBoundsException");
+        }
+
+        try {
+            impl.isDeclared("wrongQname");
+        } catch (IllegalArgumentException e) {
+            System.out.println("Expected IllegalArgumentException");
+        }
+
+        try {
+            impl.isDeclared("http://www.cars.com/xml", "attr4");
+        } catch (IllegalArgumentException e) {
+            System.out.println("Expected IllegalArgumentException");
+        }
+
+        impl.removeAttribute(2);
+        try {
+            impl.isDeclared(2);
+        } catch (ArrayIndexOutOfBoundsException e) {
+            System.out.println("Expected ArrayIndexOutOfBoundsException on index=2 after removing");
+        }
+    }
+
+    @Test
+    public void test02() {
+        System.out.println("===in test02()===");
+        Attributes2Impl impl = new Attributes2Impl();
+        impl.addAttribute("http://www.cars.com/xml", "attr1", "Qname1", "type", "value");
+        impl.addAttribute("http://www.cars.com/xml", "attr2", "Qname2", "type", "value");
+        impl.addAttribute("http://www.cars.com/xml", "attr3", "Qname3", "type", "value");
+
+        Assert.assertTrue(impl.isSpecified(0));
+        impl.setSpecified(0, false);
+        Assert.assertFalse(impl.isSpecified(0));
+
+        Assert.assertTrue(impl.isSpecified("Qname2"));
+        impl.setSpecified(1, false);
+        Assert.assertFalse(impl.isSpecified("Qname2"));
+
+        Assert.assertTrue(impl.isSpecified("http://www.cars.com/xml", "attr3"));
+        impl.setSpecified(2, false);
+        Assert.assertFalse(impl.isSpecified(2));
+
+        try {
+            impl.isSpecified(3);
+        } catch (ArrayIndexOutOfBoundsException e) {
+            System.out.println("Expected ArrayIndexOutOfBoundsException");
+        }
+
+        try {
+            impl.isSpecified("wrongQname");
+        } catch (IllegalArgumentException e) {
+            System.out.println("Expected IllegalArgumentException");
+        }
+
+        try {
+            impl.isSpecified("http://www.cars.com/xml", "attr4");
+        } catch (IllegalArgumentException e) {
+            System.out.println("Expected IllegalArgumentException");
+        }
+
+        impl.removeAttribute(2);
+        try {
+            impl.isSpecified(2);
+        } catch (ArrayIndexOutOfBoundsException e) {
+            System.out.println("Expected ArrayIndexOutOfBoundsException on index=2 after removing");
+        }
+    }
+
+    @Test
+    public void test03() {
+        System.out.println("===in test03()===");
+        Attributes2Impl impl1 = new Attributes2Impl();
+        impl1.addAttribute("http://www.cars.com/xml", "attr1", "Qname1", "type", "value");
+        impl1.addAttribute("http://www.cars.com/xml", "attr2", "Qname2", "type", "value");
+        impl1.addAttribute("http://www.cars.com/xml", "attr3", "Qname3", "type", "value");
+
+        Attributes2Impl impl2 = new Attributes2Impl(impl1);
+
+        Attributes2Impl impl3 = new Attributes2Impl();
+        impl3.setAttributes(impl1);
+
+        Assert.assertTrue(impl1.getQName(0).equals(impl2.getQName(0)));
+        Assert.assertTrue(impl1.getQName(0).equals(impl3.getQName(0)));
+
+        Assert.assertTrue(impl1.getQName(1).equals(impl2.getQName(1)));
+        Assert.assertTrue(impl1.getQName(1).equals(impl3.getQName(1)));
+
+        Assert.assertTrue(impl1.getQName(2).equals(impl2.getQName(2)));
+        Assert.assertTrue(impl1.getQName(2).equals(impl3.getQName(2)));
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6889654Test.java b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6889654Test.java
new file mode 100644
index 00000000000..ece2b16f09c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6889654Test.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.xml.sax;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6889654
+ * @summary Test SAXException includes whole information.
+ */
+public class Bug6889654Test {
+
+    final String MSG = "Failed to parse XML";
+
+    @Test
+    public void testException() {
+        try {
+            parse();
+        } catch (SAXException e) {
+            // e.printStackTrace();
+            String msg = e.toString();
+            if (msg.indexOf("systemId") == -1) {
+                Assert.fail("CR6889654 -- details should be returned.");
+            }
+            if (msg.indexOf(MSG) == -1) {
+                Assert.fail("CR6889649 -- additional error message not returned.");
+            }
+            System.out.println("error message:\n" + msg);
+        }
+    }
+
+    void parse() throws SAXException {
+        String xml = "<data>\n<broken/>\u0000</data>";
+
+        try {
+            InputSource is = new InputSource(new StringReader(xml));
+            is.setSystemId("file:///path/to/some.xml");
+            // notice that exception thrown here doesn't include the line number
+            // information when reported by JVM -- CR6889654
+            SAXParserFactory.newInstance().newSAXParser().parse(is, new DefaultHandler());
+        } catch (SAXException e) {
+            // notice that this message isn't getting displayed -- CR6889649
+            throw new SAXException(MSG, e);
+        } catch (ParserConfigurationException pce) {
+
+        } catch (IOException ioe) {
+
+        }
+
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6925410Test.java b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6925410Test.java
new file mode 100644
index 00000000000..280d2c8d6e1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6925410Test.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.xml.sax;
+
+import javax.xml.datatype.DatatypeConfigurationException;
+
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/*
+ * @bug 6925410
+ * @summary Test XMLReaderFactory can createXMLReader repeatedly.
+ */
+public class Bug6925410Test {
+
+    @Test
+    public void test() throws DatatypeConfigurationException {
+        try {
+            int times = 100;
+            long start = System.currentTimeMillis();
+            for (int i = 0; i < times; i++) {
+                XMLReaderFactory.createXMLReader();
+            }
+            long end = System.currentTimeMillis();
+            double speed = ((end - start));
+            System.out.println(speed + "ms");
+        } catch (Throwable e) {
+            e.printStackTrace();
+            Assert.fail(e.toString());
+        }
+
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6949607Test.java b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6949607Test.java
new file mode 100644
index 00000000000..800788a8581
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6949607Test.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.xml.sax;
+
+import java.io.ByteArrayInputStream;
+
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.Attributes;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6949607
+ * @summary Test Attributes.getValue returns null when parameter uri is empty.
+ */
+public class Bug6949607Test {
+
+    final String MSG = "Failed to parse XML";
+    String textXML = "<prefix:rootElem xmlns:prefix=\"something\" prefix:attr=\"attrValue\" />";
+
+    @Test
+    public void testException() {
+        try {
+            SAXParserFactory factory = SAXParserFactory.newInstance();
+            factory.setNamespaceAware(true);
+            factory.setValidating(true);
+            SAXParser saxParser = factory.newSAXParser();
+
+            saxParser.parse(new ByteArrayInputStream(textXML.getBytes()), new TestFilter());
+
+        } catch (Throwable t) {
+            t.printStackTrace();
+        }
+    }
+
+    class TestFilter extends DefaultHandler {
+        @Override
+        public void startElement(String uri, String localName, String qName, Attributes atts) throws SAXException {
+            super.startElement(uri, localName, qName, atts);
+
+            String attr_WithNs = atts.getValue("something", "attr");
+            String attr_NoNs = atts.getValue("", "attr");
+
+            System.out.println("withNs: " + attr_WithNs);
+            System.out.println("NoNs: " + attr_NoNs);
+
+            Assert.assertTrue(attr_NoNs == null, "Should return null when uri is empty.");
+
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6992561Test.java b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6992561Test.java
new file mode 100644
index 00000000000..f4761bf9440
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug6992561Test.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.xml.sax;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.ContentHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6992561
+ * @summary Test encoding of SystemId in Locator.
+ */
+public class Bug6992561Test {
+
+    @Test
+    public void test() {
+        ContentHandler handler = new DefaultHandler() {
+            public void setDocumentLocator(Locator locator) {
+                String sysId = locator.getSystemId();
+                System.out.println(locator.getSystemId());
+                if (sysId.indexOf("%7") > 0) {
+                    Assert.fail("the original system id should be left as is and not encoded.");
+                }
+            }
+        };
+
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        SAXParser parser;
+        try {
+            parser = spf.newSAXParser();
+
+            XMLReader reader = parser.getXMLReader();
+            reader.setContentHandler(handler);
+            String xml = "<test>abc</test>";
+            ByteArrayInputStream bis = new ByteArrayInputStream(xml.getBytes());
+            InputSource is = new InputSource("file:/home2/ramapulavarthi/w/bugs/jaxws861/foo~bla/test/src/wsdl/HelloTypes.xsd");
+            is.setByteStream(bis);
+            reader.parse(is);
+
+        } catch (ParserConfigurationException ex) {
+            Assert.fail(ex.toString());
+        } catch (SAXException ex) {
+            Assert.fail(ex.toString());
+        } catch (IOException ex) {
+            Assert.fail(ex.toString());
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug7057778.xml b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug7057778.xml
new file mode 100644
index 00000000000..b28b04f6431
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug7057778.xml
@@ -0,0 +1,3 @@
+
+
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug7057778Test.java b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug7057778Test.java
new file mode 100644
index 00000000000..39039ddc223
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/Bug7057778Test.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.xml.sax;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.UnsupportedEncodingException;
+import java.io.Writer;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Test;
+import org.testng.Assert;
+import org.xml.sax.Attributes;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.DefaultHandler2;
+
+/*
+ * @bug 7057778
+ * @summary Test the file can be deleted after SAXParser.parse(File, DefaultHandler).
+ */
+public class Bug7057778Test {
+
+    static final String xml = "Bug7057778.xml";
+    static final String xml1 = "Bug7057778_1.xml";
+
+    @Test
+    public void testParse() {
+        File src = new File(getClass().getResource(xml).getFile());
+        File dst = new File(src.getParent() + File.separator + xml1);
+        try {
+            copyFile(src, dst);
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            SAXParser parser = spf.newSAXParser();
+            XMLReader xmlReader = parser.getXMLReader();
+            xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", new MyHandler1());
+            parser.parse(dst, new MyHandler1());
+        } catch (SAXException ex) {
+            ex.printStackTrace();
+        } catch (IOException ex) {
+            // shouldn't happen
+        } catch (ParserConfigurationException ex) {
+            // shouldn't happen
+        }
+        if (dst != null) {
+            if (dst.delete()) {
+                System.out.println("Delete: OK");
+            } else {
+                System.out.println("Delete: NG");
+                Assert.fail("Error: denied to delete the file");
+            }
+        }
+
+    }
+
+    private void copyFile(File src, File dst) throws FileNotFoundException, IOException {
+        InputStream in = new FileInputStream(src);
+        OutputStream out = new FileOutputStream(dst);
+        // Transfer bytes
+        byte[] buf = new byte[1024];
+        int len;
+        while ((len = in.read(buf)) > 0) {
+            out.write(buf, 0, len);
+        }
+        in.close();
+        out.close();
+    }
+
+    public class MyHandler1 extends DefaultHandler2 implements ErrorHandler {
+        private Writer out;
+
+        StringBuffer textBuffer;
+        private String indentString = "    "; // Amount to indent
+        private int indentLevel = 0;
+
+        public MyHandler1() {
+            try {
+                out = new OutputStreamWriter(System.out, "UTF8");
+            } catch (UnsupportedEncodingException ex) {
+                ex.printStackTrace();
+            }
+        }
+
+        public void startDocument() throws SAXException {
+        }
+
+        public void endDocument() throws SAXException {
+        }
+
+        public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+            try {
+                System.out.println("uri: " + uri);
+                System.out.println("localName: " + localName);
+                System.out.println("qName: " + qName);
+            } catch (Exception e) {
+                throw new SAXException(e);
+            }
+
+        }
+
+        public void endElement(String uri, String localName, String qName) throws SAXException {
+        }
+
+        public void characters(char ch[], int start, int length) throws SAXException {
+        }
+
+        public void comment(char[] ch, int start, int length) {
+            String text = new String(ch, start, length);
+            // System.out.println(text);
+            try {
+                nl();
+                emit("COMMENT: " + text);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+
+        public void error(SAXParseException exception) {
+            exception.printStackTrace();
+        }
+
+        public void fatalError(SAXParseException exception) {
+            exception.printStackTrace();
+        }
+
+        public void warning(SAXParseException exception) {
+            exception.printStackTrace();
+        }
+
+        // Wrap I/O exceptions in SAX exceptions, to
+        // suit handler signature requirements
+        private void emit(String s) throws SAXException {
+            try {
+                out.write(s);
+                out.flush();
+            } catch (IOException e) {
+                throw new SAXException("I/O error", e);
+            }
+        }
+
+        // Start a new line
+        // and indent the next line appropriately
+        private void nl() throws SAXException {
+            String lineEnd = System.getProperty("line.separator");
+
+            try {
+                out.write(lineEnd);
+
+                for (int i = 0; i < indentLevel; i++)
+                    out.write(indentString);
+            } catch (IOException e) {
+                throw new SAXException("I/O error", e);
+            }
+        }
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/DefaultHandler2Test.java b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/DefaultHandler2Test.java
new file mode 100644
index 00000000000..ecce29090ce
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/DefaultHandler2Test.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.xml.sax;
+
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.AssertJUnit;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.DefaultHandler2;
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.ParserAdapter;
+import org.xml.sax.helpers.XMLFilterImpl;
+import org.xml.sax.helpers.XMLReaderFactory;
+
+/*
+ * @summary Test DefaultHandler2.
+ */
+public class DefaultHandler2Test {
+
+    @Test
+    public void testParse01() {
+        System.out.println("===in testParse01===");
+        try {
+            DefaultHandler handler = new MyDefaultHandler2();
+            SAXParserFactory saxFac = SAXParserFactory.newInstance();
+            System.out.println(saxFac.getFeature("http://xml.org/sax/features/use-locator2"));
+
+            // set use-entity-resolver2 as FALSE to use EntityResolver firstly.
+            saxFac.setFeature("http://xml.org/sax/features/use-entity-resolver2", false);
+            saxFac.setValidating(true);
+
+            SAXParser parser = saxFac.newSAXParser();
+            parser.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
+            parser.setProperty("http://xml.org/sax/properties/declaration-handler", handler);
+
+            parser.parse(this.getClass().getResource("toys.xml").getFile(), handler);
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+            Assert.fail("ParserConfigurationException in testParse01()");
+        } catch (SAXException e) {
+            e.printStackTrace();
+            Assert.fail("SAXException in testParse01()");
+        } catch (IOException e) {
+            e.printStackTrace();
+            Assert.fail("IOException in testParse01()");
+        }
+    }
+
+    @Test
+    public void testParse02() {
+        System.out.println("===in testParse02===");
+        try {
+            DefaultHandler handler = new MyDefaultHandler2();
+            SAXParserFactory saxFac = SAXParserFactory.newInstance();
+            System.out.println(saxFac.getFeature("http://xml.org/sax/features/use-locator2"));
+
+            // Enable namespace parsing
+            System.out.println(saxFac.getFeature("http://xml.org/sax/features/namespaces"));
+            saxFac.setNamespaceAware(true);
+
+            saxFac.setValidating(true);
+            SAXParser parser = saxFac.newSAXParser();
+            parser.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
+            parser.setProperty("http://xml.org/sax/properties/declaration-handler", handler);
+
+            parser.parse(this.getClass().getResource("toys.xml").getFile(), handler);
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+            Assert.fail("ParserConfigurationException in testParse02()");
+        } catch (SAXException e) {
+            e.printStackTrace();
+            Assert.fail("SAXException in testParse02()");
+        } catch (IOException e) {
+            e.printStackTrace();
+            Assert.fail("IOException in testParse02()");
+        }
+    }
+
+    @Test
+    public void testParse03() {
+        System.out.println("===in testParse03===");
+        try {
+            DefaultHandler handler = new MyDefaultHandler2();
+
+            XMLReader xmlReader = XMLReaderFactory.createXMLReader();
+            xmlReader.setProperty("http://xml.org/sax/properties/declaration-handler", handler);
+            System.out.println("XMLReader : " + xmlReader.getProperty("http://xml.org/sax/properties/declaration-handler"));
+
+            SAXParserFactory saxFac = SAXParserFactory.newInstance();
+            SAXParser parser = saxFac.newSAXParser();
+            parser.setProperty("http://xml.org/sax/properties/declaration-handler", handler);
+            System.out.println("SAXParser : " + parser.getProperty("http://xml.org/sax/properties/declaration-handler"));
+
+            // From https://docs.oracle.com/javase/7/docs/api,
+            // ParserAdapter.setProperty() and ParserAdapter.getProperty() does
+            // not support any property currently.
+            try {
+                ParserAdapter adapter = new ParserAdapter(parser.getParser());
+                System.out.println("ParserAdapter : " + adapter.getProperty("http://xml.org/sax/properties/declaration-handler"));
+            } catch (SAXNotRecognizedException e) {
+                System.out.println("Expected  SAXNotRecognizedException since ParserAdapter.getProperty() does not support any property currently");
+            }
+            try {
+                ParserAdapter adapter = new ParserAdapter(parser.getParser());
+                adapter.setProperty("http://xml.org/sax/properties/declaration-handler", handler);
+            } catch (SAXNotRecognizedException e) {
+                System.out.println("Expected  SAXNotRecognizedException since ParserAdapter.setProperty() does not support any property currently");
+            }
+        } catch (SAXException e) {
+            e.printStackTrace();
+            Assert.fail("SAXException in testParse03()");
+        } catch (ParserConfigurationException e) {
+            e.printStackTrace();
+            Assert.fail("ParserConfigurationException in testParse03()");
+        }
+
+    }
+
+    @Test
+    public void testParse04() {
+        System.out.println("===in testParse04===");
+        try {
+            DefaultHandler handler = new MyDefaultHandler2();
+            XMLReader xmlReader = XMLReaderFactory.createXMLReader();
+            System.out.println(xmlReader.getFeature("http://xml.org/sax/features/namespaces"));
+            xmlReader.setProperty("http://xml.org/sax/properties/declaration-handler", handler);
+            xmlReader.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
+            xmlReader.setContentHandler(handler);
+
+            xmlReader.parse(this.getClass().getResource("toys.xml").getFile());
+
+        } catch (SAXException e) {
+            e.printStackTrace();
+            Assert.fail("SAXException in testParse04()");
+        } catch (IOException e) {
+            e.printStackTrace();
+            Assert.fail("IOException in testParse04()");
+        }
+    }
+
+    @Test
+    public void testParse05() {
+        System.out.println("===in testParse05===");
+        try {
+            DefaultHandler handler = new MyDefaultHandler2();
+            XMLReader xmlReader = XMLReaderFactory.createXMLReader();
+            XMLFilterImpl filterImpl = new XMLFilterImpl(xmlReader);
+            System.out.println(xmlReader.getFeature("http://xml.org/sax/features/namespaces"));
+            filterImpl.setProperty("http://xml.org/sax/properties/declaration-handler", handler);
+            filterImpl.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
+            filterImpl.setContentHandler(handler);
+
+            filterImpl.parse(this.getClass().getResource("toys.xml").getFile());
+
+        } catch (SAXException e) {
+            e.printStackTrace();
+            Assert.fail("SAXException in testParse05()");
+        } catch (IOException e) {
+            e.printStackTrace();
+            Assert.fail("IOException in testParse05()");
+        }
+    }
+
+    @Test
+    public void testParse06() {
+        System.out.println("===in testParse06===");
+        try {
+            DefaultHandler handler = new MyDefaultHandler2();
+            XMLReader xmlReader = XMLReaderFactory.createXMLReader();
+            XMLFilterImpl filterImpl = new XMLFilterImpl(xmlReader);
+            System.out.println(xmlReader.getFeature("http://xml.org/sax/features/namespaces"));
+            filterImpl.setProperty("http://xml.org/sax/properties/declaration-handler", handler);
+            filterImpl.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
+            filterImpl.setContentHandler(handler);
+
+            AssertJUnit.assertTrue(filterImpl.getProperty("http://xml.org/sax/properties/declaration-handler") instanceof DefaultHandler2);
+
+            // filterImpl.setFeature("http://xml.org/sax/features/external-general-entities",
+            // false) ;
+            // filterImpl.setFeature("http://xml.org/sax/features/external-parameter-entities",
+            // false) ;
+            filterImpl.skippedEntity("name2");
+
+            filterImpl.parse(this.getClass().getResource("toys.xml").getFile());
+        } catch (SAXException e) {
+            e.printStackTrace();
+            Assert.fail("SAXException in testParse06()");
+        } catch (IOException e) {
+            e.printStackTrace();
+            Assert.fail("IOException in testParse06()");
+        }
+    }
+
+    @Test
+    public void testParse07() {
+        System.out.println("===in testParse07===");
+        try {
+            DefaultHandler handler = new MyDefaultHandler2();
+            XMLReader xmlReader = XMLReaderFactory.createXMLReader();
+            XMLFilterImpl filterImpl = new XMLFilterImpl(xmlReader);
+            System.out.println(xmlReader.getFeature("http://xml.org/sax/features/namespaces"));
+            filterImpl.setProperty("http://xml.org/sax/properties/declaration-handler", handler);
+            filterImpl.setProperty("http://xml.org/sax/properties/lexical-handler", handler);
+            filterImpl.setContentHandler(handler);
+            filterImpl.setErrorHandler(handler);
+            AssertJUnit.assertTrue(filterImpl.getProperty("http://xml.org/sax/properties/declaration-handler") instanceof DefaultHandler2);
+
+            filterImpl.setFeature("http://apache.org/xml/features/continue-after-fatal-error", true);
+            filterImpl.parse(this.getClass().getResource("toys_error.xml").getFile());
+        } catch (SAXException e) {
+            e.printStackTrace();
+            Assert.fail("SAXException in testParse07()");
+        } catch (IOException e) {
+            e.printStackTrace();
+            Assert.fail("IOException in testParse07()");
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/IssueTracker56Test.java b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/IssueTracker56Test.java
new file mode 100644
index 00000000000..9b26c5d04e0
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/IssueTracker56Test.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.xml.sax;
+
+import java.io.IOException;
+import java.io.StringReader;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
+import org.xml.sax.Attributes;
+import org.xml.sax.ErrorHandler;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/*
+ * @bug 6809409
+ * @summary Test SAXException has Cause.
+ */
+public class IssueTracker56Test {
+
+    @Test
+    public void testException() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            SAXParser parser = spf.newSAXParser();
+            String xmlToParse = "<root>Issue 56: SAXException does not do the exception chaining properly</root>";
+            InputSource source = new InputSource(new StringReader(xmlToParse));
+            parser.parse(source, new MyHandler());
+        } catch (SAXException ex) {
+            System.out.println(ex.getCause());
+            if (ex.getCause() == null)
+                Assert.fail("failed chaining exception properly.");
+            // ex.printStackTrace(); //will not print out root cause without the
+            // fix
+        } catch (IOException ex) {
+            // shouldn't happen
+        } catch (ParserConfigurationException ex) {
+            // shouldn't happen
+        }
+    }
+
+    @Test
+    public void testWorkAround() throws Exception {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            SAXParser parser = spf.newSAXParser();
+            String xmlToParse = "<root>Issue 56: SAXException does not do the exception chaining properly</root>";
+            InputSource source = new InputSource(new StringReader(xmlToParse));
+            parser.parse(source, new MyHandler1());
+        } catch (SAXException ex) {
+            System.out.println(ex.getCause());
+            // ex.printStackTrace(); //will print out root cause
+        } catch (IOException ex) {
+            // shouldn't happen
+        } catch (ParserConfigurationException ex) {
+            // shouldn't happen
+        }
+
+    }
+
+    public class MyHandler extends DefaultHandler implements ErrorHandler {
+
+        public void startDocument() throws SAXException {
+        }
+
+        public void endDocument() throws SAXException {
+        }
+
+        public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+            try {
+                System.out.println(uri);
+                System.out.println(uri.charAt(56));
+            } catch (Exception e) {
+                throw new SAXException(e);
+            }
+
+        }
+
+        public void endElement(String uri, String localName, String qName) throws SAXException {
+        }
+
+        public void characters(char ch[], int start, int length) throws SAXException {
+        }
+
+    }
+
+    public class MyHandler1 extends DefaultHandler implements ErrorHandler {
+
+        public void startDocument() throws SAXException {
+        }
+
+        public void endDocument() throws SAXException {
+        }
+
+        public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXExceptionExt {
+            try {
+                System.out.println(uri);
+                System.out.println(uri.charAt(56));
+            } catch (Exception e) {
+                throw new SAXExceptionExt(e);
+            }
+
+        }
+
+        public void endElement(String uri, String localName, String qName) throws SAXException {
+        }
+
+        public void characters(char ch[], int start, int length) throws SAXException {
+        }
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/MyDefaultHandler2.java b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/MyDefaultHandler2.java
new file mode 100644
index 00000000000..548d662256e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/MyDefaultHandler2.java
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.xml.sax;
+
+import java.io.IOException;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.InputSource;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.ext.Attributes2Impl;
+import org.xml.sax.ext.DefaultHandler2;
+import org.xml.sax.ext.Locator2;
+import org.xml.sax.ext.Locator2Impl;
+import org.xml.sax.helpers.XMLFilterImpl;
+import org.xml.sax.helpers.XMLReaderAdapter;
+
+public class MyDefaultHandler2 extends DefaultHandler2 {
+    Locator2Impl locator = new Locator2Impl();
+    StringBuffer currentValue = new StringBuffer();
+    String version = "customVersion";
+    String encoding = "customEncoding";
+
+    public void setDocumentLocator(Locator locator) {
+        this.locator = new Locator2Impl((Locator2) locator);
+        this.locator.setXMLVersion(version);
+        this.locator.setEncoding(encoding);
+    }
+
+    public void startDocument() throws SAXException {
+        super.startDocument();
+        System.out.println("startDocument() is invoked");
+        System.out.println(locator.getXMLVersion());
+        System.out.println(locator.getEncoding());
+    }
+
+    public void attributeDecl(String ename, String aname, String type, String mode, String value) throws SAXException {
+        super.attributeDecl(ename, aname, type, mode, value);
+        System.out.println("attributeDecl() is invoked for attr :" + aname);
+    }
+
+    public void elementDecl(String name, String model) throws SAXException {
+        super.elementDecl(name, model);
+        System.out.println("elementDecl() is invoked for element : " + name);
+    }
+
+    public void internalEntityDecl(String name, String value) throws SAXException {
+        super.internalEntityDecl(name, value);
+        System.out.println("internalEntityDecl() is invoked for entity : " + name);
+    }
+
+    public void externalEntityDecl(String name, String publicId, String systemId) throws SAXException {
+        super.externalEntityDecl(name, publicId, systemId);
+        System.out.println("externalEntityDecl() is invoked for entity : " + name);
+    }
+
+    public void comment(char[] ch, int start, int length) throws SAXException {
+        super.comment(ch, start, length);
+        System.out.println(new String(ch, start, length));
+    }
+
+    public void endDocument() throws SAXException {
+        super.endDocument();
+        System.out.println("\nendDocument() is invoked");
+    }
+
+    public void startCDATA() throws SAXException {
+        super.startCDATA();
+        System.out.println("startCDATA() is invoked");
+    }
+
+    public void endCDATA() throws SAXException {
+        super.endCDATA();
+        System.out.println("endCDATA() is invoked");
+    }
+
+    public void startEntity(String name) throws SAXException {
+        super.startEntity(name);
+        // System.out.println("startEntity() is invoked for entity : " + name) ;
+    }
+
+    public void endEntity(String name) throws SAXException {
+        super.endEntity(name);
+        // System.out.println("endEntity() is invoked for entity : " + name) ;
+    }
+
+    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
+        super.startElement(uri, localName, qName, attributes);
+        if (qName.equals("toy")) {
+            Attributes2Impl impl = new Attributes2Impl();
+            impl.setAttributes(attributes);
+            System.out.println("\ntoy id=" + impl.getValue("id"));
+        } else if (qName.equals("price") || qName.equals("name")) {
+            System.out.print("       " + qName + " : ");
+            currentValue = new StringBuffer();
+        }
+    }
+
+    public void endElement(String uri, String localName, String qName) throws SAXException {
+        super.endElement(uri, localName, qName);
+        if (qName.equals("price") || qName.equals("name")) {
+            System.out.print(currentValue.toString());
+        }
+    }
+
+    public void startDTD(String name, String publicId, String systemId) throws SAXException {
+        super.startDTD(name, publicId, systemId);
+        System.out.println("startDTD() is invoked");
+    }
+
+    public void endDTD() throws SAXException {
+        super.endDTD();
+        System.out.println("endDTD() is invoked");
+    }
+
+    public void characters(char[] ch, int start, int length) {
+        // System.out.println(start + " " + length) ;
+        currentValue.append(ch, start, length);
+    }
+
+    public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
+        System.out.println("resolveEntity(publicId, systemId) is invoked");
+        return super.resolveEntity(publicId, systemId);
+    }
+
+    public InputSource resolveEntity(String name, String publicId, String baseURI, String systemId) throws SAXException, IOException {
+        System.out.println("resolveEntity(name, publicId, baseURI, systemId) is invoked");
+        return super.resolveEntity(name, publicId, baseURI, systemId);
+    }
+
+    public InputSource getExternalSubset(String name, String baseURI) throws SAXException, IOException {
+        System.out.println("getExternalSubset() is invoked");
+        return super.getExternalSubset(name, baseURI);
+    }
+
+    public void startPrefixMapping(String prefix, String uri) {
+        System.out.println("startPrefixMapping() is invoked for " + prefix + " : " + uri);
+        try {
+            new XMLReaderAdapter().startPrefixMapping(prefix, uri);
+        } catch (SAXException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void endPrefixMapping(String prefix) {
+        System.out.println("\nendPrefixMapping() is invoked for " + prefix);
+        try {
+            new XMLReaderAdapter().endPrefixMapping(prefix);
+        } catch (SAXException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void skippedEntity(String name) {
+        try {
+            System.out.println("skippedEntity() is invoked for : " + name);
+            new XMLReaderAdapter().skippedEntity(name);
+        } catch (SAXException e) {
+            e.printStackTrace();
+        }
+    }
+
+    public void error(SAXParseException e) throws SAXException {
+        System.out.println("error() is invoked for in ErrorHandler");
+        new XMLFilterImpl().warning(e);
+    }
+
+    public void fatalError(SAXParseException e) throws SAXException {
+        System.out.println("fatalError() is invoked for in ErrorHandler");
+        new XMLFilterImpl().warning(e);
+    }
+
+    public void warning(SAXParseException e) throws SAXException {
+        System.out.println("warning() is invoked for in ErrorHandler");
+        new XMLFilterImpl().warning(e);
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/NSSupportTest.java b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/NSSupportTest.java
new file mode 100644
index 00000000000..b2c5221f259
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/NSSupportTest.java
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.xml.sax;
+
+import java.util.Enumeration;
+
+import org.testng.Assert;
+import org.testng.AssertJUnit;
+import org.testng.annotations.Test;
+import org.xml.sax.helpers.NamespaceSupport;
+
+/*
+ * @summary Test NamespaceSupport.
+ */
+public class NSSupportTest {
+
+    @Test
+    public void testProcessName() {
+        NamespaceSupport nssupport = new NamespaceSupport();
+
+        nssupport.pushContext();
+        nssupport.declarePrefix("", "http://www.java.com");
+        nssupport.declarePrefix("dc", "http://www.purl.org/dc");
+
+        String[] parts = new String[3];
+        nssupport.processName("dc:name1", parts, false);
+        Assert.assertTrue(parts[0].equals("http://www.purl.org/dc"));
+        Assert.assertTrue(parts[1].equals("name1"));
+        Assert.assertTrue(parts[2].equals("dc:name1"));
+
+        nssupport.processName("name2", parts, false);
+        Assert.assertTrue(parts[0].equals("http://www.java.com"));
+        Assert.assertTrue(parts[1].equals("name2"));
+        Assert.assertTrue(parts[2].equals("name2"));
+    }
+
+    @Test
+    public void testNamespaceDeclUris() {
+        String[] parts = new String[3];
+        NamespaceSupport nssupport = new NamespaceSupport();
+
+        nssupport.pushContext();
+        Assert.assertFalse(nssupport.isNamespaceDeclUris());
+        nssupport.declarePrefix("xmlns", "");
+        nssupport.processName("xmlns:name", parts, true);
+        Assert.assertNull(parts[0]);
+        Assert.assertNull(parts[1]);
+        Assert.assertNull(parts[2]);
+
+        nssupport.reset();
+
+        nssupport.setNamespaceDeclUris(true);
+        nssupport.declarePrefix("xmlns", "");
+        nssupport.processName("xmlns:name", parts, true);
+        Assert.assertTrue(parts[0].equals(NamespaceSupport.NSDECL));
+        Assert.assertTrue(parts[1].equals("name"));
+        Assert.assertTrue(parts[2].equals("xmlns:name"));
+
+        nssupport.reset();
+
+        nssupport.setNamespaceDeclUris(true);
+        nssupport.declarePrefix("xml", "");
+        nssupport.processName("xml:name", parts, true);
+        Assert.assertTrue(parts[0].equals(NamespaceSupport.XMLNS));
+        Assert.assertTrue(parts[1].equals("name"));
+        Assert.assertTrue(parts[2].equals("xml:name"));
+
+    }
+
+    @Test
+    public void testPopContext() {
+        String[] parts = new String[3];
+        NamespaceSupport nssupport = new NamespaceSupport();
+
+        nssupport.pushContext();
+        nssupport.declarePrefix("dc", "http://www.purl.org/dc");
+        Assert.assertEquals(nssupport.getPrefix("http://www.purl.org/dc"), "dc");
+
+        nssupport.popContext();
+        Assert.assertNull(nssupport.getPrefix("http://www.purl.org/dc"));
+        nssupport.processName("dc:name1", parts, false);
+        Assert.assertNull(parts[0]);
+        Assert.assertNull(parts[1]);
+        Assert.assertNull(parts[2]);
+    }
+
+    @Test
+    public void testPrefixAndUri1() {
+        boolean hasdc = false;
+        boolean hasdc1 = false;
+        boolean hasdc2 = false;
+        boolean hasdcnew = false;
+        NamespaceSupport nssupport = new NamespaceSupport();
+
+        nssupport.pushContext();
+        nssupport.declarePrefix("dc", "http://www.purl.org/dc");
+
+        nssupport.pushContext();
+        nssupport.declarePrefix("dc1", "http://www.purl.org/dc");
+        nssupport.declarePrefix("dc2", "http://www.purl.org/dc2");
+        nssupport.declarePrefix("dcnew", "http://www.purl.org/dcnew");
+
+        Enumeration enu1 = nssupport.getDeclaredPrefixes();
+        while (enu1.hasMoreElements()) {
+            String str = (String) enu1.nextElement();
+            if (str.equals("dc")) {
+                hasdc = true;
+            } else if (str.equals("dc1")) {
+                hasdc1 = true;
+            } else if (str.equals("dc2")) {
+                hasdc2 = true;
+            } else if (str.equals("dcnew")) {
+                hasdcnew = true;
+            }
+        }
+        AssertJUnit.assertTrue(hasdcnew && hasdc1 && hasdc2);
+        AssertJUnit.assertFalse(hasdc);
+    }
+
+    @Test
+    public void testPrefixAndUri2() {
+        boolean hasdc = false;
+        boolean hasdc1 = false;
+        boolean hasdc2 = false;
+        boolean hasdcnew = false;
+        NamespaceSupport nssupport = new NamespaceSupport();
+
+        nssupport.pushContext();
+        nssupport.declarePrefix("dc", "http://www.purl.org/dc");
+
+        nssupport.pushContext();
+        nssupport.declarePrefix("dc1", "http://www.purl.org/dc");
+        nssupport.declarePrefix("dc2", "http://www.purl.org/dc2");
+        nssupport.declarePrefix("dcnew", "http://www.purl.org/dcnew");
+
+        Enumeration enu1 = nssupport.getPrefixes();
+        while (enu1.hasMoreElements()) {
+            String str = (String) enu1.nextElement();
+            if (str.equals("dc")) {
+                hasdc = true;
+            } else if (str.equals("dc1")) {
+                hasdc1 = true;
+            } else if (str.equals("dc2")) {
+                hasdc2 = true;
+            } else if (str.equals("dcnew")) {
+                hasdcnew = true;
+            }
+        }
+        AssertJUnit.assertTrue(hasdcnew && hasdc1 && hasdc2 && hasdc);
+    }
+
+    @Test
+    public void testPrefixAndUri3() {
+        boolean hasdc = false;
+        boolean hasdc1 = false;
+        boolean hasdc2 = false;
+        boolean hasdcnew = false;
+        NamespaceSupport nssupport = new NamespaceSupport();
+
+        nssupport.pushContext();
+        nssupport.declarePrefix("dc", "http://www.purl.org/dc");
+
+        nssupport.pushContext();
+        nssupport.declarePrefix("dc1", "http://www.purl.org/dc");
+        nssupport.declarePrefix("dc2", "http://www.purl.org/dc2");
+        nssupport.declarePrefix("dcnew", "http://www.purl.org/dcnew");
+
+        Enumeration enu1 = nssupport.getPrefixes("http://www.purl.org/dc");
+        while (enu1.hasMoreElements()) {
+            String str = (String) enu1.nextElement();
+            if (str.equals("dc")) {
+                hasdc = true;
+            } else if (str.equals("dc1")) {
+                hasdc1 = true;
+            } else if (str.equals("dc2")) {
+                hasdc2 = true;
+            } else if (str.equals("dcnew")) {
+                hasdcnew = true;
+            }
+        }
+        AssertJUnit.assertTrue(hasdc1 && hasdc);
+        AssertJUnit.assertFalse(hasdc2);
+        AssertJUnit.assertFalse(hasdcnew);
+    }
+
+    @Test
+    public void testPrefixAndUri4() {
+        NamespaceSupport nssupport = new NamespaceSupport();
+
+        nssupport.pushContext();
+        nssupport.declarePrefix("dc", "http://www.purl.org/dc");
+
+        nssupport.pushContext();
+        nssupport.declarePrefix("dc1", "http://www.purl.org/dc");
+        nssupport.declarePrefix("dc2", "http://www.purl.org/dc2");
+        nssupport.declarePrefix("dcnew", "http://www.purl.org/dcnew");
+
+        AssertJUnit.assertTrue(nssupport.getURI("dc").equals("http://www.purl.org/dc"));
+        AssertJUnit.assertTrue(nssupport.getURI("dc1").equals("http://www.purl.org/dc"));
+        AssertJUnit.assertTrue(nssupport.getURI("dc2").equals("http://www.purl.org/dc2"));
+        AssertJUnit.assertTrue(nssupport.getURI("dcnew").equals("http://www.purl.org/dcnew"));
+
+        // Negative test
+        Assert.assertNull(nssupport.getURI("wrong_prefix"));
+        Assert.assertNull(nssupport.getURI(""));
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/SAXExceptionExt.java b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/SAXExceptionExt.java
new file mode 100644
index 00000000000..3e5421c5573
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/SAXExceptionExt.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package org.xml.sax;
+
+import org.xml.sax.SAXException;
+
+public class SAXExceptionExt extends SAXException {
+    private Exception exception;
+
+    public SAXExceptionExt(Exception e) {
+        super(e);
+        exception = e;
+    }
+
+    public Throwable getCause() {
+        return exception;
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/externalDTD.dtd b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/externalDTD.dtd
new file mode 100644
index 00000000000..9b570f38454
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/externalDTD.dtd
@@ -0,0 +1,3 @@
+<!ENTITY  name2 "toy2's name">
+<!ELEMENT name (#PCDATA)>
+<!ELEMENT price (#PCDATA)>
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/toys.xml b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/toys.xml
new file mode 100644
index 00000000000..46ce9d25b2d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/toys.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toys  [
+<!ENTITY   % external SYSTEM "externalDTD.dtd">
+%external;
+<!ELEMENT toys (toy*)>
+<!ELEMENT toy (name,price)>
+<!ATTLIST toy id CDATA #REQUIRED>
+<!ENTITY name1 "toy1's name">
+]>
+
+
+
+<!--
+    Document   : toys.xml
+    Created on : August 21, 2012
+    Author     : Patrick Zhang
+    Description: Sample test file for org.xml.sax.ext.DefaultHandler2
+-->
+
+<ns1:toys xmlns:ns1="http://ns1.java.com">
+	<![CDATA[<greeting>Hello</greeting>]]>
+    <toy id="1">	
+        <name>&name1;</name>
+        <price>98470</price>
+    </toy>
+    <toy id="2">
+        <name>&name2;</name>
+        <price>345</price>
+    </toy>         
+</ns1:toys>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/toys_error.xml b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/toys_error.xml
new file mode 100644
index 00000000000..ba5f196205b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/org/xml/sax/toys_error.xml
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE toys  [
+<!ENTITY   % external SYSTEM "externalDTD.dtd">
+%external;
+<!ELEMENT toys (toy*)>
+<!ELEMENT toy (name,price)>
+<!ATTLIST toy id CDATA #REQUIRED>
+<!ENTITY name1 "toy1's name">
+]>
+
+
+
+<!--
+    Document   : toys.xml
+    Created on : August 21, 2012
+    Author     : Patrick Zhang
+    Description: Sample test file for org.xml.sax.ext.DefaultHandler2
+-->
+
+<ns1:toys xmlns:ns1="http://ns1.java.com">
+	<![CDATA[<greeting>Hello</greeting>]]>
+    <toy id="1">	
+        <name>&name1;</name>
+        <price>98470</price>
+    </toy>
+    <toy id="2">
+        <name>&name3;</name>
+        <price>345</price>
+    </toy>         
+</ns1:toys>
+
diff --git a/jaxp/test/javax/xml/jaxp/unittest/policy/PolicyUtil.java b/jaxp/test/javax/xml/jaxp/unittest/policy/PolicyUtil.java
new file mode 100644
index 00000000000..340f5de7d55
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/policy/PolicyUtil.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package policy;
+
+import java.security.Policy;
+
+public class PolicyUtil {
+
+    public static void changePolicy(String policyFile) {
+        System.setProperty("java.security.policy", policyFile);
+        Policy.getPolicy().refresh();
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/policy/common.policy b/jaxp/test/javax/xml/jaxp/unittest/policy/common.policy
new file mode 100644
index 00000000000..0ca5f742c09
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/policy/common.policy
@@ -0,0 +1,27 @@
+grant {
+	permission java.lang.reflect.ReflectPermission "suppressAccessChecks";
+	permission java.lang.RuntimePermission "accessDeclaredMembers";
+	
+	permission java.io.FilePermission "${test.classes}/../../-", "read, write, delete";
+	permission java.io.FilePermission ".", "read, write, delete";
+	permission java.util.PropertyPermission "*", "read, write";
+	
+    permission java.lang.RuntimePermission "setSecurityManager";
+    permission java.lang.RuntimePermission "createSecurityManager";
+    permission java.lang.RuntimePermission "createClassLoader";
+    permission java.lang.RuntimePermission "setIO";
+	permission java.lang.RuntimePermission "setContextClassLoader"; 
+	permission java.security.SecurityPermission "getPolicy";
+    
+    permission java.io.FilePermission "${test.src}/-", "read, write, delete";
+    permission java.io.FilePermission "${user.dir}/-", "read, write, delete";
+    permission java.io.FilePermission "${java.io.tmpdir}/-", "read, write, delete";
+    
+    permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.bcel.internal.classfile";
+    permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.bcel.internal.generic";
+    permission java.lang.RuntimePermission "accessClassInPackage.com.sun.xml.internal.stream.writers";
+    permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xerces.internal.impl";
+    permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xalan.internal";
+    permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xalan.internal.xsltc.trax";
+	permission java.lang.RuntimePermission "accessClassInPackage.com.sun.org.apache.xalan.internal.xslt";
+};
diff --git a/jaxp/test/javax/xml/jaxp/unittest/util/BOMInputStream.java b/jaxp/test/javax/xml/jaxp/unittest/util/BOMInputStream.java
new file mode 100644
index 00000000000..2088452af58
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/util/BOMInputStream.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package util;
+
+import java.io.BufferedInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+import java.util.Map;
+
+public class BOMInputStream {
+        public static InputStream createStream(String charset, InputStream input) {
+
+                        try {
+                                byte[] content = read(input).getBytes(charset);
+                                byte[] head = bom.get(charset);
+                                if (head == null)
+                                        return null;
+                                byte[] result = new byte[head.length + content.length];
+                                System.arraycopy(head, 0, result, 0, head.length);
+                                System.arraycopy(content, 0, result, head.length, content.length);
+                                return new ByteArrayInputStream(result);
+                        } catch (UnsupportedEncodingException e) {
+                                return null;
+                        }
+        }
+
+        private static String read(InputStream input)
+        {
+                try {
+                        StringBuffer sb = new StringBuffer();
+                        InputStreamReader r = new InputStreamReader(new BufferedInputStream(input));
+                        int c = 0;
+                        while ((c = r.read()) != -1)
+                                sb.append((char)c);
+                        return sb.toString();
+                } catch (IOException e) {
+                        return "";
+                } finally {
+                        try {
+                                input.close();
+                        } catch (IOException e)
+                        {}
+                }
+        }
+
+
+        private final static Map<String, byte[]> bom = new HashMap();
+        private final static byte[][] bomBytes = {{(byte)0xEF, (byte)0xBB, (byte)0xBF},
+                                        {(byte)0xFE, (byte)0xFF}};
+
+        static {
+                bom.put("UTF-8", bomBytes[0]);
+                bom.put("UTF-16BE", bomBytes[1]);
+        }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java b/jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java
new file mode 100644
index 00000000000..86a54335249
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/util/BaseStAXUT.java
@@ -0,0 +1,559 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package util;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.io.UnsupportedEncodingException;
+import java.util.HashMap;
+
+import javax.xml.stream.XMLEventFactory;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLResolver;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.events.XMLEvent;
+
+import org.testng.Assert;
+
+/**
+ * Base class for all StaxTest unit test classes. Contains shared
+ * functionality for many common set up tasks, as well as for
+ * outputting diagnostics.
+ *
+ */
+public class BaseStAXUT implements XMLStreamConstants {
+    /**
+     * This is the de facto standard property that enables accurate reporting of
+     * CDATA events.
+     */
+    final static String PROP_REPORT_CDATA = "http://java.sun.com/xml/stream/properties/report-cdata-event";
+
+    final static HashMap mTokenTypes = new HashMap();
+    static {
+        mTokenTypes.put(new Integer(START_ELEMENT), "START_ELEMENT");
+        mTokenTypes.put(new Integer(END_ELEMENT), "END_ELEMENT");
+        mTokenTypes.put(new Integer(START_DOCUMENT), "START_DOCUMENT");
+        mTokenTypes.put(new Integer(END_DOCUMENT), "END_DOCUMENT");
+        mTokenTypes.put(new Integer(CHARACTERS), "CHARACTERS");
+        mTokenTypes.put(new Integer(CDATA), "CDATA");
+        mTokenTypes.put(new Integer(COMMENT), "COMMENT");
+        mTokenTypes.put(new Integer(PROCESSING_INSTRUCTION), "PROCESSING_INSTRUCTION");
+        mTokenTypes.put(new Integer(DTD), "DTD");
+        mTokenTypes.put(new Integer(SPACE), "SPACE");
+        mTokenTypes.put(new Integer(ENTITY_REFERENCE), "ENTITY_REFERENCE");
+        mTokenTypes.put(new Integer(NAMESPACE), "NAMESPACE_DECLARATION");
+        mTokenTypes.put(new Integer(NOTATION_DECLARATION), "NOTATION_DECLARATION");
+        mTokenTypes.put(new Integer(ENTITY_DECLARATION), "ENTITY_DECLARATION");
+    }
+
+    /*
+     * /////////////////////////////////////////////////// // Consts for
+     * expected values ///////////////////////////////////////////////////
+     */
+
+    /**
+     * Expected return value for streamReader.getNamespaceURI() in
+     * non-namespace-aware mode.
+     */
+    protected final String DEFAULT_URI_NON_NS = "";
+
+    protected final String DEFAULT_URI_NS = "";
+
+    /*
+     * /////////////////////////////////////////////////// // Other consts
+     * ///////////////////////////////////////////////////
+     */
+
+    /*
+     * /////////////////////////////////////////////////// // Cached instances
+     * ///////////////////////////////////////////////////
+     */
+
+    XMLInputFactory mInputFactory;
+    XMLOutputFactory mOutputFactory;
+    XMLEventFactory mEventFactory;
+
+    protected XMLInputFactory getInputFactory() {
+        if (mInputFactory == null) {
+            mInputFactory = getNewInputFactory();
+        }
+        return mInputFactory;
+    }
+
+    protected static XMLInputFactory getNewInputFactory() {
+        return XMLInputFactory.newInstance();
+    }
+
+    protected XMLOutputFactory getOutputFactory() {
+        if (mOutputFactory == null) {
+            mOutputFactory = getNewOutputFactory();
+        }
+        return mOutputFactory;
+    }
+
+    protected static XMLOutputFactory getNewOutputFactory() {
+        return XMLOutputFactory.newInstance();
+    }
+
+    protected XMLEventFactory getEventFactory() {
+        if (mEventFactory == null) {
+            mEventFactory = XMLEventFactory.newInstance();
+        }
+        return mEventFactory;
+    }
+
+    protected static XMLStreamReader constructStreamReader(XMLInputFactory f, String content) throws XMLStreamException {
+        // return f.createXMLStreamReader(new StringReader(content));
+        try {
+            byte[] data = content.getBytes("UTF-8");
+            return constructStreamReader(f, data);
+        } catch (UnsupportedEncodingException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    protected static XMLStreamReader constructStreamReader(XMLInputFactory f, byte[] b) throws XMLStreamException {
+        return f.createXMLStreamReader(new ByteArrayInputStream(b));
+    }
+
+    protected static XMLStreamReader constructStreamReaderForFile(XMLInputFactory f, String filename) throws IOException, XMLStreamException {
+        File inf = new File(filename);
+        XMLStreamReader sr = f.createXMLStreamReader(inf.toURL().toString(), new FileReader(inf));
+        Assert.assertEquals(START_DOCUMENT, sr.getEventType());
+        return sr;
+    }
+
+    protected XMLStreamReader constructNsStreamReader(String content) throws XMLStreamException {
+        XMLInputFactory f = getInputFactory();
+        setNamespaceAware(f, true);
+        return f.createXMLStreamReader(new StringReader(content));
+    }
+
+    protected XMLStreamReader constructNsStreamReader(String content, boolean coal) throws XMLStreamException {
+        XMLInputFactory f = getInputFactory();
+        setNamespaceAware(f, true);
+        setCoalescing(f, coal);
+        return f.createXMLStreamReader(new StringReader(content));
+    }
+
+    /*
+     * ////////////////////////////////////////////////// // Configuring input
+     * factory //////////////////////////////////////////////////
+     */
+
+    protected static boolean isCoalescing(XMLInputFactory f) throws XMLStreamException {
+        return ((Boolean) f.getProperty(XMLInputFactory.IS_COALESCING)).booleanValue();
+    }
+
+    protected static void setCoalescing(XMLInputFactory f, boolean state) throws XMLStreamException {
+        Boolean b = state ? Boolean.TRUE : Boolean.FALSE;
+        f.setProperty(XMLInputFactory.IS_COALESCING, b);
+        // Let's just double-check it...
+        Assert.assertEquals(state, isCoalescing(f));
+    }
+
+    protected static boolean isValidating(XMLInputFactory f) throws XMLStreamException {
+        return ((Boolean) f.getProperty(XMLInputFactory.IS_VALIDATING)).booleanValue();
+    }
+
+    protected static void setValidating(XMLInputFactory f, boolean state) throws XMLStreamException {
+        try {
+            Boolean b = state ? Boolean.TRUE : Boolean.FALSE;
+            f.setProperty(XMLInputFactory.IS_VALIDATING, b);
+        } catch (IllegalArgumentException iae) {
+            Assert.fail("Could not set DTD validating mode to " + state + ": " + iae);
+            // throw new XMLStreamException(iae.getMessage(), iae);
+        }
+        Assert.assertEquals(state, isValidating(f));
+    }
+
+    protected static boolean isNamespaceAware(XMLInputFactory f) throws XMLStreamException {
+        return ((Boolean) f.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)).booleanValue();
+    }
+
+    /**
+     * @return True if setting succeeded, and property supposedly was
+     *         succesfully set to the value specified; false if there was a
+     *         problem.
+     */
+    protected static boolean setNamespaceAware(XMLInputFactory f, boolean state) throws XMLStreamException {
+        try {
+            f.setProperty(XMLInputFactory.IS_NAMESPACE_AWARE, state ? Boolean.TRUE : Boolean.FALSE);
+
+            /*
+             * 07-Sep-2005, TSa: Let's not assert, but instead let's see if it
+             * sticks. Some implementations might choose to silently ignore
+             * setting, at least for 'false'?
+             */
+            return (isNamespaceAware(f) == state);
+        } catch (IllegalArgumentException e) {
+            /*
+             * Let's assume, then, that the property (or specific value for it)
+             * is NOT supported...
+             */
+            return false;
+        }
+    }
+
+    protected static void setReplaceEntities(XMLInputFactory f, boolean state) throws XMLStreamException {
+        Boolean b = state ? Boolean.TRUE : Boolean.FALSE;
+        f.setProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES, b);
+        Assert.assertEquals(b, f.getProperty(XMLInputFactory.IS_REPLACING_ENTITY_REFERENCES));
+    }
+
+    protected static void setSupportDTD(XMLInputFactory f, boolean state) throws XMLStreamException {
+        Boolean b = state ? Boolean.TRUE : Boolean.FALSE;
+        f.setProperty(XMLInputFactory.SUPPORT_DTD, b);
+        Assert.assertEquals(b, f.getProperty(XMLInputFactory.SUPPORT_DTD));
+    }
+
+    protected static boolean setSupportExternalEntities(XMLInputFactory f, boolean state) throws XMLStreamException {
+        Boolean b = state ? Boolean.TRUE : Boolean.FALSE;
+        try {
+            f.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, b);
+            Object act = f.getProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES);
+            return (act instanceof Boolean) && ((Boolean) act).booleanValue() == state;
+        } catch (IllegalArgumentException e) {
+            /*
+             * Let's assume, then, that the property (or specific value for it)
+             * is NOT supported...
+             */
+            return false;
+        }
+    }
+
+    protected static void setResolver(XMLInputFactory f, XMLResolver resolver) throws XMLStreamException {
+        f.setProperty(XMLInputFactory.RESOLVER, resolver);
+    }
+
+    protected static boolean setReportCData(XMLInputFactory f, boolean state) throws XMLStreamException {
+
+        Boolean b = state ? Boolean.TRUE : Boolean.FALSE;
+        if (f.isPropertySupported(PROP_REPORT_CDATA)) {
+            f.setProperty(PROP_REPORT_CDATA, b);
+            return true;
+        }
+        return false;
+    }
+
+    /*
+     * ////////////////////////////////////////////////// // Stream reader
+     * accessors //////////////////////////////////////////////////
+     */
+
+    /**
+     * Method that not only gets currently available text from the reader, but
+     * also checks that its consistenly accessible using different StAX methods.
+     */
+    protected static String getAndVerifyText(XMLStreamReader sr) throws XMLStreamException {
+        String text = sr.getText();
+
+        /*
+         * 05-Apr-2006, TSa: Although getText() is available for DTD and
+         * ENTITY_REFERENCE, getTextXxx() are not. Thus, can not do more checks
+         * for those types.
+         */
+        int type = sr.getEventType();
+        if (type != ENTITY_REFERENCE && type != DTD) {
+            Assert.assertNotNull("getText() should never return null.", text);
+            int expLen = sr.getTextLength();
+            /*
+             * Hmmh. Can only return empty text for CDATA (since empty blocks
+             * are legal).
+             */
+            /*
+             * !!! 01-Sep-2004, TSa: note: theoretically, in coalescing mode, it
+             * could be possible to have empty CDATA section(s) get converted to
+             * CHARACTERS, which would be empty... may need to enhance this to
+             * check that mode is not coalescing? Or something
+             */
+            if (sr.getEventType() == CHARACTERS) {
+                if (expLen == 0) {
+                    Assert.fail("Stream reader should never return empty Strings.");
+                }
+            }
+            Assert.assertEquals(expLen, text.length(), "Expected text length of " + expLen + ", got " + text.length());
+            char[] textChars = sr.getTextCharacters();
+            int start = sr.getTextStart();
+            String text2 = new String(textChars, start, expLen);
+            Assert.assertEquals("Expected getText() and getTextCharacters() to return same value for event of type (" + tokenTypeDesc(sr.getEventType()) + ")",
+                    text, text2);
+        } else { // DTD or ENTITY_REFERENCE
+            // not sure if null is legal for these either, but...
+            if (text == null) { // let's prevent an NPE at caller
+                text = "";
+            }
+        }
+        return text;
+    }
+
+    protected static String getAllText(XMLStreamReader sr) throws XMLStreamException {
+        StringBuffer sb = new StringBuffer();
+        while (true) {
+            int tt = sr.getEventType();
+            if (tt != CHARACTERS && tt != SPACE) {
+                break;
+            }
+            sb.append(getAndVerifyText(sr));
+            sr.next();
+        }
+        return sb.toString();
+    }
+
+    protected static String getAllCData(XMLStreamReader sr) throws XMLStreamException {
+        StringBuffer sb = new StringBuffer();
+        while (true) {
+            /*
+             * Note: CDATA sections CAN be reported as CHARACTERS, but not as
+             * SPACE
+             */
+            int tt = sr.getEventType();
+            if (tt != CHARACTERS && tt != CDATA) {
+                break;
+            }
+            sb.append(getAndVerifyText(sr));
+            sr.next();
+        }
+        return sb.toString();
+    }
+
+    /*
+     * ////////////////////////////////////////////////// // Derived assert/fail
+     * methods //////////////////////////////////////////////////
+     */
+
+    protected static void assertTokenType(int expType, int actType) {
+        if (expType == actType) {
+            return;
+        }
+        Assert.fail("Expected token " + tokenTypeDesc(expType) + "; got " + tokenTypeDesc(actType) + ".");
+    }
+
+    protected static void assertTokenType(int expType, int actType, XMLStreamReader sr) {
+        if (expType == actType) {
+            return;
+        }
+        Assert.fail("Expected token " + tokenTypeDesc(expType) + "; got " + tokenTypeDesc(actType, sr) + ".");
+    }
+
+    protected static void assertTextualTokenType(int actType) {
+        if (actType != CHARACTERS && actType != SPACE && actType != CDATA) {
+            Assert.fail("Expected textual token (CHARACTERS, SPACE or CDATA)" + "; got " + tokenTypeDesc(actType) + ".");
+        }
+    }
+
+    protected static void failStrings(String msg, String exp, String act) {
+        // !!! TODO: Indicate position where Strings differ
+        Assert.fail(msg + ": expected " + quotedPrintable(exp) + ", got " + quotedPrintable(act));
+    }
+
+    /**
+     * Specific method makes sense, since earlier it was not clear whether null
+     * or empty string (or perhaps both) would be the right answer when there is
+     * no prefix.
+     * <p>
+     * However: as per javadocs of {@link XMLStreamReader#getPrefix}, from JDK
+     * 1.6 indicate, the current understanding is that <b>null</b> is the
+     * ultimate right answer here.
+     */
+    protected static void assertNoPrefix(XMLStreamReader sr) throws XMLStreamException {
+        String prefix = sr.getPrefix();
+        if (prefix != null) {
+            if (prefix.length() != 0) {
+                Assert.fail("Current element should not have a prefix: got '" + prefix + "'");
+            } else {
+                Assert.fail("Expected null to signify missing prefix (see XMLStreamReader#getPrefix() JavaDocs): got empty String");
+            }
+        }
+    }
+
+    protected static void assertNoAttrPrefix(String attrPrefix) throws XMLStreamException {
+        if (attrPrefix != null) {
+            if (attrPrefix.length() != 0) {
+                Assert.fail("Attribute should not have a prefix: got '" + attrPrefix + "'");
+            } else {
+                Assert.fail("Expected null to signify missing attribute prefix (see XMLStreamReader#getAttributePrefix() JavaDocs): got empty String");
+            }
+        }
+    }
+
+    /**
+     * Similar to {@link #assertNoPrefix}, but here we do know that unbound
+     * namespace URI should be indicated as empty String.
+     */
+    protected static void assertNoNsURI(XMLStreamReader sr) throws XMLStreamException {
+        String uri = sr.getNamespaceURI();
+        if (uri == null) {
+            Assert.fail("Expected empty String to indicate \"no namespace\": got null");
+        } else if (uri.length() != 0) {
+            Assert.fail("Expected empty String to indicate \"no namespace\": got '" + uri + "'");
+        }
+    }
+
+    protected static void assertNoAttrNamespace(String attrNsURI) throws XMLStreamException {
+        if (attrNsURI == null) {
+            // refer to 6903561; accept null for now.
+            // fail("Expected empty String to indicate \"no namespace\" (for attribute): got null");
+        } else if (attrNsURI.length() != 0) {
+            Assert.fail("Expected empty String to indicate \"no namespace\" (for attribute): got '" + attrNsURI + "'");
+        }
+    }
+
+    protected static void assertNoPrefixOrNs(XMLStreamReader sr) throws XMLStreamException {
+        assertNoPrefix(sr);
+        assertNoNsURI(sr);
+    }
+
+    /**
+     * Helper assertion that assert that the String is either null or empty
+     * ("").
+     */
+    protected static void assertNullOrEmpty(String str) {
+        if (str != null && str.length() > 0) {
+            Assert.fail("Expected String to be empty or null; was '" + str + "' (length " + str.length() + ")");
+        }
+    }
+
+    /*
+     * ////////////////////////////////////////////////// // Debug/output
+     * helpers //////////////////////////////////////////////////
+     */
+
+    protected static String tokenTypeDesc(int tt) {
+        String desc = (String) mTokenTypes.get(new Integer(tt));
+        if (desc == null) {
+            return "[" + tt + "]";
+        }
+        return desc;
+    }
+
+    protected static String tokenTypeDesc(XMLEvent evt) {
+        return tokenTypeDesc(evt.getEventType());
+    }
+
+    final static int MAX_DESC_TEXT_CHARS = 8;
+
+    protected static String tokenTypeDesc(int tt, XMLStreamReader sr) {
+        String desc = tokenTypeDesc(tt);
+        // Let's show first 8 chars or so...
+        if (tt == CHARACTERS || tt == SPACE || tt == CDATA) {
+            String str = sr.getText();
+            if (str.length() > MAX_DESC_TEXT_CHARS) {
+                desc = "\"" + str.substring(0, MAX_DESC_TEXT_CHARS) + "\"[...]";
+            } else {
+                desc = "\"" + desc + "\"";
+            }
+            desc = " (" + desc + ")";
+        }
+        return desc;
+    }
+
+    protected static String valueDesc(String value) {
+        if (value == null) {
+            return "[NULL]";
+        }
+        return "\"" + value + "\"";
+    }
+
+    protected static String printable(char ch) {
+        if (ch == '\n') {
+            return "\\n";
+        }
+        if (ch == '\r') {
+            return "\\r";
+        }
+        if (ch == '\t') {
+            return "\\t";
+        }
+        if (ch == ' ') {
+            return "_";
+        }
+        if (ch > 127 || ch < 32) {
+            StringBuffer sb = new StringBuffer(6);
+            sb.append("\\u");
+            String hex = Integer.toHexString((int) ch);
+            for (int i = 0, len = 4 - hex.length(); i < len; i++) {
+                sb.append('0');
+            }
+            sb.append(hex);
+            return sb.toString();
+        }
+        return null;
+    }
+
+    protected static String printable(String str) {
+        if (str == null || str.length() == 0) {
+            return str;
+        }
+
+        int len = str.length();
+        StringBuffer sb = new StringBuffer(len + 64);
+        for (int i = 0; i < len; ++i) {
+            char c = str.charAt(i);
+            String res = printable(c);
+            if (res == null) {
+                sb.append(c);
+            } else {
+                sb.append(res);
+            }
+        }
+        return sb.toString();
+    }
+
+    protected static String quotedPrintable(String str) {
+        if (str == null || str.length() == 0) {
+            return "[0]''";
+        }
+        return "[len: " + str.length() + "] '" + printable(str) + "'";
+    }
+
+    protected void reportNADueToProperty(String method, String prop) {
+        String clsName = getClass().getName();
+        /*
+         * 27-Sep-2005, TSa: Should probably use some other mechanism for
+         * reporting this. Does JUnit have something applicable?
+         */
+        System.err.println("Skipping " + clsName + "#" + method + ": property '" + prop + "' (or one of its values) not supported.");
+    }
+
+    protected void reportNADueToNS(String method) {
+        reportNADueToProperty(method, "IS_NAMESPACE_AWARE");
+    }
+
+    protected void reportNADueToExtEnt(String method) {
+        reportNADueToProperty(method, "IS_SUPPORTING_EXTERNAL_ENTITIES");
+    }
+
+    protected void reportNADueToEntityExpansion(String method, int type) {
+        String clsName = getClass().getName();
+        String msg = (type > 0) ? " (next event: " + tokenTypeDesc(type) + ")" : "";
+        System.err.println("Skipping " + clsName + "#" + method + ": entity expansion does not seem to be functioning properly" + msg + ".");
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/unittest/util/DraconianErrorHandler.java b/jaxp/test/javax/xml/jaxp/unittest/util/DraconianErrorHandler.java
new file mode 100644
index 00000000000..5a408d1278a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/unittest/util/DraconianErrorHandler.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package util;
+
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+
+public final class DraconianErrorHandler extends DefaultHandler {
+    public void error(SAXParseException e) throws SAXException {
+        throw e;
+    }
+
+    public void fatalError(SAXParseException e) throws SAXException {
+        throw e;
+    }
+}

From 7f650a64d55bb9c877a80801cdb44ff5cb490eba Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Tue, 18 Nov 2014 15:25:14 -0800
Subject: [PATCH 110/299] Added tag jdk9-b40 for changeset 11359380f4f9

---
 corba/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/corba/.hgtags b/corba/.hgtags
index ab15ca1134c..ee710f70e9f 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -282,3 +282,4 @@ ffd90c81d4ef9d94d880fc852e2fc482ecd9b374 jdk9-b36
 7e9add74ad50841fb39dae75db56374aefa1de4c jdk9-b37
 8acf056126e819cf536eef02aee0f61f207a6b52 jdk9-b38
 53bf36cb722db50815712258a77cb6bbe25a2f5f jdk9-b39
+e27c725d6c9d155667b35255f442d4ceb8c3c084 jdk9-b40

From 785151164a65e24ce14d1847ed6f075717a82658 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Tue, 18 Nov 2014 15:25:14 -0800
Subject: [PATCH 111/299] Added tag jdk9-b40 for changeset e549997f615f

---
 hotspot/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index ec88eae37e7..acafa28f373 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -442,3 +442,4 @@ af46576a8d7cb4003028b8ee8bf408cfe227315b jdk9-b32
 b1c2dd843f247a1db19e1e85eb62ca405f72dc26 jdk9-b37
 c363a8b87e477ee45d6d3cb2a36cb365141bc596 jdk9-b38
 9cb75e5e394827ccbaf2e15524108a412dc4ddc5 jdk9-b39
+6b09b3193d731e3288e2a240c504a20d0a06c766 jdk9-b40

From b9ea81b9ed6af8701ea5105da2a6f559e9cdfa24 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Tue, 18 Nov 2014 15:25:15 -0800
Subject: [PATCH 112/299] Added tag jdk9-b40 for changeset de21c9802939

---
 jaxp/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index 6ec4929ca1b..1439963c082 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -282,3 +282,4 @@ b9370464572fc663a38956047aa612d6e7854c3d jdk9-b35
 48e4ec70cc1c8651e4a0324d91f193c4edd83af9 jdk9-b37
 6c6b34477e93e6fb350035f73ed7c02266b78380 jdk9-b38
 a12d347f84176200593999f4da91ae2bb86865b2 jdk9-b39
+3f46e2196498de33e7c65efa7b372e46f1faba01 jdk9-b40

From ed11049d5eec1e28a643007d1c2a8d135573f1fa Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Tue, 18 Nov 2014 15:25:16 -0800
Subject: [PATCH 113/299] Added tag jdk9-b40 for changeset d480c3085030

---
 jdk/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/jdk/.hgtags b/jdk/.hgtags
index e63cca060f0..06eb73ce7da 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -282,3 +282,4 @@ cdcf2e599e42935c2d1d19a24bb19e808aeb43b5 jdk9-b36
 27c3345d6dce39a22c262f30bb1f0e0b00c3709e jdk9-b37
 d2d745313c81d1fc01f426983b9f784ab1f750e8 jdk9-b38
 ca6edf957fe1c6ea818530b503578e872cea7239 jdk9-b39
+f1ed1540da70a066527fd043413107e47721edbf jdk9-b40

From d124cca5301cbb07c9eaa27c49661212fb676b73 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Tue, 18 Nov 2014 15:25:16 -0800
Subject: [PATCH 114/299] Added tag jdk9-b40 for changeset b31dbb20135a

---
 jaxws/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index 41becc85114..ed8c8533695 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -285,3 +285,4 @@ afe0c89e2edbdfb1a7ceff3d9b3ff46c4186202f jdk9-b35
 90de6ecbff46386a3f9d6f7ca876e7aa6381f50a jdk9-b37
 dd4ba422dba858b1c3c4b38f49a3e514be4e2790 jdk9-b38
 381bad1174c7c27352bee604535332da4ee2c556 jdk9-b39
+5455969de31f3083bcfd779b7acc3ab758ecb308 jdk9-b40

From f141ae6666bcb8f40f483f1bce667a331919f277 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Tue, 18 Nov 2014 15:25:18 -0800
Subject: [PATCH 115/299] Added tag jdk9-b40 for changeset 5152f73fa93b

---
 langtools/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/langtools/.hgtags b/langtools/.hgtags
index 683286ba04e..d42b3d90ecc 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -282,3 +282,4 @@ c536541235e566701ff772700c15de14b75e2979 jdk9-b36
 478972d90f7bf5002615c5b2fb1ec3e0338fcadd jdk9-b37
 5ad591bc3ef6d1b30b215cb9c228bf94aac6dc7c jdk9-b38
 5ff1cd07bd9297e82cfea5ec01249d162260fe4e jdk9-b39
+c286272a81dd8f6005e22fed0238c4a3f75188c7 jdk9-b40

From 9c481b142e8d6d9ba445b8b302c4f3afb5d9273a Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Tue, 18 Nov 2014 15:25:19 -0800
Subject: [PATCH 116/299] Added tag jdk9-b40 for changeset 4bb9d8815020

---
 nashorn/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index 09c290e03f1..28429a6832f 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -273,3 +273,4 @@ b374d8910e7f8de2b7ecacee9ae4cad88f23feab jdk9-b33
 dd7bbdf81a537106cfa9227d1a9a57849cb26b4d jdk9-b37
 365f55e7b3c45637bf912c88d31b32a127ad7429 jdk9-b38
 900508346b1c2436d7059fe46a621e6ec3ffdaad jdk9-b39
+74dcd8dbef252938d6deb032aefb46b8f452dd9e jdk9-b40

From a2b0a2413e98a3f31ac10cc6486f0bf706965732 Mon Sep 17 00:00:00 2001
From: Jan Lahoda <jlahoda@openjdk.org>
Date: Wed, 19 Nov 2014 13:46:04 +0100
Subject: [PATCH 117/299] 7196163: Project Coin: Allow effectively final
 variables to be used as resources in try-with-resources

Allowing final variables as operands to try-with-resources; also reviewed by Sergei Pikalev.

Reviewed-by: darcy, mcimadamore, vromero
---
 .../com/sun/tools/javac/code/Kinds.java       |  1 +
 .../com/sun/tools/javac/code/Source.java      |  3 +
 .../com/sun/tools/javac/comp/Attr.java        | 18 ++---
 .../com/sun/tools/javac/comp/Flow.java        | 14 ++++
 .../sun/tools/javac/parser/JavacParser.java   | 38 ++++++++--
 .../tools/javac/resources/compiler.properties | 13 ++++
 .../javac/TryWithResources/BadTwrSyntax.out   |  2 +-
 .../TryWithResources/ResDeclOutsideTry.java   |  5 ++
 .../TryWithResources/ResDeclOutsideTry.out    |  5 +-
 .../TryWithResources/TwrForVariable1.java     | 69 +++++++++++++++++++
 .../TryWithResources/TwrForVariable1.out      |  2 +
 .../TryWithResources/TwrForVariable2.java     | 39 +++++++++++
 .../TryWithResources/TwrForVariable2.out      |  7 ++
 .../TryWithResources/TwrForVariable3.java     | 29 ++++++++
 .../TryWithResources/TwrForVariable3.out      |  4 ++
 .../TryWithResources/TwrForVariable4.java     | 45 ++++++++++++
 .../TryWithResources/TwrForVariable4.out      |  5 ++
 ...yWithResourcesExprEffectivelyFinalVar.java | 40 +++++++++++
 .../TryWithResourcesExprNeedsVar.java         | 37 ++++++++++
 ...nTryWithResourcesNotSupportedInSource.java | 41 +++++++++++
 20 files changed, 398 insertions(+), 19 deletions(-)
 create mode 100644 langtools/test/tools/javac/TryWithResources/TwrForVariable1.java
 create mode 100644 langtools/test/tools/javac/TryWithResources/TwrForVariable1.out
 create mode 100644 langtools/test/tools/javac/TryWithResources/TwrForVariable2.java
 create mode 100644 langtools/test/tools/javac/TryWithResources/TwrForVariable2.out
 create mode 100644 langtools/test/tools/javac/TryWithResources/TwrForVariable3.java
 create mode 100644 langtools/test/tools/javac/TryWithResources/TwrForVariable3.out
 create mode 100644 langtools/test/tools/javac/TryWithResources/TwrForVariable4.java
 create mode 100644 langtools/test/tools/javac/TryWithResources/TwrForVariable4.out
 create mode 100644 langtools/test/tools/javac/diags/examples/TryWithResourcesExprEffectivelyFinalVar.java
 create mode 100644 langtools/test/tools/javac/diags/examples/TryWithResourcesExprNeedsVar.java
 create mode 100644 langtools/test/tools/javac/diags/examples/VarInTryWithResourcesNotSupportedInSource.java

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java
index aa945499141..56222cf70a7 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Kinds.java
@@ -168,6 +168,7 @@ public class Kinds {
         public static final KindSelector MTH = new KindSelector(0x10);
         public static final KindSelector ERR = new KindSelector(0x3f);
         public static final KindSelector POLY = new KindSelector(0x20);
+        public static final KindSelector ASG = new KindSelector(0x44);
 
         //common derived selectors
         public static final KindSelector TYP_PCK = of(TYP, PCK);
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
index 26a1e5df541..5efa7a8efbe 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
@@ -140,6 +140,9 @@ public enum Source {
     public boolean allowTryWithResources() {
         return compareTo(JDK1_7) >= 0;
     }
+    public boolean allowEffectivelyFinalVariablesInTryWithResources() {
+        return compareTo(JDK1_9) >= 0;
+    }
     public boolean allowBinaryLiterals() {
         return compareTo(JDK1_7) >= 0;
     }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
index 1e411fbf856..1fe0b48eb30 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -148,7 +148,7 @@ public class Attr extends JCTree.Visitor {
         identifyLambdaCandidate = options.getBoolean("identifyLambdaCandidate", false);
 
         statInfo = new ResultInfo(KindSelector.NIL, Type.noType);
-        varInfo = new ResultInfo(KindSelector.VAR, Type.noType);
+        varAssignmentInfo = new ResultInfo(KindSelector.ASG, Type.noType);
         unknownExprInfo = new ResultInfo(KindSelector.VAL, Type.noType);
         unknownAnyPolyInfo = new ResultInfo(KindSelector.VAL, Infer.anyPoly);
         unknownTypeInfo = new ResultInfo(KindSelector.TYP, Type.noType);
@@ -498,7 +498,7 @@ public class Attr extends JCTree.Visitor {
     }
 
     final ResultInfo statInfo;
-    final ResultInfo varInfo;
+    final ResultInfo varAssignmentInfo;
     final ResultInfo unknownAnyPolyInfo;
     final ResultInfo unknownExprInfo;
     final ResultInfo unknownTypeInfo;
@@ -1293,7 +1293,7 @@ public class Attr extends JCTree.Visitor {
                         }
                     };
                     ResultInfo twrResult =
-                        new ResultInfo(KindSelector.VAL,
+                        new ResultInfo(KindSelector.VAR,
                                        syms.autoCloseableType,
                                        twrContext);
                     if (resource.hasTag(VARDEF)) {
@@ -2942,7 +2942,7 @@ public class Attr extends JCTree.Visitor {
     }
 
     public void visitAssign(JCAssign tree) {
-        Type owntype = attribTree(tree.lhs, env.dup(tree), varInfo);
+        Type owntype = attribTree(tree.lhs, env.dup(tree), varAssignmentInfo);
         Type capturedType = capture(owntype);
         attribExpr(tree.rhs, env, owntype);
         result = check(tree, capturedType, KindSelector.VAL, resultInfo);
@@ -2950,7 +2950,7 @@ public class Attr extends JCTree.Visitor {
 
     public void visitAssignop(JCAssignOp tree) {
         // Attribute arguments.
-        Type owntype = attribTree(tree.lhs, env, varInfo);
+        Type owntype = attribTree(tree.lhs, env, varAssignmentInfo);
         Type operand = attribExpr(tree.rhs, env);
         // Find operator.
         Symbol operator = tree.operator = rs.resolveBinaryOperator(
@@ -2976,7 +2976,7 @@ public class Attr extends JCTree.Visitor {
     public void visitUnary(JCUnary tree) {
         // Attribute arguments.
         Type argtype = (tree.getTag().isIncOrDecUnaryOp())
-            ? attribTree(tree.arg, env, varInfo)
+            ? attribTree(tree.arg, env, varAssignmentInfo)
             : chk.checkNonVoid(tree.arg.pos(), attribExpr(tree.arg, env));
 
         // Find operator.
@@ -3156,7 +3156,7 @@ public class Attr extends JCTree.Visitor {
 
             // If we are expecting a variable (as opposed to a value), check
             // that the variable is assignable in the current environment.
-            if (pkind() == KindSelector.VAR)
+            if (KindSelector.ASG.subset(pkind()))
                 checkAssignable(tree.pos(), v, null, env);
         }
 
@@ -3255,7 +3255,7 @@ public class Attr extends JCTree.Visitor {
 
             // If we are expecting a variable (as opposed to a value), check
             // that the variable is assignable in the current environment.
-            if (pkind() == KindSelector.VAR)
+            if (KindSelector.ASG.subset(pkind()))
                 checkAssignable(tree.pos(), v, tree.selected, env);
         }
 
@@ -3538,7 +3538,7 @@ public class Attr extends JCTree.Visitor {
                 // Test (4): if symbol is an instance field of a raw type,
                 // which is being assigned to, issue an unchecked warning if
                 // its type changes under erasure.
-                if (resultInfo.pkind == KindSelector.VAR &&
+                if (KindSelector.ASG.subset(pkind()) &&
                     v.owner.kind == TYP &&
                     (v.flags() & STATIC) == 0 &&
                     (site.hasTag(CLASS) || site.hasTag(TYPEVAR))) {
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java
index 092fa8ac234..ab54e1e9c51 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Flow.java
@@ -2562,6 +2562,8 @@ public class Flow {
      * This pass implements the last step of the dataflow analysis, namely
      * the effectively-final analysis check. This checks that every local variable
      * reference from a lambda body/local inner class is either final or effectively final.
+     * Additional this also checks that every variable that is used as an operand to
+     * try-with-resources is final or effectively final.
      * As effectively final variables are marked as such during DA/DU, this pass must run after
      * AssignAnalyzer.
      */
@@ -2690,6 +2692,18 @@ public class Flow {
             }
         }
 
+        public void visitTry(JCTry tree) {
+            for (JCTree resource : tree.resources) {
+                if (!resource.hasTag(VARDEF)) {
+                    Symbol var = TreeInfo.symbol(resource);
+                    if (var != null && (var.flags() & (FINAL | EFFECTIVELY_FINAL)) == 0) {
+                        log.error(resource.pos(), "try.with.resources.expr.effectively.final.var", var);
+                    }
+                }
+            }
+            super.visitTry(tree);
+        }
+
     /**************************************************************************
      * main method
      *************************************************************************/
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
index f502e71bcc2..04bdc11e36e 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
@@ -145,6 +145,8 @@ public class JavacParser implements Parser {
         this.names = fac.names;
         this.source = fac.source;
         this.allowTWR = source.allowTryWithResources();
+        this.allowEffectivelyFinalVariablesInTWR =
+                source.allowEffectivelyFinalVariablesInTryWithResources();
         this.allowDiamond = source.allowDiamond();
         this.allowMulticatch = source.allowMulticatch();
         this.allowStringFolding = fac.options.getBoolean("allowStringFolding", true);
@@ -184,6 +186,10 @@ public class JavacParser implements Parser {
      */
     boolean allowTWR;
 
+    /** Switch: should we allow (effectively) final variables as resources in try-with-resources?
+     */
+    boolean allowEffectivelyFinalVariablesInTWR;
+
     /** Switch: should we fold strings?
      */
     boolean allowStringFolding;
@@ -3003,14 +3009,28 @@ public class JavacParser implements Parser {
         return defs.toList();
     }
 
-    /** Resource = VariableModifiersOpt Type VariableDeclaratorId = Expression
+    /** Resource = VariableModifiersOpt Type VariableDeclaratorId "=" Expression
+     *           | Expression
      */
     protected JCTree resource() {
-        JCModifiers optFinal = optFinal(Flags.FINAL);
-        JCExpression type = parseType();
-        int pos = token.pos;
-        Name ident = ident();
-        return variableDeclaratorRest(pos, optFinal, type, ident, true, null);
+        int startPos = token.pos;
+        if (token.kind == FINAL || token.kind == MONKEYS_AT) {
+            JCModifiers mods = optFinal(Flags.FINAL);
+            JCExpression t = parseType();
+            return variableDeclaratorRest(token.pos, mods, t, ident(), true, null);
+        }
+        JCExpression t = term(EXPR | TYPE);
+        if ((lastmode & TYPE) != 0 && LAX_IDENTIFIER.accepts(token.kind)) {
+            JCModifiers mods = toP(F.at(startPos).Modifiers(Flags.FINAL));
+            return variableDeclaratorRest(token.pos, mods, t, ident(), true, null);
+        } else {
+            checkVariableInTryWithResources(startPos);
+            if (!t.hasTag(IDENT) && !t.hasTag(SELECT)) {
+                log.error(t.pos(), "try.with.resources.expr.needs.var");
+            }
+
+            return t;
+        }
     }
 
     /** CompilationUnit = [ { "@" Annotation } PACKAGE Qualident ";"] {ImportDeclaration} {TypeDeclaration}
@@ -3933,6 +3953,12 @@ public class JavacParser implements Parser {
             allowTWR = true;
         }
     }
+    void checkVariableInTryWithResources(int startPos) {
+        if (!allowEffectivelyFinalVariablesInTWR) {
+            error(startPos, "var.in.try.with.resources.not.supported.in.source", source.name);
+            allowEffectivelyFinalVariablesInTWR = true;
+        }
+    }
     void checkLambda() {
         if (!allowLambda) {
             log.error(token.pos, "lambda.not.supported.in.source", source.name);
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
index 833be037069..23b6a09d13c 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
@@ -252,6 +252,14 @@ compiler.err.cant.assign.val.to.final.var=\
 compiler.err.cant.ref.non.effectively.final.var=\
     local variables referenced from {1} must be final or effectively final
 
+compiler.err.try.with.resources.expr.needs.var=\
+    the try-with-resources resource must either be a variable declaration or an expression denoting \
+a reference to a final or effectively final variable
+
+# 0: symbol
+compiler.err.try.with.resources.expr.effectively.final.var=\
+    variable {0} used as a try-with-resources resource neither final nor effectively final
+
 
 compiler.misc.lambda=\
     a lambda expression
@@ -2262,6 +2270,11 @@ compiler.err.try.with.resources.not.supported.in.source=\
     try-with-resources is not supported in -source {0}\n\
     (use -source 7 or higher to enable try-with-resources)
 
+# 0: string
+compiler.err.var.in.try.with.resources.not.supported.in.source=\
+    variables in try-with-resources not supported in -source {0}\n\
+    (use -source 9 or higher to enable variables in try-with-resources)
+
 compiler.warn.underscore.as.identifier=\
     ''_'' used as an identifier\n\
     (use of ''_'' as an identifier might not be supported in releases after Java SE 8)
diff --git a/langtools/test/tools/javac/TryWithResources/BadTwrSyntax.out b/langtools/test/tools/javac/TryWithResources/BadTwrSyntax.out
index 6733c8dce20..df925e04eb9 100644
--- a/langtools/test/tools/javac/TryWithResources/BadTwrSyntax.out
+++ b/langtools/test/tools/javac/TryWithResources/BadTwrSyntax.out
@@ -1,2 +1,2 @@
-BadTwrSyntax.java:14:43: compiler.err.illegal.start.of.type
+BadTwrSyntax.java:14:43: compiler.err.illegal.start.of.expr
 1 error
diff --git a/langtools/test/tools/javac/TryWithResources/ResDeclOutsideTry.java b/langtools/test/tools/javac/TryWithResources/ResDeclOutsideTry.java
index 2bd54f13ea9..58861808830 100644
--- a/langtools/test/tools/javac/TryWithResources/ResDeclOutsideTry.java
+++ b/langtools/test/tools/javac/TryWithResources/ResDeclOutsideTry.java
@@ -13,6 +13,11 @@ public class ResDeclOutsideTry implements AutoCloseable {
     String test1() {
         try (tr1 = new ResDeclOutsideTry(); tr2;) {
         }
+        return null;
+    }
+
+    @Override
+    public void close() throws Exception {
     }
 }
 
diff --git a/langtools/test/tools/javac/TryWithResources/ResDeclOutsideTry.out b/langtools/test/tools/javac/TryWithResources/ResDeclOutsideTry.out
index c2451a98c75..9be845d21ba 100644
--- a/langtools/test/tools/javac/TryWithResources/ResDeclOutsideTry.out
+++ b/langtools/test/tools/javac/TryWithResources/ResDeclOutsideTry.out
@@ -1,3 +1,2 @@
-ResDeclOutsideTry.java:14:17: compiler.err.expected: token.identifier
-ResDeclOutsideTry.java:14:48: compiler.err.expected: token.identifier
-2 errors
+ResDeclOutsideTry.java:14:18: compiler.err.try.with.resources.expr.needs.var
+1 error
diff --git a/langtools/test/tools/javac/TryWithResources/TwrForVariable1.java b/langtools/test/tools/javac/TryWithResources/TwrForVariable1.java
new file mode 100644
index 00000000000..6e5d3fec4ba
--- /dev/null
+++ b/langtools/test/tools/javac/TryWithResources/TwrForVariable1.java
@@ -0,0 +1,69 @@
+/* @test /nodynamiccopyright/
+ * @bug 7196163
+ * @summary Verify that variables can be used as operands to try-with-resources
+ * @compile/fail/ref=TwrForVariable1.out -source 8 -XDrawDiagnostics -Xlint:-options TwrForVariable1.java
+ * @compile TwrForVariable1.java
+ * @run main TwrForVariable1
+ */
+public class TwrForVariable1 implements AutoCloseable {
+    private static int closeCount = 0;
+    public static void main(String... args) {
+        TwrForVariable1 v = new TwrForVariable1();
+
+        try (v) {
+            assertCloseCount(0);
+        }
+        try (/**@deprecated*/v) {
+            assertCloseCount(1);
+        }
+        try (v.finalWrapper.finalField) {
+            assertCloseCount(2);
+        } catch (Exception ex) {
+        }
+        try (new TwrForVariable1() { }.finalWrapper.finalField) {
+            assertCloseCount(3);
+        } catch (Exception ex) {
+        }
+        try ((args.length > 0 ? v : new TwrForVariable1()).finalWrapper.finalField) {
+            assertCloseCount(4);
+        } catch (Exception ex) {
+        }
+        try {
+            throw new CloseableException();
+        } catch (CloseableException ex) {
+            try (ex) {
+                assertCloseCount(5);
+            }
+        }
+
+        assertCloseCount(6);
+    }
+
+    static void assertCloseCount(int expectedCloseCount) {
+        if (closeCount != expectedCloseCount)
+            throw new RuntimeException("bad closeCount: " + closeCount +
+                                       "; expected: " + expectedCloseCount);
+    }
+
+    public void close() {
+        closeCount++;
+    }
+
+    final FinalWrapper finalWrapper = new FinalWrapper();
+
+    static class FinalWrapper {
+        public final AutoCloseable finalField = new AutoCloseable() {
+            @Override
+            public void close() throws Exception {
+                closeCount++;
+            }
+        };
+    }
+
+    static class CloseableException extends Exception implements AutoCloseable {
+        @Override
+        public void close() {
+            closeCount++;
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/TryWithResources/TwrForVariable1.out b/langtools/test/tools/javac/TryWithResources/TwrForVariable1.out
new file mode 100644
index 00000000000..d6a8bf8b250
--- /dev/null
+++ b/langtools/test/tools/javac/TryWithResources/TwrForVariable1.out
@@ -0,0 +1,2 @@
+TwrForVariable1.java:13:14: compiler.err.var.in.try.with.resources.not.supported.in.source: 1.8
+1 error
diff --git a/langtools/test/tools/javac/TryWithResources/TwrForVariable2.java b/langtools/test/tools/javac/TryWithResources/TwrForVariable2.java
new file mode 100644
index 00000000000..70ca96b9193
--- /dev/null
+++ b/langtools/test/tools/javac/TryWithResources/TwrForVariable2.java
@@ -0,0 +1,39 @@
+/* @test /nodynamiccopyright/
+ * @bug 7196163
+ * @summary Verify that an improper combination of modifiers and variable is rejected
+ *          in an operand to try-with-resources
+ * @compile/fail/ref=TwrForVariable2.out -XDrawDiagnostics -Xlint:-options TwrForVariable2.java
+ */
+public class TwrForVariable2 implements AutoCloseable {
+    public static void main(String... args) {
+        TwrForVariable2 v = new TwrForVariable2();
+        TwrForVariable3[] v2 = new TwrForVariable3[1];
+
+        try (final v) {
+            fail("no modifiers before variables");
+        }
+        try (@Deprecated v) {
+            fail("no annotations before variables");
+        }
+        try (v;;) {
+            fail("illegal double semicolon");
+        }
+        try ((v)) {
+            fail("parentheses not allowed");
+        }
+        try (v2[0]) {
+            fail("array access not allowed");
+        }
+        try (args.length == 0 ? v : v) {
+            fail("general expressions not allowed");
+        }
+    }
+
+    static void fail(String reason) {
+        throw new RuntimeException(reason);
+    }
+
+    public void close() {
+    }
+
+}
diff --git a/langtools/test/tools/javac/TryWithResources/TwrForVariable2.out b/langtools/test/tools/javac/TryWithResources/TwrForVariable2.out
new file mode 100644
index 00000000000..491cb5e3cbb
--- /dev/null
+++ b/langtools/test/tools/javac/TryWithResources/TwrForVariable2.out
@@ -0,0 +1,7 @@
+TwrForVariable2.java:12:21: compiler.err.expected: token.identifier
+TwrForVariable2.java:15:27: compiler.err.expected: token.identifier
+TwrForVariable2.java:18:16: compiler.err.illegal.start.of.expr
+TwrForVariable2.java:21:14: compiler.err.try.with.resources.expr.needs.var
+TwrForVariable2.java:24:16: compiler.err.try.with.resources.expr.needs.var
+TwrForVariable2.java:27:31: compiler.err.try.with.resources.expr.needs.var
+6 errors
diff --git a/langtools/test/tools/javac/TryWithResources/TwrForVariable3.java b/langtools/test/tools/javac/TryWithResources/TwrForVariable3.java
new file mode 100644
index 00000000000..5f57bb370e8
--- /dev/null
+++ b/langtools/test/tools/javac/TryWithResources/TwrForVariable3.java
@@ -0,0 +1,29 @@
+/* @test /nodynamiccopyright/
+ * @bug 7196163
+ * @summary Verify that improper expressions used as an operand to try-with-resources are rejected.
+ * @compile/fail/ref=TwrForVariable3.out -XDrawDiagnostics -Xlint:-options TwrForVariable3.java
+ */
+public class TwrForVariable3 implements AutoCloseable {
+    public static void main(String... args) {
+        TwrForVariable3 v1 = new TwrForVariable3();
+        Object v2 = new Object();
+
+        try (v2) {
+            fail("no an AutoCloseable");
+        }
+        try (java.lang.Object) {
+            fail("not a variable access");
+        }
+        try (java.lang) {
+            fail("not a variable access");
+        }
+    }
+
+    static void fail(String reason) {
+        throw new RuntimeException(reason);
+    }
+
+    public void close() {
+    }
+
+}
diff --git a/langtools/test/tools/javac/TryWithResources/TwrForVariable3.out b/langtools/test/tools/javac/TryWithResources/TwrForVariable3.out
new file mode 100644
index 00000000000..248aac132ed
--- /dev/null
+++ b/langtools/test/tools/javac/TryWithResources/TwrForVariable3.out
@@ -0,0 +1,4 @@
+TwrForVariable3.java:11:14: compiler.err.prob.found.req: (compiler.misc.try.not.applicable.to.type: (compiler.misc.inconvertible.types: java.lang.Object, java.lang.AutoCloseable))
+TwrForVariable3.java:14:18: compiler.err.cant.resolve.location: kindname.class, lang, , , (compiler.misc.location: kindname.package, java, null)
+TwrForVariable3.java:17:14: compiler.err.cant.resolve.location: kindname.variable, java, , , (compiler.misc.location: kindname.class, TwrForVariable3, null)
+3 errors
diff --git a/langtools/test/tools/javac/TryWithResources/TwrForVariable4.java b/langtools/test/tools/javac/TryWithResources/TwrForVariable4.java
new file mode 100644
index 00000000000..d8437a0d295
--- /dev/null
+++ b/langtools/test/tools/javac/TryWithResources/TwrForVariable4.java
@@ -0,0 +1,45 @@
+/* @test /nodynamiccopyright/
+ * @bug 7196163
+ * @summary Verify that variable used as an operand to try-with-resources is rejected if it is not
+ *          definitelly assigned before use and or not final or effectivelly final.
+ * @compile/fail/ref=TwrForVariable4.out -XDrawDiagnostics -Xlint:-options TwrForVariable4.java
+ */
+public class TwrForVariable4 implements AutoCloseable {
+    public static void main(String... args) {
+        TwrForVariable4 uninitialized;
+
+        try (uninitialized) {
+            fail("must be initialized before use");
+        }
+        uninitialized = new TwrForVariable4();
+
+        TwrForVariable4 notEffectivellyFinal1 = new TwrForVariable4();
+
+        notEffectivellyFinal1 = new TwrForVariable4();
+
+        try (notEffectivellyFinal1) {
+            fail("not effectivelly final");
+        }
+
+        TwrForVariable4 notEffectivellyFinal2 = new TwrForVariable4();
+
+        try (notEffectivellyFinal2) {
+            notEffectivellyFinal2 = new TwrForVariable4();
+            fail("not effectivelly final");
+        }
+
+        try (notFinal) {
+            fail("not final");
+        }
+    }
+
+    static TwrForVariable4 notFinal = new TwrForVariable4();
+
+    static void fail(String reason) {
+        throw new RuntimeException(reason);
+    }
+
+    public void close() {
+    }
+
+}
diff --git a/langtools/test/tools/javac/TryWithResources/TwrForVariable4.out b/langtools/test/tools/javac/TryWithResources/TwrForVariable4.out
new file mode 100644
index 00000000000..1ab521459c9
--- /dev/null
+++ b/langtools/test/tools/javac/TryWithResources/TwrForVariable4.out
@@ -0,0 +1,5 @@
+TwrForVariable4.java:11:14: compiler.err.var.might.not.have.been.initialized: uninitialized
+TwrForVariable4.java:20:14: compiler.err.try.with.resources.expr.effectively.final.var: notEffectivellyFinal1
+TwrForVariable4.java:26:14: compiler.err.try.with.resources.expr.effectively.final.var: notEffectivellyFinal2
+TwrForVariable4.java:31:14: compiler.err.try.with.resources.expr.effectively.final.var: notFinal
+4 errors
diff --git a/langtools/test/tools/javac/diags/examples/TryWithResourcesExprEffectivelyFinalVar.java b/langtools/test/tools/javac/diags/examples/TryWithResourcesExprEffectivelyFinalVar.java
new file mode 100644
index 00000000000..21b17767c69
--- /dev/null
+++ b/langtools/test/tools/javac/diags/examples/TryWithResourcesExprEffectivelyFinalVar.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// key: compiler.err.try.with.resources.expr.effectively.final.var
+
+class TryWithResourcesExprEffectivelyFinalVar {
+    void m() {
+        CloseableImpl ac = new CloseableImpl();
+
+        try (ac) {
+            ac = null;
+        }
+    }
+}
+
+class CloseableImpl implements AutoCloseable {
+    @Override
+    public void close() {
+    }
+}
diff --git a/langtools/test/tools/javac/diags/examples/TryWithResourcesExprNeedsVar.java b/langtools/test/tools/javac/diags/examples/TryWithResourcesExprNeedsVar.java
new file mode 100644
index 00000000000..67e3121432e
--- /dev/null
+++ b/langtools/test/tools/javac/diags/examples/TryWithResourcesExprNeedsVar.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// key: compiler.err.try.with.resources.expr.needs.var
+
+class TryWithResourcesExprNeedsVar {
+    void m() {
+        try (new CloseableImpl()) {
+        }
+    }
+}
+
+class CloseableImpl implements AutoCloseable {
+    @Override
+    public void close() throws Exception {
+    }
+}
diff --git a/langtools/test/tools/javac/diags/examples/VarInTryWithResourcesNotSupportedInSource.java b/langtools/test/tools/javac/diags/examples/VarInTryWithResourcesNotSupportedInSource.java
new file mode 100644
index 00000000000..1b4b3f10a80
--- /dev/null
+++ b/langtools/test/tools/javac/diags/examples/VarInTryWithResourcesNotSupportedInSource.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+// key: compiler.err.var.in.try.with.resources.not.supported.in.source
+// key: compiler.warn.source.no.bootclasspath
+// options: -source 8
+
+class VarInTryWithResourcesNotSupportedInSource {
+    void m() {
+        AutoCloseable ac = new CloseableImpl();
+
+        try (ac) {
+        }
+    }
+}
+
+class CloseableImpl implements AutoCloseable {
+    @Override
+    public void close() throws Exception {
+    }
+}

From b83ddbef42c23ca5f0782a9581639c0e915fa73b Mon Sep 17 00:00:00 2001
From: Evgeniya Stepanova <eistepan@openjdk.org>
Date: Wed, 19 Nov 2014 17:43:19 +0300
Subject: [PATCH 118/299] 8062537: [TESTBUG] Conflicting GC combinations in
 hotspot tests

Reviewed-by: brutisso
---
 .../regalloc/C1ObjectSpillInLogicOp.java        |  3 ++-
 hotspot/test/gc/6581734/Test6581734.java        |  3 ++-
 hotspot/test/gc/TestSystemGC.java               |  3 ++-
 .../arguments/TestAlignmentToUseLargePages.java |  3 ++-
 .../test/gc/arguments/TestG1HeapRegionSize.java | 17 ++++++-----------
 .../concurrentMarkSweep/DisableResizePLAB.java  |  1 +
 hotspot/test/gc/defnew/HeapChangeLogging.java   |  6 ++----
 hotspot/test/gc/g1/TestHumongousShrinkHeap.java |  1 +
 hotspot/test/gc/g1/TestRegionAlignment.java     |  3 ++-
 hotspot/test/gc/g1/TestShrinkAuxiliaryData.java | 13 +------------
 .../test/gc/g1/TestShrinkAuxiliaryData05.java   |  1 +
 .../test/gc/g1/TestShrinkAuxiliaryData10.java   |  1 +
 .../test/gc/g1/TestShrinkAuxiliaryData15.java   |  1 +
 .../test/gc/g1/TestShrinkAuxiliaryData20.java   |  1 +
 .../test/gc/g1/TestShrinkAuxiliaryData25.java   |  1 +
 .../test/gc/g1/TestShrinkAuxiliaryData30.java   |  1 +
 hotspot/test/gc/g1/TestShrinkToOneRegion.java   |  3 ++-
 .../gc/metaspace/G1AddMetaspaceDependency.java  |  3 ++-
 .../gc/metaspace/TestMetaspacePerfCounters.java |  3 ++-
 .../TestPerfCountersAndMemoryPools.java         |  3 ++-
 .../gc/parallelScavenge/TestDynShrinkHeap.java  |  1 +
 21 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java b/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java
index 17571820b3e..f8fc1879644 100644
--- a/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java
+++ b/hotspot/test/compiler/regalloc/C1ObjectSpillInLogicOp.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /*
  * @test
  * @bug 8027751
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @summary C1 crashes generating G1 post-barrier in Unsafe.getAndSetObject() intrinsic because of the new value spill
  * @run main/othervm -XX:+UseG1GC C1ObjectSpillInLogicOp
  *
diff --git a/hotspot/test/gc/6581734/Test6581734.java b/hotspot/test/gc/6581734/Test6581734.java
index 143340dc080..9ec55c85732 100644
--- a/hotspot/test/gc/6581734/Test6581734.java
+++ b/hotspot/test/gc/6581734/Test6581734.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /*
  * @test Test6581734.java
  * @bug 6581734
+ * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null"
  * @summary CMS Old Gen's collection usage is zero after GC which is incorrect
  * @run main/othervm -Xmx512m -verbose:gc -XX:+UseConcMarkSweepGC Test6581734
  *
diff --git a/hotspot/test/gc/TestSystemGC.java b/hotspot/test/gc/TestSystemGC.java
index b882f9fc72d..d0346595137 100644
--- a/hotspot/test/gc/TestSystemGC.java
+++ b/hotspot/test/gc/TestSystemGC.java
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /*
  * @test TestSystemGC
  * @key gc
+ * @requires vm.gc=="null"
  * @summary Runs System.gc() with different flags.
  * @run main/othervm TestSystemGC
  * @run main/othervm -XX:+UseSerialGC TestSystemGC
diff --git a/hotspot/test/gc/arguments/TestAlignmentToUseLargePages.java b/hotspot/test/gc/arguments/TestAlignmentToUseLargePages.java
index 125c1aabd51..45d447840a1 100644
--- a/hotspot/test/gc/arguments/TestAlignmentToUseLargePages.java
+++ b/hotspot/test/gc/arguments/TestAlignmentToUseLargePages.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,6 +28,7 @@
  * @bug 8024396
  * @key gc
  * @key regression
+ * @requires vm.gc=="null"
  * @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
  * @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:-UseParallelOldGC -XX:-UseLargePages TestAlignmentToUseLargePages
  * @run main/othervm -Xms7M -Xmx9M -XX:+UseParallelGC -XX:+UseParallelOldGC -XX:+UseLargePages TestAlignmentToUseLargePages
diff --git a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java
index 193dacf9897..b55dc8b32d6 100644
--- a/hotspot/test/gc/arguments/TestG1HeapRegionSize.java
+++ b/hotspot/test/gc/arguments/TestG1HeapRegionSize.java
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -25,11 +25,12 @@
  * @test TestG1HeapRegionSize
  * @key gc
  * @bug 8021879
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @summary Verify that the flag G1HeapRegionSize is updated properly
  * @run main/othervm -Xmx64m TestG1HeapRegionSize 1048576
- * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m TestG1HeapRegionSize 2097152
- * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m TestG1HeapRegionSize 2097152
- * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m TestG1HeapRegionSize 33554432
+ * @run main/othervm -XX:G1HeapRegionSize=2m -Xmx64m -XX:+UseG1GC TestG1HeapRegionSize 2097152
+ * @run main/othervm -XX:G1HeapRegionSize=3m -Xmx64m -XX:+UseG1GC TestG1HeapRegionSize 2097152
+ * @run main/othervm -XX:G1HeapRegionSize=64m -Xmx256m -XX:+UseG1GC TestG1HeapRegionSize 33554432
  */
 
 import sun.management.ManagementFactoryHelper;
@@ -41,14 +42,8 @@ public class TestG1HeapRegionSize {
   public static void main(String[] args) {
     HotSpotDiagnosticMXBean diagnostic = ManagementFactoryHelper.getDiagnosticMXBean();
 
-    VMOption option = diagnostic.getVMOption("UseG1GC");
-    if (option.getValue().equals("false")) {
-      System.out.println("Skipping this test. It is only a G1 test.");
-      return;
-    }
-
     String expectedValue = getExpectedValue(args);
-    option = diagnostic.getVMOption("G1HeapRegionSize");
+    VMOption option = diagnostic.getVMOption("G1HeapRegionSize");
     if (!expectedValue.equals(option.getValue())) {
       throw new RuntimeException("Wrong value for G1HeapRegionSize. Expected " + expectedValue + " but got " + option.getValue());
     }
diff --git a/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java b/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java
index c504d069a72..be8ac5d958c 100644
--- a/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java
+++ b/hotspot/test/gc/concurrentMarkSweep/DisableResizePLAB.java
@@ -26,6 +26,7 @@
  * @key gc
  * @bug 8060467
  * @author filipp.zhinkin@oracle.com, john.coomes@oracle.com
+ * @requires vm.gc=="ConcMarkSweep" | vm.gc=="null"
  * @summary Run CMS with PLAB resizing disabled and a small OldPLABSize
  * @run main/othervm -XX:+UseConcMarkSweepGC -XX:-ResizePLAB -XX:OldPLABSize=1k -Xmx256m -XX:+PrintGCDetails DisableResizePLAB
  */
diff --git a/hotspot/test/gc/defnew/HeapChangeLogging.java b/hotspot/test/gc/defnew/HeapChangeLogging.java
index 5349e691b76..e2be82a0e4d 100644
--- a/hotspot/test/gc/defnew/HeapChangeLogging.java
+++ b/hotspot/test/gc/defnew/HeapChangeLogging.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,8 +28,6 @@
  * @build HeapChangeLogging
  * @summary Allocate to get a promotion failure and verify that that heap change logging is present.
  * @run main HeapChangeLogging
- *
- * Test the output of G1SummarizeRSetStats in conjunction with G1SummarizeRSetStatsPeriod.
  */
 
 import java.util.regex.Matcher;
@@ -78,4 +76,4 @@ class Entry {
     payload = new byte[payloadSize];
     this.previous = previous;
   }
-}
\ No newline at end of file
+}
diff --git a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java
index 97d60546b25..87f805d48cf 100644
--- a/hotspot/test/gc/g1/TestHumongousShrinkHeap.java
+++ b/hotspot/test/gc/g1/TestHumongousShrinkHeap.java
@@ -24,6 +24,7 @@
 /**
  * @test TestHumongousShrinkHeap
  * @bug 8036025 8056043
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @summary Verify that heap shrinks after GC in the presence of fragmentation due to humongous objects
  * @library /testlibrary
  * @run main/othervm -XX:MinHeapFreeRatio=10 -XX:MaxHeapFreeRatio=12 -XX:+UseG1GC -XX:G1HeapRegionSize=1M -verbose:gc TestHumongousShrinkHeap
diff --git a/hotspot/test/gc/g1/TestRegionAlignment.java b/hotspot/test/gc/g1/TestRegionAlignment.java
index 08cf02e54c1..7c7600f8be1 100644
--- a/hotspot/test/gc/g1/TestRegionAlignment.java
+++ b/hotspot/test/gc/g1/TestRegionAlignment.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /*
  * @test TestRegionAlignment.java
  * @bug 8013791
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @summary Make sure that G1 ergonomics pick a heap size that is aligned with the region size
  * @run main/othervm -XX:+UseG1GC -XX:G1HeapRegionSize=32m -XX:MaxRAM=555m TestRegionAlignment
  *
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
index 6a268ae8c46..8ee3aebe20f 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData.java
@@ -69,9 +69,7 @@ public class TestShrinkAuxiliaryData {
         printTestInfo(maxCacheSize);
 
         vmOpts.add("-XX:G1ConcRSLogCacheSize=" + RSetCacheSize);
-
-        vmOpts.addAll(Arrays.asList(Utils.getFilteredTestJavaOpts(
-                ShrinkAuxiliaryDataTest.prohibitedVmOptions)));
+        vmOpts.addAll(Arrays.asList(Utils.getTestJavaOpts()));
 
         // for 32 bits ObjectAlignmentInBytes is not a option
         if (Platform.is32bit()) {
@@ -272,14 +270,5 @@ public class TestShrinkAuxiliaryData {
         private static final int NUM_OBJECTS_PER_REGION = 10;
         private static final int NUM_LINKS = 20; // how many links create for each object
 
-        private static final String[] prohibitedVmOptions = {
-            // remove this when @requires option will be on duty
-            "-XX:\\+UseParallelGC",
-            "-XX:\\+UseSerialGC",
-            "-XX:\\+UseConcMarkSweepGC",
-            "-XX:\\+UseParallelOldGC",
-            "-XX:\\+UseParNewGC",
-            "-Xconcgc"
-        };
     }
 }
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java
index 910aad696ac..f7ff497cb9b 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData05.java
@@ -26,6 +26,7 @@
  * @bug 8038423
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @library /testlibrary /testlibrary/whitebox
  * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData05
  * @run driver/timeout=720 TestShrinkAuxiliaryData05
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java
index 5dec96d6369..0f1cf9b07e9 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData10.java
@@ -26,6 +26,7 @@
  * @bug 8038423
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @library /testlibrary /testlibrary/whitebox
  * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData10
  * @run driver/timeout=720 TestShrinkAuxiliaryData10
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java
index 30455e4f43c..33a0ecb94dc 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData15.java
@@ -26,6 +26,7 @@
  * @bug 8038423
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @library /testlibrary /testlibrary/whitebox
  * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData15
  * @run driver/timeout=720 TestShrinkAuxiliaryData15
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java
index bdc3996ec18..236a4f1ca6d 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData20.java
@@ -26,6 +26,7 @@
  * @bug 8038423
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @library /testlibrary /testlibrary/whitebox
  * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData20
  * @run driver/timeout=720 TestShrinkAuxiliaryData20
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java
index 4429ee5033f..7defc9522f3 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData25.java
@@ -26,6 +26,7 @@
  * @bug 8038423
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @library /testlibrary /testlibrary/whitebox
  * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData25
  * @run driver/timeout=720 TestShrinkAuxiliaryData25
diff --git a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java
index 2ad40ccdf2b..b51ec8449d8 100644
--- a/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java
+++ b/hotspot/test/gc/g1/TestShrinkAuxiliaryData30.java
@@ -26,6 +26,7 @@
  * @bug 8038423
  * @summary Checks that decommitment occurs for JVM with different
  * G1ConcRSLogCacheSize and ObjectAlignmentInBytes options values
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @library /testlibrary /testlibrary/whitebox
  * @build TestShrinkAuxiliaryData TestShrinkAuxiliaryData30
  * @run driver/timeout=720 TestShrinkAuxiliaryData30
diff --git a/hotspot/test/gc/g1/TestShrinkToOneRegion.java b/hotspot/test/gc/g1/TestShrinkToOneRegion.java
index 100741b6902..0821223c6c0 100644
--- a/hotspot/test/gc/g1/TestShrinkToOneRegion.java
+++ b/hotspot/test/gc/g1/TestShrinkToOneRegion.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /*
  * @test TestShrinkToOneRegion.java
  * @bug 8013872
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @summary Shrinking the heap down to one region used to hit an assert
  * @run main/othervm -XX:+UseG1GC -XX:G1HeapRegionSize=32m -Xmx256m TestShrinkToOneRegion
  *
diff --git a/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java b/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java
index b8e8b1ad598..5c6256290b7 100644
--- a/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java
+++ b/hotspot/test/gc/metaspace/G1AddMetaspaceDependency.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /*
  * @test G1AddMetaspaceDependency
  * @bug 8010196
+ * @requires vm.gc=="G1" | vm.gc=="null"
  * @summary Checks that we don't get locking problems when adding metaspace dependencies with the G1 update buffer monitor
  * @run main/othervm -XX:+UseG1GC -XX:G1UpdateBufferSize=1 G1AddMetaspaceDependency
  */
diff --git a/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java b/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java
index 974066cba56..a02f5b45f58 100644
--- a/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java
+++ b/hotspot/test/gc/metaspace/TestMetaspacePerfCounters.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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
@@ -29,6 +29,7 @@ import static com.oracle.java.testlibrary.Asserts.*;
 
 /* @test TestMetaspacePerfCounters
  * @bug 8014659
+ * @requires vm.gc=="null"
  * @library /testlibrary
  * @summary Tests that performance counters for metaspace and compressed class
  *          space exists and works.
diff --git a/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java b/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java
index ac708bf7701..4aaa8ac174b 100644
--- a/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java
+++ b/hotspot/test/gc/metaspace/TestPerfCountersAndMemoryPools.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@ import static com.oracle.java.testlibrary.Asserts.*;
 /* @test TestPerfCountersAndMemoryPools
  * @bug 8023476
  * @library /testlibrary
+ * @requires vm.gc=="Serial" | vm.gc=="null"
  * @summary Tests that a MemoryPoolMXBeans and PerfCounters for metaspace
  *          report the same data.
  * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:-UseCompressedOops -XX:-UseCompressedKlassPointers -XX:+UseSerialGC -XX:+UsePerfData -Xint TestPerfCountersAndMemoryPools
diff --git a/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java b/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java
index 336f7b9939e..d029b45e0bb 100644
--- a/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java
+++ b/hotspot/test/gc/parallelScavenge/TestDynShrinkHeap.java
@@ -25,6 +25,7 @@
  * @ignore 8019361
  * @test TestDynShrinkHeap
  * @bug 8016479
+ * @requires vm.gc=="Parallel" | vm.gc=="null"
  * @summary Verify that the heap shrinks after full GC according to the current values of the Min/MaxHeapFreeRatio flags
  * @library /testlibrary
  * @run main/othervm -XX:+UseAdaptiveSizePolicyWithSystemGC -XX:+UseParallelGC -XX:MinHeapFreeRatio=0 -XX:MaxHeapFreeRatio=100 -Xmx1g -verbose:gc TestDynShrinkHeap

From 71a33bf0641e4609dd5198e786f4ab95a9852fe2 Mon Sep 17 00:00:00 2001
From: Evgeniya Stepanova <eistepan@openjdk.org>
Date: Wed, 19 Nov 2014 17:51:06 +0300
Subject: [PATCH 119/299] 8062536: [TESTBUG] Conflicting GC combinations in jdk
 tests

Reviewed-by: brutisso, dholmes
---
 .../java/lang/management/MemoryMXBean/LowMemoryTest2.sh    | 4 ++--
 .../MemoryMXBean/MemoryManagementConcMarkSweepGC.sh        | 4 ++--
 .../management/MemoryMXBean/MemoryManagementParallelGC.sh  | 4 ++--
 .../management/MemoryMXBean/MemoryManagementSerialGC.sh    | 4 ++--
 .../java/lang/management/MemoryMXBean/MemoryTestAllGC.sh   | 6 ++----
 jdk/test/java/lang/management/MemoryMXBean/PendingAllGC.sh | 4 ++--
 .../lang/management/RuntimeMXBean/TestInputArgument.sh     | 7 +++----
 jdk/test/java/lang/ref/EnqueuePollRace.java                | 4 ++--
 jdk/test/sun/tools/jps/JpsHelper.java                      | 2 +-
 9 files changed, 18 insertions(+), 21 deletions(-)

diff --git a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh
index d05a75958ee..b584c085b46 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh
+++ b/jdk/test/java/lang/management/MemoryMXBean/LowMemoryTest2.sh
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 # @test
 # @bug     4982128
 # @summary Test low memory detection of non-heap memory pool
-#
+# @requires vm.gc=="null"
 # @run build LowMemoryTest2 MemoryUtil
 # @run shell/timeout=600 LowMemoryTest2.sh
 #
diff --git a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh
index 8db78142ef6..a80f2c417f1 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh
+++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementConcMarkSweepGC.sh
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 # @bug     4530538
 # @summary Run MemoryManagement test with concurrent mark sweep GC
 # @author  Mandy Chung
-#
+# @requires vm.gc=="ConcMarkSweep" | vm.gc=="null"
 # @run build MemoryManagement
 # @run shell/timeout=600 MemoryManagementConcMarkSweepGC.sh
 #
diff --git a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementParallelGC.sh b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementParallelGC.sh
index 0435302e8e9..f315c96eb31 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementParallelGC.sh
+++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementParallelGC.sh
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 # @bug     4530538
 # @summary Run MemoryManagement test with parallel GC
 # @author  Mandy Chung
-#
+# @requires vm.gc=="Parallel" | vm.gc=="null"
 # @run build MemoryManagement
 # @run shell/timeout=600 MemoryManagementParallelGC.sh
 #
diff --git a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementSerialGC.sh b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementSerialGC.sh
index e7ea40a1e8f..043323071d7 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementSerialGC.sh
+++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryManagementSerialGC.sh
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 # @bug     4530538
 # @summary Run MemoryManagement test with serial GC
 # @author  Mandy Chung
-#
+# @requires vm.gc=="Serial" | vm.gc=="null"
 # @run build MemoryManagement
 # @run shell/timeout=600 MemoryManagementSerialGC.sh
 #
diff --git a/jdk/test/java/lang/management/MemoryMXBean/MemoryTestAllGC.sh b/jdk/test/java/lang/management/MemoryMXBean/MemoryTestAllGC.sh
index be0827ae32a..6dbbc1659d9 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/MemoryTestAllGC.sh
+++ b/jdk/test/java/lang/management/MemoryMXBean/MemoryTestAllGC.sh
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 # @bug     4530538
 # @summary 
 # @author  Mandy Chung
-#
+# @requires vm.gc=="Parallel" | vm.gc=="null"
 # @run compile MemoryTest.java
 # @run shell MemoryTestAllGC.sh
 #
@@ -52,7 +52,5 @@ runOne MemoryTest 2
 # Test MemoryTest with parallel scavenger collector
 runOne -XX:+UseParallelGC MemoryTest 2
 
-# Test MemoryTest with concurrent collector
-#runOne -XX:+UseConcMarkSweepGC MemoryTest 3
 
 exit 0
diff --git a/jdk/test/java/lang/management/MemoryMXBean/PendingAllGC.sh b/jdk/test/java/lang/management/MemoryMXBean/PendingAllGC.sh
index edf18b3ffa0..2a1ccc3be7e 100644
--- a/jdk/test/java/lang/management/MemoryMXBean/PendingAllGC.sh
+++ b/jdk/test/java/lang/management/MemoryMXBean/PendingAllGC.sh
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 # @bug     4530538
 # @summary 
 # @author  Mandy Chung
-#
+# @requires vm.gc=="null"
 # @run compile Pending.java
 # @run shell PendingAllGC.sh
 #
diff --git a/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh b/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh
index 5c57e4878e5..6c135415875 100644
--- a/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh
+++ b/jdk/test/java/lang/management/RuntimeMXBean/TestInputArgument.sh
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
 # @bug     4530538
 # @summary 
 # @author  Mandy Chung
-#
 # @run compile InputArgument.java
 # @run shell TestInputArgument.sh
 #
@@ -48,8 +47,8 @@ runOne()
 
 runOne InputArgument 
 
-runOne -XX:+UseParallelGC -XX:+PrintGCDetails InputArgument -XX:+PrintGCDetails
-runOne -XX:+UseParallelGC -XX:+PrintGCDetails InputArgument -XX:+UseParallelGC
+runOne -XX:+UseFastJNIAccessors -XX:+PrintGCDetails InputArgument -XX:+PrintGCDetails
+runOne -XX:+UseFastJNIAccessors -XX:+PrintGCDetails InputArgument -XX:+UseFastJNIAccessors
 runOne "-Dprops=one two three" InputArgument "-Dprops=one two three"
 
 exit 0
diff --git a/jdk/test/java/lang/ref/EnqueuePollRace.java b/jdk/test/java/lang/ref/EnqueuePollRace.java
index c19a366715d..5171e138e5a 100644
--- a/jdk/test/java/lang/ref/EnqueuePollRace.java
+++ b/jdk/test/java/lang/ref/EnqueuePollRace.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
  * @bug 8014890
  * @summary Verify that a race between ReferenceQueue.enqueue() and poll() does not occur.
  * @author thomas.schatzl@oracle.com
- * @run main/othervm -XX:+UseSerialGC -Xmx10M EnqueuePollRace
+ * @run main/othervm -Xmx10M EnqueuePollRace
  */
 
 import java.lang.ref.*;
diff --git a/jdk/test/sun/tools/jps/JpsHelper.java b/jdk/test/sun/tools/jps/JpsHelper.java
index 4e00cc95de4..407f0416c34 100644
--- a/jdk/test/sun/tools/jps/JpsHelper.java
+++ b/jdk/test/sun/tools/jps/JpsHelper.java
@@ -93,7 +93,7 @@ public final class JpsHelper {
     /**
      * VM arguments to start test application with
      */
-    public static final String[] VM_ARGS = {"-Xmx512m", "-XX:+UseParallelGC"};
+    public static final String[] VM_ARGS = {"-Xmx512m", "-XX:+PrintGCDetails"};
     /**
      * VM flag to start test application with
      */

From ac5d9dad16074d711719b134b61ecc0d13baac76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Markus=20Gr=C3=B6nlund?= <mgronlun@openjdk.org>
Date: Wed, 19 Nov 2014 16:08:01 +0100
Subject: [PATCH 120/299] 8065361: Fixup headers and definitions for
 INCLUDE_TRACE

Reviewed-by: sla, stefank
---
 hotspot/src/share/vm/classfile/classLoaderData.cpp     |  5 ++---
 hotspot/src/share/vm/classfile/classLoaderData.hpp     |  3 ++-
 hotspot/src/share/vm/classfile/systemDictionary.cpp    |  5 ++---
 .../shared/objectCountEventSender.cpp                  |  2 +-
 hotspot/src/share/vm/runtime/vmStructs.cpp             |  2 +-
 hotspot/src/share/vm/trace/noTraceBackend.hpp          |  2 +-
 hotspot/src/share/vm/trace/traceBackend.hpp            | 10 +++-------
 hotspot/src/share/vm/trace/traceEvent.hpp              |  6 ++----
 hotspot/src/share/vm/trace/traceEventClasses.xsl       | 10 +++-------
 hotspot/src/share/vm/trace/traceEventIds.xsl           | 10 ++++------
 hotspot/src/share/vm/trace/traceMacros.hpp             |  6 +++---
 hotspot/src/share/vm/trace/traceStream.hpp             |  6 ++----
 hotspot/src/share/vm/trace/traceTypes.xsl              |  9 ++++-----
 hotspot/src/share/vm/trace/tracing.hpp                 |  2 +-
 14 files changed, 31 insertions(+), 47 deletions(-)

diff --git a/hotspot/src/share/vm/classfile/classLoaderData.cpp b/hotspot/src/share/vm/classfile/classLoaderData.cpp
index ff7b3533cba..dd53dc7443c 100644
--- a/hotspot/src/share/vm/classfile/classLoaderData.cpp
+++ b/hotspot/src/share/vm/classfile/classLoaderData.cpp
@@ -65,9 +65,8 @@
 #include "utilities/growableArray.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/ostream.hpp"
-
 #if INCLUDE_TRACE
- #include "trace/tracing.hpp"
+#include "trace/tracing.hpp"
 #endif
 
 ClassLoaderData * ClassLoaderData::_the_null_class_loader_data = NULL;
@@ -978,4 +977,4 @@ void ClassLoaderDataGraph::class_unload_event(Klass* const k) {
   event.commit();
 }
 
-#endif /* INCLUDE_TRACE */
+#endif // INCLUDE_TRACE
diff --git a/hotspot/src/share/vm/classfile/classLoaderData.hpp b/hotspot/src/share/vm/classfile/classLoaderData.hpp
index 17eab14b672..a9ccaf81fe2 100644
--- a/hotspot/src/share/vm/classfile/classLoaderData.hpp
+++ b/hotspot/src/share/vm/classfile/classLoaderData.hpp
@@ -31,8 +31,9 @@
 #include "memory/metaspaceCounters.hpp"
 #include "runtime/mutex.hpp"
 #include "utilities/growableArray.hpp"
+#include "utilities/macros.hpp"
 #if INCLUDE_TRACE
-# include "utilities/ticks.hpp"
+#include "utilities/ticks.hpp"
 #endif
 
 //
diff --git a/hotspot/src/share/vm/classfile/systemDictionary.cpp b/hotspot/src/share/vm/classfile/systemDictionary.cpp
index 85f90d436c2..9825c51874a 100644
--- a/hotspot/src/share/vm/classfile/systemDictionary.cpp
+++ b/hotspot/src/share/vm/classfile/systemDictionary.cpp
@@ -65,9 +65,8 @@
 #include "services/threadService.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/ticks.hpp"
-
 #if INCLUDE_TRACE
- #include "trace/tracing.hpp"
+#include "trace/tracing.hpp"
 #endif
 
 Dictionary*            SystemDictionary::_dictionary          = NULL;
@@ -2660,7 +2659,7 @@ void SystemDictionary::post_class_load_event(const Ticks& start_time,
                                       class_loader->klass() : (Klass*)NULL);
     event.commit();
   }
-#endif /* INCLUDE_TRACE */
+#endif // INCLUDE_TRACE
 }
 
 #ifndef PRODUCT
diff --git a/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp b/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp
index 4e0dc6077a6..8b9d6a141f5 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/objectCountEventSender.cpp
@@ -29,8 +29,8 @@
 #include "memory/heapInspection.hpp"
 #include "trace/tracing.hpp"
 #include "utilities/globalDefinitions.hpp"
+#include "utilities/macros.hpp"
 #include "utilities/ticks.hpp"
-
 #if INCLUDE_SERVICES
 
 void ObjectCountEventSender::send(const KlassInfoEntry* entry, GCId gc_id, const Ticks& timestamp) {
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index 9c1cec41a39..b69ce20e8d6 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -173,7 +173,7 @@
 #endif // INCLUDE_ALL_GCS
 
 #if INCLUDE_TRACE
- #include "runtime/vmStructs_trace.hpp"
+#include "runtime/vmStructs_trace.hpp"
 #endif
 
 #ifdef COMPILER2
diff --git a/hotspot/src/share/vm/trace/noTraceBackend.hpp b/hotspot/src/share/vm/trace/noTraceBackend.hpp
index 52a7f2c2899..a0b1f33dd26 100644
--- a/hotspot/src/share/vm/trace/noTraceBackend.hpp
+++ b/hotspot/src/share/vm/trace/noTraceBackend.hpp
@@ -41,4 +41,4 @@ public:
 
 typedef NoTraceBackend Tracing;
 
-#endif
+#endif // SHARE_VM_TRACE_NOTRACEBACKEND_HPP
diff --git a/hotspot/src/share/vm/trace/traceBackend.hpp b/hotspot/src/share/vm/trace/traceBackend.hpp
index 471d1b00e28..c65d89e41d8 100644
--- a/hotspot/src/share/vm/trace/traceBackend.hpp
+++ b/hotspot/src/share/vm/trace/traceBackend.hpp
@@ -25,9 +25,7 @@
 #define SHARE_VM_TRACE_TRACEBACKEND_HPP
 
 #include "utilities/macros.hpp"
-
 #if INCLUDE_TRACE
-
 #include "runtime/globals.hpp"
 #include "runtime/os.hpp"
 #include "trace/traceTime.hpp"
@@ -58,9 +56,7 @@ public:
 
 typedef TraceBackend Tracing;
 
-#else /* INCLUDE_TRACE */
-
+#else // !INCLUDE_TRACE
 #include "trace/noTraceBackend.hpp"
-
-#endif /* INCLUDE_TRACE */
-#endif /* SHARE_VM_TRACE_TRACEBACKEND_HPP */
+#endif // INCLUDE_TRACE
+#endif // SHARE_VM_TRACE_TRACEBACKEND_HPP
diff --git a/hotspot/src/share/vm/trace/traceEvent.hpp b/hotspot/src/share/vm/trace/traceEvent.hpp
index 33abd67d355..a0548d76513 100644
--- a/hotspot/src/share/vm/trace/traceEvent.hpp
+++ b/hotspot/src/share/vm/trace/traceEvent.hpp
@@ -33,7 +33,6 @@ enum EventStartTime {
 };
 
 #if INCLUDE_TRACE
-
 #include "trace/traceBackend.hpp"
 #include "trace/tracing.hpp"
 #include "tracefiles/traceEventIds.hpp"
@@ -154,6 +153,5 @@ class TraceEvent : public StackObj {
   }
 };
 
-#endif /* INCLUDE_TRACE */
-
-#endif /* SHARE_VM_TRACE_TRACEEVENT_HPP */
+#endif // INCLUDE_TRACE
+#endif // SHARE_VM_TRACE_TRACEEVENT_HPP
diff --git a/hotspot/src/share/vm/trace/traceEventClasses.xsl b/hotspot/src/share/vm/trace/traceEventClasses.xsl
index 12496ac65e8..fe097e0b370 100644
--- a/hotspot/src/share/vm/trace/traceEventClasses.xsl
+++ b/hotspot/src/share/vm/trace/traceEventClasses.xsl
@@ -41,17 +41,14 @@
 #include "trace/traceEvent.hpp"
 #include "utilities/macros.hpp"
 #include "utilities/ticks.hpp"
-
 #if INCLUDE_TRACE
-
-
 #include "trace/traceStream.hpp"
 #include "utilities/ostream.hpp"
 
   <xsl:apply-templates select="trace/events/struct" mode="trace"/>
   <xsl:apply-templates select="trace/events/event" mode="trace"/>
 
-#else
+#else // !INCLUDE_TRACE
 
 class TraceEvent {
 public:
@@ -66,9 +63,8 @@ public:
   <xsl:apply-templates select="trace/events/struct" mode="empty"/>
   <xsl:apply-templates select="trace/events/event" mode="empty"/>
 
-#endif
-
-#endif
+#endif // INCLUDE_TRACE
+#endif // TRACEFILES_TRACEEVENTCLASSES_HPP
 </xsl:template>
 
 <xsl:template match="struct" mode="trace">
diff --git a/hotspot/src/share/vm/trace/traceEventIds.xsl b/hotspot/src/share/vm/trace/traceEventIds.xsl
index 6a7e95474c0..9ee9ebdfa31 100644
--- a/hotspot/src/share/vm/trace/traceEventIds.xsl
+++ b/hotspot/src/share/vm/trace/traceEventIds.xsl
@@ -29,13 +29,11 @@
 <xsl:template match="/">
   <xsl:call-template name="file-header"/>
 
-#ifndef TRACEFILES_JFREVENTIDS_HPP
-#define TRACEFILES_JFREVENTIDS_HPP
+#ifndef TRACEFILES_TRACEEVENTIDS_HPP
+#define TRACEFILES_TRACEEVENTIDS_HPP
 
 #include "utilities/macros.hpp"
-
 #if INCLUDE_TRACE
-
 #include "trace/traceDataTypes.hpp"
 
 /**
@@ -67,8 +65,8 @@ enum TraceStructId {
 typedef enum TraceEventId  TraceEventId;
 typedef enum TraceStructId TraceStructId;
 
-#endif
-#endif
+#endif // INCLUDE_TRACE
+#endif // TRACEFILES_TRACEEVENTIDS_HPP
 </xsl:template>
 
 </xsl:stylesheet>
diff --git a/hotspot/src/share/vm/trace/traceMacros.hpp b/hotspot/src/share/vm/trace/traceMacros.hpp
index 4776e13507e..371ee7f8d09 100644
--- a/hotspot/src/share/vm/trace/traceMacros.hpp
+++ b/hotspot/src/share/vm/trace/traceMacros.hpp
@@ -22,8 +22,8 @@
  *
  */
 
-#ifndef SHARE_VM_TRACE_TRACE_MACRO_HPP
-#define SHARE_VM_TRACE_TRACE_MACRO_HPP
+#ifndef SHARE_VM_TRACE_TRACEMACROS_HPP
+#define SHARE_VM_TRACE_TRACEMACROS_HPP
 
 #define EVENT_THREAD_EXIT(thread)
 #define EVENT_THREAD_DESTRUCT(thread)
@@ -41,4 +41,4 @@
 #define TRACE_TEMPLATES(template)
 #define TRACE_INTRINSICS(do_intrinsic, do_class, do_name, do_signature, do_alias)
 
-#endif
+#endif // SHARE_VM_TRACE_TRACEMACROS_HPP
diff --git a/hotspot/src/share/vm/trace/traceStream.hpp b/hotspot/src/share/vm/trace/traceStream.hpp
index 14bc421115c..89911ea27a0 100644
--- a/hotspot/src/share/vm/trace/traceStream.hpp
+++ b/hotspot/src/share/vm/trace/traceStream.hpp
@@ -26,9 +26,7 @@
 #define SHARE_VM_TRACE_TRACESTREAM_HPP
 
 #include "utilities/macros.hpp"
-
 #if INCLUDE_TRACE
-
 #include "oops/klass.hpp"
 #include "oops/method.hpp"
 #include "oops/symbol.hpp"
@@ -117,5 +115,5 @@ class TraceStream : public StackObj {
   }
 };
 
-#endif /* INCLUDE_TRACE */
-#endif /* SHARE_VM_TRACE_TRACESTREAM_HPP */
+#endif // INCLUDE_TRACE
+#endif // SHARE_VM_TRACE_TRACESTREAM_HPP
diff --git a/hotspot/src/share/vm/trace/traceTypes.xsl b/hotspot/src/share/vm/trace/traceTypes.xsl
index c7f9c0a5dd1..c5720e6546f 100644
--- a/hotspot/src/share/vm/trace/traceTypes.xsl
+++ b/hotspot/src/share/vm/trace/traceTypes.xsl
@@ -29,15 +29,14 @@
 <xsl:template match="/">
   <xsl:call-template name="file-header"/>
 
-#ifndef TRACEFILES_JFRTYPES_HPP
-#define TRACEFILES_JFRTYPES_HPP
+#ifndef TRACEFILES_TRACETYPES_HPP
+#define TRACEFILES_TRACETYPES_HPP
 
 #include "oops/symbol.hpp"
 #include "trace/traceDataTypes.hpp"
 #include "utilities/globalDefinitions.hpp"
 #include "utilities/ticks.hpp"
 
-
 enum JVMContentType {
   _not_a_content_type = (JVM_CONTENT_TYPES_START - 1),
   
@@ -58,7 +57,7 @@ enum JVMEventRelations {
 };
 
 /**
- * Create typedefs for the JRA types:
+ * Create typedefs for the TRACE types:
  *   typedef s8 TYPE_LONG;
  *   typedef s4 TYPE_INTEGER;
  *   typedef const char * TYPE_STRING;
@@ -68,7 +67,7 @@ enum JVMEventRelations {
 typedef <xsl:value-of select="@type"/>  TYPE_<xsl:value-of select="@symbol"/>;
 </xsl:for-each>
 
-#endif // JFRFILES_JFRTYPES_HPP
+#endif // TRACEFILES_TRACETYPES_HPP
 </xsl:template>
 
 </xsl:stylesheet>
diff --git a/hotspot/src/share/vm/trace/tracing.hpp b/hotspot/src/share/vm/trace/tracing.hpp
index 72530e74594..e70696eb38c 100644
--- a/hotspot/src/share/vm/trace/tracing.hpp
+++ b/hotspot/src/share/vm/trace/tracing.hpp
@@ -28,4 +28,4 @@
 #include "tracefiles/traceEventClasses.hpp"
 #include "tracefiles/traceEventIds.hpp"
 
-#endif
+#endif // SHARE_VM_TRACE_TRACING_HPP

From 5b5a52cd58cefdb29668c35f9f1d0309ff7a3548 Mon Sep 17 00:00:00 2001
From: Andrey Zakharov <azakharov@openjdk.org>
Date: Wed, 19 Nov 2014 19:22:49 +0400
Subject: [PATCH 121/299] 8059661: Test SoftReference and OOM behavior

Reviewed-by: tschatzl
---
 .../gc/TestSoftReferencesBehaviorOnOOME.java  | 146 ++++++++++++++++++
 1 file changed, 146 insertions(+)
 create mode 100644 hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java

diff --git a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
new file mode 100644
index 00000000000..24f7a53612f
--- /dev/null
+++ b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2014 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 TestSoftReferencesBehaviorOnOOME
+ * @key gc
+ * @summary Tests that all SoftReferences has been cleared at time of OOM.
+ * @library /testlibrary
+ * @build TestSoftReference
+ * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
+ * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k
+ * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 2k 32k 10
+ */
+import com.oracle.java.testlibrary.Utils;
+import java.lang.ref.SoftReference;
+import java.util.LinkedList;
+import java.util.Random;
+
+public class TestSoftReferencesBehaviorOnOOME {
+
+    private static final Random rndGenerator = Utils.getRandomInstance();
+
+    public static void main(String[] args) {
+        int semiRefAllocFrequency = DEFAULT_FREQUENCY;
+        long minSize = DEFAULT_MIN_SIZE,
+                maxSize = DEFAULT_MAX_SIZE;
+
+        if ( args.length >= 3 ) {
+            semiRefAllocFrequency = Integer.parseInt(args[2]);
+        }
+
+        if ( args.length >= 2) {
+            maxSize = getBytesCount(args[1]);
+        }
+
+        if ( args.length >= 1) {
+            minSize = getBytesCount(args[0]);
+        }
+
+        new TestSoftReferencesBehaviorOnOOME().softReferencesOom(minSize, maxSize, semiRefAllocFrequency);
+    }
+
+    /**
+     * Test that all SoftReferences has been cleared at time of OOM.
+     */
+    void softReferencesOom(long minSize, long maxSize, int semiRefAllocFrequency) {
+        System.out.format( "minSize = %d, maxSize = %d, freq = %d%n", minSize, maxSize, semiRefAllocFrequency );
+        long counter = 0;
+
+        long multiplier = maxSize - minSize;
+        LinkedList<SoftReference> arrSoftRefs = new LinkedList();
+        LinkedList arrObjects = new LinkedList();
+        long numberOfNotNulledObjects = 0;
+        long oomSoftArraySize = 0;
+
+        try {
+            while (true) {
+                // Keep every Xth object to make sure we hit OOM pretty fast
+                if (counter % semiRefAllocFrequency != 0) {
+                    long allocationSize = ((int) (rndGenerator.nextDouble() * multiplier))
+                            + minSize;
+                    arrObjects.add(new byte[(int)allocationSize]);
+                } else {
+                    arrSoftRefs.add(new SoftReference(new Object()));
+                }
+
+                counter++;
+                if (counter == Long.MAX_VALUE) {
+                    counter = 0;
+                }
+            }
+        } catch (OutOfMemoryError oome) {
+            // Clear allocated ballast, so we don't get another OOM.
+
+            arrObjects = null;
+
+            // Get the number of soft refs first, so we don't trigger
+            // another OOM.
+            oomSoftArraySize = arrSoftRefs.size();
+
+            for (SoftReference sr : arrSoftRefs) {
+                Object o = sr.get();
+
+                if (o != null) {
+                    numberOfNotNulledObjects++;
+                }
+            }
+
+            // Make sure we clear all refs before we return failure
+            arrSoftRefs = null;
+
+            if (numberOfNotNulledObjects > 0) {
+                throw new RuntimeException(numberOfNotNulledObjects + " out of "
+                        + oomSoftArraySize + " SoftReferences was not "
+                        + "null at time of OutOfMemoryError");
+            }
+        } finally {
+            arrSoftRefs = null;
+            arrObjects = null;
+        }
+    }
+
+    private static final long getBytesCount(String arg) {
+        String postfixes = "kMGT";
+        long mod = 1;
+
+        if (arg.trim().length() >= 2) {
+            mod = postfixes.indexOf(
+                    arg.trim().charAt(arg.length() - 1)
+            );
+
+            if (mod != -1) {
+                mod = (long) Math.pow(1024, mod+1);
+                arg = arg.substring(0, arg.length() - 1);
+            } else {
+                mod = 1; // 10^0
+            }
+        }
+
+        return Long.parseLong(arg) * mod;
+    }
+
+    private static final long DEFAULT_MIN_SIZE = 512;
+    private static final long DEFAULT_MAX_SIZE = 1024;
+    private static final int DEFAULT_FREQUENCY = 4;
+}

From 4151db8bfdce2b8e645e38790bcb77d86cb49e77 Mon Sep 17 00:00:00 2001
From: Coleen Phillimore <coleenp@openjdk.org>
Date: Wed, 19 Nov 2014 13:02:11 -0500
Subject: [PATCH 122/299] 8042235: redefining method used by multiple
 MethodHandles crashes VM

Note all MemberNames created on internal list for adjusting method entries.

Reviewed-by: sspitsyn, dcubed, lfoltan
---
 .../src/share/vm/classfile/javaClasses.cpp    |  30 ++-
 .../src/share/vm/classfile/javaClasses.hpp    |   5 +-
 hotspot/src/share/vm/oops/instanceKlass.cpp   |  29 ++-
 hotspot/src/share/vm/oops/instanceKlass.hpp   |   3 +-
 hotspot/src/share/vm/prims/jvm.cpp            |  34 +++-
 hotspot/src/share/vm/prims/methodHandles.cpp  |  66 ++-----
 hotspot/src/share/vm/prims/methodHandles.hpp  |   8 +-
 ...fineMethodUsedByMultipleMethodHandles.java | 174 ++++++++++++++++++
 8 files changed, 264 insertions(+), 85 deletions(-)
 create mode 100644 hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java

diff --git a/hotspot/src/share/vm/classfile/javaClasses.cpp b/hotspot/src/share/vm/classfile/javaClasses.cpp
index 754134bdafa..d900ef5e84a 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.cpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.cpp
@@ -41,6 +41,7 @@
 #include "oops/method.hpp"
 #include "oops/symbol.hpp"
 #include "oops/typeArrayOop.hpp"
+#include "prims/jvmtiRedefineClassesTrace.hpp"
 #include "runtime/fieldDescriptor.hpp"
 #include "runtime/handles.inline.hpp"
 #include "runtime/interfaceSupport.hpp"
@@ -2794,12 +2795,35 @@ Metadata* java_lang_invoke_MemberName::vmtarget(oop mname) {
   return (Metadata*)mname->address_field(_vmtarget_offset);
 }
 
+bool java_lang_invoke_MemberName::is_method(oop mname) {
+  assert(is_instance(mname), "must be MemberName");
+  return (flags(mname) & (MN_IS_METHOD | MN_IS_CONSTRUCTOR)) > 0;
+}
+
 #if INCLUDE_JVMTI
 // Can be executed on VM thread only
-void java_lang_invoke_MemberName::adjust_vmtarget(oop mname, Metadata* ref) {
-  assert((is_instance(mname) && (flags(mname) & (MN_IS_METHOD | MN_IS_CONSTRUCTOR)) > 0), "wrong type");
+void java_lang_invoke_MemberName::adjust_vmtarget(oop mname, Method* old_method,
+                                                  Method* new_method, bool* trace_name_printed) {
+  assert(is_method(mname), "wrong type");
   assert(Thread::current()->is_VM_thread(), "not VM thread");
-  mname->address_field_put(_vmtarget_offset, (address)ref);
+
+  Method* target = (Method*)mname->address_field(_vmtarget_offset);
+  if (target == old_method) {
+    mname->address_field_put(_vmtarget_offset, (address)new_method);
+
+    if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
+      if (!(*trace_name_printed)) {
+        // RC_TRACE_MESG macro has an embedded ResourceMark
+        RC_TRACE_MESG(("adjust: name=%s",
+                       old_method->method_holder()->external_name()));
+        *trace_name_printed = true;
+      }
+      // RC_TRACE macro has an embedded ResourceMark
+      RC_TRACE(0x00400000, ("MemberName method update: %s(%s)",
+                            new_method->name()->as_C_string(),
+                            new_method->signature()->as_C_string()));
+    }
+  }
 }
 #endif // INCLUDE_JVMTI
 
diff --git a/hotspot/src/share/vm/classfile/javaClasses.hpp b/hotspot/src/share/vm/classfile/javaClasses.hpp
index c7890d20720..ee2c807ae12 100644
--- a/hotspot/src/share/vm/classfile/javaClasses.hpp
+++ b/hotspot/src/share/vm/classfile/javaClasses.hpp
@@ -1100,7 +1100,8 @@ class java_lang_invoke_MemberName: AllStatic {
   static Metadata*      vmtarget(oop mname);
   static void       set_vmtarget(oop mname, Metadata* target);
 #if INCLUDE_JVMTI
-  static void       adjust_vmtarget(oop mname, Metadata* target);
+  static void       adjust_vmtarget(oop mname, Method* old_method, Method* new_method,
+                                    bool* trace_name_printed);
 #endif // INCLUDE_JVMTI
 
   static intptr_t       vmindex(oop mname);
@@ -1114,6 +1115,8 @@ class java_lang_invoke_MemberName: AllStatic {
     return obj != NULL && is_subclass(obj->klass());
   }
 
+  static bool is_method(oop obj);
+
   // Relevant integer codes (keep these in synch. with MethodHandleNatives.Constants):
   enum {
     MN_IS_METHOD            = 0x00010000, // method (not constructor)
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
index ab925e46acb..e80eaece790 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
@@ -2931,28 +2931,27 @@ nmethod* InstanceKlass::lookup_osr_nmethod(const Method* m, int bci, int comp_le
   return NULL;
 }
 
-void InstanceKlass::add_member_name(int index, Handle mem_name) {
+bool InstanceKlass::add_member_name(Handle mem_name) {
   jweak mem_name_wref = JNIHandles::make_weak_global(mem_name);
   MutexLocker ml(MemberNameTable_lock);
-  assert(0 <= index && index < idnum_allocated_count(), "index is out of bounds");
   DEBUG_ONLY(No_Safepoint_Verifier nsv);
 
+  // Check if method has been redefined while taking out MemberNameTable_lock, if so
+  // return false.  We cannot cache obsolete methods. They will crash when the function
+  // is called!
+  Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mem_name());
+  if (method->is_obsolete()) {
+    return false;
+  } else if (method->is_old()) {
+    // Replace method with redefined version
+    java_lang_invoke_MemberName::set_vmtarget(mem_name(), method_with_idnum(method->method_idnum()));
+  }
+
   if (_member_names == NULL) {
     _member_names = new (ResourceObj::C_HEAP, mtClass) MemberNameTable(idnum_allocated_count());
   }
-  _member_names->add_member_name(index, mem_name_wref);
-}
-
-oop InstanceKlass::get_member_name(int index) {
-  MutexLocker ml(MemberNameTable_lock);
-  assert(0 <= index && index < idnum_allocated_count(), "index is out of bounds");
-  DEBUG_ONLY(No_Safepoint_Verifier nsv);
-
-  if (_member_names == NULL) {
-    return NULL;
-  }
-  oop mem_name =_member_names->get_member_name(index);
-  return mem_name;
+  _member_names->add_member_name(mem_name_wref);
+  return true;
 }
 
 // -----------------------------------------------------------------------------------------------------
diff --git a/hotspot/src/share/vm/oops/instanceKlass.hpp b/hotspot/src/share/vm/oops/instanceKlass.hpp
index a34a8dc5dbf..94a3c80ea98 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.hpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.hpp
@@ -1072,8 +1072,7 @@ public:
   // JSR-292 support
   MemberNameTable* member_names() { return _member_names; }
   void set_member_names(MemberNameTable* member_names) { _member_names = member_names; }
-  void add_member_name(int index, Handle member_name);
-  oop  get_member_name(int index);
+  bool add_member_name(Handle member_name);
 
 public:
   // JVMTI support
diff --git a/hotspot/src/share/vm/prims/jvm.cpp b/hotspot/src/share/vm/prims/jvm.cpp
index e28db7c4985..b1377298550 100644
--- a/hotspot/src/share/vm/prims/jvm.cpp
+++ b/hotspot/src/share/vm/prims/jvm.cpp
@@ -567,13 +567,14 @@ JVM_ENTRY(jobject, JVM_Clone(JNIEnv* env, jobject handle))
 
   // Make shallow object copy
   const int size = obj->size();
-  oop new_obj = NULL;
+  oop new_obj_oop = NULL;
   if (obj->is_array()) {
     const int length = ((arrayOop)obj())->length();
-    new_obj = CollectedHeap::array_allocate(klass, size, length, CHECK_NULL);
+    new_obj_oop = CollectedHeap::array_allocate(klass, size, length, CHECK_NULL);
   } else {
-    new_obj = CollectedHeap::obj_allocate(klass, size, CHECK_NULL);
+    new_obj_oop = CollectedHeap::obj_allocate(klass, size, CHECK_NULL);
   }
+
   // 4839641 (4840070): We must do an oop-atomic copy, because if another thread
   // is modifying a reference field in the clonee, a non-oop-atomic copy might
   // be suspended in the middle of copying the pointer and end up with parts
@@ -584,24 +585,41 @@ JVM_ENTRY(jobject, JVM_Clone(JNIEnv* env, jobject handle))
   // The same is true of StubRoutines::object_copy and the various oop_copy
   // variants, and of the code generated by the inline_native_clone intrinsic.
   assert(MinObjAlignmentInBytes >= BytesPerLong, "objects misaligned");
-  Copy::conjoint_jlongs_atomic((jlong*)obj(), (jlong*)new_obj,
+  Copy::conjoint_jlongs_atomic((jlong*)obj(), (jlong*)new_obj_oop,
                                (size_t)align_object_size(size) / HeapWordsPerLong);
   // Clear the header
-  new_obj->init_mark();
+  new_obj_oop->init_mark();
 
   // Store check (mark entire object and let gc sort it out)
   BarrierSet* bs = Universe::heap()->barrier_set();
   assert(bs->has_write_region_opt(), "Barrier set does not have write_region");
-  bs->write_region(MemRegion((HeapWord*)new_obj, size));
+  bs->write_region(MemRegion((HeapWord*)new_obj_oop, size));
+
+  Handle new_obj(THREAD, new_obj_oop);
+  // Special handling for MemberNames.  Since they contain Method* metadata, they
+  // must be registered so that RedefineClasses can fix metadata contained in them.
+  if (java_lang_invoke_MemberName::is_instance(new_obj()) &&
+      java_lang_invoke_MemberName::is_method(new_obj())) {
+    Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(new_obj());
+    // MemberName may be unresolved, so doesn't need registration until resolved.
+    if (method != NULL) {
+      methodHandle m(THREAD, method);
+      // This can safepoint and redefine method, so need both new_obj and method
+      // in a handle, for two different reasons.  new_obj can move, method can be
+      // deleted if nothing is using it on the stack.
+      m->method_holder()->add_member_name(new_obj());
+    }
+  }
 
   // Caution: this involves a java upcall, so the clone should be
   // "gc-robust" by this stage.
   if (klass->has_finalizer()) {
     assert(obj->is_instance(), "should be instanceOop");
-    new_obj = InstanceKlass::register_finalizer(instanceOop(new_obj), CHECK_NULL);
+    new_obj_oop = InstanceKlass::register_finalizer(instanceOop(new_obj()), CHECK_NULL);
+    new_obj = Handle(THREAD, new_obj_oop);
   }
 
-  return JNIHandles::make_local(env, oop(new_obj));
+  return JNIHandles::make_local(env, new_obj());
 JVM_END
 
 // java.io.File ///////////////////////////////////////////////////////////////
diff --git a/hotspot/src/share/vm/prims/methodHandles.cpp b/hotspot/src/share/vm/prims/methodHandles.cpp
index 8013a1329a8..1b3b4fde571 100644
--- a/hotspot/src/share/vm/prims/methodHandles.cpp
+++ b/hotspot/src/share/vm/prims/methodHandles.cpp
@@ -29,7 +29,6 @@
 #include "interpreter/oopMapCache.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/oopFactory.hpp"
-#include "prims/jvmtiRedefineClassesTrace.hpp"
 #include "prims/methodHandles.hpp"
 #include "runtime/compilationPolicy.hpp"
 #include "runtime/javaCalls.hpp"
@@ -276,9 +275,12 @@ oop MethodHandles::init_method_MemberName(Handle mname, CallInfo& info) {
   // This is done eagerly, since it is readily available without
   // constructing any new objects.
   // TO DO: maybe intern mname_oop
-  m->method_holder()->add_member_name(m->method_idnum(), mname);
-
-  return mname();
+  if (m->method_holder()->add_member_name(mname)) {
+    return mname();
+  } else {
+    // Redefinition caused this to fail.  Return NULL (and an exception?)
+    return NULL;
+  }
 }
 
 oop MethodHandles::init_field_MemberName(Handle mname, fieldDescriptor& fd, bool is_setter) {
@@ -951,63 +953,27 @@ MemberNameTable::~MemberNameTable() {
   }
 }
 
-void MemberNameTable::add_member_name(int index, jweak mem_name_wref) {
+void MemberNameTable::add_member_name(jweak mem_name_wref) {
   assert_locked_or_safepoint(MemberNameTable_lock);
-  this->at_put_grow(index, mem_name_wref);
-}
-
-// Return a member name oop or NULL.
-oop MemberNameTable::get_member_name(int index) {
-  assert_locked_or_safepoint(MemberNameTable_lock);
-
-  jweak ref = this->at(index);
-  oop mem_name = JNIHandles::resolve(ref);
-  return mem_name;
+  this->push(mem_name_wref);
 }
 
 #if INCLUDE_JVMTI
-oop MemberNameTable::find_member_name_by_method(Method* old_method) {
-  assert_locked_or_safepoint(MemberNameTable_lock);
-  oop found = NULL;
-  int len = this->length();
-
-  for (int idx = 0; idx < len; idx++) {
-    oop mem_name = JNIHandles::resolve(this->at(idx));
-    if (mem_name == NULL) {
-      continue;
-    }
-    Method* method = (Method*)java_lang_invoke_MemberName::vmtarget(mem_name);
-    if (method == old_method) {
-      found = mem_name;
-      break;
-    }
-  }
-  return found;
-}
-
-// It is called at safepoint only
+// It is called at safepoint only for RedefineClasses
 void MemberNameTable::adjust_method_entries(Method** old_methods, Method** new_methods,
                                             int methods_length, bool *trace_name_printed) {
   assert(SafepointSynchronize::is_at_safepoint(), "only called at safepoint");
-  // search the MemberNameTable for uses of either obsolete or EMCP methods
+  // For each redefined method
   for (int j = 0; j < methods_length; j++) {
     Method* old_method = old_methods[j];
     Method* new_method = new_methods[j];
-    oop mem_name = find_member_name_by_method(old_method);
-    if (mem_name != NULL) {
-      java_lang_invoke_MemberName::adjust_vmtarget(mem_name, new_method);
 
-      if (RC_TRACE_IN_RANGE(0x00100000, 0x00400000)) {
-        if (!(*trace_name_printed)) {
-          // RC_TRACE_MESG macro has an embedded ResourceMark
-          RC_TRACE_MESG(("adjust: name=%s",
-                         old_method->method_holder()->external_name()));
-          *trace_name_printed = true;
-        }
-        // RC_TRACE macro has an embedded ResourceMark
-        RC_TRACE(0x00400000, ("MemberName method update: %s(%s)",
-                              new_method->name()->as_C_string(),
-                              new_method->signature()->as_C_string()));
+    // search the MemberNameTable for uses of either obsolete or EMCP methods
+    for (int idx = 0; idx < length(); idx++) {
+      oop mem_name = JNIHandles::resolve(this->at(idx));
+      if (mem_name != NULL) {
+        java_lang_invoke_MemberName::adjust_vmtarget(mem_name, old_method, new_method,
+                                                     trace_name_printed);
       }
     }
   }
diff --git a/hotspot/src/share/vm/prims/methodHandles.hpp b/hotspot/src/share/vm/prims/methodHandles.hpp
index 4084d6c7d8b..ff7870e951d 100644
--- a/hotspot/src/share/vm/prims/methodHandles.hpp
+++ b/hotspot/src/share/vm/prims/methodHandles.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, 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
@@ -236,18 +236,14 @@ class MemberNameTable : public GrowableArray<jweak> {
  public:
   MemberNameTable(int methods_cnt);
   ~MemberNameTable();
-  void add_member_name(int index, jweak mem_name_ref);
-  oop  get_member_name(int index);
+  void add_member_name(jweak mem_name_ref);
 
 #if INCLUDE_JVMTI
- public:
   // RedefineClasses() API support:
   // If a MemberName refers to old_method then update it
   // to refer to new_method.
   void adjust_method_entries(Method** old_methods, Method** new_methods,
                              int methods_length, bool *trace_name_printed);
- private:
-  oop find_member_name_by_method(Method* old_method);
 #endif // INCLUDE_JVMTI
 };
 
diff --git a/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
new file mode 100644
index 00000000000..1695c35558a
--- /dev/null
+++ b/hotspot/test/compiler/jsr292/RedefineMethodUsedByMultipleMethodHandles.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2014, 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 8042235
+ * @summary redefining method used by multiple MethodHandles crashes VM
+ * @compile -XDignore.symbol.file RedefineMethodUsedByMultipleMethodHandles.java
+ * @run main RedefineMethodUsedByMultipleMethodHandles
+ */
+
+import java.io.*;
+import java.lang.instrument.*;
+import java.lang.invoke.*;
+import java.lang.invoke.MethodHandles.Lookup;
+import java.lang.management.*;
+import java.lang.reflect.*;
+import java.nio.file.*;
+import java.security.*;
+import java.util.jar.*;
+
+import javax.tools.*;
+
+import jdk.internal.org.objectweb.asm.*;
+
+public class RedefineMethodUsedByMultipleMethodHandles {
+
+    static class Foo {
+        public static Object getName() {
+            return "foo";
+        }
+    }
+
+    public static void main(String[] args) throws Throwable {
+
+        Lookup lookup = MethodHandles.lookup();
+        Method fooMethod = Foo.class.getDeclaredMethod("getName");
+
+        // fooMH2 displaces fooMH1 from the MemberNamesTable
+        MethodHandle fooMH1 = lookup.unreflect(fooMethod);
+        MethodHandle fooMH2 = lookup.unreflect(fooMethod);
+
+        System.out.println("fooMH1.invoke = " + fooMH1.invokeExact());
+        System.out.println("fooMH2.invoke = " + fooMH2.invokeExact());
+
+        // Redefining Foo.getName() causes vmtarget to be updated
+        // in fooMH2 but not fooMH1
+        redefineFoo();
+
+        // Full GC causes fooMH1.vmtarget to be deallocated
+        System.gc();
+
+        // Calling fooMH1.vmtarget crashes the VM
+        System.out.println("fooMH1.invoke = " + fooMH1.invokeExact());
+    }
+
+    /**
+     * Adds the class file bytes for {@code c} to {@code jar}.
+     */
+    static void add(JarOutputStream jar, Class<?> c) throws IOException {
+        String classAsPath = c.getName().replace('.', '/') + ".class";
+        jar.putNextEntry(new JarEntry(classAsPath));
+        InputStream stream = c.getClassLoader().getResourceAsStream(classAsPath);
+
+        int b;
+        while ((b = stream.read()) != -1) {
+            jar.write(b);
+        }
+    }
+
+    static void redefineFoo() throws Exception {
+        Manifest manifest = new Manifest();
+        manifest.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0");
+        Attributes mainAttrs = manifest.getMainAttributes();
+        mainAttrs.putValue("Agent-Class", FooAgent.class.getName());
+        mainAttrs.putValue("Can-Redefine-Classes", "true");
+        mainAttrs.putValue("Can-Retransform-Classes", "true");
+
+        Path jar = Files.createTempFile("myagent", ".jar");
+        try {
+            JarOutputStream jarStream = new JarOutputStream(new FileOutputStream(jar.toFile()), manifest);
+            add(jarStream, FooAgent.class);
+            add(jarStream, FooTransformer.class);
+            jarStream.close();
+            runAgent(jar);
+        } finally {
+            Files.deleteIfExists(jar);
+        }
+    }
+
+    public static void runAgent(Path agent) throws Exception {
+        String vmName = ManagementFactory.getRuntimeMXBean().getName();
+        int p = vmName.indexOf('@');
+        assert p != -1 : "VM name not in <pid>@<host> format: " + vmName;
+        String pid = vmName.substring(0, p);
+        ClassLoader cl = ToolProvider.getSystemToolClassLoader();
+        Class<?> c = Class.forName("com.sun.tools.attach.VirtualMachine", true, cl);
+        Method attach = c.getDeclaredMethod("attach", String.class);
+        Method loadAgent = c.getDeclaredMethod("loadAgent", String.class);
+        Method detach = c.getDeclaredMethod("detach");
+        Object vm = attach.invoke(null, pid);
+        loadAgent.invoke(vm, agent.toString());
+        detach.invoke(vm);
+    }
+
+    public static class FooAgent {
+
+        public static void agentmain(@SuppressWarnings("unused") String args, Instrumentation inst) throws Exception {
+            assert inst.isRedefineClassesSupported();
+            assert inst.isRetransformClassesSupported();
+            inst.addTransformer(new FooTransformer(), true);
+            Class<?>[] classes = inst.getAllLoadedClasses();
+            for (int i = 0; i < classes.length; i++) {
+                Class<?> c = classes[i];
+                if (c == Foo.class) {
+                    inst.retransformClasses(new Class[]{c});
+                }
+            }
+        }
+    }
+
+    static class FooTransformer implements ClassFileTransformer {
+
+        @Override
+        public byte[] transform(ClassLoader cl, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {
+            if (Foo.class.equals(classBeingRedefined)) {
+                System.out.println("redefining " + classBeingRedefined);
+                ClassReader cr = new ClassReader(classfileBuffer);
+                ClassWriter cw = new ClassWriter(cr, ClassWriter.COMPUTE_FRAMES);
+                ClassVisitor adapter = new ClassVisitor(Opcodes.ASM5, cw) {
+                    @Override
+                    public MethodVisitor visitMethod(int access, String base, String desc, String signature, String[] exceptions) {
+                        MethodVisitor mv = cv.visitMethod(access, base, desc, signature, exceptions);
+                        if (mv != null) {
+                            mv = new MethodVisitor(Opcodes.ASM5, mv) {
+                                @Override
+                                public void visitLdcInsn(Object cst) {
+                                    System.out.println("replacing \"" + cst + "\" with \"bar\"");
+                                    mv.visitLdcInsn("bar");
+                                }
+                            };
+                        }
+                        return mv;
+                    }
+                };
+
+                cr.accept(adapter, ClassReader.SKIP_FRAMES);
+                cw.visitEnd();
+                return cw.toByteArray();
+            }
+            return classfileBuffer;
+        }
+    }
+}

From 68c088e66f03045ede67d191121ac4ce07e80103 Mon Sep 17 00:00:00 2001
From: Ioi Lam <iklam@openjdk.org>
Date: Wed, 19 Nov 2014 19:31:13 -0800
Subject: [PATCH 123/299] 8065346: WB_AddToBootstrapClassLoaderSearch calls
 JvmtiEnv::create_a_jvmti when not in _thread_in_vm state

Removed ThreadToNativeFromVM and use java_lang_String::as_utf8_string instead

Reviewed-by: dholmes, minqi
---
 hotspot/src/share/vm/prims/whitebox.cpp | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp
index 8757dbece88..3aa5764d628 100644
--- a/hotspot/src/share/vm/prims/whitebox.cpp
+++ b/hotspot/src/share/vm/prims/whitebox.cpp
@@ -116,24 +116,22 @@ WB_END
 
 WB_ENTRY(void, WB_AddToBootstrapClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) {
 #if INCLUDE_JVMTI
-  ThreadToNativeFromVM ttnfv(thread);   // can't be in VM when we call JNI
-  const char* seg = env->GetStringUTFChars(segment, NULL);
+  ResourceMark rm;
+  const char* seg = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(segment));
   JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION);
   jvmtiError err = jvmti_env->AddToBootstrapClassLoaderSearch(seg);
   assert(err == JVMTI_ERROR_NONE, "must not fail");
-  env->ReleaseStringUTFChars(segment, seg);
 #endif
 }
 WB_END
 
 WB_ENTRY(void, WB_AddToSystemClassLoaderSearch(JNIEnv* env, jobject o, jstring segment)) {
 #if INCLUDE_JVMTI
-  ThreadToNativeFromVM ttnfv(thread);   // can't be in VM when we call JNI
-  const char* seg = env->GetStringUTFChars(segment, NULL);
+  ResourceMark rm;
+  const char* seg = java_lang_String::as_utf8_string(JNIHandles::resolve_non_null(segment));
   JvmtiEnv* jvmti_env = JvmtiEnv::create_a_jvmti(JVMTI_VERSION);
   jvmtiError err = jvmti_env->AddToSystemClassLoaderSearch(seg);
   assert(err == JVMTI_ERROR_NONE, "must not fail");
-  env->ReleaseStringUTFChars(segment, seg);
 #endif
 }
 WB_END

From 5ef6d4e99d568bb59de16c526d039bed80807b5c Mon Sep 17 00:00:00 2001
From: Tobias Hartmann <thartmann@openjdk.org>
Date: Thu, 20 Nov 2014 11:06:26 +0100
Subject: [PATCH 124/299] 8050079: crash while compiling
 java.lang.ref.Finalizer::runFinalizer

Ignore non-instance Klasses in the subclass hierarchy.

Reviewed-by: kvn, iignatyev, jrose
---
 hotspot/src/share/vm/code/dependencies.cpp    | 58 +++++++------
 hotspot/test/TEST.groups                      |  1 +
 .../TestMonomorphicObjectCall.java            | 73 ++++++++++++++++
 .../java/lang/Object.java                     | 87 +++++++++++++++++++
 4 files changed, 192 insertions(+), 27 deletions(-)
 create mode 100644 hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java
 create mode 100644 hotspot/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java

diff --git a/hotspot/src/share/vm/code/dependencies.cpp b/hotspot/src/share/vm/code/dependencies.cpp
index f995a2f9999..fbefd4a9b1e 100644
--- a/hotspot/src/share/vm/code/dependencies.cpp
+++ b/hotspot/src/share/vm/code/dependencies.cpp
@@ -912,6 +912,8 @@ class ClassHierarchyWalker {
   bool is_witness(Klass* k) {
     if (doing_subtype_search()) {
       return Dependencies::is_concrete_klass(k);
+    } else if (!k->oop_is_instance()) {
+      return false; // no methods to find in an array type
     } else {
       Method* m = InstanceKlass::cast(k)->find_method(_name, _signature);
       if (m == NULL || !Dependencies::is_concrete_method(m))  return false;
@@ -1118,7 +1120,7 @@ Klass* ClassHierarchyWalker::find_witness_anywhere(Klass* context_type,
   Klass* chain;       // scratch variable
 #define ADD_SUBCLASS_CHAIN(k)                     {  \
     assert(chaini < CHAINMAX, "oob");                \
-    chain = InstanceKlass::cast(k)->subklass();      \
+    chain = k->subklass();                           \
     if (chain != NULL)  chains[chaini++] = chain;    }
 
   // Look for non-abstract subclasses.
@@ -1129,35 +1131,37 @@ Klass* ClassHierarchyWalker::find_witness_anywhere(Klass* context_type,
   // (Their subclasses are additional indirect implementors.
   // See InstanceKlass::add_implementor.)
   // (Note:  nof_implementors is always zero for non-interfaces.)
-  int nof_impls = InstanceKlass::cast(context_type)->nof_implementors();
-  if (nof_impls > 1) {
-    // Avoid this case: *I.m > { A.m, C }; B.m > C
-    // Here, I.m has 2 concrete implementations, but m appears unique
-    // as A.m, because the search misses B.m when checking C.
-    // The inherited method B.m was getting missed by the walker
-    // when interface 'I' was the starting point.
-    // %%% Until this is fixed more systematically, bail out.
-    // (Old CHA had the same limitation.)
-    return context_type;
-  }
-  if (nof_impls > 0) {
-    Klass* impl = InstanceKlass::cast(context_type)->implementor();
-    assert(impl != NULL, "just checking");
-    // If impl is the same as the context_type, then more than one
-    // implementor has seen. No exact info in this case.
-    if (impl == context_type) {
-      return context_type;  // report an inexact witness to this sad affair
+  if (top_level_call) {
+    int nof_impls = InstanceKlass::cast(context_type)->nof_implementors();
+    if (nof_impls > 1) {
+      // Avoid this case: *I.m > { A.m, C }; B.m > C
+      // Here, I.m has 2 concrete implementations, but m appears unique
+      // as A.m, because the search misses B.m when checking C.
+      // The inherited method B.m was getting missed by the walker
+      // when interface 'I' was the starting point.
+      // %%% Until this is fixed more systematically, bail out.
+      // (Old CHA had the same limitation.)
+      return context_type;
     }
-    if (do_counts)
-      { NOT_PRODUCT(deps_find_witness_steps++); }
-    if (is_participant(impl)) {
-      if (!participants_hide_witnesses) {
+    if (nof_impls > 0) {
+      Klass* impl = InstanceKlass::cast(context_type)->implementor();
+      assert(impl != NULL, "just checking");
+      // If impl is the same as the context_type, then more than one
+      // implementor has seen. No exact info in this case.
+      if (impl == context_type) {
+        return context_type;  // report an inexact witness to this sad affair
+      }
+      if (do_counts)
+        { NOT_PRODUCT(deps_find_witness_steps++); }
+      if (is_participant(impl)) {
+        if (!participants_hide_witnesses) {
+          ADD_SUBCLASS_CHAIN(impl);
+        }
+      } else if (is_witness(impl) && !ignore_witness(impl)) {
+        return impl;
+      } else {
         ADD_SUBCLASS_CHAIN(impl);
       }
-    } else if (is_witness(impl) && !ignore_witness(impl)) {
-      return impl;
-    } else {
-      ADD_SUBCLASS_CHAIN(impl);
     }
   }
 
diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups
index e4dbf572f06..f94cb702179 100644
--- a/hotspot/test/TEST.groups
+++ b/hotspot/test/TEST.groups
@@ -344,6 +344,7 @@ hotspot_compiler_2 = \
   compiler/codecache/ \
   compiler/codegen/ \
   compiler/cpuflags/ \
+  compiler/dependencies/ \
   compiler/eliminateAutobox/ \
   compiler/escapeAnalysis/ \
   compiler/exceptions/ \
diff --git a/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java
new file mode 100644
index 00000000000..932599013cf
--- /dev/null
+++ b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/TestMonomorphicObjectCall.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2014, 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.io.File;
+import java.util.ArrayList;
+import java.util.Collections;
+
+import com.oracle.java.testlibrary.*;
+
+/*
+ * @test
+ * @bug 8050079
+ * @summary Compiles a monomorphic call to finalizeObject() on a modified java.lang.Object to test C1 CHA.
+ * @library /testlibrary
+ * @compile -XDignore.symbol.file java/lang/Object.java TestMonomorphicObjectCall.java
+ * @run main TestMonomorphicObjectCall
+ */
+public class TestMonomorphicObjectCall {
+    final static String testClasses = System.getProperty("test.classes") + File.separator;
+
+    private static void callFinalize(Object object) throws Throwable {
+        // Call modified version of java.lang.Object::finalize() that is
+        // not overridden by any subclass. C1 CHA should mark the call site
+        // as monomorphic and inline the method.
+        object.finalizeObject();
+    }
+
+    public static void main(String[] args) throws Throwable {
+        if (args.length == 0) {
+            // Execute new instance with modified java.lang.Object
+            executeTestJvm();
+        } else {
+            // Trigger compilation of 'callFinalize'
+            callFinalize(new Object());
+        }
+    }
+
+    public static void executeTestJvm() throws Throwable {
+        // Execute test with modified version of java.lang.Object
+        // in -Xbootclasspath.
+        String[] vmOpts = new String[] {
+                "-Xbootclasspath/p:" + testClasses,
+                "-Xcomp",
+                "-XX:-VerifyDependencies",
+                "-XX:CompileOnly=TestMonomorphicObjectCall::callFinalize",
+                "-XX:CompileOnly=Object::finalizeObject",
+                "-XX:TieredStopAtLevel=1",
+                TestMonomorphicObjectCall.class.getName(),
+                "true"};
+        OutputAnalyzer output = ProcessTools.executeTestJvm(vmOpts);
+        output.shouldHaveExitValue(0);
+    }
+}
diff --git a/hotspot/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java
new file mode 100644
index 00000000000..aa983bcbd68
--- /dev/null
+++ b/hotspot/test/compiler/dependencies/MonomorphicObjectCall/java/lang/Object.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 1994, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package java.lang;
+
+/**
+ * Slightly modified version of java.lang.Object that replaces
+ * finalize() by finalizeObject() to avoid overriding in subclasses.
+ */
+public class Object {
+
+    private static native void registerNatives();
+    static {
+        registerNatives();
+    }
+
+    public final native Class<?> getClass();
+
+    public native int hashCode();
+
+    public boolean equals(Object obj) {
+        return (this == obj);
+    }
+
+    protected native Object clone() throws CloneNotSupportedException;
+
+    public String toString() {
+        return getClass().getName() + "@" + Integer.toHexString(hashCode());
+    }
+
+    public final native void notify();
+
+    public final native void notifyAll();
+
+    public final native void wait(long timeout) throws InterruptedException;
+
+    public final void wait(long timeout, int nanos) throws InterruptedException {
+        if (timeout < 0) {
+            throw new IllegalArgumentException("timeout value is negative");
+        }
+
+        if (nanos < 0 || nanos > 999999) {
+            throw new IllegalArgumentException(
+                                "nanosecond timeout value out of range");
+        }
+
+        if (nanos >= 500000 || (nanos != 0 && timeout == 0)) {
+            timeout++;
+        }
+
+        wait(timeout);
+    }
+
+    public final void wait() throws InterruptedException {
+        wait(0);
+    }
+
+    /**
+     * Replaces original finalize() method and is therefore not
+     * overridden by any subclasses of Object.
+     * @throws Throwable
+     */
+    // protected void finalize() throws Throwable { }
+    public void finalizeObject() throws Throwable { }
+}

From aba13c04f26058473c6077fa51a63212f2de1e14 Mon Sep 17 00:00:00 2001
From: Alexander Harlap <alexander.harlap.@oracle.com>
Date: Thu, 20 Nov 2014 10:03:22 -0500
Subject: [PATCH 125/299] 8059492: Wrong spelling in assert: "Not initialied
 properly?"

Fixed typo in metaspace assert message

Reviewed-by: mgerdin
---
 hotspot/src/share/vm/memory/metaspace.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hotspot/src/share/vm/memory/metaspace.cpp b/hotspot/src/share/vm/memory/metaspace.cpp
index 037267e288b..0b4d69efb83 100644
--- a/hotspot/src/share/vm/memory/metaspace.cpp
+++ b/hotspot/src/share/vm/memory/metaspace.cpp
@@ -1412,7 +1412,7 @@ size_t MetaspaceGC::delta_capacity_until_GC(size_t bytes) {
 
 size_t MetaspaceGC::capacity_until_GC() {
   size_t value = (size_t)OrderAccess::load_ptr_acquire(&_capacity_until_GC);
-  assert(value >= MetaspaceSize, "Not initialied properly?");
+  assert(value >= MetaspaceSize, "Not initialized properly?");
   return value;
 }
 

From 418c9789d6f4f8e757cd501878cc4299e66b6d0c Mon Sep 17 00:00:00 2001
From: Vicente Romero <vromero@openjdk.org>
Date: Thu, 20 Nov 2014 09:43:13 -0800
Subject: [PATCH 126/299] 8059921: Missing compile error in Java 8 mode for
 Interface.super.field access

Reviewed-by: mcimadamore, jlahoda
---
 .../com/sun/tools/javac/comp/Attr.java        |  4 +++
 .../ForbidAccessToFieldUsingSuperTest.java    | 31 +++++++++++++++++++
 .../ForbidAccessToFieldUsingSuperTest.out     |  3 ++
 3 files changed, 38 insertions(+)
 create mode 100644 langtools/test/tools/javac/T8059921/ForbidAccessToFieldUsingSuperTest.java
 create mode 100644 langtools/test/tools/javac/T8059921/ForbidAccessToFieldUsingSuperTest.out

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
index 1fe0b48eb30..6101af3ba42 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -3233,6 +3233,10 @@ public class Attr extends JCTree.Visitor {
         // Determine the symbol represented by the selection.
         env.info.pendingResolutionPhase = null;
         Symbol sym = selectSym(tree, sitesym, site, env, resultInfo);
+        if (sym.kind == VAR && sym.name != names._super && env.info.defaultSuperCallSite != null) {
+            log.error(tree.selected.pos(), "not.encl.class", site.tsym);
+            sym = syms.errSymbol;
+        }
         if (sym.exists() && !isType(sym) && pkind().contains(KindSelector.TYP_PCK)) {
             site = capture(site);
             sym = selectSym(tree, sitesym, site, env, resultInfo);
diff --git a/langtools/test/tools/javac/T8059921/ForbidAccessToFieldUsingSuperTest.java b/langtools/test/tools/javac/T8059921/ForbidAccessToFieldUsingSuperTest.java
new file mode 100644
index 00000000000..5bd3171a193
--- /dev/null
+++ b/langtools/test/tools/javac/T8059921/ForbidAccessToFieldUsingSuperTest.java
@@ -0,0 +1,31 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8059921
+ * @summary Missing compile error in Java 8 mode for Interface.super.field access
+ * @compile/fail/ref=ForbidAccessToFieldUsingSuperTest.out -XDrawDiagnostics ForbidAccessToFieldUsingSuperTest.java
+ */
+
+public class ForbidAccessToFieldUsingSuperTest {
+    class C {
+        int m() { return 0; }
+    }
+
+    interface T {
+        int f = 0;
+        C c = null;
+        default int mm() {
+            return 0;
+        }
+    }
+
+    interface T1 extends T {}
+
+    class X implements T1 {
+        int i = T1.super.f;        //fail
+        int j = T1.super.c.m();    //fail
+
+        void foo(Runnable r) {
+            foo(T1.super::mm);     //should'n fail
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/T8059921/ForbidAccessToFieldUsingSuperTest.out b/langtools/test/tools/javac/T8059921/ForbidAccessToFieldUsingSuperTest.out
new file mode 100644
index 00000000000..b4424f978cd
--- /dev/null
+++ b/langtools/test/tools/javac/T8059921/ForbidAccessToFieldUsingSuperTest.out
@@ -0,0 +1,3 @@
+ForbidAccessToFieldUsingSuperTest.java:24:19: compiler.err.not.encl.class: ForbidAccessToFieldUsingSuperTest.T1
+ForbidAccessToFieldUsingSuperTest.java:25:19: compiler.err.not.encl.class: ForbidAccessToFieldUsingSuperTest.T1
+2 errors

From 6bfd41fed8deed98a374c930affe7c3251cc7dec Mon Sep 17 00:00:00 2001
From: Jonathan Gibbons <jjg@openjdk.org>
Date: Thu, 20 Nov 2014 11:00:29 -0800
Subject: [PATCH 127/299] 8058445: Javac throws exception when displaying info

Reviewed-by: vromero, jfranck
---
 .../com/sun/tools/javac/main/Main.java        |  2 ++
 langtools/test/tools/javac/main/T8058445.java | 35 +++++++++++++++++++
 2 files changed, 37 insertions(+)
 create mode 100644 langtools/test/tools/javac/main/T8058445.java

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java
index fc78bd491d0..ffa89f81475 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java
@@ -160,6 +160,8 @@ public class Main {
             Option.HELP.process(new OptionHelper.GrumpyHelper(log) {
                 @Override
                 public String getOwnName() { return ownName; }
+                @Override
+                public void put(String name, String value) { }
             }, "-help");
             return Result.CMDERR;
         }
diff --git a/langtools/test/tools/javac/main/T8058445.java b/langtools/test/tools/javac/main/T8058445.java
new file mode 100644
index 00000000000..d9ff01b48d5
--- /dev/null
+++ b/langtools/test/tools/javac/main/T8058445.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014, 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 8058445
+ * @summary javac throws exception when displaying info
+ */
+
+public class T8058445 {
+    public static void main(String... ignore) throws Exception {
+        String[] args = { };
+        com.sun.tools.javac.Main.compile(args);
+    }
+}

From 60113dc1bae6b20570b817cda9efec11c8c2bf22 Mon Sep 17 00:00:00 2001
From: Vicente Romero <vromero@openjdk.org>
Date: Thu, 20 Nov 2014 14:05:39 -0800
Subject: [PATCH 128/299] 8063052: Inference chokes on wildcard derived from
 method reference

Reviewed-by: mcimadamore
---
 .../com/sun/tools/javac/comp/Resolve.java     |  2 +-
 .../lambda/methodReference/MethodRef8.java    | 43 +++++++++++++++++++
 2 files changed, 44 insertions(+), 1 deletion(-)
 create mode 100644 langtools/test/tools/javac/lambda/methodReference/MethodRef8.java

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
index 4eab19f4531..65e166ff4c1 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java
@@ -3172,7 +3172,7 @@ public class Resolve {
             super(referenceTree, name, site, argtypes.tail, typeargtypes, maxPhase);
             if (site.isRaw() && !argtypes.head.hasTag(NONE)) {
                 Type asSuperSite = types.asSuper(argtypes.head, site.tsym);
-                this.site = asSuperSite;
+                this.site = types.capture(asSuperSite);
             }
         }
 
diff --git a/langtools/test/tools/javac/lambda/methodReference/MethodRef8.java b/langtools/test/tools/javac/lambda/methodReference/MethodRef8.java
new file mode 100644
index 00000000000..0bce841cde6
--- /dev/null
+++ b/langtools/test/tools/javac/lambda/methodReference/MethodRef8.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2014, 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 8063052
+ * @summary Inference chokes on wildcard derived from method reference
+ * @compile MethodRef8.java
+ */
+
+public class MethodRef8 {
+    void test(Box<? extends Box<? extends Number>> b) {
+        Number n1 = b.map(Box::get).get();
+        Number n2 = b.<Number>map(Box::get).get();
+    }
+
+    interface Func<S,T> { T apply(S arg); }
+
+    interface Box<T> {
+        T get();
+        <R> Box<R> map(Func<T,R> f);
+    }
+}

From 56e39629eb2d49a1b4b6cc86ee0c48d910c178b6 Mon Sep 17 00:00:00 2001
From: Jonathan Gibbons <jjg@openjdk.org>
Date: Thu, 20 Nov 2014 14:23:31 -0800
Subject: [PATCH 129/299] 8065054: Some tests have junk before the legal header

Reviewed-by: darcy
---
 .../test/tools/javac/T6181889/EmptyFinallyTest.java      | 9 ++++-----
 .../javac/T8020997/CannotCompileRepeatedAnnoTest.java    | 1 -
 langtools/test/tools/javac/VersionOpt.java               | 1 -
 .../javac/annotations/typeAnnotations/InnerClass.java    | 2 --
 .../typeAnnotations/newlocations/BasicTest.java          | 1 -
 langtools/test/tools/javac/main/Option_J_At_Test.java    | 7 +++----
 .../tools/javac/processing/model/util/elements/Foo.java  | 1 -
 7 files changed, 7 insertions(+), 15 deletions(-)

diff --git a/langtools/test/tools/javac/T6181889/EmptyFinallyTest.java b/langtools/test/tools/javac/T6181889/EmptyFinallyTest.java
index 338bdf42d72..bee4e17826a 100644
--- a/langtools/test/tools/javac/T6181889/EmptyFinallyTest.java
+++ b/langtools/test/tools/javac/T6181889/EmptyFinallyTest.java
@@ -1,8 +1,3 @@
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.nio.file.Paths;
-
 /*
  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -32,6 +27,10 @@ import java.nio.file.Paths;
  * @summary Empty try/finally results in bytecodes being generated
  */
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.nio.file.Paths;
+
 public class EmptyFinallyTest {
     private static final String assertionErrorMsg =
             "No \"Exception table\" should be generated in this case";
diff --git a/langtools/test/tools/javac/T8020997/CannotCompileRepeatedAnnoTest.java b/langtools/test/tools/javac/T8020997/CannotCompileRepeatedAnnoTest.java
index 2e7edbb58b9..97e356b35c2 100644
--- a/langtools/test/tools/javac/T8020997/CannotCompileRepeatedAnnoTest.java
+++ b/langtools/test/tools/javac/T8020997/CannotCompileRepeatedAnnoTest.java
@@ -1,4 +1,3 @@
-
 /*
  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
diff --git a/langtools/test/tools/javac/VersionOpt.java b/langtools/test/tools/javac/VersionOpt.java
index 560d47dda62..f5f9691bb2f 100644
--- a/langtools/test/tools/javac/VersionOpt.java
+++ b/langtools/test/tools/javac/VersionOpt.java
@@ -1,4 +1,3 @@
-
 /*
  * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/InnerClass.java b/langtools/test/tools/javac/annotations/typeAnnotations/InnerClass.java
index 53cab9fa589..702c817c6f7 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/InnerClass.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/InnerClass.java
@@ -1,5 +1,3 @@
-import java.lang.annotation.ElementType;
-
 /*
  * Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/BasicTest.java b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/BasicTest.java
index 8c7fb83a3f1..dac16370cff 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/BasicTest.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/newlocations/BasicTest.java
@@ -1,4 +1,3 @@
-
 /*
  * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
diff --git a/langtools/test/tools/javac/main/Option_J_At_Test.java b/langtools/test/tools/javac/main/Option_J_At_Test.java
index 66246a59b90..256eecd59be 100644
--- a/langtools/test/tools/javac/main/Option_J_At_Test.java
+++ b/langtools/test/tools/javac/main/Option_J_At_Test.java
@@ -1,7 +1,3 @@
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
 /*
  * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -31,6 +27,9 @@ import java.io.StringWriter;
  * @summary extra space in javac -help for -J and @ options
  */
 
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
 public class Option_J_At_Test {
     public static void main(String... args) throws Exception {
         new Option_J_At_Test().run();
diff --git a/langtools/test/tools/javac/processing/model/util/elements/Foo.java b/langtools/test/tools/javac/processing/model/util/elements/Foo.java
index 39b4eb9f316..d370e200470 100644
--- a/langtools/test/tools/javac/processing/model/util/elements/Foo.java
+++ b/langtools/test/tools/javac/processing/model/util/elements/Foo.java
@@ -1,4 +1,3 @@
-
 /*
  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

From 8bf55955dff94a1459354eae35098c9346a6a78b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joel=20Borggr=C3=A9n-Franck?= <jfranck@openjdk.org>
Date: Fri, 21 Nov 2014 12:36:21 +0100
Subject: [PATCH 130/299] 8062359: javac Attr crashes with NPE in
 TypeAnnotationsValidator visitNewClass

Reviewed-by: jlahoda, vromero
---
 .../classes/com/sun/tools/javac/comp/Attr.java  | 17 +++++++++--------
 .../8062359/UnresolvableClassNPEInAttrTest.java | 17 +++++++++++++++++
 .../8062359/UnresolvableClassNPEInAttrTest.out  |  2 ++
 3 files changed, 28 insertions(+), 8 deletions(-)
 create mode 100644 langtools/test/tools/javac/8062359/UnresolvableClassNPEInAttrTest.java
 create mode 100644 langtools/test/tools/javac/8062359/UnresolvableClassNPEInAttrTest.out

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
index 6101af3ba42..0ad60fe8813 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -4490,14 +4490,15 @@ public class Attr extends JCTree.Visitor {
             super.visitTypeTest(tree);
         }
         public void visitNewClass(JCNewClass tree) {
-            if (tree.clazz.hasTag(ANNOTATED_TYPE)) {
-                checkForDeclarationAnnotations(((JCAnnotatedType) tree.clazz).annotations,
-                        tree.clazz.type.tsym);
-            }
-            if (tree.def != null) {
-                checkForDeclarationAnnotations(tree.def.mods.annotations, tree.clazz.type.tsym);
-            }
-            if (tree.clazz.type != null) {
+            if (tree.clazz != null && tree.clazz.type != null) {
+                if (tree.clazz.hasTag(ANNOTATED_TYPE)) {
+                    checkForDeclarationAnnotations(((JCAnnotatedType) tree.clazz).annotations,
+                            tree.clazz.type.tsym);
+                }
+                if (tree.def != null) {
+                    checkForDeclarationAnnotations(tree.def.mods.annotations, tree.clazz.type.tsym);
+                }
+
                 validateAnnotatedType(tree.clazz, tree.clazz.type);
             }
             super.visitNewClass(tree);
diff --git a/langtools/test/tools/javac/8062359/UnresolvableClassNPEInAttrTest.java b/langtools/test/tools/javac/8062359/UnresolvableClassNPEInAttrTest.java
new file mode 100644
index 00000000000..0880fde6cfc
--- /dev/null
+++ b/langtools/test/tools/javac/8062359/UnresolvableClassNPEInAttrTest.java
@@ -0,0 +1,17 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8062359
+ * @summary NullPointerException in Attr when type-annotating an anonymous
+ *          inner class in an unresolvable class
+ * @compile/fail/ref=UnresolvableClassNPEInAttrTest.out -XDrawDiagnostics UnresolvableClassNPEInAttrTest.java
+ */
+
+public class UnresolvableClassNPEInAttrTest {
+    public static void main(String[] args) {
+        new Undefined() {
+            void test() {
+                new Object() {};
+            }
+        };
+    }
+}
diff --git a/langtools/test/tools/javac/8062359/UnresolvableClassNPEInAttrTest.out b/langtools/test/tools/javac/8062359/UnresolvableClassNPEInAttrTest.out
new file mode 100644
index 00000000000..efb2a277ecf
--- /dev/null
+++ b/langtools/test/tools/javac/8062359/UnresolvableClassNPEInAttrTest.out
@@ -0,0 +1,2 @@
+UnresolvableClassNPEInAttrTest.java:11:13: compiler.err.cant.resolve.location: kindname.class, Undefined, , , (compiler.misc.location: kindname.class, UnresolvableClassNPEInAttrTest, null)
+1 error

From bf5546e48d73a99da21a94e4dc8a542b1424235b Mon Sep 17 00:00:00 2001
From: Igor Ignatyev <iignatyev@openjdk.org>
Date: Fri, 21 Nov 2014 17:27:11 +0300
Subject: [PATCH 131/299] 8059550: JEP-JDK-8043304: Test task: segment overflow
 w/ empty others

Reviewed-by: kvn, thartmann, iignatyev
---
 .../src/share/vm/compiler/compileBroker.hpp   |  1 +
 hotspot/src/share/vm/prims/whitebox.cpp       | 13 +++
 .../codecache/OverflowCodeCacheTest.java      | 96 +++++++++++++++++++
 .../whitebox/sun/hotspot/WhiteBox.java        |  2 +
 .../whitebox/sun/hotspot/code/BlobType.java   | 13 ++-
 .../whitebox/sun/hotspot/code/CodeBlob.java   |  7 ++
 6 files changed, 131 insertions(+), 1 deletion(-)
 create mode 100644 hotspot/test/compiler/codecache/OverflowCodeCacheTest.java

diff --git a/hotspot/src/share/vm/compiler/compileBroker.hpp b/hotspot/src/share/vm/compiler/compileBroker.hpp
index e6d8bb9bdb9..b35d3766d5f 100644
--- a/hotspot/src/share/vm/compiler/compileBroker.hpp
+++ b/hotspot/src/share/vm/compiler/compileBroker.hpp
@@ -415,6 +415,7 @@ class CompileBroker: AllStatic {
     shutdown_compilaton = 2
   };
 
+  static jint get_compilation_activity_mode() { return _should_compile_new_jobs; }
   static bool should_compile_new_jobs() { return UseCompiler && (_should_compile_new_jobs == run_compilation); }
   static bool set_should_compile_new_jobs(jint new_state) {
     // Return success if the current caller set it
diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp
index f412484cbe0..1f18c63c37b 100644
--- a/hotspot/src/share/vm/prims/whitebox.cpp
+++ b/hotspot/src/share/vm/prims/whitebox.cpp
@@ -944,6 +944,16 @@ WB_ENTRY(jobjectArray, WB_GetCodeHeapEntries(JNIEnv* env, jobject o, jint blob_t
   return result;
 WB_END
 
+WB_ENTRY(jint, WB_GetCompilationActivityMode(JNIEnv* env, jobject o))
+  return CompileBroker::get_compilation_activity_mode();
+WB_END
+
+WB_ENTRY(jobjectArray, WB_GetCodeBlob(JNIEnv* env, jobject o, jlong addr))
+    ThreadToNativeFromVM ttn(thread);
+    CodeBlobStub stub((CodeBlob*) addr);
+    return codeBlob2objectArray(thread, env, &stub);
+WB_END
+
 WB_ENTRY(jlong, WB_GetThreadStackSize(JNIEnv* env, jobject o))
   return (jlong) Thread::current()->stack_size();
 WB_END
@@ -1194,6 +1204,9 @@ static JNINativeMethod methods[] = {
   {CC"allocateCodeBlob",   CC"(II)J",                 (void*)&WB_AllocateCodeBlob   },
   {CC"freeCodeBlob",       CC"(J)V",                  (void*)&WB_FreeCodeBlob       },
   {CC"getCodeHeapEntries", CC"(I)[Ljava/lang/Object;",(void*)&WB_GetCodeHeapEntries },
+  {CC"getCompilationActivityMode",
+                           CC"()I",                   (void*)&WB_GetCompilationActivityMode},
+  {CC"getCodeBlob",        CC"(J)[Ljava/lang/Object;",(void*)&WB_GetCodeBlob        },
   {CC"getThreadStackSize", CC"()J",                   (void*)&WB_GetThreadStackSize },
   {CC"getThreadRemainingStackSize", CC"()J",          (void*)&WB_GetThreadRemainingStackSize },
 };
diff --git a/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java
new file mode 100644
index 00000000000..c772f4fbddc
--- /dev/null
+++ b/hotspot/test/compiler/codecache/OverflowCodeCacheTest.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2014, 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.lang.management.MemoryPoolMXBean;
+import java.util.EnumSet;
+import java.util.ArrayList;
+
+import sun.hotspot.WhiteBox;
+import sun.hotspot.code.BlobType;
+import sun.hotspot.code.CodeBlob;
+import com.oracle.java.testlibrary.Asserts;
+
+/*
+ * @test OverflowCodeCacheTest
+ * @bug 8059550
+ * @library /testlibrary /testlibrary/whitebox
+ * @build OverflowCodeCacheTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ *                   -XX:-SegmentedCodeCache OverflowCodeCacheTest
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:CompileCommand=compileonly,null::*
+ *                   -XX:+SegmentedCodeCache OverflowCodeCacheTest
+ * @summary testing of code cache segments overflow
+ */
+public class OverflowCodeCacheTest {
+    private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+
+    public static void main(String[] args) {
+        EnumSet<BlobType> blobTypes = BlobType.getAvailable();
+        for (BlobType type : blobTypes) {
+            new OverflowCodeCacheTest(type).test();
+        }
+    }
+
+    private final BlobType type;
+    private final MemoryPoolMXBean bean;
+    private OverflowCodeCacheTest(BlobType type) {
+        this.type = type;
+        this.bean = type.getMemoryPool();
+    }
+
+    private void test() {
+        System.out.printf("type %s%n", type);
+        System.out.println("allocating till possible...");
+        ArrayList<Long> blobs = new ArrayList<>();
+        try {
+            long addr;
+            int size = (int) (getHeapSize() >> 7);
+            while ((addr = WHITE_BOX.allocateCodeBlob(size, type.id)) != 0) {
+                blobs.add(addr);
+
+                BlobType actualType = CodeBlob.getCodeBlob(addr).code_blob_type;
+                if (actualType != type) {
+                    // check we got allowed overflow handling
+                    Asserts.assertTrue(type.allowTypeWhenOverflow(actualType),
+                            type + " doesn't allow using " + actualType + " when overflow");
+                }
+            }
+            Asserts.assertNotEquals(WHITE_BOX.getCompilationActivityMode(), 1 /* run_compilation*/,
+                    "Compilation must be disabled when CodeCache(CodeHeap) overflows");
+        } finally {
+            for (Long blob : blobs) {
+                WHITE_BOX.freeCodeBlob(blob);
+            }
+        }
+    }
+
+    private long getHeapSize() {
+        return bean.getUsage().getMax();
+    }
+
+}
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
index 1759d925731..f4bda72cf1d 100644
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
@@ -151,6 +151,8 @@ public class WhiteBox {
   public native void    freeCodeBlob(long addr);
   public native void    forceNMethodSweep();
   public native Object[] getCodeHeapEntries(int type);
+  public native int     getCompilationActivityMode();
+  public native Object[] getCodeBlob(long addr);
 
   // Intered strings
   public native boolean isInStringTable(String str);
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java
index ee273bcd916..49d3a0a03d2 100644
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/BlobType.java
@@ -36,7 +36,13 @@ public enum BlobType {
     // Execution level 2 and 3 (profiled) nmethods
     MethodProfiled(1, "CodeHeap 'profiled nmethods'"),
     // Non-nmethods like Buffers, Adapters and Runtime Stubs
-    NonNMethod(2, "CodeHeap 'non-nmethods'"),
+    NonNMethod(2, "CodeHeap 'non-nmethods'") {
+        @Override
+        public boolean allowTypeWhenOverflow(BlobType type) {
+            return super.allowTypeWhenOverflow(type)
+                    || type == BlobType.MethodNonProfiled;
+        }
+    },
     // All types (No code cache segmentation)
     All(3, "CodeCache");
 
@@ -57,6 +63,11 @@ public enum BlobType {
         }
         return null;
     }
+
+    public boolean allowTypeWhenOverflow(BlobType type) {
+        return type == this;
+    }
+
     public static EnumSet<BlobType> getAvailable() {
         WhiteBox whiteBox = WhiteBox.getWhiteBox();
         if (!whiteBox.getBooleanVMFlag("SegmentedCodeCache")) {
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java
index 66556ddaa7c..a5097f1c7e4 100644
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/code/CodeBlob.java
@@ -39,6 +39,13 @@ public class CodeBlob {
     }
     return result;
   }
+  public static CodeBlob getCodeBlob(long addr) {
+    Object[] obj = WB.getCodeBlob(addr);
+    if (obj == null) {
+      return null;
+    }
+    return new CodeBlob(obj);
+  }
   protected CodeBlob(Object[] obj) {
     assert obj.length == 3;
     name = (String) obj[0];

From 585ca822b81d8d5660b0e8aa41fd5b2b6ab500d0 Mon Sep 17 00:00:00 2001
From: Tatiana Pivovarova <tatiana.pivovarova@oracle.com>
Date: Fri, 21 Nov 2014 17:28:29 +0300
Subject: [PATCH 132/299] 8064696: compiler/startup/SmallCodeCacheStartup.java
 doesn't check exit code

Reviewed-by: kvn, anoll, iignatyev
---
 .../test/compiler/startup/SmallCodeCacheStartup.java  | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java
index 72583df8502..55eb7b2b27d 100644
--- a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java
+++ b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014 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
@@ -33,14 +33,13 @@ import com.oracle.java.testlibrary.*;
 
 public class SmallCodeCacheStartup {
   public static void main(String[] args) throws Exception {
-    try {
       ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=3m",
                                                                 "-XX:CICompilerCount=64",
                                                                 "-Xcomp",
-                                                                "SmallCodeCacheStartup");
-      pb.start();
-    } catch (VirtualMachineError e) {}
+                                                                "-version");
+      OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
+      analyzer.shouldHaveExitValue(0);
 
-    System.out.println("TEST PASSED");
+      System.out.println("TEST PASSED");
   }
 }

From 2c4ba7c947ada018b9713e3142bdde10c820545c Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie <ihse@openjdk.org>
Date: Fri, 21 Nov 2014 16:05:11 +0100
Subject: [PATCH 133/299] 8058631: Rename posix to unix in build system to
 match file name changes

Reviewed-by: simonis, erikj, tbell
---
 jdk/make/CompileDemos.gmk                  |  8 +--
 jdk/make/CreateJars.gmk                    |  4 +-
 jdk/make/Import.gmk                        |  4 +-
 jdk/make/copy/Copy-java.base.gmk           |  4 +-
 jdk/make/copy/Copy-java.desktop.gmk        |  4 +-
 jdk/make/gensrc/GensrcIcons.gmk            |  4 +-
 jdk/make/gensrc/GensrcX11Wrappers.gmk      |  4 +-
 jdk/make/launcher/Launcher-jdk.runtime.gmk |  4 +-
 jdk/make/launcher/LauncherCommon.gmk       | 11 ++--
 jdk/make/lib/Awt2dLibraries.gmk            | 62 +++++++++++-----------
 jdk/make/lib/CoreLibraries.gmk             | 12 ++---
 jdk/make/lib/Lib-java.instrument.gmk       |  2 +-
 jdk/make/lib/Lib-java.management.gmk       |  2 +-
 jdk/make/lib/Lib-java.prefs.gmk            |  2 +-
 jdk/make/lib/Lib-java.security.jgss.gmk    |  4 +-
 jdk/make/lib/Lib-java.smartcardio.gmk      |  8 +--
 jdk/make/lib/Lib-jdk.crypto.mscapi.gmk     |  2 +-
 jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk     |  4 +-
 jdk/make/lib/Lib-jdk.jdi.gmk               |  2 +-
 jdk/make/lib/Lib-jdk.jdwp.agent.gmk        |  4 +-
 jdk/make/lib/Lib-jdk.runtime.gmk           |  4 +-
 jdk/make/lib/Lib-jdk.sctp.gmk              |  8 +--
 jdk/make/lib/Lib-jdk.security.auth.gmk     |  2 +-
 jdk/make/lib/LibCommon.gmk                 |  6 +--
 jdk/make/lib/NetworkingLibraries.gmk       |  3 +-
 jdk/make/lib/NioLibraries.gmk              |  6 +--
 jdk/make/lib/SoundLibraries.gmk            |  4 +-
 27 files changed, 91 insertions(+), 93 deletions(-)

diff --git a/jdk/make/CompileDemos.gmk b/jdk/make/CompileDemos.gmk
index b82548edb7a..6052468b381 100644
--- a/jdk/make/CompileDemos.gmk
+++ b/jdk/make/CompileDemos.gmk
@@ -44,7 +44,7 @@ BUILD_DEMOS =
 DEMO_SHARE_SRC := $(JDK_TOPDIR)/src/demo/share
 DEMO_CLOSED_SHARE_SRC := $(JDK_TOPDIR)/src/closed/demo/share
 DEMO_SOLARIS_SRC := $(JDK_TOPDIR)/src/demo/solaris
-DEMO_OS_API_SRC := $(JDK_TOPDIR)/src/demo/$(OPENJDK_TARGET_OS_API_DIR)
+DEMO_OS_TYPE_SRC := $(JDK_TOPDIR)/src/demo/$(OPENJDK_TARGET_OS_TYPE)
 VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
 
 ##################################################################################################
@@ -214,13 +214,13 @@ define SetupJVMTIDemo
   # Param 2 = add these directories to the includes, default is agent_util
   # Param 3 = extra CFLAGS
   # Param 4 = C or C++ (defaults to C)
-  # Param 5 = libs for posix
+  # Param 5 = libs for unix
   # Param 6 = libs for windows
   # Param 7 = libs for solaris
   # Param 8 = libs for linux
   # Param 9 = extra directories with required sources
   BUILD_DEMO_JVMTI_$1_EXTRA_SRC := \
-      $$(wildcard $(DEMO_OS_API_SRC)/jvmti/$1) \
+      $$(wildcard $(DEMO_OS_TYPE_SRC)/jvmti/$1) \
       $$(wildcard $$(addprefix $(DEMO_SHARE_SRC)/jvmti/, $2)) \
       $9
   BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE := \
@@ -257,7 +257,7 @@ define SetupJVMTIDemo
       LDFLAGS := $(filter-out -incremental:no -opt:ref, $(LDFLAGS_JDKLIB)), \
       LDFLAGS_macosx := $(call SET_EXECUTABLE_ORIGIN), \
       LDFLAGS_SUFFIX := $$($1_EXTRA_CXX), \
-      LDFLAGS_SUFFIX_posix := $5, \
+      LDFLAGS_SUFFIX_unix := $5, \
       LDFLAGS_SUFFIX_windows := $6, \
       LDFLAGS_SUFFIX_solaris := $7 -lc, \
       LDFLAGS_SUFFIX_linux := $8, \
diff --git a/jdk/make/CreateJars.gmk b/jdk/make/CreateJars.gmk
index 568eeb2e0f3..3b7438a376a 100644
--- a/jdk/make/CreateJars.gmk
+++ b/jdk/make/CreateJars.gmk
@@ -656,7 +656,7 @@ endif
 SRC_ZIP_SRCS := $(wildcard \
     $(JDK_TOPDIR)/src/*/share/classes \
     $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \
-    $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_API_DIR)/classes \
+    $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_TYPE)/classes \
     $(LANGTOOLS_TOPDIR)/src/*/share/classes \
     $(CORBA_TOPDIR)/src/*/share/classes \
     $(JAXP_TOPDIR)/src/*/share/classes \
@@ -679,7 +679,7 @@ $(eval $(call SetupCopyFiles,COPY_LAUNCHER_SRC, \
     FILES := $(wildcard \
         $(JDK_TOPDIR)/src/java.base/share/native/launcher/* \
         $(JDK_TOPDIR)/src/java.base/share/native/libjli/* \
-        $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli/java_md*)))
+        $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli/java_md*)))
 
 LAUNCHER_ZIP_SRC := $(COPY_LAUNCHER_SRC)
 
diff --git a/jdk/make/Import.gmk b/jdk/make/Import.gmk
index 5bf9437da7f..43c5bc57363 100644
--- a/jdk/make/Import.gmk
+++ b/jdk/make/Import.gmk
@@ -30,8 +30,8 @@ include MakeBase.gmk
 
 ################################################################################
 
-# Put the libraries here. Different locations for different target apis.
-ifeq ($(OPENJDK_TARGET_OS_API), posix)
+# Put the libraries here. Different locations for different target OS types.
+ifeq ($(OPENJDK_TARGET_OS_TYPE), unix)
   INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
   HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)
 else
diff --git a/jdk/make/copy/Copy-java.base.gmk b/jdk/make/copy/Copy-java.base.gmk
index fd9a0ef3afa..bcffc7d6459 100644
--- a/jdk/make/copy/Copy-java.base.gmk
+++ b/jdk/make/copy/Copy-java.base.gmk
@@ -83,7 +83,7 @@ endif
 ifeq ($(OPENJDK_TARGET_OS), macosx)
   JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/macosx/conf/$(JVMCFG_ARCH)/jvm.cfg
 else
-  JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/conf/$(JVMCFG_ARCH)/jvm.cfg
+  JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/$(JVMCFG_ARCH)/jvm.cfg
 endif
 JVMCFG_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
 JVMCFG := $(JVMCFG_DIR)/jvm.cfg
@@ -190,7 +190,7 @@ $(JDK_OUTPUTDIR)/lib/net.properties: $(JDK_TOPDIR)/src/java.base/share/conf/net.
 NET_CONF_FILES += $(JDK_OUTPUTDIR)/lib/net.properties
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-  $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/${OPENJDK_TARGET_OS_API_DIR}/conf/sdp/sdp.conf.template
+  $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/conf/sdp/sdp.conf.template
 	$(ECHO) $(LOG_INFO) Copying $(@F)
 	$(call install-file)
 
diff --git a/jdk/make/copy/Copy-java.desktop.gmk b/jdk/make/copy/Copy-java.desktop.gmk
index b3fd662bf9c..c6f3e24b8f2 100644
--- a/jdk/make/copy/Copy-java.desktop.gmk
+++ b/jdk/make/copy/Copy-java.desktop.gmk
@@ -102,13 +102,13 @@ DESKTOP_CONF_FILES += $(PSFONTPROPFILE_TARGET_FILES)
 # Copy cursor.properties and cursors gif files to LIB_DST_DIR
 #
 ifneq ($(OPENJDK_TARGET_OS), macosx)
-  OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/conf
+  OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/conf
 else
   OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/macosx/conf
 endif
 
 CURSORS_DEST_DIR := $(LIB_DST_DIR)/images/cursors
-CURSORS_OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/conf/images/cursors
+CURSORS_OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/conf/images/cursors
 
 $(CURSORS_DEST_DIR)/cursors.properties: $(CURSORS_OPENJDK_TARGET_OS_LIB_SRC)/cursors.properties
 	$(call install-file)
diff --git a/jdk/make/gensrc/GensrcIcons.gmk b/jdk/make/gensrc/GensrcIcons.gmk
index e9b32f8f0b5..6acd8b206b6 100644
--- a/jdk/make/gensrc/GensrcIcons.gmk
+++ b/jdk/make/gensrc/GensrcIcons.gmk
@@ -29,9 +29,9 @@ GENSRC_AWT_ICONS_TMP := $(JDK_OUTPUTDIR)/gensrc
 GENSRC_AWT_ICONS_DST := $(GENSRC_AWT_ICONS_TMP)/java.desktop/sun/awt/
 
 ifdef OPENJDK
-  X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)
+  X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)
 else
-  X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/closed/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)
+  X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/closed/java.desktop/$(OPENJDK_TARGET_OS_TYPE)
 endif
 
 GENSRC_AWT_ICONS_SRC += \
diff --git a/jdk/make/gensrc/GensrcX11Wrappers.gmk b/jdk/make/gensrc/GensrcX11Wrappers.gmk
index b21729654f8..f5e85e616a8 100644
--- a/jdk/make/gensrc/GensrcX11Wrappers.gmk
+++ b/jdk/make/gensrc/GensrcX11Wrappers.gmk
@@ -95,8 +95,8 @@ ifneq ($(COMPILE_TYPE), cross)
       -I$(JDK_TOPDIR)/src/java.base/share/native/include \
       -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_EXPORT_DIR)/native/include \
       -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
-      -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava \
-      -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \
+      -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
+      -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
       -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
       #
diff --git a/jdk/make/launcher/Launcher-jdk.runtime.gmk b/jdk/make/launcher/Launcher-jdk.runtime.gmk
index cf6be2d2467..a8b21fe42e7 100644
--- a/jdk/make/launcher/Launcher-jdk.runtime.gmk
+++ b/jdk/make/launcher/Launcher-jdk.runtime.gmk
@@ -42,7 +42,7 @@ UNPACKEXE_SRC := $(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \
     $(JDK_TOPDIR)/src/jdk.runtime/share/native/unpack200
 UNPACKEXE_CFLAGS := -I$(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \
     -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
-    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava
+    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava
 
 ifeq ($(USE_EXTERNAL_LIBZ), true)
   UNPACKEXE_CFLAGS += -DSYSTEM_ZLIB
@@ -102,7 +102,7 @@ $(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
     MAPFILE := $(UNPACK_MAPFILE),\
     LDFLAGS := $(UNPACKEXE_ZIPOBJS), \
     LDFLAGS_windows := $(CXXFLAGS_JDKEXE), \
-    LDFLAGS_posix := $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
+    LDFLAGS_unix := $(LDFLAGS_JDKEXE) $(LDFLAGS_CXX_JDK) \
         $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX)) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LDFLAGS_linux := -lc, \
diff --git a/jdk/make/launcher/LauncherCommon.gmk b/jdk/make/launcher/LauncherCommon.gmk
index f8ff00c830d..ad344b4faa4 100644
--- a/jdk/make/launcher/LauncherCommon.gmk
+++ b/jdk/make/launcher/LauncherCommon.gmk
@@ -62,7 +62,7 @@ endif
 LAUNCHER_SRC := $(JDK_TOPDIR)/src/java.base/share/native/launcher
 LAUNCHER_CFLAGS := -I$(JDK_TOPDIR)/src/java.base/share/native/launcher \
     -I$(JDK_TOPDIR)/src/java.base/share/native/libjli \
-    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli \
+    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli \
     -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libjli \
     #
 GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
@@ -71,10 +71,10 @@ MACOSX_PLIST_DIR := $(JDK_TOPDIR)/src/java.base/macosx/native/launcher
 # Until the shuffle is permanent, we can't add this in configure
 CFLAGS_JDKEXE := $(filter-out %javavm/export, $(CFLAGS_JDKEXE))
 CFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \
-    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/include
+    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include
 CXXFLAGS_JDKEXE := $(filter-out %javavm/export, $(CXXFLAGS_JDKEXE))
 CXXFLAGS_JDKEXE += -I$(JDK_TOPDIR)/src/java.base/share/native/include \
-    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/include
+    -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/include
 JAVA_MANIFEST := $(JDK_TOPDIR)/src/java.base/windows/native/launcher/java.manifest
 
 define SetupLauncher
@@ -82,7 +82,7 @@ define SetupLauncher
   # Parameter 1 is the name of the launcher (java, javac, jar...)
   # Parameter 2 is extra CFLAGS
   # Parameter 3 is extra LDFLAGS
-  # Parameter 4 is extra LDFLAGS_SUFFIX_posix
+  # Parameter 4 is extra LDFLAGS_SUFFIX_unix
   # Parameter 5 is extra LDFLAGS_SUFFIX_windows
   # Parameter 6 is optional Windows JLI library (full path)
   # Parameter 7 is optional Windows resource (RC) flags
@@ -187,7 +187,7 @@ define SetupLauncher
           $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \
       MAPFILE := $$($1_MAPFILE), \
       LDFLAGS_SUFFIX := $(LDFLAGS_JDKEXE_SUFFIX) $$($1_LDFLAGS_SUFFIX), \
-      LDFLAGS_SUFFIX_posix := $4, \
+      LDFLAGS_SUFFIX_unix := $4, \
       LDFLAGS_SUFFIX_windows := $$($1_WINDOWS_JLI_LIB) \
           $(JDK_OUTPUTDIR)/objs/libjava/java.lib advapi32.lib $5, \
       LDFLAGS_SUFFIX_linux := -L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli $(LIBDL) -lc, \
@@ -231,4 +231,3 @@ ifdef OPENJDK
 else
   JAVA_RC_FLAGS += -i "$(JDK_TOPDIR)/src/closed/java.base/windows/native/launcher/icons"
 endif
-
diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
index 0d38b332892..68b9f69ed20 100644
--- a/jdk/make/lib/Awt2dLibraries.gmk
+++ b/jdk/make/lib/Awt2dLibraries.gmk
@@ -31,7 +31,7 @@ BUILD_LIBMLIB_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/libmlib_image \
     $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/medialib
 BUILD_LIBMLIB_CFLAGS := -D__USE_J2D_NAMES -D__MEDIALIB_OLD_NAMES \
     $(addprefix -I, $(BUILD_LIBMLIB_SRC)) \
-    -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libmlib_image
+    -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libmlib_image
 
 BUILD_LIBMLIB_LDLIBS :=
 BUILD_LIBMLIB_IMAGE_MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libmlib_image/mapfile-vers
@@ -144,9 +144,9 @@ endif
 ################################################################################
 
 LIBAWT_DIRS := $(JDK_TOPDIR)/src/java.desktop/share/native/libawt \
-    $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt \
+    $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \
     $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-    $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \
+    $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
     #
 
 ifeq ($(OPENJDK_TARGET_OS), aix)
@@ -211,7 +211,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
   # Why does libawt need java.base headers?
   LIBAWT_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
       -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
-      -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/opengl \
+      -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
       -I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \
       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
       -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \
@@ -298,15 +298,15 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
   ifndef BUILD_HEADLESS_ONLY
 
     LIBAWT_XAWT_DIRS := \
-        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt_xawt \
-        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjawt \
+        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt_xawt \
+        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt \
         $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
         $(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/utility \
         $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
         $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
-        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/opengl \
-        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/x11 \
-        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \
+        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
+        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \
+        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
         #
 
     LIBAWT_XAWT_EXCLUDES := medialib
@@ -315,15 +315,15 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
         -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
         -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
-        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/include \
+        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
-        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/java2d \
+        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
-        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libsunwjdga \
-        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/font \
+        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga \
+        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
         $(LIBJAVA_HEADER_FLAGS)
         #
 
@@ -514,14 +514,14 @@ DESKTOP_LIBRARIES += $(BUILD_LIBJAVAJPEG)
 ################################################################################
 
 LIBFONTMANAGER_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/libfontmanager \
-    $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libfontmanager
+    $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libfontmanager
 LIBFONTMANAGER_CFLAGS := \
     $(addprefix -I, $(shell $(FIND) \
       $(LIBFONTMANAGER_SRC) \
       $(JDK_TOPDIR)/src/java.desktop/share/native/libawt \
-      $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt \
+      $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt \
       $(JDK_TOPDIR)/src/java.desktop/share/native/common \
-      $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common -type d)) \
+      $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common -type d)) \
     -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
     $(LIBJAVA_HEADER_FLAGS) \
     #
@@ -542,7 +542,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
   LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
       X11TextRenderer.c
   LIBFONTMANAGER_OPTIMIZATION := HIGHEST
-  LIBFONTMANAGER_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/windows
+  LIBFONTMANAGER_CFLAGS += -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows
 else ifeq ($(OPENJDK_TARGET_OS), macosx)
   LIBFONTMANAGER_EXCLUDE_FILES += X11FontScaler.c \
       X11TextRenderer.c \
@@ -606,12 +606,12 @@ DESKTOP_LIBRARIES += $(BUILD_LIBFONTMANAGER)
 ################################################################################
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjawt
-  LIBJAWT_CFLAGS := -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/windows \
+  LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt
+  LIBJAWT_CFLAGS := -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/windows \
       -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
-      -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/java2d/windows \
+      -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d/windows \
       -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
       -I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \
       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
@@ -655,12 +655,12 @@ else # OPENJDK_TARGET_OS not windows
   ifeq ($(OPENJDK_TARGET_OS), macosx)
     LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/macosx/native/libjawt
   else
-    LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjawt
+    LIBJAWT_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjawt
   endif
   LIBJAWT_CFLAGS := \
-      -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \
+      -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
-      -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/include \
+      -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/include \
       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
       $(LIBJAVA_HEADER_FLAGS) \
       #
@@ -724,9 +724,9 @@ ifeq ($(BUILD_HEADLESS), true)
   ifeq ($(findstring $(OPENJDK_TARGET_OS), windows macosx),)
 
     LIBAWT_HEADLESS_DIRS := $(JDK_TOPDIR)/src/java.desktop/unix/native/libawt_headless/awt \
-        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/awt \
-        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/opengl \
-        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/x11 \
+        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/awt \
+        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/opengl \
+        $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/java2d/x11 \
         $(JDK_TOPDIR)/src/java.desktop/share/native/common/java2d/opengl \
         $(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
         #
@@ -739,11 +739,11 @@ ifeq ($(BUILD_HEADLESS), true)
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/pipe \
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image \
-        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/java2d \
+        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libawt/java2d \
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/font \
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
-        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/font \
-        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libsunwjdga/ \
+        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/common/font \
+        -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsunwjdga/ \
         $(LIBJAVA_HEADER_FLAGS) \
         #
 
@@ -817,7 +817,7 @@ ifndef BUILD_HEADLESS_ONLY
   endif
 
   ifneq ($(OPENJDK_TARGET_OS), macosx)
-    LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libsplashscreen
+    LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libsplashscreen
   else
     LIBSPLASHSCREEN_DIRS += $(JDK_TOPDIR)/src/java.desktop/macosx/native/libsplashscreen
   endif
@@ -988,7 +988,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
           -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/awt \
           -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
           -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
-          -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava \
+          -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
           -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop,  \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN) \
diff --git a/jdk/make/lib/CoreLibraries.gmk b/jdk/make/lib/CoreLibraries.gmk
index c6328d4bd38..3642ba35493 100644
--- a/jdk/make/lib/CoreLibraries.gmk
+++ b/jdk/make/lib/CoreLibraries.gmk
@@ -99,7 +99,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBVERIFY, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libverify/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
-    LDFLAGS_SUFFIX_posix := -ljvm -lc, \
+    LDFLAGS_SUFFIX_unix := -ljvm -lc, \
     LDFLAGS_SUFFIX_windows := jvm.lib, \
     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
     RC_FLAGS := $(RC_FLAGS) \
@@ -160,7 +160,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
-    LDFLAGS_SUFFIX_posix := -ljvm -lverify, \
+    LDFLAGS_SUFFIX_unix := -ljvm -lverify, \
     LDFLAGS_SUFFIX_solaris := -lsocket -lnsl -lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc, \
     LDFLAGS_SUFFIX_linux := $(LIBDL) $(BUILD_LIBFDLIBM), \
     LDFLAGS_SUFFIX_aix := $(LIBDL) $(BUILD_LIBFDLIBM) -lm,\
@@ -216,9 +216,9 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
     CFLAGS := $(CFLAGS_JDKLIB) \
         $(ZLIB_CPPFLAGS) \
         -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
-        -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava \
+        -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \
         -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base, \
-    CFLAGS_posix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
+    CFLAGS_unix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libzip/mapfile-vers, \
     REORDER := $(BUILD_LIBZIP_REORDER), \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -247,7 +247,7 @@ BASE_LIBRARIES += $(BUILD_LIBZIP)
 ##########################################################################################
 
 BUILD_LIBJLI_SRC_DIRS := $(JDK_TOPDIR)/src/java.base/share/native/libjli \
-    $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli
+    $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli
 
 LIBJLI_CFLAGS := $(CFLAGS_JDKLIB)
 
@@ -291,7 +291,7 @@ else ifneq ($(OPENJDK_TARGET_OS), macosx)
 
   # if the architecture specific ergo file exists then
   # use it, else use the generic definitions from ergo.c
-  ifneq ($(wildcard $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli/$(ERGO_ARCH_FILE)), )
+  ifneq ($(wildcard $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjli/$(ERGO_ARCH_FILE)), )
     BUILD_LIBJLI_FILES += $(ERGO_ARCH_FILE)
   else # !ERGO_ARCH_FILE
     LIBJLI_CFLAGS += -DUSE_GENERIC_ERGO
diff --git a/jdk/make/lib/Lib-java.instrument.gmk b/jdk/make/lib/Lib-java.instrument.gmk
index a54a743af39..a818f05e2c0 100644
--- a/jdk/make/lib/Lib-java.instrument.gmk
+++ b/jdk/make/lib/Lib-java.instrument.gmk
@@ -28,7 +28,7 @@ include LibCommon.gmk
 ################################################################################
 
 LIBINSTRUMENT_SRC := $(JDK_TOPDIR)/src/java.instrument/share/native/libinstrument \
-    $(JDK_TOPDIR)/src/java.instrument/$(OPENJDK_TARGET_OS_API_DIR)/native/libinstrument \
+    $(JDK_TOPDIR)/src/java.instrument/$(OPENJDK_TARGET_OS_TYPE)/native/libinstrument \
     #
 LIBINSTRUMENT_CFLAGS := $(CFLAGS_JDKLIB) \
     $(addprefix -I, $(LIBINSTRUMENT_SRC)) \
diff --git a/jdk/make/lib/Lib-java.management.gmk b/jdk/make/lib/Lib-java.management.gmk
index 2cc7b850621..21b14c3750a 100644
--- a/jdk/make/lib/Lib-java.management.gmk
+++ b/jdk/make/lib/Lib-java.management.gmk
@@ -31,7 +31,7 @@ $(eval $(call IncludeCustomExtension, jdk, lib/Lib-java.management.gmk))
 ################################################################################
 
 BUILD_LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/java.management/share/native/libmanagement \
-    $(JDK_TOPDIR)/src/java.management/$(OPENJDK_TARGET_OS_API_DIR)/native/libmanagement
+    $(JDK_TOPDIR)/src/java.management/$(OPENJDK_TARGET_OS_TYPE)/native/libmanagement
 BUILD_LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include \
     $(addprefix -I,$(BUILD_LIBMANAGEMENT_SRC)) \
     -I$(JDK_OUTPUTDIR)/gensrc_headers/java.management \
diff --git a/jdk/make/lib/Lib-java.prefs.gmk b/jdk/make/lib/Lib-java.prefs.gmk
index c034b190f41..e99f655b07c 100644
--- a/jdk/make/lib/Lib-java.prefs.gmk
+++ b/jdk/make/lib/Lib-java.prefs.gmk
@@ -30,7 +30,7 @@ include LibCommon.gmk
 ifeq ($(OPENJDK_TARGET_OS), macosx)
   LIBPREF_SRC_DIRS := $(JDK_TOPDIR)/src/java.prefs/macosx/native/libprefs
 else
-  LIBPREF_SRC_DIRS := $(JDK_TOPDIR)/src/java.prefs/$(OPENJDK_TARGET_OS_API_DIR)/native/libprefs
+  LIBPREF_SRC_DIRS := $(JDK_TOPDIR)/src/java.prefs/$(OPENJDK_TARGET_OS_TYPE)/native/libprefs
 endif
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBPREFS, \
diff --git a/jdk/make/lib/Lib-java.security.jgss.gmk b/jdk/make/lib/Lib-java.security.jgss.gmk
index d6f986628ae..50ff52a76fa 100644
--- a/jdk/make/lib/Lib-java.security.jgss.gmk
+++ b/jdk/make/lib/Lib-java.security.jgss.gmk
@@ -29,7 +29,7 @@ include LibCommon.gmk
 
 ifneq ($(OPENJDK_TARGET_OS), windows)
   LIBJ2GSS_SRC := $(JDK_TOPDIR)/src/java.security.jgss/share/native/libj2gss \
-      $(JDK_TOPDIR)/src/java.security.jgss/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2gss \
+      $(JDK_TOPDIR)/src/java.security.jgss/$(OPENJDK_TARGET_OS_TYPE)/native/libj2gss \
       #
 
   $(eval $(call SetupNativeCompilation,BUILD_LIBJ2GSS, \
@@ -58,7 +58,7 @@ ifneq ($(BUILD_CRYPTO), no)
   BUILD_LIBKRB5_NAME :=
   ifeq ($(OPENJDK_TARGET_OS), windows)
     BUILD_LIBKRB5_NAME := w2k_lsa_auth
-    BUILD_LIBKRB5_SRC := $(JDK_TOPDIR)/src/java.security.jgss/$(OPENJDK_TARGET_OS_API_DIR)/native/libw2k_lsa_auth
+    BUILD_LIBKRB5_SRC := $(JDK_TOPDIR)/src/java.security.jgss/$(OPENJDK_TARGET_OS_TYPE)/native/libw2k_lsa_auth
     BUILD_LIBKRB5_LIBS := advapi32.lib Secur32.lib netapi32.lib kernel32.lib user32.lib \
         gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib \
         ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib wsock32.lib
diff --git a/jdk/make/lib/Lib-java.smartcardio.gmk b/jdk/make/lib/Lib-java.smartcardio.gmk
index 7b7be4510b7..c445dcfde38 100644
--- a/jdk/make/lib/Lib-java.smartcardio.gmk
+++ b/jdk/make/lib/Lib-java.smartcardio.gmk
@@ -28,9 +28,9 @@ include LibCommon.gmk
 ################################################################################
 
 LIBJ2PCSC_SRC := $(JDK_TOPDIR)/src/java.smartcardio/share/native/libj2pcsc \
-    $(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2pcsc
+    $(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pcsc
 LIBJ2PCSC_CPPFLAGS := $(addprefix -I,$(LIBJ2PCSC_SRC)) \
-    -I$(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2pcsc/MUSCLE \
+    -I$(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pcsc/MUSCLE \
     -I$(JDK_OUTPUTDIR)/gensrc_headers/java.smartcardio
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC, \
@@ -38,13 +38,13 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC, \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
     SRC := $(LIBJ2PCSC_SRC), \
     LANG := C, \
-    CFLAGS_posix := -D__sun_jdk, \
+    CFLAGS_unix := -D__sun_jdk, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(LIBJ2PCSC_CPPFLAGS), \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pcsc/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
-    LDFLAGS_SUFFIX_posix := $(LIBDL), \
+    LDFLAGS_SUFFIX_unix := $(LIBDL), \
     LDFLAGS_SUFFIX_windows := winscard.lib, \
     LDFLAGS_SUFFIX_solaris := -lc, \
     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
diff --git a/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk b/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk
index a1e5fc0b15e..899ed6ca9cb 100644
--- a/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk
+++ b/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk
@@ -29,7 +29,7 @@ include LibCommon.gmk
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
 
-  LIBSUNMSCAPI_SRC := $(JDK_TOPDIR)/src/jdk.crypto.mscapi/$(OPENJDK_TARGET_OS_API_DIR)/native/libsunmscapi
+  LIBSUNMSCAPI_SRC := $(JDK_TOPDIR)/src/jdk.crypto.mscapi/$(OPENJDK_TARGET_OS_TYPE)/native/libsunmscapi
 
   $(eval $(call SetupNativeCompilation,BUILD_LIBSUNMSCAPI, \
       LIBRARY := sunmscapi, \
diff --git a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk
index fd35a9d5f9b..8135d28e18f 100644
--- a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk
+++ b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk
@@ -28,7 +28,7 @@ include LibCommon.gmk
 ################################################################################
 
 LIBJ2PKCS11_SRC := $(JDK_TOPDIR)/src/jdk.crypto.pkcs11/share/native/libj2pkcs11 \
-    $(JDK_TOPDIR)/src/jdk.crypto.pkcs11/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2pkcs11
+    $(JDK_TOPDIR)/src/jdk.crypto.pkcs11/$(OPENJDK_TARGET_OS_TYPE)/native/libj2pkcs11
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11, \
     LIBRARY := j2pkcs11, \
@@ -42,7 +42,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pkcs11/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
-    LDFLAGS_SUFFIX_posix := $(LIBDL), \
+    LDFLAGS_SUFFIX_unix := $(LIBDL), \
     LDFLAGS_SUFFIX_solaris := -lc, \
     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
     RC_FLAGS := $(RC_FLAGS) \
diff --git a/jdk/make/lib/Lib-jdk.jdi.gmk b/jdk/make/lib/Lib-jdk.jdi.gmk
index 8dc731bbf6c..8bacba8622e 100644
--- a/jdk/make/lib/Lib-jdk.jdi.gmk
+++ b/jdk/make/lib/Lib-jdk.jdi.gmk
@@ -30,7 +30,7 @@ include LibCommon.gmk
 ifeq ($(OPENJDK_TARGET_OS), windows)
 
   LIBDT_SHMEM_SRC := $(JDK_TOPDIR)/src/jdk.jdi/share/native/libdt_shmem \
-      $(JDK_TOPDIR)/src/jdk.jdi/$(OPENJDK_TARGET_OS_API_DIR)/native/libdt_shmem \
+      $(JDK_TOPDIR)/src/jdk.jdi/$(OPENJDK_TARGET_OS_TYPE)/native/libdt_shmem \
       #
   LIBDT_SHMEM_CPPFLAGS := -I$(INCLUDEDIR) -I$(JDK_OUTPUTDIR)/include/$(OPENJDK_TARGET_OS) \
       $(addprefix -I, $(LIBDT_SHMEM_SRC)) \
diff --git a/jdk/make/lib/Lib-jdk.jdwp.agent.gmk b/jdk/make/lib/Lib-jdk.jdwp.agent.gmk
index 7b13248a9be..18552857109 100644
--- a/jdk/make/lib/Lib-jdk.jdwp.agent.gmk
+++ b/jdk/make/lib/Lib-jdk.jdwp.agent.gmk
@@ -28,7 +28,7 @@ include LibCommon.gmk
 ################################################################################
 
 LIBDT_SOCKET_SRC := $(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libdt_socket \
-    $(JDK_TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_API_DIR)/native/libdt_socket
+    $(JDK_TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_TYPE)/native/libdt_socket
 LIBDT_SOCKET_CPPFLAGS := \
     $(addprefix -I, $(LIBDT_SOCKET_SRC)) \
     -I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \
@@ -66,7 +66,7 @@ JDWP_LIBRARIES += $(BUILD_LIBDT_SOCKET)
 ################################################################################
 
 LIBJDWP_SRC := $(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp \
-    $(JDK_TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_API_DIR)/native/libjdwp
+    $(JDK_TOPDIR)/src/jdk.jdwp.agent/$(OPENJDK_TARGET_OS_TYPE)/native/libjdwp
 LIBJDWP_CPPFLAGS := \
     -I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \
     -I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/include \
diff --git a/jdk/make/lib/Lib-jdk.runtime.gmk b/jdk/make/lib/Lib-jdk.runtime.gmk
index 3ffaa72570a..cee0cd7deda 100644
--- a/jdk/make/lib/Lib-jdk.runtime.gmk
+++ b/jdk/make/lib/Lib-jdk.runtime.gmk
@@ -45,7 +45,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
     LDFLAGS_windows := -map:$(JDK_OUTPUTDIR)/objs/unpack.map -debug \
         jvm.lib $(WIN_JAVA_LIB), \
-    LDFLAGS_SUFFIX_posix := -ljvm $(LIBCXX) -ljava -lc, \
+    LDFLAGS_SUFFIX_unix := -ljvm $(LIBCXX) -ljava -lc, \
     OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libunpack, \
     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
     RC_FLAGS := $(RC_FLAGS) \
@@ -61,7 +61,7 @@ UNPACK_LIBRARIES += $(BUILD_LIBUNPACK)
 ################################################################################
 
 LIBJSDT_SRC := $(JDK_TOPDIR)/src/jdk.runtime/share/native/libjsdt \
-    $(JDK_TOPDIR)/src/jdk.runtime/$(OPENJDK_TARGET_OS_API_DIR)/native/libjsdt
+    $(JDK_TOPDIR)/src/jdk.runtime/$(OPENJDK_TARGET_OS_TYPE)/native/libjsdt
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBJSDT, \
     LIBRARY := jsdt, \
diff --git a/jdk/make/lib/Lib-jdk.sctp.gmk b/jdk/make/lib/Lib-jdk.sctp.gmk
index 7afd0020be7..cfc13838c53 100644
--- a/jdk/make/lib/Lib-jdk.sctp.gmk
+++ b/jdk/make/lib/Lib-jdk.sctp.gmk
@@ -27,7 +27,7 @@ include LibCommon.gmk
 
 ################################################################################
 
-ifeq ($(OPENJDK_TARGET_OS_API), posix)
+ifeq ($(OPENJDK_TARGET_OS_TYPE), unix)
 
   ifeq (, $(filter $(OPENJDK_TARGET_OS), macosx aix))
 
@@ -40,11 +40,11 @@ ifeq ($(OPENJDK_TARGET_OS_API), posix)
     $(eval $(call SetupNativeCompilation,BUILD_LIBSCTP, \
         LIBRARY := sctp, \
         OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
-        SRC := $(JDK_TOPDIR)/src/jdk.sctp/$(OPENJDK_TARGET_OS_API_DIR)/native/libsctp, \
+        SRC := $(JDK_TOPDIR)/src/jdk.sctp/$(OPENJDK_TARGET_OS_TYPE)/native/libsctp, \
         LANG := C, \
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) \
-            -I $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnio/ch \
+            -I $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/ch \
             -I $(JDK_TOPDIR)/src/java.base/share/native/libnio/ch \
             $(addprefix -I, $(call FindSrcDirsForLib, java.base, net)) \
             $(LIBJAVA_HEADER_FLAGS) \
@@ -55,7 +55,7 @@ ifeq ($(OPENJDK_TARGET_OS_API), posix)
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
         LDFLAGS_SUFFIX_linux := -lpthread $(LIBDL) -ljava -ljvm, \
-        LDFLAGS_SUFFIX_posix := -lnio -lnet, \
+        LDFLAGS_SUFFIX_unix := -lnio -lnet, \
         LDFLAGS_SUFFIX_solaris := -lsocket -ljava -ljvm -lc, \
         LDFLAGS_SUFFIX_macosx := -ljava -ljvm, \
         OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsctp, \
diff --git a/jdk/make/lib/Lib-jdk.security.auth.gmk b/jdk/make/lib/Lib-jdk.security.auth.gmk
index 52151773886..17549a71482 100644
--- a/jdk/make/lib/Lib-jdk.security.auth.gmk
+++ b/jdk/make/lib/Lib-jdk.security.auth.gmk
@@ -43,7 +43,7 @@ endif
 $(eval $(call SetupNativeCompilation,BUILD_LIBJAAS, \
     LIBRARY := $(LIBJAAS_NAME), \
     OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \
-    SRC := $(JDK_TOPDIR)/src/jdk.security.auth/$(OPENJDK_TARGET_OS_API_DIR)/native/libjaas, \
+    SRC := $(JDK_TOPDIR)/src/jdk.security.auth/$(OPENJDK_TARGET_OS_TYPE)/native/libjaas, \
     LANG := C, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.security.auth, \
diff --git a/jdk/make/lib/LibCommon.gmk b/jdk/make/lib/LibCommon.gmk
index 885ba11c780..eede8fbd8de 100644
--- a/jdk/make/lib/LibCommon.gmk
+++ b/jdk/make/lib/LibCommon.gmk
@@ -34,8 +34,8 @@ include Tools.gmk
 
 GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
 
-# Put the libraries here. Different locations for different target apis.
-ifeq ($(OPENJDK_TARGET_OS_API), posix)
+# Put the libraries here. Different locations for different target OS types.
+ifeq ($(OPENJDK_TARGET_OS_TYPE), unix)
   INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
 else
   INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/bin
@@ -63,7 +63,7 @@ endif
 # Param 2 - library name
 FindSrcDirsForLib = $(call uniq, $(wildcard \
     $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
-    $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_API_DIR)/native/lib$(strip $2) \
+    $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_TYPE)/native/lib$(strip $2) \
     $(JDK_TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
 
 ################################################################################
diff --git a/jdk/make/lib/NetworkingLibraries.gmk b/jdk/make/lib/NetworkingLibraries.gmk
index a0825b06ce2..095d2773b46 100644
--- a/jdk/make/lib/NetworkingLibraries.gmk
+++ b/jdk/make/lib/NetworkingLibraries.gmk
@@ -24,7 +24,7 @@
 #
 
 LIBNET_SRC_DIRS := $(JDK_TOPDIR)/src/java.base/share/native/libnet \
-    $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnet
+    $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnet
 LIBNET_CFLAGS += -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \
     $(LIBJAVA_HEADER_FLAGS)
 
@@ -77,4 +77,3 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNET, \
 $(BUILD_LIBNET): $(BUILD_LIBJAVA)
 
 BASE_LIBRARIES += $(BUILD_LIBNET)
-
diff --git a/jdk/make/lib/NioLibraries.gmk b/jdk/make/lib/NioLibraries.gmk
index 722115fdee5..be851af88eb 100644
--- a/jdk/make/lib/NioLibraries.gmk
+++ b/jdk/make/lib/NioLibraries.gmk
@@ -25,10 +25,10 @@
 
 BUILD_LIBNIO_SRC := \
     $(JDK_TOPDIR)/src/java.base/share/native/libnio/ch \
-    $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnio \
+    $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio \
     $(sort $(wildcard \
-      $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnio/ch \
-      $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnio/fs \
+      $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/ch \
+      $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libnio/fs \
       $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libnio/ch \
       $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS)/native/libnio/fs)) \
     #
diff --git a/jdk/make/lib/SoundLibraries.gmk b/jdk/make/lib/SoundLibraries.gmk
index 6348f7a7d7b..c0a1219b684 100644
--- a/jdk/make/lib/SoundLibraries.gmk
+++ b/jdk/make/lib/SoundLibraries.gmk
@@ -25,7 +25,7 @@
 
 LIBJSOUND_SRC_DIRS := \
     $(JDK_TOPDIR)/src/java.desktop/share/native/libjsound \
-    $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjsound \
+    $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_TYPE)/native/libjsound \
     #
 LIBJSOUND_CFLAGS := \
     -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
@@ -165,7 +165,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
         -framework CoreServices -framework AudioUnit $(LIBCXX) \
         -framework CoreMIDI -framework AudioToolbox, \
     LDFLAGS_windows := $(WIN_JAVA_LIB) advapi32.lib winmm.lib, \
-    LDFLAGS_SUFFIX_posix := -ljava -ljvm, \
+    LDFLAGS_SUFFIX_unix := -ljava -ljvm, \
     LDFLAGS_SUFFIX_solaris := -lc, \
     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
     RC_FLAGS := $(RC_FLAGS) \

From b5ae347f9c3b048ec27d0099d7ea19af16429b38 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= <hannesw@openjdk.org>
Date: Fri, 21 Nov 2014 17:44:57 +0100
Subject: [PATCH 134/299] 8057691: Nashorn: let & const declarations are not
 shared between scripts

Reviewed-by: lagergren, attila
---
 .../internal/codegen/AssignSymbols.java       |   6 +-
 .../nashorn/internal/codegen/MapCreator.java  |   4 +
 .../jdk/nashorn/internal/objects/Global.java  | 188 +++++++++++++++-
 .../jdk/nashorn/internal/parser/Parser.java   |  22 +-
 .../nashorn/internal/runtime/Property.java    |  17 +-
 .../internal/runtime/ScriptObject.java        |  61 +++--
 .../es6/const-redeclare-extra.js.EXPECTED     |  12 +-
 nashorn/test/script/basic/es6/let-load.js     |   3 +-
 .../script/basic/es6/let-load.js.EXPECTED     |   4 +-
 .../basic/es6/let-redeclare-extra.js.EXPECTED |  10 +-
 .../script/basic/es6/lexical-toplevel-def.js  |  34 +++
 .../basic/es6/lexical-toplevel-print.js       |  51 +++++
 .../lexical-toplevel-redeclare-func-on-let.js |  31 +++
 ...xical-toplevel-redeclare-let-on-builtin.js |  30 +++
 .../lexical-toplevel-redeclare-let-on-func.js |  31 +++
 ...exical-toplevel-redeclare-let-on-global.js |  30 +++
 .../lexical-toplevel-redeclare-let-on-var.js  |  31 +++
 .../lexical-toplevel-redeclare-var-on-let.js  |  31 +++
 .../basic/es6/lexical-toplevel-redeclare.js   |  78 +++++++
 .../lexical-toplevel-redeclare.js.EXPECTED    | 100 +++++++++
 .../test/script/basic/es6/lexical-toplevel.js |  35 +++
 .../basic/es6/lexical-toplevel.js.EXPECTED    |  30 +++
 .../internal/runtime/LexicalBindingTest.java  | 212 ++++++++++++++++++
 23 files changed, 986 insertions(+), 65 deletions(-)
 create mode 100644 nashorn/test/script/basic/es6/lexical-toplevel-def.js
 create mode 100644 nashorn/test/script/basic/es6/lexical-toplevel-print.js
 create mode 100644 nashorn/test/script/basic/es6/lexical-toplevel-redeclare-func-on-let.js
 create mode 100644 nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-builtin.js
 create mode 100644 nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-func.js
 create mode 100644 nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-global.js
 create mode 100644 nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-var.js
 create mode 100644 nashorn/test/script/basic/es6/lexical-toplevel-redeclare-var-on-let.js
 create mode 100644 nashorn/test/script/basic/es6/lexical-toplevel-redeclare.js
 create mode 100644 nashorn/test/script/basic/es6/lexical-toplevel-redeclare.js.EXPECTED
 create mode 100644 nashorn/test/script/basic/es6/lexical-toplevel.js
 create mode 100644 nashorn/test/script/basic/es6/lexical-toplevel.js.EXPECTED
 create mode 100644 nashorn/test/src/jdk/nashorn/internal/runtime/LexicalBindingTest.java

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java
index 88fd89bba18..ad0f13c7643 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java
@@ -356,6 +356,10 @@ final class AssignSymbols extends NodeVisitor<LexicalContext> implements Loggabl
                         throwParserException(ECMAErrors.getMessage("syntax.error.redeclare.variable", name), origin);
                     } else {
                         symbol.setHasBeenDeclared();
+                        // Set scope flag on top-level block scoped symbols
+                        if (function.isProgram() && function.getBody() == block) {
+                            symbol.setIsScope();
+                        }
                     }
                 } else if ((flags & IS_INTERNAL) != 0) {
                     // Always create a new definition.
@@ -540,7 +544,7 @@ final class AssignSymbols extends NodeVisitor<LexicalContext> implements Loggabl
         final int flags;
         if (varNode.isAnonymousFunctionDeclaration()) {
             flags = IS_INTERNAL;
-        } else if (lc.getCurrentFunction().isProgram()) {
+        } else if (!varNode.isBlockScoped() && lc.getCurrentFunction().isProgram()) {
             flags = IS_SCOPE;
         } else {
             flags = 0;
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java
index 3ba3f630fdc..1bec86fcf05 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MapCreator.java
@@ -152,6 +152,10 @@ public class MapCreator<T> {
             flags |= Property.NOT_WRITABLE;
         }
 
+        if (symbol.isBlockScoped()) {
+            flags |= Property.IS_LEXICAL_BINDING;
+        }
+
         // Mark symbol as needing declaration. Access before declaration will throw a ReferenceError.
         if (symbol.isBlockScoped() && symbol.isScope()) {
             flags |= Property.NEEDS_DECLARATION;
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java
index b4f117f70d2..6418eaf561c 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java
@@ -34,6 +34,7 @@ import java.io.IOException;
 import java.io.PrintWriter;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
 import java.lang.invoke.SwitchPoint;
 import java.lang.reflect.Field;
 import java.util.ArrayList;
@@ -44,6 +45,7 @@ import java.util.concurrent.Callable;
 import java.util.concurrent.ConcurrentHashMap;
 import javax.script.ScriptContext;
 import javax.script.ScriptEngine;
+import jdk.internal.dynalink.CallSiteDescriptor;
 import jdk.internal.dynalink.linker.GuardedInvocation;
 import jdk.internal.dynalink.linker.LinkRequest;
 import jdk.nashorn.api.scripting.ClassFilter;
@@ -54,6 +56,8 @@ import jdk.nashorn.internal.objects.annotations.Property;
 import jdk.nashorn.internal.objects.annotations.ScriptClass;
 import jdk.nashorn.internal.runtime.ConsString;
 import jdk.nashorn.internal.runtime.Context;
+import jdk.nashorn.internal.runtime.ECMAErrors;
+import jdk.nashorn.internal.runtime.GlobalConstants;
 import jdk.nashorn.internal.runtime.GlobalFunctions;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.NativeJavaPackage;
@@ -69,6 +73,7 @@ import jdk.nashorn.internal.runtime.Specialization;
 import jdk.nashorn.internal.runtime.arrays.ArrayData;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
 import jdk.nashorn.internal.runtime.linker.InvokeByName;
+import jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor;
 import jdk.nashorn.internal.runtime.regexp.RegExpResult;
 import jdk.nashorn.internal.scripts.JO;
 
@@ -410,13 +415,14 @@ public final class Global extends ScriptObject implements Scope {
     // Used to store the last RegExp result to support deprecated RegExp constructor properties
     private RegExpResult lastRegExpResult;
 
-    private static final MethodHandle EVAL              = findOwnMH_S("eval",                Object.class, Object.class, Object.class);
-    private static final MethodHandle NO_SUCH_PROPERTY  = findOwnMH_S(NO_SUCH_PROPERTY_NAME, Object.class, Object.class, Object.class);
-    private static final MethodHandle PRINT             = findOwnMH_S("print",               Object.class, Object.class, Object[].class);
-    private static final MethodHandle PRINTLN           = findOwnMH_S("println",             Object.class, Object.class, Object[].class);
-    private static final MethodHandle LOAD              = findOwnMH_S("load",                Object.class, Object.class, Object.class);
-    private static final MethodHandle LOADWITHNEWGLOBAL = findOwnMH_S("loadWithNewGlobal",   Object.class, Object.class, Object[].class);
-    private static final MethodHandle EXIT              = findOwnMH_S("exit",                Object.class, Object.class, Object.class);
+    private static final MethodHandle EVAL                 = findOwnMH_S("eval",                Object.class, Object.class, Object.class);
+    private static final MethodHandle NO_SUCH_PROPERTY     = findOwnMH_S(NO_SUCH_PROPERTY_NAME, Object.class, Object.class, Object.class);
+    private static final MethodHandle PRINT                = findOwnMH_S("print",               Object.class, Object.class, Object[].class);
+    private static final MethodHandle PRINTLN              = findOwnMH_S("println",             Object.class, Object.class, Object[].class);
+    private static final MethodHandle LOAD                 = findOwnMH_S("load",                Object.class, Object.class, Object.class);
+    private static final MethodHandle LOAD_WITH_NEW_GLOBAL = findOwnMH_S("loadWithNewGlobal",   Object.class, Object.class, Object[].class);
+    private static final MethodHandle EXIT                 = findOwnMH_S("exit",                Object.class, Object.class, Object.class);
+    private static final MethodHandle LEXICAL_SCOPE_FILTER = findOwnMH_S("lexicalScopeFilter", Object.class, Object.class);
 
     // initialized by nasgen
     private static PropertyMap $nasgenmap$;
@@ -429,6 +435,12 @@ public final class Global extends ScriptObject implements Scope {
     // current ScriptEngine associated - can be null.
     private ScriptEngine engine;
 
+    // ES6 global lexical scope.
+    private final LexicalScope lexicalScope;
+
+    // Switchpoint for non-constant global callsites in the presence of ES6 lexical scope.
+    private SwitchPoint lexicalScopeSwitchPoint;
+
     /**
      * Set the current script context
      * @param scontext script context
@@ -466,6 +478,7 @@ public final class Global extends ScriptObject implements Scope {
         super(checkAndGetMap(context));
         this.context = context;
         this.setIsScope();
+        this.lexicalScope = context.getEnv()._es6 ? new LexicalScope(this) : null;
     }
 
     /**
@@ -1693,6 +1706,133 @@ public final class Global extends ScriptObject implements Scope {
         splitState = state;
     }
 
+    /**
+     * Return the ES6 global scope for lexically declared bindings.
+     * @return the ES6 lexical global scope.
+     */
+    public final ScriptObject getLexicalScope() {
+        assert context.getEnv()._es6;
+        return lexicalScope;
+    }
+
+    @Override
+    public void addBoundProperties(final ScriptObject source, final jdk.nashorn.internal.runtime.Property[] properties) {
+        PropertyMap ownMap = getMap();
+        LexicalScope lexicalScope = null;
+        PropertyMap lexicalMap = null;
+        boolean hasLexicalDefinitions = false;
+
+        if (context.getEnv()._es6) {
+            lexicalScope = (LexicalScope) getLexicalScope();
+            lexicalMap = lexicalScope.getMap();
+
+            for (final jdk.nashorn.internal.runtime.Property property : properties) {
+                if (property.isLexicalBinding()) {
+                    hasLexicalDefinitions = true;
+                }
+                // ES6 15.1.8 steps 6. and 7.
+                final jdk.nashorn.internal.runtime.Property globalProperty = ownMap.findProperty(property.getKey());
+                if (globalProperty != null && !globalProperty.isConfigurable() && property.isLexicalBinding()) {
+                    throw ECMAErrors.syntaxError("redeclare.variable", property.getKey());
+                }
+                final jdk.nashorn.internal.runtime.Property lexicalProperty = lexicalMap.findProperty(property.getKey());
+                if (lexicalProperty != null && !property.isConfigurable()) {
+                    throw ECMAErrors.syntaxError("redeclare.variable", property.getKey());
+                }
+            }
+        }
+
+        for (final jdk.nashorn.internal.runtime.Property property : properties) {
+            if (property.isLexicalBinding()) {
+                assert lexicalScope != null;
+                lexicalMap = lexicalScope.addBoundProperty(lexicalMap, source, property);
+
+                if (ownMap.findProperty(property.getKey()) != null) {
+                    // If property exists in the global object invalidate any global constant call sites.
+                    invalidateGlobalConstant(property.getKey());
+                }
+            } else {
+                ownMap = addBoundProperty(ownMap, source, property);
+            }
+        }
+
+        setMap(ownMap);
+
+        if (hasLexicalDefinitions) {
+            lexicalScope.setMap(lexicalMap);
+            invalidateLexicalSwitchPoint();
+        }
+    }
+
+    @Override
+    public GuardedInvocation findGetMethod(final CallSiteDescriptor desc, final LinkRequest request, final String operator) {
+        final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
+        final boolean isScope = NashornCallSiteDescriptor.isScope(desc);
+
+        if (lexicalScope != null && isScope && !NashornCallSiteDescriptor.isApplyToCall(desc)) {
+            if (lexicalScope.hasOwnProperty(name)) {
+                return lexicalScope.findGetMethod(desc, request, operator);
+            }
+        }
+
+        final GuardedInvocation invocation =  super.findGetMethod(desc, request, operator);
+
+        // We want to avoid adding our generic lexical scope switchpoint to global constant invocations,
+        // because those are invalidated per-key in the addBoundProperties method above.
+        // We therefor check if the invocation does already have a switchpoint and the property is non-inherited,
+        // assuming this only applies to global constants. If other non-inherited properties will
+        // start using switchpoints some time in the future we'll have to revisit this.
+        if (isScope && context.getEnv()._es6 && (invocation.getSwitchPoints() == null || !hasOwnProperty(name))) {
+            return invocation.addSwitchPoint(getLexicalScopeSwitchPoint());
+        }
+
+        return invocation;
+    }
+
+    @Override
+    public GuardedInvocation findSetMethod(final CallSiteDescriptor desc, final LinkRequest request) {
+        final boolean isScope = NashornCallSiteDescriptor.isScope(desc);
+
+        if (lexicalScope != null && isScope) {
+            final String name = desc.getNameToken(CallSiteDescriptor.NAME_OPERAND);
+            if (lexicalScope.hasOwnProperty(name)) {
+                return lexicalScope.findSetMethod(desc, request);
+            }
+        }
+
+        final GuardedInvocation invocation = super.findSetMethod(desc, request);
+
+        if (isScope && context.getEnv()._es6) {
+            return invocation.addSwitchPoint(getLexicalScopeSwitchPoint());
+        }
+
+        return invocation;
+    }
+
+    private synchronized SwitchPoint getLexicalScopeSwitchPoint() {
+        SwitchPoint switchPoint = lexicalScopeSwitchPoint;
+        if (switchPoint == null || switchPoint.hasBeenInvalidated()) {
+            switchPoint = lexicalScopeSwitchPoint = new SwitchPoint();
+        }
+        return switchPoint;
+    }
+
+    private synchronized void invalidateLexicalSwitchPoint() {
+        if (lexicalScopeSwitchPoint != null) {
+            context.getLogger(GlobalConstants.class).info("Invalidating non-constant globals on lexical scope update");
+            SwitchPoint.invalidateAll(new SwitchPoint[]{ lexicalScopeSwitchPoint });
+        }
+    }
+
+
+    @SuppressWarnings("unused")
+    private static Object lexicalScopeFilter(final Object self) {
+        if (self instanceof Global) {
+            return ((Global) self).getLexicalScope();
+        }
+        return self;
+    }
+
     private <T extends ScriptObject> T initConstructorAndSwitchPoint(final String name, final Class<T> clazz) {
         final T func = initConstructor(name, clazz);
         tagBuiltinProperties(name, func);
@@ -1737,7 +1877,7 @@ public final class Global extends ScriptObject implements Scope {
         this.unescape           = ScriptFunctionImpl.makeFunction("unescape",   GlobalFunctions.UNESCAPE);
         this.print              = ScriptFunctionImpl.makeFunction("print",      env._print_no_newline ? PRINT : PRINTLN);
         this.load               = ScriptFunctionImpl.makeFunction("load",       LOAD);
-        this.loadWithNewGlobal  = ScriptFunctionImpl.makeFunction("loadWithNewGlobal", LOADWITHNEWGLOBAL);
+        this.loadWithNewGlobal  = ScriptFunctionImpl.makeFunction("loadWithNewGlobal", LOAD_WITH_NEW_GLOBAL);
         this.exit               = ScriptFunctionImpl.makeFunction("exit",       EXIT);
         this.quit               = ScriptFunctionImpl.makeFunction("quit",       EXIT);
 
@@ -2203,4 +2343,36 @@ public final class Global extends ScriptObject implements Scope {
     protected boolean isGlobal() {
         return true;
     }
+
+    /**
+     * A class representing the ES6 global lexical scope.
+     */
+    private static class LexicalScope extends ScriptObject {
+
+        LexicalScope(final ScriptObject proto) {
+            super(proto, PropertyMap.newMap());
+        }
+
+        @Override
+        protected GuardedInvocation findGetMethod(final CallSiteDescriptor desc, final LinkRequest request, final String operator) {
+            return filterInvocation(super.findGetMethod(desc, request, operator));
+        }
+
+        @Override
+        protected GuardedInvocation findSetMethod(final CallSiteDescriptor desc, final LinkRequest request) {
+            return filterInvocation(super.findSetMethod(desc, request));
+        }
+
+        @Override
+        protected PropertyMap addBoundProperty(final PropertyMap propMap, final ScriptObject source, final jdk.nashorn.internal.runtime.Property property) {
+            // We override this method just to make it callable by Global
+            return super.addBoundProperty(propMap, source, property);
+        }
+
+        private static GuardedInvocation filterInvocation(final GuardedInvocation invocation) {
+            final MethodType type = invocation.getInvocation().type();
+            return invocation.asType(type.changeParameterType(0, Object.class)).filterArguments(0, LEXICAL_SCOPE_FILTER);
+        }
+    }
+
 }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
index 32f1df63895..7a58c418284 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
@@ -703,26 +703,12 @@ loop:
                 Collections.<IdentNode>emptyList());
         lc.push(script);
         final ParserContextBlockNode body = newBlock();
-        // If ES6 block scope is enabled add a per-script block for top-level LET and CONST declarations.
-        final int startLine = start;
-        final ParserContextBlockNode outer = useBlockScope() ? newBlock() : null;
-        functionDeclarations = new ArrayList<>();
 
-        try {
-            sourceElements(allowPropertyFunction);
-            addFunctionDeclarations(script);
-        } finally {
-            if (outer != null) {
-                restoreBlock(outer);
-                appendStatement(new BlockStatement(
-                        startLine,
-                        new Block(
-                                functionToken,
-                                startLine, outer.getFlags(),
-                                outer.getStatements())));
-            }
-        }
+        functionDeclarations = new ArrayList<>();
+        sourceElements(allowPropertyFunction);
+        addFunctionDeclarations(script);
         functionDeclarations = null;
+
         restoreBlock(body);
         body.setFlag(Block.NEEDS_SCOPE);
         final Block programBody = new Block(functionToken, functionLine, body.getFlags(), body.getStatements());
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java
index 41baa64243b..4225c251246 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Property.java
@@ -84,14 +84,17 @@ public abstract class Property implements Serializable {
     public static final int IS_NASGEN_PRIMITIVE     = 1 << 6;
 
     /** Is this a builtin property, e.g. Function.prototype.apply */
-    public static final int IS_BUILTIN = 1 << 7;
+    public static final int IS_BUILTIN              = 1 << 7;
 
     /** Is this property bound to a receiver? This means get/set operations will be delegated to
      *  a statically defined object instead of the object passed as callsite parameter. */
-    public static final int IS_BOUND                = 1 << 7;
+    public static final int IS_BOUND                = 1 << 8;
 
     /** Is this a lexically scoped LET or CONST variable that is dead until it is declared. */
-    public static final int NEEDS_DECLARATION       = 1 << 8;
+    public static final int NEEDS_DECLARATION       = 1 << 9;
+
+    /** Is this property an ES6 lexical binding? */
+    public static final int IS_LEXICAL_BINDING      = 1 << 10;
 
     /** Property key. */
     private final String key;
@@ -714,4 +717,12 @@ public abstract class Property implements Serializable {
     public boolean isFunctionDeclaration() {
         return (flags & IS_FUNCTION_DECLARATION) == IS_FUNCTION_DECLARATION;
     }
+
+    /**
+     * Is this a property defined by ES6 let or const?
+     * @return true if this property represents a lexical binding.
+     */
+    public boolean isLexicalBinding() {
+        return (flags & IS_LEXICAL_BINDING) == IS_LEXICAL_BINDING;
+    }
 }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
index 89246241591..f87af8ee500 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
@@ -304,31 +304,46 @@ public abstract class ScriptObject implements PropertyAccess {
         PropertyMap newMap = this.getMap();
 
         for (final Property property : properties) {
-            final String key = property.getKey();
-            final Property oldProp = newMap.findProperty(key);
-            if (oldProp == null) {
-                if (property instanceof UserAccessorProperty) {
-                    // Note: we copy accessor functions to this object which is semantically different from binding.
-                    final UserAccessorProperty prop = this.newUserAccessors(key, property.getFlags(), property.getGetterFunction(source), property.getSetterFunction(source));
-                    newMap = newMap.addPropertyNoHistory(prop);
-                } else {
-                    newMap = newMap.addPropertyBind((AccessorProperty)property, source);
-                }
-            } else {
-                // See ECMA section 10.5 Declaration Binding Instantiation
-                // step 5 processing each function declaration.
-                if (property.isFunctionDeclaration() && !oldProp.isConfigurable()) {
-                     if (oldProp instanceof UserAccessorProperty ||
-                         !(oldProp.isWritable() && oldProp.isEnumerable())) {
-                         throw typeError("cant.redefine.property", key, ScriptRuntime.safeToString(this));
-                     }
-                }
-            }
+            newMap = addBoundProperty(newMap, source, property);
         }
 
         this.setMap(newMap);
     }
 
+    /**
+     * Add a bound property from {@code source}, using the interim property map {@code propMap}, and return the
+     * new interim property map.
+     *
+     * @param propMap the property map
+     * @param source the source object
+     * @param property the property to be added
+     * @return the new property map
+     */
+    protected PropertyMap addBoundProperty(final PropertyMap propMap, final ScriptObject source, final Property property) {
+        PropertyMap newMap = propMap;
+        final String key = property.getKey();
+        final Property oldProp = newMap.findProperty(key);
+        if (oldProp == null) {
+            if (property instanceof UserAccessorProperty) {
+                // Note: we copy accessor functions to this object which is semantically different from binding.
+                final UserAccessorProperty prop = this.newUserAccessors(key, property.getFlags(), property.getGetterFunction(source), property.getSetterFunction(source));
+                newMap = newMap.addPropertyNoHistory(prop);
+            } else {
+                newMap = newMap.addPropertyBind((AccessorProperty)property, source);
+            }
+        } else {
+            // See ECMA section 10.5 Declaration Binding Instantiation
+            // step 5 processing each function declaration.
+            if (property.isFunctionDeclaration() && !oldProp.isConfigurable()) {
+                if (oldProp instanceof UserAccessorProperty ||
+                        !(oldProp.isWritable() && oldProp.isEnumerable())) {
+                    throw typeError("cant.redefine.property", key, ScriptRuntime.safeToString(this));
+                }
+            }
+        }
+        return newMap;
+    }
+
     /**
      * Copy all properties from the array with their receiver bound to the source.
      *
@@ -510,7 +525,11 @@ public abstract class ScriptObject implements PropertyAccess {
         }
     }
 
-    private void invalidateGlobalConstant(final String key) {
+    /**
+     * Invalidate any existing global constant method handles that may exist for {@code key}.
+     * @param key the property name
+     */
+    protected void invalidateGlobalConstant(final String key) {
         final GlobalConstants globalConstants = getGlobalConstants();
         if (globalConstants != null) {
             globalConstants.delete(key);
diff --git a/nashorn/test/script/basic/es6/const-redeclare-extra.js.EXPECTED b/nashorn/test/script/basic/es6/const-redeclare-extra.js.EXPECTED
index 754a75c6e7f..06af782e606 100644
--- a/nashorn/test/script/basic/es6/const-redeclare-extra.js.EXPECTED
+++ b/nashorn/test/script/basic/es6/const-redeclare-extra.js.EXPECTED
@@ -1,9 +1,9 @@
 SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>:3:8 Variable "x" has already been declared
     var x = {};
         ^
-SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>:2:8 Variable "x" has already been declared
-    var x = 2;
-        ^
-SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>:2:13 Variable "x" has already been declared
-    function x () {}
-             ^
+SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>:3:10 Variable "x" has already been declared
+    const x = {};
+          ^
+SyntaxError: test/script/basic/es6/const-redeclare-extra.js#36:8<eval>:3:10 Variable "x" has already been declared
+    const x = 5;
+          ^
diff --git a/nashorn/test/script/basic/es6/let-load.js b/nashorn/test/script/basic/es6/let-load.js
index b4c294658ec..5766754359f 100644
--- a/nashorn/test/script/basic/es6/let-load.js
+++ b/nashorn/test/script/basic/es6/let-load.js
@@ -26,7 +26,8 @@
  *
  * @test
  * @run
- * @option --language=es6 */
+ * @option --language=es6
+ */
 
 "use strict";
 
diff --git a/nashorn/test/script/basic/es6/let-load.js.EXPECTED b/nashorn/test/script/basic/es6/let-load.js.EXPECTED
index 510da6e6d46..f92f84c1982 100644
--- a/nashorn/test/script/basic/es6/let-load.js.EXPECTED
+++ b/nashorn/test/script/basic/es6/let-load.js.EXPECTED
@@ -2,7 +2,7 @@ top level function
 block function
 print local defs: 20 30
 imported var: 1
-ReferenceError: "b" is not defined
-ReferenceError: "c" is not defined
+imported let: 2
+imported const: 3
 top level function
 ReferenceError: "block" is not defined
diff --git a/nashorn/test/script/basic/es6/let-redeclare-extra.js.EXPECTED b/nashorn/test/script/basic/es6/let-redeclare-extra.js.EXPECTED
index 5e43b6942a3..e0e1afec156 100644
--- a/nashorn/test/script/basic/es6/let-redeclare-extra.js.EXPECTED
+++ b/nashorn/test/script/basic/es6/let-redeclare-extra.js.EXPECTED
@@ -4,12 +4,12 @@ SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:2:8 Variabl
 SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:3:8 Variable "x" has already been declared
     var x = 2;
         ^
-SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:2:8 Variable "x" has already been declared
-    var x = 2;
+SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:3:8 Variable "x" has already been declared
+    let x = undefined;
         ^
 SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:2:10 Variable "x" has already been declared
     const x = function (){};
           ^
-SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:3:13 Variable "a" has already been declared
-    function a () {};
-             ^
+SyntaxError: test/script/basic/es6/let-redeclare-extra.js#35:8<eval>:2:8 Variable "a" has already been declared
+    let a = 2;
+        ^
diff --git a/nashorn/test/script/basic/es6/lexical-toplevel-def.js b/nashorn/test/script/basic/es6/lexical-toplevel-def.js
new file mode 100644
index 00000000000..c9a44f7062a
--- /dev/null
+++ b/nashorn/test/script/basic/es6/lexical-toplevel-def.js
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8057691: Nashorn: let & const declarations are not shared between scripts
+ *
+ * @subtest
+ */
+
+var   VAR   = "VAR";
+let   LET   = "LET";
+const CONST = "CONST";
+function FUNC() {}
+this.GLOBAL = "GLOBAL";
diff --git a/nashorn/test/script/basic/es6/lexical-toplevel-print.js b/nashorn/test/script/basic/es6/lexical-toplevel-print.js
new file mode 100644
index 00000000000..eef030ace6d
--- /dev/null
+++ b/nashorn/test/script/basic/es6/lexical-toplevel-print.js
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8057691: Nashorn: let & const declarations are not shared between scripts
+ *
+ * @subtest
+ */
+
+print(VAR);
+print(LET);
+print(CONST);
+print(FUNC);
+print(GLOBAL);
+print(this.VAR);
+print(this.LET);   // undefined
+print(this.CONST); // undefined
+print(this.FUNC);
+print(this.GLOBAL);
+print("VAR" in this);
+print("LET" in this);   // false
+print("CONST" in this); // false
+print("FUNC" in this);
+print("GLOBAL" in this);
+
+try {
+    LET   = LET + "LET";
+    CONST = CONST + "CONST";
+} catch (e) {
+    print(String(e).replace(/\\/g, "/"));
+}
diff --git a/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-func-on-let.js b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-func-on-let.js
new file mode 100644
index 00000000000..bfe7af35a54
--- /dev/null
+++ b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-func-on-let.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8057691: Nashorn: let & const declarations are not shared between scripts
+ *
+ * @subtest
+ */
+
+function LET() {}
+var SHOULD_NOT_EXIST = 10;
diff --git a/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-builtin.js b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-builtin.js
new file mode 100644
index 00000000000..64360142aeb
--- /dev/null
+++ b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-builtin.js
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8057691: Nashorn: let & const declarations are not shared between scripts
+ *
+ * @subtest
+ */
+
+let Object = "LEXICAL BUILTIN";
diff --git a/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-func.js b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-func.js
new file mode 100644
index 00000000000..44c83964bb2
--- /dev/null
+++ b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-func.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8057691: Nashorn: let & const declarations are not shared between scripts
+ *
+ * @subtest
+ */
+
+let FUNC = 10;
+var SHOULD_NOT_EXIST = 10;
diff --git a/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-global.js b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-global.js
new file mode 100644
index 00000000000..a742fad3644
--- /dev/null
+++ b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-global.js
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8057691: Nashorn: let & const declarations are not shared between scripts
+ *
+ * @subtest
+ */
+
+let GLOBAL = "LEXICAL GLOBAL";
diff --git a/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-var.js b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-var.js
new file mode 100644
index 00000000000..630741f0df7
--- /dev/null
+++ b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-let-on-var.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8057691: Nashorn: let & const declarations are not shared between scripts
+ *
+ * @subtest
+ */
+
+let VAR = 10;
+var SHOULD_NOT_EXIST = 10;
diff --git a/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-var-on-let.js b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-var-on-let.js
new file mode 100644
index 00000000000..cb4b38222dc
--- /dev/null
+++ b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare-var-on-let.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8057691: Nashorn: let & const declarations are not shared between scripts
+ *
+ * @subtest
+ */
+
+var LET = 10;
+var SHOULD_NOT_EXIST = 10;
diff --git a/nashorn/test/script/basic/es6/lexical-toplevel-redeclare.js b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare.js
new file mode 100644
index 00000000000..6a76622f084
--- /dev/null
+++ b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare.js
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8057691: Nashorn: let & const declarations are not shared between scripts
+ *
+ * @test
+ * @run
+ * @option -scripting
+ * @option --language=es6
+ */
+
+load(__DIR__ + "lexical-toplevel-def.js");
+
+var global = this;
+
+function tryIt (code) {
+    try {
+        eval(code)
+    } catch (e) {
+        print(String(e).replace(/\\/g, "/"))
+    }
+}
+
+function loadScript(script) {
+    print(script);
+    try {
+        load(__DIR__ + script);
+    } catch (e) {
+        print(String(e).replace(/\\/g, "/"));
+    }
+    print(VAR);
+    print(LET);
+    print(CONST);
+    print(FUNC);
+    print(GLOBAL);
+    print(global.VAR);
+    print(global.LET);
+    print(global.CONST);
+    print(global.FUNC);
+    print(global.GLOBAL);
+    try {
+        print(SHOULD_NOT_EXIST);
+    } catch (e) {
+        print(String(e).replace(/\\/g, "/"));
+    }
+    print(global.SHOULD_NOT_EXIST);
+    print(Object);
+    print(global.Object);
+    print();
+}
+
+loadScript("lexical-toplevel-redeclare-var-on-let.js");
+loadScript("lexical-toplevel-redeclare-func-on-let.js");
+loadScript("lexical-toplevel-redeclare-let-on-var.js");
+loadScript("lexical-toplevel-redeclare-let-on-func.js");
+loadScript("lexical-toplevel-redeclare-let-on-builtin.js");
+loadScript("lexical-toplevel-redeclare-let-on-global.js");
diff --git a/nashorn/test/script/basic/es6/lexical-toplevel-redeclare.js.EXPECTED b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare.js.EXPECTED
new file mode 100644
index 00000000000..d1471c80bac
--- /dev/null
+++ b/nashorn/test/script/basic/es6/lexical-toplevel-redeclare.js.EXPECTED
@@ -0,0 +1,100 @@
+lexical-toplevel-redeclare-var-on-let.js
+SyntaxError: Variable "LET" has already been declared
+VAR
+LET
+CONST
+function FUNC() {}
+GLOBAL
+VAR
+undefined
+undefined
+function FUNC() {}
+GLOBAL
+ReferenceError: "SHOULD_NOT_EXIST" is not defined
+undefined
+function Object() { [native code] }
+function Object() { [native code] }
+
+lexical-toplevel-redeclare-func-on-let.js
+SyntaxError: Variable "LET" has already been declared
+VAR
+LET
+CONST
+function FUNC() {}
+GLOBAL
+VAR
+undefined
+undefined
+function FUNC() {}
+GLOBAL
+ReferenceError: "SHOULD_NOT_EXIST" is not defined
+undefined
+function Object() { [native code] }
+function Object() { [native code] }
+
+lexical-toplevel-redeclare-let-on-var.js
+SyntaxError: Variable "VAR" has already been declared
+VAR
+LET
+CONST
+function FUNC() {}
+GLOBAL
+VAR
+undefined
+undefined
+function FUNC() {}
+GLOBAL
+ReferenceError: "SHOULD_NOT_EXIST" is not defined
+undefined
+function Object() { [native code] }
+function Object() { [native code] }
+
+lexical-toplevel-redeclare-let-on-func.js
+SyntaxError: Variable "FUNC" has already been declared
+VAR
+LET
+CONST
+function FUNC() {}
+GLOBAL
+VAR
+undefined
+undefined
+function FUNC() {}
+GLOBAL
+ReferenceError: "SHOULD_NOT_EXIST" is not defined
+undefined
+function Object() { [native code] }
+function Object() { [native code] }
+
+lexical-toplevel-redeclare-let-on-builtin.js
+VAR
+LET
+CONST
+function FUNC() {}
+GLOBAL
+VAR
+undefined
+undefined
+function FUNC() {}
+GLOBAL
+ReferenceError: "SHOULD_NOT_EXIST" is not defined
+undefined
+LEXICAL BUILTIN
+function Object() { [native code] }
+
+lexical-toplevel-redeclare-let-on-global.js
+VAR
+LET
+CONST
+function FUNC() {}
+LEXICAL GLOBAL
+VAR
+undefined
+undefined
+function FUNC() {}
+GLOBAL
+ReferenceError: "SHOULD_NOT_EXIST" is not defined
+undefined
+LEXICAL BUILTIN
+function Object() { [native code] }
+
diff --git a/nashorn/test/script/basic/es6/lexical-toplevel.js b/nashorn/test/script/basic/es6/lexical-toplevel.js
new file mode 100644
index 00000000000..fc272a8a974
--- /dev/null
+++ b/nashorn/test/script/basic/es6/lexical-toplevel.js
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8057691: Nashorn: let & const declarations are not shared between scripts
+ *
+ * @test
+ * @run
+ * @option --language=es6
+ */
+
+load(__DIR__ + "lexical-toplevel-def.js");
+
+load(__DIR__ + "lexical-toplevel-print.js");
+load(__DIR__ + "lexical-toplevel-print.js");
diff --git a/nashorn/test/script/basic/es6/lexical-toplevel.js.EXPECTED b/nashorn/test/script/basic/es6/lexical-toplevel.js.EXPECTED
new file mode 100644
index 00000000000..804e7506dcf
--- /dev/null
+++ b/nashorn/test/script/basic/es6/lexical-toplevel.js.EXPECTED
@@ -0,0 +1,30 @@
+VAR
+LET
+CONST
+function FUNC() {}
+GLOBAL
+VAR
+undefined
+undefined
+function FUNC() {}
+GLOBAL
+true
+false
+false
+true
+true
+VAR
+LETLET
+CONST
+function FUNC() {}
+GLOBAL
+VAR
+undefined
+undefined
+function FUNC() {}
+GLOBAL
+true
+false
+false
+true
+true
diff --git a/nashorn/test/src/jdk/nashorn/internal/runtime/LexicalBindingTest.java b/nashorn/test/src/jdk/nashorn/internal/runtime/LexicalBindingTest.java
new file mode 100644
index 00000000000..2cd0bf01ee1
--- /dev/null
+++ b/nashorn/test/src/jdk/nashorn/internal/runtime/LexicalBindingTest.java
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime;
+
+import jdk.nashorn.api.scripting.NashornScriptEngineFactory;
+import org.testng.annotations.Test;
+
+import javax.script.Bindings;
+import javax.script.ScriptContext;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import javax.script.SimpleScriptContext;
+
+import static org.testng.Assert.assertEquals;
+
+/**
+ * Top-level lexical binding tests.
+ *
+ * @test
+ * @run testng jdk.nashorn.internal.runtime.LexicalBindingTest
+ */
+@SuppressWarnings("javadoc")
+public class LexicalBindingTest {
+
+    final static String LANGUAGE_ES6 = "--language=es6";
+    final static int NUMBER_OF_CONTEXTS = 20;
+    final static int MEGAMORPHIC_LOOP_COUNT = 20;
+
+    /**
+     * Test access to global var-declared variables for shared script classes with multiple globals.
+     */
+    @Test
+    public static void megamorphicVarTest() throws ScriptException, InterruptedException {
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine e = factory.getScriptEngine();
+        final ScriptContext[] contexts = new ScriptContext[NUMBER_OF_CONTEXTS];
+        final String sharedScript = "foo";
+
+
+        for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
+            final ScriptContext context = contexts[i] = new SimpleScriptContext();
+            final Bindings b = e.createBindings();
+            context.setBindings(b, ScriptContext.ENGINE_SCOPE);
+            assertEquals(e.eval("var foo = '" + i + "';", context), null);
+        }
+
+        for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
+            final ScriptContext context = contexts[i];
+            assertEquals(e.eval(sharedScript, context), String.valueOf(i));
+        }
+    }
+
+    /**
+     * Test access to global lexically declared variables for shared script classes with multiple globals.
+     */
+    @Test
+    public static void megamorphicMultiGlobalLetTest() throws ScriptException, InterruptedException {
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine e = factory.getScriptEngine(LANGUAGE_ES6);
+        final ScriptContext[] contexts = new ScriptContext[NUMBER_OF_CONTEXTS];
+        final String sharedScript = "foo";
+
+
+        for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
+            final ScriptContext context = contexts[i] = new SimpleScriptContext();
+            final Bindings b = e.createBindings();
+            context.setBindings(b, ScriptContext.ENGINE_SCOPE);
+            assertEquals(e.eval("let foo = '" + i + "';", context), null);
+        }
+
+        for (int i = 0; i < NUMBER_OF_CONTEXTS; i++) {
+            final ScriptContext context = contexts[i];
+            assertEquals(e.eval(sharedScript, context), String.valueOf(i));
+        }
+    }
+
+
+    /**
+     * Test access to global lexically declared variables for shared script classes with single global.
+     */
+    @Test
+    public static void megamorphicSingleGlobalLetTest() throws ScriptException, InterruptedException {
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine e = factory.getScriptEngine(LANGUAGE_ES6);
+        final String sharedGetterScript = "foo";
+        final String sharedSetterScript = "foo = 1";
+
+        for (int i = 0; i < MEGAMORPHIC_LOOP_COUNT; i++) {
+            assertEquals(e.eval(sharedSetterScript), 1);
+            assertEquals(e.eval(sharedGetterScript), 1);
+            assertEquals(e.eval("delete foo; a" + i + " = 1; foo = " + i + ";"), i);
+            assertEquals(e.eval(sharedGetterScript), i);
+        }
+
+        assertEquals(e.eval("let foo = 'foo';"), null);
+        assertEquals(e.eval(sharedGetterScript), "foo");
+        assertEquals(e.eval(sharedSetterScript), 1);
+        assertEquals(e.eval(sharedGetterScript), 1);
+        assertEquals(e.eval("this.foo"), MEGAMORPHIC_LOOP_COUNT - 1);
+    }
+
+    /**
+     * Test access to global lexically declared variables for shared script classes with single global.
+     */
+    @Test
+    public static void megamorphicInheritedGlobalLetTest() throws ScriptException, InterruptedException {
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine e = factory.getScriptEngine(LANGUAGE_ES6);
+        final String sharedGetterScript = "foo";
+        final String sharedSetterScript = "foo = 1";
+
+        for (int i = 0; i < MEGAMORPHIC_LOOP_COUNT; i++) {
+            assertEquals(e.eval(sharedSetterScript), 1);
+            assertEquals(e.eval(sharedGetterScript), 1);
+            assertEquals(e.eval("delete foo; a" + i + " = 1; Object.prototype.foo = " + i + ";"), i);
+            assertEquals(e.eval(sharedGetterScript), i);
+        }
+
+        assertEquals(e.eval("let foo = 'foo';"), null);
+        assertEquals(e.eval(sharedGetterScript), "foo");
+        assertEquals(e.eval(sharedSetterScript), 1);
+        assertEquals(e.eval(sharedGetterScript), 1);
+        assertEquals(e.eval("this.foo"), MEGAMORPHIC_LOOP_COUNT - 1);
+    }
+
+    /**
+     * Test multi-threaded access to global lexically declared variables for shared script classes with multiple globals.
+     */
+    @Test
+    public static void multiThreadedLetTest() throws ScriptException, InterruptedException {
+        final NashornScriptEngineFactory factory = new NashornScriptEngineFactory();
+        final ScriptEngine e = factory.getScriptEngine(LANGUAGE_ES6);
+        final Bindings b = e.createBindings();
+        final ScriptContext origContext = e.getContext();
+        final ScriptContext newCtxt = new SimpleScriptContext();
+        newCtxt.setBindings(b, ScriptContext.ENGINE_SCOPE);
+        final String sharedScript = "foo";
+
+        assertEquals(e.eval("let foo = 'original context';", origContext), null);
+        assertEquals(e.eval("let foo = 'new context';", newCtxt), null);
+
+        final Thread t1 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t2 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "new context", 1000));
+        t1.start();
+        t2.start();
+        t1.join();
+        t2.join();
+
+        assertEquals(e.eval("foo = 'newer context';", newCtxt), "newer context");
+        final Thread t3 = new Thread(new ScriptRunner(e, origContext, sharedScript, "original context", 1000));
+        final Thread t4 = new Thread(new ScriptRunner(e, newCtxt, sharedScript, "newer context", 1000));
+
+        t3.start();
+        t4.start();
+        t3.join();
+        t4.join();
+
+        assertEquals(e.eval(sharedScript), "original context");
+        assertEquals(e.eval(sharedScript, newCtxt), "newer context");
+    }
+
+    private static class ScriptRunner implements Runnable {
+
+        final ScriptEngine engine;
+        final ScriptContext context;
+        final String source;
+        final Object expected;
+        final int iterations;
+
+        ScriptRunner(final ScriptEngine engine, final ScriptContext context, final String source, final Object expected, final int iterations) {
+            this.engine = engine;
+            this.context = context;
+            this.source = source;
+            this.expected = expected;
+            this.iterations = iterations;
+        }
+
+        @Override
+        public void run() {
+            try {
+                for (int i = 0; i < iterations; i++) {
+                    assertEquals(engine.eval(source, context), expected);
+                }
+            } catch (final ScriptException se) {
+                throw new RuntimeException(se);
+            }
+        }
+    }
+}

From c90bc5b3166aef29211e7c75b9212217b12b3d56 Mon Sep 17 00:00:00 2001
From: Staffan Friberg <staffan.friberg@oracle.com>
Date: Fri, 21 Nov 2014 09:28:53 -0800
Subject: [PATCH 135/299] 6321472: Add CRC-32C API

To add CRC-32C api and implementation

Reviewed-by: sherman
---
 .../share/classes/java/util/zip/Adler32.java  |  49 ++-
 .../share/classes/java/util/zip/CRC32.java    |  50 ++-
 .../share/classes/java/util/zip/CRC32C.java   | 339 ++++++++++++++++++
 .../share/classes/java/util/zip/Checksum.java |  86 ++++-
 .../classes/java/util/zip/package-info.java   |  77 ++++
 .../share/classes/java/util/zip/package.html  |  88 -----
 jdk/test/java/util/zip/ChecksumBase.java      | 196 ++++++++++
 jdk/test/java/util/zip/TestCRC32.java         |  40 +++
 jdk/test/java/util/zip/TestCRC32C.java        |  40 +++
 jdk/test/java/util/zip/TestChecksum.java      |  66 ++++
 10 files changed, 880 insertions(+), 151 deletions(-)
 create mode 100644 jdk/src/java.base/share/classes/java/util/zip/CRC32C.java
 create mode 100644 jdk/src/java.base/share/classes/java/util/zip/package-info.java
 delete mode 100644 jdk/src/java.base/share/classes/java/util/zip/package.html
 create mode 100644 jdk/test/java/util/zip/ChecksumBase.java
 create mode 100644 jdk/test/java/util/zip/TestCRC32.java
 create mode 100644 jdk/test/java/util/zip/TestCRC32C.java
 create mode 100644 jdk/test/java/util/zip/TestChecksum.java

diff --git a/jdk/src/java.base/share/classes/java/util/zip/Adler32.java b/jdk/src/java.base/share/classes/java/util/zip/Adler32.java
index de279f98a83..6a39b7c1c1a 100644
--- a/jdk/src/java.base/share/classes/java/util/zip/Adler32.java
+++ b/jdk/src/java.base/share/classes/java/util/zip/Adler32.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,9 +34,8 @@ import sun.nio.ch.DirectBuffer;
  * can be computed much faster.
  *
  * <p> Passing a {@code null} argument to a method in this class will cause
- * a {@link NullPointerException} to be thrown.
+ * a {@link NullPointerException} to be thrown.</p>
  *
- * @see         Checksum
  * @author      David Connelly
  */
 public
@@ -53,9 +52,8 @@ class Adler32 implements Checksum {
     /**
      * Updates the checksum with the specified byte (the low eight
      * bits of the argument b).
-     *
-     * @param b the byte to update the checksum with
      */
+    @Override
     public void update(int b) {
         adler = update(adler, b);
     }
@@ -63,11 +61,12 @@ class Adler32 implements Checksum {
     /**
      * Updates the checksum with the specified array of bytes.
      *
-     * @throws  ArrayIndexOutOfBoundsException
-     *          if {@code off} is negative, or {@code len} is negative,
-     *          or {@code off+len} is greater than the length of the
-     *          array {@code b}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code off} is negative, or {@code len} is negative, or
+     *         {@code off+len} is negative or greater than the length of
+     *         the array {@code b}.
      */
+    @Override
     public void update(byte[] b, int off, int len) {
         if (b == null) {
             throw new NullPointerException();
@@ -78,29 +77,16 @@ class Adler32 implements Checksum {
         adler = updateBytes(adler, b, off, len);
     }
 
-    /**
-     * Updates the checksum with the specified array of bytes.
-     *
-     * @param b the byte array to update the checksum with
-     */
-    public void update(byte[] b) {
-        adler = updateBytes(adler, b, 0, b.length);
-    }
-
-
     /**
      * Updates the checksum with the bytes from the specified buffer.
      *
-     * The checksum is updated using
-     * buffer.{@link java.nio.Buffer#remaining() remaining()}
-     * bytes starting at
-     * buffer.{@link java.nio.Buffer#position() position()}
-     * Upon return, the buffer's position will be updated to its
-     * limit; its limit will not have been changed.
+     * The checksum is updated with the remaining bytes in the buffer, starting
+     * at the buffer's position. Upon return, the buffer's position will be
+     * updated to its limit; its limit will not have been changed.
      *
-     * @param buffer the ByteBuffer to update the checksum with
      * @since 1.8
      */
+    @Override
     public void update(ByteBuffer buffer) {
         int pos = buffer.position();
         int limit = buffer.limit();
@@ -113,9 +99,12 @@ class Adler32 implements Checksum {
         } else if (buffer.hasArray()) {
             adler = updateBytes(adler, buffer.array(), pos + buffer.arrayOffset(), rem);
         } else {
-            byte[] b = new byte[rem];
-            buffer.get(b);
-            adler = updateBytes(adler, b, 0, b.length);
+            byte[] b = new byte[Math.min(buffer.remaining(), 4096)];
+            while (buffer.hasRemaining()) {
+                int length = Math.min(buffer.remaining(), b.length);
+                buffer.get(b, 0, length);
+                update(b, 0, length);
+            }
         }
         buffer.position(limit);
     }
@@ -123,6 +112,7 @@ class Adler32 implements Checksum {
     /**
      * Resets the checksum to initial value.
      */
+    @Override
     public void reset() {
         adler = 1;
     }
@@ -130,6 +120,7 @@ class Adler32 implements Checksum {
     /**
      * Returns the checksum value.
      */
+    @Override
     public long getValue() {
         return (long)adler & 0xffffffffL;
     }
diff --git a/jdk/src/java.base/share/classes/java/util/zip/CRC32.java b/jdk/src/java.base/share/classes/java/util/zip/CRC32.java
index 0f55579b589..95ead3c3533 100644
--- a/jdk/src/java.base/share/classes/java/util/zip/CRC32.java
+++ b/jdk/src/java.base/share/classes/java/util/zip/CRC32.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,9 +32,8 @@ import sun.nio.ch.DirectBuffer;
  * A class that can be used to compute the CRC-32 of a data stream.
  *
  * <p> Passing a {@code null} argument to a method in this class will cause
- * a {@link NullPointerException} to be thrown.
+ * a {@link NullPointerException} to be thrown.</p>
  *
- * @see         Checksum
  * @author      David Connelly
  */
 public
@@ -51,9 +50,8 @@ class CRC32 implements Checksum {
     /**
      * Updates the CRC-32 checksum with the specified byte (the low
      * eight bits of the argument b).
-     *
-     * @param b the byte to update the checksum with
      */
+    @Override
     public void update(int b) {
         crc = update(crc, b);
     }
@@ -61,11 +59,12 @@ class CRC32 implements Checksum {
     /**
      * Updates the CRC-32 checksum with the specified array of bytes.
      *
-     * @throws  ArrayIndexOutOfBoundsException
-     *          if {@code off} is negative, or {@code len} is negative,
-     *          or {@code off+len} is greater than the length of the
-     *          array {@code b}
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code off} is negative, or {@code len} is negative, or
+     *         {@code off+len} is negative or greater than the length of
+     *         the array {@code b}.
      */
+    @Override
     public void update(byte[] b, int off, int len) {
         if (b == null) {
             throw new NullPointerException();
@@ -77,27 +76,15 @@ class CRC32 implements Checksum {
     }
 
     /**
-     * Updates the CRC-32 checksum with the specified array of bytes.
+     * Updates the CRC-32 checksum with the bytes from the specified buffer.
      *
-     * @param b the array of bytes to update the checksum with
-     */
-    public void update(byte[] b) {
-        crc = updateBytes(crc, b, 0, b.length);
-    }
-
-    /**
-     * Updates the checksum with the bytes from the specified buffer.
+     * The checksum is updated with the remaining bytes in the buffer, starting
+     * at the buffer's position. Upon return, the buffer's position will be
+     * updated to its limit; its limit will not have been changed.
      *
-     * The checksum is updated using
-     * buffer.{@link java.nio.Buffer#remaining() remaining()}
-     * bytes starting at
-     * buffer.{@link java.nio.Buffer#position() position()}
-     * Upon return, the buffer's position will
-     * be updated to its limit; its limit will not have been changed.
-     *
-     * @param buffer the ByteBuffer to update the checksum with
      * @since 1.8
      */
+    @Override
     public void update(ByteBuffer buffer) {
         int pos = buffer.position();
         int limit = buffer.limit();
@@ -110,9 +97,12 @@ class CRC32 implements Checksum {
         } else if (buffer.hasArray()) {
             crc = updateBytes(crc, buffer.array(), pos + buffer.arrayOffset(), rem);
         } else {
-            byte[] b = new byte[rem];
-            buffer.get(b);
-            crc = updateBytes(crc, b, 0, b.length);
+            byte[] b = new byte[Math.min(buffer.remaining(), 4096)];
+            while (buffer.hasRemaining()) {
+                int length = Math.min(buffer.remaining(), b.length);
+                buffer.get(b, 0, length);
+                update(b, 0, length);
+            }
         }
         buffer.position(limit);
     }
@@ -120,6 +110,7 @@ class CRC32 implements Checksum {
     /**
      * Resets CRC-32 to initial value.
      */
+    @Override
     public void reset() {
         crc = 0;
     }
@@ -127,6 +118,7 @@ class CRC32 implements Checksum {
     /**
      * Returns CRC-32 value.
      */
+    @Override
     public long getValue() {
         return (long)crc & 0xffffffffL;
     }
diff --git a/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java
new file mode 100644
index 00000000000..251e3042800
--- /dev/null
+++ b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java
@@ -0,0 +1,339 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package java.util.zip;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import sun.misc.Unsafe;
+import sun.nio.ch.DirectBuffer;
+
+/**
+ * A class that can be used to compute the CRC-32C of a data stream.
+ *
+ * <p>
+ * CRC-32C is defined in <a href="http://www.ietf.org/rfc/rfc3720.txt">RFC
+ * 3720</a>: Internet Small Computer Systems Interface (iSCSI).
+ * </p>
+ *
+ * <p>
+ * Passing a {@code null} argument to a method in this class will cause a
+ * {@link NullPointerException} to be thrown.
+ * </p>
+ *
+ * @since 1.9
+ */
+public final class CRC32C implements Checksum {
+
+    /*
+     * This CRC-32C implementation uses the 'slicing-by-8' algorithm described
+     * in the paper "A Systematic Approach to Building High Performance
+     * Software-Based CRC Generators" by Michael E. Kounavis and Frank L. Berry,
+     * Intel Research and Development
+     */
+
+    /**
+     * CRC-32C Polynomial
+     */
+    private static final int CRC32C_POLY = 0x1EDC6F41;
+    private static final int REVERSED_CRC32C_POLY = Integer.reverse(CRC32C_POLY);
+
+    private static final Unsafe UNSAFE = Unsafe.getUnsafe();
+
+    // Lookup tables
+    // Lookup table for single byte calculations
+    private static final int[] byteTable;
+    // Lookup tables for bulk operations in 'slicing-by-8' algorithm
+    private static final int[][] byteTables = new int[8][256];
+    private static final int[] byteTable0 = byteTables[0];
+    private static final int[] byteTable1 = byteTables[1];
+    private static final int[] byteTable2 = byteTables[2];
+    private static final int[] byteTable3 = byteTables[3];
+    private static final int[] byteTable4 = byteTables[4];
+    private static final int[] byteTable5 = byteTables[5];
+    private static final int[] byteTable6 = byteTables[6];
+    private static final int[] byteTable7 = byteTables[7];
+
+    static {
+        // Generate lookup tables
+        // High-order polynomial term stored in LSB of r.
+        for (int index = 0; index < byteTables[0].length; index++) {
+           int r = index;
+            for (int i = 0; i < Byte.SIZE; i++) {
+                if ((r & 1) != 0) {
+                    r = (r >>> 1) ^ REVERSED_CRC32C_POLY;
+                } else {
+                    r >>>= 1;
+                }
+            }
+            byteTables[0][index] = r;
+        }
+
+        for (int index = 0; index < byteTables[0].length; index++) {
+            int r = byteTables[0][index];
+
+            for (int k = 1; k < byteTables.length; k++) {
+                r = byteTables[0][r & 0xFF] ^ (r >>> 8);
+                byteTables[k][index] = r;
+            }
+        }
+
+        if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
+            byteTable = byteTables[0];
+        } else { // ByteOrder.BIG_ENDIAN
+            byteTable = new int[byteTable0.length];
+            System.arraycopy(byteTable0, 0, byteTable, 0, byteTable0.length);
+            for (int[] table : byteTables) {
+                for (int index = 0; index < table.length; index++) {
+                    table[index] = Integer.reverseBytes(table[index]);
+                }
+            }
+        }
+    }
+
+    /**
+     * Calculated CRC-32C value
+     */
+    private int crc = 0xFFFFFFFF;
+
+    /**
+     * Creates a new CRC32C object.
+     */
+    public CRC32C() {
+    }
+
+    /**
+     * Updates the CRC-32C checksum with the specified byte (the low eight bits
+     * of the argument b).
+     */
+    @Override
+    public void update(int b) {
+        crc = (crc >>> 8) ^ byteTable[(crc ^ (b & 0xFF)) & 0xFF];
+    }
+
+    /**
+     * Updates the CRC-32C checksum with the specified array of bytes.
+     *
+     * @throws ArrayIndexOutOfBoundsException
+     *         if {@code off} is negative, or {@code len} is negative, or
+     *         {@code off+len} is negative or greater than the length of
+     *         the array {@code b}.
+     */
+    @Override
+    public void update(byte[] b, int off, int len) {
+        if (b == null) {
+            throw new NullPointerException();
+        }
+        if (off < 0 || len < 0 || off > b.length - len) {
+            throw new ArrayIndexOutOfBoundsException();
+        }
+        crc = updateBytes(crc, b, off, (off + len));
+    }
+
+    /**
+     * Updates the CRC-32C checksum with the bytes from the specified buffer.
+     *
+     * The checksum is updated with the remaining bytes in the buffer, starting
+     * at the buffer's position. Upon return, the buffer's position will be
+     * updated to its limit; its limit will not have been changed.
+     */
+    @Override
+    public void update(ByteBuffer buffer) {
+        int pos = buffer.position();
+        int limit = buffer.limit();
+        assert (pos <= limit);
+        int rem = limit - pos;
+        if (rem <= 0) {
+            return;
+        }
+
+        if (buffer instanceof DirectBuffer) {
+            crc = updateDirectByteBuffer(crc, ((DirectBuffer) buffer).address(),
+                                         pos, limit);
+        } else if (buffer.hasArray()) {
+            crc = updateBytes(crc, buffer.array(), pos + buffer.arrayOffset(),
+                              limit + buffer.arrayOffset());
+        } else {
+            byte[] b = new byte[Math.min(buffer.remaining(), 4096)];
+            while (buffer.hasRemaining()) {
+                int length = Math.min(buffer.remaining(), b.length);
+                buffer.get(b, 0, length);
+                update(b, 0, length);
+            }
+        }
+        buffer.position(limit);
+    }
+
+    /**
+     * Resets CRC-32C to initial value.
+     */
+    @Override
+    public void reset() {
+        crc = 0xFFFFFFFF;
+    }
+
+    /**
+     * Returns CRC-32C value.
+     */
+    @Override
+    public long getValue() {
+        return (~crc) & 0xFFFFFFFFL;
+    }
+
+    /**
+     * Updates the CRC-32C checksum with the specified array of bytes.
+     */
+    private static int updateBytes(int crc, byte[] b, int off, int end) {
+
+        // Do only byte reads for arrays so short they can't be aligned
+        // or if bytes are stored with a larger witdh than one byte.,%
+        if (end - off >= 8 && Unsafe.ARRAY_BYTE_INDEX_SCALE == 1) {
+
+            // align on 8 bytes
+            int alignLength
+                    = (8 - ((Unsafe.ARRAY_BYTE_BASE_OFFSET + off) & 0x7)) & 0x7;
+            for (int alignEnd = off + alignLength; off < alignEnd; off++) {
+                crc = (crc >>> 8) ^ byteTable[(crc ^ b[off]) & 0xFF];
+            }
+
+            if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
+                crc = Integer.reverseBytes(crc);
+            }
+
+            // slicing-by-8
+            for (; off < (end - Long.BYTES); off += Long.BYTES) {
+                int firstHalf;
+                int secondHalf;
+                if (Unsafe.ADDRESS_SIZE == 4) {
+                    // On 32 bit platforms read two ints instead of a single 64bit long
+                    firstHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
+                    secondHalf = UNSAFE.getInt(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off
+                                               + Integer.BYTES);
+                } else {
+                    long value = UNSAFE.getLong(b, Unsafe.ARRAY_BYTE_BASE_OFFSET + off);
+                    if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
+                        firstHalf = (int) value;
+                        secondHalf = (int) (value >>> 32);
+                    } else { // ByteOrder.BIG_ENDIAN
+                        firstHalf = (int) (value >>> 32);
+                        secondHalf = (int) value;
+                    }
+                }
+                crc ^= firstHalf;
+                if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
+                    crc = byteTable7[crc & 0xFF]
+                            ^ byteTable6[(crc >>> 8) & 0xFF]
+                            ^ byteTable5[(crc >>> 16) & 0xFF]
+                            ^ byteTable4[crc >>> 24]
+                            ^ byteTable3[secondHalf & 0xFF]
+                            ^ byteTable2[(secondHalf >>> 8) & 0xFF]
+                            ^ byteTable1[(secondHalf >>> 16) & 0xFF]
+                            ^ byteTable0[secondHalf >>> 24];
+                } else { // ByteOrder.BIG_ENDIAN
+                    crc = byteTable0[secondHalf & 0xFF]
+                            ^ byteTable1[(secondHalf >>> 8) & 0xFF]
+                            ^ byteTable2[(secondHalf >>> 16) & 0xFF]
+                            ^ byteTable3[secondHalf >>> 24]
+                            ^ byteTable4[crc & 0xFF]
+                            ^ byteTable5[(crc >>> 8) & 0xFF]
+                            ^ byteTable6[(crc >>> 16) & 0xFF]
+                            ^ byteTable7[crc >>> 24];
+                }
+            }
+
+            if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
+                crc = Integer.reverseBytes(crc);
+            }
+        }
+
+        // Tail
+        for (; off < end; off++) {
+            crc = (crc >>> 8) ^ byteTable[(crc ^ b[off]) & 0xFF];
+        }
+
+        return crc;
+    }
+
+    /**
+     * Updates the CRC-32C checksum reading from the specified address.
+     */
+    private static int updateDirectByteBuffer(int crc, long address,
+                                              int off, int end) {
+
+        // Do only byte reads for arrays so short they can't be aligned
+        if (end - off >= 8) {
+
+            // align on 8 bytes
+            int alignLength = (8 - (int) ((address + off) & 0x7)) & 0x7;
+            for (int alignEnd = off + alignLength; off < alignEnd; off++) {
+                crc = (crc >>> 8)
+                        ^ byteTable[(crc ^ UNSAFE.getByte(address + off)) & 0xFF];
+            }
+
+            if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
+                crc = Integer.reverseBytes(crc);
+            }
+
+            // slicing-by-8
+            for (; off <= (end - Long.BYTES); off += Long.BYTES) {
+                // Always reading two ints as reading a long followed by
+                // shifting and casting was slower.
+                int firstHalf = UNSAFE.getInt(address + off);
+                int secondHalf = UNSAFE.getInt(address + off + Integer.BYTES);
+                crc ^= firstHalf;
+                if (ByteOrder.nativeOrder() == ByteOrder.LITTLE_ENDIAN) {
+                    crc = byteTable7[crc & 0xFF]
+                            ^ byteTable6[(crc >>> 8) & 0xFF]
+                            ^ byteTable5[(crc >>> 16) & 0xFF]
+                            ^ byteTable4[crc >>> 24]
+                            ^ byteTable3[secondHalf & 0xFF]
+                            ^ byteTable2[(secondHalf >>> 8) & 0xFF]
+                            ^ byteTable1[(secondHalf >>> 16) & 0xFF]
+                            ^ byteTable0[secondHalf >>> 24];
+                } else { // ByteOrder.BIG_ENDIAN
+                    crc = byteTable0[secondHalf & 0xFF]
+                            ^ byteTable1[(secondHalf >>> 8) & 0xFF]
+                            ^ byteTable2[(secondHalf >>> 16) & 0xFF]
+                            ^ byteTable3[secondHalf >>> 24]
+                            ^ byteTable4[crc & 0xFF]
+                            ^ byteTable5[(crc >>> 8) & 0xFF]
+                            ^ byteTable6[(crc >>> 16) & 0xFF]
+                            ^ byteTable7[crc >>> 24];
+                }
+            }
+
+            if (ByteOrder.nativeOrder() == ByteOrder.BIG_ENDIAN) {
+                crc = Integer.reverseBytes(crc);
+            }
+        }
+
+        // Tail
+        for (; off < end; off++) {
+            crc = (crc >>> 8)
+                    ^ byteTable[(crc ^ UNSAFE.getByte(address + off)) & 0xFF];
+        }
+
+        return crc;
+    }
+}
diff --git a/jdk/src/java.base/share/classes/java/util/zip/Checksum.java b/jdk/src/java.base/share/classes/java/util/zip/Checksum.java
index 0369c53b0ed..121b687df0b 100644
--- a/jdk/src/java.base/share/classes/java/util/zip/Checksum.java
+++ b/jdk/src/java.base/share/classes/java/util/zip/Checksum.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,16 +22,17 @@
  * or visit www.oracle.com if you need additional information or have any
  * questions.
  */
-
 package java.util.zip;
 
+import java.nio.ByteBuffer;
+
 /**
  * An interface representing a data checksum.
  *
- * @author      David Connelly
+ * @author David Connelly
  */
-public
-interface Checksum {
+public interface Checksum {
+
     /**
      * Updates the current checksum with the specified byte.
      *
@@ -41,14 +42,89 @@ interface Checksum {
 
     /**
      * Updates the current checksum with the specified array of bytes.
+     *
+     * @implSpec This default implementation is equal to calling
+     * {@code update(b, 0, b.length)}.
+     *
+     * @param b the array of bytes to update the checksum with
+     *
+     * @throws NullPointerException
+     *         if {@code b} is {@code null}
+     *
+     * @since 1.9
+     */
+    default public void update(byte[] b) {
+        update(b, 0, b.length);
+    }
+
+    /**
+     * Updates the current checksum with the specified array of bytes.
+     *
      * @param b the byte array to update the checksum with
      * @param off the start offset of the data
      * @param len the number of bytes to use for the update
      */
     public void update(byte[] b, int off, int len);
 
+    /**
+     * Updates the current checksum with the bytes from the specified buffer.
+     *
+     * The checksum is updated with the remaining bytes in the buffer, starting
+     * at the buffer's position. Upon return, the buffer's position will be
+     * updated to its limit; its limit will not have been changed.
+     *
+     * @apiNote For best performance with DirectByteBuffer and other ByteBuffer
+     * implementations without a backing array implementers of this interface
+     * should override this method.
+     *
+     * @implSpec The default implementation has the following behavior.<br>
+     * For ByteBuffers backed by an accessible byte array.
+     * <pre>{@code
+     * update(buffer.array(),
+     *        buffer.position() + buffer.arrayOffset(),
+     *        buffer.remaining());
+     * }</pre>
+     * For ByteBuffers not backed by an accessible byte array.
+     * <pre>{@code
+     * byte[] b = new byte[Math.min(buffer.remaining(), 4096)];
+     * while (buffer.hasRemaining()) {
+     *     int length = Math.min(buffer.remaining(), b.length);
+     *     buffer.get(b, 0, length);
+     *     update(b, 0, length);
+     * }
+     * }</pre>
+     *
+     * @param buffer the ByteBuffer to update the checksum with
+     *
+     * @throws NullPointerException
+     *         if {@code buffer} is {@code null}
+     *
+     * @since 1.9
+     */
+    default public void update(ByteBuffer buffer) {
+        int pos = buffer.position();
+        int limit = buffer.limit();
+        assert (pos <= limit);
+        int rem = limit - pos;
+        if (rem <= 0) {
+            return;
+        }
+        if (buffer.hasArray()) {
+            update(buffer.array(), pos + buffer.arrayOffset(), rem);
+        } else {
+            byte[] b = new byte[Math.min(buffer.remaining(), 4096)];
+            while (buffer.hasRemaining()) {
+                int length = Math.min(buffer.remaining(), b.length);
+                buffer.get(b, 0, length);
+                update(b, 0, length);
+            }
+        }
+        buffer.position(limit);
+    }
+
     /**
      * Returns the current checksum value.
+     *
      * @return the current checksum value
      */
     public long getValue();
diff --git a/jdk/src/java.base/share/classes/java/util/zip/package-info.java b/jdk/src/java.base/share/classes/java/util/zip/package-info.java
new file mode 100644
index 00000000000..a6ec2072413
--- /dev/null
+++ b/jdk/src/java.base/share/classes/java/util/zip/package-info.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Provides classes for reading and writing the standard ZIP and GZIP file
+ * formats. Also includes classes for compressing and decompressing data using
+ * the DEFLATE compression algorithm, which is used by the ZIP and GZIP file
+ * formats. Additionally, there are utility classes for computing the CRC-32,
+ * CRC-32C and Adler-32 checksums of arbitrary input streams.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ *     <li><a href="http://www.info-zip.org/doc/appnote-19970311-iz.zip">
+ *         Info-ZIP Application Note 970311</a> - a detailed description of
+ *         the Info-ZIP format upon which the {@code java.util.zip} classes
+ *         are based.
+ *     <li><a name="zip64">An implementation may optionally support the
+ *         ZIP64(tm) format extensions defined by the</a>
+ *         <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">
+ *         PKWARE ZIP File Format Specification</a>. The ZIP64(tm) format
+ *         extensions are used to overcome the size limitations of the
+ *         original ZIP format.
+ *     <li><a name="lang_encoding">APPENDIX D of</a>
+ *         <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">
+ *         PKWARE ZIP File Format Specification</a> - Language Encoding Flag
+ *         (EFS) to encode ZIP entry filename and comment fields using UTF-8.
+ *     <li><a href="http://www.ietf.org/rfc/rfc1950.txt">
+ *         ZLIB Compressed Data Format Specification version 3.3</a>
+ *         &nbsp;
+ *         <a href="http://www.ietf.org/rfc/rfc1950.txt.pdf">(pdf)</a>
+ *         (RFC 1950)
+ *     <li><a href="http://www.ietf.org/rfc/rfc1951.txt">
+ *         DEFLATE Compressed Data Format Specification version 1.3</a>
+ *         &nbsp;
+ *         <a href="http://www.ietf.org/rfc/rfc1951.txt.pdf">(pdf)</a>
+ *         (RFC 1951)
+ *     <li><a href="http://www.ietf.org/rfc/rfc1952.txt">
+ *         GZIP file format specification version 4.3</a>
+ *         &nbsp;
+ *         <a href="http://www.ietf.org/rfc/rfc1952.txt.pdf">(pdf)</a>
+ *         (RFC 1952)
+ *     <li>CRC-32 checksum is described in RFC 1952 (above)
+ *     <li>CRC-32C checksum is described in
+ *         <a href="http://www.ietf.org/rfc/rfc3720.txt">Internet Small
+ *         Computer Systems Interface (iSCSI)</a>
+ *         &nbsp;
+ *         <a href="http://www.ietf.org/rfc/rfc3720.txt.pdf">(pdf)</a>
+ *         (RFC 3720)
+ *     <li>Adler-32 checksum is described in RFC 1950 (above)
+ * </ul>
+ *
+ * @since 1.1
+ */
+package java.util.zip;
diff --git a/jdk/src/java.base/share/classes/java/util/zip/package.html b/jdk/src/java.base/share/classes/java/util/zip/package.html
deleted file mode 100644
index 9b80819ae3d..00000000000
--- a/jdk/src/java.base/share/classes/java/util/zip/package.html
+++ /dev/null
@@ -1,88 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
-<html>
-<head>
-<!--
-Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
--->
-
-</head>
-<body bgcolor="white">
-
-Provides classes for reading and writing the standard ZIP and GZIP
-file formats.  Also includes classes for compressing and decompressing
-data using the DEFLATE compression algorithm, which is used by the
-ZIP and GZIP file formats. Additionally, there are utility classes
-for computing the CRC-32 and Adler-32 checksums of arbitrary
-input streams.
-
-
-<h2>Package Specification</h2>
-
-<ul>
-  <li><a href="http://www.info-zip.org/doc/appnote-19970311-iz.zip">
-      Info-ZIP Application Note 970311
-      </a> - a detailed description of the Info-ZIP format upon which
-      the <code>java.util.zip</code> classes are based.
-  <li><a name="zip64">An implementation may optionally support the ZIP64(tm) format extensions
-      defined by the </a>
-      <a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">
-      PKWARE ZIP File Format Specification</a>. The ZIP64(tm) format extensions
-      are used to overcome the size limitations of the original ZIP format.
-  <li><a name="lang_encoding">APPENDIX D of </a><a href="http://www.pkware.com/documents/casestudies/APPNOTE.TXT">
-      PKWARE ZIP File Format Specification</a> - Language Encoding Flag (EFS) to
-      encode ZIP entry filename and comment fields using UTF-8.
-  <li><a href="http://www.ietf.org/rfc/rfc1950.txt">
-      ZLIB Compressed Data Format Specification version 3.3</a>
-      &nbsp;
-      <a href="http://www.ietf.org/rfc/rfc1950.txt.pdf">(pdf)</a>
-      (RFC 1950)
-  <li><a href="http://www.ietf.org/rfc/rfc1951.txt">
-      DEFLATE Compressed Data Format Specification version 1.3</a>
-      &nbsp;
-      <a href="http://www.ietf.org/rfc/rfc1951.txt.pdf">(pdf)</a>
-      (RFC 1951)
-  <li><a href="http://www.ietf.org/rfc/rfc1952.txt">
-      GZIP file format specification version 4.3</a>
-      &nbsp;
-      <a href="http://www.ietf.org/rfc/rfc1952.txt.pdf">(pdf)</a>
-      (RFC 1952)
-  <li>CRC-32 checksum is described in RFC 1952 (above)
-  <li>Adler-32 checksum is described in RFC 1950 (above)
-</ul>
-
-
-<!--
-<h2>Related Documentation</h2>
-
-For overviews, tutorials, examples, guides, and tool documentation, please see:
-<ul>
-  <li><a href="">##### REFER TO NON-SPEC DOCUMENTATION HERE #####</a>
-</ul>
--->
-
-@since 1.1
-</body>
-</html>
-
-
diff --git a/jdk/test/java/util/zip/ChecksumBase.java b/jdk/test/java/util/zip/ChecksumBase.java
new file mode 100644
index 00000000000..5804be7151b
--- /dev/null
+++ b/jdk/test/java/util/zip/ChecksumBase.java
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * Base class for Checksum tests
+ */
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.charset.StandardCharsets;
+import java.util.zip.Checksum;
+
+public class ChecksumBase {
+
+    private final static byte[] BYTES_123456789 = "123456789".getBytes(StandardCharsets.US_ASCII);
+
+    public static void testAll(Checksum checksum, long expected) {
+        testBytes(checksum, expected);
+        testByteArray(checksum, expected);
+        testWrappedByteBuffer(checksum, expected);
+        testReadonlyByteBuffer(checksum, expected);
+        testDirectByteBuffer(checksum, expected);
+        testByteArrayOffset(checksum, expected);
+        testDirectByteBufferOffset(checksum, expected);
+        testLittleEndianDirectByteBufferOffset(checksum, expected);
+        testWrappedByteBufferOffset(checksum, expected);
+        testLittleEndianWrappedByteBufferOffset(checksum, expected);
+        testReadonlyByteBufferOffset(checksum, expected);
+        testLittleEndianReadonlyByteBufferOffset(checksum, expected);
+    }
+
+    private static void testBytes(Checksum checksum, long expected) {
+        checksum.reset();
+        for (byte bits : BYTES_123456789) {
+            checksum.update(bits);
+        }
+        checkChecksum(checksum, expected);
+    }
+
+    private static void testByteArray(Checksum checksum, long expected) {
+        checksum.reset();
+        checksum.update(BYTES_123456789);
+        checkChecksum(checksum, expected);
+    }
+
+    private static void testWrappedByteBuffer(Checksum checksum, long expected) {
+        checksum.reset();
+        ByteBuffer bb = ByteBuffer.wrap(BYTES_123456789);
+        checksum.update(bb);
+        checkChecksum(checksum, expected);
+    }
+
+    private static void testReadonlyByteBuffer(Checksum checksum, long expected) {
+        checksum.reset();
+        ByteBuffer bb = ByteBuffer.wrap(BYTES_123456789).asReadOnlyBuffer();
+        checksum.update(bb);
+        checkChecksum(checksum, expected);
+    }
+
+    private static void testDirectByteBuffer(Checksum checksum, long expected) {
+        checksum.reset();
+        ByteBuffer bb = ByteBuffer.allocateDirect(BYTES_123456789.length);
+        bb.put(BYTES_123456789);
+        bb.rewind();
+        checksum.update(bb);
+        checkChecksum(checksum, expected);
+    }
+
+    private static void checkChecksum(Checksum checksum, long expected) {
+        if (checksum.getValue() != expected) {
+            throw new RuntimeException("Calculated checksum result was invalid."
+                    + " Expected " + Long.toHexString(expected)
+                    + ", but got " + Long.toHexString(checksum.getValue()) + ".");
+        }
+    }
+
+    private static void testByteArrayOffset(Checksum checksum, long expected) {
+        byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64];
+        for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) {
+            checksum.reset();
+            System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length);
+            checksum.update(unaligned_bytes_123456789, i, BYTES_123456789.length);
+            checkChecksumOffset(checksum, expected, i);
+        }
+    }
+
+    private static void testDirectByteBufferOffset(Checksum checksum, long expected) {
+        byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64];
+        for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) {
+            checksum.reset();
+            ByteBuffer bb = ByteBuffer.allocateDirect(unaligned_bytes_123456789.length);
+            System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length);
+            bb.put(unaligned_bytes_123456789);
+            bb.position(i);
+            bb.limit(i + BYTES_123456789.length);
+            checksum.update(bb);
+            checkChecksumOffset(checksum, expected, i);
+        }
+    }
+
+    private static void testLittleEndianDirectByteBufferOffset(Checksum checksum, long expected) {
+        byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64];
+        for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) {
+            checksum.reset();
+            ByteBuffer bb = ByteBuffer.allocateDirect(unaligned_bytes_123456789.length);
+            bb.order(ByteOrder.LITTLE_ENDIAN);
+            System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length);
+            bb.put(unaligned_bytes_123456789);
+            bb.position(i);
+            bb.limit(i + BYTES_123456789.length);
+            checksum.update(bb);
+            checkChecksumOffset(checksum, expected, i);
+        }
+    }
+
+    private static void testWrappedByteBufferOffset(Checksum checksum, long expected) {
+        byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64];
+        for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) {
+            checksum.reset();
+            System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length);
+            ByteBuffer bb = ByteBuffer.wrap(unaligned_bytes_123456789);
+            bb.position(i);
+            bb.limit(i + BYTES_123456789.length);
+            checksum.update(bb);
+            checkChecksumOffset(checksum, expected, i);
+        }
+    }
+
+    private static void testLittleEndianWrappedByteBufferOffset(Checksum checksum, long expected) {
+        byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64];
+        for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) {
+            checksum.reset();
+            System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length);
+            ByteBuffer bb = ByteBuffer.wrap(unaligned_bytes_123456789);
+            bb.order(ByteOrder.LITTLE_ENDIAN);
+            bb.position(i);
+            bb.limit(i + BYTES_123456789.length);
+            checksum.update(bb);
+            checkChecksumOffset(checksum, expected, i);
+        }
+    }
+
+    private static void testReadonlyByteBufferOffset(Checksum checksum, long expected) {
+        byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64];
+        for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) {
+            checksum.reset();
+            System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length);
+            ByteBuffer bb = ByteBuffer.wrap(unaligned_bytes_123456789).asReadOnlyBuffer();
+            bb.position(i);
+            bb.limit(i + BYTES_123456789.length);
+            checksum.update(bb);
+            checkChecksumOffset(checksum, expected, i);
+        }
+    }
+
+    private static void testLittleEndianReadonlyByteBufferOffset(Checksum checksum, long expected) {
+        byte[] unaligned_bytes_123456789 = new byte[BYTES_123456789.length + 64];
+        for (int i = 0; i < unaligned_bytes_123456789.length - BYTES_123456789.length; i++) {
+            checksum.reset();
+            System.arraycopy(BYTES_123456789, 0, unaligned_bytes_123456789, i, BYTES_123456789.length);
+            ByteBuffer bb = ByteBuffer.wrap(unaligned_bytes_123456789).asReadOnlyBuffer();
+            bb.order(ByteOrder.LITTLE_ENDIAN);
+            bb.position(i);
+            bb.limit(i + BYTES_123456789.length);
+            checksum.update(bb);
+            checkChecksumOffset(checksum, expected, i);
+        }
+    }
+
+    private static void checkChecksumOffset(Checksum checksum, long expected, int offset) {
+        if (checksum.getValue() != expected) {
+            throw new RuntimeException("Calculated CRC32C result was invalid. Array offset "
+                    + offset + ". Expected: " + Long.toHexString(expected) + ", Got: "
+                    + Long.toHexString(checksum.getValue()));
+        }
+    }
+}
diff --git a/jdk/test/java/util/zip/TestCRC32.java b/jdk/test/java/util/zip/TestCRC32.java
new file mode 100644
index 00000000000..68c15aed44b
--- /dev/null
+++ b/jdk/test/java/util/zip/TestCRC32.java
@@ -0,0 +1,40 @@
+
+import java.util.zip.CRC32;
+
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test @summary Check that CRC-32 returns the expected CRC value for the
+ * string 123456789
+ * http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-32
+ * @build ChecksumBase
+ * @run main TestCRC32
+ */
+
+public class TestCRC32 {
+
+    public static void main(String[] args) {
+        ChecksumBase.testAll(new CRC32(), 0xCBF43926L);
+    }
+}
diff --git a/jdk/test/java/util/zip/TestCRC32C.java b/jdk/test/java/util/zip/TestCRC32C.java
new file mode 100644
index 00000000000..bb5ea0447c5
--- /dev/null
+++ b/jdk/test/java/util/zip/TestCRC32C.java
@@ -0,0 +1,40 @@
+
+import java.util.zip.CRC32C;
+
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test @summary Check that CRC-32C returns the expected CRC value for the
+ * string 123456789
+ * http://reveng.sourceforge.net/crc-catalogue/all.htm#crc.cat.crc-32c
+ * @build ChecksumBase
+ * @run main TestCRC32C
+ */
+
+public class TestCRC32C {
+
+    public static void main(String[] args) {
+        ChecksumBase.testAll(new CRC32C(), 0xE3069283L);
+    }
+}
diff --git a/jdk/test/java/util/zip/TestChecksum.java b/jdk/test/java/util/zip/TestChecksum.java
new file mode 100644
index 00000000000..07be5910ead
--- /dev/null
+++ b/jdk/test/java/util/zip/TestChecksum.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test @summary Test that default methods in Checksum works as expected
+ * @build ChecksumBase
+ * @run main TestChecksum
+ */
+import java.util.zip.CRC32C;
+import java.util.zip.Checksum;
+
+public class TestChecksum {
+
+    public static void main(String[] args) {
+        ChecksumBase.testAll(new MyCRC32C(), 0xE3069283L);
+    }
+
+    /**
+     * Only implementing required methods
+     */
+    private static class MyCRC32C implements Checksum {
+
+        private final CRC32C crc32c = new CRC32C();
+
+        @Override
+        public void update(int b) {
+            crc32c.update(b);
+        }
+
+        @Override
+        public void update(byte[] b, int off, int len) {
+            crc32c.update(b, off, len);
+        }
+
+        @Override
+        public long getValue() {
+            return crc32c.getValue();
+        }
+
+        @Override
+        public void reset() {
+            crc32c.reset();
+        }
+
+    }
+}

From ca85e583e9c19d810645213b5cbb809768253bc7 Mon Sep 17 00:00:00 2001
From: Sean Mullan <mullan@openjdk.org>
Date: Fri, 21 Nov 2014 15:23:36 -0500
Subject: [PATCH 136/299] 8046949: Generify the javax.xml.crypto API

Reviewed-by: xuelei
---
 .../classes/javax/xml/crypto/NodeSetData.java |  8 ++--
 .../xml/crypto/dom/DOMCryptoContext.java      |  6 +--
 .../javax/xml/crypto/dsig/Manifest.java       |  9 ++--
 .../javax/xml/crypto/dsig/Reference.java      |  5 +--
 .../xml/crypto/dsig/SignatureProperties.java  |  5 +--
 .../xml/crypto/dsig/SignatureProperty.java    |  5 +--
 .../javax/xml/crypto/dsig/SignedInfo.java     |  5 +--
 .../javax/xml/crypto/dsig/XMLObject.java      |  8 ++--
 .../javax/xml/crypto/dsig/XMLSignature.java   |  5 +--
 .../xml/crypto/dsig/XMLSignatureFactory.java  | 41 +++++++----------
 .../xml/crypto/dsig/keyinfo/KeyInfo.java      |  5 +--
 .../crypto/dsig/keyinfo/KeyInfoFactory.java   | 22 ++++------
 .../xml/crypto/dsig/keyinfo/PGPData.java      |  5 +--
 .../crypto/dsig/keyinfo/RetrievalMethod.java  |  5 +--
 .../xml/crypto/dsig/keyinfo/X509Data.java     |  5 +--
 .../dsig/spec/ExcC14NParameterSpec.java       | 27 ++++--------
 .../dsig/spec/XPathFilter2ParameterSpec.java  | 28 ++++--------
 .../dsig/spec/XPathFilterParameterSpec.java   | 32 +++++---------
 .../javax/xml/crypto/dsig/spec/XPathType.java | 40 ++++++++---------
 .../internal/dom/ApacheCanonicalizer.java     | 11 ++---
 .../dsig/internal/dom/ApacheNodeSetData.java  |  2 +-
 .../dsig/internal/dom/ApacheTransform.java    |  3 +-
 .../dsig/internal/dom/DOMExcC14NMethod.java   |  3 +-
 .../jcp/xml/dsig/internal/dom/DOMKeyInfo.java | 13 +++---
 .../dsig/internal/dom/DOMKeyInfoFactory.java  | 21 ++++-----
 .../xml/dsig/internal/dom/DOMKeyValue.java    |  1 -
 .../xml/dsig/internal/dom/DOMManifest.java    | 14 +++---
 .../jcp/xml/dsig/internal/dom/DOMPGPData.java | 34 +++++---------
 .../xml/dsig/internal/dom/DOMReference.java   | 36 ++++++---------
 .../dsig/internal/dom/DOMRetrievalMethod.java | 19 +++-----
 .../internal/dom/DOMSignatureProperties.java  | 19 ++++----
 .../internal/dom/DOMSignatureProperty.java    | 25 +++++------
 .../xml/dsig/internal/dom/DOMSignedInfo.java  | 19 +++-----
 .../xml/dsig/internal/dom/DOMSubTreeData.java |  2 +-
 .../jcp/xml/dsig/internal/dom/DOMUtils.java   |  2 -
 .../xml/dsig/internal/dom/DOMX509Data.java    |  4 +-
 .../xml/dsig/internal/dom/DOMXMLObject.java   | 18 +++-----
 .../dsig/internal/dom/DOMXMLSignature.java    | 24 +++-------
 .../internal/dom/DOMXMLSignatureFactory.java  | 44 ++++++++-----------
 .../dom/DOMXPathFilter2Transform.java         |  2 -
 .../dsig/internal/dom/DOMXPathTransform.java  |  1 -
 .../org/jcp/xml/dsig/internal/dom/Utils.java  |  4 +-
 .../xml/crypto/dsig/GenerationTests.java      | 36 +++++++--------
 .../javax/xml/crypto/dsig/KeySelectors.java   | 20 +++------
 .../xml/crypto/dsig/SignatureValidator.java   | 15 ++++---
 .../xml/crypto/dsig/X509KeySelector.java      | 10 ++---
 46 files changed, 258 insertions(+), 410 deletions(-)

diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/NodeSetData.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/NodeSetData.java
index 284753c5f78..9da53d0ea8a 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/NodeSetData.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/NodeSetData.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,9 +37,10 @@ import java.util.Iterator;
  *
  * @author Sean Mullan
  * @author JSR 105 Expert Group
+ * @param <T> the type of nodes maintained by this set
  * @since 1.6
  */
-public interface NodeSetData extends Data {
+public interface NodeSetData<T> extends Data, Iterable<T> {
 
     /**
      * Returns a read-only iterator over the nodes contained in this
@@ -52,6 +53,5 @@ public interface NodeSetData extends Data {
      * @return an <code>Iterator</code> over the nodes in this
      *    <code>NodeSetData</code> in document order
      */
-    @SuppressWarnings("rawtypes")
-    Iterator iterator();
+    Iterator<T> iterator();
 }
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java
index 9da528180e4..47f006cc5f8 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/DOMCryptoContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -33,6 +33,7 @@ import javax.xml.crypto.XMLCryptoContext;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
 import org.w3c.dom.Element;
 
 /**
@@ -219,8 +220,7 @@ public class DOMCryptoContext implements XMLCryptoContext {
      *
      * @return a read-only iterator over the set of mappings
      */
-    @SuppressWarnings("rawtypes")
-    public Iterator iterator() {
+    public Iterator<Map.Entry<String, Element>> iterator() {
         return Collections.unmodifiableMap(idMap).entrySet().iterator();
     }
 
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java
index 0a34d04d425..351b3a9a674 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Manifest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,8 +51,8 @@ import java.util.List;
  *
  * <pre>
  *   XMLSignatureFactory factory = XMLSignatureFactory.getInstance("DOM");
- *   List references = Collections.singletonList(factory.newReference
- *       ("#reference-1", DigestMethod.SHA1));
+ *   Reference ref = factory.newReference("#reference-1", DigestMethod.SHA1);
+ *   List<Reference> references = Collections.singletonList(ref);
  *   Manifest manifest = factory.newManifest(references, "manifest-1");
  * </pre>
  *
@@ -86,6 +86,5 @@ public interface Manifest extends XMLStructure {
      *
      * @return an unmodifiable list of one or more <code>Reference</code>s
      */
-    @SuppressWarnings("rawtypes")
-    List getReferences();
+    List<Reference> getReferences();
 }
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Reference.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Reference.java
index f9df64b1b2c..6f3ce617317 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Reference.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/Reference.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -85,8 +85,7 @@ public interface Reference extends URIReference, XMLStructure {
      * @return an unmodifiable list of <code>Transform</code>s
      *    (may be empty but never <code>null</code>)
      */
-    @SuppressWarnings("rawtypes")
-    List getTransforms();
+    List<Transform> getTransforms();
 
     /**
      * Returns the digest method of this <code>Reference</code>.
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperties.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperties.java
index 1093b749373..af12e38f8c0 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperties.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperties.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -87,6 +87,5 @@ public interface SignatureProperties extends XMLStructure {
      * @return an unmodifiable list of one or more
      *    <code>SignatureProperty</code>s
      */
-    @SuppressWarnings("rawtypes")
-    List getProperties();
+    List<SignatureProperty> getProperties();
 }
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperty.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperty.java
index f83da44718c..237590125b0 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperty.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignatureProperty.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -91,6 +91,5 @@ public interface SignatureProperty extends XMLStructure {
      *
      * @return an unmodifiable list of one or more <code>XMLStructure</code>s
      */
-    @SuppressWarnings("rawtypes")
-    List getContent();
+    List<XMLStructure> getContent();
 }
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignedInfo.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignedInfo.java
index 3f57b46689e..85cbb347ddb 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignedInfo.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/SignedInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -80,8 +80,7 @@ public interface SignedInfo extends XMLStructure {
      *
      * @return an unmodifiable list of one or more {@link Reference}s
      */
-    @SuppressWarnings("rawtypes")
-    List getReferences();
+    List<Reference> getReferences();
 
     /**
      * Returns the optional <code>Id</code> attribute of this
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java
index e535e8fa434..572be86f207 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -64,7 +64,8 @@ import javax.xml.crypto.XMLStructure;
  *
  * <pre>
  *   XMLSignatureFactory fac = XMLSignatureFactory.getInstance("DOM");
- *   List content = Collections.singletonList(fac.newManifest(references)));
+ *   Manifest manifest = fac.newManifest(references);
+ *   List<XMLStructure> content = Collections.singletonList(manifest);
  *   XMLObject object = factory.newXMLObject(content, "object-1", null, null);
  * </pre>
  *
@@ -100,8 +101,7 @@ public interface XMLObject extends XMLStructure {
      * @return an unmodifiable list of <code>XMLStructure</code>s (may be empty
      *    but never <code>null</code>)
      */
-    @SuppressWarnings("rawtypes")
-    List getContent();
+    List<XMLStructure> getContent();
 
     /**
      * Returns the Id of this <code>XMLObject</code>.
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignature.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignature.java
index 32c05eed10d..4909e700bcf 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignature.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignature.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -136,8 +136,7 @@ public interface XMLSignature extends XMLStructure {
      * @return an unmodifiable list of <code>XMLObject</code>s (may be empty
      *    but never <code>null</code>)
      */
-    @SuppressWarnings("rawtypes")
-    List getObjects();
+    List<XMLObject> getObjects();
 
     /**
      * Returns the optional Id of this <code>XMLSignature</code>.
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java
index 52b5198cda2..f776bf322b5 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -365,9 +365,8 @@ public abstract class XMLSignatureFactory {
      * @throws ClassCastException if any of the <code>objects</code> are not of
      *    type <code>XMLObject</code>
      */
-    @SuppressWarnings("rawtypes")
     public abstract XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki,
-        List objects, String id, String signatureValueId);
+        List<? extends XMLObject> objects, String id, String signatureValueId);
 
     /**
      * Creates a <code>Reference</code> with the specified URI and digest
@@ -399,9 +398,8 @@ public abstract class XMLSignatureFactory {
      *    compliant
      * @throws NullPointerException if <code>dm</code> is <code>null</code>
      */
-    @SuppressWarnings("rawtypes")
     public abstract Reference newReference(String uri, DigestMethod dm,
-        List transforms, String type, String id);
+        List<? extends Transform> transforms, String type, String id);
 
     /**
      * Creates a <code>Reference</code> with the specified parameters and
@@ -430,9 +428,9 @@ public abstract class XMLSignatureFactory {
      * @throws NullPointerException if <code>dm</code> or
      *    <code>digestValue</code> is <code>null</code>
      */
-    @SuppressWarnings("rawtypes")
     public abstract Reference newReference(String uri, DigestMethod dm,
-        List transforms, String type, String id, byte[] digestValue);
+        List<? extends Transform> transforms, String type, String id,
+        byte[] digestValue);
 
     /**
      * Creates a <code>Reference</code> with the specified parameters.
@@ -473,10 +471,9 @@ public abstract class XMLSignatureFactory {
      *    <code>appliedTransforms</code> or <code>result</code> is
      *    <code>null</code>
      */
-    @SuppressWarnings("rawtypes")
     public abstract Reference newReference(String uri, DigestMethod dm,
-        List appliedTransforms, Data result, List transforms, String type,
-        String id);
+        List<? extends Transform> appliedTransforms, Data result,
+        List<? extends Transform> transforms, String type, String id);
 
     /**
      * Creates a <code>SignedInfo</code> with the specified canonicalization
@@ -493,9 +490,8 @@ public abstract class XMLSignatureFactory {
      * @throws NullPointerException if any of the parameters
      *    are <code>null</code>
      */
-    @SuppressWarnings("rawtypes")
     public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm,
-        SignatureMethod sm, List references);
+        SignatureMethod sm, List<? extends Reference> references);
 
     /**
      * Creates a <code>SignedInfo</code> with the specified parameters.
@@ -512,9 +508,8 @@ public abstract class XMLSignatureFactory {
      * @throws NullPointerException if <code>cm</code>, <code>sm</code>, or
      *    <code>references</code> are <code>null</code>
      */
-    @SuppressWarnings("rawtypes")
     public abstract SignedInfo newSignedInfo(CanonicalizationMethod cm,
-        SignatureMethod sm, List references, String id);
+        SignatureMethod sm, List<? extends Reference> references, String id);
 
     // Object factory methods
     /**
@@ -530,9 +525,8 @@ public abstract class XMLSignatureFactory {
      * @throws ClassCastException if <code>content</code> contains any
      *    entries that are not of type {@link XMLStructure}
      */
-    @SuppressWarnings("rawtypes")
-    public abstract XMLObject newXMLObject(List content, String id,
-        String mimeType, String encoding);
+    public abstract XMLObject newXMLObject(List<? extends XMLStructure> content,
+        String id, String mimeType, String encoding);
 
     /**
      * Creates a <code>Manifest</code> containing the specified
@@ -547,8 +541,7 @@ public abstract class XMLSignatureFactory {
      * @throws ClassCastException if <code>references</code> contains any
      *    entries that are not of type {@link Reference}
      */
-    @SuppressWarnings("rawtypes")
-    public abstract Manifest newManifest(List references);
+    public abstract Manifest newManifest(List<? extends Reference> references);
 
     /**
      * Creates a <code>Manifest</code> containing the specified
@@ -564,8 +557,8 @@ public abstract class XMLSignatureFactory {
      * @throws ClassCastException if <code>references</code> contains any
      *    entries that are not of type {@link Reference}
      */
-    @SuppressWarnings("rawtypes")
-    public abstract Manifest newManifest(List references, String id);
+    public abstract Manifest newManifest(List<? extends Reference> references,
+        String id);
 
     /**
      * Creates a <code>SignatureProperty</code> containing the specified
@@ -583,9 +576,8 @@ public abstract class XMLSignatureFactory {
      * @throws ClassCastException if <code>content</code> contains any
      *    entries that are not of type {@link XMLStructure}
      */
-    @SuppressWarnings("rawtypes")
     public abstract SignatureProperty newSignatureProperty
-        (List content, String target, String id);
+        (List<? extends XMLStructure> content, String target, String id);
 
     /**
      * Creates a <code>SignatureProperties</code> containing the specified
@@ -602,9 +594,8 @@ public abstract class XMLSignatureFactory {
      * @throws ClassCastException if <code>properties</code> contains any
      *    entries that are not of type {@link SignatureProperty}
      */
-    @SuppressWarnings("rawtypes")
     public abstract SignatureProperties newSignatureProperties
-        (List properties, String id);
+        (List<? extends SignatureProperty> properties, String id);
 
     // Algorithm factory methods
     /**
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java
index def192a1b0e..b3e6d5e8715 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -94,8 +94,7 @@ public interface KeyInfo extends XMLStructure {
      *    in this <code>KeyInfo</code>. Never returns <code>null</code> or an
      *    empty list.
      */
-    @SuppressWarnings("rawtypes")
-    List getContent();
+    List<XMLStructure> getContent();
 
     /**
      * Return the optional Id attribute of this <code>KeyInfo</code>, which
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java
index a5e17102214..a9465f79330 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -305,8 +305,7 @@ public abstract class KeyInfoFactory {
      * @throws ClassCastException if <code>content</code> contains any entries
      *    that are not of type {@link XMLStructure}
      */
-    @SuppressWarnings("rawtypes")
-    public abstract KeyInfo newKeyInfo(List content);
+    public abstract KeyInfo newKeyInfo(List<? extends XMLStructure> content);
 
     /**
      * Creates a <code>KeyInfo</code> containing the specified list of key
@@ -325,8 +324,8 @@ public abstract class KeyInfoFactory {
      * @throws ClassCastException if <code>content</code> contains any entries
      *    that are not of type {@link XMLStructure}
      */
-    @SuppressWarnings("rawtypes")
-    public abstract KeyInfo newKeyInfo(List content, String id);
+    public abstract KeyInfo newKeyInfo(List<? extends XMLStructure> content,
+        String id);
 
     /**
      * Creates a <code>KeyName</code> from the specified name.
@@ -387,9 +386,8 @@ public abstract class KeyInfoFactory {
      * @throws ClassCastException if <code>other</code> contains any
      *    entries that are not of type {@link XMLStructure}
      */
-    @SuppressWarnings("rawtypes")
     public abstract PGPData newPGPData(byte[] keyId, byte[] keyPacket,
-        List other);
+        List<? extends XMLStructure> other);
 
     /**
      * Creates a <code>PGPData</code> from the specified PGP key material
@@ -411,8 +409,8 @@ public abstract class KeyInfoFactory {
      * @throws ClassCastException if <code>other</code> contains any
      *    entries that are not of type {@link XMLStructure}
      */
-    @SuppressWarnings("rawtypes")
-    public abstract PGPData newPGPData(byte[] keyPacket, List other);
+    public abstract PGPData newPGPData(byte[] keyPacket,
+        List<? extends XMLStructure> other);
 
     /**
      * Creates a <code>RetrievalMethod</code> from the specified URI.
@@ -443,9 +441,8 @@ public abstract class KeyInfoFactory {
      * @throws ClassCastException if <code>transforms</code> contains any
      *    entries that are not of type {@link Transform}
      */
-    @SuppressWarnings("rawtypes")
     public abstract RetrievalMethod newRetrievalMethod(String uri, String type,
-        List transforms);
+        List<? extends Transform> transforms);
 
     /**
      * Creates a <code>X509Data</code> containing the specified list of
@@ -469,8 +466,7 @@ public abstract class KeyInfoFactory {
      * @throws ClassCastException if <code>content</code> contains any entries
      *    that are not of one of the valid types mentioned above
      */
-    @SuppressWarnings("rawtypes")
-    public abstract X509Data newX509Data(List content);
+    public abstract X509Data newX509Data(List<?> content);
 
     /**
      * Creates an <code>X509IssuerSerial</code> from the specified X.500 issuer
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java
index 6f9c6a31eda..00daf4d5bdf 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/PGPData.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -112,6 +112,5 @@ public interface PGPData extends XMLStructure {
      * @return an unmodifiable list of <code>XMLStructure</code>s (may be
      *    empty, but never <code>null</code>)
      */
-    @SuppressWarnings("rawtypes")
-    List getExternalElements();
+    List<XMLStructure> getExternalElements();
 }
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java
index 3741f348660..7a53f9e41a0 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/RetrievalMethod.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -80,8 +80,7 @@ public interface RetrievalMethod extends URIReference, XMLStructure {
      * @return an unmodifiable list of <code>Transform</code> objects (may be
      *    empty but never <code>null</code>).
      */
-    @SuppressWarnings("rawtypes")
-    List getTransforms();
+    List<Transform> getTransforms();
 
     /**
      * Returns the URI of the referenced <code>KeyInfo</code> information.
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java
index 47efc86a116..d732b54e7af 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/X509Data.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -109,6 +109,5 @@ public interface X509Data extends XMLStructure {
      * @return an unmodifiable list of the content in this <code>X509Data</code>
      *    (never <code>null</code> or empty)
      */
-    @SuppressWarnings("rawtypes")
-    List getContent();
+    List<?> getContent();
 }
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java
index 990a3eedccd..45ff07f1335 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/ExcC14NParameterSpec.java
@@ -59,7 +59,7 @@ import java.util.List;
  */
 public final class ExcC14NParameterSpec implements C14NMethodParameterSpec {
 
-    private List<String> preList;
+    private final List<String> prefixList;
 
     /**
      * Indicates the default namespace ("#default").
@@ -71,7 +71,7 @@ public final class ExcC14NParameterSpec implements C14NMethodParameterSpec {
      * list.
      */
     public ExcC14NParameterSpec() {
-        preList = Collections.emptyList();
+        prefixList = Collections.emptyList();
     }
 
     /**
@@ -86,22 +86,14 @@ public final class ExcC14NParameterSpec implements C14NMethodParameterSpec {
      * @throws ClassCastException if any of the entries in the list are not
      *    of type <code>String</code>
      */
-    @SuppressWarnings("rawtypes")
-    public ExcC14NParameterSpec(List prefixList) {
+    public ExcC14NParameterSpec(List<String> prefixList) {
         if (prefixList == null) {
             throw new NullPointerException("prefixList cannot be null");
         }
-        List<?> copy = new ArrayList<>((List<?>)prefixList);
-        for (int i = 0, size = copy.size(); i < size; i++) {
-            if (!(copy.get(i) instanceof String)) {
-                throw new ClassCastException("not a String");
-            }
-        }
-
-        @SuppressWarnings("unchecked")
-        List<String> temp = (List<String>)copy;
-
-        preList = Collections.unmodifiableList(temp);
+        List<String> tempList = Collections.checkedList(new ArrayList<>(),
+                                                        String.class);
+        tempList.addAll(prefixList);
+        this.prefixList = Collections.unmodifiableList(tempList);
     }
 
     /**
@@ -114,8 +106,7 @@ public final class ExcC14NParameterSpec implements C14NMethodParameterSpec {
      * @return the inclusive namespace prefix list (may be empty but never
      *    <code>null</code>)
      */
-    @SuppressWarnings("rawtypes")
-    public List getPrefixList() {
-        return preList;
+    public List<String> getPrefixList() {
+        return prefixList;
     }
 }
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java
index 4f879019ed4..acaa651e597 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilter2ParameterSpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,27 +59,18 @@ public final class XPathFilter2ParameterSpec implements TransformParameterSpec {
      * @throws NullPointerException if <code>xPathList</code> is
      *    <code>null</code>
      */
-    @SuppressWarnings("rawtypes")
-    public XPathFilter2ParameterSpec(List xPathList) {
+    public XPathFilter2ParameterSpec(List<XPathType> xPathList) {
         if (xPathList == null) {
             throw new NullPointerException("xPathList cannot be null");
         }
-        List<?> xPathListCopy = new ArrayList<>((List<?>)xPathList);
-        if (xPathListCopy.isEmpty()) {
+        List<XPathType> tempList =
+            Collections.checkedList(new ArrayList<XPathType>(),
+                                    XPathType.class);
+        tempList.addAll(xPathList);
+        if (tempList.isEmpty()) {
             throw new IllegalArgumentException("xPathList cannot be empty");
         }
-        int size = xPathListCopy.size();
-        for (int i = 0; i < size; i++) {
-            if (!(xPathListCopy.get(i) instanceof XPathType)) {
-                throw new ClassCastException
-                    ("xPathList["+i+"] is not a valid type");
-            }
-        }
-
-        @SuppressWarnings("unchecked")
-        List<XPathType> temp = (List<XPathType>)xPathListCopy;
-
-        this.xPathList = Collections.unmodifiableList(temp);
+        this.xPathList = Collections.unmodifiableList(tempList);
     }
 
     /**
@@ -91,8 +82,7 @@ public final class XPathFilter2ParameterSpec implements TransformParameterSpec {
      * @return a <code>List</code> of <code>XPathType</code> objects
      *    (never <code>null</code> or empty)
      */
-    @SuppressWarnings("rawtypes")
-    public List getXPathList() {
+    public List<XPathType> getXPathList() {
         return xPathList;
     }
 }
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java
index c9653fc3e9c..1a0ed7e900b 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathFilterParameterSpec.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,6 @@ import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
-import java.util.Map.Entry;
 
 /**
  * Parameters for the <a href="http://www.w3.org/TR/xmldsig-core/#sec-XPath">
@@ -51,8 +50,8 @@ import java.util.Map.Entry;
  */
 public final class XPathFilterParameterSpec implements TransformParameterSpec {
 
-    private String xPath;
-    private Map<String,String> nsMap;
+    private final String xPath;
+    private final Map<String,String> nsMap;
 
     /**
      * Creates an <code>XPathFilterParameterSpec</code> with the specified
@@ -83,26 +82,16 @@ public final class XPathFilterParameterSpec implements TransformParameterSpec {
      * @throws ClassCastException if any of the map's keys or entries are not
      *    of type <code>String</code>
      */
-    @SuppressWarnings("rawtypes")
-    public XPathFilterParameterSpec(String xPath, Map namespaceMap) {
+    public XPathFilterParameterSpec(String xPath, Map<String,String> namespaceMap) {
         if (xPath == null || namespaceMap == null) {
             throw new NullPointerException();
         }
         this.xPath = xPath;
-        Map<?,?> copy = new HashMap<>((Map<?,?>)namespaceMap);
-        Iterator<? extends Map.Entry<?,?>> entries = copy.entrySet().iterator();
-        while (entries.hasNext()) {
-            Map.Entry<?,?> me = entries.next();
-            if (!(me.getKey() instanceof String) ||
-                !(me.getValue() instanceof String)) {
-                throw new ClassCastException("not a String");
-            }
-        }
-
-        @SuppressWarnings("unchecked")
-        Map<String,String> temp = (Map<String,String>)copy;
-
-        nsMap = Collections.unmodifiableMap(temp);
+        Map<String,String> tempMap = Collections.checkedMap(new HashMap<>(),
+                                                            String.class,
+                                                            String.class);
+        tempMap.putAll(namespaceMap);
+        this.nsMap = Collections.unmodifiableMap(tempMap);
     }
 
     /**
@@ -125,8 +114,7 @@ public final class XPathFilterParameterSpec implements TransformParameterSpec {
      * @return a <code>Map</code> of namespace prefixes to namespace URIs (may
      *    be empty, but never <code>null</code>)
      */
-    @SuppressWarnings("rawtypes")
-    public Map getNamespaceMap() {
+    public Map<String,String> getNamespaceMap() {
         return nsMap;
     }
 }
diff --git a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathType.java b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathType.java
index c3203f1c39c..625eaab343e 100644
--- a/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathType.java
+++ b/jdk/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/XPathType.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,6 @@
 package javax.xml.crypto.dsig.spec;
 
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -106,7 +105,7 @@ public class XPathType {
 
     private final String expression;
     private final Filter filter;
-    private Map<String,String> nsMap;
+    private final Map<String,String> nsMap;
 
     /**
      * Creates an <code>XPathType</code> instance with the specified XPath
@@ -147,26 +146,24 @@ public class XPathType {
      * @throws ClassCastException if any of the map's keys or entries are
      *    not of type <code>String</code>
      */
-    @SuppressWarnings("rawtypes")
-    public XPathType(String expression, Filter filter, Map namespaceMap) {
-        this(expression, filter);
+    public XPathType(String expression, Filter filter,
+        Map<String,String> namespaceMap) {
+        if (expression == null) {
+            throw new NullPointerException("expression cannot be null");
+        }
+        if (filter == null) {
+            throw new NullPointerException("filter cannot be null");
+        }
         if (namespaceMap == null) {
             throw new NullPointerException("namespaceMap cannot be null");
         }
-        Map<?,?> copy = new HashMap<>((Map<?,?>)namespaceMap);
-        Iterator<? extends Map.Entry<?,?>> entries = copy.entrySet().iterator();
-        while (entries.hasNext()) {
-            Map.Entry<?,?> me = entries.next();
-            if (!(me.getKey() instanceof String) ||
-                !(me.getValue() instanceof String)) {
-                throw new ClassCastException("not a String");
-            }
-        }
-
-        @SuppressWarnings("unchecked")
-        Map<String,String> temp = (Map<String,String>)copy;
-
-        nsMap = Collections.unmodifiableMap(temp);
+        this.expression = expression;
+        this.filter = filter;
+        Map<String,String> tempMap = Collections.checkedMap(new HashMap<>(),
+                                                            String.class,
+                                                            String.class);
+        tempMap.putAll(namespaceMap);
+        this.nsMap = Collections.unmodifiableMap(tempMap);
     }
 
     /**
@@ -198,8 +195,7 @@ public class XPathType {
      * @return a <code>Map</code> of namespace prefixes to namespace URIs
      *    (may be empty, but never <code>null</code>)
      */
-    @SuppressWarnings("rawtypes")
-    public Map getNamespaceMap() {
+    public Map<String,String> getNamespaceMap() {
         return nsMap;
     }
 }
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java
index c1d8257bd22..f708ffc529c 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheCanonicalizer.java
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: ApacheCanonicalizer.java 1333869 2012-05-04 10:42:44Z coheigea $
@@ -166,11 +166,9 @@ public abstract class ApacheCanonicalizer extends TransformService {
                          (subTree.getRoot())));
                 }
             } else if (data instanceof NodeSetData) {
-                NodeSetData nsd = (NodeSetData)data;
-                // convert Iterator to Set
-                @SuppressWarnings("unchecked")
-                Set<Node> ns = Utils.toNodeSet(nsd.iterator());
-                nodeSet = ns;
+                NodeSetData<?> nsd = (NodeSetData<?>)data;
+                // convert Iterator to Set<Node>
+                nodeSet = Utils.toNodeSet(nsd.iterator());
                 if (log.isLoggable(java.util.logging.Level.FINE)) {
                     log.log(java.util.logging.Level.FINE, "Canonicalizing " + nodeSet.size() + " nodes");
                 }
@@ -236,7 +234,6 @@ public abstract class ApacheCanonicalizer extends TransformService {
                 in = new XMLSignatureInput(subTree.getRoot());
                 in.setExcludeComments(subTree.excludeComments());
             } else {
-                @SuppressWarnings("unchecked")
                 Set<Node> nodeSet =
                     Utils.toNodeSet(((NodeSetData)data).iterator());
                 in = new XMLSignatureInput(nodeSet);
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java
index 8cbcaba56fe..fdd35049cf8 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheNodeSetData.java
@@ -39,7 +39,7 @@ import com.sun.org.apache.xml.internal.security.signature.NodeFilter;
 import com.sun.org.apache.xml.internal.security.signature.XMLSignatureInput;
 import com.sun.org.apache.xml.internal.security.utils.XMLUtils;
 
-public class ApacheNodeSetData implements ApacheData, NodeSetData {
+public class ApacheNodeSetData implements ApacheData, NodeSetData<Node> {
 
     private XMLSignatureInput xi;
 
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java
index f5cdec5d250..3cad0fd6f0c 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/ApacheTransform.java
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: ApacheTransform.java 1333869 2012-05-04 10:42:44Z coheigea $
@@ -175,7 +175,6 @@ public abstract class ApacheTransform extends TransformService {
                 in = new XMLSignatureInput(subTree.getRoot());
                 in.setExcludeComments(subTree.excludeComments());
             } else {
-                @SuppressWarnings("unchecked")
                 Set<Node> nodeSet =
                     Utils.toNodeSet(((NodeSetData)data).iterator());
                 in = new XMLSignatureInput(nodeSet);
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java
index 1af95986a61..cda4b4b14b5 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMExcC14NMethod.java
@@ -21,7 +21,7 @@
  * under the License.
  */
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  */
 /*
  * $Id: DOMExcC14NMethod.java 1197150 2011-11-03 14:34:57Z coheigea $
@@ -119,7 +119,6 @@ public final class DOMExcC14NMethod extends ApacheCanonicalizer {
 
         ExcC14NParameterSpec params = (ExcC14NParameterSpec)spec;
         StringBuilder prefixListAttr = new StringBuilder("");
-        @SuppressWarnings("unchecked")
         List<String> prefixList = params.getPrefixList();
         for (int i = 0, size = prefixList.size(); i < size; i++) {
             prefixListAttr.append(prefixList.get(i));
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java
index eafbf623293..71021901802 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfo.java
@@ -68,17 +68,14 @@ public final class DOMKeyInfo extends DOMStructure implements KeyInfo {
         if (content == null) {
             throw new NullPointerException("content cannot be null");
         }
-        this.keyInfoTypes =
-            Collections.unmodifiableList(new ArrayList<XMLStructure>(content));
+        List<XMLStructure> tempList =
+            Collections.checkedList(new ArrayList<XMLStructure>(),
+                                    XMLStructure.class);
+        tempList.addAll(content);
+        this.keyInfoTypes = Collections.unmodifiableList(tempList);
         if (this.keyInfoTypes.isEmpty()) {
             throw new IllegalArgumentException("content cannot be empty");
         }
-        for (int i = 0, size = this.keyInfoTypes.size(); i < size; i++) {
-            if (!(this.keyInfoTypes.get(i) instanceof XMLStructure)) {
-                throw new ClassCastException
-                    ("content["+i+"] is not a valid KeyInfo type");
-            }
-        }
         this.id = id;
     }
 
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java
index 45b5620ed5d..7715b89ff79 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyInfoFactory.java
@@ -34,6 +34,7 @@ import java.security.PublicKey;
 import java.util.List;
 import javax.xml.crypto.*;
 import javax.xml.crypto.dom.DOMCryptoContext;
+import javax.xml.crypto.dsig.Transform;
 import javax.xml.crypto.dsig.keyinfo.*;
 import org.w3c.dom.Document;
 import org.w3c.dom.Element;
@@ -48,13 +49,11 @@ public final class DOMKeyInfoFactory extends KeyInfoFactory {
 
     public DOMKeyInfoFactory() { }
 
-    @SuppressWarnings("rawtypes")
-    public KeyInfo newKeyInfo(List content) {
+    public KeyInfo newKeyInfo(List<? extends XMLStructure> content) {
         return newKeyInfo(content, null);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public KeyInfo newKeyInfo(List content, String id) {
+    public KeyInfo newKeyInfo(List<? extends XMLStructure> content, String id) {
         return new DOMKeyInfo(content, id);
     }
 
@@ -79,13 +78,13 @@ public final class DOMKeyInfoFactory extends KeyInfoFactory {
         return newPGPData(keyId, null, null);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public PGPData newPGPData(byte[] keyId, byte[] keyPacket, List other) {
+    public PGPData newPGPData(byte[] keyId, byte[] keyPacket,
+        List<? extends XMLStructure> other) {
         return new DOMPGPData(keyId, keyPacket, other);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public PGPData newPGPData(byte[] keyPacket, List other) {
+    public PGPData newPGPData(byte[] keyPacket,
+        List<? extends XMLStructure> other) {
         return new DOMPGPData(keyPacket, other);
     }
 
@@ -93,17 +92,15 @@ public final class DOMKeyInfoFactory extends KeyInfoFactory {
         return newRetrievalMethod(uri, null, null);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
     public RetrievalMethod newRetrievalMethod(String uri, String type,
-        List transforms) {
+        List<? extends Transform> transforms) {
         if (uri == null) {
             throw new NullPointerException("uri must not be null");
         }
         return new DOMRetrievalMethod(uri, type, transforms);
     }
 
-    @SuppressWarnings("rawtypes")
-    public X509Data newX509Data(List content) {
+    public X509Data newX509Data(List<?> content) {
         return new DOMX509Data(content);
     }
 
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java
index 12939570d2b..bb7a553beb3 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMKeyValue.java
@@ -33,7 +33,6 @@ import javax.xml.crypto.dom.DOMCryptoContext;
 import javax.xml.crypto.dsig.*;
 import javax.xml.crypto.dsig.keyinfo.KeyValue;
 
-// import java.io.IOException;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.security.AccessController;
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java
index 54e1ac4ae89..2c86d8f65ee 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMManifest.java
@@ -67,18 +67,15 @@ public final class DOMManifest extends DOMStructure implements Manifest {
         if (references == null) {
             throw new NullPointerException("references cannot be null");
         }
-        this.references =
-            Collections.unmodifiableList(new ArrayList<Reference>(references));
+        List<Reference> tempList =
+            Collections.checkedList(new ArrayList<Reference>(),
+                                    Reference.class);
+        tempList.addAll(references);
+        this.references = Collections.unmodifiableList(tempList);
         if (this.references.isEmpty()) {
             throw new IllegalArgumentException("list of references must " +
                 "contain at least one entry");
         }
-        for (int i = 0, size = this.references.size(); i < size; i++) {
-            if (!(this.references.get(i) instanceof Reference)) {
-                throw new ClassCastException
-                    ("references["+i+"] is not a valid type");
-            }
-        }
         this.id = id;
     }
 
@@ -127,7 +124,6 @@ public final class DOMManifest extends DOMStructure implements Manifest {
         return id;
     }
 
-    @SuppressWarnings("unchecked")
     static List<Reference> getManifestReferences(Manifest mf) {
         return mf.getReferences();
     }
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java
index a90725b2094..b845d4cb6b2 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMPGPData.java
@@ -73,18 +73,13 @@ public final class DOMPGPData extends DOMStructure implements PGPData {
         if (keyPacket == null) {
             throw new NullPointerException("keyPacket cannot be null");
         }
-        if (other == null || other.isEmpty()) {
-            this.externalElements = Collections.emptyList();
-        } else {
-            this.externalElements =
-                Collections.unmodifiableList(new ArrayList<XMLStructure>(other));
-            for (int i = 0, size = this.externalElements.size(); i < size; i++) {
-                if (!(this.externalElements.get(i) instanceof XMLStructure)) {
-                    throw new ClassCastException
-                        ("other["+i+"] is not a valid PGPData type");
-                }
-            }
+        List<XMLStructure> tempList =
+            Collections.checkedList(new ArrayList<XMLStructure>(),
+                                    XMLStructure.class);
+        if (other != null) {
+            tempList.addAll(other);
         }
+        this.externalElements = Collections.unmodifiableList(tempList);
         this.keyPacket = keyPacket.clone();
         checkKeyPacket(keyPacket);
         this.keyId = null;
@@ -120,18 +115,13 @@ public final class DOMPGPData extends DOMStructure implements PGPData {
         if (keyId.length != 8) {
             throw new IllegalArgumentException("keyId must be 8 bytes long");
         }
-        if (other == null || other.isEmpty()) {
-            this.externalElements = Collections.emptyList();
-        } else {
-            this.externalElements =
-                Collections.unmodifiableList(new ArrayList<XMLStructure>(other));
-            for (int i = 0, size = this.externalElements.size(); i < size; i++) {
-                if (!(this.externalElements.get(i) instanceof XMLStructure)) {
-                    throw new ClassCastException
-                        ("other["+i+"] is not a valid PGPData type");
-                }
-            }
+        List<XMLStructure> tempList =
+            Collections.checkedList(new ArrayList<XMLStructure>(),
+                                    XMLStructure.class);
+        if (other != null) {
+            tempList.addAll(other);
         }
+        this.externalElements = Collections.unmodifiableList(tempList);
         this.keyId = keyId.clone();
         this.keyPacket = keyPacket == null ? null
                                            : keyPacket.clone();
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java
index d29782065fe..2cc0f993db5 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMReference.java
@@ -147,29 +147,21 @@ public final class DOMReference extends DOMStructure
         if (dm == null) {
             throw new NullPointerException("DigestMethod must be non-null");
         }
-        if (appliedTransforms == null) {
-            this.allTransforms = new ArrayList<Transform>();
-        } else {
-            this.allTransforms = new ArrayList<Transform>(appliedTransforms);
-            for (int i = 0, size = this.allTransforms.size(); i < size; i++) {
-                if (!(this.allTransforms.get(i) instanceof Transform)) {
-                    throw new ClassCastException
-                        ("appliedTransforms["+i+"] is not a valid type");
-                }
-            }
+        List<Transform> tempList =
+            Collections.checkedList(new ArrayList<Transform>(),
+                                    Transform.class);
+        if (appliedTransforms != null) {
+            tempList.addAll(appliedTransforms);
         }
-        if (transforms == null) {
-            this.transforms = Collections.emptyList();
-        } else {
-            this.transforms = new ArrayList<Transform>(transforms);
-            for (int i = 0, size = this.transforms.size(); i < size; i++) {
-                if (!(this.transforms.get(i) instanceof Transform)) {
-                    throw new ClassCastException
-                        ("transforms["+i+"] is not a valid type");
-                }
-            }
-            this.allTransforms.addAll(this.transforms);
+        List<Transform> tempList2 =
+            Collections.checkedList(new ArrayList<Transform>(),
+                                    Transform.class);
+        if (transforms != null) {
+            tempList.addAll(transforms);
+            tempList2.addAll(transforms);
         }
+        this.allTransforms = Collections.unmodifiableList(tempList);
+        this.transforms = tempList2;
         this.digestMethod = dm;
         this.uri = uri;
         if ((uri != null) && (!uri.equals(""))) {
@@ -642,7 +634,7 @@ public final class DOMReference extends DOMStructure
             if (xsi.isNodeSet()) {
                 try {
                     final Set<Node> s = xsi.getNodeSet();
-                    return new NodeSetData() {
+                    return new NodeSetData<Node>() {
                         public Iterator<Node> iterator() { return s.iterator(); }
                     };
                 } catch (Exception e) {
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java
index ca5e5a5b997..eed6fffe5a5 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMRetrievalMethod.java
@@ -90,18 +90,13 @@ public final class DOMRetrievalMethod extends DOMStructure
         if (uri == null) {
             throw new NullPointerException("uri cannot be null");
         }
-        if (transforms == null || transforms.isEmpty()) {
-            this.transforms = Collections.emptyList();
-        } else {
-            this.transforms = Collections.unmodifiableList(
-                new ArrayList<Transform>(transforms));
-            for (int i = 0, size = this.transforms.size(); i < size; i++) {
-                if (!(this.transforms.get(i) instanceof Transform)) {
-                    throw new ClassCastException
-                        ("transforms["+i+"] is not a valid type");
-                }
-            }
+        List<Transform> tempList =
+            Collections.checkedList(new ArrayList<Transform>(),
+                                    Transform.class);
+        if (transforms != null) {
+            tempList.addAll(transforms);
         }
+        this.transforms = Collections.unmodifiableList(tempList);
         this.uri = uri;
         if (!uri.equals("")) {
             try {
@@ -244,7 +239,7 @@ public final class DOMRetrievalMethod extends DOMStructure
 
         // guard against RetrievalMethod loops
         if ((data instanceof NodeSetData) && Utils.secureValidation(context)) {
-            NodeSetData nsd = (NodeSetData)data;
+            NodeSetData<?> nsd = (NodeSetData<?>)data;
             Iterator<?> i = nsd.iterator();
             if (i.hasNext()) {
                 Node root = (Node)i.next();
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
index 26389e9b7ae..0923eb41c40 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperties.java
@@ -69,18 +69,15 @@ public final class DOMSignatureProperties extends DOMStructure
     {
         if (properties == null) {
             throw new NullPointerException("properties cannot be null");
-        } else if (properties.isEmpty()) {
-            throw new IllegalArgumentException("properties cannot be empty");
-        } else {
-            this.properties = Collections.unmodifiableList(
-                new ArrayList<SignatureProperty>(properties));
-            for (int i = 0, size = this.properties.size(); i < size; i++) {
-                if (!(this.properties.get(i) instanceof SignatureProperty)) {
-                    throw new ClassCastException
-                        ("properties["+i+"] is not a valid type");
-                }
-            }
         }
+        List<SignatureProperty> tempList =
+            Collections.checkedList(new ArrayList<SignatureProperty>(),
+                                    SignatureProperty.class);
+        tempList.addAll(properties);
+        if (tempList.isEmpty()) {
+            throw new IllegalArgumentException("properties cannot be empty");
+        }
+        this.properties = Collections.unmodifiableList(tempList);
         this.id = id;
     }
 
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
index 11d2e679ebf..2b43dffda92 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignatureProperty.java
@@ -71,20 +71,18 @@ public final class DOMSignatureProperty extends DOMStructure
     {
         if (target == null) {
             throw new NullPointerException("target cannot be null");
-        } else if (content == null) {
-            throw new NullPointerException("content cannot be null");
-        } else if (content.isEmpty()) {
-            throw new IllegalArgumentException("content cannot be empty");
-        } else {
-            this.content = Collections.unmodifiableList(
-                new ArrayList<XMLStructure>(content));
-            for (int i = 0, size = this.content.size(); i < size; i++) {
-                if (!(this.content.get(i) instanceof XMLStructure)) {
-                    throw new ClassCastException
-                        ("content["+i+"] is not a valid type");
-                }
-            }
         }
+        if (content == null) {
+            throw new NullPointerException("content cannot be null");
+        }
+        List<XMLStructure> tempList =
+            Collections.checkedList(new ArrayList<XMLStructure>(),
+                                    XMLStructure.class);
+        tempList.addAll(content);
+        if (tempList.isEmpty()) {
+            throw new IllegalArgumentException("content cannot be empty");
+        }
+        this.content = Collections.unmodifiableList(tempList);
         this.target = target;
         this.id = id;
     }
@@ -169,7 +167,6 @@ public final class DOMSignatureProperty extends DOMStructure
         boolean idsEqual = (id == null ? osp.getId() == null
                                        : id.equals(osp.getId()));
 
-        @SuppressWarnings("unchecked")
         List<XMLStructure> ospContent = osp.getContent();
         return (equalsContent(ospContent) &&
                 target.equals(osp.getTarget()) && idsEqual);
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
index 71a13c3605c..c18a462fba7 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSignedInfo.java
@@ -100,19 +100,14 @@ public final class DOMSignedInfo extends DOMStructure implements SignedInfo {
         }
         this.canonicalizationMethod = cm;
         this.signatureMethod = sm;
-        this.references = Collections.unmodifiableList(
-            new ArrayList<Reference>(references));
-        if (this.references.isEmpty()) {
-            throw new IllegalArgumentException("list of references must " +
-                "contain at least one entry");
-        }
-        for (int i = 0, size = this.references.size(); i < size; i++) {
-            Object obj = this.references.get(i);
-            if (!(obj instanceof Reference)) {
-                throw new ClassCastException("list of references contains " +
-                    "an illegal type");
-            }
+        List<Reference> tempList =
+            Collections.checkedList(new ArrayList<Reference>(),
+                                    Reference.class);
+        tempList.addAll(references);
+        if (tempList.isEmpty()) {
+            throw new IllegalArgumentException("references cannot be empty");
         }
+        this.references = Collections.unmodifiableList(tempList);
     }
 
     /**
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java
index c0ac945b893..6c43f5f6c7e 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMSubTreeData.java
@@ -44,7 +44,7 @@ import org.w3c.dom.Node;
  * directly on the subdocument and there is no need to convert it
  * first to an XPath node-set.
  */
-public class DOMSubTreeData implements NodeSetData {
+public class DOMSubTreeData implements NodeSetData<Node> {
 
     private boolean excludeComments;
     private Node root;
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java
index 4d4a647642e..964d0d238b4 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMUtils.java
@@ -367,9 +367,7 @@ public class DOMUtils {
     private static boolean paramsEqual(XPathFilter2ParameterSpec spec1,
                                        XPathFilter2ParameterSpec spec2)
     {
-        @SuppressWarnings("unchecked")
         List<XPathType> types = spec1.getXPathList();
-        @SuppressWarnings("unchecked")
         List<XPathType> otypes = spec2.getXPathList();
         int size = types.size();
         if (size != otypes.size()) {
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java
index 72740c709bc..7c27607e236 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMX509Data.java
@@ -135,7 +135,7 @@ public final class DOMX509Data extends DOMStructure implements X509Data {
         this.content = Collections.unmodifiableList(content);
     }
 
-    public List<Object> getContent() {
+    public List<?> getContent() {
         return content;
     }
 
@@ -265,7 +265,7 @@ public final class DOMX509Data extends DOMStructure implements X509Data {
         }
         X509Data oxd = (X509Data)o;
 
-        @SuppressWarnings("unchecked") List<Object> ocontent = oxd.getContent();
+        List<?> ocontent = oxd.getContent();
         int size = content.size();
         if (size != ocontent.size()) {
             return false;
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
index 7abd1e63523..6ce2c4ac736 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLObject.java
@@ -70,18 +70,13 @@ public final class DOMXMLObject extends DOMStructure implements XMLObject {
     public DOMXMLObject(List<? extends XMLStructure> content, String id,
                         String mimeType, String encoding)
     {
-        if (content == null || content.isEmpty()) {
-            this.content = Collections.emptyList();
-        } else {
-            this.content = Collections.unmodifiableList(
-                new ArrayList<XMLStructure>(content));
-            for (int i = 0, size = this.content.size(); i < size; i++) {
-                if (!(this.content.get(i) instanceof XMLStructure)) {
-                    throw new ClassCastException
-                        ("content["+i+"] is not a valid type");
-                }
-            }
+        List<XMLStructure> tempList =
+            Collections.checkedList(new ArrayList<XMLStructure>(),
+                                    XMLStructure.class);
+        if (content != null) {
+            tempList.addAll(content);
         }
+        this.content = Collections.unmodifiableList(tempList);
         this.id = id;
         this.mimeType = mimeType;
         this.encoding = encoding;
@@ -204,7 +199,6 @@ public final class DOMXMLObject extends DOMStructure implements XMLObject {
             (mimeType == null ? oxo.getMimeType() == null
                               : mimeType.equals(oxo.getMimeType()));
 
-        @SuppressWarnings("unchecked")
         List<XMLStructure> oxoContent = oxo.getContent();
         return (idsEqual && encodingsEqual && mimeTypesEqual &&
                 equalsContent(oxoContent));
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
index c4478932ff1..f0a614a9714 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignature.java
@@ -109,18 +109,13 @@ public final class DOMXMLSignature extends DOMStructure
         this.si = si;
         this.id = id;
         this.sv = new DOMSignatureValue(signatureValueId);
-        if (objs == null) {
-            this.objects = Collections.emptyList();
-        } else {
-            this.objects =
-                Collections.unmodifiableList(new ArrayList<XMLObject>(objs));
-            for (int i = 0, size = this.objects.size(); i < size; i++) {
-                if (!(this.objects.get(i) instanceof XMLObject)) {
-                    throw new ClassCastException
-                        ("objs["+i+"] is not an XMLObject");
-                }
-            }
+        List<XMLObject> tempList =
+            Collections.checkedList(new ArrayList<XMLObject>(),
+                                    XMLObject.class);
+        if (objs != null) {
+            tempList.addAll(objs);
         }
+        this.objects = Collections.unmodifiableList(tempList);
         this.ki = ki;
     }
 
@@ -270,7 +265,6 @@ public final class DOMXMLSignature extends DOMStructure
         }
 
         // validate all References
-        @SuppressWarnings("unchecked")
         List<Reference> refs = this.si.getReferences();
         boolean validateRefs = true;
         for (int i = 0, size = refs.size(); validateRefs && i < size; i++) {
@@ -297,7 +291,6 @@ public final class DOMXMLSignature extends DOMStructure
         {
             for (int i=0, size=objects.size(); validateMans && i < size; i++) {
                 XMLObject xo = objects.get(i);
-                @SuppressWarnings("unchecked")
                 List<XMLStructure> content = xo.getContent();
                 int csize = content.size();
                 for (int j = 0; validateMans && j < csize; j++) {
@@ -307,7 +300,6 @@ public final class DOMXMLSignature extends DOMStructure
                             log.log(java.util.logging.Level.FINE, "validating manifest");
                         }
                         Manifest man = (Manifest)xs;
-                        @SuppressWarnings("unchecked")
                         List<Reference> manRefs = man.getReferences();
                         int rsize = manRefs.size();
                         for (int k = 0; validateMans && k < rsize; k++) {
@@ -348,20 +340,17 @@ public final class DOMXMLSignature extends DOMStructure
         signatureIdMap = new HashMap<String, XMLStructure>();
         signatureIdMap.put(id, this);
         signatureIdMap.put(si.getId(), si);
-        @SuppressWarnings("unchecked")
         List<Reference> refs = si.getReferences();
         for (Reference ref : refs) {
             signatureIdMap.put(ref.getId(), ref);
         }
         for (XMLObject obj : objects) {
             signatureIdMap.put(obj.getId(), obj);
-            @SuppressWarnings("unchecked")
             List<XMLStructure> content = obj.getContent();
             for (XMLStructure xs : content) {
                 if (xs instanceof Manifest) {
                     Manifest man = (Manifest)xs;
                     signatureIdMap.put(man.getId(), man);
-                    @SuppressWarnings("unchecked")
                     List<Reference> manRefs = man.getReferences();
                     for (Reference ref : manRefs) {
                         allReferences.add(ref);
@@ -483,7 +472,6 @@ public final class DOMXMLSignature extends DOMStructure
             // reference dependencies in the XPath Transform - so be on
             // the safe side, and skip and do at end in the final sweep
             if (uri.length() == 0) {
-                @SuppressWarnings("unchecked")
                 List<Transform> transforms = ref.getTransforms();
                 for (Transform transform : transforms) {
                     String transformAlg = transform.getAlgorithm();
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java
index 0e63028c777..13e6221dd0f 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXMLSignatureFactory.java
@@ -58,9 +58,8 @@ public final class DOMXMLSignatureFactory extends XMLSignatureFactory {
         return new DOMXMLSignature(si, ki, null, null, null);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
     public XMLSignature newXMLSignature(SignedInfo si, KeyInfo ki,
-        List objects, String id, String signatureValueId) {
+        List<? extends XMLObject> objects, String id, String signatureValueId) {
         return new DOMXMLSignature(si, ki, objects, id, signatureValueId);
     }
 
@@ -68,16 +67,14 @@ public final class DOMXMLSignatureFactory extends XMLSignatureFactory {
         return newReference(uri, dm, null, null, null);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public Reference newReference(String uri, DigestMethod dm, List transforms,
-        String type, String id) {
+    public Reference newReference(String uri, DigestMethod dm,
+        List<? extends Transform> transforms, String type, String id) {
         return new DOMReference(uri, type, dm, transforms, id, getProvider());
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
     public Reference newReference(String uri, DigestMethod dm,
-        List appliedTransforms, Data result, List transforms, String type,
-        String id) {
+        List<? extends Transform> appliedTransforms, Data result,
+        List<? extends Transform> transforms, String type, String id) {
         if (appliedTransforms == null) {
             throw new NullPointerException("appliedTransforms cannot be null");
         }
@@ -91,9 +88,9 @@ public final class DOMXMLSignatureFactory extends XMLSignatureFactory {
             (uri, type, dm, appliedTransforms, result, transforms, id, getProvider());
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public Reference newReference(String uri, DigestMethod dm, List transforms,
-        String type, String id, byte[] digestValue) {
+    public Reference newReference(String uri, DigestMethod dm,
+        List<? extends Transform> transforms, String type, String id,
+        byte[] digestValue) {
         if (digestValue == null) {
             throw new NullPointerException("digestValue cannot be null");
         }
@@ -101,43 +98,38 @@ public final class DOMXMLSignatureFactory extends XMLSignatureFactory {
             (uri, type, dm, null, null, transforms, id, digestValue, getProvider());
     }
 
-    @SuppressWarnings("rawtypes")
     public SignedInfo newSignedInfo(CanonicalizationMethod cm,
-        SignatureMethod sm, List references) {
+        SignatureMethod sm, List<? extends Reference> references) {
         return newSignedInfo(cm, sm, references, null);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
     public SignedInfo newSignedInfo(CanonicalizationMethod cm,
-        SignatureMethod sm, List references, String id) {
+        SignatureMethod sm, List<? extends Reference> references, String id) {
         return new DOMSignedInfo(cm, sm, references, id);
     }
 
     // Object factory methods
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public XMLObject newXMLObject(List content, String id, String mimeType,
-        String encoding) {
+    public XMLObject newXMLObject(List<? extends XMLStructure> content,
+        String id, String mimeType, String encoding) {
         return new DOMXMLObject(content, id, mimeType, encoding);
     }
 
-    @SuppressWarnings("rawtypes")
-    public Manifest newManifest(List references) {
+    public Manifest newManifest(List<? extends Reference> references) {
         return newManifest(references, null);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public Manifest newManifest(List references, String id) {
+    public Manifest newManifest(List<? extends Reference> references,
+        String id) {
         return new DOMManifest(references, id);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    public SignatureProperties newSignatureProperties(List props, String id) {
+    public SignatureProperties newSignatureProperties(
+        List<? extends SignatureProperty> props, String id) {
         return new DOMSignatureProperties(props, id);
     }
 
-    @SuppressWarnings({ "unchecked", "rawtypes" })
     public SignatureProperty newSignatureProperty
-        (List info, String target, String id) {
+        (List<? extends XMLStructure> info, String target, String id) {
         return new DOMSignatureProperty(info, target, id);
     }
 
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java
index 0215029b489..0fc63f35526 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathFilter2Transform.java
@@ -133,7 +133,6 @@ public final class DOMXPathFilter2Transform extends ApacheTransform {
         String prefix = DOMUtils.getNSPrefix(context, Transform.XPATH2);
         String qname = (prefix == null || prefix.length() == 0)
                        ? "xmlns" : "xmlns:" + prefix;
-        @SuppressWarnings("unchecked")
         List<XPathType> xpathList = xp.getXPathList();
         for (XPathType xpathType : xpathList) {
             Element elem = DOMUtils.createElement(ownerDoc, "XPath",
@@ -146,7 +145,6 @@ public final class DOMXPathFilter2Transform extends ApacheTransform {
                                 Transform.XPATH2);
 
             // add namespace attributes, if necessary
-            @SuppressWarnings("unchecked")
             Set<Map.Entry<String, String>> entries =
                 xpathType.getNamespaceMap().entrySet();
             for (Map.Entry<String, String> entry : entries) {
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java
index e88eeb8606a..d22922bcfb3 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/DOMXPathTransform.java
@@ -99,7 +99,6 @@ public final class DOMXPathTransform extends ApacheTransform {
         xpathElem.appendChild(ownerDoc.createTextNode(xp.getXPath()));
 
         // add namespace attributes, if necessary
-        @SuppressWarnings("unchecked")
         Set<Map.Entry<String, String>> entries =
             xp.getNamespaceMap().entrySet();
         for (Map.Entry<String, String> entry : entries) {
diff --git a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java
index dd59caef60e..6aca319fb2c 100644
--- a/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java
+++ b/jdk/src/java.xml.crypto/share/classes/org/jcp/xml/dsig/internal/dom/Utils.java
@@ -70,10 +70,10 @@ public final class Utils {
      * @param i the Iterator
      * @return the Set of Nodes
      */
-    static Set<Node> toNodeSet(Iterator<Node> i) {
+    static Set<Node> toNodeSet(Iterator<?> i) {
         Set<Node> nodeSet = new HashSet<Node>();
         while (i.hasNext()) {
-            Node n = i.next();
+            Node n = (Node)i.next();
             nodeSet.add(n);
             // insert attributes nodes to comply with XPath
             if (n.getNodeType() == Node.ELEMENT_NODE) {
diff --git a/jdk/test/javax/xml/crypto/dsig/GenerationTests.java b/jdk/test/javax/xml/crypto/dsig/GenerationTests.java
index 6cc7bbb6865..29261e2f17e 100644
--- a/jdk/test/javax/xml/crypto/dsig/GenerationTests.java
+++ b/jdk/test/javax/xml/crypto/dsig/GenerationTests.java
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349
+ * @bug 4635230 6283345 6303830 6824440 6867348 7094155 8038184 8038349 8046949
  * @summary Basic unit tests for generating XML Signatures with JSR 105
  * @compile -XDignore.symbol.file KeySelectors.java SignatureValidator.java
  *     X509KeySelector.java GenerationTests.java
@@ -377,7 +377,7 @@ public class GenerationTests {
 
     static void test_create_signature_x509_crt_crl() throws Exception {
         System.out.println("* Generating signature-x509-crt-crl.xml");
-        List<Object> xds = new ArrayList<Object>();
+        List<Object> xds = new ArrayList<>();
         CertificateFactory cf = CertificateFactory.getInstance("X.509");
         xds.add(signingCert);
         FileInputStream fis = new FileInputStream(CRL);
@@ -444,7 +444,7 @@ public class GenerationTests {
         SignedInfo si = fac.newSignedInfo(withoutComments, rsaSha1, refs);
 
         // create objects
-        List<XMLStructure> objs = new ArrayList<XMLStructure>();
+        List<XMLObject> objs = new ArrayList<>();
 
         // Object 1
         List<Reference> manRefs = Collections.singletonList
@@ -559,7 +559,7 @@ public class GenerationTests {
         System.out.println("* Generating signature.xml");
 
         // create references
-        List<Reference> refs = new ArrayList<Reference>();
+        List<Reference> refs = new ArrayList<>();
 
         // Reference 1
         refs.add(fac.newReference(STYLESHEET, sha1));
@@ -610,7 +610,7 @@ public class GenerationTests {
             SignatureProperties.TYPE, null));
 
         // Reference 8
-        List<Transform> transforms = new ArrayList<Transform>();
+        List<Transform> transforms = new ArrayList<>();
         transforms.add(fac.newTransform
             (Transform.ENVELOPED, (TransformParameterSpec) null));
         refs.add(fac.newReference("", sha1, transforms, null, null));
@@ -685,7 +685,7 @@ public class GenerationTests {
         Document doc = db.newDocument();
 
         // create objects
-        List<XMLStructure> objs = new ArrayList<XMLStructure>();
+        List<XMLObject> objs = new ArrayList<>();
 
         // Object 1
         objs.add(fac.newXMLObject(Collections.singletonList
@@ -705,7 +705,7 @@ public class GenerationTests {
             (new DOMStructure(nc)), "object-3", null, null));
 
         // Manifest
-        List<Reference> manRefs = new ArrayList<Reference>();
+        List<Reference> manRefs = new ArrayList<>();
 
         // Manifest Reference 1
         manRefs.add(fac.newReference(STYLESHEET,
@@ -715,7 +715,7 @@ public class GenerationTests {
         manRefs.add(fac.newReference("#reference-1", sha1));
 
         // Manifest Reference 3
-        List<Transform> manTrans = new ArrayList<Transform>();
+        List<Transform> manTrans = new ArrayList<>();
         String xslt = ""
           + "<xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform'\n"
           + "            xmlns='http://www.w3.org/TR/xhtml1/strict' \n"
@@ -770,7 +770,7 @@ public class GenerationTests {
             null, null));
 
         // Object 4
-        List<Object> xds = new ArrayList<Object>();
+        List<Object> xds = new ArrayList<>();
         xds.add("CN=User");
         xds.add(kifac.newX509IssuerSerial
             ("CN=User", new BigInteger("45ef2729", 16)));
@@ -930,7 +930,7 @@ public class GenerationTests {
 
     static void test_create_exc_signature() throws Exception {
         System.out.println("* Generating exc_signature.xml");
-        List<Reference> refs = new ArrayList<Reference>(4);
+        List<Reference> refs = new ArrayList<>(4);
 
         // create reference 1
         refs.add(fac.newReference
@@ -942,7 +942,7 @@ public class GenerationTests {
              null, null));
 
         // create reference 2
-        List<String> prefixList = new ArrayList<String>(2);
+        List<String> prefixList = new ArrayList<>(2);
         prefixList.add("bar");
         prefixList.add("#default");
         ExcC14NParameterSpec params = new ExcC14NParameterSpec(prefixList);
@@ -963,7 +963,7 @@ public class GenerationTests {
              null, null));
 
         // create reference 4
-        prefixList = new ArrayList<String>(2);
+        prefixList = new ArrayList<>(2);
         prefixList.add("bar");
         prefixList.add("#default");
         params = new ExcC14NParameterSpec(prefixList);
@@ -982,7 +982,7 @@ public class GenerationTests {
             fac.newSignatureMethod(SignatureMethod.DSA_SHA1, null), refs);
 
         // create KeyInfo
-        List<XMLStructure> kits = new ArrayList<XMLStructure>(2);
+        List<XMLStructure> kits = new ArrayList<>(2);
         kits.add(kifac.newKeyValue(validatingKey));
         KeyInfo ki = kifac.newKeyInfo(kits);
 
@@ -1027,10 +1027,10 @@ public class GenerationTests {
 
     static void test_create_sign_spec() throws Exception {
         System.out.println("* Generating sign-spec.xml");
-        List<Reference> refs = new ArrayList<Reference>(2);
+        List<Reference> refs = new ArrayList<>(2);
 
         // create reference 1
-        List<XPathType> types = new ArrayList<XPathType>(3);
+        List<XPathType> types = new ArrayList<>(3);
         types.add(new XPathType(" //ToBeSigned ", XPathType.Filter.INTERSECT));
         types.add(new XPathType(" //NotToBeSigned ",
             XPathType.Filter.SUBTRACT));
@@ -1043,7 +1043,7 @@ public class GenerationTests {
              null, null));
 
         // create reference 2
-        List<Transform> trans2 = new ArrayList<Transform>(2);
+        List<Transform> trans2 = new ArrayList<>(2);
         trans2.add(fac.newTransform(Transform.ENVELOPED,
             (TransformParameterSpec) null));
         XPathFilter2ParameterSpec xp2 = new XPathFilter2ParameterSpec
@@ -1061,9 +1061,9 @@ public class GenerationTests {
             fac.newSignatureMethod(SignatureMethod.DSA_SHA1, null), refs);
 
         // create KeyInfo
-        List<XMLStructure> kits = new ArrayList<XMLStructure>(2);
+        List<XMLStructure> kits = new ArrayList<>(2);
         kits.add(kifac.newKeyValue(validatingKey));
-        List<Object> xds = new ArrayList<Object>(2);
+        List<Object> xds = new ArrayList<>(2);
         xds.add("CN=User");
         xds.add(signingCert);
         kits.add(kifac.newX509Data(xds));
diff --git a/jdk/test/javax/xml/crypto/dsig/KeySelectors.java b/jdk/test/javax/xml/crypto/dsig/KeySelectors.java
index 290c55b89da..b8f4d324893 100644
--- a/jdk/test/javax/xml/crypto/dsig/KeySelectors.java
+++ b/jdk/test/javax/xml/crypto/dsig/KeySelectors.java
@@ -101,9 +101,7 @@ class KeySelectors {
                 throw new KeySelectorException("Null KeyInfo object!");
             }
             // search for X509Data in keyinfo
-            Iterator iter = keyInfo.getContent().iterator();
-            while (iter.hasNext()) {
-                XMLStructure kiType = (XMLStructure) iter.next();
+            for (XMLStructure kiType : keyInfo.getContent()) {
                 if (kiType instanceof X509Data) {
                     X509Data xd = (X509Data) kiType;
                     Object[] entries = xd.getContent().toArray();
@@ -114,10 +112,8 @@ class KeySelectors {
                             crl = (X509CRL) entries[i];
                         }
                     }
-                    Iterator xi = xd.getContent().iterator();
                     boolean hasCRL = false;
-                    while (xi.hasNext()) {
-                        Object o = xi.next();
+                    for (Object o : xd.getContent()) {
                         // skip non-X509Certificate entries
                         if (o instanceof X509Certificate) {
                             if ((purpose != KeySelector.Purpose.VERIFY) &&
@@ -152,10 +148,8 @@ class KeySelectors {
                 throw new KeySelectorException("Null KeyInfo object!");
             }
             SignatureMethod sm = (SignatureMethod) method;
-            List list = keyInfo.getContent();
 
-            for (int i = 0; i < list.size(); i++) {
-                XMLStructure xmlStructure = (XMLStructure) list.get(i);
+            for (XMLStructure xmlStructure : keyInfo.getContent()) {
                 if (xmlStructure instanceof KeyValue) {
                     PublicKey pk = null;
                     try {
@@ -282,9 +276,7 @@ class KeySelectors {
             if (keyInfo == null) {
                 throw new KeySelectorException("Null KeyInfo object!");
             }
-            Iterator iter = keyInfo.getContent().iterator();
-            while (iter.hasNext()) {
-                XMLStructure xmlStructure = (XMLStructure) iter.next();
+            for (XMLStructure xmlStructure : keyInfo.getContent()) {
                 try {
                     if (xmlStructure instanceof KeyName) {
                         String name = ((KeyName)xmlStructure).getName();
@@ -330,14 +322,12 @@ class KeySelectors {
                         }
                     } else if (xmlStructure instanceof X509Data) {
                         List content = ((X509Data)xmlStructure).getContent();
-                        int size = content.size();
                         Vector<X509Certificate> result = null;
                         // Lookup the public key using the information
                         // specified in X509Data element, i.e. searching
                         // over the collection of certificate files under
                         // "certs" subdirectory and return those match.
-                        for (int k = 0; k<size; k++) {
-                            Object obj = content.get(k);
+                        for (Object obj : content) {
                             if (obj instanceof String) {
                                 result = match(MATCH_SUBJECT, obj, certs);
                             } else if (obj instanceof byte[]) {
diff --git a/jdk/test/javax/xml/crypto/dsig/SignatureValidator.java b/jdk/test/javax/xml/crypto/dsig/SignatureValidator.java
index 08e2fd9b5fa..a761d372aa0 100644
--- a/jdk/test/javax/xml/crypto/dsig/SignatureValidator.java
+++ b/jdk/test/javax/xml/crypto/dsig/SignatureValidator.java
@@ -78,9 +78,10 @@ class SignatureValidator {
 
         // Check reference cache
         if (cache) {
-            Iterator i = signature.getSignedInfo().getReferences().iterator();
-            for (int j=0; i.hasNext(); j++) {
-                Reference ref = (Reference) i.next();
+            Iterator<Reference> i =
+                signature.getSignedInfo().getReferences().iterator();
+            for (int j = 0; i.hasNext(); j++) {
+                Reference ref = i.next();
                 if (!digestInputEqual(ref)) {
                     throw new Exception
                         ("cached data for Reference[" + j + "] is not correct");
@@ -88,10 +89,10 @@ class SignatureValidator {
                 // check that dereferenced data does not contain comment nodes
                 if (ref.getURI() == "") {
                     System.out.println("checking deref data");
-                    NodeSetData data = (NodeSetData) ref.getDereferencedData();
-                    Iterator ni = data.iterator();
-                    while (ni.hasNext()) {
-                        Node n = (Node) ni.next();
+                    @SuppressWarnings("unchecked")
+                    NodeSetData<Node> data =
+                        (NodeSetData<Node>)ref.getDereferencedData();
+                    for (Node n : data) {
                         if (n.getNodeType() == Node.COMMENT_NODE) {
                             throw new Exception("dereferenced data for " +
                                 " Reference[" + j + " contains comment node");
diff --git a/jdk/test/javax/xml/crypto/dsig/X509KeySelector.java b/jdk/test/javax/xml/crypto/dsig/X509KeySelector.java
index a21e42910b4..9e3081379c0 100644
--- a/jdk/test/javax/xml/crypto/dsig/X509KeySelector.java
+++ b/jdk/test/javax/xml/crypto/dsig/X509KeySelector.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -139,9 +139,7 @@ class X509KeySelector extends KeySelector {
             }
 
             // Iterate through KeyInfo types
-            Iterator i = keyInfo.getContent().iterator();
-            while (i.hasNext()) {
-                XMLStructure kiType = (XMLStructure) i.next();
+            for (XMLStructure kiType : keyInfo.getContent()) {
                 // check X509Data
                 if (kiType instanceof X509Data) {
                     X509Data xd = (X509Data) kiType;
@@ -303,9 +301,7 @@ class X509KeySelector extends KeySelector {
         }
         Collection<X509Certificate> certs = new ArrayList<>();
 
-        Iterator xi = xd.getContent().iterator();
-        while (xi.hasNext()) {
-            Object o = xi.next();
+        for (Object o : xd.getContent()) {
             // check X509IssuerSerial
             if (o instanceof X509IssuerSerial) {
                 X509IssuerSerial xis = (X509IssuerSerial) o;

From c6db8bd7c761bc0a6d0b3ad25bd8fffa149b0418 Mon Sep 17 00:00:00 2001
From: Olivier Lagneau <olivier.lagneau@oracle.com>
Date: Fri, 21 Nov 2014 19:31:37 +0100
Subject: [PATCH 137/299] 8062037: java/lang/instrument/RetransformBigClass.sh
 should be quarantined

Add RedefineBigClass.sh and RetransformBigClss.sh in ProblemList.txt

Reviewed-by: dcubed, sspitsyn
---
 jdk/test/ProblemList.txt | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index 449db57f61f..03c2bdc7453 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -127,6 +127,10 @@
 # 8058536
 java/lang/instrument/NativeMethodPrefixAgent.java               generic-all
 
+# 8061177
+java/lang/instrument/RedefineBigClass.sh                        generic-all
+java/lang/instrument/RetransformBigClass.sh                     generic-all
+
 ############################################################################
 
 # jdk_management

From bdf693fcc5740e3dacee5b8bea8d16bb43d5d6a9 Mon Sep 17 00:00:00 2001
From: Jonathan Gibbons <jjg@openjdk.org>
Date: Fri, 21 Nov 2014 10:38:43 -0800
Subject: [PATCH 138/299] 8061876: replace java.io.File with java.nio.file.Path
 (again)

Reviewed-by: ksrini, jlahoda
---
 .../sun/tools/javac/file/BaseFileObject.java  |  13 +-
 .../com/sun/tools/javac/file/CacheFSInfo.java |  22 +-
 .../com/sun/tools/javac/file/FSInfo.java      |  34 +--
 .../tools/javac/file/JavacFileManager.java    | 203 ++++++++++++------
 .../com/sun/tools/javac/file/Locations.java   | 191 ++++++++--------
 .../tools/javac/file/RegularFileObject.java   |  87 ++++----
 .../sun/tools/javac/file/RelativePath.java    |  21 +-
 .../sun/tools/javac/file/SymbolArchive.java   |  11 +-
 .../com/sun/tools/javac/file/ZipArchive.java  |  23 +-
 .../sun/tools/javac/file/ZipFileIndex.java    |  57 ++---
 .../tools/javac/file/ZipFileIndexArchive.java |  20 +-
 .../tools/javac/file/ZipFileIndexCache.java   |  23 +-
 .../com/sun/tools/javac/jvm/ClassReader.java  |  14 +-
 .../com/sun/tools/javac/main/Main.java        |   4 +-
 .../tools/javac/nio/JavacPathFileManager.java |  21 +-
 .../util/AbstractDiagnosticFormatter.java     |   6 +-
 .../javac/util/RichDiagnosticFormatter.java   |   5 +-
 .../classes/com/sun/tools/javah/Gen.java      |   9 +-
 .../com/sun/tools/javah/JavahTask.java        |   9 +-
 .../com/sun/tools/javap/JavapTask.java        |  33 +--
 .../com/sun/tools/sjavac/JavacState.java      |  15 +-
 .../tools/sjavac/comp/SmartFileObject.java    |   4 +-
 langtools/test/tools/javac/T6725036.java      |   4 +-
 .../tools/javac/api/6440528/T6440528.java     |   7 +-
 .../test/tools/javac/api/TestJavacTask.java   |   5 +-
 langtools/test/tools/javac/diags/Example.java |  83 +++++++
 .../tools/javac/diags/README.examples.txt     |   3 +
 .../ProcUnclosedTypeFiles.java                |   3 +-
 langtools/test/tools/javac/file/T7018098.java |   4 +-
 langtools/test/tools/javac/file/T7068437.java |   5 +-
 langtools/test/tools/javac/file/T7068451.java |   3 +-
 .../test/tools/javac/links/LinksTest.java     |  24 ++-
 .../Processor.java                            |   4 +-
 .../Processor.java                            |   6 +-
 .../javac/unicode/SupplementaryJavaID6.java   |   5 +-
 .../test/tools/javac/unicode/Wrapper.java     |  78 +++++++
 .../suppress/VerifySuppressWarnings.java      |   2 +-
 .../test/tools/javap/WhitespaceTest.java      |   2 +-
 38 files changed, 678 insertions(+), 385 deletions(-)
 create mode 100644 langtools/test/tools/javac/unicode/Wrapper.java

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileObject.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileObject.java
index a0b391eb8fc..a14881b74fe 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileObject.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/BaseFileObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,20 +25,19 @@
 
 package com.sun.tools.javac.file;
 
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Reader;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.nio.charset.CharsetDecoder;
+import java.nio.file.Path;
+
 import javax.lang.model.element.Modifier;
 import javax.lang.model.element.NestingKind;
 import javax.tools.FileObject;
 import javax.tools.JavaFileObject;
 
-import static javax.tools.JavaFileObject.Kind.*;
-
 import com.sun.tools.javac.util.BaseFileManager;
 import com.sun.tools.javac.util.DefinedBy;
 import com.sun.tools.javac.util.DefinedBy.Api;
@@ -78,7 +77,7 @@ public abstract class BaseFileObject implements JavaFileObject {
         throw new UnsupportedOperationException();
     }
 
-    protected abstract String inferBinaryName(Iterable<? extends File> path);
+    protected abstract String inferBinaryName(Iterable<? extends Path> path);
 
     protected static JavaFileObject.Kind getKind(String filename) {
         return BaseFileManager.getKind(filename);
@@ -89,8 +88,8 @@ public abstract class BaseFileObject implements JavaFileObject {
         return (lastDot == -1 ? fileName : fileName.substring(0, lastDot));
     }
 
-    protected static URI createJarUri(File jarFile, String entryName) {
-        URI jarURI = jarFile.toURI().normalize();
+    protected static URI createJarUri(Path jarFile, String entryName) {
+        URI jarURI = jarFile.toUri().normalize();
         String separator = entryName.startsWith("/") ? "!" : "!/";
         try {
             // The jar URI convention appears to be not to re-encode the jarURI
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/CacheFSInfo.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/CacheFSInfo.java
index bd293fff81f..504ce28a353 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/CacheFSInfo.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/CacheFSInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
 
 package com.sun.tools.javac.file;
 
-import java.io.File;
 import java.io.IOException;
+import java.nio.file.Path;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
@@ -61,31 +61,31 @@ public class CacheFSInfo extends FSInfo {
     }
 
     @Override
-    public File getCanonicalFile(File file) {
+    public Path getCanonicalFile(Path file) {
         Entry e = getEntry(file);
         return e.canonicalFile;
     }
 
     @Override
-    public boolean exists(File file) {
+    public boolean exists(Path file) {
         Entry e = getEntry(file);
         return e.exists;
     }
 
     @Override
-    public boolean isDirectory(File file) {
+    public boolean isDirectory(Path file) {
         Entry e = getEntry(file);
         return e.isDirectory;
     }
 
     @Override
-    public boolean isFile(File file) {
+    public boolean isFile(Path file) {
         Entry e = getEntry(file);
         return e.isFile;
     }
 
     @Override
-    public List<File> getJarClassPath(File file) throws IOException {
+    public List<Path> getJarClassPath(Path file) throws IOException {
         // don't bother to lock the cache, because it is thread-safe, and
         // because the worst that can happen would be to create two identical
         // jar class paths together and have one overwrite the other.
@@ -95,7 +95,7 @@ public class CacheFSInfo extends FSInfo {
         return e.jarClassPath;
     }
 
-    private Entry getEntry(File file) {
+    private Entry getEntry(Path file) {
         // don't bother to lock the cache, because it is thread-safe, and
         // because the worst that can happen would be to create two identical
         // entries together and have one overwrite the other.
@@ -112,13 +112,13 @@ public class CacheFSInfo extends FSInfo {
     }
 
     // could also be a Map<File,SoftReference<Entry>> ?
-    private Map<File,Entry> cache = new ConcurrentHashMap<>();
+    private final Map<Path,Entry> cache = new ConcurrentHashMap<>();
 
     private static class Entry {
-        File canonicalFile;
+        Path canonicalFile;
         boolean exists;
         boolean isFile;
         boolean isDirectory;
-        List<File> jarClassPath;
+        List<Path> jarClassPath;
     }
 }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/FSInfo.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/FSInfo.java
index 7fcdb2b69d9..5d5530122de 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/FSInfo.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/FSInfo.java
@@ -1,8 +1,10 @@
 
 package com.sun.tools.javac.file;
 
-import java.io.File;
 import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
@@ -42,29 +44,29 @@ public class FSInfo {
         context.put(FSInfo.class, this);
     }
 
-    public File getCanonicalFile(File file) {
+    public Path getCanonicalFile(Path file) {
         try {
-            return file.getCanonicalFile();
+            return file.toRealPath();
         } catch (IOException e) {
-            return file.getAbsoluteFile();
+            return file.toAbsolutePath();
         }
     }
 
-    public boolean exists(File file) {
-        return file.exists();
+    public boolean exists(Path file) {
+        return Files.exists(file);
     }
 
-    public boolean isDirectory(File file) {
-        return file.isDirectory();
+    public boolean isDirectory(Path file) {
+        return Files.isDirectory(file);
     }
 
-    public boolean isFile(File file) {
-        return file.isFile();
+    public boolean isFile(Path file) {
+        return Files.isRegularFile(file);
     }
 
-    public List<File> getJarClassPath(File file) throws IOException {
-        String parent = file.getParent();
-        try (JarFile jarFile = new JarFile(file)) {
+    public List<Path> getJarClassPath(Path file) throws IOException {
+        Path parent = file.getParent();
+        try (JarFile jarFile = new JarFile(file.toFile())) {
             Manifest man = jarFile.getManifest();
             if (man == null)
                 return Collections.emptyList();
@@ -77,14 +79,14 @@ public class FSInfo {
             if (path == null)
                 return Collections.emptyList();
 
-            List<File> list = new ArrayList<>();
+            List<Path> list = new ArrayList<>();
 
             for (StringTokenizer st = new StringTokenizer(path);
                  st.hasMoreTokens(); ) {
                 String elt = st.nextToken();
-                File f = new File(elt);
+                Path f = Paths.get(elt);
                 if (!f.isAbsolute() && parent != null)
-                    f = new File(parent,elt).getAbsoluteFile();
+                    f = parent.resolve(f).toAbsolutePath();
                 list.add(f);
             }
 
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java
index 72c6574410e..2aa81b30c27 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java
@@ -25,17 +25,21 @@
 
 package com.sun.tools.javac.file;
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.OutputStreamWriter;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.nio.CharBuffer;
 import java.nio.charset.Charset;
+import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
+import java.nio.file.LinkOption;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -46,6 +50,8 @@ import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import java.util.zip.ZipFile;
 
 import javax.lang.model.SourceVersion;
@@ -54,8 +60,8 @@ import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
 import javax.tools.StandardJavaFileManager;
 
-import com.sun.tools.javac.file.RelativePath.RelativeFile;
 import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
+import com.sun.tools.javac.file.RelativePath.RelativeFile;
 import com.sun.tools.javac.util.BaseFileManager;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.DefinedBy;
@@ -95,15 +101,15 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
     protected boolean mmappedIO;
     protected boolean symbolFileEnabled;
 
-    protected enum SortFiles implements Comparator<File> {
+    protected enum SortFiles implements Comparator<Path> {
         FORWARD {
-            public int compare(File f1, File f2) {
-                return f1.getName().compareTo(f2.getName());
+            public int compare(Path f1, Path f2) {
+                return f1.getFileName().compareTo(f2.getFileName());
             }
         },
         REVERSE {
-            public int compare(File f1, File f2) {
-                return -f1.getName().compareTo(f2.getName());
+            public int compare(Path f1, Path f2) {
+                return -f1.getFileName().compareTo(f2.getFileName());
             }
         }
     }
@@ -162,10 +168,10 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
     }
 
     public JavaFileObject getFileForInput(String name) {
-        return getRegularFile(new File(name));
+        return getRegularFile(Paths.get(name));
     }
 
-    public JavaFileObject getRegularFile(File file) {
+    public JavaFileObject getRegularFile(Path file) {
         return new RegularFileObject(this, file);
     }
 
@@ -255,25 +261,36 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
      * Insert all files in subdirectory subdirectory of directory directory
      * which match fileKinds into resultList
      */
-    private void listDirectory(File directory,
+    private void listDirectory(Path directory,
                                RelativeDirectory subdirectory,
                                Set<JavaFileObject.Kind> fileKinds,
                                boolean recurse,
                                ListBuffer<JavaFileObject> resultList) {
-        File d = subdirectory.getFile(directory);
-        if (!caseMapCheck(d, subdirectory))
+        Path d;
+        try {
+            d = subdirectory.getFile(directory);
+        } catch (InvalidPathException ignore) {
             return;
+        }
 
-        File[] files = d.listFiles();
-        if (files == null)
+        if (!Files.exists(d)) {
+           return;
+        }
+
+        if (!caseMapCheck(d, subdirectory)) {
             return;
+        }
 
-        if (sortFiles != null)
-            Arrays.sort(files, sortFiles);
+        java.util.List<Path> files;
+        try (Stream<Path> s = Files.list(d)) {
+            files = (sortFiles == null ? s : s.sorted(sortFiles)).collect(Collectors.toList());
+        } catch (IOException ignore) {
+            return;
+        }
 
-        for (File f: files) {
-            String fname = f.getName();
-            if (f.isDirectory()) {
+        for (Path f: files) {
+            String fname = f.getFileName().toString();
+            if (Files.isDirectory(f)) {
                 if (recurse && SourceVersion.isIdentifier(fname)) {
                     listDirectory(directory,
                                   new RelativeDirectory(subdirectory, fname),
@@ -284,7 +301,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
             } else {
                 if (isValidFile(fname, fileKinds)) {
                     JavaFileObject fe =
-                        new RegularFileObject(this, fname, new File(d, fname));
+                        new RegularFileObject(this, fname, d.resolve(fname));
                     resultList.append(fe);
                 }
             }
@@ -327,7 +344,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
      * Insert all files in subdirectory subdirectory of container which
      * match fileKinds into resultList
      */
-    private void listContainer(File container,
+    private void listContainer(Path container,
                                RelativeDirectory subdirectory,
                                Set<JavaFileObject.Kind> fileKinds,
                                boolean recurse,
@@ -372,13 +389,15 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
      *  ends in a string of characters with the same case as given name.
      *  Ignore file separators in both path and name.
      */
-    private boolean caseMapCheck(File f, RelativePath name) {
+    private boolean caseMapCheck(Path f, RelativePath name) {
         if (fileSystemIsCaseSensitive) return true;
-        // Note that getCanonicalPath() returns the case-sensitive
+        // Note that toRealPath() returns the case-sensitive
         // spelled file name.
         String path;
+        char sep;
         try {
-            path = f.getCanonicalPath();
+            path = f.toRealPath(LinkOption.NOFOLLOW_LINKS).toString();
+            sep = f.getFileSystem().getSeparator().charAt(0);
         } catch (IOException ex) {
             return false;
         }
@@ -387,7 +406,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         int i = pcs.length - 1;
         int j = ncs.length - 1;
         while (i >= 0 && j >= 0) {
-            while (i >= 0 && pcs[i] == File.separatorChar) i--;
+            while (i >= 0 && pcs[i] == sep) i--;
             while (j >= 0 && ncs[j] == '/') j--;
             if (i >= 0 && j >= 0) {
                 if (pcs[i] != ncs[j]) return false;
@@ -415,8 +434,8 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
     }
 
     public class MissingArchive implements Archive {
-        final File zipFileName;
-        public MissingArchive(File name) {
+        final Path zipFileName;
+        public MissingArchive(Path name) {
             zipFileName = name;
         }
         public boolean contains(RelativePath name) {
@@ -446,7 +465,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
 
     /** A directory of zip files already opened.
      */
-    Map<File, Archive> archives = new HashMap<>();
+    Map<Path, Archive> archives = new HashMap<>();
 
     private static final String[] symbolFileLocation = { "lib", "ct.sym" };
     private static final RelativeDirectory symbolFilePrefix
@@ -458,7 +477,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
      * fail over to the platform zip, and allow it to deal with a potentially
      * non compliant zip file.
      */
-    protected Archive openArchive(File zipFilename) throws IOException {
+    protected Archive openArchive(Path zipFilename) throws IOException {
         try {
             return openArchive(zipFilename, contextUseOptimizedZip);
         } catch (IOException ioe) {
@@ -472,17 +491,17 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
 
     /** Open a new zip file directory, and cache it.
      */
-    private Archive openArchive(File zipFileName, boolean useOptimizedZip) throws IOException {
-        File origZipFileName = zipFileName;
+    private Archive openArchive(Path zipFileName, boolean useOptimizedZip) throws IOException {
+        Path origZipFileName = zipFileName;
         if (symbolFileEnabled && locations.isDefaultBootClassPathRtJar(zipFileName)) {
-            File file = zipFileName.getParentFile().getParentFile(); // ${java.home}
-            if (new File(file.getName()).equals(new File("jre")))
-                file = file.getParentFile();
+            Path file = zipFileName.getParent().getParent(); // ${java.home}
+            if (file.getFileName().equals(Paths.get("jre")))
+                file = file.getParent();
             // file == ${jdk.home}
             for (String name : symbolFileLocation)
-                file = new File(file, name);
+                file = file.resolve(name);
             // file == ${jdk.home}/lib/ct.sym
-            if (file.exists())
+            if (Files.exists(file))
                 zipFileName = file;
         }
 
@@ -495,7 +514,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
             String preindexCacheLocation = null;
 
             if (!useOptimizedZip) {
-                zdir = new ZipFile(zipFileName);
+                zdir = new ZipFile(zipFileName.toFile());
             } else {
                 usePreindexedCache = options.isSet("usezipindex");
                 preindexCacheLocation = options.get("java.io.tmpdir");
@@ -545,12 +564,12 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
                                     options.isSet("writezipindexfiles")));
                 }
             }
-        } catch (FileNotFoundException ex) {
+        } catch (FileNotFoundException | NoSuchFileException ex) {
             archive = new MissingArchive(zipFileName);
         } catch (ZipFileIndex.ZipFormatException zfe) {
             throw zfe;
         } catch (IOException ex) {
-            if (zipFileName.exists())
+            if (Files.exists(zipFileName))
                 log.error("error.reading.file", zipFileName, getMessage(ex));
             archive = new MissingArchive(zipFileName);
         }
@@ -610,13 +629,13 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         nullCheck(packageName);
         nullCheck(kinds);
 
-        Iterable<? extends File> path = getLocation(location);
+        Iterable<? extends Path> path = asPaths(getLocation(location));
         if (path == null)
             return List.nil();
         RelativeDirectory subdirectory = RelativeDirectory.forPackage(packageName);
         ListBuffer<JavaFileObject> results = new ListBuffer<>();
 
-        for (File directory : path)
+        for (Path directory : path)
             listContainer(directory, subdirectory, kinds, recurse, results);
         return results.toList();
     }
@@ -626,7 +645,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         file.getClass(); // null check
         location.getClass(); // null check
         // Need to match the path semantics of list(location, ...)
-        Iterable<? extends File> path = getLocation(location);
+        Iterable<? extends Path> path = getLocationAsPaths(location);
         if (path == null) {
             return null;
         }
@@ -686,17 +705,20 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
     }
 
     private JavaFileObject getFileForInput(Location location, RelativeFile name) throws IOException {
-        Iterable<? extends File> path = getLocation(location);
+        Iterable<? extends Path> path = asPaths(getLocation(location));
         if (path == null)
             return null;
 
-        for (File dir: path) {
+        for (Path dir: path) {
             Archive a = archives.get(dir);
             if (a == null) {
                 if (fsInfo.isDirectory(dir)) {
-                    File f = name.getFile(dir);
-                    if (f.exists())
-                        return new RegularFileObject(this, f);
+                    try {
+                        Path f = name.getFile(dir);
+                        if (Files.exists(f))
+                            return new RegularFileObject(this, f);
+                    } catch (InvalidPathException ignore) {
+                    }
                     continue;
                 }
                 // Not a directory, create the archive
@@ -749,31 +771,37 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
                                             FileObject sibling)
         throws IOException
     {
-        File dir;
+        Path dir;
         if (location == CLASS_OUTPUT) {
             if (getClassOutDir() != null) {
                 dir = getClassOutDir();
             } else {
-                File siblingDir = null;
+                Path siblingDir = null;
                 if (sibling != null && sibling instanceof RegularFileObject) {
-                    siblingDir = ((RegularFileObject)sibling).file.getParentFile();
+                    siblingDir = ((RegularFileObject)sibling).file.getParent();
                 }
-                return new RegularFileObject(this, new File(siblingDir, fileName.basename()));
+                if (siblingDir == null)
+                    return new RegularFileObject(this, Paths.get(fileName.basename()));
+                else
+                    return new RegularFileObject(this, siblingDir.resolve(fileName.basename()));
             }
         } else if (location == SOURCE_OUTPUT) {
             dir = (getSourceOutDir() != null ? getSourceOutDir() : getClassOutDir());
         } else {
-            Iterable<? extends File> path = locations.getLocation(location);
+            Iterable<? extends Path> path = locations.getLocation(location);
             dir = null;
-            for (File f: path) {
+            for (Path f: path) {
                 dir = f;
                 break;
             }
         }
 
-        File file = fileName.getFile(dir); // null-safe
-        return new RegularFileObject(this, file);
-
+        try {
+            Path file = fileName.getFile(dir); // null-safe
+            return new RegularFileObject(this, file);
+        } catch (InvalidPathException e) {
+            throw new IOException("bad filename " + fileName, e);
+        }
     }
 
     @DefinedBy(Api.COMPILER)
@@ -786,7 +814,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         else
             result = new ArrayList<>();
         for (File f: files)
-            result.add(new RegularFileObject(this, nullCheck(f)));
+            result.add(new RegularFileObject(this, nullCheck(f).toPath()));
         return result;
     }
 
@@ -797,24 +825,29 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
 
     @DefinedBy(Api.COMPILER)
     public void setLocation(Location location,
-                            Iterable<? extends File> path)
+                            Iterable<? extends File> searchpath)
         throws IOException
     {
         nullCheck(location);
-        locations.setLocation(location, path);
+        locations.setLocation(location, asPaths(searchpath));
     }
 
     @DefinedBy(Api.COMPILER)
     public Iterable<? extends File> getLocation(Location location) {
+        nullCheck(location);
+        return asFiles(locations.getLocation(location));
+    }
+
+    private Iterable<? extends Path> getLocationAsPaths(Location location) {
         nullCheck(location);
         return locations.getLocation(location);
     }
 
-    private File getClassOutDir() {
+    private Path getClassOutDir() {
         return locations.getOutputLocation(CLASS_OUTPUT);
     }
 
-    private File getSourceOutDir() {
+    private Path getSourceOutDir() {
         return locations.getOutputLocation(SOURCE_OUTPUT);
     }
 
@@ -885,4 +918,50 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
             return s;
         return e.toString();
     }
+
+    /* Converters between files and paths.
+     * These are temporary until we can update the StandardJavaFileManager API.
+     */
+
+    static Iterable<Path> asPaths(final Iterable<? extends File> files) {
+        if (files == null)
+            return null;
+
+        return () -> new Iterator<Path>() {
+            Iterator<? extends File> iter = files.iterator();
+
+            @Override
+            public boolean hasNext() {
+                return iter.hasNext();
+            }
+
+            @Override
+            public Path next() {
+                return iter.next().toPath();
+            }
+        };
+    }
+
+    static Iterable<File> asFiles(final Iterable<? extends Path> paths) {
+        if (paths == null)
+            return null;
+
+        return () -> new Iterator<File>() {
+            Iterator<? extends Path> iter = paths.iterator();
+
+            @Override
+            public boolean hasNext() {
+                return iter.hasNext();
+            }
+
+            @Override
+            public File next() {
+                return iter.next().toFile();
+            }
+        };
+    }
+
+    static File asFile(Path path) {
+        return path == null ? null : path.toFile();
+    }
 }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java
index 33cb4c8245e..9cf9baafd3d 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java
@@ -29,6 +29,10 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -40,7 +44,8 @@ import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
-import java.util.StringTokenizer;
+import java.util.regex.Pattern;
+import java.util.stream.Stream;
 import java.util.zip.ZipFile;
 
 import javax.tools.JavaFileManager;
@@ -105,7 +110,7 @@ public class Locations {
         this.fsInfo = fsInfo;
     }
 
-    public Collection<File> bootClassPath() {
+    public Collection<Path> bootClassPath() {
         return getLocation(PLATFORM_CLASS_PATH);
     }
 
@@ -115,56 +120,52 @@ public class Locations {
         return h.isDefault();
     }
 
-    boolean isDefaultBootClassPathRtJar(File file) {
+    boolean isDefaultBootClassPathRtJar(Path file) {
         BootClassPathLocationHandler h
                 = (BootClassPathLocationHandler) getHandler(PLATFORM_CLASS_PATH);
         return h.isDefaultRtJar(file);
     }
 
-    public Collection<File> userClassPath() {
+    public Collection<Path> userClassPath() {
         return getLocation(CLASS_PATH);
     }
 
-    public Collection<File> sourcePath() {
-        Collection<File> p = getLocation(SOURCE_PATH);
+    public Collection<Path> sourcePath() {
+        Collection<Path> p = getLocation(SOURCE_PATH);
         // TODO: this should be handled by the LocationHandler
         return p == null || p.isEmpty() ? null : p;
     }
 
     /**
-     * Split a path into its elements. Empty path elements will be ignored.
+     * Split a search path into its elements. Empty path elements will be ignored.
      *
-     * @param path The path to be split
+     * @param searchPath The search path to be split
      * @return The elements of the path
      */
-    private static Iterable<File> getPathEntries(String path) {
-        return getPathEntries(path, null);
+    private static Iterable<Path> getPathEntries(String searchPath) {
+        return getPathEntries(searchPath, null);
     }
 
     /**
-     * Split a path into its elements. If emptyPathDefault is not null, all empty elements in the
+     * Split a search path into its elements. If emptyPathDefault is not null, all empty elements in the
      * path, including empty elements at either end of the path, will be replaced with the value of
      * emptyPathDefault.
      *
-     * @param path The path to be split
+     * @param searchPath The search path to be split
      * @param emptyPathDefault The value to substitute for empty path elements, or null, to ignore
      * empty path elements
      * @return The elements of the path
      */
-    private static Iterable<File> getPathEntries(String path, File emptyPathDefault) {
-        ListBuffer<File> entries = new ListBuffer<>();
-        int start = 0;
-        while (start <= path.length()) {
-            int sep = path.indexOf(File.pathSeparatorChar, start);
-            if (sep == -1) {
-                sep = path.length();
+    private static Iterable<Path> getPathEntries(String searchPath, Path emptyPathDefault) {
+        ListBuffer<Path> entries = new ListBuffer<>();
+        for (String s: searchPath.split(Pattern.quote(File.pathSeparator), -1)) {
+            if (s.isEmpty()) {
+                if (emptyPathDefault != null) {
+                    entries.add(emptyPathDefault);
+                }
+            } else {
+                entries.add(Paths.get(s));
             }
-            if (start < sep) {
-                entries.add(new File(path.substring(start, sep)));
-            } else if (emptyPathDefault != null) {
-                entries.add(emptyPathDefault);
-            }
-            start = sep + 1;
         }
         return entries;
     }
@@ -173,12 +174,12 @@ public class Locations {
      * Utility class to help evaluate a path option. Duplicate entries are ignored, jar class paths
      * can be expanded.
      */
-    private class SearchPath extends LinkedHashSet<File> {
+    private class SearchPath extends LinkedHashSet<Path> {
 
         private static final long serialVersionUID = 0;
 
         private boolean expandJarClassPaths = false;
-        private final Set<File> canonicalValues = new HashSet<>();
+        private final Set<Path> canonicalValues = new HashSet<>();
 
         public SearchPath expandJarClassPaths(boolean x) {
             expandJarClassPaths = x;
@@ -188,9 +189,9 @@ public class Locations {
         /**
          * What to use when path element is the empty string
          */
-        private File emptyPathDefault = null;
+        private Path emptyPathDefault = null;
 
-        public SearchPath emptyPathDefault(File x) {
+        public SearchPath emptyPathDefault(Path x) {
             emptyPathDefault = x;
             return this;
         }
@@ -200,7 +201,7 @@ public class Locations {
             expandJarClassPaths = true;
             try {
                 if (dirs != null) {
-                    for (File dir : getPathEntries(dirs)) {
+                    for (Path dir : getPathEntries(dirs)) {
                         addDirectory(dir, warn);
                     }
                 }
@@ -214,8 +215,8 @@ public class Locations {
             return addDirectories(dirs, warn);
         }
 
-        private void addDirectory(File dir, boolean warn) {
-            if (!dir.isDirectory()) {
+        private void addDirectory(Path dir, boolean warn) {
+            if (!Files.isDirectory(dir)) {
                 if (warn) {
                     log.warning(Lint.LintCategory.PATH,
                             "dir.path.element.not.found", dir);
@@ -223,15 +224,10 @@ public class Locations {
                 return;
             }
 
-            File[] files = dir.listFiles();
-            if (files == null) {
-                return;
-            }
-
-            for (File direntry : files) {
-                if (isArchive(direntry)) {
-                    addFile(direntry, warn);
-                }
+            try (Stream<Path> s = Files.list(dir)) {
+                s.filter(dirEntry -> isArchive(dirEntry))
+                        .forEach(dirEntry -> addFile(dirEntry, warn));
+            } catch (IOException ignore) {
             }
         }
 
@@ -246,20 +242,20 @@ public class Locations {
             return addFiles(files, warn);
         }
 
-        public SearchPath addFiles(Iterable<? extends File> files, boolean warn) {
+        public SearchPath addFiles(Iterable<? extends Path> files, boolean warn) {
             if (files != null) {
-                for (File file : files) {
+                for (Path file : files) {
                     addFile(file, warn);
                 }
             }
             return this;
         }
 
-        public SearchPath addFiles(Iterable<? extends File> files) {
+        public SearchPath addFiles(Iterable<? extends Path> files) {
             return addFiles(files, warn);
         }
 
-        public void addFile(File file, boolean warn) {
+        public void addFile(Path file, boolean warn) {
             if (contains(file)) {
                 // discard duplicates
                 return;
@@ -275,7 +271,7 @@ public class Locations {
                 return;
             }
 
-            File canonFile = fsInfo.getCanonicalFile(file);
+            Path canonFile = fsInfo.getCanonicalFile(file);
             if (canonicalValues.contains(canonFile)) {
                 /* Discard duplicates and avoid infinite recursion */
                 return;
@@ -287,7 +283,7 @@ public class Locations {
                     /* Not a recognized extension; open it to see if
                      it looks like a valid zip file. */
                     try {
-                        ZipFile z = new ZipFile(file);
+                        ZipFile z = new ZipFile(file.toFile());
                         z.close();
                         if (warn) {
                             log.warning(Lint.LintCategory.PATH,
@@ -318,9 +314,9 @@ public class Locations {
         // Manifest entry.  In some future release, we may want to
         // update this code to recognize URLs rather than simple
         // filenames, but if we do, we should redo all path-related code.
-        private void addJarClassPath(File jarFile, boolean warn) {
+        private void addJarClassPath(Path jarFile, boolean warn) {
             try {
-                for (File f : fsInfo.getJarClassPath(jarFile)) {
+                for (Path f : fsInfo.getJarClassPath(jarFile)) {
                     addFile(f, warn);
                 }
             } catch (IOException e) {
@@ -365,12 +361,12 @@ public class Locations {
         /**
          * @see StandardJavaFileManager#getLocation
          */
-        abstract Collection<File> getLocation();
+        abstract Collection<Path> getLocation();
 
         /**
          * @see StandardJavaFileManager#setLocation
          */
-        abstract void setLocation(Iterable<? extends File> files) throws IOException;
+        abstract void setLocation(Iterable<? extends Path> files) throws IOException;
     }
 
     /**
@@ -380,7 +376,7 @@ public class Locations {
      */
     private class OutputLocationHandler extends LocationHandler {
 
-        private File outputDir;
+        private Path outputDir;
 
         OutputLocationHandler(Location location, Option... options) {
             super(location, options);
@@ -396,31 +392,31 @@ public class Locations {
             // need to decide how best to report issue for benefit of
             // direct API call on JavaFileManager.handleOption(specifies IAE)
             // vs. command line decoding.
-            outputDir = (value == null) ? null : new File(value);
+            outputDir = (value == null) ? null : Paths.get(value);
             return true;
         }
 
         @Override
-        Collection<File> getLocation() {
+        Collection<Path> getLocation() {
             return (outputDir == null) ? null : Collections.singleton(outputDir);
         }
 
         @Override
-        void setLocation(Iterable<? extends File> files) throws IOException {
+        void setLocation(Iterable<? extends Path> files) throws IOException {
             if (files == null) {
                 outputDir = null;
             } else {
-                Iterator<? extends File> pathIter = files.iterator();
+                Iterator<? extends Path> pathIter = files.iterator();
                 if (!pathIter.hasNext()) {
                     throw new IllegalArgumentException("empty path for directory");
                 }
-                File dir = pathIter.next();
+                Path dir = pathIter.next();
                 if (pathIter.hasNext()) {
                     throw new IllegalArgumentException("path too long for directory");
                 }
-                if (!dir.exists()) {
+                if (!Files.exists(dir)) {
                     throw new FileNotFoundException(dir + ": does not exist");
-                } else if (!dir.isDirectory()) {
+                } else if (!Files.isDirectory(dir)) {
                     throw new IOException(dir + ": not a directory");
                 }
                 outputDir = dir;
@@ -435,7 +431,7 @@ public class Locations {
      */
     private class SimpleLocationHandler extends LocationHandler {
 
-        protected Collection<File> searchPath;
+        protected Collection<Path> searchPath;
 
         SimpleLocationHandler(Location location, Option... options) {
             super(location, options);
@@ -452,12 +448,12 @@ public class Locations {
         }
 
         @Override
-        Collection<File> getLocation() {
+        Collection<Path> getLocation() {
             return searchPath;
         }
 
         @Override
-        void setLocation(Iterable<? extends File> files) {
+        void setLocation(Iterable<? extends Path> files) {
             SearchPath p;
             if (files == null) {
                 p = computePath(null);
@@ -488,7 +484,7 @@ public class Locations {
         }
 
         @Override
-        Collection<File> getLocation() {
+        Collection<Path> getLocation() {
             lazy();
             return searchPath;
         }
@@ -520,7 +516,7 @@ public class Locations {
         protected SearchPath createPath() {
             return new SearchPath()
                     .expandJarClassPaths(true) // Only search user jars for Class-Paths
-                    .emptyPathDefault(new File("."));  // Empty path elt ==> current directory
+                    .emptyPathDefault(Paths.get("."));  // Empty path elt ==> current directory
         }
 
         private void lazy() {
@@ -539,14 +535,14 @@ public class Locations {
      */
     private class BootClassPathLocationHandler extends LocationHandler {
 
-        private Collection<File> searchPath;
+        private Collection<Path> searchPath;
         final Map<Option, String> optionValues = new EnumMap<>(Option.class);
 
         /**
          * rt.jar as found on the default bootclasspath. If the user specified a bootclasspath, null
          * is used.
          */
-        private File defaultBootClassPathRtJar = null;
+        private Path defaultBootClassPathRtJar = null;
 
         /**
          * Is bootclasspath the default?
@@ -567,7 +563,7 @@ public class Locations {
             return isDefaultBootClassPath;
         }
 
-        boolean isDefaultRtJar(File file) {
+        boolean isDefaultRtJar(Path file) {
             lazy();
             return file.equals(defaultBootClassPathRtJar);
         }
@@ -604,13 +600,13 @@ public class Locations {
         }
 
         @Override
-        Collection<File> getLocation() {
+        Collection<Path> getLocation() {
             lazy();
             return searchPath;
         }
 
         @Override
-        void setLocation(Iterable<? extends File> files) {
+        void setLocation(Iterable<? extends Path> files) {
             if (files == null) {
                 searchPath = null;  // reset to "uninitialized"
             } else {
@@ -645,9 +641,9 @@ public class Locations {
                 // Standard system classes for this compiler's release.
                 String files = System.getProperty("sun.boot.class.path");
                 path.addFiles(files, false);
-                File rt_jar = new File("rt.jar");
-                for (File file : getPathEntries(files)) {
-                    if (new File(file.getName()).equals(rt_jar)) {
+                Path rt_jar = Paths.get("rt.jar");
+                for (Path file : getPathEntries(files)) {
+                    if (file.getFileName().equals(rt_jar)) {
                         defaultBootClassPathRtJar = file;
                     }
                 }
@@ -709,12 +705,12 @@ public class Locations {
         return (h == null ? false : h.handleOption(option, value));
     }
 
-    Collection<File> getLocation(Location location) {
+    Collection<Path> getLocation(Location location) {
         LocationHandler h = getHandler(location);
         return (h == null ? null : h.getLocation());
     }
 
-    File getOutputLocation(Location location) {
+    Path getOutputLocation(Location location) {
         if (!location.isOutputLocation()) {
             throw new IllegalArgumentException();
         }
@@ -722,7 +718,7 @@ public class Locations {
         return ((OutputLocationHandler) h).outputDir;
     }
 
-    void setLocation(Location location, Iterable<? extends File> files) throws IOException {
+    void setLocation(Location location, Iterable<? extends Path> files) throws IOException {
         LocationHandler h = getHandler(location);
         if (h == null) {
             if (location.isOutputLocation()) {
@@ -743,8 +739,8 @@ public class Locations {
     /**
      * Is this the name of an archive file?
      */
-    private boolean isArchive(File file) {
-        String n = StringUtils.toLowerCase(file.getName());
+    private boolean isArchive(Path file) {
+        String n = StringUtils.toLowerCase(file.getFileName().toString());
         return fsInfo.isFile(file)
                 && (n.endsWith(".jar") || n.endsWith(".zip"));
     }
@@ -753,50 +749,41 @@ public class Locations {
      * Utility method for converting a search path string to an array of directory and JAR file
      * URLs.
      *
-     * Note that this method is called by apt and the DocletInvoker.
+     * Note that this method is called by the DocletInvoker.
      *
      * @param path the search path string
      * @return the resulting array of directory and JAR file URLs
      */
     public static URL[] pathToURLs(String path) {
-        StringTokenizer st = new StringTokenizer(path, File.pathSeparator);
-        URL[] urls = new URL[st.countTokens()];
-        int count = 0;
-        while (st.hasMoreTokens()) {
-            URL url = fileToURL(new File(st.nextToken()));
-            if (url != null) {
-                urls[count++] = url;
+        java.util.List<URL> urls = new ArrayList<>();
+        for (String s: path.split(Pattern.quote(File.pathSeparator))) {
+            if (!s.isEmpty()) {
+                URL url = fileToURL(Paths.get(s));
+                if (url != null) {
+                    urls.add(url);
+                }
             }
         }
-        urls = Arrays.copyOf(urls, count);
-        return urls;
+        return urls.toArray(new URL[urls.size()]);
     }
 
     /**
      * Returns the directory or JAR file URL corresponding to the specified local file name.
      *
-     * @param file the File object
+     * @param file the Path object
      * @return the resulting directory or JAR file URL, or null if unknown
      */
-    private static URL fileToURL(File file) {
-        String name;
+    private static URL fileToURL(Path file) {
+        Path p;
         try {
-            name = file.getCanonicalPath();
+            p = file.toRealPath();
         } catch (IOException e) {
-            name = file.getAbsolutePath();
-        }
-        name = name.replace(File.separatorChar, '/');
-        if (!name.startsWith("/")) {
-            name = "/" + name;
-        }
-        // If the file does not exist, then assume that it's a directory
-        if (!file.isFile()) {
-            name = name + "/";
+            p = file.toAbsolutePath();
         }
         try {
-            return new URL("file", "", name);
+            return p.normalize().toUri().toURL();
         } catch (MalformedURLException e) {
-            throw new IllegalArgumentException(file.toString());
+            return null;
         }
     }
 }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RegularFileObject.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RegularFileObject.java
index 29e7b708ae3..b3e7596eded 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RegularFileObject.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RegularFileObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,6 @@
 
 package com.sun.tools.javac.file;
 
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -39,9 +36,13 @@ import java.net.URI;
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.CharsetDecoder;
-import javax.tools.JavaFileObject;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.text.Normalizer;
 
+import javax.tools.JavaFileObject;
+
 import com.sun.tools.javac.util.DefinedBy;
 import com.sun.tools.javac.util.DefinedBy.Api;
 
@@ -59,33 +60,33 @@ class RegularFileObject extends BaseFileObject {
      */
     private boolean hasParents = false;
     private String name;
-    final File file;
-    private Reference<File> absFileRef;
+    final Path file;
+    private Reference<Path> absFileRef;
     final static boolean isMacOS = System.getProperty("os.name", "").contains("OS X");
 
-    public RegularFileObject(JavacFileManager fileManager, File f) {
-        this(fileManager, f.getName(), f);
+    public RegularFileObject(JavacFileManager fileManager, Path f) {
+        this(fileManager, f.getFileName().toString(), f);
     }
 
-    public RegularFileObject(JavacFileManager fileManager, String name, File f) {
+    public RegularFileObject(JavacFileManager fileManager, String name, Path f) {
         super(fileManager);
-        if (f.isDirectory()) {
+        if (Files.isDirectory(f)) {
             throw new IllegalArgumentException("directories not supported");
         }
         this.name = name;
         this.file = f;
-        if (f.lastModified() > System.currentTimeMillis())
+        if (getLastModified() > System.currentTimeMillis())
             fileManager.log.warning("file.from.future", f);
     }
 
     @Override @DefinedBy(Api.COMPILER)
     public URI toUri() {
-        return file.toURI().normalize();
+        return file.toUri().normalize();
     }
 
     @Override @DefinedBy(Api.COMPILER)
     public String getName() {
-        return file.getPath();
+        return file.toString();
     }
 
     @Override
@@ -100,21 +101,21 @@ class RegularFileObject extends BaseFileObject {
 
     @Override @DefinedBy(Api.COMPILER)
     public InputStream openInputStream() throws IOException {
-        return new FileInputStream(file);
+        return Files.newInputStream(file);
     }
 
     @Override @DefinedBy(Api.COMPILER)
     public OutputStream openOutputStream() throws IOException {
         fileManager.flushCache(this);
         ensureParentDirectoriesExist();
-        return new FileOutputStream(file);
+        return Files.newOutputStream(file);
     }
 
     @Override @DefinedBy(Api.COMPILER)
     public CharBuffer getCharContent(boolean ignoreEncodingErrors) throws IOException {
         CharBuffer cb = fileManager.getCachedContent(this);
         if (cb == null) {
-            try (InputStream in = new FileInputStream(file)) {
+            try (InputStream in = Files.newInputStream(file)) {
                 ByteBuffer bb = fileManager.makeByteBuffer(in);
                 JavaFileObject prev = fileManager.log.useSource(this);
                 try {
@@ -135,17 +136,26 @@ class RegularFileObject extends BaseFileObject {
     public Writer openWriter() throws IOException {
         fileManager.flushCache(this);
         ensureParentDirectoriesExist();
-        return new OutputStreamWriter(new FileOutputStream(file), fileManager.getEncodingName());
+        return new OutputStreamWriter(Files.newOutputStream(file), fileManager.getEncodingName());
     }
 
     @Override @DefinedBy(Api.COMPILER)
     public long getLastModified() {
-        return file.lastModified();
+        try {
+            return Files.getLastModifiedTime(file).toMillis();
+        } catch (IOException e) {
+            return 0;
+        }
     }
 
     @Override @DefinedBy(Api.COMPILER)
     public boolean delete() {
-        return file.delete();
+        try {
+            Files.delete(file);
+            return true;
+        } catch (IOException e) {
+            return false;
+        }
     }
 
     @Override
@@ -154,20 +164,21 @@ class RegularFileObject extends BaseFileObject {
     }
 
     @Override
-    protected String inferBinaryName(Iterable<? extends File> path) {
-        String fPath = file.getPath();
+    protected String inferBinaryName(Iterable<? extends Path> path) {
+        String fPath = file.toString();
         //System.err.println("RegularFileObject " + file + " " +r.getPath());
-        for (File dir: path) {
+        for (Path dir: path) {
             //System.err.println("dir: " + dir);
-            String dPath = dir.getPath();
+            String sep = dir.getFileSystem().getSeparator();
+            String dPath = dir.toString();
             if (dPath.length() == 0)
                 dPath = System.getProperty("user.dir");
-            if (!dPath.endsWith(File.separator))
-                dPath += File.separator;
+            if (!dPath.endsWith(sep))
+                dPath += sep;
             if (fPath.regionMatches(true, 0, dPath, 0, dPath.length())
-                && new File(fPath.substring(0, dPath.length())).equals(new File(dPath))) {
+                && Paths.get(fPath.substring(0, dPath.length())).equals(Paths.get(dPath))) {
                 String relativeName = fPath.substring(dPath.length());
-                return removeExtension(relativeName).replace(File.separatorChar, '.');
+                return removeExtension(relativeName).replace(sep, ".");
             }
         }
         return null;
@@ -199,7 +210,7 @@ class RegularFileObject extends BaseFileObject {
             if (name.equalsIgnoreCase(n)) {
             try {
                 // allow for Windows
-                return file.getCanonicalFile().getName().equals(n);
+                return file.toRealPath().getFileName().toString().equals(n);
             } catch (IOException e) {
             }
         }
@@ -208,12 +219,12 @@ class RegularFileObject extends BaseFileObject {
 
     private void ensureParentDirectoriesExist() throws IOException {
         if (!hasParents) {
-            File parent = file.getParentFile();
-            if (parent != null && !parent.exists()) {
-                if (!parent.mkdirs()) {
-                    if (!parent.exists() || !parent.isDirectory()) {
-                        throw new IOException("could not create parent directories");
-                    }
+            Path parent = file.getParent();
+            if (parent != null && !Files.isDirectory(parent)) {
+                try {
+                    Files.createDirectories(parent);
+                } catch (IOException e) {
+                    throw new IOException("could not create parent directories", e);
                 }
             }
             hasParents = true;
@@ -242,10 +253,10 @@ class RegularFileObject extends BaseFileObject {
         return getAbsoluteFile().hashCode();
     }
 
-    private File getAbsoluteFile() {
-        File absFile = (absFileRef == null ? null : absFileRef.get());
+    private Path getAbsoluteFile() {
+        Path absFile = (absFileRef == null ? null : absFileRef.get());
         if (absFile == null) {
-            absFile = file.getAbsoluteFile();
+            absFile = file.toAbsolutePath();
             absFileRef = new SoftReference<>(absFile);
         }
         return absFile;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RelativePath.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RelativePath.java
index 564ff170348..43af92c4a8e 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RelativePath.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RelativePath.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,9 +25,13 @@
 
 package com.sun.tools.javac.file;
 
-import java.io.File;
+import java.nio.file.FileSystems;
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
+
 import javax.tools.JavaFileObject;
 
 /**
@@ -52,12 +56,17 @@ public abstract class RelativePath implements Comparable<RelativePath> {
 
     public abstract String basename();
 
-    public File getFile(File directory) {
-        if (path.length() == 0)
-            return directory;
-        return new File(directory, path.replace('/', File.separatorChar));
+    public Path getFile(Path directory) throws /*unchecked*/ InvalidPathException {
+        if (directory == null) {
+            String sep = FileSystems.getDefault().getSeparator();
+            return Paths.get(path.replace("/", sep));
+        } else {
+            String sep = directory.getFileSystem().getSeparator();
+            return directory.resolve(path.replace("/", sep));
+        }
     }
 
+    @Override
     public int compareTo(RelativePath other) {
         return path.compareTo(other.path);
     }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/SymbolArchive.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/SymbolArchive.java
index 581527d6c6f..ad992326512 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/SymbolArchive.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/SymbolArchive.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,10 +25,11 @@
 
 package com.sun.tools.javac.file;
 
-import java.io.File;
 import java.io.IOException;
+import java.nio.file.Path;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
+
 import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
@@ -43,10 +44,10 @@ import com.sun.tools.javac.util.List;
 */
 public class SymbolArchive extends ZipArchive {
 
-    final File origFile;
+    final Path origFile;
     final RelativeDirectory prefix;
 
-    public SymbolArchive(JavacFileManager fileManager, File orig, ZipFile zdir, RelativeDirectory prefix) throws IOException {
+    public SymbolArchive(JavacFileManager fileManager, Path orig, ZipFile zdir, RelativeDirectory prefix) throws IOException {
         super(fileManager, zdir, false);
         this.origFile = orig;
         this.prefix = prefix;
@@ -94,7 +95,7 @@ public class SymbolArchive extends ZipArchive {
         }
 
         @Override
-        protected String inferBinaryName(Iterable<? extends File> path) {
+        protected String inferBinaryName(Iterable<? extends Path> path) {
             String entryName = entry.getName();
             String prefix = ((SymbolArchive) zarch).prefix.path;
             if (entryName.startsWith(prefix))
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipArchive.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipArchive.java
index 19e2360e9ab..867a6c420c6 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipArchive.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipArchive.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,15 +25,18 @@
 
 package com.sun.tools.javac.file;
 
-import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Writer;
+import java.lang.ref.Reference;
+import java.lang.ref.SoftReference;
 import java.net.URI;
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.CharsetDecoder;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Enumeration;
 import java.util.HashMap;
 import java.util.Map;
@@ -49,8 +52,6 @@ import com.sun.tools.javac.file.RelativePath.RelativeFile;
 import com.sun.tools.javac.util.DefinedBy;
 import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.List;
-import java.lang.ref.Reference;
-import java.lang.ref.SoftReference;
 
 /**
  * <p><b>This is NOT part of any supported API.
@@ -131,10 +132,10 @@ public class ZipArchive implements Archive {
         return "ZipArchive[" + zfile.getName() + "]";
     }
 
-    private File getAbsoluteFile() {
-        File absFile = (absFileRef == null ? null : absFileRef.get());
+    private Path getAbsoluteFile() {
+        Path absFile = (absFileRef == null ? null : absFileRef.get());
         if (absFile == null) {
-            absFile = new File(zfile.getName()).getAbsoluteFile();
+            absFile = Paths.get(zfile.getName()).toAbsolutePath();
             absFileRef = new SoftReference<>(absFile);
         }
         return absFile;
@@ -155,7 +156,7 @@ public class ZipArchive implements Archive {
     /**
      * A reference to the absolute filename for the zip file for the archive.
      */
-    protected Reference<File> absFileRef;
+    protected Reference<Path> absFileRef;
 
     /**
      * A subclass of JavaFileObject representing zip entries.
@@ -175,7 +176,7 @@ public class ZipArchive implements Archive {
 
         @DefinedBy(Api.COMPILER)
         public URI toUri() {
-            File zipFile = new File(zarch.zfile.getName());
+            Path zipFile = Paths.get(zarch.zfile.getName());
             return createJarUri(zipFile, entry.getName());
         }
 
@@ -186,7 +187,7 @@ public class ZipArchive implements Archive {
 
         @Override
         public String getShortName() {
-            return new File(zarch.zfile.getName()).getName() + "(" + entry + ")";
+            return Paths.get(zarch.zfile.getName()).getFileName() + "(" + entry + ")";
         }
 
         @Override @DefinedBy(Api.COMPILER)
@@ -246,7 +247,7 @@ public class ZipArchive implements Archive {
         }
 
         @Override
-        protected String inferBinaryName(Iterable<? extends File> path) {
+        protected String inferBinaryName(Iterable<? extends Path> path) {
             String entryName = entry.getName();
             return removeExtension(entryName).replace('/', '.');
         }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipFileIndex.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipFileIndex.java
index dc734d4e2b2..9002498a732 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipFileIndex.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipFileIndex.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,18 +26,20 @@
 package com.sun.tools.javac.file;
 
 
-import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.RandomAccessFile;
 import java.lang.ref.Reference;
 import java.lang.ref.SoftReference;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Calendar;
 import java.util.Collections;
-import java.util.LinkedHashMap;
 import java.util.HashMap;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
@@ -91,14 +93,14 @@ public class ZipFileIndex {
             Collections.<RelativeDirectory>emptySet();
 
     // ZipFileIndex data entries
-    final File zipFile;
-    private Reference<File> absFileRef;
+    final Path zipFile;
+    private Reference<Path> absFileRef;
     long zipFileLastModified = NOT_MODIFIED;
     private RandomAccessFile zipRandomFile;
     private Entry[] entries;
 
     private boolean readFromIndex = false;
-    private File zipIndexFile = null;
+    private Path zipIndexFile = null;
     private boolean triedToReadIndex = false;
     final RelativeDirectory symbolFilePrefix;
     private final int symbolFilePrefixLength;
@@ -117,7 +119,7 @@ public class ZipFileIndex {
         return (zipRandomFile != null);
     }
 
-    ZipFileIndex(File zipFile, RelativeDirectory symbolFilePrefix, boolean writeIndex,
+    ZipFileIndex(Path zipFile, RelativeDirectory symbolFilePrefix, boolean writeIndex,
             boolean useCache, String cacheLocation) throws IOException {
         this.zipFile = zipFile;
         this.symbolFilePrefix = symbolFilePrefix;
@@ -128,7 +130,7 @@ public class ZipFileIndex {
         this.preindexedCacheLocation = cacheLocation;
 
         if (zipFile != null) {
-            this.zipFileLastModified = zipFile.lastModified();
+            this.zipFileLastModified = Files.getLastModifiedTime(zipFile).toMillis();
         }
 
         // Validate integrity of the zip file
@@ -148,10 +150,11 @@ public class ZipFileIndex {
     }
 
     private boolean isUpToDate() {
-        if (zipFile != null
-                && ((!NON_BATCH_MODE) || zipFileLastModified == zipFile.lastModified())
-                && hasPopulatedData) {
-            return true;
+        try {
+            return (zipFile != null
+                    && ((!NON_BATCH_MODE) || zipFileLastModified == Files.getLastModifiedTime(zipFile).toMillis())
+                    && hasPopulatedData);
+        } catch (IOException ignore) {
         }
 
         return false;
@@ -199,7 +202,7 @@ public class ZipFileIndex {
 
     private void openFile() throws FileNotFoundException {
         if (zipRandomFile == null && zipFile != null) {
-            zipRandomFile = new RandomAccessFile(zipFile, "r");
+            zipRandomFile = new RandomAccessFile(zipFile.toFile(), "r");
         }
     }
 
@@ -785,11 +788,11 @@ public class ZipFileIndex {
                     entries.add(zipFileIndex.entries[i]);
                 }
             } else {
-                File indexFile = zipFileIndex.getIndexFile();
+                Path indexFile = zipFileIndex.getIndexFile();
                 if (indexFile != null) {
                     RandomAccessFile raf = null;
                     try {
-                        raf = new RandomAccessFile(indexFile, "r");
+                        raf = new RandomAccessFile(indexFile.toFile(), "r");
                         raf.seek(writtenOffsetOffset);
 
                         for (int nFiles = 0; nFiles < numEntries; nFiles++) {
@@ -856,11 +859,11 @@ public class ZipFileIndex {
             triedToReadIndex = true;
             RandomAccessFile raf = null;
             try {
-                File indexFileName = getIndexFile();
-                raf = new RandomAccessFile(indexFileName, "r");
+                Path indexFileName = getIndexFile();
+                raf = new RandomAccessFile(indexFileName.toFile(), "r");
 
                 long fileStamp = raf.readLong();
-                if (zipFile.lastModified() != fileStamp) {
+                if (Files.getLastModifiedTime(zipFile).toMillis() != fileStamp) {
                     ret = false;
                 } else {
                     directories = new LinkedHashMap<>();
@@ -908,7 +911,7 @@ public class ZipFileIndex {
             return true;
         }
 
-        File indexFile = getIndexFile();
+        Path indexFile = getIndexFile();
         if (indexFile == null) {
             return false;
         }
@@ -916,7 +919,7 @@ public class ZipFileIndex {
         RandomAccessFile raf = null;
         long writtenSoFar = 0;
         try {
-            raf = new RandomAccessFile(indexFile, "rw");
+            raf = new RandomAccessFile(indexFile.toFile(), "rw");
 
             raf.writeLong(zipFileLastModified);
             writtenSoFar += 8;
@@ -1016,27 +1019,27 @@ public class ZipFileIndex {
         }
     }
 
-    private File getIndexFile() {
+    private Path getIndexFile() {
         if (zipIndexFile == null) {
             if (zipFile == null) {
                 return null;
             }
 
-            zipIndexFile = new File((preindexedCacheLocation == null ? "" : preindexedCacheLocation) +
-                    zipFile.getName() + ".index");
+            zipIndexFile = Paths.get((preindexedCacheLocation == null ? "" : preindexedCacheLocation) +
+                    zipFile.getFileName() + ".index");
         }
 
         return zipIndexFile;
     }
 
-    public File getZipFile() {
+    public Path getZipFile() {
         return zipFile;
     }
 
-    File getAbsoluteFile() {
-        File absFile = (absFileRef == null ? null : absFileRef.get());
+    Path getAbsoluteFile() {
+        Path absFile = (absFileRef == null ? null : absFileRef.get());
         if (absFile == null) {
-            absFile = zipFile.getAbsoluteFile();
+            absFile = zipFile.toAbsolutePath();
             absFileRef = new SoftReference<>(absFile);
         }
         return absFile;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java
index 5ca4e85df5a..2ffbc8534e1 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipFileIndexArchive.java
@@ -25,12 +25,8 @@
 
 package com.sun.tools.javac.file;
 
-import java.io.IOException;
-import java.util.Set;
-import javax.tools.JavaFileObject;
-
 import java.io.ByteArrayInputStream;
-import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Writer;
@@ -38,6 +34,10 @@ import java.net.URI;
 import java.nio.ByteBuffer;
 import java.nio.CharBuffer;
 import java.nio.charset.CharsetDecoder;
+import java.nio.file.Path;
+import java.util.Set;
+
+import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.file.JavacFileManager.Archive;
 import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
@@ -56,7 +56,7 @@ import com.sun.tools.javac.util.List;
 public class ZipFileIndexArchive implements Archive {
 
     private final ZipFileIndex zfIndex;
-    private JavacFileManager fileManager;
+    private final JavacFileManager fileManager;
 
     public ZipFileIndexArchive(JavacFileManager fileManager, ZipFileIndex zdir) throws IOException {
         super();
@@ -111,10 +111,10 @@ public class ZipFileIndexArchive implements Archive {
 
         /** The name of the zip file where this entry resides.
          */
-        File zipName;
+        Path zipName;
 
 
-        ZipFileIndexFileObject(JavacFileManager fileManager, ZipFileIndex zfIndex, ZipFileIndex.Entry entry, File zipFileName) {
+        ZipFileIndexFileObject(JavacFileManager fileManager, ZipFileIndex zfIndex, ZipFileIndex.Entry entry, Path zipFileName) {
             super(fileManager);
             this.name = entry.getFileName();
             this.zfIndex = zfIndex;
@@ -134,7 +134,7 @@ public class ZipFileIndexArchive implements Archive {
 
         @Override
         public String getShortName() {
-            return zipName.getName() + "(" + entry.getName() + ")";
+            return zipName.getFileName() + "(" + entry.getName() + ")";
         }
 
         @Override @DefinedBy(Api.COMPILER)
@@ -194,7 +194,7 @@ public class ZipFileIndexArchive implements Archive {
         }
 
         @Override
-        protected String inferBinaryName(Iterable<? extends File> path) {
+        protected String inferBinaryName(Iterable<? extends Path> path) {
             String entryName = entry.getName();
             if (zfIndex.symbolFilePrefix != null) {
                 String prefix = zfIndex.symbolFilePrefix.path;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipFileIndexCache.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipFileIndexCache.java
index 7524c558c60..f16fa411eb2 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipFileIndexCache.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/ZipFileIndexCache.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,21 +25,22 @@
 
 package com.sun.tools.javac.file;
 
-import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
-import com.sun.tools.javac.util.Context;
-import java.io.File;
 import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
+import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
+import com.sun.tools.javac.util.Context;
+
 
 /** A cache for ZipFileIndex objects. */
 public class ZipFileIndexCache {
 
-    private final Map<File, ZipFileIndex> map = new HashMap<>();
+    private final Map<Path, ZipFileIndex> map = new HashMap<>();
 
     /** Get a shared instance of the cache. */
     private static ZipFileIndexCache sharedInstance;
@@ -89,13 +90,13 @@ public class ZipFileIndexCache {
         return zipFileIndexes;
     }
 
-    public synchronized ZipFileIndex getZipFileIndex(File zipFile,
+    public synchronized ZipFileIndex getZipFileIndex(Path zipFile,
             RelativeDirectory symbolFilePrefix,
             boolean useCache, String cacheLocation,
             boolean writeIndex) throws IOException {
         ZipFileIndex zi = getExistingZipIndex(zipFile);
 
-        if (zi == null || (zi != null && zipFile.lastModified() != zi.zipFileLastModified)) {
+        if (zi == null || (zi != null && Files.getLastModifiedTime(zipFile).toMillis() != zi.zipFileLastModified)) {
             zi = new ZipFileIndex(zipFile, symbolFilePrefix, writeIndex,
                     useCache, cacheLocation);
             map.put(zipFile, zi);
@@ -103,7 +104,7 @@ public class ZipFileIndexCache {
         return zi;
     }
 
-    public synchronized ZipFileIndex getExistingZipIndex(File zipFile) {
+    public synchronized ZipFileIndex getExistingZipIndex(Path zipFile) {
         return map.get(zipFile);
     }
 
@@ -112,7 +113,7 @@ public class ZipFileIndexCache {
     }
 
     public synchronized void clearCache(long timeNotUsed) {
-        for (File cachedFile : map.keySet()) {
+        for (Path cachedFile : map.keySet()) {
             ZipFileIndex cachedZipIndex = map.get(cachedFile);
             if (cachedZipIndex != null) {
                 long timeToTest = cachedZipIndex.lastReferenceTimeStamp + timeNotUsed;
@@ -124,7 +125,7 @@ public class ZipFileIndexCache {
         }
     }
 
-    public synchronized void removeFromCache(File file) {
+    public synchronized void removeFromCache(Path file) {
         map.remove(file);
     }
 
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
index 2dddaa17929..4dad7db041f 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
@@ -29,23 +29,27 @@ import java.io.*;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.nio.CharBuffer;
+import java.nio.file.Path;
 import java.util.Arrays;
 import java.util.EnumSet;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-import javax.tools.JavaFileObject;
-import javax.tools.JavaFileManager;
 
-import com.sun.tools.javac.comp.Annotate;
+import javax.tools.JavaFileManager;
+import javax.tools.JavaFileObject;
+
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Lint.LintCategory;
-import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.code.Type.*;
+import com.sun.tools.javac.comp.Annotate;
 import com.sun.tools.javac.file.BaseFileObject;
+import com.sun.tools.javac.jvm.ClassFile.NameAndType;
+import com.sun.tools.javac.jvm.ClassFile.Version;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
@@ -2481,7 +2485,7 @@ public class ClassReader {
         }
 
         @Override
-        protected String inferBinaryName(Iterable<? extends File> path) {
+        protected String inferBinaryName(Iterable<? extends Path> path) {
             return flatname.toString();
         }
 
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java
index ffa89f81475..909cb2b505d 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/main/Main.java
@@ -29,10 +29,10 @@ import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.net.URL;
+import java.nio.file.NoSuchFileException;
 import java.security.DigestInputStream;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
-
 import java.util.Set;
 
 import javax.tools.JavaFileManager;
@@ -168,7 +168,7 @@ public class Main {
 
         try {
             argv = CommandLine.parse(argv);
-        } catch (FileNotFoundException e) {
+        } catch (FileNotFoundException | NoSuchFileException e) {
             warning("err.file.not.found", e.getMessage());
             return Result.SYSERR;
         } catch (IOException ex) {
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java
index 9a05715f8e8..2bc84cca016 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java
@@ -30,12 +30,13 @@ import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
 import java.nio.charset.Charset;
-import java.nio.file.Files;
 import java.nio.file.FileSystem;
 import java.nio.file.FileSystems;
 import java.nio.file.FileVisitOption;
 import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.nio.file.SimpleFileVisitor;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.util.ArrayList;
@@ -48,6 +49,7 @@ import java.util.Iterator;
 import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
+
 import javax.lang.model.SourceVersion;
 import javax.tools.FileObject;
 import javax.tools.JavaFileManager;
@@ -55,9 +57,6 @@ import javax.tools.JavaFileObject;
 import javax.tools.JavaFileObject.Kind;
 import javax.tools.StandardLocation;
 
-import static java.nio.file.FileVisitOption.*;
-import static javax.tools.StandardLocation.*;
-
 import com.sun.tools.javac.util.BaseFileManager;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.DefinedBy;
@@ -65,6 +64,10 @@ import com.sun.tools.javac.util.DefinedBy.Api;
 import com.sun.tools.javac.util.List;
 import com.sun.tools.javac.util.ListBuffer;
 
+import static java.nio.file.FileVisitOption.*;
+
+import static javax.tools.StandardLocation.*;
+
 import static com.sun.tools.javac.main.Option.*;
 
 
@@ -221,7 +224,7 @@ public class JavacPathFileManager extends BaseFileManager implements PathFileMan
     }
 
     private void setDefaultForLocation(Location locn) {
-        Collection<File> files = null;
+        Collection<Path> files = null;
         if (locn instanceof StandardLocation) {
             switch ((StandardLocation) locn) {
                 case CLASS_PATH:
@@ -235,12 +238,12 @@ public class JavacPathFileManager extends BaseFileManager implements PathFileMan
                     break;
                 case CLASS_OUTPUT: {
                     String arg = options.get(D);
-                    files = (arg == null ? null : Collections.singleton(new File(arg)));
+                    files = (arg == null ? null : Collections.singleton(Paths.get(arg)));
                     break;
                 }
                 case SOURCE_OUTPUT: {
                     String arg = options.get(S);
-                    files = (arg == null ? null : Collections.singleton(new File(arg)));
+                    files = (arg == null ? null : Collections.singleton(Paths.get(arg)));
                     break;
                 }
             }
@@ -248,8 +251,8 @@ public class JavacPathFileManager extends BaseFileManager implements PathFileMan
 
         PathsForLocation pl = new PathsForLocation();
         if (files != null) {
-            for (File f: files)
-                pl.add(f.toPath());
+            for (Path f: files)
+                pl.add(f);
         }
         if (!pl.isEmpty())
             pathsForLocation.put(locn, pl);
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java
index d034dcbf095..2eba5b447cb 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/AbstractDiagnosticFormatter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
  */
 package com.sun.tools.javac.util;
 
+import java.nio.file.Path;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.EnumSet;
@@ -48,6 +49,7 @@ import com.sun.tools.javac.file.BaseFileObject;
 import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.javac.tree.JCTree.*;
 import com.sun.tools.javac.tree.Pretty;
+
 import static com.sun.tools.javac.util.JCDiagnostic.DiagnosticType.*;
 
 /**
@@ -186,7 +188,7 @@ public abstract class AbstractDiagnosticFormatter implements DiagnosticFormatter
         else if (arg instanceof JCExpression) {
             return expr2String((JCExpression)arg);
         }
-        else if (arg instanceof Iterable<?>) {
+        else if (arg instanceof Iterable<?> && !(arg instanceof Path)) {
             return formatIterable(d, (Iterable<?>)arg, l);
         }
         else if (arg instanceof Type) {
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java
index f346a41634b..c543782b888 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/RichDiagnosticFormatter.java
@@ -24,6 +24,7 @@
  */
 package com.sun.tools.javac.util;
 
+import java.nio.file.Path;
 import java.util.EnumMap;
 import java.util.EnumSet;
 import java.util.HashMap;
@@ -39,8 +40,8 @@ import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.code.Types;
 
-import static com.sun.tools.javac.code.TypeTag.*;
 import static com.sun.tools.javac.code.Flags.*;
+import static com.sun.tools.javac.code.TypeTag.*;
 import static com.sun.tools.javac.code.Kinds.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 import static com.sun.tools.javac.util.LayoutCharacters.*;
@@ -186,7 +187,7 @@ public class RichDiagnosticFormatter extends
         else if (arg instanceof JCDiagnostic) {
             preprocessDiagnostic((JCDiagnostic)arg);
         }
-        else if (arg instanceof Iterable<?>) {
+        else if (arg instanceof Iterable<?> && !(arg instanceof Path)) {
             for (Object o : (Iterable<?>)arg) {
                 preprocessArgument(o);
             }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/Gen.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/Gen.java
index 579f0e8c836..12dbe4d49e0 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/Gen.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/Gen.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,6 @@
 
 package com.sun.tools.javah;
 
-import java.io.UnsupportedEncodingException;
 import java.io.ByteArrayOutputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
@@ -33,6 +32,8 @@ import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
+import java.io.UnsupportedEncodingException;
+import java.nio.file.NoSuchFileException;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -40,7 +41,6 @@ import java.util.Set;
 import java.util.Stack;
 
 import javax.annotation.processing.ProcessingEnvironment;
-
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.Modifier;
 import javax.lang.model.element.TypeElement;
@@ -48,7 +48,6 @@ import javax.lang.model.element.VariableElement;
 import javax.lang.model.util.ElementFilter;
 import javax.lang.model.util.Elements;
 import javax.lang.model.util.Types;
-
 import javax.tools.FileObject;
 import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
@@ -204,7 +203,7 @@ public abstract class Gen {
                     event = "[Overwriting file ";
 
                 }
-            } catch (FileNotFoundException e) {
+            } catch (FileNotFoundException | NoSuchFileException e) {
                 mustWrite = true;
                 event = "[Creating file ";
             }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTask.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTask.java
index f51d616e214..b82a6368547 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTask.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javah/JavahTask.java
@@ -31,6 +31,7 @@ import java.io.IOException;
 import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.io.Writer;
+import java.nio.file.NoSuchFileException;
 import java.text.MessageFormat;
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -50,7 +51,6 @@ import javax.annotation.processing.Messager;
 import javax.annotation.processing.ProcessingEnvironment;
 import javax.annotation.processing.RoundEnvironment;
 import javax.annotation.processing.SupportedAnnotationTypes;
-
 import javax.lang.model.SourceVersion;
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.TypeElement;
@@ -62,7 +62,6 @@ import javax.lang.model.type.TypeVisitor;
 import javax.lang.model.util.ElementFilter;
 import javax.lang.model.util.SimpleTypeVisitor9;
 import javax.lang.model.util.Types;
-
 import javax.tools.Diagnostic;
 import javax.tools.DiagnosticListener;
 import javax.tools.JavaCompiler;
@@ -72,13 +71,15 @@ import javax.tools.JavaFileObject;
 import javax.tools.StandardJavaFileManager;
 import javax.tools.StandardLocation;
 import javax.tools.ToolProvider;
-import static javax.tools.Diagnostic.Kind.*;
 
 import com.sun.tools.javac.code.Symbol.CompletionFailure;
 import com.sun.tools.javac.main.CommandLine;
 import com.sun.tools.javac.util.DefinedBy;
 import com.sun.tools.javac.util.DefinedBy.Api;
 
+import static javax.tools.Diagnostic.Kind.*;
+
+
 /**
  * Javah generates support files for native methods.
  * Parse commandline options and invokes javadoc to execute those commands.
@@ -420,7 +421,7 @@ public class JavahTask implements NativeHeaderTool.NativeHeaderTask {
             List<String> l = new ArrayList<>();
             for (String arg: args) l.add(arg);
             return Arrays.asList(CommandLine.parse(l.toArray(new String[l.size()])));
-        } catch (FileNotFoundException e) {
+        } catch (FileNotFoundException | NoSuchFileException e) {
             throw new BadArgs("at.args.file.not.found", e.getLocalizedMessage());
         } catch (IOException e) {
             throw new BadArgs("at.args.io.exception", e.getLocalizedMessage());
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapTask.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapTask.java
index 59ddd6ba4df..413e4888d0b 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapTask.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapTask.java
@@ -36,6 +36,10 @@ import java.io.Reader;
 import java.io.StringWriter;
 import java.io.Writer;
 import java.net.URI;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.file.NoSuchFileException;
 import java.security.DigestInputStream;
 import java.security.MessageDigest;
 import java.security.NoSuchAlgorithmException;
@@ -61,10 +65,6 @@ import javax.tools.StandardJavaFileManager;
 import javax.tools.StandardLocation;
 
 import com.sun.tools.classfile.*;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-
 import com.sun.tools.javac.util.DefinedBy;
 import com.sun.tools.javac.util.DefinedBy.Api;
 
@@ -568,7 +568,7 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
             } catch (EOFException e) {
                 reportError("err.end.of.file", className);
                 result = EXIT_ERROR;
-            } catch (FileNotFoundException e) {
+            } catch (FileNotFoundException | NoSuchFileException e) {
                 reportError("err.file.not.found", e.getLocalizedMessage());
                 result = EXIT_ERROR;
             } catch (IOException e) {
@@ -668,9 +668,12 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
 
         if (fileManager instanceof StandardJavaFileManager) {
             StandardJavaFileManager sfm = (StandardJavaFileManager) fileManager;
-            fo = sfm.getJavaFileObjects(className).iterator().next();
-            if (fo != null && fo.getLastModified() != 0) {
-                return fo;
+            try {
+                fo = sfm.getJavaFileObjects(className).iterator().next();
+                if (fo != null && fo.getLastModified() != 0) {
+                    return fo;
+                }
+            } catch (IllegalArgumentException ignore) {
             }
         }
 
@@ -859,11 +862,15 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
     }
 
     private JavaFileObject getClassFileObject(String className) throws IOException {
-        JavaFileObject fo;
-        fo = fileManager.getJavaFileForInput(StandardLocation.PLATFORM_CLASS_PATH, className, JavaFileObject.Kind.CLASS);
-        if (fo == null)
-            fo = fileManager.getJavaFileForInput(StandardLocation.CLASS_PATH, className, JavaFileObject.Kind.CLASS);
-        return fo;
+        try {
+            JavaFileObject fo;
+            fo = fileManager.getJavaFileForInput(StandardLocation.PLATFORM_CLASS_PATH, className, JavaFileObject.Kind.CLASS);
+            if (fo == null)
+                fo = fileManager.getJavaFileForInput(StandardLocation.CLASS_PATH, className, JavaFileObject.Kind.CLASS);
+            return fo;
+        } catch (IllegalArgumentException e) {
+            return null;
+        }
     }
 
     private void showHelp() {
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
index 0300e409281..938f49f2f71 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java
@@ -26,16 +26,17 @@
 package com.sun.tools.sjavac;
 
 import java.io.*;
+import java.net.URI;
+import java.nio.file.NoSuchFileException;
+import java.text.SimpleDateFormat;
+import java.util.*;
 import java.util.Collections;
 import java.util.Date;
-import java.util.Set;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
-import java.util.HashMap;
-import java.text.SimpleDateFormat;
-import java.net.URI;
-import java.util.*;
+import java.util.Set;
 
 import com.sun.tools.sjavac.options.Options;
 import com.sun.tools.sjavac.server.Sjavac;
@@ -364,7 +365,7 @@ public class JavacState {
                     }
                 }
             }
-        } catch (FileNotFoundException e) {
+        } catch (FileNotFoundException | NoSuchFileException e) {
             // Silently create a new javac_state file.
             noFileFound = true;
         } catch (IOException e) {
@@ -841,7 +842,7 @@ public class JavacState {
                 }
                 listedSources.add(l);
             }
-        } catch (FileNotFoundException e) {
+        } catch (FileNotFoundException | NoSuchFileException e) {
             throw new ProblemException("Could not open "+makefileSourceList.getPath()+" since it does not exist!");
         } catch (IOException e) {
             throw new ProblemException("Could not read "+makefileSourceList.getPath());
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SmartFileObject.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SmartFileObject.java
index 81fd7153c72..c7ac09d5868 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SmartFileObject.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SmartFileObject.java
@@ -27,6 +27,8 @@ package com.sun.tools.sjavac.comp;
 
 import java.io.*;
 import java.net.URI;
+import java.nio.file.NoSuchFileException;
+
 import javax.lang.model.element.Modifier;
 import javax.lang.model.element.NestingKind;
 import javax.tools.JavaFileObject;
@@ -108,7 +110,7 @@ public class SmartFileObject implements JavaFileObject {
             while (r.ready()) {
                 s.append(r.readLine()+lineseparator);
             }
-        } catch (FileNotFoundException e) {
+        } catch (FileNotFoundException | NoSuchFileException e) {
             // Perfectly ok.
         }
         return new SmartWriter(file, s.toString(), file.getName(), stdout);
diff --git a/langtools/test/tools/javac/T6725036.java b/langtools/test/tools/javac/T6725036.java
index a2fd60bbce3..916cdab527a 100644
--- a/langtools/test/tools/javac/T6725036.java
+++ b/langtools/test/tools/javac/T6725036.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,7 @@ public class T6725036 {
         long jarEntryTime = je.getTime();
 
         ZipFileIndexCache zfic = ZipFileIndexCache.getSharedInstance();
-        ZipFileIndex zfi = zfic.getZipFileIndex(rt_jar, null, false, null, false);
+        ZipFileIndex zfi = zfic.getZipFileIndex(rt_jar.toPath(), null, false, null, false);
         long zfiTime = zfi.getLastModified(TEST_ENTRY_NAME);
 
         check(je, jarEntryTime, zfi + ":" + TEST_ENTRY_NAME.getPath(), zfiTime);
diff --git a/langtools/test/tools/javac/api/6440528/T6440528.java b/langtools/test/tools/javac/api/6440528/T6440528.java
index f0220121b35..70d11dde914 100644
--- a/langtools/test/tools/javac/api/6440528/T6440528.java
+++ b/langtools/test/tools/javac/api/6440528/T6440528.java
@@ -34,6 +34,7 @@
 
 import java.io.File;
 import java.lang.reflect.Field;
+import java.nio.file.Path;
 import java.util.Arrays;
 import static javax.tools.StandardLocation.CLASS_OUTPUT;
 import javax.tools.*;
@@ -59,10 +60,10 @@ public class T6440528 extends ToolTester {
         System.err.println("Got:      " + got);
     }
 
-    private File getUnderlyingFile(Object o) throws Exception {
-        Field file = o.getClass().getDeclaredField("file");
+    private File getUnderlyingFile(FileObject o) throws Exception {
+        Field file = o.getClass().getDeclaredField("file"); // assumes RegularFileObject
         file.setAccessible(true);
-        return (File)file.get(o);
+        return ((Path)file.get(o)).toFile();
     }
 
     public static void main(String... args) throws Exception {
diff --git a/langtools/test/tools/javac/api/TestJavacTask.java b/langtools/test/tools/javac/api/TestJavacTask.java
index 24efb7e17f8..2b61851d497 100644
--- a/langtools/test/tools/javac/api/TestJavacTask.java
+++ b/langtools/test/tools/javac/api/TestJavacTask.java
@@ -61,7 +61,10 @@ public class TestJavacTask {
         try {
             getTask(testFile);
         } catch (IllegalArgumentException iae) {
-            if (!iae.getMessage().contains("\"" + testFile.getName() + "\"")) {
+            // The following check is somewhat fragile, since the content of the ILA is not
+            // formally specified. If we want to fix this, we should catch/rewrap ILA coming
+            // from use of java.nio.file.Path inside javac's impl of JavaFileManager.
+            if (!iae.getMessage().contains(testFile.getName())) {
                 System.err.println("Got message: " + iae.getMessage());
                 throw new RuntimeException("Error: expected string not found");
             }
diff --git a/langtools/test/tools/javac/diags/Example.java b/langtools/test/tools/javac/diags/Example.java
index 1339f33a0f8..f4522cda193 100644
--- a/langtools/test/tools/javac/diags/Example.java
+++ b/langtools/test/tools/javac/diags/Example.java
@@ -321,12 +321,17 @@ class Example implements Comparable<Example> {
                     first = opts.get(0);
                     rest = opts.subList(1, opts.size()).toArray(new String[opts.size() - 1]);
                 }
+                // For more details on the different compilers,
+                // see their respective class doc comments.
+                // See also README.examples.txt in this directory.
                 if (first == null || first.equals("jsr199"))
                     return new Jsr199Compiler(verbose, rest);
                 else if (first.equals("simple"))
                     return new SimpleCompiler(verbose);
                 else if (first.equals("backdoor"))
                     return new BackdoorCompiler(verbose);
+                else if (first.equals("exec"))
+                    return new ExecCompiler(verbose);
                 else
                     throw new IllegalArgumentException(first);
             }
@@ -506,6 +511,84 @@ class Example implements Comparable<Example> {
         }
     }
 
+    /**
+     * Run the test in a separate process.
+     */
+    static class ExecCompiler extends Compiler {
+        ExecCompiler(boolean verbose) {
+            super(verbose);
+        }
+
+        @Override
+        boolean run(PrintWriter out, Set<String> keys, boolean raw, List<String> opts, List<File> files) {
+            if (out != null && keys != null)
+                throw new IllegalArgumentException();
+
+            if (verbose)
+                System.err.println("run_exec: " + opts + " " + files);
+
+            List<String> args = new ArrayList<String>();
+
+            File javaHome = new File(System.getProperty("java.home"));
+            if (javaHome.getName().equals("jre"))
+                javaHome = javaHome.getParentFile();
+            File javaExe = new File(new File(javaHome, "bin"), "java");
+            args.add(javaExe.getPath());
+
+            File toolsJar = new File(new File(javaHome, "lib"), "tools.jar");
+            if (toolsJar.exists()) {
+                args.add("-classpath");
+                args.add(toolsJar.getPath());
+            }
+
+            addOpts(args, "test.vm.opts");
+            addOpts(args, "test.java.opts");
+            args.add(com.sun.tools.javac.Main.class.getName());
+
+            if (keys != null || raw)
+                args.add("-XDrawDiagnostics");
+
+            args.addAll(opts);
+            for (File f: files)
+                args.add(f.getPath());
+
+            try {
+                ProcessBuilder pb = new ProcessBuilder(args);
+                pb.redirectErrorStream(true);
+                Process p = pb.start();
+                BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
+                String line;
+                while ((line = in.readLine()) != null) {
+                    if (keys != null)
+                        scanForKeys(line, keys);
+                }
+                int rc = p.waitFor();
+
+                return (rc == 0);
+            } catch (IOException | InterruptedException e) {
+                System.err.println("Exception execing javac" + e);
+                System.err.println("Command line: " + opts);
+                return false;
+            }
+        }
+
+        private static void scanForKeys(String text, Set<String> keys) {
+            StringTokenizer st = new StringTokenizer(text, " ,\r\n():");
+            while (st.hasMoreElements()) {
+                String t = st.nextToken();
+                if (t.startsWith("compiler."))
+                    keys.add(t);
+            }
+        }
+
+        private static void addOpts(List<String> args, String propName) {
+            String propValue = System.getProperty(propName);
+            if (propValue == null || propValue.isEmpty())
+                return;
+            args.addAll(Arrays.asList(propValue.split(" +", 0)));
+        }
+    }
+
     static class BackdoorCompiler extends Compiler {
         BackdoorCompiler(boolean verbose) {
             super(verbose);
diff --git a/langtools/test/tools/javac/diags/README.examples.txt b/langtools/test/tools/javac/diags/README.examples.txt
index c7dd4c90c51..d3a207552a5 100644
--- a/langtools/test/tools/javac/diags/README.examples.txt
+++ b/langtools/test/tools/javac/diags/README.examples.txt
@@ -123,6 +123,9 @@ different types of information may be given:
               is required to detect and track messages that bypass the normal
               diagnostic mechanisms, such as output generated by the -verbose
               option.
+    exec -- The example will be run in a subprocess. This mode is useful when
+              the example will leave files open, such that the only way to close
+              them is to exit the process.
 
 The "jsr199" run mode accepts the following options:
     -cantRead:pattern
diff --git a/langtools/test/tools/javac/diags/examples/ProcUnclosedTypeFiles/ProcUnclosedTypeFiles.java b/langtools/test/tools/javac/diags/examples/ProcUnclosedTypeFiles/ProcUnclosedTypeFiles.java
index 764e833b1df..eebfe8965cc 100644
--- a/langtools/test/tools/javac/diags/examples/ProcUnclosedTypeFiles/ProcUnclosedTypeFiles.java
+++ b/langtools/test/tools/javac/diags/examples/ProcUnclosedTypeFiles/ProcUnclosedTypeFiles.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,5 +23,6 @@
 
 // key: compiler.warn.proc.unclosed.type.files
 // options: -Xlint:processing -processor AnnoProc
+// run: exec
 
 class ProcUnclosedTypeFiles { }
diff --git a/langtools/test/tools/javac/file/T7018098.java b/langtools/test/tools/javac/file/T7018098.java
index bacc1160e82..0f5d263938d 100644
--- a/langtools/test/tools/javac/file/T7018098.java
+++ b/langtools/test/tools/javac/file/T7018098.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, 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
@@ -99,7 +99,7 @@ public class T7018098 extends JavacTestingAbstractProcessor {
         round++;
         if (round == 1) {
             boolean expect = Boolean.valueOf(options.get("expect"));
-            checkEqual("cache result", fsInfo.isDirectory(testDir), expect);
+            checkEqual("cache result", fsInfo.isDirectory(testDir.toPath()), expect);
             initialFSInfo = fsInfo;
         } else {
             checkEqual("fsInfo", fsInfo, initialFSInfo);
diff --git a/langtools/test/tools/javac/file/T7068437.java b/langtools/test/tools/javac/file/T7068437.java
index 86ae51fe46e..f0a74896ac0 100644
--- a/langtools/test/tools/javac/file/T7068437.java
+++ b/langtools/test/tools/javac/file/T7068437.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,6 +30,7 @@
 import java.io.FileNotFoundException;
 import java.io.IOException;
 import java.io.Writer;
+import java.nio.file.NoSuchFileException;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.Map;
@@ -104,7 +105,7 @@ public class T7068437 {
                 messager.printMessage(Kind.NOTE, "found previous content of length " +
                         filer.getResource(StandardLocation.SOURCE_OUTPUT, "p", "C.java").getCharContent(false).length());
                 found = true;
-            } catch (FileNotFoundException x) {
+            } catch (FileNotFoundException | NoSuchFileException x) {
                 messager.printMessage(Kind.NOTE, "not previously there");
                 found = false;
             } catch (IOException x) {
diff --git a/langtools/test/tools/javac/file/T7068451.java b/langtools/test/tools/javac/file/T7068451.java
index c56cccfe1c1..5a19ffc86ba 100644
--- a/langtools/test/tools/javac/file/T7068451.java
+++ b/langtools/test/tools/javac/file/T7068451.java
@@ -33,6 +33,7 @@ import java.io.FileNotFoundException;
 import java.io.FileWriter;
 import java.io.IOException;
 import java.io.Writer;
+import java.nio.file.NoSuchFileException;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
@@ -143,7 +144,7 @@ public class T7068451 {
             try {
                 int len = filer.getResource(StandardLocation.SOURCE_OUTPUT, "p", "C.java").getCharContent(false).length();
                 messager.printMessage(Kind.NOTE, "C.java: found previous content of length " + len);
-            } catch (FileNotFoundException x) {
+            } catch (FileNotFoundException | NoSuchFileException x) {
                 messager.printMessage(Kind.NOTE, "C.java: not previously there");
             } catch (IOException x) {
                 messager.printMessage(Kind.ERROR, "while reading: " + x);
diff --git a/langtools/test/tools/javac/links/LinksTest.java b/langtools/test/tools/javac/links/LinksTest.java
index 890ffa6b7c7..0c94cf1b6b5 100644
--- a/langtools/test/tools/javac/links/LinksTest.java
+++ b/langtools/test/tools/javac/links/LinksTest.java
@@ -30,6 +30,7 @@
  * @run main LinksTest
  */
 
+import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 
@@ -48,17 +49,24 @@ public class LinksTest {
         ToolBox tb = new ToolBox();
         tb.writeFile("tmp/B.java", BSrc);
 
+        // Try to set up a symbolic link for the test.
         try {
             Files.createSymbolicLink(Paths.get("a"), Paths.get("tmp"));
-
-            tb.new JavacTask()
-                    .sourcepath(".")
-                    .outdir(".")
-                    .sources(TSrc)
-                    .run();
-        } catch (UnsupportedOperationException e) {
-            System.err.println("Symbolic links not supported on this system. The test can't finish");
+            System.err.println("Created symbolic link");
+        } catch (UnsupportedOperationException | IOException e) {
+            System.err.println("Problem creating symbolic link: " + e);
+            System.err.println("Test cannot continue; test passed by default");
+            return;
         }
+
+        // If symbolic link was successfully created,
+        // try a compilation that will use it.
+        tb.new JavacTask()
+                .sourcepath(".")
+                .outdir(".")
+                .sources(TSrc)
+                .run()
+                .writeAll();
     }
 
 }
diff --git a/langtools/test/tools/javac/processing/errors/CrashOnNonExistingAnnotation/Processor.java b/langtools/test/tools/javac/processing/errors/CrashOnNonExistingAnnotation/Processor.java
index c89149265bf..1e0ce80c9d8 100644
--- a/langtools/test/tools/javac/processing/errors/CrashOnNonExistingAnnotation/Processor.java
+++ b/langtools/test/tools/javac/processing/errors/CrashOnNonExistingAnnotation/Processor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -88,7 +88,7 @@ public class Processor extends AbstractProcessor {
         if (!testFile.canRead()) throw new IllegalStateException("Cannot read the test source");
         JavacTool compiler = JavacTool.create();
         JavacFileManager fm = compiler.getStandardFileManager(null, null, null);
-        testContent = fm.getRegularFile(testFile).getCharContent(true).toString();
+        testContent = fm.getRegularFile(testFile.toPath()).getCharContent(true).toString();
         JavaFileObject testFileObject = new TestFO(new URI("mem://" + args[0]), testContent);
         TestFM testFileManager = new TestFM(fm);
         JavacTask task = compiler.getTask(null,
diff --git a/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/Processor.java b/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/Processor.java
index be90d983d0f..6e85a83e967 100644
--- a/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/Processor.java
+++ b/langtools/test/tools/javac/processing/errors/StopOnInapplicableAnnotations/Processor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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
@@ -71,7 +71,7 @@ public class Processor extends AbstractProcessor {
             File inp = new File(sp, args[0]);
 
             if (inp.canRead()) {
-                testContent = fm.getRegularFile(inp).getCharContent(true).toString();
+                testContent = fm.getRegularFile(inp.toPath()).getCharContent(true).toString();
             }
         }
         if (testContent == null) throw new IllegalStateException();
@@ -167,4 +167,4 @@ public class Processor extends AbstractProcessor {
         }
 
     }
-}
\ No newline at end of file
+}
diff --git a/langtools/test/tools/javac/unicode/SupplementaryJavaID6.java b/langtools/test/tools/javac/unicode/SupplementaryJavaID6.java
index 69b76ba4970..9a3cf918d29 100644
--- a/langtools/test/tools/javac/unicode/SupplementaryJavaID6.java
+++ b/langtools/test/tools/javac/unicode/SupplementaryJavaID6.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,8 @@
  * @bug 4914724 4973116 5014511
  * @summary Ensure that a supplementary character can be used as part/whole of a
  * class name on platforms that have Unicode aware filesystems.
- * @run main SupplementaryJavaID6
+ * @build Wrapper
+ * @run main Wrapper SupplementaryJavaID6
  */
 
 public class SupplementaryJavaID6 {
diff --git a/langtools/test/tools/javac/unicode/Wrapper.java b/langtools/test/tools/javac/unicode/Wrapper.java
new file mode 100644
index 00000000000..90544dc34ae
--- /dev/null
+++ b/langtools/test/tools/javac/unicode/Wrapper.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+import java.io.File;
+import java.lang.reflect.Method;
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.Arrays;
+
+
+public class Wrapper {
+    public static void main(String... args) throws Exception {
+        if (!isSupplementaryCharactersSupported()) {
+            System.out.println("Unicode supplementary characters in filenames not supported: pass by default");
+            return;
+        }
+
+        String testClassName = args[0];
+        String[] testArgs = Arrays.copyOfRange(args, 1, args.length);
+
+        File srcDir = new File(System.getProperty("test.src"));
+        File clsDir = new File(System.getProperty("test.classes"));
+
+        File src = new File(srcDir, testClassName + ".java");
+        File cls = new File(clsDir, testClassName + ".class");
+
+        if (cls.lastModified() < src.lastModified()) {
+            System.err.println("Recompiling test class...");
+            String[] javacArgs = { "-d", clsDir.getPath(), src.getPath() };
+            int rc = com.sun.tools.javac.Main.compile(javacArgs);
+            if (rc != 0)
+                throw new Exception("compilation failed");
+        }
+
+        Class<?> mainClass = Class.forName(testClassName);
+        Method main = mainClass.getMethod("main", String[].class);
+        main.invoke(null, new Object[] { testArgs });
+    }
+
+    private static boolean isSupplementaryCharactersSupported() {
+        try {
+            String s = "p--\ud801\udc00--";
+            System.err.println("Trying: Paths.get(" + s + ")");
+            Path p1 = Paths.get(s);
+            System.err.println("Found: " + p1);
+            System.err.println("Trying: p1.resolve(" + s + ")");
+            Path p2 = p1.resolve(s);
+            System.err.println("Found: " + p2);
+            return p1.toString().equals(s) && p2.toString().equals(s + java.io.File.separator + s);
+        } catch (InvalidPathException e) {
+            System.err.println(e);
+            return false;
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/warnings/suppress/VerifySuppressWarnings.java b/langtools/test/tools/javac/warnings/suppress/VerifySuppressWarnings.java
index dad2ebecd72..e5e3f6d8b54 100644
--- a/langtools/test/tools/javac/warnings/suppress/VerifySuppressWarnings.java
+++ b/langtools/test/tools/javac/warnings/suppress/VerifySuppressWarnings.java
@@ -74,7 +74,7 @@ public class VerifySuppressWarnings {
             File inp = new File(sp, args[0]);
 
             if (inp.canRead()) {
-                testContent = fm.getRegularFile(inp).getCharContent(true).toString();
+                testContent = fm.getRegularFile(inp.toPath()).getCharContent(true).toString();
             }
         }
         if (testContent == null) throw new IllegalStateException();
diff --git a/langtools/test/tools/javap/WhitespaceTest.java b/langtools/test/tools/javap/WhitespaceTest.java
index 3c9933a33e2..2b6bccb0eef 100644
--- a/langtools/test/tools/javap/WhitespaceTest.java
+++ b/langtools/test/tools/javap/WhitespaceTest.java
@@ -57,7 +57,7 @@ public class WhitespaceTest {
             if (line.endsWith(" "))
                 error("line has trailing whitespace: " + line);
             int comment = line.indexOf(doubleSlash);
-            if (comment > 0 && line.charAt(comment - 1) != ' ')
+            if (comment > 0 && line.charAt(comment - 1) != ' ' && !line.contains("file:///"))
                 error("no space before comment: " + line);
             if (line.matches(" +}"))
                 error("bad indentation: " + line);

From da2c303927c30e9fed1c6cd4677bd2250a1c4d38 Mon Sep 17 00:00:00 2001
From: Stuart Marks <smarks@openjdk.org>
Date: Fri, 21 Nov 2014 13:32:17 -0800
Subject: [PATCH 139/299] 8056313: TEST_BUG:
 java/util/Timer/NameConstructors.java fails intermittently

Reviewed-by: lancea, rriggs
---
 .../java/util/Timer/NameConstructors.java     | 41 +++++++++++--------
 1 file changed, 23 insertions(+), 18 deletions(-)

diff --git a/jdk/test/java/util/Timer/NameConstructors.java b/jdk/test/java/util/Timer/NameConstructors.java
index bc74522e473..fbf1649ef06 100644
--- a/jdk/test/java/util/Timer/NameConstructors.java
+++ b/jdk/test/java/util/Timer/NameConstructors.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,37 +23,42 @@
 
 /*
  * @test
- * @bug 4279061
+ * @bug 4279061 8056313
  * @summary Basic test for constructors with thread name
  */
 
-import java.util.*;
+import java.util.Timer;
+import java.util.TimerTask;
+import java.util.concurrent.LinkedTransferQueue;
 
 public class NameConstructors {
     private static final String NAME1 = "Norm D. Plume";
     private static final String NAME2 = "Ann Onymous";
 
-    public static void main (String[] args) throws Exception  {
-        Random rnd = new Random();
+    public static void main (String[] args) throws InterruptedException {
         test(new Timer(NAME1), NAME1);
         test(new Timer(NAME2, true), NAME2);
     }
 
-    private static boolean done, passed;
+    public static void test(Timer timer, String expected) throws InterruptedException {
+        try {
+            LinkedTransferQueue<String> queue = new LinkedTransferQueue<>();
 
-    public static void test(Timer timer, final String name) throws Exception {
-        done = passed = false;
+            TimerTask task = new TimerTask() {
+                public void run() {
+                    queue.put(Thread.currentThread().getName());
+                }
+            };
 
-        TimerTask task = new TimerTask() {
-            public void run() {
-                passed = Thread.currentThread().getName().equals(name);
-                done = true;
+            timer.schedule(task, 0L); // immediately
+            String actual = queue.take();
+
+            if (!expected.equals(actual)) {
+                throw new AssertionError(
+                    String.format("expected='%s', actual='%s'", expected, actual));
             }
-        };
-        timer.schedule(task, 0); // Immediate
-        Thread.sleep(500);
-        if (!(done && passed))
-            throw new RuntimeException(done + " : " + passed);
-        timer.cancel();
+        } finally {
+            timer.cancel();
+        }
     }
 }

From 590188542edb27c21a6e48ca863404fa13de485d Mon Sep 17 00:00:00 2001
From: Eric McCorkle <emc@openjdk.org>
Date: Fri, 21 Nov 2014 16:36:39 -0500
Subject: [PATCH 140/299] 8065132: Parameter annotations not updated when
 synthetic parameters are prepended

Cause javac to add synthetic parameters to Runtime[In]VisibleParameterAnnotations attributes

Reviewed-by: jjg, jfranck
---
 .../com/sun/tools/javac/jvm/ClassWriter.java  |  43 +-
 .../classfile/ClassfileInspector.java         | 927 ++++++++++++++++--
 .../annotations/SyntheticParameters.java      | 198 ++++
 .../classfile/SyntheticParameters.java        |   7 +-
 4 files changed, 1081 insertions(+), 94 deletions(-)
 rename langtools/test/{tools/javac/annotations/typeAnnotations => lib/annotations/annotations}/classfile/ClassfileInspector.java (52%)
 create mode 100644 langtools/test/tools/javac/annotations/SyntheticParameters.java

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
index 9f001ff6d9a..7fccb889041 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassWriter.java
@@ -640,6 +640,27 @@ public class ClassWriter extends ClassFile {
     }
 
 
+    private void writeParamAnnotations(List<VarSymbol> params,
+                                       RetentionPolicy retention) {
+        for (VarSymbol s : params) {
+            ListBuffer<Attribute.Compound> buf = new ListBuffer<>();
+            for (Attribute.Compound a : s.getRawAttributes())
+                if (types.getRetention(a) == retention)
+                    buf.append(a);
+            databuf.appendChar(buf.length());
+            for (Attribute.Compound a : buf)
+                writeCompoundAttribute(a);
+        }
+
+    }
+
+    private void writeParamAnnotations(MethodSymbol m,
+                                       RetentionPolicy retention) {
+        databuf.appendByte(m.params.length() + m.extraParams.length());
+        writeParamAnnotations(m.extraParams, retention);
+        writeParamAnnotations(m.params, retention);
+    }
+
     /** Write method parameter annotations;
      *  return number of attributes written.
      */
@@ -662,31 +683,13 @@ public class ClassWriter extends ClassFile {
         int attrCount = 0;
         if (hasVisible) {
             int attrIndex = writeAttr(names.RuntimeVisibleParameterAnnotations);
-            databuf.appendByte(m.params.length());
-            for (VarSymbol s : m.params) {
-                ListBuffer<Attribute.Compound> buf = new ListBuffer<>();
-                for (Attribute.Compound a : s.getRawAttributes())
-                    if (types.getRetention(a) == RetentionPolicy.RUNTIME)
-                        buf.append(a);
-                databuf.appendChar(buf.length());
-                for (Attribute.Compound a : buf)
-                    writeCompoundAttribute(a);
-            }
+            writeParamAnnotations(m, RetentionPolicy.RUNTIME);
             endAttr(attrIndex);
             attrCount++;
         }
         if (hasInvisible) {
             int attrIndex = writeAttr(names.RuntimeInvisibleParameterAnnotations);
-            databuf.appendByte(m.params.length());
-            for (VarSymbol s : m.params) {
-                ListBuffer<Attribute.Compound> buf = new ListBuffer<>();
-                for (Attribute.Compound a : s.getRawAttributes())
-                    if (types.getRetention(a) == RetentionPolicy.CLASS)
-                        buf.append(a);
-                databuf.appendChar(buf.length());
-                for (Attribute.Compound a : buf)
-                    writeCompoundAttribute(a);
-            }
+            writeParamAnnotations(m, RetentionPolicy.CLASS);
             endAttr(attrIndex);
             attrCount++;
         }
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileInspector.java b/langtools/test/lib/annotations/annotations/classfile/ClassfileInspector.java
similarity index 52%
rename from langtools/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileInspector.java
rename to langtools/test/lib/annotations/annotations/classfile/ClassfileInspector.java
index 864787e2f3a..85317a8dc0e 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/ClassfileInspector.java
+++ b/langtools/test/lib/annotations/annotations/classfile/ClassfileInspector.java
@@ -21,7 +21,8 @@
  * questions.
  */
 
-import java.lang.annotation.*;
+package annotations.classfile;
+
 import java.io.*;
 import java.net.URL;
 import java.util.List;
@@ -54,37 +55,109 @@ public class ClassfileInspector {
          * The expected class annotations.  These will be checked
          * against the class' attributes.
          */
-        public final ExpectedTypeAnnotation[] classAnnos;
+        public final ExpectedAnnotation[] classAnnos;
 
         /**
          * The expected method annotations.  These will be checked
          * against all methods in the class.
          */
-        public final ExpectedMethodTypeAnnotation[] methodAnnos;
+        public final ExpectedMethodAnnotation[] methodAnnos;
 
         /**
-         * The expected field annotations.  These will be checked
+         * The expected method parameter annotations.  These will be checked
+         * against all methods in the class.
+         */
+        public final ExpectedParameterAnnotation[] methodParamAnnos;
+
+        /**
+         * The expected field type annotations.  These will be checked
          * against all fields in the class.
          */
-        public final ExpectedFieldTypeAnnotation[] fieldAnnos;
+        public final ExpectedFieldAnnotation[] fieldAnnos;
 
         /**
-         * Create an {@code Expected} from its components.
+         * The expected class type annotations.  These will be checked
+         * against the class' attributes.
+         */
+        public final ExpectedTypeAnnotation[] classTypeAnnos;
+
+        /**
+         * The expected method type annotations.  These will be checked
+         * against all methods in the class.
+         */
+        public final ExpectedMethodTypeAnnotation[] methodTypeAnnos;
+
+        /**
+         * The expected field type annotations.  These will be checked
+         * against all fields in the class.
+         */
+        public final ExpectedFieldTypeAnnotation[] fieldTypeAnnos;
+
+        /**
+         * Create an {@code Expected} from all components.
          *
          * @param classname The name of the class to match, or {@code
          *                  null} for all classes.
          * @param classAnnos The expected class annotations.
          * @param methodAnnos The expected method annotations.
+         * @param methodParamAnnos The expected method parameter annotations.
          * @param fieldAnnos The expected field annotations.
+         * @param classTypeAnnos The expected class type annotations.
+         * @param methodTypeAnnos The expected method type annotations.
+         * @param fieldTypeAnnos The expected field type annotations.
          */
         public Expected(String classname,
-                        ExpectedTypeAnnotation[] classAnnos,
-                        ExpectedMethodTypeAnnotation[] methodAnnos,
-                        ExpectedFieldTypeAnnotation[] fieldAnnos) {
+                        ExpectedAnnotation[] classAnnos,
+                        ExpectedMethodAnnotation[] methodAnnos,
+                        ExpectedParameterAnnotation[] methodParamAnnos,
+                        ExpectedFieldAnnotation[] fieldAnnos,
+                        ExpectedTypeAnnotation[] classTypeAnnos,
+                        ExpectedMethodTypeAnnotation[] methodTypeAnnos,
+                        ExpectedFieldTypeAnnotation[] fieldTypeAnnos) {
             this.classname = classname;
             this.classAnnos = classAnnos;
             this.methodAnnos = methodAnnos;
+            this.methodParamAnnos = methodParamAnnos;
             this.fieldAnnos = fieldAnnos;
+            this.classTypeAnnos = classTypeAnnos;
+            this.methodTypeAnnos = methodTypeAnnos;
+            this.fieldTypeAnnos = fieldTypeAnnos;
+        }
+
+        /**
+         * Create an {@code Expected} from regular annotation components.
+         *
+         * @param classname The name of the class to match, or {@code
+         *                  null} for all classes.
+         * @param classAnnos The expected class annotations.
+         * @param methodAnnos The expected method annotations.
+         * @param methodParamAnnos The expected method parameter annotations.
+         * @param fieldAnnos The expected field annotations.
+         */
+        public Expected(String classname,
+                        ExpectedAnnotation[] classAnnos,
+                        ExpectedMethodAnnotation[] methodAnnos,
+                        ExpectedParameterAnnotation[] methodParamAnnos,
+                        ExpectedFieldAnnotation[] fieldAnnos) {
+            this(classname, classAnnos, methodAnnos, methodParamAnnos,
+                 fieldAnnos, null, null, null);
+        }
+
+        /**
+         * Create an {@code Expected} from type annotation components.
+         *
+         * @param classname The name of the class to match, or {@code
+         *                  null} for all classes.
+         * @param classTypeAnnos The expected class type annotations.
+         * @param methodTypeAnnos The expected method type annotations.
+         * @param fieldTypeAnnos The expected field type annotations.
+         */
+        public Expected(String classname,
+                        ExpectedTypeAnnotation[] classTypeAnnos,
+                        ExpectedMethodTypeAnnotation[] methodTypeAnnos,
+                        ExpectedFieldTypeAnnotation[] fieldTypeAnnos) {
+            this(classname, null, null, null, null,
+                 classTypeAnnos, methodTypeAnnos, fieldTypeAnnos);
         }
 
         public String toString() {
@@ -93,19 +166,43 @@ public class ClassfileInspector {
             sb.append("Expected on class ").append(classname);
             if (null != classAnnos) {
                 sb.append(newline).append("Class annotations:").append(newline);
-                for(ExpectedTypeAnnotation anno : classAnnos) {
+                for(ExpectedAnnotation anno : classAnnos) {
                     sb.append(anno).append(newline);
                 }
             }
             if (null != methodAnnos) {
                 sb.append(newline).append("Method annotations:").append(newline);
-                for(ExpectedTypeAnnotation anno : methodAnnos) {
+                for(ExpectedAnnotation anno : methodAnnos) {
+                    sb.append(anno).append(newline);
+                }
+            }
+            if (null != methodParamAnnos) {
+                sb.append(newline).append("Method param annotations:").append(newline);
+                for(ExpectedAnnotation anno : methodParamAnnos) {
                     sb.append(anno).append(newline);
                 }
             }
             if (null != fieldAnnos) {
                 sb.append(newline).append("Field annotations:").append(newline);
-                for(ExpectedTypeAnnotation anno : fieldAnnos) {
+                for(ExpectedAnnotation anno : fieldAnnos) {
+                    sb.append(anno).append(newline);
+                }
+            }
+            if (null != classTypeAnnos) {
+                sb.append(newline).append("Class type annotations:").append(newline);
+                for(ExpectedAnnotation anno : classTypeAnnos) {
+                    sb.append(anno).append(newline);
+                }
+            }
+            if (null != methodTypeAnnos) {
+                sb.append(newline).append("Method type annotations:").append(newline);
+                for(ExpectedAnnotation anno : methodTypeAnnos) {
+                    sb.append(anno).append(newline);
+                }
+            }
+            if (null != fieldTypeAnnos) {
+                sb.append(newline).append("Field type annotations:").append(newline);
+                for(ExpectedAnnotation anno : fieldTypeAnnos) {
                     sb.append(anno).append(newline);
                 }
             }
@@ -131,21 +228,49 @@ public class ClassfileInspector {
         public int check() {
             int count = 0;
             if (classAnnos != null) {
-                for(ExpectedTypeAnnotation expected : classAnnos) {
+                for(ExpectedAnnotation expected : classAnnos) {
                     if (!expected.check()) {
                         count++;
                     }
                 }
             }
             if (methodAnnos != null) {
-                for(ExpectedMethodTypeAnnotation expected : methodAnnos) {
+                for(ExpectedAnnotation expected : methodAnnos) {
+                    if (!expected.check()) {
+                        count++;
+                    }
+                }
+            }
+            if (methodParamAnnos != null) {
+                for(ExpectedAnnotation expected : methodParamAnnos) {
                     if (!expected.check()) {
                         count++;
                     }
                 }
             }
             if (fieldAnnos != null) {
-                for(ExpectedFieldTypeAnnotation expected : fieldAnnos) {
+                for(ExpectedAnnotation expected : fieldAnnos) {
+                    if (!expected.check()) {
+                        count++;
+                    }
+                }
+            }
+            if (classTypeAnnos != null) {
+                for(ExpectedAnnotation expected : classTypeAnnos) {
+                    if (!expected.check()) {
+                        count++;
+                    }
+                }
+            }
+            if (methodTypeAnnos != null) {
+                for(ExpectedAnnotation expected : methodTypeAnnos) {
+                    if (!expected.check()) {
+                        count++;
+                    }
+                }
+            }
+            if (fieldTypeAnnos != null) {
+                for(ExpectedAnnotation expected : fieldTypeAnnos) {
                     if (!expected.check()) {
                         count++;
                     }
@@ -155,22 +280,252 @@ public class ClassfileInspector {
         }
     }
 
+    /**
+     * An expected annotation.  This is both a superclass for
+     * method, field, and type annotations, as well as a class for
+     * annotations on a class.
+     */
+    public static class ExpectedAnnotation {
+        protected int count = 0;
+        protected final String expectedName;
+        protected final int expectedCount;
+        protected final boolean visibility;
+
+        /**
+         * Create an {@code ExpectedAnnotation} from its
+         * components.  It is usually a better idea to use a {@code
+         * Builder} to do this.
+         *
+         * @param expectedName The expected annotation name.
+         * @param visibility Whether this annotation should be runtime-visible.
+         * @param expectedCount The number of annotations that should
+         *                      be seen.  If 0, this asserts that the
+         *                      described annotation is not present.
+         */
+        public ExpectedAnnotation(String expectedName,
+                                  boolean visibility,
+                                  int expectedCount) {
+            this.expectedName = expectedName;
+            this.visibility = visibility;
+            this.expectedCount = expectedCount;
+        }
+
+        public String toString() {
+            final StringBuilder sb = new StringBuilder();
+            sb.append("Expected ");
+            sb.append(expectedCount);
+            sb.append(" annotation ");
+            sb.append(expectedName);
+            sb.append(visibility ? ", runtime visibile " : ", runtime invisibile ");
+            return sb.toString();
+        }
+
+        /**
+         * See if this template matches the given visibility.
+         *
+         * @param Whether or not the annotation is visible at runtime.
+         * @return Whether or not this template matches the visibility.
+         */
+        public boolean matchVisibility(boolean visibility) {
+            return this.visibility == visibility;
+        }
+
+        /**
+         * Attempty to match this template against an annotation.  If
+         * it does match, then the match count for the template will
+         * be incremented.  Otherwise, nothing will be done.
+         *
+         * @param anno The annotation to attempt to match.
+         */
+        public void matchAnnotation(ConstantPool cpool,
+                                    Annotation anno) {
+            if (checkMatch(cpool, anno)) {
+                count++;
+            }
+        }
+
+        /**
+         * Indicate whether an annotation matches this expected
+         * annotation.
+         *
+         * @param ConstantPool The constant pool to use.
+         * @param anno The annotation to check.
+         * @return Whether the annotation matches.
+         */
+        protected boolean checkMatch(ConstantPool cpool,
+                                     Annotation anno) {
+            try {
+                return cpool.getUTF8Info(anno.type_index).value.equals("L" + expectedName + ";");
+            } catch(Exception e) {
+                return false;
+            }
+        }
+
+        /**
+         * After all matching, check to see if the expected number of
+         * matches equals the actual number.  If not, then print a
+         * failure message and return {@code false}.
+         *
+         * @return Whether or not the expected number of matched
+         *         equals the actual number.
+         */
+        public boolean check() {
+            if (count != expectedCount) {
+                System.err.println(this + ", but saw " + count);
+                return false;
+            } else {
+                return true;
+            }
+        }
+    }
+
+    /**
+     * An annotation found on a method.
+     */
+    public static class ExpectedMethodAnnotation extends ExpectedAnnotation {
+        protected final String methodname;
+
+        /**
+         * Create an {@code ExpectedMethodAnnotation} from its
+         * components.  It is usually a better idea to use a {@code
+         * Builder} to do this.
+         *
+         * @param methodname The expected method name.
+         * @param expectedName The expected annotation name.
+         * @param visibility Whether this annotation should be runtime-visible.
+         * @param expectedCount The number of annotations that should be seen.
+         */
+        public ExpectedMethodAnnotation(String methodname,
+                                        String expectedName,
+                                        boolean visibility,
+                                        int expectedCount) {
+            super(expectedName, visibility, expectedCount);
+            this.methodname = methodname;
+        }
+
+        public String toString() {
+            final StringBuilder sb = new StringBuilder();
+            sb.append("Expected ");
+            sb.append(expectedCount);
+            sb.append(" annotation ");
+            sb.append(expectedName);
+            sb.append(visibility ? ", runtime visibile " : ", runtime invisibile ");
+            sb.append(" on method ");
+            sb.append(methodname);
+            return sb.toString();
+        }
+
+        /**
+         * See if this template applies to a method.
+         *
+         * @param methodname The method name to check.
+         * @return Whether or not this template should apply.
+         */
+        public boolean matchMethodName(String methodname) {
+            return this.methodname.equals(methodname);
+        }
+
+    }
+
+    /**
+     * An annotation found on a method parameter.
+     */
+    public static class ExpectedParameterAnnotation
+        extends ExpectedMethodAnnotation {
+        protected final int index;
+
+        /**
+         * Create an {@code ExpectedParameterAnnotation} from its
+         * components.  It is usually a better idea to use a {@code
+         * Builder} to do this.
+         *
+         * @param methodname The expected method name.
+         * @param index The parameter index.
+         * @param expectedName The expected annotation name.
+         * @param visibility Whether this annotation should be runtime-visible.
+         * @param expectedCount The number of annotations that should be seen.
+         */
+        public ExpectedParameterAnnotation(String methodname,
+                                           int index,
+                                           String expectedName,
+                                           boolean visibility,
+                                           int expectedCount) {
+            super(methodname, expectedName, visibility, expectedCount);
+            this.index = index;
+        }
+
+        public String toString() {
+            final StringBuilder sb = new StringBuilder();
+            sb.append("Expected ");
+            sb.append(expectedCount);
+            sb.append(" annotation ");
+            sb.append(expectedName);
+            sb.append(visibility ? ", runtime visibile " : ", runtime invisibile ");
+            sb.append(" on method ");
+            sb.append(methodname);
+            sb.append(" parameter " + index);
+            return sb.toString();
+        }
+
+    }
+
+    /**
+     * An annotation found on a field.
+     */
+    public static class ExpectedFieldAnnotation extends ExpectedAnnotation {
+        private final String fieldname;
+
+        /**
+         * Create an {@code ExpectedFieldAnnotation} from its
+         * components.  It is usually a better idea to use a {@code
+         * Builder} to do this.
+         *
+         * @param fieldname The expected field name.
+         * @param expectedName The expected annotation name.
+         * @param visibility Whether this annotation should be runtime-visible.
+         * @param expectedCount The number of annotations that should be seen.
+         */
+        public ExpectedFieldAnnotation(String fieldname,
+                                       String expectedName,
+                                       boolean visibility,
+                                       int expectedCount) {
+            super(expectedName, visibility, expectedCount);
+            this.fieldname = fieldname;
+        }
+
+        public String toString() {
+            final StringBuilder sb = new StringBuilder();
+            sb.append("Expected ").append(expectedCount)
+            .append(" annotation ").append(expectedName)
+            .append(visibility ? ", runtime visibile " : ", runtime invisibile ")
+            .append(" on field ").append(fieldname);
+            return sb.toString();
+        }
+
+        /**
+         * See if this template applies to a field.
+         *
+         * @param fieldname The field name to check.
+         * @return Whether or not this template should apply.
+         */
+        public boolean matchFieldName(String fieldname) {
+            return this.fieldname.equals(fieldname);
+        }
+
+    }
+
     /**
      * An expected type annotation.  This is both a superclass for
      * method and field type annotations, as well as a class for type
      * annotations on a class.
      */
-    public static class ExpectedTypeAnnotation {
-        private int count = 0;
-        protected final String expectedName;
-        protected final int expectedCount;
+    public static class ExpectedTypeAnnotation extends ExpectedAnnotation {
         protected final TypeAnnotation.TargetType targetType;
         protected final int bound_index;
         protected final int parameter_index;
         protected final int type_index;
         protected final int exception_index;
         protected final TypeAnnotation.Position.TypePathEntry[] typePath;
-        protected final boolean visibility;
 
         /**
          * Create an {@code ExpectedTypeAnnotation} from its
@@ -200,9 +555,7 @@ public class ClassfileInspector {
                                       int type_index,
                                       int exception_index,
                                       TypeAnnotation.Position.TypePathEntry... typePath) {
-            this.expectedName = expectedName;
-            this.visibility = visibility;
-            this.expectedCount = expectedCount;
+            super(expectedName, visibility, expectedCount);
             this.targetType = targetType;
             this.bound_index = bound_index;
             this.parameter_index = parameter_index;
@@ -238,31 +591,18 @@ public class ClassfileInspector {
             return sb.toString();
         }
 
-        /**
-         * See if this template matches the given visibility.
-         *
-         * @param Whether or not the annotation is visible at runtime.
-         * @return Whether or not this template matches the visibility.
-         */
-        public boolean matchVisibility(boolean visibility) {
-            return this.visibility == visibility;
+        @Override
+        public void matchAnnotation(ConstantPool cpool,
+                                    Annotation anno) {}
+
+        public void matchAnnotation(TypeAnnotation anno) {
+            if (checkMatch(anno)) {
+                count++;
+            }
         }
 
-        /**
-         * Attempty to match this template against an annotation.  If
-         * it does match, then the match count for the template will
-         * be incremented.  Otherwise, nothing will be done.
-         *
-         * @param anno The annotation to attempt to match.
-         */
-        public void matchAnnotation(TypeAnnotation anno) {
-            boolean matches = true;
-
-            try {
-                matches = anno.constant_pool.getUTF8Info(anno.annotation.type_index).value.equals("L" + expectedName + ";");
-            } catch(Exception e) {
-                matches = false;
-            }
+        public boolean checkMatch(TypeAnnotation anno) {
+            boolean matches = checkMatch(anno.constant_pool, anno.annotation);
 
             matches = matches && anno.position.type == targetType;
             matches = matches && anno.position.bound_index == bound_index;
@@ -279,26 +619,7 @@ public class ClassfileInspector {
                 }
             }
 
-            if (matches) {
-                count++;
-            }
-        }
-
-        /**
-         * After all matching, check to see if the expected number of
-         * matches equals the actual number.  If not, then print a
-         * failure message and return {@code false}.
-         *
-         * @return Whether or not the expected number of matched
-         *         equals the actual number.
-         */
-        public boolean check() {
-            if (count != expectedCount) {
-                System.err.println(this + ", but saw " + count);
-                return false;
-            } else {
-                return true;
-            }
+            return matches;
         }
 
         /**
@@ -311,9 +632,9 @@ public class ClassfileInspector {
          */
         public static class Builder {
             protected final String expectedName;
+            protected final boolean visibility;
             protected final int expectedCount;
             protected final TypeAnnotation.TargetType targetType;
-            protected final boolean visibility;
             protected int bound_index = Integer.MIN_VALUE;
             protected int parameter_index = Integer.MIN_VALUE;
             protected int type_index = Integer.MIN_VALUE;
@@ -648,6 +969,50 @@ public class ClassfileInspector {
         }
     }
 
+    private void matchClassAnnotation(ClassFile classfile,
+                                      ExpectedAnnotation expected)
+        throws ConstantPoolException {
+        for(Attribute attr : classfile.attributes) {
+            attr.accept(annoMatcher(classfile.constant_pool), expected);
+        }
+    }
+
+    private void matchMethodAnnotation(ClassFile classfile,
+                                       ExpectedMethodAnnotation expected)
+        throws ConstantPoolException {
+        for(Method meth : classfile.methods) {
+            if (expected.matchMethodName(meth.getName(classfile.constant_pool))) {
+                for(Attribute attr : meth.attributes) {
+                    attr.accept(annoMatcher(classfile.constant_pool), expected);
+                }
+            }
+        }
+    }
+
+    private void matchParameterAnnotation(ClassFile classfile,
+                                          ExpectedParameterAnnotation expected)
+        throws ConstantPoolException {
+        for(Method meth : classfile.methods) {
+            if (expected.matchMethodName(meth.getName(classfile.constant_pool))) {
+                for(Attribute attr : meth.attributes) {
+                    attr.accept(paramMatcher(classfile.constant_pool), expected);
+                }
+            }
+        }
+    }
+
+    private void matchFieldAnnotation(ClassFile classfile,
+                                      ExpectedFieldAnnotation expected)
+        throws ConstantPoolException {
+        for(Field field : classfile.fields) {
+            if (expected.matchFieldName(field.getName(classfile.constant_pool))) {
+                for(Attribute attr : field.attributes) {
+                    attr.accept(annoMatcher(classfile.constant_pool), expected);
+                }
+            }
+        }
+    }
+
     private void matchClassTypeAnnotation(ClassFile classfile,
                                           ExpectedTypeAnnotation expected)
         throws ConstantPoolException {
@@ -680,6 +1045,38 @@ public class ClassfileInspector {
         }
     }
 
+    private void matchClassAnnotations(ClassFile classfile,
+                                       ExpectedAnnotation[] expected)
+        throws ConstantPoolException {
+        for(ExpectedAnnotation one : expected) {
+            matchClassAnnotation(classfile, one);
+        }
+    }
+
+    private void matchMethodAnnotations(ClassFile classfile,
+                                        ExpectedMethodAnnotation[] expected)
+        throws ConstantPoolException {
+        for(ExpectedMethodAnnotation one : expected) {
+            matchMethodAnnotation(classfile, one);
+        }
+    }
+
+    private void matchParameterAnnotations(ClassFile classfile,
+                                           ExpectedParameterAnnotation[] expected)
+        throws ConstantPoolException {
+        for(ExpectedParameterAnnotation one : expected) {
+            matchParameterAnnotation(classfile, one);
+        }
+    }
+
+    private void matchFieldAnnotations(ClassFile classfile,
+                                       ExpectedFieldAnnotation[] expected)
+        throws ConstantPoolException {
+        for(ExpectedFieldAnnotation one : expected) {
+            matchFieldAnnotation(classfile, one);
+        }
+    }
+
     private void matchClassTypeAnnotations(ClassFile classfile,
                                            ExpectedTypeAnnotation[] expected)
         throws ConstantPoolException {
@@ -729,11 +1126,19 @@ public class ClassfileInspector {
             for(Expected one : expected) {
                 if (one.matchClassName(classfile.getName())) {
                     if (one.classAnnos != null)
-                        matchClassTypeAnnotations(classfile, one.classAnnos);
+                        matchClassAnnotations(classfile, one.classAnnos);
                     if (one.methodAnnos != null)
-                        matchMethodTypeAnnotations(classfile, one.methodAnnos);
+                        matchMethodAnnotations(classfile, one.methodAnnos);
+                    if (one.methodParamAnnos != null)
+                        matchParameterAnnotations(classfile, one.methodParamAnnos);
                     if (one.fieldAnnos != null)
-                        matchFieldTypeAnnotations(classfile, one.fieldAnnos);
+                        matchFieldAnnotations(classfile, one.fieldAnnos);
+                    if (one.classTypeAnnos != null)
+                        matchClassTypeAnnotations(classfile, one.classTypeAnnos);
+                    if (one.methodTypeAnnos != null)
+                        matchMethodTypeAnnotations(classfile, one.methodTypeAnnos);
+                    if (one.fieldTypeAnnos != null)
+                        matchFieldTypeAnnotations(classfile, one.fieldTypeAnnos);
                 }
             }
         }
@@ -751,11 +1156,13 @@ public class ClassfileInspector {
      * Get a {@code ClassFile} from its file name.
      *
      * @param name The class' file name.
+     * @param host A class in the same package.
      * @return The {@code ClassFile}
      */
-    public static ClassFile getClassFile(String name)
+    public static ClassFile getClassFile(String name,
+                                         Class<?> host)
         throws IOException, ConstantPoolException {
-        final URL url = ClassfileInspector.class.getResource(name);
+        final URL url = host.getResource(name);
         final InputStream in = url.openStream();
         try {
             return ClassFile.read(in);
@@ -947,4 +1354,380 @@ public class ClassfileInspector {
             return null;
         }
     };
+
+    private static Attribute.Visitor<Void, ExpectedAnnotation> annoMatcher(ConstantPool cpool) {
+        return new Attribute.Visitor<Void, ExpectedAnnotation>() {
+
+            @Override
+                public Void visitBootstrapMethods(BootstrapMethods_attribute attr,
+                                                  ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitDefault(DefaultAttribute attr,
+                                         ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitAnnotationDefault(AnnotationDefault_attribute attr,
+                                                   ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr,
+                                                     ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitCode(Code_attribute attr,
+                                      ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitCompilationID(CompilationID_attribute attr,
+                                               ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitConstantValue(ConstantValue_attribute attr,
+                                               ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitDeprecated(Deprecated_attribute attr,
+                                            ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitEnclosingMethod(EnclosingMethod_attribute attr,
+                                                 ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitExceptions(Exceptions_attribute attr,
+                                            ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitInnerClasses(InnerClasses_attribute attr,
+                                              ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitLineNumberTable(LineNumberTable_attribute attr,
+                                                 ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitLocalVariableTable(LocalVariableTable_attribute attr,
+                                                    ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr,
+                                                        ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitMethodParameters(MethodParameters_attribute attr,
+                                                  ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr,
+                                                                    ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr,
+                                                                      ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr,
+                                                               ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr,
+                                                                 ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitSignature(Signature_attribute attr,
+                                           ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitSourceDebugExtension(SourceDebugExtension_attribute attr,
+                                                      ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitSourceFile(SourceFile_attribute attr,
+                                            ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitSourceID(SourceID_attribute attr,
+                                          ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitStackMap(StackMap_attribute attr,
+                                          ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitStackMapTable(StackMapTable_attribute attr,
+                                               ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitSynthetic(Synthetic_attribute attr,
+                                           ExpectedAnnotation expected) {
+                return null;
+            }
+
+            @Override
+            public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr,
+                                                       ExpectedAnnotation expected) {
+                if (expected.matchVisibility(true)) {
+                    for(Annotation anno : attr.annotations) {
+                        expected.matchAnnotation(cpool, anno);
+                    }
+                }
+
+                return null;
+            }
+
+            @Override
+            public Void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr,
+                                                         ExpectedAnnotation expected) {
+                if (expected.matchVisibility(false)) {
+                    for(Annotation anno : attr.annotations) {
+                        expected.matchAnnotation(cpool, anno);
+                    }
+                }
+
+                return null;
+            }
+        };
+    }
+
+    private static Attribute.Visitor<Void, ExpectedParameterAnnotation> paramMatcher(ConstantPool cpool) {
+        return new Attribute.Visitor<Void, ExpectedParameterAnnotation>() {
+
+            @Override
+                public Void visitBootstrapMethods(BootstrapMethods_attribute attr,
+                                                  ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitDefault(DefaultAttribute attr,
+                                         ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitAnnotationDefault(AnnotationDefault_attribute attr,
+                                                   ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitCharacterRangeTable(CharacterRangeTable_attribute attr,
+                                                     ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitCode(Code_attribute attr,
+                                      ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitCompilationID(CompilationID_attribute attr,
+                                               ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitConstantValue(ConstantValue_attribute attr,
+                                               ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitDeprecated(Deprecated_attribute attr,
+                                            ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitEnclosingMethod(EnclosingMethod_attribute attr,
+                                                 ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitExceptions(Exceptions_attribute attr,
+                                            ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitInnerClasses(InnerClasses_attribute attr,
+                                              ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitLineNumberTable(LineNumberTable_attribute attr,
+                                                 ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitLocalVariableTable(LocalVariableTable_attribute attr,
+                                                    ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitLocalVariableTypeTable(LocalVariableTypeTable_attribute attr,
+                                                        ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitMethodParameters(MethodParameters_attribute attr,
+                                                  ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+            public Void visitRuntimeVisibleAnnotations(RuntimeVisibleAnnotations_attribute attr,
+                                                       ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+            public Void visitRuntimeInvisibleAnnotations(RuntimeInvisibleAnnotations_attribute attr,
+                                                         ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitRuntimeVisibleTypeAnnotations(RuntimeVisibleTypeAnnotations_attribute attr,
+                                                               ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitRuntimeInvisibleTypeAnnotations(RuntimeInvisibleTypeAnnotations_attribute attr,
+                                                                 ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitSignature(Signature_attribute attr,
+                                           ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitSourceDebugExtension(SourceDebugExtension_attribute attr,
+                                                      ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitSourceFile(SourceFile_attribute attr,
+                                            ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitSourceID(SourceID_attribute attr,
+                                          ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitStackMap(StackMap_attribute attr,
+                                          ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitStackMapTable(StackMapTable_attribute attr,
+                                               ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+                public Void visitSynthetic(Synthetic_attribute attr,
+                                           ExpectedParameterAnnotation expected) {
+                return null;
+            }
+
+            @Override
+            public Void visitRuntimeVisibleParameterAnnotations(RuntimeVisibleParameterAnnotations_attribute attr,
+                                                                ExpectedParameterAnnotation expected) {
+                if (expected.matchVisibility(true)) {
+                    if (expected.index < attr.parameter_annotations.length) {
+                        for(Annotation anno :
+                                attr.parameter_annotations[expected.index]) {
+                            expected.matchAnnotation(cpool, anno);
+                        }
+                    }
+                }
+
+                return null;
+            }
+
+            @Override
+            public Void visitRuntimeInvisibleParameterAnnotations(RuntimeInvisibleParameterAnnotations_attribute attr,
+                                                                  ExpectedParameterAnnotation expected) {
+                if (expected.matchVisibility(false)) {
+                    if (expected.index < attr.parameter_annotations.length) {
+                        for(Annotation anno :
+                                attr.parameter_annotations[expected.index]) {
+                            expected.matchAnnotation(cpool, anno);
+                        }
+                    }
+                }
+
+                return null;
+            }
+        };
+    }
 }
diff --git a/langtools/test/tools/javac/annotations/SyntheticParameters.java b/langtools/test/tools/javac/annotations/SyntheticParameters.java
new file mode 100644
index 00000000000..7c70df2db0b
--- /dev/null
+++ b/langtools/test/tools/javac/annotations/SyntheticParameters.java
@@ -0,0 +1,198 @@
+/*
+ * Copyright (c) 2014, 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 SyntheticParameters
+ * @bug 8065132
+ * @summary Test generation of annotations on inner class parameters.
+ * @library /lib/annotations/
+ * @run main SyntheticParameters
+ */
+
+import annotations.classfile.ClassfileInspector;
+
+import java.io.*;
+import java.lang.annotation.*;
+
+import com.sun.tools.classfile.*;
+
+public class SyntheticParameters extends ClassfileInspector {
+
+    private static final String Inner_class = "SyntheticParameters$Inner.class";
+    private static final String Foo_class = "SyntheticParameters$Foo.class";
+    private static final Expected Inner_expected =
+        new Expected("SyntheticParameters$Inner",
+                     null,
+                     null,
+                     new ExpectedParameterAnnotation[] {
+                         (ExpectedParameterAnnotation)
+                         // Assert there is no annotation on the
+                         // this$0 parameter.
+                         new ExpectedParameterAnnotation(
+                             "<init>",
+                             0,
+                             "A",
+                             true,
+                             0),
+                         (ExpectedParameterAnnotation)
+                         // Assert there is an annotation on the
+                         // first parameter.
+                         new ExpectedParameterAnnotation(
+                             "<init>",
+                             1,
+                             "A",
+                             true,
+                             1),
+                         (ExpectedParameterAnnotation)
+                         new ExpectedParameterAnnotation(
+                             "foo",
+                             0,
+                             "A",
+                             true,
+                             1),
+                         (ExpectedParameterAnnotation)
+                         new ExpectedParameterAnnotation(
+                             "foo",
+                             1,
+                             "A",
+                             true,
+                             0),
+                         (ExpectedParameterAnnotation)
+                         // Assert there is no annotation on the
+                         // this$0 parameter.
+                         new ExpectedParameterAnnotation(
+                             "<init>",
+                             0,
+                             "B",
+                             false,
+                             0),
+                         (ExpectedParameterAnnotation)
+                         // Assert there is an annotation on the
+                         // first parameter.
+                         new ExpectedParameterAnnotation(
+                             "<init>",
+                             1,
+                             "B",
+                             false,
+                             1),
+                         (ExpectedParameterAnnotation)
+                         new ExpectedParameterAnnotation(
+                             "foo",
+                             0,
+                             "B",
+                             false,
+                             1),
+                         (ExpectedParameterAnnotation)
+                         new ExpectedParameterAnnotation(
+                             "foo",
+                             1,
+                             "B",
+                             false,
+                             0)
+                     },
+                     null);
+    private static final Expected Foo_expected =
+        new Expected("SyntheticParameters$Foo",
+                     null,
+                     null,
+                     new ExpectedParameterAnnotation[] {
+                         (ExpectedParameterAnnotation)
+                         // Assert there is no annotation on the
+                         // $enum$name parameter.
+                         new ExpectedParameterAnnotation(
+                             "<init>",
+                             0,
+                             "A",
+                             true,
+                             0),
+                         (ExpectedParameterAnnotation)
+                         // Assert there is no annotation on the
+                         // $enum$ordinal parameter.
+                         new ExpectedParameterAnnotation(
+                             "<init>",
+                             1,
+                             "A",
+                             true,
+                             0),
+                         (ExpectedParameterAnnotation)
+                         // Assert there is an annotation on the
+                         // first parameter.
+                         new ExpectedParameterAnnotation(
+                             "<init>",
+                             2,
+                             "A",
+                             true,
+                             1),
+                         (ExpectedParameterAnnotation)
+                         // Assert there is no annotation on the
+                         // $enum$name parameter.
+                         new ExpectedParameterAnnotation(
+                             "<init>",
+                             0,
+                             "B",
+                             false,
+                             0),
+                         (ExpectedParameterAnnotation)
+                         // Assert there is no annotation on the
+                         // $enum$ordinal parameter.
+                         new ExpectedParameterAnnotation(
+                             "<init>",
+                             1,
+                             "B",
+                             false,
+                             0),
+                         (ExpectedParameterAnnotation)
+                         // Assert there is an annotation on the
+                         // first parameter.
+                         new ExpectedParameterAnnotation(
+                             "<init>",
+                             2,
+                             "B",
+                             false,
+                             1)
+                     },
+                     null);
+
+    public static void main(String... args) throws Exception {
+        new SyntheticParameters().run(
+            new ClassFile[] { getClassFile(Inner_class, Inner.class),
+                              getClassFile(Foo_class, Foo.class) },
+            new Expected[] { Inner_expected, Foo_expected });
+    }
+
+    public class Inner {
+        public Inner(@A @B int a) {}
+        public void foo(@A @B int a, int b) {}
+    }
+
+    public static enum Foo {
+        ONE(null);
+        Foo(@A @B Object a) {}
+    }
+}
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface A {}
+
+@Retention(RetentionPolicy.CLASS)
+@interface B {}
diff --git a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/SyntheticParameters.java b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/SyntheticParameters.java
index 35477d21086..a747fc8f0b2 100644
--- a/langtools/test/tools/javac/annotations/typeAnnotations/classfile/SyntheticParameters.java
+++ b/langtools/test/tools/javac/annotations/typeAnnotations/classfile/SyntheticParameters.java
@@ -24,10 +24,12 @@
 /*
  * @test SyntheticParameters
  * @summary Test generation of annotations on inner class parameters.
- * @build ClassfileInspector
+ * @library /lib/annotations/
  * @run main SyntheticParameters
  */
 
+import annotations.classfile.ClassfileInspector;
+
 import java.io.*;
 import java.lang.annotation.*;
 
@@ -111,7 +113,8 @@ public class SyntheticParameters extends ClassfileInspector {
 
     public static void main(String... args) throws Exception {
         new SyntheticParameters().run(
-            new ClassFile[] { getClassFile(Inner_class), getClassFile(Foo_class) },
+            new ClassFile[] { getClassFile(Inner_class, Inner.class),
+                              getClassFile(Foo_class, Foo.class) },
             new Expected[] { Inner_expected, Foo_expected });
     }
 

From 5ffaffb47eeb6b58d71979b9c620da369e467260 Mon Sep 17 00:00:00 2001
From: Martin Buchholz <martin@openjdk.org>
Date: Fri, 21 Nov 2014 16:30:02 -0800
Subject: [PATCH 141/299] 8065159: AttributedString has quadratic resize
 algorithm

Grow backing arrays geometrically instead of arithmetically

Reviewed-by: naoto, okutsu
---
 .../classes/java/text/AttributedString.java   | 53 ++++++++-----------
 1 file changed, 23 insertions(+), 30 deletions(-)

diff --git a/jdk/src/java.base/share/classes/java/text/AttributedString.java b/jdk/src/java.base/share/classes/java/text/AttributedString.java
index 2e82924510a..daceb62a70f 100644
--- a/jdk/src/java.base/share/classes/java/text/AttributedString.java
+++ b/jdk/src/java.base/share/classes/java/text/AttributedString.java
@@ -48,21 +48,18 @@ import java.text.AttributedCharacterIterator.Attribute;
  */
 
 public class AttributedString {
-
-    // since there are no vectors of int, we have to use arrays.
-    // We allocate them in chunks of 10 elements so we don't have to allocate all the time.
-    private static final int ARRAY_SIZE_INCREMENT = 10;
-
     // field holding the text
     String text;
 
-    // fields holding run attribute information
-    // run attributes are organized by run
-    int runArraySize;               // current size of the arrays
-    int runCount;                   // actual number of runs, <= runArraySize
-    int runStarts[];                // start index for each run
-    Vector<Attribute> runAttributes[];         // vector of attribute keys for each run
-    Vector<Object> runAttributeValues[];    // parallel vector of attribute values for each run
+    // Fields holding run attribute information.
+    // Run attributes are organized by run.
+    // Arrays are always of equal lengths (the current capacity).
+    // Since there are no vectors of int, we have to use arrays.
+    private static final int INITIAL_CAPACITY = 10;
+    int runCount;                   // actual number of runs, <= current capacity
+    int[] runStarts;                // start index for each run
+    Vector<Attribute>[] runAttributes;   // vector of attribute keys for each run
+    Vector<Object>[] runAttributeValues; // parallel vector of attribute values for each run
 
     /**
      * Constructs an AttributedString instance with the given
@@ -416,18 +413,17 @@ public class AttributedString {
 
     private final void createRunAttributeDataVectors() {
         // use temporary variables so things remain consistent in case of an exception
-        int newRunStarts[] = new int[ARRAY_SIZE_INCREMENT];
+        int[] newRunStarts = new int[INITIAL_CAPACITY];
 
         @SuppressWarnings("unchecked")
-        Vector<Attribute> newRunAttributes[] = (Vector<Attribute>[]) new Vector<?>[ARRAY_SIZE_INCREMENT];
+        Vector<Attribute>[] newRunAttributes = (Vector<Attribute>[]) new Vector<?>[INITIAL_CAPACITY];
 
         @SuppressWarnings("unchecked")
-        Vector<Object> newRunAttributeValues[] = (Vector<Object>[]) new Vector<?>[ARRAY_SIZE_INCREMENT];
+        Vector<Object>[] newRunAttributeValues = (Vector<Object>[]) new Vector<?>[INITIAL_CAPACITY];
 
         runStarts = newRunStarts;
         runAttributes = newRunAttributes;
         runAttributeValues = newRunAttributeValues;
-        runArraySize = ARRAY_SIZE_INCREMENT;
         runCount = 1; // assume initial run starting at index 0
     }
 
@@ -465,25 +461,22 @@ public class AttributedString {
 
         // we'll have to break up a run
         // first, make sure we have enough space in our arrays
-        if (runCount == runArraySize) {
-            int newArraySize = runArraySize + ARRAY_SIZE_INCREMENT;
-            int newRunStarts[] = new int[newArraySize];
+        int currentCapacity = runStarts.length;
+        if (runCount == currentCapacity) {
+            // We need to resize - we grow capacity by 25%.
+            int newCapacity = currentCapacity + (currentCapacity >> 2);
 
-            @SuppressWarnings("unchecked")
-            Vector<Attribute> newRunAttributes[] = (Vector<Attribute>[]) new Vector<?>[newArraySize];
+            // use temporary variables so things remain consistent in case of an exception
+            int[] newRunStarts =
+                Arrays.copyOf(runStarts, newCapacity);
+            Vector<Attribute>[] newRunAttributes =
+                Arrays.copyOf(runAttributes, newCapacity);
+            Vector<Object>[] newRunAttributeValues =
+                Arrays.copyOf(runAttributeValues, newCapacity);
 
-            @SuppressWarnings("unchecked")
-            Vector<Object> newRunAttributeValues[] = (Vector<Object>[]) new Vector<?>[newArraySize];
-
-            for (int i = 0; i < runArraySize; i++) {
-                newRunStarts[i] = runStarts[i];
-                newRunAttributes[i] = runAttributes[i];
-                newRunAttributeValues[i] = runAttributeValues[i];
-            }
             runStarts = newRunStarts;
             runAttributes = newRunAttributes;
             runAttributeValues = newRunAttributeValues;
-            runArraySize = newArraySize;
         }
 
         // make copies of the attribute information of the old run that the new one used to be part of

From e3e615d6bdced6b25e009d6d3d87b4fd4a60e6d5 Mon Sep 17 00:00:00 2001
From: Mark Sheppard <msheppar@openjdk.org>
Date: Sat, 22 Nov 2014 14:56:16 +0000
Subject: [PATCH 142/299] 8065222: sun/net/www/protocol/http/B6369510.java
 doesn't execute as expected

Changed address.getHostName() to InetAddress.getLocalHost().getHostName() in URL construction in test's doClient method

Reviewed-by: chegar
---
 jdk/test/sun/net/www/protocol/http/B6369510.java | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/jdk/test/sun/net/www/protocol/http/B6369510.java b/jdk/test/sun/net/www/protocol/http/B6369510.java
index 6d71e819892..c8aa023c636 100644
--- a/jdk/test/sun/net/www/protocol/http/B6369510.java
+++ b/jdk/test/sun/net/www/protocol/http/B6369510.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@ public class B6369510
     com.sun.net.httpserver.HttpServer httpServer;
     ExecutorService executorService;
 
-    public static void main(String[] args)
+    public static void main(String[] args) throws Exception
     {
         new B6369510();
     }
@@ -58,13 +58,15 @@ public class B6369510
     void doClient() {
         try {
             InetSocketAddress address = httpServer.getAddress();
+            String urlString = "http://" + InetAddress.getLocalHost().getHostName() + ":" + address.getPort() + "/test/";
+            System.out.println("URL == " + urlString);
 
             // GET Request
-            URL url = new URL("http://" + address.getHostName() + ":" + address.getPort() + "/test/");
+            URL url = new URL("http://" + InetAddress.getLocalHost().getHostName() + ":" + address.getPort() + "/test/");
             HttpURLConnection uc = (HttpURLConnection)url.openConnection();
             int resp = uc.getResponseCode();
             if (resp != 200)
-                throw new RuntimeException("Failed: Response code from GET is not 200");
+                throw new RuntimeException("Failed: Response code from GET is not 200 RSP == " + resp);
 
             System.out.println("Response code from GET = 200 OK");
 
@@ -75,12 +77,13 @@ public class B6369510
             OutputStream os = uc.getOutputStream();
             resp = uc.getResponseCode();
             if (resp != 200)
-                throw new RuntimeException("Failed: Response code form POST is not 200");
+                throw new RuntimeException("Failed: Response code form POST is not 200 RSP == " + resp);
 
             System.out.println("Response code from POST = 200 OK");
 
         } catch (IOException e) {
             e.printStackTrace();
+            throw new RuntimeException("Failed with IOException");
         } finally {
             httpServer.stop(1);
             executorService.shutdown();

From c7b43102bc89a4aedd9bad7b14bb831753febb6e Mon Sep 17 00:00:00 2001
From: Erik Joelsson <erikj@openjdk.org>
Date: Mon, 24 Nov 2014 11:40:49 +0100
Subject: [PATCH 143/299] 8065412: generated source to compile .properties file
 incorreectly includes the module name in the package name

Reviewed-by: tbell, mchung, ihse
---
 jdk/make/gensrc/GensrcProperties.gmk | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/jdk/make/gensrc/GensrcProperties.gmk b/jdk/make/gensrc/GensrcProperties.gmk
index 0b0520c6fd9..6d7e1cc8489 100644
--- a/jdk/make/gensrc/GensrcProperties.gmk
+++ b/jdk/make/gensrc/GensrcProperties.gmk
@@ -58,13 +58,15 @@ define SetupCompileProperties
   $1_CLASS := $3
 
   # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
-  # to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
+  # to .../support/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
   # Strip away prefix and suffix, leaving for example only: 
   # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
   $1_JAVAS := $$(patsubst $(JDK_TOPDIR)/src/%, \
       $(JDK_OUTPUTDIR)/gensrc/%, \
       $$(patsubst %.properties, %.java, \
-      $$(subst /share/classes,, $$($1_SRCS))))
+      $$(subst /$(OPENJDK_TARGET_OS)/classes,, \
+      $$(subst /$(OPENJDK_TARGET_OS_TYPE)/classes,, \
+      $$(subst /share/classes,, $$($1_SRCS))))))
 
   # Generate the package dirs for the to be generated java files. Sort to remove
   # duplicates.

From 26298f1124f15e809857122b84821b672f05e79e Mon Sep 17 00:00:00 2001
From: Jan Lahoda <jlahoda@openjdk.org>
Date: Mon, 24 Nov 2014 16:02:35 +0100
Subject: [PATCH 144/299] 8032211: Don't issue deprecation warnings on import
 statements 6598104: javac should not warn about imports of deprecated classes

Suppressing the deprecation warnings when importing a deprecated element (deprecations in import qualifier will be produced).

Reviewed-by: darcy, jjg, mcimadamore
---
 .../com/sun/tools/javac/code/Lint.java        | 10 +++++++
 .../com/sun/tools/javac/code/Source.java      |  3 ++
 .../com/sun/tools/javac/comp/MemberEnter.java | 10 +++++++
 .../warnings/6594914/ImplicitCompilation.java |  4 +--
 .../tools/javac/warnings/Deprecation.java     | 10 ++++---
 .../javac/warnings/Deprecation.lintAll.out    |  3 --
 .../warnings/Deprecation.lintDeprecation.out  |  4 +--
 .../warnings/Deprecation.lintDeprecation8.out |  4 +++
 .../NestedDeprecation/NestedDeprecation.java  | 29 +++++++++++++++++++
 .../NestedDeprecation/NestedDeprecation.out   |  9 ++++++
 .../warnings/NestedDeprecation/p/Dep1.java    | 12 ++++++++
 .../warnings/NestedDeprecation/p/Dep2.java    |  8 +++++
 .../javac/warnings/suppress/ImplicitTest.java |  2 +-
 .../javac/warnings/suppress/PackageInfo.java  |  2 +-
 14 files changed, 97 insertions(+), 13 deletions(-)
 delete mode 100644 langtools/test/tools/javac/warnings/Deprecation.lintAll.out
 create mode 100644 langtools/test/tools/javac/warnings/Deprecation.lintDeprecation8.out
 create mode 100644 langtools/test/tools/javac/warnings/NestedDeprecation/NestedDeprecation.java
 create mode 100644 langtools/test/tools/javac/warnings/NestedDeprecation/NestedDeprecation.out
 create mode 100644 langtools/test/tools/javac/warnings/NestedDeprecation/p/Dep1.java
 create mode 100644 langtools/test/tools/javac/warnings/NestedDeprecation/p/Dep2.java

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java
index 8bd11e71522..52f9bec3379 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Lint.java
@@ -80,6 +80,16 @@ public class Lint
         return l;
     }
 
+    /**
+     * Returns a new Lint that has the given LintCategory suppressed.
+     */
+    public Lint suppress(LintCategory lc) {
+        Lint l = new Lint(this);
+        l.values.remove(lc);
+        l.suppressedValues.add(lc);
+        return l;
+    }
+
     private final AugmentVisitor augmentor;
 
     private final EnumSet<LintCategory> values;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
index 5efa7a8efbe..0af7fce16af 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
@@ -152,6 +152,9 @@ public enum Source {
     public boolean allowStringsInSwitch() {
         return compareTo(JDK1_7) >= 0;
     }
+    public boolean allowDeprecationOnImport() {
+        return compareTo(JDK1_9) < 0;
+    }
     public boolean allowSimplifiedVarargs() {
         return compareTo(JDK1_7) >= 0;
     }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
index e064a225875..b63132cd39b 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
@@ -33,6 +33,7 @@ import java.util.Set;
 import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Lint.LintCategory;
 import com.sun.tools.javac.code.Scope.ImportFilter;
 import com.sun.tools.javac.code.Scope.NamedImportScope;
 import com.sun.tools.javac.code.Scope.StarImportScope;
@@ -123,12 +124,18 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
         typeEnvs = TypeEnvs.instance(context);
         dependencies = Dependencies.instance(context);
         allowTypeAnnos = source.allowTypeAnnotations();
+        allowDeprecationOnImport = source.allowDeprecationOnImport();
     }
 
     /** Switch: support type annotations.
      */
     boolean allowTypeAnnos;
 
+    /**
+     * Switch: should deprecation warnings be issued on import
+     */
+    boolean allowDeprecationOnImport;
+
     /** A queue for classes whose members still need to be entered into the
      *  symbol table.
      */
@@ -771,6 +778,8 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
 
     Type attribImportType(JCTree tree, Env<AttrContext> env) {
         Assert.check(completionEnabled);
+        Lint prevLint = chk.setLint(allowDeprecationOnImport ?
+                lint : lint.suppress(LintCategory.DEPRECATION));
         try {
             // To prevent deep recursion, suppress completion of some
             // types.
@@ -778,6 +787,7 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
             return attr.attribType(tree, env);
         } finally {
             completionEnabled = true;
+            chk.setLint(prevLint);
         }
     }
 
diff --git a/langtools/test/tools/javac/warnings/6594914/ImplicitCompilation.java b/langtools/test/tools/javac/warnings/6594914/ImplicitCompilation.java
index 6bf41567f5a..81626e9db3d 100644
--- a/langtools/test/tools/javac/warnings/6594914/ImplicitCompilation.java
+++ b/langtools/test/tools/javac/warnings/6594914/ImplicitCompilation.java
@@ -3,9 +3,9 @@
  * @bug 8020586
  * @summary Warnings in the imports section should be attributed to the correct source file
  * @clean Auxiliary ImplicitCompilation
- * @compile/ref=ImplicitCompilation.out -XDrawDiagnostics -Xlint:deprecation -sourcepath . ImplicitCompilation.java
+ * @compile/ref=ImplicitCompilation.out -source 8 -XDrawDiagnostics -Xlint:deprecation,-options -sourcepath . ImplicitCompilation.java
  * @clean Auxiliary ImplicitCompilation
- * @compile/ref=ExplicitCompilation.out -XDrawDiagnostics -Xlint:deprecation ImplicitCompilation.java Auxiliary.java
+ * @compile/ref=ExplicitCompilation.out -source 8 -XDrawDiagnostics -Xlint:deprecation,-options ImplicitCompilation.java Auxiliary.java
  */
 
 public class ImplicitCompilation {
diff --git a/langtools/test/tools/javac/warnings/Deprecation.java b/langtools/test/tools/javac/warnings/Deprecation.java
index 09e80ca2726..87a9f6285a4 100644
--- a/langtools/test/tools/javac/warnings/Deprecation.java
+++ b/langtools/test/tools/javac/warnings/Deprecation.java
@@ -1,11 +1,13 @@
 /**
  * @test  /nodynamiccopyright/
- * @bug 4986256
- * @compile/ref=Deprecation.noLint.out                             -XDrawDiagnostics Deprecation.java
- * @compile/ref=Deprecation.lintDeprecation.out -Xlint:deprecation -XDrawDiagnostics Deprecation.java
- * @compile/ref=Deprecation.lintAll.out         -Xlint:all,-path   -XDrawDiagnostics Deprecation.java
+ * @bug 4986256 6598104 8032211
+ * @compile/ref=Deprecation.noLint.out                                                 -XDrawDiagnostics Deprecation.java
+ * @compile/ref=Deprecation.lintDeprecation.out  -Xlint:deprecation                    -XDrawDiagnostics Deprecation.java
+ * @compile/ref=Deprecation.lintDeprecation8.out -Xlint:deprecation,-options -source 8 -XDrawDiagnostics Deprecation.java
  */
 
+import java.io.StringBufferInputStream;
+
 @Deprecated
 class Deprecation
 {
diff --git a/langtools/test/tools/javac/warnings/Deprecation.lintAll.out b/langtools/test/tools/javac/warnings/Deprecation.lintAll.out
deleted file mode 100644
index e778c0cba23..00000000000
--- a/langtools/test/tools/javac/warnings/Deprecation.lintAll.out
+++ /dev/null
@@ -1,3 +0,0 @@
-Deprecation.java:18:24: compiler.warn.has.been.deprecated: Deprecation, compiler.misc.unnamed.package
-Deprecation.java:55:24: compiler.warn.has.been.deprecated: Deprecation, compiler.misc.unnamed.package
-2 warnings
diff --git a/langtools/test/tools/javac/warnings/Deprecation.lintDeprecation.out b/langtools/test/tools/javac/warnings/Deprecation.lintDeprecation.out
index e778c0cba23..eff2019707d 100644
--- a/langtools/test/tools/javac/warnings/Deprecation.lintDeprecation.out
+++ b/langtools/test/tools/javac/warnings/Deprecation.lintDeprecation.out
@@ -1,3 +1,3 @@
-Deprecation.java:18:24: compiler.warn.has.been.deprecated: Deprecation, compiler.misc.unnamed.package
-Deprecation.java:55:24: compiler.warn.has.been.deprecated: Deprecation, compiler.misc.unnamed.package
+Deprecation.java:20:24: compiler.warn.has.been.deprecated: Deprecation, compiler.misc.unnamed.package
+Deprecation.java:57:24: compiler.warn.has.been.deprecated: Deprecation, compiler.misc.unnamed.package
 2 warnings
diff --git a/langtools/test/tools/javac/warnings/Deprecation.lintDeprecation8.out b/langtools/test/tools/javac/warnings/Deprecation.lintDeprecation8.out
new file mode 100644
index 00000000000..d3da0f1b6f9
--- /dev/null
+++ b/langtools/test/tools/javac/warnings/Deprecation.lintDeprecation8.out
@@ -0,0 +1,4 @@
+Deprecation.java:9:15: compiler.warn.has.been.deprecated: java.io.StringBufferInputStream, java.io
+Deprecation.java:20:24: compiler.warn.has.been.deprecated: Deprecation, compiler.misc.unnamed.package
+Deprecation.java:57:24: compiler.warn.has.been.deprecated: Deprecation, compiler.misc.unnamed.package
+3 warnings
diff --git a/langtools/test/tools/javac/warnings/NestedDeprecation/NestedDeprecation.java b/langtools/test/tools/javac/warnings/NestedDeprecation/NestedDeprecation.java
new file mode 100644
index 00000000000..2e41f72b58b
--- /dev/null
+++ b/langtools/test/tools/javac/warnings/NestedDeprecation/NestedDeprecation.java
@@ -0,0 +1,29 @@
+/**
+ * @test  /nodynamiccopyright/
+ * @bug 6598104 8032211
+ * @build p.Dep1 p.Dep2
+ * @compile/ref=NestedDeprecation.out -Xlint:deprecation -XDrawDiagnostics NestedDeprecation.java
+ */
+
+package p;
+
+import p.Dep1.A;
+import static p.Dep1.B;
+import static p.Dep1.method;
+import static p.Dep1.field;
+import p.Dep2.C;
+import p.Dep2.D;
+
+class NestedDeprecation {
+    Dep1 f1;
+    A f2;
+    Dep2 f3;
+    B f4;
+    C f5;
+    D f6;
+
+    static {
+        method();
+        String f = field;
+    }
+}
diff --git a/langtools/test/tools/javac/warnings/NestedDeprecation/NestedDeprecation.out b/langtools/test/tools/javac/warnings/NestedDeprecation/NestedDeprecation.out
new file mode 100644
index 00000000000..21c3e534c17
--- /dev/null
+++ b/langtools/test/tools/javac/warnings/NestedDeprecation/NestedDeprecation.out
@@ -0,0 +1,9 @@
+NestedDeprecation.java:14:9: compiler.warn.has.been.deprecated: p.Dep2, p
+NestedDeprecation.java:15:9: compiler.warn.has.been.deprecated: p.Dep2, p
+NestedDeprecation.java:19:5: compiler.warn.has.been.deprecated: p.Dep1.A, p.Dep1
+NestedDeprecation.java:20:5: compiler.warn.has.been.deprecated: p.Dep2, p
+NestedDeprecation.java:21:5: compiler.warn.has.been.deprecated: p.Dep1.B, p.Dep1
+NestedDeprecation.java:23:5: compiler.warn.has.been.deprecated: p.Dep2.D, p.Dep2
+NestedDeprecation.java:26:9: compiler.warn.has.been.deprecated: method(), p.Dep1
+NestedDeprecation.java:27:20: compiler.warn.has.been.deprecated: field, p.Dep1
+8 warnings
diff --git a/langtools/test/tools/javac/warnings/NestedDeprecation/p/Dep1.java b/langtools/test/tools/javac/warnings/NestedDeprecation/p/Dep1.java
new file mode 100644
index 00000000000..563585c4d2d
--- /dev/null
+++ b/langtools/test/tools/javac/warnings/NestedDeprecation/p/Dep1.java
@@ -0,0 +1,12 @@
+package p;
+
+class Dep1 {
+    @Deprecated
+    static class A { }
+    @Deprecated
+    static class B { }
+    @Deprecated
+    static void method() { }
+    @Deprecated
+    static String field;
+}
diff --git a/langtools/test/tools/javac/warnings/NestedDeprecation/p/Dep2.java b/langtools/test/tools/javac/warnings/NestedDeprecation/p/Dep2.java
new file mode 100644
index 00000000000..3a7b6f7b4ac
--- /dev/null
+++ b/langtools/test/tools/javac/warnings/NestedDeprecation/p/Dep2.java
@@ -0,0 +1,8 @@
+package p;
+
+@Deprecated
+class Dep2 {
+    class C { }
+    @Deprecated
+    class D { }
+}
diff --git a/langtools/test/tools/javac/warnings/suppress/ImplicitTest.java b/langtools/test/tools/javac/warnings/suppress/ImplicitTest.java
index 1c4208ca902..b8e532a1f25 100644
--- a/langtools/test/tools/javac/warnings/suppress/ImplicitTest.java
+++ b/langtools/test/tools/javac/warnings/suppress/ImplicitTest.java
@@ -27,5 +27,5 @@
  * @summary Verify that deprecated warning is printed correctly for import
  *          statement when processing a file on demand while attributing another file.
  * @clean pack.ImplicitUse pack.ImplicitMain pack.Dep
- * @compile/ref=ImplicitTest.out -XDrawDiagnostics -Xlint:deprecation pack/ImplicitMain.java
+ * @compile/ref=ImplicitTest.out -source 8 -XDrawDiagnostics -Xlint:deprecation,-options pack/ImplicitMain.java
  */
diff --git a/langtools/test/tools/javac/warnings/suppress/PackageInfo.java b/langtools/test/tools/javac/warnings/suppress/PackageInfo.java
index 98a93102a7c..3979a0faa53 100644
--- a/langtools/test/tools/javac/warnings/suppress/PackageInfo.java
+++ b/langtools/test/tools/javac/warnings/suppress/PackageInfo.java
@@ -26,5 +26,5 @@
  * @bug 8021112
  * @summary Verify that deprecated warnings are printed correctly for package-info.java
  * @clean pack.package-info pack.DeprecatedClass
- * @compile/ref=PackageInfo.out -XDrawDiagnostics -Xlint:deprecation pack/package-info.java pack/DeprecatedClass.java
+ * @compile/ref=PackageInfo.out -source 8 -XDrawDiagnostics -Xlint:deprecation,-options pack/package-info.java pack/DeprecatedClass.java
  */

From 96da5b9ce34eb1bd72fbc350107719108d9a52ef Mon Sep 17 00:00:00 2001
From: Daniel Fuchs <dfuchs@openjdk.org>
Date: Mon, 24 Nov 2014 17:02:37 +0100
Subject: [PATCH 145/299] 8060132: Handlers configured on abstract nodes in
 logging.properties are not always properly closed

Loggers which have been configured with a handler in the configuration file will be retained by the LogManager until reset() is called. A new configuration property is added to explicitely turn the fix off.

Reviewed-by: mchung
---
 .../classes/java/util/logging/LogManager.java |  69 ++-
 .../ParentLoggerWithHandlerGC.java            | 517 ++++++++++++++++++
 2 files changed, 580 insertions(+), 6 deletions(-)
 create mode 100644 jdk/test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java

diff --git a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java
index 45f2c054bd6..3cf6842c871 100644
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java
@@ -31,6 +31,7 @@ import java.util.*;
 import java.security.*;
 import java.lang.ref.ReferenceQueue;
 import java.lang.ref.WeakReference;
+import java.util.concurrent.CopyOnWriteArrayList;
 import sun.misc.JavaAWTAccess;
 import sun.misc.SharedSecrets;
 
@@ -100,6 +101,19 @@ import sun.misc.SharedSecrets;
  * Note that these Handlers may be created lazily, when they are
  * first used.
  *
+ * <li>A property "&lt;logger&gt;.handlers.ensureCloseOnReset". This defines a
+ * a boolean value. If "&lt;logger&gt;.handlers" is not defined or is empty,
+ * this property is ignored. Otherwise it defaults to {@code true}. When the
+ * value is {@code true}, the handlers associated with the logger are guaranteed
+ * to be closed on {@linkplain #reset} and shutdown. This can be turned off
+ * by explicitly setting "&lt;logger&gt;.handlers.ensureCloseOnReset=false" in
+ * the configuration. Note that turning this property off causes the risk of
+ * introducing a resource leak, as the logger may get garbage collected before
+ * {@code reset()} is called, thus preventing its handlers from being closed
+ * on {@code reset()}. In that case it is the responsibility of the application
+ * to ensure that the handlers are closed before the logger is garbage
+ * collected.
+ *
  * <li>A property "&lt;logger&gt;.useParentHandlers". This defines a boolean
  * value. By default every logger calls its parent in addition to
  * handling the logging message itself, this often result in messages
@@ -169,6 +183,33 @@ public class LogManager {
     // True if JVM death is imminent and the exit hook has been called.
     private boolean deathImminent;
 
+    // This list contains the loggers for which some handlers have been
+    // explicitly configured in the configuration file.
+    // It prevents these loggers from being arbitrarily garbage collected.
+    private static final class CloseOnReset {
+        private final Logger logger;
+        private CloseOnReset(Logger ref) {
+            this.logger = Objects.requireNonNull(ref);
+        }
+        @Override
+        public boolean equals(Object other) {
+            return (other instanceof CloseOnReset) && ((CloseOnReset)other).logger == logger;
+        }
+        @Override
+        public int hashCode() {
+            return System.identityHashCode(logger);
+        }
+        public Logger get() {
+            return logger;
+        }
+        public static CloseOnReset create(Logger logger) {
+            return new CloseOnReset(logger);
+        }
+    }
+    private final CopyOnWriteArrayList<CloseOnReset> closeOnResetLoggers =
+            new CopyOnWriteArrayList<>();
+
+
     private final Map<Object, Runnable> listeners =
             Collections.synchronizedMap(new IdentityHashMap<>());
 
@@ -204,7 +245,6 @@ public class LogManager {
         });
     }
 
-
     // This private class is used as a shutdown hook.
     // It does a "reset" to close all open handlers.
     private class Cleaner extends Thread {
@@ -875,30 +915,39 @@ public class LogManager {
             @Override
             public Object run() {
                 String names[] = parseClassNames(handlersPropertyName);
-                for (String word : names) {
+                final boolean ensureCloseOnReset = names.length > 0
+                    && getBooleanProperty(handlersPropertyName + ".ensureCloseOnReset",true);
+
+                int count = 0;
+                for (String type : names) {
                     try {
-                        Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(word);
+                        Class<?> clz = ClassLoader.getSystemClassLoader().loadClass(type);
                         Handler hdl = (Handler) clz.newInstance();
                         // Check if there is a property defining the
                         // this handler's level.
-                        String levs = getProperty(word + ".level");
+                        String levs = getProperty(type + ".level");
                         if (levs != null) {
                             Level l = Level.findLevel(levs);
                             if (l != null) {
                                 hdl.setLevel(l);
                             } else {
                                 // Probably a bad level. Drop through.
-                                System.err.println("Can't set level for " + word);
+                                System.err.println("Can't set level for " + type);
                             }
                         }
                         // Add this Handler to the logger
                         logger.addHandler(hdl);
+                        if (++count == 1 && ensureCloseOnReset) {
+                            // add this logger to the closeOnResetLoggers list.
+                            closeOnResetLoggers.addIfAbsent(CloseOnReset.create(logger));
+                        }
                     } catch (Exception ex) {
-                        System.err.println("Can't load log handler \"" + word + "\"");
+                        System.err.println("Can't load log handler \"" + type + "\"");
                         System.err.println("" + ex);
                         ex.printStackTrace();
                     }
                 }
+
                 return null;
             }
         });
@@ -1233,8 +1282,15 @@ public class LogManager {
 
     public void reset() throws SecurityException {
         checkPermission();
+        List<CloseOnReset> persistent;
         synchronized (this) {
             props = new Properties();
+            // make sure we keep the loggers persistent until reset is done.
+            // Those are the loggers for which we previously created a
+            // handler from the configuration, and we need to prevent them
+            // from being gc'ed until those handlers are closed.
+            persistent = new ArrayList<>(closeOnResetLoggers);
+            closeOnResetLoggers.clear();
             // Since we are doing a reset we no longer want to initialize
             // the global handlers, if they haven't been initialized yet.
             initializedGlobalHandlers = true;
@@ -1249,6 +1305,7 @@ public class LogManager {
                 }
             }
         }
+        persistent.clear();
     }
 
     // Private method to reset an individual target logger.
diff --git a/jdk/test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java b/jdk/test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java
new file mode 100644
index 00000000000..491d7583243
--- /dev/null
+++ b/jdk/test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java
@@ -0,0 +1,517 @@
+/*
+ * Copyright (c) 2014, 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.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FilePermission;
+import java.io.IOException;
+import java.lang.ref.Reference;
+import java.lang.ref.ReferenceQueue;
+import java.lang.ref.WeakReference;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+import java.util.Set;
+import java.util.UUID;
+import java.util.concurrent.Callable;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.logging.FileHandler;
+import java.util.logging.Handler;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+import java.util.logging.LoggingPermission;
+
+/**
+ * @test
+ * @bug 8060132
+ * @summary tests that FileHandlers configured on abstract nodes in logging.properties
+ *          will be closed by reset().
+ * @run main/othervm ParentLoggerWithHandlerGC UNSECURE
+ * @run main/othervm ParentLoggerWithHandlerGC SECURE
+ * @author danielfuchs
+ */
+public class ParentLoggerWithHandlerGC {
+
+    /**
+     * We will test the handling of abstract logger nodes with file handlers in
+     * two configurations:
+     * UNSECURE: No security manager.
+     * SECURE: With the security manager present - and the required
+     *         permissions granted.
+     */
+    public static enum TestCase {
+        UNSECURE, SECURE;
+        public void run(Properties propertyFile) throws Exception {
+            System.out.println("Running test case: " + name());
+            Configure.setUp(this, propertyFile);
+            test(this.name() + " " + propertyFile.getProperty("test.name"), propertyFile);
+        }
+    }
+
+
+    private static final String PREFIX =
+            "FileHandler-" + UUID.randomUUID() + ".log";
+    private static final String userDir = System.getProperty("user.dir", ".");
+    private static final boolean userDirWritable = Files.isWritable(Paths.get(userDir));
+
+    static enum ConfigMode { DEFAULT, ENSURE_CLOSE_ON_RESET_TRUE, ENSURE_CLOSE_ON_RESET_FALSE }
+
+    private static final List<Properties> properties;
+    static {
+        Properties props1 = new Properties();
+        props1.setProperty("test.name", "parent logger with handler");
+        props1.setProperty("test.config.mode", ConfigMode.DEFAULT.name());
+        props1.setProperty(FileHandler.class.getName() + ".pattern", PREFIX);
+        props1.setProperty(FileHandler.class.getName() + ".limit", String.valueOf(Integer.MAX_VALUE));
+        props1.setProperty(FileHandler.class.getName() + ".level", "ALL");
+        props1.setProperty(FileHandler.class.getName() + ".formatter", "java.util.logging.SimpleFormatter");
+        props1.setProperty("com.foo.handlers", FileHandler.class.getName());
+        props1.setProperty("com.bar.level", "FINEST");
+
+        Properties props2 = new Properties();
+        props2.setProperty("test.name", "parent logger with handler");
+        props2.setProperty("test.config.mode", ConfigMode.ENSURE_CLOSE_ON_RESET_TRUE.name());
+        props2.setProperty(FileHandler.class.getName() + ".pattern", PREFIX);
+        props2.setProperty(FileHandler.class.getName() + ".limit", String.valueOf(Integer.MAX_VALUE));
+        props2.setProperty(FileHandler.class.getName() + ".level", "ALL");
+        props2.setProperty(FileHandler.class.getName() + ".formatter", "java.util.logging.SimpleFormatter");
+        props2.setProperty("com.foo.handlers", FileHandler.class.getName());
+        props2.setProperty("com.foo.handlers.ensureCloseOnReset", "true");
+        props2.setProperty("com.bar.level", "FINEST");
+
+        Properties props3 = new Properties();
+        props3.setProperty("test.name", "parent logger with handler");
+        props3.setProperty("test.config.mode", ConfigMode.ENSURE_CLOSE_ON_RESET_FALSE.name());
+        props3.setProperty(FileHandler.class.getName() + ".pattern", PREFIX);
+        props3.setProperty(FileHandler.class.getName() + ".limit", String.valueOf(Integer.MAX_VALUE));
+        props3.setProperty(FileHandler.class.getName() + ".level", "ALL");
+        props3.setProperty(FileHandler.class.getName() + ".formatter", "java.util.logging.SimpleFormatter");
+        props3.setProperty("com.foo.handlers", FileHandler.class.getName());
+        props3.setProperty("com.foo.handlers.ensureCloseOnReset", "false");
+        props3.setProperty("com.bar.level", "FINEST");
+
+        properties = Collections.unmodifiableList(Arrays.asList(
+                    props1, props2, props3));
+    }
+
+    public static void main(String... args) throws Exception {
+
+
+        if (args == null || args.length == 0) {
+            args = new String[] {
+                TestCase.UNSECURE.name(),
+                TestCase.SECURE.name(),
+            };
+        }
+
+        try {
+            for (String testName : args) {
+                for (Properties propertyFile : properties) {
+                    TestCase test = TestCase.valueOf(testName);
+                    test.run(propertyFile);
+                }
+            }
+        } finally {
+            if (userDirWritable) {
+                Configure.doPrivileged(() -> {
+                    // cleanup - delete files that have been created
+                    try {
+                        Files.list(Paths.get(userDir))
+                            .filter((f) -> f.toString().contains(PREFIX))
+                            .forEach((f) -> {
+                                try {
+                                    System.out.println("deleting " + f);
+                                    Files.delete(f);
+                                } catch(Throwable t) {
+                                    System.err.println("Failed to delete " + f + ": " + t);
+                                }
+                            });
+                    } catch(Throwable t) {
+                        System.err.println("Cleanup failed to list files: " + t);
+                        t.printStackTrace();
+                    }
+                });
+            }
+        }
+    }
+
+    static class Configure {
+        static Policy policy = null;
+        static final AtomicBoolean allowAll = new AtomicBoolean(false);
+        static void setUp(TestCase test, Properties propertyFile) {
+            switch (test) {
+                case SECURE:
+                    if (policy == null && System.getSecurityManager() != null) {
+                        throw new IllegalStateException("SecurityManager already set");
+                    } else if (policy == null) {
+                        policy = new SimplePolicy(TestCase.SECURE, allowAll);
+                        Policy.setPolicy(policy);
+                        System.setSecurityManager(new SecurityManager());
+                    }
+                    if (System.getSecurityManager() == null) {
+                        throw new IllegalStateException("No SecurityManager.");
+                    }
+                    if (policy == null) {
+                        throw new IllegalStateException("policy not configured");
+                    }
+                    break;
+                case UNSECURE:
+                    if (System.getSecurityManager() != null) {
+                        throw new IllegalStateException("SecurityManager already set");
+                    }
+                    break;
+                default:
+                    new InternalError("No such testcase: " + test);
+            }
+            doPrivileged(() -> {
+                try {
+                    ByteArrayOutputStream bytes = new ByteArrayOutputStream();
+                    propertyFile.store(bytes, propertyFile.getProperty("test.name"));
+                    ByteArrayInputStream bais = new ByteArrayInputStream(bytes.toByteArray());
+                    LogManager.getLogManager().readConfiguration(bais);
+                } catch (IOException ex) {
+                    throw new RuntimeException(ex);
+                }
+            });
+        }
+        static void doPrivileged(Runnable run) {
+            allowAll.set(true);
+            try {
+                run.run();
+            } finally {
+                allowAll.set(false);
+            }
+        }
+        static <T> T callPrivileged(Callable<T> call) throws Exception {
+            allowAll.set(true);
+            try {
+                return call.call();
+            } finally {
+                allowAll.set(false);
+            }
+        }
+    }
+
+    @FunctionalInterface
+    public static interface FileHandlerSupplier {
+        public FileHandler test() throws Exception;
+    }
+
+    static final class TestAssertException extends RuntimeException {
+        TestAssertException(String msg) {
+            super(msg);
+        }
+    }
+
+    private static void assertEquals(long expected, long received, String msg) {
+        if (expected != received) {
+            throw new TestAssertException("Unexpected result for " + msg
+                    + ".\n\texpected: " + expected
+                    +  "\n\tactual:   " + received);
+        } else {
+            System.out.println("Got expected " + msg + ": " + received);
+        }
+    }
+
+
+    public static void test(String name, Properties props) throws Exception {
+        ConfigMode configMode = ConfigMode.valueOf(props.getProperty("test.config.mode"));
+        System.out.println("\nTesting: " + name + " mode=" + configMode);
+        if (!userDirWritable) {
+            throw new RuntimeException("Not writable: "+userDir);
+        }
+        switch(configMode) {
+            case DEFAULT:
+            case ENSURE_CLOSE_ON_RESET_TRUE:
+                testCloseOnResetTrue(name, props); break;
+            case ENSURE_CLOSE_ON_RESET_FALSE:
+                testCloseOnResetFalse(name, props); break;
+            default:
+                throw new RuntimeException("Unknwown mode: " + configMode);
+        }
+    }
+
+
+    // Test a configuration which has either
+    // com.foo.handlers.ensureCloseOnReset=true, or where
+    // com.foo.handlers.ensureCloseOnReset is not specified.
+    public static void testCloseOnResetTrue(String name, Properties props)
+            throws Exception {
+        Logger fooChild = Logger.getLogger("com.foo.child");
+        fooChild.info("hello world");
+        Logger barChild = Logger.getLogger("com.bar.child");
+        barChild.info("hello world");
+
+        ReferenceQueue<Logger> queue = new ReferenceQueue();
+        WeakReference<Logger> fooRef = new WeakReference<>(Logger.getLogger("com.foo"), queue);
+        if (fooRef.get() != fooChild.getParent()) {
+            throw new RuntimeException("Unexpected parent logger: "
+                    + fooChild.getParent() +"\n\texpected: " + fooRef.get());
+        }
+        WeakReference<Logger> barRef = new WeakReference<>(Logger.getLogger("com.bar"), queue);
+        if (barRef.get() != barChild.getParent()) {
+            throw new RuntimeException("Unexpected parent logger: "
+                    + barChild.getParent() +"\n\texpected: " + barRef.get());
+        }
+        fooChild = barChild = null;
+        Reference<? extends Logger> ref2 = null;
+        while ((ref2 = queue.poll()) == null) {
+            System.gc();
+            Thread.sleep(1000);
+        }
+        Throwable failed = null;
+        try {
+            do {
+                if (ref2 != barRef) {
+                    throw new RuntimeException("Unexpected reference: "
+                            + ref2 +"\n\texpected: " + barRef);
+                }
+                if (ref2.get() != null) {
+                    throw new RuntimeException("Referent not cleared: "
+                            + ref2.get());
+                }
+                System.out.println("Got barRef");
+                System.gc();
+                Thread.sleep(1000);
+            } while( (ref2 = queue.poll()) != null);
+            System.out.println("Parent logger GCed");
+        } catch(Throwable t) {
+            failed = t;
+        } finally {
+            final Throwable suppressed = failed;
+            Configure.doPrivileged(() -> LogManager.getLogManager().reset());
+            Configure.doPrivileged(() -> {
+                try {
+                    StringBuilder builder = new StringBuilder();
+                    Files.list(Paths.get(userDir))
+                        .filter((f) -> f.toString().contains(PREFIX))
+                        .filter((f) -> f.toString().endsWith(".lck"))
+                        .forEach((f) -> {
+                                builder.append(f.toString()).append('\n');
+                        });
+                    if (!builder.toString().isEmpty()) {
+                        throw new RuntimeException("Lock files not cleaned:\n"
+                                + builder.toString());
+                    }
+                } catch(RuntimeException | Error x) {
+                    if (suppressed != null) x.addSuppressed(suppressed);
+                    throw x;
+                } catch(Exception x) {
+                    if (suppressed != null) x.addSuppressed(suppressed);
+                    throw new RuntimeException(x);
+                }
+            });
+            while ((ref2 = queue.poll()) == null) {
+                System.gc();
+                Thread.sleep(1000);
+            }
+            if (ref2 != fooRef) {
+                throw new RuntimeException("Unexpected reference: "
+                        + ref2 +"\n\texpected: " + fooRef);
+            }
+            if (ref2.get() != null) {
+                throw new RuntimeException("Referent not cleared: " + ref2.get());
+            }
+            System.out.println("Got fooRef after reset()");
+
+        }
+        if (failed != null) {
+            // should rarely happen...
+            throw new RuntimeException(failed);
+        }
+
+    }
+
+    private static Handler getHandlerToClose() throws Exception {
+        return Configure.callPrivileged(
+                () -> Logger.getLogger("com.foo.child").getParent().getHandlers()[0]);
+    }
+
+    // Test a configuration which has com.foo.handlers.ensureCloseOnReset=false
+    public static void testCloseOnResetFalse(String name, Properties props)
+            throws Exception {
+        Logger fooChild = Logger.getLogger("com.foo.child");
+        fooChild.info("hello world");
+        Logger barChild = Logger.getLogger("com.bar.child");
+        barChild.info("hello world");
+
+        Handler toClose = getHandlerToClose();
+
+        ReferenceQueue<Logger> queue = new ReferenceQueue();
+        WeakReference<Logger> fooRef = new WeakReference<>(Logger.getLogger("com.foo"), queue);
+        if (fooRef.get() != fooChild.getParent()) {
+            throw new RuntimeException("Unexpected parent logger: "
+                    + fooChild.getParent() +"\n\texpected: " + fooRef.get());
+        }
+        WeakReference<Logger> barRef = new WeakReference<>(Logger.getLogger("com.bar"), queue);
+        if (barRef.get() != barChild.getParent()) {
+            throw new RuntimeException("Unexpected parent logger: "
+                    + barChild.getParent() +"\n\texpected: " + barRef.get());
+        }
+        fooChild = barChild = null;
+        Reference<? extends Logger> ref2 = null;
+        Set<WeakReference<Logger>> expectedRefs = new HashSet<>(Arrays.asList(fooRef, barRef));
+        Throwable failed = null;
+        try {
+            int l=0;
+            while (failed == null && !expectedRefs.isEmpty()) {
+                int max = 60;
+                while ((ref2 = queue.poll()) == null) {
+                    if (l > 0 && max-- <= 0) {
+                        throw new RuntimeException("Logger #2 not GC'ed!"
+                                + " max too short (max=60) or "
+                                + "com.foo.handlers.ensureCloseOnReset=false"
+                                + " does not work");
+                    }
+                    System.gc();
+                    Thread.sleep(1000);
+                }
+                do {
+                    if (!expectedRefs.contains(ref2)) {
+                        throw new RuntimeException("Unexpected reference: "
+                                + ref2 +"\n\texpected: " + expectedRefs);
+                    }
+                    if (ref2.get() != null) {
+                        throw new RuntimeException("Referent not cleared: "
+                                + ref2.get());
+                    }
+                    expectedRefs.remove(ref2);
+                    System.out.println("Got "+
+                            (ref2 == barRef ? "barRef"
+                                    : (ref2 == fooRef ? "fooRef"
+                                            : ref2.toString())));
+                    System.gc();
+                    Thread.sleep(1000);
+                    System.out.println("Logger #" + (++l) + " GCed");
+                } while( (ref2 = queue.poll()) != null);
+            }
+        } catch(Throwable t) {
+            failed = t;
+        } finally {
+            final Throwable suppressed = failed;
+            Configure.doPrivileged(() -> LogManager.getLogManager().reset());
+            Configure.doPrivileged(() -> {
+                try {
+                    toClose.close();
+                    StringBuilder builder = new StringBuilder();
+                    Files.list(Paths.get(userDir))
+                        .filter((f) -> f.toString().contains(PREFIX))
+                        .filter((f) -> f.toString().endsWith(".lck"))
+                        .forEach((f) -> {
+                                builder.append(f.toString()).append('\n');
+                        });
+                    if (!builder.toString().isEmpty()) {
+                        throw new RuntimeException("Lock files not cleaned:\n" + builder.toString());
+                    }
+                } catch(RuntimeException | Error x) {
+                    if (suppressed != null) x.addSuppressed(suppressed);
+                    throw x;
+                } catch(Exception x) {
+                    if (suppressed != null) x.addSuppressed(suppressed);
+                    throw new RuntimeException(x);
+                }
+            });
+        }
+        if (failed != null) {
+            // should rarely happen...
+            throw new RuntimeException(failed);
+        }
+
+    }
+
+
+    final static class PermissionsBuilder {
+        final Permissions perms;
+        public PermissionsBuilder() {
+            this(new Permissions());
+        }
+        public PermissionsBuilder(Permissions perms) {
+            this.perms = perms;
+        }
+        public PermissionsBuilder add(Permission p) {
+            perms.add(p);
+            return this;
+        }
+        public PermissionsBuilder addAll(PermissionCollection col) {
+            if (col != null) {
+                for (Enumeration<Permission> e = col.elements(); e.hasMoreElements(); ) {
+                    perms.add(e.nextElement());
+                }
+            }
+            return this;
+        }
+        public Permissions toPermissions() {
+            final PermissionsBuilder builder = new PermissionsBuilder();
+            builder.addAll(perms);
+            return builder.perms;
+        }
+    }
+
+    public static class SimplePolicy extends Policy {
+
+        final Permissions permissions;
+        final Permissions allPermissions;
+        final AtomicBoolean allowAll;
+        public SimplePolicy(TestCase test, AtomicBoolean allowAll) {
+            this.allowAll = allowAll;
+            permissions = new Permissions();
+            permissions.add(new LoggingPermission("control", null));
+            permissions.add(new FilePermission(PREFIX+".lck", "read,write,delete"));
+            permissions.add(new FilePermission(PREFIX, "read,write"));
+
+            // these are used for configuring the test itself...
+            allPermissions = new Permissions();
+            allPermissions.add(new java.security.AllPermission());
+
+        }
+
+        @Override
+        public boolean implies(ProtectionDomain domain, Permission permission) {
+            if (allowAll.get()) return allPermissions.implies(permission);
+            return permissions.implies(permission);
+        }
+
+        @Override
+        public PermissionCollection getPermissions(CodeSource codesource) {
+            return new PermissionsBuilder().addAll(allowAll.get()
+                    ? allPermissions : permissions).toPermissions();
+        }
+
+        @Override
+        public PermissionCollection getPermissions(ProtectionDomain domain) {
+            return new PermissionsBuilder().addAll(allowAll.get()
+                    ? allPermissions : permissions).toPermissions();
+        }
+    }
+
+}

From b1ad8012a0fa3247f39dce98df17f0b53e6791ef Mon Sep 17 00:00:00 2001
From: Vladimir Ivanov <vlivanov@openjdk.org>
Date: Mon, 24 Nov 2014 07:16:38 -0800
Subject: [PATCH 146/299] 8063135: Enable full LF sharing by default

Reviewed-by: psandoz, shade
---
 .../java/lang/invoke/MethodHandle.java        |  38 +--
 .../java/lang/invoke/MethodHandleImpl.java    |   6 +-
 .../java/lang/invoke/MethodHandleStatics.java |  17 +-
 .../java/lang/invoke/MethodHandles.java       | 252 +++++++-----------
 .../LFCaching/LFGarbageCollectedTest.java     |   2 +-
 .../LFCaching/LFMultiThreadCachingTest.java   |   2 +-
 .../LFCaching/LFSingleThreadCachingTest.java  |   2 +-
 7 files changed, 115 insertions(+), 204 deletions(-)

diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java
index 17ba24019b8..0a45d2707e9 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandle.java
@@ -867,15 +867,11 @@ assertEquals("[A, B, C]", (String) caToString2.invokeExact('A', "BC".toCharArray
         MethodType postSpreadType = asSpreaderChecks(arrayType, arrayLength);
         int arity = type().parameterCount();
         int spreadArgPos = arity - arrayLength;
-        if (USE_LAMBDA_FORM_EDITOR) {
-            MethodHandle afterSpread = this.asType(postSpreadType);
-            BoundMethodHandle mh = afterSpread.rebind();
-            LambdaForm lform = mh.editor().spreadArgumentsForm(1 + spreadArgPos, arrayType, arrayLength);
-            MethodType preSpreadType = postSpreadType.replaceParameterTypes(spreadArgPos, arity, arrayType);
-            return mh.copyWith(preSpreadType, lform);
-        } else {
-            return MethodHandleImpl.makeSpreadArguments(this, arrayType, spreadArgPos, arrayLength);
-        }
+        MethodHandle afterSpread = this.asType(postSpreadType);
+        BoundMethodHandle mh = afterSpread.rebind();
+        LambdaForm lform = mh.editor().spreadArgumentsForm(1 + spreadArgPos, arrayType, arrayLength);
+        MethodType preSpreadType = postSpreadType.replaceParameterTypes(spreadArgPos, arity, arrayType);
+        return mh.copyWith(preSpreadType, lform);
     }
 
     /**
@@ -996,23 +992,15 @@ assertEquals("[123]", (String) longsToString.invokeExact((long)123));
     public MethodHandle asCollector(Class<?> arrayType, int arrayLength) {
         asCollectorChecks(arrayType, arrayLength);
         int collectArgPos = type().parameterCount() - 1;
-        if (USE_LAMBDA_FORM_EDITOR) {
-            BoundMethodHandle mh = rebind();
-            MethodType resultType = type().asCollectorType(arrayType, arrayLength);
-            MethodHandle newArray = MethodHandleImpl.varargsArray(arrayType, arrayLength);
-            LambdaForm lform = mh.editor().collectArgumentArrayForm(1 + collectArgPos, newArray);
-            if (lform != null) {
-                return mh.copyWith(resultType, lform);
-            }
-            lform = mh.editor().collectArgumentsForm(1 + collectArgPos, newArray.type().basicType());
-            return mh.copyWithExtendL(resultType, lform, newArray);
-        } else {
-            MethodHandle target = this;
-            if (arrayType != type().parameterType(collectArgPos))
-                target = MethodHandleImpl.makePairwiseConvert(this, type().changeParameterType(collectArgPos, arrayType), true);
-            MethodHandle collector = MethodHandleImpl.varargsArray(arrayType, arrayLength);
-            return MethodHandles.collectArguments(target, collectArgPos, collector);
+        BoundMethodHandle mh = rebind();
+        MethodType resultType = type().asCollectorType(arrayType, arrayLength);
+        MethodHandle newArray = MethodHandleImpl.varargsArray(arrayType, arrayLength);
+        LambdaForm lform = mh.editor().collectArgumentArrayForm(1 + collectArgPos, newArray);
+        if (lform != null) {
+            return mh.copyWith(resultType, lform);
         }
+        lform = mh.editor().collectArgumentsForm(1 + collectArgPos, newArray.type().basicType());
+        return mh.copyWithExtendL(resultType, lform, newArray);
     }
 
     /**
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
index 09864eb19f3..7d8c63490d5 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleImpl.java
@@ -191,11 +191,7 @@ import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
         MethodType dstType = target.type();
         if (srcType == dstType)
             return target;
-        if (USE_LAMBDA_FORM_EDITOR) {
-            return makePairwiseConvertByEditor(target, srcType, strict, monobox);
-        } else {
-            return makePairwiseConvertIndirect(target, srcType, strict, monobox);
-        }
+        return makePairwiseConvertByEditor(target, srcType, strict, monobox);
     }
 
     private static int countNonNull(Object[] array) {
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java
index 1bd43538a91..43700b4d8db 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java
@@ -45,23 +45,21 @@ import sun.misc.Unsafe;
     static final boolean DUMP_CLASS_FILES;
     static final boolean TRACE_INTERPRETER;
     static final boolean TRACE_METHOD_LINKAGE;
-    static final boolean USE_LAMBDA_FORM_EDITOR;
     static final int COMPILE_THRESHOLD;
     static final int DONT_INLINE_THRESHOLD;
     static final int PROFILE_LEVEL;
 
     static {
-        final Object[] values = new Object[8];
+        final Object[] values = new Object[7];
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
                 public Void run() {
                     values[0] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DEBUG_NAMES");
                     values[1] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DUMP_CLASS_FILES");
                     values[2] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_INTERPRETER");
                     values[3] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE");
-                    values[4] = Boolean.getBoolean("java.lang.invoke.MethodHandle.USE_LF_EDITOR");
-                    values[5] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 30);
-                    values[6] = Integer.getInteger("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", 30);
-                    values[7] = Integer.getInteger("java.lang.invoke.MethodHandle.PROFILE_LEVEL", 0);
+                    values[4] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 30);
+                    values[5] = Integer.getInteger("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", 30);
+                    values[6] = Integer.getInteger("java.lang.invoke.MethodHandle.PROFILE_LEVEL", 0);
                     return null;
                 }
             });
@@ -69,10 +67,9 @@ import sun.misc.Unsafe;
         DUMP_CLASS_FILES          = (Boolean) values[1];
         TRACE_INTERPRETER         = (Boolean) values[2];
         TRACE_METHOD_LINKAGE      = (Boolean) values[3];
-        USE_LAMBDA_FORM_EDITOR    = (Boolean) values[4];
-        COMPILE_THRESHOLD         = (Integer) values[5];
-        DONT_INLINE_THRESHOLD     = (Integer) values[6];
-        PROFILE_LEVEL             = (Integer) values[7];
+        COMPILE_THRESHOLD         = (Integer) values[4];
+        DONT_INLINE_THRESHOLD     = (Integer) values[5];
+        PROFILE_LEVEL             = (Integer) values[6];
     }
 
     /** Tell if any of the debugging switches are turned on.
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
index 1600658e938..0fe5a897417 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
@@ -2103,115 +2103,65 @@ assert((int)twice.invokeExact(21) == 42);
         reorder = reorder.clone();  // get a private copy
         MethodType oldType = target.type();
         permuteArgumentChecks(reorder, newType, oldType);
-        if (USE_LAMBDA_FORM_EDITOR) {
-            // first detect dropped arguments and handle them separately
-            int[] originalReorder = reorder;
-            BoundMethodHandle result = target.rebind();
-            LambdaForm form = result.form;
-            int newArity = newType.parameterCount();
-            // Normalize the reordering into a real permutation,
-            // by removing duplicates and adding dropped elements.
-            // This somewhat improves lambda form caching, as well
-            // as simplifying the transform by breaking it up into steps.
-            for (int ddIdx; (ddIdx = findFirstDupOrDrop(reorder, newArity)) != 0; ) {
-                if (ddIdx > 0) {
-                    // We found a duplicated entry at reorder[ddIdx].
-                    // Example:  (x,y,z)->asList(x,y,z)
-                    // permuted by [1*,0,1] => (a0,a1)=>asList(a1,a0,a1)
-                    // permuted by [0,1,0*] => (a0,a1)=>asList(a0,a1,a0)
-                    // The starred element corresponds to the argument
-                    // deleted by the dupArgumentForm transform.
-                    int srcPos = ddIdx, dstPos = srcPos, dupVal = reorder[srcPos];
-                    boolean killFirst = false;
-                    for (int val; (val = reorder[--dstPos]) != dupVal; ) {
-                        // Set killFirst if the dup is larger than an intervening position.
-                        // This will remove at least one inversion from the permutation.
-                        if (dupVal > val) killFirst = true;
-                    }
-                    if (!killFirst) {
-                        srcPos = dstPos;
-                        dstPos = ddIdx;
-                    }
-                    form = form.editor().dupArgumentForm(1 + srcPos, 1 + dstPos);
-                    assert (reorder[srcPos] == reorder[dstPos]);
-                    oldType = oldType.dropParameterTypes(dstPos, dstPos + 1);
-                    // contract the reordering by removing the element at dstPos
-                    int tailPos = dstPos + 1;
-                    System.arraycopy(reorder, tailPos, reorder, dstPos, reorder.length - tailPos);
-                    reorder = Arrays.copyOf(reorder, reorder.length - 1);
-                } else {
-                    int dropVal = ~ddIdx, insPos = 0;
-                    while (insPos < reorder.length && reorder[insPos] < dropVal) {
-                        // Find first element of reorder larger than dropVal.
-                        // This is where we will insert the dropVal.
-                        insPos += 1;
-                    }
-                    Class<?> ptype = newType.parameterType(dropVal);
-                    form = form.editor().addArgumentForm(1 + insPos, BasicType.basicType(ptype));
-                    oldType = oldType.insertParameterTypes(insPos, ptype);
-                    // expand the reordering by inserting an element at insPos
-                    int tailPos = insPos + 1;
-                    reorder = Arrays.copyOf(reorder, reorder.length + 1);
-                    System.arraycopy(reorder, insPos, reorder, tailPos, reorder.length - tailPos);
-                    reorder[insPos] = dropVal;
+        // first detect dropped arguments and handle them separately
+        int[] originalReorder = reorder;
+        BoundMethodHandle result = target.rebind();
+        LambdaForm form = result.form;
+        int newArity = newType.parameterCount();
+        // Normalize the reordering into a real permutation,
+        // by removing duplicates and adding dropped elements.
+        // This somewhat improves lambda form caching, as well
+        // as simplifying the transform by breaking it up into steps.
+        for (int ddIdx; (ddIdx = findFirstDupOrDrop(reorder, newArity)) != 0; ) {
+            if (ddIdx > 0) {
+                // We found a duplicated entry at reorder[ddIdx].
+                // Example:  (x,y,z)->asList(x,y,z)
+                // permuted by [1*,0,1] => (a0,a1)=>asList(a1,a0,a1)
+                // permuted by [0,1,0*] => (a0,a1)=>asList(a0,a1,a0)
+                // The starred element corresponds to the argument
+                // deleted by the dupArgumentForm transform.
+                int srcPos = ddIdx, dstPos = srcPos, dupVal = reorder[srcPos];
+                boolean killFirst = false;
+                for (int val; (val = reorder[--dstPos]) != dupVal; ) {
+                    // Set killFirst if the dup is larger than an intervening position.
+                    // This will remove at least one inversion from the permutation.
+                    if (dupVal > val) killFirst = true;
                 }
-                assert (permuteArgumentChecks(reorder, newType, oldType));
+                if (!killFirst) {
+                    srcPos = dstPos;
+                    dstPos = ddIdx;
+                }
+                form = form.editor().dupArgumentForm(1 + srcPos, 1 + dstPos);
+                assert (reorder[srcPos] == reorder[dstPos]);
+                oldType = oldType.dropParameterTypes(dstPos, dstPos + 1);
+                // contract the reordering by removing the element at dstPos
+                int tailPos = dstPos + 1;
+                System.arraycopy(reorder, tailPos, reorder, dstPos, reorder.length - tailPos);
+                reorder = Arrays.copyOf(reorder, reorder.length - 1);
+            } else {
+                int dropVal = ~ddIdx, insPos = 0;
+                while (insPos < reorder.length && reorder[insPos] < dropVal) {
+                    // Find first element of reorder larger than dropVal.
+                    // This is where we will insert the dropVal.
+                    insPos += 1;
+                }
+                Class<?> ptype = newType.parameterType(dropVal);
+                form = form.editor().addArgumentForm(1 + insPos, BasicType.basicType(ptype));
+                oldType = oldType.insertParameterTypes(insPos, ptype);
+                // expand the reordering by inserting an element at insPos
+                int tailPos = insPos + 1;
+                reorder = Arrays.copyOf(reorder, reorder.length + 1);
+                System.arraycopy(reorder, insPos, reorder, tailPos, reorder.length - tailPos);
+                reorder[insPos] = dropVal;
             }
-            assert (reorder.length == newArity);  // a perfect permutation
-            // Note:  This may cache too many distinct LFs. Consider backing off to varargs code.
-            form = form.editor().permuteArgumentsForm(1, reorder);
-            if (newType == result.type() && form == result.internalForm())
-                return result;
-            return result.copyWith(newType, form);
-        } else {
-            // first detect dropped arguments and handle them separately
-            MethodHandle originalTarget = target;
-            int newArity = newType.parameterCount();
-            for (int dropIdx; (dropIdx = findFirstDrop(reorder, newArity)) >= 0; ) {
-                // dropIdx is missing from reorder; add it in at the end
-                int oldArity = reorder.length;
-                target = dropArguments(target, oldArity, newType.parameterType(dropIdx));
-                reorder = Arrays.copyOf(reorder, oldArity + 1);
-                reorder[oldArity] = dropIdx;
-            }
-            assert(target == originalTarget || permuteArgumentChecks(reorder, newType, target.type()));
-            // Note:  This may cache too many distinct LFs. Consider backing off to varargs code.
-            BoundMethodHandle result = target.rebind();
-            LambdaForm form = result.form.permuteArguments(1, reorder, basicTypes(newType.parameterList()));
-            return result.copyWith(newType, form);
-        }
-    }
-
-    /** Return the first value in [0..newArity-1] that is not present in reorder. */
-    private static int findFirstDrop(int[] reorder, int newArity) {
-        final int BIT_LIMIT = 63;  // max number of bits in bit mask
-        if (newArity < BIT_LIMIT) {
-            long mask = 0;
-            for (int arg : reorder) {
-                assert(arg < newArity);
-                mask |= (1L << arg);
-            }
-            if (mask == (1L << newArity) - 1) {
-                assert(Long.numberOfTrailingZeros(Long.lowestOneBit(~mask)) == newArity);
-                return -1;
-            }
-            // find first zero
-            long zeroBit = Long.lowestOneBit(~mask);
-            int zeroPos = Long.numberOfTrailingZeros(zeroBit);
-            assert(zeroPos < newArity);
-            return zeroPos;
-        } else {
-            BitSet mask = new BitSet(newArity);
-            for (int arg : reorder) {
-                assert (arg < newArity);
-                mask.set(arg);
-            }
-            int zeroPos = mask.nextClearBit(0);
-            assert(zeroPos <= newArity);
-            if (zeroPos == newArity)
-                return -1;
-            return zeroPos;
+            assert (permuteArgumentChecks(reorder, newType, oldType));
         }
+        assert (reorder.length == newArity);  // a perfect permutation
+        // Note:  This may cache too many distinct LFs. Consider backing off to varargs code.
+        form = form.editor().permuteArgumentsForm(1, reorder);
+        if (newType == result.type() && form == result.internalForm())
+            return result;
+        return result.copyWith(newType, form);
     }
 
     /**
@@ -2502,13 +2452,9 @@ assertEquals("yz", (String) d0.invokeExact(123, "x", "y", "z"));
         if (dropped == 0)  return target;
         BoundMethodHandle result = target.rebind();
         LambdaForm lform = result.form;
-        if (USE_LAMBDA_FORM_EDITOR) {
-            int insertFormArg = 1 + pos;
-            for (Class<?> ptype : valueTypes) {
-                lform = lform.editor().addArgumentForm(insertFormArg++, BasicType.basicType(ptype));
-            }
-        } else {
-            lform = lform.addArguments(pos, valueTypes);
+        int insertFormArg = 1 + pos;
+        for (Class<?> ptype : valueTypes) {
+            lform = lform.editor().addArgumentForm(insertFormArg++, BasicType.basicType(ptype));
         }
         result = result.copyWith(newType, lform);
         return result;
@@ -2659,18 +2605,14 @@ assertEquals("XY", (String) f2.invokeExact("x", "y")); // XY
     /*non-public*/ static
     MethodHandle filterArgument(MethodHandle target, int pos, MethodHandle filter) {
         filterArgumentChecks(target, pos, filter);
-        if (USE_LAMBDA_FORM_EDITOR) {
-            MethodType targetType = target.type();
-            MethodType filterType = filter.type();
-            BoundMethodHandle result = target.rebind();
-            Class<?> newParamType = filterType.parameterType(0);
-            LambdaForm lform = result.editor().filterArgumentForm(1 + pos, BasicType.basicType(newParamType));
-            MethodType newType = targetType.changeParameterType(pos, newParamType);
-            result = result.copyWithExtendL(newType, lform, filter);
-            return result;
-        } else {
-            return MethodHandleImpl.makeCollectArguments(target, filter, pos, false);
-        }
+        MethodType targetType = target.type();
+        MethodType filterType = filter.type();
+        BoundMethodHandle result = target.rebind();
+        Class<?> newParamType = filterType.parameterType(0);
+        LambdaForm lform = result.editor().filterArgumentForm(1 + pos, BasicType.basicType(newParamType));
+        MethodType newType = targetType.changeParameterType(pos, newParamType);
+        result = result.copyWithExtendL(newType, lform, filter);
+        return result;
     }
 
     private static void filterArgumentsCheckArity(MethodHandle target, int pos, MethodHandle[] filters) {
@@ -2797,21 +2739,17 @@ assertEquals("[top, [[up, down, strange], charm], bottom]",
     public static
     MethodHandle collectArguments(MethodHandle target, int pos, MethodHandle filter) {
         MethodType newType = collectArgumentsChecks(target, pos, filter);
-        if (USE_LAMBDA_FORM_EDITOR) {
-            MethodType collectorType = filter.type();
-            BoundMethodHandle result = target.rebind();
-            LambdaForm lform;
-            if (collectorType.returnType().isArray() && filter.intrinsicName() == Intrinsic.NEW_ARRAY) {
-                lform = result.editor().collectArgumentArrayForm(1 + pos, filter);
-                if (lform != null) {
-                    return result.copyWith(newType, lform);
-                }
+        MethodType collectorType = filter.type();
+        BoundMethodHandle result = target.rebind();
+        LambdaForm lform;
+        if (collectorType.returnType().isArray() && filter.intrinsicName() == Intrinsic.NEW_ARRAY) {
+            lform = result.editor().collectArgumentArrayForm(1 + pos, filter);
+            if (lform != null) {
+                return result.copyWith(newType, lform);
             }
-            lform = result.editor().collectArgumentsForm(1 + pos, collectorType.basicType());
-            return result.copyWithExtendL(newType, lform, filter);
-        } else {
-            return MethodHandleImpl.makeCollectArguments(target, filter, pos, false);
         }
+        lform = result.editor().collectArgumentsForm(1 + pos, collectorType.basicType());
+        return result.copyWithExtendL(newType, lform, filter);
     }
 
     private static MethodType collectArgumentsChecks(MethodHandle target, int pos, MethodHandle filter) throws RuntimeException {
@@ -2890,16 +2828,12 @@ System.out.println((int) f0.invokeExact("x", "y")); // 2
         MethodType targetType = target.type();
         MethodType filterType = filter.type();
         filterReturnValueChecks(targetType, filterType);
-        if (USE_LAMBDA_FORM_EDITOR) {
-            BoundMethodHandle result = target.rebind();
-            BasicType rtype = BasicType.basicType(filterType.returnType());
-            LambdaForm lform = result.editor().filterReturnForm(rtype, false);
-            MethodType newType = targetType.changeReturnType(filterType.returnType());
-            result = result.copyWithExtendL(newType, lform, filter);
-            return result;
-        } else {
-            return MethodHandleImpl.makeCollectArguments(filter, target, 0, false);
-        }
+        BoundMethodHandle result = target.rebind();
+        BasicType rtype = BasicType.basicType(filterType.returnType());
+        LambdaForm lform = result.editor().filterReturnForm(rtype, false);
+        MethodType newType = targetType.changeReturnType(filterType.returnType());
+        result = result.copyWithExtendL(newType, lform, filter);
+        return result;
     }
 
     private static void filterReturnValueChecks(MethodType targetType, MethodType filterType) throws RuntimeException {
@@ -2993,19 +2927,15 @@ assertEquals("boojum", (String) catTrace.invokeExact("boo", "jum"));
         MethodType targetType = target.type();
         MethodType combinerType = combiner.type();
         Class<?> rtype = foldArgumentChecks(foldPos, targetType, combinerType);
-        if (USE_LAMBDA_FORM_EDITOR) {
-            BoundMethodHandle result = target.rebind();
-            boolean dropResult = (rtype == void.class);
-            // Note:  This may cache too many distinct LFs. Consider backing off to varargs code.
-            LambdaForm lform = result.editor().foldArgumentsForm(1 + foldPos, dropResult, combinerType.basicType());
-            MethodType newType = targetType;
-            if (!dropResult)
-                newType = newType.dropParameterTypes(foldPos, foldPos + 1);
-            result = result.copyWithExtendL(newType, lform, combiner);
-            return result;
-        } else {
-            return MethodHandleImpl.makeCollectArguments(target, combiner, foldPos, true);
-        }
+        BoundMethodHandle result = target.rebind();
+        boolean dropResult = (rtype == void.class);
+        // Note:  This may cache too many distinct LFs. Consider backing off to varargs code.
+        LambdaForm lform = result.editor().foldArgumentsForm(1 + foldPos, dropResult, combinerType.basicType());
+        MethodType newType = targetType;
+        if (!dropResult)
+            newType = newType.dropParameterTypes(foldPos, foldPos + 1);
+        result = result.copyWithExtendL(newType, lform, combiner);
+        return result;
     }
 
     private static Class<?> foldArgumentChecks(int foldPos, MethodType targetType, MethodType combinerType) {
diff --git a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
index 3b9ed4dea74..451af074bdc 100644
--- a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
+++ b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
@@ -31,7 +31,7 @@
  * @build TestMethods
  * @build LambdaFormTestCase
  * @build LFGarbageCollectedTest
- * @run main/othervm/timeout=600 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true -DtestLimit=150 LFGarbageCollectedTest
+ * @run main/othervm/timeout=600 -DtestLimit=150 LFGarbageCollectedTest
  */
 
 import java.lang.invoke.MethodHandle;
diff --git a/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java b/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
index a41647246bc..21771c1a0a0 100644
--- a/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
+++ b/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
@@ -31,7 +31,7 @@
  * @build LambdaFormTestCase
  * @build LFCachingTestCase
  * @build LFMultiThreadCachingTest
- * @run main/othervm/timeout=300 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true LFMultiThreadCachingTest
+ * @run main/othervm/timeout=300 LFMultiThreadCachingTest
  */
 
 import java.lang.invoke.MethodHandle;
diff --git a/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java b/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java
index 21221aa7caf..bd0ba2bde59 100644
--- a/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java
+++ b/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java
@@ -31,7 +31,7 @@
  * @build LambdaFormTestCase
  * @build LFCachingTestCase
  * @build LFSingleThreadCachingTest
- * @run main/othervm/timeout=300 -Djava.lang.invoke.MethodHandle.USE_LF_EDITOR=true LFSingleThreadCachingTest
+ * @run main/othervm/timeout=300 LFSingleThreadCachingTest
  */
 
 import java.lang.invoke.MethodHandle;

From 95ef6e0cb2b59d8f6c8736bac5217a0feb0c4d01 Mon Sep 17 00:00:00 2001
From: Vladimir Ivanov <vlivanov@openjdk.org>
Date: Mon, 24 Nov 2014 07:19:36 -0800
Subject: [PATCH 147/299] 8059880: Get rid of LambdaForm interpretation

Reviewed-by: psandoz, kvn, shade
---
 .../share/classes/java/lang/invoke/MethodHandleStatics.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java
index 43700b4d8db..335a32289a7 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleStatics.java
@@ -57,7 +57,7 @@ import sun.misc.Unsafe;
                     values[1] = Boolean.getBoolean("java.lang.invoke.MethodHandle.DUMP_CLASS_FILES");
                     values[2] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_INTERPRETER");
                     values[3] = Boolean.getBoolean("java.lang.invoke.MethodHandle.TRACE_METHOD_LINKAGE");
-                    values[4] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 30);
+                    values[4] = Integer.getInteger("java.lang.invoke.MethodHandle.COMPILE_THRESHOLD", 0);
                     values[5] = Integer.getInteger("java.lang.invoke.MethodHandle.DONT_INLINE_THRESHOLD", 30);
                     values[6] = Integer.getInteger("java.lang.invoke.MethodHandle.PROFILE_LEVEL", 0);
                     return null;

From 3469175a632b593b610f3ee1f93cbc834ce92d9d Mon Sep 17 00:00:00 2001
From: Alan Bateman <alanb@openjdk.org>
Date: Mon, 24 Nov 2014 18:11:25 +0000
Subject: [PATCH 148/299] 8065720: (ch) AbstractInterruptibleChannel.end sets
 interrupted to null

Reviewed-by: psandoz, chegar
---
 .../java/nio/channels/spi/AbstractInterruptibleChannel.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java b/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java
index 5000c583cde..fccc2904c7d 100644
--- a/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java
+++ b/jdk/src/java.base/share/classes/java/nio/channels/spi/AbstractInterruptibleChannel.java
@@ -198,7 +198,7 @@ public abstract class AbstractInterruptibleChannel
         blockedOn(null);
         Thread interrupted = this.interrupted;
         if (interrupted != null && interrupted == Thread.currentThread()) {
-            interrupted = null;
+            this.interrupted = null;
             throw new ClosedByInterruptException();
         }
         if (!completed && !open)

From 634c33938c27e2da6300b0eaf4fd0660111baa48 Mon Sep 17 00:00:00 2001
From: Robert Field <rfield@openjdk.org>
Date: Mon, 24 Nov 2014 14:52:46 -0800
Subject: [PATCH 149/299] 8058112: Invalid BootstrapMethod for
 constructor/method reference

Bridge method references with functional interface method parameters of intersection type

Reviewed-by: vromero, dlsmith
---
 .../sun/tools/javac/comp/LambdaToMethod.java  | 141 +++++++++++++-----
 .../MethodReferenceIntersection1.java         |  88 +++++++++++
 .../MethodReferenceIntersection2.java         |  68 +++++++++
 .../MethodReferenceIntersection3.java         |  50 +++++++
 4 files changed, 306 insertions(+), 41 deletions(-)
 create mode 100644 langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection1.java
 create mode 100644 langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection2.java
 create mode 100644 langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection3.java

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
index d97465b8f7d..df06e137a9e 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/LambdaToMethod.java
@@ -40,6 +40,7 @@ import com.sun.tools.javac.code.Symbol.VarSymbol;
 import com.sun.tools.javac.code.Symtab;
 import com.sun.tools.javac.code.Type;
 import com.sun.tools.javac.code.Type.MethodType;
+import com.sun.tools.javac.code.Type.TypeVar;
 import com.sun.tools.javac.code.Types;
 import com.sun.tools.javac.comp.LambdaToMethod.LambdaAnalyzerPreprocessor.*;
 import com.sun.tools.javac.comp.Lower.BasicFreeVarCollector;
@@ -60,6 +61,7 @@ import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 import static com.sun.tools.javac.code.TypeTag.*;
 import static com.sun.tools.javac.tree.JCTree.Tag.*;
+import javax.lang.model.type.TypeKind;
 
 /**
  * This pass desugars lambda expressions into static methods
@@ -759,49 +761,10 @@ public class LambdaToMethod extends TreeTranslator {
             int prevPos = make.pos;
             try {
                 make.at(tree);
-                Type samDesc = localContext.bridgedRefSig();
-                List<Type> samPTypes = samDesc.getParameterTypes();
-
-                // an extra argument is prepended in the case where the member
-                // reference is an unbound instance method reference (in which
-                // case the receiver expression in passed.
-                VarSymbol rcvr;
-                switch (tree.kind) {
-                    case BOUND:
-                        rcvr = addParameter("rec$", tree.getQualifierExpression().type, false);
-                        receiverExpression = attr.makeNullCheck(tree.getQualifierExpression());
-                        break;
-                    case UNBOUND:
-                        rcvr = addParameter("rec$", samPTypes.head, false);
-                        samPTypes = samPTypes.tail;
-                        break;
-                    default:
-                        rcvr = null;
-                        break;
-                }
-
-                // generate the parameter list for the coverted member reference.
-                // the signature will match the signature of the target sam descriptor
-
-                List<Type> refPTypes = tree.sym.type.getParameterTypes();
-                int refSize = refPTypes.size();
-                int samSize = samPTypes.size();
-                // Last parameter to copy from referenced method
-                int last = localContext.needsVarArgsConversion() ? refSize - 1 : refSize;
-
-                List<Type> l = refPTypes;
-                // Use parameter types of the referenced method, excluding final var args
-                for (int i = 0; l.nonEmpty() && i < last; ++i) {
-                    addParameter("x$" + i, l.head, true);
-                    l = l.tail;
-                }
-                // Flatten out the var args
-                for (int i = last; i < samSize; ++i) {
-                    addParameter("xva$" + i, tree.varargsElement, true);
-                }
 
                 //body generation - this can be either a method call or a
                 //new instance creation expression, depending on the member reference kind
+                VarSymbol rcvr = addParametersReturnReceiver();
                 JCExpression expr = (tree.getMode() == ReferenceMode.INVOKE)
                         ? expressionInvoke(rcvr)
                         : expressionNew();
@@ -816,6 +779,78 @@ public class LambdaToMethod extends TreeTranslator {
             }
         }
 
+        /**
+         * Generate the parameter list for the converted member reference.
+         *
+         * @return The receiver variable symbol, if any
+         */
+        VarSymbol addParametersReturnReceiver() {
+            Type samDesc = localContext.bridgedRefSig();
+            List<Type> samPTypes = samDesc.getParameterTypes();
+            List<Type> descPTypes = tree.getDescriptorType(types).getParameterTypes();
+
+            // Determine the receiver, if any
+            VarSymbol rcvr;
+            switch (tree.kind) {
+                case BOUND:
+                    // The receiver is explicit in the method reference
+                    rcvr = addParameter("rec$", tree.getQualifierExpression().type, false);
+                    receiverExpression = attr.makeNullCheck(tree.getQualifierExpression());
+                    break;
+                case UNBOUND:
+                    // The receiver is the first parameter, extract it and
+                    // adjust the SAM and unerased type lists accordingly
+                    rcvr = addParameter("rec$", samDesc.getParameterTypes().head, false);
+                    samPTypes = samPTypes.tail;
+                    descPTypes = descPTypes.tail;
+                    break;
+                default:
+                    rcvr = null;
+                    break;
+            }
+            List<Type> implPTypes = tree.sym.type.getParameterTypes();
+            int implSize = implPTypes.size();
+            int samSize = samPTypes.size();
+            // Last parameter to copy from referenced method, exclude final var args
+            int last = localContext.needsVarArgsConversion() ? implSize - 1 : implSize;
+
+            // Failsafe -- assure match-up
+            boolean checkForIntersection = tree.varargsElement != null || implSize == descPTypes.size();
+
+            // Use parameter types of the implementation method unless the unerased
+            // SAM parameter type is an intersection type, in that case use the
+            // erased SAM parameter type so that the supertype relationship
+            // the implementation method parameters is not obscured.
+            // Note: in this loop, the lists implPTypes, samPTypes, and descPTypes
+            // are used as pointers to the current parameter type information
+            // and are thus not usable afterwards.
+            for (int i = 0; implPTypes.nonEmpty() && i < last; ++i) {
+                // By default use the implementation method parmeter type
+                Type parmType = implPTypes.head;
+                // If the unerased parameter type is a type variable whose
+                // bound is an intersection (eg. <T extends A & B>) then
+                // use the SAM parameter type
+                if (checkForIntersection && descPTypes.head.getKind() == TypeKind.TYPEVAR) {
+                    TypeVar tv = (TypeVar) descPTypes.head;
+                    if (tv.bound.getKind() == TypeKind.INTERSECTION) {
+                        parmType = samPTypes.head;
+                    }
+                }
+                addParameter("x$" + i, parmType, true);
+
+                // Advance to the next parameter
+                implPTypes = implPTypes.tail;
+                samPTypes = samPTypes.tail;
+                descPTypes = descPTypes.tail;
+            }
+            // Flatten out the var args
+            for (int i = last; i < samSize; ++i) {
+                addParameter("xva$" + i, tree.varargsElement, true);
+            }
+
+            return rcvr;
+        }
+
         JCExpression getReceiverExpression() {
             return receiverExpression;
         }
@@ -2063,12 +2098,36 @@ public class LambdaToMethod extends TreeTranslator {
                         types.isSignaturePolymorphic((MethodSymbol)tree.sym);
             }
 
+            /**
+             * Erasure destroys the implementation parameter subtype
+             * relationship for intersection types
+             */
+            boolean interfaceParameterIsIntersectionType() {
+                List<Type> tl = tree.getDescriptorType(types).getParameterTypes();
+                if (tree.kind == ReferenceKind.UNBOUND) {
+                    tl = tl.tail;
+                }
+                for (; tl.nonEmpty(); tl = tl.tail) {
+                    Type pt = tl.head;
+                    if (pt.getKind() == TypeKind.TYPEVAR) {
+                        TypeVar tv = (TypeVar) pt;
+                        if (tv.bound.getKind() == TypeKind.INTERSECTION) {
+                            return true;
+                        }
+                    }
+                }
+                return false;
+            }
+
             /**
              * Does this reference need to be converted to a lambda
              * (i.e. var args need to be expanded or "super" is used)
              */
             final boolean needsConversionToLambda() {
-                return isSuper || needsVarArgsConversion() || isArrayOp() ||
+                return interfaceParameterIsIntersectionType() ||
+                        isSuper ||
+                        needsVarArgsConversion() ||
+                        isArrayOp() ||
                         isPrivateInOtherClass() ||
                         !receiverAccessible() ||
                         (tree.getMode() == ReferenceMode.NEW &&
diff --git a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection1.java b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection1.java
new file mode 100644
index 00000000000..aff05a7e12c
--- /dev/null
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection1.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8058112
+ * @summary Invalid BootstrapMethod for constructor/method reference
+ */
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+
+import static java.util.stream.Collectors.toList;
+
+public class MethodReferenceIntersection1 {
+
+    public static void main(String[] args) {
+        MethodReferenceIntersection1 main = new MethodReferenceIntersection1();
+        List<Info_MRI1> list = main.toInfoListError(Arrays.asList(new Base_MRI1()));
+        System.out.printf("result %d\n", list.size());
+    }
+
+    public <H extends B_MRI1 & A_MRI1> List<Info_MRI1> toInfoListError(List<H> list) {
+        Comparator<B_MRI1> byNameComparator =
+                    (B_MRI1 b1, B_MRI1 b2) -> b1.getB().compareToIgnoreCase(b2.getB());
+        return list.stream().sorted(byNameComparator).map(Info_MRI1::new).collect(toList());
+    }
+
+    public <H extends B_MRI1 & A_MRI1> List<Info_MRI1> toInfoListWorks(List<H> list) {
+        Comparator<B_MRI1> byNameComparator =
+                    (B_MRI1 b1, B_MRI1 b2) -> b1.getB().compareToIgnoreCase(b2.getB());
+        return list.stream().sorted(byNameComparator).map(s -> new Info_MRI1(s)).collect(toList());
+    }
+}
+
+interface B_MRI1 {
+    public String getB();
+}
+
+interface A_MRI1 {
+    public long getA();
+}
+
+class Info_MRI1 {
+    private final long a;
+    private final String b;
+
+    <H extends A_MRI1 & B_MRI1> Info_MRI1(H h) {
+        a = h.getA();
+        b = h.getB();
+    }
+}
+
+class Base_MRI1 implements A_MRI1, B_MRI1 {
+
+    @Override
+    public long getA() {
+        return 7L;
+    }
+
+    @Override
+    public String getB() {
+        return "hello";
+    }
+}
diff --git a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection2.java b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection2.java
new file mode 100644
index 00000000000..ef594517581
--- /dev/null
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection2.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8058112
+ * @summary Invalid BootstrapMethod for constructor/method reference
+ */
+
+import java.util.function.Function;
+
+public class MethodReferenceIntersection2 {
+
+    interface B { }
+
+    interface A { }
+
+    static class C implements A, B { }
+
+    static class Info {
+        <H extends A & B> Info(H h) { }
+
+        static <H extends A & B> Info info(H h) {
+            return new Info(h);
+        }
+    }
+
+    public static void main(String[] args) {
+        test();
+    }
+
+    // Note the switch in order compared to that on Info
+    static <H extends B & A> void test() {
+        Function<H, Info> f1L = _h -> new Info(_h);
+        Function<H, Info> f1 = Info::new;
+        Function<H, Info> f2L = _h -> Info.info(_h);
+        Function<H, Info> f2 = Info::info;
+        H c = (H) new C();
+        if(f1.apply(c) instanceof Info &&
+           f2.apply(c) instanceof Info) {
+           System.out.println("Passes.");
+        } else {
+           throw new AssertionError();
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection3.java b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection3.java
new file mode 100644
index 00000000000..0eeb739bb95
--- /dev/null
+++ b/langtools/test/tools/javac/lambda/methodReferenceExecution/MethodReferenceIntersection3.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @bug 8058112
+ * @summary Invalid BootstrapMethod for constructor/method reference
+ */
+
+/**
+ * @author Remi Forax
+ */
+
+public class MethodReferenceIntersection3 {
+  interface A {}
+
+  interface Foo {
+    <T extends Object & A> void foo(T t);
+  }
+
+  static <T extends A> void bar(T t) {
+  }
+
+  public static void main(String[] args) {
+    Foo foo = MethodReferenceIntersection3::bar;
+    foo.foo(new A(){});
+  }
+}

From 758644082bddea64c8d88287ab411bdfc1300866 Mon Sep 17 00:00:00 2001
From: Konstantin Shefov <kshefov@openjdk.org>
Date: Tue, 25 Nov 2014 14:16:55 +0400
Subject: [PATCH 150/299] 8059070: [TESTBUG]
 java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java failed - timeout

Reviewed-by: psandoz, vlivanov
---
 .../lang/invoke/LFCaching/LFGarbageCollectedTest.java |  2 +-
 .../invoke/LFCaching/LFMultiThreadCachingTest.java    |  2 +-
 .../invoke/LFCaching/LFSingleThreadCachingTest.java   |  2 +-
 .../lang/invoke/LFCaching/LambdaFormTestCase.java     | 11 +++++++++++
 jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java   |  7 +++++++
 5 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
index 451af074bdc..f0f6b034dbb 100644
--- a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
+++ b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
@@ -31,7 +31,7 @@
  * @build TestMethods
  * @build LambdaFormTestCase
  * @build LFGarbageCollectedTest
- * @run main/othervm/timeout=600 -DtestLimit=150 LFGarbageCollectedTest
+ * @run main/othervm LFGarbageCollectedTest
  */
 
 import java.lang.invoke.MethodHandle;
diff --git a/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java b/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
index 21771c1a0a0..35c2f97d191 100644
--- a/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
+++ b/jdk/test/java/lang/invoke/LFCaching/LFMultiThreadCachingTest.java
@@ -31,7 +31,7 @@
  * @build LambdaFormTestCase
  * @build LFCachingTestCase
  * @build LFMultiThreadCachingTest
- * @run main/othervm/timeout=300 LFMultiThreadCachingTest
+ * @run main/othervm LFMultiThreadCachingTest
  */
 
 import java.lang.invoke.MethodHandle;
diff --git a/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java b/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java
index bd0ba2bde59..6a44e44d8b6 100644
--- a/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java
+++ b/jdk/test/java/lang/invoke/LFCaching/LFSingleThreadCachingTest.java
@@ -31,7 +31,7 @@
  * @build LambdaFormTestCase
  * @build LFCachingTestCase
  * @build LFSingleThreadCachingTest
- * @run main/othervm/timeout=300 LFSingleThreadCachingTest
+ * @run main/othervm LFSingleThreadCachingTest
  */
 
 import java.lang.invoke.MethodHandle;
diff --git a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
index dfdcd15297f..a1821fa696f 100644
--- a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
+++ b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
@@ -27,6 +27,7 @@ import java.lang.management.ManagementFactory;
 import java.lang.reflect.Method;
 import java.util.Collection;
 import java.util.function.Function;
+import jdk.testlibrary.Utils;
 
 /**
  * Lambda forms caching test case class. Contains all necessary test routines to
@@ -41,6 +42,7 @@ public abstract class LambdaFormTestCase {
     private final static String INTERNAL_FORM_METHOD_NAME = "internalForm";
     private static final double ITERATIONS_TO_CODE_CACHE_SIZE_RATIO
             = 45 / (128.0 * 1024 * 1024);
+    private static final long TIMEOUT = Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT);
 
     /**
      * Reflection link to {@code j.l.i.MethodHandle.internalForm} method. It is
@@ -120,6 +122,7 @@ public abstract class LambdaFormTestCase {
         System.out.printf("Number of iterations is set to %d (%d cases)%n",
                 iterations, iterations * testCaseNum);
         System.out.flush();
+        long startTime = System.currentTimeMillis();
         for (long i = 0; i < iterations; i++) {
             System.err.println(String.format("Iteration %d:", i));
             for (TestMethods testMethod : testMethods) {
@@ -137,6 +140,14 @@ public abstract class LambdaFormTestCase {
                 }
                 testCounter++;
             }
+            long passedTime = System.currentTimeMillis() - startTime;
+            long avgIterTime = passedTime / (i + 1);
+            long remainTime = TIMEOUT - passedTime;
+            if (avgIterTime > 2 * remainTime) {
+                System.err.printf("Stopping iterations because of lack of time.%n"
+                        + "Increase timeout factor for more iterations.%n");
+                break;
+            }
         }
         if (!passed) {
             throw new Error(String.format("%d of %d test cases FAILED! %n"
diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java
index e96898c8fc5..af8cc267493 100644
--- a/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/Utils.java
@@ -38,6 +38,7 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.regex.Pattern;
 import java.util.regex.Matcher;
+import java.util.concurrent.TimeUnit;
 
 /**
  * Common library for various test helper functions.
@@ -69,6 +70,12 @@ public final class Utils {
        TIMEOUT_FACTOR = Double.parseDouble(toFactor);
     }
 
+    /**
+    * Returns the value of JTREG default test timeout in milliseconds
+    * converted to {@code long}.
+    */
+    public static final long DEFAULT_TEST_TIMEOUT = TimeUnit.SECONDS.toMillis(120);
+
     private Utils() {
         // Private constructor to prevent class instantiation
     }

From 5ffd65a73105dd593896cf1ef2b0d0bafb062e33 Mon Sep 17 00:00:00 2001
From: Ivan Gerasimov <igerasim@openjdk.org>
Date: Tue, 25 Nov 2014 14:16:32 +0300
Subject: [PATCH 151/299] 8064694: Kitchensink: WaitForMultipleObjects failed
 in hotspot\src\os\windows\vm\os_windows.cpp: 3844

Increase the timeout in debug builds; raise the priority of exiting threads

Reviewed-by: dcubed, dholmes
---
 hotspot/src/os/windows/vm/os_windows.cpp | 25 +++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp
index 4a3109bef47..31de938eef4 100644
--- a/hotspot/src/os/windows/vm/os_windows.cpp
+++ b/hotspot/src/os/windows/vm/os_windows.cpp
@@ -3781,8 +3781,8 @@ HINSTANCE os::win32::load_Windows_dll(const char* name, char *ebuf,
   return NULL;
 }
 
-#define MAX_EXIT_HANDLES    16
-#define EXIT_TIMEOUT      1000 /* 1 sec */
+#define MAX_EXIT_HANDLES PRODUCT_ONLY(32)   NOT_PRODUCT(128)
+#define EXIT_TIMEOUT     PRODUCT_ONLY(1000) NOT_PRODUCT(4000) /* 1 sec in product, 4 sec in debug */
 
 static BOOL CALLBACK init_crit_sect_call(PINIT_ONCE, PVOID pcrit_sect, PVOID*) {
   InitializeCriticalSection((CRITICAL_SECTION*)pcrit_sect);
@@ -3833,6 +3833,9 @@ int os::win32::exit_process_or_thread(Ept what, int exit_code) {
         // If there's no free slot in the array of the kept handles, we'll have to
         // wait until at least one thread completes exiting.
         if ((handle_count = j) == MAX_EXIT_HANDLES) {
+          // Raise the priority of the oldest exiting thread to increase its chances
+          // to complete sooner.
+          SetThreadPriority(handles[0], THREAD_PRIORITY_ABOVE_NORMAL);
           res = WaitForMultipleObjects(MAX_EXIT_HANDLES, handles, FALSE, EXIT_TIMEOUT);
           if (res >= WAIT_OBJECT_0 && res < (WAIT_OBJECT_0 + MAX_EXIT_HANDLES)) {
             i = (res - WAIT_OBJECT_0);
@@ -3841,7 +3844,8 @@ int os::win32::exit_process_or_thread(Ept what, int exit_code) {
               handles[i] = handles[i + 1];
             }
           } else {
-            warning("WaitForMultipleObjects failed in %s: %d\n", __FILE__, __LINE__);
+            warning("WaitForMultipleObjects %s in %s: %d\n",
+                    (res == WAIT_FAILED ? "failed" : "timed out"), __FILE__, __LINE__);
             // Don't keep handles, if we failed waiting for them.
             for (i = 0; i < MAX_EXIT_HANDLES; ++i) {
               CloseHandle(handles[i]);
@@ -3867,9 +3871,20 @@ int os::win32::exit_process_or_thread(Ept what, int exit_code) {
         if (handle_count > 0) {
           // Before ending the process, make sure all the threads that had called
           // _endthreadex() completed.
+
+          // Set the priority level of the current thread to the same value as
+          // the priority level of exiting threads.
+          // This is to ensure it will be given a fair chance to execute if
+          // the timeout expires.
+          hthr = GetCurrentThread();
+          SetThreadPriority(hthr, THREAD_PRIORITY_ABOVE_NORMAL);
+          for (i = 0; i < handle_count; ++i) {
+            SetThreadPriority(handles[i], THREAD_PRIORITY_ABOVE_NORMAL);
+          }
           res = WaitForMultipleObjects(handle_count, handles, TRUE, EXIT_TIMEOUT);
-          if (res == WAIT_FAILED) {
-            warning("WaitForMultipleObjects failed in %s: %d\n", __FILE__, __LINE__);
+          if (res < WAIT_OBJECT_0 || res >= (WAIT_OBJECT_0 + MAX_EXIT_HANDLES)) {
+            warning("WaitForMultipleObjects %s in %s: %d\n",
+                    (res == WAIT_FAILED ? "failed" : "timed out"), __FILE__, __LINE__);
           }
           for (i = 0; i < handle_count; ++i) {
             CloseHandle(handles[i]);

From 1da0a969933f191d41a125a3496344d5e9241bdb Mon Sep 17 00:00:00 2001
From: Jesper Wilhelmsson <jwilhelm@openjdk.org>
Date: Tue, 25 Nov 2014 13:41:08 +0100
Subject: [PATCH 152/299] 8065305: Make it possible to extend the
 G1CollectorPolicy

Added a G1CollectorPolicyExt where it is possible to extend the class.

Reviewed-by: sjohanss, tschatzl
---
 .../g1/g1CollectorPolicy.cpp                  | 12 +++++++
 .../g1/g1CollectorPolicy.hpp                  | 15 +++------
 .../g1/g1CollectorPolicy_ext.hpp              | 32 +++++++++++++++++++
 hotspot/src/share/vm/memory/universe.cpp      |  4 +--
 hotspot/src/share/vm/runtime/arguments.cpp    |  6 ++--
 hotspot/src/share/vm/runtime/arguments.hpp    |  2 +-
 .../src/share/vm/runtime/arguments_ext.hpp    | 11 ++-----
 7 files changed, 57 insertions(+), 25 deletions(-)
 create mode 100644 hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy_ext.hpp

diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
index ec9dc9a506a..d66e82d4dd6 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp
@@ -1425,6 +1425,18 @@ void G1CollectorPolicy::print_yg_surv_rate_info() const {
 #endif // PRODUCT
 }
 
+bool G1CollectorPolicy::is_young_list_full() {
+  uint young_list_length = _g1->young_list()->length();
+  uint young_list_target_length = _young_list_target_length;
+  return young_list_length >= young_list_target_length;
+}
+
+bool G1CollectorPolicy::can_expand_young_list() {
+  uint young_list_length = _g1->young_list()->length();
+  uint young_list_max_length = _young_list_max_length;
+  return young_list_length < young_list_max_length;
+}
+
 uint G1CollectorPolicy::max_regions(int purpose) {
   switch (purpose) {
     case GCAllocForSurvived:
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
index b9c73f4120b..3593be39cdb 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp
@@ -26,6 +26,7 @@
 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_HPP
 
 #include "gc_implementation/g1/collectionSetChooser.hpp"
+#include "gc_implementation/g1/g1Allocator.hpp"
 #include "gc_implementation/g1/g1MMUTracker.hpp"
 #include "memory/collectorPolicy.hpp"
 
@@ -807,7 +808,7 @@ public:
 
   // If an expansion would be appropriate, because recent GC overhead had
   // exceeded the desired limit, return an amount to expand by.
-  size_t expansion_amount();
+  virtual size_t expansion_amount();
 
   // Print tracing information.
   void print_tracing_info() const;
@@ -826,17 +827,9 @@ public:
 
   size_t young_list_target_length() const { return _young_list_target_length; }
 
-  bool is_young_list_full() {
-    uint young_list_length = _g1->young_list()->length();
-    uint young_list_target_length = _young_list_target_length;
-    return young_list_length >= young_list_target_length;
-  }
+  bool is_young_list_full();
 
-  bool can_expand_young_list() {
-    uint young_list_length = _g1->young_list()->length();
-    uint young_list_max_length = _young_list_max_length;
-    return young_list_length < young_list_max_length;
-  }
+  bool can_expand_young_list();
 
   uint young_list_max_length() {
     return _young_list_max_length;
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy_ext.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy_ext.hpp
new file mode 100644
index 00000000000..c0b90985606
--- /dev/null
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectorPolicy_ext.hpp
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ */
+
+#ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_EXT_HPP
+#define SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_EXT_HPP
+
+#include "gc_implementation/g1/g1CollectorPolicy.hpp"
+
+class G1CollectorPolicyExt : public G1CollectorPolicy { };
+
+#endif // SHARE_VM_GC_IMPLEMENTATION_G1_G1COLLECTORPOLICY_EXT_HPP
diff --git a/hotspot/src/share/vm/memory/universe.cpp b/hotspot/src/share/vm/memory/universe.cpp
index d2d1837b74f..c731140cd5f 100644
--- a/hotspot/src/share/vm/memory/universe.cpp
+++ b/hotspot/src/share/vm/memory/universe.cpp
@@ -76,7 +76,7 @@
 #include "gc_implementation/shared/adaptiveSizePolicy.hpp"
 #include "gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.hpp"
 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
-#include "gc_implementation/g1/g1CollectorPolicy.hpp"
+#include "gc_implementation/g1/g1CollectorPolicy_ext.hpp"
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.hpp"
 #endif // INCLUDE_ALL_GCS
 #if INCLUDE_CDS
@@ -799,7 +799,7 @@ jint Universe::initialize_heap() {
 
   } else if (UseG1GC) {
 #if INCLUDE_ALL_GCS
-    G1CollectorPolicy* g1p = new G1CollectorPolicy();
+    G1CollectorPolicyExt* g1p = new G1CollectorPolicyExt();
     g1p->initialize_all();
     G1CollectedHeap* g1h = new G1CollectedHeap(g1p);
     Universe::_collectedHeap = g1h;
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index f9adba7985a..7b6da5732b5 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -2300,7 +2300,7 @@ bool Arguments::check_vm_args_consistency() {
     FLAG_SET_DEFAULT(UseGCOverheadLimit, false);
   }
 
-  status = status && ArgumentsExt::check_gc_consistency_user();
+  status = status && check_gc_consistency_user();
   status = status && check_stack_pages();
 
   status = status && verify_percentage(CMSIncrementalSafetyFactor,
@@ -3556,7 +3556,7 @@ jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_req
     }
   }
 
-  if (!ArgumentsExt::check_vm_args_consistency()) {
+  if (!check_vm_args_consistency()) {
     return JNI_ERR;
   }
 
@@ -3954,7 +3954,7 @@ jint Arguments::apply_ergo() {
   // Set heap size based on available physical memory
   set_heap_size();
 
-  set_gc_specific_flags();
+  ArgumentsExt::set_gc_specific_flags();
 
   // Initialize Metaspace flags and alignments
   Metaspace::ergo_initialize();
diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp
index 3c8ae0f5679..aa62dac52e7 100644
--- a/hotspot/src/share/vm/runtime/arguments.hpp
+++ b/hotspot/src/share/vm/runtime/arguments.hpp
@@ -346,7 +346,6 @@ class Arguments : AllStatic {
   static void select_gc();
   static void set_ergonomics_flags();
   static void set_shared_spaces_flags();
-  static void set_gc_specific_flags();
   // limits the given memory size by the maximum amount of memory this process is
   // currently allowed to allocate or reserve.
   static julong limit_by_allocatable_memory(julong size);
@@ -458,6 +457,7 @@ class Arguments : AllStatic {
   // Adjusts the arguments after the OS have adjusted the arguments
   static jint adjust_after_os();
 
+  static void set_gc_specific_flags();
   static inline bool gc_selected(); // whether a gc has been selected
   static void select_gc_ergonomically();
 
diff --git a/hotspot/src/share/vm/runtime/arguments_ext.hpp b/hotspot/src/share/vm/runtime/arguments_ext.hpp
index 4016182107d..4e7415154bf 100644
--- a/hotspot/src/share/vm/runtime/arguments_ext.hpp
+++ b/hotspot/src/share/vm/runtime/arguments_ext.hpp
@@ -31,9 +31,8 @@
 class ArgumentsExt: AllStatic {
 public:
   static inline void select_gc_ergonomically();
-  static inline bool check_gc_consistency_user();
+  static inline void set_gc_specific_flags();
   static inline bool check_gc_consistency_ergo();
-  static inline bool check_vm_args_consistency();
   // The argument processing extension. Returns true if there is
   // no additional parsing needed in Arguments::parse() for the option.
   // Otherwise returns false.
@@ -44,16 +43,12 @@ void ArgumentsExt::select_gc_ergonomically() {
   Arguments::select_gc_ergonomically();
 }
 
-bool ArgumentsExt::check_gc_consistency_user() {
-  return Arguments::check_gc_consistency_user();
+void ArgumentsExt::set_gc_specific_flags() {
+  Arguments::set_gc_specific_flags();
 }
 
 bool ArgumentsExt::check_gc_consistency_ergo() {
   return Arguments::check_gc_consistency_ergo();
 }
 
-bool ArgumentsExt::check_vm_args_consistency() {
-  return Arguments::check_vm_args_consistency();
-}
-
 #endif // SHARE_VM_RUNTIME_ARGUMENTS_EXT_HPP

From bdefb9e2504f1aa01926071232e611f724c28d6e Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier <goetz@openjdk.org>
Date: Tue, 25 Nov 2014 15:59:42 +0100
Subject: [PATCH 153/299] 8065915: Fix includes after 8058148: MaxNodeLimit and
 LiveNodeCountInliningCutoff

Reviewed-by: vlivanov, dholmes
---
 hotspot/src/share/vm/ci/ciTypeFlow.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hotspot/src/share/vm/ci/ciTypeFlow.cpp b/hotspot/src/share/vm/ci/ciTypeFlow.cpp
index d78eb145624..4707cc96e14 100644
--- a/hotspot/src/share/vm/ci/ciTypeFlow.cpp
+++ b/hotspot/src/share/vm/ci/ciTypeFlow.cpp
@@ -36,6 +36,7 @@
 #include "interpreter/bytecodes.hpp"
 #include "memory/allocation.inline.hpp"
 #include "opto/compile.hpp"
+#include "opto/node.hpp"
 #include "runtime/deoptimization.hpp"
 #include "utilities/growableArray.hpp"
 

From a6da554cfb11fe793e5b31ea9e25efa2a7738993 Mon Sep 17 00:00:00 2001
From: Chris Hegarty <chegar@openjdk.org>
Date: Tue, 25 Nov 2014 18:43:44 +0000
Subject: [PATCH 154/299] 8065072:
 sun/net/www/http/HttpClient/StreamingRetry.java failed intermittently

Reviewed-by: dfuchs
---
 .../sun/net/www/http/HttpClient/StreamingRetry.java  | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java b/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java
index 35dbc51d2de..d3e2b5215d0 100644
--- a/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java
+++ b/jdk/test/sun/net/www/http/HttpClient/StreamingRetry.java
@@ -37,13 +37,13 @@ import static java.lang.System.out;
 
 public class StreamingRetry implements Runnable {
     static final int ACCEPT_TIMEOUT = 20 * 1000; // 20 seconds
-    ServerSocket ss;
+    volatile ServerSocket ss;
 
-    public static void main(String[] args) throws IOException {
+    public static void main(String[] args) throws Exception {
         (new StreamingRetry()).instanceMain();
     }
 
-    void instanceMain() throws IOException {
+    void instanceMain() throws Exception {
         out.println("Test with default method");
         test(null);
         out.println("Test with POST method");
@@ -54,12 +54,13 @@ public class StreamingRetry implements Runnable {
         if (failed > 0) throw new RuntimeException("Some tests failed");
     }
 
-    void test(String method) throws IOException {
+    void test(String method) throws Exception {
         ss = new ServerSocket(0);
         ss.setSoTimeout(ACCEPT_TIMEOUT);
         int port = ss.getLocalPort();
 
-        (new Thread(this)).start();
+        Thread otherThread = new Thread(this);
+        otherThread.start();
 
         try {
             URL url = new URL("http://localhost:" + port + "/");
@@ -77,6 +78,7 @@ public class StreamingRetry implements Runnable {
             //expected.printStackTrace();
         } finally {
             ss.close();
+            otherThread.join();
         }
     }
 

From 26dc1466b7b0c16efb8a8d51dd558542a3c95d7a Mon Sep 17 00:00:00 2001
From: David Holmes <dholmes@openjdk.org>
Date: Tue, 25 Nov 2014 21:00:21 -0500
Subject: [PATCH 155/299] 8035663: Suspicious failure of test
 java/util/concurrent/Phaser/FickleRegister.java

Reviewed-by: shade, coleenp
---
 hotspot/src/share/vm/prims/unsafe.cpp        | 50 +++++++++++++++-----
 hotspot/src/share/vm/runtime/mutexLocker.cpp |  7 +++
 hotspot/src/share/vm/runtime/mutexLocker.hpp |  4 ++
 3 files changed, 50 insertions(+), 11 deletions(-)

diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp
index f465e61589e..a85be2b874e 100644
--- a/hotspot/src/share/vm/prims/unsafe.cpp
+++ b/hotspot/src/share/vm/prims/unsafe.cpp
@@ -262,10 +262,33 @@ UNSAFE_ENTRY(void, Unsafe_SetObjectVolatile(JNIEnv *env, jobject unsafe, jobject
 UNSAFE_END
 
 #ifndef SUPPORTS_NATIVE_CX8
-// Keep old code for platforms which may not have atomic jlong (8 bytes) instructions
 
-// Volatile long versions must use locks if !VM_Version::supports_cx8().
-// support_cx8 is a surrogate for 'supports atomic long memory ops'.
+// VM_Version::supports_cx8() is a surrogate for 'supports atomic long memory ops'.
+//
+// On platforms which do not support atomic compare-and-swap of jlong (8 byte)
+// values we have to use a lock-based scheme to enforce atomicity. This has to be
+// applied to all Unsafe operations that set the value of a jlong field. Even so
+// the compareAndSwapLong operation will not be atomic with respect to direct stores
+// to the field from Java code. It is important therefore that any Java code that
+// utilizes these Unsafe jlong operations does not perform direct stores. To permit
+// direct loads of the field from Java code we must also use Atomic::store within the
+// locked regions. And for good measure, in case there are direct stores, we also
+// employ Atomic::load within those regions. Note that the field in question must be
+// volatile and so must have atomic load/store accesses applied at the Java level.
+//
+// The locking scheme could utilize a range of strategies for controlling the locking
+// granularity: from a lock per-field through to a single global lock. The latter is
+// the simplest and is used for the current implementation. Note that the Java object
+// that contains the field, can not, in general, be used for locking. To do so can lead
+// to deadlocks as we may introduce locking into what appears to the Java code to be a
+// lock-free path.
+//
+// As all the locked-regions are very short and themselves non-blocking we can treat
+// them as leaf routines and elide safepoint checks (ie we don't perform any thread
+// state transitions even when blocking for the lock). Note that if we do choose to
+// add safepoint checks and thread state transitions, we must ensure that we calculate
+// the address of the field _after_ we have acquired the lock, else the object may have
+// been moved by the GC
 
 UNSAFE_ENTRY(jlong, Unsafe_GetLongVolatile(JNIEnv *env, jobject unsafe, jobject obj, jlong offset))
   UnsafeWrapper("Unsafe_GetLongVolatile");
@@ -277,8 +300,8 @@ UNSAFE_ENTRY(jlong, Unsafe_GetLongVolatile(JNIEnv *env, jobject unsafe, jobject
     else {
       Handle p (THREAD, JNIHandles::resolve(obj));
       jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
-      ObjectLocker ol(p, THREAD);
-      jlong value = *addr;
+      MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
+      jlong value = Atomic::load(addr);
       return value;
     }
   }
@@ -293,8 +316,8 @@ UNSAFE_ENTRY(void, Unsafe_SetLongVolatile(JNIEnv *env, jobject unsafe, jobject o
     else {
       Handle p (THREAD, JNIHandles::resolve(obj));
       jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
-      ObjectLocker ol(p, THREAD);
-      *addr = x;
+      MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
+      Atomic::store(x, addr);
     }
   }
 UNSAFE_END
@@ -403,8 +426,8 @@ UNSAFE_ENTRY(void, Unsafe_SetOrderedLong(JNIEnv *env, jobject unsafe, jobject ob
     else {
       Handle p (THREAD, JNIHandles::resolve(obj));
       jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
-      ObjectLocker ol(p, THREAD);
-      *addr = x;
+      MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
+      Atomic::store(x, addr);
     }
   }
 #endif
@@ -1152,14 +1175,19 @@ UNSAFE_ENTRY(jboolean, Unsafe_CompareAndSwapLong(JNIEnv *env, jobject unsafe, jo
   UnsafeWrapper("Unsafe_CompareAndSwapLong");
   Handle p (THREAD, JNIHandles::resolve(obj));
   jlong* addr = (jlong*)(index_oop_from_field_offset_long(p(), offset));
+#ifdef SUPPORTS_NATIVE_CX8
+  return (jlong)(Atomic::cmpxchg(x, addr, e)) == e;
+#else
   if (VM_Version::supports_cx8())
     return (jlong)(Atomic::cmpxchg(x, addr, e)) == e;
   else {
     jboolean success = false;
-    ObjectLocker ol(p, THREAD);
-    if (*addr == e) { *addr = x; success = true; }
+    MutexLockerEx mu(UnsafeJlong_lock, Mutex::_no_safepoint_check_flag);
+    jlong val = Atomic::load(addr);
+    if (val == e) { Atomic::store(x, addr); success = true; }
     return success;
   }
+#endif
 UNSAFE_END
 
 UNSAFE_ENTRY(void, Unsafe_Park(JNIEnv *env, jobject unsafe, jboolean isAbsolute, jlong time))
diff --git a/hotspot/src/share/vm/runtime/mutexLocker.cpp b/hotspot/src/share/vm/runtime/mutexLocker.cpp
index 687a8a27482..a2c53bb885e 100644
--- a/hotspot/src/share/vm/runtime/mutexLocker.cpp
+++ b/hotspot/src/share/vm/runtime/mutexLocker.cpp
@@ -136,6 +136,10 @@ Mutex*   JfrStream_lock               = NULL;
 Mutex*   JfrThreadGroups_lock         = NULL;
 #endif
 
+#ifndef SUPPORTS_NATIVE_CX8
+Mutex*   UnsafeJlong_lock             = NULL;
+#endif
+
 #define MAX_NUM_MUTEX 128
 static Monitor * _mutex_array[MAX_NUM_MUTEX];
 static int _num_mutex;
@@ -286,6 +290,9 @@ void mutex_init() {
   def(JfrStacktrace_lock           , Mutex,   special,     true);
 #endif
 
+#ifndef SUPPORTS_NATIVE_CX8
+  def(UnsafeJlong_lock             , Mutex,   special,     false);
+#endif
 }
 
 GCMutexLocker::GCMutexLocker(Monitor * mutex) {
diff --git a/hotspot/src/share/vm/runtime/mutexLocker.hpp b/hotspot/src/share/vm/runtime/mutexLocker.hpp
index 4b36abc127b..8ec82fc63dd 100644
--- a/hotspot/src/share/vm/runtime/mutexLocker.hpp
+++ b/hotspot/src/share/vm/runtime/mutexLocker.hpp
@@ -136,6 +136,10 @@ extern Mutex*   JfrStream_lock;                  // protects JFR stream access
 extern Mutex*   JfrThreadGroups_lock;            // protects JFR access to Thread Groups
 #endif
 
+#ifndef SUPPORTS_NATIVE_CX8
+extern Mutex*   UnsafeJlong_lock;                // provides Unsafe atomic updates to jlongs on platforms that don't support cx8
+#endif
+
 // A MutexLocker provides mutual exclusion with respect to a given mutex
 // for the scope which contains the locker.  The lock is an OS lock, not
 // an object lock, and the two do not interoperate.  Do not use Mutex-based

From 137d39454df62bf1b4a3dd7cbd4b21fa1fa7c5e1 Mon Sep 17 00:00:00 2001
From: Tobias Hartmann <thartmann@openjdk.org>
Date: Wed, 26 Nov 2014 08:06:58 +0100
Subject: [PATCH 156/299] 8007993: hotspot.log w/ enabled LogCompilation can be
 an invalid XML

Open compilation log files in write-mode and close before deletion attempt.

Reviewed-by: vlivanov
---
 hotspot/src/share/vm/compiler/compileBroker.cpp | 2 +-
 hotspot/src/share/vm/compiler/compileLog.cpp    | 7 ++++---
 2 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/hotspot/src/share/vm/compiler/compileBroker.cpp b/hotspot/src/share/vm/compiler/compileBroker.cpp
index 079d0835883..2b22da1f705 100644
--- a/hotspot/src/share/vm/compiler/compileBroker.cpp
+++ b/hotspot/src/share/vm/compiler/compileBroker.cpp
@@ -1807,7 +1807,7 @@ void CompileBroker::init_compiler_thread_log() {
                      os::file_separator(), thread_id, os::current_process_id());
       }
 
-      fp = fopen(file_name, "at");
+      fp = fopen(file_name, "wt");
       if (fp != NULL) {
         if (LogCompilation && Verbose) {
           tty->print_cr("Opening compilation log %s", file_name);
diff --git a/hotspot/src/share/vm/compiler/compileLog.cpp b/hotspot/src/share/vm/compiler/compileLog.cpp
index 340251f3265..88cfb1bbfb6 100644
--- a/hotspot/src/share/vm/compiler/compileLog.cpp
+++ b/hotspot/src/share/vm/compiler/compileLog.cpp
@@ -56,8 +56,10 @@ CompileLog::CompileLog(const char* file_name, FILE* fp, intx thread_id)
 }
 
 CompileLog::~CompileLog() {
-  delete _out;
+  delete _out; // Close fd in fileStream::~fileStream()
   _out = NULL;
+  // Remove partial file after merging in CompileLog::finish_log_on_error
+  unlink(_file);
   FREE_C_HEAP_ARRAY(char, _identities, mtCompiler);
   FREE_C_HEAP_ARRAY(char, _file, mtCompiler);
 }
@@ -278,10 +280,9 @@ void CompileLog::finish_log_on_error(outputStream* file, char* buf, int buflen)
       }
       file->print_raw_cr("</compilation_log>");
       close(partial_fd);
-      unlink(partial_file);
     }
     CompileLog* next_log = log->_next;
-    delete log;
+    delete log; // Removes partial file
     log = next_log;
   }
   _first = NULL;

From eafad5770a80bdfd8451f192fce41ef2d34829fb Mon Sep 17 00:00:00 2001
From: Weijun Wang <weijun@openjdk.org>
Date: Wed, 26 Nov 2014 15:28:46 +0800
Subject: [PATCH 157/299] 8061253: Spec cleanup for some security-related
 classes

Reviewed-by: mullan
---
 .../share/classes/java/security/KeyStore.java |  3 +-
 .../classes/java/security/Principal.java      |  3 +-
 .../javax/security/auth/Destroyable.java      |  4 +-
 .../security/auth/kerberos/EncryptionKey.java | 26 +++++++++----
 .../auth/kerberos/KerberosCredMessage.java    | 23 ++++++++++++
 .../security/auth/kerberos/KerberosKey.java   | 37 +++++++++++--------
 .../auth/kerberos/KerberosPrincipal.java      | 32 +++++++++-------
 .../auth/kerberos/KerberosTicket.java         | 31 +++++++++-------
 .../javax/security/auth/kerberos/KeyTab.java  | 29 +++++++++------
 9 files changed, 122 insertions(+), 66 deletions(-)

diff --git a/jdk/src/java.base/share/classes/java/security/KeyStore.java b/jdk/src/java.base/share/classes/java/security/KeyStore.java
index 4278369e8be..53e787b7d98 100644
--- a/jdk/src/java.base/share/classes/java/security/KeyStore.java
+++ b/jdk/src/java.base/share/classes/java/security/KeyStore.java
@@ -416,7 +416,8 @@ public class KeyStore {
 
         /**
          * Retrieves the attributes associated with an entry.
-         * <p>
+         *
+         * @implSpec
          * The default implementation returns an empty {@code Set}.
          *
          * @return an unmodifiable {@code Set} of attributes, possibly empty
diff --git a/jdk/src/java.base/share/classes/java/security/Principal.java b/jdk/src/java.base/share/classes/java/security/Principal.java
index a538e707ee7..db1e7d5fd02 100644
--- a/jdk/src/java.base/share/classes/java/security/Principal.java
+++ b/jdk/src/java.base/share/classes/java/security/Principal.java
@@ -74,7 +74,8 @@ public interface Principal {
     /**
      * Returns true if the specified subject is implied by this principal.
      *
-     * <p>The default implementation of this method returns true if
+     * @implSpec
+     * The default implementation of this method returns true if
      * {@code subject} is non-null and contains at least one principal that
      * is equal to this principal.
      *
diff --git a/jdk/src/java.base/share/classes/javax/security/auth/Destroyable.java b/jdk/src/java.base/share/classes/javax/security/auth/Destroyable.java
index 15b92006cdf..4d1afe56fd5 100644
--- a/jdk/src/java.base/share/classes/javax/security/auth/Destroyable.java
+++ b/jdk/src/java.base/share/classes/javax/security/auth/Destroyable.java
@@ -41,7 +41,7 @@ public interface Destroyable {
      * on this {@code Object} will result in an
      * {@code IllegalStateException} being thrown.
      *
-     * <p>
+     * @implSpec
      * The default implementation throws {@code DestroyFailedException}.
      *
      * @exception DestroyFailedException if the destroy operation fails. <p>
@@ -56,7 +56,7 @@ public interface Destroyable {
     /**
      * Determine if this {@code Object} has been destroyed.
      *
-     * <p>
+     * @implSpec
      * The default implementation returns false.
      *
      * @return true if this {@code Object} has been destroyed,
diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java
index 22730b60844..08b9179a11f 100644
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/EncryptionKey.java
@@ -158,6 +158,11 @@ public final class EncryptionKey implements SecretKey {
         return destroyed;
     }
 
+    /**
+     * Returns an informative textual representation of this {@code EncryptionKey}.
+     *
+     * @return an informative textual representation of this {@code EncryptionKey}.
+     */
     @Override
     public String toString() {
         if (destroyed) {
@@ -166,6 +171,11 @@ public final class EncryptionKey implements SecretKey {
         return "key "  + key.toString();
     }
 
+    /**
+     * Returns a hash code for this {@code EncryptionKey}.
+     *
+     * @return a hash code for this {@code EncryptionKey}.
+     */
     @Override
     public int hashCode() {
         int result = 17;
@@ -177,15 +187,17 @@ public final class EncryptionKey implements SecretKey {
     }
 
     /**
-     * Compares the specified Object with this key for equality.
-     * Returns true if the given object is also a
+     * Compares the specified object with this key for equality.
+     * Returns true if the given object is also an
      * {@code EncryptionKey} and the two
-     * {@code EncryptionKey} instances are equivalent.
+     * {@code EncryptionKey} instances are equivalent. More formally two
+     * {@code EncryptionKey} instances are equal if they have equal key types
+     * and key material.
+     * A destroyed {@code EncryptionKey} object is only equal to itself.
      *
-     * @param other the Object to compare to
-     * @return true if the specified object is equal to this EncryptionKey,
-     * false otherwise. NOTE: Returns false if either of the EncryptionKey
-     * objects has been destroyed.
+     * @param other the object to compare to
+     * @return true if the specified object is equal to this
+     * {@code EncryptionKey}, false otherwise.
      */
     @Override
     public boolean equals(Object other) {
diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java
index ee2010b1531..e45ae2a4cee 100644
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosCredMessage.java
@@ -130,6 +130,11 @@ public final class KerberosCredMessage implements Destroyable {
         return destroyed;
     }
 
+    /**
+     * Returns an informative textual representation of this {@code KerberosCredMessage}.
+     *
+     * @return an informative textual representation of this {@code KerberosCredMessage}.
+     */
     @Override
     public String toString() {
         if (destroyed) {
@@ -140,6 +145,11 @@ public final class KerberosCredMessage implements Destroyable {
         }
     }
 
+    /**
+     * Returns a hash code for this {@code KerberosCredMessage}.
+     *
+     * @return a hash code for this {@code KerberosCredMessage}.
+     */
     @Override
     public int hashCode() {
         if (isDestroyed()) {
@@ -149,6 +159,19 @@ public final class KerberosCredMessage implements Destroyable {
         }
     }
 
+    /**
+     * Compares the specified object with this {@code KerberosCredMessage}
+     * for equality. Returns true if the given object is also a
+     * {@code KerberosCredMessage} and the two {@code KerberosCredMessage}
+     * instances are equivalent. More formally two {@code KerberosCredMessage}
+     * instances are equal if they have equal sender, recipient, and encoded
+     * KRB_CRED messages.
+     * A destroyed {@code KerberosCredMessage} object is only equal to itself.
+     *
+     * @param other the object to compare to
+     * @return true if the specified object is equal to this
+     * {@code KerberosCredMessage}, false otherwise.
+     */
     @Override
     public boolean equals(Object other) {
         if (other == this) {
diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosKey.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosKey.java
index b233052f44f..84a39e0e129 100644
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosKey.java
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosKey.java
@@ -61,10 +61,10 @@ import javax.security.auth.DestroyFailedException;
  *
  * It might be necessary for the application to be granted a
  * {@link javax.security.auth.PrivateCredentialPermission
- * PrivateCredentialPermission} if it needs to access the KerberosKey
+ * PrivateCredentialPermission} if it needs to access the {@code KerberosKey}
  * instance from a Subject. This permission is not needed when the
  * application depends on the default JGSS Kerberos mechanism to access the
- * KerberosKey. In that case, however, the application will need an
+ * {@code KerberosKey}. In that case, however, the application will need an
  * appropriate
  * {@link javax.security.auth.kerberos.ServicePermission ServicePermission}.<p>
  *
@@ -113,9 +113,9 @@ public class KerberosKey implements SecretKey {
     private transient boolean destroyed = false;
 
     /**
-     * Constructs a KerberosKey from the given bytes when the key type and
-     * key version number are known. This can be used when reading the secret
-     * key information from a Kerberos "keytab".
+     * Constructs a {@code KerberosKey} from the given bytes when the key type
+     * and key version number are known. This can be used when reading the
+     * secret key information from a Kerberos "keytab".
      *
      * @param principal the principal that this secret key belongs to
      * @param keyBytes the key material for the secret key
@@ -133,9 +133,9 @@ public class KerberosKey implements SecretKey {
     }
 
     /**
-     * Constructs a KerberosKey from a principal's password using the specified
-     * algorithm name. The algorithm name (case insensitive) should be provided
-     * as the encryption type string defined on the IANA
+     * Constructs a {@code KerberosKey} from a principal's password using the
+     * specified algorithm name. The algorithm name (case insensitive) should
+     * be provided as the encryption type string defined on the IANA
      * <a href="https://www.iana.org/assignments/kerberos-parameters/kerberos-parameters.xhtml#kerberos-parameters-1">Kerberos Encryption Type Numbers</a>
      * page. The version number of the key generated will be 0.
      *
@@ -261,6 +261,11 @@ public class KerberosKey implements SecretKey {
         return destroyed;
     }
 
+    /**
+     * Returns an informative textual representation of this {@code KerberosKey}.
+     *
+     * @return an informative textual representation of this {@code KerberosKey}.
+     */
     public String toString() {
         if (destroyed) {
             return "Destroyed KerberosKey";
@@ -271,9 +276,9 @@ public class KerberosKey implements SecretKey {
     }
 
     /**
-     * Returns a hashcode for this KerberosKey.
+     * Returns a hash code for this {@code KerberosKey}.
      *
-     * @return a hashCode() for the {@code KerberosKey}
+     * @return a hash code for this {@code KerberosKey}.
      * @since 1.6
      */
     public int hashCode() {
@@ -290,15 +295,15 @@ public class KerberosKey implements SecretKey {
     }
 
     /**
-     * Compares the specified Object with this KerberosKey for equality.
-     * Returns true if the given object is also a
+     * Compares the specified object with this {@code KerberosKey} for
+     * equality. Returns true if the given object is also a
      * {@code KerberosKey} and the two
      * {@code KerberosKey} instances are equivalent.
+     * A destroyed {@code KerberosKey} object is only equal to itself.
      *
-     * @param other the Object to compare to
-     * @return true if the specified object is equal to this KerberosKey,
-     * false otherwise. NOTE: Returns false if either of the KerberosKey
-     * objects has been destroyed.
+     * @param other the object to compare to
+     * @return true if the specified object is equal to this {@code KerberosKey},
+     * false otherwise.
      * @since 1.6
      */
     public boolean equals(Object other) {
diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java
index 1c033803cc7..3a1c2c4c41b 100644
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosPrincipal.java
@@ -88,8 +88,8 @@ public final class KerberosPrincipal
 
 
     /**
-     * Constructs a KerberosPrincipal from the provided string input. The
-     * name type for this  principal defaults to
+     * Constructs a {@code KerberosPrincipal} from the provided string input.
+     * The name type for this principal defaults to
      * {@link #KRB_NT_PRINCIPAL KRB_NT_PRINCIPAL}
      * This string is assumed to contain a name in the format
      * that is specified in Section 2.1.1. (Kerberos Principal Name Form) of
@@ -127,7 +127,7 @@ public final class KerberosPrincipal
     }
 
     /**
-     * Constructs a KerberosPrincipal from the provided string and
+     * Constructs a {@code KerberosPrincipal} from the provided string and
      * name type input.  The string is assumed to contain a name in the
      * format that is specified in Section 2.1 (Mandatory Name Forms) of
      * <a href=http://www.ietf.org/rfc/rfc1964.txt>RFC 1964</a>.
@@ -137,7 +137,7 @@ public final class KerberosPrincipal
      * (for example, <i>duke@FOO.COM</i>, is a valid input string for the
      * name type, KRB_NT_PRINCIPAL where <i>duke</i>
      * represents a principal, and <i>FOO.COM</i> represents a realm).
-
+     *
      * <p> If the input name does not contain a realm, the default realm
      * is used. The default realm can be specified either in a Kerberos
      * configuration file or via the java.security.krb5.realm
@@ -179,28 +179,28 @@ public final class KerberosPrincipal
     }
 
     /**
-     * Returns a hashcode for this principal. The hash code is defined to
-     * be the result of the following  calculation:
+     * Returns a hash code for this {@code KerberosPrincipal}. The hash code
+     * is defined to be the result of the following calculation:
      * <pre>{@code
      *  hashCode = getName().hashCode();
      * }</pre>
      *
-     * @return a hashCode() for the {@code KerberosPrincipal}
+     * @return a hash code for this {@code KerberosPrincipal}.
      */
     public int hashCode() {
         return getName().hashCode();
     }
 
     /**
-     * Compares the specified Object with this Principal for equality.
+     * Compares the specified object with this principal for equality.
      * Returns true if the given object is also a
      * {@code KerberosPrincipal} and the two
      * {@code KerberosPrincipal} instances are equivalent.
      * More formally two {@code KerberosPrincipal} instances are equal
      * if the values returned by {@code getName()} are equal.
      *
-     * @param other the Object to compare to
-     * @return true if the Object passed in represents the same principal
+     * @param other the object to compare to
+     * @return true if the object passed in represents the same principal
      * as this one, false otherwise.
      */
     public boolean equals(Object other) {
@@ -217,11 +217,11 @@ public final class KerberosPrincipal
     }
 
     /**
-     * Save the KerberosPrincipal object to a stream
+     * Save the {@code KerberosPrincipal} object to a stream
      *
      * @serialData this {@code KerberosPrincipal} is serialized
      *          by writing out the PrincipalName and the
-     *          realm in their DER-encoded form as specified in Section 5.2.2 of
+     *          Realm in their DER-encoded form as specified in Section 5.2.2 of
      *          <a href=http://www.ietf.org/rfc/rfc4120.txt> RFC4120</a>.
      */
     private void writeObject(ObjectOutputStream oos)
@@ -268,7 +268,7 @@ public final class KerberosPrincipal
     }
 
     /**
-     * Returns the name type of the KerberosPrincipal. Valid name types
+     * Returns the name type of the {@code KerberosPrincipal}. Valid name types
      * are specified in Section 6.2 of
      * <a href=http://www.ietf.org/rfc/rfc4120.txt> RFC4120</a>.
      *
@@ -278,7 +278,11 @@ public final class KerberosPrincipal
         return nameType;
     }
 
-    // Inherits javadocs from Object
+    /**
+     * Returns an informative textual representation of this {@code KerberosPrincipal}.
+     *
+     * @return an informative textual representation of this {@code KerberosPrincipal}.
+     */
     public String toString() {
         return getName();
     }
diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java
index 513b49c1fc0..2be499ff80b 100644
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KerberosTicket.java
@@ -53,10 +53,10 @@ import sun.misc.HexDumpEncoder;
  *
  * It might be necessary for the application to be granted a
  * {@link javax.security.auth.PrivateCredentialPermission
- * PrivateCredentialPermission} if it needs to access a KerberosTicket
- * instance from a Subject. This permission is not needed when the
+ * PrivateCredentialPermission} if it needs to access a {@code KerberosTicket}
+ * instance from a {@code Subject}. This permission is not needed when the
  * application depends on the default JGSS Kerberos mechanism to access the
- * KerberosTicket. In that case, however, the application will need an
+ * {@code KerberosTicket}. In that case, however, the application will need an
  * appropriate
  * {@link javax.security.auth.kerberos.ServicePermission ServicePermission}.
  * <p>
@@ -193,7 +193,7 @@ public class KerberosTicket implements Destroyable, Refreshable,
     private transient boolean destroyed = false;
 
     /**
-     * Constructs a KerberosTicket using credentials information that a
+     * Constructs a {@code KerberosTicket} using credentials information that a
      * client either receives from a KDC or reads from a cache.
      *
      * @param asn1Encoding the ASN.1 encoding of the ticket as defined by
@@ -565,8 +565,8 @@ public class KerberosTicket implements Destroyable, Refreshable,
 
         try {
             krb5Creds = new sun.security.krb5.Credentials(asn1Encoding,
-                                                    client.toString(),
-                                                    server.toString(),
+                                                    client.getName(),
+                                                    server.getName(),
                                                     sessionKey.getEncoded(),
                                                     sessionKey.getKeyType(),
                                                     flags,
@@ -644,6 +644,11 @@ public class KerberosTicket implements Destroyable, Refreshable,
         return destroyed;
     }
 
+    /**
+     * Returns an informative textual representation of this {@code KerberosTicket}.
+     *
+     * @return an informative textual representation of this {@code KerberosTicket}.
+     */
     public String toString() {
         if (destroyed) {
             return "Destroyed KerberosTicket";
@@ -677,9 +682,9 @@ public class KerberosTicket implements Destroyable, Refreshable,
     }
 
     /**
-     * Returns a hashcode for this KerberosTicket.
+     * Returns a hash code for this {@code KerberosTicket}.
      *
-     * @return a hashCode() for the {@code KerberosTicket}
+     * @return a hash code for this {@code KerberosTicket}.
      * @since 1.6
      */
     public int hashCode() {
@@ -714,15 +719,15 @@ public class KerberosTicket implements Destroyable, Refreshable,
     }
 
     /**
-     * Compares the specified Object with this KerberosTicket for equality.
+     * Compares the specified object with this {@code KerberosTicket} for equality.
      * Returns true if the given object is also a
      * {@code KerberosTicket} and the two
      * {@code KerberosTicket} instances are equivalent.
+     * A destroyed {@code KerberosTicket} object is only equal to itself.
      *
-     * @param other the Object to compare to
-     * @return true if the specified object is equal to this KerberosTicket,
-     * false otherwise. NOTE: Returns false if either of the KerberosTicket
-     * objects has been destroyed.
+     * @param other the object to compare to
+     * @return true if the specified object is equal to this {@code KerberosTicket},
+     * false otherwise.
      * @since 1.6
      */
     public boolean equals(Object other) {
diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyTab.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyTab.java
index db815395e3a..3b636077b08 100644
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyTab.java
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/KeyTab.java
@@ -58,10 +58,10 @@ import sun.security.krb5.RealmException;
  * <p>
  * It might be necessary for the application to be granted a
  * {@link javax.security.auth.PrivateCredentialPermission
- * PrivateCredentialPermission} if it needs to access the KeyTab
- * instance from a Subject. This permission is not needed when the
+ * PrivateCredentialPermission} if it needs to access the {@code KeyTab}
+ * instance from a {@code Subject}. This permission is not needed when the
  * application depends on the default JGSS Kerberos mechanism to access the
- * KeyTab. In that case, however, the application will need an appropriate
+ * {@code KeyTab}. In that case, however, the application will need an appropriate
  * {@link javax.security.auth.kerberos.ServicePermission ServicePermission}.
  * <p>
  * The keytab file format is described at
@@ -249,7 +249,7 @@ public final class KeyTab {
      * could potentially be expired.
      * <p>
      * If there is any error (say, I/O error or format error)
-     * during the reading process of the KeyTab file, a saved result should be
+     * during the reading process of the keytab file, a saved result should be
      * returned. If there is no saved result (say, this is the first time this
      * method is called, or, all previous read attempts failed), an empty array
      * should be returned. This can make sure the result is not drastically
@@ -316,6 +316,11 @@ public final class KeyTab {
         return !takeSnapshot().isMissing();
     }
 
+    /**
+     * Returns an informative textual representation of this {@code KeyTab}.
+     *
+     * @return an informative textual representation of this {@code KeyTab}.
+     */
     public String toString() {
         String s = (file == null) ? "Default keytab" : file.toString();
         if (!bound) return s;
@@ -324,22 +329,22 @@ public final class KeyTab {
     }
 
     /**
-     * Returns a hashcode for this KeyTab.
+     * Returns a hash code for this {@code KeyTab}.
      *
-     * @return a hashCode() for the {@code KeyTab}
+     * @return a hash code for this {@code KeyTab}.
      */
     public int hashCode() {
         return Objects.hash(file, princ, bound);
     }
 
     /**
-     * Compares the specified Object with this KeyTab for equality.
+     * Compares the specified object with this {@code KeyTab} for equality.
      * Returns true if the given object is also a
      * {@code KeyTab} and the two
      * {@code KeyTab} instances are equivalent.
      *
-     * @param other the Object to compare to
-     * @return true if the specified object is equal to this KeyTab
+     * @param other the object to compare to
+     * @return true if the specified object is equal to this {@code KeyTab}
      */
     public boolean equals(Object other) {
         if (other == this)
@@ -359,9 +364,9 @@ public final class KeyTab {
      * Returns the service principal this {@code KeyTab} object
      * is bound to. Returns {@code null} if it's not bound.
      * <p>
-     * Please note the deprecated constructors create a KeyTab object bound for
-     * some unknown principal. In this case, this method also returns null.
-     * User can call {@link #isBound()} to verify this case.
+     * Please note the deprecated constructors create a {@code KeyTab} object
+     * bound for some unknown principal. In this case, this method also returns
+     * null. User can call {@link #isBound()} to verify this case.
      * @return the service principal
      * @since 1.8
      */

From d65f3c41b7bcf1d332239c8ad25aa5bab1d09ee1 Mon Sep 17 00:00:00 2001
From: Mikael Gerdin <mgerdin@openjdk.org>
Date: Wed, 26 Nov 2014 10:51:52 +0100
Subject: [PATCH 158/299] 8065218: Move CMS-specific fields from Space to
 CompactibleFreeListSpace

Reviewed-by: brutisso, tschatzl, sangheki
---
 .../concurrentMarkSweep/compactibleFreeListSpace.cpp  |  3 ++-
 .../concurrentMarkSweep/compactibleFreeListSpace.hpp  | 11 +++++++++++
 hotspot/src/share/vm/memory/space.hpp                 | 11 +++--------
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
index 812b8bcf3cf..1658e6612bd 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.cpp
@@ -90,7 +90,8 @@ CompactibleFreeListSpace::CompactibleFreeListSpace(BlockOffsetSharedArray* bs,
                     CMSRescanMultiple),
   _marking_task_size(CardTableModRefBS::card_size_in_words * BitsPerWord *
                     CMSConcMarkMultiple),
-  _collector(NULL)
+  _collector(NULL),
+  _preconsumptionDirtyCardClosure(NULL)
 {
   assert(sizeof(FreeChunk) / BytesPerWord <= MinChunkSize,
          "FreeChunk is larger than expected");
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp
index 5c05828103c..11f622b1258 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp
@@ -155,6 +155,9 @@ class CompactibleFreeListSpace: public CompactibleSpace {
   // Used to keep track of limit of sweep for the space
   HeapWord* _sweep_limit;
 
+  // Used to make the young collector update the mod union table
+  MemRegionClosure* _preconsumptionDirtyCardClosure;
+
   // Support for compacting cms
   HeapWord* cross_threshold(HeapWord* start, HeapWord* end);
   HeapWord* forward(oop q, size_t size, CompactPoint* cp, HeapWord* compact_top);
@@ -356,6 +359,14 @@ class CompactibleFreeListSpace: public CompactibleSpace {
   void initialize_sequential_subtasks_for_marking(int n_threads,
          HeapWord* low = NULL);
 
+  virtual MemRegionClosure* preconsumptionDirtyCardClosure() const {
+    return _preconsumptionDirtyCardClosure;
+  }
+
+  void setPreconsumptionDirtyCardClosure(MemRegionClosure* cl) {
+    _preconsumptionDirtyCardClosure = cl;
+  }
+
   // Space enquiries
   size_t used() const;
   size_t free() const;
diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp
index d0c7a111784..a590dbf0067 100644
--- a/hotspot/src/share/vm/memory/space.hpp
+++ b/hotspot/src/share/vm/memory/space.hpp
@@ -70,15 +70,13 @@ class Space: public CHeapObj<mtGC> {
   // Used in support of save_marks()
   HeapWord* _saved_mark_word;
 
-  MemRegionClosure* _preconsumptionDirtyCardClosure;
-
   // A sequential tasks done structure. This supports
   // parallel GC, where we have threads dynamically
   // claiming sub-tasks from a larger parallel task.
   SequentialSubTasksDone _par_seq_tasks;
 
   Space():
-    _bottom(NULL), _end(NULL), _preconsumptionDirtyCardClosure(NULL) { }
+    _bottom(NULL), _end(NULL) { }
 
  public:
   // Accessors
@@ -97,11 +95,8 @@ class Space: public CHeapObj<mtGC> {
     return (HeapWord*)obj >= saved_mark_word();
   }
 
-  MemRegionClosure* preconsumptionDirtyCardClosure() const {
-    return _preconsumptionDirtyCardClosure;
-  }
-  void setPreconsumptionDirtyCardClosure(MemRegionClosure* cl) {
-    _preconsumptionDirtyCardClosure = cl;
+  virtual MemRegionClosure* preconsumptionDirtyCardClosure() const {
+    return NULL;
   }
 
   // Returns a subregion of the space containing only the allocated objects in

From b5ef32af36198991214ee03ee4b547ebde8c5106 Mon Sep 17 00:00:00 2001
From: Mikael Gerdin <mgerdin@openjdk.org>
Date: Wed, 26 Nov 2014 10:53:31 +0100
Subject: [PATCH 159/299] 8065358: Refactor G1s usage of save_marks and reduce
 related races

Stop using save_marks in G1 related code and make setting the replacement field less racy.

Reviewed-by: brutisso, tschatzl
---
 .../vm/gc_implementation/g1/g1Allocator.cpp   |  5 +-
 .../gc_implementation/g1/g1CollectedHeap.cpp  |  2 +-
 .../vm/gc_implementation/g1/g1RemSet.cpp      |  8 ++-
 .../vm/gc_implementation/g1/heapRegion.cpp    | 49 ++++++++++---------
 .../vm/gc_implementation/g1/heapRegion.hpp    | 40 +++++++--------
 5 files changed, 54 insertions(+), 50 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp
index 86149eca495..695feeea6f6 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1Allocator.cpp
@@ -59,7 +59,7 @@ void G1Allocator::reuse_retained_old_region(EvacuationInfo& evacuation_info,
       !(retained_region->top() == retained_region->end()) &&
       !retained_region->is_empty() &&
       !retained_region->is_humongous()) {
-    retained_region->record_top_and_timestamp();
+    retained_region->record_timestamp();
     // The retained region was added to the old region set when it was
     // retired. We have to remove it now, since we don't allow regions
     // we allocate to in the region sets. We'll re-add it later, when
@@ -94,6 +94,9 @@ void G1DefaultAllocator::release_gc_alloc_regions(uint no_of_gc_workers, Evacuat
   // want either way so no reason to check explicitly for either
   // condition.
   _retained_old_gc_alloc_region = old_gc_alloc_region(context)->release();
+  if (_retained_old_gc_alloc_region != NULL) {
+    _retained_old_gc_alloc_region->record_retained_region();
+  }
 
   if (ResizePLAB) {
     _g1h->_survivor_plab_stats.adjust_desired_plab_sz(no_of_gc_workers);
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index 742e5cef1c2..f00116fead3 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -6530,7 +6530,7 @@ HeapRegion* G1CollectedHeap::new_gc_alloc_region(size_t word_size,
       // We really only need to do this for old regions given that we
       // should never scan survivors. But it doesn't hurt to do it
       // for survivors too.
-      new_alloc_region->record_top_and_timestamp();
+      new_alloc_region->record_timestamp();
       if (survivor) {
         new_alloc_region->set_survivor();
         _hr_printer.alloc(new_alloc_region, G1HRPrinter::Survivor);
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
index 048c09f5c52..23a0531f2d5 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
@@ -140,11 +140,9 @@ public:
 
     // Set the "from" region in the closure.
     _oc->set_region(r);
-    HeapWord* card_start = _bot_shared->address_for_index(index);
-    HeapWord* card_end = card_start + G1BlockOffsetSharedArray::N_words;
-    Space *sp = SharedHeap::heap()->space_containing(card_start);
-    MemRegion sm_region = sp->used_region_at_save_marks();
-    MemRegion mr = sm_region.intersection(MemRegion(card_start,card_end));
+    MemRegion card_region(_bot_shared->address_for_index(index), G1BlockOffsetSharedArray::N_words);
+    MemRegion pre_gc_allocated(r->bottom(), r->scan_top());
+    MemRegion mr = pre_gc_allocated.intersection(card_region);
     if (!mr.is_empty() && !_ct_bs->is_card_claimed(index)) {
       // We make the card as "claimed" lazily (so races are possible
       // but they're benign), which reduces the number of duplicate
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
index 299eec5a3e6..7be4de130d2 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.cpp
@@ -326,7 +326,7 @@ void HeapRegion::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
 
   hr_clear(false /*par*/, false /*clear_space*/);
   set_top(bottom());
-  record_top_and_timestamp();
+  record_timestamp();
 
   assert(mr.end() == orig_end(),
          err_msg("Given region end address " PTR_FORMAT " should match exactly "
@@ -416,9 +416,9 @@ oops_on_card_seq_iterate_careful(MemRegion mr,
 
   // If we're within a stop-world GC, then we might look at a card in a
   // GC alloc region that extends onto a GC LAB, which may not be
-  // parseable.  Stop such at the "saved_mark" of the region.
+  // parseable.  Stop such at the "scan_top" of the region.
   if (g1h->is_gc_active()) {
-    mr = mr.intersection(used_region_at_save_marks());
+    mr = mr.intersection(MemRegion(bottom(), scan_top()));
   } else {
     mr = mr.intersection(used_region());
   }
@@ -969,7 +969,7 @@ void HeapRegion::prepare_for_compaction(CompactPoint* cp) {
 
 void G1OffsetTableContigSpace::clear(bool mangle_space) {
   set_top(bottom());
-  set_saved_mark_word(bottom());
+  _scan_top = bottom();
   CompactibleSpace::clear(mangle_space);
   reset_bot();
 }
@@ -1001,41 +1001,42 @@ HeapWord* G1OffsetTableContigSpace::cross_threshold(HeapWord* start,
   return _offsets.threshold();
 }
 
-HeapWord* G1OffsetTableContigSpace::saved_mark_word() const {
+HeapWord* G1OffsetTableContigSpace::scan_top() const {
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
-  assert( _gc_time_stamp <= g1h->get_gc_time_stamp(), "invariant" );
   HeapWord* local_top = top();
   OrderAccess::loadload();
-  if (_gc_time_stamp < g1h->get_gc_time_stamp()) {
+  const unsigned local_time_stamp = _gc_time_stamp;
+  assert(local_time_stamp <= g1h->get_gc_time_stamp(), "invariant");
+  if (local_time_stamp < g1h->get_gc_time_stamp()) {
     return local_top;
   } else {
-    return Space::saved_mark_word();
+    return _scan_top;
   }
 }
 
-void G1OffsetTableContigSpace::record_top_and_timestamp() {
+void G1OffsetTableContigSpace::record_timestamp() {
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
   unsigned curr_gc_time_stamp = g1h->get_gc_time_stamp();
 
   if (_gc_time_stamp < curr_gc_time_stamp) {
-    // The order of these is important, as another thread might be
-    // about to start scanning this region. If it does so after
-    // set_saved_mark and before _gc_time_stamp = ..., then the latter
-    // will be false, and it will pick up top() as the high water mark
-    // of region. If it does so after _gc_time_stamp = ..., then it
-    // will pick up the right saved_mark_word() as the high water mark
-    // of the region. Either way, the behavior will be correct.
-    Space::set_saved_mark_word(top());
-    OrderAccess::storestore();
+    // Setting the time stamp here tells concurrent readers to look at
+    // scan_top to know the maximum allowed address to look at.
+
+    // scan_top should be bottom for all regions except for the
+    // retained old alloc region which should have scan_top == top
+    HeapWord* st = _scan_top;
+    guarantee(st == _bottom || st == _top, "invariant");
+
     _gc_time_stamp = curr_gc_time_stamp;
-    // No need to do another barrier to flush the writes above. If
-    // this is called in parallel with other threads trying to
-    // allocate into the region, the caller should call this while
-    // holding a lock and when the lock is released the writes will be
-    // flushed.
   }
 }
 
+void G1OffsetTableContigSpace::record_retained_region() {
+  // scan_top is the maximum address where it's safe for the next gc to
+  // scan this region.
+  _scan_top = top();
+}
+
 void G1OffsetTableContigSpace::safe_object_iterate(ObjectClosure* blk) {
   object_iterate(blk);
 }
@@ -1063,6 +1064,8 @@ G1OffsetTableContigSpace(G1BlockOffsetSharedArray* sharedOffsetArray,
 void G1OffsetTableContigSpace::initialize(MemRegion mr, bool clear_space, bool mangle_space) {
   CompactibleSpace::initialize(mr, clear_space, mangle_space);
   _top = bottom();
+  _scan_top = bottom();
+  set_saved_mark_word(NULL);
   reset_bot();
 }
 
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp
index 997524b5bed..3c4e91b0cf8 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegion.hpp
@@ -101,28 +101,25 @@ public:
 // OffsetTableContigSpace.  If the two versions of BlockOffsetTable could
 // be reconciled, then G1OffsetTableContigSpace could go away.
 
-// The idea behind time stamps is the following. Doing a save_marks on
-// all regions at every GC pause is time consuming (if I remember
-// well, 10ms or so). So, we would like to do that only for regions
-// that are GC alloc regions. To achieve this, we use time
-// stamps. For every evacuation pause, G1CollectedHeap generates a
-// unique time stamp (essentially a counter that gets
-// incremented). Every time we want to call save_marks on a region,
-// we set the saved_mark_word to top and also copy the current GC
-// time stamp to the time stamp field of the space. Reading the
-// saved_mark_word involves checking the time stamp of the
-// region. If it is the same as the current GC time stamp, then we
-// can safely read the saved_mark_word field, as it is valid. If the
-// time stamp of the region is not the same as the current GC time
-// stamp, then we instead read top, as the saved_mark_word field is
-// invalid. Time stamps (on the regions and also on the
-// G1CollectedHeap) are reset at every cleanup (we iterate over
-// the regions anyway) and at the end of a Full GC. The current scheme
-// that uses sequential unsigned ints will fail only if we have 4b
+// The idea behind time stamps is the following. We want to keep track of
+// the highest address where it's safe to scan objects for each region.
+// This is only relevant for current GC alloc regions so we keep a time stamp
+// per region to determine if the region has been allocated during the current
+// GC or not. If the time stamp is current we report a scan_top value which
+// was saved at the end of the previous GC for retained alloc regions and which is
+// equal to the bottom for all other regions.
+// There is a race between card scanners and allocating gc workers where we must ensure
+// that card scanners do not read the memory allocated by the gc workers.
+// In order to enforce that, we must not return a value of _top which is more recent than the
+// time stamp. This is due to the fact that a region may become a gc alloc region at
+// some point after we've read the timestamp value as being < the current time stamp.
+// The time stamps are re-initialized to zero at cleanup and at Full GCs.
+// The current scheme that uses sequential unsigned ints will fail only if we have 4b
 // evacuation pauses between two cleanups, which is _highly_ unlikely.
 class G1OffsetTableContigSpace: public CompactibleSpace {
   friend class VMStructs;
   HeapWord* _top;
+  HeapWord* volatile _scan_top;
  protected:
   G1BlockOffsetArrayContigSpace _offsets;
   Mutex _par_alloc_lock;
@@ -166,10 +163,11 @@ class G1OffsetTableContigSpace: public CompactibleSpace {
   void set_bottom(HeapWord* value);
   void set_end(HeapWord* value);
 
-  virtual HeapWord* saved_mark_word() const;
-  void record_top_and_timestamp();
+  HeapWord* scan_top() const;
+  void record_timestamp();
   void reset_gc_time_stamp() { _gc_time_stamp = 0; }
   unsigned get_gc_time_stamp() { return _gc_time_stamp; }
+  void record_retained_region();
 
   // See the comment above in the declaration of _pre_dummy_top for an
   // explanation of what it is.
@@ -191,6 +189,8 @@ class G1OffsetTableContigSpace: public CompactibleSpace {
   virtual HeapWord* allocate(size_t word_size);
   HeapWord* par_allocate(size_t word_size);
 
+  HeapWord* saved_mark_word() const { ShouldNotReachHere(); return NULL; }
+
   // MarkSweep support phase3
   virtual HeapWord* initialize_threshold();
   virtual HeapWord* cross_threshold(HeapWord* start, HeapWord* end);

From 5e21021117f4a61abb9411505f958dfb05be0bc8 Mon Sep 17 00:00:00 2001
From: Filipp Zhinkin <fzhinkin@openjdk.org>
Date: Wed, 26 Nov 2014 14:17:06 +0400
Subject: [PATCH 160/299] 8037968: Add tests on alignment of objects copied to
 survivor space

Reviewed-by: jmasa, dfazunen
---
 hotspot/test/TEST.groups                      |   1 +
 .../TestSurvivorAlignmentInBytesOption.java   | 120 +++++
 .../gc/survivorAlignment/AlignmentHelper.java | 174 ++++++++
 .../SurvivorAlignmentTestMain.java            | 416 ++++++++++++++++++
 .../TestAllocationInEden.java                 |  84 ++++
 .../TestPromotionFromEdenToTenured.java       |  96 ++++
 ...otionFromSurvivorToTenuredAfterFullGC.java | 101 +++++
 ...tionFromSurvivorToTenuredAfterMinorGC.java | 106 +++++
 .../TestPromotionToSurvivor.java              |  85 ++++
 9 files changed, 1183 insertions(+)
 create mode 100644 hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java
 create mode 100644 hotspot/test/gc/survivorAlignment/AlignmentHelper.java
 create mode 100644 hotspot/test/gc/survivorAlignment/SurvivorAlignmentTestMain.java
 create mode 100644 hotspot/test/gc/survivorAlignment/TestAllocationInEden.java
 create mode 100644 hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java
 create mode 100644 hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java
 create mode 100644 hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java
 create mode 100644 hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java

diff --git a/hotspot/test/TEST.groups b/hotspot/test/TEST.groups
index 8ea66a65e68..7983141d45a 100644
--- a/hotspot/test/TEST.groups
+++ b/hotspot/test/TEST.groups
@@ -139,6 +139,7 @@ needs_compact3 = \
   gc/g1/TestShrinkAuxiliaryData20.java \
   gc/g1/TestShrinkAuxiliaryData25.java \
   gc/g1/TestShrinkAuxiliaryData30.java \
+  gc/survivorAlignment \
   runtime/InternalApi/ThreadCpuTimesDeadlock.java \
   serviceability/threads/TestFalseDeadLock.java \
 
diff --git a/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java b/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java
new file mode 100644
index 00000000000..4dc7845ecee
--- /dev/null
+++ b/hotspot/test/gc/arguments/TestSurvivorAlignmentInBytesOption.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2014, 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 com.oracle.java.testlibrary.ExitCode;
+import com.oracle.java.testlibrary.Utils;
+import com.oracle.java.testlibrary.cli.CommandLineOptionTest;
+
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+/**
+ * @test
+ * @bug 8031323
+ * @summary Verify SurvivorAlignmentInBytes option processing.
+ * @library /testlibrary
+ * @run main TestSurvivorAlignmentInBytesOption
+ */
+public class TestSurvivorAlignmentInBytesOption {
+    private static final String[] FILTERED_VM_OPTIONS
+            = Utils.getFilteredTestJavaOpts(
+            "UnlockExperimentalVMOptions",
+            "SurvivorAlignmentInBytes",
+            "ObjectAlignmentInBytes");
+
+    public static void main(String args[]) throws Throwable {
+        String optionName = "SurvivorAlignmentInBytes";
+        String optionIsExperimental
+                = CommandLineOptionTest.getExperimentalOptionErrorMessage(
+                optionName);
+        String valueIsTooSmall= ".*SurvivorAlignmentInBytes=.*must be greater"
+                + " than ObjectAlignmentInBytes.*";
+        String mustBePowerOf2 = ".*SurvivorAlignmentInBytes=.*must be "
+                + "power of 2.*";
+
+        // Verify that without -XX:+UnlockExperimentalVMOptions usage of
+        // SurvivorAlignmentInBytes option will cause JVM startup failure
+        // with the warning message saying that that option is experimental.
+        CommandLineOptionTest.verifyJVMStartup(
+                new String[]{optionIsExperimental}, null, ExitCode.FAIL, false,
+                TestSurvivorAlignmentInBytesOption.prepareOptions(
+                        "-XX:-UnlockExperimentalVMOptions",
+                        CommandLineOptionTest.prepareNumericFlag(
+                                optionName, 64)));
+
+        // Verify that with -XX:+UnlockExperimentalVMOptions passed to JVM
+        // usage of SurvivorAlignmentInBytes option won't cause JVM startup
+        // failure.
+        CommandLineOptionTest.verifyJVMStartup(
+                null, new String[]{optionIsExperimental}, ExitCode.OK, false,
+                TestSurvivorAlignmentInBytesOption.prepareOptions(
+                        CommandLineOptionTest.prepareNumericFlag(
+                                optionName, 64)));
+
+        // Verify that if specified SurvivorAlignmentInBytes is lower then
+        // ObjectAlignmentInBytes, then the JVM startup will fail with
+        // appropriate error message.
+        CommandLineOptionTest.verifyJVMStartup(
+                new String[]{valueIsTooSmall}, null, ExitCode.FAIL, false,
+                TestSurvivorAlignmentInBytesOption.prepareOptions(
+                        CommandLineOptionTest.prepareNumericFlag(
+                                optionName, 2)));
+
+        // Verify that if specified SurvivorAlignmentInBytes value is not
+        // a power of 2 then the JVM startup will fail with appropriate error
+        // message.
+        CommandLineOptionTest.verifyJVMStartup(
+                new String[]{mustBePowerOf2}, null, ExitCode.FAIL, false,
+                TestSurvivorAlignmentInBytesOption.prepareOptions(
+                        CommandLineOptionTest.prepareNumericFlag(
+                                optionName, 127)));
+
+        // Verify that if SurvivorAlignmentInBytes has correct value, then
+        // the JVM will be started without errors.
+        CommandLineOptionTest.verifyJVMStartup(
+                null, new String[]{".*SurvivorAlignmentInBytes.*"},
+                ExitCode.OK, false,
+                TestSurvivorAlignmentInBytesOption.prepareOptions(
+                        CommandLineOptionTest.prepareNumericFlag(
+                                optionName, 128)));
+
+        // Verify that we can setup different SurvivorAlignmentInBytes values.
+        for (int alignment = 32; alignment <= 128; alignment *= 2) {
+            CommandLineOptionTest.verifyOptionValue(optionName,
+                    Integer.toString(alignment), false,
+                    TestSurvivorAlignmentInBytesOption.prepareOptions(
+                            CommandLineOptionTest.prepareNumericFlag(
+                                    optionName, alignment)));
+        }
+    }
+
+    private static String[] prepareOptions(String... options) {
+        List<String> finalOptions = new LinkedList<>();
+        Collections.addAll(finalOptions,
+                TestSurvivorAlignmentInBytesOption.FILTERED_VM_OPTIONS);
+        finalOptions.add(CommandLineOptionTest.UNLOCK_EXPERIMENTAL_VM_OPTIONS);
+        Collections.addAll(finalOptions, options);
+        return finalOptions.toArray(new String[finalOptions.size()]);
+    }
+}
diff --git a/hotspot/test/gc/survivorAlignment/AlignmentHelper.java b/hotspot/test/gc/survivorAlignment/AlignmentHelper.java
new file mode 100644
index 00000000000..57de213baeb
--- /dev/null
+++ b/hotspot/test/gc/survivorAlignment/AlignmentHelper.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 2014, 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.lang.management.MemoryPoolMXBean;
+import java.util.Optional;
+
+import sun.hotspot.WhiteBox;
+
+/**
+ * Helper class aimed to provide information about alignment of objects in
+ * particular heap space, expected memory usage after objects' allocation so on.
+ */
+public class AlignmentHelper {
+    private static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+
+    private static final long OBJECT_ALIGNMENT_IN_BYTES_FOR_32_VM = 8L;
+
+    /**
+     * Max relative allowed actual memory usage deviation from expected memory
+     * usage.
+     */
+    private static final float MAX_RELATIVE_DEVIATION = 0.05f; // 5%
+
+    public static final long OBJECT_ALIGNMENT_IN_BYTES = Optional.ofNullable(
+            AlignmentHelper.WHITE_BOX.getIntxVMFlag("ObjectAlignmentInBytes"))
+            .orElse(AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES_FOR_32_VM);
+
+    public static final long SURVIVOR_ALIGNMENT_IN_BYTES = Optional.ofNullable(
+            AlignmentHelper.WHITE_BOX.getIntxVMFlag("SurvivorAlignmentInBytes"))
+            .orElseThrow(() ->new AssertionError(
+                    "Unable to get SurvivorAlignmentInBytes value"));
+    /**
+     * Min amount of memory that will be occupied by an object.
+     */
+    public static final long MIN_OBJECT_SIZE
+            = AlignmentHelper.WHITE_BOX.getObjectSize(new Object());
+    /**
+     * Min amount of memory that will be occupied by an empty byte array.
+     */
+    public static final long MIN_ARRAY_SIZE
+            = AlignmentHelper.WHITE_BOX.getObjectSize(new byte[0]);
+
+    /**
+     * Precision at which actual memory usage in a heap space represented by
+     * this sizing helper could be measured.
+     */
+    private final long memoryUsageMeasurementPrecision;
+    /**
+     * Min amount of memory that will be occupied by an object allocated in a
+     * heap space represented by this sizing helper.
+     */
+    private final long minObjectSizeInThisSpace;
+    /**
+     * Object's alignment in a heap space represented by this sizing helper.
+     */
+    private final long objectAlignmentInThisRegion;
+    /**
+     * MemoryPoolMXBean associated with a heap space represented by this sizing
+     * helper.
+     */
+    private final MemoryPoolMXBean poolMXBean;
+
+    private static long alignUp(long value, long alignment) {
+        return ((value - 1) / alignment + 1) * alignment;
+    }
+
+    protected AlignmentHelper(long memoryUsageMeasurementPrecision,
+            long objectAlignmentInThisRegion, long minObjectSizeInThisSpace,
+            MemoryPoolMXBean poolMXBean) {
+        this.memoryUsageMeasurementPrecision = memoryUsageMeasurementPrecision;
+        this.minObjectSizeInThisSpace = minObjectSizeInThisSpace;
+        this.objectAlignmentInThisRegion = objectAlignmentInThisRegion;
+        this.poolMXBean = poolMXBean;
+    }
+
+    /**
+     * Returns how many objects have to be allocated to fill
+     * {@code memoryToFill} bytes in this heap space using objects of size
+     * {@code objectSize}.
+     */
+    public int getObjectsCount(long memoryToFill, long objectSize) {
+        return (int) (memoryToFill / getObjectSizeInThisSpace(objectSize));
+    }
+
+    /**
+     * Returns amount of memory that {@code objectsCount} of objects with size
+     * {@code objectSize} will occupy this this space after allocation.
+     */
+    public long getExpectedMemoryUsage(long objectSize, int objectsCount) {
+        long correctedObjectSize = getObjectSizeInThisSpace(objectSize);
+        return AlignmentHelper.alignUp(correctedObjectSize * objectsCount,
+                memoryUsageMeasurementPrecision);
+    }
+
+    /**
+     * Returns current memory usage in this heap space.
+     */
+    public long getActualMemoryUsage() {
+        return poolMXBean.getUsage().getUsed();
+    }
+
+    /**
+     * Returns maximum memory usage deviation from {@code expectedMemoryUsage}
+     * given the max allowed relative deviation equal to
+     * {@code relativeDeviation}.
+     *
+     * Note that value returned by this method is aligned according to
+     * memory measurement precision for this heap space.
+     */
+    public long getAllowedMemoryUsageDeviation(long expectedMemoryUsage) {
+        long unalignedDeviation = (long) (expectedMemoryUsage *
+                AlignmentHelper.MAX_RELATIVE_DEVIATION);
+        return AlignmentHelper.alignUp(unalignedDeviation,
+                memoryUsageMeasurementPrecision);
+    }
+
+    /**
+     * Returns amount of memory that will be occupied by an object with size
+     * {@code objectSize} in this heap space.
+     */
+    public long getObjectSizeInThisSpace(long objectSize) {
+        objectSize = Math.max(objectSize, minObjectSizeInThisSpace);
+
+        long alignedObjectSize = AlignmentHelper.alignUp(objectSize,
+                objectAlignmentInThisRegion);
+        long sizeDiff = alignedObjectSize - objectSize;
+
+        // If there is not enough space to fit padding object, then object will
+        // be aligned to {@code 2 * objectAlignmentInThisRegion}.
+        if (sizeDiff >= AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES
+                && sizeDiff < AlignmentHelper.MIN_OBJECT_SIZE) {
+            alignedObjectSize += AlignmentHelper.MIN_OBJECT_SIZE;
+            alignedObjectSize = AlignmentHelper.alignUp(alignedObjectSize,
+                    objectAlignmentInThisRegion);
+        }
+
+        return alignedObjectSize;
+    }
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+
+        builder.append(String.format("AlignmentHelper for memory pool '%s':%n",
+                poolMXBean.getName()));
+        builder.append(String.format("Memory usage measurement precision: %d%n",
+                memoryUsageMeasurementPrecision));
+        builder.append(String.format("Min object size in this space: %d%n",
+                minObjectSizeInThisSpace));
+        builder.append(String.format("Object alignment in this space: %d%n",
+                objectAlignmentInThisRegion));
+
+        return builder.toString();
+    }
+}
diff --git a/hotspot/test/gc/survivorAlignment/SurvivorAlignmentTestMain.java b/hotspot/test/gc/survivorAlignment/SurvivorAlignmentTestMain.java
new file mode 100644
index 00000000000..77de614694a
--- /dev/null
+++ b/hotspot/test/gc/survivorAlignment/SurvivorAlignmentTestMain.java
@@ -0,0 +1,416 @@
+/*
+ * Copyright (c) 2014, 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.lang.management.ManagementFactory;
+import java.lang.management.MemoryPoolMXBean;
+import java.util.Objects;
+import java.util.Optional;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import com.oracle.java.testlibrary.Asserts;
+import com.sun.management.ThreadMXBean;
+import sun.hotspot.WhiteBox;
+import sun.misc.Unsafe;
+
+/**
+ * Main class for tests on {@code SurvivorAlignmentInBytes} option.
+ *
+ * Typical usage is to obtain instance using fromArgs method, allocate objects
+ * and verify that actual memory usage in tested heap space is close to
+ * expected.
+ */
+public class SurvivorAlignmentTestMain {
+    enum HeapSpace {
+        EDEN,
+        SURVIVOR,
+        TENURED
+    }
+
+    public static final WhiteBox WHITE_BOX = WhiteBox.getWhiteBox();
+
+    public static final long MAX_TENURING_THRESHOLD = Optional.ofNullable(
+            SurvivorAlignmentTestMain.WHITE_BOX.getIntxVMFlag(
+                    "MaxTenuringThreshold")).orElse(15L);
+
+    /**
+     * Regexp used to parse memory size params, like 2G, 34m or 15k.
+     */
+    private static final Pattern SIZE_REGEX
+            = Pattern.compile("(?<size>[0-9]+)(?<multiplier>[GMKgmk])?");
+
+    // Names of different heap spaces.
+    private static final String DEF_NEW_EDEN = "Eden Space";
+    private static final String DEF_NEW_SURVIVOR = "Survivor Space";
+    private static final String PAR_NEW_EDEN = "Par Eden Space";
+    private static final String PAR_NEW_SURVIVOR = "Par Survivor Space";
+    private static final String PS_EDEN = "PS Eden Space";
+    private static final String PS_SURVIVOR = "PS Survivor Space";
+    private static final String G1_EDEN = "G1 Eden Space";
+    private static final String G1_SURVIVOR = "G1 Survivor Space";
+    private static final String SERIAL_TENURED = "Tenured Gen";
+    private static final String CMS_TENURED = "CMS Old Gen";
+    private static final String PS_TENURED = "PS Old Gen";
+    private static final String G1_TENURED = "G1 Old Gen";
+
+    private static final long G1_HEAP_REGION_SIZE = Optional.ofNullable(
+            SurvivorAlignmentTestMain.WHITE_BOX.getUintxVMFlag(
+                    "G1HeapRegionSize")).orElse(-1L);
+
+    /**
+     * Min size of free chunk in CMS generation.
+     * An object allocated in CMS generation will at least occupy this amount
+     * of bytes.
+     */
+    private static final long CMS_MIN_FREE_CHUNK_SIZE
+            = 3L * Unsafe.ADDRESS_SIZE;
+
+    private static final AlignmentHelper EDEN_SPACE_HELPER;
+    private static final AlignmentHelper SURVIVOR_SPACE_HELPER;
+    private static final AlignmentHelper TENURED_SPACE_HELPER;
+    /**
+     * Amount of memory that should be filled during a test run.
+     */
+    private final long memoryToFill;
+    /**
+     * The size of an objects that will be allocated during a test run.
+     */
+    private final long objectSize;
+    /**
+     * Amount of memory that will be actually occupied by an object in eden
+     * space.
+     */
+    private final long actualObjectSize;
+    /**
+     * Storage for allocated objects.
+     */
+    private final Object[] garbage;
+    /**
+     * Heap space whose memory usage is a subject of assertions during the test
+     * run.
+     */
+    private final HeapSpace testedSpace;
+
+    private long[] baselinedThreadMemoryUsage = null;
+    private long[] threadIds = null;
+
+    /**
+     * Initialize {@code EDEN_SPACE_HELPER}, {@code SURVIVOR_SPACE_HELPER} and
+     * {@code TENURED_SPACE_HELPER} to represent heap spaces in use.
+     *
+     * Note that regardless to GC object's alignment in survivor space is
+     * expected to be equal to {@code SurvivorAlignmentInBytes} value and
+     * alignment in other spaces is expected to be equal to
+     * {@code ObjectAlignmentInBytes} value.
+     *
+     * In CMS generation we can't allocate less then {@code MinFreeChunk} value,
+     * for other CGs we expect that object of size {@code MIN_OBJECT_SIZE}
+     * could be allocated as it is (of course, its size could be aligned
+     * according to alignment value used in a particular space).
+     *
+     * For G1 GC MXBeans could report memory usage only with region size
+     * precision (if an object allocated in some G1 heap region, then all region
+     * will claimed as used), so for G1's spaces precision is equal to
+     * {@code G1HeapRegionSize} value.
+     */
+    static {
+        AlignmentHelper edenHelper = null;
+        AlignmentHelper survivorHelper = null;
+        AlignmentHelper tenuredHelper = null;
+        for (MemoryPoolMXBean pool : ManagementFactory.getMemoryPoolMXBeans()) {
+            switch (pool.getName()) {
+                case SurvivorAlignmentTestMain.DEF_NEW_EDEN:
+                case SurvivorAlignmentTestMain.PAR_NEW_EDEN:
+                case SurvivorAlignmentTestMain.PS_EDEN:
+                    Asserts.assertNull(edenHelper,
+                            "Only one bean for eden space is expected.");
+                    edenHelper = new AlignmentHelper(
+                            AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+                            AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+                            AlignmentHelper.MIN_OBJECT_SIZE, pool);
+                    break;
+                case SurvivorAlignmentTestMain.G1_EDEN:
+                    Asserts.assertNull(edenHelper,
+                            "Only one bean for eden space is expected.");
+                    edenHelper = new AlignmentHelper(
+                            SurvivorAlignmentTestMain.G1_HEAP_REGION_SIZE,
+                            AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+                            AlignmentHelper.MIN_OBJECT_SIZE, pool);
+                    break;
+                case SurvivorAlignmentTestMain.DEF_NEW_SURVIVOR:
+                case SurvivorAlignmentTestMain.PAR_NEW_SURVIVOR:
+                case SurvivorAlignmentTestMain.PS_SURVIVOR:
+                    Asserts.assertNull(survivorHelper,
+                            "Only one bean for survivor space is expected.");
+                    survivorHelper = new AlignmentHelper(
+                            AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+                            AlignmentHelper.SURVIVOR_ALIGNMENT_IN_BYTES,
+                            AlignmentHelper.MIN_OBJECT_SIZE, pool);
+                    break;
+                case SurvivorAlignmentTestMain.G1_SURVIVOR:
+                    Asserts.assertNull(survivorHelper,
+                            "Only one bean for survivor space is expected.");
+                    survivorHelper = new AlignmentHelper(
+                            SurvivorAlignmentTestMain.G1_HEAP_REGION_SIZE,
+                            AlignmentHelper.SURVIVOR_ALIGNMENT_IN_BYTES,
+                            AlignmentHelper.MIN_OBJECT_SIZE, pool);
+                    break;
+                case SurvivorAlignmentTestMain.SERIAL_TENURED:
+                case SurvivorAlignmentTestMain.PS_TENURED:
+                case SurvivorAlignmentTestMain.G1_TENURED:
+                    Asserts.assertNull(tenuredHelper,
+                            "Only one bean for tenured space is expected.");
+                    tenuredHelper = new AlignmentHelper(
+                            AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+                            AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+                            AlignmentHelper.MIN_OBJECT_SIZE, pool);
+                    break;
+                case SurvivorAlignmentTestMain.CMS_TENURED:
+                    Asserts.assertNull(tenuredHelper,
+                            "Only one bean for tenured space is expected.");
+                    tenuredHelper = new AlignmentHelper(
+                            AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+                            AlignmentHelper.OBJECT_ALIGNMENT_IN_BYTES,
+                            SurvivorAlignmentTestMain.CMS_MIN_FREE_CHUNK_SIZE,
+                            pool);
+                    break;
+            }
+        }
+        EDEN_SPACE_HELPER = Objects.requireNonNull(edenHelper,
+                "AlignmentHelper for eden space should be initialized.");
+        SURVIVOR_SPACE_HELPER = Objects.requireNonNull(survivorHelper,
+                "AlignmentHelper for survivor space should be initialized.");
+        TENURED_SPACE_HELPER = Objects.requireNonNull(tenuredHelper,
+                "AlignmentHelper for tenured space should be initialized.");
+    }
+    /**
+     * Returns an SurvivorAlignmentTestMain instance constructed using CLI
+     * options.
+     *
+     * Following options are expected:
+     * <ul>
+     *     <li>memoryToFill</li>
+     *     <li>objectSize</li>
+     * </ul>
+     *
+     * Both argument may contain multiplier suffix k, m or g.
+     */
+    public static SurvivorAlignmentTestMain fromArgs(String[] args) {
+        Asserts.assertEQ(args.length, 3, "Expected three arguments: "
+                + "memory size, object size and tested heap space name.");
+
+        long memoryToFill = parseSize(args[0]);
+        long objectSize = Math.max(parseSize(args[1]),
+                AlignmentHelper.MIN_ARRAY_SIZE);
+        HeapSpace testedSpace = HeapSpace.valueOf(args[2]);
+
+        return new SurvivorAlignmentTestMain(memoryToFill, objectSize,
+                testedSpace);
+    }
+
+    /**
+     * Returns a value parsed from a string with format
+     * &lt;integer&gt;&lt;multiplier&gt;.
+     */
+    private static long parseSize(String sizeString) {
+        Matcher matcher = SIZE_REGEX.matcher(sizeString);
+        Asserts.assertTrue(matcher.matches(),
+                "sizeString should have following format \"[0-9]+([MBK])?\"");
+        long size = Long.valueOf(matcher.group("size"));
+
+        if (matcher.group("multiplier") != null) {
+            long K = 1024L;
+            // fall through multipliers
+            switch (matcher.group("multiplier").toLowerCase()) {
+                case "g":
+                    size *= K;
+                case "m":
+                    size *= K;
+                case "k":
+                    size *= K;
+            }
+        }
+        return size;
+    }
+
+    private SurvivorAlignmentTestMain(long memoryToFill, long objectSize,
+            HeapSpace testedSpace) {
+        this.objectSize = objectSize;
+        this.memoryToFill = memoryToFill;
+        this.testedSpace = testedSpace;
+
+        AlignmentHelper helper = SurvivorAlignmentTestMain.EDEN_SPACE_HELPER;
+
+        this.actualObjectSize = helper.getObjectSizeInThisSpace(
+                this.objectSize);
+        int arrayLength = helper.getObjectsCount(memoryToFill, this.objectSize);
+        garbage = new Object[arrayLength];
+    }
+
+    /**
+     * Allocate byte arrays to fill {@code memoryToFill} memory.
+     */
+    public void allocate() {
+        int byteArrayLength = Math.max((int) (objectSize
+                - Unsafe.ARRAY_BYTE_BASE_OFFSET), 0);
+
+        for (int i = 0; i < garbage.length; i++) {
+            garbage[i] = new byte[byteArrayLength];
+        }
+    }
+
+    /**
+     * Release memory occupied after {@code allocate} call.
+     */
+    public void release() {
+        for (int i = 0; i < garbage.length; i++) {
+            garbage[i] = null;
+        }
+    }
+
+    /**
+     * Returns expected amount of memory occupied in a {@code heapSpace} by
+     * objects referenced from {@code garbage} array.
+     */
+    public long getExpectedMemoryUsage() {
+        AlignmentHelper alignmentHelper = getAlignmentHelper(testedSpace);
+        return alignmentHelper.getExpectedMemoryUsage(objectSize,
+                garbage.length);
+    }
+
+    /**
+     * Verifies that memory usage in a {@code heapSpace} deviates from
+     * {@code expectedUsage} for no more than {@code MAX_RELATIVE_DEVIATION}.
+     */
+    public void verifyMemoryUsage(long expectedUsage) {
+        AlignmentHelper alignmentHelper = getAlignmentHelper(testedSpace);
+
+        long actualMemoryUsage = alignmentHelper.getActualMemoryUsage();
+        boolean otherThreadsAllocatedMemory = areOtherThreadsAllocatedMemory();
+
+        long memoryUsageDiff = Math.abs(actualMemoryUsage - expectedUsage);
+        long maxAllowedUsageDiff
+                = alignmentHelper.getAllowedMemoryUsageDeviation(expectedUsage);
+
+        System.out.println("Verifying memory usage in space: " + testedSpace);
+        System.out.println("Allocated objects count: " + garbage.length);
+        System.out.println("Desired object size: " + objectSize);
+        System.out.println("Actual object size: " + actualObjectSize);
+        System.out.println("Expected object size in space: "
+                + alignmentHelper.getObjectSizeInThisSpace(objectSize));
+        System.out.println("Expected memory usage: " + expectedUsage);
+        System.out.println("Actual memory usage: " + actualMemoryUsage);
+        System.out.println("Memory usage diff: " + memoryUsageDiff);
+        System.out.println("Max allowed usage diff: " + maxAllowedUsageDiff);
+
+        if (memoryUsageDiff > maxAllowedUsageDiff
+                && otherThreadsAllocatedMemory) {
+            System.out.println("Memory usage diff is incorrect, but it seems "
+                    + "like someone else allocated objects");
+            return;
+        }
+
+        Asserts.assertLTE(memoryUsageDiff, maxAllowedUsageDiff,
+                "Actual memory usage should not deviate from expected for " +
+                        "more then " + maxAllowedUsageDiff);
+    }
+
+    /**
+     * Baselines amount of memory allocated by each thread.
+     */
+    public void baselineMemoryAllocation() {
+        ThreadMXBean bean = (ThreadMXBean) ManagementFactory.getThreadMXBean();
+        threadIds = bean.getAllThreadIds();
+        baselinedThreadMemoryUsage = bean.getThreadAllocatedBytes(threadIds);
+    }
+
+    /**
+     * Checks if threads other then the current thread were allocating objects
+     * after baselinedThreadMemoryUsage call.
+     *
+     * If baselinedThreadMemoryUsage was not called, then this method will return
+     * {@code false}.
+     */
+    public boolean areOtherThreadsAllocatedMemory() {
+        if (baselinedThreadMemoryUsage == null) {
+            return false;
+        }
+
+        ThreadMXBean bean = (ThreadMXBean) ManagementFactory.getThreadMXBean();
+        long currentMemoryAllocation[]
+                = bean.getThreadAllocatedBytes(threadIds);
+        boolean otherThreadsAllocatedMemory = false;
+
+        System.out.println("Verifying amount of memory allocated by threads:");
+        for (int i = 0; i < threadIds.length; i++) {
+            System.out.format("Thread %d%nbaseline allocation: %d"
+                            + "%ncurrent allocation:%d%n", threadIds[i],
+                    baselinedThreadMemoryUsage[i], currentMemoryAllocation[i]);
+            System.out.println(bean.getThreadInfo(threadIds[i]));
+
+            long bytesAllocated = Math.abs(currentMemoryAllocation[i]
+                    - baselinedThreadMemoryUsage[i]);
+            if (bytesAllocated > 0
+                    && threadIds[i] != Thread.currentThread().getId()) {
+                otherThreadsAllocatedMemory = true;
+            }
+        }
+
+        return otherThreadsAllocatedMemory;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder builder = new StringBuilder();
+
+        builder.append(String.format("SurvivorAlignmentTestMain info:%n"));
+        builder.append(String.format("Desired object size: %d%n", objectSize));
+        builder.append(String.format("Memory to fill: %d%n", memoryToFill));
+        builder.append(String.format("Objects to be allocated: %d%n",
+                garbage.length));
+
+        builder.append(String.format("Alignment helpers to be used: %n"));
+        for (HeapSpace heapSpace: HeapSpace.values()) {
+            builder.append(String.format("For space %s:%n%s%n", heapSpace,
+                    getAlignmentHelper(heapSpace)));
+        }
+
+        return builder.toString();
+    }
+
+    /**
+     * Returns {@code AlignmentHelper} for a space {@code heapSpace}.
+     */
+    public static AlignmentHelper getAlignmentHelper(HeapSpace heapSpace) {
+        switch (heapSpace) {
+            case EDEN:
+                return SurvivorAlignmentTestMain.EDEN_SPACE_HELPER;
+            case SURVIVOR:
+                return SurvivorAlignmentTestMain.SURVIVOR_SPACE_HELPER;
+            case TENURED:
+                return SurvivorAlignmentTestMain.TENURED_SPACE_HELPER;
+            default:
+                throw new Error("Unexpected heap space: " + heapSpace);
+        }
+    }
+}
diff --git a/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java b/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java
new file mode 100644
index 00000000000..f5572386fdf
--- /dev/null
+++ b/hotspot/test/gc/survivorAlignment/TestAllocationInEden.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2014, 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 8031323
+ * @summary Verify that object's alignment in eden space is not affected by
+ *          SurvivorAlignmentInBytes option.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestAllocationInEden SurvivorAlignmentTestMain AlignmentHelper
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB
+ *                    -XX:OldSize=128m -XX:-ExplicitGCInvokesConcurrent
+ *                   TestAllocationInEden 10m 9 EDEN
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=32 -XX:-UseTLAB
+ *                    -XX:OldSize=128m -XX:-ExplicitGCInvokesConcurrent
+ *                   TestAllocationInEden 10m 47 EDEN
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB
+ *                    -XX:OldSize=128m -XX:-ExplicitGCInvokesConcurrent
+ *                   TestAllocationInEden 10m 9 EDEN
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=64 -XX:-UseTLAB
+ *                    -XX:OldSize=128m -XX:-ExplicitGCInvokesConcurrent
+ *                   TestAllocationInEden 10m 87 EDEN
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB
+ *                    -XX:OldSize=128m -XX:-ExplicitGCInvokesConcurrent
+ *                   TestAllocationInEden 10m 9 EDEN
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=128 -XX:-UseTLAB
+ *                    -XX:OldSize=128m -XX:-ExplicitGCInvokesConcurrent
+ *                   TestAllocationInEden 10m 147 EDEN
+ */
+public class TestAllocationInEden {
+    public static void main(String args[]) {
+        SurvivorAlignmentTestMain test
+                = SurvivorAlignmentTestMain.fromArgs(args);
+        System.out.println(test);
+
+        long expectedMemoryUsage = test.getExpectedMemoryUsage();
+        test.baselineMemoryAllocation();
+        System.gc();
+
+        test.allocate();
+
+        test.verifyMemoryUsage(expectedMemoryUsage);
+    }
+}
diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java b/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java
new file mode 100644
index 00000000000..e5025f75c5a
--- /dev/null
+++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromEdenToTenured.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2014, 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 8031323
+ * @summary Verify that objects promoted from eden space to tenured space during
+ *          full GC are not aligned to SurvivorAlignmentInBytes value.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestPromotionFromEdenToTenured SurvivorAlignmentTestMain
+ *        AlignmentHelper
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ *                   -XX:OldSize=32m -XX:SurvivorRatio=1
+ *                    -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=32
+ *                   TestPromotionFromEdenToTenured 10m 9 TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ *                   -XX:OldSize=32m -XX:SurvivorRatio=1
+ *                    -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=32
+ *                   TestPromotionFromEdenToTenured 10m 47 TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ *                   -XX:OldSize=32m -XX:SurvivorRatio=1
+ *                    -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=64
+ *                   TestPromotionFromEdenToTenured 10m 9 TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ *                   -XX:OldSize=32m -XX:SurvivorRatio=1
+ *                    -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=64
+ *                   TestPromotionFromEdenToTenured 10m 87 TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ *                   -XX:OldSize=32M -XX:SurvivorRatio=1
+ *                    -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=128
+ *                   TestPromotionFromEdenToTenured 10m 9 TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=64m -XX:MaxNewSize=64m
+ *                   -XX:OldSize=32m -XX:SurvivorRatio=1
+ *                    -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=128
+ *                   TestPromotionFromEdenToTenured 10m 147 TENURED
+ */
+public class TestPromotionFromEdenToTenured {
+    public static void main(String args[]) {
+        SurvivorAlignmentTestMain test
+                = SurvivorAlignmentTestMain.fromArgs(args);
+        System.out.println(test);
+
+        long expectedMemoryUsage = test.getExpectedMemoryUsage();
+        test.baselineMemoryAllocation();
+        System.gc();
+        // increase expected usage by current old gen usage
+        expectedMemoryUsage += SurvivorAlignmentTestMain.getAlignmentHelper(
+                SurvivorAlignmentTestMain.HeapSpace.TENURED)
+                .getActualMemoryUsage();
+
+        test.allocate();
+        System.gc();
+
+        test.verifyMemoryUsage(expectedMemoryUsage);
+    }
+}
diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java
new file mode 100644
index 00000000000..960ef28ee91
--- /dev/null
+++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterFullGC.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2014, 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 8031323
+ * @summary Verify that objects promoted from survivor space to tenured space
+ *          during full GC are not aligned to SurvivorAlignmentInBytes value.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestPromotionFromSurvivorToTenuredAfterFullGC
+ *        SurvivorAlignmentTestMain AlignmentHelper
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ *                   -XX:OldSize=32m -XX:SurvivorRatio=1
+ *                   -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=32
+ *                   TestPromotionFromSurvivorToTenuredAfterFullGC 10m 9 TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ *                   -XX:OldSize=32m -XX:SurvivorRatio=1
+ *                   -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=32
+ *                   TestPromotionFromSurvivorToTenuredAfterFullGC 20m 47
+ *                   TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=200m -XX:MaxNewSize=200m
+ *                   -XX:OldSize=32m -XX:InitialHeapSize=232m
+ *                   -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=64
+ *                   TestPromotionFromSurvivorToTenuredAfterFullGC 10m 9 TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ *                   -XX:OldSize=32m -XX:SurvivorRatio=1
+ *                   -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=64
+ *                   TestPromotionFromSurvivorToTenuredAfterFullGC 20m 87
+ *                   TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=256m -XX:MaxNewSize=256m
+ *                   -XX:OldSize=32M -XX:InitialHeapSize=288m
+ *                   -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=128
+ *                    TestPromotionFromSurvivorToTenuredAfterFullGC 10m 9
+ *                    TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ *                   -XX:OldSize=32m -XX:SurvivorRatio=1
+ *                   -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=128
+ *                   TestPromotionFromSurvivorToTenuredAfterFullGC 20m 147
+ *                   TENURED
+ */
+public class TestPromotionFromSurvivorToTenuredAfterFullGC {
+    public static void main(String args[]) {
+        SurvivorAlignmentTestMain test
+                = SurvivorAlignmentTestMain.fromArgs(args);
+        System.out.println(test);
+
+        long expectedMemoryUsage = test.getExpectedMemoryUsage();
+        test.baselineMemoryAllocation();
+        System.gc();
+        // increase expected usage by current old gen usage
+        expectedMemoryUsage += SurvivorAlignmentTestMain.getAlignmentHelper(
+                SurvivorAlignmentTestMain.HeapSpace.TENURED)
+                .getActualMemoryUsage();
+
+        test.allocate();
+        SurvivorAlignmentTestMain.WHITE_BOX.youngGC();
+        System.gc();
+
+        test.verifyMemoryUsage(expectedMemoryUsage);
+    }
+}
diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java
new file mode 100644
index 00000000000..3b2dacd727c
--- /dev/null
+++ b/hotspot/test/gc/survivorAlignment/TestPromotionFromSurvivorToTenuredAfterMinorGC.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2014, 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 8031323
+ * @summary Verify that objects promoted from survivor space to tenured space
+ *          when their age exceeded tenuring threshold are not aligned to
+ *          SurvivorAlignmentInBytes value.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestPromotionFromSurvivorToTenuredAfterMinorGC
+ *        SurvivorAlignmentTestMain AlignmentHelper
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ *                   -XX:OldSize=32M -XX:SurvivorRatio=1
+ *                   -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=32
+ *                   TestPromotionFromSurvivorToTenuredAfterMinorGC 10m 9
+ *                   TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ *                   -XX:OldSize=32M -XX:SurvivorRatio=1
+ *                   -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=32
+ *                   TestPromotionFromSurvivorToTenuredAfterMinorGC 20m 47
+ *                   TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=200m -XX:MaxNewSize=200m
+ *                   -XX:OldSize=32M -XX:InitialHeapSize=232m
+ *                   -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=64
+ *                   TestPromotionFromSurvivorToTenuredAfterMinorGC 10m 9
+ *                   TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ *                   -XX:OldSize=32M -XX:SurvivorRatio=1
+ *                   -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=64
+ *                   TestPromotionFromSurvivorToTenuredAfterMinorGC 20m 87
+ *                   TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=256m -XX:MaxNewSize=256m
+ *                   -XX:OldSize=32M -XX:InitialHeapSize=288m
+ *                   -XX:SurvivorRatio=1 -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=128
+ *                    TestPromotionFromSurvivorToTenuredAfterMinorGC 10m 9
+ *                    TENURED
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ *                   -XX:OldSize=32M -XX:SurvivorRatio=1
+ *                   -XX:-ExplicitGCInvokesConcurrent
+ *                   -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=128
+ *                   TestPromotionFromSurvivorToTenuredAfterMinorGC 20m 147
+ *                   TENURED
+ */
+public class TestPromotionFromSurvivorToTenuredAfterMinorGC {
+    public static void main(String args[]) throws Exception {
+        SurvivorAlignmentTestMain test
+                = SurvivorAlignmentTestMain.fromArgs(args);
+        System.out.println(test);
+
+        long expectedMemoryUsage = test.getExpectedMemoryUsage();
+        test.baselineMemoryAllocation();
+        SurvivorAlignmentTestMain.WHITE_BOX.fullGC();
+        // increase expected usage by current old gen usage
+        expectedMemoryUsage += SurvivorAlignmentTestMain.getAlignmentHelper(
+                SurvivorAlignmentTestMain.HeapSpace.TENURED)
+                .getActualMemoryUsage();
+
+        test.allocate();
+        for (int i = 0; i <= SurvivorAlignmentTestMain.MAX_TENURING_THRESHOLD;
+             i++) {
+            SurvivorAlignmentTestMain.WHITE_BOX.youngGC();
+        }
+
+        test.verifyMemoryUsage(expectedMemoryUsage);
+    }
+}
diff --git a/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java b/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java
new file mode 100644
index 00000000000..59087f6b0e5
--- /dev/null
+++ b/hotspot/test/gc/survivorAlignment/TestPromotionToSurvivor.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2014, 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 8031323
+ * @summary Verify that objects promoted from eden space to survivor space after
+ *          minor GC are aligned to SurvivorAlignmentInBytes.
+ * @library /testlibrary /testlibrary/whitebox
+ * @build TestPromotionToSurvivor
+ *        SurvivorAlignmentTestMain AlignmentHelper
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=32 -XX:OldSize=128m
+ *                   -XX:-ExplicitGCInvokesConcurrent
+ *                   TestPromotionToSurvivor 10m 9 SURVIVOR
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=32 -XX:OldSize=128m
+ *                   TestPromotionToSurvivor 20m 47 SURVIVOR
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=64 -XX:OldSize=128m
+ *                   -XX:-ExplicitGCInvokesConcurrent
+ *                   TestPromotionToSurvivor 8m 9 SURVIVOR
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=64 -XX:OldSize=128m
+ *                   -XX:-ExplicitGCInvokesConcurrent
+ *                   TestPromotionToSurvivor 20m 87 SURVIVOR
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=256m -XX:MaxNewSize=256m
+ *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=128 -XX:OldSize=32m
+ *                   -XX:InitialHeapSize=288m  -XX:-ExplicitGCInvokesConcurrent
+ *                   TestPromotionToSurvivor 10m 9 SURVIVOR
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:+WhiteBoxAPI -XX:NewSize=128m -XX:MaxNewSize=128m
+ *                   -XX:SurvivorRatio=1 -XX:+UnlockExperimentalVMOptions
+ *                   -XX:SurvivorAlignmentInBytes=128 -XX:OldSize=128m
+ *                   -XX:-ExplicitGCInvokesConcurrent
+ *                   TestPromotionToSurvivor 20m 147 SURVIVOR
+ */
+public class TestPromotionToSurvivor {
+    public static void main(String args[]) {
+        SurvivorAlignmentTestMain test
+                = SurvivorAlignmentTestMain.fromArgs(args);
+        System.out.println(test);
+
+        long expectedUsage = test.getExpectedMemoryUsage();
+        test.baselineMemoryAllocation();
+        SurvivorAlignmentTestMain.WHITE_BOX.fullGC();
+
+        test.allocate();
+        SurvivorAlignmentTestMain.WHITE_BOX.youngGC();
+
+        test.verifyMemoryUsage(expectedUsage);
+    }
+}

From 64bb4a891c9480523e1e07879909d19bd0612408 Mon Sep 17 00:00:00 2001
From: Magnus Ihse Bursie <ihse@openjdk.org>
Date: Wed, 26 Nov 2014 15:15:27 +0100
Subject: [PATCH 161/299] 8065913: Various improvements in
 SetupNativeCompilation

Reviewed-by: erikj
---
 jdk/make/launcher/Launcher-jdk.runtime.gmk |  2 +-
 jdk/make/lib/LibCommon.gmk                 | 16 +++++++++-------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/jdk/make/launcher/Launcher-jdk.runtime.gmk b/jdk/make/launcher/Launcher-jdk.runtime.gmk
index a8b21fe42e7..af3fc299240 100644
--- a/jdk/make/launcher/Launcher-jdk.runtime.gmk
+++ b/jdk/make/launcher/Launcher-jdk.runtime.gmk
@@ -77,7 +77,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
   EXE_OUT_OPTION := -Fe
   # With the current way unpack200 is built, debug symbols aren't supported
   # anyway.
-  UNPACKEXE_DEBUG_SYMBOLS :=
+  UNPACKEXE_DEBUG_SYMBOLS := false
 endif
 
 # The linker on older SuSE distros (e.g. on SLES 10) complains with:
diff --git a/jdk/make/lib/LibCommon.gmk b/jdk/make/lib/LibCommon.gmk
index eede8fbd8de..fd6e3428715 100644
--- a/jdk/make/lib/LibCommon.gmk
+++ b/jdk/make/lib/LibCommon.gmk
@@ -45,15 +45,17 @@ endif
 # elegant solution to this.
 WIN_JAVA_LIB := $(JDK_OUTPUTDIR)/objs/libjava/java.lib
 
-# Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
-# not on other platforms.
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  DEBUG_ALL_BINARIES := true
-endif
-
-# Build everything with debugging on OpenJDK
 ifdef OPENJDK
+  # Build everything with debugging on OpenJDK
   DEBUG_ALL_BINARIES := true
+else
+  # Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
+  # not on other platforms.
+  ifeq ($(OPENJDK_TARGET_OS), windows)
+    DEBUG_ALL_BINARIES := true
+  else
+    DEBUG_ALL_BINARIES := false
+  endif
 endif
 
 ################################################################################

From 09ae36fd33f3254e897af99d5ea7d9e03ef193b3 Mon Sep 17 00:00:00 2001
From: Erik Helin <ehelin@openjdk.org>
Date: Wed, 26 Nov 2014 17:32:39 +0100
Subject: [PATCH 162/299] 8065656: Use DWARF debug symbols for Solaris

Reviewed-by: dcubed, huntch, pbk
---
 hotspot/make/solaris/makefiles/gcc.make        | 14 ++------------
 hotspot/make/solaris/makefiles/sparcWorks.make |  9 ---------
 2 files changed, 2 insertions(+), 21 deletions(-)

diff --git a/hotspot/make/solaris/makefiles/gcc.make b/hotspot/make/solaris/makefiles/gcc.make
index 03ba4458c12..0ab4e9e9fe5 100644
--- a/hotspot/make/solaris/makefiles/gcc.make
+++ b/hotspot/make/solaris/makefiles/gcc.make
@@ -226,18 +226,8 @@ SHARED_FLAG = -shared
 # Allow no optimizations.
 DEBUG_CFLAGS=-O0
 
-# Use the stabs format for debugging information (this is the default
-# on gcc-2.91). It's good enough, has all the information about line
-# numbers and local variables, and libjvm.so is only about 16M.
-# Change this back to "-g" if you want the most expressive format.
-# (warning: that could easily inflate libjvm.so to 150M!)
-# Note: The Itanium gcc compiler crashes when using -gstabs.
-DEBUG_CFLAGS/ia64  = -g
-DEBUG_CFLAGS/amd64 = -g
-DEBUG_CFLAGS += $(DEBUG_CFLAGS/$(BUILDARCH))
-ifeq ($(DEBUG_CFLAGS/$(BUILDARCH)),)
-  DEBUG_CFLAGS += -gstabs
-endif
+# Enable debug symbols
+DEBUG_CFLAGS += -g
 
 # Enable bounds checking.
 ifeq "$(shell expr \( $(CC_VER_MAJOR) \> 3 \) )" "1"
diff --git a/hotspot/make/solaris/makefiles/sparcWorks.make b/hotspot/make/solaris/makefiles/sparcWorks.make
index 30d0c2ec691..8a8007f26a5 100644
--- a/hotspot/make/solaris/makefiles/sparcWorks.make
+++ b/hotspot/make/solaris/makefiles/sparcWorks.make
@@ -496,15 +496,6 @@ ifeq ($(ENABLE_FULL_DEBUG_SYMBOLS),1)
   FASTDEBUG_CFLAGS += -xs
 endif
 
-# Special global options for SS12
-ifeq ($(shell expr $(COMPILER_REV_NUMERIC) \>= 509), 1)
-  # There appears to be multiple issues with the new Dwarf2 debug format, so
-  #   we tell the compiler to use the older 'stabs' debug format all the time.
-  #   Note that this needs to be used in optimized compiles too to be 100%.
-  #   This is a workaround for SS12 (5.9) bug 6694600
-  CFLAGS += -xdebugformat=stabs
-endif
-
 # Enable the following CFLAGS additions if you need to compare the
 # built ELF objects.
 #

From d620b54c63bacc3aef52722f2ae40f6b0a60c7d7 Mon Sep 17 00:00:00 2001
From: Yumin Qi <yumin.qi@oracle.com>
Date: Wed, 26 Nov 2014 10:32:21 -0800
Subject: [PATCH 163/299] 8053995: Add method to WhiteBox to get vm pagesize

Unsafe is not recommended and may deprecated in future. Added a WhiteBox API to get VM page size.

Reviewed-by: dholmes, ccheung, mseledtsov
---
 hotspot/src/share/vm/prims/whitebox.cpp       |  4 ++
 .../test/runtime/memory/ReadVMPageSize.java   | 46 +++++++++++++++++++
 .../whitebox/sun/hotspot/WhiteBox.java        |  1 +
 3 files changed, 51 insertions(+)
 create mode 100644 hotspot/test/runtime/memory/ReadVMPageSize.java

diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp
index 3aa5764d628..0d7782bcf93 100644
--- a/hotspot/src/share/vm/prims/whitebox.cpp
+++ b/hotspot/src/share/vm/prims/whitebox.cpp
@@ -82,6 +82,9 @@ WB_ENTRY(jint, WB_GetHeapOopSize(JNIEnv* env, jobject o))
   return heapOopSize;
 WB_END
 
+WB_ENTRY(jint, WB_GetVMPageSize(JNIEnv* env, jobject o))
+  return os::vm_page_size();
+WB_END
 
 class WBIsKlassAliveClosure : public KlassClosure {
     Symbol* _name;
@@ -1121,6 +1124,7 @@ static JNINativeMethod methods[] = {
   {CC"getObjectSize",      CC"(Ljava/lang/Object;)J", (void*)&WB_GetObjectSize     },
   {CC"isObjectInOldGen",   CC"(Ljava/lang/Object;)Z", (void*)&WB_isObjectInOldGen  },
   {CC"getHeapOopSize",     CC"()I",                   (void*)&WB_GetHeapOopSize    },
+  {CC"getVMPageSize",      CC"()I",                   (void*)&WB_GetVMPageSize     },
   {CC"isClassAlive0",      CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive      },
   {CC"parseCommandLine",
       CC"(Ljava/lang/String;[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
diff --git a/hotspot/test/runtime/memory/ReadVMPageSize.java b/hotspot/test/runtime/memory/ReadVMPageSize.java
new file mode 100644
index 00000000000..a32822040d6
--- /dev/null
+++ b/hotspot/test/runtime/memory/ReadVMPageSize.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Using WhiteBox to get VM page size
+ * @library /testlibrary /testlibrary/whitebox
+ * @build ReadVMPageSize
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ * @run main/othervm  -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI  ReadVMPageSize
+ */
+
+import com.oracle.java.testlibrary.*;
+import sun.hotspot.WhiteBox;
+
+public class ReadVMPageSize {
+  public static void main(String args[]) throws Exception {
+    WhiteBox wb = WhiteBox.getWhiteBox();
+    int pageSize = wb.getVMPageSize();
+    if (pageSize < 0) {
+      throw new Exception("pageSize < 0");
+    } else {
+      System.out.println("Page size = " + pageSize);
+    }
+  }
+}
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
index 09e3aa27c5f..0ccdb9b81cb 100644
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
@@ -74,6 +74,7 @@ public class WhiteBox {
   // Memory
   public native long getObjectAddress(Object o);
   public native int  getHeapOopSize();
+  public native int  getVMPageSize();
   public native boolean isObjectInOldGen(Object o);
   public native long getObjectSize(Object o);
 

From 13f3dfa073c624e5438beefb6041965bbf952314 Mon Sep 17 00:00:00 2001
From: Amy Lu <amy.lu@oracle.com>
Date: Wed, 26 Nov 2014 11:12:19 -0800
Subject: [PATCH 164/299] 8060026: Update jdk/test/tools/launcher tests to
 eliminate dependency on sun.tools.jar.Main

Reviewed-by: alanb, ksrini, psandoz
---
 jdk/test/tools/launcher/TestHelper.java | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/jdk/test/tools/launcher/TestHelper.java b/jdk/test/tools/launcher/TestHelper.java
index 40737320d52..840e67ead20 100644
--- a/jdk/test/tools/launcher/TestHelper.java
+++ b/jdk/test/tools/launcher/TestHelper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, 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
@@ -50,6 +50,7 @@ import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
+import java.util.Arrays;
 import javax.tools.JavaCompiler;
 import javax.tools.ToolProvider;
 
@@ -333,15 +334,10 @@ public class TestHelper {
     }
 
    static void createJar(String... args) {
-        sun.tools.jar.Main jarTool =
-                new sun.tools.jar.Main(System.out, System.err, "JarCreator");
-        if (!jarTool.run(args)) {
-            String message = "jar creation failed with command:";
-            for (String x : args) {
-                message = message.concat(" " + x);
-            }
-            throw new RuntimeException(message);
-        }
+        List<String> cmdList = new ArrayList<>();
+        cmdList.add(jarCmd);
+        cmdList.addAll(Arrays.asList(args));
+        doExec(cmdList.toArray(new String[cmdList.size()]));
    }
 
    static void copyStream(InputStream in, OutputStream out) throws IOException {

From 6026dc63ea960a00d9c9ad85f513613b9b39ddf4 Mon Sep 17 00:00:00 2001
From: Daniel Fuchs <dfuchs@openjdk.org>
Date: Wed, 26 Nov 2014 20:10:48 +0100
Subject: [PATCH 165/299] 8065748: Add a test to verify that non ascii
 characters in Encodings.properties do not cause issues

Reviewed-by: joehw
---
 .../jaxp/Encodings/CheckEncodingPropertiesFile.java   | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java b/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java
index e8f03021e08..88e9648f066 100644
--- a/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java
+++ b/jdk/test/javax/xml/jaxp/Encodings/CheckEncodingPropertiesFile.java
@@ -23,7 +23,7 @@
 
 /**
  * @test
- * @bug 8008738
+ * @bug 8008738 8065138
  * @summary checks that the mapping implemented by
  *      com.sun.org.apache.xml.internal.serializer.Encodings
  *      correctly identifies valid Charset names and
@@ -64,6 +64,15 @@ public class CheckEncodingPropertiesFile {
             props.load(is);
         }
 
+       if (!props.containsKey("UTF8")) {
+           // If the test fails here - it may indicate that you stumbled on an
+           // issue similar to that fixed by JDK-8065138.
+           // Check that the content of the Encodings.properties included in
+           // the tested build image matches the content of the file in the source
+           // jaxp tree of the jdk forest.
+           throw new RuntimeException("UTF8 key missing in " + ClassLoader.getSystemResource(ENCODINGS_FILE));
+       }
+
         //printAllCharsets();
 
         test(props);

From 1ffc316e18a74daf2eb1bcc60692312b825c0054 Mon Sep 17 00:00:00 2001
From: Sangheon Kim <sangheki@openjdk.org>
Date: Wed, 26 Nov 2014 21:38:25 -0800
Subject: [PATCH 166/299] 8055239: assert(_thread ==
 Thread::current()->osthread()) failed: The PromotionFailedInfo should be
 thread local

Changed to trace and reset before second use of PromotionFailedInfo.

Reviewed-by: jmasa, brutisso, kbarrett
---
 .../share/vm/gc_implementation/parNew/parNewGeneration.cpp   | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
index a923cf57441..9f21403440b 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
@@ -999,6 +999,11 @@ void ParNewGeneration::collect(bool   full,
   thread_state_set.reset(0 /* Bad value in debug if not reset */,
                          promotion_failed());
 
+  // Trace and reset failed promotion info.
+  if (promotion_failed()) {
+    thread_state_set.trace_promotion_failed(gc_tracer);
+  }
+
   // Process (weak) reference objects found during scavenge.
   ReferenceProcessor* rp = ref_processor();
   IsAliveClosure is_alive(this);

From e635ae96cb34b50cf34c2dc0c998aae45808df31 Mon Sep 17 00:00:00 2001
From: Evgeniya Stepanova <eistepan@openjdk.org>
Date: Thu, 27 Nov 2014 14:52:01 +0400
Subject: [PATCH 167/299] 8065865: gc/TestSoftReferencesBehaviorOnOOME.java:
 Error. Can't find source file: TestSoftReference.java

Reviewed-by: sla
---
 hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
index 24f7a53612f..3232b27a450 100644
--- a/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
+++ b/hotspot/test/gc/TestSoftReferencesBehaviorOnOOME.java
@@ -26,7 +26,7 @@
  * @key gc
  * @summary Tests that all SoftReferences has been cleared at time of OOM.
  * @library /testlibrary
- * @build TestSoftReference
+ * @build TestSoftReferencesBehaviorOnOOME
  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 512 2k
  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 128k 256k
  * @run main/othervm -Xmx128m TestSoftReferencesBehaviorOnOOME 2k 32k 10

From 02adde2aac9cff62bd51b35c7ba5b530a1cf53ec Mon Sep 17 00:00:00 2001
From: Stefan Johansson <sjohanss@openjdk.org>
Date: Thu, 27 Nov 2014 11:09:55 +0100
Subject: [PATCH 168/299] 8065227: Report allocation context stats at end of
 cleanup

Moved allocation context update from remark to the cleanup phase.

Reviewed-by: mgerdin, jmasa
---
 hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp    | 2 +-
 .../src/share/vm/gc_implementation/g1/g1AllocationContext.hpp   | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
index 108a3a5e637..ce8ab529c7c 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentMark.cpp
@@ -2123,6 +2123,7 @@ void ConcurrentMark::cleanup() {
   // We reclaimed old regions so we should calculate the sizes to make
   // sure we update the old gen/space data.
   g1h->g1mm()->update_sizes();
+  g1h->allocation_context_stats().update_after_mark();
 
   g1h->trace_heap_after_concurrent_cycle();
 }
@@ -3243,7 +3244,6 @@ void ConcurrentMark::aggregate_count_data() {
   _g1h->set_par_threads(n_workers);
   _g1h->workers()->run_task(&g1_par_agg_task);
   _g1h->set_par_threads(0);
-  _g1h->allocation_context_stats().update_at_remark();
 }
 
 // Clear the per-worker arrays used to store the per-region counting data
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp
index ae64a36b9f2..c1089268ca6 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1AllocationContext.hpp
@@ -45,7 +45,7 @@ class AllocationContextStats: public StackObj {
 public:
   inline void clear() { }
   inline void update(bool full_gc) { }
-  inline void update_at_remark() { }
+  inline void update_after_mark() { }
   inline bool available() { return false; }
 };
 

From e79371a0bc7fbea54a041a13e99af0d9f3c815c6 Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Thu, 27 Nov 2014 13:04:46 +0100
Subject: [PATCH 169/299] 8051778: support bind on all Nashorn callables

Reviewed-by: hannesw, lagergren
---
 .../internal/objects/NativeFunction.java      |   9 +-
 .../internal/objects/NativeObject.java        |   3 +-
 .../internal/objects/ScriptFunctionImpl.java  |   5 +-
 .../runtime/arrays/IteratorAction.java        |  16 +--
 .../internal/runtime/linker/Bootstrap.java    |  59 ++++++--
 .../runtime/linker/BoundCallable.java         |  96 +++++++++++++
 .../runtime/linker/BoundCallableLinker.java   | 132 ++++++++++++++++++
 .../runtime/linker/BoundDynamicMethod.java    |  57 --------
 .../linker/BoundDynamicMethodLinker.java      |  91 ------------
 .../linker/JavaSuperAdapterLinker.java        |   2 +-
 nashorn/test/script/basic/JDK-8051778.js      |  83 +++++++++++
 .../test/script/basic/JDK-8051778.js.EXPECTED |  10 ++
 12 files changed, 379 insertions(+), 184 deletions(-)
 create mode 100644 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundCallable.java
 create mode 100644 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundCallableLinker.java
 delete mode 100644 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundDynamicMethod.java
 delete mode 100644 nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundDynamicMethodLinker.java
 create mode 100644 nashorn/test/script/basic/JDK-8051778.js
 create mode 100644 nashorn/test/script/basic/JDK-8051778.js.EXPECTED

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFunction.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFunction.java
index c4a79a563cb..bd2f2dd913b 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFunction.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeFunction.java
@@ -48,6 +48,7 @@ import jdk.nashorn.internal.runtime.ScriptEnvironment;
 import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptObject;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
+import jdk.nashorn.internal.runtime.linker.Bootstrap;
 
 /**
  * ECMA 15.3 Function Objects
@@ -204,11 +205,7 @@ public final class NativeFunction {
      * @return function with bound arguments
      */
     @Function(attributes = Attribute.NOT_ENUMERABLE, arity = 1)
-    public static ScriptFunction bind(final Object self, final Object... args) {
-        if (!(self instanceof ScriptFunction)) {
-            throw typeError("not.a.function", ScriptRuntime.safeToString(self));
-        }
-
+    public static Object bind(final Object self, final Object... args) {
         final Object thiz = (args.length == 0) ? UNDEFINED : args[0];
 
         Object[] arguments;
@@ -219,7 +216,7 @@ public final class NativeFunction {
             arguments = ScriptRuntime.EMPTY_ARRAY;
         }
 
-        return ((ScriptFunctionImpl)self).makeBoundFunction(thiz, arguments);
+        return Bootstrap.bindCallable(self, thiz, arguments);
     }
 
     /**
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java
index 7a1375d39e2..c086442ddc9 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java
@@ -28,6 +28,7 @@ package jdk.nashorn.internal.objects;
 import static jdk.nashorn.internal.lookup.Lookup.MH;
 import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
+
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import java.lang.invoke.MethodType;
@@ -804,7 +805,7 @@ public final class NativeObject {
             // name and object linked with BeansLinker. (Actually, an even stronger assumption is true: return value is
             // constant for any given method name and object's class.)
             return MethodHandles.dropArguments(MethodHandles.constant(Object.class,
-                    Bootstrap.bindDynamicMethod(methodGetter.invoke(source), source)), 0, Object.class);
+                    Bootstrap.bindCallable(methodGetter.invoke(source), source, null)), 0, Object.class);
         } catch(RuntimeException|Error e) {
             throw e;
         } catch(final Throwable t) {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ScriptFunctionImpl.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ScriptFunctionImpl.java
index 36e7716b702..f147234b4d2 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ScriptFunctionImpl.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ScriptFunctionImpl.java
@@ -30,7 +30,6 @@ import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
 
 import java.lang.invoke.MethodHandle;
 import java.util.ArrayList;
-
 import jdk.nashorn.internal.runtime.AccessorProperty;
 import jdk.nashorn.internal.runtime.GlobalFunctions;
 import jdk.nashorn.internal.runtime.Property;
@@ -237,13 +236,13 @@ public class ScriptFunctionImpl extends ScriptFunction {
 
     /**
      * Same as {@link ScriptFunction#makeBoundFunction(Object, Object[])}. The only reason we override it is so that we
-     * can expose it to methods in this package.
+     * can expose it.
      * @param self the self to bind to this function. Can be null (in which case, null is bound as this).
      * @param args additional arguments to bind to this function. Can be null or empty to not bind additional arguments.
      * @return a function with the specified self and parameters bound.
      */
     @Override
-    protected ScriptFunction makeBoundFunction(final Object self, final Object[] args) {
+    public ScriptFunction makeBoundFunction(final Object self, final Object[] args) {
         return super.makeBoundFunction(self, args);
     }
 
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IteratorAction.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IteratorAction.java
index 244739b389d..ff4c13e2c53 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IteratorAction.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/IteratorAction.java
@@ -25,11 +25,7 @@
 
 package jdk.nashorn.internal.runtime.arrays;
 
-import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
-
-import jdk.nashorn.api.scripting.JSObject;
 import jdk.nashorn.internal.runtime.Context;
-import jdk.nashorn.internal.runtime.ScriptFunction;
 import jdk.nashorn.internal.runtime.ScriptRuntime;
 import jdk.nashorn.internal.runtime.linker.Bootstrap;
 
@@ -98,17 +94,7 @@ public abstract class IteratorAction<T> {
      * @return result of apply
      */
     public final T apply() {
-        final boolean strict;
-        if (callbackfn instanceof ScriptFunction) {
-            strict = ((ScriptFunction)callbackfn).isStrict();
-        } else if (callbackfn instanceof JSObject &&
-            ((JSObject)callbackfn).isFunction()) {
-            strict = ((JSObject)callbackfn).isStrictFunction();
-        } else if (Bootstrap.isDynamicMethod(callbackfn) || Bootstrap.isFunctionalInterfaceObject(callbackfn)) {
-            strict = false;
-        } else {
-            throw typeError("not.a.function", ScriptRuntime.safeToString(callbackfn));
-        }
+        final boolean strict = Bootstrap.isStrictCallable(callbackfn);
 
         // for non-strict callback, need to translate undefined thisArg to be global object
         thisArg = (thisArg == ScriptRuntime.UNDEFINED && !strict)? Context.getGlobal() : thisArg;
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java
index 8c270fb836d..749c4728ae5 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java
@@ -26,6 +26,7 @@
 package jdk.nashorn.internal.runtime.linker;
 
 import static jdk.nashorn.internal.codegen.CompilerConstants.staticCallNoLookup;
+import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
 
 import java.lang.invoke.CallSite;
 import java.lang.invoke.ConstantCallSite;
@@ -50,6 +51,8 @@ import jdk.nashorn.internal.codegen.ObjectClassGenerator;
 import jdk.nashorn.internal.codegen.RuntimeCallSite;
 import jdk.nashorn.internal.lookup.MethodHandleFactory;
 import jdk.nashorn.internal.lookup.MethodHandleFunctionality;
+import jdk.nashorn.internal.objects.ScriptFunctionImpl;
+import jdk.nashorn.internal.runtime.ECMAException;
 import jdk.nashorn.internal.runtime.JSType;
 import jdk.nashorn.internal.runtime.OptimisticReturnFilters;
 import jdk.nashorn.internal.runtime.ScriptFunction;
@@ -94,7 +97,7 @@ public final class Bootstrap {
             new NashornLinker(),
             new NashornPrimitiveLinker(),
             new NashornStaticClassLinker(),
-            new BoundDynamicMethodLinker(),
+            new BoundCallableLinker(),
             new JavaSuperAdapterLinker(),
             new JSObjectLinker(nashornBeansLinker),
             new BrowserJSObjectLinker(nashornBeansLinker),
@@ -136,19 +139,47 @@ public final class Bootstrap {
         }
 
         return obj instanceof ScriptFunction ||
-            ((obj instanceof JSObject) && ((JSObject)obj).isFunction()) ||
-            isDynamicMethod(obj) ||
+            isJSObjectFunction(obj) ||
+            BeansLinker.isDynamicMethod(obj) ||
+            obj instanceof BoundCallable ||
             isFunctionalInterfaceObject(obj) ||
             obj instanceof StaticClass;
     }
 
+    /**
+     * Returns true if the given object is a strict callable
+     * @param callable the callable object to be checked for strictness
+     * @return true if the obj is a strict callable, false if it is a non-strict callable.
+     * @throws ECMAException with {@code TypeError} if the object is not a callable.
+     */
+    public static boolean isStrictCallable(final Object callable) {
+        if (callable instanceof ScriptFunction) {
+            return ((ScriptFunction)callable).isStrict();
+        } else if (isJSObjectFunction(callable)) {
+            return ((JSObject)callable).isStrictFunction();
+        } else if (callable instanceof BoundCallable) {
+            return isStrictCallable(((BoundCallable)callable).getCallable());
+        } else if (BeansLinker.isDynamicMethod(callable) || callable instanceof StaticClass) {
+            return false;
+        }
+        throw notFunction(callable);
+    }
+
+    private static ECMAException notFunction(final Object obj) {
+        return typeError("not.a.function", ScriptRuntime.safeToString(obj));
+    }
+
+    private static boolean isJSObjectFunction(final Object obj) {
+        return obj instanceof JSObject && ((JSObject)obj).isFunction();
+    }
+
     /**
      * Returns if the given object is a dynalink Dynamic method
      * @param obj object to be checked
      * @return true if the obj is a dynamic method
      */
     public static boolean isDynamicMethod(final Object obj) {
-        return obj instanceof BoundDynamicMethod || BeansLinker.isDynamicMethod(obj);
+        return BeansLinker.isDynamicMethod(obj instanceof BoundCallable ? ((BoundCallable)obj).getCallable() : obj);
     }
 
     /**
@@ -370,14 +401,22 @@ public final class Bootstrap {
     }
 
     /**
-     * Binds a bean dynamic method (returned by invoking {@code dyn:getMethod} on an object linked with
-     * {@code BeansLinker} to a receiver.
-     * @param dynamicMethod the dynamic method to bind
+     * Binds any object Nashorn can use as a [[Callable]] to a receiver and optionally arguments.
+     * @param callable the callable to bind
      * @param boundThis the bound "this" value.
-     * @return a bound dynamic method.
+     * @param boundArgs the bound arguments. Can be either null or empty array to signify no arguments are bound.
+     * @return a bound callable.
+     * @throws ECMAException with {@code TypeError} if the object is not a callable.
      */
-    public static Object bindDynamicMethod(final Object dynamicMethod, final Object boundThis) {
-        return new BoundDynamicMethod(dynamicMethod, boundThis);
+    public static Object bindCallable(final Object callable, final Object boundThis, final Object[] boundArgs) {
+        if (callable instanceof ScriptFunctionImpl) {
+            return ((ScriptFunctionImpl)callable).makeBoundFunction(boundThis, boundArgs);
+        } else if (callable instanceof BoundCallable) {
+            return ((BoundCallable)callable).bind(boundArgs);
+        } else if (isCallable(callable)) {
+            return new BoundCallable(callable, boundThis, boundArgs);
+        }
+        throw notFunction(callable);
     }
 
     /**
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundCallable.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundCallable.java
new file mode 100644
index 00000000000..a0eee0de530
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundCallable.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime.linker;
+
+import java.util.Arrays;
+import jdk.nashorn.internal.runtime.ScriptRuntime;
+
+/**
+ * Represents a Nashorn callable bound to a receiver and optionally arguments. Note that objects of this class
+ * are just the tuples of a callable and a bound this and arguments, without any behavior. All the behavior is
+ * defined in the {@code BoundCallableLinker}.
+ */
+public final class BoundCallable {
+    private final Object callable;
+    private final Object boundThis;
+    private final Object[] boundArgs;
+
+    BoundCallable(final Object callable, final Object boundThis, final Object[] boundArgs) {
+        this.callable = callable;
+        this.boundThis = boundThis;
+        this.boundArgs = isEmptyArray(boundArgs) ? ScriptRuntime.EMPTY_ARRAY : boundArgs.clone();
+    }
+
+    private BoundCallable(final BoundCallable original, final Object[] extraBoundArgs) {
+        this.callable = original.callable;
+        this.boundThis = original.boundThis;
+        this.boundArgs = original.concatenateBoundArgs(extraBoundArgs);
+    }
+
+    Object getCallable() {
+        return callable;
+    }
+
+    Object getBoundThis() {
+        return boundThis;
+    }
+
+    Object[] getBoundArgs() {
+        return boundArgs;
+    }
+
+    BoundCallable bind(final Object[] extraBoundArgs) {
+        if (isEmptyArray(extraBoundArgs)) {
+            return this;
+        }
+        return new BoundCallable(this, extraBoundArgs);
+    }
+
+    private Object[] concatenateBoundArgs(final Object[] extraBoundArgs) {
+        if (boundArgs.length == 0) {
+            return extraBoundArgs.clone();
+        }
+        final int origBoundArgsLen = boundArgs.length;
+        final int extraBoundArgsLen = extraBoundArgs.length;
+        final Object[] newBoundArgs = new Object[origBoundArgsLen + extraBoundArgsLen];
+        System.arraycopy(boundArgs, 0, newBoundArgs, 0, origBoundArgsLen);
+        System.arraycopy(extraBoundArgs, 0, newBoundArgs, origBoundArgsLen, extraBoundArgsLen);
+        return newBoundArgs;
+    }
+
+    private static boolean isEmptyArray(final Object[] a) {
+        return a == null || a.length == 0;
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder b = new StringBuilder(callable.toString()).append(" on ").append(boundThis);
+        if (boundArgs.length != 0) {
+            b.append(" with ").append(Arrays.toString(boundArgs));
+        }
+        return b.toString();
+    }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundCallableLinker.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundCallableLinker.java
new file mode 100644
index 00000000000..d52063bf3f5
--- /dev/null
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundCallableLinker.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.nashorn.internal.runtime.linker;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.lang.invoke.MethodType;
+import java.util.Arrays;
+import jdk.internal.dynalink.CallSiteDescriptor;
+import jdk.internal.dynalink.linker.GuardedInvocation;
+import jdk.internal.dynalink.linker.LinkRequest;
+import jdk.internal.dynalink.linker.LinkerServices;
+import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
+import jdk.internal.dynalink.support.Guards;
+
+/**
+ * Links {@link BoundCallable} objects. Passes through to linker services for linking a callable (for either
+ * "dyn:call" or "dyn:new"), and modifies the returned invocation to deal with the receiver and argument binding.
+ */
+final class BoundCallableLinker implements TypeBasedGuardingDynamicLinker {
+    @Override
+    public boolean canLinkType(final Class<?> type) {
+        return type == BoundCallable.class;
+    }
+
+    @Override
+    public GuardedInvocation getGuardedInvocation(final LinkRequest linkRequest, final LinkerServices linkerServices) throws Exception {
+        final Object objBoundCallable = linkRequest.getReceiver();
+        if(!(objBoundCallable instanceof BoundCallable)) {
+            return null;
+        }
+
+        final CallSiteDescriptor descriptor = linkRequest.getCallSiteDescriptor();
+        if (descriptor.getNameTokenCount() < 2 || !"dyn".equals(descriptor.getNameToken(CallSiteDescriptor.SCHEME))) {
+            return null;
+        }
+        final String operation = descriptor.getNameToken(CallSiteDescriptor.OPERATOR);
+        // We need to distinguish "dyn:new" from "dyn:call" because "dyn:call" sites have parameter list of the form
+        // "callee, this, args", while "dyn:call" sites have "callee, args" -- they lack the "this" parameter.
+        final boolean isCall;
+        if ("new".equals(operation)) {
+            isCall = false;
+        } else if ("call".equals(operation)) {
+            isCall = true;
+        } else {
+            // Only dyn:call and dyn:new are supported.
+            return null;
+        }
+        final BoundCallable boundCallable = (BoundCallable)objBoundCallable;
+        final Object callable = boundCallable.getCallable();
+        final Object boundThis = boundCallable.getBoundThis();
+
+        // We need to ask the linker services for a delegate invocation on the target callable.
+
+        // Replace arguments (boundCallable[, this], args) => (callable[, boundThis], boundArgs, args) when delegating
+        final Object[] args = linkRequest.getArguments();
+        final Object[] boundArgs = boundCallable.getBoundArgs();
+        final int argsLen = args.length;
+        final int boundArgsLen = boundArgs.length;
+        final Object[] newArgs = new Object[argsLen + boundArgsLen];
+        newArgs[0] = callable;
+        final int firstArgIndex;
+        if (isCall) {
+            newArgs[1] = boundThis;
+            firstArgIndex = 2;
+        } else {
+            firstArgIndex = 1;
+        }
+        System.arraycopy(boundArgs, 0, newArgs, firstArgIndex, boundArgsLen);
+        System.arraycopy(args, firstArgIndex, newArgs, firstArgIndex + boundArgsLen, argsLen - firstArgIndex);
+
+        // Use R(T0, T1, T2, ...) => R(callable.class, boundThis.class, boundArg0.class, ..., boundArgn.class, T2, ...)
+        // call site type when delegating to underlying linker (for dyn:new, there's no this).
+        final MethodType type = descriptor.getMethodType();
+        // Use R(T0, ...) => R(callable.class, ...)
+        MethodType newMethodType = descriptor.getMethodType().changeParameterType(0, callable.getClass());
+        if (isCall) {
+            // R(callable.class, T1, ...) => R(callable.class, boundThis.class, ...)
+            newMethodType = newMethodType.changeParameterType(1, boundThis.getClass());
+        }
+        // R(callable.class[, boundThis.class], T2, ...) => R(callable.class[, boundThis.class], boundArg0.class, ..., boundArgn.class, T2, ...)
+        for(int i = boundArgs.length; i-- > 0;) {
+            newMethodType = newMethodType.insertParameterTypes(firstArgIndex, boundArgs[i] == null ? Object.class : boundArgs[i].getClass());
+        }
+        final CallSiteDescriptor newDescriptor = descriptor.changeMethodType(newMethodType);
+
+        // Delegate to target's linker
+        final GuardedInvocation inv = linkerServices.getGuardedInvocation(linkRequest.replaceArguments(newDescriptor, newArgs));
+        if(inv == null) {
+            return null;
+        }
+
+        // Bind (callable[, boundThis], boundArgs) to the delegate handle
+        final MethodHandle boundHandle = MethodHandles.insertArguments(inv.getInvocation(), 0,
+                Arrays.copyOf(newArgs, firstArgIndex + boundArgs.length));
+        final Class<?> p0Type = type.parameterType(0);
+        final MethodHandle droppingHandle;
+        if (isCall) {
+            // Ignore incoming boundCallable and this
+            droppingHandle = MethodHandles.dropArguments(boundHandle, 0, p0Type, type.parameterType(1));
+        } else {
+            // Ignore incoming boundCallable
+            droppingHandle = MethodHandles.dropArguments(boundHandle, 0, p0Type);
+        }
+        // Identity guard on boundCallable object
+        final MethodHandle newGuard = Guards.getIdentityGuard(boundCallable);
+        return inv.replaceMethods(droppingHandle, newGuard.asType(newGuard.type().changeParameterType(0, p0Type)));
+    }
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundDynamicMethod.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundDynamicMethod.java
deleted file mode 100644
index 9008547fa88..00000000000
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundDynamicMethod.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime.linker;
-
-import java.util.Objects;
-import jdk.internal.dynalink.beans.BeansLinker;
-
-/**
- * Represents a Dynalink dynamic method bound to a receiver. Note that objects of this class are just the tuples of
- * a method and a bound this, without any behavior. All the behavior is defined in the {@code BoundDynamicMethodLinker}.
- */
-final class BoundDynamicMethod {
-    private final Object dynamicMethod;
-    private final Object boundThis;
-
-    BoundDynamicMethod(final Object dynamicMethod, final Object boundThis) {
-        assert BeansLinker.isDynamicMethod(dynamicMethod);
-        this.dynamicMethod = dynamicMethod;
-        this.boundThis = boundThis;
-    }
-
-    Object getDynamicMethod() {
-        return dynamicMethod;
-    }
-
-    Object getBoundThis() {
-        return boundThis;
-    }
-
-    @Override
-    public String toString() {
-        return dynamicMethod.toString() + " on " + Objects.toString(boundThis);
-    }
-}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundDynamicMethodLinker.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundDynamicMethodLinker.java
deleted file mode 100644
index 67e29835bb6..00000000000
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BoundDynamicMethodLinker.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package jdk.nashorn.internal.runtime.linker;
-
-import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
-import java.lang.invoke.MethodType;
-import jdk.internal.dynalink.CallSiteDescriptor;
-import jdk.internal.dynalink.beans.BeansLinker;
-import jdk.internal.dynalink.linker.GuardedInvocation;
-import jdk.internal.dynalink.linker.LinkRequest;
-import jdk.internal.dynalink.linker.LinkerServices;
-import jdk.internal.dynalink.linker.TypeBasedGuardingDynamicLinker;
-import jdk.internal.dynalink.support.Guards;
-
-/**
- * Links {@code BoundDynamicMethod} objects. Passes through to Dynalink's BeansLinker for linking a dynamic method
- * (they only respond to "dyn:call"), and modifies the returned invocation to deal with the receiver binding.
- */
-final class BoundDynamicMethodLinker implements TypeBasedGuardingDynamicLinker {
-    @Override
-    public boolean canLinkType(final Class<?> type) {
-        return type == BoundDynamicMethod.class;
-    }
-
-    @Override
-    public GuardedInvocation getGuardedInvocation(final LinkRequest linkRequest, final LinkerServices linkerServices) throws Exception {
-        final Object objBoundDynamicMethod = linkRequest.getReceiver();
-        if(!(objBoundDynamicMethod instanceof BoundDynamicMethod)) {
-            return null;
-        }
-
-        final BoundDynamicMethod boundDynamicMethod = (BoundDynamicMethod)objBoundDynamicMethod;
-        final Object dynamicMethod = boundDynamicMethod.getDynamicMethod();
-        final Object boundThis = boundDynamicMethod.getBoundThis();
-
-        // Replace arguments (boundDynamicMethod, this, ...) => (dynamicMethod, boundThis, ...) when delegating to
-        // BeansLinker
-        final Object[] args = linkRequest.getArguments();
-        args[0] = dynamicMethod;
-        args[1] = boundThis;
-
-        // Use R(T0, T1, ...) => R(dynamicMethod.class, boundThis.class, ...) call site type when delegating to
-        // BeansLinker.
-        final CallSiteDescriptor descriptor = linkRequest.getCallSiteDescriptor();
-        final MethodType type = descriptor.getMethodType();
-        final Class<?> dynamicMethodClass = dynamicMethod.getClass();
-        final CallSiteDescriptor newDescriptor = descriptor.changeMethodType(
-                type.changeParameterType(0, dynamicMethodClass).changeParameterType(1, boundThis.getClass()));
-
-        // Delegate to BeansLinker
-        final GuardedInvocation inv = NashornBeansLinker.getGuardedInvocation(BeansLinker.getLinkerForClass(dynamicMethodClass),
-                linkRequest.replaceArguments(newDescriptor, args), linkerServices);
-        if(inv == null) {
-            return null;
-        }
-
-        // Bind (dynamicMethod, boundThis) to the handle
-        final MethodHandle boundHandle = MethodHandles.insertArguments(inv.getInvocation(), 0, dynamicMethod, boundThis);
-        final Class<?> p0Type = type.parameterType(0);
-        // Ignore incoming (boundDynamicMethod, this)
-        final MethodHandle droppingHandle = MethodHandles.dropArguments(boundHandle, 0, p0Type, type.parameterType(1));
-        // Identity guard on boundDynamicMethod object
-        final MethodHandle newGuard = Guards.getIdentityGuard(boundDynamicMethod);
-
-        return inv.replaceMethods(droppingHandle, newGuard.asType(newGuard.type().changeParameterType(0, p0Type)));
-    }
-}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaSuperAdapterLinker.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaSuperAdapterLinker.java
index 5fc93cb4353..9aeefd72e37 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaSuperAdapterLinker.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaSuperAdapterLinker.java
@@ -165,7 +165,7 @@ final class JavaSuperAdapterLinker implements TypeBasedGuardingDynamicLinker {
      */
     @SuppressWarnings("unused")
     private static Object bindDynamicMethod(final Object dynamicMethod, final Object boundThis) {
-        return dynamicMethod == null ? ScriptRuntime.UNDEFINED : Bootstrap.bindDynamicMethod(dynamicMethod, boundThis);
+        return dynamicMethod == null ? ScriptRuntime.UNDEFINED : Bootstrap.bindCallable(dynamicMethod, boundThis, null);
     }
 
     /**
diff --git a/nashorn/test/script/basic/JDK-8051778.js b/nashorn/test/script/basic/JDK-8051778.js
new file mode 100644
index 00000000000..2d8d788aa37
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8051778.js
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2014 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.
+ */
+
+/**
+ * JDK-8051778: support bind on all Nashorn callables
+ *
+ * @test
+ * @run
+ */
+
+var bind = Function.prototype.bind;
+
+// Bind a POJO method
+var l = new java.util.ArrayList();
+var l_add_foo = bind.call(l.add, l, "foo");
+l_add_foo();
+print("l=" + l);
+
+// Bind a BoundCallable
+var l_add = bind.call(l.add, l);
+var l_add_foo2 = bind.call(l_add, null, "foo2");
+l_add_foo2();
+print("l=" + l);
+
+// Bind a POJO method retrieved from one instance to a different but 
+// compatible instance.
+var l2 = new java.util.ArrayList();
+var l2_size = bind.call(l.size, l2);
+print("l2_size()=" + l2_size());
+
+// Bind a Java type object (used as a constructor).
+var construct_two = bind.call(java.lang.Integer, null, 2);
+print("Bound Integer(2) constructor: " + new construct_two())
+
+// Bind a @FunctionalInterface proxying to an object literal. NOTE: the 
+// expected value of this.a is always "original" and never "bound". This
+// might seem counterintuitive, but we are not binding the apply()
+// function of the object literal that defines the BiFunction behaviour,
+// we are binding the SAM proxy object instead, and it is always
+// forwarding to the apply() function with "this" set to the object
+// literal. Basically, binding "this" for SAM proxies is useless; only
+// binding arguments makes sense.
+var f1 = new java.util.function.BiFunction() {
+    apply: function(x, y) {
+        return "BiFunction with literal: " + this.a + ", " + x + ", " + y;
+    },
+    a: "unbound"
+};
+print((bind.call(f1, {a: "bound"}))(1, 2))
+print((bind.call(f1, {a: "bound"}, 3))(4))
+print((bind.call(f1, {a: "bound"}, 5, 6))())
+
+// Bind a @FunctionalInterface proxying to a function. With the same 
+// reasoning as above (binding the proxy vs. binding the JS function), 
+// the value of this.a will always be undefined, and never "bound".
+var f2 = new java.util.function.BiFunction(
+    function(x, y) {
+        return "BiFunction with function: " + this.a + ", " + x + ", " + y;
+    }
+);
+print((bind.call(f2, {a: "bound"}))(7, 8))
+print((bind.call(f2, {a: "bound"}, 9))(10))
+print((bind.call(f2, {a: "bound"}, 11, 12))())
diff --git a/nashorn/test/script/basic/JDK-8051778.js.EXPECTED b/nashorn/test/script/basic/JDK-8051778.js.EXPECTED
new file mode 100644
index 00000000000..4ba3e28712e
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8051778.js.EXPECTED
@@ -0,0 +1,10 @@
+l=[foo]
+l=[foo, foo2]
+l2_size()=0
+Bound Integer(2) constructor: 2
+BiFunction with literal: unbound, 1, 2
+BiFunction with literal: unbound, 3, 4
+BiFunction with literal: unbound, 5, 6
+BiFunction with function: undefined, 7, 8
+BiFunction with function: undefined, 9, 10
+BiFunction with function: undefined, 11, 12

From a0485e336d962f27ca62a0c5f86f5dcde784f5ab Mon Sep 17 00:00:00 2001
From: Vladimir Ivanov <vlivanov@openjdk.org>
Date: Thu, 27 Nov 2014 17:14:01 +0400
Subject: [PATCH 170/299] 8065985: Inlining failure of Number.doubleValue() in
 JSType.toNumeric() causes 15% peak perf regresion on Box2D

Reviewed-by: lagergren, hannesw
---
 .../share/classes/jdk/nashorn/internal/runtime/JSType.java     | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java
index 75395ea427e..7e54b1e2257 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java
@@ -714,6 +714,9 @@ public enum JSType {
      * @return a number
      */
     public static double toNumber(final Object obj) {
+        if (obj instanceof Double) {
+            return (Double)obj;
+        }
         if (obj instanceof Number) {
             return ((Number)obj).doubleValue();
         }

From 7b35db48f7ce7d45d736012b2ead79f4b8128f4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= <hannesw@openjdk.org>
Date: Thu, 27 Nov 2014 16:42:53 +0100
Subject: [PATCH 171/299] 8057980: let & const: remaining issues with lexical
 scoping

Reviewed-by: lagergren, attila
---
 .../internal/codegen/AssignSymbols.java       | 30 ++++--
 .../internal/codegen/CodeGenerator.java       |  7 ++
 .../jdk/nashorn/internal/codegen/Lower.java   |  2 +-
 .../jdk/nashorn/internal/ir/ForNode.java      | 15 ++-
 .../nashorn/internal/ir/LexicalContext.java   | 14 +++
 .../jdk/nashorn/internal/ir/LoopNode.java     |  6 ++
 .../jdk/nashorn/internal/ir/VarNode.java      | 19 +---
 .../jdk/nashorn/internal/ir/WhileNode.java    |  5 +
 .../jdk/nashorn/internal/parser/Parser.java   | 96 ++++++++++---------
 .../parser/ParserContextSwitchNode.java       |  2 +-
 .../internal/runtime/ScriptObject.java        | 83 +++++++++++-----
 .../internal/runtime/arrays/ArrayData.java    | 15 ++-
 .../runtime/resources/Messages.properties     |  2 +
 nashorn/test/script/basic/es6/for-let.js      | 37 +++++++
 .../test/script/basic/es6/for-let.js.EXPECTED | 22 +++++
 .../basic/es6/let-const-statement-context.js  | 49 ++++++++++
 .../let-const-statement-context.js.EXPECTED   | 30 ++++++
 .../test/script/basic/es6/let-const-switch.js | 45 +++++++++
 .../basic/es6/let-const-switch.js.EXPECTED    | 12 +++
 nashorn/test/script/basic/es6/let-load.js     | 19 ++--
 .../script/basic/es6/let-load.js.EXPECTED     |  1 +
 .../basic/es6/let_const_closure.js.EXPECTED   |  6 +-
 .../basic/es6/lexical-toplevel.js.EXPECTED    |  2 +
 23 files changed, 391 insertions(+), 128 deletions(-)
 create mode 100644 nashorn/test/script/basic/es6/let-const-statement-context.js
 create mode 100644 nashorn/test/script/basic/es6/let-const-statement-context.js.EXPECTED
 create mode 100644 nashorn/test/script/basic/es6/let-const-switch.js
 create mode 100644 nashorn/test/script/basic/es6/let-const-switch.js.EXPECTED

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java
index ad0f13c7643..6eb89a16299 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java
@@ -189,7 +189,7 @@ final class AssignSymbols extends NodeVisitor<LexicalContext> implements Loggabl
      * @param body the body of the FunctionNode we are entering
      */
     private void acceptDeclarations(final FunctionNode functionNode, final Block body) {
-        // This visitor will assign symbol to all declared variables, except "var" declarations in for loop initializers.
+        // This visitor will assign symbol to all declared variables.
         body.accept(new NodeVisitor<LexicalContext>(new LexicalContext()) {
             @Override
             protected boolean enterDefault(final Node node) {
@@ -200,16 +200,17 @@ final class AssignSymbols extends NodeVisitor<LexicalContext> implements Loggabl
 
             @Override
             public Node leaveVarNode(final VarNode varNode) {
-                if (varNode.isStatement()) {
-                    final IdentNode ident  = varNode.getName();
-                    final Block block = varNode.isBlockScoped() ? getLexicalContext().getCurrentBlock() : body;
-                    final Symbol symbol = defineSymbol(block, ident.getName(), ident, varNode.getSymbolFlags());
-                    if (varNode.isFunctionDeclaration()) {
-                        symbol.setIsFunctionDeclaration();
-                    }
-                    return varNode.setName(ident.setSymbol(symbol));
+                final IdentNode ident  = varNode.getName();
+                final boolean blockScoped = varNode.isBlockScoped();
+                if (blockScoped && lc.inUnprotectedSwitchContext()) {
+                    throwUnprotectedSwitchError(varNode);
                 }
-                return varNode;
+                final Block block = blockScoped ? lc.getCurrentBlock() : body;
+                final Symbol symbol = defineSymbol(block, ident.getName(), ident, varNode.getSymbolFlags());
+                if (varNode.isFunctionDeclaration()) {
+                    symbol.setIsFunctionDeclaration();
+                }
+                return varNode.setName(ident.setSymbol(symbol));
             }
         });
     }
@@ -1048,6 +1049,15 @@ final class AssignSymbols extends NodeVisitor<LexicalContext> implements Loggabl
         return !(units == null || units.isEmpty());
     }
 
+    private void throwUnprotectedSwitchError(final VarNode varNode) {
+        // Block scoped declarations in switch statements without explicit blocks should be declared
+        // in a common block that contains all the case clauses. We cannot support this without a
+        // fundamental rewrite of how switch statements are handled (case nodes contain blocks and are
+        // directly contained by switch node). As a temporary solution we throw a reference error here.
+        final String msg = ECMAErrors.getMessage("syntax.error.unprotected.switch.declaration", varNode.isLet() ? "let" : "const");
+        throwParserException(msg, varNode);
+    }
+
     private void throwParserException(final String message, final Node origin) {
         if (origin == null) {
             throw new ParserException(message);
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
index 6e84dd8992c..1bf3b382b08 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -3264,6 +3264,13 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
             emitContinueLabel(continueLabel, liveLocalsOnContinue);
         }
 
+        if (loopNode.hasPerIterationScope() && lc.getParentBlock().needsScope()) {
+            // ES6 for loops with LET init need a new scope for each iteration. We just create a shallow copy here.
+            method.loadCompilerConstant(SCOPE);
+            method.invoke(virtualCallNoLookup(ScriptObject.class, "copy", ScriptObject.class));
+            method.storeCompilerConstant(SCOPE);
+        }
+
         if(method.isReachable()) {
             if(modify != null) {
                 lineNumber(loopNode);
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
index 724c6f1e531..b52d39843a3 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
@@ -525,7 +525,7 @@ final class Lower extends NodeOperatorVisitor<BlockLexicalContext> implements Lo
 
         if (isAlwaysTrue(test)) {
             //turn it into a for node without a test.
-            final ForNode forNode = (ForNode)new ForNode(whileNode.getLineNumber(), whileNode.getToken(), whileNode.getFinish(), body, ForNode.IS_FOR).accept(this);
+            final ForNode forNode = (ForNode)new ForNode(whileNode.getLineNumber(), whileNode.getToken(), whileNode.getFinish(), body, 0).accept(this);
             lc.replace(whileNode, forNode);
             return forNode;
         }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ForNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ForNode.java
index e08c4d2b1da..ee9722d33e9 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ForNode.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/ForNode.java
@@ -45,14 +45,14 @@ public final class ForNode extends LoopNode {
     /** Iterator symbol. */
     private Symbol iterator;
 
-    /** Is this a normal for loop? */
-    public static final int IS_FOR      = 1 << 0;
-
     /** Is this a normal for in loop? */
-    public static final int IS_FOR_IN   = 1 << 1;
+    public static final int IS_FOR_IN           = 1 << 0;
 
     /** Is this a normal for each in loop? */
-    public static final int IS_FOR_EACH = 1 << 2;
+    public static final int IS_FOR_EACH         = 1 << 1;
+
+    /** Does this loop need a per-iteration scope because its init contain a LET declaration? */
+    public static final int PER_ITERATION_SCOPE = 1 << 2;
 
     private final int flags;
 
@@ -264,4 +264,9 @@ public final class ForNode extends LoopNode {
     JoinPredecessor setLocalVariableConversionChanged(final LexicalContext lc, final LocalVariableConversion conversion) {
         return Node.replaceInLexicalContext(lc, this, new ForNode(this, init, test, body, modify, flags, controlFlowEscapes, conversion));
     }
+
+    @Override
+    public boolean hasPerIterationScope() {
+        return (flags & PER_ITERATION_SCOPE) != 0;
+    }
 }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LexicalContext.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LexicalContext.java
index 2b59a07cc79..487d6aeb7af 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LexicalContext.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LexicalContext.java
@@ -597,6 +597,20 @@ public class LexicalContext {
         throw new AssertionError(target + " was expected in lexical context " + LexicalContext.this + " but wasn't");
     }
 
+    /**
+     * Checks whether the current context is inside a switch statement without explicit blocks (curly braces).
+     * @return true if in unprotected switch statement
+     */
+    public boolean inUnprotectedSwitchContext() {
+        for (int i = sp; i > 0; i--) {
+            final LexicalContextNode next = stack[i];
+            if (next instanceof Block) {
+                return stack[i - 1] instanceof SwitchNode;
+            }
+        }
+        return false;
+    }
+
     @Override
     public String toString() {
         final StringBuffer sb = new StringBuffer();
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LoopNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LoopNode.java
index 9e4dc421624..bbc6d595c9d 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LoopNode.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LoopNode.java
@@ -177,4 +177,10 @@ public abstract class LoopNode extends BreakableStatement {
      * @return new loop node if changed otherwise the same
      */
     public abstract LoopNode setControlFlowEscapes(final LexicalContext lc, final boolean controlFlowEscapes);
+
+    /**
+     * Does this loop have a LET declaration and hence require a per-iteration scope?
+     * @return true if a per-iteration scope is required.
+     */
+    public abstract boolean hasPerIterationScope();
 }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/VarNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/VarNode.java
index 44d7d4c7767..1cee8cb59a6 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/VarNode.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/VarNode.java
@@ -45,19 +45,16 @@ public final class VarNode extends Statement implements Assignment<IdentNode> {
     /** Is this a var statement (as opposed to a "var" in a for loop statement) */
     private final int flags;
 
-    /** Flag that determines if this function node is a statement */
-    public static final int IS_STATEMENT                 = 1 << 0;
-
     /** Flag for ES6 LET declaration */
-    public static final int IS_LET                       = 1 << 1;
+    public static final int IS_LET                       = 1 << 0;
 
     /** Flag for ES6 CONST declaration */
-    public static final int IS_CONST                     = 1 << 2;
+    public static final int IS_CONST                     = 1 << 1;
 
     /** Flag that determines if this is the last function declaration in a function
      *  This is used to micro optimize the placement of return value assignments for
      *  a program node */
-    public static final int IS_LAST_FUNCTION_DECLARATION = 1 << 3;
+    public static final int IS_LAST_FUNCTION_DECLARATION = 1 << 2;
 
     /**
      * Constructor
@@ -69,7 +66,7 @@ public final class VarNode extends Statement implements Assignment<IdentNode> {
      * @param init       init node or null if just a declaration
      */
     public VarNode(final int lineNumber, final long token, final int finish, final IdentNode name, final Expression init) {
-        this(lineNumber, token, finish, name, init, IS_STATEMENT);
+        this(lineNumber, token, finish, name, init, 0);
     }
 
     private VarNode(final VarNode varNode, final IdentNode name, final Expression init, final int flags) {
@@ -259,14 +256,6 @@ public final class VarNode extends Statement implements Assignment<IdentNode> {
         return setFlags(flags | flag);
     }
 
-    /**
-     * Returns true if this is a var statement (as opposed to a var initializer in a for loop).
-     * @return true if this is a var statement (as opposed to a var initializer in a for loop).
-     */
-    public boolean isStatement() {
-        return (flags & IS_STATEMENT) != 0;
-    }
-
     /**
      * Returns true if this is a function declaration.
      * @return true if this is a function declaration.
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/WhileNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/WhileNode.java
index 40bda535fe4..e6304f4e9fb 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/WhileNode.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/WhileNode.java
@@ -150,4 +150,9 @@ public final class WhileNode extends LoopNode {
         }
         return test == null;
     }
+
+    @Override
+    public boolean hasPerIterationScope() {
+        return false;
+    }
 }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
index 7a58c418284..4fa27ce34f4 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
@@ -554,7 +554,7 @@ loop:
         // Set up new block. Captures first token.
         final ParserContextBlockNode newBlock = newBlock();
         try {
-            statement();
+            statement(false, false, true);
         } finally {
             restoreBlock(newBlock);
         }
@@ -770,7 +770,7 @@ loop:
 
                 try {
                     // Get the next element.
-                    statement(true, allowPropertyFunction);
+                    statement(true, allowPropertyFunction, false);
                     allowPropertyFunction = false;
 
                     // check for directive prologues
@@ -860,13 +860,15 @@ loop:
      * Parse any of the basic statement types.
      */
     private void statement() {
-        statement(false, false);
+        statement(false, false, false);
     }
 
     /**
      * @param topLevel does this statement occur at the "top level" of a script or a function?
+     * @param allowPropertyFunction allow property "get" and "set" functions?
+     * @param singleStatement are we in a single statement context?
      */
-    private void statement(final boolean topLevel, final boolean allowPropertyFunction) {
+    private void statement(final boolean topLevel, final boolean allowPropertyFunction, final boolean singleStatement) {
         if (type == FUNCTION) {
             // As per spec (ECMA section 12), function declarations as arbitrary statement
             // is not "portable". Implementation can issue a warning or disallow the same.
@@ -930,6 +932,9 @@ loop:
             break;
         default:
             if (useBlockScope() && (type == LET || type == CONST)) {
+                if (singleStatement) {
+                    throw error(AbstractParser.message("expected.stmt", type.getName() + " declaration"), token);
+                }
                 variableStatement(type, true);
                 break;
             }
@@ -1055,7 +1060,7 @@ loop:
         next();
 
         final List<VarNode> vars = new ArrayList<>();
-        int varFlags = VarNode.IS_STATEMENT;
+        int varFlags = 0;
         if (varType == LET) {
             varFlags |= VarNode.IS_LET;
         } else if (varType == CONST) {
@@ -1200,7 +1205,6 @@ loop:
         final int startLine = start;
         final ParserContextBlockNode outer = useBlockScope() ? newBlock() : null;
 
-
         // Create FOR node, capturing FOR token.
         final ParserContextLoopNode forNode = new ParserContextLoopNode();
         lc.push(forNode);
@@ -1228,19 +1232,22 @@ loop:
 
             switch (type) {
             case VAR:
-                // Var statements captured in for outer block.
+                // Var declaration captured in for outer block.
                 vars = variableStatement(type, false);
                 break;
             case SEMICOLON:
                 break;
             default:
                 if (useBlockScope() && (type == LET || type == CONST)) {
-                    // LET/CONST captured in container block created above.
+                    if (type == LET) {
+                        flags |= ForNode.PER_ITERATION_SCOPE;
+                    }
+                    // LET/CONST declaration captured in container block created above.
                     vars = variableStatement(type, false);
                     break;
                 }
                 if (env._const_as_var && type == CONST) {
-                    // Var statements captured in for outer block.
+                    // Var declaration captured in for outer block.
                     vars = variableStatement(TokenType.VAR, false);
                     break;
                 }
@@ -1316,22 +1323,23 @@ loop:
             body = getStatement();
         } finally {
             lc.pop(forNode);
-            if (vars != null) {
-                for (final VarNode var : vars) {
-                    appendStatement(var);
-                }
-            }
-            if (body != null) {
-                appendStatement(new ForNode(forLine, forToken, body.getFinish(), body, (forNode.getFlags() | flags), init, test, modify));
-            }
-            if (outer != null) {
-                restoreBlock(outer);
-                appendStatement(new BlockStatement(startLine, new Block(
-                        outer.getToken(),
-                        body.getFinish(),
-                        outer.getStatements())));
+        }
+
+        if (vars != null) {
+            for (final VarNode var : vars) {
+                appendStatement(var);
             }
         }
+        if (body != null) {
+            appendStatement(new ForNode(forLine, forToken, body.getFinish(), body, (forNode.getFlags() | flags), init, test, modify));
+        }
+        if (outer != null) {
+            restoreBlock(outer);
+            appendStatement(new BlockStatement(startLine, new Block(
+                    outer.getToken(),
+                    body.getFinish(),
+                    outer.getStatements())));
+        }
     }
 
     /**
@@ -1364,9 +1372,10 @@ loop:
             body = getStatement();
         } finally {
             lc.pop(whileNode);
-            if (body != null){
-              appendStatement(new WhileNode(whileLine, whileToken, body.getFinish(), false, test, body));
-            }
+        }
+
+        if (body != null) {
+            appendStatement(new WhileNode(whileLine, whileToken, body.getFinish(), false, test, body));
         }
     }
 
@@ -1408,8 +1417,9 @@ loop:
             }
         } finally {
             lc.pop(doWhileNode);
-            appendStatement(new WhileNode(doLine, doToken, finish, true, test, body));
         }
+
+        appendStatement(new WhileNode(doLine, doToken, finish, true, test, body));
     }
 
     /**
@@ -1607,17 +1617,12 @@ loop:
             throw error(AbstractParser.message("strict.no.with"), withToken);
         }
 
-        Expression expression = null;
-        Block body = null;
-        try {
-            expect(LPAREN);
-            expression = expression();
-            expect(RPAREN);
-            body = getStatement();
-        } finally {
-            appendStatement(new WithNode(withLine, withToken, finish, expression, body));
-        }
+        expect(LPAREN);
+        final Expression expression = expression();
+        expect(RPAREN);
+        final Block body = getStatement();
 
+        appendStatement(new WithNode(withLine, withToken, finish, expression, body));
     }
 
     /**
@@ -1706,8 +1711,9 @@ loop:
             next();
         } finally {
             lc.pop(switchNode);
-            appendStatement(new SwitchNode(switchLine, switchToken, finish, expression, cases, defaultCase));
         }
+
+        appendStatement(new SwitchNode(switchLine, switchToken, finish, expression, cases, defaultCase));
     }
 
     /**
@@ -1738,10 +1744,9 @@ loop:
         } finally {
             assert lc.peek() instanceof ParserContextLabelNode;
             lc.pop(labelNode);
-            if (ident != null){
-              appendStatement(new LabelNode(line, labelToken, finish, ident.getName(), body));
-            }
         }
+
+        appendStatement(new LabelNode(line, labelToken, finish, ident.getName(), body));
     }
 
     /**
@@ -2725,12 +2730,9 @@ loop:
                 functionBody);
 
         if (isStatement) {
-            int varFlags = VarNode.IS_STATEMENT;
-            if (!topLevel && useBlockScope()) {
-                // mark ES6 block functions as lexically scoped
-                varFlags |= VarNode.IS_LET;
-            }
-            final VarNode varNode = new VarNode(functionLine, functionToken, finish, name, function, varFlags);
+            // mark ES6 block functions as lexically scoped
+            final int     varFlags = (topLevel || !useBlockScope()) ? 0 : VarNode.IS_LET;
+            final VarNode varNode  = new VarNode(functionLine, functionToken, finish, name, function, varFlags);
             if (topLevel) {
                 functionDeclarations.add(varNode);
             } else if (useBlockScope()) {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextSwitchNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextSwitchNode.java
index 8c9c96a6a2d..ec0d2d0eca4 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextSwitchNode.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextSwitchNode.java
@@ -25,7 +25,7 @@
 package jdk.nashorn.internal.parser;
 
 /**
- * A ParserContextNode that represents a SwithcNode that is currently being parsed
+ * A ParserContextNode that represents a SwitchNode that is currently being parsed
  */
 class ParserContextSwitchNode extends ParserContextBaseNode implements ParserContextBreakableNode {
 
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
index f87af8ee500..3f605910248 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
@@ -46,6 +46,8 @@ import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_
 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.isValid;
 import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.getArrayIndex;
 import static jdk.nashorn.internal.runtime.arrays.ArrayIndex.isValidArrayIndex;
+import static jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor.isScopeFlag;
+import static jdk.nashorn.internal.runtime.linker.NashornCallSiteDescriptor.isStrictFlag;
 import static jdk.nashorn.internal.runtime.linker.NashornGuards.explicitInstanceOfCheck;
 
 import java.lang.invoke.MethodHandle;
@@ -98,7 +100,7 @@ import jdk.nashorn.internal.runtime.linker.NashornGuards;
  * </ul>
  */
 
-public abstract class ScriptObject implements PropertyAccess {
+public abstract class ScriptObject implements PropertyAccess, Cloneable {
     /** __proto__ special property name inside object literals. ES6 draft. */
     public static final String PROTO_PROPERTY_NAME   = "__proto__";
 
@@ -2202,6 +2204,9 @@ public abstract class ScriptObject implements PropertyAccess {
 
         if (find != null) {
             if (!find.getProperty().isWritable() && !NashornCallSiteDescriptor.isDeclaration(desc)) {
+                if (NashornCallSiteDescriptor.isScope(desc) && find.getProperty().isLexicalBinding()) {
+                    throw typeError("assign.constant", name); // Overwriting ES6 const should throw also in non-strict mode.
+                }
                 // Existing, non-writable property
                 return createEmptySetMethod(desc, explicitInstanceOfCheck, "property.not.writable", true);
             }
@@ -3103,7 +3108,7 @@ public abstract class ScriptObject implements PropertyAccess {
     private boolean doesNotHaveEnsureLength(final long longIndex, final long oldLength, final int callSiteFlags) {
         if (longIndex >= oldLength) {
             if (!isExtensible()) {
-                if (NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)) {
+                if (isStrictFlag(callSiteFlags)) {
                     throw typeError("object.non.extensible", JSType.toString(longIndex), ScriptRuntime.safeToString(this));
                 }
                 return true;
@@ -3127,7 +3132,7 @@ public abstract class ScriptObject implements PropertyAccess {
         final long oldLength = getArray().length();
         final long longIndex = ArrayIndex.toLongIndex(index);
         if (!doesNotHaveCheckArrayKeys(longIndex, value, callSiteFlags) && !doesNotHaveEnsureLength(longIndex, oldLength, callSiteFlags)) {
-            final boolean strict = NashornCallSiteDescriptor.isStrictFlag(callSiteFlags);
+            final boolean strict = isStrictFlag(callSiteFlags);
             setArray(getArray().set(index, value, strict));
             doesNotHaveEnsureDelete(longIndex, oldLength, strict);
         }
@@ -3137,7 +3142,7 @@ public abstract class ScriptObject implements PropertyAccess {
         final long oldLength = getArray().length();
         final long longIndex = ArrayIndex.toLongIndex(index);
         if (!doesNotHaveCheckArrayKeys(longIndex, value, callSiteFlags) && !doesNotHaveEnsureLength(longIndex, oldLength, callSiteFlags)) {
-            final boolean strict = NashornCallSiteDescriptor.isStrictFlag(callSiteFlags);
+            final boolean strict = isStrictFlag(callSiteFlags);
             setArray(getArray().set(index, value, strict));
             doesNotHaveEnsureDelete(longIndex, oldLength, strict);
         }
@@ -3147,7 +3152,7 @@ public abstract class ScriptObject implements PropertyAccess {
         final long oldLength = getArray().length();
         final long longIndex = ArrayIndex.toLongIndex(index);
         if (!doesNotHaveCheckArrayKeys(longIndex, value, callSiteFlags) && !doesNotHaveEnsureLength(longIndex, oldLength, callSiteFlags)) {
-            final boolean strict = NashornCallSiteDescriptor.isStrictFlag(callSiteFlags);
+            final boolean strict = isStrictFlag(callSiteFlags);
             setArray(getArray().set(index, value, strict));
             doesNotHaveEnsureDelete(longIndex, oldLength, strict);
         }
@@ -3157,7 +3162,7 @@ public abstract class ScriptObject implements PropertyAccess {
         final long oldLength = getArray().length();
         final long longIndex = ArrayIndex.toLongIndex(index);
         if (!doesNotHaveCheckArrayKeys(longIndex, value, callSiteFlags) && !doesNotHaveEnsureLength(longIndex, oldLength, callSiteFlags)) {
-            final boolean strict = NashornCallSiteDescriptor.isStrictFlag(callSiteFlags);
+            final boolean strict = isStrictFlag(callSiteFlags);
             setArray(getArray().set(index, value, strict));
             doesNotHaveEnsureDelete(longIndex, oldLength, strict);
         }
@@ -3178,7 +3183,7 @@ public abstract class ScriptObject implements PropertyAccess {
         invalidateGlobalConstant(key);
 
         if (f != null && f.isInherited() && !(f.getProperty() instanceof UserAccessorProperty)) {
-            final boolean isScope = NashornCallSiteDescriptor.isScopeFlag(callSiteFlags);
+            final boolean isScope = isScopeFlag(callSiteFlags);
             // If the start object of the find is not this object it means the property was found inside a
             // 'with' statement expression (see WithObject.findProperty()). In this case we forward the 'set'
             // to the 'with' object.
@@ -3199,16 +3204,19 @@ public abstract class ScriptObject implements PropertyAccess {
 
         if (f != null) {
             if (!f.getProperty().isWritable()) {
-                if (NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)) {
+                if (isScopeFlag(callSiteFlags) && f.getProperty().isLexicalBinding()) {
+                    throw typeError("assign.constant", key); // Overwriting ES6 const should throw also in non-strict mode.
+                }
+                if (isStrictFlag(callSiteFlags)) {
                     throw typeError("property.not.writable", key, ScriptRuntime.safeToString(this));
                 }
                 return;
             }
 
-            f.setValue(value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags));
+            f.setValue(value, isStrictFlag(callSiteFlags));
 
         } else if (!isExtensible()) {
-            if (NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)) {
+            if (isStrictFlag(callSiteFlags)) {
                 throw typeError("object.non.extensible", key, ScriptRuntime.safeToString(this));
             }
         } else {
@@ -3235,7 +3243,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             final ArrayData data = getArray();
             if (data.has(index)) {
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3255,7 +3263,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             final ArrayData data = getArray();
             if (data.has(index)) {
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3275,7 +3283,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             final ArrayData data = getArray();
             if (data.has(index)) {
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3295,7 +3303,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             final ArrayData data = getArray();
             if (data.has(index)) {
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3314,7 +3322,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             final ArrayData data = getArray();
             if (data.has(index)) {
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3333,7 +3341,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             final ArrayData data = getArray();
             if (data.has(index)) {
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3352,7 +3360,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             final ArrayData data = getArray();
             if (data.has(index)) {
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3371,7 +3379,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             final ArrayData data = getArray();
             if (data.has(index)) {
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3390,7 +3398,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             final ArrayData data = getArray();
             if (data.has(index)) {
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3409,7 +3417,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             final ArrayData data = getArray();
             if (data.has(index)) {
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3428,7 +3436,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             final ArrayData data = getArray();
             if (data.has(index)) {
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3447,7 +3455,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             final ArrayData data = getArray();
             if (data.has(index)) {
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3465,7 +3473,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             if (getArray().has(index)) {
                 final ArrayData data = getArray();
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3483,7 +3491,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             final ArrayData data = getArray();
             if (data.has(index)) {
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3502,7 +3510,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             final ArrayData data = getArray();
             if (data.has(index)) {
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3521,7 +3529,7 @@ public abstract class ScriptObject implements PropertyAccess {
         if (isValidArrayIndex(index)) {
             final ArrayData data = getArray();
             if (data.has(index)) {
-                setArray(data.set(index, value, NashornCallSiteDescriptor.isStrictFlag(callSiteFlags)));
+                setArray(data.set(index, value, isStrictFlag(callSiteFlags)));
             } else {
                 doesNotHave(index, value, callSiteFlags);
             }
@@ -3685,6 +3693,29 @@ public abstract class ScriptObject implements PropertyAccess {
         return true;
     }
 
+    /**
+     * Return a shallow copy of this ScriptObject.
+     * @return a shallow copy.
+     */
+    public final ScriptObject copy() {
+        try {
+            return clone();
+        } catch (final CloneNotSupportedException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
+    @Override
+    protected ScriptObject clone() throws CloneNotSupportedException {
+        final ScriptObject clone = (ScriptObject) super.clone();
+        if (objectSpill != null) {
+            clone.objectSpill = objectSpill.clone();
+            clone.primitiveSpill = primitiveSpill.clone();
+        }
+        clone.arrayData = arrayData.copy();
+        return clone;
+    }
+
     /**
      * Make a new UserAccessorProperty property. getter and setter functions are stored in
      * this ScriptObject and slot values are used in property object.
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java
index b018596f679..f0a8c7a246b 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ArrayData.java
@@ -61,9 +61,9 @@ public abstract class ArrayData {
     /**
      * Length of the array data. Not necessarily length of the wrapped array.
      * This is private to ensure that no one in a subclass is able to touch the length
-     * without going through {@link setLength}. This is used to implement
+     * without going through {@link #setLength}. This is used to implement
      * {@link LengthNotWritableFilter}s, ensuring that there are no ways past
-     * a {@link setLength} function replaced by a nop
+     * a {@link #setLength} function replaced by a nop
      */
     private long length;
 
@@ -79,11 +79,7 @@ public abstract class ArrayData {
      */
     private static class UntouchedArrayData extends ContinuousArrayData {
         private UntouchedArrayData() {
-            this(0);
-        }
-
-        private UntouchedArrayData(final int length) {
-            super(length);
+            super(0);
         }
 
         private ArrayData toRealArrayData() {
@@ -100,7 +96,8 @@ public abstract class ArrayData {
 
         @Override
         public ContinuousArrayData copy() {
-            return new UntouchedArrayData((int)length());
+            assert length() == 0;
+            return this;
         }
 
         @Override
@@ -246,7 +243,7 @@ public abstract class ArrayData {
         public Class<?> getBoxedElementType() {
             return Integer.class;
         }
-    };
+    }
 
     /**
      * Constructor
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties
index 3a161c8d352..71c11743b00 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties
@@ -116,6 +116,7 @@ type.error.instanceof.on.non.object=instanceof must be called with a javascript
 type.error.cannot.convert.to.interface=object {0} cannot be converted to {1} due to "{2}"
 type.error.array.reduce.invalid.init=invalid initialValue for Array.prototype.reduce
 type.error.array.reduceright.invalid.init=invalid initialValue for Array.prototype.reduceRight
+type.error.assign.constant=Assignment to constant "{0}"
 type.error.cannot.get.default.string=Cannot get default string value
 type.error.cannot.get.default.number=Cannot get default number value
 type.error.cant.apply.with.to.null=Cannot apply "with" to null
@@ -166,6 +167,7 @@ syntax.error.invalid.json=Invalid JSON: {0}
 syntax.error.strict.cant.delete=cannot delete "{0}" in strict mode
 syntax.error.redeclare.variable=Variable "{0}" has already been declared
 syntax.error.assign.constant=Assignment to constant "{0}"
+syntax.error.unprotected.switch.declaration=Unsupported {0} declaration in unprotected switch statement
 
 io.error.cant.write=cannot write "{0}"
 config.error.no.dest=no destination directory supplied
diff --git a/nashorn/test/script/basic/es6/for-let.js b/nashorn/test/script/basic/es6/for-let.js
index 949b348c47e..848dc3ce061 100644
--- a/nashorn/test/script/basic/es6/for-let.js
+++ b/nashorn/test/script/basic/es6/for-let.js
@@ -39,3 +39,40 @@ try {
 } catch (e) {
     print(e);
 }
+
+let a = [];
+
+for (let i = 0; i < 10; i++) {
+    a.push(function() { print(i); });
+}
+
+a.forEach(function(f) { f(); });
+
+a = [];
+
+for (let i = 0; i < 10; i++) {
+    if (i == 5) {
+        i = "foo";
+    }
+    a.push(function() { print(i); });
+}
+
+a.forEach(function(f) { f(); });
+
+try {
+    print(i);
+} catch (e) {
+    print(e);
+}
+
+a = [];
+
+for (let i = 0; i < 20; i++) {
+    if (i % 2 == 1) {
+        i += 2;
+        continue;
+    }
+    a.push(function() { print(i); });
+}
+
+a.forEach(function(f) { f(); });
diff --git a/nashorn/test/script/basic/es6/for-let.js.EXPECTED b/nashorn/test/script/basic/es6/for-let.js.EXPECTED
index 4c1ebad83f8..21787adb64b 100644
--- a/nashorn/test/script/basic/es6/for-let.js.EXPECTED
+++ b/nashorn/test/script/basic/es6/for-let.js.EXPECTED
@@ -9,3 +9,25 @@
 8
 9
 ReferenceError: "i" is not defined
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+0
+1
+2
+3
+4
+foo
+ReferenceError: "i" is not defined
+0
+4
+8
+12
+16
diff --git a/nashorn/test/script/basic/es6/let-const-statement-context.js b/nashorn/test/script/basic/es6/let-const-statement-context.js
new file mode 100644
index 00000000000..3e66237834e
--- /dev/null
+++ b/nashorn/test/script/basic/es6/let-const-statement-context.js
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8057980: let & const: remaining issues with lexical scoping
+ *
+ * @test
+ * @run
+ * @option --language=es6
+ */
+
+function tryEval(s) {
+    try {
+        eval(s);
+    } catch (e) {
+        print(String(e).replace(/\\/g, "/"));
+    }
+}
+
+tryEval('if (true) let x = 1;');
+tryEval('if (true) const x = 1;');
+tryEval('while (true) let x = 1;');
+tryEval('while (true) const x = 1;');
+tryEval('for (;;) let x = 1;');
+tryEval('for (;;) const x = 1;');
+tryEval('do let x = 1; while (true);');
+tryEval('do const x = 1; while (true);');
+tryEval('with (y) const x = 1;');
+tryEval('with (y) let x = 1;');
diff --git a/nashorn/test/script/basic/es6/let-const-statement-context.js.EXPECTED b/nashorn/test/script/basic/es6/let-const-statement-context.js.EXPECTED
new file mode 100644
index 00000000000..1b73e4c7114
--- /dev/null
+++ b/nashorn/test/script/basic/es6/let-const-statement-context.js.EXPECTED
@@ -0,0 +1,30 @@
+SyntaxError: test/script/basic/es6/let-const-statement-context.js#34:8<eval>:1:10 Expected statement but found let declaration
+if (true) let x = 1;
+          ^
+SyntaxError: test/script/basic/es6/let-const-statement-context.js#34:8<eval>:1:10 Expected statement but found const declaration
+if (true) const x = 1;
+          ^
+SyntaxError: test/script/basic/es6/let-const-statement-context.js#34:8<eval>:1:13 Expected statement but found let declaration
+while (true) let x = 1;
+             ^
+SyntaxError: test/script/basic/es6/let-const-statement-context.js#34:8<eval>:1:13 Expected statement but found const declaration
+while (true) const x = 1;
+             ^
+SyntaxError: test/script/basic/es6/let-const-statement-context.js#34:8<eval>:1:9 Expected statement but found let declaration
+for (;;) let x = 1;
+         ^
+SyntaxError: test/script/basic/es6/let-const-statement-context.js#34:8<eval>:1:9 Expected statement but found const declaration
+for (;;) const x = 1;
+         ^
+SyntaxError: test/script/basic/es6/let-const-statement-context.js#34:8<eval>:1:3 Expected statement but found let declaration
+do let x = 1; while (true);
+   ^
+SyntaxError: test/script/basic/es6/let-const-statement-context.js#34:8<eval>:1:3 Expected statement but found const declaration
+do const x = 1; while (true);
+   ^
+SyntaxError: test/script/basic/es6/let-const-statement-context.js#34:8<eval>:1:9 Expected statement but found const declaration
+with (y) const x = 1;
+         ^
+SyntaxError: test/script/basic/es6/let-const-statement-context.js#34:8<eval>:1:9 Expected statement but found let declaration
+with (y) let x = 1;
+         ^
diff --git a/nashorn/test/script/basic/es6/let-const-switch.js b/nashorn/test/script/basic/es6/let-const-switch.js
new file mode 100644
index 00000000000..8a538b807ac
--- /dev/null
+++ b/nashorn/test/script/basic/es6/let-const-switch.js
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8057980: let & const: remaining issues with lexical scoping
+ *
+ * @test
+ * @run
+ * @option --language=es6
+ */
+
+function tryEval(s) {
+    try {
+        eval(s);
+    } catch (e) {
+        print(String(e).replace(/\\/g, "/"));
+    }
+}
+
+tryEval('var x = 0; switch (x) { case 0: { let   x = 1; print(x); } case 1: { let   x = 2; print(x); }} print(x);');
+tryEval('var x = 0; switch (x) { case 0: { const x = 1; print(x); } case 1: { const x = 2; print(x); }} print(x);');
+
+// TODO: the following should not throw
+tryEval('switch (x) { case 0: let x = 1; }');
+tryEval('switch (x) { case 0: const x = 1; }');
diff --git a/nashorn/test/script/basic/es6/let-const-switch.js.EXPECTED b/nashorn/test/script/basic/es6/let-const-switch.js.EXPECTED
new file mode 100644
index 00000000000..90309bfe1af
--- /dev/null
+++ b/nashorn/test/script/basic/es6/let-const-switch.js.EXPECTED
@@ -0,0 +1,12 @@
+1
+2
+0
+1
+2
+0
+SyntaxError: test/script/basic/es6/let-const-switch.js#34:8<eval>:1:25 Unsupported let declaration in unprotected switch statement
+switch (x) { case 0: let x = 1; }
+                         ^
+SyntaxError: test/script/basic/es6/let-const-switch.js#34:8<eval>:1:27 Unsupported const declaration in unprotected switch statement
+switch (x) { case 0: const x = 1; }
+                           ^
diff --git a/nashorn/test/script/basic/es6/let-load.js b/nashorn/test/script/basic/es6/let-load.js
index 5766754359f..ff8f4e1ca54 100644
--- a/nashorn/test/script/basic/es6/let-load.js
+++ b/nashorn/test/script/basic/es6/let-load.js
@@ -40,17 +40,8 @@ load(__DIR__ + "let-load-lib.js");
 }
 
 print("imported var: " + a);
-try {
-    print("imported let: " + b);
-} catch (e) {
-    print(e);
-}
-
-try {
-    print("imported const: " + c);
-} catch (e) {
-    print(e);
-}
+print("imported let: " + b);
+print("imported const: " + c);
 
 top();
 
@@ -60,4 +51,10 @@ try {
     print(e);
 }
 
+try {
+    c = "foo";
+} catch (e) {
+    print(e);
+}
+
 
diff --git a/nashorn/test/script/basic/es6/let-load.js.EXPECTED b/nashorn/test/script/basic/es6/let-load.js.EXPECTED
index f92f84c1982..a0b2e094610 100644
--- a/nashorn/test/script/basic/es6/let-load.js.EXPECTED
+++ b/nashorn/test/script/basic/es6/let-load.js.EXPECTED
@@ -6,3 +6,4 @@ imported let: 2
 imported const: 3
 top level function
 ReferenceError: "block" is not defined
+TypeError: Assignment to constant "c"
diff --git a/nashorn/test/script/basic/es6/let_const_closure.js.EXPECTED b/nashorn/test/script/basic/es6/let_const_closure.js.EXPECTED
index 5a720d86b6e..f49ca4b9974 100644
--- a/nashorn/test/script/basic/es6/let_const_closure.js.EXPECTED
+++ b/nashorn/test/script/basic/es6/let_const_closure.js.EXPECTED
@@ -5,9 +5,9 @@
 test
 test
 test
-3
-3
-3
+0
+1
+2
 0
 1
 2
diff --git a/nashorn/test/script/basic/es6/lexical-toplevel.js.EXPECTED b/nashorn/test/script/basic/es6/lexical-toplevel.js.EXPECTED
index 804e7506dcf..7580af4fe00 100644
--- a/nashorn/test/script/basic/es6/lexical-toplevel.js.EXPECTED
+++ b/nashorn/test/script/basic/es6/lexical-toplevel.js.EXPECTED
@@ -13,6 +13,7 @@ false
 false
 true
 true
+TypeError: Assignment to constant "CONST"
 VAR
 LETLET
 CONST
@@ -28,3 +29,4 @@ false
 false
 true
 true
+TypeError: Assignment to constant "CONST"

From 6d20d3298ac0a222c5ae43f56a4a5cc0c3f355b3 Mon Sep 17 00:00:00 2001
From: Roland Westrelin <roland@openjdk.org>
Date: Thu, 27 Nov 2014 16:54:49 +0100
Subject: [PATCH 172/299] 8066045: opto/node.hpp:355, assert(i < _max) failed:
 oob: i=1, _max=1

Code in PhaseIterGVN::add_users_to_worklist() from 8054478 makes incorrect assumption about graph shape

Reviewed-by: iveresov
---
 hotspot/src/share/vm/opto/phaseX.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hotspot/src/share/vm/opto/phaseX.cpp b/hotspot/src/share/vm/opto/phaseX.cpp
index 3f5373b7a89..477ab2883e3 100644
--- a/hotspot/src/share/vm/opto/phaseX.cpp
+++ b/hotspot/src/share/vm/opto/phaseX.cpp
@@ -1431,7 +1431,7 @@ void PhaseIterGVN::add_users_to_worklist( Node *n ) {
             Node* castii = in1->raw_out(i);
             if (castii->in(0) != NULL && castii->in(0)->in(0) != NULL && castii->in(0)->in(0)->is_If()) {
               Node* ifnode = castii->in(0)->in(0);
-              if (ifnode->in(1) != NULL && ifnode->in(1)->in(1) == use) {
+              if (ifnode->in(1) != NULL && ifnode->in(1)->is_Bool() && ifnode->in(1)->in(1) == use) {
                 // Reprocess a CastII node that may depend on an
                 // opaque node value when the opaque node is
                 // removed. In case it carries a dependency we can do

From 0ecc753586bd53b292e509a8500ac0d24ace5e15 Mon Sep 17 00:00:00 2001
From: Bengt Rutisson <brutisso@openjdk.org>
Date: Thu, 27 Nov 2014 21:02:13 +0100
Subject: [PATCH 173/299] 8065972: Remove support for ParNew+SerialOld and
 DefNew+CMS

Reviewed-by: mgerdin, stefank
---
 .../cmsCollectorPolicy.cpp                    |  25 +---
 .../concurrentMarkSweepGeneration.cpp         |   7 +-
 .../concurrentMarkSweepGeneration.hpp         |   2 -
 .../parNew/parNewGeneration.hpp               |   1 -
 hotspot/src/share/vm/memory/cardTableRS.cpp   |  22 +--
 hotspot/src/share/vm/memory/cardTableRS.hpp   |   1 -
 .../src/share/vm/memory/collectorPolicy.cpp   |  23 +--
 .../src/share/vm/memory/defNewGeneration.hpp  |   3 -
 .../src/share/vm/memory/genCollectedHeap.cpp  |   9 +-
 .../src/share/vm/memory/genCollectedHeap.hpp  |   4 +-
 hotspot/src/share/vm/memory/genRemSet.hpp     |  11 --
 hotspot/src/share/vm/memory/generation.hpp    |   7 -
 hotspot/src/share/vm/memory/sharedHeap.cpp    |   4 +-
 .../src/share/vm/memory/tenuredGeneration.cpp | 133 +-----------------
 .../src/share/vm/memory/tenuredGeneration.hpp |  33 +----
 hotspot/src/share/vm/oops/oop.inline.hpp      |   8 +-
 hotspot/src/share/vm/runtime/arguments.cpp    |  59 ++++----
 hotspot/src/share/vm/runtime/arguments.hpp    |   4 +-
 .../test/compiler/8010927/Test8010927.java    |   2 +-
 hotspot/test/gc/TestSystemGC.java             |   2 -
 .../gc/startup_warnings/TestDefNewCMS.java    |  12 +-
 .../gc/startup_warnings/TestNoParNew.java     |  46 ++++++
 .../gc/startup_warnings/TestParNewCMS.java    |   8 +-
 .../startup_warnings/TestParNewSerialOld.java |  10 +-
 24 files changed, 109 insertions(+), 327 deletions(-)
 create mode 100644 hotspot/test/gc/startup_warnings/TestNoParNew.java

diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp
index 9bd48077b87..0bc3a84dba4 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/cmsCollectorPolicy.cpp
@@ -52,21 +52,9 @@ void ConcurrentMarkSweepPolicy::initialize_alignments() {
 }
 
 void ConcurrentMarkSweepPolicy::initialize_generations() {
-  _generations = NEW_C_HEAP_ARRAY3(GenerationSpecPtr, number_of_generations(), mtGC,
-    CURRENT_PC, AllocFailStrategy::RETURN_NULL);
-  if (_generations == NULL)
-    vm_exit_during_initialization("Unable to allocate gen spec");
-
-  Generation::Name yg_name =
-    UseParNewGC ? Generation::ParNew : Generation::DefNew;
-  _generations[0] = new GenerationSpec(yg_name, _initial_young_size,
-                                       _max_young_size);
-  _generations[1] = new GenerationSpec(Generation::ConcurrentMarkSweep,
-                                       _initial_old_size, _max_old_size);
-
-  if (_generations[0] == NULL || _generations[1] == NULL) {
-    vm_exit_during_initialization("Unable to allocate gen spec");
-  }
+  _generations = NEW_C_HEAP_ARRAY(GenerationSpecPtr, number_of_generations(), mtGC);
+  _generations[0] = new GenerationSpec(Generation::ParNew, _initial_young_size, _max_young_size);
+  _generations[1] = new GenerationSpec(Generation::ConcurrentMarkSweep, _initial_old_size, _max_old_size);
 }
 
 void ConcurrentMarkSweepPolicy::initialize_size_policy(size_t init_eden_size,
@@ -82,10 +70,5 @@ void ConcurrentMarkSweepPolicy::initialize_size_policy(size_t init_eden_size,
 
 void ConcurrentMarkSweepPolicy::initialize_gc_policy_counters() {
   // initialize the policy counters - 2 collectors, 3 generations
-  if (UseParNewGC) {
-    _gc_policy_counters = new GCPolicyCounters("ParNew:CMS", 2, 3);
-  }
-  else {
-    _gc_policy_counters = new GCPolicyCounters("Copy:CMS", 2, 3);
-  }
+  _gc_policy_counters = new GCPolicyCounters("ParNew:CMS", 2, 3);
 }
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
index 94cb93540f1..e0d2d0fe62b 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
@@ -4094,10 +4094,7 @@ size_t CMSCollector::preclean_work(bool clean_refs, bool clean_survivor) {
   }
 
   if (clean_survivor) {  // preclean the active survivor space(s)
-    assert(_young_gen->kind() == Generation::DefNew ||
-           _young_gen->kind() == Generation::ParNew,
-         "incorrect type for cast");
-    DefNewGeneration* dng = (DefNewGeneration*)_young_gen;
+    DefNewGeneration* dng = _young_gen->as_DefNewGeneration();
     PushAndMarkClosure pam_cl(this, _span, ref_processor(),
                              &_markBitMap, &_modUnionTable,
                              &_markStack, true /* precleaning phase */);
@@ -5168,7 +5165,7 @@ void
 CMSCollector::
 initialize_sequential_subtasks_for_young_gen_rescan(int n_threads) {
   assert(n_threads > 0, "Unexpected n_threads argument");
-  DefNewGeneration* dng = (DefNewGeneration*)_young_gen;
+  DefNewGeneration* dng = _young_gen->as_DefNewGeneration();
 
   // Eden space
   if (!dng->eden()->is_empty()) {
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
index 58ee68d7b27..7e49507acbf 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
@@ -1256,8 +1256,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
   virtual const char* short_name() const { return "CMS"; }
   void        print() const;
   void printOccupancy(const char* s);
-  bool must_be_youngest() const { return false; }
-  bool must_be_oldest()   const { return true; }
 
   // Resize the generation after a compacting GC.  The
   // generation can be treated as a contiguous space
diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp
index 7685353ed1e..324614eeb39 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp
@@ -372,7 +372,6 @@ class ParNewGeneration: public DefNewGeneration {
 
   // override
   virtual bool refs_discovery_is_mt()     const {
-    assert(UseParNewGC, "ParNewGeneration only when UseParNewGC");
     return ParallelGCThreads > 1;
   }
 
diff --git a/hotspot/src/share/vm/memory/cardTableRS.cpp b/hotspot/src/share/vm/memory/cardTableRS.cpp
index c3b8968cb07..97b244518b1 100644
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp
@@ -283,14 +283,14 @@ void CardTableRS::younger_refs_in_space_iterate(Space* sp,
   // Convert the assertion check to a warning if we are running
   // CMS+ParNew until related bug is fixed.
   MemRegion ur    = sp->used_region();
-  assert(ur.contains(urasm) || (UseConcMarkSweepGC && UseParNewGC),
+  assert(ur.contains(urasm) || (UseConcMarkSweepGC),
          err_msg("Did you forget to call save_marks()? "
                  "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
                  "[" PTR_FORMAT ", " PTR_FORMAT ")",
                  p2i(urasm.start()), p2i(urasm.end()), p2i(ur.start()), p2i(ur.end())));
   // In the case of CMS+ParNew, issue a warning
   if (!ur.contains(urasm)) {
-    assert(UseConcMarkSweepGC && UseParNewGC, "Tautology: see assert above");
+    assert(UseConcMarkSweepGC, "Tautology: see assert above");
     warning("CMS+ParNew: Did you forget to call save_marks()? "
             "[" PTR_FORMAT ", " PTR_FORMAT ") is not contained in "
             "[" PTR_FORMAT ", " PTR_FORMAT ")",
@@ -609,21 +609,3 @@ void CardTableRS::verify() {
     _ct_bs->verify();
     }
   }
-
-
-void CardTableRS::verify_aligned_region_empty(MemRegion mr) {
-  if (!mr.is_empty()) {
-    jbyte* cur_entry = byte_for(mr.start());
-    jbyte* limit = byte_after(mr.last());
-    // The region mr may not start on a card boundary so
-    // the first card may reflect a write to the space
-    // just prior to mr.
-    if (!is_aligned(mr.start())) {
-      cur_entry++;
-    }
-    for (;cur_entry < limit; cur_entry++) {
-      guarantee(*cur_entry == CardTableModRefBS::clean_card,
-                "Unexpected dirty card found");
-    }
-  }
-}
diff --git a/hotspot/src/share/vm/memory/cardTableRS.hpp b/hotspot/src/share/vm/memory/cardTableRS.hpp
index a9bfef87b76..cf3288a100d 100644
--- a/hotspot/src/share/vm/memory/cardTableRS.hpp
+++ b/hotspot/src/share/vm/memory/cardTableRS.hpp
@@ -138,7 +138,6 @@ public:
   }
 
   void verify();
-  void verify_aligned_region_empty(MemRegion mr);
 
   void clear(MemRegion mr) { _ct_bs->clear(mr); }
   void clear_into_younger(Generation* old_gen);
diff --git a/hotspot/src/share/vm/memory/collectorPolicy.cpp b/hotspot/src/share/vm/memory/collectorPolicy.cpp
index 86c7a979d93..917c8ffb899 100644
--- a/hotspot/src/share/vm/memory/collectorPolicy.cpp
+++ b/hotspot/src/share/vm/memory/collectorPolicy.cpp
@@ -908,31 +908,14 @@ void MarkSweepPolicy::initialize_alignments() {
 }
 
 void MarkSweepPolicy::initialize_generations() {
-  _generations = NEW_C_HEAP_ARRAY3(GenerationSpecPtr, number_of_generations(), mtGC, CURRENT_PC,
-    AllocFailStrategy::RETURN_NULL);
-  if (_generations == NULL) {
-    vm_exit_during_initialization("Unable to allocate gen spec");
-  }
-
-  if (UseParNewGC) {
-    _generations[0] = new GenerationSpec(Generation::ParNew, _initial_young_size, _max_young_size);
-  } else {
-    _generations[0] = new GenerationSpec(Generation::DefNew, _initial_young_size, _max_young_size);
-  }
+  _generations = NEW_C_HEAP_ARRAY(GenerationSpecPtr, number_of_generations(), mtGC);
+  _generations[0] = new GenerationSpec(Generation::DefNew, _initial_young_size, _max_young_size);
   _generations[1] = new GenerationSpec(Generation::MarkSweepCompact, _initial_old_size, _max_old_size);
-
-  if (_generations[0] == NULL || _generations[1] == NULL) {
-    vm_exit_during_initialization("Unable to allocate gen spec");
-  }
 }
 
 void MarkSweepPolicy::initialize_gc_policy_counters() {
   // Initialize the policy counters - 2 collectors, 3 generations.
-  if (UseParNewGC) {
-    _gc_policy_counters = new GCPolicyCounters("ParNew:MSC", 2, 3);
-  } else {
-    _gc_policy_counters = new GCPolicyCounters("Copy:MSC", 2, 3);
-  }
+  _gc_policy_counters = new GCPolicyCounters("Copy:MSC", 2, 3);
 }
 
 /////////////// Unit tests ///////////////
diff --git a/hotspot/src/share/vm/memory/defNewGeneration.hpp b/hotspot/src/share/vm/memory/defNewGeneration.hpp
index c6e8c56f4b1..48876a82c17 100644
--- a/hotspot/src/share/vm/memory/defNewGeneration.hpp
+++ b/hotspot/src/share/vm/memory/defNewGeneration.hpp
@@ -340,9 +340,6 @@ protected:
   virtual const char* name() const;
   virtual const char* short_name() const { return "DefNew"; }
 
-  bool must_be_youngest() const { return true; }
-  bool must_be_oldest() const { return false; }
-
   // PrintHeapAtGC support.
   void print_on(outputStream* st) const;
 
diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
index 1ff0b9266ea..dd1f512bcc7 100644
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
@@ -182,10 +182,7 @@ void GenCollectedHeap::post_initialize() {
   SharedHeap::post_initialize();
   GenCollectorPolicy *policy = (GenCollectorPolicy *)collector_policy();
   guarantee(policy->is_generation_policy(), "Illegal policy type");
-  DefNewGeneration* def_new_gen = (DefNewGeneration*) get_gen(0);
-  assert(def_new_gen->kind() == Generation::DefNew ||
-         def_new_gen->kind() == Generation::ParNew,
-         "Wrong generation kind");
+  DefNewGeneration* def_new_gen = get_gen(0)->as_DefNewGeneration();
 
   Generation* old_gen = get_gen(1);
   assert(old_gen->kind() == Generation::ConcurrentMarkSweep ||
@@ -1117,10 +1114,8 @@ void GenCollectedHeap::gc_threads_do(ThreadClosure* tc) const {
 
 void GenCollectedHeap::print_gc_threads_on(outputStream* st) const {
 #if INCLUDE_ALL_GCS
-  if (UseParNewGC) {
-    workers()->print_worker_threads_on(st);
-  }
   if (UseConcMarkSweepGC) {
+    workers()->print_worker_threads_on(st);
     ConcurrentMarkSweepThread::print_all_on(st);
   }
 #endif // INCLUDE_ALL_GCS
diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.hpp b/hotspot/src/share/vm/memory/genCollectedHeap.hpp
index e4615b3b76b..db4133560fc 100644
--- a/hotspot/src/share/vm/memory/genCollectedHeap.hpp
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.hpp
@@ -262,12 +262,12 @@ public:
 
   // We don't need barriers for stores to objects in the
   // young gen and, a fortiori, for initializing stores to
-  // objects therein. This applies to {DefNew,ParNew}+{Tenured,CMS}
+  // objects therein. This applies to DefNew+Tenured and ParNew+CMS
   // only and may need to be re-examined in case other
   // kinds of collectors are implemented in the future.
   virtual bool can_elide_initializing_store_barrier(oop new_obj) {
     // We wanted to assert that:-
-    // assert(UseParNewGC || UseSerialGC || UseConcMarkSweepGC,
+    // assert(UseSerialGC || UseConcMarkSweepGC,
     //       "Check can_elide_initializing_store_barrier() for this collector");
     // but unfortunately the flag UseSerialGC need not necessarily always
     // be set when DefNew+Tenured are being used.
diff --git a/hotspot/src/share/vm/memory/genRemSet.hpp b/hotspot/src/share/vm/memory/genRemSet.hpp
index d0a79a3371e..64a63230b80 100644
--- a/hotspot/src/share/vm/memory/genRemSet.hpp
+++ b/hotspot/src/share/vm/memory/genRemSet.hpp
@@ -105,17 +105,6 @@ public:
 
   virtual void verify() = 0;
 
-  // Verify that the remembered set has no entries for
-  // the heap interval denoted by mr.  If there are any
-  // alignment constraints on the remembered set, only the
-  // part of the region that is aligned is checked.
-  //
-  //   alignment boundaries
-  //   +--------+-------+--------+-------+
-  //         [ region mr              )
-  //            [ part checked   )
-  virtual void verify_aligned_region_empty(MemRegion mr) = 0;
-
   // If appropriate, print some information about the remset on "tty".
   virtual void print() {}
 
diff --git a/hotspot/src/share/vm/memory/generation.hpp b/hotspot/src/share/vm/memory/generation.hpp
index e472d9b8a46..5cf311f4f26 100644
--- a/hotspot/src/share/vm/memory/generation.hpp
+++ b/hotspot/src/share/vm/memory/generation.hpp
@@ -517,13 +517,6 @@ class Generation: public CHeapObj<mtGC> {
 
   int level() const { return _level; }
 
-  // Attributes
-
-  // True iff the given generation may only be the youngest generation.
-  virtual bool must_be_youngest() const = 0;
-  // True iff the given generation may only be the oldest generation.
-  virtual bool must_be_oldest() const = 0;
-
   // Reference Processing accessor
   ReferenceProcessor* const ref_processor() { return _ref_processor; }
 
diff --git a/hotspot/src/share/vm/memory/sharedHeap.cpp b/hotspot/src/share/vm/memory/sharedHeap.cpp
index 7d7648e3716..3cf4a316c92 100644
--- a/hotspot/src/share/vm/memory/sharedHeap.cpp
+++ b/hotspot/src/share/vm/memory/sharedHeap.cpp
@@ -68,9 +68,7 @@ SharedHeap::SharedHeap(CollectorPolicy* policy_) :
     vm_exit_during_initialization("Failed necessary allocation.");
   }
   _sh = this;  // ch is static, should be set only once.
-  if (UseParNewGC ||
-      UseG1GC ||
-      (UseConcMarkSweepGC && (CMSParallelInitialMarkEnabled || CMSParallelRemarkEnabled) && use_parallel_gc_threads())) {
+  if (UseConcMarkSweepGC || UseG1GC) {
     _workers = new FlexibleWorkGang("Parallel GC Threads", ParallelGCThreads,
                             /* are_GC_task_threads */true,
                             /* are_ConcurrentGC_threads */false);
diff --git a/hotspot/src/share/vm/memory/tenuredGeneration.cpp b/hotspot/src/share/vm/memory/tenuredGeneration.cpp
index c159d8092f2..9e602a981b5 100644
--- a/hotspot/src/share/vm/memory/tenuredGeneration.cpp
+++ b/hotspot/src/share/vm/memory/tenuredGeneration.cpp
@@ -64,46 +64,13 @@ TenuredGeneration::TenuredGeneration(ReservedSpace rs,
   _space_counters = new CSpaceCounters(gen_name, 0,
                                        _virtual_space.reserved_size(),
                                        _the_space, _gen_counters);
-#if INCLUDE_ALL_GCS
-  if (UseParNewGC) {
-    typedef ParGCAllocBufferWithBOT* ParGCAllocBufferWithBOTPtr;
-    _alloc_buffers = NEW_C_HEAP_ARRAY(ParGCAllocBufferWithBOTPtr,
-                                      ParallelGCThreads, mtGC);
-    if (_alloc_buffers == NULL)
-      vm_exit_during_initialization("Could not allocate alloc_buffers");
-    for (uint i = 0; i < ParallelGCThreads; i++) {
-      _alloc_buffers[i] =
-        new ParGCAllocBufferWithBOT(OldPLABSize, _bts);
-      if (_alloc_buffers[i] == NULL)
-        vm_exit_during_initialization("Could not allocate alloc_buffers");
-    }
-  } else {
-    _alloc_buffers = NULL;
-  }
-#endif // INCLUDE_ALL_GCS
-}
-
-
-const char* TenuredGeneration::name() const {
-  return "tenured generation";
 }
 
 void TenuredGeneration::gc_prologue(bool full) {
   _capacity_at_prologue = capacity();
   _used_at_prologue = used();
-  if (VerifyBeforeGC) {
-    verify_alloc_buffers_clean();
-  }
 }
 
-void TenuredGeneration::gc_epilogue(bool full) {
-  if (VerifyAfterGC) {
-    verify_alloc_buffers_clean();
-  }
-  OneContigSpaceCardGeneration::gc_epilogue(full);
-}
-
-
 bool TenuredGeneration::should_collect(bool  full,
                                        size_t size,
                                        bool   is_tlab) {
@@ -149,15 +116,6 @@ bool TenuredGeneration::should_collect(bool  full,
   return result;
 }
 
-void TenuredGeneration::collect(bool   full,
-                                bool   clear_all_soft_refs,
-                                size_t size,
-                                bool   is_tlab) {
-  retire_alloc_buffers_before_full_gc();
-  OneContigSpaceCardGeneration::collect(full, clear_all_soft_refs,
-                                        size, is_tlab);
-}
-
 void TenuredGeneration::compute_new_size() {
   assert_locked_or_safepoint(Heap_lock);
 
@@ -171,6 +129,7 @@ void TenuredGeneration::compute_new_size() {
          err_msg("used: " SIZE_FORMAT " used_after_gc: " SIZE_FORMAT
          " capacity: " SIZE_FORMAT, used(), used_after_gc, capacity()));
 }
+
 void TenuredGeneration::update_gc_stats(int current_level,
                                         bool full) {
   // If the next lower level(s) has been collected, gather any statistics
@@ -198,96 +157,6 @@ void TenuredGeneration::update_counters() {
   }
 }
 
-
-#if INCLUDE_ALL_GCS
-oop TenuredGeneration::par_promote(int thread_num,
-                                   oop old, markOop m, size_t word_sz) {
-
-  ParGCAllocBufferWithBOT* buf = _alloc_buffers[thread_num];
-  HeapWord* obj_ptr = buf->allocate(word_sz);
-  bool is_lab = true;
-  if (obj_ptr == NULL) {
-#ifndef PRODUCT
-    if (Universe::heap()->promotion_should_fail()) {
-      return NULL;
-    }
-#endif  // #ifndef PRODUCT
-
-    // Slow path:
-    if (word_sz * 100 < ParallelGCBufferWastePct * buf->word_sz()) {
-      // Is small enough; abandon this buffer and start a new one.
-      size_t buf_size = buf->word_sz();
-      HeapWord* buf_space =
-        TenuredGeneration::par_allocate(buf_size, false);
-      if (buf_space == NULL) {
-        buf_space = expand_and_allocate(buf_size, false, true /* parallel*/);
-      }
-      if (buf_space != NULL) {
-        buf->retire(false, false);
-        buf->set_buf(buf_space);
-        obj_ptr = buf->allocate(word_sz);
-        assert(obj_ptr != NULL, "Buffer was definitely big enough...");
-      }
-    };
-    // Otherwise, buffer allocation failed; try allocating object
-    // individually.
-    if (obj_ptr == NULL) {
-      obj_ptr = TenuredGeneration::par_allocate(word_sz, false);
-      if (obj_ptr == NULL) {
-        obj_ptr = expand_and_allocate(word_sz, false, true /* parallel */);
-      }
-    }
-    if (obj_ptr == NULL) return NULL;
-  }
-  assert(obj_ptr != NULL, "program logic");
-  Copy::aligned_disjoint_words((HeapWord*)old, obj_ptr, word_sz);
-  oop obj = oop(obj_ptr);
-  // Restore the mark word copied above.
-  obj->set_mark(m);
-  return obj;
-}
-
-void TenuredGeneration::par_promote_alloc_undo(int thread_num,
-                                               HeapWord* obj,
-                                               size_t word_sz) {
-  ParGCAllocBufferWithBOT* buf = _alloc_buffers[thread_num];
-  if (buf->contains(obj)) {
-    guarantee(buf->contains(obj + word_sz - 1),
-              "should contain whole object");
-    buf->undo_allocation(obj, word_sz);
-  } else {
-    CollectedHeap::fill_with_object(obj, word_sz);
-  }
-}
-
-void TenuredGeneration::par_promote_alloc_done(int thread_num) {
-  ParGCAllocBufferWithBOT* buf = _alloc_buffers[thread_num];
-  buf->retire(true, ParallelGCRetainPLAB);
-}
-
-void TenuredGeneration::retire_alloc_buffers_before_full_gc() {
-  if (UseParNewGC) {
-    for (uint i = 0; i < ParallelGCThreads; i++) {
-      _alloc_buffers[i]->retire(true /*end_of_gc*/, false /*retain*/);
-    }
-  }
-}
-
-// Verify that any retained parallel allocation buffers do not
-// intersect with dirty cards.
-void TenuredGeneration::verify_alloc_buffers_clean() {
-  if (UseParNewGC) {
-    for (uint i = 0; i < ParallelGCThreads; i++) {
-      _rs->verify_aligned_region_empty(_alloc_buffers[i]->range());
-    }
-  }
-}
-
-#else  // INCLUDE_ALL_GCS
-void TenuredGeneration::retire_alloc_buffers_before_full_gc() {}
-void TenuredGeneration::verify_alloc_buffers_clean() {}
-#endif // INCLUDE_ALL_GCS
-
 bool TenuredGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const {
   size_t available = max_contiguous_available();
   size_t av_promo  = (size_t)gc_stats()->avg_promoted()->padded_average();
diff --git a/hotspot/src/share/vm/memory/tenuredGeneration.hpp b/hotspot/src/share/vm/memory/tenuredGeneration.hpp
index f9d621db54e..c82b3ab5cf0 100644
--- a/hotspot/src/share/vm/memory/tenuredGeneration.hpp
+++ b/hotspot/src/share/vm/memory/tenuredGeneration.hpp
@@ -33,22 +33,9 @@
 
 // TenuredGeneration models the heap containing old (promoted/tenured) objects.
 
-class ParGCAllocBufferWithBOT;
-
 class TenuredGeneration: public OneContigSpaceCardGeneration {
   friend class VMStructs;
  protected:
-
-#if INCLUDE_ALL_GCS
-  // To support parallel promotion: an array of parallel allocation
-  // buffers, one per thread, initially NULL.
-  ParGCAllocBufferWithBOT** _alloc_buffers;
-#endif // INCLUDE_ALL_GCS
-
-  // Retire all alloc buffers before a full GC, so that they will be
-  // re-allocated at the start of the next young GC.
-  void retire_alloc_buffers_before_full_gc();
-
   GenerationCounters*   _gen_counters;
   CSpaceCounters*       _space_counters;
 
@@ -59,10 +46,8 @@ class TenuredGeneration: public OneContigSpaceCardGeneration {
   Generation::Name kind() { return Generation::MarkSweepCompact; }
 
   // Printing
-  const char* name() const;
+  const char* name() const { return "tenured generation"; }
   const char* short_name() const { return "Tenured"; }
-  bool must_be_youngest() const { return false; }
-  bool must_be_oldest() const { return true; }
 
   // Does a "full" (forced) collection invoked on this generation collect
   // all younger generations as well? Note that this is a
@@ -73,26 +58,12 @@ class TenuredGeneration: public OneContigSpaceCardGeneration {
   }
 
   virtual void gc_prologue(bool full);
-  virtual void gc_epilogue(bool full);
   bool should_collect(bool   full,
                       size_t word_size,
                       bool   is_tlab);
 
-  virtual void collect(bool full,
-                       bool clear_all_soft_refs,
-                       size_t size,
-                       bool is_tlab);
   virtual void compute_new_size();
 
-#if INCLUDE_ALL_GCS
-  // Overrides.
-  virtual oop par_promote(int thread_num,
-                          oop obj, markOop m, size_t word_sz);
-  virtual void par_promote_alloc_undo(int thread_num,
-                                      HeapWord* obj, size_t word_sz);
-  virtual void par_promote_alloc_done(int thread_num);
-#endif // INCLUDE_ALL_GCS
-
   // Performance Counter support
   void update_counters();
 
@@ -101,8 +72,6 @@ class TenuredGeneration: public OneContigSpaceCardGeneration {
   virtual void update_gc_stats(int level, bool full);
 
   virtual bool promotion_attempt_is_safe(size_t max_promoted_in_bytes) const;
-
-  void verify_alloc_buffers_clean();
 };
 
 #endif // SHARE_VM_MEMORY_TENUREDGENERATION_HPP
diff --git a/hotspot/src/share/vm/oops/oop.inline.hpp b/hotspot/src/share/vm/oops/oop.inline.hpp
index 08839267e01..4b3c901f63d 100644
--- a/hotspot/src/share/vm/oops/oop.inline.hpp
+++ b/hotspot/src/share/vm/oops/oop.inline.hpp
@@ -441,12 +441,12 @@ inline int oopDesc::size_given_klass(Klass* klass)  {
       s = (int)((size_t)round_to(size_in_bytes, MinObjAlignmentInBytes) /
         HeapWordSize);
 
-      // UseParNewGC, UseParallelGC and UseG1GC can change the length field
+      // ParNew (used by CMS), UseParallelGC and UseG1GC can change the length field
       // of an "old copy" of an object array in the young gen so it indicates
       // the grey portion of an already copied array. This will cause the first
       // disjunct below to fail if the two comparands are computed across such
       // a concurrent change.
-      // UseParNewGC also runs with promotion labs (which look like int
+      // ParNew also runs with promotion labs (which look like int
       // filler arrays) which are subject to changing their declared size
       // when finally retiring a PLAB; this also can cause the first disjunct
       // to fail for another worker thread that is concurrently walking the block
@@ -458,8 +458,8 @@ inline int oopDesc::size_given_klass(Klass* klass)  {
       // technique, we will need to suitably modify the assertion.
       assert((s == klass->oop_size(this)) ||
              (Universe::heap()->is_gc_active() &&
-              ((is_typeArray() && UseParNewGC) ||
-               (is_objArray()  && is_forwarded() && (UseParNewGC || UseParallelGC || UseG1GC)))),
+              ((is_typeArray() && UseConcMarkSweepGC) ||
+               (is_objArray()  && is_forwarded() && (UseConcMarkSweepGC || UseParallelGC || UseG1GC)))),
              "wrong array object size");
     } else {
       // Must be zero, so bite the bullet and take the virtual call.
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index 7b6da5732b5..24ef448c5c7 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -1260,10 +1260,8 @@ static void disable_adaptive_size_policy(const char* collector_name) {
 void Arguments::set_parnew_gc_flags() {
   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC && !UseG1GC,
          "control point invariant");
-  assert(UseParNewGC, "Error");
-
-  // Turn off AdaptiveSizePolicy for parnew until it is complete.
-  disable_adaptive_size_policy("UseParNewGC");
+  assert(UseConcMarkSweepGC, "CMS is expected to be on here");
+  assert(UseParNewGC, "ParNew should always be used with CMS");
 
   if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
     FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
@@ -1304,21 +1302,12 @@ void Arguments::set_parnew_gc_flags() {
 void Arguments::set_cms_and_parnew_gc_flags() {
   assert(!UseSerialGC && !UseParallelOldGC && !UseParallelGC, "Error");
   assert(UseConcMarkSweepGC, "CMS is expected to be on here");
-
-  // If we are using CMS, we prefer to UseParNewGC,
-  // unless explicitly forbidden.
-  if (FLAG_IS_DEFAULT(UseParNewGC)) {
-    FLAG_SET_ERGO(bool, UseParNewGC, true);
-  }
+  assert(UseParNewGC, "ParNew should always be used with CMS");
 
   // Turn off AdaptiveSizePolicy by default for cms until it is complete.
   disable_adaptive_size_policy("UseConcMarkSweepGC");
 
-  // In either case, adjust ParallelGCThreads and/or UseParNewGC
-  // as needed.
-  if (UseParNewGC) {
-    set_parnew_gc_flags();
-  }
+  set_parnew_gc_flags();
 
   size_t max_heap = align_size_down(MaxHeapSize,
                                     CardTableRS::ct_max_alignment_constraint());
@@ -1788,14 +1777,11 @@ void Arguments::set_gc_specific_flags() {
   // Set per-collector flags
   if (UseParallelGC || UseParallelOldGC) {
     set_parallel_gc_flags();
-  } else if (UseConcMarkSweepGC) { // Should be done before ParNew check below
+  } else if (UseConcMarkSweepGC) {
     set_cms_and_parnew_gc_flags();
-  } else if (UseParNewGC) {  // Skipped if CMS is set above
-    set_parnew_gc_flags();
   } else if (UseG1GC) {
     set_g1_gc_flags();
   }
-  check_deprecated_gcs();
   check_deprecated_gc_flags();
   if (AssumeMP && !UseSerialGC) {
     if (FLAG_IS_DEFAULT(ParallelGCThreads) && ParallelGCThreads == 1) {
@@ -2156,17 +2142,11 @@ bool Arguments::verify_MaxHeapFreeRatio(FormatBuffer<80>& err_msg, uintx max_hea
 // Check consistency of GC selection
 bool Arguments::check_gc_consistency_user() {
   check_gclog_consistency();
-  bool status = true;
   // Ensure that the user has not selected conflicting sets
-  // of collectors. [Note: this check is merely a user convenience;
-  // collectors over-ride each other so that only a non-conflicting
-  // set is selected; however what the user gets is not what they
-  // may have expected from the combination they asked for. It's
-  // better to reduce user confusion by not allowing them to
-  // select conflicting combinations.
+  // of collectors.
   uint i = 0;
   if (UseSerialGC)                       i++;
-  if (UseConcMarkSweepGC || UseParNewGC) i++;
+  if (UseConcMarkSweepGC)                i++;
   if (UseParallelGC || UseParallelOldGC) i++;
   if (UseG1GC)                           i++;
   if (i > 1) {
@@ -2174,26 +2154,30 @@ bool Arguments::check_gc_consistency_user() {
                 "Conflicting collector combinations in option list; "
                 "please refer to the release notes for the combinations "
                 "allowed\n");
-    status = false;
+    return false;
   }
-  return status;
-}
 
-void Arguments::check_deprecated_gcs() {
   if (UseConcMarkSweepGC && !UseParNewGC) {
-    warning("Using the DefNew young collector with the CMS collector is deprecated "
-        "and will likely be removed in a future release");
+    jio_fprintf(defaultStream::error_stream(),
+        "It is not possible to combine the DefNew young collector with the CMS collector.\n");
+    return false;
   }
 
   if (UseParNewGC && !UseConcMarkSweepGC) {
     // !UseConcMarkSweepGC means that we are using serial old gc. Unfortunately we don't
     // set up UseSerialGC properly, so that can't be used in the check here.
-    warning("Using the ParNew young collector with the Serial old collector is deprecated "
-        "and will likely be removed in a future release");
+    jio_fprintf(defaultStream::error_stream(),
+        "It is not possible to combine the ParNew young collector with the Serial old collector.\n");
+    return false;
   }
+
+  return true;
 }
 
 void Arguments::check_deprecated_gc_flags() {
+  if (FLAG_IS_CMDLINE(UseParNewGC)) {
+    warning("The UseParNewGC flag is deprecated and will likely be removed in a future release");
+  }
   if (FLAG_IS_CMDLINE(MaxGCMinorPauseMillis)) {
     warning("Using MaxGCMinorPauseMillis as minor pause goal is deprecated"
             "and will likely be removed in future release");
@@ -3556,6 +3540,11 @@ jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_req
     }
   }
 
+  if (UseConcMarkSweepGC && FLAG_IS_DEFAULT(UseParNewGC) && !UseParNewGC) {
+    // CMS can only be used with ParNew
+    FLAG_SET_ERGO(bool, UseParNewGC, true);
+  }
+
   if (!check_vm_args_consistency()) {
     return JNI_ERR;
   }
diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp
index aa62dac52e7..b6709530d00 100644
--- a/hotspot/src/share/vm/runtime/arguments.hpp
+++ b/hotspot/src/share/vm/runtime/arguments.hpp
@@ -472,7 +472,6 @@ class Arguments : AllStatic {
   // Check for consistency in the selection of the garbage collector.
   static bool check_gc_consistency_user();        // Check user-selected gc
   static inline bool check_gc_consistency_ergo(); // Check ergonomic-selected gc
-  static void check_deprecated_gcs();
   static void check_deprecated_gc_flags();
   // Check consistency or otherwise of VM argument settings
   static bool check_vm_args_consistency();
@@ -615,8 +614,7 @@ class Arguments : AllStatic {
 };
 
 bool Arguments::gc_selected() {
-  return UseConcMarkSweepGC || UseG1GC || UseParallelGC || UseParallelOldGC ||
-    UseParNewGC || UseSerialGC;
+  return UseConcMarkSweepGC || UseG1GC || UseParallelGC || UseParallelOldGC || UseSerialGC;
 }
 
 bool Arguments::check_gc_consistency_ergo() {
diff --git a/hotspot/test/compiler/8010927/Test8010927.java b/hotspot/test/compiler/8010927/Test8010927.java
index 3c0f0915d36..6ffbdb522a6 100644
--- a/hotspot/test/compiler/8010927/Test8010927.java
+++ b/hotspot/test/compiler/8010927/Test8010927.java
@@ -29,7 +29,7 @@
  * @build Test8010927
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
  *                              sun.hotspot.WhiteBox$WhiteBoxPermission
- * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. -Xmx64m -XX:NewSize=20971520 -XX:MaxNewSize=32m -XX:-UseTLAB -XX:-UseParNewGC -XX:-UseAdaptiveSizePolicy Test8010927
+ * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+IgnoreUnrecognizedVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. -Xmx64m -XX:NewSize=20971520 -XX:MaxNewSize=32m -XX:-UseTLAB -XX:-UseAdaptiveSizePolicy Test8010927
  */
 
 import sun.hotspot.WhiteBox;
diff --git a/hotspot/test/gc/TestSystemGC.java b/hotspot/test/gc/TestSystemGC.java
index d0346595137..275ee24c304 100644
--- a/hotspot/test/gc/TestSystemGC.java
+++ b/hotspot/test/gc/TestSystemGC.java
@@ -28,12 +28,10 @@
  * @summary Runs System.gc() with different flags.
  * @run main/othervm TestSystemGC
  * @run main/othervm -XX:+UseSerialGC TestSystemGC
- * @run main/othervm -XX:+UseParNewGC TestSystemGC
  * @run main/othervm -XX:+UseParallelGC TestSystemGC
  * @run main/othervm -XX:+UseParallelGC -XX:-UseParallelOldGC TestSystemGC
  * @run main/othervm -XX:+UseConcMarkSweepGC TestSystemGC
  * @run main/othervm -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent TestSystemGC
- * @run main/othervm -XX:+UseConcMarkSweepGC -XX:+ExplicitGCInvokesConcurrent -XX:-UseParNewGC TestSystemGC
  * @run main/othervm -XX:+UseG1GC TestSystemGC
  * @run main/othervm -XX:+UseG1GC -XX:+ExplicitGCInvokesConcurrent TestSystemGC
  * @run main/othervm -XX:+UseLargePages TestSystemGC
diff --git a/hotspot/test/gc/startup_warnings/TestDefNewCMS.java b/hotspot/test/gc/startup_warnings/TestDefNewCMS.java
index 35360b60c0f..c17b9444631 100644
--- a/hotspot/test/gc/startup_warnings/TestDefNewCMS.java
+++ b/hotspot/test/gc/startup_warnings/TestDefNewCMS.java
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -24,8 +24,8 @@
 /*
 * @test TestDefNewCMS
 * @key gc
-* @bug 8006398
-* @summary Test that the deprecated DefNew+CMS combination print a warning message
+* @bug 8065972
+* @summary Test that the unsupported DefNew+CMS combination does not start
 * @library /testlibrary
 */
 
@@ -37,9 +37,9 @@ public class TestDefNewCMS {
   public static void main(String args[]) throws Exception {
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:-UseParNewGC", "-XX:+UseConcMarkSweepGC", "-version");
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release");
-    output.shouldNotContain("error");
-    output.shouldHaveExitValue(0);
+    output.shouldContain("It is not possible to combine the DefNew young collector with the CMS collector.");
+    output.shouldContain("Error");
+    output.shouldHaveExitValue(1);
   }
 
 }
diff --git a/hotspot/test/gc/startup_warnings/TestNoParNew.java b/hotspot/test/gc/startup_warnings/TestNoParNew.java
new file mode 100644
index 00000000000..bc9d8bdb4b9
--- /dev/null
+++ b/hotspot/test/gc/startup_warnings/TestNoParNew.java
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2014, 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 TestNoParNew
+* @key gc
+* @bug 8065972
+* @summary Test that specifying -XX:-UseParNewGC on the command line logs a warning message
+* @library /testlibrary
+*/
+
+import com.oracle.java.testlibrary.OutputAnalyzer;
+import com.oracle.java.testlibrary.ProcessTools;
+
+
+public class TestNoParNew {
+
+  public static void main(String args[]) throws Exception {
+    ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:-UseParNewGC", "-version");
+    OutputAnalyzer output = new OutputAnalyzer(pb.start());
+    output.shouldContain("warning: The UseParNewGC flag is deprecated and will likely be removed in a future release");
+    output.shouldNotContain("error");
+    output.shouldHaveExitValue(0);
+  }
+
+}
diff --git a/hotspot/test/gc/startup_warnings/TestParNewCMS.java b/hotspot/test/gc/startup_warnings/TestParNewCMS.java
index 3f8bfb42d2f..f78b75f631e 100644
--- a/hotspot/test/gc/startup_warnings/TestParNewCMS.java
+++ b/hotspot/test/gc/startup_warnings/TestParNewCMS.java
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -24,8 +24,8 @@
 /*
 * @test TestParNewCMS
 * @key gc
-* @bug 8006398
-* @summary Test that the combination ParNew+CMS does not print a warning message
+* @bug 8065972
+* @summary Test that specifying -XX:+UseParNewGC on the command line logs a warning message
 * @library /testlibrary
 */
 
@@ -38,7 +38,7 @@ public class TestParNewCMS {
   public static void main(String args[]) throws Exception {
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParNewGC", "-XX:+UseConcMarkSweepGC", "-version");
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldNotContain("deprecated");
+    output.shouldContain("warning: The UseParNewGC flag is deprecated and will likely be removed in a future release");
     output.shouldNotContain("error");
     output.shouldHaveExitValue(0);
   }
diff --git a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java b/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java
index cbcea77e66f..fa607921c4d 100644
--- a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java
+++ b/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+* Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved.
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 /*
 * @test TestParNewSerialOld
 * @key gc
-* @bug 8006398
+* @bug 8065972
 * @summary Test that the deprecated ParNew+SerialOld combination print a warning message
 * @library /testlibrary
 */
@@ -38,9 +38,9 @@ public class TestParNewSerialOld {
   public static void main(String args[]) throws Exception {
     ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:+UseParNewGC", "-version");
     OutputAnalyzer output = new OutputAnalyzer(pb.start());
-    output.shouldContain("warning: Using the ParNew young collector with the Serial old collector is deprecated and will likely be removed in a future release");
-    output.shouldNotContain("error");
-    output.shouldHaveExitValue(0);
+    output.shouldContain("It is not possible to combine the ParNew young collector with the Serial old collector.");
+    output.shouldContain("Error");
+    output.shouldHaveExitValue(1);
   }
 
 }

From d8635f58cdd1c1213d28b5fbf3e50b25b804fa15 Mon Sep 17 00:00:00 2001
From: Bengt Rutisson <brutisso@openjdk.org>
Date: Fri, 28 Nov 2014 08:20:52 +0100
Subject: [PATCH 174/299] 8066133: Fix missing reivew changes for JDK-8065972

Reviewed-by: mgerdin, stefank
---
 .../concurrentMarkSweepGeneration.cpp         |   8 -
 .../concurrentMarkSweepGeneration.hpp         |   3 -
 .../parNew/parNewGeneration.cpp               | 135 +----------
 .../parNew/parNewGeneration.hpp               |  21 +-
 .../shared/parGCAllocBuffer.cpp               | 213 ------------------
 .../shared/parGCAllocBuffer.hpp               |  40 ----
 .../src/share/vm/memory/blockOffsetTable.hpp  |   6 -
 .../src/share/vm/memory/cardTableModRefBS.hpp |   5 -
 hotspot/src/share/vm/memory/generation.cpp    |   6 -
 hotspot/src/share/vm/memory/generation.hpp    |   5 -
 .../startup_warnings/TestParNewSerialOld.java |   2 +-
 11 files changed, 4 insertions(+), 440 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
index e0d2d0fe62b..3fbdef64ea0 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
@@ -1201,14 +1201,6 @@ ConcurrentMarkSweepGeneration::par_promote(int thread_num,
   return obj;
 }
 
-void
-ConcurrentMarkSweepGeneration::
-par_promote_alloc_undo(int thread_num,
-                       HeapWord* obj, size_t word_sz) {
-  // CMS does not support promotion undo.
-  ShouldNotReachHere();
-}
-
 void
 ConcurrentMarkSweepGeneration::
 par_promote_alloc_done(int thread_num) {
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
index 7e49507acbf..e54d53d8489 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
@@ -1151,9 +1151,6 @@ class ConcurrentMarkSweepGeneration: public CardGeneration {
   // Overrides for parallel promotion.
   virtual oop par_promote(int thread_num,
                           oop obj, markOop m, size_t word_sz);
-  // This one should not be called for CMS.
-  virtual void par_promote_alloc_undo(int thread_num,
-                                      HeapWord* obj, size_t word_sz);
   virtual void par_promote_alloc_done(int thread_num);
   virtual void par_oop_since_save_marks_iterate_done(int thread_num);
 
diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
index 9f21403440b..b87898fadb6 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
@@ -884,8 +884,6 @@ void EvacuateFollowersClosureGeneral::do_void() {
 
 // A Generation that does parallel young-gen collection.
 
-bool ParNewGeneration::_avoid_promotion_undo = false;
-
 void ParNewGeneration::handle_promotion_failed(GenCollectedHeap* gch, ParScanThreadStateSet& thread_state_set, ParNewTracer& gc_tracer) {
   assert(_promo_failure_scan_stack.is_empty(), "post condition");
   _promo_failure_scan_stack.clear(true); // Clear cached segments.
@@ -934,10 +932,6 @@ void ParNewGeneration::collect(bool   full,
   assert(gch->n_gens() == 2,
          "Par collection currently only works with single older gen.");
   _next_gen = gch->next_gen(this);
-  // Do we have to avoid promotion_undo?
-  if (gch->collector_policy()->is_concurrent_mark_sweep_policy()) {
-    set_avoid_promotion_undo(true);
-  }
 
   // If the next generation is too full to accommodate worst-case promotion
   // from this generation, pass on collection; let the next generation
@@ -1141,7 +1135,7 @@ oop ParNewGeneration::real_forwardee_slow(oop obj) {
 #ifdef ASSERT
 bool ParNewGeneration::is_legal_forward_ptr(oop p) {
   return
-    (_avoid_promotion_undo && p == ClaimedForwardPtr)
+    (p == ClaimedForwardPtr)
     || Universe::heap()->is_in_reserved(p);
 }
 #endif
@@ -1162,7 +1156,7 @@ void ParNewGeneration::preserve_mark_if_necessary(oop obj, markOop m) {
 // thus avoiding the need to undo the copy as in
 // copy_to_survivor_space_avoiding_with_undo.
 
-oop ParNewGeneration::copy_to_survivor_space_avoiding_promotion_undo(
+oop ParNewGeneration::copy_to_survivor_space(
         ParScanThreadState* par_scan_state, oop old, size_t sz, markOop m) {
   // In the sequential version, this assert also says that the object is
   // not forwarded.  That might not be the case here.  It is the case that
@@ -1282,131 +1276,6 @@ oop ParNewGeneration::copy_to_survivor_space_avoiding_promotion_undo(
   return forward_ptr;
 }
 
-
-// Multiple GC threads may try to promote the same object.  If two
-// or more GC threads copy the object, only one wins the race to install
-// the forwarding pointer.  The other threads have to undo their copy.
-
-oop ParNewGeneration::copy_to_survivor_space_with_undo(
-        ParScanThreadState* par_scan_state, oop old, size_t sz, markOop m) {
-
-  // In the sequential version, this assert also says that the object is
-  // not forwarded.  That might not be the case here.  It is the case that
-  // the caller observed it to be not forwarded at some time in the past.
-  assert(is_in_reserved(old), "shouldn't be scavenging this oop");
-
-  // The sequential code read "old->age()" below.  That doesn't work here,
-  // since the age is in the mark word, and that might be overwritten with
-  // a forwarding pointer by a parallel thread.  So we must save the mark
-  // word here, install it in a local oopDesc, and then analyze it.
-  oopDesc dummyOld;
-  dummyOld.set_mark(m);
-  assert(!dummyOld.is_forwarded(),
-         "should not be called with forwarding pointer mark word.");
-
-  bool failed_to_promote = false;
-  oop new_obj = NULL;
-  oop forward_ptr;
-
-  // Try allocating obj in to-space (unless too old)
-  if (dummyOld.age() < tenuring_threshold()) {
-    new_obj = (oop)par_scan_state->alloc_in_to_space(sz);
-    if (new_obj == NULL) {
-      set_survivor_overflow(true);
-    }
-  }
-
-  if (new_obj == NULL) {
-    // Either to-space is full or we decided to promote
-    // try allocating obj tenured
-    new_obj = _next_gen->par_promote(par_scan_state->thread_num(),
-                                       old, m, sz);
-
-    if (new_obj == NULL) {
-      // promotion failed, forward to self
-      forward_ptr = old->forward_to_atomic(old);
-      new_obj = old;
-
-      if (forward_ptr != NULL) {
-        return forward_ptr;   // someone else succeeded
-      }
-
-      _promotion_failed = true;
-      failed_to_promote = true;
-
-      preserve_mark_if_necessary(old, m);
-      par_scan_state->register_promotion_failure(sz);
-    }
-  } else {
-    // Is in to-space; do copying ourselves.
-    Copy::aligned_disjoint_words((HeapWord*)old, (HeapWord*)new_obj, sz);
-    // Restore the mark word copied above.
-    new_obj->set_mark(m);
-    // Increment age if new_obj still in new generation
-    new_obj->incr_age();
-    par_scan_state->age_table()->add(new_obj, sz);
-  }
-  assert(new_obj != NULL, "just checking");
-
-#ifndef PRODUCT
-  // This code must come after the CAS test, or it will print incorrect
-  // information.
-  if (TraceScavenge) {
-    gclog_or_tty->print_cr("{%s %s " PTR_FORMAT " -> " PTR_FORMAT " (%d)}",
-       is_in_reserved(new_obj) ? "copying" : "tenuring",
-       new_obj->klass()->internal_name(), (void *)old, (void *)new_obj, new_obj->size());
-  }
-#endif
-
-  // Now attempt to install the forwarding pointer (atomically).
-  // We have to copy the mark word before overwriting with forwarding
-  // ptr, so we can restore it below in the copy.
-  if (!failed_to_promote) {
-    forward_ptr = old->forward_to_atomic(new_obj);
-  }
-
-  if (forward_ptr == NULL) {
-    oop obj_to_push = new_obj;
-    if (par_scan_state->should_be_partially_scanned(obj_to_push, old)) {
-      // Length field used as index of next element to be scanned.
-      // Real length can be obtained from real_forwardee()
-      arrayOop(old)->set_length(0);
-      obj_to_push = old;
-      assert(obj_to_push->is_forwarded() && obj_to_push->forwardee() != obj_to_push,
-             "push forwarded object");
-    }
-    // Push it on one of the queues of to-be-scanned objects.
-    bool simulate_overflow = false;
-    NOT_PRODUCT(
-      if (ParGCWorkQueueOverflowALot && should_simulate_overflow()) {
-        // simulate a stack overflow
-        simulate_overflow = true;
-      }
-    )
-    if (simulate_overflow || !par_scan_state->work_queue()->push(obj_to_push)) {
-      // Add stats for overflow pushes.
-      push_on_overflow_list(old, par_scan_state);
-      TASKQUEUE_STATS_ONLY(par_scan_state->taskqueue_stats().record_overflow(0));
-    }
-
-    return new_obj;
-  }
-
-  // Oops.  Someone beat us to it.  Undo the allocation.  Where did we
-  // allocate it?
-  if (is_in_reserved(new_obj)) {
-    // Must be in to_space.
-    assert(to()->is_in_reserved(new_obj), "Checking");
-    par_scan_state->undo_alloc_in_to_space((HeapWord*)new_obj, sz);
-  } else {
-    assert(!_avoid_promotion_undo, "Should not be here if avoiding.");
-    _next_gen->par_promote_alloc_undo(par_scan_state->thread_num(),
-                                      (HeapWord*)new_obj, sz);
-  }
-
-  return forward_ptr;
-}
-
 #ifndef PRODUCT
 // It's OK to call this multi-threaded;  the worst thing
 // that can happen is that we'll get a bunch of closely
diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp
index 324614eeb39..13f7b67299e 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp
@@ -329,9 +329,6 @@ class ParNewGeneration: public DefNewGeneration {
   oop _overflow_list;
   NOT_PRODUCT(ssize_t _num_par_pushes;)
 
-  // If true, older generation does not support promotion undo, so avoid.
-  static bool _avoid_promotion_undo;
-
   // This closure is used by the reference processor to filter out
   // references to live referent.
   DefNewGeneration::IsAliveClosure _is_alive_closure;
@@ -349,9 +346,6 @@ class ParNewGeneration: public DefNewGeneration {
 
   bool _survivor_overflow;
 
-  bool avoid_promotion_undo() { return _avoid_promotion_undo; }
-  void set_avoid_promotion_undo(bool v) { _avoid_promotion_undo = v; }
-
   bool survivor_overflow() { return _survivor_overflow; }
   void set_survivor_overflow(bool v) { _survivor_overflow = v; }
 
@@ -385,20 +379,7 @@ class ParNewGeneration: public DefNewGeneration {
   // "obj" is the object to be copied, "m" is a recent value of its mark
   // that must not contain a forwarding pointer (though one might be
   // inserted in "obj"s mark word by a parallel thread).
-  inline oop copy_to_survivor_space(ParScanThreadState* par_scan_state,
-                             oop obj, size_t obj_sz, markOop m) {
-    if (_avoid_promotion_undo) {
-       return copy_to_survivor_space_avoiding_promotion_undo(par_scan_state,
-                                                             obj, obj_sz, m);
-    }
-
-    return copy_to_survivor_space_with_undo(par_scan_state, obj, obj_sz, m);
-  }
-
-  oop copy_to_survivor_space_avoiding_promotion_undo(ParScanThreadState* par_scan_state,
-                             oop obj, size_t obj_sz, markOop m);
-
-  oop copy_to_survivor_space_with_undo(ParScanThreadState* par_scan_state,
+  oop copy_to_survivor_space(ParScanThreadState* par_scan_state,
                              oop obj, size_t obj_sz, markOop m);
 
   // in support of testing overflow code
diff --git a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp
index 01781705f93..0a396050fbe 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.cpp
@@ -142,216 +142,3 @@ void ParGCAllocBuffer::print() {
              "FT"[_retained], _retained_filler.start(), _retained_filler.end());
 }
 #endif // !PRODUCT
-
-const size_t ParGCAllocBufferWithBOT::ChunkSizeInWords =
-MIN2(CardTableModRefBS::par_chunk_heapword_alignment(),
-     ((size_t)Generation::GenGrain)/HeapWordSize);
-const size_t ParGCAllocBufferWithBOT::ChunkSizeInBytes =
-MIN2(CardTableModRefBS::par_chunk_heapword_alignment() * HeapWordSize,
-     (size_t)Generation::GenGrain);
-
-ParGCAllocBufferWithBOT::ParGCAllocBufferWithBOT(size_t word_sz,
-                                                 BlockOffsetSharedArray* bsa) :
-  ParGCAllocBuffer(word_sz),
-  _bsa(bsa),
-  _bt(bsa, MemRegion(_bottom, _hard_end)),
-  _true_end(_hard_end)
-{}
-
-// The buffer comes with its own BOT, with a shared (obviously) underlying
-// BlockOffsetSharedArray. We manipulate this BOT in the normal way
-// as we would for any contiguous space. However, on occasion we
-// need to do some buffer surgery at the extremities before we
-// start using the body of the buffer for allocations. Such surgery
-// (as explained elsewhere) is to prevent allocation on a card that
-// is in the process of being walked concurrently by another GC thread.
-// When such surgery happens at a point that is far removed (to the
-// right of the current allocation point, top), we use the "contig"
-// parameter below to directly manipulate the shared array without
-// modifying the _next_threshold state in the BOT.
-void ParGCAllocBufferWithBOT::fill_region_with_block(MemRegion mr,
-                                                     bool contig) {
-  CollectedHeap::fill_with_object(mr);
-  if (contig) {
-    _bt.alloc_block(mr.start(), mr.end());
-  } else {
-    _bt.BlockOffsetArray::alloc_block(mr.start(), mr.end());
-  }
-}
-
-HeapWord* ParGCAllocBufferWithBOT::allocate_slow(size_t word_sz) {
-  HeapWord* res = NULL;
-  if (_true_end > _hard_end) {
-    assert((HeapWord*)align_size_down(intptr_t(_hard_end),
-                                      ChunkSizeInBytes) == _hard_end,
-           "or else _true_end should be equal to _hard_end");
-    assert(_retained, "or else _true_end should be equal to _hard_end");
-    assert(_retained_filler.end() <= _top, "INVARIANT");
-    CollectedHeap::fill_with_object(_retained_filler);
-    if (_top < _hard_end) {
-      fill_region_with_block(MemRegion(_top, _hard_end), true);
-    }
-    HeapWord* next_hard_end = MIN2(_true_end, _hard_end + ChunkSizeInWords);
-    _retained_filler = MemRegion(_hard_end, FillerHeaderSize);
-    _bt.alloc_block(_retained_filler.start(), _retained_filler.word_size());
-    _top      = _retained_filler.end();
-    _hard_end = next_hard_end;
-    _end      = _hard_end - AlignmentReserve;
-    res       = ParGCAllocBuffer::allocate(word_sz);
-    if (res != NULL) {
-      _bt.alloc_block(res, word_sz);
-    }
-  }
-  return res;
-}
-
-void
-ParGCAllocBufferWithBOT::undo_allocation(HeapWord* obj, size_t word_sz) {
-  ParGCAllocBuffer::undo_allocation(obj, word_sz);
-  // This may back us up beyond the previous threshold, so reset.
-  _bt.set_region(MemRegion(_top, _hard_end));
-  _bt.initialize_threshold();
-}
-
-void ParGCAllocBufferWithBOT::retire(bool end_of_gc, bool retain) {
-  assert(!retain || end_of_gc, "Can only retain at GC end.");
-  if (_retained) {
-    // We're about to make the retained_filler into a block.
-    _bt.BlockOffsetArray::alloc_block(_retained_filler.start(),
-                                      _retained_filler.end());
-  }
-  // Reset _hard_end to _true_end (and update _end)
-  if (retain && _hard_end != NULL) {
-    assert(_hard_end <= _true_end, "Invariant.");
-    _hard_end = _true_end;
-    _end      = MAX2(_top, _hard_end - AlignmentReserve);
-    assert(_end <= _hard_end, "Invariant.");
-  }
-  _true_end = _hard_end;
-  HeapWord* pre_top = _top;
-
-  ParGCAllocBuffer::retire(end_of_gc, retain);
-  // Now any old _retained_filler is cut back to size, the free part is
-  // filled with a filler object, and top is past the header of that
-  // object.
-
-  if (retain && _top < _end) {
-    assert(end_of_gc && retain, "Or else retain should be false.");
-    // If the lab does not start on a card boundary, we don't want to
-    // allocate onto that card, since that might lead to concurrent
-    // allocation and card scanning, which we don't support.  So we fill
-    // the first card with a garbage object.
-    size_t first_card_index = _bsa->index_for(pre_top);
-    HeapWord* first_card_start = _bsa->address_for_index(first_card_index);
-    if (first_card_start < pre_top) {
-      HeapWord* second_card_start =
-        _bsa->inc_by_region_size(first_card_start);
-
-      // Ensure enough room to fill with the smallest block
-      second_card_start = MAX2(second_card_start, pre_top + AlignmentReserve);
-
-      // If the end is already in the first card, don't go beyond it!
-      // Or if the remainder is too small for a filler object, gobble it up.
-      if (_hard_end < second_card_start ||
-          pointer_delta(_hard_end, second_card_start) < AlignmentReserve) {
-        second_card_start = _hard_end;
-      }
-      if (pre_top < second_card_start) {
-        MemRegion first_card_suffix(pre_top, second_card_start);
-        fill_region_with_block(first_card_suffix, true);
-      }
-      pre_top = second_card_start;
-      _top = pre_top;
-      _end = MAX2(_top, _hard_end - AlignmentReserve);
-    }
-
-    // If the lab does not end on a card boundary, we don't want to
-    // allocate onto that card, since that might lead to concurrent
-    // allocation and card scanning, which we don't support.  So we fill
-    // the last card with a garbage object.
-    size_t last_card_index = _bsa->index_for(_hard_end);
-    HeapWord* last_card_start = _bsa->address_for_index(last_card_index);
-    if (last_card_start < _hard_end) {
-
-      // Ensure enough room to fill with the smallest block
-      last_card_start = MIN2(last_card_start, _hard_end - AlignmentReserve);
-
-      // If the top is already in the last card, don't go back beyond it!
-      // Or if the remainder is too small for a filler object, gobble it up.
-      if (_top > last_card_start ||
-          pointer_delta(last_card_start, _top) < AlignmentReserve) {
-        last_card_start = _top;
-      }
-      if (last_card_start < _hard_end) {
-        MemRegion last_card_prefix(last_card_start, _hard_end);
-        fill_region_with_block(last_card_prefix, false);
-      }
-      _hard_end = last_card_start;
-      _end      = MAX2(_top, _hard_end - AlignmentReserve);
-      _true_end = _hard_end;
-      assert(_end <= _hard_end, "Invariant.");
-    }
-
-    // At this point:
-    //   1) we had a filler object from the original top to hard_end.
-    //   2) We've filled in any partial cards at the front and back.
-    if (pre_top < _hard_end) {
-      // Now we can reset the _bt to do allocation in the given area.
-      MemRegion new_filler(pre_top, _hard_end);
-      fill_region_with_block(new_filler, false);
-      _top = pre_top + ParGCAllocBuffer::FillerHeaderSize;
-      // If there's no space left, don't retain.
-      if (_top >= _end) {
-        _retained = false;
-        invalidate();
-        return;
-      }
-      _retained_filler = MemRegion(pre_top, _top);
-      _bt.set_region(MemRegion(_top, _hard_end));
-      _bt.initialize_threshold();
-      assert(_bt.threshold() > _top, "initialize_threshold failed!");
-
-      // There may be other reasons for queries into the middle of the
-      // filler object.  When such queries are done in parallel with
-      // allocation, bad things can happen, if the query involves object
-      // iteration.  So we ensure that such queries do not involve object
-      // iteration, by putting another filler object on the boundaries of
-      // such queries.  One such is the object spanning a parallel card
-      // chunk boundary.
-
-      // "chunk_boundary" is the address of the first chunk boundary less
-      // than "hard_end".
-      HeapWord* chunk_boundary =
-        (HeapWord*)align_size_down(intptr_t(_hard_end-1), ChunkSizeInBytes);
-      assert(chunk_boundary < _hard_end, "Or else above did not work.");
-      assert(pointer_delta(_true_end, chunk_boundary) >= AlignmentReserve,
-             "Consequence of last card handling above.");
-
-      if (_top <= chunk_boundary) {
-        assert(_true_end == _hard_end, "Invariant.");
-        while (_top <= chunk_boundary) {
-          assert(pointer_delta(_hard_end, chunk_boundary) >= AlignmentReserve,
-                 "Consequence of last card handling above.");
-          _bt.BlockOffsetArray::alloc_block(chunk_boundary, _hard_end);
-          CollectedHeap::fill_with_object(chunk_boundary, _hard_end);
-          _hard_end = chunk_boundary;
-          chunk_boundary -= ChunkSizeInWords;
-        }
-        _end = _hard_end - AlignmentReserve;
-        assert(_top <= _end, "Invariant.");
-        // Now reset the initial filler chunk so it doesn't overlap with
-        // the one(s) inserted above.
-        MemRegion new_filler(pre_top, _hard_end);
-        fill_region_with_block(new_filler, false);
-      }
-    } else {
-      _retained = false;
-      invalidate();
-    }
-  } else {
-    assert(!end_of_gc ||
-           (!_retained && _true_end == _hard_end), "Checking.");
-  }
-  assert(_end <= _hard_end, "Invariant.");
-  assert(_top < _end || _top == _hard_end, "Invariant");
-}
diff --git a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp
index 6f1c5eb8eba..ce196cbced5 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/parGCAllocBuffer.hpp
@@ -216,44 +216,4 @@ class PLABStats VALUE_OBJ_CLASS_SPEC {
   }
 };
 
-class ParGCAllocBufferWithBOT: public ParGCAllocBuffer {
-  BlockOffsetArrayContigSpace _bt;
-  BlockOffsetSharedArray*     _bsa;
-  HeapWord*                   _true_end;  // end of the whole ParGCAllocBuffer
-
-  static const size_t ChunkSizeInWords;
-  static const size_t ChunkSizeInBytes;
-  HeapWord* allocate_slow(size_t word_sz);
-
-  void fill_region_with_block(MemRegion mr, bool contig);
-
-public:
-  ParGCAllocBufferWithBOT(size_t word_sz, BlockOffsetSharedArray* bsa);
-
-  HeapWord* allocate(size_t word_sz) {
-    HeapWord* res = ParGCAllocBuffer::allocate(word_sz);
-    if (res != NULL) {
-      _bt.alloc_block(res, word_sz);
-    } else {
-      res = allocate_slow(word_sz);
-    }
-    return res;
-  }
-
-  void undo_allocation(HeapWord* obj, size_t word_sz);
-
-  virtual void set_buf(HeapWord* buf_start) {
-    ParGCAllocBuffer::set_buf(buf_start);
-    _true_end = _hard_end;
-    _bt.set_region(MemRegion(buf_start, word_sz()));
-    _bt.initialize_threshold();
-  }
-
-  virtual void retire(bool end_of_gc, bool retain);
-
-  MemRegion range() {
-    return MemRegion(_top, _true_end);
-  }
-};
-
 #endif // SHARE_VM_GC_IMPLEMENTATION_PARNEW_PARGCALLOCBUFFER_HPP
diff --git a/hotspot/src/share/vm/memory/blockOffsetTable.hpp b/hotspot/src/share/vm/memory/blockOffsetTable.hpp
index 2730bee618c..53343e4ee09 100644
--- a/hotspot/src/share/vm/memory/blockOffsetTable.hpp
+++ b/hotspot/src/share/vm/memory/blockOffsetTable.hpp
@@ -251,12 +251,6 @@ public:
   // Return the address indicating the start of the region corresponding to
   // "index" in "_offset_array".
   HeapWord* address_for_index(size_t index) const;
-
-  // Return the address "p" incremented by the size of
-  // a region.  This method does not align the address
-  // returned to the start of a region.  It is a simple
-  // primitive.
-  HeapWord* inc_by_region_size(HeapWord* p) const { return p + N_words; }
 };
 
 //////////////////////////////////////////////////////////////////////////
diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
index 04a1cb1b937..73f922b47dd 100644
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.hpp
@@ -466,11 +466,6 @@ public:
   void verify_region(MemRegion mr, jbyte val, bool val_equals) PRODUCT_RETURN;
   void verify_not_dirty_region(MemRegion mr) PRODUCT_RETURN;
   void verify_dirty_region(MemRegion mr) PRODUCT_RETURN;
-
-  static size_t par_chunk_heapword_alignment() {
-    return ParGCCardsPerStrideChunk * card_size_in_words;
-  }
-
 };
 
 class CardTableRS;
diff --git a/hotspot/src/share/vm/memory/generation.cpp b/hotspot/src/share/vm/memory/generation.cpp
index 7a7d21f2563..510dadded3e 100644
--- a/hotspot/src/share/vm/memory/generation.cpp
+++ b/hotspot/src/share/vm/memory/generation.cpp
@@ -220,12 +220,6 @@ oop Generation::par_promote(int thread_num,
   return NULL;
 }
 
-void Generation::par_promote_alloc_undo(int thread_num,
-                                        HeapWord* obj, size_t word_sz) {
-  // Could do a bad general impl here that gets a lock.  But no.
-  guarantee(false, "No good general implementation.");
-}
-
 Space* Generation::space_containing(const void* p) const {
   GenerationIsInReservedClosure blk(p);
   // Cast away const
diff --git a/hotspot/src/share/vm/memory/generation.hpp b/hotspot/src/share/vm/memory/generation.hpp
index 5cf311f4f26..d0ff35cea06 100644
--- a/hotspot/src/share/vm/memory/generation.hpp
+++ b/hotspot/src/share/vm/memory/generation.hpp
@@ -317,11 +317,6 @@ class Generation: public CHeapObj<mtGC> {
   virtual oop par_promote(int thread_num,
                           oop obj, markOop m, size_t word_sz);
 
-  // Undo, if possible, the most recent par_promote_alloc allocation by
-  // "thread_num" ("obj", of "word_sz").
-  virtual void par_promote_alloc_undo(int thread_num,
-                                      HeapWord* obj, size_t word_sz);
-
   // Informs the current generation that all par_promote_alloc's in the
   // collection have been completed; any supporting data structures can be
   // reset.  Default is to do nothing.
diff --git a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java b/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java
index fa607921c4d..8bacb7b831a 100644
--- a/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java
+++ b/hotspot/test/gc/startup_warnings/TestParNewSerialOld.java
@@ -25,7 +25,7 @@
 * @test TestParNewSerialOld
 * @key gc
 * @bug 8065972
-* @summary Test that the deprecated ParNew+SerialOld combination print a warning message
+* @summary Test that the unsupported ParNew+SerialOld combination does not start
 * @library /testlibrary
 */
 

From c8a147b8c7730be353aba1acbcf232bdfadda5d5 Mon Sep 17 00:00:00 2001
From: Leonid Mesnik <leonid.mesnik@oracle.com>
Date: Fri, 28 Nov 2014 09:33:48 +0100
Subject: [PATCH 175/299] 8065579: WB method to start G1 concurrent mark cycle
 should be introduced

Add a WhiteBox callback to the VM to start a concurrent mark cycle in G1.

Reviewed-by: tschatzl, sjohanss
---
 .../gc_implementation/g1/g1CollectedHeap.cpp  |  1 +
 .../gc_implementation/g1/vm_operations_g1.cpp |  8 +--
 hotspot/src/share/vm/gc_interface/gcCause.cpp |  3 +
 hotspot/src/share/vm/gc_interface/gcCause.hpp |  1 +
 hotspot/src/share/vm/prims/whitebox.cpp       | 14 ++++-
 .../test/gc/whitebox/TestConcMarkCycleWB.java | 57 +++++++++++++++++++
 .../whitebox/sun/hotspot/WhiteBox.java        |  8 ++-
 7 files changed, 82 insertions(+), 10 deletions(-)
 create mode 100644 hotspot/test/gc/whitebox/TestConcMarkCycleWB.java

diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index f00116fead3..d91b6a1621c 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -2257,6 +2257,7 @@ bool G1CollectedHeap::should_do_concurrent_full_gc(GCCause::Cause cause) {
     case GCCause::_java_lang_system_gc:     return ExplicitGCInvokesConcurrent;
     case GCCause::_g1_humongous_allocation: return true;
     case GCCause::_update_allocation_context_stats_inc: return true;
+    case GCCause::_wb_conc_mark:            return true;
     default:                                return false;
   }
 }
diff --git a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
index 11e78d07370..6196ca9ccbf 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/vm_operations_g1.cpp
@@ -92,12 +92,8 @@ bool VM_G1IncCollectionPause::doit_prologue() {
 
 void VM_G1IncCollectionPause::doit() {
   G1CollectedHeap* g1h = G1CollectedHeap::heap();
-  assert(!_should_initiate_conc_mark ||
-  ((_gc_cause == GCCause::_gc_locker && GCLockerInvokesConcurrent) ||
-   (_gc_cause == GCCause::_java_lang_system_gc && ExplicitGCInvokesConcurrent) ||
-    _gc_cause == GCCause::_g1_humongous_allocation ||
-    _gc_cause == GCCause::_update_allocation_context_stats_inc),
-      "only a GC locker, a System.gc(), stats update or a hum allocation induced GC should start a cycle");
+  assert(!_should_initiate_conc_mark || g1h->should_do_concurrent_full_gc(_gc_cause),
+      "only a GC locker, a System.gc(), stats update, whitebox, or a hum allocation induced GC should start a cycle");
 
   if (_word_size > 0) {
     // An allocation has been requested. So, try to do that first.
diff --git a/hotspot/src/share/vm/gc_interface/gcCause.cpp b/hotspot/src/share/vm/gc_interface/gcCause.cpp
index 4778d8aa45a..a364214bdd2 100644
--- a/hotspot/src/share/vm/gc_interface/gcCause.cpp
+++ b/hotspot/src/share/vm/gc_interface/gcCause.cpp
@@ -54,6 +54,9 @@ const char* GCCause::to_string(GCCause::Cause cause) {
     case _wb_young_gc:
       return "WhiteBox Initiated Young GC";
 
+    case _wb_conc_mark:
+      return "WhiteBox Initiated Concurrent Mark";
+
     case _update_allocation_context_stats_inc:
     case _update_allocation_context_stats_full:
       return "Update Allocation Context Stats";
diff --git a/hotspot/src/share/vm/gc_interface/gcCause.hpp b/hotspot/src/share/vm/gc_interface/gcCause.hpp
index 4af99f1cf7e..cb304294639 100644
--- a/hotspot/src/share/vm/gc_interface/gcCause.hpp
+++ b/hotspot/src/share/vm/gc_interface/gcCause.hpp
@@ -47,6 +47,7 @@ class GCCause : public AllStatic {
     _heap_inspection,
     _heap_dump,
     _wb_young_gc,
+    _wb_conc_mark,
     _update_allocation_context_stats_inc,
     _update_allocation_context_stats_full,
 
diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp
index 7310ef4e942..32bdce552ce 100644
--- a/hotspot/src/share/vm/prims/whitebox.cpp
+++ b/hotspot/src/share/vm/prims/whitebox.cpp
@@ -49,6 +49,7 @@
 #if INCLUDE_ALL_GCS
 #include "gc_implementation/parallelScavenge/parallelScavengeHeap.inline.hpp"
 #include "gc_implementation/g1/concurrentMark.hpp"
+#include "gc_implementation/g1/concurrentMarkThread.hpp"
 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp"
 #include "gc_implementation/g1/heapRegionRemSet.hpp"
 #endif // INCLUDE_ALL_GCS
@@ -266,8 +267,16 @@ WB_END
 
 WB_ENTRY(jboolean, WB_G1InConcurrentMark(JNIEnv* env, jobject o))
   G1CollectedHeap* g1 = G1CollectedHeap::heap();
-  ConcurrentMark* cm = g1->concurrent_mark();
-  return cm->concurrent_marking_in_progress();
+  return g1->concurrent_mark()->cmThread()->during_cycle();
+WB_END
+
+WB_ENTRY(jboolean, WB_G1StartMarkCycle(JNIEnv* env, jobject o))
+  G1CollectedHeap* g1h = G1CollectedHeap::heap();
+  if (!g1h->concurrent_mark()->cmThread()->during_cycle()) {
+    g1h->collect(GCCause::_wb_conc_mark);
+    return true;
+  }
+  return false;
 WB_END
 
 WB_ENTRY(jint, WB_G1RegionSize(JNIEnv* env, jobject o))
@@ -1106,6 +1115,7 @@ static JNINativeMethod methods[] = {
   {CC"g1IsHumongous",      CC"(Ljava/lang/Object;)Z", (void*)&WB_G1IsHumongous     },
   {CC"g1NumFreeRegions",   CC"()J",                   (void*)&WB_G1NumFreeRegions  },
   {CC"g1RegionSize",       CC"()I",                   (void*)&WB_G1RegionSize      },
+  {CC"g1StartConcMarkCycle",       CC"()Z",           (void*)&WB_G1StartMarkCycle  },
 #endif // INCLUDE_ALL_GCS
 #if INCLUDE_NMT
   {CC"NMTMalloc",           CC"(J)J",                 (void*)&WB_NMTMalloc          },
diff --git a/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java b/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java
new file mode 100644
index 00000000000..2d97bc739c6
--- /dev/null
+++ b/hotspot/test/gc/whitebox/TestConcMarkCycleWB.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2014, 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 TestConMarkCycleWB
+ * @bug 8065579
+ * @requires vm.gc=="null" | vm.gc=="G1"
+ * @library /testlibrary /testlibrary/whitebox
+ * @build ClassFileInstaller com.oracle.java.testlibrary.* sun.hotspot.WhiteBox TestConcMarkCycleWB
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -XX:+UseG1GC TestConcMarkCycleWB
+ * @summary Verifies that ConcurrentMarking-related WB works properly
+ */
+import static com.oracle.java.testlibrary.Asserts.assertFalse;
+import static com.oracle.java.testlibrary.Asserts.assertTrue;
+import sun.hotspot.WhiteBox;
+
+public class TestConcMarkCycleWB {
+
+    public static void main(String[] args) throws Exception {
+        WhiteBox wb = WhiteBox.getWhiteBox();
+
+        wb.youngGC();
+        assertTrue(wb.g1StartConcMarkCycle());
+        while (wb.g1InConcurrentMark()) {
+            Thread.sleep(5);
+        }
+
+        wb.fullGC();
+        assertTrue(wb.g1StartConcMarkCycle());
+        while (wb.g1InConcurrentMark()) {
+            Thread.sleep(5);
+        }
+        assertTrue(wb.g1StartConcMarkCycle());
+    }
+}
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
index 1759d925731..3f219428543 100644
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
@@ -162,12 +162,16 @@ public class WhiteBox {
   public native long incMetaspaceCapacityUntilGC(long increment);
   public native long metaspaceCapacityUntilGC();
 
-  // force Young GC
+  // Force Young GC
   public native void youngGC();
 
-  // force Full GC
+  // Force Full GC
   public native void fullGC();
 
+  // Method tries to start concurrent mark cycle.
+  // It returns false if CM Thread is always in concurrent cycle.
+  public native boolean g1StartConcMarkCycle();
+
   // Tests on ReservedSpace/VirtualSpace classes
   public native int stressVirtualSpaceResize(long reservedSpaceSize, long magnitude, long iterations);
   public native void runMemoryUnitTests();

From 9c7f48c842eabe5254dccbccc350d17c9affe4d6 Mon Sep 17 00:00:00 2001
From: Marcus Lagergren <lagergren@openjdk.org>
Date: Fri, 28 Nov 2014 11:02:54 +0100
Subject: [PATCH 176/299] 8066119: Invalid resource tag used for looking up
 error message in NativeDataView

Reviewed-by: hannesw, sundar
---
 .../internal/objects/NativeDataView.java      | 20 +++++++++----------
 .../runtime/resources/Messages.properties     |  2 +-
 2 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDataView.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDataView.java
index fb502771473..14c11f69c88 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDataView.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDataView.java
@@ -105,10 +105,10 @@ public class NativeDataView extends ScriptObject {
 
     private NativeDataView(final NativeArrayBuffer arrBuf, final ByteBuffer buf, final int offset, final int length) {
         super(Global.instance().getDataViewPrototype(), $nasgenmap$);
-        this.buffer = arrBuf;
+        this.buffer     = arrBuf;
         this.byteOffset = offset;
         this.byteLength = length;
-        this.buf = buf;
+        this.buf        = buf;
     }
 
     /**
@@ -135,14 +135,14 @@ public class NativeDataView extends ScriptObject {
             throw typeError("not.an.arraybuffer.in.dataview");
         }
 
-        final NativeArrayBuffer arrBuf = (NativeArrayBuffer) args[0];
+        final NativeArrayBuffer arrBuf = (NativeArrayBuffer)args[0];
         switch (args.length) {
-            case 1:
-                return new NativeDataView(arrBuf);
-            case 2:
-                return new NativeDataView(arrBuf, JSType.toInt32(args[1]));
-            default:
-                return new NativeDataView(arrBuf, JSType.toInt32(args[1]), JSType.toInt32(args[2]));
+        case 1:
+            return new NativeDataView(arrBuf);
+        case 2:
+            return new NativeDataView(arrBuf, JSType.toInt32(args[1]));
+        default:
+            return new NativeDataView(arrBuf, JSType.toInt32(args[1]), JSType.toInt32(args[2]));
         }
     }
 
@@ -995,7 +995,7 @@ public class NativeDataView extends ScriptObject {
 
     private static NativeDataView checkSelf(final Object self) {
         if (!(self instanceof NativeDataView)) {
-            throw typeError("not.an.arraybuffer", ScriptRuntime.safeToString(self));
+            throw typeError("not.an.arraybuffer.in.dataview", ScriptRuntime.safeToString(self));
         }
         return (NativeDataView)self;
     }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties
index 71c11743b00..119277dfd84 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/Messages.properties
@@ -82,7 +82,7 @@ type.error.not.a.constructor={0} is not a constructor function
 type.error.not.a.file={0} is not a File
 type.error.not.a.numeric.array={0} is not a numeric array
 type.error.not.a.bytebuffer={0} is not a java.nio.ByteBuffer
-type.error.not.an.arraybuffer.in.dataview=First arg to DataView constructor must be an ArrayBuffer
+type.error.not.an.arraybuffer.in.dataview=First argument to DataView constructor must be an ArrayBuffer
 type.error.no.reflection.with.classfilter=Java reflection not supported when class filter is present
 
 # operations not permitted on undefined

From 02df6a4564965fd12f1ec1aaa4415f0de8201f7d Mon Sep 17 00:00:00 2001
From: Maurizio Cimadamore <mcimadamore@openjdk.org>
Date: Fri, 28 Nov 2014 11:45:56 +0000
Subject: [PATCH 177/299] 8065986: Compiler fails to NullPointerException when
 calling super with Object<>()

Missing POLY kind selector on recursive constructor calls with poly arguments

Reviewed-by: vromero
---
 .../com/sun/tools/javac/comp/Attr.java        | 16 ++++-----
 .../generics/diamond/8065986/T8065986a.java   | 33 +++++++++++++++++++
 .../generics/diamond/8065986/T8065986a.out    |  6 ++++
 .../generics/diamond/8065986/T8065986b.java   | 33 +++++++++++++++++++
 .../generics/diamond/8065986/T8065986b.out    |  6 ++++
 5 files changed, 86 insertions(+), 8 deletions(-)
 create mode 100644 langtools/test/tools/javac/generics/diamond/8065986/T8065986a.java
 create mode 100644 langtools/test/tools/javac/generics/diamond/8065986/T8065986a.out
 create mode 100644 langtools/test/tools/javac/generics/diamond/8065986/T8065986b.java
 create mode 100644 langtools/test/tools/javac/generics/diamond/8065986/T8065986b.out

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
index 0ad60fe8813..9432f6f034b 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -629,19 +629,19 @@ public class Attr extends JCTree.Visitor {
 
     /** Attribute the arguments in a method call, returning the method kind.
      */
-    KindSelector attribArgs(List<JCExpression> trees, Env<AttrContext> env, ListBuffer<Type> argtypes) {
-        boolean polykind = false;
+    KindSelector attribArgs(KindSelector initialKind, List<JCExpression> trees, Env<AttrContext> env, ListBuffer<Type> argtypes) {
+        KindSelector kind = initialKind;
         for (JCExpression arg : trees) {
             Type argtype;
             if (allowPoly && deferredAttr.isDeferred(env, arg)) {
                 argtype = deferredAttr.new DeferredType(arg, env);
-                polykind = true;
+                kind = KindSelector.of(KindSelector.POLY, kind);
             } else {
                 argtype = chk.checkNonVoid(arg, attribTree(arg, env, unknownAnyPolyInfo));
             }
             argtypes.append(argtype);
         }
-        return polykind ? KindSelector.VAL_POLY : KindSelector.VAL;
+        return kind;
     }
 
     /** Attribute a type argument list, returning a list of types.
@@ -1704,7 +1704,7 @@ public class Attr extends JCTree.Visitor {
                 localEnv.info.isSelfCall = true;
 
                 // Attribute arguments, yielding list of argument types.
-                attribArgs(tree.args, localEnv, argtypesBuf);
+                KindSelector kind = attribArgs(KindSelector.MTH, tree.args, localEnv, argtypesBuf);
                 argtypes = argtypesBuf.toList();
                 typeargtypes = attribTypes(tree.typeargs, localEnv);
 
@@ -1770,7 +1770,7 @@ public class Attr extends JCTree.Visitor {
                     // (this will also set the tree's type)
                     Type mpt = newMethodTemplate(resultInfo.pt, argtypes, typeargtypes);
                     checkId(tree.meth, site, sym, localEnv,
-                            new ResultInfo(KindSelector.MTH, mpt));
+                            new ResultInfo(kind, mpt));
                 }
                 // Otherwise, `site' is an error type and we do nothing
             }
@@ -1778,7 +1778,7 @@ public class Attr extends JCTree.Visitor {
         } else {
             // Otherwise, we are seeing a regular method call.
             // Attribute the arguments, yielding list of argument types, ...
-            KindSelector kind = attribArgs(tree.args, localEnv, argtypesBuf);
+            KindSelector kind = attribArgs(KindSelector.VAL, tree.args, localEnv, argtypesBuf);
             argtypes = argtypesBuf.toList();
             typeargtypes = attribAnyTypes(tree.typeargs, localEnv);
 
@@ -1958,7 +1958,7 @@ public class Attr extends JCTree.Visitor {
         // Attribute constructor arguments.
         ListBuffer<Type> argtypesBuf = new ListBuffer<>();
         final KindSelector pkind =
-            attribArgs(tree.args, localEnv, argtypesBuf);
+            attribArgs(KindSelector.VAL, tree.args, localEnv, argtypesBuf);
         List<Type> argtypes = argtypesBuf.toList();
         List<Type> typeargtypes = attribTypes(tree.typeargs, localEnv);
 
diff --git a/langtools/test/tools/javac/generics/diamond/8065986/T8065986a.java b/langtools/test/tools/javac/generics/diamond/8065986/T8065986a.java
new file mode 100644
index 00000000000..311b276c424
--- /dev/null
+++ b/langtools/test/tools/javac/generics/diamond/8065986/T8065986a.java
@@ -0,0 +1,33 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8065986
+ *
+ * @summary Compiler fails to NullPointerException when calling super with Object<>()
+ * @compile/fail/ref=T8065986a.out T8065986a.java -XDrawDiagnostics
+ *
+ */
+import java.util.ArrayList;
+
+class T8065986a {
+    T8065986a() {
+        super(new Object<>());
+    }
+
+    T8065986a(boolean b) {
+        super(new ArrayList<>());
+    }
+
+    T8065986a(boolean b1, boolean b2) {
+        super(()->{});
+    }
+
+    T8065986a(boolean b1, boolean b2, boolean b3) {
+        super(T8065986a::m);
+    }
+
+    T8065986a(boolean cond, Object o1, Object o2) {
+        super(cond ? o1 : o2);
+    }
+
+    static void m() { }
+}
diff --git a/langtools/test/tools/javac/generics/diamond/8065986/T8065986a.out b/langtools/test/tools/javac/generics/diamond/8065986/T8065986a.out
new file mode 100644
index 00000000000..cb605f43d9c
--- /dev/null
+++ b/langtools/test/tools/javac/generics/diamond/8065986/T8065986a.out
@@ -0,0 +1,6 @@
+T8065986a.java:13:25: compiler.err.cant.apply.diamond.1: java.lang.Object, (compiler.misc.diamond.non.generic: java.lang.Object)
+T8065986a.java:17:9: compiler.err.cant.apply.symbol: kindname.constructor, Object, compiler.misc.no.args, java.util.ArrayList<java.lang.Object>, kindname.class, java.lang.Object, (compiler.misc.arg.length.mismatch)
+T8065986a.java:21:9: compiler.err.cant.apply.symbol: kindname.constructor, Object, compiler.misc.no.args, @438, kindname.class, java.lang.Object, (compiler.misc.arg.length.mismatch)
+T8065986a.java:25:9: compiler.err.cant.apply.symbol: kindname.constructor, Object, compiler.misc.no.args, @520, kindname.class, java.lang.Object, (compiler.misc.arg.length.mismatch)
+T8065986a.java:29:9: compiler.err.cant.apply.symbol: kindname.constructor, Object, compiler.misc.no.args, @608, kindname.class, java.lang.Object, (compiler.misc.arg.length.mismatch)
+5 errors
diff --git a/langtools/test/tools/javac/generics/diamond/8065986/T8065986b.java b/langtools/test/tools/javac/generics/diamond/8065986/T8065986b.java
new file mode 100644
index 00000000000..40a6a8b573e
--- /dev/null
+++ b/langtools/test/tools/javac/generics/diamond/8065986/T8065986b.java
@@ -0,0 +1,33 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 8065986
+ *
+ * @summary Compiler fails to NullPointerException when calling super with Object<>()
+ * @compile/fail/ref=T8065986b.out T8065986b.java -XDrawDiagnostics
+ *
+ */
+import java.util.ArrayList;
+
+class T8065986b {
+    T8065986b() {
+        this(new Object<>());
+    }
+
+    T8065986b(boolean b) {
+        this(new ArrayList<>());
+    }
+
+    T8065986b(boolean b1, boolean b2) {
+        this(()->{});
+    }
+
+    T8065986b(boolean b1, boolean b2, boolean b3) {
+        this(T8065986b::m);
+    }
+
+    T8065986b(boolean cond, Object o1, Object o2) {
+        this(cond ? o1 : o2);
+    }
+
+    static void m() { }
+}
diff --git a/langtools/test/tools/javac/generics/diamond/8065986/T8065986b.out b/langtools/test/tools/javac/generics/diamond/8065986/T8065986b.out
new file mode 100644
index 00000000000..30bcfb6eb65
--- /dev/null
+++ b/langtools/test/tools/javac/generics/diamond/8065986/T8065986b.out
@@ -0,0 +1,6 @@
+T8065986b.java:13:24: compiler.err.cant.apply.diamond.1: java.lang.Object, (compiler.misc.diamond.non.generic: java.lang.Object)
+T8065986b.java:17:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, java.util.ArrayList<java.lang.Object>,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.cant.apply.diamond.1: (compiler.misc.diamond: java.util.ArrayList), (compiler.misc.infer.no.conforming.instance.exists: E, java.util.ArrayList<E>, boolean)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch))}
+T8065986b.java:21:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, @435,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: boolean))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch))}
+T8065986b.java:25:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, @516,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.not.a.functional.intf: boolean))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch))}
+T8065986b.java:29:9: compiler.err.cant.apply.symbols: kindname.constructor, T8065986b, @603,{(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean), (compiler.misc.no.conforming.assignment.exists: (compiler.misc.incompatible.type.in.conditional: (compiler.misc.inconvertible.types: java.lang.Object, boolean)))),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,boolean,boolean), (compiler.misc.arg.length.mismatch)),(compiler.misc.inapplicable.method: kindname.constructor, T8065986b, T8065986b(boolean,java.lang.Object,java.lang.Object), (compiler.misc.arg.length.mismatch))}
+5 errors

From d291f2c3f7ed82c56dc53043471f9382eeb68988 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan <sundar@openjdk.org>
Date: Fri, 28 Nov 2014 18:31:05 +0530
Subject: [PATCH 178/299] 8066146: jdk.nashorn.api.scripting package javadoc
 should be included in jdk docs

Reviewed-by: erikj, jlaskey, lagergren
---
 make/Javadoc.gmk              | 56 +++++++++++++++++++++++++++++++++++
 make/common/NON_CORE_PKGS.gmk |  2 ++
 2 files changed, 58 insertions(+)

diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk
index e9bd588e17b..faa75a665f4 100644
--- a/make/Javadoc.gmk
+++ b/make/Javadoc.gmk
@@ -74,6 +74,7 @@ JCONSOLE_FIRST_COPYRIGHT_YEAR = 2006
 SCTPAPI_FIRST_COPYRIGHT_YEAR = 2009
 TRACING_FIRST_COPYRIGHT_YEAR = 2008
 TREEAPI_FIRST_COPYRIGHT_YEAR = 2005
+NASHORNAPI_FIRST_COPYRIGHT_YEAR = 2014
 JNLP_FIRST_COPYRIGHT_YEAR = 1998
 PLUGIN2_FIRST_COPYRIGHT_YEAR = 2007
 JDKNET_FIRST_COPYRIGHT_YEAR = 2014
@@ -140,6 +141,7 @@ ALL_SOURCE_DIRS := $(wildcard \
       $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \
       $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_TYPE)/classes \
       $(LANGTOOLS_TOPDIR)/src/*/share/classes \
+      $(NASHORN_TOPDIR)/src/*/share/classes \
       $(CORBA_TOPDIR)/src/*/share/classes \
       $(JAXP_TOPDIR)/src/*/share/classes \
       $(JAXWS_TOPDIR)/src/*/share/classes \
@@ -1127,6 +1129,60 @@ $(TREEAPI_PACKAGES_FILE): $(call PackageDependencies,$(TREEAPI_PKGS))
 	$(prep-target)
 	$(call PackageFilter,$(TREEAPI_PKGS))
 
+#############################################################
+#
+# nashornapidocs
+#
+
+ALL_OTHER_TARGETS += nashornapidocs
+
+NASHORNAPI_DOCDIR := $(JDK_API_DOCSDIR)/nashorn
+NASHORNAPI2COREAPI := ../$(JDKJRE2COREAPI)
+NASHORNAPI_DOCTITLE := Nashorn API
+NASHORNAPI_WINDOWTITLE := Nashorn API
+NASHORNAPI_HEADER := <strong>Nashorn API</strong>
+NASHORNAPI_BOTTOM := $(call CommonBottom,$(NASHORNAPI_FIRST_COPYRIGHT_YEAR))
+NASHORNAPI_GROUPNAME := Packages
+NASHORNAPI_REGEXP := jdk.nashorn.api.scripting.*
+# NASHORNAPI_PKGS is located in NON_CORE_PKGS.gmk
+
+NASHORNAPI_INDEX_HTML = $(NASHORNAPI_DOCDIR)/index.html
+NASHORNAPI_OPTIONS_FILE = $(DOCSTMPDIR)/nashornapi.options
+NASHORNAPI_PACKAGES_FILE = $(DOCSTMPDIR)/nashornapi.packages
+
+nashornapidocs: $(NASHORNAPI_INDEX_HTML)
+
+# Set relative location to core api document root
+$(NASHORNAPI_INDEX_HTML): GET2DOCSDIR=$(NASHORNAPI2COREAPI)/..
+
+# Run javadoc if the index file is out of date or missing
+$(NASHORNAPI_INDEX_HTML): $(NASHORNAPI_OPTIONS_FILE) $(NASHORNAPI_PACKAGES_FILE) $(COREAPI_INDEX_FILE)
+	$(prep-javadoc)
+	$(call JavadocSummary,$(NASHORNAPI_OPTIONS_FILE),$(NASHORNAPI_PACKAGES_FILE))
+	$(JAVADOC_CMD) -d $(@D) \
+	    @$(NASHORNAPI_OPTIONS_FILE) @$(NASHORNAPI_PACKAGES_FILE)
+
+# Create file with javadoc options in it
+$(NASHORNAPI_OPTIONS_FILE):
+	$(prep-target)
+	@($(call COMMON_JAVADOCFLAGS) ; \
+          $(call COMMON_JAVADOCTAGS) ; \
+	  $(call OptionOnly,-Xdoclint:all) ; \
+	  $(call OptionPair,-sourcepath,$(RELEASEDOCS_SOURCEPATH)) ; \
+	  $(call OptionPair,-encoding,ascii) ; \
+	  $(call OptionPair,-doctitle,$(NASHORNAPI_DOCTITLE)) ; \
+	  $(call OptionPair,-windowtitle,$(NASHORNAPI_WINDOWTITLE) $(DRAFT_WINTITLE)); \
+	  $(call OptionPair,-header,$(NASHORNAPI_HEADER)$(DRAFT_HEADER)) ; \
+	  $(call OptionPair,-bottom,$(NASHORNAPI_BOTTOM)$(DRAFT_BOTTOM)) ; \
+	  $(call OptionTrip,-group,$(NASHORNAPI_GROUPNAME),$(NASHORNAPI_REGEXP)); \
+	  $(call OptionTrip,-linkoffline,$(NASHORNAPI2COREAPI),$(COREAPI_DOCSDIR)/); \
+	) >> $@
+
+# Create a file with the package names in it
+$(NASHORNAPI_PACKAGES_FILE): $(call PackageDependencies,$(NASHORNAPI_PKGS))
+	$(prep-target)
+	$(call PackageFilter,$(NASHORNAPI_PKGS))
+
 #############################################################
 #
 # sctpdocs
diff --git a/make/common/NON_CORE_PKGS.gmk b/make/common/NON_CORE_PKGS.gmk
index 5978042d82f..cb3887a9d00 100644
--- a/make/common/NON_CORE_PKGS.gmk
+++ b/make/common/NON_CORE_PKGS.gmk
@@ -82,6 +82,8 @@ TREEAPI_PKGS = com.sun.source.doctree \
     com.sun.source.util \
     jdk
 
+NASHORNAPI_PKGS = jdk.nashorn.api.scripting
+
 SMARTCARDIO_PKGS = javax.smartcardio
 
 SCTPAPI_PKGS = com.sun.nio.sctp

From f0b198804a1665117404295f0c5a2839d9766758 Mon Sep 17 00:00:00 2001
From: Alan Bateman <alanb@openjdk.org>
Date: Fri, 28 Nov 2014 14:58:10 +0000
Subject: [PATCH 179/299] 8062955: (fs spec) Files.setLastModifiedTime should
 specify SecurityException more clearly 8062949: (fs)
 Files.setLastModifiedTime(path, null) does not throw NPE

Reviewed-by: chegar
---
 .../share/classes/java/nio/file/Files.java    |  16 +--
 .../java/nio/file/Files/FileAttributes.java   |   6 -
 .../nio/file/Files/SetLastModifiedTime.java   | 118 ++++++++++++++++++
 3 files changed, 126 insertions(+), 14 deletions(-)
 create mode 100644 jdk/test/java/nio/file/Files/SetLastModifiedTime.java

diff --git a/jdk/src/java.base/share/classes/java/nio/file/Files.java b/jdk/src/java.base/share/classes/java/nio/file/Files.java
index 18ef214e9a0..4d0119393b6 100644
--- a/jdk/src/java.base/share/classes/java/nio/file/Files.java
+++ b/jdk/src/java.base/share/classes/java/nio/file/Files.java
@@ -1778,7 +1778,7 @@ public final class Files {
      * @param   options
      *          options indicating how symbolic links are handled
      *
-     * @return  the {@code path} parameter
+     * @return  the given path
      *
      * @throws  UnsupportedOperationException
      *          if the attribute view is not available
@@ -2019,7 +2019,7 @@ public final class Files {
      * @param   perms
      *          The new set of permissions
      *
-     * @return  The path
+     * @return  The given path
      *
      * @throws  UnsupportedOperationException
      *          if the associated file system does not support the {@code
@@ -2102,7 +2102,7 @@ public final class Files {
      * @param   owner
      *          The new file owner
      *
-     * @return  The path
+     * @return  The given path
      *
      * @throws  UnsupportedOperationException
      *          if the associated file system does not support the {@code
@@ -2289,14 +2289,14 @@ public final class Files {
      * @param   time
      *          the new last modified time
      *
-     * @return  the path
+     * @return  the given path
      *
      * @throws  IOException
      *          if an I/O error occurs
      * @throws  SecurityException
-     *          In the case of the default provider, the security manager's {@link
-     *          SecurityManager#checkWrite(String) checkWrite} method is invoked
-     *          to check write access to file
+     *          In the case of the default provider, and a security manager is
+     *          installed, its {@link SecurityManager#checkWrite(String)
+     *          checkWrite} method denies write access to the file.
      *
      * @see BasicFileAttributeView#setTimes
      */
@@ -2304,7 +2304,7 @@ public final class Files {
         throws IOException
     {
         getFileAttributeView(path, BasicFileAttributeView.class)
-            .setTimes(time, null, null);
+            .setTimes(Objects.requireNonNull(time), null, null);
         return path;
     }
 
diff --git a/jdk/test/java/nio/file/Files/FileAttributes.java b/jdk/test/java/nio/file/Files/FileAttributes.java
index 8b179f8efeb..a993b81e149 100644
--- a/jdk/test/java/nio/file/Files/FileAttributes.java
+++ b/jdk/test/java/nio/file/Files/FileAttributes.java
@@ -52,12 +52,6 @@ public class FileAttributes {
         }
     }
 
-    // checks that two time values are within 1s of each other
-    static void checkNearEqual(FileTime t1, FileTime t2) {
-        long diff = Math.abs(t1.toMillis() - t2.toMillis());
-        assertTrue(diff <= 1000);
-    }
-
     // Exercise getAttribute/setAttribute/readAttributes on basic attributes
     static void checkBasicAttributes(Path file, BasicFileAttributes attrs)
         throws IOException
diff --git a/jdk/test/java/nio/file/Files/SetLastModifiedTime.java b/jdk/test/java/nio/file/Files/SetLastModifiedTime.java
new file mode 100644
index 00000000000..ef8cfaa0cec
--- /dev/null
+++ b/jdk/test/java/nio/file/Files/SetLastModifiedTime.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2014, 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.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.FileTime;
+
+import org.testng.annotations.Test;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
+
+/**
+ * @test
+ * @bug 4313887 8062949
+ * @library ..
+ * @run testng SetLastModifiedTime
+ * @summary Unit test for Files.setLastModifiedTime
+ */
+
+public class SetLastModifiedTime {
+
+    static Path testDir;
+
+    @BeforeClass
+    void createTestDirectory() throws Exception {
+        testDir = TestUtil.createTemporaryDirectory();
+    }
+
+    @AfterClass
+    void removeTestDirectory() throws Exception {
+        TestUtil.removeAll(testDir);
+    }
+
+    /**
+     * Exercise Files.setLastModifiedTime on the given file
+     */
+    void test(Path path) throws Exception {
+        FileTime now = Files.getLastModifiedTime(path);
+        FileTime zero = FileTime.fromMillis(0L);
+
+        Path result = Files.setLastModifiedTime(path, zero);
+        assertTrue(result == path);
+        assertEquals(Files.getLastModifiedTime(path), zero);
+
+        result = Files.setLastModifiedTime(path, now);
+        assertTrue(result == path);
+        assertEquals(Files.getLastModifiedTime(path), now);
+    }
+
+    @Test
+    public void testRegularFile() throws Exception {
+        Path file = Files.createFile(testDir.resolve("file"));
+        test(file);
+    }
+
+    @Test
+    public void testDirectory() throws Exception {
+        Path dir = Files.createDirectory(testDir.resolve("dir"));
+        test(dir);
+    }
+
+    @Test
+    public void testSymbolicLink() throws Exception {
+        if (TestUtil.supportsLinks(testDir)) {
+            Path target = Files.createFile(testDir.resolve("target"));
+            Path link = testDir.resolve("link");
+            Files.createSymbolicLink(link, target);
+            test(link);
+        }
+    }
+
+    @Test
+    public void testNulls() throws Exception {
+        Path path = Paths.get("foo");
+        FileTime zero = FileTime.fromMillis(0L);
+
+        try {
+            Files.setLastModifiedTime(null, zero);
+            assertTrue(false);
+        } catch (NullPointerException expected) { }
+
+        try {
+            Files.setLastModifiedTime(path, null);
+            assertTrue(false);
+        } catch (NullPointerException expected) { }
+
+        try {
+            Files.setLastModifiedTime(null, null);
+            assertTrue(false);
+        } catch (NullPointerException expected) { }
+    }
+}
+

From 6c1cf6ba456de5b5b550b9850951a97ee6c884ee Mon Sep 17 00:00:00 2001
From: Jaroslav Bachorik <jbachorik@openjdk.org>
Date: Fri, 28 Nov 2014 16:33:57 +0100
Subject: [PATCH 180/299] 8065783: DCMD parser fails to recognize one character
 argument when it's positioned last

Reviewed-by: sla, egahlin, fparain
---
 .../vm/prims/wbtestmethods/parserTests.cpp    | 53 +++++++++++++++----
 .../vm/prims/wbtestmethods/parserTests.hpp    |  2 +-
 hotspot/src/share/vm/prims/whitebox.cpp       |  2 +-
 .../share/vm/services/diagnosticFramework.cpp |  9 ++--
 hotspot/test/serviceability/ParserTest.java   | 23 ++++++--
 .../whitebox/sun/hotspot/WhiteBox.java        |  2 +-
 .../sun/hotspot/parser/DiagnosticCommand.java | 11 ++++
 7 files changed, 82 insertions(+), 20 deletions(-)

diff --git a/hotspot/src/share/vm/prims/wbtestmethods/parserTests.cpp b/hotspot/src/share/vm/prims/wbtestmethods/parserTests.cpp
index da3493cf3c1..e67d380d77c 100644
--- a/hotspot/src/share/vm/prims/wbtestmethods/parserTests.cpp
+++ b/hotspot/src/share/vm/prims/wbtestmethods/parserTests.cpp
@@ -70,38 +70,63 @@ static void fill_in_parser(DCmdParser* parser, oop argument)
   const char* desc = WhiteBox::lookup_jstring("desc", argument);
   const char* default_value = WhiteBox::lookup_jstring("defaultValue", argument);
   bool mandatory = WhiteBox::lookup_bool("mandatory", argument);
+  bool isarg = WhiteBox::lookup_bool("argument", argument);
   const char*  type = lookup_diagnosticArgumentEnum("type", argument);
 
    if (strcmp(type, "STRING") == 0) {
      DCmdArgument<char*>* argument = new DCmdArgument<char*>(
      name, desc,
      "STRING", mandatory, default_value);
-     parser->add_dcmd_option(argument);
+     if (isarg) {
+      parser->add_dcmd_argument(argument);
+     } else {
+      parser->add_dcmd_option(argument);
+     }
    } else if (strcmp(type, "NANOTIME") == 0) {
      DCmdArgument<NanoTimeArgument>* argument = new DCmdArgument<NanoTimeArgument>(
      name, desc,
      "NANOTIME", mandatory, default_value);
-     parser->add_dcmd_option(argument);
+     if (isarg) {
+      parser->add_dcmd_argument(argument);
+     } else {
+      parser->add_dcmd_option(argument);
+     }
    } else if (strcmp(type, "JLONG") == 0) {
      DCmdArgument<jlong>* argument = new DCmdArgument<jlong>(
      name, desc,
      "JLONG", mandatory, default_value);
-     parser->add_dcmd_option(argument);
+     if (isarg) {
+      parser->add_dcmd_argument(argument);
+     } else {
+      parser->add_dcmd_option(argument);
+     }
    } else if (strcmp(type, "BOOLEAN") == 0) {
      DCmdArgument<bool>* argument = new DCmdArgument<bool>(
      name, desc,
      "BOOLEAN", mandatory, default_value);
-     parser->add_dcmd_option(argument);
+     if (isarg) {
+      parser->add_dcmd_argument(argument);
+     } else {
+      parser->add_dcmd_option(argument);
+     }
    } else if (strcmp(type, "MEMORYSIZE") == 0) {
      DCmdArgument<MemorySizeArgument>* argument = new DCmdArgument<MemorySizeArgument>(
      name, desc,
      "MEMORY SIZE", mandatory, default_value);
-     parser->add_dcmd_option(argument);
+     if (isarg) {
+      parser->add_dcmd_argument(argument);
+     } else {
+      parser->add_dcmd_option(argument);
+     }
    } else if (strcmp(type, "STRINGARRAY") == 0) {
      DCmdArgument<StringArrayArgument*>* argument = new DCmdArgument<StringArrayArgument*>(
      name, desc,
      "STRING SET", mandatory);
-     parser->add_dcmd_option(argument);
+     if (isarg) {
+      parser->add_dcmd_argument(argument);
+     } else {
+      parser->add_dcmd_option(argument);
+     }
    }
 }
 
@@ -111,11 +136,12 @@ static void fill_in_parser(DCmdParser* parser, oop argument)
  * { name, value, name, value ... }
  * This can then be checked from java.
  */
-WB_ENTRY(jobjectArray, WB_ParseCommandLine(JNIEnv* env, jobject o, jstring j_cmdline, jobjectArray arguments))
+WB_ENTRY(jobjectArray, WB_ParseCommandLine(JNIEnv* env, jobject o, jstring j_cmdline, jchar j_delim, jobjectArray arguments))
   ResourceMark rm;
   DCmdParser parser;
 
   const char* c_cmdline = java_lang_String::as_utf8_string(JNIHandles::resolve(j_cmdline));
+  const char c_delim = j_delim & 0xff;
   objArrayOop argumentArray = objArrayOop(JNIHandles::resolve_non_null(arguments));
   objArrayHandle argumentArray_ah(THREAD, argumentArray);
 
@@ -127,20 +153,29 @@ WB_ENTRY(jobjectArray, WB_ParseCommandLine(JNIEnv* env, jobject o, jstring j_cmd
   }
 
   CmdLine cmdline(c_cmdline, strlen(c_cmdline), true);
-  parser.parse(&cmdline,',',CHECK_NULL);
+  parser.parse(&cmdline,c_delim,CHECK_NULL);
 
   Klass* k = SystemDictionary::Object_klass();
   objArrayOop returnvalue_array = oopFactory::new_objArray(k, parser.num_arguments() * 2, CHECK_NULL);
   objArrayHandle returnvalue_array_ah(THREAD, returnvalue_array);
 
   GrowableArray<const char *>*parsedArgNames = parser.argument_name_array();
+  GenDCmdArgument* arglist = parser.arguments_list();
 
   for (int i = 0; i < parser.num_arguments(); i++) {
     oop parsedName = java_lang_String::create_oop_from_str(parsedArgNames->at(i), CHECK_NULL);
     returnvalue_array_ah->obj_at_put(i*2, parsedName);
     GenDCmdArgument* arg = parser.lookup_dcmd_option(parsedArgNames->at(i), strlen(parsedArgNames->at(i)));
+    if (!arg) {
+      arg = arglist;
+      arglist = arglist->next();
+    }
     char buf[VALUE_MAXLEN];
-    arg->value_as_str(buf, sizeof(buf));
+    if (arg) {
+      arg->value_as_str(buf, sizeof(buf));
+    } else {
+      sprintf(buf, "<null>");
+    }
     oop parsedValue = java_lang_String::create_oop_from_str(buf, CHECK_NULL);
     returnvalue_array_ah->obj_at_put(i*2+1, parsedValue);
   }
diff --git a/hotspot/src/share/vm/prims/wbtestmethods/parserTests.hpp b/hotspot/src/share/vm/prims/wbtestmethods/parserTests.hpp
index a6ff1bd980d..e791225a43f 100644
--- a/hotspot/src/share/vm/prims/wbtestmethods/parserTests.hpp
+++ b/hotspot/src/share/vm/prims/wbtestmethods/parserTests.hpp
@@ -27,6 +27,6 @@
 #include "prims/jni.h"
 #include "prims/whitebox.hpp"
 
-WB_METHOD_DECLARE(jobjectArray) WB_ParseCommandLine(JNIEnv* env, jobject o, jstring args, jobjectArray arguments);
+WB_METHOD_DECLARE(jobjectArray) WB_ParseCommandLine(JNIEnv* env, jobject o, jstring args, jchar delim, jobjectArray arguments);
 
 #endif //SHARE_VM_PRIMS_WBTESTMETHODS_PARSERTESTS_H
diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp
index 0d7782bcf93..e8afcc9461e 100644
--- a/hotspot/src/share/vm/prims/whitebox.cpp
+++ b/hotspot/src/share/vm/prims/whitebox.cpp
@@ -1127,7 +1127,7 @@ static JNINativeMethod methods[] = {
   {CC"getVMPageSize",      CC"()I",                   (void*)&WB_GetVMPageSize     },
   {CC"isClassAlive0",      CC"(Ljava/lang/String;)Z", (void*)&WB_IsClassAlive      },
   {CC"parseCommandLine",
-      CC"(Ljava/lang/String;[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
+      CC"(Ljava/lang/String;C[Lsun/hotspot/parser/DiagnosticCommand;)[Ljava/lang/Object;",
       (void*) &WB_ParseCommandLine
   },
   {CC"addToBootstrapClassLoaderSearch", CC"(Ljava/lang/String;)V",
diff --git a/hotspot/src/share/vm/services/diagnosticFramework.cpp b/hotspot/src/share/vm/services/diagnosticFramework.cpp
index dcb67d36c3b..870e6405c5b 100644
--- a/hotspot/src/share/vm/services/diagnosticFramework.cpp
+++ b/hotspot/src/share/vm/services/diagnosticFramework.cpp
@@ -60,16 +60,15 @@ CmdLine::CmdLine(const char* line, size_t len, bool no_command_name) {
 
 bool DCmdArgIter::next(TRAPS) {
   if (_len == 0) return false;
-  // skipping spaces
+  // skipping delimiters
   while (_cursor < _len - 1 && _buffer[_cursor] == _delim) {
     _cursor++;
   }
   // handling end of command line
-  if (_cursor >= _len - 1) {
-    _cursor = _len - 1;
-    _key_addr = &_buffer[_len - 1];
+  if (_cursor == _len - 1 && _buffer[_cursor] == _delim) {
+    _key_addr = &_buffer[_cursor];
     _key_len = 0;
-    _value_addr = &_buffer[_len - 1];
+    _value_addr = &_buffer[_cursor];
     _value_len = 0;
     return false;
   }
diff --git a/hotspot/test/serviceability/ParserTest.java b/hotspot/test/serviceability/ParserTest.java
index 264b25c89bf..5a0f488f0d9 100644
--- a/hotspot/test/serviceability/ParserTest.java
+++ b/hotspot/test/serviceability/ParserTest.java
@@ -48,6 +48,7 @@ public class ParserTest {
         testBool();
         testQuotes();
         testMemorySize();
+        testSingleLetterArg();
     }
 
     public static void main(String... args) throws Exception  {
@@ -99,7 +100,7 @@ public class ParserTest {
                 false, "0");
         DiagnosticCommand[] args = {arg};
 
-        wb.parseCommandLine(name + "=10", args);
+        wb.parseCommandLine(name + "=10", ',', args);
         parse(name, "10", name + "=10", args);
         parse(name, "-5", name + "=-5", args);
 
@@ -149,6 +150,15 @@ public class ParserTest {
         parse(name, "Recording 1", "\"" + name + "\"" + "=\"Recording 1\",arg=value", args);
     }
 
+    public void testSingleLetterArg() throws Exception {
+        DiagnosticCommand[] args = new DiagnosticCommand[]{
+            new DiagnosticCommand("flag", "desc", DiagnosticArgumentType.STRING, true, false, null),
+            new DiagnosticCommand("value", "desc", DiagnosticArgumentType.STRING, true, false, null)
+        };
+        parse("flag", "flag", "flag v", ' ', args);
+        parse("value", "v", "flag v", ' ', args);
+    }
+
     public void testMemorySize() throws Exception {
         String name = "name";
         String defaultValue = "1024";
@@ -176,9 +186,13 @@ public class ParserTest {
 
     public void parse(String searchName, String expectedValue,
             String cmdLine, DiagnosticCommand[] argumentTypes) throws Exception {
+        parse(searchName, expectedValue, cmdLine, ',', argumentTypes);
+    }
+    public void parse(String searchName, String expectedValue,
+            String cmdLine, char delim, DiagnosticCommand[] argumentTypes) throws Exception {
         //parseCommandLine will return an object array that looks like
         //{<name of parsed object>, <of parsed object> ... }
-        Object[] res = wb.parseCommandLine(cmdLine, argumentTypes);
+        Object[] res = wb.parseCommandLine(cmdLine, delim, argumentTypes);
         for (int i = 0; i < res.length-1; i+=2) {
             String parsedName = (String) res[i];
             if (searchName.equals(parsedName)) {
@@ -196,8 +210,11 @@ public class ParserTest {
     }
 
     private void shouldFail(String argument, DiagnosticCommand[] argumentTypes) throws Exception {
+        shouldFail(argument, ',', argumentTypes);
+    }
+    private void shouldFail(String argument, char delim, DiagnosticCommand[] argumentTypes) throws Exception {
         try {
-            wb.parseCommandLine(argument, argumentTypes);
+            wb.parseCommandLine(argument, delim, argumentTypes);
             throw new Exception("Parser accepted argument: " + argument);
         } catch (IllegalArgumentException e) {
             //expected
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
index 0ccdb9b81cb..f36f5ec5762 100644
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
@@ -94,7 +94,7 @@ public class WhiteBox {
   public native boolean g1IsHumongous(Object o);
   public native long    g1NumFreeRegions();
   public native int     g1RegionSize();
-  public native Object[]    parseCommandLine(String commandline, DiagnosticCommand[] args);
+  public native Object[]    parseCommandLine(String commandline, char delim, DiagnosticCommand[] args);
 
   // NMT
   public native long NMTMalloc(long size);
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/parser/DiagnosticCommand.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/parser/DiagnosticCommand.java
index ad4ebcc73e9..11a0c2b4e1b 100644
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/parser/DiagnosticCommand.java
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/parser/DiagnosticCommand.java
@@ -34,14 +34,21 @@ public class DiagnosticCommand {
     private DiagnosticArgumentType type;
     private boolean mandatory;
     private String defaultValue;
+    private boolean argument;
 
     public DiagnosticCommand(String name, String desc, DiagnosticArgumentType type,
             boolean mandatory, String defaultValue) {
+        this(name, desc, type, false, mandatory, defaultValue);
+    }
+
+    public DiagnosticCommand(String name, String desc, DiagnosticArgumentType type,
+            boolean argument, boolean mandatory, String defaultValue) {
         this.name = name;
         this.desc = desc;
         this.type = type;
         this.mandatory = mandatory;
         this.defaultValue = defaultValue;
+        this.argument = argument;
     }
 
     public String getName() {
@@ -60,6 +67,10 @@ public class DiagnosticCommand {
         return mandatory;
     }
 
+    public boolean isArgument() {
+        return argument;
+    }
+
     public String getDefaultValue() {
         return defaultValue;
     }

From 4e55928fafb843ab864dcffbc47369507c419579 Mon Sep 17 00:00:00 2001
From: Tatiana Pivovarova <tatiana.pivovarova@oracle.com>
Date: Fri, 28 Nov 2014 19:42:10 +0300
Subject: [PATCH 181/299] 8064953: Asserts.assert* should print values

Reviewed-by: sla, dholmes, iignatyev
---
 .../com/oracle/java/testlibrary/Asserts.java  | 34 +++++++++----------
 1 file changed, 16 insertions(+), 18 deletions(-)

diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Asserts.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Asserts.java
index 176e883546b..6e15ea23b3b 100644
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Asserts.java
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Asserts.java
@@ -68,8 +68,7 @@ public class Asserts {
      * @see #assertLessThan(T, T, String)
      */
     public static <T extends Comparable<T>> void assertLessThan(T lhs, T rhs) {
-        String msg = "Expected that " + format(lhs) + " < " + format(rhs);
-        assertLessThan(lhs, rhs, msg);
+        assertLessThan(lhs, rhs, null);
     }
 
     /**
@@ -81,7 +80,7 @@ public class Asserts {
      * @throws RuntimeException if the assertion isn't valid.
      */
     public static <T extends Comparable<T>>void assertLessThan(T lhs, T rhs, String msg) {
-        assertTrue(compare(lhs, rhs, msg) < 0, msg);
+        assertTrue(compare(lhs, rhs, msg) < 0, getMessage(lhs, rhs, "<", msg));
     }
 
     /**
@@ -108,8 +107,7 @@ public class Asserts {
      * @see #assertLessThanOrEqual(T, T, String)
      */
     public static <T extends Comparable<T>> void assertLessThanOrEqual(T lhs, T rhs) {
-        String msg = "Expected that " + format(lhs) + " <= " + format(rhs);
-        assertLessThanOrEqual(lhs, rhs, msg);
+        assertLessThanOrEqual(lhs, rhs, null);
     }
 
     /**
@@ -121,7 +119,7 @@ public class Asserts {
      * @throws RuntimeException if the assertion isn't valid.
      */
     public static <T extends Comparable<T>> void assertLessThanOrEqual(T lhs, T rhs, String msg) {
-        assertTrue(compare(lhs, rhs, msg) <= 0, msg);
+        assertTrue(compare(lhs, rhs, msg) <= 0, getMessage(lhs, rhs, "<=", msg));
     }
 
     /**
@@ -148,8 +146,7 @@ public class Asserts {
      * @see #assertEquals(T, T, String)
      */
     public static void assertEquals(Object lhs, Object rhs) {
-        String msg = "Expected " + format(lhs) + " to equal " + format(rhs);
-        assertEquals(lhs, rhs, msg);
+        assertEquals(lhs, rhs, null);
     }
 
     /**
@@ -166,7 +163,7 @@ public class Asserts {
                 error(msg);
             }
         } else {
-            assertTrue(lhs.equals(rhs), msg);
+            assertTrue(lhs.equals(rhs), getMessage(lhs, rhs, "==", msg));
         }
     }
 
@@ -194,8 +191,7 @@ public class Asserts {
      * @see #assertGreaterThanOrEqual(T, T, String)
      */
     public static <T extends Comparable<T>> void assertGreaterThanOrEqual(T lhs, T rhs) {
-        String msg = "Expected that " + format(lhs) + " >= " + format(rhs);
-        assertGreaterThanOrEqual(lhs, rhs, msg);
+        assertGreaterThanOrEqual(lhs, rhs, null);
     }
 
     /**
@@ -207,7 +203,7 @@ public class Asserts {
      * @throws RuntimeException if the assertion isn't valid.
      */
     public static <T extends Comparable<T>> void assertGreaterThanOrEqual(T lhs, T rhs, String msg) {
-        assertTrue(compare(lhs, rhs, msg) >= 0, msg);
+        assertTrue(compare(lhs, rhs, msg) >= 0, getMessage(lhs, rhs, ">=", msg));
     }
 
     /**
@@ -234,8 +230,7 @@ public class Asserts {
      * @see #assertGreaterThan(T, T, String)
      */
     public static <T extends Comparable<T>> void assertGreaterThan(T lhs, T rhs) {
-        String msg = "Expected that " + format(lhs) + " > " + format(rhs);
-        assertGreaterThan(lhs, rhs, msg);
+        assertGreaterThan(lhs, rhs, null);
     }
 
     /**
@@ -247,7 +242,7 @@ public class Asserts {
      * @throws RuntimeException if the assertion isn't valid.
      */
     public static <T extends Comparable<T>> void assertGreaterThan(T lhs, T rhs, String msg) {
-        assertTrue(compare(lhs, rhs, msg) > 0, msg);
+        assertTrue(compare(lhs, rhs, msg) > 0, getMessage(lhs, rhs, ">", msg));
     }
 
     /**
@@ -274,8 +269,7 @@ public class Asserts {
      * @see #assertNotEquals(T, T, String)
      */
     public static void assertNotEquals(Object lhs, Object rhs) {
-        String msg = "Expected " + format(lhs) + " to not equal " + format(rhs);
-        assertNotEquals(lhs, rhs, msg);
+        assertNotEquals(lhs, rhs, null);
     }
 
     /**
@@ -292,7 +286,7 @@ public class Asserts {
                 error(msg);
             }
         } else {
-            assertFalse(lhs.equals(rhs), msg);
+            assertFalse(lhs.equals(rhs), getMessage(lhs, rhs,"!=", msg));
         }
     }
 
@@ -450,4 +444,8 @@ public class Asserts {
         throw new RuntimeException(msg);
     }
 
+    private static String getMessage(Object lhs, Object rhs, String op, String msg) {
+        return (msg == null ? "" : msg + " ") + "(assert failed: " + format(lhs) + " " + op +  " " + format(rhs) + ")";
+    }
 }
+

From 23b769e30e4990c6a5d73ab003769cf51336283c Mon Sep 17 00:00:00 2001
From: Filipp Zhinkin <fzhinkin@openjdk.org>
Date: Fri, 28 Nov 2014 19:49:16 +0300
Subject: [PATCH 182/299] 8058846: c.o.j.t.Platform::isX86 and isX64 may
 simultaneously return true

Reviewed-by: iveresov, iignatyev
---
 .../com/oracle/java/testlibrary/Platform.java |  20 +--
 ...stMutuallyExclusivePlatformPredicates.java | 134 ++++++++++++++++++
 2 files changed, 146 insertions(+), 8 deletions(-)
 create mode 100644 hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java

diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java
index 0211514e532..854a67beaf4 100644
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java
@@ -23,6 +23,8 @@
 
 package com.oracle.java.testlibrary;
 
+import java.util.regex.Pattern;
+
 public class Platform {
     private static final String osName      = System.getProperty("os.name");
     private static final String dataModel   = System.getProperty("sun.arch.data.model");
@@ -94,29 +96,31 @@ public class Platform {
 
     // Returns true for sparc and sparcv9.
     public static boolean isSparc() {
-        return isArch("sparc");
+        return isArch("sparc.*");
     }
 
     public static boolean isARM() {
-        return isArch("arm");
+        return isArch("arm.*");
     }
 
     public static boolean isPPC() {
-        return isArch("ppc");
+        return isArch("ppc.*");
     }
 
     public static boolean isX86() {
-        // On Linux it's 'i386', Windows 'x86'
-        return (isArch("i386") || isArch("x86"));
+        // On Linux it's 'i386', Windows 'x86' without '_64' suffix.
+        return isArch("(i386)|(x86(?!_64))");
     }
 
     public static boolean isX64() {
         // On OSX it's 'x86_64' and on other (Linux, Windows and Solaris) platforms it's 'amd64'
-        return (isArch("amd64") || isArch("x86_64"));
+        return isArch("(amd64)|(x86_64)");
     }
 
-    private static boolean isArch(String archname) {
-        return osArch.toLowerCase().startsWith(archname.toLowerCase());
+    private static boolean isArch(String archnameRE) {
+        return Pattern.compile(archnameRE, Pattern.CASE_INSENSITIVE)
+                .matcher(osArch)
+                .matches();
     }
 
     public static String getOsArch() {
diff --git a/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java
new file mode 100644
index 00000000000..4735d5dbfb2
--- /dev/null
+++ b/hotspot/test/testlibrary_tests/TestMutuallyExclusivePlatformPredicates.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2014, 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 com.oracle.java.testlibrary.Asserts;
+import com.oracle.java.testlibrary.Platform;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @test
+ * @summary Verify that for each group of mutually exclusive predicates defined
+ *          in com.oracle.java.testlibrary.Platform one and only one predicate
+ *          evaluates to true.
+ * @library /testlibrary
+ * @run main TestMutuallyExclusivePlatformPredicates
+ */
+public class TestMutuallyExclusivePlatformPredicates {
+    private static enum MethodGroup {
+        ARCH("isARM", "isPPC", "isSparc", "isX86", "isX64"),
+        BITNESS("is32bit", "is64bit"),
+        OS("isLinux", "isSolaris", "isWindows", "isOSX"),
+        VM_TYPE("isClient", "isServer", "isGraal", "isMinimal"),
+        IGNORED("isEmbedded", "isDebugBuild");
+
+        public final List<String> methodNames;
+
+        private MethodGroup(String... methodNames) {
+            this.methodNames = Collections.unmodifiableList(
+                    Arrays.asList(methodNames));
+        }
+    }
+
+    public static void main(String args[]) {
+        EnumSet<MethodGroup> notIgnoredMethodGroups
+                = EnumSet.complementOf(EnumSet.of(MethodGroup.IGNORED));
+
+        notIgnoredMethodGroups.forEach(
+                TestMutuallyExclusivePlatformPredicates::verifyPredicates);
+
+        TestMutuallyExclusivePlatformPredicates.verifyCoverage();
+    }
+
+    /**
+     * Verifies that one and only one predicate method defined in
+     * {@link com.oracle.java.testlibrary.Platform}, whose name included into
+     * methodGroup will return {@code true}.
+     * @param methodGroup The group of methods that should be tested.
+     */
+    private static void verifyPredicates(MethodGroup methodGroup) {
+        System.out.println("Verifying method group: " + methodGroup.name());
+        long truePredicatesCount = methodGroup.methodNames.stream()
+                .filter(TestMutuallyExclusivePlatformPredicates
+                        ::evaluatePredicate)
+                .count();
+
+        Asserts.assertEQ(truePredicatesCount, 1L, String.format(
+                "Only one predicate from group %s should be evaluated to true "
+                        + "(Actually %d predicates were evaluated to true).",
+                methodGroup.name(), truePredicatesCount));
+    }
+
+    /**
+     * Verifies that all predicates defined in
+     * {@link com.oracle.java.testlibrary.Platform} were either tested or
+     * explicitly ignored.
+     */
+    private static void verifyCoverage() {
+        Set<String> allMethods = new HashSet<>();
+        for (MethodGroup group : MethodGroup.values()) {
+            allMethods.addAll(group.methodNames);
+        }
+
+        for (Method m : Platform.class.getMethods()) {
+            if (m.getParameterCount() == 0
+                    && m.getReturnType() == boolean.class) {
+                Asserts.assertTrue(allMethods.contains(m.getName()),
+                        "All Platform's methods with signature '():Z' should "
+                                + "be tested ");
+            }
+        }
+    }
+
+    /**
+     * Evaluates predicate method with name {@code name} defined in
+     * {@link com.oracle.java.testlibrary.Platform}.
+     *
+     * @param name The name of a predicate to be evaluated.
+     * @return evaluated predicate's value.
+     * @throws java.lang.Error if predicate is not defined or could not be
+     *                         evaluated.
+     */
+    private static boolean evaluatePredicate(String name) {
+        try {
+            System.out.printf("Trying to evaluate predicate with name %s%n",
+                    name);
+            boolean value
+                    = (Boolean) Platform.class.getMethod(name).invoke(null);
+            System.out.printf("Predicate evaluated to: %s%n", value);
+            return value;
+        } catch (NoSuchMethodException e) {
+            throw new Error("Predicate with name " + name
+                    + " is not defined in " + Platform.class.getName(), e);
+        } catch (IllegalAccessException | InvocationTargetException e) {
+            throw new Error("Unable to evaluate predicate " + name, e);
+        }
+    }
+}

From db7c757726dddbb4342b2f2969f0b4cca12eabf6 Mon Sep 17 00:00:00 2001
From: Lance Andersen <lancea@openjdk.org>
Date: Sat, 29 Nov 2014 11:14:20 -0500
Subject: [PATCH 183/299] 8066188: BaseRowSet default value for escape
 processing is not correct

Reviewed-by: alanb
---
 .../share/classes/javax/sql/rowset/BaseRowSet.java            | 2 +-
 jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java
index 2998715e3c8..7f65c0eed9c 100644
--- a/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java
+++ b/jdk/src/java.sql.rowset/share/classes/javax/sql/rowset/BaseRowSet.java
@@ -462,7 +462,7 @@ public abstract class BaseRowSet implements Serializable, Cloneable {
      * <code>false</code> that it is not. The default is <code>true</code>.
      * @serial
      */
-    private boolean escapeProcessing;
+    private boolean escapeProcessing = true;
 
     /**
      * A constant indicating the isolation level of the connection
diff --git a/jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java b/jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java
index e1b5457bda8..8e92f20af33 100644
--- a/jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java
+++ b/jdk/test/javax/sql/testng/test/rowset/BaseRowSetTests.java
@@ -186,11 +186,11 @@ public class BaseRowSetTests extends BaseTest {
     }
 
     /*
-     * Validate that getEscapeProcessing() returns false by default
+     * Validate that getEscapeProcessing() returns true by default
      */
     @Test
     public void test08() throws Exception {
-        assertFalse(brs.getEscapeProcessing());
+        assertTrue(brs.getEscapeProcessing());
     }
 
     /*

From 686e5a0a6f01b439ca2f2ec316c76340a89d9cfb Mon Sep 17 00:00:00 2001
From: Roland Westrelin <roland@openjdk.org>
Date: Mon, 1 Dec 2014 11:59:56 +0100
Subject: [PATCH 184/299] 8064703: crash running specjvm98's javac following
 8060252

Uncommon trap between arraycopy and initialization may leave array initialized

Reviewed-by: kvn, vlivanov, goetz
---
 hotspot/src/share/vm/opto/graphKit.cpp        |  11 +-
 hotspot/src/share/vm/opto/graphKit.hpp        |   3 +-
 hotspot/src/share/vm/opto/library_call.cpp    |  69 ++++-
 .../arraycopy/TestArrayCopyNoInit.java        | 244 ++++++++++++++++++
 4 files changed, 310 insertions(+), 17 deletions(-)
 create mode 100644 hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java

diff --git a/hotspot/src/share/vm/opto/graphKit.cpp b/hotspot/src/share/vm/opto/graphKit.cpp
index eee548e219e..20932a5bd51 100644
--- a/hotspot/src/share/vm/opto/graphKit.cpp
+++ b/hotspot/src/share/vm/opto/graphKit.cpp
@@ -2809,7 +2809,8 @@ Node* GraphKit::maybe_cast_profiled_receiver(Node* not_null_obj,
  */
 Node* GraphKit::maybe_cast_profiled_obj(Node* obj,
                                         ciKlass* type,
-                                        bool not_null) {
+                                        bool not_null,
+                                        SafePointNode* sfpt) {
   // type == NULL if profiling tells us this object is always null
   if (type != NULL) {
     Deoptimization::DeoptReason class_reason = Deoptimization::Reason_speculate_class_check;
@@ -2831,7 +2832,13 @@ Node* GraphKit::maybe_cast_profiled_obj(Node* obj,
       ciKlass* exact_kls = type;
       Node* slow_ctl  = type_check_receiver(exact_obj, exact_kls, 1.0,
                                             &exact_obj);
-      {
+      if (sfpt != NULL) {
+        GraphKit kit(sfpt->jvms());
+        PreserveJVMState pjvms(&kit);
+        kit.set_control(slow_ctl);
+        kit.uncommon_trap(class_reason,
+                          Deoptimization::Action_maybe_recompile);
+      } else {
         PreserveJVMState pjvms(this);
         set_control(slow_ctl);
         uncommon_trap(class_reason,
diff --git a/hotspot/src/share/vm/opto/graphKit.hpp b/hotspot/src/share/vm/opto/graphKit.hpp
index 41c4032f9c6..22699420cbb 100644
--- a/hotspot/src/share/vm/opto/graphKit.hpp
+++ b/hotspot/src/share/vm/opto/graphKit.hpp
@@ -418,7 +418,8 @@ class GraphKit : public Phase {
   // Cast obj to type and emit guard unless we had too many traps here already
   Node* maybe_cast_profiled_obj(Node* obj,
                                 ciKlass* type,
-                                bool not_null = false);
+                                bool not_null = false,
+                                SafePointNode* sfpt = NULL);
 
   // Cast obj to not-null on this path
   Node* cast_not_null(Node* obj, bool do_replace_in_map = true);
diff --git a/hotspot/src/share/vm/opto/library_call.cpp b/hotspot/src/share/vm/opto/library_call.cpp
index aad0a78cb64..fbe2dbdfb70 100644
--- a/hotspot/src/share/vm/opto/library_call.cpp
+++ b/hotspot/src/share/vm/opto/library_call.cpp
@@ -4697,10 +4697,6 @@ bool LibraryCallKit::inline_arraycopy() {
   Node* dest_offset = argument(3);  // type: int
   Node* length      = argument(4);  // type: int
 
-  // Check for allocation before we add nodes that would confuse
-  // tightly_coupled_allocation()
-  AllocateArrayNode* alloc = tightly_coupled_allocation(dest, NULL);
-
   // The following tests must be performed
   // (1) src and dest are arrays.
   // (2) src and dest arrays must have elements of the same BasicType
@@ -4717,6 +4713,36 @@ bool LibraryCallKit::inline_arraycopy() {
   src  = null_check(src,  T_ARRAY);
   dest = null_check(dest, T_ARRAY);
 
+  // Check for allocation before we add nodes that would confuse
+  // tightly_coupled_allocation()
+  AllocateArrayNode* alloc = tightly_coupled_allocation(dest, NULL);
+
+  SafePointNode* sfpt = NULL;
+  if (alloc != NULL) {
+    // The JVM state for uncommon traps between the allocation and
+    // arraycopy is set to the state before the allocation: if the
+    // initialization is performed by the array copy, we don't want to
+    // go back to the interpreter with an unitialized array.
+    JVMState* old_jvms = alloc->jvms();
+    JVMState* jvms = old_jvms->clone_shallow(C);
+    uint size = alloc->req();
+    sfpt = new SafePointNode(size, jvms);
+    jvms->set_map(sfpt);
+    for (uint i = 0; i < size; i++) {
+      sfpt->init_req(i, alloc->in(i));
+    }
+    // re-push array length for deoptimization
+    sfpt->ins_req(jvms->stkoff() + jvms->sp(), alloc->in(AllocateNode::ALength));
+    jvms->set_sp(jvms->sp()+1);
+    jvms->set_monoff(jvms->monoff()+1);
+    jvms->set_scloff(jvms->scloff()+1);
+    jvms->set_endoff(jvms->endoff()+1);
+    jvms->set_should_reexecute(true);
+
+    sfpt->set_i_o(map()->i_o());
+    sfpt->set_memory(map()->memory());
+  }
+
   bool notest = false;
 
   const Type* src_type  = _gvn.type(src);
@@ -4762,14 +4788,14 @@ bool LibraryCallKit::inline_arraycopy() {
     if (could_have_src && could_have_dest) {
       // This is going to pay off so emit the required guards
       if (!has_src) {
-        src = maybe_cast_profiled_obj(src, src_k);
+        src = maybe_cast_profiled_obj(src, src_k, true, sfpt);
         src_type  = _gvn.type(src);
         top_src  = src_type->isa_aryptr();
         has_src = (top_src != NULL && top_src->klass() != NULL);
         src_spec = true;
       }
       if (!has_dest) {
-        dest = maybe_cast_profiled_obj(dest, dest_k);
+        dest = maybe_cast_profiled_obj(dest, dest_k, true);
         dest_type  = _gvn.type(dest);
         top_dest  = dest_type->isa_aryptr();
         has_dest = (top_dest != NULL && top_dest->klass() != NULL);
@@ -4810,10 +4836,10 @@ bool LibraryCallKit::inline_arraycopy() {
       if (could_have_src && could_have_dest) {
         // If we can have both exact types, emit the missing guards
         if (could_have_src && !src_spec) {
-          src = maybe_cast_profiled_obj(src, src_k);
+          src = maybe_cast_profiled_obj(src, src_k, true, sfpt);
         }
         if (could_have_dest && !dest_spec) {
-          dest = maybe_cast_profiled_obj(dest, dest_k);
+          dest = maybe_cast_profiled_obj(dest, dest_k, true);
         }
       }
     }
@@ -4855,13 +4881,28 @@ bool LibraryCallKit::inline_arraycopy() {
     Node* not_subtype_ctrl = gen_subtype_check(src_klass, dest_klass);
 
     if (not_subtype_ctrl != top()) {
-      PreserveJVMState pjvms(this);
-      set_control(not_subtype_ctrl);
-      uncommon_trap(Deoptimization::Reason_intrinsic,
-                    Deoptimization::Action_make_not_entrant);
-      assert(stopped(), "Should be stopped");
+      if (sfpt != NULL) {
+        GraphKit kit(sfpt->jvms());
+        PreserveJVMState pjvms(&kit);
+        kit.set_control(not_subtype_ctrl);
+        kit.uncommon_trap(Deoptimization::Reason_intrinsic,
+                          Deoptimization::Action_make_not_entrant);
+        assert(kit.stopped(), "Should be stopped");
+      } else {
+        PreserveJVMState pjvms(this);
+        set_control(not_subtype_ctrl);
+        uncommon_trap(Deoptimization::Reason_intrinsic,
+                      Deoptimization::Action_make_not_entrant);
+        assert(stopped(), "Should be stopped");
+      }
     }
-    {
+    if (sfpt != NULL) {
+      GraphKit kit(sfpt->jvms());
+      kit.set_control(_gvn.transform(slow_region));
+      kit.uncommon_trap(Deoptimization::Reason_intrinsic,
+                        Deoptimization::Action_make_not_entrant);
+      assert(kit.stopped(), "Should be stopped");
+    } else {
       PreserveJVMState pjvms(this);
       set_control(_gvn.transform(slow_region));
       uncommon_trap(Deoptimization::Reason_intrinsic,
diff --git a/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java
new file mode 100644
index 00000000000..d820eb7fc67
--- /dev/null
+++ b/hotspot/test/compiler/arraycopy/TestArrayCopyNoInit.java
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 2014, 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 8064703
+ * @summary Deoptimization between array allocation and arraycopy may result in non initialized array
+ * @run main/othervm -XX:-BackgroundCompilation -XX:-UseOnStackReplacement -XX:TypeProfileLevel=020 TestArrayCopyNoInit
+ *
+ */
+
+import java.lang.invoke.*;
+
+public class TestArrayCopyNoInit {
+
+    static int[] m1(int[] src) {
+        int[] dest = new int[10];
+        try {
+            System.arraycopy(src, 0, dest, 0, 10);
+        } catch (NullPointerException npe) {
+        }
+        return dest;
+    }
+
+    static int[] m2(Object src, boolean flag) {
+        Class tmp = src.getClass();
+        if (flag) {
+            return null;
+        }
+        int[] dest = new int[10];
+        try {
+            System.arraycopy(src, 0, dest, 0, 10);
+        } catch (ArrayStoreException npe) {
+        }
+        return dest;
+    }
+
+    static int[] m3(int[] src, int src_offset) {
+        int tmp = src[0];
+        int[] dest = new int[10];
+        try {
+            System.arraycopy(src, src_offset, dest, 0, 10);
+        } catch (IndexOutOfBoundsException npe) {
+        }
+        return dest;
+    }
+
+    static int[] m4(int[] src, int length) {
+        int tmp = src[0];
+        int[] dest = new int[10];
+        try {
+            System.arraycopy(src, 0, dest, 0, length);
+        } catch (IndexOutOfBoundsException npe) {
+        }
+        return dest;
+    }
+
+    static TestArrayCopyNoInit[] m5(Object[] src) {
+        Object tmp = src[0];
+        TestArrayCopyNoInit[] dest = new TestArrayCopyNoInit[10];
+        System.arraycopy(src, 0, dest, 0, 0);
+        return dest;
+    }
+
+    static class A {
+    }
+
+    static class B extends A {
+    }
+
+    static class C extends B {
+    }
+
+    static class D extends C {
+    }
+
+    static class E extends D {
+    }
+
+    static class F extends E {
+    }
+
+    static class G extends F {
+    }
+
+    static class H extends G {
+    }
+
+    static class I extends H {
+    }
+
+    static H[] m6(Object[] src) {
+        Object tmp = src[0];
+        H[] dest = new H[10];
+        System.arraycopy(src, 0, dest, 0, 0);
+        return dest;
+    }
+
+    static Object m7_src(Object src) {
+        return src;
+    }
+
+    static int[] m7(Object src, boolean flag) {
+        Class tmp = src.getClass();
+        if (flag) {
+            return null;
+        }
+        src = m7_src(src);
+        int[] dest = new int[10];
+        try {
+            System.arraycopy(src, 0, dest, 0, 10);
+        } catch (ArrayStoreException npe) {
+        }
+        return dest;
+    }
+
+    static public void main(String[] args) throws Throwable {
+        boolean success = true;
+        int[] src = new int[10];
+        TestArrayCopyNoInit[] src2 = new TestArrayCopyNoInit[10];
+        int[] res = null;
+        TestArrayCopyNoInit[] res2 = null;
+        Object src_obj = new Object();
+
+        for (int i = 0; i < 20000; i++) {
+            m1(src);
+        }
+
+        res = m1(null);
+        for (int i = 0; i < res.length; i++) {
+            if (res[i] != 0) {
+                success = false;
+                System.out.println("Uninitialized array following NPE");
+                break;
+            }
+        }
+
+        for (int i = 0; i < 20000; i++) {
+            if ((i%2) == 0) {
+                m2(src, false);
+            } else {
+                m2(src_obj, true);
+            }
+        }
+        res = m2(src_obj, false);
+        for (int i = 0; i < res.length; i++) {
+            if (res[i] != 0) {
+                success = false;
+                System.out.println("Uninitialized array following failed array check");
+                break;
+            }
+        }
+
+        for (int i = 0; i < 20000; i++) {
+            m3(src, 0);
+        }
+        res = m3(src, -1);
+        for (int i = 0; i < res.length; i++) {
+            if (res[i] != 0) {
+                success = false;
+                System.out.println("Uninitialized array following failed src offset check");
+                break;
+            }
+        }
+
+        for (int i = 0; i < 20000; i++) {
+            m4(src, 0);
+        }
+        res = m4(src, -1);
+        for (int i = 0; i < res.length; i++) {
+            if (res[i] != 0) {
+                success = false;
+                System.out.println("Uninitialized array following failed length check");
+                break;
+            }
+        }
+
+        for (int i = 0; i < 20000; i++) {
+            m5(src2);
+        }
+        res2 = m5(new Object[10]);
+        for (int i = 0; i < res2.length; i++) {
+            if (res2[i] != null) {
+                success = false;
+                System.out.println("Uninitialized array following failed type check");
+                break;
+            }
+        }
+
+        H[] src3 = new H[10];
+        I b = new I();
+        for (int i = 0; i < 20000; i++) {
+            m6(src3);
+        }
+        H[] res3 = m6(new Object[10]);
+        for (int i = 0; i < res3.length; i++) {
+            if (res3[i] != null) {
+                success = false;
+                System.out.println("Uninitialized array following failed full type check");
+                break;
+            }
+        }
+
+        for (int i = 0; i < 20000; i++) {
+            if ((i%2) == 0) {
+                m7(src, false);
+            } else {
+                m7(src_obj, true);
+            }
+        }
+        res = m7(src_obj, false);
+        for (int i = 0; i < res.length; i++) {
+            if (res[i] != 0) {
+                success = false;
+                System.out.println("Uninitialized array following failed type check with return value profiling");
+                break;
+            }
+        }
+
+        if (!success) {
+            throw new RuntimeException("Some tests failed");
+        }
+    }
+}

From beb05bda0df684f58c6b83a973b41c2c146e629d Mon Sep 17 00:00:00 2001
From: Andreas Gabrielsson <andreas.gabrielsson@oracle.com>
Date: Mon, 1 Dec 2014 13:17:24 +0100
Subject: [PATCH 185/299] 8066238: AssertionError in parser when syntax errors
 appeared in non finished Blocks

Reviewed-by: hannesw, sundar, lagergren
---
 .../jdk/nashorn/internal/parser/Parser.java   | 17 ++++++--
 nashorn/test/script/basic/JDK-8066238.js      | 43 +++++++++++++++++++
 2 files changed, 56 insertions(+), 4 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8066238.js

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
index 4fa27ce34f4..ed078dfdbf8 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
@@ -2291,9 +2291,14 @@ loop:
         final ParserContextFunctionNode functionNode = createParserContextFunctionNode(getNameNode, getSetToken, FunctionNode.Kind.GETTER, functionLine, Collections.<IdentNode>emptyList());
         lc.push(functionNode);
 
-        final Block functionBody = functionBody(functionNode);
+        Block functionBody;
 
-        lc.pop(functionNode);
+
+        try {
+            functionBody = functionBody(functionNode);
+        } finally {
+            lc.pop(functionNode);
+        }
 
         final FunctionNode  function = createFunctionNode(
                 functionNode,
@@ -2331,9 +2336,13 @@ loop:
         final ParserContextFunctionNode functionNode = createParserContextFunctionNode(setNameNode, getSetToken, FunctionNode.Kind.SETTER, functionLine, parameters);
         lc.push(functionNode);
 
-        final Block functionBody = functionBody(functionNode);
+        Block functionBody;
+        try {
+            functionBody = functionBody(functionNode);
+        } finally {
+            lc.pop(functionNode);
+        }
 
-        lc.pop(functionNode);
 
         final FunctionNode  function = createFunctionNode(
                 functionNode,
diff --git a/nashorn/test/script/basic/JDK-8066238.js b/nashorn/test/script/basic/JDK-8066238.js
new file mode 100644
index 00000000000..3a7ec892b9b
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066238.js
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * Parser should not crash on invalid property function bodies.
+ *
+ * @test
+ * @run
+ */
+try {
+    eval("function f() { L: ({ set prop(){0 = null} }); }");
+} catch (e) {
+    if (!(e instanceof ReferenceError)) {
+        throw e;
+    }
+}
+try {
+    eval("function g() { do ; while({ get x()1-- }); }");
+} catch (e) {
+    if (!(e instanceof ReferenceError)) {
+        throw e;
+    }
+}

From ca3e287e96455dc314395d3e225dcd44ce9760e1 Mon Sep 17 00:00:00 2001
From: Bengt Rutisson <brutisso@openjdk.org>
Date: Tue, 2 Dec 2014 09:51:16 +0100
Subject: [PATCH 186/299] 8065992: Change CMSCollector::_young_gen to be a
 ParNewGeneration*

Reviewed-by: mgerdin, kbarrett
---
 .../concurrentMarkSweepGeneration.cpp         | 43 +++++++++----------
 .../concurrentMarkSweepGeneration.hpp         |  3 +-
 .../concurrentMarkSweepGeneration.inline.hpp  |  6 +--
 .../src/share/vm/memory/genCollectedHeap.cpp  |  5 ++-
 hotspot/src/share/vm/memory/generation.cpp    |  7 ---
 hotspot/src/share/vm/memory/generation.hpp    |  4 --
 6 files changed, 29 insertions(+), 39 deletions(-)

diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
index 3fbdef64ea0..74496abf43c 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
@@ -623,7 +623,8 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
 
   // Support for parallelizing young gen rescan
   GenCollectedHeap* gch = GenCollectedHeap::heap();
-  _young_gen = gch->prev_gen(_cmsGen);
+  assert(gch->prev_gen(_cmsGen)->kind() == Generation::ParNew, "CMS can only be used with ParNew");
+  _young_gen = (ParNewGeneration*)gch->prev_gen(_cmsGen);
   if (gch->supports_inline_contig_alloc()) {
     _top_addr = gch->top_addr();
     _end_addr = gch->end_addr();
@@ -1633,13 +1634,12 @@ void CMSCollector::acquire_control_and_collect(bool full,
   do_compaction_work(clear_all_soft_refs);
 
   // Has the GC time limit been exceeded?
-  DefNewGeneration* young_gen = _young_gen->as_DefNewGeneration();
-  size_t max_eden_size = young_gen->max_capacity() -
-                         young_gen->to()->capacity() -
-                         young_gen->from()->capacity();
+  size_t max_eden_size = _young_gen->max_capacity() -
+                         _young_gen->to()->capacity() -
+                         _young_gen->from()->capacity();
   GCCause::Cause gc_cause = gch->gc_cause();
   size_policy()->check_gc_overhead_limit(_young_gen->used(),
-                                         young_gen->eden()->used(),
+                                         _young_gen->eden()->used(),
                                          _cmsGen->max_capacity(),
                                          max_eden_size,
                                          full,
@@ -1760,10 +1760,9 @@ void CMSCollector::do_compaction_work(bool clear_all_soft_refs) {
 }
 
 void CMSCollector::print_eden_and_survivor_chunk_arrays() {
-  DefNewGeneration* dng = _young_gen->as_DefNewGeneration();
-  ContiguousSpace* eden_space = dng->eden();
-  ContiguousSpace* from_space = dng->from();
-  ContiguousSpace* to_space   = dng->to();
+  ContiguousSpace* eden_space = _young_gen->eden();
+  ContiguousSpace* from_space = _young_gen->from();
+  ContiguousSpace* to_space   = _young_gen->to();
   // Eden
   if (_eden_chunk_array != NULL) {
     gclog_or_tty->print_cr("eden " PTR_FORMAT "-" PTR_FORMAT "-" PTR_FORMAT "(" SIZE_FORMAT ")",
@@ -4086,7 +4085,6 @@ size_t CMSCollector::preclean_work(bool clean_refs, bool clean_survivor) {
   }
 
   if (clean_survivor) {  // preclean the active survivor space(s)
-    DefNewGeneration* dng = _young_gen->as_DefNewGeneration();
     PushAndMarkClosure pam_cl(this, _span, ref_processor(),
                              &_markBitMap, &_modUnionTable,
                              &_markStack, true /* precleaning phase */);
@@ -4099,8 +4097,8 @@ size_t CMSCollector::preclean_work(bool clean_refs, bool clean_survivor) {
     SurvivorSpacePrecleanClosure
       sss_cl(this, _span, &_markBitMap, &_markStack,
              &pam_cl, before_count, CMSYield);
-    dng->from()->object_iterate_careful(&sss_cl);
-    dng->to()->object_iterate_careful(&sss_cl);
+    _young_gen->from()->object_iterate_careful(&sss_cl);
+    _young_gen->to()->object_iterate_careful(&sss_cl);
   }
   MarkRefsIntoAndScanClosure
     mrias_cl(_span, ref_processor(), &_markBitMap, &_modUnionTable,
@@ -4685,10 +4683,10 @@ class RemarkKlassClosure : public KlassClosure {
 };
 
 void CMSParMarkTask::work_on_young_gen_roots(uint worker_id, OopsInGenClosure* cl) {
-  DefNewGeneration* dng = _collector->_young_gen->as_DefNewGeneration();
-  ContiguousSpace* eden_space = dng->eden();
-  ContiguousSpace* from_space = dng->from();
-  ContiguousSpace* to_space   = dng->to();
+  ParNewGeneration* young_gen = _collector->_young_gen;
+  ContiguousSpace* eden_space = young_gen->eden();
+  ContiguousSpace* from_space = young_gen->from();
+  ContiguousSpace* to_space   = young_gen->to();
 
   HeapWord** eca = _collector->_eden_chunk_array;
   size_t     ect = _collector->_eden_chunk_index;
@@ -5157,11 +5155,10 @@ void
 CMSCollector::
 initialize_sequential_subtasks_for_young_gen_rescan(int n_threads) {
   assert(n_threads > 0, "Unexpected n_threads argument");
-  DefNewGeneration* dng = _young_gen->as_DefNewGeneration();
 
   // Eden space
-  if (!dng->eden()->is_empty()) {
-    SequentialSubTasksDone* pst = dng->eden()->par_seq_tasks();
+  if (!_young_gen->eden()->is_empty()) {
+    SequentialSubTasksDone* pst = _young_gen->eden()->par_seq_tasks();
     assert(!pst->valid(), "Clobbering existing data?");
     // Each valid entry in [0, _eden_chunk_index) represents a task.
     size_t n_tasks = _eden_chunk_index + 1;
@@ -5174,14 +5171,14 @@ initialize_sequential_subtasks_for_young_gen_rescan(int n_threads) {
 
   // Merge the survivor plab arrays into _survivor_chunk_array
   if (_survivor_plab_array != NULL) {
-    merge_survivor_plab_arrays(dng->from(), n_threads);
+    merge_survivor_plab_arrays(_young_gen->from(), n_threads);
   } else {
     assert(_survivor_chunk_index == 0, "Error");
   }
 
   // To space
   {
-    SequentialSubTasksDone* pst = dng->to()->par_seq_tasks();
+    SequentialSubTasksDone* pst = _young_gen->to()->par_seq_tasks();
     assert(!pst->valid(), "Clobbering existing data?");
     // Sets the condition for completion of the subtask (how many threads
     // need to finish in order to be done).
@@ -5192,7 +5189,7 @@ initialize_sequential_subtasks_for_young_gen_rescan(int n_threads) {
 
   // From space
   {
-    SequentialSubTasksDone* pst = dng->from()->par_seq_tasks();
+    SequentialSubTasksDone* pst = _young_gen->from()->par_seq_tasks();
     assert(!pst->valid(), "Clobbering existing data?");
     size_t n_tasks = _survivor_chunk_index + 1;
     assert(n_tasks == 1 || _survivor_chunk_array != NULL, "Error");
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
index e54d53d8489..826cfd5def2 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp
@@ -721,7 +721,8 @@ class CMSCollector: public CHeapObj<mtGC> {
 
  private:
   // Support for parallelizing young gen rescan in CMS remark phase
-  Generation* _young_gen;  // the younger gen
+  ParNewGeneration* _young_gen;  // the younger gen
+
   HeapWord** _top_addr;    // ... Top of Eden
   HeapWord** _end_addr;    // ... End of Eden
   Mutex*     _eden_chunk_lock;
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp
index b80830bf234..a76e3a90d06 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp
@@ -29,8 +29,8 @@
 #include "gc_implementation/concurrentMarkSweep/compactibleFreeListSpace.hpp"
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.hpp"
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
+#include "gc_implementation/parNew/parNewGeneration.hpp"
 #include "gc_implementation/shared/gcUtil.hpp"
-#include "memory/defNewGeneration.hpp"
 
 inline void CMSBitMap::clear_all() {
   assert_locked();
@@ -257,11 +257,11 @@ inline bool CMSCollector::should_abort_preclean() const {
 }
 
 inline size_t CMSCollector::get_eden_used() const {
-  return _young_gen->as_DefNewGeneration()->eden()->used();
+  return _young_gen->eden()->used();
 }
 
 inline size_t CMSCollector::get_eden_capacity() const {
-  return _young_gen->as_DefNewGeneration()->eden()->capacity();
+  return _young_gen->eden()->capacity();
 }
 
 inline bool CMSStats::valid() const {
diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
index dd1f512bcc7..4a1a4ad3b4d 100644
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
@@ -182,7 +182,10 @@ void GenCollectedHeap::post_initialize() {
   SharedHeap::post_initialize();
   GenCollectorPolicy *policy = (GenCollectorPolicy *)collector_policy();
   guarantee(policy->is_generation_policy(), "Illegal policy type");
-  DefNewGeneration* def_new_gen = get_gen(0)->as_DefNewGeneration();
+  assert((get_gen(0)->kind() == Generation::DefNew) ||
+         (get_gen(0)->kind() == Generation::ParNew),
+    "Wrong youngest generation type");
+  DefNewGeneration* def_new_gen = (DefNewGeneration*)get_gen(0);
 
   Generation* old_gen = get_gen(1);
   assert(old_gen->kind() == Generation::ConcurrentMarkSweep ||
diff --git a/hotspot/src/share/vm/memory/generation.cpp b/hotspot/src/share/vm/memory/generation.cpp
index 510dadded3e..ebc04268a3a 100644
--- a/hotspot/src/share/vm/memory/generation.cpp
+++ b/hotspot/src/share/vm/memory/generation.cpp
@@ -152,13 +152,6 @@ bool Generation::is_in(const void* p) const {
   return blk.sp != NULL;
 }
 
-DefNewGeneration* Generation::as_DefNewGeneration() {
-  assert((kind() == Generation::DefNew) ||
-         (kind() == Generation::ParNew),
-    "Wrong youngest generation type");
-  return (DefNewGeneration*) this;
-}
-
 Generation* Generation::next_gen() const {
   GenCollectedHeap* gch = GenCollectedHeap::heap();
   int next = level() + 1;
diff --git a/hotspot/src/share/vm/memory/generation.hpp b/hotspot/src/share/vm/memory/generation.hpp
index d0ff35cea06..cc8e63b9527 100644
--- a/hotspot/src/share/vm/memory/generation.hpp
+++ b/hotspot/src/share/vm/memory/generation.hpp
@@ -229,10 +229,6 @@ class Generation: public CHeapObj<mtGC> {
     return _reserved.contains(p);
   }
 
-  // Check that the generation kind is DefNewGeneration or a sub
-  // class of DefNewGeneration and return a DefNewGeneration*
-  DefNewGeneration*  as_DefNewGeneration();
-
   // If some space in the generation contains the given "addr", return a
   // pointer to that space, else return "NULL".
   virtual Space* space_containing(const void* addr) const;

From 5c41d82d7896995f1b55943abb1e00453c1af751 Mon Sep 17 00:00:00 2001
From: Bengt Rutisson <brutisso@openjdk.org>
Date: Mon, 1 Dec 2014 14:37:25 +0100
Subject: [PATCH 187/299] 8065993: Merge OneContigSpaceCardGeneration with
 TenuredGeneration

Reviewed-by: mgerdin, kbarrett
---
 .../sun/jvm/hotspot/memory/Generation.java    |   5 +-
 .../memory/OneContigSpaceCardGeneration.java  |  82 ------
 .../jvm/hotspot/memory/TenuredGeneration.java |  55 +++-
 .../concurrentMarkSweepGeneration.cpp         |   2 +-
 .../concurrentMarkSweepGeneration.inline.hpp  |   1 +
 .../parNew/parNewGeneration.cpp               |   1 -
 .../src/share/vm/memory/cardTableModRefBS.cpp |  13 -
 .../src/share/vm/memory/defNewGeneration.hpp  |   1 -
 .../src/share/vm/memory/genCollectedHeap.cpp  |   1 -
 hotspot/src/share/vm/memory/genMarkSweep.cpp  |   1 -
 hotspot/src/share/vm/memory/generation.cpp    | 250 ------------------
 hotspot/src/share/vm/memory/generation.hpp    | 101 +------
 hotspot/src/share/vm/memory/space.hpp         |   1 -
 .../src/share/vm/memory/tenuredGeneration.cpp | 250 +++++++++++++++++-
 .../src/share/vm/memory/tenuredGeneration.hpp |  89 ++++++-
 ...nline.hpp => tenuredGeneration.inline.hpp} |  24 +-
 .../src/share/vm/precompiled/precompiled.hpp  |   1 -
 hotspot/src/share/vm/runtime/vmStructs.cpp    |  11 +-
 18 files changed, 404 insertions(+), 485 deletions(-)
 delete mode 100644 hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/OneContigSpaceCardGeneration.java
 rename hotspot/src/share/vm/memory/{generation.inline.hpp => tenuredGeneration.inline.hpp} (70%)

diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Generation.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Generation.java
index cc1deb377eb..0da3de8b1ed 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Generation.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/Generation.java
@@ -37,10 +37,7 @@ import sun.jvm.hotspot.runtime.*;
       <ul>
       <li> CardGeneration
         <ul>
-        <li> OneContigSpaceCardGeneration
-          <ul>
-          <li> TenuredGeneration
-          </ul>
+        <li> TenuredGeneration
         </ul>
       <li> DefNewGeneration
       </ul>
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/OneContigSpaceCardGeneration.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/OneContigSpaceCardGeneration.java
deleted file mode 100644
index 13020b14f6f..00000000000
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/OneContigSpaceCardGeneration.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2000, 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.
- *
- */
-
-package sun.jvm.hotspot.memory;
-
-import java.io.*;
-import java.util.*;
-
-import sun.jvm.hotspot.debugger.*;
-import sun.jvm.hotspot.runtime.*;
-import sun.jvm.hotspot.types.*;
-
-/** <P> OneSpaceOldGeneration models a heap of old objects contained
-    in a single contiguous space. </P>
-
-    <P> Garbage collection is performed using mark-compact. </P> */
-
-public abstract class OneContigSpaceCardGeneration extends CardGeneration {
-  private static AddressField theSpaceField;
-
-  static {
-    VM.registerVMInitializedObserver(new Observer() {
-        public void update(Observable o, Object data) {
-          initialize(VM.getVM().getTypeDataBase());
-        }
-      });
-  }
-
-  private static synchronized void initialize(TypeDataBase db) {
-    Type type = db.lookupType("OneContigSpaceCardGeneration");
-
-    theSpaceField = type.getAddressField("_the_space");
-  }
-
-  public OneContigSpaceCardGeneration(Address addr) {
-    super(addr);
-  }
-
-  public ContiguousSpace theSpace() {
-    return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, theSpaceField.getValue(addr));
-  }
-
-  public boolean isIn(Address p) {
-    return theSpace().contains(p);
-  }
-
-  /** Space queries */
-  public long capacity()            { return theSpace().capacity();                                }
-  public long used()                { return theSpace().used();                                    }
-  public long free()                { return theSpace().free();                                    }
-  public long contiguousAvailable() { return theSpace().free() + virtualSpace().uncommittedSize(); }
-
-  public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
-    blk.doSpace(theSpace());
-  }
-
-  public void printOn(PrintStream tty) {
-    tty.print("  old ");
-    theSpace().printOn(tty);
-  }
-}
diff --git a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/TenuredGeneration.java b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/TenuredGeneration.java
index a8964134a6b..50ac92752b8 100644
--- a/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/TenuredGeneration.java
+++ b/hotspot/agent/src/share/classes/sun/jvm/hotspot/memory/TenuredGeneration.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,13 +24,62 @@
 
 package sun.jvm.hotspot.memory;
 
-import sun.jvm.hotspot.debugger.*;
+import java.io.*;
+import java.util.*;
+
+import sun.jvm.hotspot.debugger.*;
+import sun.jvm.hotspot.runtime.*;
+import sun.jvm.hotspot.types.*;
+
+/** <P> TenuredGeneration models a heap of old objects contained
+    in a single contiguous space. </P>
+
+    <P> Garbage collection is performed using mark-compact. </P> */
+
+public class TenuredGeneration extends CardGeneration {
+  private static AddressField theSpaceField;
+
+  static {
+    VM.registerVMInitializedObserver(new Observer() {
+        public void update(Observable o, Object data) {
+          initialize(VM.getVM().getTypeDataBase());
+        }
+      });
+  }
+
+  private static synchronized void initialize(TypeDataBase db) {
+    Type type = db.lookupType("TenuredGeneration");
+
+    theSpaceField = type.getAddressField("_the_space");
+  }
 
-public class TenuredGeneration extends OneContigSpaceCardGeneration {
   public TenuredGeneration(Address addr) {
     super(addr);
   }
 
+  public ContiguousSpace theSpace() {
+    return (ContiguousSpace) VMObjectFactory.newObject(ContiguousSpace.class, theSpaceField.getValue(addr));
+  }
+
+  public boolean isIn(Address p) {
+    return theSpace().contains(p);
+  }
+
+  /** Space queries */
+  public long capacity()            { return theSpace().capacity();                                }
+  public long used()                { return theSpace().used();                                    }
+  public long free()                { return theSpace().free();                                    }
+  public long contiguousAvailable() { return theSpace().free() + virtualSpace().uncommittedSize(); }
+
+  public void spaceIterate(SpaceClosure blk, boolean usedOnly) {
+    blk.doSpace(theSpace());
+  }
+
+  public void printOn(PrintStream tty) {
+    tty.print("  old ");
+    theSpace().printOn(tty);
+  }
+
   public Generation.Name kind() {
     return Generation.Name.MARK_SWEEP_COMPACT;
   }
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
index 74496abf43c..246a11929a6 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
@@ -2812,7 +2812,7 @@ ConcurrentMarkSweepGeneration::expand_and_allocate(size_t word_size,
 }
 
 // YSR: All of this generation expansion/shrinking stuff is an exact copy of
-// OneContigSpaceCardGeneration, which makes me wonder if we should move this
+// TenuredGeneration, which makes me wonder if we should move this
 // to CardGeneration and share it...
 bool ConcurrentMarkSweepGeneration::expand(size_t bytes, size_t expand_bytes) {
   return CardGeneration::expand(bytes, expand_bytes);
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp
index a76e3a90d06..dc76d1bc884 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.inline.hpp
@@ -31,6 +31,7 @@
 #include "gc_implementation/concurrentMarkSweep/concurrentMarkSweepThread.hpp"
 #include "gc_implementation/parNew/parNewGeneration.hpp"
 #include "gc_implementation/shared/gcUtil.hpp"
+#include "memory/genCollectedHeap.hpp"
 
 inline void CMSBitMap::clear_all() {
   assert_locked();
diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
index b87898fadb6..5f828e4a088 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
@@ -39,7 +39,6 @@
 #include "memory/genCollectedHeap.hpp"
 #include "memory/genOopClosures.inline.hpp"
 #include "memory/generation.hpp"
-#include "memory/generation.inline.hpp"
 #include "memory/referencePolicy.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/sharedHeap.hpp"
diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
index 8446d290266..fb67888e4a2 100644
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
@@ -462,19 +462,6 @@ void CardTableModRefBS::non_clean_card_iterate_possibly_parallel(Space* sp,
     // equal to active_workers.  When a different mechanism for shutting
     // off parallelism is used, then active_workers can be used in
     // place of n_par_threads.
-    //  This is an example of a path where n_par_threads is
-    // set to 0 to turn off parallelism.
-    //  [7] CardTableModRefBS::non_clean_card_iterate()
-    //  [8] CardTableRS::younger_refs_in_space_iterate()
-    //  [9] Generation::younger_refs_in_space_iterate()
-    //  [10] OneContigSpaceCardGeneration::younger_refs_iterate()
-    //  [11] CompactingPermGenGen::younger_refs_iterate()
-    //  [12] CardTableRS::younger_refs_iterate()
-    //  [13] SharedHeap::process_strong_roots()
-    //  [14] G1CollectedHeap::verify()
-    //  [15] Universe::verify()
-    //  [16] G1CollectedHeap::do_collection_pause_at_safepoint()
-    //
     int n_threads =  SharedHeap::heap()->n_par_threads();
     bool is_par = n_threads > 0;
     if (is_par) {
diff --git a/hotspot/src/share/vm/memory/defNewGeneration.hpp b/hotspot/src/share/vm/memory/defNewGeneration.hpp
index 48876a82c17..105c029be14 100644
--- a/hotspot/src/share/vm/memory/defNewGeneration.hpp
+++ b/hotspot/src/share/vm/memory/defNewGeneration.hpp
@@ -29,7 +29,6 @@
 #include "gc_implementation/shared/cSpaceCounters.hpp"
 #include "gc_implementation/shared/generationCounters.hpp"
 #include "gc_implementation/shared/copyFailedInfo.hpp"
-#include "memory/generation.inline.hpp"
 #include "utilities/stack.hpp"
 
 class ContiguousSpace;
diff --git a/hotspot/src/share/vm/memory/genCollectedHeap.cpp b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
index 4a1a4ad3b4d..4677975dd5b 100644
--- a/hotspot/src/share/vm/memory/genCollectedHeap.cpp
+++ b/hotspot/src/share/vm/memory/genCollectedHeap.cpp
@@ -36,7 +36,6 @@
 #include "memory/gcLocker.inline.hpp"
 #include "memory/genCollectedHeap.hpp"
 #include "memory/genOopClosures.inline.hpp"
-#include "memory/generation.inline.hpp"
 #include "memory/generationSpec.hpp"
 #include "memory/resourceArea.hpp"
 #include "memory/sharedHeap.hpp"
diff --git a/hotspot/src/share/vm/memory/genMarkSweep.cpp b/hotspot/src/share/vm/memory/genMarkSweep.cpp
index 823b0a196bf..88421227c87 100644
--- a/hotspot/src/share/vm/memory/genMarkSweep.cpp
+++ b/hotspot/src/share/vm/memory/genMarkSweep.cpp
@@ -37,7 +37,6 @@
 #include "memory/genCollectedHeap.hpp"
 #include "memory/genMarkSweep.hpp"
 #include "memory/genOopClosures.inline.hpp"
-#include "memory/generation.inline.hpp"
 #include "memory/modRefBarrierSet.hpp"
 #include "memory/referencePolicy.hpp"
 #include "memory/space.hpp"
diff --git a/hotspot/src/share/vm/memory/generation.cpp b/hotspot/src/share/vm/memory/generation.cpp
index ebc04268a3a..87880cf0e31 100644
--- a/hotspot/src/share/vm/memory/generation.cpp
+++ b/hotspot/src/share/vm/memory/generation.cpp
@@ -36,7 +36,6 @@
 #include "memory/genOopClosures.hpp"
 #include "memory/genOopClosures.inline.hpp"
 #include "memory/generation.hpp"
-#include "memory/generation.inline.hpp"
 #include "memory/space.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/java.hpp"
@@ -603,252 +602,3 @@ void CardGeneration::compute_new_size() {
 // Currently nothing to do.
 void CardGeneration::prepare_for_verify() {}
 
-
-void OneContigSpaceCardGeneration::collect(bool   full,
-                                           bool   clear_all_soft_refs,
-                                           size_t size,
-                                           bool   is_tlab) {
-  GenCollectedHeap* gch = GenCollectedHeap::heap();
-
-  SpecializationStats::clear();
-  // Temporarily expand the span of our ref processor, so
-  // refs discovery is over the entire heap, not just this generation
-  ReferenceProcessorSpanMutator
-    x(ref_processor(), gch->reserved_region());
-
-  STWGCTimer* gc_timer = GenMarkSweep::gc_timer();
-  gc_timer->register_gc_start();
-
-  SerialOldTracer* gc_tracer = GenMarkSweep::gc_tracer();
-  gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
-
-  GenMarkSweep::invoke_at_safepoint(_level, ref_processor(), clear_all_soft_refs);
-
-  gc_timer->register_gc_end();
-
-  gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
-
-  SpecializationStats::print();
-}
-
-HeapWord*
-OneContigSpaceCardGeneration::expand_and_allocate(size_t word_size,
-                                                  bool is_tlab,
-                                                  bool parallel) {
-  assert(!is_tlab, "OneContigSpaceCardGeneration does not support TLAB allocation");
-  if (parallel) {
-    MutexLocker x(ParGCRareEvent_lock);
-    HeapWord* result = NULL;
-    size_t byte_size = word_size * HeapWordSize;
-    while (true) {
-      expand(byte_size, _min_heap_delta_bytes);
-      if (GCExpandToAllocateDelayMillis > 0) {
-        os::sleep(Thread::current(), GCExpandToAllocateDelayMillis, false);
-      }
-      result = _the_space->par_allocate(word_size);
-      if ( result != NULL) {
-        return result;
-      } else {
-        // If there's not enough expansion space available, give up.
-        if (_virtual_space.uncommitted_size() < byte_size) {
-          return NULL;
-        }
-        // else try again
-      }
-    }
-  } else {
-    expand(word_size*HeapWordSize, _min_heap_delta_bytes);
-    return _the_space->allocate(word_size);
-  }
-}
-
-bool OneContigSpaceCardGeneration::expand(size_t bytes, size_t expand_bytes) {
-  GCMutexLocker x(ExpandHeap_lock);
-  return CardGeneration::expand(bytes, expand_bytes);
-}
-
-
-void OneContigSpaceCardGeneration::shrink(size_t bytes) {
-  assert_locked_or_safepoint(ExpandHeap_lock);
-  size_t size = ReservedSpace::page_align_size_down(bytes);
-  if (size > 0) {
-    shrink_by(size);
-  }
-}
-
-
-size_t OneContigSpaceCardGeneration::capacity() const {
-  return _the_space->capacity();
-}
-
-
-size_t OneContigSpaceCardGeneration::used() const {
-  return _the_space->used();
-}
-
-
-size_t OneContigSpaceCardGeneration::free() const {
-  return _the_space->free();
-}
-
-MemRegion OneContigSpaceCardGeneration::used_region() const {
-  return the_space()->used_region();
-}
-
-size_t OneContigSpaceCardGeneration::unsafe_max_alloc_nogc() const {
-  return _the_space->free();
-}
-
-size_t OneContigSpaceCardGeneration::contiguous_available() const {
-  return _the_space->free() + _virtual_space.uncommitted_size();
-}
-
-bool OneContigSpaceCardGeneration::grow_by(size_t bytes) {
-  assert_locked_or_safepoint(ExpandHeap_lock);
-  bool result = _virtual_space.expand_by(bytes);
-  if (result) {
-    size_t new_word_size =
-       heap_word_size(_virtual_space.committed_size());
-    MemRegion mr(_the_space->bottom(), new_word_size);
-    // Expand card table
-    Universe::heap()->barrier_set()->resize_covered_region(mr);
-    // Expand shared block offset array
-    _bts->resize(new_word_size);
-
-    // Fix for bug #4668531
-    if (ZapUnusedHeapArea) {
-      MemRegion mangle_region(_the_space->end(),
-      (HeapWord*)_virtual_space.high());
-      SpaceMangler::mangle_region(mangle_region);
-    }
-
-    // Expand space -- also expands space's BOT
-    // (which uses (part of) shared array above)
-    _the_space->set_end((HeapWord*)_virtual_space.high());
-
-    // update the space and generation capacity counters
-    update_counters();
-
-    if (Verbose && PrintGC) {
-      size_t new_mem_size = _virtual_space.committed_size();
-      size_t old_mem_size = new_mem_size - bytes;
-      gclog_or_tty->print_cr("Expanding %s from " SIZE_FORMAT "K by "
-                      SIZE_FORMAT "K to " SIZE_FORMAT "K",
-                      name(), old_mem_size/K, bytes/K, new_mem_size/K);
-    }
-  }
-  return result;
-}
-
-
-bool OneContigSpaceCardGeneration::grow_to_reserved() {
-  assert_locked_or_safepoint(ExpandHeap_lock);
-  bool success = true;
-  const size_t remaining_bytes = _virtual_space.uncommitted_size();
-  if (remaining_bytes > 0) {
-    success = grow_by(remaining_bytes);
-    DEBUG_ONLY(if (!success) warning("grow to reserved failed");)
-  }
-  return success;
-}
-
-void OneContigSpaceCardGeneration::shrink_by(size_t bytes) {
-  assert_locked_or_safepoint(ExpandHeap_lock);
-  // Shrink committed space
-  _virtual_space.shrink_by(bytes);
-  // Shrink space; this also shrinks the space's BOT
-  _the_space->set_end((HeapWord*) _virtual_space.high());
-  size_t new_word_size = heap_word_size(_the_space->capacity());
-  // Shrink the shared block offset array
-  _bts->resize(new_word_size);
-  MemRegion mr(_the_space->bottom(), new_word_size);
-  // Shrink the card table
-  Universe::heap()->barrier_set()->resize_covered_region(mr);
-
-  if (Verbose && PrintGC) {
-    size_t new_mem_size = _virtual_space.committed_size();
-    size_t old_mem_size = new_mem_size + bytes;
-    gclog_or_tty->print_cr("Shrinking %s from " SIZE_FORMAT "K to " SIZE_FORMAT "K",
-                  name(), old_mem_size/K, new_mem_size/K);
-  }
-}
-
-// Currently nothing to do.
-void OneContigSpaceCardGeneration::prepare_for_verify() {}
-
-
-// Override for a card-table generation with one contiguous
-// space. NOTE: For reasons that are lost in the fog of history,
-// this code is used when you iterate over perm gen objects,
-// even when one uses CDS, where the perm gen has a couple of
-// other spaces; this is because CompactingPermGenGen derives
-// from OneContigSpaceCardGeneration. This should be cleaned up,
-// see CR 6897789..
-void OneContigSpaceCardGeneration::object_iterate(ObjectClosure* blk) {
-  _the_space->object_iterate(blk);
-}
-
-void OneContigSpaceCardGeneration::space_iterate(SpaceClosure* blk,
-                                                 bool usedOnly) {
-  blk->do_space(_the_space);
-}
-
-void OneContigSpaceCardGeneration::younger_refs_iterate(OopsInGenClosure* blk) {
-  blk->set_generation(this);
-  younger_refs_in_space_iterate(_the_space, blk);
-  blk->reset_generation();
-}
-
-void OneContigSpaceCardGeneration::save_marks() {
-  _the_space->set_saved_mark();
-}
-
-
-void OneContigSpaceCardGeneration::reset_saved_marks() {
-  _the_space->reset_saved_mark();
-}
-
-
-bool OneContigSpaceCardGeneration::no_allocs_since_save_marks() {
-  return _the_space->saved_mark_at_top();
-}
-
-#define OneContig_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix)      \
-                                                                                \
-void OneContigSpaceCardGeneration::                                             \
-oop_since_save_marks_iterate##nv_suffix(OopClosureType* blk) {                  \
-  blk->set_generation(this);                                                    \
-  _the_space->oop_since_save_marks_iterate##nv_suffix(blk);                     \
-  blk->reset_generation();                                                      \
-  save_marks();                                                                 \
-}
-
-ALL_SINCE_SAVE_MARKS_CLOSURES(OneContig_SINCE_SAVE_MARKS_ITERATE_DEFN)
-
-#undef OneContig_SINCE_SAVE_MARKS_ITERATE_DEFN
-
-
-void OneContigSpaceCardGeneration::gc_epilogue(bool full) {
-  _last_gc = WaterMark(the_space(), the_space()->top());
-
-  // update the generation and space performance counters
-  update_counters();
-  if (ZapUnusedHeapArea) {
-    the_space()->check_mangled_unused_area_complete();
-  }
-}
-
-void OneContigSpaceCardGeneration::record_spaces_top() {
-  assert(ZapUnusedHeapArea, "Not mangling unused space");
-  the_space()->set_top_for_allocations();
-}
-
-void OneContigSpaceCardGeneration::verify() {
-  the_space()->verify();
-}
-
-void OneContigSpaceCardGeneration::print_on(outputStream* st)  const {
-  Generation::print_on(st);
-  st->print("   the");
-  the_space()->print_on(st);
-}
diff --git a/hotspot/src/share/vm/memory/generation.hpp b/hotspot/src/share/vm/memory/generation.hpp
index cc8e63b9527..e9c352e10b4 100644
--- a/hotspot/src/share/vm/memory/generation.hpp
+++ b/hotspot/src/share/vm/memory/generation.hpp
@@ -45,9 +45,7 @@
 //   - ParNewGeneration            - a DefNewGeneration that is collected by
 //                                   several threads
 // - CardGeneration                 - abstract class adding offset array behavior
-//   - OneContigSpaceCardGeneration - abstract class holding a single
-//                                    contiguous space with card marking
-//     - TenuredGeneration         - tenured (old object) space (markSweepCompact)
+//   - TenuredGeneration             - tenured (old object) space (markSweepCompact)
 //   - ConcurrentMarkSweepGeneration - Mostly Concurrent Mark Sweep Generation
 //                                       (Detlefs-Printezis refinement of
 //                                       Boehm-Demers-Schenker)
@@ -55,9 +53,7 @@
 // The system configurations currently allowed are:
 //
 //   DefNewGeneration + TenuredGeneration
-//   DefNewGeneration + ConcurrentMarkSweepGeneration
 //
-//   ParNewGeneration + TenuredGeneration
 //   ParNewGeneration + ConcurrentMarkSweepGeneration
 //
 
@@ -641,99 +637,4 @@ class CardGeneration: public Generation {
   virtual bool grow_to_reserved() = 0;
 };
 
-// OneContigSpaceCardGeneration models a heap of old objects contained in a single
-// contiguous space.
-//
-// Garbage collection is performed using mark-compact.
-
-class OneContigSpaceCardGeneration: public CardGeneration {
-  friend class VMStructs;
-  // Abstractly, this is a subtype that gets access to protected fields.
-  friend class VM_PopulateDumpSharedSpace;
-
- protected:
-  ContiguousSpace*  _the_space;       // actual space holding objects
-  WaterMark  _last_gc;                // watermark between objects allocated before
-                                      // and after last GC.
-
-  // Grow generation with specified size (returns false if unable to grow)
-  virtual bool grow_by(size_t bytes);
-  // Grow generation to reserved size.
-  virtual bool grow_to_reserved();
-  // Shrink generation with specified size (returns false if unable to shrink)
-  void shrink_by(size_t bytes);
-
-  // Allocation failure
-  virtual bool expand(size_t bytes, size_t expand_bytes);
-  void shrink(size_t bytes);
-
-  // Accessing spaces
-  ContiguousSpace* the_space() const { return _the_space; }
-
- public:
-  OneContigSpaceCardGeneration(ReservedSpace rs, size_t initial_byte_size,
-                               int level, GenRemSet* remset,
-                               ContiguousSpace* space) :
-    CardGeneration(rs, initial_byte_size, level, remset),
-    _the_space(space)
-  {}
-
-  inline bool is_in(const void* p) const;
-
-  // Space enquiries
-  size_t capacity() const;
-  size_t used() const;
-  size_t free() const;
-
-  MemRegion used_region() const;
-
-  size_t unsafe_max_alloc_nogc() const;
-  size_t contiguous_available() const;
-
-  // Iteration
-  void object_iterate(ObjectClosure* blk);
-  void space_iterate(SpaceClosure* blk, bool usedOnly = false);
-
-  void younger_refs_iterate(OopsInGenClosure* blk);
-
-  inline CompactibleSpace* first_compaction_space() const;
-
-  virtual inline HeapWord* allocate(size_t word_size, bool is_tlab);
-  virtual inline HeapWord* par_allocate(size_t word_size, bool is_tlab);
-
-  // Accessing marks
-  inline WaterMark top_mark();
-  inline WaterMark bottom_mark();
-
-#define OneContig_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix)      \
-  void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl);
-  OneContig_SINCE_SAVE_MARKS_DECL(OopsInGenClosure,_v)
-  SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(OneContig_SINCE_SAVE_MARKS_DECL)
-
-  void save_marks();
-  void reset_saved_marks();
-  bool no_allocs_since_save_marks();
-
-  inline size_t block_size(const HeapWord* addr) const;
-
-  inline bool block_is_obj(const HeapWord* addr) const;
-
-  virtual void collect(bool full,
-                       bool clear_all_soft_refs,
-                       size_t size,
-                       bool is_tlab);
-  HeapWord* expand_and_allocate(size_t size,
-                                bool is_tlab,
-                                bool parallel = false);
-
-  virtual void prepare_for_verify();
-
-  virtual void gc_epilogue(bool full);
-
-  virtual void record_spaces_top();
-
-  virtual void verify();
-  virtual void print_on(outputStream* st) const;
-};
-
 #endif // SHARE_VM_MEMORY_GENERATION_HPP
diff --git a/hotspot/src/share/vm/memory/space.hpp b/hotspot/src/share/vm/memory/space.hpp
index a590dbf0067..4eb7669ac23 100644
--- a/hotspot/src/share/vm/memory/space.hpp
+++ b/hotspot/src/share/vm/memory/space.hpp
@@ -495,7 +495,6 @@ class GenSpaceMangler;
 // A space in which the free area is contiguous.  It therefore supports
 // faster allocation, and compaction.
 class ContiguousSpace: public CompactibleSpace {
-  friend class OneContigSpaceCardGeneration;
   friend class VMStructs;
   // Allow scan_and_forward function to call (private) overrides for auxiliary functions on this class
   template <typename SpaceType>
diff --git a/hotspot/src/share/vm/memory/tenuredGeneration.cpp b/hotspot/src/share/vm/memory/tenuredGeneration.cpp
index 9e602a981b5..37cd32c8585 100644
--- a/hotspot/src/share/vm/memory/tenuredGeneration.cpp
+++ b/hotspot/src/share/vm/memory/tenuredGeneration.cpp
@@ -24,13 +24,15 @@
 
 #include "precompiled.hpp"
 #include "gc_implementation/shared/collectorCounters.hpp"
+#include "gc_implementation/shared/gcTimer.hpp"
 #include "gc_implementation/shared/parGCAllocBuffer.hpp"
 #include "memory/allocation.inline.hpp"
 #include "memory/blockOffsetTable.inline.hpp"
-#include "memory/generation.inline.hpp"
 #include "memory/generationSpec.hpp"
+#include "memory/genMarkSweep.hpp"
+#include "memory/genOopClosures.inline.hpp"
 #include "memory/space.hpp"
-#include "memory/tenuredGeneration.hpp"
+#include "memory/tenuredGeneration.inline.hpp"
 #include "oops/oop.inline.hpp"
 #include "runtime/java.hpp"
 #include "utilities/macros.hpp"
@@ -38,8 +40,7 @@
 TenuredGeneration::TenuredGeneration(ReservedSpace rs,
                                      size_t initial_byte_size, int level,
                                      GenRemSet* remset) :
-  OneContigSpaceCardGeneration(rs, initial_byte_size,
-                               level, remset, NULL)
+  CardGeneration(rs, initial_byte_size, level, remset)
 {
   HeapWord* bottom = (HeapWord*) _virtual_space.low();
   HeapWord* end    = (HeapWord*) _virtual_space.high();
@@ -170,3 +171,244 @@ bool TenuredGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes)
   }
   return res;
 }
+
+void TenuredGeneration::collect(bool   full,
+                                bool   clear_all_soft_refs,
+                                size_t size,
+                                bool   is_tlab) {
+  GenCollectedHeap* gch = GenCollectedHeap::heap();
+
+  SpecializationStats::clear();
+  // Temporarily expand the span of our ref processor, so
+  // refs discovery is over the entire heap, not just this generation
+  ReferenceProcessorSpanMutator
+    x(ref_processor(), gch->reserved_region());
+
+  STWGCTimer* gc_timer = GenMarkSweep::gc_timer();
+  gc_timer->register_gc_start();
+
+  SerialOldTracer* gc_tracer = GenMarkSweep::gc_tracer();
+  gc_tracer->report_gc_start(gch->gc_cause(), gc_timer->gc_start());
+
+  GenMarkSweep::invoke_at_safepoint(_level, ref_processor(), clear_all_soft_refs);
+
+  gc_timer->register_gc_end();
+
+  gc_tracer->report_gc_end(gc_timer->gc_end(), gc_timer->time_partitions());
+
+  SpecializationStats::print();
+}
+
+HeapWord*
+TenuredGeneration::expand_and_allocate(size_t word_size,
+                                       bool is_tlab,
+                                       bool parallel) {
+  assert(!is_tlab, "TenuredGeneration does not support TLAB allocation");
+  if (parallel) {
+    MutexLocker x(ParGCRareEvent_lock);
+    HeapWord* result = NULL;
+    size_t byte_size = word_size * HeapWordSize;
+    while (true) {
+      expand(byte_size, _min_heap_delta_bytes);
+      if (GCExpandToAllocateDelayMillis > 0) {
+        os::sleep(Thread::current(), GCExpandToAllocateDelayMillis, false);
+      }
+      result = _the_space->par_allocate(word_size);
+      if ( result != NULL) {
+        return result;
+      } else {
+        // If there's not enough expansion space available, give up.
+        if (_virtual_space.uncommitted_size() < byte_size) {
+          return NULL;
+        }
+        // else try again
+      }
+    }
+  } else {
+    expand(word_size*HeapWordSize, _min_heap_delta_bytes);
+    return _the_space->allocate(word_size);
+  }
+}
+
+bool TenuredGeneration::expand(size_t bytes, size_t expand_bytes) {
+  GCMutexLocker x(ExpandHeap_lock);
+  return CardGeneration::expand(bytes, expand_bytes);
+}
+
+
+void TenuredGeneration::shrink(size_t bytes) {
+  assert_locked_or_safepoint(ExpandHeap_lock);
+  size_t size = ReservedSpace::page_align_size_down(bytes);
+  if (size > 0) {
+    shrink_by(size);
+  }
+}
+
+
+size_t TenuredGeneration::capacity() const {
+  return _the_space->capacity();
+}
+
+
+size_t TenuredGeneration::used() const {
+  return _the_space->used();
+}
+
+
+size_t TenuredGeneration::free() const {
+  return _the_space->free();
+}
+
+MemRegion TenuredGeneration::used_region() const {
+  return the_space()->used_region();
+}
+
+size_t TenuredGeneration::unsafe_max_alloc_nogc() const {
+  return _the_space->free();
+}
+
+size_t TenuredGeneration::contiguous_available() const {
+  return _the_space->free() + _virtual_space.uncommitted_size();
+}
+
+bool TenuredGeneration::grow_by(size_t bytes) {
+  assert_locked_or_safepoint(ExpandHeap_lock);
+  bool result = _virtual_space.expand_by(bytes);
+  if (result) {
+    size_t new_word_size =
+       heap_word_size(_virtual_space.committed_size());
+    MemRegion mr(_the_space->bottom(), new_word_size);
+    // Expand card table
+    Universe::heap()->barrier_set()->resize_covered_region(mr);
+    // Expand shared block offset array
+    _bts->resize(new_word_size);
+
+    // Fix for bug #4668531
+    if (ZapUnusedHeapArea) {
+      MemRegion mangle_region(_the_space->end(),
+      (HeapWord*)_virtual_space.high());
+      SpaceMangler::mangle_region(mangle_region);
+    }
+
+    // Expand space -- also expands space's BOT
+    // (which uses (part of) shared array above)
+    _the_space->set_end((HeapWord*)_virtual_space.high());
+
+    // update the space and generation capacity counters
+    update_counters();
+
+    if (Verbose && PrintGC) {
+      size_t new_mem_size = _virtual_space.committed_size();
+      size_t old_mem_size = new_mem_size - bytes;
+      gclog_or_tty->print_cr("Expanding %s from " SIZE_FORMAT "K by "
+                      SIZE_FORMAT "K to " SIZE_FORMAT "K",
+                      name(), old_mem_size/K, bytes/K, new_mem_size/K);
+    }
+  }
+  return result;
+}
+
+
+bool TenuredGeneration::grow_to_reserved() {
+  assert_locked_or_safepoint(ExpandHeap_lock);
+  bool success = true;
+  const size_t remaining_bytes = _virtual_space.uncommitted_size();
+  if (remaining_bytes > 0) {
+    success = grow_by(remaining_bytes);
+    DEBUG_ONLY(if (!success) warning("grow to reserved failed");)
+  }
+  return success;
+}
+
+void TenuredGeneration::shrink_by(size_t bytes) {
+  assert_locked_or_safepoint(ExpandHeap_lock);
+  // Shrink committed space
+  _virtual_space.shrink_by(bytes);
+  // Shrink space; this also shrinks the space's BOT
+  _the_space->set_end((HeapWord*) _virtual_space.high());
+  size_t new_word_size = heap_word_size(_the_space->capacity());
+  // Shrink the shared block offset array
+  _bts->resize(new_word_size);
+  MemRegion mr(_the_space->bottom(), new_word_size);
+  // Shrink the card table
+  Universe::heap()->barrier_set()->resize_covered_region(mr);
+
+  if (Verbose && PrintGC) {
+    size_t new_mem_size = _virtual_space.committed_size();
+    size_t old_mem_size = new_mem_size + bytes;
+    gclog_or_tty->print_cr("Shrinking %s from " SIZE_FORMAT "K to " SIZE_FORMAT "K",
+                  name(), old_mem_size/K, new_mem_size/K);
+  }
+}
+
+// Currently nothing to do.
+void TenuredGeneration::prepare_for_verify() {}
+
+void TenuredGeneration::object_iterate(ObjectClosure* blk) {
+  _the_space->object_iterate(blk);
+}
+
+void TenuredGeneration::space_iterate(SpaceClosure* blk,
+                                                 bool usedOnly) {
+  blk->do_space(_the_space);
+}
+
+void TenuredGeneration::younger_refs_iterate(OopsInGenClosure* blk) {
+  blk->set_generation(this);
+  younger_refs_in_space_iterate(_the_space, blk);
+  blk->reset_generation();
+}
+
+void TenuredGeneration::save_marks() {
+  _the_space->set_saved_mark();
+}
+
+
+void TenuredGeneration::reset_saved_marks() {
+  _the_space->reset_saved_mark();
+}
+
+
+bool TenuredGeneration::no_allocs_since_save_marks() {
+  return _the_space->saved_mark_at_top();
+}
+
+#define TenuredGen_SINCE_SAVE_MARKS_ITERATE_DEFN(OopClosureType, nv_suffix)     \
+                                                                                \
+void TenuredGeneration::                                                        \
+oop_since_save_marks_iterate##nv_suffix(OopClosureType* blk) {                  \
+  blk->set_generation(this);                                                    \
+  _the_space->oop_since_save_marks_iterate##nv_suffix(blk);                     \
+  blk->reset_generation();                                                      \
+  save_marks();                                                                 \
+}
+
+ALL_SINCE_SAVE_MARKS_CLOSURES(TenuredGen_SINCE_SAVE_MARKS_ITERATE_DEFN)
+
+#undef TenuredGen_SINCE_SAVE_MARKS_ITERATE_DEFN
+
+
+void TenuredGeneration::gc_epilogue(bool full) {
+  _last_gc = WaterMark(the_space(), the_space()->top());
+
+  // update the generation and space performance counters
+  update_counters();
+  if (ZapUnusedHeapArea) {
+    the_space()->check_mangled_unused_area_complete();
+  }
+}
+
+void TenuredGeneration::record_spaces_top() {
+  assert(ZapUnusedHeapArea, "Not mangling unused space");
+  the_space()->set_top_for_allocations();
+}
+
+void TenuredGeneration::verify() {
+  the_space()->verify();
+}
+
+void TenuredGeneration::print_on(outputStream* st)  const {
+  Generation::print_on(st);
+  st->print("   the");
+  the_space()->print_on(st);
+}
diff --git a/hotspot/src/share/vm/memory/tenuredGeneration.hpp b/hotspot/src/share/vm/memory/tenuredGeneration.hpp
index c82b3ab5cf0..0ecd54dd55f 100644
--- a/hotspot/src/share/vm/memory/tenuredGeneration.hpp
+++ b/hotspot/src/share/vm/memory/tenuredGeneration.hpp
@@ -31,17 +31,41 @@
 #include "memory/generation.hpp"
 #include "utilities/macros.hpp"
 
-// TenuredGeneration models the heap containing old (promoted/tenured) objects.
+// TenuredGeneration models the heap containing old (promoted/tenured) objects
+// contained in a single contiguous space.
+//
+// Garbage collection is performed using mark-compact.
 
-class TenuredGeneration: public OneContigSpaceCardGeneration {
+class TenuredGeneration: public CardGeneration {
   friend class VMStructs;
+  // Abstractly, this is a subtype that gets access to protected fields.
+  friend class VM_PopulateDumpSharedSpace;
+
  protected:
+  ContiguousSpace*  _the_space;       // actual space holding objects
+  WaterMark  _last_gc;                // watermark between objects allocated before
+                                      // and after last GC.
+
   GenerationCounters*   _gen_counters;
   CSpaceCounters*       _space_counters;
 
+  // Grow generation with specified size (returns false if unable to grow)
+  virtual bool grow_by(size_t bytes);
+  // Grow generation to reserved size.
+  virtual bool grow_to_reserved();
+  // Shrink generation with specified size (returns false if unable to shrink)
+  void shrink_by(size_t bytes);
+
+  // Allocation failure
+  virtual bool expand(size_t bytes, size_t expand_bytes);
+  void shrink(size_t bytes);
+
+  // Accessing spaces
+  ContiguousSpace* the_space() const { return _the_space; }
+
  public:
-  TenuredGeneration(ReservedSpace rs, size_t initial_byte_size, int level,
-                    GenRemSet* remset);
+  TenuredGeneration(ReservedSpace rs, size_t initial_byte_size,
+                               int level, GenRemSet* remset);
 
   Generation::Name kind() { return Generation::MarkSweepCompact; }
 
@@ -57,7 +81,59 @@ class TenuredGeneration: public OneContigSpaceCardGeneration {
     return !ScavengeBeforeFullGC;
   }
 
+  inline bool is_in(const void* p) const;
+
+  // Space enquiries
+  size_t capacity() const;
+  size_t used() const;
+  size_t free() const;
+
+  MemRegion used_region() const;
+
+  size_t unsafe_max_alloc_nogc() const;
+  size_t contiguous_available() const;
+
+  // Iteration
+  void object_iterate(ObjectClosure* blk);
+  void space_iterate(SpaceClosure* blk, bool usedOnly = false);
+
+  void younger_refs_iterate(OopsInGenClosure* blk);
+
+  inline CompactibleSpace* first_compaction_space() const;
+
+  virtual inline HeapWord* allocate(size_t word_size, bool is_tlab);
+  virtual inline HeapWord* par_allocate(size_t word_size, bool is_tlab);
+
+  // Accessing marks
+  inline WaterMark top_mark();
+  inline WaterMark bottom_mark();
+
+#define TenuredGen_SINCE_SAVE_MARKS_DECL(OopClosureType, nv_suffix)     \
+  void oop_since_save_marks_iterate##nv_suffix(OopClosureType* cl);
+  TenuredGen_SINCE_SAVE_MARKS_DECL(OopsInGenClosure,_v)
+  SPECIALIZED_SINCE_SAVE_MARKS_CLOSURES(TenuredGen_SINCE_SAVE_MARKS_DECL)
+
+  void save_marks();
+  void reset_saved_marks();
+  bool no_allocs_since_save_marks();
+
+  inline size_t block_size(const HeapWord* addr) const;
+
+  inline bool block_is_obj(const HeapWord* addr) const;
+
+  virtual void collect(bool full,
+                       bool clear_all_soft_refs,
+                       size_t size,
+                       bool is_tlab);
+  HeapWord* expand_and_allocate(size_t size,
+                                bool is_tlab,
+                                bool parallel = false);
+
+  virtual void prepare_for_verify();
+
+
   virtual void gc_prologue(bool full);
+  virtual void gc_epilogue(bool full);
   bool should_collect(bool   full,
                       size_t word_size,
                       bool   is_tlab);
@@ -67,11 +143,16 @@ class TenuredGeneration: public OneContigSpaceCardGeneration {
   // Performance Counter support
   void update_counters();
 
+  virtual void record_spaces_top();
+
   // Statistics
 
   virtual void update_gc_stats(int level, bool full);
 
   virtual bool promotion_attempt_is_safe(size_t max_promoted_in_bytes) const;
+
+  virtual void verify();
+  virtual void print_on(outputStream* st) const;
 };
 
 #endif // SHARE_VM_MEMORY_TENUREDGENERATION_HPP
diff --git a/hotspot/src/share/vm/memory/generation.inline.hpp b/hotspot/src/share/vm/memory/tenuredGeneration.inline.hpp
similarity index 70%
rename from hotspot/src/share/vm/memory/generation.inline.hpp
rename to hotspot/src/share/vm/memory/tenuredGeneration.inline.hpp
index 506bf2a2701..0aa4c6d2d3b 100644
--- a/hotspot/src/share/vm/memory/generation.inline.hpp
+++ b/hotspot/src/share/vm/memory/tenuredGeneration.inline.hpp
@@ -26,48 +26,48 @@
 #define SHARE_VM_MEMORY_GENERATION_INLINE_HPP
 
 #include "memory/genCollectedHeap.hpp"
-#include "memory/generation.hpp"
 #include "memory/space.hpp"
+#include "memory/tenuredGeneration.hpp"
 
-bool OneContigSpaceCardGeneration::is_in(const void* p) const {
+bool TenuredGeneration::is_in(const void* p) const {
   return the_space()->is_in(p);
 }
 
 
-WaterMark OneContigSpaceCardGeneration::top_mark() {
+WaterMark TenuredGeneration::top_mark() {
   return the_space()->top_mark();
 }
 
 CompactibleSpace*
-OneContigSpaceCardGeneration::first_compaction_space() const {
+TenuredGeneration::first_compaction_space() const {
   return the_space();
 }
 
-HeapWord* OneContigSpaceCardGeneration::allocate(size_t word_size,
+HeapWord* TenuredGeneration::allocate(size_t word_size,
                                                  bool is_tlab) {
-  assert(!is_tlab, "OneContigSpaceCardGeneration does not support TLAB allocation");
+  assert(!is_tlab, "TenuredGeneration does not support TLAB allocation");
   return the_space()->allocate(word_size);
 }
 
-HeapWord* OneContigSpaceCardGeneration::par_allocate(size_t word_size,
+HeapWord* TenuredGeneration::par_allocate(size_t word_size,
                                                      bool is_tlab) {
-  assert(!is_tlab, "OneContigSpaceCardGeneration does not support TLAB allocation");
+  assert(!is_tlab, "TenuredGeneration does not support TLAB allocation");
   return the_space()->par_allocate(word_size);
 }
 
-WaterMark OneContigSpaceCardGeneration::bottom_mark() {
+WaterMark TenuredGeneration::bottom_mark() {
   return the_space()->bottom_mark();
 }
 
-size_t OneContigSpaceCardGeneration::block_size(const HeapWord* addr) const {
+size_t TenuredGeneration::block_size(const HeapWord* addr) const {
   if (addr < the_space()->top()) return oop(addr)->size();
   else {
     assert(addr == the_space()->top(), "non-block head arg to block_size");
-    return the_space()->_end - the_space()->top();
+    return the_space()->end() - the_space()->top();
   }
 }
 
-bool OneContigSpaceCardGeneration::block_is_obj(const HeapWord* addr) const {
+bool TenuredGeneration::block_is_obj(const HeapWord* addr) const {
   return addr < the_space()->top();
 }
 
diff --git a/hotspot/src/share/vm/precompiled/precompiled.hpp b/hotspot/src/share/vm/precompiled/precompiled.hpp
index 121c8aa14c6..df15b2f8c32 100644
--- a/hotspot/src/share/vm/precompiled/precompiled.hpp
+++ b/hotspot/src/share/vm/precompiled/precompiled.hpp
@@ -127,7 +127,6 @@
 # include "memory/genOopClosures.hpp"
 # include "memory/genRemSet.hpp"
 # include "memory/generation.hpp"
-# include "memory/generation.inline.hpp"
 # include "memory/heap.hpp"
 # include "memory/iterator.hpp"
 # include "memory/memRegion.hpp"
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index 0cf20e99517..3c2c2999c94 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -554,9 +554,9 @@ typedef TwoOopHashtable<Symbol*, mtClass>     SymbolTwoOopHashtable;
                                                                                                                                      \
   nonstatic_field(OffsetTableContigSpace,      _offsets,                                      BlockOffsetArray)                      \
                                                                                                                                      \
-  nonstatic_field(OneContigSpaceCardGeneration, _min_heap_delta_bytes,                        size_t)                                \
-  nonstatic_field(OneContigSpaceCardGeneration, _the_space,                                   ContiguousSpace*)                      \
-  nonstatic_field(OneContigSpaceCardGeneration, _last_gc,                                     WaterMark)                             \
+  nonstatic_field(TenuredGeneration,           _min_heap_delta_bytes,                         size_t)                                \
+  nonstatic_field(TenuredGeneration,           _the_space,                                    ContiguousSpace*)                      \
+  nonstatic_field(TenuredGeneration,           _last_gc,                                      WaterMark)                             \
                                                                                                                                      \
                                                                                                                                      \
                                                                                                                                      \
@@ -1481,8 +1481,7 @@ typedef TwoOopHashtable<Symbol*, mtClass>     SymbolTwoOopHashtable;
   declare_toplevel_type(Generation)                                       \
            declare_type(DefNewGeneration,             Generation)         \
            declare_type(CardGeneration,               Generation)         \
-           declare_type(OneContigSpaceCardGeneration, CardGeneration)     \
-           declare_type(TenuredGeneration,            OneContigSpaceCardGeneration) \
+           declare_type(TenuredGeneration,            CardGeneration)     \
   declare_toplevel_type(Space)                                            \
   declare_toplevel_type(BitMap)                                           \
            declare_type(CompactibleSpace,             Space)              \
@@ -1534,8 +1533,8 @@ typedef TwoOopHashtable<Symbol*, mtClass>     SymbolTwoOopHashtable;
   declare_toplevel_type(HeapWord*)                                        \
   declare_toplevel_type(MemRegion*)                                       \
   declare_toplevel_type(OffsetTableContigSpace*)                          \
-  declare_toplevel_type(OneContigSpaceCardGeneration*)                    \
   declare_toplevel_type(Space*)                                           \
+  declare_toplevel_type(TenuredGeneration*)                               \
   declare_toplevel_type(ThreadLocalAllocBuffer*)                          \
                                                                           \
   /************************/                                              \

From 14ee08928760e5d97c574e746775d28c0ae552cb Mon Sep 17 00:00:00 2001
From: Alan Bateman <alanb@openjdk.org>
Date: Mon, 1 Dec 2014 13:44:57 +0000
Subject: [PATCH 188/299] 8066196: (fs) Typo in Path::normalize, empty path
 only returned if path does not have a root component

Reviewed-by: dfuchs
---
 jdk/src/java.base/share/classes/java/nio/file/Path.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/src/java.base/share/classes/java/nio/file/Path.java b/jdk/src/java.base/share/classes/java/nio/file/Path.java
index daa09f4cf87..9df57c120e0 100644
--- a/jdk/src/java.base/share/classes/java/nio/file/Path.java
+++ b/jdk/src/java.base/share/classes/java/nio/file/Path.java
@@ -325,7 +325,7 @@ public interface Path
      *
      * @return  the resulting path or this path if it does not contain
      *          redundant name elements; an empty path is returned if this path
-     *          does have a root component and all name elements are redundant
+     *          does not have a root component and all name elements are redundant
      *
      * @see #getParent
      * @see #toRealPath

From 91dbd4f088953f0876440114b3e64134aa2377f7 Mon Sep 17 00:00:00 2001
From: Max Ockner <max.ockner@oracle.com>
Date: Mon, 1 Dec 2014 12:16:15 -0500
Subject: [PATCH 189/299] 8060074: os::free() takes MemoryTrackingLevel but
 doesn't need it

Cleaned up unused arguments in os::free and it's callers.

Reviewed-by: lfoltan, coleenp, ctornqvi, dholmes
---
 hotspot/src/os/aix/vm/os_aix.cpp              |  8 +-
 hotspot/src/os/aix/vm/perfMemory_aix.cpp      | 50 ++++++-------
 hotspot/src/os/bsd/vm/os_bsd.cpp              | 12 +--
 hotspot/src/os/bsd/vm/perfMemory_bsd.cpp      | 46 ++++++------
 hotspot/src/os/linux/vm/os_linux.cpp          | 10 +--
 hotspot/src/os/linux/vm/perfMemory_linux.cpp  | 46 ++++++------
 hotspot/src/os/solaris/vm/os_solaris.cpp      | 22 +++---
 .../src/os/solaris/vm/perfMemory_solaris.cpp  | 46 ++++++------
 hotspot/src/os/windows/vm/os_windows.cpp      | 36 ++++-----
 .../src/os/windows/vm/perfMemory_windows.cpp  | 74 +++++++++----------
 hotspot/src/share/vm/asm/codeBuffer.cpp       |  2 +-
 .../src/share/vm/classfile/classLoader.cpp    |  4 +-
 .../share/vm/classfile/loaderConstraints.cpp  |  8 +-
 .../vm/classfile/sharedPathsMiscInfo.hpp      |  2 +-
 hotspot/src/share/vm/code/codeBlob.cpp        |  2 +-
 hotspot/src/share/vm/code/codeCache.cpp       |  2 +-
 hotspot/src/share/vm/compiler/compileLog.cpp  |  4 +-
 .../concurrentMarkSweepGeneration.cpp         | 12 +--
 .../g1/concurrentG1Refine.cpp                 |  4 +-
 .../g1/g1CodeCacheRemSet.cpp                  |  4 +-
 .../gc_implementation/g1/g1CollectedHeap.cpp  |  2 +-
 .../gc_implementation/g1/g1GCPhaseTimes.hpp   |  2 +-
 .../gc_implementation/g1/g1HotCardCache.cpp   |  4 +-
 .../g1/g1ParScanThreadState.cpp               |  2 +-
 .../vm/gc_implementation/g1/g1RemSet.cpp      |  4 +-
 .../gc_implementation/g1/g1RemSetSummary.hpp  |  4 +-
 .../g1/g1StringDedupTable.cpp                 |  2 +-
 .../g1/heapRegionManager.cpp                  |  2 +-
 .../vm/gc_implementation/g1/heapRegionSet.cpp |  2 +-
 .../vm/gc_implementation/g1/ptrQueue.cpp      |  4 +-
 .../vm/gc_implementation/g1/sparsePRT.cpp     |  4 +-
 .../vm/gc_implementation/g1/survRateGroup.cpp |  6 +-
 .../parNew/parCardTableModRefBS.cpp           |  2 +-
 .../parNew/parNewGeneration.cpp               |  2 +-
 .../parallelScavenge/gcTaskManager.cpp        |  6 +-
 .../parallelScavenge/gcTaskThread.cpp         |  2 +-
 .../shared/cSpaceCounters.hpp                 |  4 +-
 .../shared/collectorCounters.hpp              |  4 +-
 .../shared/gSpaceCounters.hpp                 |  4 +-
 .../shared/generationCounters.hpp             |  4 +-
 .../shared/hSpaceCounters.hpp                 |  4 +-
 .../shared/mutableNUMASpace.cpp               |  2 +-
 .../shared/spaceCounters.hpp                  |  4 +-
 .../src/share/vm/interpreter/oopMapCache.cpp  |  6 +-
 hotspot/src/share/vm/memory/allocation.cpp    |  4 +-
 hotspot/src/share/vm/memory/allocation.hpp    | 10 +--
 .../src/share/vm/memory/allocation.inline.hpp | 10 +--
 .../src/share/vm/memory/cardTableModRefBS.cpp |  8 +-
 hotspot/src/share/vm/memory/cardTableRS.cpp   |  2 +-
 hotspot/src/share/vm/memory/filemap.cpp       |  4 +-
 .../src/share/vm/memory/heapInspection.cpp    |  2 +-
 hotspot/src/share/vm/memory/memRegion.cpp     |  4 +-
 hotspot/src/share/vm/oops/instanceKlass.cpp   |  6 +-
 hotspot/src/share/vm/oops/method.cpp          |  2 +-
 hotspot/src/share/vm/prims/jniCheck.cpp       |  2 +-
 .../vm/prims/jvmtiClassFileReconstituter.hpp  |  6 +-
 hotspot/src/share/vm/prims/jvmtiEnvBase.hpp   |  2 +-
 hotspot/src/share/vm/prims/jvmtiExport.cpp    |  2 +-
 hotspot/src/share/vm/prims/jvmtiImpl.cpp      |  4 +-
 hotspot/src/share/vm/prims/unsafe.cpp         |  6 +-
 hotspot/src/share/vm/prims/whitebox.cpp       |  4 +-
 hotspot/src/share/vm/runtime/arguments.cpp    | 16 ++--
 .../src/share/vm/runtime/deoptimization.cpp   |  6 +-
 hotspot/src/share/vm/runtime/dtraceJSDT.hpp   |  2 +-
 hotspot/src/share/vm/runtime/fprofiler.cpp    |  2 +-
 hotspot/src/share/vm/runtime/globals.cpp      |  6 +-
 hotspot/src/share/vm/runtime/handles.cpp      |  4 +-
 .../src/share/vm/runtime/objectMonitor.hpp    |  2 +-
 hotspot/src/share/vm/runtime/os.cpp           | 10 +--
 hotspot/src/share/vm/runtime/os.hpp           |  2 +-
 hotspot/src/share/vm/runtime/perfData.cpp     |  4 +-
 hotspot/src/share/vm/runtime/perfMemory.cpp   |  2 +-
 .../src/share/vm/runtime/sharedRuntime.cpp    |  6 +-
 hotspot/src/share/vm/runtime/thread.cpp       | 12 +--
 hotspot/src/share/vm/runtime/vmStructs.cpp    |  8 +-
 .../src/share/vm/services/attachListener.cpp  |  2 +-
 .../share/vm/services/diagnosticArgument.cpp  |  4 +-
 .../share/vm/services/diagnosticArgument.hpp  |  4 +-
 hotspot/src/share/vm/services/heapDumper.cpp  |  2 +-
 hotspot/src/share/vm/services/management.cpp  |  4 +-
 .../src/share/vm/services/memoryManager.cpp   |  4 +-
 hotspot/src/share/vm/utilities/array.cpp      |  4 +-
 hotspot/src/share/vm/utilities/bitMap.cpp     |  2 +-
 hotspot/src/share/vm/utilities/hashtable.cpp  |  2 +-
 hotspot/src/share/vm/utilities/numberSeq.cpp  |  2 +-
 hotspot/src/share/vm/utilities/ostream.cpp    | 22 +++---
 hotspot/src/share/vm/utilities/quickSort.cpp  |  4 +-
 .../src/share/vm/utilities/stack.inline.hpp   |  4 +-
 hotspot/src/share/vm/utilities/taskqueue.hpp  |  4 +-
 hotspot/src/share/vm/utilities/workgroup.cpp  |  4 +-
 hotspot/src/share/vm/utilities/xmlstream.cpp  |  4 +-
 91 files changed, 354 insertions(+), 354 deletions(-)

diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp
index d7420ad820d..7dbc1ab61e9 100644
--- a/hotspot/src/os/aix/vm/os_aix.cpp
+++ b/hotspot/src/os/aix/vm/os_aix.cpp
@@ -571,7 +571,7 @@ void os::init_system_properties_values() {
   char *ld_library_path = (char *)NEW_C_HEAP_ARRAY(char, strlen(v) + 1 + sizeof(DEFAULT_LIBPATH) + 1, mtInternal);
   sprintf(ld_library_path, "%s%s" DEFAULT_LIBPATH, v, v_colon);
   Arguments::set_library_path(ld_library_path);
-  FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal);
+  FREE_C_HEAP_ARRAY(char, ld_library_path);
 
   // Extensions directories.
   sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
@@ -581,7 +581,7 @@ void os::init_system_properties_values() {
   sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
   Arguments::set_endorsed_dirs(buf);
 
-  FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, buf);
 
 #undef DEFAULT_LIBPATH
 #undef EXTENSIONS_DIR
@@ -1307,11 +1307,11 @@ bool os::dll_build_name(char* buffer, size_t buflen,
     // release the storage
     for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
-        FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
+        FREE_C_HEAP_ARRAY(char, pelements[i]);
       }
     }
     if (pelements != NULL) {
-      FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
+      FREE_C_HEAP_ARRAY(char*, pelements);
     }
   } else {
     snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
diff --git a/hotspot/src/os/aix/vm/perfMemory_aix.cpp b/hotspot/src/os/aix/vm/perfMemory_aix.cpp
index 8850fe705e2..f329c2bbca4 100644
--- a/hotspot/src/os/aix/vm/perfMemory_aix.cpp
+++ b/hotspot/src/os/aix/vm/perfMemory_aix.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
  * Copyright 2012, 2013 SAP AG. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
@@ -127,7 +127,7 @@ static void save_memory_to_file(char* addr, size_t size) {
       }
     }
   }
-  FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
+  FREE_C_HEAP_ARRAY(char, destfile);
 }
 
 
@@ -279,14 +279,14 @@ static char* get_user_name(uid_t uid) {
                                      "pw_name zero length");
       }
     }
-    FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+    FREE_C_HEAP_ARRAY(char, pwbuf);
     return NULL;
   }
 
   char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
   strcpy(user_name, p->pw_name);
 
-  FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, pwbuf);
   return user_name;
 }
 
@@ -347,7 +347,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
     DIR* subdirp = os::opendir(usrdir_name);
 
     if (subdirp == NULL) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       continue;
     }
 
@@ -358,7 +358,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
     // symlink can be exploited.
     //
     if (!is_directory_secure(usrdir_name)) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       os::closedir(subdirp);
       continue;
     }
@@ -382,13 +382,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
         // don't follow symbolic links for the file
         RESTARTABLE(::lstat(filename, &statbuf), result);
         if (result == OS_ERR) {
-           FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+           FREE_C_HEAP_ARRAY(char, filename);
            continue;
         }
 
         // skip over files that are not regular files.
         if (!S_ISREG(statbuf.st_mode)) {
-          FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+          FREE_C_HEAP_ARRAY(char, filename);
           continue;
         }
 
@@ -398,7 +398,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
           if (statbuf.st_ctime > oldest_ctime) {
             char* user = strchr(dentry->d_name, '_') + 1;
 
-            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal);
+            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
             oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
 
             strcpy(oldest_user, user);
@@ -406,15 +406,15 @@ static char* get_user_name_slow(int vmid, TRAPS) {
           }
         }
 
-        FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+        FREE_C_HEAP_ARRAY(char, filename);
       }
     }
     os::closedir(subdirp);
-    FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
-    FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, udbuf);
+    FREE_C_HEAP_ARRAY(char, usrdir_name);
   }
   os::closedir(tmpdirp);
-  FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, tdbuf);
 
   return(oldest_user);
 }
@@ -481,7 +481,7 @@ static void remove_file(const char* dirname, const char* filename) {
 
   remove_file(path);
 
-  FREE_C_HEAP_ARRAY(char, path, mtInternal);
+  FREE_C_HEAP_ARRAY(char, path);
 }
 
 
@@ -558,7 +558,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
     errno = 0;
   }
   os::closedir(dirp);
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
 // make the user specific temporary directory. Returns true if
@@ -703,11 +703,11 @@ static char* mmap_create_shared(size_t size) {
 
   fd = create_sharedmem_resources(dirname, filename, size);
 
-  FREE_C_HEAP_ARRAY(char, user_name, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+  FREE_C_HEAP_ARRAY(char, user_name);
+  FREE_C_HEAP_ARRAY(char, dirname);
 
   if (fd == -1) {
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -723,7 +723,7 @@ static char* mmap_create_shared(size_t size) {
       warning("mmap failed -  %s\n", strerror(errno));
     }
     remove_file(filename);
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -769,7 +769,7 @@ static void delete_shared_memory(char* addr, size_t size) {
     remove_file(backing_store_file_name);
     // Don't.. Free heap memory could deadlock os::abort() if it is called
     // from signal handler. OS will reclaim the heap memory.
-    // FREE_C_HEAP_ARRAY(char, backing_store_file_name, mtInternal);
+    // FREE_C_HEAP_ARRAY(char, backing_store_file_name);
     backing_store_file_name = NULL;
   }
 }
@@ -853,9 +853,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
   // store file, we don't follow them when attaching either.
   //
   if (!is_directory_secure(dirname)) {
-    FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+    FREE_C_HEAP_ARRAY(char, dirname);
     if (luser != user) {
-      FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+      FREE_C_HEAP_ARRAY(char, luser);
     }
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Process not found");
@@ -871,9 +871,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
   strcpy(rfilename, filename);
 
   // free the c heap resources that are no longer needed
-  if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
-  FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+  if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
+  FREE_C_HEAP_ARRAY(char, dirname);
+  FREE_C_HEAP_ARRAY(char, filename);
 
   // open the shared memory file for the give vmid
   fd = open_sharedmem_file(rfilename, file_flags, CHECK);
diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp
index a42e3bf19ba..8a8bfa2162a 100644
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp
@@ -418,7 +418,7 @@ void os::init_system_properties_values() {
                                                      mtInternal);
     sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib/%s:" DEFAULT_LIBPATH, v, v_colon, cpu_arch);
     Arguments::set_library_path(ld_library_path);
-    FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal);
+    FREE_C_HEAP_ARRAY(char, ld_library_path);
   }
 
   // Extensions directories.
@@ -429,7 +429,7 @@ void os::init_system_properties_values() {
   sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
   Arguments::set_endorsed_dirs(buf);
 
-  FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, buf);
 
 #else // __APPLE__
 
@@ -513,7 +513,7 @@ void os::init_system_properties_values() {
     sprintf(ld_library_path, "%s%s%s%s%s" SYS_EXTENSIONS_DIR ":" SYS_EXTENSIONS_DIRS ":.",
             v, v_colon, l, l_colon, user_home_dir);
     Arguments::set_library_path(ld_library_path);
-    FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal);
+    FREE_C_HEAP_ARRAY(char, ld_library_path);
   }
 
   // Extensions directories.
@@ -529,7 +529,7 @@ void os::init_system_properties_values() {
   sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
   Arguments::set_endorsed_dirs(buf);
 
-  FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, buf);
 
 #undef SYS_EXTENSIONS_DIR
 #undef SYS_EXTENSIONS_DIRS
@@ -1315,11 +1315,11 @@ bool os::dll_build_name(char* buffer, size_t buflen,
     // release the storage
     for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
-        FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
+        FREE_C_HEAP_ARRAY(char, pelements[i]);
       }
     }
     if (pelements != NULL) {
-      FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
+      FREE_C_HEAP_ARRAY(char*, pelements);
     }
   } else {
     snprintf(buffer, buflen, "%s/" JNI_LIB_PREFIX "%s" JNI_LIB_SUFFIX, pname, fname);
diff --git a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp
index 5cd6cf4e3dd..155ebb51e32 100644
--- a/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp
+++ b/hotspot/src/os/bsd/vm/perfMemory_bsd.cpp
@@ -127,7 +127,7 @@ static void save_memory_to_file(char* addr, size_t size) {
       }
     }
   }
-  FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
+  FREE_C_HEAP_ARRAY(char, destfile);
 }
 
 
@@ -279,14 +279,14 @@ static char* get_user_name(uid_t uid) {
                                      "pw_name zero length");
       }
     }
-    FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+    FREE_C_HEAP_ARRAY(char, pwbuf);
     return NULL;
   }
 
   char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
   strcpy(user_name, p->pw_name);
 
-  FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, pwbuf);
   return user_name;
 }
 
@@ -347,7 +347,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
     DIR* subdirp = os::opendir(usrdir_name);
 
     if (subdirp == NULL) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       continue;
     }
 
@@ -358,7 +358,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
     // symlink can be exploited.
     //
     if (!is_directory_secure(usrdir_name)) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       os::closedir(subdirp);
       continue;
     }
@@ -382,13 +382,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
         // don't follow symbolic links for the file
         RESTARTABLE(::lstat(filename, &statbuf), result);
         if (result == OS_ERR) {
-           FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+           FREE_C_HEAP_ARRAY(char, filename);
            continue;
         }
 
         // skip over files that are not regular files.
         if (!S_ISREG(statbuf.st_mode)) {
-          FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+          FREE_C_HEAP_ARRAY(char, filename);
           continue;
         }
 
@@ -398,7 +398,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
           if (statbuf.st_ctime > oldest_ctime) {
             char* user = strchr(dentry->d_name, '_') + 1;
 
-            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal);
+            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
             oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
 
             strcpy(oldest_user, user);
@@ -406,15 +406,15 @@ static char* get_user_name_slow(int vmid, TRAPS) {
           }
         }
 
-        FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+        FREE_C_HEAP_ARRAY(char, filename);
       }
     }
     os::closedir(subdirp);
-    FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
-    FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, udbuf);
+    FREE_C_HEAP_ARRAY(char, usrdir_name);
   }
   os::closedir(tmpdirp);
-  FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, tdbuf);
 
   return(oldest_user);
 }
@@ -481,7 +481,7 @@ static void remove_file(const char* dirname, const char* filename) {
 
   remove_file(path);
 
-  FREE_C_HEAP_ARRAY(char, path, mtInternal);
+  FREE_C_HEAP_ARRAY(char, path);
 }
 
 
@@ -558,7 +558,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
     errno = 0;
   }
   os::closedir(dirp);
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
 // make the user specific temporary directory. Returns true if
@@ -725,11 +725,11 @@ static char* mmap_create_shared(size_t size) {
 
   fd = create_sharedmem_resources(dirname, filename, size);
 
-  FREE_C_HEAP_ARRAY(char, user_name, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+  FREE_C_HEAP_ARRAY(char, user_name);
+  FREE_C_HEAP_ARRAY(char, dirname);
 
   if (fd == -1) {
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -743,7 +743,7 @@ static char* mmap_create_shared(size_t size) {
       warning("mmap failed -  %s\n", strerror(errno));
     }
     remove_file(filename);
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -872,9 +872,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
   // store file, we don't follow them when attaching either.
   //
   if (!is_directory_secure(dirname)) {
-    FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+    FREE_C_HEAP_ARRAY(char, dirname);
     if (luser != user) {
-      FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+      FREE_C_HEAP_ARRAY(char, luser);
     }
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Process not found");
@@ -890,9 +890,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
   strcpy(rfilename, filename);
 
   // free the c heap resources that are no longer needed
-  if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
-  FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+  if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
+  FREE_C_HEAP_ARRAY(char, dirname);
+  FREE_C_HEAP_ARRAY(char, filename);
 
   // open the shared memory file for the give vmid
   fd = open_sharedmem_file(rfilename, file_flags, CHECK);
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index 202e3612171..b8c3cb7efcc 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -403,7 +403,7 @@ void os::init_system_properties_values() {
                                                      mtInternal);
     sprintf(ld_library_path, "%s%s" SYS_EXT_DIR "/lib/%s:" DEFAULT_LIBPATH, v, v_colon, cpu_arch);
     Arguments::set_library_path(ld_library_path);
-    FREE_C_HEAP_ARRAY(char, ld_library_path, mtInternal);
+    FREE_C_HEAP_ARRAY(char, ld_library_path);
   }
 
   // Extensions directories.
@@ -414,7 +414,7 @@ void os::init_system_properties_values() {
   sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
   Arguments::set_endorsed_dirs(buf);
 
-  FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, buf);
 
 #undef DEFAULT_LIBPATH
 #undef SYS_EXT_DIR
@@ -1620,11 +1620,11 @@ bool os::dll_build_name(char* buffer, size_t buflen,
     // release the storage
     for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
-        FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
+        FREE_C_HEAP_ARRAY(char, pelements[i]);
       }
     }
     if (pelements != NULL) {
-      FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
+      FREE_C_HEAP_ARRAY(char*, pelements);
     }
   } else {
     snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
@@ -2935,7 +2935,7 @@ void os::Linux::rebuild_cpu_to_node_map() {
       }
     }
   }
-  FREE_C_HEAP_ARRAY(unsigned long, cpu_map, mtInternal);
+  FREE_C_HEAP_ARRAY(unsigned long, cpu_map);
 }
 
 int os::Linux::get_node_by_cpu(int cpu_id) {
diff --git a/hotspot/src/os/linux/vm/perfMemory_linux.cpp b/hotspot/src/os/linux/vm/perfMemory_linux.cpp
index 3fad2964ab8..58683a51cb1 100644
--- a/hotspot/src/os/linux/vm/perfMemory_linux.cpp
+++ b/hotspot/src/os/linux/vm/perfMemory_linux.cpp
@@ -127,7 +127,7 @@ static void save_memory_to_file(char* addr, size_t size) {
       }
     }
   }
-  FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
+  FREE_C_HEAP_ARRAY(char, destfile);
 }
 
 
@@ -279,14 +279,14 @@ static char* get_user_name(uid_t uid) {
                                      "pw_name zero length");
       }
     }
-    FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+    FREE_C_HEAP_ARRAY(char, pwbuf);
     return NULL;
   }
 
   char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
   strcpy(user_name, p->pw_name);
 
-  FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, pwbuf);
   return user_name;
 }
 
@@ -347,7 +347,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
     DIR* subdirp = os::opendir(usrdir_name);
 
     if (subdirp == NULL) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       continue;
     }
 
@@ -358,7 +358,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
     // symlink can be exploited.
     //
     if (!is_directory_secure(usrdir_name)) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       os::closedir(subdirp);
       continue;
     }
@@ -382,13 +382,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
         // don't follow symbolic links for the file
         RESTARTABLE(::lstat(filename, &statbuf), result);
         if (result == OS_ERR) {
-           FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+           FREE_C_HEAP_ARRAY(char, filename);
            continue;
         }
 
         // skip over files that are not regular files.
         if (!S_ISREG(statbuf.st_mode)) {
-          FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+          FREE_C_HEAP_ARRAY(char, filename);
           continue;
         }
 
@@ -398,7 +398,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
           if (statbuf.st_ctime > oldest_ctime) {
             char* user = strchr(dentry->d_name, '_') + 1;
 
-            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal);
+            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
             oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
 
             strcpy(oldest_user, user);
@@ -406,15 +406,15 @@ static char* get_user_name_slow(int vmid, TRAPS) {
           }
         }
 
-        FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+        FREE_C_HEAP_ARRAY(char, filename);
       }
     }
     os::closedir(subdirp);
-    FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
-    FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, udbuf);
+    FREE_C_HEAP_ARRAY(char, usrdir_name);
   }
   os::closedir(tmpdirp);
-  FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, tdbuf);
 
   return(oldest_user);
 }
@@ -481,7 +481,7 @@ static void remove_file(const char* dirname, const char* filename) {
 
   remove_file(path);
 
-  FREE_C_HEAP_ARRAY(char, path, mtInternal);
+  FREE_C_HEAP_ARRAY(char, path);
 }
 
 
@@ -558,7 +558,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
     errno = 0;
   }
   os::closedir(dirp);
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
 // make the user specific temporary directory. Returns true if
@@ -725,11 +725,11 @@ static char* mmap_create_shared(size_t size) {
 
   fd = create_sharedmem_resources(dirname, filename, size);
 
-  FREE_C_HEAP_ARRAY(char, user_name, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+  FREE_C_HEAP_ARRAY(char, user_name);
+  FREE_C_HEAP_ARRAY(char, dirname);
 
   if (fd == -1) {
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -743,7 +743,7 @@ static char* mmap_create_shared(size_t size) {
       warning("mmap failed -  %s\n", strerror(errno));
     }
     remove_file(filename);
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -872,9 +872,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
   // store file, we don't follow them when attaching either.
   //
   if (!is_directory_secure(dirname)) {
-    FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+    FREE_C_HEAP_ARRAY(char, dirname);
     if (luser != user) {
-      FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+      FREE_C_HEAP_ARRAY(char, luser);
     }
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Process not found");
@@ -890,9 +890,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
   strcpy(rfilename, filename);
 
   // free the c heap resources that are no longer needed
-  if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
-  FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+  if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
+  FREE_C_HEAP_ARRAY(char, dirname);
+  FREE_C_HEAP_ARRAY(char, filename);
 
   // open the shared memory file for the give vmid
   fd = open_sharedmem_file(rfilename, file_flags, THREAD);
diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp
index d67200f9bbb..aa74ea6a83c 100644
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp
@@ -506,7 +506,7 @@ static bool assign_distribution(processorid_t* id_array,
     }
   }
   if (available_id != NULL) {
-    FREE_C_HEAP_ARRAY(bool, available_id, mtInternal);
+    FREE_C_HEAP_ARRAY(bool, available_id);
   }
   return true;
 }
@@ -538,7 +538,7 @@ bool os::distribute_processes(uint length, uint* distribution) {
     }
   }
   if (id_array != NULL) {
-    FREE_C_HEAP_ARRAY(processorid_t, id_array, mtInternal);
+    FREE_C_HEAP_ARRAY(processorid_t, id_array);
   }
   return result;
 }
@@ -675,7 +675,7 @@ void os::init_system_properties_values() {
 
     // Determine search path count and required buffer size.
     if (dlinfo(RTLD_SELF, RTLD_DI_SERINFOSIZE, (void *)info) == -1) {
-      FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+      FREE_C_HEAP_ARRAY(char, buf);
       vm_exit_during_initialization("dlinfo SERINFOSIZE request", dlerror());
     }
 
@@ -686,8 +686,8 @@ void os::init_system_properties_values() {
 
     // Obtain search path information.
     if (dlinfo(RTLD_SELF, RTLD_DI_SERINFO, (void *)info) == -1) {
-      FREE_C_HEAP_ARRAY(char, buf, mtInternal);
-      FREE_C_HEAP_ARRAY(char, info, mtInternal);
+      FREE_C_HEAP_ARRAY(char, buf);
+      FREE_C_HEAP_ARRAY(char, info);
       vm_exit_during_initialization("dlinfo SERINFO request", dlerror());
     }
 
@@ -757,8 +757,8 @@ void os::init_system_properties_values() {
     // Callee copies into its own buffer.
     Arguments::set_library_path(library_path);
 
-    FREE_C_HEAP_ARRAY(char, library_path, mtInternal);
-    FREE_C_HEAP_ARRAY(char, info, mtInternal);
+    FREE_C_HEAP_ARRAY(char, library_path);
+    FREE_C_HEAP_ARRAY(char, info);
   }
 
   // Extensions directories.
@@ -769,7 +769,7 @@ void os::init_system_properties_values() {
   sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
   Arguments::set_endorsed_dirs(buf);
 
-  FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, buf);
 
 #undef SYS_EXT_DIR
 #undef EXTENSIONS_DIR
@@ -1599,11 +1599,11 @@ bool os::dll_build_name(char* buffer, size_t buflen,
     // release the storage
     for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
-        FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
+        FREE_C_HEAP_ARRAY(char, pelements[i]);
       }
     }
     if (pelements != NULL) {
-      FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
+      FREE_C_HEAP_ARRAY(char*, pelements);
     }
   } else {
     snprintf(buffer, buflen, "%s/lib%s.so", pname, fname);
@@ -4681,7 +4681,7 @@ jint os::init_2(void) {
       size_t lgrp_limit = os::numa_get_groups_num();
       int *lgrp_ids = NEW_C_HEAP_ARRAY(int, lgrp_limit, mtInternal);
       size_t lgrp_num = os::numa_get_leaf_groups(lgrp_ids, lgrp_limit);
-      FREE_C_HEAP_ARRAY(int, lgrp_ids, mtInternal);
+      FREE_C_HEAP_ARRAY(int, lgrp_ids);
       if (lgrp_num < 2) {
         // There's only one locality group, disable NUMA.
         UseNUMA = false;
diff --git a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
index 9c348d9b2d1..f3f3a174304 100644
--- a/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
+++ b/hotspot/src/os/solaris/vm/perfMemory_solaris.cpp
@@ -129,7 +129,7 @@ static void save_memory_to_file(char* addr, size_t size) {
       }
     }
   }
-  FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
+  FREE_C_HEAP_ARRAY(char, destfile);
 }
 
 
@@ -270,14 +270,14 @@ static char* get_user_name(uid_t uid) {
                                      "pw_name zero length");
       }
     }
-    FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+    FREE_C_HEAP_ARRAY(char, pwbuf);
     return NULL;
   }
 
   char* user_name = NEW_C_HEAP_ARRAY(char, strlen(p->pw_name) + 1, mtInternal);
   strcpy(user_name, p->pw_name);
 
-  FREE_C_HEAP_ARRAY(char, pwbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, pwbuf);
   return user_name;
 }
 
@@ -338,7 +338,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
     DIR* subdirp = os::opendir(usrdir_name);
 
     if (subdirp == NULL) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       continue;
     }
 
@@ -349,7 +349,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
     // symlink can be exploited.
     //
     if (!is_directory_secure(usrdir_name)) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       os::closedir(subdirp);
       continue;
     }
@@ -373,13 +373,13 @@ static char* get_user_name_slow(int vmid, TRAPS) {
         // don't follow symbolic links for the file
         RESTARTABLE(::lstat(filename, &statbuf), result);
         if (result == OS_ERR) {
-           FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+           FREE_C_HEAP_ARRAY(char, filename);
            continue;
         }
 
         // skip over files that are not regular files.
         if (!S_ISREG(statbuf.st_mode)) {
-          FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+          FREE_C_HEAP_ARRAY(char, filename);
           continue;
         }
 
@@ -389,7 +389,7 @@ static char* get_user_name_slow(int vmid, TRAPS) {
           if (statbuf.st_ctime > oldest_ctime) {
             char* user = strchr(dentry->d_name, '_') + 1;
 
-            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user, mtInternal);
+            if (oldest_user != NULL) FREE_C_HEAP_ARRAY(char, oldest_user);
             oldest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
 
             strcpy(oldest_user, user);
@@ -397,15 +397,15 @@ static char* get_user_name_slow(int vmid, TRAPS) {
           }
         }
 
-        FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+        FREE_C_HEAP_ARRAY(char, filename);
       }
     }
     os::closedir(subdirp);
-    FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
-    FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, udbuf);
+    FREE_C_HEAP_ARRAY(char, usrdir_name);
   }
   os::closedir(tmpdirp);
-  FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, tdbuf);
 
   return(oldest_user);
 }
@@ -520,7 +520,7 @@ static void remove_file(const char* dirname, const char* filename) {
 
   remove_file(path);
 
-  FREE_C_HEAP_ARRAY(char, path, mtInternal);
+  FREE_C_HEAP_ARRAY(char, path);
 }
 
 
@@ -597,7 +597,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
     errno = 0;
   }
   os::closedir(dirp);
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
 // make the user specific temporary directory. Returns true if
@@ -742,11 +742,11 @@ static char* mmap_create_shared(size_t size) {
 
   fd = create_sharedmem_resources(dirname, filename, size);
 
-  FREE_C_HEAP_ARRAY(char, user_name, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+  FREE_C_HEAP_ARRAY(char, user_name);
+  FREE_C_HEAP_ARRAY(char, dirname);
 
   if (fd == -1) {
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -760,7 +760,7 @@ static char* mmap_create_shared(size_t size) {
       warning("mmap failed -  %s\n", strerror(errno));
     }
     remove_file(filename);
-    FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+    FREE_C_HEAP_ARRAY(char, filename);
     return NULL;
   }
 
@@ -890,9 +890,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
   // store file, we don't follow them when attaching either.
   //
   if (!is_directory_secure(dirname)) {
-    FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+    FREE_C_HEAP_ARRAY(char, dirname);
     if (luser != user) {
-      FREE_C_HEAP_ARRAY(char, luser, mtInternal);
+      FREE_C_HEAP_ARRAY(char, luser);
     }
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Process not found");
@@ -908,9 +908,9 @@ static void mmap_attach_shared(const char* user, int vmid, PerfMemory::PerfMemor
   strcpy(rfilename, filename);
 
   // free the c heap resources that are no longer needed
-  if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
-  FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+  if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
+  FREE_C_HEAP_ARRAY(char, dirname);
+  FREE_C_HEAP_ARRAY(char, filename);
 
   // open the shared memory file for the give vmid
   fd = open_sharedmem_file(rfilename, file_flags, THREAD);
diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp
index 31de938eef4..5677e63a058 100644
--- a/hotspot/src/os/windows/vm/os_windows.cpp
+++ b/hotspot/src/os/windows/vm/os_windows.cpp
@@ -211,7 +211,7 @@ void os::init_system_properties_values() {
     }
     strcpy(home_path, home_dir);
     Arguments::set_java_home(home_path);
-    FREE_C_HEAP_ARRAY(char, home_path, mtInternal);
+    FREE_C_HEAP_ARRAY(char, home_path);
 
     dll_path = NEW_C_HEAP_ARRAY(char, strlen(home_dir) + strlen(bin) + 1,
                                 mtInternal);
@@ -221,7 +221,7 @@ void os::init_system_properties_values() {
     strcpy(dll_path, home_dir);
     strcat(dll_path, bin);
     Arguments::set_dll_dir(dll_path);
-    FREE_C_HEAP_ARRAY(char, dll_path, mtInternal);
+    FREE_C_HEAP_ARRAY(char, dll_path);
 
     if (!set_boot_path('\\', ';')) {
       return;
@@ -276,7 +276,7 @@ void os::init_system_properties_values() {
     strcat(library_path, ";.");
 
     Arguments::set_library_path(library_path);
-    FREE_C_HEAP_ARRAY(char, library_path, mtInternal);
+    FREE_C_HEAP_ARRAY(char, library_path);
   }
 
   // Default extensions directory
@@ -301,7 +301,7 @@ void os::init_system_properties_values() {
     Arguments::set_endorsed_dirs(buf);
     // (Arguments::set_endorsed_dirs() calls SystemProperty::set_value(), which
     //  duplicates the input.)
-    FREE_C_HEAP_ARRAY(char, buf, mtInternal);
+    FREE_C_HEAP_ARRAY(char, buf);
 #undef ENDORSED_DIR
   }
 
@@ -1136,7 +1136,7 @@ DIR * os::opendir(const char *dirname) {
 
   dirp->path = (char *)malloc(strlen(dirname) + 5, mtInternal);
   if (dirp->path == 0) {
-    free(dirp, mtInternal);
+    free(dirp);
     errno = ENOMEM;
     return 0;
   }
@@ -1144,13 +1144,13 @@ DIR * os::opendir(const char *dirname) {
 
   fattr = GetFileAttributes(dirp->path);
   if (fattr == 0xffffffff) {
-    free(dirp->path, mtInternal);
-    free(dirp, mtInternal);
+    free(dirp->path);
+    free(dirp);
     errno = ENOENT;
     return 0;
   } else if ((fattr & FILE_ATTRIBUTE_DIRECTORY) == 0) {
-    free(dirp->path, mtInternal);
-    free(dirp, mtInternal);
+    free(dirp->path);
+    free(dirp);
     errno = ENOTDIR;
     return 0;
   }
@@ -1168,8 +1168,8 @@ DIR * os::opendir(const char *dirname) {
   dirp->handle = FindFirstFile(dirp->path, &dirp->find_data);
   if (dirp->handle == INVALID_HANDLE_VALUE) {
     if (GetLastError() != ERROR_FILE_NOT_FOUND) {
-      free(dirp->path, mtInternal);
-      free(dirp, mtInternal);
+      free(dirp->path);
+      free(dirp);
       errno = EACCES;
       return 0;
     }
@@ -1207,8 +1207,8 @@ int os::closedir(DIR *dirp) {
     }
     dirp->handle = INVALID_HANDLE_VALUE;
   }
-  free(dirp->path, mtInternal);
-  free(dirp, mtInternal);
+  free(dirp->path);
+  free(dirp);
   return 0;
 }
 
@@ -1275,11 +1275,11 @@ bool os::dll_build_name(char *buffer, size_t buflen,
     // release the storage
     for (int i = 0; i < n; i++) {
       if (pelements[i] != NULL) {
-        FREE_C_HEAP_ARRAY(char, pelements[i], mtInternal);
+        FREE_C_HEAP_ARRAY(char, pelements[i]);
       }
     }
     if (pelements != NULL) {
-      FREE_C_HEAP_ARRAY(char*, pelements, mtInternal);
+      FREE_C_HEAP_ARRAY(char*, pelements);
     }
   } else {
     jio_snprintf(buffer, buflen, "%s\\%s.dll", pname, fname);
@@ -2745,7 +2745,7 @@ class NUMANodeListHolder {
 
   void free_node_list() {
     if (_numa_used_node_list != NULL) {
-      FREE_C_HEAP_ARRAY(int, _numa_used_node_list, mtInternal);
+      FREE_C_HEAP_ARRAY(int, _numa_used_node_list);
     }
   }
 
@@ -4642,7 +4642,7 @@ static int stdinAvailable(int fd, long *pbytes) {
 
   error = ::PeekConsoleInput(han, lpBuffer, numEvents, &numEventsRead);
   if (error == 0) {
-    os::free(lpBuffer, mtInternal);
+    os::free(lpBuffer);
     return FALSE;
   }
 
@@ -4663,7 +4663,7 @@ static int stdinAvailable(int fd, long *pbytes) {
   }
 
   if (lpBuffer != NULL) {
-    os::free(lpBuffer, mtInternal);
+    os::free(lpBuffer);
   }
 
   *pbytes = (long) actualLength;
diff --git a/hotspot/src/os/windows/vm/perfMemory_windows.cpp b/hotspot/src/os/windows/vm/perfMemory_windows.cpp
index edbd0bf622d..74ebe7d6f8a 100644
--- a/hotspot/src/os/windows/vm/perfMemory_windows.cpp
+++ b/hotspot/src/os/windows/vm/perfMemory_windows.cpp
@@ -122,7 +122,7 @@ static void save_memory_to_file(char* addr, size_t size) {
     }
   }
 
-  FREE_C_HEAP_ARRAY(char, destfile, mtInternal);
+  FREE_C_HEAP_ARRAY(char, destfile);
 }
 
 // Shared Memory Implementation Details
@@ -335,7 +335,7 @@ static char* get_user_name_slow(int vmid) {
     DIR* subdirp = os::opendir(usrdir_name);
 
     if (subdirp == NULL) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       continue;
     }
 
@@ -346,7 +346,7 @@ static char* get_user_name_slow(int vmid) {
     // symlink can be exploited.
     //
     if (!is_directory_secure(usrdir_name)) {
-      FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+      FREE_C_HEAP_ARRAY(char, usrdir_name);
       os::closedir(subdirp);
       continue;
     }
@@ -367,13 +367,13 @@ static char* get_user_name_slow(int vmid) {
         strcat(filename, udentry->d_name);
 
         if (::stat(filename, &statbuf) == OS_ERR) {
-           FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+           FREE_C_HEAP_ARRAY(char, filename);
            continue;
         }
 
         // skip over files that are not regular files.
         if ((statbuf.st_mode & S_IFMT) != S_IFREG) {
-          FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+          FREE_C_HEAP_ARRAY(char, filename);
           continue;
         }
 
@@ -395,22 +395,22 @@ static char* get_user_name_slow(int vmid) {
         if (statbuf.st_ctime > latest_ctime) {
           char* user = strchr(dentry->d_name, '_') + 1;
 
-          if (latest_user != NULL) FREE_C_HEAP_ARRAY(char, latest_user, mtInternal);
+          if (latest_user != NULL) FREE_C_HEAP_ARRAY(char, latest_user);
           latest_user = NEW_C_HEAP_ARRAY(char, strlen(user)+1, mtInternal);
 
           strcpy(latest_user, user);
           latest_ctime = statbuf.st_ctime;
         }
 
-        FREE_C_HEAP_ARRAY(char, filename, mtInternal);
+        FREE_C_HEAP_ARRAY(char, filename);
       }
     }
     os::closedir(subdirp);
-    FREE_C_HEAP_ARRAY(char, udbuf, mtInternal);
-    FREE_C_HEAP_ARRAY(char, usrdir_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, udbuf);
+    FREE_C_HEAP_ARRAY(char, usrdir_name);
   }
   os::closedir(tmpdirp);
-  FREE_C_HEAP_ARRAY(char, tdbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, tdbuf);
 
   return(latest_user);
 }
@@ -502,7 +502,7 @@ static void remove_file(const char* dirname, const char* filename) {
     }
   }
 
-  FREE_C_HEAP_ARRAY(char, path, mtInternal);
+  FREE_C_HEAP_ARRAY(char, path);
 }
 
 // returns true if the process represented by pid is alive, otherwise
@@ -683,7 +683,7 @@ static void cleanup_sharedmem_resources(const char* dirname) {
     errno = 0;
   }
   os::closedir(dirp);
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
 }
 
 // create a file mapping object with the requested name, and size
@@ -749,11 +749,11 @@ static void free_security_desc(PSECURITY_DESCRIPTOR pSD) {
     // be an ACL we enlisted. free the resources.
     //
     if (success && exists && pACL != NULL && !isdefault) {
-      FREE_C_HEAP_ARRAY(char, pACL, mtInternal);
+      FREE_C_HEAP_ARRAY(char, pACL);
     }
 
     // free the security descriptor
-    FREE_C_HEAP_ARRAY(char, pSD, mtInternal);
+    FREE_C_HEAP_ARRAY(char, pSD);
   }
 }
 
@@ -768,7 +768,7 @@ static void free_security_attr(LPSECURITY_ATTRIBUTES lpSA) {
     lpSA->lpSecurityDescriptor = NULL;
 
     // free the security attributes structure
-    FREE_C_HEAP_ARRAY(char, lpSA, mtInternal);
+    FREE_C_HEAP_ARRAY(char, lpSA);
   }
 }
 
@@ -815,7 +815,7 @@ static PSID get_user_sid(HANDLE hProcess) {
       warning("GetTokenInformation failure: lasterror = %d,"
               " rsize = %d\n", GetLastError(), rsize);
     }
-    FREE_C_HEAP_ARRAY(char, token_buf, mtInternal);
+    FREE_C_HEAP_ARRAY(char, token_buf);
     CloseHandle(hAccessToken);
     return NULL;
   }
@@ -828,15 +828,15 @@ static PSID get_user_sid(HANDLE hProcess) {
       warning("GetTokenInformation failure: lasterror = %d,"
               " rsize = %d\n", GetLastError(), rsize);
     }
-    FREE_C_HEAP_ARRAY(char, token_buf, mtInternal);
-    FREE_C_HEAP_ARRAY(char, pSID, mtInternal);
+    FREE_C_HEAP_ARRAY(char, token_buf);
+    FREE_C_HEAP_ARRAY(char, pSID);
     CloseHandle(hAccessToken);
     return NULL;
   }
 
   // close the access token.
   CloseHandle(hAccessToken);
-  FREE_C_HEAP_ARRAY(char, token_buf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, token_buf);
 
   return pSID;
 }
@@ -920,7 +920,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
     if (PrintMiscellaneous && Verbose) {
       warning("InitializeAcl failure: lasterror = %d \n", GetLastError());
     }
-    FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+    FREE_C_HEAP_ARRAY(char, newACL);
     return false;
   }
 
@@ -933,7 +933,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
         if (PrintMiscellaneous && Verbose) {
           warning("InitializeAcl failure: lasterror = %d \n", GetLastError());
         }
-        FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+        FREE_C_HEAP_ARRAY(char, newACL);
         return false;
       }
       if (((ACCESS_ALLOWED_ACE *)ace)->Header.AceFlags && INHERITED_ACE) {
@@ -960,7 +960,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
           if (PrintMiscellaneous && Verbose) {
             warning("AddAce failure: lasterror = %d \n", GetLastError());
           }
-          FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+          FREE_C_HEAP_ARRAY(char, newACL);
           return false;
         }
       }
@@ -976,7 +976,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
         warning("AddAccessAllowedAce failure: lasterror = %d \n",
                 GetLastError());
       }
-      FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+      FREE_C_HEAP_ARRAY(char, newACL);
       return false;
     }
   }
@@ -991,7 +991,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
         if (PrintMiscellaneous && Verbose) {
           warning("InitializeAcl failure: lasterror = %d \n", GetLastError());
         }
-        FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+        FREE_C_HEAP_ARRAY(char, newACL);
         return false;
       }
       if (!AddAce(newACL, ACL_REVISION, MAXDWORD, ace,
@@ -999,7 +999,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
         if (PrintMiscellaneous && Verbose) {
           warning("AddAce failure: lasterror = %d \n", GetLastError());
         }
-        FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+        FREE_C_HEAP_ARRAY(char, newACL);
         return false;
       }
       ace_index++;
@@ -1012,7 +1012,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
       warning("SetSecurityDescriptorDacl failure:"
               " lasterror = %d \n", GetLastError());
     }
-    FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+    FREE_C_HEAP_ARRAY(char, newACL);
     return false;
   }
 
@@ -1032,7 +1032,7 @@ static bool add_allow_aces(PSECURITY_DESCRIPTOR pSD,
         warning("SetSecurityDescriptorControl failure:"
                 " lasterror = %d \n", GetLastError());
       }
-      FREE_C_HEAP_ARRAY(char, newACL, mtInternal);
+      FREE_C_HEAP_ARRAY(char, newACL);
       return false;
     }
   }
@@ -1149,7 +1149,7 @@ static LPSECURITY_ATTRIBUTES make_user_everybody_admin_security_attr(
   // create a security attributes structure with access control
   // entries as initialized above.
   LPSECURITY_ATTRIBUTES lpSA = make_security_attr(aces, 3);
-  FREE_C_HEAP_ARRAY(char, aces[0].pSid, mtInternal);
+  FREE_C_HEAP_ARRAY(char, aces[0].pSid);
   FreeSid(everybodySid);
   FreeSid(administratorsSid);
   return(lpSA);
@@ -1464,15 +1464,15 @@ static char* mapping_create_shared(size_t size) {
   assert(((size != 0) && (size % os::vm_page_size() == 0)),
          "unexpected PerfMemry region size");
 
-  FREE_C_HEAP_ARRAY(char, user, mtInternal);
+  FREE_C_HEAP_ARRAY(char, user);
 
   // create the shared memory resources
   sharedmem_fileMapHandle =
                create_sharedmem_resources(dirname, filename, objectname, size);
 
-  FREE_C_HEAP_ARRAY(char, filename, mtInternal);
-  FREE_C_HEAP_ARRAY(char, objectname, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+  FREE_C_HEAP_ARRAY(char, filename);
+  FREE_C_HEAP_ARRAY(char, objectname);
+  FREE_C_HEAP_ARRAY(char, dirname);
 
   if (sharedmem_fileMapHandle == NULL) {
     return NULL;
@@ -1627,7 +1627,7 @@ static void open_file_mapping(const char* user, int vmid,
   // store file, we also don't following them when attaching
   //
   if (!is_directory_secure(dirname)) {
-    FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
+    FREE_C_HEAP_ARRAY(char, dirname);
     THROW_MSG(vmSymbols::java_lang_IllegalArgumentException(),
               "Process not found");
   }
@@ -1646,10 +1646,10 @@ static void open_file_mapping(const char* user, int vmid,
   strcpy(robjectname, objectname);
 
   // free the c heap resources that are no longer needed
-  if (luser != user) FREE_C_HEAP_ARRAY(char, luser, mtInternal);
-  FREE_C_HEAP_ARRAY(char, dirname, mtInternal);
-  FREE_C_HEAP_ARRAY(char, filename, mtInternal);
-  FREE_C_HEAP_ARRAY(char, objectname, mtInternal);
+  if (luser != user) FREE_C_HEAP_ARRAY(char, luser);
+  FREE_C_HEAP_ARRAY(char, dirname);
+  FREE_C_HEAP_ARRAY(char, filename);
+  FREE_C_HEAP_ARRAY(char, objectname);
 
   if (*sizep == 0) {
     size = sharedmem_filesize(rfilename, CHECK);
diff --git a/hotspot/src/share/vm/asm/codeBuffer.cpp b/hotspot/src/share/vm/asm/codeBuffer.cpp
index 025880fa71a..4567735fbd6 100644
--- a/hotspot/src/share/vm/asm/codeBuffer.cpp
+++ b/hotspot/src/share/vm/asm/codeBuffer.cpp
@@ -1025,7 +1025,7 @@ class CodeString: public CHeapObj<mtCode> {
 
   ~CodeString() {
     assert(_next == NULL, "wrong interface for freeing list");
-    os::free((void*)_string, mtCode);
+    os::free((void*)_string);
   }
 
   bool is_comment() const { return _offset >= 0; }
diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp
index 4def66bb3b0..4f1b0370efb 100644
--- a/hotspot/src/share/vm/classfile/classLoader.cpp
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp
@@ -161,7 +161,7 @@ MetaIndex::MetaIndex(char** meta_package_names, int num_meta_package_names) {
 
 
 MetaIndex::~MetaIndex() {
-  FREE_C_HEAP_ARRAY(char*, _meta_package_names, mtClass);
+  FREE_C_HEAP_ARRAY(char*, _meta_package_names);
 }
 
 
@@ -247,7 +247,7 @@ ClassPathZipEntry::~ClassPathZipEntry() {
   if (ZipClose != NULL) {
     (*ZipClose)(_zip);
   }
-  FREE_C_HEAP_ARRAY(char, _zip_name, mtClass);
+  FREE_C_HEAP_ARRAY(char, _zip_name);
 }
 
 u1* ClassPathZipEntry::open_entry(const char* name, jint* filesize, bool nul_terminate, TRAPS) {
diff --git a/hotspot/src/share/vm/classfile/loaderConstraints.cpp b/hotspot/src/share/vm/classfile/loaderConstraints.cpp
index 8d59c00e718..1cdc34d0548 100644
--- a/hotspot/src/share/vm/classfile/loaderConstraints.cpp
+++ b/hotspot/src/share/vm/classfile/loaderConstraints.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -164,7 +164,7 @@ void LoaderConstraintTable::purge_loader_constraints() {
 
         // Purge entry
         *p = probe->next();
-        FREE_C_HEAP_ARRAY(oop, probe->loaders(), mtClass);
+        FREE_C_HEAP_ARRAY(oop, probe->loaders());
         free_entry(probe);
       } else {
 #ifdef ASSERT
@@ -340,7 +340,7 @@ void LoaderConstraintTable::ensure_loader_constraint_capacity(
         ClassLoaderData** new_loaders = NEW_C_HEAP_ARRAY(ClassLoaderData*, n, mtClass);
         memcpy(new_loaders, p->loaders(), sizeof(ClassLoaderData*) * p->num_loaders());
         p->set_max_loaders(n);
-        FREE_C_HEAP_ARRAY(ClassLoaderData*, p->loaders(), mtClass);
+        FREE_C_HEAP_ARRAY(ClassLoaderData*, p->loaders());
         p->set_loaders(new_loaders);
     }
 }
@@ -422,7 +422,7 @@ void LoaderConstraintTable::merge_loader_constraints(
   }
 
   *pp2 = p2->next();
-  FREE_C_HEAP_ARRAY(oop, p2->loaders(), mtClass);
+  FREE_C_HEAP_ARRAY(oop, p2->loaders());
   free_entry(p2);
   return;
 }
diff --git a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp
index 3f52648310f..d1992e4bd4a 100644
--- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp
+++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.hpp
@@ -89,7 +89,7 @@ public:
   }
   ~SharedPathsMiscInfo() {
     if (_allocated) {
-      FREE_C_HEAP_ARRAY(char, _buf_start, mtClass);
+      FREE_C_HEAP_ARRAY(char, _buf_start);
     }
   }
   int get_used_bytes() {
diff --git a/hotspot/src/share/vm/code/codeBlob.cpp b/hotspot/src/share/vm/code/codeBlob.cpp
index 3cf66665d87..255f0f5225e 100644
--- a/hotspot/src/share/vm/code/codeBlob.cpp
+++ b/hotspot/src/share/vm/code/codeBlob.cpp
@@ -168,7 +168,7 @@ void CodeBlob::trace_new_stub(CodeBlob* stub, const char* name1, const char* nam
 
 void CodeBlob::flush() {
   if (_oop_maps) {
-    FREE_C_HEAP_ARRAY(unsigned char, _oop_maps, mtCode);
+    FREE_C_HEAP_ARRAY(unsigned char, _oop_maps);
     _oop_maps = NULL;
   }
   _strings.free();
diff --git a/hotspot/src/share/vm/code/codeCache.cpp b/hotspot/src/share/vm/code/codeCache.cpp
index b3942454ab8..f81e2983172 100644
--- a/hotspot/src/share/vm/code/codeCache.cpp
+++ b/hotspot/src/share/vm/code/codeCache.cpp
@@ -1190,7 +1190,7 @@ void CodeCache::print_internals() {
     }
   }
 
-  FREE_C_HEAP_ARRAY(int, buckets, mtCode);
+  FREE_C_HEAP_ARRAY(int, buckets);
   print_memory_overhead();
 }
 
diff --git a/hotspot/src/share/vm/compiler/compileLog.cpp b/hotspot/src/share/vm/compiler/compileLog.cpp
index 340251f3265..cb508227d8b 100644
--- a/hotspot/src/share/vm/compiler/compileLog.cpp
+++ b/hotspot/src/share/vm/compiler/compileLog.cpp
@@ -58,8 +58,8 @@ CompileLog::CompileLog(const char* file_name, FILE* fp, intx thread_id)
 CompileLog::~CompileLog() {
   delete _out;
   _out = NULL;
-  FREE_C_HEAP_ARRAY(char, _identities, mtCompiler);
-  FREE_C_HEAP_ARRAY(char, _file, mtCompiler);
+  FREE_C_HEAP_ARRAY(char, _identities);
+  FREE_C_HEAP_ARRAY(char, _file);
 }
 
 
diff --git a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
index aec716c782a..a0e8baa7a29 100644
--- a/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/concurrentMarkSweep/concurrentMarkSweepGeneration.cpp
@@ -653,15 +653,15 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
         || _cursor == NULL) {
       warning("Failed to allocate survivor plab/chunk array");
       if (_survivor_plab_array  != NULL) {
-        FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array, mtGC);
+        FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array);
         _survivor_plab_array = NULL;
       }
       if (_survivor_chunk_array != NULL) {
-        FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array, mtGC);
+        FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array);
         _survivor_chunk_array = NULL;
       }
       if (_cursor != NULL) {
-        FREE_C_HEAP_ARRAY(size_t, _cursor, mtGC);
+        FREE_C_HEAP_ARRAY(size_t, _cursor);
         _cursor = NULL;
       }
     } else {
@@ -671,10 +671,10 @@ CMSCollector::CMSCollector(ConcurrentMarkSweepGeneration* cmsGen,
         if (vec == NULL) {
           warning("Failed to allocate survivor plab array");
           for (int j = i; j > 0; j--) {
-            FREE_C_HEAP_ARRAY(HeapWord*, _survivor_plab_array[j-1].array(), mtGC);
+            FREE_C_HEAP_ARRAY(HeapWord*, _survivor_plab_array[j-1].array());
           }
-          FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array, mtGC);
-          FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array, mtGC);
+          FREE_C_HEAP_ARRAY(ChunkArray, _survivor_plab_array);
+          FREE_C_HEAP_ARRAY(HeapWord*, _survivor_chunk_array);
           _survivor_plab_array = NULL;
           _survivor_chunk_array = NULL;
           _survivor_chunk_capacity = 0;
diff --git a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp
index 6d93ce04299..635781b1424 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/concurrentG1Refine.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, 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
@@ -107,7 +107,7 @@ ConcurrentG1Refine::~ConcurrentG1Refine() {
     for (uint i = 0; i < _n_threads; i++) {
       delete _threads[i];
     }
-    FREE_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _threads, mtGC);
+    FREE_C_HEAP_ARRAY(ConcurrentG1RefineThread*, _threads);
   }
 }
 
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp
index c7cad45fe7d..f70375800e7 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CodeCacheRemSet.cpp
@@ -111,13 +111,13 @@ CodeRootSetTable::~CodeRootSetTable() {
       // read next before freeing.
       e = e->next();
       unlink_entry(to_remove);
-      FREE_C_HEAP_ARRAY(char, to_remove, mtGC);
+      FREE_C_HEAP_ARRAY(char, to_remove);
     }
   }
   assert(number_of_entries() == 0, "should have removed all entries");
   free_buckets();
   for (BasicHashtableEntry<mtGC>* e = new_entry_free_list(); e != NULL; e = new_entry_free_list()) {
-    FREE_C_HEAP_ARRAY(char, e, mtGC);
+    FREE_C_HEAP_ARRAY(char, e);
   }
 }
 
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
index ebd77eb0b1e..134876d9c04 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp
@@ -3561,7 +3561,7 @@ G1CollectedHeap::update_surviving_young_words(size_t* surv_young_words) {
 void
 G1CollectedHeap::cleanup_surviving_young_words() {
   guarantee( _surviving_young_words != NULL, "pre-condition" );
-  FREE_C_HEAP_ARRAY(size_t, _surviving_young_words, mtGC);
+  FREE_C_HEAP_ARRAY(size_t, _surviving_young_words);
   _surviving_young_words = NULL;
 }
 
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp
index 8421eb07b6a..1a9cedda9bc 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp
@@ -53,7 +53,7 @@ class WorkerDataArray  : public CHeapObj<mtGC> {
   }
 
   ~WorkerDataArray() {
-    FREE_C_HEAP_ARRAY(T, _data, mtGC);
+    FREE_C_HEAP_ARRAY(T, _data);
   }
 
   void set(uint worker_i, T value) {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp
index 9d5b382b5dd..b64f56146ee 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1HotCardCache.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, 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
@@ -53,7 +53,7 @@ void G1HotCardCache::initialize(G1RegionToSpaceMapper* card_counts_storage) {
 G1HotCardCache::~G1HotCardCache() {
   if (default_use_cache()) {
     assert(_hot_cache != NULL, "Logic");
-    FREE_C_HEAP_ARRAY(jbyte*, _hot_cache, mtGC);
+    FREE_C_HEAP_ARRAY(jbyte*, _hot_cache);
   }
 }
 
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
index 311b9d00832..6024928e153 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1ParScanThreadState.cpp
@@ -65,7 +65,7 @@ G1ParScanThreadState::G1ParScanThreadState(G1CollectedHeap* g1h, uint queue_num,
 G1ParScanThreadState::~G1ParScanThreadState() {
   _g1_par_allocator->retire_alloc_buffers();
   delete _g1_par_allocator;
-  FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base, mtGC);
+  FREE_C_HEAP_ARRAY(size_t, _surviving_young_words_base);
 }
 
 void
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
index 048c09f5c52..169fb0fe453 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSet.cpp
@@ -94,7 +94,7 @@ G1RemSet::~G1RemSet() {
   for (uint i = 0; i < n_workers(); i++) {
     assert(_cset_rs_update_cl[i] == NULL, "it should be");
   }
-  FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl, mtGC);
+  FREE_C_HEAP_ARRAY(OopsInHeapRegionClosure*, _cset_rs_update_cl);
 }
 
 class ScanRSClosure : public HeapRegionClosure {
@@ -353,7 +353,7 @@ void G1RemSet::cleanup_after_oops_into_collection_set_do() {
   for (uint i = 0; i < n_workers(); ++i) {
     _total_cards_scanned += _cards_scanned[i];
   }
-  FREE_C_HEAP_ARRAY(size_t, _cards_scanned, mtGC);
+  FREE_C_HEAP_ARRAY(size_t, _cards_scanned);
   _cards_scanned = NULL;
   // Cleanup after copy
   _g1->set_refine_cte_cl_concurrency(true);
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.hpp b/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.hpp
index 9c019d99e13..2b083388fbc 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.hpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1RemSetSummary.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -59,7 +59,7 @@ private:
 
   void free_and_null() {
     if (_rs_threads_vtimes) {
-      FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes, mtGC);
+      FREE_C_HEAP_ARRAY(double, _rs_threads_vtimes);
       _rs_threads_vtimes = NULL;
       _num_vtimes = 0;
     }
diff --git a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
index 2b41688a3e5..e0fce706491 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/g1StringDedupTable.cpp
@@ -187,7 +187,7 @@ G1StringDedupTable::G1StringDedupTable(size_t size, jint hash_seed) :
 }
 
 G1StringDedupTable::~G1StringDedupTable() {
-  FREE_C_HEAP_ARRAY(G1StringDedupEntry*, _buckets, mtGC);
+  FREE_C_HEAP_ARRAY(G1StringDedupEntry*, _buckets);
 }
 
 void G1StringDedupTable::create() {
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
index 5de9dbcce98..e083912a15e 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionManager.cpp
@@ -449,7 +449,7 @@ HeapRegionClaimer::HeapRegionClaimer(uint n_workers) :
 
 HeapRegionClaimer::~HeapRegionClaimer() {
   if (_claims != NULL) {
-    FREE_C_HEAP_ARRAY(uint, _claims, mtGC);
+    FREE_C_HEAP_ARRAY(uint, _claims);
   }
 }
 
diff --git a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
index 7c954ffd6bc..b1724dcdcd3 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/heapRegionSet.cpp
@@ -449,5 +449,5 @@ void FreeRegionList_test() {
 
   bot_storage->uncommit_regions(0, num_regions_in_test);
   delete bot_storage;
-  FREE_C_HEAP_ARRAY(HeapWord, bot_data, mtGC);
+  FREE_C_HEAP_ARRAY(HeapWord, bot_data);
 }
diff --git a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp
index c8aeb086766..45069c77ed3 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/ptrQueue.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, 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
@@ -129,7 +129,7 @@ void PtrQueueSet::reduce_free_list() {
     assert(_buf_free_list != NULL, "_buf_free_list_sz must be wrong.");
     void* b = BufferNode::make_block_from_node(_buf_free_list);
     _buf_free_list = _buf_free_list->next();
-    FREE_C_HEAP_ARRAY(char, b, mtGC);
+    FREE_C_HEAP_ARRAY(char, b);
     _buf_free_list_sz --;
     n--;
   }
diff --git a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp
index 9fb2a116f43..62646b00f3b 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/sparsePRT.cpp
@@ -154,11 +154,11 @@ RSHashTable::RSHashTable(size_t capacity) :
 
 RSHashTable::~RSHashTable() {
   if (_entries != NULL) {
-    FREE_C_HEAP_ARRAY(SparsePRTEntry, _entries, mtGC);
+    FREE_C_HEAP_ARRAY(SparsePRTEntry, _entries);
     _entries = NULL;
   }
   if (_buckets != NULL) {
-    FREE_C_HEAP_ARRAY(int, _buckets, mtGC);
+    FREE_C_HEAP_ARRAY(int, _buckets);
     _buckets = NULL;
   }
 }
diff --git a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp
index 3121c9c664e..4a2ea6e5aea 100644
--- a/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp
+++ b/hotspot/src/share/vm/gc_implementation/g1/survRateGroup.cpp
@@ -106,13 +106,13 @@ SurvRateGroup::stop_adding_regions() {
     _stats_arrays_length = _region_num;
 
     if (old_surv_rate != NULL) {
-      FREE_C_HEAP_ARRAY(double, old_surv_rate, mtGC);
+      FREE_C_HEAP_ARRAY(double, old_surv_rate);
     }
     if (old_accum_surv_rate_pred != NULL) {
-      FREE_C_HEAP_ARRAY(double, old_accum_surv_rate_pred, mtGC);
+      FREE_C_HEAP_ARRAY(double, old_accum_surv_rate_pred);
     }
     if (old_surv_rate_pred != NULL) {
-      FREE_C_HEAP_ARRAY(TruncatedSeq*, old_surv_rate_pred, mtGC);
+      FREE_C_HEAP_ARRAY(TruncatedSeq*, old_surv_rate_pred);
     }
   }
 
diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp
index c1033579cf5..c0674f38f35 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parCardTableModRefBS.cpp
@@ -462,7 +462,7 @@ get_LNC_array_for_space(Space* sp,
         if (_lowest_non_clean[i] != NULL) {
           assert(n_chunks != _lowest_non_clean_chunk_size[i],
                  "logical consequence");
-          FREE_C_HEAP_ARRAY(CardPtr, _lowest_non_clean[i], mtGC);
+          FREE_C_HEAP_ARRAY(CardPtr, _lowest_non_clean[i]);
           _lowest_non_clean[i] = NULL;
         }
         // Now allocate a new one if necessary.
diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
index a923cf57441..7558224d9bf 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.cpp
@@ -1609,7 +1609,7 @@ bool ParNewGeneration::take_from_overflow_list_work(ParScanThreadState* par_scan
       // This can become a scaling bottleneck when there is work queue overflow coincident
       // with promotion failure.
       oopDesc* f = cur;
-      FREE_C_HEAP_ARRAY(oopDesc, f, mtGC);
+      FREE_C_HEAP_ARRAY(oopDesc, f);
     } else if (par_scan_state->should_be_partially_scanned(obj_to_push, cur)) {
       assert(arrayOop(cur)->length() == 0, "entire array remaining to be scanned");
       obj_to_push = cur;
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp
index 5aecfb2a984..b0bcd89afcf 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskManager.cpp
@@ -429,7 +429,7 @@ void GCTaskManager::initialize() {
       }
       tty->cr();
     }
-    FREE_C_HEAP_ARRAY(uint, processor_assignment, mtGC);
+    FREE_C_HEAP_ARRAY(uint, processor_assignment);
   }
   reset_busy_workers();
   set_unblocked();
@@ -458,11 +458,11 @@ GCTaskManager::~GCTaskManager() {
       GCTaskThread::destroy(thread(i));
       set_thread(i, NULL);
     }
-    FREE_C_HEAP_ARRAY(GCTaskThread*, _thread, mtGC);
+    FREE_C_HEAP_ARRAY(GCTaskThread*, _thread);
     _thread = NULL;
   }
   if (_resource_flag != NULL) {
-    FREE_C_HEAP_ARRAY(bool, _resource_flag, mtGC);
+    FREE_C_HEAP_ARRAY(bool, _resource_flag);
     _resource_flag = NULL;
   }
   if (queue() != NULL) {
diff --git a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
index ec5ac692ebd..b3b550af6cc 100644
--- a/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
+++ b/hotspot/src/share/vm/gc_implementation/parallelScavenge/gcTaskThread.cpp
@@ -58,7 +58,7 @@ GCTaskThread::GCTaskThread(GCTaskManager* manager,
 
 GCTaskThread::~GCTaskThread() {
   if (_time_stamps != NULL) {
-    FREE_C_HEAP_ARRAY(GCTaskTimeStamp, _time_stamps, mtGC);
+    FREE_C_HEAP_ARRAY(GCTaskTimeStamp, _time_stamps);
   }
 }
 
diff --git a/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp
index 6ece433baa5..12d759566ac 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/cSpaceCounters.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -53,7 +53,7 @@ class CSpaceCounters: public CHeapObj<mtGC> {
                  ContiguousSpace* s, GenerationCounters* gc);
 
   ~CSpaceCounters() {
-      if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtInternal);
+      if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
   }
 
   virtual inline void update_capacity() {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/collectorCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/collectorCounters.hpp
index 81791d2a5e0..30fe32e6ea8 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/collectorCounters.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/collectorCounters.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -50,7 +50,7 @@ class CollectorCounters: public CHeapObj<mtGC> {
     CollectorCounters(const char* name, int ordinal);
 
     ~CollectorCounters() {
-      if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
+      if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
     }
 
     inline PerfCounter* invocation_counter() const  { return _invocations; }
diff --git a/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp
index 7a5fdf9ee57..3e138b3a41a 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/gSpaceCounters.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -55,7 +55,7 @@ class GSpaceCounters: public CHeapObj<mtGC> {
                  GenerationCounters* gc, bool sampled=true);
 
   ~GSpaceCounters() {
-    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
+    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
   }
 
   inline void update_capacity() {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp
index f2776cee1f3..4a74a3fd4a0 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/generationCounters.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -69,7 +69,7 @@ private:
                      size_t min_capacity, size_t max_capacity, VirtualSpace* v);
 
   ~GenerationCounters() {
-    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
+    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
   }
 
   virtual void update_all();
diff --git a/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp
index 0b855e7f674..f1722677775 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/hSpaceCounters.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, 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
@@ -54,7 +54,7 @@ class HSpaceCounters: public CHeapObj<mtGC> {
                  size_t initial_capacity, GenerationCounters* gc);
 
   ~HSpaceCounters() {
-    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
+    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
   }
 
   inline void update_capacity(size_t v) {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp
index 965aedea053..bdb746fe09e 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/mutableNUMASpace.cpp
@@ -276,7 +276,7 @@ bool MutableNUMASpace::update_layout(bool force) {
       }
     }
 
-    FREE_C_HEAP_ARRAY(int, lgrp_ids, mtGC);
+    FREE_C_HEAP_ARRAY(int, lgrp_ids);
 
     if (changed) {
       for (JavaThread *thread = Threads::first(); thread; thread = thread->next()) {
diff --git a/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.hpp b/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.hpp
index e02bc28da34..893bba88c66 100644
--- a/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.hpp
+++ b/hotspot/src/share/vm/gc_implementation/shared/spaceCounters.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -56,7 +56,7 @@ class SpaceCounters: public CHeapObj<mtGC> {
                 MutableSpace* m, GenerationCounters* gc);
 
   ~SpaceCounters() {
-    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space, mtGC);
+    if (_name_space != NULL) FREE_C_HEAP_ARRAY(char, _name_space);
   }
 
   inline void update_capacity() {
diff --git a/hotspot/src/share/vm/interpreter/oopMapCache.cpp b/hotspot/src/share/vm/interpreter/oopMapCache.cpp
index d3f188863ae..14985be348a 100644
--- a/hotspot/src/share/vm/interpreter/oopMapCache.cpp
+++ b/hotspot/src/share/vm/interpreter/oopMapCache.cpp
@@ -334,7 +334,7 @@ void OopMapCacheEntry::deallocate_bit_mask() {
   if (mask_size() > small_mask_limit && _bit_mask[0] != 0) {
     assert(!Thread::current()->resource_area()->contains((void*)_bit_mask[0]),
       "This bit mask should not be in the resource area");
-    FREE_C_HEAP_ARRAY(uintptr_t, _bit_mask[0], mtClass);
+    FREE_C_HEAP_ARRAY(uintptr_t, _bit_mask[0]);
     debug_only(_bit_mask[0] = 0;)
   }
 }
@@ -492,7 +492,7 @@ OopMapCache::~OopMapCache() {
   flush();
   // Deallocate array
   NOT_PRODUCT(_total_memory_usage -= sizeof(OopMapCache) + (sizeof(OopMapCacheEntry) * _size);)
-  FREE_C_HEAP_ARRAY(OopMapCacheEntry, _array, mtClass);
+  FREE_C_HEAP_ARRAY(OopMapCacheEntry, _array);
 }
 
 OopMapCacheEntry* OopMapCache::entry_at(int i) const {
@@ -603,5 +603,5 @@ void OopMapCache::compute_one_oop_map(methodHandle method, int bci, InterpreterO
   tmp->initialize();
   tmp->fill(method, bci);
   entry->resource_copy(tmp);
-  FREE_C_HEAP_ARRAY(OopMapCacheEntry, tmp, mtInternal);
+  FREE_C_HEAP_ARRAY(OopMapCacheEntry, tmp);
 }
diff --git a/hotspot/src/share/vm/memory/allocation.cpp b/hotspot/src/share/vm/memory/allocation.cpp
index 0a05e6a7960..5210cab81bc 100644
--- a/hotspot/src/share/vm/memory/allocation.cpp
+++ b/hotspot/src/share/vm/memory/allocation.cpp
@@ -297,7 +297,7 @@ class ChunkPool: public CHeapObj<mtInternal> {
     // to avoid deadlock with NMT
         while(cur != NULL) {
           next = cur->next();
-      os::free(cur, mtChunk);
+      os::free(cur);
           cur = next;
         }
       }
@@ -385,7 +385,7 @@ void Chunk::operator delete(void* p) {
    case Chunk::medium_size: ChunkPool::medium_pool()->free(c); break;
    case Chunk::init_size:   ChunkPool::small_pool()->free(c); break;
    case Chunk::tiny_size:   ChunkPool::tiny_pool()->free(c); break;
-   default:                 os::free(c, mtChunk);
+   default:                 os::free(c);
   }
 }
 
diff --git a/hotspot/src/share/vm/memory/allocation.hpp b/hotspot/src/share/vm/memory/allocation.hpp
index a1faa70871a..c5207414b64 100644
--- a/hotspot/src/share/vm/memory/allocation.hpp
+++ b/hotspot/src/share/vm/memory/allocation.hpp
@@ -101,7 +101,7 @@ typedef AllocFailStrategy::AllocFailEnum AllocFailType;
 //   NEW_RESOURCE_OBJ(type)
 //   NEW_C_HEAP_ARRAY(type, size)
 //   NEW_C_HEAP_OBJ(type, memflags)
-//   FREE_C_HEAP_ARRAY(type, old, memflags)
+//   FREE_C_HEAP_ARRAY(type, old)
 //   FREE_C_HEAP_OBJ(objname, type, memflags)
 //   char* AllocateHeap(size_t size, const char* name);
 //   void  FreeHeap(void* p);
@@ -669,8 +669,8 @@ class ResourceObj ALLOCATION_SUPER_CLASS_SPEC {
 #define REALLOC_C_HEAP_ARRAY_RETURN_NULL(type, old, size, memflags)\
   (type*) (ReallocateHeap((char*)(old), (size) * sizeof(type), memflags, AllocFailStrategy::RETURN_NULL))
 
-#define FREE_C_HEAP_ARRAY(type, old, memflags) \
-  FreeHeap((char*)(old), memflags)
+#define FREE_C_HEAP_ARRAY(type, old) \
+  FreeHeap((char*)(old))
 
 // allocate type in heap without calling ctor
 #define NEW_C_HEAP_OBJ(type, memflags)\
@@ -680,8 +680,8 @@ class ResourceObj ALLOCATION_SUPER_CLASS_SPEC {
   NEW_C_HEAP_ARRAY_RETURN_NULL(type, 1, memflags)
 
 // deallocate obj of type in heap without calling dtor
-#define FREE_C_HEAP_OBJ(objname, memflags)\
-  FreeHeap((char*)objname, memflags);
+#define FREE_C_HEAP_OBJ(objname)\
+  FreeHeap((char*)objname);
 
 // for statistics
 #ifndef PRODUCT
diff --git a/hotspot/src/share/vm/memory/allocation.inline.hpp b/hotspot/src/share/vm/memory/allocation.inline.hpp
index ddce9f5909b..7d012f328bb 100644
--- a/hotspot/src/share/vm/memory/allocation.inline.hpp
+++ b/hotspot/src/share/vm/memory/allocation.inline.hpp
@@ -79,11 +79,11 @@ inline char* ReallocateHeap(char *old, size_t size, MEMFLAGS flag,
   return p;
 }
 
-inline void FreeHeap(void* p, MEMFLAGS memflags = mtInternal) {
+inline void FreeHeap(void* p) {
   #ifdef ASSERT
   if (PrintMallocFree) trace_heap_free(p);
   #endif
-  os::free(p, memflags);
+  os::free(p);
 }
 
 
@@ -136,11 +136,11 @@ template <MEMFLAGS F> void* CHeapObj<F>::operator new [](size_t size,
 }
 
 template <MEMFLAGS F> void CHeapObj<F>::operator delete(void* p){
-    FreeHeap(p, F);
+    FreeHeap(p);
 }
 
 template <MEMFLAGS F> void CHeapObj<F>::operator delete [](void* p){
-    FreeHeap(p, F);
+    FreeHeap(p);
 }
 
 template <class E, MEMFLAGS F>
@@ -199,7 +199,7 @@ template<class E, MEMFLAGS F>
 void ArrayAllocator<E, F>::free() {
   if (_addr != NULL) {
     if (_use_malloc) {
-      FreeHeap(_addr, F);
+      FreeHeap(_addr);
     } else {
       os::release_memory(_addr, _size);
     }
diff --git a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
index 30e8618d597..98bdbd8d7fb 100644
--- a/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
+++ b/hotspot/src/share/vm/memory/cardTableModRefBS.cpp
@@ -172,19 +172,19 @@ CardTableModRefBS::~CardTableModRefBS() {
     _committed = NULL;
   }
   if (_lowest_non_clean) {
-    FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean, mtGC);
+    FREE_C_HEAP_ARRAY(CardArr, _lowest_non_clean);
     _lowest_non_clean = NULL;
   }
   if (_lowest_non_clean_chunk_size) {
-    FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size, mtGC);
+    FREE_C_HEAP_ARRAY(size_t, _lowest_non_clean_chunk_size);
     _lowest_non_clean_chunk_size = NULL;
   }
   if (_lowest_non_clean_base_chunk_index) {
-    FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index, mtGC);
+    FREE_C_HEAP_ARRAY(uintptr_t, _lowest_non_clean_base_chunk_index);
     _lowest_non_clean_base_chunk_index = NULL;
   }
   if (_last_LNC_resizing_collection) {
-    FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection, mtGC);
+    FREE_C_HEAP_ARRAY(int, _last_LNC_resizing_collection);
     _last_LNC_resizing_collection = NULL;
   }
 }
diff --git a/hotspot/src/share/vm/memory/cardTableRS.cpp b/hotspot/src/share/vm/memory/cardTableRS.cpp
index 90f72d19efd..268611a0250 100644
--- a/hotspot/src/share/vm/memory/cardTableRS.cpp
+++ b/hotspot/src/share/vm/memory/cardTableRS.cpp
@@ -73,7 +73,7 @@ CardTableRS::~CardTableRS() {
     _ct_bs = NULL;
   }
   if (_last_cur_val_in_gen) {
-    FREE_C_HEAP_ARRAY(jbyte, _last_cur_val_in_gen, mtInternal);
+    FREE_C_HEAP_ARRAY(jbyte, _last_cur_val_in_gen);
   }
 }
 
diff --git a/hotspot/src/share/vm/memory/filemap.cpp b/hotspot/src/share/vm/memory/filemap.cpp
index 07027b52c42..bac26f1b802 100644
--- a/hotspot/src/share/vm/memory/filemap.cpp
+++ b/hotspot/src/share/vm/memory/filemap.cpp
@@ -326,7 +326,7 @@ bool FileMapInfo::init_from_file(int fd) {
   n = os::read(fd, _paths_misc_info, (unsigned int)info_size);
   if (n != info_size) {
     fail_continue("Unable to read the shared path info header.");
-    FREE_C_HEAP_ARRAY(char, _paths_misc_info, mtClass);
+    FREE_C_HEAP_ARRAY(char, _paths_misc_info);
     _paths_misc_info = NULL;
     return false;
   }
@@ -709,7 +709,7 @@ bool FileMapInfo::validate_header() {
   }
 
   if (_paths_misc_info != NULL) {
-    FREE_C_HEAP_ARRAY(char, _paths_misc_info, mtClass);
+    FREE_C_HEAP_ARRAY(char, _paths_misc_info);
     _paths_misc_info = NULL;
   }
   return status;
diff --git a/hotspot/src/share/vm/memory/heapInspection.cpp b/hotspot/src/share/vm/memory/heapInspection.cpp
index cc8f4fc061a..415ae6732cc 100644
--- a/hotspot/src/share/vm/memory/heapInspection.cpp
+++ b/hotspot/src/share/vm/memory/heapInspection.cpp
@@ -153,7 +153,7 @@ KlassInfoTable::~KlassInfoTable() {
     for (int index = 0; index < _size; index++) {
       _buckets[index].empty();
     }
-    FREE_C_HEAP_ARRAY(KlassInfoBucket, _buckets, mtInternal);
+    FREE_C_HEAP_ARRAY(KlassInfoBucket, _buckets);
     _size = 0;
   }
 }
diff --git a/hotspot/src/share/vm/memory/memRegion.cpp b/hotspot/src/share/vm/memory/memRegion.cpp
index 8c33ddca1de..5b2c5f7fc48 100644
--- a/hotspot/src/share/vm/memory/memRegion.cpp
+++ b/hotspot/src/share/vm/memory/memRegion.cpp
@@ -112,10 +112,10 @@ void* MemRegion::operator new [](size_t size) throw() {
     AllocFailStrategy::RETURN_NULL);
 }
 void  MemRegion::operator delete(void* p) {
-  FreeHeap(p, mtGC);
+  FreeHeap(p);
 }
 
 void  MemRegion::operator delete [](void* p) {
-  FreeHeap(p, mtGC);
+  FreeHeap(p);
 }
 
diff --git a/hotspot/src/share/vm/oops/instanceKlass.cpp b/hotspot/src/share/vm/oops/instanceKlass.cpp
index e80eaece790..f3123b77af5 100644
--- a/hotspot/src/share/vm/oops/instanceKlass.cpp
+++ b/hotspot/src/share/vm/oops/instanceKlass.cpp
@@ -1365,7 +1365,7 @@ void InstanceKlass::do_nonstatic_fields(FieldClosure* cl) {
       cl->do_field(&fd);
     }
   }
-  FREE_C_HEAP_ARRAY(int, fields_sorted, mtClass);
+  FREE_C_HEAP_ARRAY(int, fields_sorted);
 }
 
 
@@ -2473,7 +2473,7 @@ void InstanceKlass::release_C_heap_structures() {
 
   // deallocate the cached class file
   if (_cached_class_file != NULL) {
-    os::free(_cached_class_file, mtClass);
+    os::free(_cached_class_file);
     _cached_class_file = NULL;
   }
 
@@ -2482,7 +2482,7 @@ void InstanceKlass::release_C_heap_structures() {
   // unreference array name derived from this class name (arrays of an unloaded
   // class can't be referenced anymore).
   if (_array_name != NULL)  _array_name->decrement_refcount();
-  if (_source_debug_extension != NULL) FREE_C_HEAP_ARRAY(char, _source_debug_extension, mtClass);
+  if (_source_debug_extension != NULL) FREE_C_HEAP_ARRAY(char, _source_debug_extension);
 
   assert(_total_instanceKlass_count >= 1, "Sanity check");
   Atomic::dec(&_total_instanceKlass_count);
diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp
index 9a248ce3e27..2fb747385d8 100644
--- a/hotspot/src/share/vm/oops/method.cpp
+++ b/hotspot/src/share/vm/oops/method.cpp
@@ -1757,7 +1757,7 @@ class JNIMethodBlockNode : public CHeapObj<mtClass> {
 
   JNIMethodBlockNode(int num_methods = min_block_size);
 
-  ~JNIMethodBlockNode() { FREE_C_HEAP_ARRAY(Method*, _methods, mtInternal); }
+  ~JNIMethodBlockNode() { FREE_C_HEAP_ARRAY(Method*, _methods); }
 
   void ensure_methods(int num_addl_methods) {
     if (_top < _number_of_methods) {
diff --git a/hotspot/src/share/vm/prims/jniCheck.cpp b/hotspot/src/share/vm/prims/jniCheck.cpp
index 1de4f021017..412d9352082 100644
--- a/hotspot/src/share/vm/prims/jniCheck.cpp
+++ b/hotspot/src/share/vm/prims/jniCheck.cpp
@@ -1554,7 +1554,7 @@ JNI_ENTRY_CHECKED(const char *,
       }
       // Avoiding call to UNCHECKED()->ReleaseStringUTFChars() since that will fire unexpected dtrace probes
       // Note that the dtrace arguments for the allocated memory will not match up with this solution.
-      FreeHeap((char*)result, mtInternal);
+      FreeHeap((char*)result);
     }
     functionExit(thr);
     return new_result;
diff --git a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp
index 4170cf9155d..be0536630cb 100644
--- a/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp
+++ b/hotspot/src/share/vm/prims/jvmtiClassFileReconstituter.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -68,11 +68,11 @@ class JvmtiConstantPoolReconstituter : public StackObj {
 
   ~JvmtiConstantPoolReconstituter() {
     if (_symmap != NULL) {
-      os::free(_symmap, mtClass);
+      os::free(_symmap);
       _symmap = NULL;
     }
     if (_classmap != NULL) {
-      os::free(_classmap, mtClass);
+      os::free(_classmap);
       _classmap = NULL;
     }
   }
diff --git a/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp b/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp
index f3c06c30c34..d8f4ffcd443 100644
--- a/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp
+++ b/hotspot/src/share/vm/prims/jvmtiEnvBase.hpp
@@ -192,7 +192,7 @@ class JvmtiEnvBase : public CHeapObj<mtInternal> {
 
   jvmtiError deallocate(unsigned char* mem) {
     if (mem != NULL) {
-      os::free(mem, mtInternal);
+      os::free(mem);
     }
     return JVMTI_ERROR_NONE;
   }
diff --git a/hotspot/src/share/vm/prims/jvmtiExport.cpp b/hotspot/src/share/vm/prims/jvmtiExport.cpp
index 99dfc1d455c..ca735b447b0 100644
--- a/hotspot/src/share/vm/prims/jvmtiExport.cpp
+++ b/hotspot/src/share/vm/prims/jvmtiExport.cpp
@@ -727,7 +727,7 @@ class JvmtiCompiledMethodLoadEventMark : public JvmtiMethodEventMark {
     JvmtiCodeBlobEvents::build_jvmti_addr_location_map(nm, &_map, &_map_length);
   }
   ~JvmtiCompiledMethodLoadEventMark() {
-     FREE_C_HEAP_ARRAY(jvmtiAddrLocationMap, _map, mtInternal);
+     FREE_C_HEAP_ARRAY(jvmtiAddrLocationMap, _map);
   }
 
   jint code_size() { return _code_size; }
diff --git a/hotspot/src/share/vm/prims/jvmtiImpl.cpp b/hotspot/src/share/vm/prims/jvmtiImpl.cpp
index 24c039d8b27..bfc55d0fa84 100644
--- a/hotspot/src/share/vm/prims/jvmtiImpl.cpp
+++ b/hotspot/src/share/vm/prims/jvmtiImpl.cpp
@@ -88,7 +88,7 @@ JvmtiAgentThread::call_start_function() {
 void GrowableCache::recache() {
   int len = _elements->length();
 
-  FREE_C_HEAP_ARRAY(address, _cache, mtInternal);
+  FREE_C_HEAP_ARRAY(address, _cache);
   _cache = NEW_C_HEAP_ARRAY(address,len+1, mtInternal);
 
   for (int i=0; i<len; i++) {
@@ -132,7 +132,7 @@ GrowableCache::GrowableCache() {
 GrowableCache::~GrowableCache() {
   clear();
   delete _elements;
-  FREE_C_HEAP_ARRAY(address, _cache, mtInternal);
+  FREE_C_HEAP_ARRAY(address, _cache);
 }
 
 void GrowableCache::initialize(void *this_obj, void listener_fun(void *, address*) ) {
diff --git a/hotspot/src/share/vm/prims/unsafe.cpp b/hotspot/src/share/vm/prims/unsafe.cpp
index a85be2b874e..446bdf41c6f 100644
--- a/hotspot/src/share/vm/prims/unsafe.cpp
+++ b/hotspot/src/share/vm/prims/unsafe.cpp
@@ -898,10 +898,10 @@ static jclass Unsafe_DefineClass_impl(JNIEnv *env, jstring name, jbyteArray data
     result = JVM_DefineClass(env, utfName, loader, body, length, pd);
 
     if (utfName && utfName != buf)
-        FREE_C_HEAP_ARRAY(char, utfName, mtInternal);
+        FREE_C_HEAP_ARRAY(char, utfName);
 
  free_body:
-    FREE_C_HEAP_ARRAY(jbyte, body, mtInternal);
+    FREE_C_HEAP_ARRAY(jbyte, body);
     return result;
   }
 }
@@ -1086,7 +1086,7 @@ UNSAFE_ENTRY(jclass, Unsafe_DefineAnonymousClass(JNIEnv *env, jobject unsafe, jc
 
   // try/finally clause:
   if (temp_alloc != NULL) {
-    FREE_C_HEAP_ARRAY(HeapWord, temp_alloc, mtInternal);
+    FREE_C_HEAP_ARRAY(HeapWord, temp_alloc);
   }
 
   // The anonymous class loader data has been artificially been kept alive to
diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp
index e8afcc9461e..a46291f66a4 100644
--- a/hotspot/src/share/vm/prims/whitebox.cpp
+++ b/hotspot/src/share/vm/prims/whitebox.cpp
@@ -328,7 +328,7 @@ WB_END
 
 // Free the memory allocated by NMTAllocTest
 WB_ENTRY(void, WB_NMTFree(JNIEnv* env, jobject o, jlong mem))
-  os::free((void*)(uintptr_t)mem, mtTest);
+  os::free((void*)(uintptr_t)mem);
 WB_END
 
 WB_ENTRY(jlong, WB_NMTReserveMemory(JNIEnv* env, jobject o, jlong size))
@@ -754,7 +754,7 @@ WB_ENTRY(void, WB_SetStringVMFlag(JNIEnv* env, jobject o, jstring name, jstring
     env->ReleaseStringUTFChars(value, ccstrValue);
   }
   if (needFree) {
-    FREE_C_HEAP_ARRAY(char, ccstrResult, mtInternal);
+    FREE_C_HEAP_ARRAY(char, ccstrResult);
   }
 WB_END
 
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index 73a5369f1f6..68eb6c2f96f 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -437,7 +437,7 @@ inline void SysClassPath::add_suffix(const char* suffix) {
 inline void SysClassPath::reset_item_at(int index) {
   assert(index < _scp_nitems && index != _scp_base, "just checking");
   if (_items[index] != NULL) {
-    FREE_C_HEAP_ARRAY(char, _items[index], mtInternal);
+    FREE_C_HEAP_ARRAY(char, _items[index]);
     _items[index] = NULL;
   }
 }
@@ -473,7 +473,7 @@ void SysClassPath::expand_endorsed() {
       memcpy(dirpath, path, tmp_end - path);
       dirpath[tmp_end - path] = '\0';
       expanded_path = add_jars_to_path(expanded_path, dirpath);
-      FREE_C_HEAP_ARRAY(char, dirpath, mtInternal);
+      FREE_C_HEAP_ARRAY(char, dirpath);
       path = tmp_end + 1;
     }
   }
@@ -540,7 +540,7 @@ SysClassPath::add_to_path(const char* path, const char* str, bool prepend) {
       cp_tmp += str_len;
       *cp_tmp = separator;
       memcpy(++cp_tmp, path, old_len + 1);      // copy the trailing null
-      FREE_C_HEAP_ARRAY(char, path, mtInternal);
+      FREE_C_HEAP_ARRAY(char, path);
     } else {
       cp = REALLOC_C_HEAP_ARRAY(char, path, len, mtInternal);
       char* cp_tmp = cp + old_len;
@@ -575,10 +575,10 @@ char* SysClassPath::add_jars_to_path(char* path, const char* directory) {
       char* jarpath = NEW_C_HEAP_ARRAY(char, directory_len + 2 + strlen(name), mtInternal);
       sprintf(jarpath, "%s%s%s", directory, dir_sep, name);
       path = add_to_path(path, jarpath, false);
-      FREE_C_HEAP_ARRAY(char, jarpath, mtInternal);
+      FREE_C_HEAP_ARRAY(char, jarpath);
     }
   }
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
   os::closedir(dir);
   return path;
 }
@@ -713,7 +713,7 @@ static bool set_numeric_flag(char* name, char* value, Flag::Flags origin) {
 static bool set_string_flag(char* name, const char* value, Flag::Flags origin) {
   if (!CommandLineFlags::ccstrAtPut(name, &value, origin))  return false;
   // Contract:  CommandLineFlags always returns a pointer that needs freeing.
-  FREE_C_HEAP_ARRAY(char, value, mtInternal);
+  FREE_C_HEAP_ARRAY(char, value);
   return true;
 }
 
@@ -737,10 +737,10 @@ static bool append_to_string_flag(char* name, const char* new_value, Flag::Flags
   }
   (void) CommandLineFlags::ccstrAtPut(name, &value, origin);
   // CommandLineFlags always returns a pointer that needs freeing.
-  FREE_C_HEAP_ARRAY(char, value, mtInternal);
+  FREE_C_HEAP_ARRAY(char, value);
   if (free_this_too != NULL) {
     // CommandLineFlags made its own copy, so I must delete my own temp. buffer.
-    FREE_C_HEAP_ARRAY(char, free_this_too, mtInternal);
+    FREE_C_HEAP_ARRAY(char, free_this_too);
   }
   return true;
 }
diff --git a/hotspot/src/share/vm/runtime/deoptimization.cpp b/hotspot/src/share/vm/runtime/deoptimization.cpp
index 95587bff533..75da1fef019 100644
--- a/hotspot/src/share/vm/runtime/deoptimization.cpp
+++ b/hotspot/src/share/vm/runtime/deoptimization.cpp
@@ -82,9 +82,9 @@ Deoptimization::UnrollBlock::UnrollBlock(int  size_of_deoptimized_frame,
 
 
 Deoptimization::UnrollBlock::~UnrollBlock() {
-  FREE_C_HEAP_ARRAY(intptr_t, _frame_sizes, mtCompiler);
-  FREE_C_HEAP_ARRAY(intptr_t, _frame_pcs, mtCompiler);
-  FREE_C_HEAP_ARRAY(intptr_t, _register_block, mtCompiler);
+  FREE_C_HEAP_ARRAY(intptr_t, _frame_sizes);
+  FREE_C_HEAP_ARRAY(intptr_t, _frame_pcs);
+  FREE_C_HEAP_ARRAY(intptr_t, _register_block);
 }
 
 
diff --git a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp
index 7e7592a5406..71828d029e5 100644
--- a/hotspot/src/share/vm/runtime/dtraceJSDT.hpp
+++ b/hotspot/src/share/vm/runtime/dtraceJSDT.hpp
@@ -66,7 +66,7 @@ class RegisteredProbes : public CHeapObj<mtInternal> {
       _nmethods[i]->make_not_entrant();
       _nmethods[i]->method()->clear_code();
     }
-    FREE_C_HEAP_ARRAY(nmethod*, _nmethods, mtInternal);
+    FREE_C_HEAP_ARRAY(nmethod*, _nmethods);
     _nmethods = NULL;
     _count = 0;
   }
diff --git a/hotspot/src/share/vm/runtime/fprofiler.cpp b/hotspot/src/share/vm/runtime/fprofiler.cpp
index 4d97872e9f9..a0ad5b697d7 100644
--- a/hotspot/src/share/vm/runtime/fprofiler.cpp
+++ b/hotspot/src/share/vm/runtime/fprofiler.cpp
@@ -936,7 +936,7 @@ void FlatProfiler::record_thread_ticks() {
       FlatProfiler::interval_reset();
     }
 
-    FREE_C_HEAP_ARRAY(JavaThread *, threadsList, mtInternal);
+    FREE_C_HEAP_ARRAY(JavaThread *, threadsList);
   } else {
     // Couldn't get the threads lock, just record that rather than blocking
     FlatProfiler::threads_lock_ticks += 1;
diff --git a/hotspot/src/share/vm/runtime/globals.cpp b/hotspot/src/share/vm/runtime/globals.cpp
index 8d77691a282..be3c4af9ec2 100644
--- a/hotspot/src/share/vm/runtime/globals.cpp
+++ b/hotspot/src/share/vm/runtime/globals.cpp
@@ -840,7 +840,7 @@ void CommandLineFlagsEx::ccstrAtPut(CommandLineFlagWithType flag, ccstr value, F
   faddr->set_ccstr(new_value);
   if (!faddr->is_default() && old_value != NULL) {
     // Prior value is heap allocated so free it.
-    FREE_C_HEAP_ARRAY(char, old_value, mtInternal);
+    FREE_C_HEAP_ARRAY(char, old_value);
   }
   faddr->set_origin(origin);
 }
@@ -874,7 +874,7 @@ void CommandLineFlags::printSetFlags(outputStream* out) {
     }
   }
   out->cr();
-  FREE_C_HEAP_ARRAY(Flag*, array, mtInternal);
+  FREE_C_HEAP_ARRAY(Flag*, array);
 }
 
 #ifndef PRODUCT
@@ -908,5 +908,5 @@ void CommandLineFlags::printFlags(outputStream* out, bool withComments) {
       array[i]->print_on(out, withComments);
     }
   }
-  FREE_C_HEAP_ARRAY(Flag*, array, mtInternal);
+  FREE_C_HEAP_ARRAY(Flag*, array);
 }
diff --git a/hotspot/src/share/vm/runtime/handles.cpp b/hotspot/src/share/vm/runtime/handles.cpp
index 83745a8f86d..4357ed2d684 100644
--- a/hotspot/src/share/vm/runtime/handles.cpp
+++ b/hotspot/src/share/vm/runtime/handles.cpp
@@ -179,11 +179,11 @@ void* HandleMark::operator new [] (size_t size) throw() {
 }
 
 void HandleMark::operator delete(void* p) {
-  FreeHeap(p, mtThread);
+  FreeHeap(p);
 }
 
 void HandleMark::operator delete[](void* p) {
-  FreeHeap(p, mtThread);
+  FreeHeap(p);
 }
 
 #ifdef ASSERT
diff --git a/hotspot/src/share/vm/runtime/objectMonitor.hpp b/hotspot/src/share/vm/runtime/objectMonitor.hpp
index 901462c2005..f792a250264 100644
--- a/hotspot/src/share/vm/runtime/objectMonitor.hpp
+++ b/hotspot/src/share/vm/runtime/objectMonitor.hpp
@@ -207,7 +207,7 @@ class ObjectMonitor {
     return operator new (size);
   }
   void operator delete(void* p) {
-    FreeHeap(p, mtInternal);
+    FreeHeap(p);
   }
   void operator delete[] (void *p) {
     operator delete(p);
diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp
index 1e632f4d543..ed43b3fb2b6 100644
--- a/hotspot/src/share/vm/runtime/os.cpp
+++ b/hotspot/src/share/vm/runtime/os.cpp
@@ -473,7 +473,7 @@ void* os::find_agent_function(AgentLibrary *agent_lib, bool check_lib,
       break;
     }
     entryName = dll_lookup(handle, agent_function_name);
-    FREE_C_HEAP_ARRAY(char, agent_function_name, mtThread);
+    FREE_C_HEAP_ARRAY(char, agent_function_name);
     if (entryName != NULL) {
       break;
     }
@@ -689,7 +689,7 @@ void* os::realloc(void *memblock, size_t size, MEMFLAGS memflags, const NativeCa
 }
 
 
-void  os::free(void *memblock, MEMFLAGS memflags) {
+void  os::free(void *memblock) {
   NOT_PRODUCT(inc_stat_counter(&num_frees, 1));
 #ifdef ASSERT
   if (memblock == NULL) return;
@@ -1211,7 +1211,7 @@ static char* expand_entries_to_path(char* directory, char fileSep, char pathSep)
     path_len = new_len;
   }
 
-  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  FREE_C_HEAP_ARRAY(char, dbuf);
   os::closedir(dir);
 
   return path;
@@ -1236,7 +1236,7 @@ bool os::set_boot_path(char fileSep, char pathSep) {
   if (rt_jar == NULL) return false;
   struct stat st;
   bool has_rt_jar = (os::stat(rt_jar, &st) == 0);
-  FREE_C_HEAP_ARRAY(char, rt_jar, mtInternal);
+  FREE_C_HEAP_ARRAY(char, rt_jar);
 
   if (has_rt_jar) {
     // Any modification to the JAR-file list, for the boot classpath must be
@@ -1320,7 +1320,7 @@ char** os::split_path(const char* path, int* n) {
     opath[i] = s;
     p += len + 1;
   }
-  FREE_C_HEAP_ARRAY(char, inpath, mtInternal);
+  FREE_C_HEAP_ARRAY(char, inpath);
   *n = count;
   return opath;
 }
diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp
index fa15d25b6c6..8d657afc640 100644
--- a/hotspot/src/share/vm/runtime/os.hpp
+++ b/hotspot/src/share/vm/runtime/os.hpp
@@ -663,7 +663,7 @@ class os: AllStatic {
   static void* realloc (void *memblock, size_t size, MEMFLAGS flag, const NativeCallStack& stack);
   static void* realloc (void *memblock, size_t size, MEMFLAGS flag);
 
-  static void  free    (void *memblock, MEMFLAGS flags = mtNone);
+  static void  free    (void *memblock);
   static bool  check_heap(bool force = false);      // verify C heap integrity
   static char* strdup(const char *, MEMFLAGS flags = mtInternal);  // Like strdup
   // Like strdup, but exit VM when strdup() returns NULL
diff --git a/hotspot/src/share/vm/runtime/perfData.cpp b/hotspot/src/share/vm/runtime/perfData.cpp
index caf4c99295e..e4289bedde8 100644
--- a/hotspot/src/share/vm/runtime/perfData.cpp
+++ b/hotspot/src/share/vm/runtime/perfData.cpp
@@ -113,10 +113,10 @@ PerfData::PerfData(CounterNS ns, const char* name, Units u, Variability v)
 
 PerfData::~PerfData() {
   if (_name != NULL) {
-    FREE_C_HEAP_ARRAY(char, _name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, _name);
   }
   if (is_on_c_heap()) {
-    FREE_C_HEAP_ARRAY(PerfDataEntry, _pdep, mtInternal);
+    FREE_C_HEAP_ARRAY(PerfDataEntry, _pdep);
   }
 }
 
diff --git a/hotspot/src/share/vm/runtime/perfMemory.cpp b/hotspot/src/share/vm/runtime/perfMemory.cpp
index 4eddf2a9722..68c0f33464d 100644
--- a/hotspot/src/share/vm/runtime/perfMemory.cpp
+++ b/hotspot/src/share/vm/runtime/perfMemory.cpp
@@ -250,7 +250,7 @@ char* PerfMemory::get_perfdata_file_path() {
     dest_file = NEW_C_HEAP_ARRAY(char, JVM_MAXPATHLEN, mtInternal);
     if(!Arguments::copy_expand_pid(PerfDataSaveFile, strlen(PerfDataSaveFile),
                                    dest_file, JVM_MAXPATHLEN)) {
-      FREE_C_HEAP_ARRAY(char, dest_file, mtInternal);
+      FREE_C_HEAP_ARRAY(char, dest_file);
       if (PrintMiscellaneous && Verbose) {
         warning("Invalid performance data file path name specified, "\
                 "fall back to a default name");
diff --git a/hotspot/src/share/vm/runtime/sharedRuntime.cpp b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
index 344c2a61f3e..be36aa48205 100644
--- a/hotspot/src/share/vm/runtime/sharedRuntime.cpp
+++ b/hotspot/src/share/vm/runtime/sharedRuntime.cpp
@@ -2084,7 +2084,7 @@ class AdapterFingerPrint : public CHeapObj<mtCode> {
 
   ~AdapterFingerPrint() {
     if (_length > 0) {
-      FREE_C_HEAP_ARRAY(int, _value._fingerprint, mtCode);
+      FREE_C_HEAP_ARRAY(int, _value._fingerprint);
     }
   }
 
@@ -2491,7 +2491,7 @@ void AdapterHandlerEntry::relocate(address new_base) {
 void AdapterHandlerEntry::deallocate() {
   delete _fingerprint;
 #ifdef ASSERT
-  if (_saved_code) FREE_C_HEAP_ARRAY(unsigned char, _saved_code, mtCode);
+  if (_saved_code) FREE_C_HEAP_ARRAY(unsigned char, _saved_code);
 #endif
 }
 
@@ -2902,7 +2902,7 @@ JRT_LEAF(intptr_t*, SharedRuntime::OSR_migration_begin( JavaThread *thread) )
 JRT_END
 
 JRT_LEAF(void, SharedRuntime::OSR_migration_end( intptr_t* buf) )
-  FREE_C_HEAP_ARRAY(intptr_t, buf, mtCode);
+  FREE_C_HEAP_ARRAY(intptr_t, buf);
 JRT_END
 
 bool AdapterHandlerLibrary::contains(CodeBlob* b) {
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index fde9bab9642..10abaaf5376 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -171,9 +171,9 @@ void* Thread::allocate(size_t size, bool throw_excpt, MEMFLAGS flags) {
 void Thread::operator delete(void* p) {
   if (UseBiasedLocking) {
     void* real_malloc_addr = ((Thread*) p)->_real_malloc_address;
-    FreeHeap(real_malloc_addr, mtThread);
+    FreeHeap(real_malloc_addr);
   } else {
-    FreeHeap(p, mtThread);
+    FreeHeap(p);
   }
 }
 
@@ -1146,7 +1146,7 @@ NamedThread::NamedThread() : Thread() {
 
 NamedThread::~NamedThread() {
   if (_name != NULL) {
-    FREE_C_HEAP_ARRAY(char, _name, mtThread);
+    FREE_C_HEAP_ARRAY(char, _name);
     _name = NULL;
   }
 }
@@ -2998,7 +2998,7 @@ WordSize JavaThread::popframe_preserved_args_size_in_words() {
 
 void JavaThread::popframe_free_preserved_args() {
   assert(_popframe_preserved_args != NULL, "should not free PopFrame preserved arguments twice");
-  FREE_C_HEAP_ARRAY(char, (char*) _popframe_preserved_args, mtThread);
+  FREE_C_HEAP_ARRAY(char, (char*) _popframe_preserved_args);
   _popframe_preserved_args = NULL;
   _popframe_preserved_args_size = 0;
 }
@@ -3608,7 +3608,7 @@ static OnLoadEntry_t lookup_on_load(AgentLibrary* agent,
         jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
         // If we can't find the agent, exit.
         vm_exit_during_initialization(buf, NULL);
-        FREE_C_HEAP_ARRAY(char, buf, mtThread);
+        FREE_C_HEAP_ARRAY(char, buf);
       }
     } else {
       // Try to load the agent from the standard dll directory
@@ -3628,7 +3628,7 @@ static OnLoadEntry_t lookup_on_load(AgentLibrary* agent,
           jio_snprintf(buf, len, "%s%s%s%s", msg, name, sub_msg, ebuf);
           // If we can't find the agent, exit.
           vm_exit_during_initialization(buf, NULL);
-          FREE_C_HEAP_ARRAY(char, buf, mtThread);
+          FREE_C_HEAP_ARRAY(char, buf);
         }
       }
     }
diff --git a/hotspot/src/share/vm/runtime/vmStructs.cpp b/hotspot/src/share/vm/runtime/vmStructs.cpp
index b69ce20e8d6..e8bff439e78 100644
--- a/hotspot/src/share/vm/runtime/vmStructs.cpp
+++ b/hotspot/src/share/vm/runtime/vmStructs.cpp
@@ -3269,10 +3269,10 @@ static int recursiveFindType(VMTypeEntry* origtypes, const char* typeName, bool
     s[len-1] = '\0';
     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
     if (recursiveFindType(origtypes, s, true) == 1) {
-      FREE_C_HEAP_ARRAY(char, s, mtInternal);
+      FREE_C_HEAP_ARRAY(char, s);
       return 1;
     }
-    FREE_C_HEAP_ARRAY(char, s, mtInternal);
+    FREE_C_HEAP_ARRAY(char, s);
   }
   const char* start = NULL;
   if (strstr(typeName, "GrowableArray<") == typeName) {
@@ -3288,10 +3288,10 @@ static int recursiveFindType(VMTypeEntry* origtypes, const char* typeName, bool
     s[len-1] = '\0';
     // tty->print_cr("checking \"%s\" for \"%s\"", s, typeName);
     if (recursiveFindType(origtypes, s, true) == 1) {
-      FREE_C_HEAP_ARRAY(char, s, mtInternal);
+      FREE_C_HEAP_ARRAY(char, s);
       return 1;
     }
-    FREE_C_HEAP_ARRAY(char, s, mtInternal);
+    FREE_C_HEAP_ARRAY(char, s);
   }
   if (strstr(typeName, "const ") == typeName) {
     const char * s = typeName + strlen("const ");
diff --git a/hotspot/src/share/vm/services/attachListener.cpp b/hotspot/src/share/vm/services/attachListener.cpp
index ecd59d4c11d..241914cd6cc 100644
--- a/hotspot/src/share/vm/services/attachListener.cpp
+++ b/hotspot/src/share/vm/services/attachListener.cpp
@@ -348,7 +348,7 @@ static jint set_ccstr_flag(const char* name, AttachOperation* op, outputStream*
   }
   bool res = CommandLineFlags::ccstrAtPut((char*)name, &value, Flag::ATTACH_ON_DEMAND);
   if (res) {
-    FREE_C_HEAP_ARRAY(char, value, mtInternal);
+    FREE_C_HEAP_ARRAY(char, value);
   } else {
     out->print_cr("setting flag %s failed", name);
   }
diff --git a/hotspot/src/share/vm/services/diagnosticArgument.cpp b/hotspot/src/share/vm/services/diagnosticArgument.cpp
index 51126f063b4..3f411b73157 100644
--- a/hotspot/src/share/vm/services/diagnosticArgument.cpp
+++ b/hotspot/src/share/vm/services/diagnosticArgument.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, 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
@@ -174,7 +174,7 @@ template <> void DCmdArgument<char*>::init_value(TRAPS) {
 
 template <> void DCmdArgument<char*>::destroy_value() {
   if (_value != NULL) {
-    FREE_C_HEAP_ARRAY(char, _value, mtInternal);
+    FREE_C_HEAP_ARRAY(char, _value);
     set_value(NULL);
   }
 }
diff --git a/hotspot/src/share/vm/services/diagnosticArgument.hpp b/hotspot/src/share/vm/services/diagnosticArgument.hpp
index 596353b0752..d276d3b6294 100644
--- a/hotspot/src/share/vm/services/diagnosticArgument.hpp
+++ b/hotspot/src/share/vm/services/diagnosticArgument.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, 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
@@ -53,7 +53,7 @@ public:
   ~StringArrayArgument() {
     for (int i=0; i<_array->length(); i++) {
       if(_array->at(i) != NULL) { // Safety check
-        FREE_C_HEAP_ARRAY(char, _array->at(i), mtInternal);
+        FREE_C_HEAP_ARRAY(char, _array->at(i));
       }
     }
     delete _array;
diff --git a/hotspot/src/share/vm/services/heapDumper.cpp b/hotspot/src/share/vm/services/heapDumper.cpp
index 3264f148748..0deb80c7bba 100644
--- a/hotspot/src/share/vm/services/heapDumper.cpp
+++ b/hotspot/src/share/vm/services/heapDumper.cpp
@@ -1404,7 +1404,7 @@ class VM_HeapDumper : public VM_GC_Operation {
       for (int i=0; i < _num_threads; i++) {
         delete _stack_traces[i];
       }
-      FREE_C_HEAP_ARRAY(ThreadStackTrace*, _stack_traces, mtInternal);
+      FREE_C_HEAP_ARRAY(ThreadStackTrace*, _stack_traces);
     }
     delete _klass_map;
   }
diff --git a/hotspot/src/share/vm/services/management.cpp b/hotspot/src/share/vm/services/management.cpp
index fbe4901a3f7..c5127a889da 100644
--- a/hotspot/src/share/vm/services/management.cpp
+++ b/hotspot/src/share/vm/services/management.cpp
@@ -1744,7 +1744,7 @@ JVM_ENTRY(void, jmm_SetVMGlobal(JNIEnv *env, jstring flag_name, jvalue new_value
     ccstr svalue = java_lang_String::as_utf8_string(str);
     succeed = CommandLineFlags::ccstrAtPut(name, &svalue, Flag::MANAGEMENT);
     if (succeed) {
-      FREE_C_HEAP_ARRAY(char, svalue, mtInternal);
+      FREE_C_HEAP_ARRAY(char, svalue);
     }
   }
   assert(succeed, "Setting flag should succeed");
@@ -1819,7 +1819,7 @@ ThreadTimesClosure::~ThreadTimesClosure() {
   for (int i = 0; i < _count; i++) {
     os::free(_names_chars[i]);
   }
-  FREE_C_HEAP_ARRAY(char *, _names_chars, mtInternal);
+  FREE_C_HEAP_ARRAY(char *, _names_chars);
 }
 
 // Fills names with VM internal thread names and times with the corresponding
diff --git a/hotspot/src/share/vm/services/memoryManager.cpp b/hotspot/src/share/vm/services/memoryManager.cpp
index 0469c937013..415c1a82855 100644
--- a/hotspot/src/share/vm/services/memoryManager.cpp
+++ b/hotspot/src/share/vm/services/memoryManager.cpp
@@ -171,8 +171,8 @@ GCStatInfo::GCStatInfo(int num_pools) {
 }
 
 GCStatInfo::~GCStatInfo() {
-  FREE_C_HEAP_ARRAY(MemoryUsage*, _before_gc_usage_array, mtInternal);
-  FREE_C_HEAP_ARRAY(MemoryUsage*, _after_gc_usage_array, mtInternal);
+  FREE_C_HEAP_ARRAY(MemoryUsage*, _before_gc_usage_array);
+  FREE_C_HEAP_ARRAY(MemoryUsage*, _after_gc_usage_array);
 }
 
 void GCStatInfo::set_gc_usage(int pool_index, MemoryUsage usage, bool before_gc) {
diff --git a/hotspot/src/share/vm/utilities/array.cpp b/hotspot/src/share/vm/utilities/array.cpp
index 782abd95acc..746f2a5e498 100644
--- a/hotspot/src/share/vm/utilities/array.cpp
+++ b/hotspot/src/share/vm/utilities/array.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -66,7 +66,7 @@ template <MEMFLAGS F> void CHeapArray<F>::expand(size_t esize, int i, int& size)
   // allocate and initialize new data section
   void* data = NEW_C_HEAP_ARRAY(char*, esize * size, F);
   memcpy(data, _data, esize * length());
-  FREE_C_HEAP_ARRAY(char*, _data, F);
+  FREE_C_HEAP_ARRAY(char*, _data);
   _data = data;
 }
 
diff --git a/hotspot/src/share/vm/utilities/bitMap.cpp b/hotspot/src/share/vm/utilities/bitMap.cpp
index baa76938cc3..3ebd7391e88 100644
--- a/hotspot/src/share/vm/utilities/bitMap.cpp
+++ b/hotspot/src/share/vm/utilities/bitMap.cpp
@@ -468,7 +468,7 @@ void BitMap::init_pop_count_table() {
                                        (intptr_t)  NULL_WORD);
     if (res != NULL_WORD) {
       guarantee( _pop_count_table == (void*) res, "invariant" );
-      FREE_C_HEAP_ARRAY(idx_t, table, mtInternal);
+      FREE_C_HEAP_ARRAY(idx_t, table);
     }
   }
 }
diff --git a/hotspot/src/share/vm/utilities/hashtable.cpp b/hotspot/src/share/vm/utilities/hashtable.cpp
index 85c8d5f26bb..456c4af920d 100644
--- a/hotspot/src/share/vm/utilities/hashtable.cpp
+++ b/hotspot/src/share/vm/utilities/hashtable.cpp
@@ -149,7 +149,7 @@ template <MEMFLAGS F> void BasicHashtable<F>::free_buckets() {
     // allocated by os::malloc
     if (!UseSharedSpaces ||
         !FileMapInfo::current_info()->is_in_shared_space(_buckets)) {
-       FREE_C_HEAP_ARRAY(HashtableBucket, _buckets, F);
+       FREE_C_HEAP_ARRAY(HashtableBucket, _buckets);
     }
     _buckets = NULL;
   }
diff --git a/hotspot/src/share/vm/utilities/numberSeq.cpp b/hotspot/src/share/vm/utilities/numberSeq.cpp
index 230447b2167..702a16a2a7f 100644
--- a/hotspot/src/share/vm/utilities/numberSeq.cpp
+++ b/hotspot/src/share/vm/utilities/numberSeq.cpp
@@ -139,7 +139,7 @@ TruncatedSeq::TruncatedSeq(int length, double alpha):
 }
 
 TruncatedSeq::~TruncatedSeq() {
-  FREE_C_HEAP_ARRAY(double, _sequence, mtGC);
+  FREE_C_HEAP_ARRAY(double, _sequence);
 }
 
 void TruncatedSeq::add(double val) {
diff --git a/hotspot/src/share/vm/utilities/ostream.cpp b/hotspot/src/share/vm/utilities/ostream.cpp
index f6880d7ac86..6e7fc2685a7 100644
--- a/hotspot/src/share/vm/utilities/ostream.cpp
+++ b/hotspot/src/share/vm/utilities/ostream.cpp
@@ -497,37 +497,37 @@ void test_loggc_filename() {
   jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "test.log", tms);
   o_result = make_log_name_internal("test.log", NULL, pid, tms);
   assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+  FREE_C_HEAP_ARRAY(char, o_result);
 
   // test-%t-%p.log
   jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "test-%s-pid%u.log", tms, pid);
   o_result = make_log_name_internal("test-%t-%p.log", NULL, pid, tms);
   assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test-%%t-%%p.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+  FREE_C_HEAP_ARRAY(char, o_result);
 
   // test-%t%p.log
   jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "test-%spid%u.log", tms, pid);
   o_result = make_log_name_internal("test-%t%p.log", NULL, pid, tms);
   assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"test-%%t%%p.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+  FREE_C_HEAP_ARRAY(char, o_result);
 
   // %p%t.log
   jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "pid%u%s.log", pid, tms);
   o_result = make_log_name_internal("%p%t.log", NULL, pid, tms);
   assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%p%%t.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+  FREE_C_HEAP_ARRAY(char, o_result);
 
   // %p-test.log
   jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "pid%u-test.log", pid);
   o_result = make_log_name_internal("%p-test.log", NULL, pid, tms);
   assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%p-test.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+  FREE_C_HEAP_ARRAY(char, o_result);
 
   // %t.log
   jio_snprintf(i_result, sizeof(char)*FILENAMEBUFLEN, "%s.log", tms);
   o_result = make_log_name_internal("%t.log", NULL, pid, tms);
   assert(strcmp(i_result, o_result) == 0, "failed on testing make_log_name(\"%%t.log\", NULL)");
-  FREE_C_HEAP_ARRAY(char, o_result, mtInternal);
+  FREE_C_HEAP_ARRAY(char, o_result);
 }
 #endif // PRODUCT
 
@@ -626,7 +626,7 @@ gcLogFileStream::~gcLogFileStream() {
     _file = NULL;
   }
   if (_file_name != NULL) {
-    FREE_C_HEAP_ARRAY(char, _file_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, _file_name);
     _file_name = NULL;
   }
 }
@@ -828,7 +828,7 @@ void defaultStream::init_log() {
                  "Warning:  Cannot open log file: %s\n", try_name);
     // Note:  This feature is for maintainer use only.  No need for L10N.
     jio_print(warnbuf);
-    FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, try_name);
     try_name = make_log_name(log_name, os::get_temp_directory());
     jio_snprintf(warnbuf, sizeof(warnbuf),
                  "Warning:  Forcing option -XX:LogFile=%s\n", try_name);
@@ -836,7 +836,7 @@ void defaultStream::init_log() {
     delete file;
     file = new(ResourceObj::C_HEAP, mtInternal) fileStream(try_name);
   }
-  FREE_C_HEAP_ARRAY(char, try_name, mtInternal);
+  FREE_C_HEAP_ARRAY(char, try_name);
 
   if (file->is_open()) {
     _log_file = file;
@@ -1120,7 +1120,7 @@ void ostream_init_log() {
     const char* list_name = make_log_name(DumpLoadedClassList, NULL);
     classlist_file = new(ResourceObj::C_HEAP, mtInternal)
                          fileStream(list_name);
-    FREE_C_HEAP_ARRAY(char, list_name, mtInternal);
+    FREE_C_HEAP_ARRAY(char, list_name);
   }
 #endif
 
@@ -1273,7 +1273,7 @@ char* bufferedStream::as_string() {
 
 bufferedStream::~bufferedStream() {
   if (!buffer_fixed) {
-    FREE_C_HEAP_ARRAY(char, buffer, mtInternal);
+    FREE_C_HEAP_ARRAY(char, buffer);
   }
 }
 
diff --git a/hotspot/src/share/vm/utilities/quickSort.cpp b/hotspot/src/share/vm/utilities/quickSort.cpp
index de008877989..523b169b3c3 100644
--- a/hotspot/src/share/vm/utilities/quickSort.cpp
+++ b/hotspot/src/share/vm/utilities/quickSort.cpp
@@ -214,8 +214,8 @@ void QuickSort::test_quick_sort() {
     sort(test_array, length, test_even_odd_comparator, true);
     assert(compare_arrays(test_array, expected_array, length), "Sorting already sorted array changed order of elements - not idempotent");
 
-    FREE_C_HEAP_ARRAY(int, test_array, mtInternal);
-    FREE_C_HEAP_ARRAY(int, expected_array, mtInternal);
+    FREE_C_HEAP_ARRAY(int, test_array);
+    FREE_C_HEAP_ARRAY(int, expected_array);
   }
 }
 
diff --git a/hotspot/src/share/vm/utilities/stack.inline.hpp b/hotspot/src/share/vm/utilities/stack.inline.hpp
index 7fe7d1db32d..f63957a7a8c 100644
--- a/hotspot/src/share/vm/utilities/stack.inline.hpp
+++ b/hotspot/src/share/vm/utilities/stack.inline.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2014, 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
@@ -145,7 +145,7 @@ E* Stack<E, F>::alloc(size_t bytes)
 template <class E, MEMFLAGS F>
 void Stack<E, F>::free(E* addr, size_t bytes)
 {
-  FREE_C_HEAP_ARRAY(char, (char*) addr, F);
+  FREE_C_HEAP_ARRAY(char, (char*) addr);
 }
 
 template <class E, MEMFLAGS F>
diff --git a/hotspot/src/share/vm/utilities/taskqueue.hpp b/hotspot/src/share/vm/utilities/taskqueue.hpp
index 9e55b7d610b..da30b2c8834 100644
--- a/hotspot/src/share/vm/utilities/taskqueue.hpp
+++ b/hotspot/src/share/vm/utilities/taskqueue.hpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2014, 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
@@ -427,7 +427,7 @@ bool GenericTaskQueue<E, F, N>::pop_global(volatile E& t) {
 
 template<class E, MEMFLAGS F, unsigned int N>
 GenericTaskQueue<E, F, N>::~GenericTaskQueue() {
-  FREE_C_HEAP_ARRAY(E, _elems, F);
+  FREE_C_HEAP_ARRAY(E, _elems);
 }
 
 // OverflowTaskQueue is a TaskQueue that also includes an overflow stack for
diff --git a/hotspot/src/share/vm/utilities/workgroup.cpp b/hotspot/src/share/vm/utilities/workgroup.cpp
index 6b5d8969798..17db9df7a81 100644
--- a/hotspot/src/share/vm/utilities/workgroup.cpp
+++ b/hotspot/src/share/vm/utilities/workgroup.cpp
@@ -489,7 +489,7 @@ void SubTasksDone::all_tasks_completed() {
 
 
 SubTasksDone::~SubTasksDone() {
-  if (_tasks != NULL) FREE_C_HEAP_ARRAY(jint, _tasks, mtInternal);
+  if (_tasks != NULL) FREE_C_HEAP_ARRAY(jint, _tasks);
 }
 
 // *** SequentialSubTasksDone
@@ -560,7 +560,7 @@ FreeIdSet::FreeIdSet(int sz, Monitor* mon) :
 
 FreeIdSet::~FreeIdSet() {
   _sets[_index] = NULL;
-  FREE_C_HEAP_ARRAY(int, _ids, mtInternal);
+  FREE_C_HEAP_ARRAY(int, _ids);
 }
 
 void FreeIdSet::set_safepoint(bool b) {
diff --git a/hotspot/src/share/vm/utilities/xmlstream.cpp b/hotspot/src/share/vm/utilities/xmlstream.cpp
index 785f927b10e..dc1fd1e599a 100644
--- a/hotspot/src/share/vm/utilities/xmlstream.cpp
+++ b/hotspot/src/share/vm/utilities/xmlstream.cpp
@@ -58,7 +58,7 @@ void xmlStream::initialize(outputStream* out) {
 
 #ifdef ASSERT
 xmlStream::~xmlStream() {
-  FREE_C_HEAP_ARRAY(char, _element_close_stack_low, mtInternal);
+  FREE_C_HEAP_ARRAY(char, _element_close_stack_low);
 }
 #endif
 
@@ -162,7 +162,7 @@ void xmlStream::see_tag(const char* tag, bool push) {
     _element_close_stack_high = new_high;
     _element_close_stack_low  = new_low;
     _element_close_stack_ptr  = new_ptr;
-    FREE_C_HEAP_ARRAY(char, old_low, mtInternal);
+    FREE_C_HEAP_ARRAY(char, old_low);
     push_ptr = new_ptr - (tag_len+1);
   }
   assert(push_ptr >= _element_close_stack_low, "in range");

From 4e4687806248fae6c1e494d7723cfb025795e1c3 Mon Sep 17 00:00:00 2001
From: Vladimir Kempik <vkempik@openjdk.org>
Date: Mon, 1 Dec 2014 18:22:45 +0400
Subject: [PATCH 190/299] 8058935: CPU detection gives 0 cores per cpu, 2
 threads per core in Amazon EC2 environment

Reviewed-by: kvn, dsamersoff
---
 hotspot/src/cpu/x86/vm/vm_version_x86.hpp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp
index 17c34cd525a..be27e3908b2 100644
--- a/hotspot/src/cpu/x86/vm/vm_version_x86.hpp
+++ b/hotspot/src/cpu/x86/vm/vm_version_x86.hpp
@@ -570,10 +570,12 @@ public:
   static uint cores_per_cpu()  {
     uint result = 1;
     if (is_intel()) {
-      if (supports_processor_topology()) {
+      bool supports_topology = supports_processor_topology();
+      if (supports_topology) {
         result = _cpuid_info.tpl_cpuidB1_ebx.bits.logical_cpus /
                  _cpuid_info.tpl_cpuidB0_ebx.bits.logical_cpus;
-      } else {
+      }
+      if (!supports_topology || result == 0) {
         result = (_cpuid_info.dcp_cpuid4_eax.bits.cores_per_cpu + 1);
       }
     } else if (is_amd()) {

From 5f72abe97e68570cff5d58fe52b4efc3d38fa250 Mon Sep 17 00:00:00 2001
From: Lance Andersen <lancea@openjdk.org>
Date: Mon, 1 Dec 2014 11:34:44 -0500
Subject: [PATCH 191/299] 8066261: Typo in Connection.isValid

Reviewed-by: dfuchs
---
 jdk/src/java.sql/share/classes/java/sql/Connection.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/jdk/src/java.sql/share/classes/java/sql/Connection.java b/jdk/src/java.sql/share/classes/java/sql/Connection.java
index ac73fde29dd..ac5d3158b6e 100644
--- a/jdk/src/java.sql/share/classes/java/sql/Connection.java
+++ b/jdk/src/java.sql/share/classes/java/sql/Connection.java
@@ -1116,7 +1116,7 @@ public interface Connection  extends Wrapper, AutoCloseable {
          *
          * @return true if the connection is valid, false otherwise
          * @exception SQLException if the value supplied for <code>timeout</code>
-         * is less then 0
+         * is less than 0
          * @since 1.6
          *
          * @see java.sql.DatabaseMetaData#getClientInfoProperties

From 392436eade0b7eef17305e45fd3de51128883bd8 Mon Sep 17 00:00:00 2001
From: Mark Sheppard <msheppar@openjdk.org>
Date: Mon, 1 Dec 2014 17:20:06 +0000
Subject: [PATCH 192/299] 8066130: com.sun.net.httpserver stop() throws
 NullPointerException if it is not started

Added null check on dispatcherThread variable in stop method

Reviewed-by: chegar
---
 .../sun/net/httpserver/ServerImpl.java        | 12 +++---
 .../sun/net/httpserver/StopNoStartTest.java   | 42 +++++++++++++++++++
 2 files changed, 49 insertions(+), 5 deletions(-)
 create mode 100644 jdk/test/com/sun/net/httpserver/StopNoStartTest.java

diff --git a/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java b/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java
index 5952c79ee87..24ab8b014db 100644
--- a/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java
+++ b/jdk/src/jdk.httpserver/share/classes/sun/net/httpserver/ServerImpl.java
@@ -206,11 +206,13 @@ class ServerImpl implements TimeSource {
         if (timer1Enabled) {
             timer1.cancel();
         }
-        try {
-            dispatcherThread.join();
-        } catch (InterruptedException e) {
-            Thread.currentThread().interrupt();
-            logger.log(Level.FINER, "ServerImpl.stop: ", e);
+        if (dispatcherThread != null) {
+            try {
+                dispatcherThread.join();
+            } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
+                logger.log(Level.FINER, "ServerImpl.stop: ", e);
+            }
         }
     }
 
diff --git a/jdk/test/com/sun/net/httpserver/StopNoStartTest.java b/jdk/test/com/sun/net/httpserver/StopNoStartTest.java
new file mode 100644
index 00000000000..c10d767e7d7
--- /dev/null
+++ b/jdk/test/com/sun/net/httpserver/StopNoStartTest.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014 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 8066130
+ * @summary  Test HttpServer stop method invocation before a start has been called
+ */
+
+import java.net.InetSocketAddress;
+import com.sun.net.httpserver.HttpServer;
+
+
+public class StopNoStartTest {
+
+    public static void main(String[] args) throws Exception {
+
+        InetSocketAddress serverAddr = new InetSocketAddress(0);
+        HttpServer server = HttpServer.create(serverAddr, 0);
+        server.stop(0);
+    }
+}

From 3e1d5786af201705d46af49159e3e74808e7dca9 Mon Sep 17 00:00:00 2001
From: Igor Ignatyev <iignatyev@openjdk.org>
Date: Mon, 1 Dec 2014 21:56:54 +0300
Subject: [PATCH 193/299] 8066191: Introduce time limited test executor

Reviewed-by: vlivanov, psandoz
---
 .../jdk/testlibrary/TimeLimitedRunner.java    | 86 +++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100644 jdk/test/lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java

diff --git a/jdk/test/lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java b/jdk/test/lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java
new file mode 100644
index 00000000000..5cc98ea8f8a
--- /dev/null
+++ b/jdk/test/lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package jdk.testlibrary;
+
+import java.util.Objects;
+import java.util.concurrent.Callable;
+
+/**
+ * Auxiliary class to run target w/ given timeout.
+ */
+public class TimeLimitedRunner implements Callable<Void> {
+    private final long              stoptime;
+    private final long              timeout;
+    private final double            factor;
+    private final Callable<Boolean> target;
+
+    /**
+     * @param timeout   a timeout. zero means no time limitation
+     * @param factor    a multiplier used to estimate next iteration time
+     * @param target    a target to run
+     * @throws NullPointerException     if target is null
+     * @throws IllegalArgumentException if timeout is negative or
+                                        factor isn't positive
+     */
+    public TimeLimitedRunner(long timeout, double factor,
+            Callable<Boolean> target) {
+        Objects.requireNonNull(target, "target must not be null");
+        if (timeout < 0) {
+            throw new IllegalArgumentException("timeout[" + timeout + "] < 0");
+        }
+        if (factor <= 0d) {
+            throw new IllegalArgumentException("factor[" + factor + "] <= 0");
+        }
+        this.stoptime = System.currentTimeMillis() + timeout;
+        this.timeout = timeout;
+        this.factor = factor;
+        this.target = target;
+    }
+
+    /**
+     * Runs @{linkplan target} while it returns true and timeout isn't exceeded
+     */
+    @Override
+    public Void call() throws Exception {
+        long maxDuration = 0L;
+        long iterStart = System.currentTimeMillis();
+        if (timeout != 0 && iterStart > stoptime) {
+            return null;
+        }
+        while (target.call()) {
+            if (timeout != 0) {
+                long iterDuration = System.currentTimeMillis() - iterStart;
+                maxDuration = Math.max(maxDuration, iterDuration);
+                iterStart = System.currentTimeMillis();
+                if (iterStart + (maxDuration * factor) > stoptime) {
+                    System.out.println("Not enough time to continue execution. "
+                            + "Interrupted.");
+                    break;
+                }
+            }
+        }
+        return null;
+    }
+
+}

From 7abe24d3ea017b431113c5a709f976519f7492c3 Mon Sep 17 00:00:00 2001
From: Igor Ignatyev <iignatyev@openjdk.org>
Date: Mon, 1 Dec 2014 21:58:46 +0300
Subject: [PATCH 194/299] 8039953: [TESTBUG] Timeout
 java/lang/invoke/MethodHandles/CatchExceptionTest.java

Reviewed-by: vlivanov, psandoz
---
 .../MethodHandles/CatchExceptionTest.java     | 22 ++++++++++++++-----
 1 file changed, 17 insertions(+), 5 deletions(-)

diff --git a/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java b/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
index 52c41dfd991..996ed526413 100644
--- a/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
+++ b/jdk/test/java/lang/invoke/MethodHandles/CatchExceptionTest.java
@@ -24,6 +24,8 @@ package test.java.lang.invoke.MethodHandles;
 
 import com.oracle.testlibrary.jsr292.Helper;
 import jdk.testlibrary.Asserts;
+import jdk.testlibrary.TimeLimitedRunner;
+import jdk.testlibrary.Utils;
 
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
@@ -33,6 +35,7 @@ import java.util.*;
 import java.util.function.BiFunction;
 import java.util.function.Function;
 import java.util.function.Supplier;
+import java.util.concurrent.TimeUnit;
 
 /* @test
  * @library /lib/testlibrary/jsr292 /lib/testlibrary/
@@ -93,14 +96,23 @@ public class CatchExceptionTest {
     }
 
     public static void main(String[] args) throws Throwable {
+        TestFactory factory = new TestFactory();
+        long timeout = Helper.IS_THOROUGH ? 0L : Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT);
+        // substract vm init time and reserve time for vm exit
+        timeout *= 0.9;
+        TimeLimitedRunner runner = new TimeLimitedRunner(timeout, 2.0d,
+                () -> {
+                    CatchExceptionTest test = factory.nextTest();
+                    if (test != null) {
+                        test.runTest();
+                        return true;
+                    }
+                    return false;
+                });
         for (CatchExceptionTest test : TestFactory.MANDATORY_TEST_CASES) {
             test.runTest();
         }
-        TestFactory factory = new TestFactory();
-        CatchExceptionTest test;
-        while ((test = factory.nextTest()) != null ) {
-            test.runTest();
-        }
+        runner.call();
     }
 
     private List<Class<?>> getThrowerParams(boolean isVararg, int argsCount) {

From 0fccf46ae46f8d80fbc48673566d86ad467a9361 Mon Sep 17 00:00:00 2001
From: Tatiana Pivovarova <tatiana.pivovarova@oracle.com>
Date: Mon, 1 Dec 2014 22:38:29 +0300
Subject: [PATCH 195/299] 8066141: compiler/whitebox/GetNMethodTest.java:
 java.lang.RuntimeException: blob_type[MethodProfiled] for 2 level isn't
 MethodNonProfiled

Reviewed-by: iveresov, iignatyev
---
 hotspot/test/compiler/whitebox/GetNMethodTest.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hotspot/test/compiler/whitebox/GetNMethodTest.java b/hotspot/test/compiler/whitebox/GetNMethodTest.java
index dc3d35d42e0..45ce48fc6ec 100644
--- a/hotspot/test/compiler/whitebox/GetNMethodTest.java
+++ b/hotspot/test/compiler/whitebox/GetNMethodTest.java
@@ -75,7 +75,7 @@ public class GetNMethodTest extends CompilerWhiteBoxTest {
                 break;
             case 2:
             case 3:
-                checkBlockType(nmethod, BlobType.MethodNonProfiled);
+                checkBlockType(nmethod, BlobType.MethodProfiled);
                 break;
             default:
                 throw new Error("unexpected comp level " + nmethod);

From 3034f050f9c6a5d381c66b728796d42b9b9f127a Mon Sep 17 00:00:00 2001
From: Daniel Fuchs <dfuchs@openjdk.org>
Date: Mon, 1 Dec 2014 21:02:21 +0100
Subject: [PATCH 196/299] 8065552: setAccessible(true) on fields of Class may
 throw a SecurityException

This fix hides the new private Class.classLoader field from reflection, rather than making it not accessible.

Reviewed-by: mchung, coffeys
---
 .../share/classes/java/lang/Class.java        |   2 +
 .../java/lang/reflect/AccessibleObject.java   |   7 -
 .../share/classes/sun/reflect/Reflection.java |   1 +
 .../ClassDeclaredFieldsTest.java              | 205 ++++++++++++++++++
 4 files changed, 208 insertions(+), 7 deletions(-)
 create mode 100644 jdk/test/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java

diff --git a/jdk/src/java.base/share/classes/java/lang/Class.java b/jdk/src/java.base/share/classes/java/lang/Class.java
index ee24402ec8d..25ed5c47fec 100644
--- a/jdk/src/java.base/share/classes/java/lang/Class.java
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java
@@ -691,6 +691,8 @@ public final class Class<T> implements java.io.Serializable,
     ClassLoader getClassLoader0() { return classLoader; }
 
     // Initialized in JVM not by private constructor
+    // This field is filtered from reflection access, i.e. getDeclaredField
+    // will throw NoSuchFieldException
     private final ClassLoader classLoader;
 
     /**
diff --git a/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java b/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java
index 01a074f36e0..65755f09826 100644
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java
@@ -140,13 +140,6 @@ public class AccessibleObject implements AnnotatedElement {
                 throw new SecurityException("Cannot make a java.lang.Class" +
                                             " constructor accessible");
             }
-        } else if (obj instanceof Field && flag == true) {
-            Field f = (Field)obj;
-            if (f.getDeclaringClass() == Class.class &&
-                f.getName().equals("classLoader")) {
-                throw new SecurityException("Cannot make java.lang.Class.classLoader" +
-                                            " accessible");
-            }
         }
         obj.override = flag;
     }
diff --git a/jdk/src/java.base/share/classes/sun/reflect/Reflection.java b/jdk/src/java.base/share/classes/sun/reflect/Reflection.java
index 63baa42abae..bc3e13e23cb 100644
--- a/jdk/src/java.base/share/classes/sun/reflect/Reflection.java
+++ b/jdk/src/java.base/share/classes/sun/reflect/Reflection.java
@@ -46,6 +46,7 @@ public class Reflection {
         map.put(Reflection.class,
             new String[] {"fieldFilterMap", "methodFilterMap"});
         map.put(System.class, new String[] {"security"});
+        map.put(Class.class, new String[] {"classLoader"});
         fieldFilterMap = map;
 
         methodFilterMap = new HashMap<>();
diff --git a/jdk/test/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java b/jdk/test/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java
new file mode 100644
index 00000000000..c05e1790d59
--- /dev/null
+++ b/jdk/test/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2014, 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.lang.reflect.Field;
+import java.lang.reflect.ReflectPermission;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+/**
+ * @test
+ * @bug 8065552
+ * @summary test that all fields returned by getDeclaredFields() can be
+ *          set accessible if the right permission is granted; this test
+ *          also verifies that Class.classLoader final private field is
+ *          hidden from reflection access.
+ * @run main/othervm ClassDeclaredFieldsTest UNSECURE
+ * @run main/othervm ClassDeclaredFieldsTest SECURE
+ *
+ * @author danielfuchs
+ */
+public class ClassDeclaredFieldsTest {
+
+    // Test with or without a security manager
+    public static enum TestCase {
+        UNSECURE, SECURE;
+        public void run() throws Exception {
+            System.out.println("Running test case: " + name());
+            Configure.setUp(this);
+            test(this);
+        }
+    }
+    /**
+     * @param args the command line arguments
+     */
+    public static void main(String[] args) throws Exception {
+        System.out.println(System.getProperty("java.version"));
+        if (args == null || args.length == 0) {
+            args = new String[] { "SECURE" };
+        } else if (args.length != 1) {
+            throw new IllegalArgumentException("Only one arg expected: "
+                    + Arrays.asList(args));
+        }
+        TestCase.valueOf(args[0]).run();
+    }
+
+    static void test(TestCase test) {
+        for (Field f : Class.class.getDeclaredFields()) {
+            f.setAccessible(true);
+            System.out.println("Field "+f.getName()+" is now accessible.");
+            if (f.getName().equals("classLoader")) {
+                throw new RuntimeException("Found "+f.getName()+" field!");
+            }
+        }
+        try {
+            Class.class.getDeclaredField("classLoader");
+            throw new RuntimeException("Expected NoSuchFieldException for"
+                    + " 'classLoader' field not raised");
+        } catch(NoSuchFieldException x) {
+            System.out.println("Got expected exception: " + x);
+        }
+        System.out.println("Passed "+test);
+    }
+
+    // A helper class to configure the security manager for the test,
+    // and bypass it when needed.
+    static class Configure {
+        static Policy policy = null;
+        static final ThreadLocal<AtomicBoolean> allowAll = new ThreadLocal<AtomicBoolean>() {
+            @Override
+            protected AtomicBoolean initialValue() {
+                return  new AtomicBoolean(false);
+            }
+        };
+        static void setUp(TestCase test) {
+            switch (test) {
+                case SECURE:
+                    if (policy == null && System.getSecurityManager() != null) {
+                        throw new IllegalStateException("SecurityManager already set");
+                    } else if (policy == null) {
+                        policy = new SimplePolicy(TestCase.SECURE, allowAll);
+                        Policy.setPolicy(policy);
+                        System.setSecurityManager(new SecurityManager());
+                    }
+                    if (System.getSecurityManager() == null) {
+                        throw new IllegalStateException("No SecurityManager.");
+                    }
+                    if (policy == null) {
+                        throw new IllegalStateException("policy not configured");
+                    }
+                    break;
+                case UNSECURE:
+                    if (System.getSecurityManager() != null) {
+                        throw new IllegalStateException("SecurityManager already set");
+                    }
+                    break;
+                default:
+                    throw new InternalError("No such testcase: " + test);
+            }
+        }
+        static void doPrivileged(Runnable run) {
+            allowAll.get().set(true);
+            try {
+                run.run();
+            } finally {
+                allowAll.get().set(false);
+            }
+        }
+    }
+
+    // A Helper class to build a set of permissions.
+    final static class PermissionsBuilder {
+        final Permissions perms;
+        public PermissionsBuilder() {
+            this(new Permissions());
+        }
+        public PermissionsBuilder(Permissions perms) {
+            this.perms = perms;
+        }
+        public PermissionsBuilder add(Permission p) {
+            perms.add(p);
+            return this;
+        }
+        public PermissionsBuilder addAll(PermissionCollection col) {
+            if (col != null) {
+                for (Enumeration<Permission> e = col.elements(); e.hasMoreElements(); ) {
+                    perms.add(e.nextElement());
+                }
+            }
+            return this;
+        }
+        public Permissions toPermissions() {
+            final PermissionsBuilder builder = new PermissionsBuilder();
+            builder.addAll(perms);
+            return builder.perms;
+        }
+    }
+
+    // Policy for the test...
+    public static class SimplePolicy extends Policy {
+
+        final Permissions permissions;
+        final Permissions allPermissions;
+        final ThreadLocal<AtomicBoolean> allowAll; // actually: this should be in a thread locale
+        public SimplePolicy(TestCase test, ThreadLocal<AtomicBoolean> allowAll) {
+            this.allowAll = allowAll;
+            // we don't actually need any permission to create our
+            // FileHandlers because we're passing invalid parameters
+            // which will make the creation fail...
+            permissions = new Permissions();
+            permissions.add(new RuntimePermission("accessDeclaredMembers"));
+            permissions.add(new ReflectPermission("suppressAccessChecks"));
+
+            // these are used for configuring the test itself...
+            allPermissions = new Permissions();
+            allPermissions.add(new java.security.AllPermission());
+
+        }
+
+        @Override
+        public boolean implies(ProtectionDomain domain, Permission permission) {
+            if (allowAll.get().get()) return allPermissions.implies(permission);
+            return permissions.implies(permission);
+        }
+
+        @Override
+        public PermissionCollection getPermissions(CodeSource codesource) {
+            return new PermissionsBuilder().addAll(allowAll.get().get()
+                    ? allPermissions : permissions).toPermissions();
+        }
+
+        @Override
+        public PermissionCollection getPermissions(ProtectionDomain domain) {
+            return new PermissionsBuilder().addAll(allowAll.get().get()
+                    ? allPermissions : permissions).toPermissions();
+        }
+    }
+
+}

From 2f9a2c3c320a4413ad843f0c505a75c5792ad249 Mon Sep 17 00:00:00 2001
From: Stuart Marks <smarks@openjdk.org>
Date: Mon, 1 Dec 2014 17:59:39 -0800
Subject: [PATCH 197/299] 8035000: clean up ActivationLibrary.DestroyThread

Reviewed-by: lancea
---
 .../checkActivateRef/CheckActivateRef.java    |   4 +-
 .../checkAnnotations/CheckAnnotations.java    |   4 +-
 .../CheckImplClassLoader.java                 |   4 +-
 .../CheckRegisterInLog.java                   |   4 +-
 .../CreatePrivateActivatable.java             |   4 +-
 .../DownloadParameterClass.java               |   4 +-
 .../ElucidateNoSuchMethod.java                |   4 +-
 .../extLoadedImpl/ExtLoadedImplTest.java      |   4 +-
 .../forceLogSnapshot/ForceLogSnapshot.java    |   4 +-
 .../inactiveGroup/InactiveGroup.java          |   4 +-
 .../LookupActivationSystem.java               |   4 +-
 .../nestedActivate/NestedActivate.java        |   4 +-
 .../NonExistentActivatable.java               |   4 +-
 .../RestartCrashedService.java                |   4 +-
 .../restartLatecomer/RestartLatecomer.java    |   4 +-
 .../restartService/RestartService.java        |   4 +-
 .../UnregisterInactive.java                   |   4 +-
 .../activateFails/ActivateFails.java          |   4 +-
 .../DownloadActivationGroup.java              |   4 +-
 .../activeGroup/IdempotentActiveGroup.java    |   4 +-
 .../modifyDescriptor/ModifyDescriptor.java    |   4 +-
 .../StubClassesPermitted.java                 |   4 +-
 .../unregisterGroup/UnregisterGroup.java      |   4 +-
 .../CommandEnvironment/SetChildEnv.java       |   4 +-
 .../InheritedChannelNotServerSocket.java      |   4 +-
 .../RmidViaInheritedChannel.java              |   4 +-
 .../AltSecurityManager.java                   |   7 -
 .../activatable/UseCustomSocketFactory.java   |   4 +-
 .../rmi/testlibrary/ActivationLibrary.java    |  64 ------
 jdk/test/java/rmi/testlibrary/RMID.java       | 216 +++++++++---------
 30 files changed, 160 insertions(+), 235 deletions(-)

diff --git a/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java b/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java
index dcd5990db63..f37fdec54dc 100644
--- a/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java
+++ b/jdk/test/java/rmi/activation/Activatable/checkActivateRef/CheckActivateRef.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -262,7 +262,7 @@ public class CheckActivateRef
                              e.getClass().getName(), e);
 
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             obj = null;
         }
     }
diff --git a/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java b/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java
index d2a0bab342c..126fae1e521 100644
--- a/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java
+++ b/jdk/test/java/rmi/activation/Activatable/checkAnnotations/CheckAnnotations.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -130,7 +130,7 @@ public class CheckAnnotations
 
             myRMI = null;
             System.err.println("rmid shut down");
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 
diff --git a/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java b/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java
index 556e2895ca9..dc54f82459b 100644
--- a/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java
+++ b/jdk/test/java/rmi/activation/Activatable/checkImplClassLoader/CheckImplClassLoader.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -112,7 +112,7 @@ public class CheckImplClassLoader {
 
             myRMI = null;
             System.err.println("rmid shut down");
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             TestLibrary.unexport(group);
         }
     }
diff --git a/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java b/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java
index c294a972d36..0d03562346c 100644
--- a/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java
+++ b/jdk/test/java/rmi/activation/Activatable/checkRegisterInLog/CheckRegisterInLog.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -164,7 +164,7 @@ public class CheckRegisterInLog
             throw new RuntimeException("CheckRegisterInLog got exception " +
                                        e.getMessage());
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
diff --git a/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java b/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java
index 2900e80964a..414527dfa4b 100644
--- a/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java
+++ b/jdk/test/java/rmi/activation/Activatable/createPrivateActivable/CreatePrivateActivatable.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, 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
@@ -155,7 +155,7 @@ public class CreatePrivateActivatable
                              e.getClass().getName(), e);
 
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             obj = null;
         }
     }
diff --git a/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java b/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java
index 64f11681341..9f236978a4a 100644
--- a/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java
+++ b/jdk/test/java/rmi/activation/Activatable/downloadParameterClass/DownloadParameterClass.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -138,7 +138,7 @@ public class DownloadParameterClass {
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
diff --git a/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java b/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java
index 29482121ffb..0e0efb52cd5 100644
--- a/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java
+++ b/jdk/test/java/rmi/activation/Activatable/elucidateNoSuchMethod/ElucidateNoSuchMethod.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -135,7 +135,7 @@ public class ElucidateNoSuchMethod
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
diff --git a/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java b/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java
index 3fd009b611a..c46baeaf5e7 100644
--- a/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java
+++ b/jdk/test/java/rmi/activation/Activatable/extLoadedImpl/ExtLoadedImplTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -69,7 +69,7 @@ public class ExtLoadedImplTest {
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
diff --git a/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java b/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java
index abbaadfb9f3..55ff0cfd14e 100644
--- a/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java
+++ b/jdk/test/java/rmi/activation/Activatable/forceLogSnapshot/ForceLogSnapshot.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -248,7 +248,7 @@ public class ForceLogSnapshot
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             for (int i = 0 ; i < HOW_MANY ; i ++) {
                 TestLibrary.unexport(unicastObjs[i]);
             }
diff --git a/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java b/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java
index ad0b14e421a..145e6109df8 100644
--- a/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java
+++ b/jdk/test/java/rmi/activation/Activatable/inactiveGroup/InactiveGroup.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -176,7 +176,7 @@ public class InactiveGroup
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
diff --git a/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java b/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java
index ce154c4ca99..df778dc8e91 100644
--- a/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java
+++ b/jdk/test/java/rmi/activation/Activatable/lookupActivationSystem/LookupActivationSystem.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, 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
@@ -118,7 +118,7 @@ public class LookupActivationSystem implements Remote, Serializable {
 
 
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
diff --git a/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java b/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java
index 48e3e2d701e..507912e90b5 100644
--- a/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java
+++ b/jdk/test/java/rmi/activation/Activatable/nestedActivate/NestedActivate.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -165,7 +165,7 @@ public class NestedActivate
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
diff --git a/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java b/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java
index 47ddd176ef8..df8ddbef82c 100644
--- a/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java
+++ b/jdk/test/java/rmi/activation/Activatable/nonExistentActivatable/NonExistentActivatable.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -139,7 +139,7 @@ public class NonExistentActivatable
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
diff --git a/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java b/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java
index 5700f3d72f2..c3026b02c93 100644
--- a/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java
+++ b/jdk/test/java/rmi/activation/Activatable/restartCrashedService/RestartCrashedService.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -231,7 +231,7 @@ public class RestartCrashedService
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             TestLibrary.unexport(unicastObj);
         }
     }
diff --git a/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java b/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java
index 747eee68f3a..3bbe8a60c44 100644
--- a/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java
+++ b/jdk/test/java/rmi/activation/Activatable/restartLatecomer/RestartLatecomer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -247,7 +247,7 @@ public class RestartLatecomer
         } catch (Exception e) {
             TestLibrary.bomb(e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             TestLibrary.unexport(callbackObj);
         }
     }
diff --git a/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java b/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java
index e1f2eb554ee..468f5b239f1 100644
--- a/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java
+++ b/jdk/test/java/rmi/activation/Activatable/restartService/RestartService.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -221,7 +221,7 @@ public class RestartService
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             TestLibrary.unexport(unicastObj);
         }
     }
diff --git a/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java b/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java
index 455efd7d7f6..085120b159d 100644
--- a/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java
+++ b/jdk/test/java/rmi/activation/Activatable/unregisterInactive/UnregisterInactive.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -125,7 +125,7 @@ public class UnregisterInactive
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
diff --git a/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java b/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java
index 6a2eba05864..6d9ccceb141 100644
--- a/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java
+++ b/jdk/test/java/rmi/activation/ActivateFailedException/activateFails/ActivateFails.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -163,7 +163,7 @@ public class ActivateFails
 
         } finally {
             obj1 = obj2 = null;
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
diff --git a/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java b/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java
index f9aed42021d..2f025cf25b8 100644
--- a/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java
+++ b/jdk/test/java/rmi/activation/ActivationGroup/downloadActivationGroup/DownloadActivationGroup.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2014, 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
@@ -156,7 +156,7 @@ public class DownloadActivationGroup
         } catch (Exception e) {
             TestLibrary.bomb(e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
diff --git a/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java b/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java
index f6c08178eec..058d3c7e2d9 100644
--- a/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java
+++ b/jdk/test/java/rmi/activation/ActivationSystem/activeGroup/IdempotentActiveGroup.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -108,7 +108,7 @@ public class IdempotentActiveGroup {
             } catch (NoSuchObjectException unexpected) {
                 throw new AssertionError(unexpected);
             }
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 
diff --git a/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java b/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java
index ba376d1a8d9..53ff030e393 100644
--- a/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java
+++ b/jdk/test/java/rmi/activation/ActivationSystem/modifyDescriptor/ModifyDescriptor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -250,7 +250,7 @@ public class ModifyDescriptor
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
diff --git a/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java b/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java
index b7890e0ebe7..f4970da26ad 100644
--- a/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java
+++ b/jdk/test/java/rmi/activation/ActivationSystem/stubClassesPermitted/StubClassesPermitted.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -171,7 +171,7 @@ public class StubClassesPermitted
             }
 
             canCreateStubs = null;
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
             System.err.println("rmid shut down");
         }
     }
diff --git a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java
index bc5976b74fe..94976dc0c6f 100644
--- a/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java
+++ b/jdk/test/java/rmi/activation/ActivationSystem/unregisterGroup/UnregisterGroup.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -156,7 +156,7 @@ public class UnregisterGroup extends Activatable implements ActivateMe
         } catch (Exception e) {
             TestLibrary.bomb("test failed", e);
         } finally {
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 }
diff --git a/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java b/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java
index 7b1a9688ad4..69274a0a797 100644
--- a/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java
+++ b/jdk/test/java/rmi/activation/CommandEnvironment/SetChildEnv.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, 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
@@ -203,7 +203,7 @@ public class SetChildEnv
         actsys.unregisterGroup(gid);
 
         Thread.sleep(5000);
-        ActivationLibrary.rmidCleanup(rmid);
+        rmid.cleanup();
     }
 
     public static class DebugExecWatcher
diff --git a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java
index 4611a83bda5..d375fc84611 100644
--- a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java
+++ b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/InheritedChannelNotServerSocket.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -121,7 +121,7 @@ public class InheritedChannelNotServerSocket {
             if (obj != null) {
                 UnicastRemoteObject.unexportObject(obj, true);
             }
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 
diff --git a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java
index 6d81b0f1248..1f3cd6603d5 100644
--- a/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java
+++ b/jdk/test/java/rmi/activation/rmidViaInheritedChannel/RmidViaInheritedChannel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2014, 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
@@ -119,7 +119,7 @@ public class RmidViaInheritedChannel implements Callback {
             if (obj != null) {
                 UnicastRemoteObject.unexportObject(obj, true);
             }
-            ActivationLibrary.rmidCleanup(rmid);
+            rmid.cleanup();
         }
     }
 
diff --git a/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java b/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java
index 351042965de..ebad01300ae 100644
--- a/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java
+++ b/jdk/test/java/rmi/registry/altSecurityManager/AltSecurityManager.java
@@ -104,13 +104,6 @@ public class AltSecurityManager implements Runnable {
                                utilityToStart + " to die");
 
             if (time >= TIME_OUT) {
-
-                // dont pollute other tests; increase the likelihood
-                // that rmid will go away if it did not exit already.
-                if (utility.equals(ACTIVATION)) {
-                    RMID.shutdown(port);
-                }
-
                 TestLibrary.bomb(utilityToStart +
                                  " took too long to die...");
             } else {
diff --git a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java
index b300e1083bb..5157f789c75 100644
--- a/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java
+++ b/jdk/test/java/rmi/server/RMISocketFactory/useSocketFactory/activatable/UseCustomSocketFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,7 +57,7 @@ public class UseCustomSocketFactory {
         RMID rmid = null;
 
         try {
-            rmid = RMID.createRMID(true);
+            rmid = RMID.createRMID();
             rmid.addArguments(new String[] {
                 "-C-Djava.security.policy=" +
                     TestParams.defaultGroupPolicy +
diff --git a/jdk/test/java/rmi/testlibrary/ActivationLibrary.java b/jdk/test/java/rmi/testlibrary/ActivationLibrary.java
index b33a3035c89..6a7a5b753d8 100644
--- a/jdk/test/java/rmi/testlibrary/ActivationLibrary.java
+++ b/jdk/test/java/rmi/testlibrary/ActivationLibrary.java
@@ -103,68 +103,4 @@ public class ActivationLibrary {
         } catch (NoSuchObjectException e) {
         }
     }
-
-    /** cleanup after rmid */
-    public static void rmidCleanup(RMID rmid) {
-        if (rmid != null) {
-            if (!ActivationLibrary.safeDestroy(rmid, SAFE_WAIT_TIME)) {
-                TestLibrary.bomb("rmid not destroyed in: " +
-                                 SAFE_WAIT_TIME +
-                                 " milliseconds");
-            }
-        }
-        RMID.removeLog();
-    }
-
-    /**
-     * Invoke shutdown on rmid in a way that will not cause a test
-     * to hang.
-     *
-     * @return whether or not shutdown completed succesfully in the
-     *         timeAllowed
-     */
-    private static boolean safeDestroy(RMID rmid, long timeAllowed) {
-        DestroyThread destroyThread = new DestroyThread(rmid);
-        destroyThread.start();
-
-        try {
-            destroyThread.join(timeAllowed);
-        } catch (InterruptedException ie) {
-            Thread.currentThread().interrupt();
-        }
-
-        return destroyThread.shutdownSucceeded();
-    }
-
-    /**
-     * Thread class to handle the destruction of rmid
-     */
-    private static class DestroyThread extends Thread {
-        private final RMID rmid;
-        private final int port;
-        private boolean succeeded = false;
-
-        DestroyThread(RMID rmid) {
-            this.rmid = rmid;
-            this.port = rmid.getPort();
-            this.setDaemon(true);
-        }
-
-        public void run() {
-            if (RMID.lookupSystem(port) != null) {
-                rmid.destroy();
-                synchronized (this) {
-                    // flag that the test was able to shutdown rmid
-                    succeeded = true;
-                }
-                mesg("finished destroying rmid");
-            } else {
-                mesg("tried to shutdown when rmid was not running");
-            }
-        }
-
-        public synchronized boolean shutdownSucceeded() {
-            return succeeded;
-        }
-    }
 }
diff --git a/jdk/test/java/rmi/testlibrary/RMID.java b/jdk/test/java/rmi/testlibrary/RMID.java
index bdd8c829d89..29365e8125f 100644
--- a/jdk/test/java/rmi/testlibrary/RMID.java
+++ b/jdk/test/java/rmi/testlibrary/RMID.java
@@ -21,14 +21,11 @@
  * questions.
  */
 
-/**
- *
- */
-
 import java.io.*;
 import java.rmi.*;
 import java.rmi.activation.*;
 import java.rmi.registry.*;
+import java.util.concurrent.TimeoutException;
 
 /**
  * Utility class that creates an instance of rmid with a policy
@@ -39,6 +36,14 @@ import java.rmi.registry.*;
  */
 public class RMID extends JavaVM {
 
+    // TODO: adjust these based on the timeout factor
+    // such as jcov.sleep.multiplier; see start(long) method.
+    // Also consider the test.timeout.factor property (a float).
+    private static final long TIMEOUT_SHUTDOWN_MS = 60_000L;
+    private static final long TIMEOUT_DESTROY_MS  = 10_000L;
+    private static final long STARTTIME_MS        = 15_000L;
+    private static final long POLLTIME_MS         = 100L;
+
     private static final String SYSTEM_NAME = ActivationSystem.class.getName();
         // "java.rmi.activation.ActivationSystem"
 
@@ -140,15 +145,8 @@ public class RMID extends JavaVM {
      * policy file.
      */
     public static RMID createRMID() {
-        return createRMID(System.out, System.err, true);
-    }
-
-    public static RMID createRMID(boolean debugExec) {
-        return createRMID(System.out, System.err, debugExec);
-    }
-
-    public static RMID createRMID(OutputStream out, OutputStream err) {
-        return createRMID(out, err, true);
+        return createRMID(System.out, System.err, true, true,
+                          TestLibrary.getUnusedRandomPort());
     }
 
     public static RMID createRMID(OutputStream out, OutputStream err,
@@ -173,24 +171,24 @@ public class RMID extends JavaVM {
 
 
     /**
-     * Test RMID should be created with the createRMID method.
+     * Private constructor. RMID instances should be created
+     * using the static factory methods.
      */
-    protected RMID(String classname, String options, String args,
+    private RMID(String classname, String options, String args,
                    OutputStream out, OutputStream err, int port)
     {
         super(classname, options, args, out, err);
         this.port = port;
     }
 
+    /**
+     * Removes rmid's log file directory.
+     */
     public static void removeLog() {
-        /*
-         * Remove previous log file directory before
-         * starting up rmid.
-         */
         File f = new File(LOGDIR, log);
 
         if (f.exists()) {
-            mesg("removing rmid's old log file...");
+            mesg("Removing rmid's old log file.");
             String[] files = f.list();
 
             if (files != null) {
@@ -199,8 +197,8 @@ public class RMID extends JavaVM {
                 }
             }
 
-            if (f.delete() != true) {
-                mesg("\t" + " unable to delete old log file.");
+            if (! f.delete()) {
+                mesg("Warning: unable to delete old log file.");
             }
         }
     }
@@ -215,14 +213,6 @@ public class RMID extends JavaVM {
         return TestLibrary.getExtraProperty("rmid.jcov.args","");
     }
 
-    public void start() throws IOException {
-        start(10000);
-    }
-
-    public void slowStart() throws IOException {
-        start(60000);
-    }
-
     /**
      * Looks up the activation system in the registry on the given port,
      * returning its stub, or null if it's not present. This method differs from
@@ -239,12 +229,24 @@ public class RMID extends JavaVM {
         }
     }
 
+    /**
+     * Starts rmid and waits up to the default timeout period
+     * to confirm that it's running.
+     */
+    public void start() throws IOException {
+        start(STARTTIME_MS);
+    }
+
+    /**
+     * Starts rmid and waits up to the given timeout period
+     * to confirm that it's running.
+     */
     public void start(long waitTime) throws IOException {
 
         // if rmid is already running, then the test will fail with
         // a well recognized exception (port already in use...).
 
-        mesg("starting rmid on port #" + port + "...");
+        mesg("Starting rmid on port " + port + ".");
         super.start();
 
         int slopFactor = 1;
@@ -254,20 +256,17 @@ public class RMID extends JavaVM {
         } catch (NumberFormatException ignore) {}
         waitTime = waitTime * slopFactor;
 
-        // We check several times (as many as provides passed waitTime) to
-        // see if Rmid is currently running. Waiting steps last 100 msecs.
-        final long rmidStartSleepTime = 100;
+        // We check several times, for a maximum of waitTime, until we have
+        // verified that rmid is running.
         do {
-            // Sleeping for another rmidStartSleepTime time slice.
             try {
-                Thread.sleep(Math.min(waitTime, rmidStartSleepTime));
+                Thread.sleep(Math.min(waitTime, POLLTIME_MS));
             } catch (InterruptedException ie) {
                 Thread.currentThread().interrupt();
-                mesg("Thread interrupted while checking for start of Activation System. Giving up check.");
-                mesg("Activation System state unknown");
+                mesg("Interrupted while starting activation system, giving up.");
                 return;
             }
-            waitTime -= rmidStartSleepTime;
+            waitTime -= POLLTIME_MS;
 
             // Checking if rmid is present
             if (lookupSystem(port) != null) {
@@ -279,7 +278,7 @@ public class RMID extends JavaVM {
                  * incorrect value.
                  */
                 System.setProperty("java.rmi.activation.port", Integer.toString(port));
-                mesg("finished starting rmid.");
+                mesg("Started successfully.");
                 return;
             } else {
                 if (waitTime > 0) {
@@ -287,9 +286,15 @@ public class RMID extends JavaVM {
                 }
             }
         } while (waitTime > 0);
-        TestLibrary.bomb("start rmid failed... giving up", null);
+        TestLibrary.bomb("Failed to start rmid, giving up.", null);
     }
 
+    /**
+     * Destroys rmid and restarts it. Note that this does NOT clean up
+     * the log file, because it stores information about restartable
+     * and activatable objects that must be carried over to the new
+     * rmid instance.
+     */
     public void restart() throws IOException {
         destroy();
         start();
@@ -298,30 +303,35 @@ public class RMID extends JavaVM {
     /**
      * Ask rmid to shutdown gracefully using a remote method call.
      * catch any errors that might occur from rmid not being present
-     * at time of shutdown invocation.
-     *
-     * Shutdown does not nullify possible references to the rmid
-     * process object (destroy does though).
+     * at time of shutdown invocation. If the remote call is
+     * successful, wait for the process to terminate. Return true
+     * if the process terminated, otherwise return false.
      */
-    public static void shutdown(int port) {
+    private boolean shutdown() throws InterruptedException {
+        mesg("shutdown()");
+        ActivationSystem system = lookupSystem(port);
+        if (system == null) {
+            mesg("lookupSystem() returned null");
+            return false;
+        }
 
         try {
-            ActivationSystem system = lookupSystem(port);
-
-            if (system == null) {
-                TestLibrary.bomb("reference to the activation system was null");
-            }
-
+            mesg("ActivationSystem.shutdown()");
             system.shutdown();
-        } catch (RemoteException re) {
-            mesg("shutting down the activation daemon failed");
         } catch (Exception e) {
-            mesg("caught exception trying to shutdown rmid");
-            mesg(e.getMessage());
+            mesg("Caught exception from ActivationSystem.shutdown():");
             e.printStackTrace();
         }
 
-        mesg("testlibrary finished shutting down rmid");
+        try {
+            waitFor(TIMEOUT_SHUTDOWN_MS);
+            mesg("Shutdown successful.");
+            return true;
+        } catch (TimeoutException ex) {
+            mesg("Shutdown timed out:");
+            ex.printStackTrace();
+            return false;
+        }
     }
 
     /**
@@ -330,60 +340,46 @@ public class RMID extends JavaVM {
      * if rmid is a child process of the current VM.
      */
     public void destroy() {
-        // attempt graceful shutdown of the activation system
-        shutdown(port);
-
-        if (vm != null) {
-            try {
-                /* Waiting for distant RMID process to shutdown.
-                 * Waiting is bounded at a hardcoded max of 60 secs (1 min).
-                 * Waiting by steps of 200 msecs, thus at most 300 such attempts
-                 * for termination of distant RMID process. If process is not
-                 * known to be terminated properly after that time,
-                 * we give up for a gracefull termination, and thus go for
-                 * forcibly destroying the process.
-                 */
-                boolean vmEnded = false;
-                int waitingTrials = 0;
-                final int maxTrials = 300;
-                final long vmProcessEndWaitInterval = 200;
-                int vmExitValue;
-                do {
-                    try {
-                        Thread.sleep(vmProcessEndWaitInterval);
-                        waitingTrials++;
-                        vmExitValue = vm.exitValue();
-                        mesg("rmid exited on shutdown request");
-                        vmEnded = true;
-                    } catch (IllegalThreadStateException illegal) {
-                        mesg("RMID's process still not terminated after more than " +
-                             (waitingTrials * vmProcessEndWaitInterval) + " milliseconds");
-                    }
-                }
-                while (!vmEnded &&
-                       (waitingTrials < maxTrials));
-
-                if (waitingTrials >= maxTrials) {
-                    mesg("RMID's process still not terminated after more than " +
-                         (waitingTrials * vmProcessEndWaitInterval) + " milliseconds." +
-                         "Givinp up gracefull termination...");
-                    mesg("destroying RMID's process using Process.destroy()");
-                    super.destroy();
-                }
-
-            } catch (InterruptedException ie) {
-                Thread.currentThread().interrupt();
-                mesg("Thread interrupted while checking for termination of distant rmid vm. Giving up check.");
-            } catch (Exception e) {
-                mesg("caught unexpected exception trying to destroy rmid: " +
-                     e.getMessage());
-                e.printStackTrace();
-            }
-
-            // rmid will not restart if its process is not null
-            vm = null;
+        if (vm == null) {
+            throw new IllegalStateException("can't wait for RMID that isn't running");
         }
+
+        // First, attempt graceful shutdown of the activation system.
+        try {
+            if (! shutdown()) {
+                // Graceful shutdown failed, use Process.destroy().
+                mesg("Destroying RMID process.");
+                vm.destroy();
+                try {
+                    waitFor(TIMEOUT_DESTROY_MS);
+                    mesg("Destroy successful.");
+                } catch (TimeoutException ex) {
+                    mesg("Destroy timed out, giving up.");
+                    ex.printStackTrace();
+                }
+            }
+        } catch (InterruptedException ie) {
+            mesg("Shutdown/destroy interrupted, giving up.");
+            ie.printStackTrace();
+            Thread.currentThread().interrupt();
+            return;
+        }
+
+        vm = null;
     }
 
-    public int getPort() {return port;}
+    /**
+     * Shuts down rmid and then removes its log file.
+     */
+    public void cleanup() {
+        destroy();
+        RMID.removeLog();
+    }
+
+    /**
+     * Gets the port on which this rmid is listening.
+     */
+    public int getPort() {
+        return port;
+    }
 }

From 3a9c14c70aa8ed006e1d7c5ed84aee6196e02459 Mon Sep 17 00:00:00 2001
From: Igor Ignatyev <iignatyev@openjdk.org>
Date: Tue, 2 Dec 2014 12:36:03 +0300
Subject: [PATCH 198/299] 8064669:
 compiler/whitebox/AllocationCodeBlobTest.java crashes / asserts

Reviewed-by: kvn, anoll
---
 hotspot/src/share/vm/prims/whitebox.cpp       | 48 +++++++--
 hotspot/src/share/vm/prims/whitebox.hpp       |  5 +-
 hotspot/src/share/vm/runtime/sweeper.cpp      | 93 +++++++++++-------
 hotspot/src/share/vm/runtime/sweeper.hpp      | 15 ++-
 hotspot/src/share/vm/runtime/thread.cpp       |  8 +-
 hotspot/src/share/vm/runtime/thread.hpp       |  3 +-
 .../whitebox/AllocationCodeBlobTest.java      | 46 ++++-----
 .../whitebox/ForceNMethodSweepTest.java       | 97 +++++++++++++++++++
 .../oracle/java/testlibrary/InfiniteLoop.java | 64 ++++++++++++
 .../whitebox/sun/hotspot/WhiteBox.java        |  9 +-
 10 files changed, 308 insertions(+), 80 deletions(-)
 create mode 100644 hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java
 create mode 100644 hotspot/test/testlibrary/com/oracle/java/testlibrary/InfiniteLoop.java

diff --git a/hotspot/src/share/vm/prims/whitebox.cpp b/hotspot/src/share/vm/prims/whitebox.cpp
index 43a4c63779e..3714d3bc562 100644
--- a/hotspot/src/share/vm/prims/whitebox.cpp
+++ b/hotspot/src/share/vm/prims/whitebox.cpp
@@ -41,6 +41,7 @@
 #include "runtime/interfaceSupport.hpp"
 #include "runtime/os.hpp"
 #include "runtime/sweeper.hpp"
+#include "runtime/javaCalls.hpp"
 #include "runtime/thread.hpp"
 #include "runtime/vm_version.hpp"
 #include "utilities/array.hpp"
@@ -759,8 +760,8 @@ WB_ENTRY(void, WB_UnlockCompilation(JNIEnv* env, jobject o))
   mo.notify_all();
 WB_END
 
-void WhiteBox::force_sweep() {
-  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled");
+void WhiteBox::sweeper_thread_entry(JavaThread* thread, TRAPS) {
+  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to be enabled");
   {
     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     NMethodSweeper::_should_sweep = true;
@@ -768,8 +769,37 @@ void WhiteBox::force_sweep() {
   NMethodSweeper::possibly_sweep();
 }
 
-WB_ENTRY(void, WB_ForceNMethodSweep(JNIEnv* env, jobject o))
-  WhiteBox::force_sweep();
+JavaThread* WhiteBox::create_sweeper_thread(TRAPS) {
+  // create sweeper thread w/ custom entry -- one iteration instead of loop
+  CodeCacheSweeperThread* sweeper_thread = new CodeCacheSweeperThread();
+  sweeper_thread->set_entry_point(&WhiteBox::sweeper_thread_entry);
+
+  // create j.l.Thread object and associate it w/ sweeper thread
+  {
+    // inherit deamon property from current thread
+    bool is_daemon = java_lang_Thread::is_daemon(JavaThread::current()->threadObj());
+
+    HandleMark hm(THREAD);
+    Handle thread_group(THREAD, Universe::system_thread_group());
+    const char* name = "WB Sweeper thread";
+    sweeper_thread->allocate_threadObj(thread_group, name, is_daemon, THREAD);
+  }
+
+  {
+    MutexLocker mu(Threads_lock, THREAD);
+    Threads::add(sweeper_thread);
+  }
+  return sweeper_thread;
+}
+
+WB_ENTRY(jobject, WB_ForceNMethodSweep(JNIEnv* env, jobject o))
+  JavaThread* sweeper_thread = WhiteBox::create_sweeper_thread(Thread::current());
+  if (sweeper_thread == NULL) {
+    return NULL;
+  }
+  jobject result = JNIHandles::make_local(env, sweeper_thread->threadObj());
+  Thread::start(sweeper_thread);
+  return result;
 WB_END
 
 WB_ENTRY(jboolean, WB_IsInStringTable(JNIEnv* env, jobject o, jstring javaString))
@@ -819,12 +849,12 @@ WB_ENTRY(jstring, WB_GetCPUFeatures(JNIEnv* env, jobject o))
 WB_END
 
 int WhiteBox::get_blob_type(const CodeBlob* code) {
-  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled");
+  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to be enabled");
   return CodeCache::get_code_heap(code)->code_blob_type();
 }
 
 CodeHeap* WhiteBox::get_code_heap(int blob_type) {
-  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled");
+  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to be enabled");
   return CodeCache::get_code_heap(blob_type);
 }
 
@@ -900,7 +930,7 @@ WB_ENTRY(jobjectArray, WB_GetNMethod(JNIEnv* env, jobject o, jobject method, jbo
 WB_END
 
 CodeBlob* WhiteBox::allocate_code_blob(int size, int blob_type) {
-  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to enabled");
+  guarantee(WhiteBoxAPI, "internal testing API :: WhiteBox has to be enabled");
   BufferBlob* blob;
   int full_size = CodeBlob::align_code_offset(sizeof(BufferBlob));
   if (full_size < size) {
@@ -909,10 +939,10 @@ CodeBlob* WhiteBox::allocate_code_blob(int size, int blob_type) {
   {
     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
     blob = (BufferBlob*) CodeCache::allocate(full_size, blob_type);
+    ::new (blob) BufferBlob("WB::DummyBlob", full_size);
   }
   // Track memory usage statistic after releasing CodeCache_lock
   MemoryService::track_code_cache_memory_usage();
-  ::new (blob) BufferBlob("WB::DummyBlob", full_size);
   return blob;
 }
 
@@ -1221,7 +1251,7 @@ static JNINativeMethod methods[] = {
   {CC"getCPUFeatures",     CC"()Ljava/lang/String;",  (void*)&WB_GetCPUFeatures     },
   {CC"getNMethod",         CC"(Ljava/lang/reflect/Executable;Z)[Ljava/lang/Object;",
                                                       (void*)&WB_GetNMethod         },
-  {CC"forceNMethodSweep",  CC"()V",                   (void*)&WB_ForceNMethodSweep  },
+  {CC"forceNMethodSweep0", CC"()Ljava/lang/Thread;",  (void*)&WB_ForceNMethodSweep  },
   {CC"allocateCodeBlob",   CC"(II)J",                 (void*)&WB_AllocateCodeBlob   },
   {CC"freeCodeBlob",       CC"(J)V",                  (void*)&WB_FreeCodeBlob       },
   {CC"getCodeHeapEntries", CC"(I)[Ljava/lang/Object;",(void*)&WB_GetCodeHeapEntries },
diff --git a/hotspot/src/share/vm/prims/whitebox.hpp b/hotspot/src/share/vm/prims/whitebox.hpp
index 6325eef1568..4ead33f7fec 100644
--- a/hotspot/src/share/vm/prims/whitebox.hpp
+++ b/hotspot/src/share/vm/prims/whitebox.hpp
@@ -27,6 +27,7 @@
 
 #include "prims/jni.h"
 
+#include "utilities/exceptions.hpp"
 #include "memory/allocation.hpp"
 #include "oops/oopsHierarchy.hpp"
 #include "oops/symbol.hpp"
@@ -56,6 +57,7 @@
 
 class CodeBlob;
 class CodeHeap;
+class JavaThread;
 
 class WhiteBox : public AllStatic {
  private:
@@ -68,7 +70,8 @@ class WhiteBox : public AllStatic {
     Symbol* signature_symbol);
   static const char* lookup_jstring(const char* field_name, oop object);
   static bool lookup_bool(const char* field_name, oop object);
-  static void force_sweep();
+  static void sweeper_thread_entry(JavaThread* thread, TRAPS);
+  static JavaThread* create_sweeper_thread(TRAPS);
   static int get_blob_type(const CodeBlob* code);
   static CodeHeap* get_code_heap(int blob_type);
   static CodeBlob* allocate_code_blob(int blob_type, int size);
diff --git a/hotspot/src/share/vm/runtime/sweeper.cpp b/hotspot/src/share/vm/runtime/sweeper.cpp
index 1f70b6edc20..72d7868f727 100644
--- a/hotspot/src/share/vm/runtime/sweeper.cpp
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp
@@ -142,9 +142,6 @@ long     NMethodSweeper::_total_nof_code_cache_sweeps  = 0;    // Total number o
 long     NMethodSweeper::_time_counter                 = 0;    // Virtual time used to periodically invoke sweeper
 long     NMethodSweeper::_last_sweep                   = 0;    // Value of _time_counter when the last sweep happened
 int      NMethodSweeper::_seen                         = 0;    // Nof. nmethod we have currently processed in current pass of CodeCache
-int      NMethodSweeper::_flushed_count                = 0;    // Nof. nmethods flushed in current sweep
-int      NMethodSweeper::_zombified_count              = 0;    // Nof. nmethods made zombie in current sweep
-int      NMethodSweeper::_marked_for_reclamation_count = 0;    // Nof. nmethods marked for reclaim in current sweep
 
 volatile bool NMethodSweeper::_should_sweep            = true; // Indicates if we should invoke the sweeper
 volatile int  NMethodSweeper::_bytes_changed           = 0;    // Counts the total nmethod size if the nmethod changed from:
@@ -161,6 +158,7 @@ Tickspan NMethodSweeper::_total_time_this_sweep;               // Total time thi
 Tickspan NMethodSweeper::_peak_sweep_time;                     // Peak time for a full sweep
 Tickspan NMethodSweeper::_peak_sweep_fraction_time;            // Peak time sweeping one fraction
 
+Monitor* NMethodSweeper::_stat_lock = new Monitor(Mutex::special, "Sweeper::Statistics", true);
 
 class MarkActivationClosure: public CodeBlobClosure {
 public:
@@ -370,9 +368,10 @@ void NMethodSweeper::sweep_code_cache() {
   ResourceMark rm;
   Ticks sweep_start_counter = Ticks::now();
 
-  _flushed_count                = 0;
-  _zombified_count              = 0;
-  _marked_for_reclamation_count = 0;
+  int flushed_count                = 0;
+  int zombified_count              = 0;
+  int marked_for_reclamation_count = 0;
+  int flushed_c2_count     = 0;
 
   if (PrintMethodFlushing && Verbose) {
     tty->print_cr("### Sweep at %d out of %d", _seen, CodeCache::nof_nmethods());
@@ -386,10 +385,8 @@ void NMethodSweeper::sweep_code_cache() {
   {
     MutexLockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
 
-    // The last invocation iterates until there are no more nmethods
     while (!_current.end()) {
       swept_count++;
-      handle_safepoint_request();
       // Since we will give up the CodeCache_lock, always skip ahead
       // to the next nmethod.  Other blobs can be deleted by other
       // threads but nmethods are only reclaimed by the sweeper.
@@ -399,9 +396,32 @@ void NMethodSweeper::sweep_code_cache() {
       // Now ready to process nmethod and give up CodeCache_lock
       {
         MutexUnlockerEx mu(CodeCache_lock, Mutex::_no_safepoint_check_flag);
-        freed_memory += process_nmethod(nm);
+        int size = nm->total_size();
+        bool is_c2_method = nm->is_compiled_by_c2();
+
+        MethodStateChange type = process_nmethod(nm);
+        switch (type) {
+          case Flushed:
+            freed_memory += size;
+            ++flushed_count;
+            if (is_c2_method) {
+              ++flushed_c2_count;
+            }
+            break;
+          case MarkedForReclamation:
+            ++marked_for_reclamation_count;
+            break;
+          case MadeZombie:
+            ++zombified_count;
+            break;
+          case None:
+            break;
+          default:
+           ShouldNotReachHere();
+        }
       }
       _seen++;
+      handle_safepoint_request();
     }
   }
 
@@ -409,21 +429,25 @@ void NMethodSweeper::sweep_code_cache() {
 
   const Ticks sweep_end_counter = Ticks::now();
   const Tickspan sweep_time = sweep_end_counter - sweep_start_counter;
-  _total_time_sweeping  += sweep_time;
-  _total_time_this_sweep += sweep_time;
-  _peak_sweep_fraction_time = MAX2(sweep_time, _peak_sweep_fraction_time);
-  _total_flushed_size += freed_memory;
-  _total_nof_methods_reclaimed += _flushed_count;
-
+  {
+    MutexLockerEx mu(_stat_lock, Mutex::_no_safepoint_check_flag);
+    _total_time_sweeping  += sweep_time;
+    _total_time_this_sweep += sweep_time;
+    _peak_sweep_fraction_time = MAX2(sweep_time, _peak_sweep_fraction_time);
+    _total_flushed_size += freed_memory;
+    _total_nof_methods_reclaimed += flushed_count;
+    _total_nof_c2_methods_reclaimed += flushed_c2_count;
+    _peak_sweep_time = MAX2(_peak_sweep_time, _total_time_this_sweep);
+  }
   EventSweepCodeCache event(UNTIMED);
   if (event.should_commit()) {
     event.set_starttime(sweep_start_counter);
     event.set_endtime(sweep_end_counter);
     event.set_sweepIndex(_traversals);
     event.set_sweptCount(swept_count);
-    event.set_flushedCount(_flushed_count);
-    event.set_markedCount(_marked_for_reclamation_count);
-    event.set_zombifiedCount(_zombified_count);
+    event.set_flushedCount(flushed_count);
+    event.set_markedCount(marked_for_reclamation_count);
+    event.set_zombifiedCount(zombified_count);
     event.commit();
   }
 
@@ -433,7 +457,6 @@ void NMethodSweeper::sweep_code_cache() {
   }
 #endif
 
-  _peak_sweep_time = MAX2(_peak_sweep_time, _total_time_this_sweep);
   log_sweep("finished");
 
   // Sweeper is the only case where memory is released, check here if it
@@ -511,10 +534,11 @@ void NMethodSweeper::release_nmethod(nmethod* nm) {
   nm->flush();
 }
 
-int NMethodSweeper::process_nmethod(nmethod* nm) {
+NMethodSweeper::MethodStateChange NMethodSweeper::process_nmethod(nmethod* nm) {
+  assert(nm != NULL, "sanity");
   assert(!CodeCache_lock->owned_by_self(), "just checking");
 
-  int freed_memory = 0;
+  MethodStateChange result = None;
   // Make sure this nmethod doesn't get unloaded during the scan,
   // since safepoints may happen during acquired below locks.
   NMethodMarker nmm(nm);
@@ -529,7 +553,7 @@ int NMethodSweeper::process_nmethod(nmethod* nm) {
       nm->cleanup_inline_caches();
       SWEEP(nm);
     }
-    return freed_memory;
+    return result;
   }
 
   if (nm->is_zombie()) {
@@ -541,12 +565,9 @@ int NMethodSweeper::process_nmethod(nmethod* nm) {
       if (PrintMethodFlushing && Verbose) {
         tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (marked for reclamation) being flushed", nm->compile_id(), nm);
       }
-      freed_memory = nm->total_size();
-      if (nm->is_compiled_by_c2()) {
-        _total_nof_c2_methods_reclaimed++;
-      }
       release_nmethod(nm);
-      _flushed_count++;
+      assert(result == None, "sanity");
+      result = Flushed;
     } else {
       if (PrintMethodFlushing && Verbose) {
         tty->print_cr("### Nmethod %3d/" PTR_FORMAT " (zombie) being marked for reclamation", nm->compile_id(), nm);
@@ -554,8 +575,9 @@ int NMethodSweeper::process_nmethod(nmethod* nm) {
       nm->mark_for_reclamation();
       // Keep track of code cache state change
       _bytes_changed += nm->total_size();
-      _marked_for_reclamation_count++;
       SWEEP(nm);
+      assert(result == None, "sanity");
+      result = MarkedForReclamation;
     }
   } else if (nm->is_not_entrant()) {
     // If there are no current activations of this method on the
@@ -576,8 +598,9 @@ int NMethodSweeper::process_nmethod(nmethod* nm) {
         }
         // Code cache state change is tracked in make_zombie()
         nm->make_zombie();
-        _zombified_count++;
         SWEEP(nm);
+        assert(result == None, "sanity");
+        result = MadeZombie;
       }
       assert(nm->is_zombie(), "nmethod must be zombie");
     } else {
@@ -594,17 +617,15 @@ int NMethodSweeper::process_nmethod(nmethod* nm) {
     if (nm->is_osr_method()) {
       SWEEP(nm);
       // No inline caches will ever point to osr methods, so we can just remove it
-      freed_memory = nm->total_size();
-      if (nm->is_compiled_by_c2()) {
-        _total_nof_c2_methods_reclaimed++;
-      }
       release_nmethod(nm);
-      _flushed_count++;
+      assert(result == None, "sanity");
+      result = Flushed;
     } else {
       // Code cache state change is tracked in make_zombie()
       nm->make_zombie();
-      _zombified_count++;
       SWEEP(nm);
+      assert(result == None, "sanity");
+      result = MadeZombie;
     }
   } else {
     possibly_flush(nm);
@@ -613,7 +634,7 @@ int NMethodSweeper::process_nmethod(nmethod* nm) {
     nm->cleanup_inline_caches();
     SWEEP(nm);
   }
-  return freed_memory;
+  return result;
 }
 
 
diff --git a/hotspot/src/share/vm/runtime/sweeper.hpp b/hotspot/src/share/vm/runtime/sweeper.hpp
index e66c96adb23..f0ce1e93e27 100644
--- a/hotspot/src/share/vm/runtime/sweeper.hpp
+++ b/hotspot/src/share/vm/runtime/sweeper.hpp
@@ -56,15 +56,18 @@ class WhiteBox;
 class NMethodSweeper : public AllStatic {
   friend class WhiteBox;
  private:
+  enum MethodStateChange {
+    None,
+    MadeZombie,
+    MarkedForReclamation,
+    Flushed
+  };
   static long      _traversals;                   // Stack scan count, also sweep ID.
   static long      _total_nof_code_cache_sweeps;  // Total number of full sweeps of the code cache
   static long      _time_counter;                 // Virtual time used to periodically invoke sweeper
   static long      _last_sweep;                   // Value of _time_counter when the last sweep happened
   static NMethodIterator _current;                // Current nmethod
   static int       _seen;                         // Nof. nmethod we have currently processed in current pass of CodeCache
-  static int       _flushed_count;                // Nof. nmethods flushed in current sweep
-  static int       _zombified_count;              // Nof. nmethods made zombie in current sweep
-  static int       _marked_for_reclamation_count; // Nof. nmethods marked for reclaim in current sweep
 
   static volatile int  _sweep_started;            // Flag to control conc sweeper
   static volatile bool _should_sweep;             // Indicates if we should invoke the sweeper
@@ -83,8 +86,10 @@ class NMethodSweeper : public AllStatic {
   static Tickspan  _peak_sweep_time;              // Peak time for a full sweep
   static Tickspan  _peak_sweep_fraction_time;     // Peak time sweeping one fraction
 
-  static int  process_nmethod(nmethod *nm);
-  static void release_nmethod(nmethod* nm);
+  static Monitor*  _stat_lock;
+
+  static MethodStateChange process_nmethod(nmethod *nm);
+  static void              release_nmethod(nmethod* nm);
 
   static void init_sweeper_log() NOT_DEBUG_RETURN;
   static bool wait_for_stack_scanning();
diff --git a/hotspot/src/share/vm/runtime/thread.cpp b/hotspot/src/share/vm/runtime/thread.cpp
index fde9bab9642..10f00cd6429 100644
--- a/hotspot/src/share/vm/runtime/thread.cpp
+++ b/hotspot/src/share/vm/runtime/thread.cpp
@@ -1076,7 +1076,7 @@ static void reset_vm_info_property(TRAPS) {
 }
 
 
-void JavaThread::allocate_threadObj(Handle thread_group, char* thread_name,
+void JavaThread::allocate_threadObj(Handle thread_group, const char* thread_name,
                                     bool daemon, TRAPS) {
   assert(thread_group.not_null(), "thread group should be specified");
   assert(threadObj() == NULL, "should only create Java thread object once");
@@ -1123,8 +1123,8 @@ void JavaThread::allocate_threadObj(Handle thread_group, char* thread_name,
     return;
   }
 
-  KlassHandle group(this, SystemDictionary::ThreadGroup_klass());
-  Handle threadObj(this, this->threadObj());
+  KlassHandle group(THREAD, SystemDictionary::ThreadGroup_klass());
+  Handle threadObj(THREAD, this->threadObj());
 
   JavaCalls::call_special(&result,
                           thread_group,
@@ -1133,8 +1133,6 @@ void JavaThread::allocate_threadObj(Handle thread_group, char* thread_name,
                           vmSymbols::thread_void_signature(),
                           threadObj,          // Arg 1
                           THREAD);
-
-
 }
 
 // NamedThread --  non-JavaThread subclasses with multiple
diff --git a/hotspot/src/share/vm/runtime/thread.hpp b/hotspot/src/share/vm/runtime/thread.hpp
index 67043b9d245..44e10aae90b 100644
--- a/hotspot/src/share/vm/runtime/thread.hpp
+++ b/hotspot/src/share/vm/runtime/thread.hpp
@@ -749,6 +749,7 @@ typedef void (*ThreadFunction)(JavaThread*, TRAPS);
 
 class JavaThread: public Thread {
   friend class VMStructs;
+  friend class WhiteBox;
  private:
   JavaThread*    _next;                          // The next thread in the Threads list
   oop            _threadObj;                     // The Java level thread object
@@ -1000,7 +1001,7 @@ class JavaThread: public Thread {
   ThreadFunction entry_point() const             { return _entry_point; }
 
   // Allocates a new Java level thread object for this thread. thread_name may be NULL.
-  void allocate_threadObj(Handle thread_group, char* thread_name, bool daemon, TRAPS);
+  void allocate_threadObj(Handle thread_group, const char* thread_name, bool daemon, TRAPS);
 
   // Last frame anchor routines
 
diff --git a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
index 3738b35b375..a8648e7a3e5 100644
--- a/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
+++ b/hotspot/test/compiler/whitebox/AllocationCodeBlobTest.java
@@ -29,10 +29,11 @@ import java.util.ArrayList;
 import sun.hotspot.WhiteBox;
 import sun.hotspot.code.BlobType;
 import com.oracle.java.testlibrary.Asserts;
+import com.oracle.java.testlibrary.InfiniteLoop;
 
 /*
  * @test AllocationCodeBlobTest
- * @bug 8059624
+ * @bug 8059624 8064669
  * @library /testlibrary /testlibrary/whitebox
  * @build AllocationCodeBlobTest
  * @run main ClassFileInstaller sun.hotspot.WhiteBox
@@ -53,11 +54,32 @@ public class AllocationCodeBlobTest {
 
     public static void main(String[] args) {
         // check that Sweeper handels dummy blobs correctly
-        new ForcedSweeper(500).start();
+        Thread t = new Thread(
+                new InfiniteLoop(WHITE_BOX::forceNMethodSweep, 1L),
+                "ForcedSweeper");
+        t.setDaemon(true);
+        System.out.println("Starting " + t.getName());
+        t.start();
+
         EnumSet<BlobType> blobTypes = BlobType.getAvailable();
         for (BlobType type : blobTypes) {
             new AllocationCodeBlobTest(type).test();
         }
+
+        // check that deoptimization works well w/ dummy blobs
+        t = new Thread(
+                new InfiniteLoop(WHITE_BOX::deoptimizeAll, 1L),
+                "Deoptimize Thread");
+        t.setDaemon(true);
+        System.out.println("Starting " + t.getName());
+        t.start();
+
+        for (int i = 0; i < 10_000; ++i) {
+            for (BlobType type : blobTypes) {
+                long addr = WHITE_BOX.allocateCodeBlob(SIZE, type.id);
+            }
+        }
+
     }
 
     private final BlobType type;
@@ -105,24 +127,4 @@ public class AllocationCodeBlobTest {
     private long getUsage() {
         return bean.getUsage().getUsed();
     }
-
-    private static class ForcedSweeper extends Thread {
-        private final int millis;
-        public ForcedSweeper(int millis) {
-            super("ForcedSweeper");
-            setDaemon(true);
-            this.millis = millis;
-        }
-        public void run() {
-            try {
-                while (true) {
-                    WHITE_BOX.forceNMethodSweep();
-                    Thread.sleep(millis);
-                }
-            } catch (InterruptedException e) {
-                Thread.currentThread().interrupt();
-                throw new Error(e);
-            }
-        }
-    }
 }
diff --git a/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java
new file mode 100644
index 00000000000..9617465ca5b
--- /dev/null
+++ b/hotspot/test/compiler/whitebox/ForceNMethodSweepTest.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2014, 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.lang.reflect.Method;
+import java.util.EnumSet;
+
+import sun.hotspot.WhiteBox;
+import sun.hotspot.code.BlobType;
+
+import com.oracle.java.testlibrary.Asserts;
+import com.oracle.java.testlibrary.InfiniteLoop;
+
+/*
+ * @test
+ * @bug 8059624 8064669
+ * @library /testlibrary /testlibrary/whitebox
+ * @build ForceNMethodSweepTest
+ * @run main ClassFileInstaller sun.hotspot.WhiteBox
+ *                              sun.hotspot.WhiteBox$WhiteBoxPermission
+ * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions
+ *                   -XX:-TieredCompilation -XX:+WhiteBoxAPI
+ *                   -XX:CompileCommand=compileonly,SimpleTestCase$Helper::*
+ *                   ForceNMethodSweepTest
+ * @summary testing of WB::forceNMethodSweep
+ */
+public class ForceNMethodSweepTest extends CompilerWhiteBoxTest {
+    public static void main(String[] args) throws Exception {
+        CompilerWhiteBoxTest.main(ForceNMethodSweepTest::new, args);
+    }
+    private final EnumSet<BlobType> blobTypes;
+    private ForceNMethodSweepTest(TestCase testCase) {
+        super(testCase);
+        // to prevent inlining of #method
+        WHITE_BOX.testSetDontInlineMethod(method, true);
+        blobTypes = BlobType.getAvailable();
+    }
+
+    @Override
+    protected void test() throws Exception {
+        checkNotCompiled();
+        guaranteedSweep();
+        int usage = getTotalUsage();
+
+        compile();
+        checkCompiled();
+        int afterCompilation = getTotalUsage();
+        Asserts.assertGT(afterCompilation, usage,
+                "compilation should increase usage");
+
+        guaranteedSweep();
+        int afterSweep = getTotalUsage();
+        Asserts.assertLTE(afterSweep, afterCompilation,
+                "sweep shouldn't increase usage");
+
+        deoptimize();
+        guaranteedSweep();
+        int afterDeoptAndSweep = getTotalUsage();
+        Asserts.assertLT(afterDeoptAndSweep, afterSweep,
+                "sweep after deoptimization should decrease usage");
+     }
+
+    private int getTotalUsage() {
+        int usage = 0;
+        for (BlobType type : blobTypes) {
+           usage += type.getMemoryPool().getUsage().getUsed();
+        }
+        return usage;
+    }
+    private void guaranteedSweep() {
+        // not entrant -> ++stack_traversal_mark -> zombie -> reclamation -> flushed
+        for (int i = 0; i < 5; ++i) {
+            WHITE_BOX.fullGC();
+            WHITE_BOX.forceNMethodSweep();
+        }
+    }
+}
diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/InfiniteLoop.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/InfiniteLoop.java
new file mode 100644
index 00000000000..9c52dcaa12f
--- /dev/null
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/InfiniteLoop.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package com.oracle.java.testlibrary;
+
+import java.util.Objects;
+
+/**
+ * Class which runs another Runnable in infinite loop with certain pauses
+ * between cycles.
+ */
+public class InfiniteLoop implements Runnable {
+    private final Runnable target;
+    private final long mills;
+
+
+    /**
+     * @param target a target to run in a loop
+     * @param mills  the length of pause time in milliseconds
+     * @throws NullPointerException if target is null
+     * @throws IllegalArgumentException if the value of millis is negative
+     */
+    public InfiniteLoop(Runnable target, long mills) {
+        Objects.requireNonNull(target);
+        if (mills < 0) {
+            throw new IllegalArgumentException("mills < 0");
+        }
+        this.target = target;
+        this.mills = mills;
+    }
+
+    @Override
+    public void run() {
+        try {
+            while (true) {
+                target.run();
+                Thread.sleep(mills);
+            }
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            throw new Error(e);
+        }
+    }
+}
diff --git a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
index b84a439f918..d61c09c8274 100644
--- a/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
+++ b/hotspot/test/testlibrary/whitebox/sun/hotspot/WhiteBox.java
@@ -153,7 +153,14 @@ public class WhiteBox {
   public native Object[] getNMethod(Executable method, boolean isOsr);
   public native long    allocateCodeBlob(int size, int type);
   public native void    freeCodeBlob(long addr);
-  public native void    forceNMethodSweep();
+  public        void    forceNMethodSweep() {
+    try {
+        forceNMethodSweep0().join();
+    } catch (InterruptedException e) {
+        Thread.currentThread().interrupt();
+    }
+  }
+  public native Thread  forceNMethodSweep0();
   public native Object[] getCodeHeapEntries(int type);
   public native int     getCompilationActivityMode();
   public native Object[] getCodeBlob(long addr);

From fd0dba3fc72a61394f2f011db653c9165da6b289 Mon Sep 17 00:00:00 2001
From: Igor Ignatyev <iignatyev@openjdk.org>
Date: Tue, 2 Dec 2014 12:37:01 +0300
Subject: [PATCH 199/299] 8066290: Port JDK-8066191 into hotspot

Reviewed-by: kvn
---
 .../java/testlibrary/TimeLimitedRunner.java   | 86 +++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100644 hotspot/test/testlibrary/com/oracle/java/testlibrary/TimeLimitedRunner.java

diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/TimeLimitedRunner.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/TimeLimitedRunner.java
new file mode 100644
index 00000000000..daf36dd797f
--- /dev/null
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/TimeLimitedRunner.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package com.oracle.java.testlibrary;
+
+import java.util.Objects;
+import java.util.concurrent.Callable;
+
+/**
+ * Auxiliary class to run target w/ given timeout.
+ */
+public class TimeLimitedRunner implements Callable<Void> {
+    private final long              stoptime;
+    private final long              timeout;
+    private final double            factor;
+    private final Callable<Boolean> target;
+
+    /**
+     * @param timeout   a timeout. zero means no time limitation
+     * @param factor    a multiplier used to estimate next iteration time
+     * @param target    a target to run
+     * @throws NullPointerException     if target is null
+     * @throws IllegalArgumentException if timeout is negative or
+                                        factor isn't positive
+     */
+    public TimeLimitedRunner(long timeout, double factor,
+            Callable<Boolean> target) {
+        Objects.requireNonNull(target, "target must not be null");
+        if (timeout < 0) {
+            throw new IllegalArgumentException("timeout[" + timeout + "] < 0");
+        }
+        if (factor <= 0d) {
+            throw new IllegalArgumentException("factor[" + factor + "] <= 0");
+        }
+        this.stoptime = System.currentTimeMillis() + timeout;
+        this.timeout = timeout;
+        this.factor = factor;
+        this.target = target;
+    }
+
+    /**
+     * Runs @{linkplan target} while it returns true and timeout isn't exceeded
+     */
+    @Override
+    public Void call() throws Exception {
+        long maxDuration = 0L;
+        long iterStart = System.currentTimeMillis();
+        if (timeout != 0 && iterStart > stoptime) {
+            return null;
+        }
+        while (target.call()) {
+            if (timeout != 0) {
+                long iterDuration = System.currentTimeMillis() - iterStart;
+                maxDuration = Math.max(maxDuration, iterDuration);
+                iterStart = System.currentTimeMillis();
+                if (iterStart + (maxDuration * factor) > stoptime) {
+                    System.out.println("Not enough time to continue execution. "
+                            + "Interrupted.");
+                    break;
+                }
+            }
+        }
+        return null;
+    }
+
+}

From 77c37e1eb76e39d677d3a389deb8c294e4ea813f Mon Sep 17 00:00:00 2001
From: Miroslav Kos <mkos@openjdk.org>
Date: Tue, 2 Dec 2014 15:03:49 +0100
Subject: [PATCH 200/299] 8065870: Update JAX-WS RI integration to latest
 version (2.2.11-b141124.1933)

Reviewed-by: smarks
---
 .../v2/runtime/ContentHandlerAdaptor.java     |   9 +-
 .../unmarshaller/StAXStreamConnector.java     |  12 +-
 .../message/BaseDistributedPropertySet.java   |   4 +-
 .../ws/api/model/CheckedException.java        |  10 +-
 .../xml/internal/ws/api/model/JavaMethod.java |  10 +-
 .../api/streaming/XMLStreamReaderFactory.java |  14 ++
 .../internal/ws/fault/SOAPFaultBuilder.java   |   6 +-
 .../ws/model/AbstractSEIModelImpl.java        |   6 +-
 .../ws/model/CheckedExceptionImpl.java        |  11 +-
 .../xml/internal/ws/model/ParameterImpl.java  |  11 +-
 .../xml/internal/ws/model/RuntimeModeler.java |  22 +-
 .../db/ServiceArtifactSchemaGenerator.java    | 226 ++++++++++++++++++
 .../sun/xml/internal/ws/spi/db/TypeInfo.java  |  13 +-
 .../pipe/AbstractSchemaValidationTube.java    |   6 +-
 .../ws/util/resources/Messages_en.properties  |   4 +-
 .../xml/internal/ws/util/version.properties   |   6 +-
 .../ws/wsdl/writer/WSDLGenerator.java         |  95 +-------
 .../sun/codemodel/internal/JAnnotatable.java  |  10 +-
 .../internal/JAnnotationArrayMember.java      |   7 +-
 .../sun/codemodel/internal/JDefinedClass.java |   4 +
 .../sun/codemodel/internal/JEnumConstant.java |   5 +-
 .../com/sun/codemodel/internal/JMethod.java   |   6 +-
 .../com/sun/codemodel/internal/JPackage.java  |   6 +-
 .../com/sun/codemodel/internal/JVar.java      |   6 +-
 .../internal/util/JavadocEscapeWriter.java    |   5 +-
 .../internal/jxc/MessageBundle.properties     |   4 +-
 .../internal/jxc/MessageBundle_de.properties  |   4 +-
 .../internal/jxc/MessageBundle_es.properties  |   4 +-
 .../internal/jxc/MessageBundle_fr.properties  |   4 +-
 .../internal/jxc/MessageBundle_it.properties  |   4 +-
 .../internal/jxc/MessageBundle_ja.properties  |   4 +-
 .../internal/jxc/MessageBundle_ko.properties  |   4 +-
 .../jxc/MessageBundle_pt_BR.properties        |   4 +-
 .../jxc/MessageBundle_zh_CN.properties        |   4 +-
 .../jxc/MessageBundle_zh_TW.properties        |   4 +-
 .../tools/internal/jxc/SchemaGenerator.java   |  16 +-
 .../sun/tools/internal/jxc/ap/Options.java    |  17 +-
 .../internal/xjc/MessageBundle.properties     |  10 +-
 .../internal/xjc/MessageBundle_de.properties  |  10 +-
 .../internal/xjc/MessageBundle_es.properties  |  10 +-
 .../internal/xjc/MessageBundle_fr.properties  |  10 +-
 .../internal/xjc/MessageBundle_it.properties  |  10 +-
 .../internal/xjc/MessageBundle_ja.properties  |  10 +-
 .../internal/xjc/MessageBundle_ko.properties  |  10 +-
 .../xjc/MessageBundle_pt_BR.properties        |  10 +-
 .../xjc/MessageBundle_zh_CN.properties        |  10 +-
 .../xjc/MessageBundle_zh_TW.properties        |  10 +-
 .../xjc/addon/episode/PluginImpl.java         |  50 ++--
 .../xjc/api/impl/s2j/ElementAdapter.java      |   6 +-
 .../impl/s2j/ElementCollectionAdapter.java    |   4 +-
 .../api/impl/s2j/ElementSingleAdapter.java    |   7 +-
 .../api/impl/s2j/TypeAndAnnotationImpl.java   |   4 +-
 .../xjc/generator/bean/BeanGenerator.java     |   6 +-
 .../generator/bean/ElementOutlineImpl.java    |   4 +-
 .../generator/bean/ImplStructureStrategy.java |   4 +-
 .../generator/bean/MessageBundle.properties   |   4 +-
 .../bean/ObjectFactoryGeneratorImpl.java      |   4 +-
 .../generator/bean/PackageOutlineImpl.java    |   4 +-
 .../bean/PrivateObjectFactoryGenerator.java   |   4 +-
 .../bean/PublicObjectFactoryGenerator.java    |   4 +-
 .../generator/bean/field/AbstractField.java   |   6 +-
 .../bean/field/ContentListField.java          |   4 +-
 .../bean/field/NoExtendedContentField.java    |   4 +-
 .../generator/bean/field/UnboxedField.java    |   4 +-
 .../xjc/{outline => model}/Aspect.java        |   6 +-
 .../tools/internal/xjc/model/CAdapter.java    |   3 +-
 .../tools/internal/xjc/model/CArrayInfo.java  |   3 +-
 .../xjc/model/CAttributePropertyInfo.java     |   6 +-
 .../internal/xjc/model/CBuiltinLeafInfo.java  |   3 +-
 .../tools/internal/xjc/model/CClassInfo.java  |   5 +-
 .../tools/internal/xjc/model/CClassRef.java   |  15 +-
 .../internal/xjc/model/CElementInfo.java      |   3 +-
 .../xjc/model/CElementPropertyInfo.java       |   7 +-
 .../internal/xjc/model/CEnumLeafInfo.java     |   3 +-
 .../internal/xjc/model/CPropertyInfo.java     |   5 +-
 .../internal/xjc/model/CPropertyVisitor2.java |  76 ++++++
 .../xjc/model/CReferencePropertyInfo.java     |   7 +-
 .../tools/internal/xjc/model/CTypeInfo.java   |   3 +-
 .../xjc/model/CValuePropertyInfo.java         |   7 +-
 .../internal/xjc/model/CWildcardTypeInfo.java |   3 +-
 .../sun/tools/internal/xjc/model/Model.java   |  46 ++--
 .../internal/xjc/model/nav/EagerNClass.java   |   4 +-
 .../internal/xjc/model/nav/EagerNType.java    |   4 +-
 .../tools/internal/xjc/model/nav/NClass.java  |   4 +-
 .../xjc/model/nav/NClassByJClass.java         |   4 +-
 .../xjc/model/nav/NParameterizedType.java     |   4 +-
 .../tools/internal/xjc/model/nav/NType.java   |   6 +-
 .../tools/internal/xjc/outline/Outline.java   |   8 +-
 .../xjc/reader/internalizer/DOMForest.java    |   4 +-
 .../xml/internal/xsom/impl/SchemaImpl.java    |   7 +-
 .../modeler/wsdl/PseudoSchemaBuilder.java     |  13 +-
 .../ws/resources/ConfigurationMessages.java   |   4 +-
 .../ws/resources/WscompileMessages.java       |  50 ++--
 .../ws/resources/configuration.properties     |   4 +-
 .../ws/resources/configuration_fr.properties  |   4 +-
 .../ws/resources/configuration_it.properties  |   4 +-
 .../ws/resources/configuration_ja.properties  |   4 +-
 .../ws/resources/configuration_ko.properties  |   4 +-
 .../resources/configuration_pt_BR.properties  |   4 +-
 .../resources/configuration_zh_CN.properties  |   4 +-
 .../resources/configuration_zh_TW.properties  |   4 +-
 .../ws/resources/wscompile.properties         |  14 +-
 .../ws/resources/wscompile_de.properties      |   8 +-
 .../ws/resources/wscompile_es.properties      |  12 +-
 .../ws/resources/wscompile_fr.properties      |  10 +-
 .../ws/resources/wscompile_it.properties      |   8 +-
 .../ws/resources/wscompile_ja.properties      |   6 +-
 .../ws/resources/wscompile_ko.properties      |   6 +-
 .../ws/resources/wscompile_pt_BR.properties   |  12 +-
 .../ws/resources/wscompile_zh_CN.properties   |   8 +-
 .../ws/resources/wscompile_zh_TW.properties   |  12 +-
 .../sun/tools/internal/ws/version.properties  |   6 +-
 .../internal/ws/wscompile/WsgenTool.java      |  18 +-
 .../internal/ws/wscompile/WsimportTool.java   |   5 +-
 114 files changed, 803 insertions(+), 477 deletions(-)
 create mode 100644 jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/ServiceArtifactSchemaGenerator.java
 rename jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/{outline => model}/Aspect.java (93%)
 create mode 100644 jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CPropertyVisitor2.java

diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java
index 7b7081d365f..9b2ce7053df 100644
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/ContentHandlerAdaptor.java
@@ -27,7 +27,6 @@ package com.sun.xml.internal.bind.v2.runtime;
 
 import com.sun.istack.internal.FinalArrayList;
 import com.sun.istack.internal.SAXException2;
-
 import org.xml.sax.Attributes;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.DefaultHandler;
@@ -69,14 +68,14 @@ final class ContentHandlerAdaptor extends DefaultHandler {
     private boolean containsPrefixMapping(String prefix, String uri) {
         for( int i=0; i<prefixMap.size(); i+=2 ) {
             if(prefixMap.get(i).equals(prefix)
-                    && prefixMap.get(i+1).equals(uri))
+            && prefixMap.get(i+1).equals(uri))
                 return true;
         }
         return false;
     }
 
     public void startElement(String namespaceURI, String localName, String qName, Attributes atts)
-            throws SAXException {
+        throws SAXException {
         try {
             flushText();
 
@@ -99,6 +98,7 @@ final class ContentHandlerAdaptor extends DefaultHandler {
                 serializer.getNamespaceContext().force(
                         prefixMap.get(i + 1), prefixMap.get(i));
             }
+
             // make sure namespaces needed by attributes are bound
             for( int i=0; i<len; i++ ) {
                 String qname = atts.getQName(i);
@@ -107,7 +107,7 @@ final class ContentHandlerAdaptor extends DefaultHandler {
                 String prefix = getPrefix(qname);
 
                 serializer.getNamespaceContext().declareNamespace(
-                        atts.getURI(i), prefix, true );
+                    atts.getURI(i), prefix, true );
             }
 
             serializer.endNamespaceDecls(null);
@@ -127,7 +127,6 @@ final class ContentHandlerAdaptor extends DefaultHandler {
         }
     }
 
-    // make sure namespaces needed by attributes are bound
     private String getPrefix(String qname) {
         int idx = qname.indexOf(':');
         String prefix = (idx == -1) ? "" : qname.substring(0, idx);
diff --git a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXStreamConnector.java b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXStreamConnector.java
index a3b51b05b92..3e389337e6c 100644
--- a/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXStreamConnector.java
+++ b/jaxws/src/java.xml.bind/share/classes/com/sun/xml/internal/bind/v2/runtime/unmarshaller/StAXStreamConnector.java
@@ -70,7 +70,7 @@ class StAXStreamConnector extends StAXConnector {
         // Quick hack until SJSXP fixes 6270116
         boolean isZephyr = readerClass.getName().equals("com.sun.xml.internal.stream.XMLReaderImpl");
         if (getBoolProp(reader,"org.codehaus.stax2.internNames") &&
-                getBoolProp(reader,"org.codehaus.stax2.internNsUris"))
+            getBoolProp(reader,"org.codehaus.stax2.internNsUris"))
             ; // no need for interning
         else
         if (isZephyr)
@@ -219,8 +219,8 @@ class StAXStreamConnector extends StAXConnector {
         int nsCount = staxStreamReader.getNamespaceCount();
         for (int i = 0; i < nsCount; i++) {
             visitor.startPrefixMapping(
-                    fixNull(staxStreamReader.getNamespacePrefix(i)),
-                    fixNull(staxStreamReader.getNamespaceURI(i)));
+                fixNull(staxStreamReader.getNamespacePrefix(i)),
+                fixNull(staxStreamReader.getNamespaceURI(i)));
         }
 
         // fire startElement
@@ -310,9 +310,9 @@ class StAXStreamConnector extends StAXConnector {
     protected void handleCharacters() throws XMLStreamException, SAXException {
         if( predictor.expectText() )
             buffer.append(
-                    staxStreamReader.getTextCharacters(),
-                    staxStreamReader.getTextStart(),
-                    staxStreamReader.getTextLength() );
+                staxStreamReader.getTextCharacters(),
+                staxStreamReader.getTextStart(),
+                staxStreamReader.getTextLength() );
     }
 
     private void processText( boolean ignorable ) throws SAXException {
diff --git a/jaxws/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/message/BaseDistributedPropertySet.java b/jaxws/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/message/BaseDistributedPropertySet.java
index e4ea2c19ea8..33c89459805 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/message/BaseDistributedPropertySet.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/oracle/webservices/internal/api/message/BaseDistributedPropertySet.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -247,7 +247,7 @@ public abstract class BaseDistributedPropertySet extends BasePropertySet impleme
             if (viewthis.containsKey(key))
                 return true;
             for (PropertySet child : satellites.values()) {
-                if (child.containsKey(key))
+                if (child.asMap().containsKey(key))
                     return true;
             }
             return false;
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/model/CheckedException.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/model/CheckedException.java
index 77201c86ed2..6b1efd955cb 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/model/CheckedException.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/model/CheckedException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,10 +26,9 @@
 package com.sun.xml.internal.ws.api.model;
 
 import com.sun.xml.internal.bind.api.Bridge;
+import com.sun.xml.internal.ws.spi.db.TypeInfo;
 
 import javax.xml.ws.WebFault;
-import javax.xml.namespace.QName;
-import java.rmi.RemoteException;
 
 /**
  * This class provides abstractio to the  the exception class
@@ -98,4 +97,9 @@ public interface CheckedException {
      * referenced by wsdl:fault
      */
     String getMessageName();
+
+    /**
+     * Gives the {@link com.sun.xml.internal.ws.spi.db.TypeInfo} of the detail
+     */
+    TypeInfo getDetailType();
 }
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/model/JavaMethod.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/model/JavaMethod.java
index c715df9ade4..4b8d6145c6c 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/model/JavaMethod.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/model/JavaMethod.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,6 +31,8 @@ import com.sun.xml.internal.ws.api.model.soap.SOAPBinding;
 
 import javax.xml.namespace.QName;
 import java.lang.reflect.Method;
+import java.util.Collection;
+
 import javax.jws.WebService;
 
 /**
@@ -138,4 +140,10 @@ public interface JavaMethod {
      */
     @Nullable QName getResponsePayloadName();
 
+    /**
+     * Gives the checked Exception thrown from this method.
+     *
+     * @return Returns the {@link CheckedException}.
+     */
+    Collection<? extends CheckedException> getCheckedExceptions();
 }
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/streaming/XMLStreamReaderFactory.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/streaming/XMLStreamReaderFactory.java
index 40a51184c89..f3c6bf41839 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/streaming/XMLStreamReaderFactory.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/api/streaming/XMLStreamReaderFactory.java
@@ -482,6 +482,7 @@ public abstract class XMLStreamReaderFactory {
         private static final java.lang.String P_MAX_ELEMENT_DEPTH = "com.ctc.wstx.maxElementDepth";
         private static final java.lang.String P_MAX_CHARACTERS = "com.ctc.wstx.maxCharacters";
         private static final java.lang.String P_INTERN_NSURIS = "org.codehaus.stax2.internNsUris";
+        private static final java.lang.String P_RETURN_NULL_FOR_DEFAULT_NAMESPACE = "com.ctc.wstx.returnNullForDefaultNamespace";
 
         public Woodstox(XMLInputFactory xif) {
             super(xif);
@@ -552,6 +553,19 @@ public abstract class XMLStreamReaderFactory {
                     LOGGER.log(Level.FINE, P_MAX_CHARACTERS + " is {0}", maxCharacters);
                 }
             }
+            //Using try/catch instead of isPropertySupported because Woodstox
+            //isPropertySupported is not always reliable
+            try {
+                //this is needed to make sure Woodstox behavior is spec compliant for
+                //calls to XMLStreamReader.getNamespacePrefix
+                xif.setProperty(P_RETURN_NULL_FOR_DEFAULT_NAMESPACE, Boolean.TRUE);
+                if (LOGGER.isLoggable(Level.FINE)) {
+                    LOGGER.log(Level.FINE, P_RETURN_NULL_FOR_DEFAULT_NAMESPACE + " is {0}", xif.getProperty(P_RETURN_NULL_FOR_DEFAULT_NAMESPACE));
+                }
+            } catch (Throwable t) {
+                //ignore - this should not happen Woodstox 4.1.2 or later (maybe older version of Woodstox).
+                LOGGER.log(Level.WARNING, "Expected property not found in Woodstox input factory: '{0}'", P_RETURN_NULL_FOR_DEFAULT_NAMESPACE);
+            }
         }
 
         @Override
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java
index bf258021c33..8006e032c39 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/fault/SOAPFaultBuilder.java
@@ -37,6 +37,7 @@ import com.sun.xml.internal.ws.message.jaxb.JAXBMessage;
 import com.sun.xml.internal.ws.message.FaultMessage;
 import com.sun.xml.internal.ws.model.CheckedExceptionImpl;
 import com.sun.xml.internal.ws.model.JavaMethodImpl;
+import com.sun.xml.internal.ws.spi.db.WrapperComposite;
 import com.sun.xml.internal.ws.spi.db.XMLBridge;
 import com.sun.xml.internal.ws.util.DOMUtil;
 import com.sun.xml.internal.ws.util.StringUtils;
@@ -306,6 +307,7 @@ public abstract class SOAPFaultBuilder {
         try{
             Node detailNode = getDetail().getDetails().get(0);
             Object jaxbDetail = getJAXBObject(detailNode, ce);
+            if (jaxbDetail instanceof Exception) return (Exception)jaxbDetail;
             Constructor exConstructor;
             try{
                 exConstructor = exceptionClass.getConstructor(String.class, detailBean);
@@ -330,8 +332,7 @@ public abstract class SOAPFaultBuilder {
             return createDetailFromUserDefinedException(ce, exception);
         }
         try {
-            Method m = exception.getClass().getMethod("getFaultInfo");
-            return m.invoke(exception);
+            return ce.getFaultInfoGetter().invoke(exception);
         } catch (Exception e) {
             throw new SerializationException(e);
         }
@@ -339,6 +340,7 @@ public abstract class SOAPFaultBuilder {
 
     private static Object createDetailFromUserDefinedException(CheckedExceptionImpl ce, Object exception) {
         Class detailBean = ce.getDetailBean();
+        if (ce.getExceptionClass().equals(detailBean)) return exception;
         Field[] fields = detailBean.getDeclaredFields();
         try {
             Object detail = detailBean.newInstance();
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/AbstractSEIModelImpl.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/AbstractSEIModelImpl.java
index 4ba3062315f..60f074cce38 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/AbstractSEIModelImpl.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/AbstractSEIModelImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -95,6 +95,10 @@ public abstract class AbstractSEIModelImpl implements SEIModel {
         createJAXBContext();
     }
 
+    public BindingInfo databindingInfo() {
+        return databindingInfo;
+    }
+
     /**
      * Link {@link SEIModel} to {@link WSDLModel}.
      * Merge it with {@link #postProcess()}.
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/CheckedExceptionImpl.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/CheckedExceptionImpl.java
index daa1ee75019..d2229bd1200 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/CheckedExceptionImpl.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/CheckedExceptionImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,8 @@
 
 package com.sun.xml.internal.ws.model;
 
+import java.lang.reflect.Method;
+
 import com.sun.xml.internal.bind.api.Bridge;
 import com.sun.xml.internal.ws.api.model.CheckedException;
 import com.sun.xml.internal.ws.api.model.ExceptionType;
@@ -52,6 +54,7 @@ public final class CheckedExceptionImpl implements CheckedException {
     private final JavaMethodImpl javaMethod;
     private String messageName;
     private String faultAction = "";
+    private Method faultInfoGetter;
 
     /**
      * @param jm {@link JavaMethodImpl} that throws this exception
@@ -127,5 +130,11 @@ public final class CheckedExceptionImpl implements CheckedException {
         return WsaActionUtil.getDefaultFaultAction(javaMethod,this);
     }
 
+    public Method getFaultInfoGetter() {
+        return faultInfoGetter;
+    }
 
+    public void setFaultInfoGetter(Method faultInfoGetter) {
+        this.faultInfoGetter = faultInfoGetter;
+    }
 }
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/ParameterImpl.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/ParameterImpl.java
index eb684e98a4e..9444b67f193 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/ParameterImpl.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/ParameterImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -101,7 +101,7 @@ public class ParameterImpl implements Parameter {
 
     public XMLBridge getInlinedRepeatedElementBridge() {
         TypeInfo itemType = getItemType();
-        if (itemType != null) {
+        if (itemType != null && itemType.getWrapperType() == null) {
             XMLBridge xb = getOwner().getXMLBridge(itemType);
             if (xb != null) return new RepeatedElementBridge(typeInfo, xb);
         }
@@ -255,6 +255,11 @@ public class ParameterImpl implements Parameter {
 
     void fillTypes(List<TypeInfo> types) {
         TypeInfo itemType = getItemType();
-        types.add((itemType != null) ? itemType : getTypeInfo());
+        if (itemType != null) {
+            types.add(itemType);
+            if (itemType.getWrapperType() != null) types.add(getTypeInfo());
+        } else {
+            types.add(getTypeInfo());
+        }
     }
 }
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/RuntimeModeler.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/RuntimeModeler.java
index a466b8458fa..720caca333a 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/RuntimeModeler.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/model/RuntimeModeler.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,7 @@ import com.sun.xml.internal.ws.spi.db.TypeInfo;
 import com.sun.xml.internal.ws.spi.db.WrapperComposite;
 
 import static com.sun.xml.internal.ws.binding.WebServiceFeatureList.getSoapVersion;
+import static com.sun.xml.internal.ws.model.Utils.REFLECTION_NAVIGATOR;
 
 import javax.jws.*;
 import javax.jws.WebParam.Mode;
@@ -381,6 +382,7 @@ public class RuntimeModeler {
         try {
             return loader.loadClass(className);
         } catch (ClassNotFoundException e) {
+            if (noWrapperGen()) return exception;
             logger.fine("Dynamically creating exception bean Class " + className);
             return WrapperBeanGenerator.createExceptionBean(className, exception, targetNamespace, name, namespace, loader, decapitalizeExceptionBeanProperties);
         }
@@ -885,7 +887,7 @@ public class RuntimeModeler {
             //set the actual type argument of Holder in the TypeReference
             if (isHolder) {
                 if(clazzType==Holder.class){
-                    clazzType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(((ParameterizedType)genericParameterTypes[pos]).getActualTypeArguments()[0]);
+                    clazzType = erasure(((ParameterizedType)genericParameterTypes[pos]).getActualTypeArguments()[0]);
                 }
             }
             Mode paramMode = isHolder ? Mode.INOUT : Mode.IN;
@@ -1100,7 +1102,7 @@ public class RuntimeModeler {
             //set the actual type argument of Holder in the TypeReference
             if (isHolder) {
                 if (clazzType==Holder.class)
-                    clazzType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(((ParameterizedType)genericParameterTypes[pos]).getActualTypeArguments()[0]);
+                    clazzType = erasure(((ParameterizedType)genericParameterTypes[pos]).getActualTypeArguments()[0]);
             }
             Mode paramMode = isHolder ? Mode.INOUT : Mode.IN;
             for (Annotation annotation : pannotations[pos]) {
@@ -1210,7 +1212,8 @@ public class RuntimeModeler {
                 continue;
             if (RUNTIME_EXCEPTION_CLASS.isAssignableFrom(exception) || REMOTE_EXCEPTION_CLASS.isAssignableFrom(exception))
                 continue;
-
+            if (getAnnotation(exception, javax.xml.bind.annotation.XmlTransient.class) != null)
+                continue;
             Class exceptionBean;
             Annotation[] anns;
             WebFault webFault = getAnnotation(exception, WebFault.class);
@@ -1246,6 +1249,7 @@ public class RuntimeModeler {
             CheckedExceptionImpl checkedException =
                 new CheckedExceptionImpl(javaMethod, exception, typeRef, exceptionType);
             checkedException.setMessageName(messageName);
+            checkedException.setFaultInfoGetter(faultInfoMethod);
             for(FaultAction fa: faultActions) {
                 if(fa.className().equals(exception) && !fa.value().equals("")) {
                     checkedException.setFaultAction(fa.value());
@@ -1346,7 +1350,7 @@ public class RuntimeModeler {
             //set the actual type argument of Holder in the TypeReference
             if (isHolder) {
                 if (clazzType==Holder.class)
-                    clazzType = (Class) Utils.REFLECTION_NAVIGATOR.erasure(((ParameterizedType)genericParameterTypes[pos]).getActualTypeArguments()[0]);
+                    clazzType = erasure(((ParameterizedType)genericParameterTypes[pos]).getActualTypeArguments()[0]);
             }
 
             Mode paramMode = isHolder ? Mode.INOUT : Mode.IN;
@@ -1434,14 +1438,14 @@ public class RuntimeModeler {
     private Class getAsyncReturnType(Method method, Class returnType) {
         if(Response.class.isAssignableFrom(returnType)){
             Type ret = method.getGenericReturnType();
-            return (Class) Utils.REFLECTION_NAVIGATOR.erasure(((ParameterizedType)ret).getActualTypeArguments()[0]);
+            return erasure(((ParameterizedType)ret).getActualTypeArguments()[0]);
         }else{
             Type[] types = method.getGenericParameterTypes();
             Class[] params = method.getParameterTypes();
             int i = 0;
             for(Class cls : params){
                 if(AsyncHandler.class.isAssignableFrom(cls)){
-                    return (Class) Utils.REFLECTION_NAVIGATOR.erasure(((ParameterizedType)types[i]).getActualTypeArguments()[0]);
+                    return erasure(((ParameterizedType)types[i]).getActualTypeArguments()[0]);
                 }
                 i++;
             }
@@ -1733,5 +1737,7 @@ public class RuntimeModeler {
         return new QName(ns, localPart);
     }
 
-
+    static public Class erasure(Type type) {
+        return (Class)REFLECTION_NAVIGATOR.erasure(type);
+    }
 }
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/ServiceArtifactSchemaGenerator.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/ServiceArtifactSchemaGenerator.java
new file mode 100644
index 00000000000..9f58026bd97
--- /dev/null
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/ServiceArtifactSchemaGenerator.java
@@ -0,0 +1,226 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.spi.db;
+
+import static com.sun.xml.internal.ws.model.RuntimeModeler.DocWrappeeNamespapceQualified;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Map.Entry;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import static com.sun.xml.internal.ws.wsdl.writer.WSDLGenerator.XsdNs;
+
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.SchemaOutputResolver;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Result;
+import javax.xml.ws.WebServiceException;
+
+import com.sun.xml.internal.bind.v2.schemagen.xmlschema.ComplexType;
+import com.sun.xml.internal.bind.v2.schemagen.xmlschema.Element;
+import com.sun.xml.internal.bind.v2.schemagen.xmlschema.ExplicitGroup;
+import com.sun.xml.internal.bind.v2.schemagen.xmlschema.LocalElement;
+import com.sun.xml.internal.bind.v2.schemagen.xmlschema.Occurs;
+import com.sun.xml.internal.txw2.TXW;
+import com.sun.xml.internal.txw2.output.ResultFactory;
+import com.sun.xml.internal.ws.api.model.SEIModel;
+import com.sun.xml.internal.ws.model.AbstractSEIModelImpl;
+import com.sun.xml.internal.ws.model.JavaMethodImpl;
+import com.sun.xml.internal.ws.model.ParameterImpl;
+import com.sun.xml.internal.ws.model.WrapperParameter;
+import com.sun.xml.internal.ws.wsdl.writer.document.xsd.Schema;
+
+/**
+ * ServiceArtifactSchemaGenerator generates XML schema for service artifacts including the wrapper types of
+ * document-literal stype operation and exceptions.
+ *
+ * @author shih-chang.chen@oracle.com
+ */
+public class ServiceArtifactSchemaGenerator {
+
+    protected AbstractSEIModelImpl model;
+    protected SchemaOutputResolver xsdResolver;
+
+    public ServiceArtifactSchemaGenerator(SEIModel model) {
+        this.model = (AbstractSEIModelImpl)model;
+    }
+
+    static final String FilePrefix = "jaxwsGen";
+    protected int fileIndex = 0;
+    protected Schema create(String tns) {
+        try {
+            Result res = xsdResolver.createOutput(tns, FilePrefix + (fileIndex++) + ".xsd");
+            return TXW.create(Schema.class, ResultFactory.createSerializer(res));
+        } catch (IOException e) {
+            // TODO Auto-generated catch block
+            throw new WebServiceException(e);
+        }
+    }
+
+    public void generate(SchemaOutputResolver resolver) {
+        xsdResolver = resolver;
+        List<WrapperParameter> wrappers = new ArrayList<WrapperParameter>();
+        for (JavaMethodImpl method : model.getJavaMethods()) {
+            if(method.getBinding().isRpcLit()) continue;
+            for (ParameterImpl p : method.getRequestParameters()) {
+                if (p instanceof WrapperParameter) {
+                    if (WrapperComposite.class.equals((((WrapperParameter)p).getTypeInfo().type))) {
+                        wrappers.add((WrapperParameter)p);
+                    }
+                }
+            }
+            for (ParameterImpl p : method.getResponseParameters()) {
+                if (p instanceof WrapperParameter) {
+                    if (WrapperComposite.class.equals((((WrapperParameter)p).getTypeInfo().type))) {
+                        wrappers.add((WrapperParameter)p);
+                    }
+                }
+            }
+        }
+        if (wrappers.isEmpty()) return;
+        HashMap<String, Schema> xsds = initWrappersSchemaWithImports(wrappers);
+        postInit(xsds);
+        for(WrapperParameter wp : wrappers) {
+            String tns = wp.getName().getNamespaceURI();
+            Schema xsd = xsds.get(tns);
+            Element e =  xsd._element(Element.class);
+            e._attribute("name", wp.getName().getLocalPart());
+            e.type(wp.getName());
+            ComplexType ct =  xsd._element(ComplexType.class);
+            ct._attribute("name", wp.getName().getLocalPart());
+            ExplicitGroup sq = ct.sequence();
+            for (ParameterImpl p : wp.getWrapperChildren() ) if (p.getBinding().isBody()) addChild(sq, p);
+        }
+        for(Schema xsd: xsds.values()) xsd.commit();
+    }
+
+    protected void postInit(HashMap<String, Schema> xsds) {
+    }
+
+    protected void addChild(ExplicitGroup sq, ParameterImpl param) {
+        TypeInfo typeInfo = param.getItemType();
+        boolean repeatedElement = false;
+        if (typeInfo == null) {
+            typeInfo = param.getTypeInfo();
+        } else {
+            if (typeInfo.getWrapperType() != null) typeInfo = param.getTypeInfo();
+            else repeatedElement = true;
+        }
+        Occurs child = addChild(sq, param.getName(), typeInfo);
+        if (repeatedElement && child != null) {
+            child.maxOccurs("unbounded");
+        }
+    }
+
+    protected Occurs addChild(ExplicitGroup sq, QName name, TypeInfo typeInfo) {
+        LocalElement le = null;;
+        QName type = model.getBindingContext().getTypeName(typeInfo);
+        if (type != null) {
+            le = sq.element();
+            le._attribute("name", name.getLocalPart());
+            le.type(type);
+        } else {
+            if (typeInfo.type instanceof Class) {
+                try {
+                    QName elemName = model.getBindingContext().getElementName((Class)typeInfo.type);
+                    if (elemName.getLocalPart().equals("any") && elemName.getNamespaceURI().equals(XsdNs)) {
+                        return sq.any();
+                    } else {
+                        le = sq.element();
+                        le.ref(elemName);
+                    }
+                } catch (JAXBException je) {
+                    throw new WebServiceException(je.getMessage(), je);
+                }
+            }
+        }
+        return le;
+    }
+
+    //All the imports have to go first ...
+    private HashMap<String, Schema> initWrappersSchemaWithImports(List<WrapperParameter> wrappers) {
+        Object o = model.databindingInfo().properties().get(DocWrappeeNamespapceQualified);
+        boolean wrappeeQualified = (o!= null && o instanceof Boolean) ? ((Boolean) o) : false;
+        HashMap<String, Schema> xsds = new HashMap<String, Schema>();
+        HashMap<String, Set<String>> imports = new HashMap<String, Set<String>>();
+        for(WrapperParameter wp : wrappers) {
+            String tns = wp.getName().getNamespaceURI();
+            Schema xsd = xsds.get(tns);
+            if (xsd == null) {
+                xsd = create(tns);
+                xsd.targetNamespace(tns);
+                if (wrappeeQualified) xsd._attribute("elementFormDefault", "qualified");
+                xsds.put(tns, xsd);
+            }
+            for (ParameterImpl p : wp.getWrapperChildren() ) {
+                String nsToImport = (p.getBinding().isBody())? bodyParamNS(p): null;
+                if (nsToImport != null && !nsToImport.equals(tns) && !nsToImport.equals("http://www.w3.org/2001/XMLSchema")) {
+                    Set<String> importSet = imports.get(tns);
+                    if (importSet == null) {
+                        importSet = new HashSet<String>();
+                        imports.put(tns, importSet);
+                    }
+                    importSet.add(nsToImport);
+                }
+            }
+        }
+        for(Entry<String, Set<String>> entry: imports.entrySet()) {
+            String tns = entry.getKey();
+            Set<String> importSet = entry.getValue();
+            Schema xsd = xsds.get(tns);
+            for(String nsToImport : importSet) xsd._namespace(nsToImport, true);
+            for(String nsToImport : importSet) {
+                com.sun.xml.internal.ws.wsdl.writer.document.xsd.Import imp = xsd._import();
+                imp.namespace(nsToImport);
+            }
+        }
+        return xsds;
+    }
+
+    protected String bodyParamNS(ParameterImpl p) {
+        String nsToImport = null;
+        TypeInfo typeInfo = p.getItemType();
+        if (typeInfo == null) typeInfo = p.getTypeInfo();
+        QName type = model.getBindingContext().getTypeName(typeInfo);
+        if (type != null) {
+            nsToImport = type.getNamespaceURI();
+        } else {
+            if (typeInfo.type instanceof Class) {
+                try {
+                    QName elemRef = model.getBindingContext().getElementName((Class)typeInfo.type);
+                    if (elemRef != null) nsToImport = elemRef.getNamespaceURI();
+                } catch (JAXBException je) {
+                    throw new WebServiceException(je.getMessage(), je);
+                }
+            }
+        }
+        return nsToImport;
+    }
+}
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java
index eda1c39bd16..8eeeaeea4ca 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/spi/db/TypeInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -33,8 +33,7 @@ import java.util.HashMap;
 import java.util.Map;
 
 import javax.xml.namespace.QName;
-
-import com.sun.xml.internal.bind.v2.model.nav.Navigator;
+import javax.xml.bind.annotation.XmlElementWrapper;
 
 /**
  * A reference to a JAXB-bound type.
@@ -75,6 +74,8 @@ public final class TypeInfo {
 
     private TypeInfo parentCollectionType;
 
+    private TypeInfo wrapperType;
+
     private Type genericType;
 
     private boolean nillable = true;
@@ -172,7 +173,6 @@ public final class TypeInfo {
     }
 
     public TypeInfo getItemType() {
-//      System.out.println("????? TypeInfo " + type);
         if (type instanceof Class && ((Class)type).isArray() && !byte[].class.equals(type)) {
             Type componentType = ((Class)type).getComponentType();
             Type genericComponentType = null;
@@ -183,6 +183,7 @@ public final class TypeInfo {
             }
             TypeInfo ti =new TypeInfo(tagName, componentType, annotations);
             if (genericComponentType != null) ti.setGenericType(genericComponentType);
+            for(Annotation anno : annotations) if (anno instanceof XmlElementWrapper) ti.wrapperType = this;
             return ti;
         }
 //        if (type instanceof Class && java.util.Collection.class.isAssignableFrom((Class)type)) {
@@ -193,4 +194,8 @@ public final class TypeInfo {
         }
         return null;
     }
+
+    public TypeInfo getWrapperType() {
+        return wrapperType;
+    }
 }
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/pipe/AbstractSchemaValidationTube.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/pipe/AbstractSchemaValidationTube.java
index 12d1507d7a5..6241299d41a 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/pipe/AbstractSchemaValidationTube.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/pipe/AbstractSchemaValidationTube.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -483,7 +483,7 @@ public abstract class AbstractSchemaValidationTube extends AbstractFilterTubeImp
         assert docs.size() > 1;
 
         final StringBuilder sb = new StringBuilder("<xsd:schema xmlns:xsd='http://www.w3.org/2001/XMLSchema'");
-        if (!tns.equals("")) {
+        if (!"".equals(tns)) {
             sb.append(" targetNamespace='").append(tns).append("'");
         }
         sb.append(">\n");
@@ -521,7 +521,7 @@ public abstract class AbstractSchemaValidationTube extends AbstractFilterTubeImp
             String systemId = e.getValue();
             String ns = e.getKey();
             sb.append("<xsd:import schemaLocation='").append(systemId).append("'");
-            if (!ns.equals("")) {
+            if (!"".equals(ns)) {
                 sb.append(" namespace='").append(ns).append("'");
             }
             sb.append("/>\n");
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/resources/Messages_en.properties b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/resources/Messages_en.properties
index 2a5887b47a5..359ca7bcc90 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/resources/Messages_en.properties
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/resources/Messages_en.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2014, 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
@@ -274,7 +274,7 @@ V-029 = Value "{0}" is not one of the enumerated values for this attribute
 V-030 = Attribute value "{0}" does not name a notation
 V-031 = Attribute value "{0}" does not name an unparsed entity
 V-032 = NMTOKENS attributes must have at least one value
-# Empty content model is a special type of XML element. I�d leave the message in English as is (also libraries from outside of Oracle use this exact message) but the word EMPTY can be translated.
+# Empty content model is a special type of XML element. I'd leave the message in English as is (also libraries from outside of Oracle use this exact message) but the word EMPTY can be translated.
 V-033 = Empty content models must have no content
 # Usage not found. TODO Remove
 #V-034 = Element "{0}" does not allow "{1}" -- {2}
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties
index 1d11f65b66a..1ae4b3cd94f 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/util/version.properties
@@ -23,7 +23,7 @@
 # questions.
 #
 
-build-id=2.2.11-b140602.1731
-build-version=JAX-WS RI 2.2.11-b140602.1731
+build-id=2.2.11-b141124.1933
+build-version=JAX-WS RI 2.2.11-b141124.1933
 major-version=2.2.11
-svn-revision=a684014c13b34abb8b9613e106f44f59abea206f
+svn-revision=312b19a2e0e312b55e1ea6f531bd595955cd581f
diff --git a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/wsdl/writer/WSDLGenerator.java b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/wsdl/writer/WSDLGenerator.java
index c954b6fcd29..fa1fb331031 100644
--- a/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/wsdl/writer/WSDLGenerator.java
+++ b/jaxws/src/java.xml.ws/share/classes/com/sun/xml/internal/ws/wsdl/writer/WSDLGenerator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -71,18 +71,11 @@ import com.sun.xml.internal.ws.wsdl.writer.document.soap.BodyType;
 import com.sun.xml.internal.ws.wsdl.writer.document.soap.Header;
 import com.sun.xml.internal.ws.wsdl.writer.document.soap.SOAPAddress;
 import com.sun.xml.internal.ws.wsdl.writer.document.soap.SOAPFault;
-import com.sun.xml.internal.ws.wsdl.writer.document.xsd.Schema;
 import com.sun.xml.internal.ws.spi.db.BindingContext;
 import com.sun.xml.internal.ws.spi.db.BindingHelper;
-import com.sun.xml.internal.ws.spi.db.TypeInfo;
-import com.sun.xml.internal.ws.spi.db.WrapperComposite;
 import com.sun.xml.internal.ws.util.RuntimeVersion;
 import com.sun.xml.internal.ws.policy.jaxws.PolicyWSDLGeneratorExtension;
 import com.sun.xml.internal.ws.encoding.soap.streaming.SOAPNamespaceConstants;
-import com.sun.xml.internal.bind.v2.schemagen.xmlschema.Element;
-import com.sun.xml.internal.bind.v2.schemagen.xmlschema.ComplexType;
-import com.sun.xml.internal.bind.v2.schemagen.xmlschema.ExplicitGroup;
-import com.sun.xml.internal.bind.v2.schemagen.xmlschema.LocalElement;
 
 import javax.jws.soap.SOAPBinding.Style;
 import javax.jws.soap.SOAPBinding.Use;
@@ -100,12 +93,12 @@ import javax.xml.ws.Holder;
 import javax.xml.ws.WebServiceException;
 
 import org.w3c.dom.Document;
+import org.w3c.dom.NodeList;
 
 import java.io.IOException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
 import java.util.List;
@@ -128,22 +121,6 @@ public class WSDLGenerator {
      * Constant String for ".wsdl"
      */
     private static final String DOT_WSDL = ".wsdl";
-    /**
-     * Constant String appended to response message names
-     */
-    private static final String RESPONSE = "Response";
-    /**
-     * constant String used for part name for wrapped request messages
-     */
-    private static final String PARAMETERS = "parameters";
-    /**
-     * the part name for unwrappable response messages
-     */
-    private static final String RESULT = "parameters";
-    /**
-     * the part name for response messages that are not unwrappable
-     */
-    private static final String UNWRAPPABLE_RESULT = "result";
     /**
      * The WSDL namespace
      */
@@ -196,6 +173,9 @@ public class WSDLGenerator {
      * Constant String to flag the URL to replace at runtime for the endpoint
      */
     private static final String REPLACE_WITH_ACTUAL_URL = "REPLACE_WITH_ACTUAL_URL";
+
+    static public final String XsdNs = "http://www.w3.org/2001/XMLSchema";
+
     private Set<QName> processedExceptions = new HashSet<QName>();
     private WSBinding binding;
     private String wsdlLocation;
@@ -468,6 +448,13 @@ public class WSDLGenerator {
                 Transformer t = tf.newTransformer();
                 for (DOMResult xsd : resolver.nonGlassfishSchemas) {
                     Document doc = (Document) xsd.getNode();
+                    if (inlineSchemas) {
+                        NodeList importList = doc.getDocumentElement().getElementsByTagNameNS("http://www.w3.org/2001/XMLSchema", "import");
+                        for(int i = 0; i < importList.getLength(); i++) {
+                            org.w3c.dom.Element impElem = (org.w3c.dom.Element)importList.item(i);
+                            impElem.removeAttribute("schemaLocation");
+                        }
+                    }
                     SAXResult sax = new SAXResult(new TXWContentHandler(types));
                     t.transform(new DOMSource(doc.getDocumentElement()), sax);
                 }
@@ -477,64 +464,6 @@ public class WSDLGenerator {
                 throw new WebServiceException(e.getMessage(), e);
             }
         }
-        generateWrappers();
-    }
-
-    void generateWrappers() {
-        List<WrapperParameter> wrappers = new ArrayList<WrapperParameter>();
-        for (JavaMethodImpl method : model.getJavaMethods()) {
-            if(method.getBinding().isRpcLit()) continue;
-            for (ParameterImpl p : method.getRequestParameters()) {
-                if (p instanceof WrapperParameter) {
-                    if (WrapperComposite.class.equals((((WrapperParameter)p).getTypeInfo().type))) {
-                        wrappers.add((WrapperParameter)p);
-                    }
-                }
-            }
-            for (ParameterImpl p : method.getResponseParameters()) {
-                if (p instanceof WrapperParameter) {
-                    if (WrapperComposite.class.equals((((WrapperParameter)p).getTypeInfo().type))) {
-                        wrappers.add((WrapperParameter)p);
-                    }
-                }
-            }
-        }
-        if (wrappers.isEmpty()) return;
-        HashMap<String, Schema> xsds = new HashMap<String, Schema>();
-        for(WrapperParameter wp : wrappers) {
-            String tns = wp.getName().getNamespaceURI();
-            Schema xsd = xsds.get(tns);
-            if (xsd == null) {
-                xsd = types.schema();
-                xsd.targetNamespace(tns);
-                xsds.put(tns, xsd);
-            }
-            Element e =  xsd._element(Element.class);
-            e._attribute("name", wp.getName().getLocalPart());
-            e.type(wp.getName());
-            ComplexType ct =  xsd._element(ComplexType.class);
-            ct._attribute("name", wp.getName().getLocalPart());
-            ExplicitGroup sq = ct.sequence();
-            for (ParameterImpl p : wp.getWrapperChildren() ) {
-                if (p.getBinding().isBody()) {
-                    LocalElement le = sq.element();
-                    le._attribute("name", p.getName().getLocalPart());
-                    TypeInfo typeInfo = p.getItemType();
-                    boolean repeatedElement = false;
-                    if (typeInfo == null) {
-                        typeInfo = p.getTypeInfo();
-                    } else {
-                        repeatedElement = true;
-                    }
-                    QName type = model.getBindingContext().getTypeName(typeInfo);
-                    le.type(type);
-                    if (repeatedElement) {
-                        le.minOccurs(0);
-                        le.maxOccurs("unbounded");
-                    }
-                }
-            }
-        }
     }
 
     /**
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JAnnotatable.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JAnnotatable.java
index 012f0891883..022ce070944 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JAnnotatable.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JAnnotatable.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,6 +49,14 @@ public interface JAnnotatable {
      */
     JAnnotationUse annotate(Class <? extends Annotation> clazz);
 
+    /**
+     * Removes annotation from this program element.
+     *
+     * @param annotation
+     *          The annotation to be removed from the program element
+     */
+    boolean removeAnnotation(JAnnotationUse annotation);
+
     /**
      * Adds an annotation to this program element
      * and returns a type-safe writer to fill in the values of such annotations.
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JAnnotationArrayMember.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JAnnotationArrayMember.java
index f4b3f9e315e..08d70ddd5dc 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JAnnotationArrayMember.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JAnnotationArrayMember.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -252,6 +252,11 @@ public final class JAnnotationArrayMember extends JAnnotationValue implements JA
         return a;
     }
 
+
+    public boolean removeAnnotation(JAnnotationUse annotation) {
+        return this.values.remove(annotation);
+    }
+
     public <W extends JAnnotationWriter> W annotate2(Class<W> clazz) {
         return TypedAnnotationWriter.create(clazz,this);
     }
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JDefinedClass.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JDefinedClass.java
index d0b234864d1..e54c0c56852 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JDefinedClass.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JDefinedClass.java
@@ -895,6 +895,10 @@ public class JDefinedClass
         return TypedAnnotationWriter.create(clazz,this);
     }
 
+    public boolean removeAnnotation(JAnnotationUse annotation) {
+        return this.annotations.remove(annotation);
+    }
+
     /**
      * {@link JAnnotatable#annotations()}
      */
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JEnumConstant.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JEnumConstant.java
index c2bd9705633..cf49c8a58df 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JEnumConstant.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JEnumConstant.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -132,6 +132,9 @@ public final class JEnumConstant extends JExpressionImpl implements JDeclaration
         return TypedAnnotationWriter.create(clazz,this);
     }
 
+    public boolean removeAnnotation(JAnnotationUse annotation) {
+        return this.annotations.remove(annotation);
+    }
     /**
      * {@link JAnnotatable#annotations()}
      */
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JMethod.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JMethod.java
index a77b6fce4d1..f6831ebba7a 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JMethod.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JMethod.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -267,6 +267,10 @@ public class JMethod extends JGenerifiableImpl implements JDeclaration, JAnnotat
         return TypedAnnotationWriter.create(clazz,this);
     }
 
+    public boolean removeAnnotation(JAnnotationUse annotation) {
+        return this.annotations.remove(annotation);
+    }
+
     public Collection<JAnnotationUse> annotations() {
         if (annotations == null)
             annotations = new ArrayList<JAnnotationUse>();
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JPackage.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JPackage.java
index e0d5ff144e4..9b9b174ba8c 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JPackage.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JPackage.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -388,6 +388,10 @@ public final class JPackage implements JDeclaration, JGenerable, JClassContainer
         return TypedAnnotationWriter.create(clazz,this);
     }
 
+    public boolean removeAnnotation(JAnnotationUse annotation) {
+        return this.annotations.remove(annotation);
+    }
+
     public Collection<JAnnotationUse> annotations() {
         if (annotations == null)
             annotations = new ArrayList<JAnnotationUse>();
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JVar.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JVar.java
index cee5c0ed5fa..2adbe59624b 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JVar.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/JVar.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -177,6 +177,10 @@ public class JVar extends JExpressionImpl implements JDeclaration, JAssignmentTa
         return TypedAnnotationWriter.create(clazz,this);
     }
 
+    public boolean removeAnnotation(JAnnotationUse annotation) {
+        return this.annotations.remove(annotation);
+    }
+
     public Collection<JAnnotationUse> annotations() {
         if (annotations == null)
             annotations = new ArrayList<JAnnotationUse>();
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/util/JavadocEscapeWriter.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/util/JavadocEscapeWriter.java
index 0651b12c20c..9a9fae31705 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/util/JavadocEscapeWriter.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/codemodel/internal/util/JavadocEscapeWriter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -61,6 +61,9 @@ public class JavadocEscapeWriter extends FilterWriter {
         else
         if(ch=='&')
             out.write("&amp;");
+        else
+        if(ch=='>')
+            out.write("&gt;");
         else
             out.write(ch);
     }
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties
index 4cca2e5f744..d8194d0aa17 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle.properties
@@ -30,10 +30,10 @@ BASEDIR_DOESNT_EXIST = \
     Non-existent directory: {0}
 
 VERSION = \
-        schemagen 2.2.11-b140528.1207
+        schemagen 2.2.12-b141016.1821
 
 FULLVERSION = \
-        schemagen full version "2.2.11-b140528.1207"
+        schemagen full version "2.2.12-b141016.1821"
 
 USAGE = \
 Usage: schemagen [-options ...] <java files> \n\
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_de.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_de.properties
index 7b1a1a4a1c0..fff47122d87 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_de.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_de.properties
@@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = Nicht erkanntes {0} in Zeile {1} Spalte {2}
 
 BASEDIR_DOESNT_EXIST = Nicht vorhandenes Verzeichnis: {0}
 
-VERSION = schemagen 2.2.11-b140528.1207
+VERSION = schemagen 2.2.12-b141016.1821
 
-FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.11-b140528.1207"
+FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.12-b141016.1821"
 
 USAGE = Verwendung: schemagen [-options ...] <java files> \nOptionen: \n\\ \\ \\ \\ -d <path>             : Gibt an, wo die von Prozessor und javac generierten Klassendateien gespeichert werden sollen\n\\ \\ \\ \\ -cp <path>            : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -classpath <path>     : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -encoding <encoding>  : Gibt die Codierung f\u00FCr die Annotationsverarbeitung/den javac-Aufruf an \n\\ \\ \\ \\ -episode <file>       : Generiert Episodendatei f\u00FCr separate Kompilierung\n\\ \\ \\ \\ -version              : Zeigt Versionsinformation an\n\\ \\ \\ \\ -fullversion          : Zeigt vollst\u00E4ndige Versionsinformationen an\n\\ \\ \\ \\ -help                 : Zeigt diese Verwendungsmeldung an
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_es.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_es.properties
index 33eb90a5fe9..60ecdc915a5 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_es.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_es.properties
@@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = Aparece un {0} inesperado en la l\u00EDnea {1} y la colu
 
 BASEDIR_DOESNT_EXIST = Directorio no existente: {0}
 
-VERSION = schemagen 2.2.11-b140528.1207
+VERSION = schemagen 2.2.12-b141016.1821
 
-FULLVERSION = versi\u00F3n completa de schemagen "2.2.11-b140528.1207"
+FULLVERSION = versi\u00F3n completa de schemagen "2.2.12-b141016.1821"
 
 USAGE = Sintaxis: schemagen [-options ...] <archivos java> \nOpciones: \n\\ \\ \\ \\ -d <ruta de acceso>             : especifique d\u00F3nde se colocan los archivos de clase generados por javac y el procesador\n\\ \\ \\ \\ -cp <ruta de acceso>            : especifique d\u00F3nde se encuentran los archivos especificados por el usuario\n\\ \\ \\ \\ -encoding <codificaci\u00F3n>  : especifique la codificaci\u00F3n que se va a utilizar para el procesamiento de anotaciones/llamada de javac\n\\ \\ \\ \\ -episode <archivo>       : genera un archivo de episodio para una compilaci\u00F3n diferente\n\\ \\ \\ \\ -version              : muestra la informaci\u00F3n de la versi\u00F3n\n\\ \\ \\ \\ -fullversion          : muestra la informaci\u00F3n completa de la versi\u00F3n\n\\ \\ \\ \\ -help                 : muestra este mensaje de sintaxis
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties
index b3f02685312..1b9109796f0 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties
@@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = Un \u00E9l\u00E9ment {0} inattendu appara\u00EEt \u00E0
 
 BASEDIR_DOESNT_EXIST = R\u00E9pertoire {0} inexistant
 
-VERSION = schemagen 2.2.11-b140528.1207
+VERSION = schemagen 2.2.12-b141016.1821
 
-FULLVERSION = version compl\u00E8te de schemagen "2.2.11-b140528.1207"
+FULLVERSION = version compl\u00E8te de schemagen "2.2.12-b141016.1821"
 
 USAGE = Syntaxe : schemagen [-options ...] <java files> \nOptions : \n\ \ \ \ -d <path> : indiquez o\u00F9 placer les fichiers de classe g\u00E9n\u00E9r\u00E9s par le processeur et le compilateur javac\n\ \ \ \ -cp <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -classpath <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -encoding <encoding> : indiquez l'encodage \u00E0 utiliser pour l'appel de javac/traitement de l'annotation \n\ \ \ \ -episode <file> : g\u00E9n\u00E9rez un fichier d'\u00E9pisode pour la compilation s\u00E9par\u00E9e\n\ \ \ \ -version : affichez les informations de version\n\ \ \ \ -fullversion : affichez les informations compl\u00E8tes de version\n\ \ \ \ -help : affichez ce message de syntaxe
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_it.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_it.properties
index bd0029a195d..ba82f11fe95 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_it.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_it.properties
@@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = {0} imprevisto visualizzato sulla riga {1} colonna {2}
 
 BASEDIR_DOESNT_EXIST = Directory non esistente: {0}
 
-VERSION = schemagen 2.2.11-b140528.1207
+VERSION = schemagen 2.2.12-b141016.1821
 
-FULLVERSION = versione completa schemagen "2.2.11-b140528.1207"
+FULLVERSION = versione completa schemagen "2.2.12-b141016.1821"
 
 USAGE = Uso: schemagen [-options ...] <java files> \nOpzioni: \n\ \ \ \ -d <path>             : specifica dove posizionare il processore e i file della classe generata javac\n\ \ \ \ -cp <path>            : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -classpath <path>     : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -encoding <encoding>  : specifica la codifica da usare per l'elaborazione dell'annotazione/richiamo javac \n\ \ \ \ -episode <file>       : genera il file di episodio per la compilazione separata\n\ \ \ \ -version              : visualizza le informazioni sulla versione\n\ \ \ \ -fullversion          : visualizza le informazioni sulla versione completa\n\ \ \ \ -help                 : visualizza questo messaggio sull'uso
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties
index a8aa8a74252..bd3107c2387 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties
@@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \u4E88\u671F\u3057\u306A\u3044{0}\u304C\u884C{1}\u3001\u
 
 BASEDIR_DOESNT_EXIST = \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u5B58\u5728\u3057\u307E\u305B\u3093: {0}
 
-VERSION = schemagen 2.2.11-b140528.1207
+VERSION = schemagen 2.2.12-b141016.1821
 
-FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.11-b140528.1207"
+FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b141016.1821"
 
 USAGE = \u4F7F\u7528\u65B9\u6CD5: schemagen [-options ...] <java files> \n\u30AA\u30D7\u30B7\u30E7\u30F3: \n\ \ \ \ -d <path>             : \u30D7\u30ED\u30BB\u30C3\u30B5\u304A\u3088\u3073javac\u304C\u751F\u6210\u3057\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -cp <path>            : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -classpath <path>     : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -encoding <encoding>  : \u6CE8\u91C8\u51E6\u7406/javac\u547C\u51FA\u3057\u306B\u4F7F\u7528\u3059\u308B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -episode <file>       : \u30B3\u30F3\u30D1\u30A4\u30EB\u3054\u3068\u306B\u30A8\u30D4\u30BD\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3057\u307E\u3059\n\ \ \ \ -version              : \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -fullversion          : \u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -help                 : \u3053\u306E\u4F7F\u7528\u4F8B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u307E\u3059
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties
index 9af99916c29..642294c211d 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties
@@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \uC608\uC0C1\uCE58 \uC54A\uC740 {0}\uC774(\uAC00) {1}\uD
 
 BASEDIR_DOESNT_EXIST = \uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uB514\uB809\uD1A0\uB9AC: {0}
 
-VERSION = schemagen 2.2.11-b140528.1207
+VERSION = schemagen 2.2.12-b141016.1821
 
-FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.11-b140528.1207"
+FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.12-b141016.1821"
 
 USAGE = \uC0AC\uC6A9\uBC95: schemagen [-options ...] <java files> \n\uC635\uC158: \n\ \ \ \ -d <path>             : \uD504\uB85C\uC138\uC11C \uBC0F javac\uC5D0\uC11C \uC0DD\uC131\uD55C \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uBC30\uCE58\uD560 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -cp <path>            : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -classpath <path>     : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -encoding <encoding>  : \uC8FC\uC11D \uCC98\uB9AC/javac \uD638\uCD9C\uC5D0 \uC0AC\uC6A9\uD560 \uC778\uCF54\uB529\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4. \n\ \ \ \ -episode <file>       : \uBCC4\uB3C4 \uCEF4\uD30C\uC77C\uC744 \uC704\uD574 episode \uD30C\uC77C\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ \ \ -version              : \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -fullversion          : \uC815\uC2DD \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -help                 : \uC774 \uC0AC\uC6A9\uBC95 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties
index 8e711c63fc3..c4284ad4ff2 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties
@@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = {0} inesperado aparece na linha {1} coluna {2}
 
 BASEDIR_DOESNT_EXIST = Diret\u00F3rio n\u00E3o existente: {0}
 
-VERSION = gera\u00E7\u00E3o do esquema 2.2.11-b140528.1207
+VERSION = gera\u00E7\u00E3o do esquema 2.2.12-b141016.1821
 
-FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.11-b140528.1207"
+FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.12-b141016.1821"
 
 USAGE = Uso: gera\u00E7\u00E3o do esquema [-options ...] <java files> \nOp\u00E7\u00F5es: \n\\ \\ \\ \\ -d <path>             : especificar onde colocar o processador e os arquivos da classe gerados por javac\n\\ \\ \\ \\ -cp <path>            : especificar onde localizar arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -classpath <path>     : especificar onde localizar os arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -encoding <encoding>  : especificar codifica\u00E7\u00E3o a ser usada para processamento de anota\u00E7\u00E3o/chamada javac \n\\ \\ \\ \\ -episode <file>       : gerar arquivo do epis\u00F3dio para compila\u00E7\u00E3o separada\n\\ \\ \\ \\ -version              : exibir informa\u00E7\u00F5es da vers\u00E3o\n\\ \\ \\ \\ -fullversion          : exibir informa\u00E7\u00F5es da vers\u00E3o completa\n\\ \\ \\ \\ -help                 : exibir esta mensagem de uso
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties
index b4ca2ef4543..c89cc1ebf51 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties
@@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \u5728\u7B2C {1} \u884C, \u7B2C {2} \u5217\u51FA\u73B0\u
 
 BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u5F55: {0}
 
-VERSION = schemagen 2.2.11-b140528.1207
+VERSION = schemagen 2.2.12-b141016.1821
 
-FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.11-b140528.1207"
+FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b141016.1821"
 
 USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9009\u9879: \n\ \ \ \ -d <path>             : \u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -cp <path>            : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -classpath <path>     : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -encoding <encoding>  : \u6307\u5B9A\u7528\u4E8E\u6CE8\u91CA\u5904\u7406/javac \u8C03\u7528\u7684\u7F16\u7801\n\ \ \ \ -episode <file>       : \u751F\u6210\u7247\u6BB5\u6587\u4EF6\u4EE5\u4F9B\u5355\u72EC\u7F16\u8BD1\n\ \ \ \ -version              : \u663E\u793A\u7248\u672C\u4FE1\u606F\n\ \ \ \ -fullversion          : \u663E\u793A\u5B8C\u6574\u7684\u7248\u672C\u4FE1\u606F\n\ \ \ \ -help                 : \u663E\u793A\u6B64\u7528\u6CD5\u6D88\u606F
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties
index c39f1295219..f6e5241eebc 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties
@@ -27,8 +27,8 @@ UNEXPECTED_NGCC_TOKEN = \u672A\u9810\u671F\u7684 {0} \u986F\u793A\u65BC\u884C {1
 
 BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u9304: {0}
 
-VERSION = schemagen 2.2.11-b140528.1207
+VERSION = schemagen 2.2.12-b141016.1821
 
-FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.11-b140528.1207"
+FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.12-b141016.1821"
 
 USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9078\u9805: \n\\ \\ \\ \\ -d <path>             : \u6307\u5B9A\u8655\u7406\u5668\u4EE5\u53CA javac \u7522\u751F\u7684\u985E\u5225\u6A94\u6848\u653E\u7F6E\u4F4D\u7F6E\n\\ \\ \\ \\ -cp <path>            : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -classpath <path>     : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -encoding <encoding>  : \u6307\u5B9A\u8981\u7528\u65BC\u8A3B\u89E3\u8655\u7406/javac \u547C\u53EB\u7684\u7DE8\u78BC \n\\ \\ \\ \\ -episode <file>       : \u7522\u751F\u7368\u7ACB\u7DE8\u8B6F\u7684\u4E8B\u4EF6 (episode) \u6A94\u6848\n\\ \\ \\ \\ -version              : \u986F\u793A\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -fullversion          : \u986F\u793A\u5B8C\u6574\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -help                 : \u986F\u793A\u6B64\u7528\u6CD5\u8A0A\u606F
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java
index cd4619ad336..47d62d8e713 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/SchemaGenerator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -57,6 +57,9 @@ import java.util.logging.Logger;
  * @author Bhakti Mehta
  */
 public class SchemaGenerator {
+
+    private static final Logger LOGGER = Logger.getLogger(SchemaGenerator.class.getName());
+
     /**
      * Runs the schema generator.
      */
@@ -72,7 +75,7 @@ public class SchemaGenerator {
             }
             return run(args, cl);
         } catch(Exception e) {
-            System.err.println(e.getMessage());
+            LOGGER.log(Level.SEVERE, e.getMessage(), e);
             return -1;
         }
     }
@@ -206,9 +209,9 @@ public class SchemaGenerator {
                 return f.getPath();
             }
         } catch (URISyntaxException ex) {
-            Logger.getLogger(SchemaGenerator.class.getName()).log(Level.SEVERE, null, ex);
+            LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
         } catch (MalformedURLException ex) {
-            Logger.getLogger(SchemaGenerator.class.getName()).log(Level.SEVERE, null, ex);
+            LOGGER.log(Level.SEVERE, ex.getMessage(), ex);
         }
         return null;
     }
@@ -225,8 +228,9 @@ public class SchemaGenerator {
             StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null);
             JavacOptions options = JavacOptions.parse(compiler, fileManager, args);
             List<String> unrecognizedOptions = options.getUnrecognizedOptions();
-            if (!unrecognizedOptions.isEmpty())
-                Logger.getLogger(SchemaGenerator.class.getName()).log(Level.WARNING, "Unrecognized options found: {0}", unrecognizedOptions);
+            if (!unrecognizedOptions.isEmpty()) {
+                LOGGER.log(Level.WARNING, "Unrecognized options found: {0}", unrecognizedOptions);
+            }
             Iterable<? extends JavaFileObject> compilationUnits = fileManager.getJavaFileObjectsFromFiles(options.getFiles());
             JavaCompiler.CompilationTask task = compiler.getTask(
                     null,
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/Options.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/Options.java
index 18bf6aae87d..cb9b7883d92 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/Options.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/jxc/ap/Options.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -58,11 +58,7 @@ public class Options  {
     public void parseArguments(String[] args) throws BadCommandLineException {
         for (int i = 0 ; i <args.length; i++) {
             if (args[i].charAt(0)== '-') {
-                int j = parseArgument(args,i);
-                if(j==0)
-                    throw new BadCommandLineException(
-                            Messages.UNRECOGNIZED_PARAMETER.format(args[i]));
-                i += j;
+                i += parseArgument(args, i);
             } else {
                 arguments.add(args[i]);
             }
@@ -90,11 +86,8 @@ public class Options  {
         }
 
         if (args[i].equals(DISABLE_XML_SECURITY)) {
-            if (i == args.length - 1)
-                throw new BadCommandLineException(
-                        (Messages.OPERAND_MISSING.format(args[i])));
             disableXmlSecurity = true;
-            return 1;
+            return 0;
         }
 
         if (args[i].equals("-encoding")) {
@@ -114,8 +107,8 @@ public class Options  {
             return 1;
         }
 
-        return 0;
-
+        throw new BadCommandLineException(
+                Messages.UNRECOGNIZED_PARAMETER.format(args[i]));
     }
 
     /**
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties
index b8d84282b0a..adbe668bfb0 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle.properties
@@ -171,20 +171,20 @@ Driver.CompilingSchema = \
 Driver.FailedToGenerateCode = \
         Failed to produce code.
 
-# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
+# DO NOT localize the 2.2.12-b141016.1821 string - it is a token for an mvn <properties filter>
 Driver.FilePrologComment = \
-        This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11-b140528.1207 \n\
+        This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b141016.1821 \n\
         See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\
         Any modifications to this file will be lost upon recompilation of the source schema. \n\
         Generated on: {0} \n
 
 Driver.Version = \
-        xjc 2.2.11-b140528.1207
+        xjc 2.2.12-b141016.1821
 
 Driver.FullVersion = \
-        xjc full version "2.2.11-b140528.1207"
+        xjc full version "2.2.12-b141016.1821"
 
-Driver.BuildID = 2.2.11-b140528.1207
+Driver.BuildID = 2.2.12-b141016.1821
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_de.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_de.properties
index 4da4e04ba3e..df277d39716 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_de.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_de.properties
@@ -96,14 +96,14 @@ Driver.CompilingSchema = Ein Schema wird kompiliert ...
 
 Driver.FailedToGenerateCode = Code konnte nicht erzeugt werden.
 
-# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11-b140528.1207 generiert \nSiehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n
+# DO NOT localize the 2.2.12-b141016.1821 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b141016.1821 generiert \nSiehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n
 
-Driver.Version = xjc 2.2.11-b140528.1207
+Driver.Version = xjc 2.2.12-b141016.1821
 
-Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.11-b140528.1207"
+Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.12-b141016.1821"
 
-Driver.BuildID = 2.2.11-b140528.1207
+Driver.BuildID = 2.2.12-b141016.1821
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_es.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_es.properties
index 67232a962ab..d27e3ef36d3 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_es.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_es.properties
@@ -96,14 +96,14 @@ Driver.CompilingSchema = Compilando un esquema...
 
 Driver.FailedToGenerateCode = Fallo al producir c\u00f3digo.
 
-# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.11-b140528.1207 \nVisite <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n
+# DO NOT localize the 2.2.12-b141016.1821 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.12-b141016.1821 \nVisite <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n
 
-Driver.Version = xjc 2.2.11-b140528.1207
+Driver.Version = xjc 2.2.12-b141016.1821
 
-Driver.FullVersion = versi\u00F3n completa de xjc "2.2.11-b140528.1207"
+Driver.FullVersion = versi\u00F3n completa de xjc "2.2.12-b141016.1821"
 
-Driver.BuildID = 2.2.11-b140528.1207
+Driver.BuildID = 2.2.12-b141016.1821
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties
index 6c53d943abe..8f3deded4f1 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties
@@ -96,14 +96,14 @@ Driver.CompilingSchema = compilation d'un sch\u00e9ma...
 
 Driver.FailedToGenerateCode = Echec de la production du code.
 
-# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.11-b140528.1207 \nVoir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n
+# DO NOT localize the 2.2.12-b141016.1821 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.12-b141016.1821 \nVoir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n
 
-Driver.Version = xjc 2.2.11-b140528.1207
+Driver.Version = xjc 2.2.12-b141016.1821
 
-Driver.FullVersion = version compl\u00E8te xjc "2.2.11-b140528.1207"
+Driver.FullVersion = version compl\u00E8te xjc "2.2.12-b141016.1821"
 
-Driver.BuildID = 2.2.11-b140528.1207
+Driver.BuildID = 2.2.12-b141016.1821
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_it.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_it.properties
index 5496cc310e2..21f60a899e8 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_it.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_it.properties
@@ -96,14 +96,14 @@ Driver.CompilingSchema = compilazione di uno schema in corso...
 
 Driver.FailedToGenerateCode = Produzione del codice non riuscita.
 
-# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.11-b140528.1207 \nVedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n
+# DO NOT localize the 2.2.12-b141016.1821 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.12-b141016.1821 \nVedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n
 
-Driver.Version = xjc 2.2.11-b140528.1207
+Driver.Version = xjc 2.2.12-b141016.1821
 
-Driver.FullVersion = versione completa xjc "2.2.11-b140528.1207"
+Driver.FullVersion = versione completa xjc "2.2.12-b141016.1821"
 
-Driver.BuildID = 2.2.11-b140528.1207
+Driver.BuildID = 2.2.12-b141016.1821
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties
index 6bbc0ee7937..342dbcaca62 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties
@@ -96,14 +96,14 @@ Driver.CompilingSchema = \u30b9\u30ad\u30fc\u30de\u306e\u30b3\u30f3\u30d1\u30a4\
 
 Driver.FailedToGenerateCode = \u30b3\u30fc\u30c9\u306e\u751f\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002
 
-# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.11-b140528.1207\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n
+# DO NOT localize the 2.2.12-b141016.1821 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.12-b141016.1821\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n
 
-Driver.Version = xjc 2.2.11-b140528.1207
+Driver.Version = xjc 2.2.12-b141016.1821
 
-Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.11-b140528.1207"
+Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.12-b141016.1821"
 
-Driver.BuildID = 2.2.11-b140528.1207
+Driver.BuildID = 2.2.12-b141016.1821
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties
index 06820b7ba72..97cf258262e 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties
@@ -96,14 +96,14 @@ Driver.CompilingSchema = \uc2a4\ud0a4\ub9c8\ub97c \ucef4\ud30c\uc77c\ud558\ub294
 
 Driver.FailedToGenerateCode = \ucf54\ub4dc \uc0dd\uc131\uc744 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4.
 
-# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.11-b140528.1207 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n
+# DO NOT localize the 2.2.12-b141016.1821 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.12-b141016.1821 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n
 
-Driver.Version = XJC 2.2.11-b140528.1207
+Driver.Version = XJC 2.2.12-b141016.1821
 
-Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.11-b140528.1207"
+Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.12-b141016.1821"
 
-Driver.BuildID = 2.2.11-b140528.1207
+Driver.BuildID = 2.2.12-b141016.1821
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties
index 91ebf60b28c..395ede3aefc 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties
@@ -96,14 +96,14 @@ Driver.CompilingSchema = compilando um esquema...
 
 Driver.FailedToGenerateCode = Falha ao produzir o c\u00f3digo.
 
-# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.11-b140528.1207 \nConsulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n
+# DO NOT localize the 2.2.12-b141016.1821 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.12-b141016.1821 \nConsulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n
 
-Driver.Version = xjc 2.2.11-b140528.1207
+Driver.Version = xjc 2.2.12-b141016.1821
 
-Driver.FullVersion = vers\u00E3o completa de xjc "2.2.11-b140528.1207"
+Driver.FullVersion = vers\u00E3o completa de xjc "2.2.12-b141016.1821"
 
-Driver.BuildID = 2.2.11-b140528.1207
+Driver.BuildID = 2.2.12-b141016.1821
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties
index cea171b5208..048488a1500 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties
@@ -96,14 +96,14 @@ Driver.CompilingSchema = \u6b63\u5728\u7f16\u8bd1\u6a21\u5f0f...
 
 Driver.FailedToGenerateCode = \u65e0\u6cd5\u751f\u6210\u4ee3\u7801\u3002
 
-# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.11-b140528.1207 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n
+# DO NOT localize the 2.2.12-b141016.1821 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.12-b141016.1821 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n
 
-Driver.Version = xjc 2.2.11-b140528.1207
+Driver.Version = xjc 2.2.12-b141016.1821
 
-Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.11-b140528.1207"
+Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b141016.1821"
 
-Driver.BuildID = 2.2.11-b140528.1207
+Driver.BuildID = 2.2.12-b141016.1821
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties
index 99a89597e66..185fc08bdb7 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties
@@ -96,14 +96,14 @@ Driver.CompilingSchema = \u6b63\u5728\u7de8\u8b6f\u7db1\u8981...
 
 Driver.FailedToGenerateCode = \u7121\u6cd5\u7522\u751f\u7a0b\u5f0f\u78bc.
 
-# DO NOT localize the 2.2.11-b140528.1207 string - it is a token for an mvn <properties filter>
-Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.11-b140528.1207 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n
+# DO NOT localize the 2.2.12-b141016.1821 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.12-b141016.1821 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n
 
-Driver.Version = xjc 2.2.11-b140528.1207
+Driver.Version = xjc 2.2.12-b141016.1821
 
-Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.11-b140528.1207"
+Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.12-b141016.1821"
 
-Driver.BuildID = 2.2.11-b140528.1207
+Driver.BuildID = 2.2.12-b141016.1821
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/addon/episode/PluginImpl.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/addon/episode/PluginImpl.java
index 25176eee4cb..875d6889083 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/addon/episode/PluginImpl.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/addon/episode/PluginImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,24 +25,15 @@
 
 package com.sun.tools.internal.xjc.addon.episode;
 
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
 import com.sun.tools.internal.xjc.BadCommandLineException;
 import com.sun.tools.internal.xjc.Options;
 import com.sun.tools.internal.xjc.Plugin;
 import com.sun.tools.internal.xjc.outline.ClassOutline;
-import com.sun.tools.internal.xjc.outline.Outline;
 import com.sun.tools.internal.xjc.outline.EnumOutline;
+import com.sun.tools.internal.xjc.outline.Outline;
 import com.sun.tools.internal.xjc.reader.Const;
+import com.sun.xml.internal.bind.v2.schemagen.episode.Bindings;
+import com.sun.xml.internal.bind.v2.schemagen.episode.SchemaBindings;
 import com.sun.xml.internal.txw2.TXW;
 import com.sun.xml.internal.txw2.output.StreamSerializer;
 import com.sun.xml.internal.xsom.XSAnnotation;
@@ -65,13 +56,21 @@ import com.sun.xml.internal.xsom.XSSimpleType;
 import com.sun.xml.internal.xsom.XSWildcard;
 import com.sun.xml.internal.xsom.XSXPath;
 import com.sun.xml.internal.xsom.visitor.XSFunction;
-import com.sun.xml.internal.bind.v2.schemagen.episode.Bindings;
-import com.sun.xml.internal.bind.v2.schemagen.episode.SchemaBindings;
-
 import org.xml.sax.ErrorHandler;
 import org.xml.sax.SAXException;
 import org.xml.sax.SAXParseException;
 
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * Creates the episode file,
  *
@@ -106,7 +105,7 @@ public class PluginImpl extends Plugin {
         try {
             // reorganize qualifying components by their namespaces to
             // generate the list nicely
-            Map<XSSchema, PerSchemaOutlineAdaptors> perSchema = new HashMap<XSSchema,PerSchemaOutlineAdaptors>();
+            Map<XSSchema, PerSchemaOutlineAdaptors> perSchema = new LinkedHashMap<XSSchema, PerSchemaOutlineAdaptors>();
             boolean hasComponentInNoNamespace = false;
 
             // Combine classes and enums into a single list
@@ -172,10 +171,9 @@ public class PluginImpl extends Plugin {
                 group.scd("x-schema::"+(tns.equals("")?"":"tns"));
                 SchemaBindings schemaBindings = group.schemaBindings();
                                 schemaBindings.map(false);
-                                if (ps.packageNames.size() == 1)
-                                {
-                                        final String packageName = ps.packageNames.iterator().next();
-                                        if (packageName != null && packageName.length() > 0) {
+                if (ps.packageNames.size() == 1) {
+                    final String packageName = ps.packageNames.iterator().next();
+                    if (packageName != null && packageName.length() > 0) {
                                                 schemaBindings._package().name(packageName);
                                         }
                                 }
@@ -285,7 +283,6 @@ public class PluginImpl extends Plugin {
             CLASS(new BindingsBuilder() {
                 public void build(OutlineAdaptor adaptor, Bindings bindings) {
                     bindings.klass().ref(adaptor.implName);
-
                 }
             }),
             ENUM(new BindingsBuilder() {
@@ -304,7 +301,7 @@ public class PluginImpl extends Plugin {
                 void build(OutlineAdaptor adaptor, Bindings bindings);
             }
 
-        };
+        }
 
         private final XSComponent schemaComponent;
         private final OutlineType outlineType;
@@ -331,10 +328,9 @@ public class PluginImpl extends Plugin {
 
         private final Set<String> packageNames = new HashSet<String>();
 
-        private void add(OutlineAdaptor outlineAdaptor)
-        {
-                this.outlineAdaptors.add(outlineAdaptor);
-                this.packageNames.add(outlineAdaptor.packageName);
+        private void add(OutlineAdaptor outlineAdaptor) {
+            this.outlineAdaptors.add(outlineAdaptor);
+            this.packageNames.add(outlineAdaptor.packageName);
         }
 
     }
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/ElementAdapter.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/ElementAdapter.java
index 184d73f51ea..655d8416ab0 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/ElementAdapter.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/ElementAdapter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,16 +31,12 @@ import javax.xml.namespace.QName;
 import com.sun.tools.internal.xjc.outline.FieldOutline;
 import com.sun.tools.internal.xjc.outline.ClassOutline;
 import com.sun.tools.internal.xjc.outline.FieldAccessor;
-import com.sun.tools.internal.xjc.outline.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 import com.sun.tools.internal.xjc.model.CPropertyInfo;
 import com.sun.tools.internal.xjc.model.CElementInfo;
 import com.sun.tools.internal.xjc.model.CReferencePropertyInfo;
-import com.sun.codemodel.internal.JType;
 import com.sun.codemodel.internal.JExpression;
 import com.sun.codemodel.internal.JBlock;
-import com.sun.codemodel.internal.JVar;
-import com.sun.codemodel.internal.JConditional;
 import com.sun.codemodel.internal.JExpr;
 import com.sun.codemodel.internal.JCodeModel;
 import com.sun.codemodel.internal.JInvocation;
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/ElementCollectionAdapter.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/ElementCollectionAdapter.java
index 937e244eae5..426a06b1b39 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/ElementCollectionAdapter.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/ElementCollectionAdapter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@ import com.sun.codemodel.internal.JForEach;
 import com.sun.codemodel.internal.JType;
 import com.sun.codemodel.internal.JVar;
 import com.sun.tools.internal.xjc.model.CElementInfo;
-import static com.sun.tools.internal.xjc.outline.Aspect.EXPOSED;
+import static com.sun.tools.internal.xjc.model.Aspect.EXPOSED;
 import com.sun.tools.internal.xjc.outline.FieldAccessor;
 import com.sun.tools.internal.xjc.outline.FieldOutline;
 
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/ElementSingleAdapter.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/ElementSingleAdapter.java
index e840468182d..cad3f700def 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/ElementSingleAdapter.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/ElementSingleAdapter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
 package com.sun.tools.internal.xjc.api.impl.s2j;
 
 import javax.xml.bind.JAXBElement;
-import javax.xml.namespace.QName;
 
 import com.sun.codemodel.internal.JType;
 import com.sun.codemodel.internal.JBlock;
@@ -34,9 +33,7 @@ import com.sun.codemodel.internal.JVar;
 import com.sun.codemodel.internal.JConditional;
 import com.sun.codemodel.internal.JExpr;
 import com.sun.codemodel.internal.JExpression;
-import com.sun.codemodel.internal.JCodeModel;
-import com.sun.codemodel.internal.JInvocation;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.tools.internal.xjc.outline.FieldOutline;
 import com.sun.tools.internal.xjc.outline.FieldAccessor;
 import com.sun.tools.internal.xjc.model.CElementInfo;
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/TypeAndAnnotationImpl.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/TypeAndAnnotationImpl.java
index a6a242c7899..444a5576175 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/TypeAndAnnotationImpl.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/api/impl/s2j/TypeAndAnnotationImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@ import com.sun.tools.internal.xjc.generator.annotation.spec.XmlJavaTypeAdapterWr
 import com.sun.tools.internal.xjc.model.CAdapter;
 import com.sun.tools.internal.xjc.model.TypeUse;
 import com.sun.tools.internal.xjc.model.nav.NType;
-import static com.sun.tools.internal.xjc.outline.Aspect.EXPOSED;
+import static com.sun.tools.internal.xjc.model.Aspect.EXPOSED;
 import com.sun.tools.internal.xjc.outline.Outline;
 import com.sun.xml.internal.bind.v2.runtime.SwaRefAdapterMarker;
 
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/BeanGenerator.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/BeanGenerator.java
index 740191addfa..a8082b3eb35 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/BeanGenerator.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/BeanGenerator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 
 package com.sun.tools.internal.xjc.generator.bean;
 
-import static com.sun.tools.internal.xjc.outline.Aspect.EXPOSED;
+import static com.sun.tools.internal.xjc.model.Aspect.EXPOSED;
 
 import java.io.Serializable;
 import java.net.URL;
@@ -90,7 +90,7 @@ import com.sun.tools.internal.xjc.model.CPropertyInfo;
 import com.sun.tools.internal.xjc.model.CTypeRef;
 import com.sun.tools.internal.xjc.model.Model;
 import com.sun.tools.internal.xjc.model.CClassRef;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.tools.internal.xjc.outline.ClassOutline;
 import com.sun.tools.internal.xjc.outline.EnumConstantOutline;
 import com.sun.tools.internal.xjc.outline.EnumOutline;
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/ElementOutlineImpl.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/ElementOutlineImpl.java
index 6e0c0d88794..c0ed6134d6a 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/ElementOutlineImpl.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/ElementOutlineImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -39,7 +39,7 @@ import com.sun.codemodel.internal.JMethod;
 import com.sun.codemodel.internal.JMod;
 import com.sun.codemodel.internal.JType;
 import com.sun.tools.internal.xjc.model.CElementInfo;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.tools.internal.xjc.outline.ElementOutline;
 
 /**
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/ImplStructureStrategy.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/ImplStructureStrategy.java
index 4c3a27a779a..5e3a32d0876 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/ImplStructureStrategy.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/ImplStructureStrategy.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,7 @@ import com.sun.codemodel.internal.JType;
 import com.sun.codemodel.internal.JVar;
 import com.sun.tools.internal.xjc.generator.annotation.spec.XmlAccessorTypeWriter;
 import com.sun.tools.internal.xjc.model.CClassInfo;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 
 /**
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/MessageBundle.properties b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/MessageBundle.properties
index 81a5aa8f65f..54a0ed9d70b 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/MessageBundle.properties
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/MessageBundle.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 METHOD_COLLISION = \
         The "{0}" method is defined on both "{1}" and "{2}" and is causing a collision.
 
-# {0} - enumeration constant value (but something that couldn�t be translated to a valid java identifier e.g. starting special character, number, ..)    e.g. Cannot derive a valid Java identifier from "5.6.0". Specify a customization to change the name.
+# {0} - enumeration constant value (but something that couldn't be translated to a valid java identifier e.g. starting special character, number, ..)    e.g. Cannot derive a valid Java identifier from "5.6.0". Specify a customization to change the name.
 ERR_UNUSABLE_NAME = \
         Cannot derive a valid Java identifier from "{0}". Specify a customization to change the name.
 
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/ObjectFactoryGeneratorImpl.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/ObjectFactoryGeneratorImpl.java
index 1c10742a669..71d6a5d551a 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/ObjectFactoryGeneratorImpl.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/ObjectFactoryGeneratorImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,7 @@ import com.sun.tools.internal.xjc.model.CElementInfo;
 import com.sun.tools.internal.xjc.model.CPropertyInfo;
 import com.sun.tools.internal.xjc.model.Constructor;
 import com.sun.tools.internal.xjc.model.Model;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.tools.internal.xjc.outline.FieldAccessor;
 import com.sun.tools.internal.xjc.outline.FieldOutline;
 import com.sun.xml.internal.bind.v2.TODO;
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/PackageOutlineImpl.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/PackageOutlineImpl.java
index afaf1e62c56..04d024c3b87 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/PackageOutlineImpl.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/PackageOutlineImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -49,7 +49,7 @@ import com.sun.tools.internal.xjc.model.CTypeRef;
 import com.sun.tools.internal.xjc.model.CValuePropertyInfo;
 import com.sun.tools.internal.xjc.model.Model;
 import com.sun.tools.internal.xjc.outline.PackageOutline;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 
 /**
  * {@link PackageOutline} enhanced with schema2java specific
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/PrivateObjectFactoryGenerator.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/PrivateObjectFactoryGenerator.java
index bd1c1fbab7a..b43bd348af9 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/PrivateObjectFactoryGenerator.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/PrivateObjectFactoryGenerator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -32,7 +32,7 @@ import com.sun.codemodel.internal.JPackage;
 import com.sun.codemodel.internal.fmt.JPropertyFile;
 import com.sun.tools.internal.xjc.model.CElementInfo;
 import com.sun.tools.internal.xjc.model.Model;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.tools.internal.xjc.runtime.JAXBContextFactory;
 
 /**
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/PublicObjectFactoryGenerator.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/PublicObjectFactoryGenerator.java
index 4f3c8bca66a..31afd1df0ee 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/PublicObjectFactoryGenerator.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/PublicObjectFactoryGenerator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@ package com.sun.tools.internal.xjc.generator.bean;
 import com.sun.codemodel.internal.JPackage;
 import com.sun.tools.internal.xjc.model.CElementInfo;
 import com.sun.tools.internal.xjc.model.Model;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 
 /**
  * Generates public ObjectFactory.
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/AbstractField.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/AbstractField.java
index 871813da056..79a7c2084d3 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/AbstractField.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/AbstractField.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -63,8 +63,8 @@ import com.sun.tools.internal.xjc.model.CTypeInfo;
 import com.sun.tools.internal.xjc.model.CTypeRef;
 import com.sun.tools.internal.xjc.model.CValuePropertyInfo;
 import com.sun.tools.internal.xjc.model.nav.NClass;
-import com.sun.tools.internal.xjc.outline.Aspect;
-import static com.sun.tools.internal.xjc.outline.Aspect.IMPLEMENTATION;
+import com.sun.tools.internal.xjc.model.Aspect;
+import static com.sun.tools.internal.xjc.model.Aspect.IMPLEMENTATION;
 import com.sun.tools.internal.xjc.outline.ClassOutline;
 import com.sun.tools.internal.xjc.outline.FieldAccessor;
 import com.sun.tools.internal.xjc.outline.FieldOutline;
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/ContentListField.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/ContentListField.java
index 1d6e2beba9a..0535385cefe 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/ContentListField.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/ContentListField.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,7 @@ import com.sun.codemodel.internal.JVar;
 import com.sun.tools.internal.xjc.generator.bean.ClassOutlineImpl;
 import com.sun.tools.internal.xjc.generator.bean.MethodWriter;
 import com.sun.tools.internal.xjc.model.CPropertyInfo;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.xml.internal.bind.api.impl.NameConverter;
 import java.io.Serializable;
 
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/NoExtendedContentField.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/NoExtendedContentField.java
index 31d582e28b8..b1fe84d32de 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/NoExtendedContentField.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/NoExtendedContentField.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -40,7 +40,7 @@ import com.sun.tools.internal.xjc.generator.bean.MethodWriter;
 import com.sun.tools.internal.xjc.model.CElement;
 import com.sun.tools.internal.xjc.model.CPropertyInfo;
 import com.sun.tools.internal.xjc.model.CReferencePropertyInfo;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.xml.internal.bind.api.impl.NameConverter;
 import java.io.Serializable;
 import java.util.Set;
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/UnboxedField.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/UnboxedField.java
index 55b62980e97..d1d60072d9e 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/UnboxedField.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/generator/bean/field/UnboxedField.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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 @@ import com.sun.codemodel.internal.JVar;
 import com.sun.tools.internal.xjc.generator.bean.ClassOutlineImpl;
 import com.sun.tools.internal.xjc.generator.bean.MethodWriter;
 import com.sun.tools.internal.xjc.model.CPropertyInfo;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.tools.internal.xjc.outline.FieldAccessor;
 import com.sun.xml.internal.bind.api.impl.NameConverter;
 
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/Aspect.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/Aspect.java
similarity index 93%
rename from jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/Aspect.java
rename to jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/Aspect.java
index fbcb4031559..7d825b60844 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/Aspect.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/Aspect.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
  * questions.
  */
 
-package com.sun.tools.internal.xjc.outline;
+package com.sun.tools.internal.xjc.model;
 
 import com.sun.tools.internal.xjc.generator.bean.ImplStructureStrategy;
 
@@ -35,8 +35,6 @@ import com.sun.tools.internal.xjc.generator.bean.ImplStructureStrategy;
  * This is an enumeration of all possible aspects.
  *
  * @author Kohsuke Kawaguchi
- *
- * TODO: move this to the model package
  */
 public enum Aspect {
     /**
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CAdapter.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CAdapter.java
index b4b7530f2ea..fb5ce6a5f5c 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CAdapter.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CAdapter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,6 @@ import com.sun.tools.internal.xjc.model.nav.EagerNClass;
 import com.sun.tools.internal.xjc.model.nav.NClass;
 import com.sun.tools.internal.xjc.model.nav.NType;
 import com.sun.tools.internal.xjc.model.nav.NavigatorImpl;
-import com.sun.tools.internal.xjc.outline.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 import com.sun.xml.internal.bind.v2.model.core.Adapter;
 
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CArrayInfo.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CArrayInfo.java
index 546753b25a5..2fc179cf2da 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CArrayInfo.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CArrayInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,6 @@ import com.sun.codemodel.internal.JType;
 import com.sun.xml.internal.bind.v2.model.util.ArrayInfoUtil;
 import com.sun.tools.internal.xjc.model.nav.NClass;
 import com.sun.tools.internal.xjc.model.nav.NType;
-import com.sun.tools.internal.xjc.outline.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 import com.sun.xml.internal.bind.v2.model.core.ArrayInfo;
 import com.sun.xml.internal.xsom.XSComponent;
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CAttributePropertyInfo.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CAttributePropertyInfo.java
index cdd2d0c6ee1..6c0f9c685ee 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CAttributePropertyInfo.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CAttributePropertyInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -85,6 +85,10 @@ public final class CAttributePropertyInfo extends CSingleTypePropertyInfo implem
     public <V> V accept(CPropertyVisitor<V> visitor) {
         return visitor.onAttribute(this);
     }
+    @Override
+    public <R, P> R accept(CPropertyVisitor2<R, P> visitor, P p) {
+        return visitor.visit(this, p);
+    }
 
     public final PropertyKind kind() {
         return  PropertyKind.ATTRIBUTE;
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CBuiltinLeafInfo.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CBuiltinLeafInfo.java
index 4b3e8db6d8a..d4f50da7f3c 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CBuiltinLeafInfo.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CBuiltinLeafInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -56,7 +56,6 @@ import com.sun.xml.internal.bind.v2.model.core.LeafInfo;
 import com.sun.xml.internal.bind.v2.runtime.Location;
 import com.sun.tools.internal.xjc.model.nav.NType;
 import com.sun.tools.internal.xjc.model.nav.NavigatorImpl;
-import com.sun.tools.internal.xjc.outline.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 import com.sun.tools.internal.xjc.runtime.ZeroOneBooleanAdapter;
 import com.sun.tools.internal.xjc.util.NamespaceContextAdapter;
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CClassInfo.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CClassInfo.java
index 2c8724218ac..c74ee55c578 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CClassInfo.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CClassInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -45,7 +45,6 @@ import com.sun.istack.internal.Nullable;
 import com.sun.tools.internal.xjc.Language;
 import com.sun.tools.internal.xjc.model.nav.NClass;
 import com.sun.tools.internal.xjc.model.nav.NType;
-import com.sun.tools.internal.xjc.outline.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 import com.sun.tools.internal.xjc.reader.Ring;
 import com.sun.tools.internal.xjc.reader.xmlschema.BGMBuilder;
@@ -57,7 +56,7 @@ import com.sun.xml.internal.xsom.XSComponent;
 import org.xml.sax.Locator;
 
 /**
- * Mutable {@link ClassInfo} represenatation.
+ * Mutable {@link ClassInfo} representation.
  *
  * <p>
  * Schema parsers build these objects.
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CClassRef.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CClassRef.java
index 013d5d510fa..f546e28ce2e 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CClassRef.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CClassRef.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,14 +30,13 @@ import javax.xml.namespace.QName;
 import com.sun.codemodel.internal.JClass;
 import com.sun.tools.internal.xjc.model.nav.NClass;
 import com.sun.tools.internal.xjc.model.nav.NType;
-import com.sun.tools.internal.xjc.outline.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIClass;
 import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIEnum;
 import com.sun.xml.internal.xsom.XSComponent;
 
 /**
- * Refernece to an existing class.
+ * Reference to an existing class.
  *
  * @author Kohsuke Kawaguchi
  */
@@ -45,6 +44,11 @@ public final class CClassRef extends AbstractCElement implements NClass, CClass
 
     private final String fullyQualifiedClassName;
 
+    /**
+     * Cached for both performance and single identity.
+     */
+    private JClass clazz;
+
     /**
      *
      * @param decl
@@ -80,11 +84,6 @@ public final class CClassRef extends AbstractCElement implements NClass, CClass
         return this;
     }
 
-    /**
-     * Cached for both performance and single identity.
-     */
-    private JClass clazz;
-
     public JClass toType(Outline o, Aspect aspect) {
         if(clazz==null)
             clazz = o.getCodeModel().ref(fullyQualifiedClassName);
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CElementInfo.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CElementInfo.java
index fa77b3a26ec..6a7419bdddd 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CElementInfo.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CElementInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -43,7 +43,6 @@ import static com.sun.tools.internal.xjc.model.CElementPropertyInfo.CollectionMo
 import com.sun.tools.internal.xjc.model.nav.NClass;
 import com.sun.tools.internal.xjc.model.nav.NType;
 import com.sun.tools.internal.xjc.model.nav.NavigatorImpl;
-import com.sun.tools.internal.xjc.outline.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIInlineBinaryData;
 import com.sun.tools.internal.xjc.reader.xmlschema.bindinfo.BIFactoryMethod;
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CElementPropertyInfo.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CElementPropertyInfo.java
index 6d212e63a70..bf1f2f1e961 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CElementPropertyInfo.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CElementPropertyInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -169,6 +169,11 @@ public final class CElementPropertyInfo extends CPropertyInfo implements Element
         return visitor.onElement(this);
     }
 
+    @Override
+    public <R, P> R accept(CPropertyVisitor2<R, P> visitor, P p) {
+        return visitor.visit(this, p);
+    }
+
     public CAdapter getAdapter() {
         return adapter;
     }
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CEnumLeafInfo.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CEnumLeafInfo.java
index 2df7c38ee09..2914606bc84 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CEnumLeafInfo.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CEnumLeafInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,6 @@ import com.sun.codemodel.internal.JClass;
 import com.sun.codemodel.internal.JExpression;
 import com.sun.tools.internal.xjc.model.nav.NClass;
 import com.sun.tools.internal.xjc.model.nav.NType;
-import com.sun.tools.internal.xjc.outline.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 import com.sun.xml.internal.bind.v2.model.annotation.Locatable;
 import com.sun.xml.internal.bind.v2.model.core.EnumLeafInfo;
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CPropertyInfo.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CPropertyInfo.java
index 59f5625cef8..fddd7ca1b95 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CPropertyInfo.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CPropertyInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -42,7 +42,6 @@ import com.sun.tools.internal.xjc.model.nav.NClass;
 import com.sun.tools.internal.xjc.model.nav.NType;
 import com.sun.tools.internal.xjc.reader.Ring;
 import com.sun.xml.internal.bind.api.impl.NameConverter;
-import com.sun.xml.internal.bind.v2.WellKnownNamespace;
 import com.sun.xml.internal.bind.v2.model.core.PropertyInfo;
 import com.sun.xml.internal.bind.v2.runtime.RuntimeUtil;
 import com.sun.xml.internal.xsom.XSComponent;
@@ -290,6 +289,8 @@ public abstract class CPropertyInfo implements PropertyInfo<NType,NClass>, CCust
 
     public abstract <V> V accept( CPropertyVisitor<V> visitor );
 
+    public abstract <R, P> R accept( CPropertyVisitor2<R, P> visitor, P p );
+
     /**
      * Checks if the given {@link TypeUse} would need an explicit {@link XmlSchemaType}
      * annotation with the given type name.
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CPropertyVisitor2.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CPropertyVisitor2.java
new file mode 100644
index 00000000000..199dc8d7833
--- /dev/null
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CPropertyVisitor2.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.internal.xjc.model;
+
+/**
+ * Visitor for {@link CPropertyInfo}.
+ *
+ * The number 2 signals number of arguments.
+ *
+ * @param <R> the return type of this visitor's methods.  Use {@link
+ *            Void} for visitors that do not need to return results.
+ * @param <P> the type of the additional parameter to this visitor's
+ *            methods.  Use {@code Void} for visitors that do not need an
+ *            additional parameter.
+ *
+ * @see CPropertyInfo#accept(CPropertyVisitor2, Object)
+ *
+ * @author Marcel Valovy
+ */
+public interface CPropertyVisitor2<R, P> {
+
+    /**
+     * Visits a CElementPropertyInfo type.
+     * @param t the type to visit
+     * @param p a visitor-specified parameter
+     * @return  a visitor-specified result
+     */
+    R visit(CElementPropertyInfo t, P p);
+
+    /**
+     * Visits a CAttributePropertyInfo type.
+     * @param t the type to visit
+     * @param p a visitor-specified parameter
+     * @return  a visitor-specified result
+     */
+    R visit(CAttributePropertyInfo t, P p);
+
+    /**
+     * Visits a CValuePropertyInfo type.
+     * @param t the type to visit
+     * @param p a visitor-specified parameter
+     * @return  a visitor-specified result
+     */
+    R visit(CValuePropertyInfo t, P p);
+
+    /**
+     * Visits a CReferencePropertyInfo type.
+     * @param t the type to visit
+     * @param p a visitor-specified parameter
+     * @return  a visitor-specified result
+     */
+    R visit(CReferencePropertyInfo t, P p);
+}
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CReferencePropertyInfo.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CReferencePropertyInfo.java
index dd7e905839b..d5c64a83679 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CReferencePropertyInfo.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CReferencePropertyInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -171,6 +171,11 @@ public final class CReferencePropertyInfo extends CPropertyInfo implements Refer
         return visitor.onReference(this);
     }
 
+    @Override
+    public <R, P> R accept(CPropertyVisitor2<R, P> visitor, P p) {
+        return visitor.visit(this, p);
+    }
+
     public CAdapter getAdapter() {
         return null;
     }
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CTypeInfo.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CTypeInfo.java
index 77d1de3182e..a987439c694 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CTypeInfo.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CTypeInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -29,7 +29,6 @@ import com.sun.codemodel.internal.JClass;
 import com.sun.codemodel.internal.JType;
 import com.sun.tools.internal.xjc.model.nav.NClass;
 import com.sun.tools.internal.xjc.model.nav.NType;
-import com.sun.tools.internal.xjc.outline.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 import com.sun.xml.internal.bind.v2.model.core.TypeInfo;
 
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CValuePropertyInfo.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CValuePropertyInfo.java
index cee8dd98c97..8930cfc0363 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CValuePropertyInfo.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CValuePropertyInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -52,4 +52,9 @@ public final class CValuePropertyInfo extends CSingleTypePropertyInfo implements
     public <V> V accept(CPropertyVisitor<V> visitor) {
         return visitor.onValue(this);
     }
+
+    @Override
+    public <R, P> R accept(CPropertyVisitor2<R, P> visitor, P p) {
+        return visitor.visit(this, p);
+    }
 }
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CWildcardTypeInfo.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CWildcardTypeInfo.java
index 6b713486b1f..58506956982 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CWildcardTypeInfo.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/CWildcardTypeInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -29,7 +29,6 @@ import com.sun.codemodel.internal.JType;
 import com.sun.tools.internal.xjc.model.nav.NClass;
 import com.sun.tools.internal.xjc.model.nav.NType;
 import com.sun.tools.internal.xjc.model.nav.NavigatorImpl;
-import com.sun.tools.internal.xjc.outline.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 import com.sun.xml.internal.bind.v2.model.core.WildcardTypeInfo;
 
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/Model.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/Model.java
index 08cb56343db..b2649397aaa 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/Model.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/Model.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,20 +25,6 @@
 
 package com.sun.tools.internal.xjc.model;
 
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlNsForm;
-import javax.xml.bind.annotation.XmlTransient;
-import javax.xml.namespace.QName;
-import javax.xml.transform.Result;
-
 import com.sun.codemodel.internal.JClass;
 import com.sun.codemodel.internal.JCodeModel;
 import com.sun.codemodel.internal.JPackage;
@@ -61,11 +47,23 @@ import com.sun.xml.internal.bind.v2.model.nav.Navigator;
 import com.sun.xml.internal.bind.v2.util.FlattenIterator;
 import com.sun.xml.internal.xsom.XSComponent;
 import com.sun.xml.internal.xsom.XSSchemaSet;
-
 import org.xml.sax.Locator;
 import org.xml.sax.SAXException;
 import org.xml.sax.helpers.LocatorImpl;
 
+import javax.xml.bind.annotation.XmlAttribute;
+import javax.xml.bind.annotation.XmlNsForm;
+import javax.xml.bind.annotation.XmlTransient;
+import javax.xml.namespace.QName;
+import javax.xml.transform.Result;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
 /**
  * Root of the object model that represents the code that needs to be generated.
  *
@@ -92,7 +90,7 @@ public final class Model implements TypeInfoSet<NType,NClass,Void,Void>, CCustom
      * The element mappings.
      */
     private final Map<NClass/*scope*/,Map<QName,CElementInfo>> elementMappings =
-        new HashMap<NClass,Map<QName,CElementInfo>>();
+            new LinkedHashMap<NClass, Map<QName, CElementInfo>>();
 
     private final Iterable<? extends CElementInfo> allElements =
         new Iterable<CElementInfo>() {
@@ -132,11 +130,11 @@ public final class Model implements TypeInfoSet<NType,NClass,Void,Void>, CCustom
      * stores the root object of the parse schema model.
      * Otherwise null.
      *
-     * @sine 2.1.1
+     * @since 2.1.1
      */
     public final XSSchemaSet schemaComponent;
 
-    private CCustomizations gloablCustomizations = new CCustomizations();
+    private CCustomizations globalCustomizations = new CCustomizations();
 
     /**
      * @param nc
@@ -152,13 +150,13 @@ public final class Model implements TypeInfoSet<NType,NClass,Void,Void>, CCustom
         this.defaultSymbolSpace = new SymbolSpace(codeModel);
         defaultSymbolSpace.setType(codeModel.ref(Object.class));
 
-        elementMappings.put(null,new HashMap<QName,CElementInfo>());
+        elementMappings.put(null, new LinkedHashMap<QName, CElementInfo>());
 
         if(opts.automaticNameConflictResolution)
             allocator = new AutoClassNameAllocator(allocator);
         this.allocator = new ClassNameAllocatorWrapper(allocator);
         this.schemaComponent = schemaComponent;
-        this.gloablCustomizations.setParent(this,this);
+        this.globalCustomizations.setParent(this, this);
     }
 
     public void setNameConverter(NameConverter nameConverter) {
@@ -320,7 +318,7 @@ public final class Model implements TypeInfoSet<NType,NClass,Void,Void>, CCustom
      * global element declarations to its representation class.
      *
      * <p>
-     * For other schema languages, it should follow the appendicies in
+     * For other schema languages, it should follow the appendices in
      * WSDL (but in practice no one would use WSDL with a schema language
      * other than XML Schema, so it doesn't really matter.)
      *
@@ -424,7 +422,7 @@ public final class Model implements TypeInfoSet<NType,NClass,Void,Void>, CCustom
      * Gets the global customizations.
      */
     public CCustomizations getCustomizations() {
-        return gloablCustomizations;
+        return globalCustomizations;
     }
 
     /**
@@ -466,7 +464,7 @@ public final class Model implements TypeInfoSet<NType,NClass,Void,Void>, CCustom
 
         Map<QName,CElementInfo> m = elementMappings.get(clazz);
         if(m==null)
-            elementMappings.put(clazz,m=new HashMap<QName,CElementInfo>());
+            elementMappings.put(clazz, m = new LinkedHashMap<QName, CElementInfo>());
         m.put(ei.getElementName(),ei);
     }
 
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/EagerNClass.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/EagerNClass.java
index f894f80456b..2fadd1cfea5 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/EagerNClass.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/EagerNClass.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@ import java.util.HashSet;
 import java.util.Set;
 
 import com.sun.codemodel.internal.JClass;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 
 /**
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/EagerNType.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/EagerNType.java
index fff399e7383..dbb598c0db4 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/EagerNType.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/EagerNType.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@ package com.sun.tools.internal.xjc.model.nav;
 import java.lang.reflect.Type;
 
 import com.sun.codemodel.internal.JType;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 
 /**
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NClass.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NClass.java
index 939961d6437..3499949bdb2 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NClass.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NClass.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 package com.sun.tools.internal.xjc.model.nav;
 
 import com.sun.codemodel.internal.JClass;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 
 /**
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NClassByJClass.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NClassByJClass.java
index 3f0d7f4bb29..558f15740ea 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NClassByJClass.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NClassByJClass.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 package com.sun.tools.internal.xjc.model.nav;
 
 import com.sun.codemodel.internal.JClass;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 
 /**
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NParameterizedType.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NParameterizedType.java
index f0d09f3ae14..b7a2c9a647d 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NParameterizedType.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NParameterizedType.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 package com.sun.tools.internal.xjc.model.nav;
 
 import com.sun.codemodel.internal.JClass;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 
 /**
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NType.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NType.java
index 26216b8251d..4e30ccf7c38 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NType.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/model/nav/NType.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,13 +26,13 @@
 package com.sun.tools.internal.xjc.model.nav;
 
 import com.sun.codemodel.internal.JType;
-import com.sun.tools.internal.xjc.outline.Aspect;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.tools.internal.xjc.outline.Outline;
 
 /**
  * A type.
  *
- * See the package documentaion for details.
+ * See the package documentation for details.
  *
  * @author Kohsuke Kawaguchi
  */
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/Outline.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/Outline.java
index b5db4e2914a..49a8b911e93 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/Outline.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/outline/Outline.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -33,6 +33,7 @@ import com.sun.codemodel.internal.JCodeModel;
 import com.sun.codemodel.internal.JPackage;
 import com.sun.codemodel.internal.JType;
 import com.sun.tools.internal.xjc.ErrorReceiver;
+import com.sun.tools.internal.xjc.model.Aspect;
 import com.sun.tools.internal.xjc.model.CClassInfo;
 import com.sun.tools.internal.xjc.model.CClassInfoParent;
 import com.sun.tools.internal.xjc.model.CElementInfo;
@@ -46,13 +47,12 @@ import com.sun.tools.internal.xjc.util.CodeModelClassFactory;
  * Root of the outline. Captures which code is generated for which model component.
  *
  * <p>
- * This object also provides access to varioues utilities, such as
+ * This object also provides access to various utilities, such as
  * error reporting etc, for the convenience of code that builds the outline.
  *
  * @author Kohsuke Kawaguchi
  */
-public interface Outline
-{
+public interface Outline {
     /**
      * This outline is for this model.
      */
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/internalizer/DOMForest.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/internalizer/DOMForest.java
index bea319e5733..ae1faf66035 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/internalizer/DOMForest.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/tools/internal/xjc/reader/internalizer/DOMForest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -95,7 +95,7 @@ public final class DOMForest {
      * <p>
      * Set of system ids as strings.
      */
-    private final Set<String> rootDocuments = new HashSet<String>();
+    private final Set<String> rootDocuments = new LinkedHashSet<String>();
 
     /** Stores location information for all the trees in this forest. */
     public final LocatorTable locatorTable = new LocatorTable();
diff --git a/jaxws/src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/impl/SchemaImpl.java b/jaxws/src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/impl/SchemaImpl.java
index 7401a9ab119..9b098a08ea0 100644
--- a/jaxws/src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/impl/SchemaImpl.java
+++ b/jaxws/src/jdk.xml.bind/share/classes/com/sun/xml/internal/xsom/impl/SchemaImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,6 +51,7 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map;
 
@@ -125,7 +126,7 @@ public class SchemaImpl implements XSSchema
         return atts.values().iterator();
     }
 
-    private final Map<String,XSElementDecl> elems = new HashMap<String,XSElementDecl>();
+    private final Map<String, XSElementDecl> elems = new LinkedHashMap<String, XSElementDecl>();
     private final Map<String,XSElementDecl> elemsView = Collections.unmodifiableMap(elems);
     public void addElementDecl(XSElementDecl newDecl) {
         elems.put(newDecl.getName(), newDecl);
@@ -204,7 +205,7 @@ public class SchemaImpl implements XSSchema
         return idConstraints.get(localName);
     }
 
-    private final Map<String,XSType> allTypes = new HashMap<String,XSType>();
+    private final Map<String, XSType> allTypes = new LinkedHashMap<String, XSType>();
     private final Map<String,XSType> allTypesView = Collections.unmodifiableMap(allTypes);
 
     private final Map<String,XSSimpleType> simpleTypes = new HashMap<String,XSSimpleType>();
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java
index cfbb18b0bed..751e3247281 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/processor/modeler/wsdl/PseudoSchemaBuilder.java
@@ -41,7 +41,7 @@ import javax.xml.namespace.QName;
 import java.io.ByteArrayInputStream;
 import java.io.StringReader;
 import java.io.StringWriter;
-import java.nio.charset.StandardCharsets;
+import java.io.UnsupportedEncodingException;
 import java.text.MessageFormat;
 import java.util.*;
 
@@ -108,7 +108,7 @@ public class PseudoSchemaBuilder {
         }
         //add w3c EPR binding
         if(!(options.noAddressingBbinding) && options.target.isLaterThan(Options.Target.V2_1)){
-            InputSource is = new InputSource(new ByteArrayInputStream(w3ceprSchemaBinding.getBytes(StandardCharsets.UTF_8)));
+            InputSource is = new InputSource(new ByteArrayInputStream(getUTF8Bytes(w3ceprSchemaBinding)));
             is.setSystemId(sysId+(++i +1));
             b.schemas.add(is);
         }
@@ -123,6 +123,15 @@ public class PseudoSchemaBuilder {
         return b.schemas;
     }
 
+    private static byte[] getUTF8Bytes(String w3ceprSchemaBinding1) {
+        try {
+            return w3ceprSchemaBinding1.getBytes("UTF-8");
+        } catch (UnsupportedEncodingException unexpected) {
+            // should never happen
+            throw new IllegalStateException(unexpected);
+        }
+    }
+
 
     private PseudoSchemaBuilder(WSDLDocument _wsdl) {
         this.wsdlDocument = _wsdl;
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/ConfigurationMessages.java b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/ConfigurationMessages.java
index b6c9a0c5dbf..ba729f65283 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/ConfigurationMessages.java
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/ConfigurationMessages.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -44,7 +44,7 @@ public final class ConfigurationMessages {
     }
 
     /**
-     * Ignoring: binding file ""{0}". It is not a jaxws or a jaxb binding file.
+     * Ignoring: binding file "{0}". It is not a jaxws or a jaxb binding file.
      *
      */
     public static String CONFIGURATION_NOT_BINDING_FILE(Object arg0) {
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/WscompileMessages.java b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/WscompileMessages.java
index e3873169a41..a3db122631f 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/WscompileMessages.java
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/WscompileMessages.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -283,20 +283,6 @@ public final class WscompileMessages {
         return localizer.localize(localizableWSGEN_USAGE_EXTENSIONS());
     }
 
-    public static Localizable localizablePLEASE() {
-        return messageFactory.getMessage("Please");
-    }
-
-    /**
-     * specify "-extension" and "-wsdl:protocol XSoap1.2" switches. For example:
-     *
-     *
-     *
-     */
-    public static String PLEASE() {
-        return localizer.localize(localizablePLEASE());
-    }
-
     public static Localizable localizableWSCOMPILE_EXISTING_OPTION(Object arg0) {
         return messageFactory.getMessage("wscompile.existingOption", arg0);
     }
@@ -385,6 +371,19 @@ public final class WscompileMessages {
         return localizer.localize(localizableWSIMPORT_HELP(arg0));
     }
 
+    public static Localizable localizableWSCOMPILE_CANT_GET_COMPILER(Object arg0, Object arg1, Object arg2) {
+        return messageFactory.getMessage("wscompile.cant.get.compiler", arg0, arg1, arg2);
+    }
+
+    /**
+     * No Java compiler found. Perhaps environment/JDK problem?
+     *  Used JVM: {0}, {1}/{2}
+     *
+     */
+    public static String WSCOMPILE_CANT_GET_COMPILER(Object arg0, Object arg1, Object arg2) {
+        return localizer.localize(localizableWSCOMPILE_CANT_GET_COMPILER(arg0, arg1, arg2));
+    }
+
     public static Localizable localizableWSCOMPILE_ERROR(Object arg0) {
         return messageFactory.getMessage("wscompile.error", arg0);
     }
@@ -557,18 +556,6 @@ public final class WscompileMessages {
         return localizer.localize(localizableWSIMPORT_GENERATING_CODE());
     }
 
-    public static Localizable localizableWSGEN() {
-        return messageFactory.getMessage("wsgen");
-    }
-
-    /**
-     * -wsdl:protocol XSoap1.2 -extenson {1}
-     *
-     */
-    public static String WSGEN() {
-        return localizer.localize(localizableWSGEN());
-    }
-
     public static Localizable localizableWSIMPORT_NOT_A_FILE_NOR_URL(Object arg0) {
         return messageFactory.getMessage("wsimport.NotAFileNorURL", arg0);
     }
@@ -658,7 +645,7 @@ public final class WscompileMessages {
     }
 
     /**
-     * "Could not create file: "{0}"
+     * Could not create file: "{0}"
      *
      */
     public static String WSGEN_COULD_NOT_CREATE_FILE(Object arg0) {
@@ -848,7 +835,7 @@ public final class WscompileMessages {
     }
 
     /**
-     * Failed to read the WSDL document: {0}, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>.
+     * Failed to read the WSDL document: {0}, because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>.
      *
      */
     public static String WSIMPORT_NO_WSDL(Object arg0) {
@@ -860,7 +847,7 @@ public final class WscompileMessages {
     }
 
     /**
-     * "line {0} of {1}
+     * line {0} of {1}
      *
      */
     public static String WSIMPORT_AUTH_INFO_LINENO(Object arg0, Object arg1) {
@@ -922,8 +909,7 @@ public final class WscompileMessages {
     }
 
     /**
-     * wsgen can not generate WSDL for SOAP 1.2 binding: {0} on class: {1}.
-     *
+     * wsgen can not generate WSDL for SOAP 1.2 binding: {0} on class: {1}.Please specify "-extension" and "-wsdl:protocol XSoap1.2" switches. For example:wsgen -wsdl:protocol XSoap1.2 -extenson {1}
      *
      */
     public static String WSGEN_CANNOT_GEN_WSDL_FOR_SOAP_12_BINDING(Object arg0, Object arg1) {
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration.properties
index 443f19afc75..98e130beddd 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,4 +25,4 @@
 
 # Usage not found. TODO Remove
 #configuration.invalidElement=invalid element \"{2}\" in file \"{0}\" (line {1})
-configuration.notBindingFile=Ignoring: binding file "\"{0}\". It is not a jaxws or a jaxb binding file.
+configuration.notBindingFile=Ignoring: binding file \"{0}\". It is not a jaxws or a jaxb binding file.
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_fr.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_fr.properties
index 38adb6be4aa..4c4e544bd0a 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_fr.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_fr.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,4 +25,4 @@
 
 # Usage not found. TODO Remove
 #configuration.invalidElement=invalid element \"{2}\" in file \"{0}\" (line {1})
-configuration.notBindingFile=Non-prise en compte : fichier de binding "\"{0}\". Il ne s''agit pas d''un fichier de binding jaxws ou jaxb.
+configuration.notBindingFile=Non-prise en compte : fichier de binding \"{0}\". Il ne s''agit pas d''un fichier de binding jaxws ou jaxb.
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_it.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_it.properties
index eb67582abb5..539d8ce45a0 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_it.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_it.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,4 +25,4 @@
 
 # Usage not found. TODO Remove
 #configuration.invalidElement=invalid element \"{2}\" in file \"{0}\" (line {1})
-configuration.notBindingFile=Il file di associazione "\"{0}\" verr\u00E0 ignorato. Non si tratta di un file di associazione jaxws o jaxb.
+configuration.notBindingFile=Il file di associazione \"{0}\" verr\u00E0 ignorato. Non si tratta di un file di associazione jaxws o jaxb.
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_ja.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_ja.properties
index 3d96a3df0bd..0129b089f6a 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_ja.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_ja.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,4 +25,4 @@
 
 # Usage not found. TODO Remove
 #configuration.invalidElement=invalid element \"{2}\" in file \"{0}\" (line {1})
-configuration.notBindingFile=\u7121\u8996\u3057\u307E\u3059: \u30D0\u30A4\u30F3\u30C7\u30A3\u30F3\u30B0\u30FB\u30D5\u30A1\u30A4\u30EB"\"{0}\"\u3002\u3053\u308C\u306FJAXWS\u307E\u305F\u306FJAXB\u30D0\u30A4\u30F3\u30C7\u30A3\u30F3\u30B0\u30FB\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
+configuration.notBindingFile=\u7121\u8996\u3057\u307E\u3059: \u30D0\u30A4\u30F3\u30C7\u30A3\u30F3\u30B0\u30FB\u30D5\u30A1\u30A4\u30EB\"{0}\"\u3002\u3053\u308C\u306FJAXWS\u307E\u305F\u306FJAXB\u30D0\u30A4\u30F3\u30C7\u30A3\u30F3\u30B0\u30FB\u30D5\u30A1\u30A4\u30EB\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_ko.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_ko.properties
index a378795571f..614d446dc6d 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_ko.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_ko.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,4 +25,4 @@
 
 # Usage not found. TODO Remove
 #configuration.invalidElement=invalid element \"{2}\" in file \"{0}\" (line {1})
-configuration.notBindingFile=\uBC14\uC778\uB529 \uD30C\uC77C "\"{0}\"\uC744(\uB97C) \uBB34\uC2DC\uD558\uB294 \uC911\uC785\uB2C8\uB2E4. JAXWS \uB610\uB294 JAXB \uBC14\uC778\uB529 \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+configuration.notBindingFile=\uBC14\uC778\uB529 \uD30C\uC77C \"{0}\"\uC744(\uB97C) \uBB34\uC2DC\uD558\uB294 \uC911\uC785\uB2C8\uB2E4. JAXWS \uB610\uB294 JAXB \uBC14\uC778\uB529 \uD30C\uC77C\uC774 \uC544\uB2D9\uB2C8\uB2E4.
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_pt_BR.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_pt_BR.properties
index 6b2fb05aae2..8e1ae9490dd 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_pt_BR.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_pt_BR.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,4 +25,4 @@
 
 # Usage not found. TODO Remove
 #configuration.invalidElement=invalid element \"{2}\" in file \"{0}\" (line {1})
-configuration.notBindingFile=Ignorando: arquivo de bind "\"{0}\". N\u00E3o \u00E9 um arquivo bind jaxws ou jaxb.
+configuration.notBindingFile=Ignorando: arquivo de bind \"{0}\". N\u00E3o \u00E9 um arquivo bind jaxws ou jaxb.
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_zh_CN.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_zh_CN.properties
index 779a0b5afde..43e7af9808a 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_zh_CN.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_zh_CN.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,4 +25,4 @@
 
 # Usage not found. TODO Remove
 #configuration.invalidElement=invalid element \"{2}\" in file \"{0}\" (line {1})
-configuration.notBindingFile=\u5FFD\u7565: \u7ED1\u5B9A\u6587\u4EF6 "\"{0}\"\u3002\u8BE5\u6587\u4EF6\u4E0D\u662F jaxws \u6216 jaxb \u7ED1\u5B9A\u6587\u4EF6\u3002
+configuration.notBindingFile=\u5FFD\u7565: \u7ED1\u5B9A\u6587\u4EF6 \"{0}\"\u3002\u8BE5\u6587\u4EF6\u4E0D\u662F jaxws \u6216 jaxb \u7ED1\u5B9A\u6587\u4EF6\u3002
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_zh_TW.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_zh_TW.properties
index faa0278b2f4..f2cf5de8b1e 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_zh_TW.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/configuration_zh_TW.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,4 +25,4 @@
 
 # Usage not found. TODO Remove
 #configuration.invalidElement=invalid element \"{2}\" in file \"{0}\" (line {1})
-configuration.notBindingFile=\u5FFD\u7565: \u9023\u7D50\u6A94 "\"{0}\". \u8A72\u6A94\u6848\u4E0D\u662F jaxws \u6216 jaxb \u9023\u7D50\u6A94.
+configuration.notBindingFile=\u5FFD\u7565: \u9023\u7D50\u6A94 \"{0}\". \u8A72\u6A94\u6848\u4E0D\u662F jaxws \u6216 jaxb \u9023\u7D50\u6A94.
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile.properties
index ab332df746f..d89ac65d151 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, 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
@@ -162,6 +162,8 @@ wscompile.invalidOption=unrecognized parameter {0}
 wscompile.existingOption=Ignoring already defined option {0}\n
 wsimport.noSuchJaxbOption=no such JAXB option: {0}
 
+wscompile.cant.get.compiler=No Java compiler found. Perhaps environment/JDK problem? \n Used JVM: {0}, {1}/{2}
+
 wscompile.error=error: {0}
 wscompile.warning=warning: {0}
 wscompile.info=info: {0}
@@ -177,7 +179,7 @@ wsimport.missingFile=Missing WSDL_URI
 wsgen.invalid.protocol=\"{0}\" is not a supported protocol.  Supported protocols include: {1}.
 wsgen.invalid.transport=\"{0}\" is not a supported transport.  Supported transport includes: {1}.
 wsgen.class.not.found=Class not found: \"{0}\"
-wsgen.could.not.create.file="Could not create file: "\{0}\"
+wsgen.could.not.create.file=Could not create file: \"{0}\"
 wsgen.missingFile=Missing SEI
 wsgen.soap12.without.extension=The optional protocol \"Xsoap1.2\" must be used in conjunction with the \"-extension\" option.
 wsgen.protocol.without.extension=The optional protocol \"{0}\" must be used in conjunction with the \"-extension\" option.
@@ -192,14 +194,14 @@ wsimport.NotAFileNorURL = \
 
 wsgen.cannot.gen.wsdl.for.non.soap.binding=wsgen can not generate WSDL for non-SOAP binding: {0} on Class {1}
 
-wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen can not generate WSDL for SOAP 1.2 binding: {0} on class: {1}.\n
-Please specify \"-extension\" and \"-wsdl:protocol XSoap1.2\" switches. For example:\n\n
+wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen can not generate WSDL for SOAP 1.2 binding: {0} on class: {1}.\
+Please specify \"-extension\" and \"-wsdl:protocol XSoap1.2\" switches. For example:\
 wsgen -wsdl:protocol XSoap1.2 -extenson {1}
 wsgen.inlineSchemas.only.with.wsdl=\"-inlineSchemas\" must be used in conjunction with the \"-wsdl\" option
 
 wsgen.no.webservices.class=wsgen did not find any class with @WebService annotation. Please specify @WebService annotation on {0}.
 
-wsimport.no.wsdl=Failed to read the WSDL document: {0}, because 1) could not find the document; /\
+wsimport.no.wsdl=Failed to read the WSDL document: {0}, because 1) could not find the document; \
   2) the document could not be read; \
   3) the root element of the document is not <wsdl:definitions>.
 
@@ -230,7 +232,7 @@ wsimport.authInfoNeeded = \
   {0},  "{1}" needs authorization, please provide authorization file with read access at {2} or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http[s]://user:password@host:port//<url-path>
 
 wsimport.AUTH_INFO_LINENO = \
-  "line {0} of {1}
+  line {0} of {1}
 
 
 wsimport.ErrorMessage = \
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_de.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_de.properties
index 3c73ba51df9..b325ad5be5a 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_de.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_de.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, 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
@@ -81,8 +81,8 @@ wsimport.NotAFileNorURL = "{0}" ist weder ein Dateiname noch eine URL
 
 wsgen.cannot.gen.wsdl.for.non.soap.binding=wsgen kann WSDL f\u00fcr Nicht-SOAP-Binding nicht generieren: {0} in Klasse {1}
 
-wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen kann WSDL f\u00fcr SOAP 1.2-Binding nicht generieren: {0} in Klasse {1}
-Please geben Sie die Switches \\"-extension\\" und \\"-wsdl:protocol XSoap1.2\\" an. Beispiel:\n\n
+wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen kann WSDL f\u00fcr SOAP 1.2-Binding nicht generieren: {0} in Klasse {1}\
+Please geben Sie die Switches \\"-extension\\" und \\"-wsdl:protocol XSoap1.2\\" an. Beispiel:\
 wsgen -wsdl:protocol XSoap1.2 -extension {1}
 wsgen.inlineSchemas.only.with.wsdl=\"-inlineSchemas\" muss in Verbindung mit der Option \"-wsdl\" verwendet werden
 
@@ -107,7 +107,7 @@ wsimport.authFileNotFound = Autorisierungsdatei "{0}" nicht gefunden. Wenn f\u00
 # {0} - exception message, {1} - systemId (e.g. location of WSDL file) , {2} - path to metro authentication file e.g.: Server returned HTTP response code: 401 for URL: http://localhost:8080/myServer/mywebService?WSDL, "http://localhost:8080/myServer/mywebService?WSDL" needs authorization, please provide authorization file with read access at C:\Documents and Settings\user\.metro\auth or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http[s]://user:password@host:port//
 wsimport.authInfoNeeded = {0}, "{1}" erfordert Autorisierung. Geben Sie eine Autorisierungsdatei mit Lesezugriff in {2} an, oder verwenden Sie -Xauthfile, um die Autorisierungsdatei anzugeben. Geben Sie auf jeder Zeile Autorisierungsinformationen mit folgendem Format an: http[s]://user:password@host:port//<url-path>
 
-wsimport.AUTH_INFO_LINENO = "Zeile {0} von {1}
+wsimport.AUTH_INFO_LINENO = Zeile {0} von {1}
 
 
 wsimport.ErrorMessage = [ERROR] {0}
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_es.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_es.properties
index 9dca1e77a45..5c3906c63dd 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_es.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_es.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, 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
@@ -67,7 +67,7 @@ wsimport.missingFile=Falta WSDL_URI
 wsgen.invalid.protocol=\"{0}\" no es un protocolo soportado. Los protocolos soportados son: {1}.
 wsgen.invalid.transport=\"{0}\" no es un transporte soportado. El transporte soportado es: {1}.
 wsgen.class.not.found=No se ha encontrado la clase: \"{0}\"
-wsgen.could.not.create.file="No se ha podido crear el archivo: "\\{0}\"
+wsgen.could.not.create.file="No se ha podido crear el archivo: \"{0}\"
 wsgen.missingFile=Falta la interfaz de punto final de servicio
 wsgen.soap12.without.extension=El protocolo opcional \\"Xsoap1.2\\" se debe utilizar junto con la opci\u00f3n \\"-extension\\".
 wsgen.protocol.without.extension=El protocolo opcional \"{0}\" se debe utilizar junto con la opci\u00f3n \"-extension\".
@@ -81,14 +81,14 @@ wsimport.NotAFileNorURL = "{0}" no es un nombre de archivo ni una URL
 
 wsgen.cannot.gen.wsdl.for.non.soap.binding=wsgen no puede generar WSDL para enlaces no SOAP: {0} en la clase {1}
 
-wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen no puede generar WSDL para enlaces SOAP 1.2: {0} en la clase {1}.\n
-Please especifique los conmutadores \\"-extension\\" y \\"-wsdl:protocol XSoap1.2\\". Por ejemplo:\n\n
+wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen no puede generar WSDL para enlaces SOAP 1.2: {0} en la clase {1}.\
+Please especifique los conmutadores \\"-extension\\" y \\"-wsdl:protocol XSoap1.2\\". Por ejemplo:\
 wsgen -wsdl:protocol XSoap1.2 -extenson {1}
 wsgen.inlineSchemas.only.with.wsdl=\\"-inlineSchemas\\" se debe utilizar junto con la opci\u00f3n \\"-wsdl\\"
 
 wsgen.no.webservices.class=wsgen no ha encontrado ninguna clase con la anotaci\u00f3n @WebService. Especifique la anotaci\u00f3n @WebService en {0}.
 
-wsimport.no.wsdl=Fallo al leer el documento WSDL: {0}, porque 1) no se ha encontrado el documento, /2) el documento no se ha podido leer; 3) el elemento ra\u00edz del documento no es <wsdl:definitions>.
+wsimport.no.wsdl=Fallo al leer el documento WSDL: {0}, porque 1) no se ha encontrado el documento, 2) el documento no se ha podido leer; 3) el elemento ra\u00edz del documento no es <wsdl:definitions>.
 
 wsimport.FailedToParse = Fallo al analizar "{0}": {1}
 
@@ -107,7 +107,7 @@ wsimport.authFileNotFound = No se ha encontrado el archivo de autorizaci\u00f3n
 # {0} - exception message, {1} - systemId (e.g. location of WSDL file) , {2} - path to metro authentication file e.g.: Server returned HTTP response code: 401 for URL: http://localhost:8080/myServer/mywebService?WSDL, "http://localhost:8080/myServer/mywebService?WSDL" needs authorization, please provide authorization file with read access at C:\Documents and Settings\user\.metro\auth or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http[s]://user:password@host:port//
 wsimport.authInfoNeeded = {0}, "{1}" necesita autorizaci\u00f3n. Proporcione un archivo de autorizaci\u00f3n con acceso de lectura en {2} o utilice -Xauthfile para proporcionar el archivo de autorizaci\u00f3n y, en cada l\u00ednea, proporcione la informaci\u00f3n de autorizaci\u00f3n utilizando este formato: http[s]://usuario:contrase\u00f1a@host:puerto//<url-ruta de acceso>
 
-wsimport.AUTH_INFO_LINENO = "l\u00ednea {0} de {1}
+wsimport.AUTH_INFO_LINENO = l\u00ednea {0} de {1}
 
 
 wsimport.ErrorMessage = [ERROR] {0}
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_fr.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_fr.properties
index a1b930c9673..c26d69e9b8e 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_fr.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_fr.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, 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
@@ -67,7 +67,7 @@ wsimport.missingFile=WSDL_URI manquant
 wsgen.invalid.protocol=\"{0}\" n''est pas un protocole pris en charge. Les protocoles pris en charge incluent : {1}.
 wsgen.invalid.transport=\"{0}\" n''est pas un transport pris en charge. Les transports pris en charge incluent : {1}.
 wsgen.class.not.found=Classe introuvable : \"{0}\"
-wsgen.could.not.create.file="Impossible de cr\u00e9er le fichier : "\\{0}\"
+wsgen.could.not.create.file=Impossible de cr\u00e9er le fichier : \"{0}\"
 wsgen.missingFile=interface d'adresse de service manquante
 wsgen.soap12.without.extension=Le protocole facultatif \"Xsoap1.2\" doit \u00eatre utilis\u00e9 avec l'option \"-extension\".
 wsgen.protocol.without.extension=Le protocole facultatif \"{0}\" doit \u00eatre utilis\u00e9 avec l''option \"-extension\".
@@ -81,8 +81,8 @@ wsimport.NotAFileNorURL = "{0}" n''est pas un nom de fichier ni une URL
 
 wsgen.cannot.gen.wsdl.for.non.soap.binding=wsgen ne peut pas g\u00e9n\u00e9rer le WSDL pour le binding non-SOAP {0} sur la classe {1}
 
-wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen ne peut pas g\u00e9n\u00e9rer le WSDL pour le binding SOAP 1.2 {0} sur la classe {1}.\n
-Please indiquez les commutateurs \"-extension\" et \"-wsdl:protocol XSoap1.2\". Par exemple :\n\n
+wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen ne peut pas g\u00e9n\u00e9rer le WSDL pour le binding SOAP 1.2 {0} sur la classe {1}.\
+Please indiquez les commutateurs \"-extension\" et \"-wsdl:protocol XSoap1.2\". Par exemple :\
 wsgen -wsdl:protocol XSoap1.2 -extenson {1}
 wsgen.inlineSchemas.only.with.wsdl=\"-inlineSchemas\" doit \u00eatre utilis\u00e9 avec l'option \"-wsdl\"
 
@@ -107,7 +107,7 @@ wsimport.authFileNotFound = Fichier d''autorisation "{0}" introuvable. Si l''acc
 # {0} - exception message, {1} - systemId (e.g. location of WSDL file) , {2} - path to metro authentication file e.g.: Server returned HTTP response code: 401 for URL: http://localhost:8080/myServer/mywebService?WSDL, "http://localhost:8080/myServer/mywebService?WSDL" needs authorization, please provide authorization file with read access at C:\Documents and Settings\user\.metro\auth or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http[s]://user:password@host:port//
 wsimport.authInfoNeeded = {0}, "{1}" n\u00e9cessite une autorisation, fournissez un fichier d''autorisation avec un acc\u00e8s en lecture \u00e0 {2} ou utilisez -Xauthfile pour donner le fichier d''autorisation et fournir sur chaque ligne les informations d''autorisation \u00e0 l''aide du format suivant : http[s]://user:password@host:port//<url-path>
 
-wsimport.AUTH_INFO_LINENO = "ligne {0} sur {1}
+wsimport.AUTH_INFO_LINENO = ligne {0} sur {1}
 
 
 wsimport.ErrorMessage = [ERROR] {0}
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_it.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_it.properties
index 7422534277d..92a0c8cba5a 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_it.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_it.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, 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
@@ -81,8 +81,8 @@ wsimport.NotAFileNorURL = "{0}" non \u00e8 un nome file n\u00e9 un URL
 
 wsgen.cannot.gen.wsdl.for.non.soap.binding=wsgen non pu\u00f2 generare WSDL per un''associazione non SOAP: {0} sulla classe {1}
 
-wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen non pu\u00f2 generare WSDL per un''associazione SOAP 1.2: {0} sulla classe {1}.\n
-Please specificare i parametri \"-extension\" e \"-wsdl:protocol XSoap1.2\". Ad esempio:\n\n
+wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen non pu\u00f2 generare WSDL per un''associazione SOAP 1.2: {0} sulla classe {1}.\
+Please specificare i parametri \"-extension\" e \"-wsdl:protocol XSoap1.2\". Ad esempio:\
 wsgen -wsdl:protocol XSoap1.2 -extenson {1}
 wsgen.inlineSchemas.only.with.wsdl=\"-inlineSchemas\" deve essere usato insieme all''opzione \"-wsdl\"
 
@@ -107,7 +107,7 @@ wsimport.authFileNotFound = File di autorizzazione "{0}" non trovato. Se l''acce
 # {0} - exception message, {1} - systemId (e.g. location of WSDL file) , {2} - path to metro authentication file e.g.: Server returned HTTP response code: 401 for URL: http://localhost:8080/myServer/mywebService?WSDL, "http://localhost:8080/myServer/mywebService?WSDL" needs authorization, please provide authorization file with read access at C:\Documents and Settings\user\.metro\auth or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http[s]://user:password@host:port//
 wsimport.authInfoNeeded = {0}, "{1}" richiede autorizzazione. Fornire il file di autorizzazione con accesso in lettura a {2} oppure usare -Xauthfile per fornire il file di autorizzazione e su ogni riga fornire le informazioni di autorizzazione usando il formato: http[s]://user:password@host:porta//<url-path>
 
-wsimport.AUTH_INFO_LINENO = "riga {0} di {1}
+wsimport.AUTH_INFO_LINENO = riga {0} di {1}
 
 
 wsimport.ErrorMessage = [ERROR] {0}
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_ja.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_ja.properties
index 59a6273c931..65561cc41a1 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_ja.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_ja.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, 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
@@ -67,7 +67,7 @@ wsimport.missingFile=WSDL_URI\u304c\u3042\u308a\u307e\u305b\u3093
 wsgen.invalid.protocol=\"{0}\"\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u308b\u30d7\u30ed\u30c8\u30b3\u30eb\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u308b\u30d7\u30ed\u30c8\u30b3\u30eb\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059: {1}\u3002
 wsgen.invalid.transport=\"{0}\"\u306f\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u308b\u30c8\u30e9\u30f3\u30b9\u30dd\u30fc\u30c8\u3067\u306f\u3042\u308a\u307e\u305b\u3093\u3002\u30b5\u30dd\u30fc\u30c8\u3055\u308c\u3066\u3044\u308b\u30c8\u30e9\u30f3\u30b9\u30dd\u30fc\u30c8\u306f\u6b21\u306e\u3068\u304a\u308a\u3067\u3059: {1}\u3002
 wsgen.class.not.found=\u30af\u30e9\u30b9\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093: \"{0}\"
-wsgen.could.not.create.file="\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f: "\\{0}\"
+wsgen.could.not.create.file="\u30d5\u30a1\u30a4\u30eb\u3092\u4f5c\u6210\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f: \"{0}\"
 wsgen.missingFile=SEI\u304c\u3042\u308a\u307e\u305b\u3093
 wsgen.soap12.without.extension=\u30aa\u30d7\u30b7\u30e7\u30f3\u30fb\u30d7\u30ed\u30c8\u30b3\u30eb\"Xsoap1.2\"\u306f\u3001\"-extension\"\u30aa\u30d7\u30b7\u30e7\u30f3\u3068\u7d44\u307f\u5408\u305b\u3066\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002
 wsgen.protocol.without.extension=\u30aa\u30d7\u30b7\u30e7\u30f3\u30fb\u30d7\u30ed\u30c8\u30b3\u30eb\"{0}\"\u306f\u3001\"-extension\"\u30aa\u30d7\u30b7\u30e7\u30f3\u3068\u7d44\u307f\u5408\u305b\u3066\u4f7f\u7528\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002
@@ -107,7 +107,7 @@ wsimport.authFileNotFound = \u8a8d\u8a3c\u30d5\u30a1\u30a4\u30eb"{0}"\u304c\u898
 # {0} - exception message, {1} - systemId (e.g. location of WSDL file) , {2} - path to metro authentication file e.g.: Server returned HTTP response code: 401 for URL: http://localhost:8080/myServer/mywebService?WSDL, "http://localhost:8080/myServer/mywebService?WSDL" needs authorization, please provide authorization file with read access at C:\Documents and Settings\user\.metro\auth or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http[s]://user:password@host:port//
 wsimport.authInfoNeeded = {0}\u3002"{1}"\u306b\u306f\u8a8d\u8a3c\u304c\u5fc5\u8981\u3067\u3059\u3002{2}\u306b\u3042\u308b\u8a8d\u8a3c\u30d5\u30a1\u30a4\u30eb\u3092\u8aad\u53d6\u308a\u30a2\u30af\u30bb\u30b9\u306b\u3088\u308a\u6307\u5b9a\u3059\u308b\u304b\u3001-Xauthfile\u3092\u4f7f\u7528\u3057\u3066\u8a8d\u8a3c\u30d5\u30a1\u30a4\u30eb\u3092\u6307\u5b9a\u3057\u3001\u5404\u884c\u3067\u6b21\u306e\u5f62\u5f0f\u3092\u4f7f\u7528\u3057\u3066\u8a8d\u8a3c\u60c5\u5831\u3092\u6307\u5b9a\u3057\u3066\u304f\u3060\u3055\u3044: http[s]://user:password@host:port//<url-path>
 
-wsimport.AUTH_INFO_LINENO = "\u884c{0}/{1}
+wsimport.AUTH_INFO_LINENO = \u884c{0}/{1}
 
 
 wsimport.ErrorMessage = [ERROR] {0}
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_ko.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_ko.properties
index ab67a679119..c6571186abd 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_ko.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_ko.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, 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
@@ -81,8 +81,8 @@ wsimport.NotAFileNorURL = "{0}"\uc740(\ub294) \ud30c\uc77c \uc774\ub984 \ub610\u
 
 wsgen.cannot.gen.wsdl.for.non.soap.binding=wsgen\uc740 {1} \ud074\ub798\uc2a4\uc758 \ube44SOAP \ubc14\uc778\ub529 {0}\uc5d0 \ub300\ud574 WSDL\uc744 \uc0dd\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.
 
-wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen\uc740 {1} \ud074\ub798\uc2a4\uc758 SOAP 1.2 \ubc14\uc778\ub529 {0}\uc5d0 \ub300\ud574 WSDL\uc744 \uc0dd\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.\n
-Please \"-extension\" \ubc0f \"-wsdl:protocol XSoap1.2\" \uc2a4\uc704\uce58\ub97c \uc9c0\uc815\ud558\uc2ed\uc2dc\uc624. \uc608:\n\n
+wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen\uc740 {1} \ud074\ub798\uc2a4\uc758 SOAP 1.2 \ubc14\uc778\ub529 {0}\uc5d0 \ub300\ud574 WSDL\uc744 \uc0dd\uc131\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4.\
+Please \"-extension\" \ubc0f \"-wsdl:protocol XSoap1.2\" \uc2a4\uc704\uce58\ub97c \uc9c0\uc815\ud558\uc2ed\uc2dc\uc624. \uc608:\
 wsgen -wsdl:protocol XSoap1.2 -extenson {1}
 wsgen.inlineSchemas.only.with.wsdl=\"-inlineSchemas\"\ub294 \"-wsdl\" \uc635\uc158\uacfc \ud568\uaed8 \uc0ac\uc6a9\ud574\uc57c \ud569\ub2c8\ub2e4.
 
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_pt_BR.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_pt_BR.properties
index 9f4eabcb1de..3806bf2a029 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_pt_BR.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_pt_BR.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, 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
@@ -67,7 +67,7 @@ wsimport.missingFile=WSDL_URI n\u00e3o encontrado
 wsgen.invalid.protocol=\"{0}\" n\u00e3o \u00e9 um protocolo suportado. Os protocolos suportados s\u00e3o: {1}.
 wsgen.invalid.transport=\"{0}\" n\u00e3o \u00e9 um transporte suportado. Os transportes suportados s\u00e3o: {1}.
 wsgen.class.not.found=Classe n\u00e3o encontrada: \"{0}\"
-wsgen.could.not.create.file=N\u00e3o foi poss\u00edvel criar o arquivo: "\\{0}\"
+wsgen.could.not.create.file=N\u00e3o foi poss\u00edvel criar o arquivo: \"{0}\"
 wsgen.missingFile=SEI N\u00e3o Encontrado
 wsgen.soap12.without.extension=O protocolo \"Xsoap1.2\" opcional deve ser usado junto com a op\u00e7\u00e3o \"-extension\".
 wsgen.protocol.without.extension=O protocolo \"{0}\" opcional deve ser usado junto com a op\u00e7\u00e3o \"-extension\".
@@ -81,14 +81,14 @@ wsimport.NotAFileNorURL = "{0}" n\u00e3o \u00e9 um nome de arquivo nem um URL
 
 wsgen.cannot.gen.wsdl.for.non.soap.binding=wsgen n\u00e3o pode gerar WSDL para bind n\u00e3o-SOAP: {0} na Classe {1}
 
-wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen n\u00e3o pode gerar WSDL para bind de SOAP 1.2: {0} na classe: {1}.\n
-Please especifique as chaves \"-extension\" e \"-wsdl:protocol XSoap1.2\". Por exemplo:\n\n
+wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen n\u00e3o pode gerar WSDL para bind de SOAP 1.2: {0} na classe: {1}.\
+Please especifique as chaves \"-extension\" e \"-wsdl:protocol XSoap1.2\". Por exemplo:\
 wsgen -wsdl:protocol XSoap1.2 -extension {1}
 wsgen.inlineSchemas.only.with.wsdl=\"-inlineSchemas\" deve ser usado junto com a op\u00e7\u00e3o \"-wsdl\"
 
 wsgen.no.webservices.class=wsgen n\u00e3o encontrou nenhuma classe com a anota\u00e7\u00e3o @WebService. Especifique a anota\u00e7\u00e3o @WebService em {0}.
 
-wsimport.no.wsdl=Falha ao ler o documento WSDL: {0}, porque 1) n\u00e3o p\u00f4de localizar o documento; /2) o documento n\u00e3o p\u00f4de ser lido; 3) o elemento-raiz do documento n\u00e3o \u00e9 <wsdl:definitions>.
+wsimport.no.wsdl=Falha ao ler o documento WSDL: {0}, porque 1) n\u00e3o p\u00f4de localizar o documento; 2) o documento n\u00e3o p\u00f4de ser lido; 3) o elemento-raiz do documento n\u00e3o \u00e9 <wsdl:definitions>.
 
 wsimport.FailedToParse = Falha ao fazer parse "{0}": {1}
 
@@ -107,7 +107,7 @@ wsimport.authFileNotFound = Arquivo de autoriza\u00e7\u00e3o "{0}" n\u00e3o enco
 # {0} - exception message, {1} - systemId (e.g. location of WSDL file) , {2} - path to metro authentication file e.g.: Server returned HTTP response code: 401 for URL: http://localhost:8080/myServer/mywebService?WSDL, "http://localhost:8080/myServer/mywebService?WSDL" needs authorization, please provide authorization file with read access at C:\Documents and Settings\user\.metro\auth or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http[s]://user:password@host:port//
 wsimport.authInfoNeeded = {0},  "{1}" precisa de autoriza\u00e7\u00e3o; forne\u00e7a o arquivo de autoriza\u00e7\u00e3o com o acesso de leitura em {2} ou use -Xauthfile para fornecer o arquivo de autoriza\u00e7\u00e3o em cada linha para fornecer informa\u00e7\u00f5es de autoriza\u00e7\u00e3o usando este formato : http[s]://user:password@host:port//<url-path>
 
-wsimport.AUTH_INFO_LINENO = "linha {0} de {1}
+wsimport.AUTH_INFO_LINENO = linha {0} de {1}
 
 
 wsimport.ErrorMessage = [ERROR] {0}
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_zh_CN.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_zh_CN.properties
index c13fae46503..1eabe9a7baa 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_zh_CN.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_zh_CN.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, 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
@@ -81,8 +81,8 @@ wsimport.NotAFileNorURL = "{0}" \u4e0d\u662f\u6587\u4ef6\u540d\u4e5f\u4e0d\u662f
 
 wsgen.cannot.gen.wsdl.for.non.soap.binding=wsgen \u65e0\u6cd5\u5728\u7c7b{1}\u4e0a\u4e3a\u975e SOAP \u7ed1\u5b9a{0}\u751f\u6210 WSDL
 
-wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen \u65e0\u6cd5\u5728\u7c7b{1}\u4e0a\u4e3a SOAP 1.2 \u7ed1\u5b9a{0}\u751f\u6210 WSDL\u3002\n
-Please \u6307\u5b9a \"-extension\" \u548c \"-wsdl:protocol XSoap1.2\" \u5f00\u5173\u3002\u4f8b\u5982:\n\n
+wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen \u65e0\u6cd5\u5728\u7c7b{1}\u4e0a\u4e3a SOAP 1.2 \u7ed1\u5b9a{0}\u751f\u6210 WSDL\u3002\
+Please \u6307\u5b9a \"-extension\" \u548c \"-wsdl:protocol XSoap1.2\" \u5f00\u5173\u3002\u4f8b\u5982:\
 wsgen -wsdl:protocol XSoap1.2 -extenson {1}
 wsgen.inlineSchemas.only.with.wsdl=\"-inlineSchemas\" \u5fc5\u987b\u4e0e \"-wsdl\" \u9009\u9879\u7ed3\u5408\u4f7f\u7528
 
@@ -107,7 +107,7 @@ wsimport.authFileNotFound = \u672a\u627e\u5230\u6388\u6743\u6587\u4ef6 "{0}"\u30
 # {0} - exception message, {1} - systemId (e.g. location of WSDL file) , {2} - path to metro authentication file e.g.: Server returned HTTP response code: 401 for URL: http://localhost:8080/myServer/mywebService?WSDL, "http://localhost:8080/myServer/mywebService?WSDL" needs authorization, please provide authorization file with read access at C:\Documents and Settings\user\.metro\auth or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http[s]://user:password@host:port//
 wsimport.authInfoNeeded = {0},  "{1}" \u9700\u8981\u6388\u6743, \u8bf7\u5728{2}\u4e2d\u63d0\u4f9b\u5177\u6709\u8bfb\u53d6\u8bbf\u95ee\u6743\u9650\u7684\u6388\u6743\u6587\u4ef6, \u6216\u8005\u4f7f\u7528 -Xauthfile \u6307\u5b9a\u6388\u6743\u6587\u4ef6\u5e76\u5728\u6bcf\u4e00\u884c\u4e0a\u4f7f\u7528\u4ee5\u4e0b\u683c\u5f0f\u63d0\u4f9b\u6388\u6743\u4fe1\u606f: http[s]://user:password@host:port//<url-path>
 
-wsimport.AUTH_INFO_LINENO = "{1}\u7684\u7b2c {0} \u884c
+wsimport.AUTH_INFO_LINENO = {1}\u7684\u7b2c {0} \u884c
 
 
 wsimport.ErrorMessage = [ERROR] {0}
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_zh_TW.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_zh_TW.properties
index a87007f9bb8..6c338863b1d 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_zh_TW.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/resources/wscompile_zh_TW.properties
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 2014, 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
@@ -67,7 +67,7 @@ wsimport.missingFile=\u907a\u6f0f WSDL_URI
 wsgen.invalid.protocol=\u4e0d\u652f\u63f4 \"{0}\" \u5354\u5b9a.  \u652f\u63f4\u7684\u5354\u5b9a\u5305\u62ec: {1}.
 wsgen.invalid.transport=\u4e0d\u652f\u63f4 \"{0}\" \u50b3\u8f38.  \u652f\u63f4\u7684\u50b3\u8f38\u5305\u62ec: {1}.
 wsgen.class.not.found=\u627e\u4e0d\u5230\u985e\u5225: \"{0}\"
-wsgen.could.not.create.file="\u7121\u6cd5\u5efa\u7acb\u6a94\u6848: "\\{0}\"
+wsgen.could.not.create.file="\u7121\u6cd5\u5efa\u7acb\u6a94\u6848: \"{0}\"
 wsgen.missingFile=\u907a\u6f0f SEI
 wsgen.soap12.without.extension=\u9078\u64c7\u6027\u5354\u5b9a \"Xsoap1.2\" \u5fc5\u9808\u642d\u914d \"-extension\" \u9078\u9805\u4e00\u8d77\u4f7f\u7528.
 wsgen.protocol.without.extension=\u9078\u64c7\u6027\u5354\u5b9a \"{0}\" \u5fc5\u9808\u642d\u914d \"-extension\" \u9078\u9805\u4e00\u8d77\u4f7f\u7528.
@@ -81,14 +81,14 @@ wsimport.NotAFileNorURL = "{0}" \u4e0d\u662f\u6a94\u6848\u540d\u7a31\u6216 URL
 
 wsgen.cannot.gen.wsdl.for.non.soap.binding=wsgen \u7121\u6cd5\u7522\u751f\u985e\u5225 {1} \u4e4b\u975e SOAP \u9023\u7d50 {0} \u7684 WSDL
 
-wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen \u7121\u6cd5\u7522\u751f\u985e\u5225 {1} \u4e4b SOAP 1.2 \u9023\u7d50 {0} \u7684 WSDL.\n
-Please \u6307\u5b9a \"-extension\" \u548c \"-wsdl:protocol XSoap1.2\" \u53c3\u6578. \u4f8b\u5982:\n\n
+wsgen.cannot.gen.wsdl.for.soap12.binding=wsgen \u7121\u6cd5\u7522\u751f\u985e\u5225 {1} \u4e4b SOAP 1.2 \u9023\u7d50 {0} \u7684 WSDL.\
+Please \u6307\u5b9a \"-extension\" \u548c \"-wsdl:protocol XSoap1.2\" \u53c3\u6578. \u4f8b\u5982:\
 wsgen -wsdl:protocol XSoap1.2 -extenson {1}
 wsgen.inlineSchemas.only.with.wsdl=\"-inlineSchemas\" \u5fc5\u9808\u642d\u914d \"-wsdl\" \u9078\u9805\u4e00\u8d77\u4f7f\u7528
 
 wsgen.no.webservices.class=wsgen \u627e\u4e0d\u5230\u4efb\u4f55\u542b @WebService \u8a3b\u89e3\u7684\u985e\u5225. \u8acb\u5728 {0} \u6307\u5b9a @WebService \u8a3b\u89e3.
 
-wsimport.no.wsdl=\u7121\u6cd5\u8b80\u53d6 WSDL \u6587\u4ef6: {0}, \u56e0\u70ba 1) \u627e\u4e0d\u5230\u6587\u4ef6; /2) \u7121\u6cd5\u8b80\u53d6\u6587\u4ef6; 3) \u6587\u4ef6\u7684\u6839\u5143\u7d20\u4e0d\u662f <wsdl:definitions>.
+wsimport.no.wsdl=\u7121\u6cd5\u8b80\u53d6 WSDL \u6587\u4ef6: {0}, \u56e0\u70ba 1) \u627e\u4e0d\u5230\u6587\u4ef6; 2) \u7121\u6cd5\u8b80\u53d6\u6587\u4ef6; 3) \u6587\u4ef6\u7684\u6839\u5143\u7d20\u4e0d\u662f <wsdl:definitions>.
 
 wsimport.FailedToParse = \u7121\u6cd5\u5256\u6790 "{0}": {1}
 
@@ -107,7 +107,7 @@ wsimport.authFileNotFound = \u627e\u4e0d\u5230\u6388\u6b0a\u6a94\u6848 "{0}". \u
 # {0} - exception message, {1} - systemId (e.g. location of WSDL file) , {2} - path to metro authentication file e.g.: Server returned HTTP response code: 401 for URL: http://localhost:8080/myServer/mywebService?WSDL, "http://localhost:8080/myServer/mywebService?WSDL" needs authorization, please provide authorization file with read access at C:\Documents and Settings\user\.metro\auth or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http[s]://user:password@host:port//
 wsimport.authInfoNeeded = {0},  "{1}" \u9700\u8981\u6388\u6b0a, \u8acb\u5728 {2} \u63d0\u4f9b\u5177\u6709\u8b80\u53d6\u5b58\u53d6\u6b0a\u7684\u6388\u6b0a\u6a94\u6848, \u6216\u8005\u4f7f\u7528 -Xauthfile \u6307\u5b9a\u6388\u6b0a\u6a94\u6848, \u4e26\u4e14\u5728\u6bcf\u4e00\u884c\u63d0\u4f9b\u6388\u6b0a\u8cc7\u8a0a (\u4f7f\u7528\u4ee5\u4e0b\u683c\u5f0f) : http[s]://user:password@host:port//<url-path>
 
-wsimport.AUTH_INFO_LINENO = "{1} \u7684\u7b2c {0} \u884c
+wsimport.AUTH_INFO_LINENO = {1} \u7684\u7b2c {0} \u884c
 
 
 wsimport.ErrorMessage = [ERROR] {0}
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties
index 1d11f65b66a..1ae4b3cd94f 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/version.properties
@@ -23,7 +23,7 @@
 # questions.
 #
 
-build-id=2.2.11-b140602.1731
-build-version=JAX-WS RI 2.2.11-b140602.1731
+build-id=2.2.11-b141124.1933
+build-version=JAX-WS RI 2.2.11-b141124.1933
 major-version=2.2.11
-svn-revision=a684014c13b34abb8b9613e106f44f59abea206f
+svn-revision=312b19a2e0e312b55e1ea6f531bd595955cd581f
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java
index debc4cc8e58..6d7564c967c 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -69,7 +69,6 @@ import java.io.OutputStream;
 import java.io.PrintStream;
 import java.net.URLClassLoader;
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
@@ -187,7 +186,11 @@ public class WsgenTool {
             args.addAll(options.getJavacOptions(args, listener));
         }
 
-        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();//        compiler = JavacTool.create();
+        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+        if (compiler == null) {
+            out.println(WscompileMessages.WSCOMPILE_CANT_GET_COMPILER(property("java.home"), property("java.version"), property("java.vendor")));
+            return false;
+        }
         DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
         StandardJavaFileManager fileManager = compiler.getStandardFileManager(diagnostics, null, null);
         JavaCompiler.CompilationTask task = compiler.getTask(
@@ -305,6 +308,15 @@ public class WsgenTool {
         return true;
     }
 
+    private String property(String key) {
+        try {
+            String property = System.getProperty(key);
+            return property != null ? property : "UNKNOWN";
+        } catch (SecurityException ignored) {
+            return "UNKNOWN";
+        }
+    }
+
     private List<File> getExternalFiles(List<String> exts) {
         List<File> files = new ArrayList<File>();
         for (String ext : exts) {
diff --git a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsimportTool.java b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsimportTool.java
index 87e9f42234b..b6e3f843905 100644
--- a/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsimportTool.java
+++ b/jaxws/src/jdk.xml.ws/share/classes/com/sun/tools/internal/ws/wscompile/WsimportTool.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2014, 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
@@ -554,7 +554,8 @@ public class WsimportTool {
                 args.add(sourceFiles.get(i));
             }
 
-            listener.message(WscompileMessages.WSIMPORT_COMPILING_CODE());
+            if (!options.quiet) listener.message(WscompileMessages.WSIMPORT_COMPILING_CODE());
+
             if(options.verbose){
                 StringBuilder argstr = new StringBuilder();
                 for(String arg:args){

From 43f018317f183990135df17f94a36db9177fa883 Mon Sep 17 00:00:00 2001
From: Jan Lahoda <jlahoda@openjdk.org>
Date: Tue, 2 Dec 2014 15:11:05 +0100
Subject: [PATCH 201/299] 8065998: Avoid use of _ as a one-character identifier

Reviewed-by: alanb, chegar, darcy
---
 .../xml/jaxp/unittest/javax/xml/validation/Bug4969089.java    | 4 ++--
 .../javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991857.java   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969089.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969089.java
index d0d28122c47..32477a246b5 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969089.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/validation/Bug4969089.java
@@ -52,11 +52,11 @@ public class Bug4969089 {
         StringReader reader = new StringReader(xsd1);
         StreamSource source = new StreamSource(reader);
         DefaultHandler errorHandler = new DefaultHandler() {
-            public void fatalError(SAXParseException _) throws SAXException {
+            public void fatalError(SAXParseException unused) throws SAXException {
                 throw EUREKA;
             }
 
-            public void error(SAXParseException _) throws SAXException {
+            public void error(SAXParseException unused) throws SAXException {
                 throw EUREKA;
             }
         };
diff --git a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991857.java b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991857.java
index 5cdee0efd79..9c71f1929b2 100644
--- a/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991857.java
+++ b/jaxp/test/javax/xml/jaxp/unittest/javax/xml/xpath/Bug4991857.java
@@ -50,7 +50,7 @@ public class Bug4991857 {
             Assert.assertNotNull(xpath);
 
             Double result = (Double) xpath.evaluate("1+2", d, XPathConstants.NUMBER);
-        } catch (XPathExpressionException _) {
+        } catch (XPathExpressionException unused) {
             Assert.fail("Unexpected XPathExpressionException thrown");
         }
     }

From 56d2ce25a92347fae09657b5e413c4c1513ac337 Mon Sep 17 00:00:00 2001
From: Jan Lahoda <jlahoda@openjdk.org>
Date: Tue, 2 Dec 2014 15:12:40 +0100
Subject: [PATCH 202/299] 8065998: Avoid use of _ as a one-character identifier

Reviewed-by: alanb, chegar, darcy
---
 jdk/test/java/io/readBytes/MemoryLeak.java    |  2 +-
 .../lang/Class/TypeCheckMicroBenchmark.java   |  4 +-
 .../java/lang/ProcessBuilder/Zombies.java     |  6 +-
 .../java/lang/invoke/6998541/Test6998541.java | 74 +++++++++----------
 jdk/test/java/util/EnumSet/BogusEnumSet.java  |  2 +-
 5 files changed, 44 insertions(+), 44 deletions(-)

diff --git a/jdk/test/java/io/readBytes/MemoryLeak.java b/jdk/test/java/io/readBytes/MemoryLeak.java
index ab099b16956..a9dd8e61209 100644
--- a/jdk/test/java/io/readBytes/MemoryLeak.java
+++ b/jdk/test/java/io/readBytes/MemoryLeak.java
@@ -40,7 +40,7 @@ public class MemoryLeak {
             try {
                 s.read(bytes);
                 throw new Error("expected IOException");
-            } catch (IOException _) {
+            } catch (IOException expected) {
                 /* OK */
             } catch (OutOfMemoryError oome) {
                 System.out.printf("Got OutOfMemoryError, i=%d%n", i);
diff --git a/jdk/test/java/lang/Class/TypeCheckMicroBenchmark.java b/jdk/test/java/lang/Class/TypeCheckMicroBenchmark.java
index e406c4f3060..d82de6ed185 100644
--- a/jdk/test/java/lang/Class/TypeCheckMicroBenchmark.java
+++ b/jdk/test/java/lang/Class/TypeCheckMicroBenchmark.java
@@ -182,7 +182,7 @@ public class TypeCheckMicroBenchmark {
                 for (int i = 0; i < iterations; i++) {
                     for (Object x : list.toArray()) {
                         try { a[0] = x; }
-                        catch (ArrayStoreException _) {
+                        catch (ArrayStoreException unused) {
                             throw new ClassCastException(); }}}}},
             new Job("write into dynamic array") { void work() {
                 for (int i = 0; i < iterations; i++) {
@@ -190,7 +190,7 @@ public class TypeCheckMicroBenchmark {
                         Object[] a = (Object[])
                             java.lang.reflect.Array.newInstance(klazz, 1);
                         try { a[0] = x; }
-                        catch (ArrayStoreException _) {
+                        catch (ArrayStoreException unused) {
                             throw new ClassCastException(); }}}}}
         };
 
diff --git a/jdk/test/java/lang/ProcessBuilder/Zombies.java b/jdk/test/java/lang/ProcessBuilder/Zombies.java
index f8c3b627dd8..c417b696c2b 100644
--- a/jdk/test/java/lang/ProcessBuilder/Zombies.java
+++ b/jdk/test/java/lang/ProcessBuilder/Zombies.java
@@ -47,17 +47,17 @@ public class Zombies {
         try {
             rt.exec("no-such-file");
             throw new Error("expected IOException not thrown");
-        } catch (IOException _) {/* OK */}
+        } catch (IOException expected) {/* OK */}
 
         try {
             rt.exec(".");
             throw new Error("expected IOException not thrown");
-        } catch (IOException _) {/* OK */}
+        } catch (IOException expected) {/* OK */}
 
         try {
             rt.exec(TrueCommand, null, new File("no-such-dir"));
             throw new Error("expected IOException not thrown");
-        } catch (IOException _) {/* OK */}
+        } catch (IOException expected) {/* OK */}
 
         rt.exec(TrueCommand).waitFor();
 
diff --git a/jdk/test/java/lang/invoke/6998541/Test6998541.java b/jdk/test/java/lang/invoke/6998541/Test6998541.java
index e9f467be3f4..59d9d45bffb 100644
--- a/jdk/test/java/lang/invoke/6998541/Test6998541.java
+++ b/jdk/test/java/lang/invoke/6998541/Test6998541.java
@@ -214,13 +214,13 @@ public class Test6998541 {
     }
     private static void boolean2prim_invalid(boolean x) throws Throwable {
         if (DO_CASTS)  return;
-        try { byte    y = (byte)    mh_bz.invokeExact(x); fail(); } catch (ClassCastException _) {}  // boolean -> byte
-        try { char    y = (char)    mh_cz.invokeExact(x); fail(); } catch (ClassCastException _) {}  // boolean -> char
-        try { short   y = (short)   mh_sz.invokeExact(x); fail(); } catch (ClassCastException _) {}  // boolean -> short
-        try { int     y = (int)     mh_iz.invokeExact(x); fail(); } catch (ClassCastException _) {}  // boolean -> int
-        try { long    y = (long)    mh_jz.invokeExact(x); fail(); } catch (ClassCastException _) {}  // boolean -> long
-        try { float   y = (float)   mh_fz.invokeExact(x); fail(); } catch (ClassCastException _) {}  // boolean -> float
-        try { double  y = (double)  mh_dz.invokeExact(x); fail(); } catch (ClassCastException _) {}  // boolean -> double
+        try { byte    y = (byte)    mh_bz.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // boolean -> byte
+        try { char    y = (char)    mh_cz.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // boolean -> char
+        try { short   y = (short)   mh_sz.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // boolean -> short
+        try { int     y = (int)     mh_iz.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // boolean -> int
+        try { long    y = (long)    mh_jz.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // boolean -> long
+        try { float   y = (float)   mh_fz.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // boolean -> float
+        try { double  y = (double)  mh_dz.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // boolean -> double
     }
 
     private static MethodHandle mh_b(Class ret) { return mh(ret, byte.class); }
@@ -248,8 +248,8 @@ public class Test6998541 {
     }
     private static void byte2prim_invalid(byte x) throws Throwable {
         if (DO_CASTS)  return;
-        try { char    y = (char)    mh_cb.invokeExact(x); fail(); } catch (ClassCastException _) {}  // byte -> char
-        try { boolean y = (boolean) mh_zb.invokeExact(x); fail(); } catch (ClassCastException _) {}  // byte -> boolean
+        try { char    y = (char)    mh_cb.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // byte -> char
+        try { boolean y = (boolean) mh_zb.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // byte -> boolean
     }
 
     private static MethodHandle mh_c(Class ret) { return mh(ret, char.class); }
@@ -277,9 +277,9 @@ public class Test6998541 {
     }
     private static void char2prim_invalid(char x) throws Throwable {
         if (DO_CASTS)  return;
-        try { boolean y = (boolean) mh_zc.invokeExact(x); fail(); } catch (ClassCastException _) {}  // char -> boolean
-        try { byte    y = (byte)    mh_bc.invokeExact(x); fail(); } catch (ClassCastException _) {}  // char -> byte
-        try { short   y = (short)   mh_sc.invokeExact(x); fail(); } catch (ClassCastException _) {}  // char -> short
+        try { boolean y = (boolean) mh_zc.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // char -> boolean
+        try { byte    y = (byte)    mh_bc.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // char -> byte
+        try { short   y = (short)   mh_sc.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // char -> short
     }
 
     private static MethodHandle mh_s(Class ret) { return mh(ret, short.class); }
@@ -307,9 +307,9 @@ public class Test6998541 {
     }
     private static void short2prim_invalid(short x) throws Throwable {
         if (DO_CASTS)  return;
-        try { boolean y = (boolean) mh_zs.invokeExact(x); fail(); } catch (ClassCastException _) {}  // short -> boolean
-        try { byte    y = (byte)    mh_bs.invokeExact(x); fail(); } catch (ClassCastException _) {}  // short -> byte
-        try { char    y = (char)    mh_cs.invokeExact(x); fail(); } catch (ClassCastException _) {}  // short -> char
+        try { boolean y = (boolean) mh_zs.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // short -> boolean
+        try { byte    y = (byte)    mh_bs.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // short -> byte
+        try { char    y = (char)    mh_cs.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // short -> char
     }
 
     private static MethodHandle mh_i(Class ret) { return mh(ret, int.class); }
@@ -337,10 +337,10 @@ public class Test6998541 {
     }
     private static void int2prim_invalid(int x) throws Throwable {
         if (DO_CASTS)  return;
-        try { boolean y = (boolean) mh_zi.invokeExact(x); fail(); } catch (ClassCastException _) {}  // int -> boolean
-        try { byte    y = (byte)    mh_bi.invokeExact(x); fail(); } catch (ClassCastException _) {}  // int -> byte
-        try { char    y = (char)    mh_ci.invokeExact(x); fail(); } catch (ClassCastException _) {}  // int -> char
-        try { short   y = (short)   mh_si.invokeExact(x); fail(); } catch (ClassCastException _) {}  // int -> short
+        try { boolean y = (boolean) mh_zi.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // int -> boolean
+        try { byte    y = (byte)    mh_bi.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // int -> byte
+        try { char    y = (char)    mh_ci.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // int -> char
+        try { short   y = (short)   mh_si.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // int -> short
     }
 
     private static MethodHandle mh_j(Class ret) { return mh(ret, long.class); }
@@ -368,11 +368,11 @@ public class Test6998541 {
     }
     private static void long2prim_invalid(long x) throws Throwable {
         if (DO_CASTS)  return;
-        try { boolean y = (boolean) mh_zj.invokeExact(x); fail(); } catch (ClassCastException _) {}  // long -> boolean
-        try { byte    y = (byte)    mh_bj.invokeExact(x); fail(); } catch (ClassCastException _) {}  // long -> byte
-        try { char    y = (char)    mh_cj.invokeExact(x); fail(); } catch (ClassCastException _) {}  // long -> char
-        try { short   y = (short)   mh_sj.invokeExact(x); fail(); } catch (ClassCastException _) {}  // long -> short
-        try { int     y = (int)     mh_ij.invokeExact(x); fail(); } catch (ClassCastException _) {}  // long -> int
+        try { boolean y = (boolean) mh_zj.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // long -> boolean
+        try { byte    y = (byte)    mh_bj.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // long -> byte
+        try { char    y = (char)    mh_cj.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // long -> char
+        try { short   y = (short)   mh_sj.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // long -> short
+        try { int     y = (int)     mh_ij.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // long -> int
     }
 
     private static MethodHandle mh_f(Class ret) { return mh(ret, float.class); }
@@ -400,12 +400,12 @@ public class Test6998541 {
     }
     private static void float2prim_invalid(float x) throws Throwable {
         if (DO_CASTS)  return;
-        try { boolean y = (boolean) mh_zf.invokeExact(x); fail(); } catch (ClassCastException _) {}  // float -> boolean
-        try { byte    y = (byte)    mh_bf.invokeExact(x); fail(); } catch (ClassCastException _) {}  // float -> byte
-        try { char    y = (char)    mh_cf.invokeExact(x); fail(); } catch (ClassCastException _) {}  // float -> char
-        try { short   y = (short)   mh_sf.invokeExact(x); fail(); } catch (ClassCastException _) {}  // float -> short
-        try { int     y = (int)     mh_if.invokeExact(x); fail(); } catch (ClassCastException _) {}  // float -> int
-        try { long    y = (long)    mh_jf.invokeExact(x); fail(); } catch (ClassCastException _) {}  // float -> long
+        try { boolean y = (boolean) mh_zf.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // float -> boolean
+        try { byte    y = (byte)    mh_bf.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // float -> byte
+        try { char    y = (char)    mh_cf.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // float -> char
+        try { short   y = (short)   mh_sf.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // float -> short
+        try { int     y = (int)     mh_if.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // float -> int
+        try { long    y = (long)    mh_jf.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // float -> long
     }
 
     private static MethodHandle mh_d(Class ret) { return mh(ret, double.class); }
@@ -433,13 +433,13 @@ public class Test6998541 {
     }
     private static void double2prim_invalid(double x) throws Throwable {
         if (DO_CASTS)  return;
-        try { boolean y = (boolean) mh_zd.invokeExact(x); fail(); } catch (ClassCastException _) {}  // double -> boolean
-        try { byte    y = (byte)    mh_bd.invokeExact(x); fail(); } catch (ClassCastException _) {}  // double -> byte
-        try { char    y = (char)    mh_cd.invokeExact(x); fail(); } catch (ClassCastException _) {}  // double -> char
-        try { short   y = (short)   mh_sd.invokeExact(x); fail(); } catch (ClassCastException _) {}  // double -> short
-        try { int     y = (int)     mh_id.invokeExact(x); fail(); } catch (ClassCastException _) {}  // double -> int
-        try { long    y = (long)    mh_jd.invokeExact(x); fail(); } catch (ClassCastException _) {}  // double -> long
-        try { float   y = (float)   mh_fd.invokeExact(x); fail(); } catch (ClassCastException _) {}  // double -> float
+        try { boolean y = (boolean) mh_zd.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // double -> boolean
+        try { byte    y = (byte)    mh_bd.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // double -> byte
+        try { char    y = (char)    mh_cd.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // double -> char
+        try { short   y = (short)   mh_sd.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // double -> short
+        try { int     y = (int)     mh_id.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // double -> int
+        try { long    y = (long)    mh_jd.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // double -> long
+        try { float   y = (float)   mh_fd.invokeExact(x); fail(); } catch (ClassCastException expected) {}  // double -> float
     }
 
     private final static MethodHandle mh_zv = mh(boolean.class);
diff --git a/jdk/test/java/util/EnumSet/BogusEnumSet.java b/jdk/test/java/util/EnumSet/BogusEnumSet.java
index 1f52b90440a..9769cfebe2d 100644
--- a/jdk/test/java/util/EnumSet/BogusEnumSet.java
+++ b/jdk/test/java/util/EnumSet/BogusEnumSet.java
@@ -82,7 +82,7 @@ public class BogusEnumSet {
           System.out.println("Set size: " + es.size()); // 64
           System.out.println("Set: " + es); // Throws IndexOutOfBoundsException
           throw new AssertionError("Expected exception InvalidObjectException not thrown");
-        } catch (java.io.InvalidObjectException _) { /* OK */ }
+        } catch (java.io.InvalidObjectException expected) { /* OK */ }
     }
 
     private static Object deserialize(byte[] sf) throws Throwable {

From 65fe921d3d9be1a122f443c328c792e81413ce2c Mon Sep 17 00:00:00 2001
From: Vladimir Kozlov <kvn@openjdk.org>
Date: Tue, 2 Dec 2014 12:24:31 -0800
Subject: [PATCH 203/299] 8066199: C2 escape analysis prevents VM from exiting
 quickly

Check for safepoint and block during EA Connection graph construction.

Reviewed-by: roland, vlivanov, shade
---
 hotspot/src/share/vm/opto/escape.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hotspot/src/share/vm/opto/escape.cpp b/hotspot/src/share/vm/opto/escape.cpp
index 355e02cc896..736248113c7 100644
--- a/hotspot/src/share/vm/opto/escape.cpp
+++ b/hotspot/src/share/vm/opto/escape.cpp
@@ -1115,6 +1115,9 @@ bool ConnectionGraph::complete_connection_graph(
           // Each 4 iterations calculate how much time it will take
           // to complete graph construction.
           time.stop();
+          // Poll for requests from shutdown mechanism to quiesce compiler
+          // because Connection graph construction may take long time.
+          CompileBroker::maybe_block();
           double stop_time = time.seconds();
           double time_per_iter = (stop_time - start_time) / (double)SAMPLE_SIZE;
           double time_until_end = time_per_iter * (double)(java_objects_length - next);

From 31af33c0e2b113578b3447ecd1f508f9185d71a4 Mon Sep 17 00:00:00 2001
From: Shanliang Jiang <sjiang@openjdk.org>
Date: Wed, 3 Dec 2014 11:38:56 +0100
Subject: [PATCH 204/299] 8065764:
 javax/management/monitor/CounterMonitorTest.java hangs

Reviewed-by: jbachorik, dfuchs
---
 .../monitor/CounterMonitorTest.java           | 46 ++++++++++++++-----
 1 file changed, 34 insertions(+), 12 deletions(-)

diff --git a/jdk/test/javax/management/monitor/CounterMonitorTest.java b/jdk/test/javax/management/monitor/CounterMonitorTest.java
index 6c4ea1022e3..939f1ece0df 100644
--- a/jdk/test/javax/management/monitor/CounterMonitorTest.java
+++ b/jdk/test/javax/management/monitor/CounterMonitorTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
  * @bug 4981829
  * @summary Test that the counter monitor, when running in difference mode,
  *          emits a notification every time the threshold is exceeded.
- * @author Luis-Miguel Alventosa
+ * @author Luis-Miguel Alventosa, Shanliang JIANG
  * @run clean CounterMonitorTest
  * @run build CounterMonitorTest
  * @run main CounterMonitorTest
@@ -50,23 +50,31 @@ public class CounterMonitorTest implements NotificationListener {
     private boolean notifyFlag = true;
 
     // granularity period
-    private int granularityperiod = 500;
+    private int granularityperiod = 10;
 
-    // counter values
-    private int[] values = new int[] {4, 6, 9, 11};
+    // derived gauge
+    private volatile int derivedGauge = 2;
 
     // flag to notify that a message has been received
     private volatile boolean messageReceived = false;
 
+    private volatile Object observedValue = null;
+
     // MBean class
     public class StdObservedObject implements StdObservedObjectMBean {
         public Object getNbObjects() {
+            echo(">>> StdObservedObject.getNbObjects: " + count);
+            synchronized(CounterMonitorTest.class) {
+                observedValue = count;
+                CounterMonitorTest.class.notifyAll();
+            }
             return count;
         }
         public void setNbObjects(Object n) {
+            echo(">>> StdObservedObject.setNbObjects: " + n);
             count = n;
         }
-        private Object count= null;
+        private volatile Object count= null;
     }
 
     // MBean interface
@@ -166,18 +174,18 @@ public class CounterMonitorTest implements NotificationListener {
             Attribute attrib = new Attribute("NbObjects", data);
             server.setAttribute(stdObsObjName, attrib);
 
-            // Wait for granularity period (multiplied by 2 for sure)
-            //
-            Thread.sleep(granularityperiod * 2);
+            waitObservation(data);
 
             // Loop through the values
             //
-            for (int i = 0; i < values.length; i++) {
-                data = new Integer(values[i]);
-                echo(">>> Set data = " + data.intValue());
+            while (derivedGauge++ < 10) {
+                System.out.print(">>> Set data from " + data.intValue());
+                data = new Integer(data.intValue() + derivedGauge);
+                echo(" to " + data.intValue());
 
                 attrib = new Attribute("NbObjects", data);
                 server.setAttribute(stdObsObjName, attrib);
+                waitObservation(data);
 
                 echo("\tdoWait in Counter Monitor");
                 doWait();
@@ -214,6 +222,20 @@ public class CounterMonitorTest implements NotificationListener {
         }
     }
 
+    private void waitObservation(Object value) {
+        synchronized (CounterMonitorTest.class) {
+            while (value != observedValue) {
+                try {
+                    CounterMonitorTest.class.wait();
+                } catch (InterruptedException e) {
+                    System.err.println("Got unexpected exception: " + e);
+                    e.printStackTrace();
+                    break;
+                }
+            }
+        }
+    }
+
     /*
      * Print message
      */

From e3a64209bc7ec9269b7c6714b3a666a17ff0e9fe Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= <hannesw@openjdk.org>
Date: Wed, 3 Dec 2014 11:43:57 +0100
Subject: [PATCH 205/299] 8066214: Fuzzing bug:
 Object.prototype.toLocaleString(0)

Reviewed-by: attila, lagergren
---
 .../internal/objects/NativeObject.java        |  2 +-
 nashorn/test/script/basic/JDK-8066214.js      | 49 +++++++++++++++++++
 .../test/script/basic/JDK-8066214.js.EXPECTED | 15 ++++++
 3 files changed, 65 insertions(+), 1 deletion(-)
 create mode 100644 nashorn/test/script/basic/JDK-8066214.js
 create mode 100644 nashorn/test/script/basic/JDK-8066214.js.EXPECTED

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java
index c086442ddc9..351e5a1948e 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeObject.java
@@ -499,7 +499,7 @@ public final class NativeObject {
         final Object obj = JSType.toScriptObject(self);
         if (obj instanceof ScriptObject) {
             final InvokeByName toStringInvoker = getTO_STRING();
-            final ScriptObject sobj = (ScriptObject)self;
+            final ScriptObject sobj = (ScriptObject)obj;
             try {
                 final Object toString = toStringInvoker.getGetter().invokeExact(sobj);
 
diff --git a/nashorn/test/script/basic/JDK-8066214.js b/nashorn/test/script/basic/JDK-8066214.js
new file mode 100644
index 00000000000..fbf9af3993c
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066214.js
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8066214: Fuzzing bug: Object.prototype.toLocaleString(0)
+ *
+ * @test
+ * @run
+ */
+
+function test(func) {
+    print(func.call(0));
+    print(func.call("abc"));
+    print(func.call(true));
+    try {
+        print(func.call(undefined));
+    } catch (e) {
+        print(e);
+    }
+    try {
+        print(func.call(null));
+    } catch (e) {
+        print(e);
+    }
+}
+
+test(Object.prototype.toLocaleString);
+test(Object.prototype.toString);
+test(Object.prototype.valueOf);
diff --git a/nashorn/test/script/basic/JDK-8066214.js.EXPECTED b/nashorn/test/script/basic/JDK-8066214.js.EXPECTED
new file mode 100644
index 00000000000..baf23eab395
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066214.js.EXPECTED
@@ -0,0 +1,15 @@
+0
+abc
+true
+TypeError: undefined is not an Object
+TypeError: null is not an Object
+[object Number]
+[object String]
+[object Boolean]
+[object Undefined]
+[object Null]
+0
+abc
+true
+TypeError: undefined is not an Object
+TypeError: null is not an Object

From cec929efaf2cd44dcbd4f77842e87106293ebf6a Mon Sep 17 00:00:00 2001
From: Paul Sandoz <psandoz@openjdk.org>
Date: Wed, 3 Dec 2014 12:00:26 +0100
Subject: [PATCH 206/299] 8066397: Remove network-related seed initialization
 code in ThreadLocal/SplittableRandom

Reviewed-by: alanb, dl, chegar, rriggs, shade
---
 .../classes/java/util/SplittableRandom.java   | 39 +++----------------
 .../util/concurrent/ThreadLocalRandom.java    | 31 +--------------
 2 files changed, 6 insertions(+), 64 deletions(-)

diff --git a/jdk/src/java.base/share/classes/java/util/SplittableRandom.java b/jdk/src/java.base/share/classes/java/util/SplittableRandom.java
index 00de113a6f8..285655d40c9 100644
--- a/jdk/src/java.base/share/classes/java/util/SplittableRandom.java
+++ b/jdk/src/java.base/share/classes/java/util/SplittableRandom.java
@@ -25,7 +25,6 @@
 
 package java.util;
 
-import java.net.NetworkInterface;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.function.IntConsumer;
 import java.util.function.LongConsumer;
@@ -140,11 +139,10 @@ public final class SplittableRandom {
      * other cases, this split must be performed in a thread-safe
      * manner, so we use an AtomicLong to represent the seed rather
      * than use an explicit SplittableRandom. To bootstrap the
-     * defaultGen, we start off using a seed based on current time and
-     * network interface address unless the java.util.secureRandomSeed
-     * property is set. This serves as a slimmed-down (and insecure)
-     * variant of SecureRandom that also avoids stalls that may occur
-     * when using /dev/random.
+     * defaultGen, we start off using a seed based on current time
+     * unless the java.util.secureRandomSeed property is set. This
+     * serves as a slimmed-down (and insecure) variant of SecureRandom
+     * that also avoids stalls that may occur when using /dev/random.
      *
      * It is a relatively simple matter to apply the basic design here
      * to use 128 bit seeds. However, emulating 128bit arithmetic and
@@ -237,34 +235,7 @@ public final class SplittableRandom {
                 s = (s << 8) | ((long)(seedBytes[i]) & 0xffL);
             return s;
         }
-        long h = 0L;
-        try {
-            Enumeration<NetworkInterface> ifcs =
-                    NetworkInterface.getNetworkInterfaces();
-            boolean retry = false; // retry once if getHardwareAddress is null
-            while (ifcs.hasMoreElements()) {
-                NetworkInterface ifc = ifcs.nextElement();
-                if (!ifc.isVirtual()) { // skip fake addresses
-                    byte[] bs = ifc.getHardwareAddress();
-                    if (bs != null) {
-                        int n = bs.length;
-                        int m = Math.min(n >>> 1, 4);
-                        for (int i = 0; i < m; ++i)
-                            h = (h << 16) ^ (bs[i] << 8) ^ bs[n-1-i];
-                        if (m < 4)
-                            h = (h << 8) ^ bs[n-1-m];
-                        h = mix64(h);
-                        break;
-                    }
-                    else if (!retry)
-                        retry = true;
-                    else
-                        break;
-                }
-            }
-        } catch (Exception ignore) {
-        }
-        return (h ^ mix64(System.currentTimeMillis()) ^
+        return (mix64(System.currentTimeMillis()) ^
                 mix64(System.nanoTime()));
     }
 
diff --git a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java
index 2606bed44be..95cc6549b9f 100644
--- a/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java
+++ b/jdk/src/java.base/share/classes/java/util/concurrent/ThreadLocalRandom.java
@@ -36,8 +36,6 @@
 package java.util.concurrent;
 
 import java.io.ObjectStreamField;
-import java.net.NetworkInterface;
-import java.util.Enumeration;
 import java.util.Random;
 import java.util.Spliterator;
 import java.util.concurrent.atomic.AtomicInteger;
@@ -147,34 +145,7 @@ public class ThreadLocalRandom extends Random {
                 s = (s << 8) | ((long)(seedBytes[i]) & 0xffL);
             return s;
         }
-        long h = 0L;
-        try {
-            Enumeration<NetworkInterface> ifcs =
-                    NetworkInterface.getNetworkInterfaces();
-            boolean retry = false; // retry once if getHardwareAddress is null
-            while (ifcs.hasMoreElements()) {
-                NetworkInterface ifc = ifcs.nextElement();
-                if (!ifc.isVirtual()) { // skip fake addresses
-                    byte[] bs = ifc.getHardwareAddress();
-                    if (bs != null) {
-                        int n = bs.length;
-                        int m = Math.min(n >>> 1, 4);
-                        for (int i = 0; i < m; ++i)
-                            h = (h << 16) ^ (bs[i] << 8) ^ bs[n-1-i];
-                        if (m < 4)
-                            h = (h << 8) ^ bs[n-1-m];
-                        h = mix64(h);
-                        break;
-                    }
-                    else if (!retry)
-                        retry = true;
-                    else
-                        break;
-                }
-            }
-        } catch (Exception ignore) {
-        }
-        return (h ^ mix64(System.currentTimeMillis()) ^
+        return (mix64(System.currentTimeMillis()) ^
                 mix64(System.nanoTime()));
     }
 

From d739446063a7c03f92ae7535be3ef55491857722 Mon Sep 17 00:00:00 2001
From: Jan Lahoda <jlahoda@openjdk.org>
Date: Wed, 3 Dec 2014 13:46:12 +0100
Subject: [PATCH 207/299] 7101822: Compiling depends on order of imports
 7177813: Static import to local nested class fails

MemberEnter overhaul - TypeEnter is split out of MemberEnter; the TypeEnter consists of several Phases which ensure actions are done in the correct order.

Co-authored-by: Maurizio Cimadamore <maurizio.cimadamore@oracle.com>
Reviewed-by: mcimadamore, jfranck, aeremeev
---
 .../com/sun/tools/javac/code/ClassFinder.java |    3 +-
 .../com/sun/tools/javac/code/Scope.java       |  165 +--
 .../com/sun/tools/javac/comp/Attr.java        |    4 +-
 .../com/sun/tools/javac/comp/Check.java       |  124 +-
 .../com/sun/tools/javac/comp/Enter.java       |   56 +-
 .../com/sun/tools/javac/comp/MemberEnter.java |  905 +-------------
 .../com/sun/tools/javac/comp/TypeEnter.java   | 1070 +++++++++++++++++
 .../com/sun/tools/javac/tree/JCTree.java      |    1 +
 .../sun/tools/javac/util/Dependencies.java    |   19 +-
 .../std/NonStatic2StaticImportClash.java      |   14 +
 .../std/NonStatic2StaticImportClash.out       |    2 +
 .../std/Static2NonStaticImportClash.java      |   14 +
 .../std/Static2NonStaticImportClash.out       |    2 +
 .../test/tools/javac/4980495/std/Test.out     |    3 +-
 .../ImportRequiresCanonical.java              |    2 +-
 .../importChecks/NoImportedNoClasses.java     |   10 +
 .../importChecks/NoImportedNoClasses.out      |    2 +
 .../importscope/ImportResolvedTooSoon.java    |   42 +
 .../tools/javac/importscope/T7101822A.java    |   49 +
 .../tools/javac/importscope/T7101822Z.java    |   25 +
 .../importscope/TestDuplicateImport.java      |  240 ++++
 .../importscope/TestLazyImportScope.java      |  224 ++++
 .../javac/importscope/TypeParamCycle.java     |   38 +
 .../javac/importscope/TypeParamCycle2.java    |   41 +
 .../javac/importscope/TypeParamCycle3.java    |   42 +
 .../dependencies/DependenciesTest.java        |  366 ++++++
 .../dependencies/annotations/Phase.java       |   40 +
 .../annotations/TriggersComplete.java         |   32 +
 .../annotations/TriggersCompleteRepeat.java   |   28 +
 .../tests/ImportResolvedTooSoon.java          |   41 +
 .../dependencies/tests/Simple.java            |   33 +
 .../dependencies/tests/T7101822/T7101822.java |   47 +
 .../tests/T7101822/T7101822Aux.java           |   25 +
 .../dependencies/tests/TypeParamCycle.java    |   35 +
 .../dependencies/tests/TypeParamCycle2.java   |   37 +
 .../dependencies/tests/TypeParamCycle3.java   |   37 +
 langtools/test/tools/javac/lib/DPrinter.java  |    4 +-
 .../tools/javac/scope/HashCollisionTest.java  |    6 +-
 .../tools/javac/scope/StarImportTest.java     |    6 +-
 39 files changed, 2756 insertions(+), 1078 deletions(-)
 create mode 100644 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java
 create mode 100644 langtools/test/tools/javac/4980495/std/NonStatic2StaticImportClash.java
 create mode 100644 langtools/test/tools/javac/4980495/std/NonStatic2StaticImportClash.out
 create mode 100644 langtools/test/tools/javac/4980495/std/Static2NonStaticImportClash.java
 create mode 100644 langtools/test/tools/javac/4980495/std/Static2NonStaticImportClash.out
 create mode 100644 langtools/test/tools/javac/importChecks/NoImportedNoClasses.java
 create mode 100644 langtools/test/tools/javac/importChecks/NoImportedNoClasses.out
 create mode 100644 langtools/test/tools/javac/importscope/ImportResolvedTooSoon.java
 create mode 100644 langtools/test/tools/javac/importscope/T7101822A.java
 create mode 100644 langtools/test/tools/javac/importscope/T7101822Z.java
 create mode 100644 langtools/test/tools/javac/importscope/TestDuplicateImport.java
 create mode 100644 langtools/test/tools/javac/importscope/TestLazyImportScope.java
 create mode 100644 langtools/test/tools/javac/importscope/TypeParamCycle.java
 create mode 100644 langtools/test/tools/javac/importscope/TypeParamCycle2.java
 create mode 100644 langtools/test/tools/javac/importscope/TypeParamCycle3.java
 create mode 100644 langtools/test/tools/javac/importscope/dependencies/DependenciesTest.java
 create mode 100644 langtools/test/tools/javac/importscope/dependencies/annotations/Phase.java
 create mode 100644 langtools/test/tools/javac/importscope/dependencies/annotations/TriggersComplete.java
 create mode 100644 langtools/test/tools/javac/importscope/dependencies/annotations/TriggersCompleteRepeat.java
 create mode 100644 langtools/test/tools/javac/importscope/dependencies/tests/ImportResolvedTooSoon.java
 create mode 100644 langtools/test/tools/javac/importscope/dependencies/tests/Simple.java
 create mode 100644 langtools/test/tools/javac/importscope/dependencies/tests/T7101822/T7101822.java
 create mode 100644 langtools/test/tools/javac/importscope/dependencies/tests/T7101822/T7101822Aux.java
 create mode 100644 langtools/test/tools/javac/importscope/dependencies/tests/TypeParamCycle.java
 create mode 100644 langtools/test/tools/javac/importscope/dependencies/tests/TypeParamCycle2.java
 create mode 100644 langtools/test/tools/javac/importscope/dependencies/tests/TypeParamCycle3.java

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
index bd2c0c4eb1a..e7cc9290178 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
@@ -46,6 +46,7 @@ import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 
 import static com.sun.tools.javac.main.Option.*;
+import com.sun.tools.javac.util.Dependencies.CompletionCause;
 
 /**
  *  This class provides operations to locate class definitions
@@ -186,7 +187,7 @@ public class ClassFinder {
         if (sym.kind == TYP) {
             try {
                 ClassSymbol c = (ClassSymbol) sym;
-                dependencies.push(c);
+                dependencies.push(c, CompletionCause.CLASS_READER);
                 c.members_field = new Scope.ErrorScope(c); // make sure it's always defined
                 annotate.enterStart();
                 try {
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
index ea87cb35ab4..7e7c89de97d 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Scope.java
@@ -25,13 +25,18 @@
 
 package com.sun.tools.javac.code;
 
+import com.sun.tools.javac.code.Kinds.Kind;
 import java.util.*;
 
+import com.sun.tools.javac.code.Symbol.TypeSymbol;
+import com.sun.tools.javac.tree.JCTree.JCImport;
 import com.sun.tools.javac.util.*;
 import com.sun.tools.javac.util.List;
 
 import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.Scope.LookupKind.RECURSIVE;
+import java.util.stream.Stream;
+import java.util.stream.StreamSupport;
 
 /** A scope represents an area of visibility in a Java program. The
  *  Scope class is a container for symbols which provides
@@ -672,28 +677,67 @@ public abstract class Scope {
 
     }
 
-    public static class NamedImportScope extends CompoundScope {
+    public static class ImportScope extends CompoundScope {
+
+        public ImportScope(Symbol owner) {
+            super(owner);
+        }
+
+        /**Finalize the content of the ImportScope to speed-up future lookups.
+         * No further changes to class hierarchy or class content will be reflected.
+         */
+        public void finalizeScope() {
+            for (List<Scope> scopes = this.subScopes; scopes.nonEmpty(); scopes = scopes.tail) {
+                Scope impScope = scopes.head;
+
+                if (impScope instanceof FilterImportScope && impScope.owner.kind == Kind.TYP) {
+                    WriteableScope finalized = WriteableScope.create(impScope.owner);
+
+                    for (Symbol sym : impScope.getSymbols()) {
+                        finalized.enter(sym);
+                    }
+
+                    finalized.addScopeListener(new ScopeListener() {
+                        @Override
+                        public void symbolAdded(Symbol sym, Scope s) {
+                            Assert.error("The scope is sealed.");
+                        }
+                        @Override
+                        public void symbolRemoved(Symbol sym, Scope s) {
+                            Assert.error("The scope is sealed.");
+                        }
+                    });
+
+                    scopes.head = finalized;
+                }
+            }
+        }
+
+    }
+
+    public static class NamedImportScope extends ImportScope {
 
         public NamedImportScope(Symbol owner, Scope currentFileScope) {
             super(owner);
             prependSubScope(currentFileScope);
         }
 
-        public void importByName(Scope delegate, Scope origin, Name name, ImportFilter filter) {
-            appendScope(new FilterImportScope(delegate, origin, name, filter, true));
+        public Scope importByName(Types types, Scope origin, Name name, ImportFilter filter) {
+            return appendScope(new FilterImportScope(types, origin, name, filter, true));
         }
 
-        public void importType(Scope delegate, Scope origin, Symbol sym) {
-            appendScope(new SingleEntryScope(delegate.owner, sym, origin));
+        public Scope importType(Scope delegate, Scope origin, Symbol sym) {
+            return appendScope(new SingleEntryScope(delegate.owner, sym, origin));
         }
 
-        private void appendScope(Scope newScope) {
+        private Scope appendScope(Scope newScope) {
             List<Scope> existingScopes = this.subScopes.reverse();
             subScopes = List.of(existingScopes.head);
             subScopes = subScopes.prepend(newScope);
             for (Scope s : existingScopes.tail) {
                 subScopes = subScopes.prepend(s);
             }
+            return newScope;
         }
 
         private static class SingleEntryScope extends Scope {
@@ -735,24 +779,23 @@ public abstract class Scope {
         }
     }
 
-    public static class StarImportScope extends CompoundScope {
+    public static class StarImportScope extends ImportScope {
 
         public StarImportScope(Symbol owner) {
             super(owner);
         }
 
-        public void importAll(Scope delegate,
-                              Scope origin,
+        public void importAll(Types types, Scope origin,
                               ImportFilter filter,
                               boolean staticImport) {
             for (Scope existing : subScopes) {
                 Assert.check(existing instanceof FilterImportScope);
                 FilterImportScope fis = (FilterImportScope) existing;
-                if (fis.delegate == delegate && fis.origin == origin &&
-                    fis.filter == filter && fis.staticImport == staticImport)
+                if (fis.origin == origin && fis.filter == filter &&
+                    fis.staticImport == staticImport)
                     return ; //avoid entering the same scope twice
             }
-            prependSubScope(new FilterImportScope(delegate, origin, null, filter, staticImport));
+            prependSubScope(new FilterImportScope(types, origin, null, filter, staticImport));
         }
 
     }
@@ -763,19 +806,19 @@ public abstract class Scope {
 
     private static class FilterImportScope extends Scope {
 
-        private final Scope delegate;
+        private final Types types;
         private final Scope origin;
         private final Name  filterName;
         private final ImportFilter filter;
         private final boolean staticImport;
 
-        public FilterImportScope(Scope delegate,
+        public FilterImportScope(Types types,
                                  Scope origin,
                                  Name  filterName,
                                  ImportFilter filter,
                                  boolean staticImport) {
-            super(delegate.owner);
-            this.delegate = delegate;
+            super(origin.owner);
+            this.types = types;
             this.origin = origin;
             this.filterName = filterName;
             this.filter = filter;
@@ -783,19 +826,31 @@ public abstract class Scope {
         }
 
         @Override
-        public Iterable<Symbol> getSymbols(Filter<Symbol> sf, LookupKind lookupKind) {
+        public Iterable<Symbol> getSymbols(final Filter<Symbol> sf, final LookupKind lookupKind) {
             if (filterName != null)
                 return getSymbolsByName(filterName, sf, lookupKind);
-            return new FilteredIterable(delegate.getSymbols(sf, lookupKind));
+            SymbolImporter si = new SymbolImporter(staticImport) {
+                @Override
+                Iterable<Symbol> doLookup(TypeSymbol tsym) {
+                    return tsym.members().getSymbols(sf, lookupKind);
+                }
+            };
+            return si.importFrom((TypeSymbol) origin.owner) :: iterator;
         }
 
         @Override
-        public Iterable<Symbol> getSymbolsByName(Name name,
-                                                 Filter<Symbol> sf,
-                                                 LookupKind lookupKind) {
+        public Iterable<Symbol> getSymbolsByName(final Name name,
+                                                 final Filter<Symbol> sf,
+                                                 final LookupKind lookupKind) {
             if (filterName != null && filterName != name)
                 return Collections.emptyList();
-            return new FilteredIterable(delegate.getSymbolsByName(name, sf, lookupKind));
+            SymbolImporter si = new SymbolImporter(staticImport) {
+                @Override
+                Iterable<Symbol> doLookup(TypeSymbol tsym) {
+                    return tsym.members().getSymbolsByName(name, sf, lookupKind);
+                }
+            };
+            return si.importFrom((TypeSymbol) origin.owner) :: iterator;
         }
 
         @Override
@@ -808,57 +863,31 @@ public abstract class Scope {
             return staticImport;
         }
 
-        private class FilteredIterator implements Iterator<Symbol> {
-            private final Iterator<Symbol> delegate;
-            private Symbol next;
-
-            public FilteredIterator(Iterator<Symbol> delegate) {
-                this.delegate = delegate;
-                update();
+        abstract class SymbolImporter {
+            Set<Symbol> processed = new HashSet<>();
+            List<Iterable<Symbol>> delegates = List.nil();
+            final boolean inspectSuperTypes;
+            public SymbolImporter(boolean inspectSuperTypes) {
+                this.inspectSuperTypes = inspectSuperTypes;
             }
+            Stream<Symbol> importFrom(TypeSymbol tsym) {
+                if (tsym == null || !processed.add(tsym))
+                    return Stream.empty();
 
-            void update() {
-                while (delegate.hasNext()) {
-                    if (filter.accepts(origin, next = delegate.next()))
-                        return;
+                Stream<Symbol> result = Stream.empty();
+
+                if (inspectSuperTypes) {
+                    // also import inherited names
+                    result = importFrom(types.supertype(tsym.type).tsym);
+                    for (Type t : types.interfaces(tsym.type))
+                        result = Stream.concat(importFrom(t.tsym), result);
                 }
 
-                next = null;
-            }
-
-            @Override
-            public boolean hasNext() {
-                return next != null;
-            }
-
-            @Override
-            public Symbol next() {
-                Symbol result = next;
-
-                update();
-
-                return result;
-            }
-
-            @Override
-            public void remove() {
-                throw new UnsupportedOperationException("Not supported.");
-            }
-
-        }
-
-        private class FilteredIterable implements Iterable<Symbol> {
-
-            private final Iterable<Symbol> unfiltered;
-
-            public FilteredIterable(Iterable<Symbol> unfiltered) {
-                this.unfiltered = unfiltered;
-            }
-
-            @Override
-            public Iterator<Symbol> iterator() {
-                return new FilteredIterator(unfiltered.iterator());
+                return Stream.concat(StreamSupport.stream(doLookup(tsym).spliterator(), false)
+                                                  .filter(s -> filter.accepts(origin, s)),
+                                     result);
             }
+            abstract Iterable<Symbol> doLookup(TypeSymbol tsym);
         }
 
     }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
index 9432f6f034b..d6aa70a00d1 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Attr.java
@@ -87,6 +87,7 @@ public class Attr extends JCTree.Visitor {
     final Check chk;
     final Flow flow;
     final MemberEnter memberEnter;
+    final TypeEnter typeEnter;
     final TreeMaker make;
     final ConstFold cfolder;
     final Enter enter;
@@ -116,6 +117,7 @@ public class Attr extends JCTree.Visitor {
         chk = Check.instance(context);
         flow = Flow.instance(context);
         memberEnter = MemberEnter.instance(context);
+        typeEnter = TypeEnter.instance(context);
         make = TreeMaker.instance(context);
         enter = Enter.instance(context);
         infer = Infer.instance(context);
@@ -949,7 +951,7 @@ public class Attr extends JCTree.Visitor {
                     if (body.stats.isEmpty() ||
                             !TreeInfo.isSelfCall(body.stats.head)) {
                         body.stats = body.stats.
-                                prepend(memberEnter.SuperCall(make.at(body.pos),
+                                prepend(typeEnter.SuperCall(make.at(body.pos),
                                         List.<Type>nil(),
                                         List.<JCVariableDecl>nil(),
                                         false));
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
index 04ea7df1d8a..4db2a418875 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Check.java
@@ -28,7 +28,6 @@ package com.sun.tools.javac.comp;
 import java.util.*;
 
 import javax.tools.JavaFileManager;
-import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.code.*;
 import com.sun.tools.javac.code.Attribute.Compound;
@@ -40,6 +39,7 @@ import com.sun.tools.javac.util.List;
 
 import com.sun.tools.javac.code.Lint;
 import com.sun.tools.javac.code.Lint.LintCategory;
+import com.sun.tools.javac.code.Scope.CompoundScope;
 import com.sun.tools.javac.code.Scope.NamedImportScope;
 import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Type.*;
@@ -3415,56 +3415,69 @@ public class Check {
         }
     }
 
-    /** Check that single-type import is not already imported or top-level defined,
-     *  but make an exception for two single-type imports which denote the same type.
-     *  @param pos           Position for error reporting.
-     *  @param toplevel      The file in which in the check is performed.
-     *  @param sym           The symbol.
+    /**Check that types imported through the ordinary imports don't clash with types imported
+     * by other (static or ordinary) imports. Note that two static imports may import two clashing
+     * types without an error on the imports.
+     * @param toplevel       The toplevel tree for which the test should be performed.
      */
-    boolean checkUniqueImport(DiagnosticPosition pos, JCCompilationUnit toplevel, Symbol sym) {
-        return checkUniqueImport(pos, toplevel, sym, false);
-    }
-
-    /** Check that static single-type import is not already imported or top-level defined,
-     *  but make an exception for two single-type imports which denote the same type.
-     *  @param pos           Position for error reporting.
-     *  @param toplevel      The file in which in the check is performed.
-     *  @param sym           The symbol.
-     */
-    boolean checkUniqueStaticImport(DiagnosticPosition pos, JCCompilationUnit toplevel, Symbol sym) {
-        return checkUniqueImport(pos, toplevel, sym, true);
-    }
-
-    /** Check that single-type import is not already imported or top-level defined,
-     *  but make an exception for two single-type imports which denote the same type.
-     *  @param pos           Position for error reporting.
-     *  @param toplevel      The file in which in the check is performed.
-     *  @param sym           The symbol.
-     *  @param staticImport  Whether or not this was a static import
-     */
-    private boolean checkUniqueImport(DiagnosticPosition pos, JCCompilationUnit toplevel, Symbol sym, boolean staticImport) {
-        NamedImportScope namedImportScope = toplevel.namedImportScope;
+    void checkImportsUnique(JCCompilationUnit toplevel) {
+        WriteableScope ordinallyImportedSoFar = WriteableScope.create(toplevel.packge);
+        WriteableScope staticallyImportedSoFar = WriteableScope.create(toplevel.packge);
         WriteableScope topLevelScope = toplevel.toplevelScope;
 
-        for (Symbol byName : namedImportScope.getSymbolsByName(sym.name)) {
-            // is encountered class entered via a class declaration?
-            boolean isClassDecl = namedImportScope.getOrigin(byName) == topLevelScope;
-            if ((isClassDecl || sym != byName) &&
-                sym.kind == byName.kind &&
-                sym.name != names.error &&
-                (!staticImport || !namedImportScope.isStaticallyImported(byName))) {
-                if (!byName.type.isErroneous()) {
-                    if (!isClassDecl) {
-                        if (staticImport)
-                            log.error(pos, "already.defined.static.single.import", byName);
-                        else
-                        log.error(pos, "already.defined.single.import", byName);
-                    }
-                    else if (sym != byName)
-                        log.error(pos, "already.defined.this.unit", byName);
+        for (JCTree def : toplevel.defs) {
+            if (!def.hasTag(IMPORT))
+                continue;
+
+            JCImport imp = (JCImport) def;
+
+            if (imp.importScope == null)
+                continue;
+
+            for (Symbol sym : imp.importScope.getSymbols(sym -> sym.kind == TYP)) {
+                if (imp.isStatic()) {
+                    checkUniqueImport(imp.pos(), ordinallyImportedSoFar, staticallyImportedSoFar, topLevelScope, sym, true);
+                    staticallyImportedSoFar.enter(sym);
+                } else {
+                    checkUniqueImport(imp.pos(), ordinallyImportedSoFar, staticallyImportedSoFar, topLevelScope, sym, false);
+                    ordinallyImportedSoFar.enter(sym);
                 }
-                return false;
             }
+
+            imp.importScope = null;
+        }
+    }
+
+    /** Check that single-type import is not already imported or top-level defined,
+     *  but make an exception for two single-type imports which denote the same type.
+     *  @param pos                     Position for error reporting.
+     *  @param ordinallyImportedSoFar  A Scope containing types imported so far through
+     *                                 ordinary imports.
+     *  @param staticallyImportedSoFar A Scope containing types imported so far through
+     *                                 static imports.
+     *  @param topLevelScope           The current file's top-level Scope
+     *  @param sym                     The symbol.
+     *  @param staticImport            Whether or not this was a static import
+     */
+    private boolean checkUniqueImport(DiagnosticPosition pos, Scope ordinallyImportedSoFar,
+                                      Scope staticallyImportedSoFar, Scope topLevelScope,
+                                      Symbol sym, boolean staticImport) {
+        Filter<Symbol> duplicates = candidate -> candidate != sym && !candidate.type.isErroneous();
+        Symbol clashing = ordinallyImportedSoFar.findFirst(sym.name, duplicates);
+        if (clashing == null && !staticImport) {
+            clashing = staticallyImportedSoFar.findFirst(sym.name, duplicates);
+        }
+        if (clashing != null) {
+            if (staticImport)
+                log.error(pos, "already.defined.static.single.import", clashing);
+            else
+                log.error(pos, "already.defined.single.import", clashing);
+            return false;
+        }
+        clashing = topLevelScope.findFirst(sym.name, duplicates);
+        if (clashing != null) {
+            log.error(pos, "already.defined.this.unit", clashing);
+            return false;
         }
         return true;
     }
@@ -3570,18 +3583,13 @@ public class Check {
             if (select.name == names.asterisk || (origin = TreeInfo.symbol(select.selected)) == null || origin.kind != TYP)
                 continue;
 
-            JavaFileObject prev = log.useSource(toplevel.sourcefile);
-            try {
-                TypeSymbol site = (TypeSymbol) TreeInfo.symbol(select.selected);
-                if (!checkTypeContainsImportableElement(site, site, toplevel.packge, select.name, new HashSet<Symbol>())) {
-                    log.error(imp.pos(), "cant.resolve.location",
-                              KindName.STATIC,
-                              select.name, List.<Type>nil(), List.<Type>nil(),
-                              Kinds.typeKindName(TreeInfo.symbol(select.selected).type),
-                              TreeInfo.symbol(select.selected).type);
-                }
-            } finally {
-                log.useSource(prev);
+            TypeSymbol site = (TypeSymbol) TreeInfo.symbol(select.selected);
+            if (!checkTypeContainsImportableElement(site, site, toplevel.packge, select.name, new HashSet<Symbol>())) {
+                log.error(imp.pos(), "cant.resolve.location",
+                          KindName.STATIC,
+                          select.name, List.<Type>nil(), List.<Type>nil(),
+                          Kinds.typeKindName(TreeInfo.symbol(select.selected).type),
+                          TreeInfo.symbol(select.selected).type);
             }
         }
     }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
index d0fd21060b7..12346622a8d 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Enter.java
@@ -47,40 +47,34 @@ import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 
 /** This class enters symbols for all encountered definitions into
- *  the symbol table. The pass consists of two phases, organized as
- *  follows:
+ *  the symbol table. The pass consists of high-level two phases,
+ *  organized as follows:
  *
  *  <p>In the first phase, all class symbols are entered into their
  *  enclosing scope, descending recursively down the tree for classes
  *  which are members of other classes. The class symbols are given a
- *  MemberEnter object as completer.
+ *  TypeEnter object as completer.
  *
  *  <p>In the second phase classes are completed using
- *  MemberEnter.complete().  Completion might occur on demand, but
+ *  TypeEnter.complete(). Completion might occur on demand, but
  *  any classes that are not completed that way will be eventually
- *  completed by processing the `uncompleted' queue.  Completion
- *  entails (1) determination of a class's parameters, supertype and
- *  interfaces, as well as (2) entering all symbols defined in the
+ *  completed by processing the `uncompleted' queue. Completion
+ *  entails determination of a class's parameters, supertype and
+ *  interfaces, as well as entering all symbols defined in the
  *  class into its scope, with the exception of class symbols which
- *  have been entered in phase 1.  (2) depends on (1) having been
- *  completed for a class and all its superclasses and enclosing
- *  classes. That's why, after doing (1), we put classes in a
- *  `halfcompleted' queue. Only when we have performed (1) for a class
- *  and all it's superclasses and enclosing classes, we proceed to
- *  (2).
+ *  have been entered in phase 1.
  *
  *  <p>Whereas the first phase is organized as a sweep through all
- *  compiled syntax trees, the second phase is demand. Members of a
+ *  compiled syntax trees, the second phase is on-demand. Members of a
  *  class are entered when the contents of a class are first
  *  accessed. This is accomplished by installing completer objects in
- *  class symbols for compiled classes which invoke the member-enter
+ *  class symbols for compiled classes which invoke the type-enter
  *  phase for the corresponding class tree.
  *
  *  <p>Classes migrate from one phase to the next via queues:
  *
  *  <pre>{@literal
- *  class enter -> (Enter.uncompleted)         --> member enter (1)
- *              -> (MemberEnter.halfcompleted) --> member enter (2)
+ *  class enter -> (Enter.uncompleted)         --> type enter
  *              -> (Todo)                      --> attribute
  *                                              (only for toplevel classes)
  *  }</pre>
@@ -98,7 +92,7 @@ public class Enter extends JCTree.Visitor {
     Check chk;
     TreeMaker make;
     Annotate annotate;
-    MemberEnter memberEnter;
+    TypeEnter typeEnter;
     Types types;
     Lint lint;
     Names names;
@@ -122,7 +116,7 @@ public class Enter extends JCTree.Visitor {
         make = TreeMaker.instance(context);
         syms = Symtab.instance(context);
         chk = Check.instance(context);
-        memberEnter = MemberEnter.instance(context);
+        typeEnter = TypeEnter.instance(context);
         types = Types.instance(context);
         annotate = Annotate.instance(context);
         lint = Lint.instance(context);
@@ -391,7 +385,7 @@ public class Enter extends JCTree.Visitor {
         typeEnvs.put(c, localEnv);
 
         // Fill out class fields.
-        c.completer = memberEnter;
+        c.completer = typeEnter;
         c.flags_field = chk.checkFlags(tree.pos(), tree.mods.flags, c, tree);
         c.sourcefile = env.toplevel.sourcefile;
         c.members_field = WriteableScope.create(c);
@@ -469,22 +463,23 @@ public class Enter extends JCTree.Visitor {
         complete(trees, null);
     }
 
-    /** Main method: enter one class from a list of toplevel trees and
-     *  place the rest on uncompleted for later processing.
+    /** Main method: enter classes from the list of toplevel trees, possibly
+     *  skipping TypeEnter for all but 'c' by placing them on the uncompleted
+     *  list.
      *  @param trees      The list of trees to be processed.
-     *  @param c          The class symbol to be processed.
+     *  @param c          The class symbol to be processed or null to process all.
      */
     public void complete(List<JCCompilationUnit> trees, ClassSymbol c) {
         annotate.enterStart();
         ListBuffer<ClassSymbol> prevUncompleted = uncompleted;
-        if (memberEnter.completionEnabled) uncompleted = new ListBuffer<>();
+        if (typeEnter.completionEnabled) uncompleted = new ListBuffer<>();
 
         try {
             // enter all classes, and construct uncompleted list
             classEnter(trees, null);
 
             // complete all uncompleted classes in memberEnter
-            if  (memberEnter.completionEnabled) {
+            if (typeEnter.completionEnabled) {
                 while (uncompleted.nonEmpty()) {
                     ClassSymbol clazz = uncompleted.next();
                     if (c == null || c == clazz || prevUncompleted == null)
@@ -494,16 +489,7 @@ public class Enter extends JCTree.Visitor {
                         prevUncompleted.append(clazz);
                 }
 
-                // if there remain any unimported toplevels (these must have
-                // no classes at all), process their import statements as well.
-                for (JCCompilationUnit tree : trees) {
-                    if (tree.starImportScope.isEmpty()) {
-                        JavaFileObject prev = log.useSource(tree.sourcefile);
-                        Env<AttrContext> topEnv = topLevelEnv(tree);
-                        memberEnter.memberEnter(tree, topEnv);
-                        log.useSource(prev);
-                    }
-                }
+                typeEnter.ensureImportsChecked(trees);
             }
         } finally {
             uncompleted = prevUncompleted;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
index b63132cd39b..721612d5e68 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/MemberEnter.java
@@ -25,76 +25,45 @@
 
 package com.sun.tools.javac.comp;
 
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.IdentityHashMap;
-import java.util.Set;
-
 import javax.tools.JavaFileObject;
 
 import com.sun.tools.javac.code.*;
-import com.sun.tools.javac.code.Lint.LintCategory;
-import com.sun.tools.javac.code.Scope.ImportFilter;
-import com.sun.tools.javac.code.Scope.NamedImportScope;
-import com.sun.tools.javac.code.Scope.StarImportScope;
 import com.sun.tools.javac.code.Scope.WriteableScope;
-import com.sun.tools.javac.jvm.*;
 import com.sun.tools.javac.tree.*;
 import com.sun.tools.javac.util.*;
-import com.sun.tools.javac.util.DefinedBy.Api;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 
 import com.sun.tools.javac.code.Symbol.*;
 import com.sun.tools.javac.code.Type.*;
 import com.sun.tools.javac.tree.JCTree.*;
 
 import static com.sun.tools.javac.code.Flags.*;
-import static com.sun.tools.javac.code.Flags.ANNOTATION;
-import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
 import static com.sun.tools.javac.code.Kinds.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
-import static com.sun.tools.javac.code.TypeTag.CLASS;
-import static com.sun.tools.javac.code.TypeTag.ERROR;
 import static com.sun.tools.javac.code.TypeTag.TYPEVAR;
-import static com.sun.tools.javac.tree.JCTree.Tag.*;
 
-import com.sun.tools.javac.util.Dependencies.AttributionKind;
-import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
-import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
-
-/** This is the second phase of Enter, in which classes are completed
- *  by entering their members into the class scope using
- *  MemberEnter.complete().  See Enter for an overview.
+/** Resolves field, method and constructor header, and constructs corresponding Symbols.
  *
  *  <p><b>This is NOT part of any supported API.
  *  If you write code that depends on this, you do so at your own risk.
  *  This code and its internal interfaces are subject to change or
  *  deletion without notice.</b>
  */
-public class MemberEnter extends JCTree.Visitor implements Completer {
+public class MemberEnter extends JCTree.Visitor {
     protected static final Context.Key<MemberEnter> memberEnterKey = new Context.Key<>();
 
     /** A switch to determine whether we check for package/class conflicts
      */
     final static boolean checkClash = true;
 
-    private final Names names;
     private final Enter enter;
     private final Log log;
     private final Check chk;
     private final Attr attr;
     private final Symtab syms;
-    private final TreeMaker make;
-    private final Todo todo;
     private final Annotate annotate;
-    private final TypeAnnotations typeAnnotations;
     private final Types types;
-    private final JCDiagnostic.Factory diags;
-    private final Source source;
-    private final Target target;
     private final DeferredLintHandler deferredLintHandler;
-    private final Lint lint;
-    private final TypeEnvs typeEnvs;
-    private final Dependencies dependencies;
 
     public static MemberEnter instance(Context context) {
         MemberEnter instance = context.get(memberEnterKey);
@@ -105,178 +74,14 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
 
     protected MemberEnter(Context context) {
         context.put(memberEnterKey, this);
-        names = Names.instance(context);
         enter = Enter.instance(context);
         log = Log.instance(context);
         chk = Check.instance(context);
         attr = Attr.instance(context);
         syms = Symtab.instance(context);
-        make = TreeMaker.instance(context);
-        todo = Todo.instance(context);
         annotate = Annotate.instance(context);
-        typeAnnotations = TypeAnnotations.instance(context);
         types = Types.instance(context);
-        diags = JCDiagnostic.Factory.instance(context);
-        source = Source.instance(context);
-        target = Target.instance(context);
         deferredLintHandler = DeferredLintHandler.instance(context);
-        lint = Lint.instance(context);
-        typeEnvs = TypeEnvs.instance(context);
-        dependencies = Dependencies.instance(context);
-        allowTypeAnnos = source.allowTypeAnnotations();
-        allowDeprecationOnImport = source.allowDeprecationOnImport();
-    }
-
-    /** Switch: support type annotations.
-     */
-    boolean allowTypeAnnos;
-
-    /**
-     * Switch: should deprecation warnings be issued on import
-     */
-    boolean allowDeprecationOnImport;
-
-    /** A queue for classes whose members still need to be entered into the
-     *  symbol table.
-     */
-    ListBuffer<Env<AttrContext>> halfcompleted = new ListBuffer<>();
-
-    /** Set to true only when the first of a set of classes is
-     *  processed from the half completed queue.
-     */
-    boolean isFirst = true;
-
-    /** A flag to disable completion from time to time during member
-     *  enter, as we only need to look up types.  This avoids
-     *  unnecessarily deep recursion.
-     */
-    boolean completionEnabled = true;
-
-    /* ---------- Processing import clauses ----------------
-     */
-
-    /** Import all classes of a class or package on demand.
-     *  @param pos           Position to be used for error reporting.
-     *  @param tsym          The class or package the members of which are imported.
-     *  @param env           The env in which the imported classes will be entered.
-     */
-    private void importAll(int pos,
-                           final TypeSymbol tsym,
-                           Env<AttrContext> env) {
-        // Check that packages imported from exist (JLS ???).
-        if (tsym.kind == PCK && tsym.members().isEmpty() && !tsym.exists()) {
-            // If we can't find java.lang, exit immediately.
-            if (((PackageSymbol)tsym).fullname.equals(names.java_lang)) {
-                JCDiagnostic msg = diags.fragment("fatal.err.no.java.lang");
-                throw new FatalError(msg);
-            } else {
-                log.error(DiagnosticFlag.RESOLVE_ERROR, pos, "doesnt.exist", tsym);
-            }
-        }
-        env.toplevel.starImportScope.importAll(tsym.members(), tsym.members(), typeImportFilter, false);
-    }
-
-    /** Import all static members of a class or package on demand.
-     *  @param pos           Position to be used for error reporting.
-     *  @param tsym          The class or package the members of which are imported.
-     *  @param env           The env in which the imported classes will be entered.
-     */
-    private void importStaticAll(int pos,
-                                 final TypeSymbol tsym,
-                                 Env<AttrContext> env) {
-        final StarImportScope toScope = env.toplevel.starImportScope;
-        final PackageSymbol packge = env.toplevel.packge;
-        final TypeSymbol origin = tsym;
-
-        // enter imported types immediately
-        new SymbolImporter() {
-            void doImport(TypeSymbol tsym) {
-                toScope.importAll(tsym.members(), origin.members(), staticImportFilter, true);
-            }
-        }.importFrom(tsym);
-    }
-
-    /** Import statics types of a given name.  Non-types are handled in Attr.
-     *  @param pos           Position to be used for error reporting.
-     *  @param tsym          The class from which the name is imported.
-     *  @param name          The (simple) name being imported.
-     *  @param env           The environment containing the named import
-     *                  scope to add to.
-     */
-    private void importNamedStatic(final DiagnosticPosition pos,
-                                   final TypeSymbol tsym,
-                                   final Name name,
-                                   final Env<AttrContext> env) {
-        if (tsym.kind != TYP) {
-            log.error(DiagnosticFlag.RECOVERABLE, pos, "static.imp.only.classes.and.interfaces");
-            return;
-        }
-
-        final NamedImportScope toScope = env.toplevel.namedImportScope;
-        final Scope originMembers = tsym.members();
-
-        // enter imported types immediately
-        new SymbolImporter() {
-            void doImport(TypeSymbol tsym) {
-                Set<Symbol> maskedOut = null;
-                for (Symbol sym : tsym.members().getSymbolsByName(name)) {
-                    if (sym.kind == TYP &&
-                        staticImportFilter.accepts(originMembers, sym) &&
-                        !chk.checkUniqueStaticImport(pos, env.toplevel, sym)) {
-                        if (maskedOut == null)
-                            maskedOut = Collections.newSetFromMap(new IdentityHashMap<Symbol, Boolean>());
-                        maskedOut.add(sym);
-                    }
-                }
-                ImportFilter importFilter = maskedOut != null ?
-                        new MaskedImportFilter(staticImportFilter, maskedOut) :
-                        staticImportFilter;
-                toScope.importByName(tsym.members(), originMembers, name, importFilter);
-            }
-        }.importFrom(tsym);
-    }
-    //where:
-        class MaskedImportFilter implements ImportFilter {
-
-            private final ImportFilter delegate;
-            private final Set<Symbol> maskedOut;
-
-            public MaskedImportFilter(ImportFilter delegate, Set<Symbol> maskedOut) {
-                this.delegate = delegate;
-                this.maskedOut = maskedOut;
-            }
-
-            @Override
-            public boolean accepts(Scope origin, Symbol sym) {
-                return !maskedOut.contains(sym) && delegate.accepts(origin, sym);
-            }
-        }
-        abstract class SymbolImporter {
-            Set<Symbol> processed = new HashSet<>();
-            void importFrom(TypeSymbol tsym) {
-                if (tsym == null || !processed.add(tsym))
-                    return;
-
-                // also import inherited names
-                importFrom(types.supertype(tsym.type).tsym);
-                for (Type t : types.interfaces(tsym.type))
-                    importFrom(t.tsym);
-
-                doImport(tsym);
-            }
-            abstract void doImport(TypeSymbol tsym);
-        }
-
-    /** Import given class.
-     *  @param pos           Position to be used for error reporting.
-     *  @param tsym          The class to be imported.
-     *  @param env           The environment containing the named import
-     *                  scope to add to.
-     */
-    private void importNamed(DiagnosticPosition pos, final Symbol tsym, Env<AttrContext> env) {
-        if (tsym.kind == TYP &&
-            chk.checkUniqueImport(pos, env.toplevel, tsym))
-            env.toplevel.namedImportScope.importType(tsym.owner.members(), tsym.owner.members(), tsym);
     }
 
     /** Construct method type from method signature.
@@ -345,32 +150,6 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
  * Visitor methods for member enter
  *********************************************************************/
 
-    ImportFilter staticImportFilter;
-    ImportFilter typeImportFilter = new ImportFilter() {
-        @Override
-        public boolean accepts(Scope origin, Symbol t) {
-            return t.kind == TYP;
-        }
-    };
-
-    protected void memberEnter(JCCompilationUnit tree, Env<AttrContext> env) {
-        ImportFilter prevStaticImportFilter = staticImportFilter;
-        try {
-            final PackageSymbol packge = env.toplevel.packge;
-            this.staticImportFilter = new ImportFilter() {
-                @Override
-                public boolean accepts(Scope origin, Symbol sym) {
-                    return sym.isStatic() &&
-                           chk.staticImportAccessible(sym, packge) &&
-                           sym.isMemberOf((TypeSymbol) origin.owner, types);
-                }
-            };
-            memberEnter((JCTree) tree, env);
-        } finally {
-            this.staticImportFilter = prevStaticImportFilter;
-        }
-    }
-
     /** Visitor argument: the current environment
      */
     protected Env<AttrContext> env;
@@ -397,122 +176,6 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
             memberEnter(l.head, env);
     }
 
-    /** Enter members for a class.
-     */
-    void finishClass(JCClassDecl tree, Env<AttrContext> env) {
-        if ((tree.mods.flags & Flags.ENUM) != 0 &&
-            (types.supertype(tree.sym.type).tsym.flags() & Flags.ENUM) == 0) {
-            addEnumMembers(tree, env);
-        }
-        memberEnter(tree.defs, env);
-    }
-
-    /** Add the implicit members for an enum type
-     *  to the symbol table.
-     */
-    private void addEnumMembers(JCClassDecl tree, Env<AttrContext> env) {
-        JCExpression valuesType = make.Type(new ArrayType(tree.sym.type, syms.arrayClass));
-
-        // public static T[] values() { return ???; }
-        JCMethodDecl values = make.
-            MethodDef(make.Modifiers(Flags.PUBLIC|Flags.STATIC),
-                      names.values,
-                      valuesType,
-                      List.<JCTypeParameter>nil(),
-                      List.<JCVariableDecl>nil(),
-                      List.<JCExpression>nil(), // thrown
-                      null, //make.Block(0, Tree.emptyList.prepend(make.Return(make.Ident(names._null)))),
-                      null);
-        memberEnter(values, env);
-
-        // public static T valueOf(String name) { return ???; }
-        JCMethodDecl valueOf = make.
-            MethodDef(make.Modifiers(Flags.PUBLIC|Flags.STATIC),
-                      names.valueOf,
-                      make.Type(tree.sym.type),
-                      List.<JCTypeParameter>nil(),
-                      List.of(make.VarDef(make.Modifiers(Flags.PARAMETER |
-                                                         Flags.MANDATED),
-                                            names.fromString("name"),
-                                            make.Type(syms.stringType), null)),
-                      List.<JCExpression>nil(), // thrown
-                      null, //make.Block(0, Tree.emptyList.prepend(make.Return(make.Ident(names._null)))),
-                      null);
-        memberEnter(valueOf, env);
-    }
-
-    public void visitTopLevel(JCCompilationUnit tree) {
-        if (!tree.starImportScope.isEmpty()) {
-            // we must have already processed this toplevel
-            return;
-        }
-
-        DiagnosticPosition prevLintPos = deferredLintHandler.immediate();
-        Lint prevLint = chk.setLint(lint);
-
-        try {
-            // Import-on-demand java.lang.
-            importAll(tree.pos, syms.enterPackage(names.java_lang), env);
-
-            // Process the package def and all import clauses.
-            memberEnter(tree.defs, env);
-        } finally {
-            chk.setLint(prevLint);
-            deferredLintHandler.setPos(prevLintPos);
-        }
-    }
-
-    public void visitPackageDef(JCPackageDecl tree) {
-        // check that no class exists with same fully qualified name as
-        // toplevel package
-        if (checkClash && tree.pid != null) {
-            Symbol p = env.toplevel.packge;
-            while (p.owner != syms.rootPackage) {
-                p.owner.complete(); // enter all class members of p
-                if (syms.classes.get(p.getQualifiedName()) != null) {
-                    log.error(tree.pos,
-                              "pkg.clashes.with.class.of.same.name",
-                              p);
-                }
-                p = p.owner;
-            }
-        }
-        // process package annotations
-        annotate.annotateLater(tree.annotations, env, env.toplevel.packge, null);
-    }
-
-    // process the non-static imports and the static imports of types.
-    public void visitImport(JCImport tree) {
-        dependencies.push(AttributionKind.IMPORT, tree);
-        JCFieldAccess imp = (JCFieldAccess)tree.qualid;
-        Name name = TreeInfo.name(imp);
-
-        // Create a local environment pointing to this tree to disable
-        // effects of other imports in Resolve.findGlobalType
-        Env<AttrContext> localEnv = env.dup(tree);
-
-        TypeSymbol p = attr.attribImportQualifier(tree, localEnv).tsym;
-        if (name == names.asterisk) {
-            // Import on demand.
-            chk.checkCanonical(imp.selected);
-            if (tree.staticImport)
-                importStaticAll(tree.pos, p, env);
-            else
-                importAll(tree.pos, p, env);
-        } else {
-            // Named type import.
-            if (tree.staticImport) {
-                importNamedStatic(tree.pos(), p, name, localEnv);
-                chk.checkCanonical(imp.selected);
-            } else {
-                TypeSymbol c = attribImportType(imp, localEnv).tsym;
-                chk.checkCanonical(imp);
-                importNamed(tree.pos(), c, env);
-            }
-        }
-        dependencies.pop();
-    }
-
     public void visitMethodDef(JCMethodDecl tree) {
         WriteableScope enclScope = enter.enterScope(env);
         MethodSymbol m = new MethodSymbol(0, tree.name, null, enclScope.owner);
@@ -772,38 +435,6 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
         return iEnv;
     }
 
-/* ********************************************************************
- * Type completion
- *********************************************************************/
-
-    Type attribImportType(JCTree tree, Env<AttrContext> env) {
-        Assert.check(completionEnabled);
-        Lint prevLint = chk.setLint(allowDeprecationOnImport ?
-                lint : lint.suppress(LintCategory.DEPRECATION));
-        try {
-            // To prevent deep recursion, suppress completion of some
-            // types.
-            completionEnabled = false;
-            return attr.attribType(tree, env);
-        } finally {
-            completionEnabled = true;
-            chk.setLint(prevLint);
-        }
-    }
-
-    /**
-     * Check if a list of annotations contains a reference to
-     * java.lang.Deprecated.
-     **/
-    private boolean hasDeprecatedAnnotation(List<JCAnnotation> annotations) {
-        for (List<JCAnnotation> al = annotations; !al.isEmpty(); al = al.tail) {
-            JCAnnotation a = al.head;
-            if (a.annotationType.type == syms.deprecatedType && a.args.isEmpty())
-                return true;
-        }
-        return false;
-    }
-
     /** Queue processing of an attribute default value. */
     void annotateDefaultValueLater(final JCExpression defaultValue,
                                    final Env<AttrContext> localEnv,
@@ -849,534 +480,4 @@ public class MemberEnter extends JCTree.Visitor implements Completer {
                                                       localEnv);
     }
 
-/* ********************************************************************
- * Source completer
- *********************************************************************/
-
-    /** Complete entering a class.
-     *  @param sym         The symbol of the class to be completed.
-     */
-    public void complete(Symbol sym) throws CompletionFailure {
-        // Suppress some (recursive) MemberEnter invocations
-        if (!completionEnabled) {
-            // Re-install same completer for next time around and return.
-            Assert.check((sym.flags() & Flags.COMPOUND) == 0);
-            sym.completer = this;
-            return;
-        }
-
-        try {
-            annotate.enterStart();
-
-            ClassSymbol c = (ClassSymbol)sym;
-            ClassType ct = (ClassType)c.type;
-            Env<AttrContext> env = typeEnvs.get(c);
-            JCClassDecl tree = (JCClassDecl)env.tree;
-            boolean wasFirst = isFirst;
-            isFirst = false;
-
-            JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
-            DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos());
-            try {
-                dependencies.push(c);
-
-                // Save class environment for later member enter (2) processing.
-                halfcompleted.append(env);
-
-                // Mark class as not yet attributed.
-                c.flags_field |= UNATTRIBUTED;
-
-                // If this is a toplevel-class, make sure any preceding import
-                // clauses have been seen.
-                if (c.owner.kind == PCK) {
-                    memberEnter(env.toplevel, env.enclosing(TOPLEVEL));
-                    todo.append(env);
-                }
-
-                if (c.owner.kind == TYP)
-                    c.owner.complete();
-
-                // create an environment for evaluating the base clauses
-                Env<AttrContext> baseEnv = baseEnv(tree, env);
-
-                if (tree.extending != null)
-                    annotate.annotateTypeLater(tree.extending, baseEnv, sym, tree.pos());
-                for (JCExpression impl : tree.implementing)
-                    annotate.annotateTypeLater(impl, baseEnv, sym, tree.pos());
-                annotate.flush();
-
-                // Determine supertype.
-                Type supertype;
-                if (tree.extending != null) {
-                    dependencies.push(AttributionKind.EXTENDS, tree.extending);
-                    try {
-                        supertype = attr.attribBase(tree.extending, baseEnv,
-                                true, false, true);
-                    } finally {
-                        dependencies.pop();
-                    }
-                } else {
-                    supertype = ((tree.mods.flags & Flags.ENUM) != 0)
-                    ? attr.attribBase(enumBase(tree.pos, c), baseEnv,
-                                      true, false, false)
-                    : (c.fullname == names.java_lang_Object)
-                    ? Type.noType
-                    : syms.objectType;
-                }
-                ct.supertype_field = modelMissingTypes(supertype, tree.extending, false);
-
-                // Determine interfaces.
-                ListBuffer<Type> interfaces = new ListBuffer<>();
-                ListBuffer<Type> all_interfaces = null; // lazy init
-                Set<Type> interfaceSet = new HashSet<>();
-                List<JCExpression> interfaceTrees = tree.implementing;
-                for (JCExpression iface : interfaceTrees) {
-                    dependencies.push(AttributionKind.IMPLEMENTS, iface);
-                    try {
-                        Type it = attr.attribBase(iface, baseEnv, false, true, true);
-                        if (it.hasTag(CLASS)) {
-                            interfaces.append(it);
-                            if (all_interfaces != null) all_interfaces.append(it);
-                            chk.checkNotRepeated(iface.pos(), types.erasure(it), interfaceSet);
-                        } else {
-                            if (all_interfaces == null)
-                                all_interfaces = new ListBuffer<Type>().appendList(interfaces);
-                            all_interfaces.append(modelMissingTypes(it, iface, true));
-                        }
-                    } finally {
-                        dependencies.pop();
-                    }
-                }
-
-                if ((c.flags_field & ANNOTATION) != 0) {
-                    ct.interfaces_field = List.of(syms.annotationType);
-                    ct.all_interfaces_field = ct.interfaces_field;
-                }  else {
-                    ct.interfaces_field = interfaces.toList();
-                    ct.all_interfaces_field = (all_interfaces == null)
-                            ? ct.interfaces_field : all_interfaces.toList();
-                }
-
-                if (c.fullname == names.java_lang_Object) {
-                    if (tree.extending != null) {
-                        chk.checkNonCyclic(tree.extending.pos(),
-                                           supertype);
-                        ct.supertype_field = Type.noType;
-                    }
-                    else if (tree.implementing.nonEmpty()) {
-                        chk.checkNonCyclic(tree.implementing.head.pos(),
-                                           ct.interfaces_field.head);
-                        ct.interfaces_field = List.nil();
-                    }
-                }
-
-                // Annotations.
-                // In general, we cannot fully process annotations yet,  but we
-                // can attribute the annotation types and then check to see if the
-                // @Deprecated annotation is present.
-                attr.attribAnnotationTypes(tree.mods.annotations, baseEnv);
-                if (hasDeprecatedAnnotation(tree.mods.annotations))
-                    c.flags_field |= DEPRECATED;
-                annotate.annotateLater(tree.mods.annotations, baseEnv,
-                            c, tree.pos());
-
-                chk.checkNonCyclicDecl(tree);
-
-                // class type parameters use baseEnv but everything uses env
-                attr.attribTypeVariables(tree.typarams, baseEnv);
-                for (JCTypeParameter tp : tree.typarams)
-                    annotate.annotateTypeLater(tp, baseEnv, sym, tree.pos());
-
-                // Add default constructor if needed.
-                if ((c.flags() & INTERFACE) == 0 &&
-                    !TreeInfo.hasConstructors(tree.defs)) {
-                    List<Type> argtypes = List.nil();
-                    List<Type> typarams = List.nil();
-                    List<Type> thrown = List.nil();
-                    long ctorFlags = 0;
-                    boolean based = false;
-                    boolean addConstructor = true;
-                    JCNewClass nc = null;
-                    if (c.name.isEmpty()) {
-                        nc = (JCNewClass)env.next.tree;
-                        if (nc.constructor != null) {
-                            addConstructor = nc.constructor.kind != ERR;
-                            Type superConstrType = types.memberType(c.type,
-                                                                    nc.constructor);
-                            argtypes = superConstrType.getParameterTypes();
-                            typarams = superConstrType.getTypeArguments();
-                            ctorFlags = nc.constructor.flags() & VARARGS;
-                            if (nc.encl != null) {
-                                argtypes = argtypes.prepend(nc.encl.type);
-                                based = true;
-                            }
-                            thrown = superConstrType.getThrownTypes();
-                        }
-                    }
-                    if (addConstructor) {
-                        MethodSymbol basedConstructor = nc != null ?
-                                (MethodSymbol)nc.constructor : null;
-                        JCTree constrDef = DefaultConstructor(make.at(tree.pos), c,
-                                                            basedConstructor,
-                                                            typarams, argtypes, thrown,
-                                                            ctorFlags, based);
-                        tree.defs = tree.defs.prepend(constrDef);
-                    }
-                }
-
-                // enter symbols for 'this' into current scope.
-                VarSymbol thisSym =
-                    new VarSymbol(FINAL | HASINIT, names._this, c.type, c);
-                thisSym.pos = Position.FIRSTPOS;
-                env.info.scope.enter(thisSym);
-                // if this is a class, enter symbol for 'super' into current scope.
-                if ((c.flags_field & INTERFACE) == 0 &&
-                        ct.supertype_field.hasTag(CLASS)) {
-                    VarSymbol superSym =
-                        new VarSymbol(FINAL | HASINIT, names._super,
-                                      ct.supertype_field, c);
-                    superSym.pos = Position.FIRSTPOS;
-                    env.info.scope.enter(superSym);
-                }
-
-                // check that no package exists with same fully qualified name,
-                // but admit classes in the unnamed package which have the same
-                // name as a top-level package.
-                if (checkClash &&
-                    c.owner.kind == PCK && c.owner != syms.unnamedPackage &&
-                    syms.packageExists(c.fullname)) {
-                    log.error(tree.pos, "clash.with.pkg.of.same.name", Kinds.kindName(sym), c);
-                }
-                if (c.owner.kind == PCK && (c.flags_field & PUBLIC) == 0 &&
-                    !env.toplevel.sourcefile.isNameCompatible(c.name.toString(),JavaFileObject.Kind.SOURCE)) {
-                    c.flags_field |= AUXILIARY;
-                }
-            } catch (CompletionFailure ex) {
-                chk.completionError(tree.pos(), ex);
-            } finally {
-                deferredLintHandler.setPos(prevLintPos);
-                log.useSource(prev);
-                dependencies.pop();
-            }
-
-            // Enter all member fields and methods of a set of half completed
-            // classes in a second phase.
-            if (wasFirst) {
-                Set<JCCompilationUnit> topLevels = new HashSet<>();
-                try {
-                    while (halfcompleted.nonEmpty()) {
-                        Env<AttrContext> toFinish = halfcompleted.next();
-                        topLevels.add(toFinish.toplevel);
-                        finish(toFinish);
-                        if (allowTypeAnnos) {
-                            typeAnnotations.organizeTypeAnnotationsSignatures(toFinish, (JCClassDecl)toFinish.tree);
-                            typeAnnotations.validateTypeAnnotationsSignatures(toFinish, (JCClassDecl)toFinish.tree);
-                        }
-                    }
-                } finally {
-                    isFirst = true;
-                }
-
-                for (JCCompilationUnit toplevel : topLevels) {
-                    chk.checkImportsResolvable(toplevel);
-                }
-
-            }
-        } finally {
-            annotate.enterDone();
-        }
-    }
-
-    private Env<AttrContext> baseEnv(JCClassDecl tree, Env<AttrContext> env) {
-        WriteableScope baseScope = WriteableScope.create(tree.sym);
-        //import already entered local classes into base scope
-        for (Symbol sym : env.outer.info.scope.getSymbols(NON_RECURSIVE)) {
-            if (sym.isLocal()) {
-                baseScope.enter(sym);
-            }
-        }
-        //import current type-parameters into base scope
-        if (tree.typarams != null)
-            for (List<JCTypeParameter> typarams = tree.typarams;
-                 typarams.nonEmpty();
-                 typarams = typarams.tail)
-                baseScope.enter(typarams.head.type.tsym);
-        Env<AttrContext> outer = env.outer; // the base clause can't see members of this class
-        Env<AttrContext> localEnv = outer.dup(tree, outer.info.dup(baseScope));
-        localEnv.baseClause = true;
-        localEnv.outer = outer;
-        localEnv.info.isSelfCall = false;
-        return localEnv;
-    }
-
-    /** Enter member fields and methods of a class
-     *  @param env        the environment current for the class block.
-     */
-    private void finish(Env<AttrContext> env) {
-        JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
-        try {
-            JCClassDecl tree = (JCClassDecl)env.tree;
-            finishClass(tree, env);
-        } finally {
-            log.useSource(prev);
-        }
-    }
-
-    /** Generate a base clause for an enum type.
-     *  @param pos              The position for trees and diagnostics, if any
-     *  @param c                The class symbol of the enum
-     */
-    private JCExpression enumBase(int pos, ClassSymbol c) {
-        JCExpression result = make.at(pos).
-            TypeApply(make.QualIdent(syms.enumSym),
-                      List.<JCExpression>of(make.Type(c.type)));
-        return result;
-    }
-
-    Type modelMissingTypes(Type t, final JCExpression tree, final boolean interfaceExpected) {
-        if (!t.hasTag(ERROR))
-            return t;
-
-        return new ErrorType(t.getOriginalType(), t.tsym) {
-            private Type modelType;
-
-            @Override
-            public Type getModelType() {
-                if (modelType == null)
-                    modelType = new Synthesizer(getOriginalType(), interfaceExpected).visit(tree);
-                return modelType;
-            }
-        };
-    }
-    // where
-    private class Synthesizer extends JCTree.Visitor {
-        Type originalType;
-        boolean interfaceExpected;
-        List<ClassSymbol> synthesizedSymbols = List.nil();
-        Type result;
-
-        Synthesizer(Type originalType, boolean interfaceExpected) {
-            this.originalType = originalType;
-            this.interfaceExpected = interfaceExpected;
-        }
-
-        Type visit(JCTree tree) {
-            tree.accept(this);
-            return result;
-        }
-
-        List<Type> visit(List<? extends JCTree> trees) {
-            ListBuffer<Type> lb = new ListBuffer<>();
-            for (JCTree t: trees)
-                lb.append(visit(t));
-            return lb.toList();
-        }
-
-        @Override
-        public void visitTree(JCTree tree) {
-            result = syms.errType;
-        }
-
-        @Override
-        public void visitIdent(JCIdent tree) {
-            if (!tree.type.hasTag(ERROR)) {
-                result = tree.type;
-            } else {
-                result = synthesizeClass(tree.name, syms.unnamedPackage).type;
-            }
-        }
-
-        @Override
-        public void visitSelect(JCFieldAccess tree) {
-            if (!tree.type.hasTag(ERROR)) {
-                result = tree.type;
-            } else {
-                Type selectedType;
-                boolean prev = interfaceExpected;
-                try {
-                    interfaceExpected = false;
-                    selectedType = visit(tree.selected);
-                } finally {
-                    interfaceExpected = prev;
-                }
-                ClassSymbol c = synthesizeClass(tree.name, selectedType.tsym);
-                result = c.type;
-            }
-        }
-
-        @Override
-        public void visitTypeApply(JCTypeApply tree) {
-            if (!tree.type.hasTag(ERROR)) {
-                result = tree.type;
-            } else {
-                ClassType clazzType = (ClassType) visit(tree.clazz);
-                if (synthesizedSymbols.contains(clazzType.tsym))
-                    synthesizeTyparams((ClassSymbol) clazzType.tsym, tree.arguments.size());
-                final List<Type> actuals = visit(tree.arguments);
-                result = new ErrorType(tree.type, clazzType.tsym) {
-                    @Override @DefinedBy(Api.LANGUAGE_MODEL)
-                    public List<Type> getTypeArguments() {
-                        return actuals;
-                    }
-                };
-            }
-        }
-
-        ClassSymbol synthesizeClass(Name name, Symbol owner) {
-            int flags = interfaceExpected ? INTERFACE : 0;
-            ClassSymbol c = new ClassSymbol(flags, name, owner);
-            c.members_field = new Scope.ErrorScope(c);
-            c.type = new ErrorType(originalType, c) {
-                @Override @DefinedBy(Api.LANGUAGE_MODEL)
-                public List<Type> getTypeArguments() {
-                    return typarams_field;
-                }
-            };
-            synthesizedSymbols = synthesizedSymbols.prepend(c);
-            return c;
-        }
-
-        void synthesizeTyparams(ClassSymbol sym, int n) {
-            ClassType ct = (ClassType) sym.type;
-            Assert.check(ct.typarams_field.isEmpty());
-            if (n == 1) {
-                TypeVar v = new TypeVar(names.fromString("T"), sym, syms.botType);
-                ct.typarams_field = ct.typarams_field.prepend(v);
-            } else {
-                for (int i = n; i > 0; i--) {
-                    TypeVar v = new TypeVar(names.fromString("T" + i), sym,
-                                            syms.botType);
-                    ct.typarams_field = ct.typarams_field.prepend(v);
-                }
-            }
-        }
-    }
-
-
-/* ***************************************************************************
- * tree building
- ****************************************************************************/
-
-    /** Generate default constructor for given class. For classes different
-     *  from java.lang.Object, this is:
-     *
-     *    c(argtype_0 x_0, ..., argtype_n x_n) throws thrown {
-     *      super(x_0, ..., x_n)
-     *    }
-     *
-     *  or, if based == true:
-     *
-     *    c(argtype_0 x_0, ..., argtype_n x_n) throws thrown {
-     *      x_0.super(x_1, ..., x_n)
-     *    }
-     *
-     *  @param make     The tree factory.
-     *  @param c        The class owning the default constructor.
-     *  @param argtypes The parameter types of the constructor.
-     *  @param thrown   The thrown exceptions of the constructor.
-     *  @param based    Is first parameter a this$n?
-     */
-    JCTree DefaultConstructor(TreeMaker make,
-                            ClassSymbol c,
-                            MethodSymbol baseInit,
-                            List<Type> typarams,
-                            List<Type> argtypes,
-                            List<Type> thrown,
-                            long flags,
-                            boolean based) {
-        JCTree result;
-        if ((c.flags() & ENUM) != 0 &&
-            (types.supertype(c.type).tsym == syms.enumSym)) {
-            // constructors of true enums are private
-            flags = (flags & ~AccessFlags) | PRIVATE | GENERATEDCONSTR;
-        } else
-            flags |= (c.flags() & AccessFlags) | GENERATEDCONSTR;
-        if (c.name.isEmpty()) {
-            flags |= ANONCONSTR;
-        }
-        Type mType = new MethodType(argtypes, null, thrown, c);
-        Type initType = typarams.nonEmpty() ?
-            new ForAll(typarams, mType) :
-            mType;
-        MethodSymbol init = new MethodSymbol(flags, names.init,
-                initType, c);
-        init.params = createDefaultConstructorParams(make, baseInit, init,
-                argtypes, based);
-        List<JCVariableDecl> params = make.Params(argtypes, init);
-        List<JCStatement> stats = List.nil();
-        if (c.type != syms.objectType) {
-            stats = stats.prepend(SuperCall(make, typarams, params, based));
-        }
-        result = make.MethodDef(init, make.Block(0, stats));
-        return result;
-    }
-
-    private List<VarSymbol> createDefaultConstructorParams(
-            TreeMaker make,
-            MethodSymbol baseInit,
-            MethodSymbol init,
-            List<Type> argtypes,
-            boolean based) {
-        List<VarSymbol> initParams = null;
-        List<Type> argTypesList = argtypes;
-        if (based) {
-            /*  In this case argtypes will have an extra type, compared to baseInit,
-             *  corresponding to the type of the enclosing instance i.e.:
-             *
-             *  Inner i = outer.new Inner(1){}
-             *
-             *  in the above example argtypes will be (Outer, int) and baseInit
-             *  will have parameter's types (int). So in this case we have to add
-             *  first the extra type in argtypes and then get the names of the
-             *  parameters from baseInit.
-             */
-            initParams = List.nil();
-            VarSymbol param = new VarSymbol(PARAMETER, make.paramName(0), argtypes.head, init);
-            initParams = initParams.append(param);
-            argTypesList = argTypesList.tail;
-        }
-        if (baseInit != null && baseInit.params != null &&
-            baseInit.params.nonEmpty() && argTypesList.nonEmpty()) {
-            initParams = (initParams == null) ? List.<VarSymbol>nil() : initParams;
-            List<VarSymbol> baseInitParams = baseInit.params;
-            while (baseInitParams.nonEmpty() && argTypesList.nonEmpty()) {
-                VarSymbol param = new VarSymbol(baseInitParams.head.flags() | PARAMETER,
-                        baseInitParams.head.name, argTypesList.head, init);
-                initParams = initParams.append(param);
-                baseInitParams = baseInitParams.tail;
-                argTypesList = argTypesList.tail;
-            }
-        }
-        return initParams;
-    }
-
-    /** Generate call to superclass constructor. This is:
-     *
-     *    super(id_0, ..., id_n)
-     *
-     * or, if based == true
-     *
-     *    id_0.super(id_1,...,id_n)
-     *
-     *  where id_0, ..., id_n are the names of the given parameters.
-     *
-     *  @param make    The tree factory
-     *  @param params  The parameters that need to be passed to super
-     *  @param typarams  The type parameters that need to be passed to super
-     *  @param based   Is first parameter a this$n?
-     */
-    JCExpressionStatement SuperCall(TreeMaker make,
-                   List<Type> typarams,
-                   List<JCVariableDecl> params,
-                   boolean based) {
-        JCExpression meth;
-        if (based) {
-            meth = make.Select(make.Ident(params.head), names._super);
-            params = params.tail;
-        } else {
-            meth = make.Ident(names._super);
-        }
-        List<JCExpression> typeargs = typarams.nonEmpty() ? make.Types(typarams) : null;
-        return make.Exec(make.Apply(typeargs, meth, make.Idents(params)));
-    }
 }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java
new file mode 100644
index 00000000000..367e77641b7
--- /dev/null
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/TypeEnter.java
@@ -0,0 +1,1070 @@
+/*
+ * Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.javac.comp;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.tools.JavaFileObject;
+
+import com.sun.tools.javac.code.*;
+import com.sun.tools.javac.code.Lint.LintCategory;
+import com.sun.tools.javac.code.Scope.ImportFilter;
+import com.sun.tools.javac.code.Scope.NamedImportScope;
+import com.sun.tools.javac.code.Scope.StarImportScope;
+import com.sun.tools.javac.code.Scope.WriteableScope;
+import com.sun.tools.javac.tree.*;
+import com.sun.tools.javac.util.*;
+import com.sun.tools.javac.util.DefinedBy.Api;
+
+import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.code.Type.*;
+import com.sun.tools.javac.tree.JCTree.*;
+
+import static com.sun.tools.javac.code.Flags.*;
+import static com.sun.tools.javac.code.Flags.ANNOTATION;
+import static com.sun.tools.javac.code.Scope.LookupKind.NON_RECURSIVE;
+import static com.sun.tools.javac.code.Kinds.Kind.*;
+import static com.sun.tools.javac.code.TypeTag.CLASS;
+import static com.sun.tools.javac.code.TypeTag.ERROR;
+import static com.sun.tools.javac.tree.JCTree.Tag.*;
+
+import com.sun.tools.javac.util.Dependencies.AttributionKind;
+import com.sun.tools.javac.util.Dependencies.CompletionCause;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticFlag;
+import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
+
+/** This is the second phase of Enter, in which classes are completed
+ *  by resolving their headers and entering their members in the into
+ *  the class scope. See Enter for an overall overview.
+ *
+ *  This class uses internal phases to process the classes. When a phase
+ *  processes classes, the lower phases are not invoked until all classes
+ *  pass through the current phase. Note that it is possible that upper phases
+ *  are run due to recursive completion. The internal phases are:
+ *  - ImportPhase: shallow pass through imports, adds information about imports
+ *                 the NamedImportScope and StarImportScope, but avoids queries
+ *                 about class hierarchy.
+ *  - HierarchyPhase: resolves the supertypes of the given class. Does not handle
+ *                    type parameters of the class or type argument of the supertypes.
+ *  - HeaderPhase: finishes analysis of the header of the given class by resolving
+ *                 type parameters, attributing supertypes including type arguments
+ *                 and scheduling full annotation attribution. This phase also adds
+ *                 a synthetic default constructor if needed and synthetic "this" field.
+ *  - MembersPhase: resolves headers for fields, methods and constructors in the given class.
+ *                  Also generates synthetic enum members.
+ *
+ *  <p><b>This is NOT part of any supported API.
+ *  If you write code that depends on this, you do so at your own risk.
+ *  This code and its internal interfaces are subject to change or
+ *  deletion without notice.</b>
+ */
+public class TypeEnter implements Completer {
+    protected static final Context.Key<TypeEnter> typeEnterKey = new Context.Key<>();
+
+    /** A switch to determine whether we check for package/class conflicts
+     */
+    final static boolean checkClash = true;
+
+    private final Names names;
+    private final Enter enter;
+    private final MemberEnter memberEnter;
+    private final Log log;
+    private final Check chk;
+    private final Attr attr;
+    private final Symtab syms;
+    private final TreeMaker make;
+    private final Todo todo;
+    private final Annotate annotate;
+    private final TypeAnnotations typeAnnotations;
+    private final Types types;
+    private final JCDiagnostic.Factory diags;
+    private final Source source;
+    private final DeferredLintHandler deferredLintHandler;
+    private final Lint lint;
+    private final TypeEnvs typeEnvs;
+    private final Dependencies dependencies;
+
+    public static TypeEnter instance(Context context) {
+        TypeEnter instance = context.get(typeEnterKey);
+        if (instance == null)
+            instance = new TypeEnter(context);
+        return instance;
+    }
+
+    protected TypeEnter(Context context) {
+        context.put(typeEnterKey, this);
+        names = Names.instance(context);
+        enter = Enter.instance(context);
+        memberEnter = MemberEnter.instance(context);
+        log = Log.instance(context);
+        chk = Check.instance(context);
+        attr = Attr.instance(context);
+        syms = Symtab.instance(context);
+        make = TreeMaker.instance(context);
+        todo = Todo.instance(context);
+        annotate = Annotate.instance(context);
+        typeAnnotations = TypeAnnotations.instance(context);
+        types = Types.instance(context);
+        diags = JCDiagnostic.Factory.instance(context);
+        source = Source.instance(context);
+        deferredLintHandler = DeferredLintHandler.instance(context);
+        lint = Lint.instance(context);
+        typeEnvs = TypeEnvs.instance(context);
+        dependencies = Dependencies.instance(context);
+        allowTypeAnnos = source.allowTypeAnnotations();
+        allowDeprecationOnImport = source.allowDeprecationOnImport();
+    }
+
+    /** Switch: support type annotations.
+     */
+    boolean allowTypeAnnos;
+
+    /**
+     * Switch: should deprecation warnings be issued on import
+     */
+    boolean allowDeprecationOnImport;
+
+    /** A flag to disable completion from time to time during member
+     *  enter, as we only need to look up types.  This avoids
+     *  unnecessarily deep recursion.
+     */
+    boolean completionEnabled = true;
+
+    /* Verify Imports:
+     */
+    protected void ensureImportsChecked(List<JCCompilationUnit> trees) {
+        // if there remain any unimported toplevels (these must have
+        // no classes at all), process their import statements as well.
+        for (JCCompilationUnit tree : trees) {
+            if (tree.starImportScope.isEmpty()) {
+                Env<AttrContext> topEnv = enter.topLevelEnv(tree);
+                finishImports(tree, () -> { completeClass.resolveImports(tree, topEnv); });
+            }
+       }
+    }
+
+/* ********************************************************************
+ * Source completer
+ *********************************************************************/
+
+    /** Complete entering a class.
+     *  @param sym         The symbol of the class to be completed.
+     */
+    public void complete(Symbol sym) throws CompletionFailure {
+        // Suppress some (recursive) MemberEnter invocations
+        if (!completionEnabled) {
+            // Re-install same completer for next time around and return.
+            Assert.check((sym.flags() & Flags.COMPOUND) == 0);
+            sym.completer = this;
+            return;
+        }
+
+        try {
+            annotate.enterStart();
+            sym.flags_field |= UNATTRIBUTED;
+
+            List<Env<AttrContext>> queue;
+
+            dependencies.push((ClassSymbol) sym, CompletionCause.MEMBER_ENTER);
+            try {
+                queue = completeClass.runPhase(List.of(typeEnvs.get((ClassSymbol) sym)));
+            } finally {
+                dependencies.pop();
+            }
+
+            if (!queue.isEmpty()) {
+                Set<JCCompilationUnit> seen = new HashSet<>();
+
+                for (Env<AttrContext> env : queue) {
+                    if (env.toplevel.defs.contains(env.enclClass) && seen.add(env.toplevel)) {
+                        finishImports(env.toplevel, () -> {});
+                    }
+                }
+            }
+        } finally {
+            annotate.enterDone();
+        }
+    }
+
+    void finishImports(JCCompilationUnit toplevel, Runnable resolve) {
+        JavaFileObject prev = log.useSource(toplevel.sourcefile);
+        try {
+            resolve.run();
+            chk.checkImportsUnique(toplevel);
+            chk.checkImportsResolvable(toplevel);
+            toplevel.namedImportScope.finalizeScope();
+            toplevel.starImportScope.finalizeScope();
+        } finally {
+            log.useSource(prev);
+        }
+    }
+
+    abstract class Phase {
+        private final ListBuffer<Env<AttrContext>> queue = new ListBuffer<>();
+        private final Phase next;
+        private final CompletionCause phaseName;
+
+        Phase(CompletionCause phaseName, Phase next) {
+            this.phaseName = phaseName;
+            this.next = next;
+        }
+
+        public List<Env<AttrContext>> runPhase(List<Env<AttrContext>> envs) {
+            boolean firstToComplete = queue.isEmpty();
+
+            for (Env<AttrContext> env : envs) {
+                JCClassDecl tree = (JCClassDecl)env.tree;
+
+                queue.add(env);
+
+                JavaFileObject prev = log.useSource(env.toplevel.sourcefile);
+                DiagnosticPosition prevLintPos = deferredLintHandler.setPos(tree.pos());
+                try {
+                    dependencies.push(env.enclClass.sym, phaseName);
+                    doRunPhase(env);
+                } catch (CompletionFailure ex) {
+                    chk.completionError(tree.pos(), ex);
+                } finally {
+                    dependencies.pop();
+                    deferredLintHandler.setPos(prevLintPos);
+                    log.useSource(prev);
+                }
+            }
+
+            if (firstToComplete) {
+                List<Env<AttrContext>> out = queue.toList();
+
+                queue.clear();
+                return next != null ? next.runPhase(out) : out;
+            } else {
+                return List.nil();
+            }
+       }
+
+        protected abstract void doRunPhase(Env<AttrContext> env);
+    }
+
+    private final ImportsPhase completeClass = new ImportsPhase();
+
+    /**Analyze import clauses.
+     */
+    private final class ImportsPhase extends Phase {
+
+        public ImportsPhase() {
+            super(CompletionCause.IMPORTS_PHASE, new HierarchyPhase());
+        }
+
+        Env<AttrContext> env;
+        ImportFilter staticImportFilter;
+        ImportFilter typeImportFilter = new ImportFilter() {
+            @Override
+            public boolean accepts(Scope origin, Symbol t) {
+                return t.kind == TYP;
+            }
+        };
+
+        @Override
+        protected void doRunPhase(Env<AttrContext> env) {
+            JCClassDecl tree = env.enclClass;
+            ClassSymbol sym = tree.sym;
+
+            // If sym is a toplevel-class, make sure any import
+            // clauses in its source file have been seen.
+            if (sym.owner.kind == PCK) {
+                resolveImports(env.toplevel, env.enclosing(TOPLEVEL));
+                todo.append(env);
+            }
+
+            if (sym.owner.kind == TYP)
+                sym.owner.complete();
+        }
+
+        private void resolveImports(JCCompilationUnit tree, Env<AttrContext> env) {
+            if (!tree.starImportScope.isEmpty()) {
+                // we must have already processed this toplevel
+                return;
+            }
+
+            ImportFilter prevStaticImportFilter = staticImportFilter;
+            DiagnosticPosition prevLintPos = deferredLintHandler.immediate();
+            Lint prevLint = chk.setLint(lint);
+            Env<AttrContext> prevEnv = this.env;
+            try {
+                this.env = env;
+                final PackageSymbol packge = env.toplevel.packge;
+                this.staticImportFilter = new ImportFilter() {
+                    @Override
+                    public boolean accepts(Scope origin, Symbol sym) {
+                        return sym.isStatic() &&
+                               chk.staticImportAccessible(sym, packge) &&
+                               sym.isMemberOf((TypeSymbol) origin.owner, types);
+                    }
+                };
+
+                // Import-on-demand java.lang.
+                importAll(tree.pos, syms.enterPackage(names.java_lang), env);
+
+                // Process the package def and all import clauses.
+                if (tree.getPackage() != null)
+                    checkClassPackageClash(tree.getPackage());
+
+                for (JCImport imp : tree.getImports()) {
+                    doImport(imp);
+                }
+            } finally {
+                this.env = prevEnv;
+                chk.setLint(prevLint);
+                deferredLintHandler.setPos(prevLintPos);
+                this.staticImportFilter = prevStaticImportFilter;
+            }
+        }
+
+        private void checkClassPackageClash(JCPackageDecl tree) {
+            // check that no class exists with same fully qualified name as
+            // toplevel package
+            if (checkClash && tree.pid != null) {
+                Symbol p = env.toplevel.packge;
+                while (p.owner != syms.rootPackage) {
+                    p.owner.complete(); // enter all class members of p
+                    if (syms.classes.get(p.getQualifiedName()) != null) {
+                        log.error(tree.pos,
+                                  "pkg.clashes.with.class.of.same.name",
+                                  p);
+                    }
+                    p = p.owner;
+                }
+            }
+            // process package annotations
+            annotate.annotateLater(tree.annotations, env, env.toplevel.packge, null);
+        }
+
+        private void doImport(JCImport tree) {
+            dependencies.push(AttributionKind.IMPORT, tree);
+            JCFieldAccess imp = (JCFieldAccess)tree.qualid;
+            Name name = TreeInfo.name(imp);
+
+            // Create a local environment pointing to this tree to disable
+            // effects of other imports in Resolve.findGlobalType
+            Env<AttrContext> localEnv = env.dup(tree);
+
+            TypeSymbol p = attr.attribImportQualifier(tree, localEnv).tsym;
+            if (name == names.asterisk) {
+                // Import on demand.
+                chk.checkCanonical(imp.selected);
+                if (tree.staticImport)
+                    importStaticAll(tree.pos, p, env);
+                else
+                    importAll(tree.pos, p, env);
+            } else {
+                // Named type import.
+                if (tree.staticImport) {
+                    importNamedStatic(tree.pos(), p, name, localEnv, tree);
+                    chk.checkCanonical(imp.selected);
+                } else {
+                    TypeSymbol c = attribImportType(imp, localEnv).tsym;
+                    chk.checkCanonical(imp);
+                    importNamed(tree.pos(), c, env, tree);
+                }
+            }
+            dependencies.pop();
+        }
+
+        Type attribImportType(JCTree tree, Env<AttrContext> env) {
+            Assert.check(completionEnabled);
+            Lint prevLint = chk.setLint(allowDeprecationOnImport ?
+                    lint : lint.suppress(LintCategory.DEPRECATION));
+            try {
+                // To prevent deep recursion, suppress completion of some
+                // types.
+                completionEnabled = false;
+                return attr.attribType(tree, env);
+            } finally {
+                completionEnabled = true;
+                chk.setLint(prevLint);
+            }
+        }
+
+        /** Import all classes of a class or package on demand.
+         *  @param pos           Position to be used for error reporting.
+         *  @param tsym          The class or package the members of which are imported.
+         *  @param env           The env in which the imported classes will be entered.
+         */
+        private void importAll(int pos,
+                               final TypeSymbol tsym,
+                               Env<AttrContext> env) {
+            // Check that packages imported from exist (JLS ???).
+            if (tsym.kind == PCK && tsym.members().isEmpty() && !tsym.exists()) {
+                // If we can't find java.lang, exit immediately.
+                if (((PackageSymbol)tsym).fullname.equals(names.java_lang)) {
+                    JCDiagnostic msg = diags.fragment("fatal.err.no.java.lang");
+                    throw new FatalError(msg);
+                } else {
+                    log.error(DiagnosticFlag.RESOLVE_ERROR, pos, "doesnt.exist", tsym);
+                }
+            }
+            env.toplevel.starImportScope.importAll(types, tsym.members(), typeImportFilter, false);
+        }
+
+        /** Import all static members of a class or package on demand.
+         *  @param pos           Position to be used for error reporting.
+         *  @param tsym          The class or package the members of which are imported.
+         *  @param env           The env in which the imported classes will be entered.
+         */
+        private void importStaticAll(int pos,
+                                     final TypeSymbol tsym,
+                                     Env<AttrContext> env) {
+            final StarImportScope toScope = env.toplevel.starImportScope;
+            final TypeSymbol origin = tsym;
+
+            toScope.importAll(types, origin.members(), staticImportFilter, true);
+        }
+
+        /** Import statics types of a given name.  Non-types are handled in Attr.
+         *  @param pos           Position to be used for error reporting.
+         *  @param tsym          The class from which the name is imported.
+         *  @param name          The (simple) name being imported.
+         *  @param env           The environment containing the named import
+         *                  scope to add to.
+         */
+        private void importNamedStatic(final DiagnosticPosition pos,
+                                       final TypeSymbol tsym,
+                                       final Name name,
+                                       final Env<AttrContext> env,
+                                       final JCImport imp) {
+            if (tsym.kind != TYP) {
+                log.error(DiagnosticFlag.RECOVERABLE, pos, "static.imp.only.classes.and.interfaces");
+                return;
+            }
+
+            final NamedImportScope toScope = env.toplevel.namedImportScope;
+            final Scope originMembers = tsym.members();
+
+            imp.importScope = toScope.importByName(types, originMembers, name, staticImportFilter);
+        }
+
+        /** Import given class.
+         *  @param pos           Position to be used for error reporting.
+         *  @param tsym          The class to be imported.
+         *  @param env           The environment containing the named import
+         *                  scope to add to.
+         */
+        private void importNamed(DiagnosticPosition pos, final Symbol tsym, Env<AttrContext> env, JCImport imp) {
+            if (tsym.kind == TYP)
+                imp.importScope = env.toplevel.namedImportScope.importType(tsym.owner.members(), tsym.owner.members(), tsym);
+        }
+
+    }
+
+    /**Defines common utility methods used by the HierarchyPhase and HeaderPhase.
+     */
+    private abstract class AbstractHeaderPhase extends Phase {
+
+        public AbstractHeaderPhase(CompletionCause phaseName, Phase next) {
+            super(phaseName, next);
+        }
+
+        protected Env<AttrContext> baseEnv(JCClassDecl tree, Env<AttrContext> env) {
+            WriteableScope baseScope = WriteableScope.create(tree.sym);
+            //import already entered local classes into base scope
+            for (Symbol sym : env.outer.info.scope.getSymbols(NON_RECURSIVE)) {
+                if (sym.isLocal()) {
+                    baseScope.enter(sym);
+                }
+            }
+            //import current type-parameters into base scope
+            if (tree.typarams != null)
+                for (List<JCTypeParameter> typarams = tree.typarams;
+                     typarams.nonEmpty();
+                     typarams = typarams.tail)
+                    baseScope.enter(typarams.head.type.tsym);
+            Env<AttrContext> outer = env.outer; // the base clause can't see members of this class
+            Env<AttrContext> localEnv = outer.dup(tree, outer.info.dup(baseScope));
+            localEnv.baseClause = true;
+            localEnv.outer = outer;
+            localEnv.info.isSelfCall = false;
+            return localEnv;
+        }
+
+        /** Generate a base clause for an enum type.
+         *  @param pos              The position for trees and diagnostics, if any
+         *  @param c                The class symbol of the enum
+         */
+        protected  JCExpression enumBase(int pos, ClassSymbol c) {
+            JCExpression result = make.at(pos).
+                TypeApply(make.QualIdent(syms.enumSym),
+                          List.<JCExpression>of(make.Type(c.type)));
+            return result;
+        }
+
+        protected Type modelMissingTypes(Type t, final JCExpression tree, final boolean interfaceExpected) {
+            if (!t.hasTag(ERROR))
+                return t;
+
+            return new ErrorType(t.getOriginalType(), t.tsym) {
+                private Type modelType;
+
+                @Override
+                public Type getModelType() {
+                    if (modelType == null)
+                        modelType = new Synthesizer(getOriginalType(), interfaceExpected).visit(tree);
+                    return modelType;
+                }
+            };
+        }
+            // where:
+            private class Synthesizer extends JCTree.Visitor {
+                Type originalType;
+                boolean interfaceExpected;
+                List<ClassSymbol> synthesizedSymbols = List.nil();
+                Type result;
+
+                Synthesizer(Type originalType, boolean interfaceExpected) {
+                    this.originalType = originalType;
+                    this.interfaceExpected = interfaceExpected;
+                }
+
+                Type visit(JCTree tree) {
+                    tree.accept(this);
+                    return result;
+                }
+
+                List<Type> visit(List<? extends JCTree> trees) {
+                    ListBuffer<Type> lb = new ListBuffer<>();
+                    for (JCTree t: trees)
+                        lb.append(visit(t));
+                    return lb.toList();
+                }
+
+                @Override
+                public void visitTree(JCTree tree) {
+                    result = syms.errType;
+                }
+
+                @Override
+                public void visitIdent(JCIdent tree) {
+                    if (!tree.type.hasTag(ERROR)) {
+                        result = tree.type;
+                    } else {
+                        result = synthesizeClass(tree.name, syms.unnamedPackage).type;
+                    }
+                }
+
+                @Override
+                public void visitSelect(JCFieldAccess tree) {
+                    if (!tree.type.hasTag(ERROR)) {
+                        result = tree.type;
+                    } else {
+                        Type selectedType;
+                        boolean prev = interfaceExpected;
+                        try {
+                            interfaceExpected = false;
+                            selectedType = visit(tree.selected);
+                        } finally {
+                            interfaceExpected = prev;
+                        }
+                        ClassSymbol c = synthesizeClass(tree.name, selectedType.tsym);
+                        result = c.type;
+                    }
+                }
+
+                @Override
+                public void visitTypeApply(JCTypeApply tree) {
+                    if (!tree.type.hasTag(ERROR)) {
+                        result = tree.type;
+                    } else {
+                        ClassType clazzType = (ClassType) visit(tree.clazz);
+                        if (synthesizedSymbols.contains(clazzType.tsym))
+                            synthesizeTyparams((ClassSymbol) clazzType.tsym, tree.arguments.size());
+                        final List<Type> actuals = visit(tree.arguments);
+                        result = new ErrorType(tree.type, clazzType.tsym) {
+                            @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                            public List<Type> getTypeArguments() {
+                                return actuals;
+                            }
+                        };
+                    }
+                }
+
+                ClassSymbol synthesizeClass(Name name, Symbol owner) {
+                    int flags = interfaceExpected ? INTERFACE : 0;
+                    ClassSymbol c = new ClassSymbol(flags, name, owner);
+                    c.members_field = new Scope.ErrorScope(c);
+                    c.type = new ErrorType(originalType, c) {
+                        @Override @DefinedBy(Api.LANGUAGE_MODEL)
+                        public List<Type> getTypeArguments() {
+                            return typarams_field;
+                        }
+                    };
+                    synthesizedSymbols = synthesizedSymbols.prepend(c);
+                    return c;
+                }
+
+                void synthesizeTyparams(ClassSymbol sym, int n) {
+                    ClassType ct = (ClassType) sym.type;
+                    Assert.check(ct.typarams_field.isEmpty());
+                    if (n == 1) {
+                        TypeVar v = new TypeVar(names.fromString("T"), sym, syms.botType);
+                        ct.typarams_field = ct.typarams_field.prepend(v);
+                    } else {
+                        for (int i = n; i > 0; i--) {
+                            TypeVar v = new TypeVar(names.fromString("T" + i), sym,
+                                                    syms.botType);
+                            ct.typarams_field = ct.typarams_field.prepend(v);
+                        }
+                    }
+                }
+            }
+
+        protected void attribSuperTypes(Env<AttrContext> env, Env<AttrContext> baseEnv) {
+            JCClassDecl tree = env.enclClass;
+            ClassSymbol sym = tree.sym;
+            ClassType ct = (ClassType)sym.type;
+            // Determine supertype.
+            Type supertype;
+            JCExpression extending;
+
+            if (tree.extending != null) {
+                extending = clearTypeParams(tree.extending);
+                dependencies.push(AttributionKind.EXTENDS, tree.extending);
+                try {
+                    supertype = attr.attribBase(extending, baseEnv,
+                                                true, false, true);
+                } finally {
+                    dependencies.pop();
+                }
+            } else {
+                extending = null;
+                supertype = ((tree.mods.flags & Flags.ENUM) != 0)
+                ? attr.attribBase(enumBase(tree.pos, sym), baseEnv,
+                                  true, false, false)
+                : (sym.fullname == names.java_lang_Object)
+                ? Type.noType
+                : syms.objectType;
+            }
+            ct.supertype_field = modelMissingTypes(supertype, extending, false);
+
+            // Determine interfaces.
+            ListBuffer<Type> interfaces = new ListBuffer<>();
+            ListBuffer<Type> all_interfaces = null; // lazy init
+            List<JCExpression> interfaceTrees = tree.implementing;
+            for (JCExpression iface : interfaceTrees) {
+                iface = clearTypeParams(iface);
+                dependencies.push(AttributionKind.IMPLEMENTS, iface);
+                try {
+                    Type it = attr.attribBase(iface, baseEnv, false, true, true);
+                    if (it.hasTag(CLASS)) {
+                        interfaces.append(it);
+                        if (all_interfaces != null) all_interfaces.append(it);
+                    } else {
+                        if (all_interfaces == null)
+                            all_interfaces = new ListBuffer<Type>().appendList(interfaces);
+                        all_interfaces.append(modelMissingTypes(it, iface, true));
+
+                    }
+                } finally {
+                    dependencies.pop();
+                }
+            }
+
+            if ((sym.flags_field & ANNOTATION) != 0) {
+                ct.interfaces_field = List.of(syms.annotationType);
+                ct.all_interfaces_field = ct.interfaces_field;
+            }  else {
+                ct.interfaces_field = interfaces.toList();
+                ct.all_interfaces_field = (all_interfaces == null)
+                        ? ct.interfaces_field : all_interfaces.toList();
+            }
+        }
+            //where:
+            protected JCExpression clearTypeParams(JCExpression superType) {
+                return superType;
+            }
+    }
+
+    private final class HierarchyPhase extends AbstractHeaderPhase {
+
+        public HierarchyPhase() {
+            super(CompletionCause.HIERARCHY_PHASE, new HeaderPhase());
+        }
+
+        @Override
+        protected void doRunPhase(Env<AttrContext> env) {
+            JCClassDecl tree = env.enclClass;
+            ClassSymbol sym = tree.sym;
+            ClassType ct = (ClassType)sym.type;
+
+            Env<AttrContext> baseEnv = baseEnv(tree, env);
+
+            attribSuperTypes(env, baseEnv);
+
+            if (sym.fullname == names.java_lang_Object) {
+                if (tree.extending != null) {
+                    chk.checkNonCyclic(tree.extending.pos(),
+                                       ct.supertype_field);
+                    ct.supertype_field = Type.noType;
+                }
+                else if (tree.implementing.nonEmpty()) {
+                    chk.checkNonCyclic(tree.implementing.head.pos(),
+                                       ct.interfaces_field.head);
+                    ct.interfaces_field = List.nil();
+                }
+            }
+
+            // Annotations.
+            // In general, we cannot fully process annotations yet,  but we
+            // can attribute the annotation types and then check to see if the
+            // @Deprecated annotation is present.
+            attr.attribAnnotationTypes(tree.mods.annotations, baseEnv);
+            if (hasDeprecatedAnnotation(tree.mods.annotations))
+                sym.flags_field |= DEPRECATED;
+
+            chk.checkNonCyclicDecl(tree);
+        }
+            //where:
+            protected JCExpression clearTypeParams(JCExpression superType) {
+                switch (superType.getTag()) {
+                    case TYPEAPPLY:
+                        return ((JCTypeApply) superType).clazz;
+                }
+
+                return superType;
+            }
+
+            /**
+             * Check if a list of annotations contains a reference to
+             * java.lang.Deprecated.
+             **/
+            private boolean hasDeprecatedAnnotation(List<JCAnnotation> annotations) {
+                for (List<JCAnnotation> al = annotations; !al.isEmpty(); al = al.tail) {
+                    JCAnnotation a = al.head;
+                    if (a.annotationType.type == syms.deprecatedType && a.args.isEmpty())
+                        return true;
+                }
+                return false;
+            }
+    }
+
+    private final class HeaderPhase extends AbstractHeaderPhase {
+
+        public HeaderPhase() {
+            super(CompletionCause.HEADER_PHASE, new MembersPhase());
+        }
+
+        @Override
+        protected void doRunPhase(Env<AttrContext> env) {
+            JCClassDecl tree = env.enclClass;
+            ClassSymbol sym = tree.sym;
+            ClassType ct = (ClassType)sym.type;
+
+            // create an environment for evaluating the base clauses
+            Env<AttrContext> baseEnv = baseEnv(tree, env);
+
+            if (tree.extending != null)
+                annotate.annotateTypeLater(tree.extending, baseEnv, sym, tree.pos());
+            for (JCExpression impl : tree.implementing)
+                annotate.annotateTypeLater(impl, baseEnv, sym, tree.pos());
+            annotate.flush();
+
+            attribSuperTypes(env, baseEnv);
+
+            Set<Type> interfaceSet = new HashSet<>();
+
+            for (JCExpression iface : tree.implementing) {
+                Type it = iface.type;
+                if (it.hasTag(CLASS))
+                    chk.checkNotRepeated(iface.pos(), types.erasure(it), interfaceSet);
+            }
+
+            annotate.annotateLater(tree.mods.annotations, baseEnv,
+                        sym, tree.pos());
+
+            attr.attribTypeVariables(tree.typarams, baseEnv);
+            for (JCTypeParameter tp : tree.typarams)
+                annotate.annotateTypeLater(tp, baseEnv, sym, tree.pos());
+
+            // check that no package exists with same fully qualified name,
+            // but admit classes in the unnamed package which have the same
+            // name as a top-level package.
+            if (checkClash &&
+                sym.owner.kind == PCK && sym.owner != syms.unnamedPackage &&
+                syms.packageExists(sym.fullname)) {
+                log.error(tree.pos, "clash.with.pkg.of.same.name", Kinds.kindName(sym), sym);
+            }
+            if (sym.owner.kind == PCK && (sym.flags_field & PUBLIC) == 0 &&
+                !env.toplevel.sourcefile.isNameCompatible(sym.name.toString(),JavaFileObject.Kind.SOURCE)) {
+                sym.flags_field |= AUXILIARY;
+            }
+        }
+    }
+
+    /** Enter member fields and methods of a class
+     */
+    private final class MembersPhase extends Phase {
+
+        public MembersPhase() {
+            super(CompletionCause.MEMBERS_PHASE, null);
+        }
+
+        @Override
+        protected void doRunPhase(Env<AttrContext> env) {
+            JCClassDecl tree = env.enclClass;
+            ClassSymbol sym = tree.sym;
+            ClassType ct = (ClassType)sym.type;
+
+            // Add default constructor if needed.
+            if ((sym.flags() & INTERFACE) == 0 &&
+                !TreeInfo.hasConstructors(tree.defs)) {
+                List<Type> argtypes = List.nil();
+                List<Type> typarams = List.nil();
+                List<Type> thrown = List.nil();
+                long ctorFlags = 0;
+                boolean based = false;
+                boolean addConstructor = true;
+                JCNewClass nc = null;
+                if (sym.name.isEmpty()) {
+                    nc = (JCNewClass)env.next.tree;
+                    if (nc.constructor != null) {
+                        addConstructor = nc.constructor.kind != ERR;
+                        Type superConstrType = types.memberType(sym.type,
+                                                                nc.constructor);
+                        argtypes = superConstrType.getParameterTypes();
+                        typarams = superConstrType.getTypeArguments();
+                        ctorFlags = nc.constructor.flags() & VARARGS;
+                        if (nc.encl != null) {
+                            argtypes = argtypes.prepend(nc.encl.type);
+                            based = true;
+                        }
+                        thrown = superConstrType.getThrownTypes();
+                    }
+                }
+                if (addConstructor) {
+                    MethodSymbol basedConstructor = nc != null ?
+                            (MethodSymbol)nc.constructor : null;
+                    JCTree constrDef = DefaultConstructor(make.at(tree.pos), sym,
+                                                        basedConstructor,
+                                                        typarams, argtypes, thrown,
+                                                        ctorFlags, based);
+                    tree.defs = tree.defs.prepend(constrDef);
+                }
+            }
+
+            // enter symbols for 'this' into current scope.
+            VarSymbol thisSym =
+                new VarSymbol(FINAL | HASINIT, names._this, sym.type, sym);
+            thisSym.pos = Position.FIRSTPOS;
+            env.info.scope.enter(thisSym);
+            // if this is a class, enter symbol for 'super' into current scope.
+            if ((sym.flags_field & INTERFACE) == 0 &&
+                    ct.supertype_field.hasTag(CLASS)) {
+                VarSymbol superSym =
+                    new VarSymbol(FINAL | HASINIT, names._super,
+                                  ct.supertype_field, sym);
+                superSym.pos = Position.FIRSTPOS;
+                env.info.scope.enter(superSym);
+            }
+
+            finishClass(tree, env);
+
+            if (allowTypeAnnos) {
+                typeAnnotations.organizeTypeAnnotationsSignatures(env, (JCClassDecl)env.tree);
+                typeAnnotations.validateTypeAnnotationsSignatures(env, (JCClassDecl)env.tree);
+            }
+        }
+
+        /** Enter members for a class.
+         */
+        void finishClass(JCClassDecl tree, Env<AttrContext> env) {
+            if ((tree.mods.flags & Flags.ENUM) != 0 &&
+                (types.supertype(tree.sym.type).tsym.flags() & Flags.ENUM) == 0) {
+                addEnumMembers(tree, env);
+            }
+            memberEnter.memberEnter(tree.defs, env);
+        }
+
+        /** Add the implicit members for an enum type
+         *  to the symbol table.
+         */
+        private void addEnumMembers(JCClassDecl tree, Env<AttrContext> env) {
+            JCExpression valuesType = make.Type(new ArrayType(tree.sym.type, syms.arrayClass));
+
+            // public static T[] values() { return ???; }
+            JCMethodDecl values = make.
+                MethodDef(make.Modifiers(Flags.PUBLIC|Flags.STATIC),
+                          names.values,
+                          valuesType,
+                          List.<JCTypeParameter>nil(),
+                          List.<JCVariableDecl>nil(),
+                          List.<JCExpression>nil(), // thrown
+                          null, //make.Block(0, Tree.emptyList.prepend(make.Return(make.Ident(names._null)))),
+                          null);
+            memberEnter.memberEnter(values, env);
+
+            // public static T valueOf(String name) { return ???; }
+            JCMethodDecl valueOf = make.
+                MethodDef(make.Modifiers(Flags.PUBLIC|Flags.STATIC),
+                          names.valueOf,
+                          make.Type(tree.sym.type),
+                          List.<JCTypeParameter>nil(),
+                          List.of(make.VarDef(make.Modifiers(Flags.PARAMETER |
+                                                             Flags.MANDATED),
+                                                names.fromString("name"),
+                                                make.Type(syms.stringType), null)),
+                          List.<JCExpression>nil(), // thrown
+                          null, //make.Block(0, Tree.emptyList.prepend(make.Return(make.Ident(names._null)))),
+                          null);
+            memberEnter.memberEnter(valueOf, env);
+        }
+
+    }
+
+/* ***************************************************************************
+ * tree building
+ ****************************************************************************/
+
+    /** Generate default constructor for given class. For classes different
+     *  from java.lang.Object, this is:
+     *
+     *    c(argtype_0 x_0, ..., argtype_n x_n) throws thrown {
+     *      super(x_0, ..., x_n)
+     *    }
+     *
+     *  or, if based == true:
+     *
+     *    c(argtype_0 x_0, ..., argtype_n x_n) throws thrown {
+     *      x_0.super(x_1, ..., x_n)
+     *    }
+     *
+     *  @param make     The tree factory.
+     *  @param c        The class owning the default constructor.
+     *  @param argtypes The parameter types of the constructor.
+     *  @param thrown   The thrown exceptions of the constructor.
+     *  @param based    Is first parameter a this$n?
+     */
+    JCTree DefaultConstructor(TreeMaker make,
+                            ClassSymbol c,
+                            MethodSymbol baseInit,
+                            List<Type> typarams,
+                            List<Type> argtypes,
+                            List<Type> thrown,
+                            long flags,
+                            boolean based) {
+        JCTree result;
+        if ((c.flags() & ENUM) != 0 &&
+            (types.supertype(c.type).tsym == syms.enumSym)) {
+            // constructors of true enums are private
+            flags = (flags & ~AccessFlags) | PRIVATE | GENERATEDCONSTR;
+        } else
+            flags |= (c.flags() & AccessFlags) | GENERATEDCONSTR;
+        if (c.name.isEmpty()) {
+            flags |= ANONCONSTR;
+        }
+        Type mType = new MethodType(argtypes, null, thrown, c);
+        Type initType = typarams.nonEmpty() ?
+            new ForAll(typarams, mType) :
+            mType;
+        MethodSymbol init = new MethodSymbol(flags, names.init,
+                initType, c);
+        init.params = createDefaultConstructorParams(make, baseInit, init,
+                argtypes, based);
+        List<JCVariableDecl> params = make.Params(argtypes, init);
+        List<JCStatement> stats = List.nil();
+        if (c.type != syms.objectType) {
+            stats = stats.prepend(SuperCall(make, typarams, params, based));
+        }
+        result = make.MethodDef(init, make.Block(0, stats));
+        return result;
+    }
+
+    private List<VarSymbol> createDefaultConstructorParams(
+            TreeMaker make,
+            MethodSymbol baseInit,
+            MethodSymbol init,
+            List<Type> argtypes,
+            boolean based) {
+        List<VarSymbol> initParams = null;
+        List<Type> argTypesList = argtypes;
+        if (based) {
+            /*  In this case argtypes will have an extra type, compared to baseInit,
+             *  corresponding to the type of the enclosing instance i.e.:
+             *
+             *  Inner i = outer.new Inner(1){}
+             *
+             *  in the above example argtypes will be (Outer, int) and baseInit
+             *  will have parameter's types (int). So in this case we have to add
+             *  first the extra type in argtypes and then get the names of the
+             *  parameters from baseInit.
+             */
+            initParams = List.nil();
+            VarSymbol param = new VarSymbol(PARAMETER, make.paramName(0), argtypes.head, init);
+            initParams = initParams.append(param);
+            argTypesList = argTypesList.tail;
+        }
+        if (baseInit != null && baseInit.params != null &&
+            baseInit.params.nonEmpty() && argTypesList.nonEmpty()) {
+            initParams = (initParams == null) ? List.<VarSymbol>nil() : initParams;
+            List<VarSymbol> baseInitParams = baseInit.params;
+            while (baseInitParams.nonEmpty() && argTypesList.nonEmpty()) {
+                VarSymbol param = new VarSymbol(baseInitParams.head.flags() | PARAMETER,
+                        baseInitParams.head.name, argTypesList.head, init);
+                initParams = initParams.append(param);
+                baseInitParams = baseInitParams.tail;
+                argTypesList = argTypesList.tail;
+            }
+        }
+        return initParams;
+    }
+
+    /** Generate call to superclass constructor. This is:
+     *
+     *    super(id_0, ..., id_n)
+     *
+     * or, if based == true
+     *
+     *    id_0.super(id_1,...,id_n)
+     *
+     *  where id_0, ..., id_n are the names of the given parameters.
+     *
+     *  @param make    The tree factory
+     *  @param params  The parameters that need to be passed to super
+     *  @param typarams  The type parameters that need to be passed to super
+     *  @param based   Is first parameter a this$n?
+     */
+    JCExpressionStatement SuperCall(TreeMaker make,
+                   List<Type> typarams,
+                   List<JCVariableDecl> params,
+                   boolean based) {
+        JCExpression meth;
+        if (based) {
+            meth = make.Select(make.Ident(params.head), names._super);
+            params = params.tail;
+        } else {
+            meth = make.Ident(names._super);
+        }
+        List<JCExpression> typeargs = typarams.nonEmpty() ? make.Types(typarams) : null;
+        return make.Exec(make.Apply(typeargs, meth, make.Idents(params)));
+    }
+}
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java
index cea3dec5d25..11fff6cdd69 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/tree/JCTree.java
@@ -612,6 +612,7 @@ public abstract class JCTree implements Tree, Cloneable, DiagnosticPosition {
         public boolean staticImport;
         /** The imported class(es). */
         public JCTree qualid;
+        public com.sun.tools.javac.code.Scope importScope;
         protected JCImport(JCTree qualid, boolean importStatic) {
             this.qualid = qualid;
             this.staticImport = importStatic;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Dependencies.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Dependencies.java
index 3a1d50a48d1..37c3e40f010 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Dependencies.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/Dependencies.java
@@ -73,7 +73,7 @@ public abstract class Dependencies {
         return instance;
     }
 
-    Dependencies(Context context) {
+    protected Dependencies(Context context) {
         context.put(dependenciesKey, this);
     }
 
@@ -122,7 +122,7 @@ public abstract class Dependencies {
     /**
      * Push a new completion node on the stack.
      */
-    abstract public void push(ClassSymbol s);
+    abstract public void push(ClassSymbol s, CompletionCause phase);
 
     /**
      * Push a new attribution node on the stack.
@@ -134,6 +134,15 @@ public abstract class Dependencies {
      */
     abstract public void pop();
 
+    public enum CompletionCause {
+        CLASS_READER,
+        HEADER_PHASE,
+        HIERARCHY_PHASE,
+        IMPORTS_PHASE,
+        MEMBER_ENTER,
+        MEMBERS_PHASE;
+    }
+
     /**
      * This class creates a graph of all dependencies as symbols are completed;
      * when compilation finishes, the resulting dependecy graph is then dumped
@@ -391,7 +400,7 @@ public abstract class Dependencies {
         Map<String, Node> dependencyNodeMap = new LinkedHashMap<>();
 
         @Override
-        public void push(ClassSymbol s) {
+        public void push(ClassSymbol s, CompletionCause phase) {
             Node n = new CompletionNode(s);
             if (n == push(n)) {
                 s.completer = this;
@@ -454,7 +463,7 @@ public abstract class Dependencies {
 
         @Override
         public void complete(Symbol sym) throws CompletionFailure {
-            push((ClassSymbol) sym);
+            push((ClassSymbol) sym, null);
             pop();
             sym.completer = this;
         }
@@ -542,7 +551,7 @@ public abstract class Dependencies {
         }
 
         @Override
-        public void push(ClassSymbol s) {
+        public void push(ClassSymbol s, CompletionCause phase) {
             //do nothing
         }
 
diff --git a/langtools/test/tools/javac/4980495/std/NonStatic2StaticImportClash.java b/langtools/test/tools/javac/4980495/std/NonStatic2StaticImportClash.java
new file mode 100644
index 00000000000..d30bf03df1c
--- /dev/null
+++ b/langtools/test/tools/javac/4980495/std/NonStatic2StaticImportClash.java
@@ -0,0 +1,14 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 7101822
+ * @summary Check the when clashing types are imported through an ordinary and static import,
+ *          the compile-time error is properly reported.
+ * @compile/fail/ref=NonStatic2StaticImportClash.out -XDrawDiagnostics NonStatic2StaticImportClash.java p1/A1.java p2/A2.java
+ *
+ */
+
+import p1.A1.f;
+import static p2.A2.f;
+
+public class NonStatic2StaticImportClash {
+}
diff --git a/langtools/test/tools/javac/4980495/std/NonStatic2StaticImportClash.out b/langtools/test/tools/javac/4980495/std/NonStatic2StaticImportClash.out
new file mode 100644
index 00000000000..b9b6a4726fc
--- /dev/null
+++ b/langtools/test/tools/javac/4980495/std/NonStatic2StaticImportClash.out
@@ -0,0 +1,2 @@
+NonStatic2StaticImportClash.java:11:1: compiler.err.already.defined.static.single.import: p1.A1.f
+1 error
diff --git a/langtools/test/tools/javac/4980495/std/Static2NonStaticImportClash.java b/langtools/test/tools/javac/4980495/std/Static2NonStaticImportClash.java
new file mode 100644
index 00000000000..f838fdd02fd
--- /dev/null
+++ b/langtools/test/tools/javac/4980495/std/Static2NonStaticImportClash.java
@@ -0,0 +1,14 @@
+/*
+ * @test  /nodynamiccopyright/
+ * @bug 7101822
+ * @summary Check the when clashing types are imported through an ordinary and static import,
+ *          the compile-time error is properly reported.
+ * @compile/fail/ref=Static2NonStaticImportClash.out -XDrawDiagnostics Static2NonStaticImportClash.java p1/A1.java p2/A2.java
+ *
+ */
+
+import static p2.A2.f;
+import p1.A1.f;
+
+public class Static2NonStaticImportClash {
+}
diff --git a/langtools/test/tools/javac/4980495/std/Static2NonStaticImportClash.out b/langtools/test/tools/javac/4980495/std/Static2NonStaticImportClash.out
new file mode 100644
index 00000000000..40f8e57be26
--- /dev/null
+++ b/langtools/test/tools/javac/4980495/std/Static2NonStaticImportClash.out
@@ -0,0 +1,2 @@
+Static2NonStaticImportClash.java:11:1: compiler.err.already.defined.single.import: p2.A2.f
+1 error
diff --git a/langtools/test/tools/javac/4980495/std/Test.out b/langtools/test/tools/javac/4980495/std/Test.out
index 762974c88ef..8f3b6486e19 100644
--- a/langtools/test/tools/javac/4980495/std/Test.out
+++ b/langtools/test/tools/javac/4980495/std/Test.out
@@ -1,2 +1,3 @@
 Test.java:11:1: compiler.err.already.defined.single.import: p1.A1.f
-1 error
+Test.java:16:13: compiler.err.ref.ambiguous: f, kindname.class, p1.A1.f, p1.A1, kindname.class, p2.A2.f, p2.A2
+2 errors
diff --git a/langtools/test/tools/javac/diags/examples/ImportRequiresCanonical/ImportRequiresCanonical.java b/langtools/test/tools/javac/diags/examples/ImportRequiresCanonical/ImportRequiresCanonical.java
index 4fd6f5f4aad..14976580c20 100644
--- a/langtools/test/tools/javac/diags/examples/ImportRequiresCanonical/ImportRequiresCanonical.java
+++ b/langtools/test/tools/javac/diags/examples/ImportRequiresCanonical/ImportRequiresCanonical.java
@@ -23,6 +23,6 @@
 
 // key: compiler.err.import.requires.canonical
 
-import p.ExtendsBase.NestedInBase;
+import java.util.HashMap.Entry;
 
 class ImportRequiredCanonical { }
diff --git a/langtools/test/tools/javac/importChecks/NoImportedNoClasses.java b/langtools/test/tools/javac/importChecks/NoImportedNoClasses.java
new file mode 100644
index 00000000000..19deff00a50
--- /dev/null
+++ b/langtools/test/tools/javac/importChecks/NoImportedNoClasses.java
@@ -0,0 +1,10 @@
+/*
+ * @test /nodynamiccopyright/
+ * @bug 7101822
+ * @summary Verify that statically importing non-existing constant causes a compile-time error
+ *          for files without a class.
+ *
+ * @compile/fail/ref=NoImportedNoClasses.out -XDrawDiagnostics NoImportedNoClasses.java
+ */
+
+import static java.lang.Runnable.UNKNOWN;
diff --git a/langtools/test/tools/javac/importChecks/NoImportedNoClasses.out b/langtools/test/tools/javac/importChecks/NoImportedNoClasses.out
new file mode 100644
index 00000000000..3e49e06f089
--- /dev/null
+++ b/langtools/test/tools/javac/importChecks/NoImportedNoClasses.out
@@ -0,0 +1,2 @@
+NoImportedNoClasses.java:10:1: compiler.err.cant.resolve.location: kindname.static, UNKNOWN, , , kindname.interface, java.lang.Runnable
+1 error
\ No newline at end of file
diff --git a/langtools/test/tools/javac/importscope/ImportResolvedTooSoon.java b/langtools/test/tools/javac/importscope/ImportResolvedTooSoon.java
new file mode 100644
index 00000000000..182ebe77b4b
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/ImportResolvedTooSoon.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014, 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 7101822
+ * @summary Verify that imports are declarations are processed in the correct order.
+ * @compile ImportResolvedTooSoon.java
+ */
+package pkg;
+
+import static pkg.B.SubInner.Foo;
+
+class B extends A {
+     static class SubInner extends Inner { }
+}
+
+class A {
+     static class Inner {
+         static class Foo { }
+     }
+}
diff --git a/langtools/test/tools/javac/importscope/T7101822A.java b/langtools/test/tools/javac/importscope/T7101822A.java
new file mode 100644
index 00000000000..e0b5543ceec
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/T7101822A.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2014, 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 7101822
+ * @summary Verify that imports are declarations are processed in the correct order.
+ * @compile T7101822A.java T7101822Z.java
+ */
+package a;
+
+import a.T7101822A.B.C;
+import z.T7101822Z;
+
+public class T7101822A {
+
+    class B extends T7101822Z {
+
+        class C {
+        }
+    }
+
+    class D {
+
+        Class foo() {
+            return C.class;
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/importscope/T7101822Z.java b/langtools/test/tools/javac/importscope/T7101822Z.java
new file mode 100644
index 00000000000..f228952f649
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/T7101822Z.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package z;
+public class T7101822Z {}
diff --git a/langtools/test/tools/javac/importscope/TestDuplicateImport.java b/langtools/test/tools/javac/importscope/TestDuplicateImport.java
new file mode 100644
index 00000000000..580b9e91772
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/TestDuplicateImport.java
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2011-2014, 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 7101822
+ * @summary static import fails to resolve interfaces on nested enums via import statements
+ */
+
+import com.sun.source.util.JavacTask;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+
+public class TestDuplicateImport {
+
+    static int checkCount = 0;
+
+    enum ImportKind {
+        NORMAL("import a.#Q.#N;"),
+        STATIC("import static a.#Q.#N;");
+
+        String importStr;
+
+        ImportKind(String importStr) {
+            this.importStr = importStr;
+        }
+
+        String getImportStatement(QualifierKind qk, NameKind nk) {
+            return importStr.replaceAll("#Q", qk.qualifierStr)
+                    .replaceAll("#N", nk.nameStr);
+        }
+
+        boolean isStatic() {
+            return this == STATIC;
+        }
+    }
+
+    enum QualifierKind {
+        A("A"),
+        B("B"),
+        C("C");
+
+        String qualifierStr;
+
+        QualifierKind(String qualifierStr) {
+            this.qualifierStr = qualifierStr;
+        }
+
+        public boolean compatible(QualifierKind ik) {
+            return this == ik || (this != A && ik != A);
+        }
+    }
+
+    enum NameKind {
+        D("D"),
+        E("E"),
+        M("m"),
+        F("f"),
+        STAR("*"),
+        NON_EXISTENT("NonExistent");
+
+        String nameStr;
+
+        NameKind(String nameStr) {
+            this.nameStr = nameStr;
+        }
+
+        boolean exists() {
+            return this != NON_EXISTENT;
+        }
+
+        boolean isMember() {
+            return this == M || this == F;
+        }
+
+        boolean isType() {
+            return this == D || this == E;
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+
+        //create default shared JavaCompiler - reused across multiple compilations
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
+        for (ImportKind ik1 : ImportKind.values()) {
+            for (ImportKind ik2 : ImportKind.values()) {
+                for (QualifierKind qk1 : QualifierKind.values()) {
+                    for (QualifierKind qk2 : QualifierKind.values()) {
+                        for (NameKind nk1 : NameKind.values()) {
+                            for (NameKind nk2 : NameKind.values()) {
+                                new TestDuplicateImport(ik1, ik2, qk1, qk2, nk1, nk2).run(comp, fm);
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        System.out.println("Total check executed: " + checkCount);
+    }
+
+    ImportKind ik1;
+    ImportKind ik2;
+    QualifierKind qk1;
+    QualifierKind qk2;
+    NameKind nk1;
+    NameKind nk2;
+    JavaSource source;
+    DiagnosticChecker diagChecker;
+
+    TestDuplicateImport(ImportKind ik1, ImportKind ik2, QualifierKind qk1, QualifierKind qk2, NameKind nk1, NameKind nk2) {
+        this.ik1 = ik1;
+        this.ik2 = ik2;
+        this.qk1 = qk1;
+        this.qk2 = qk2;
+        this.nk1 = nk1;
+        this.nk2 = nk2;
+        this.source = new JavaSource();
+        this.diagChecker = new DiagnosticChecker();
+    }
+    class JavaSource extends SimpleJavaFileObject {
+
+        String bodyTemplate = "package a;\n" +
+                              "#I1\n" +
+                              "#I2\n" +
+                              "class A {\n" +
+                              "   static class D { }\n" +
+                              "   static class E { }\n" +
+                              "   static Object f;\n" +
+                              "   static void m() { }\n" +
+                              "}\n" +
+                              "class B {\n" +
+                              "   static class D { }\n" +
+                              "   static class E { }\n" +
+                              "   static Object f;\n" +
+                              "   static void m() { }\n" +
+                              "}\n" +
+                              "class C extends B {\n" +
+                              "}\n";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = bodyTemplate.replaceAll("#I1", ik1.getImportStatement(qk1, nk1))
+                    .replaceAll("#I2", ik2.getImportStatement(qk2, nk2));
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+                null, null, Arrays.asList(source));
+        try {
+            ct.analyze();
+        } catch (Throwable ex) {
+            throw new AssertionError("Error thrown when compiling the following code:\n" + source.getCharContent(true));
+        }
+        check();
+    }
+
+    void check() {
+        checkCount++;
+
+        boolean errorExpected = false;
+
+        //error if the import refers to a non-existent symbol
+        if (!nk1.exists() || !nk2.exists()) {
+            errorExpected = true;
+        }
+
+        //error if a non-static import refers to a non-type symbol
+        if ((nk1.isMember() && !ik1.isStatic()) ||
+                (nk2.isMember() && !ik2.isStatic())) {
+            errorExpected = true;
+        }
+
+        //error if two single non-static (or one static and one non-static)
+        //imports import same names from different places
+        if (nk1 == nk2 && nk1 != NameKind.STAR && !qk1.compatible(qk2) &&
+                (!ik1.isStatic() || !ik2.isStatic())) {
+            errorExpected = true;
+        }
+
+        if ((qk1 == QualifierKind.C && !ik1.isStatic() && nk1 != NameKind.STAR) ||
+            (qk2 == QualifierKind.C && !ik2.isStatic() && nk2 != NameKind.STAR)) {
+            errorExpected = true;
+        }
+
+        if (errorExpected != diagChecker.errorFound) {
+            throw new Error("invalid diagnostics for source:\n" +
+                source.getCharContent(true) +
+                "\nFound error: " + diagChecker.errorFound +
+                "\nExpected error: " + errorExpected);
+        }
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean errorFound;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
+                errorFound = true;
+            }
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/importscope/TestLazyImportScope.java b/langtools/test/tools/javac/importscope/TestLazyImportScope.java
new file mode 100644
index 00000000000..e5da4185b38
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/TestLazyImportScope.java
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 2011-2014, 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 7101822
+ * @summary static import fails to resolve interfaces on nested enums via import statements
+ */
+
+import com.sun.source.util.JavacTask;
+import java.net.URI;
+import java.util.Arrays;
+import javax.tools.Diagnostic;
+import javax.tools.JavaCompiler;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+import javax.tools.StandardJavaFileManager;
+import javax.tools.ToolProvider;
+
+public class TestLazyImportScope {
+
+    static int checkCount = 0;
+
+    enum ImportOrder {
+        NORMAL("import a.C.D;\n" +
+               "#I"),
+        REVERSE("#I\n" +
+               "import a.C.D;");
+
+        String importLayout;
+
+        ImportOrder(String importLayout) {
+            this.importLayout = importLayout;
+        }
+
+        String getImportString(ImportKind ik) {
+            return importLayout.replaceAll("#I", ik.importStr);
+        }
+    }
+
+    enum ImportKind {
+        NAMED("import a.A.B.E;"),
+        ON_DEMAND("import a.A.B.*;"),
+        STATIC_NAMED_TYPE("import static a.A.B.E;"),
+        STATIC_NAMED_MEMBER("import static a.A.B.bm;"),
+        STATIC_ON_DEMAND("import static a.A.B.*;");
+
+        String importStr;
+
+        private ImportKind(String importStr) {
+            this.importStr = importStr;
+        }
+    }
+
+    enum TypeRefKind {
+        NONE(""),
+        E("E e = null;"),
+        F("F f = null;"),
+        BOTH("E e = null; F f = null;");
+
+        String typeRefStr;
+
+        private TypeRefKind(String typeRefStr) {
+            this.typeRefStr = typeRefStr;
+        }
+
+        boolean isImported(ImportKind ik) {
+            switch (ik) {
+                case NAMED:
+                case STATIC_NAMED_TYPE: return this == NONE || this == E;
+                case ON_DEMAND:
+                case STATIC_ON_DEMAND: return true;
+                default: return this == NONE;
+            }
+        }
+    }
+
+    enum MemberRefKind {
+        NONE(""),
+        FIELD("Object o = bf;"),
+        METHOD("bm();"),
+        BOTH("Object o = bf; bm();");
+
+        String memberRefStr;
+
+        private MemberRefKind(String memberRefStr) {
+            this.memberRefStr = memberRefStr;
+        }
+
+        boolean isImported(ImportKind ik) {
+            switch (ik) {
+                case STATIC_NAMED_MEMBER: return this == NONE || this == METHOD;
+                case STATIC_ON_DEMAND: return true;
+                default: return this == NONE;
+            }
+        }
+    }
+
+    public static void main(String... args) throws Exception {
+
+        //create default shared JavaCompiler - reused across multiple compilations
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        StandardJavaFileManager fm = comp.getStandardFileManager(null, null, null);
+
+        for (ImportOrder ord : ImportOrder.values()) {
+            for (ImportKind ik : ImportKind.values()) {
+                for (TypeRefKind tk : TypeRefKind.values()) {
+                    for (MemberRefKind mk : MemberRefKind.values()) {
+                        new TestLazyImportScope(ord, ik, tk, mk).run(comp, fm);
+                    }
+                }
+            }
+        }
+        System.out.println("Total check executed: " + checkCount);
+    }
+
+    ImportOrder ord;
+    ImportKind ik;
+    TypeRefKind tk;
+    MemberRefKind mk;
+    JavaSource source;
+    DiagnosticChecker diagChecker;
+
+    TestLazyImportScope(ImportOrder ord, ImportKind ik, TypeRefKind tk, MemberRefKind mk) {
+        this.ord = ord;
+        this.ik = ik;
+        this.tk = tk;
+        this.mk = mk;
+        this.source = new JavaSource();
+        this.diagChecker = new DiagnosticChecker();
+    }
+
+    class JavaSource extends SimpleJavaFileObject {
+
+        String bodyTemplate = "package a;\n" +
+                              "#I\n" +
+                              "class A {\n" +
+                              "   static class B extends D {\n" +
+                              "      static class E { }\n" +
+                              "      static class F { }\n" +
+                              "      static Object bf;\n" +
+                              "      static void bm() { }\n" +
+                              "   }\n" +
+                              "}\n" +
+                              "class C {\n" +
+                              "   static class D { }\n" +
+                              "}\n" +
+                              "class Test {\n" +
+                              "   void test() {\n" +
+                              "      #T\n" +
+                              "      #M\n" +
+                              "   }\n" +
+                              "}";
+
+        String source;
+
+        public JavaSource() {
+            super(URI.create("myfo:/Test.java"), JavaFileObject.Kind.SOURCE);
+            source = bodyTemplate.replaceAll("#I", ord.getImportString(ik))
+                    .replaceAll("#T", tk.typeRefStr)
+                    .replaceAll("#M", mk.memberRefStr);
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) {
+            return source;
+        }
+    }
+
+    void run(JavaCompiler tool, StandardJavaFileManager fm) throws Exception {
+        JavacTask ct = (JavacTask)tool.getTask(null, fm, diagChecker,
+                null, null, Arrays.asList(source));
+        try {
+            ct.analyze();
+        } catch (Throwable ex) {
+            throw new AssertionError("Error thrown when compiling the following code:\n" + source.getCharContent(true));
+        }
+        check();
+    }
+
+    void check() {
+        checkCount++;
+
+        boolean errorExpected = !tk.isImported(ik) || !mk.isImported(ik);
+
+        if (errorExpected != diagChecker.errorFound) {
+            throw new Error("invalid diagnostics for source:\n" +
+                source.getCharContent(true) +
+                "\nFound error: " + diagChecker.errorFound +
+                "\nExpected error: " + errorExpected);
+        }
+    }
+
+    static class DiagnosticChecker implements javax.tools.DiagnosticListener<JavaFileObject> {
+
+        boolean errorFound;
+
+        public void report(Diagnostic<? extends JavaFileObject> diagnostic) {
+            if (diagnostic.getKind() == Diagnostic.Kind.ERROR) {
+                errorFound = true;
+            }
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/importscope/TypeParamCycle.java b/langtools/test/tools/javac/importscope/TypeParamCycle.java
new file mode 100644
index 00000000000..e4561b53ba3
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/TypeParamCycle.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014, 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 7101822
+ * @summary Verify that cycles between type parameter bounds and imports/class nesting
+ *          are not a problem.
+ * @compile TypeParamCycle.java
+ */
+package pkg;
+
+import pkg.A.Outer.Inner;
+
+class A {
+   static class Outer<X extends Inner> { static class Inner {} }
+}
+
diff --git a/langtools/test/tools/javac/importscope/TypeParamCycle2.java b/langtools/test/tools/javac/importscope/TypeParamCycle2.java
new file mode 100644
index 00000000000..3a8a285ef61
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/TypeParamCycle2.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014, 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 7101822
+ * @summary Verify that cycles between type parameter bounds and imports/class nesting
+ *          are not a problem.
+ * @compile TypeParamCycle2.java
+ */
+package pkg;
+
+import pkg.A.Outer.Inner;
+
+class B extends Inner {
+}
+
+class A {
+   static class Outer<X extends Inner> { static class Inner {} }
+}
+
diff --git a/langtools/test/tools/javac/importscope/TypeParamCycle3.java b/langtools/test/tools/javac/importscope/TypeParamCycle3.java
new file mode 100644
index 00000000000..0657c135518
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/TypeParamCycle3.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2014, 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 7101822
+ * @summary Verify that cycles between type parameter bounds and imports/class nesting
+ *          are not a problem.
+ * @compile TypeParamCycle3.java
+ */
+package pkg;
+
+import static pkg.A.Outer.Inner;
+
+class A {
+   static class Outer<X extends Inner> extends B { }
+}
+
+class B {
+    static class Inner {}
+}
+
diff --git a/langtools/test/tools/javac/importscope/dependencies/DependenciesTest.java b/langtools/test/tools/javac/importscope/dependencies/DependenciesTest.java
new file mode 100644
index 00000000000..5c9b838b107
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/dependencies/DependenciesTest.java
@@ -0,0 +1,366 @@
+/*
+ * Copyright (c) 2014, 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 7101822
+ * @summary Verify that the processing of classes in TypeEnter runs in the correct order.
+ * @library /tools/lib
+ * @build annotations.TriggersComplete annotations.TriggersCompleteRepeat annotations.Phase
+ * @build DependenciesTest
+ * @run main DependenciesTest
+ */
+
+import java.io.IOException;
+import java.net.URI;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Set;
+import java.util.Stack;
+import java.util.stream.Stream;
+
+import javax.lang.model.element.AnnotationMirror;
+import javax.lang.model.element.AnnotationValue;
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.Name;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.Elements;
+import javax.tools.JavaFileObject;
+import javax.tools.SimpleJavaFileObject;
+
+import annotations.*;
+import com.sun.source.tree.AnnotationTree;
+
+import com.sun.source.tree.ClassTree;
+import com.sun.source.tree.CompilationUnitTree;
+import com.sun.source.tree.ImportTree;
+import com.sun.source.tree.Tree;
+import com.sun.source.util.JavacTask;
+import com.sun.source.util.SourcePositions;
+import com.sun.source.util.TreePathScanner;
+import com.sun.source.util.Trees;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.api.JavacTrees;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.tree.JCTree;
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.util.Context.Factory;
+import com.sun.tools.javac.util.Dependencies;
+
+
+public class DependenciesTest {
+    public static void main(String... args) throws IOException {
+        new DependenciesTest().run();
+    }
+
+    void run() throws IOException {
+        Path src = Paths.get(System.getProperty("test.src"), "tests");
+
+        try (Stream<Path> tests = Files.list(src)) {
+            tests.map(p -> Files.isRegularFile(p) ? Stream.of(p) : silentWalk(p))
+                 .forEach(this :: runTest);
+        }
+    }
+
+    Stream<Path> silentWalk(Path src) {
+        try {
+            return Files.walk(src).filter(Files :: isRegularFile);
+        } catch (IOException ex) {
+            throw new IllegalStateException(ex);
+        }
+    }
+
+    void runTest(Stream<Path> inputs) {
+        JavacTool tool = JavacTool.create();
+        try (JavacFileManager fm = tool.getStandardFileManager(null, null, null)) {
+            Path classes = Paths.get(System.getProperty("test.classes"));
+            Iterable<? extends JavaFileObject> reconFiles =
+                    fm.getJavaFileObjectsFromFiles(inputs.sorted().map(p -> p.toFile()) :: iterator);
+            List<String> options = Arrays.asList("-classpath", classes.toAbsolutePath().toString());
+            JavacTask reconTask = tool.getTask(null, fm, null, options, null, reconFiles);
+            Iterable<? extends CompilationUnitTree> reconUnits = reconTask.parse();
+            JavacTrees reconTrees = JavacTrees.instance(reconTask);
+            SearchAnnotations scanner = new SearchAnnotations(reconTrees,
+                                                              reconTask.getElements());
+            List<JavaFileObject> validateFiles = new ArrayList<>();
+
+            reconTask.analyze();
+            scanner.scan(reconUnits, null);
+
+            for (CompilationUnitTree cut : reconUnits) {
+                validateFiles.add(ClearAnnotations.clearAnnotations(reconTrees, cut));
+            }
+
+            Context validateContext = new Context();
+            TestDependencies.preRegister(validateContext);
+            JavacTask validateTask =
+                    tool.getTask(null, fm, null, options, null, validateFiles, validateContext);
+
+            validateTask.analyze();
+
+            TestDependencies deps = (TestDependencies) Dependencies.instance(validateContext);
+
+            if (!scanner.topLevel2Expected.equals(deps.topLevel2Completing)) {
+                throw new IllegalStateException(  "expected=" + scanner.topLevel2Expected +
+                                                "; actual=" + deps.topLevel2Completing);
+            }
+        } catch (IOException ex) {
+            throw new IllegalStateException(ex);
+        } finally {
+            inputs.close();
+        }
+    }
+
+    static final class TestDependencies extends Dependencies {
+
+        public static void preRegister(Context context) {
+            context.put(dependenciesKey, (Factory<Dependencies>) TestDependencies :: new);
+        }
+
+        public TestDependencies(Context context) {
+            super(context);
+        }
+
+        final Stack<PhaseDescription> inProcess = new Stack<>();
+
+        String topLevelMemberEnter;
+        Map<String, Set<PhaseDescription>> topLevel2Completing = new HashMap<>();
+
+        @Override
+        public void push(ClassSymbol s, CompletionCause phase) {
+            String flatname = s.flatName().toString();
+            for (Phase p : Phase.values()) {
+                if (phase == p.cause) {
+                    inProcess.push(new PhaseDescription(flatname, p));
+                    return ;
+                }
+            }
+            if (phase == CompletionCause.MEMBER_ENTER) {
+                if (inProcess.isEmpty()) {
+                    topLevelMemberEnter = flatname;
+                } else {
+                    for (PhaseDescription running : inProcess) {
+                        if (running == null)
+                            continue;
+
+                        Set<PhaseDescription> completing =
+                                topLevel2Completing.computeIfAbsent(running.flatname, $ -> new HashSet<>());
+
+                        completing.add(new PhaseDescription(flatname, running.phase));
+                    }
+                }
+            }
+            inProcess.push(null);
+        }
+
+        @Override
+        public void push(AttributionKind ak, JCTree t) {
+            inProcess.push(null);
+        }
+
+        @Override
+        public void pop() {
+            inProcess.pop();
+        }
+
+    }
+
+    static final class SearchAnnotations extends TreePathScanner<Void, Void> {
+        final Trees trees;
+        final Elements elements;
+        final TypeElement triggersCompleteAnnotation;
+        final TypeElement triggersCompleteRepeatAnnotation;
+        final Map<String, Set<PhaseDescription>> topLevel2Expected =
+                new HashMap<>();
+
+        public SearchAnnotations(Trees trees, Elements elements) {
+            this.trees = trees;
+            this.elements = elements;
+            this.triggersCompleteAnnotation =
+                    elements.getTypeElement(TriggersComplete.class.getName());
+            this.triggersCompleteRepeatAnnotation =
+                    elements.getTypeElement(TriggersCompleteRepeat.class.getName());
+        }
+
+        @Override
+        public Void visitClass(ClassTree node, Void p) {
+            TypeElement te = (TypeElement) trees.getElement(getCurrentPath());
+            Set<PhaseDescription> expected = new HashSet<>();
+
+            for (AnnotationMirror am : getTriggersCompleteAnnotation(te)) {
+                TypeMirror of = (TypeMirror) findAttribute(am, "of").getValue();
+                Name ofName = elements.getBinaryName((TypeElement) ((DeclaredType) of).asElement());
+                Element at = (Element) findAttribute(am, "at").getValue();
+                Phase phase = Phase.valueOf(at.getSimpleName().toString());
+                expected.add(new PhaseDescription(ofName.toString(), phase));
+            }
+
+            if (!expected.isEmpty())
+                topLevel2Expected.put(elements.getBinaryName(te).toString(), expected);
+
+            return super.visitClass(node, p);
+        }
+
+        Collection<AnnotationMirror> getTriggersCompleteAnnotation(TypeElement te) {
+            for (AnnotationMirror am : te.getAnnotationMirrors()) {
+                if (triggersCompleteAnnotation.equals(am.getAnnotationType().asElement())) {
+                    return Collections.singletonList(am);
+                }
+                if (triggersCompleteRepeatAnnotation.equals(am.getAnnotationType().asElement())) {
+                    return (Collection<AnnotationMirror>) findAttribute(am, "value").getValue();
+                }
+            }
+            return Collections.emptyList();
+        }
+
+        AnnotationValue findAttribute(AnnotationMirror mirror, String name) {
+            for (Entry<? extends ExecutableElement, ? extends AnnotationValue> e :
+                    mirror.getElementValues().entrySet()) {
+                if (e.getKey().getSimpleName().contentEquals(name)) {
+                    return e.getValue();
+                }
+            }
+
+            throw new IllegalStateException("Could not find " + name + " in " + mirror);
+        }
+    }
+
+    static final class ClearAnnotations extends TreePathScanner<Void, Void> {
+        final SourcePositions positions;
+        final List<int[]> spans2Clear = new ArrayList<>();
+
+        ClearAnnotations(Trees trees) {
+            this.positions = trees.getSourcePositions();
+        }
+
+        @Override
+        public Void visitAnnotation(AnnotationTree node, Void p) {
+            removeCurrentNode();
+            return null;
+        }
+
+        @Override
+        public Void visitImport(ImportTree node, Void p) {
+            if (node.getQualifiedIdentifier().toString().startsWith("annotations.")) {
+                removeCurrentNode();
+                return null;
+            }
+            return super.visitImport(node, p);
+        }
+
+        void removeCurrentNode() {
+            CompilationUnitTree topLevel = getCurrentPath().getCompilationUnit();
+            Tree node = getCurrentPath().getLeaf();
+            spans2Clear.add(new int[] {(int) positions.getStartPosition(topLevel, node),
+                                       (int) positions.getEndPosition(topLevel, node)});
+        }
+
+        static JavaFileObject clearAnnotations(Trees trees, CompilationUnitTree cut)
+                throws IOException {
+            ClearAnnotations a = new ClearAnnotations(trees);
+            a.scan(cut, null);
+            Collections.sort(a.spans2Clear, (s1, s2) -> s2[0] - s1[0]);
+            StringBuilder result = new StringBuilder(cut.getSourceFile().getCharContent(true));
+            for (int[] toClear : a.spans2Clear) {
+                result.delete(toClear[0], toClear[1]);
+            }
+            return new TestJavaFileObject(cut.getSourceFile().toUri(), result.toString());
+        }
+
+    }
+
+    static final class PhaseDescription {
+        final String flatname;
+        final Phase phase;
+
+        public PhaseDescription(String flatname, Phase phase) {
+            this.flatname = flatname;
+            this.phase = phase;
+        }
+
+        @Override
+        public String toString() {
+            return "@annotations.TriggersComplete(of=" + flatname + ".class," +
+                   "at=annotations.Phase." + phase + ')';
+        }
+
+        @Override
+        public int hashCode() {
+            int hash = 7;
+            hash = 89 * hash + Objects.hashCode(this.flatname);
+            hash = 89 * hash + Objects.hashCode(this.phase);
+            return hash;
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            if (obj == null) {
+                return false;
+            }
+            if (getClass() != obj.getClass()) {
+                return false;
+            }
+            final PhaseDescription other = (PhaseDescription) obj;
+            if (!Objects.equals(this.flatname, other.flatname)) {
+                return false;
+            }
+            if (this.phase != other.phase) {
+                return false;
+            }
+            return true;
+        }
+
+    }
+
+    static final class TestJavaFileObject extends SimpleJavaFileObject {
+        private final String content;
+
+        public TestJavaFileObject(URI uri, String content) {
+            super(uri, Kind.SOURCE);
+            this.content = content;
+        }
+
+        @Override
+        public CharSequence getCharContent(boolean ignoreEncodingErrors) throws IOException {
+            return content;
+        }
+
+    }
+}
+
+
diff --git a/langtools/test/tools/javac/importscope/dependencies/annotations/Phase.java b/langtools/test/tools/javac/importscope/dependencies/annotations/Phase.java
new file mode 100644
index 00000000000..a0f5e35ec46
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/dependencies/annotations/Phase.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package annotations;
+
+import com.sun.tools.javac.util.Dependencies.CompletionCause;
+
+public enum Phase {
+    IMPORTS(CompletionCause.IMPORTS_PHASE),
+    HIERARCHY(CompletionCause.HIERARCHY_PHASE),
+    HEADER(CompletionCause.HEADER_PHASE),
+    MEMBERS(CompletionCause.MEMBERS_PHASE);
+
+    public final CompletionCause cause;
+
+    private Phase(CompletionCause cause) {
+        this.cause = cause;
+    }
+
+}
diff --git a/langtools/test/tools/javac/importscope/dependencies/annotations/TriggersComplete.java b/langtools/test/tools/javac/importscope/dependencies/annotations/TriggersComplete.java
new file mode 100644
index 00000000000..83375b16c09
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/dependencies/annotations/TriggersComplete.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package annotations;
+
+import java.lang.annotation.Repeatable;
+
+@Repeatable(TriggersCompleteRepeat.class)
+public @interface TriggersComplete {
+    public Class<?> of();
+    public Phase    at();
+}
diff --git a/langtools/test/tools/javac/importscope/dependencies/annotations/TriggersCompleteRepeat.java b/langtools/test/tools/javac/importscope/dependencies/annotations/TriggersCompleteRepeat.java
new file mode 100644
index 00000000000..de216f9e99e
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/dependencies/annotations/TriggersCompleteRepeat.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package annotations;
+
+public @interface TriggersCompleteRepeat {
+    TriggersComplete[] value();
+}
diff --git a/langtools/test/tools/javac/importscope/dependencies/tests/ImportResolvedTooSoon.java b/langtools/test/tools/javac/importscope/dependencies/tests/ImportResolvedTooSoon.java
new file mode 100644
index 00000000000..ffb9da13d89
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/dependencies/tests/ImportResolvedTooSoon.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package pkg;
+
+import annotations.*;
+
+import static pkg.B.SubInner.Foo;
+
+@TriggersComplete(of=A.class, at=Phase.HIERARCHY)
+@TriggersComplete(of=B.SubInner.class, at=Phase.IMPORTS)
+class B extends A {
+    @TriggersComplete(of=A.Inner.class, at=Phase.HIERARCHY)
+    static class SubInner extends Inner { }
+}
+
+class A {
+     static class Inner {
+         static class Foo { }
+     }
+}
diff --git a/langtools/test/tools/javac/importscope/dependencies/tests/Simple.java b/langtools/test/tools/javac/importscope/dependencies/tests/Simple.java
new file mode 100644
index 00000000000..b88d503bdd2
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/dependencies/tests/Simple.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2014, 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 annotations.*;
+
+@TriggersComplete(of = Bar.class, at = Phase.HEADER)
+@TriggersComplete(of = Sup.class, at = Phase.HIERARCHY)
+class Foo<X extends Bar> extends Sup {
+}
+class Bar {
+}
+class Sup {
+}
diff --git a/langtools/test/tools/javac/importscope/dependencies/tests/T7101822/T7101822.java b/langtools/test/tools/javac/importscope/dependencies/tests/T7101822/T7101822.java
new file mode 100644
index 00000000000..4398d6de745
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/dependencies/tests/T7101822/T7101822.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package a;
+
+import annotations.*;
+
+import a.T7101822.B.C;
+import z.T7101822Aux;
+
+@TriggersComplete(of=T7101822.B.class, at=Phase.IMPORTS)
+public class T7101822 {
+
+    @TriggersComplete(of=z.T7101822Aux.class, at=Phase.HIERARCHY)
+    class B extends T7101822Aux {
+
+        class C {
+        }
+    }
+
+    class D {
+
+        Class foo() {
+            return C.class;
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/importscope/dependencies/tests/T7101822/T7101822Aux.java b/langtools/test/tools/javac/importscope/dependencies/tests/T7101822/T7101822Aux.java
new file mode 100644
index 00000000000..f55ed36fed8
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/dependencies/tests/T7101822/T7101822Aux.java
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package z;
+public class T7101822Aux {}
diff --git a/langtools/test/tools/javac/importscope/dependencies/tests/TypeParamCycle.java b/langtools/test/tools/javac/importscope/dependencies/tests/TypeParamCycle.java
new file mode 100644
index 00000000000..d54003d0131
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/dependencies/tests/TypeParamCycle.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package pkg;
+
+import annotations.*;
+
+import pkg.A.Outer.Inner;
+
+@TriggersComplete(of=A.Outer.class, at=Phase.IMPORTS)
+class A {
+    @TriggersComplete(of=A.Outer.Inner.class, at=Phase.HEADER)
+    static class Outer<X extends Inner> { static class Inner {} }
+}
+
diff --git a/langtools/test/tools/javac/importscope/dependencies/tests/TypeParamCycle2.java b/langtools/test/tools/javac/importscope/dependencies/tests/TypeParamCycle2.java
new file mode 100644
index 00000000000..fd2baa589c8
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/dependencies/tests/TypeParamCycle2.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package pkg;
+
+import pkg.A.Outer.Inner;
+
+@annotations.TriggersComplete(of=A.class, at=annotations.Phase.IMPORTS)
+@annotations.TriggersComplete(of=A.Outer.class, at=annotations.Phase.IMPORTS)
+@annotations.TriggersComplete(of=A.Outer.Inner.class, at=annotations.Phase.HIERARCHY)
+class B extends Inner {
+}
+
+class A {
+   static class Outer<X extends Inner> { static class Inner {} }
+}
+
diff --git a/langtools/test/tools/javac/importscope/dependencies/tests/TypeParamCycle3.java b/langtools/test/tools/javac/importscope/dependencies/tests/TypeParamCycle3.java
new file mode 100644
index 00000000000..3bc96ff7cd4
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/dependencies/tests/TypeParamCycle3.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package pkg;
+
+import static pkg.A.Outer.Inner;
+
+@annotations.TriggersComplete(of=A.Outer.class, at=annotations.Phase.IMPORTS)
+class A {
+    @annotations.TriggersComplete(of=B.class, at=annotations.Phase.HIERARCHY)
+    @annotations.TriggersComplete(of=B.Inner.class, at=annotations.Phase.HEADER)
+    static class Outer<X extends Inner> extends B { }
+}
+
+class B {
+    static class Inner {}
+}
diff --git a/langtools/test/tools/javac/lib/DPrinter.java b/langtools/test/tools/javac/lib/DPrinter.java
index 6418a7f9b03..da9f62da6a2 100644
--- a/langtools/test/tools/javac/lib/DPrinter.java
+++ b/langtools/test/tools/javac/lib/DPrinter.java
@@ -398,8 +398,8 @@ public class DPrinter {
             }
             out.println();
         } else if (FILTER_SCOPE_CLASS.equals(scope.getClass().getName())) {
-            printScope("delegate",
-                    (Scope) getField(scope, scope.getClass(), "delegate"), Details.FULL);
+            printScope("origin",
+                    (Scope) getField(scope, scope.getClass(), "origin"), Details.FULL);
         } else if (scope instanceof CompoundScope) {
             printList("delegates", (List<?>) getField(scope, CompoundScope.class, "subScopes"));
         } else {
diff --git a/langtools/test/tools/javac/scope/HashCollisionTest.java b/langtools/test/tools/javac/scope/HashCollisionTest.java
index 23f8f8c5a06..a4b1f328dae 100644
--- a/langtools/test/tools/javac/scope/HashCollisionTest.java
+++ b/langtools/test/tools/javac/scope/HashCollisionTest.java
@@ -55,6 +55,7 @@ public class HashCollisionTest {
         names = Names.instance(context);       // Name.Table impls tied to an instance of Names
         symtab = Symtab.instance(context);
         trees = JavacTrees.instance(context);
+        types = Types.instance(context);
 
         // determine hashMask for an empty scope
         Scope emptyScope = WriteableScope.create(symtab.unnamedPackage); // any owner will do
@@ -121,12 +122,12 @@ public class HashCollisionTest {
                 return sym.kind == TYP;
             }
         };
-        starImportScope.importAll(fromScope, fromScope, typeFilter, false);
+        starImportScope.importAll(types, fromScope, typeFilter, false);
 
         dump("imported p", starImportScope);
 
         // 7. Insert the class from 3.
-        starImportScope.importAll(cc.members_field, cc.members_field, typeFilter, false);
+        starImportScope.importAll(types, cc.members_field, typeFilter, false);
         dump("imported ce", starImportScope);
 
         /*
@@ -196,4 +197,5 @@ public class HashCollisionTest {
     Names names;
     Symtab symtab;
     Trees trees;
+    Types types;
 }
diff --git a/langtools/test/tools/javac/scope/StarImportTest.java b/langtools/test/tools/javac/scope/StarImportTest.java
index 6ca75234962..150b08dab53 100644
--- a/langtools/test/tools/javac/scope/StarImportTest.java
+++ b/langtools/test/tools/javac/scope/StarImportTest.java
@@ -135,6 +135,7 @@ public class StarImportTest {
             JavacFileManager.preRegister(context); // required by ClassReader which is required by Symtab
             names = Names.instance(context);       // Name.Table impls tied to an instance of Names
             symtab = Symtab.instance(context);
+            types = Types.instance(context);
             int setupCount = rgen.nextInt(MAX_SETUP_COUNT);
             for (int i = 0; i < setupCount; i++) {
                 switch (random(SetupKind.values())) {
@@ -204,7 +205,7 @@ public class StarImportTest {
         }
 
         /**
-         * Create a star-import scope and a model therof, from the packages and
+         * Create a star-import scope and a model thereof, from the packages and
          * classes created by setupPackages and setupClasses.
          * @throws Exception for fatal errors, such as from reflection
          */
@@ -218,7 +219,7 @@ public class StarImportTest {
             for (Symbol imp: imports) {
                 Scope members = imp.members();
 //                    log("importAll", members);
-                starImportScope.importAll(members, members, new ImportFilter() {
+                starImportScope.importAll(types, members, new ImportFilter() {
                     @Override
                     public boolean accepts(Scope origin, Symbol t) {
                         return t.kind == TYP;
@@ -292,6 +293,7 @@ public class StarImportTest {
         Context context;
         Symtab symtab;
         Names names;
+        Types types;
         int nextNameSerial;
         List<PackageSymbol> packages = new ArrayList<PackageSymbol>();
         int nextPackageSerial;

From 8d3af43a7c1a5e455377b9a44365b937d9c150c9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= <hannesw@openjdk.org>
Date: Wed, 3 Dec 2014 14:49:36 +0100
Subject: [PATCH 208/299] 8065769: OOM on Window/Solaris in test
 compile-octane-splitter.js

Reviewed-by: sundar, jlaskey
---
 .../classes/jdk/nashorn/internal/codegen/AstSerializer.java | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AstSerializer.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AstSerializer.java
index 19197a26a0b..dc35f964de4 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AstSerializer.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AstSerializer.java
@@ -48,11 +48,13 @@ final class AstSerializer {
     private static final int COMPRESSION_LEVEL = Options.getIntProperty("nashorn.serialize.compression", 4);
     static byte[] serialize(final FunctionNode fn) {
         final ByteArrayOutputStream out = new ByteArrayOutputStream();
-        try (final ObjectOutputStream oout = new ObjectOutputStream(new DeflaterOutputStream(out,
-                new Deflater(COMPRESSION_LEVEL)))) {
+        final Deflater deflater = new Deflater(COMPRESSION_LEVEL);
+        try (final ObjectOutputStream oout = new ObjectOutputStream(new DeflaterOutputStream(out, deflater))) {
             oout.writeObject(removeInnerFunctionBodies(fn));
         } catch (final IOException e) {
             throw new AssertionError("Unexpected exception serializing function", e);
+        } finally {
+            deflater.end();
         }
         return out.toByteArray();
     }

From b26d39ffd735316f3d6383f4a9a0dca30d44047d Mon Sep 17 00:00:00 2001
From: Chris Hegarty <chegar@openjdk.org>
Date: Wed, 3 Dec 2014 14:20:21 +0000
Subject: [PATCH 209/299] 8049367: Modular Run-Time Images

Co-authored-by: Alan Bateman <alan.bateman@oracle.com>
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Bradford Wetmore <bradford.wetmore@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Magnus Ihse Bursie <magnus.ihse.bursie@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Paul Sandoz <paul.sandoz@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: chegar, dfuchs, ihse, joehw, mullan, psandoz, wetmore
---
 Makefile                               |  36 +-
 common/autoconf/boot-jdk.m4            |  14 -
 common/autoconf/bootcycle-spec.gmk.in  |   9 +-
 common/autoconf/compare.sh.in          |   1 +
 common/autoconf/flags.m4               |  12 +-
 common/autoconf/generated-configure.sh |  30 +-
 common/autoconf/spec.gmk.in            |  39 +-
 common/bin/compare.sh                  | 217 +++--------
 common/bin/compare_exceptions.sh.incl  |  16 +
 common/bin/unshuffle_list.txt          |   2 +-
 make/CompileJavaModules.gmk            |  22 +-
 make/Images.gmk                        | 496 +++++++++++++++++++++++++
 make/Javadoc.gmk                       |  17 +-
 make/JrtfsJar.gmk                      |  37 ++
 make/MacBundles.gmk                    | 137 +++++++
 make/Main.gmk                          | 306 ++++++++-------
 make/MakeHelpers.gmk                   | 147 ++++++--
 make/ModuleWrapper.gmk                 |  88 +++++
 make/StripBinaries.gmk                 |  99 +++++
 make/ZipSecurity.gmk                   | 104 ++++++
 make/ZipSource.gmk                     |  88 +++++
 make/common/JavaCompilation.gmk        |  13 +-
 make/common/Modules.gmk                |   1 +
 make/common/NativeCompilation.gmk      | 109 +++---
 make/common/SetupJavaCompilers.gmk     |  11 +-
 make/jprt.properties                   |   4 +-
 modules.xml                            |   4 +
 27 files changed, 1546 insertions(+), 513 deletions(-)
 create mode 100644 make/Images.gmk
 create mode 100644 make/JrtfsJar.gmk
 create mode 100644 make/MacBundles.gmk
 create mode 100644 make/ModuleWrapper.gmk
 create mode 100644 make/StripBinaries.gmk
 create mode 100644 make/ZipSecurity.gmk
 create mode 100644 make/ZipSource.gmk

diff --git a/Makefile b/Makefile
index d4b36e4539d..15c4eaadf59 100644
--- a/Makefile
+++ b/Makefile
@@ -143,31 +143,37 @@ help:
 	$(info .  make [default]         # Compile all modules in langtools, hotspot, jaxp, jaxws,)
 	$(info .                         # corba and jdk and create a runnable "exploded" image)
 	$(info .  make all               # Compile everything, all repos, docs and images)
-	$(info .  make images            # Create complete j2sdk and j2re images)
+	$(info .  make images            # Create complete jdk and jre images)
+	$(info .  make <phase>           # Compile the specified phase and everything it depends on)
+	$(info .                         # (gensrc, java, copy, libs, launchers, gendata, rmic))
+	$(info .  make *-only            # Applies to most targets and disables compling the)
+	$(info .                         # dependencies for the target. This is faster but may)
+	$(info .                         # result in incorrect build results!)
 	$(info .  make docs              # Create all docs)
 	$(info .  make docs-javadoc      # Create just javadocs, depends on less than full docs)
-	$(info .  make profiles          # Create complete j2re compact profile images)
+	$(info .  make profiles          # Create complete jre compact profile images)
 	$(info .  make bootcycle-images  # Build images twice, second time with newly built JDK)
 	$(info .  make install           # Install the generated images locally)
 	$(info .  make reconfigure       # Rerun configure with the same arguments as last time)
-	$(info .  make clean             # Remove all files generated by make, but not those)
-	$(info .                         # generated by configure)
-	$(info .  make dist-clean        # Remove all files, including configuration)
 	$(info .  make help              # Give some help on using make)
 	$(info .  make test              # Run tests, default is all tests (see TEST below))
 	$(info )
+	$(info Targets for cleaning)
+	$(info .  make clean             # Remove all files generated by make, but not those)
+	$(info .                         # generated by configure)
+	$(info .  make dist-clean        # Remove all files, including configuration)
+	$(info .  make clean-<outputdir> # Remove the subdir in the output dir with the name)
+	$(info .  make clean-<phase>     # Remove all build results related to a certain build)
+	$(info .                         # phase (gensrc, java, libs, launchers))
+	$(info .  make clean-<module>    # Remove all build results related to a certain module)
+	$(info .  make clean-<module>-<phase> # Remove all build results related to a certain)
+	$(info .                         # module and phase)
+	$(info )
 	$(info Targets for specific modules)
 	$(info .  make <module>          # Build <module> and everything it depends on. )
-	$(info .  make <module>-only     # Build <module> only, without dependencies. This)
-	$(info .                         # is faster but can result in incorrect build results!)
-	$(info .  make <module>-java     # Compile java classes for <module> and everything it)
-	$(info .                         # depends on)
-	$(info .  make <module>-libs     # Build native libraries for <module> and everything it)
-	$(info .                         # depends on)
-	$(info .  make <module>-launchers# Build native executables for <module> and everything it)
-	$(info .                         # depends on)
-	$(info .  make <module>-gensrc   # Execute the gensrc step for <module> and everything it)
-	$(info .                         # depends on)
+	$(info .  make <module>-<phase>  # Compile the specified phase for the specified module)
+	$(info .                         # and everything it depends on)
+	$(info .                         # (gensrc, java, copy, libs, launchers, gendata, rmic))
 	$(info )
 	$(info Useful make variables)
 	$(info .  make CONF=             # Build all configurations (note, assignment is empty))
diff --git a/common/autoconf/boot-jdk.m4 b/common/autoconf/boot-jdk.m4
index fbfa15c7b06..716a8c44c35 100644
--- a/common/autoconf/boot-jdk.m4
+++ b/common/autoconf/boot-jdk.m4
@@ -305,20 +305,6 @@ AC_DEFUN_ONCE([BOOTJDK_SETUP_BOOT_JDK],
     AC_MSG_ERROR([Cannot continue])
   fi
 
-  # Setup proper paths for what we found
-  BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
-  if test ! -f "$BOOT_RTJAR"; then
-    # On MacOSX it is called classes.jar
-    BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
-    if test -f "$BOOT_RTJAR"; then
-      # Remove the ..
-      BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
-    fi
-  fi
-  BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
-  BOOT_JDK="$BOOT_JDK"
-  AC_SUBST(BOOT_RTJAR)
-  AC_SUBST(BOOT_TOOLSJAR)
   AC_SUBST(BOOT_JDK)
 
   # Setup tools from the Boot JDK.
diff --git a/common/autoconf/bootcycle-spec.gmk.in b/common/autoconf/bootcycle-spec.gmk.in
index 87e6203fc88..e4fc779128f 100644
--- a/common/autoconf/bootcycle-spec.gmk.in
+++ b/common/autoconf/bootcycle-spec.gmk.in
@@ -42,13 +42,12 @@ endif
 
 # Override specific values to do a boot cycle build
 
+# Use a different Boot JDK
+BOOT_JDK := $(JDK_IMAGE_DIR)
+
 # The bootcycle build has a different output directory
 BUILD_OUTPUT:=@BUILD_OUTPUT@/bootcycle-build
-
-# Use a different Boot JDK
-OLD_BOOT_JDK:=$(BOOT_JDK)
-BOOT_JDK:=@BUILD_OUTPUT@/images/j2sdk-image
-BOOT_RTJAR:=$(BOOT_JDK)/jre/lib/rt.jar
+SJAVAC_SERVER_DIR:=$(subst @BUILD_OUTPUT@,$(BUILD_OUTPUT),$(SJAVAC_SERVER_DIR))
 
 JAVA_CMD:=$(BOOT_JDK)/bin/java
 JAVAC_CMD:=$(BOOT_JDK)/bin/javac
diff --git a/common/autoconf/compare.sh.in b/common/autoconf/compare.sh.in
index 4c6207176c5..5b46e04b6d0 100644
--- a/common/autoconf/compare.sh.in
+++ b/common/autoconf/compare.sh.in
@@ -46,6 +46,7 @@ FILE="@FILE@"
 FIND="@FIND@"
 GREP="@GREP@"
 JAVAP="@FIXPATH@ @BOOT_JDK@/bin/javap @JAVA_TOOL_FLAGS_SMALL@"
+JIMAGE="@FIXPATH@ @BUILD_OUTPUT@/jdk/bin/jimage"
 LDD="@LDD@"
 MKDIR="@MKDIR@"
 NAWK="@NAWK@"
diff --git a/common/autoconf/flags.m4 b/common/autoconf/flags.m4
index cd2d4a38eaa..99a0ce5dc5c 100644
--- a/common/autoconf/flags.m4
+++ b/common/autoconf/flags.m4
@@ -784,24 +784,24 @@ AC_DEFUN_ONCE([FLAGS_SETUP_COMPILER_FLAGS_FOR_JDK],
   LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
 
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
-    LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${JDK_OUTPUTDIR}/lib"
+    LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
     LDFLAGS_JDKLIB_SUFFIX=""
   else
     LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB}  ${SHARED_LIBRARY_FLAGS} \
-        -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
+        -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}"
 
     # On some platforms (mac) the linker warns about non existing -L dirs.
     # Add server first if available. Linking aginst client does not always produce the same results.
     # Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
     # Default to server for other variants.
     if test "x$JVM_VARIANT_SERVER" = xtrue; then
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
     elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/client"
     elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
     else
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
     fi
 
     LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index ee4a8945ede..9d1100744df 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -820,8 +820,6 @@ JAVAH
 JAVAC
 JAVA
 BOOT_JDK
-BOOT_TOOLSJAR
-BOOT_RTJAR
 JAVA_CHECK
 JAVAC_CHECK
 COOKED_BUILD_NUMBER
@@ -4328,7 +4326,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1415179461
+DATE_WHEN_GENERATED=1416999037
 
 ###############################################################################
 #
@@ -25533,20 +25531,6 @@ $as_echo "$as_me: This might be fixed by explicitely setting --with-boot-jdk" >&
     as_fn_error $? "Cannot continue" "$LINENO" 5
   fi
 
-  # Setup proper paths for what we found
-  BOOT_RTJAR="$BOOT_JDK/jre/lib/rt.jar"
-  if test ! -f "$BOOT_RTJAR"; then
-    # On MacOSX it is called classes.jar
-    BOOT_RTJAR="$BOOT_JDK/../Classes/classes.jar"
-    if test -f "$BOOT_RTJAR"; then
-      # Remove the ..
-      BOOT_RTJAR="`cd ${BOOT_RTJAR%/*} && pwd`/${BOOT_RTJAR##*/}"
-    fi
-  fi
-  BOOT_TOOLSJAR="$BOOT_JDK/lib/tools.jar"
-  BOOT_JDK="$BOOT_JDK"
-
-
 
 
   # Setup tools from the Boot JDK.
@@ -42870,24 +42854,24 @@ $as_echo "$as_me: WARNING: $HAS_CFLAG_DETECT_UNDEFINED_BEHAVIOR" >&2;}
   LDFLAGS_JDKLIB="${LDFLAGS_JDK}"
 
   if test "x$TOOLCHAIN_TYPE" = xmicrosoft; then
-    LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${JDK_OUTPUTDIR}/lib"
+    LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -dll -libpath:${OUTPUT_ROOT}/support/modules_libs/java.base"
     LDFLAGS_JDKLIB_SUFFIX=""
   else
     LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB}  ${SHARED_LIBRARY_FLAGS} \
-        -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}"
+        -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}"
 
     # On some platforms (mac) the linker warns about non existing -L dirs.
     # Add server first if available. Linking aginst client does not always produce the same results.
     # Only add client dir if client is being built. Add minimal (note not minimal1) if only building minimal1.
     # Default to server for other variants.
     if test "x$JVM_VARIANT_SERVER" = xtrue; then
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
     elif test "x$JVM_VARIANT_CLIENT" = xtrue; then
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/client"
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/client"
     elif test "x$JVM_VARIANT_MINIMAL1" = xtrue; then
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/minimal"
     else
-      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${JDK_OUTPUTDIR}/lib${OPENJDK_TARGET_CPU_LIBDIR}/server"
+      LDFLAGS_JDKLIB="${LDFLAGS_JDKLIB} -L${OUTPUT_ROOT}/support/modules_libs/java.base${OPENJDK_TARGET_CPU_LIBDIR}/server"
     fi
 
     LDFLAGS_JDKLIB_SUFFIX="-ljava -ljvm"
diff --git a/common/autoconf/spec.gmk.in b/common/autoconf/spec.gmk.in
index e5b43ecdafb..056d9edf8f5 100644
--- a/common/autoconf/spec.gmk.in
+++ b/common/autoconf/spec.gmk.in
@@ -236,31 +236,23 @@ BUILD_VARIANT_RELEASE:=@BUILD_VARIANT_RELEASE@
 
 BUILD_OUTPUT:=@BUILD_OUTPUT@
 # Colon left out to be able to override IMAGES_OUTPUTDIR for bootcycle-images
-LANGTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/langtools
-CORBA_OUTPUTDIR=$(BUILD_OUTPUT)/corba
-JAXP_OUTPUTDIR=$(BUILD_OUTPUT)/jaxp
-JAXWS_OUTPUTDIR=$(BUILD_OUTPUT)/jaxws
+SUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/support
+BUILDTOOLS_OUTPUTDIR=$(BUILD_OUTPUT)/buildtools
+MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/makesupport
+
 HOTSPOT_OUTPUTDIR=$(BUILD_OUTPUT)/hotspot
 JDK_OUTPUTDIR=$(BUILD_OUTPUT)/jdk
-NASHORN_OUTPUTDIR=$(BUILD_OUTPUT)/nashorn
 IMAGES_OUTPUTDIR=$(BUILD_OUTPUT)/images
 TESTMAKE_OUTPUTDIR=$(BUILD_OUTPUT)/testmake
 MAKESUPPORT_OUTPUTDIR=$(BUILD_OUTPUT)/make-support
 
-LANGTOOLS_DIST=$(LANGTOOLS_OUTPUTDIR)/dist
-CORBA_DIST=$(CORBA_OUTPUTDIR)/dist
-JAXP_DIST=$(JAXP_OUTPUTDIR)/dist
-JAXWS_DIST=$(JAXWS_OUTPUTDIR)/dist
 HOTSPOT_DIST=@HOTSPOT_DIST@
-NASHORN_DIST=$(NASHORN_OUTPUTDIR)/dist
 
 BUILD_HOTSPOT=@BUILD_HOTSPOT@
 
-# The boot jdk to use. These are overridden in bootcycle-spec.gmk. Make sure to keep
-# them in sync.
+# The boot jdk to use. This is overridden in bootcycle-spec.gmk. Make sure to keep
+# it in sync.
 BOOT_JDK:=@BOOT_JDK@
-BOOT_RTJAR:=@BOOT_RTJAR@
-BOOT_TOOLSJAR=$(BOOT_JDK)/lib/tools.jar
 
 # When compiling Java source to be run by the boot jdk
 # use these extra flags, eg -source 6 -target 6
@@ -484,13 +476,14 @@ SJAVAC_SERVER_JAVA=@FIXPATH@ $(SJAVAC_SERVER_JAVA_CMD) $(SJAVAC_SERVER_JAVA_FLAG
 JAVAC_FLAGS?=@JAVAC_FLAGS@
 
 # You run the new javac using the boot jdk with $(BOOT_JDK)/bin/java $(NEW_JAVAC) ...
-INTERIM_LANGTOOLS_JAR := $(LANGTOOLS_OUTPUTDIR)/dist/interim_langtools.jar
-INTERIM_LANGTOOLS_ARGS := "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" -cp $(INTERIM_LANGTOOLS_JAR)
+# Use = assignment to be able to override in bootcycle-spec.gmk
+INTERIM_LANGTOOLS_JAR = $(BUILDTOOLS_OUTPUTDIR)/interim_langtools.jar
+INTERIM_LANGTOOLS_ARGS = "-Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR)" -cp $(INTERIM_LANGTOOLS_JAR)
 NEW_JAVAC   = $(INTERIM_LANGTOOLS_ARGS) com.sun.tools.javac.Main
 NEW_JAVADOC = $(INTERIM_LANGTOOLS_ARGS) com.sun.tools.javadoc.Main
 
 # The interim corba jar is needed for running rmic
-INTERIM_CORBA_JAR := $(CORBA_OUTPUTDIR)/dist/interim_corba.jar
+INTERIM_CORBA_JAR = $(BUILDTOOLS_OUTPUTDIR)/interim_corba.jar
 
 # Base flags for RC
 # Guarding this against resetting value. Legacy make files include spec multiple
@@ -695,19 +688,15 @@ OS_VERSION_MINOR:=@OS_VERSION_MINOR@
 OS_VERSION_MICRO:=@OS_VERSION_MICRO@
 
 # Images directory definitions
-JDK_IMAGE_SUBDIR:=j2sdk-image
-JRE_IMAGE_SUBDIR:=j2re-image
-JDK_OVERLAY_IMAGE_SUBDIR:=j2sdk-overlay-image
-JRE_OVERLAY_IMAGE_SUBDIR:=j2re-overlay-image
+JDK_IMAGE_SUBDIR:=jdk
+JRE_IMAGE_SUBDIR:=jre
 # Colon left out to be able to override output dir for bootcycle-images
 JDK_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_IMAGE_SUBDIR)
 JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_IMAGE_SUBDIR)
-JDK_OVERLAY_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_OVERLAY_IMAGE_SUBDIR)
-JRE_OVERLAY_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_OVERLAY_IMAGE_SUBDIR)
 
 # Macosx bundles directory definitions
-JDK_BUNDLE_SUBDIR=j2sdk-bundle/jdk$(JDK_VERSION).jdk/Contents
-JRE_BUNDLE_SUBDIR=j2re-bundle/jre$(JDK_VERSION).jre/Contents
+JDK_BUNDLE_SUBDIR=jdk-bundle/jdk$(JDK_VERSION).jdk/Contents
+JRE_BUNDLE_SUBDIR=jre-bundle/jre$(JDK_VERSION).jre/Contents
 JDK_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JDK_BUNDLE_SUBDIR)
 JRE_BUNDLE_DIR=$(IMAGES_OUTPUTDIR)/$(JRE_BUNDLE_SUBDIR)
 
diff --git a/common/bin/compare.sh b/common/bin/compare.sh
index 31ec560dd16..418ca1d3517 100644
--- a/common/bin/compare.sh
+++ b/common/bin/compare.sh
@@ -103,8 +103,8 @@ diff_text() {
 	        -e '[0-9]\{2\}/[0-9]\{2\}/[0-9]\{4\}' \
 	        -e thePoint -e aPoint -e setItemsPtr \
                 -e 'lambda\$[a-zA-Z0-9]*\$[0-9]' ${THIS_FILE} > /dev/null; then
-            $JAVAP -c -constants -l -p ${OTHER_FILE} >  ${OTHER_FILE}.javap
-            $JAVAP -c -constants -l -p ${THIS_FILE} > ${THIS_FILE}.javap
+            $JAVAP -c -constants -l -p "${OTHER_FILE}" >  ${OTHER_FILE}.javap
+            $JAVAP -c -constants -l -p "${THIS_FILE}" > ${THIS_FILE}.javap
             TMP=$($DIFF ${OTHER_FILE}.javap ${THIS_FILE}.javap | \
                 $GREP '^[<>]' | \
                 $SED -e '/[<>].*[0-9]\{4\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}_[0-9]\{2\}-b[0-9]\{2\}.*/d' \
@@ -298,7 +298,7 @@ compare_general_files() {
     WORK_DIR=$3
     
     GENERAL_FILES=$(cd $THIS_DIR && $FIND . -type f ! -name "*.so" ! -name "*.jar" ! -name "*.zip" \
-        ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" \
+        ! -name "*.debuginfo" ! -name "*.dylib" ! -name "jexec" ! -name "*.jimage" \
         ! -name "ct.sym" ! -name "*.diz" ! -name "*.dll" \
         ! -name "*.pdb" ! -name "*.exp" ! -name "*.ilk" \
         ! -name "*.lib" ! -name "*.war" ! -name "JavaControlPanel" \
@@ -395,8 +395,14 @@ compare_zip_file() {
     $RM -rf $THIS_UNZIPDIR $OTHER_UNZIPDIR
     $MKDIR -p $THIS_UNZIPDIR
     $MKDIR -p $OTHER_UNZIPDIR
-    (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
-    (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
+    if [ "$TYPE" = "jimage" ]
+    then
+        (cd $THIS_UNZIPDIR && $JIMAGE extract $THIS_ZIP)
+        (cd $OTHER_UNZIPDIR && $JIMAGE extract $OTHER_ZIP)
+    else
+        (cd $THIS_UNZIPDIR && $UNARCHIVE $THIS_ZIP)
+        (cd $OTHER_UNZIPDIR && $UNARCHIVE $OTHER_ZIP)
+    fi
 
     # Find all archives inside and unzip them as well to compare the contents rather than
     # the archives. pie.jar.pack.gz i app3.war is corrupt, skip it.
@@ -525,7 +531,7 @@ compare_all_jar_files() {
 
     # TODO filter?
     ZIPS=$(cd $THIS_DIR && $FIND . -type f -name "*.jar" -o -name "*.war" \
-        | $SORT | $FILTER)
+        -o -name "*.jimage" | $SORT | $FILTER)
 
     if [ -n "$ZIPS" ]; then
         echo Jar files...
@@ -633,7 +639,7 @@ compare_bin_file() {
         if cmp $OTHER_FILE $THIS_FILE > /dev/null; then
         # The files were bytewise identical.
             if [ -n "$VERBOSE" ]; then
-                echo "        :           :         :         :          : $BIN_FILE"
+                echo "        :           :         :         :          :          : $BIN_FILE"
             fi
             return 0
         fi
@@ -1136,17 +1142,8 @@ fi
 
 if [ "$SKIP_DEFAULT" != "true" ]; then
     if [ -z "$OTHER" ]; then
-        OTHER="$THIS/../$LEGACY_BUILD_DIR"
-        if [ -d "$OTHER" ]; then
-            OTHER="$( cd "$OTHER" && pwd )"
-        else
-            echo "Default old build directory does not exist:"
-            echo "$OTHER"
-            exit 1
-        fi
-        echo "Comparing to default old build:"
-        echo "$OTHER"
-        echo
+        echo "Nothing to compare to, set with -o"
+        exit 1
     else
         if [ ! -d "$OTHER" ]; then
             echo "Other build directory does not exist:"
@@ -1160,90 +1157,36 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
     fi
 
 
-    # Figure out the layout of the this build. Which kinds of images have been produced
-    if [ -d "$THIS/install/j2sdk-image" ]; then
-        THIS_J2SDK="$THIS/install/j2sdk-image"
-        THIS_J2RE="$THIS/install/j2re-image"
-        echo "Selecting install images in this build"
-    elif [ -d "$THIS/deploy/j2sdk-image" ]; then
-        THIS_J2SDK="$THIS/deploy/j2sdk-image"
-        THIS_J2RE="$THIS/deploy/j2re-image"
-        echo "Selecting deploy images in this build"
-    elif [ -d "$THIS/images/j2sdk-image" ]; then
-        THIS_J2SDK="$THIS/images/j2sdk-image"
-        THIS_J2RE="$THIS/images/j2re-image"
-        echo "Selecting jdk images in this build"
+    # Find the common images to compare, prioritizing later build stages
+    if [ -d "$THIS/install/jdk" ] && [ -d "$OTHER/install/jdk" ]; then
+        THIS_J2SDK="$THIS/install/jdk"
+        THIS_J2RE="$THIS/install/jre"
+        OTHER_J2SDK="$OTHER/install/jdk"
+        OTHER_J2RE="$OTHER/install/jre"
+        echo "Selecting install images for compare"
+    elif [ -d "$THIS/deploy/jdk" ] && [ -d "$OTHER/deploy/jdk" ]; then
+        THIS_J2SDK="$THIS/deploy/jdk"
+        THIS_J2RE="$THIS/deploy/jre"
+        OTHER_J2SDK="$OTHER/deploy/jdk"
+        OTHER_J2RE="$OTHER/deploy/jre"
+        echo "Selecting deploy images for compare"
+    elif [ -d "$THIS/images/jdk" ] && [ -d "$OTHER/images/jdk" ]; then
+        THIS_J2SDK="$THIS/images/jdk"
+        THIS_J2RE="$THIS/images/jre"
+        OTHER_J2SDK="$OTHER/images/jdk"
+        OTHER_J2RE="$OTHER/images/jre"
+        echo "Selecting jdk images for compare"
+    else
+	echo "No common images found."
+	exit 1
     fi
 
-    if [ -d "$THIS/images/j2sdk-overlay-image" ]; then
-        if [ -d "$THIS/install/j2sdk-image" ]; then
-            # If there is an install image, prefer that, it's also overlay
-            THIS_J2SDK_OVERLAY="$THIS/install/j2sdk-image"
-            THIS_J2RE_OVERLAY="$THIS/install/j2re-image"
-            echo "Selecting install overlay images in this build"
-        else
-            THIS_J2SDK_OVERLAY="$THIS/images/j2sdk-overlay-image"
-            THIS_J2RE_OVERLAY="$THIS/images/j2re-overlay-image"
-            echo "Selecting jdk overlay images in this build"
-        fi
-    fi
-
-    if [ -d "$THIS/images/j2sdk-bundle" ]; then
-        THIS_J2SDK_BUNDLE="$THIS/images/j2sdk-bundle"
-        THIS_J2RE_BUNDLE="$THIS/images/j2re-bundle"
-        echo "Selecting bundles in this build"
-    fi
-
-    # Figure out the layout of the other build (old or new, normal or overlay image)
-    if [ -d "$OTHER/j2sdk-image" ]; then
-        if [ -f "$OTHER/j2sdk-image/LICENSE" ]; then
-            OTHER_J2SDK="$OTHER/j2sdk-image"
-            OTHER_J2RE="$OTHER/j2re-image"
-            echo "Selecting old-style images in other build"
-        else
-            OTHER_J2SDK_OVERLAY="$OTHER/j2sdk-image"
-            OTHER_J2RE_OVERLAY="$OTHER/j2re-image"
-            echo "Selecting overlay images in other build"
-        fi
-    elif [ -d "$OTHER/install/j2sdk-image" ]; then
-        OTHER_J2SDK="$OTHER/install/j2sdk-image"
-        OTHER_J2RE="$OTHER/install/j2re-image"
-        echo "Selecting install images in other build"
-    elif [ -d "$OTHER/deploy/j2sdk-image" ]; then
-        OTHER_J2SDK="$OTHER/deploy/j2sdk-image"
-        OTHER_J2RE="$OTHER/deploy/j2re-image"
-        echo "Selecting deploy images in other build"
-    elif [ -d "$OTHER/images/j2sdk-image" ]; then
-        OTHER_J2SDK="$OTHER/images/j2sdk-image"
-        OTHER_J2RE="$OTHER/images/j2re-image"
-        echo "Selecting jdk images in other build"
-    fi
-
-    if [ -d "$OTHER/j2sdk-bundle" ]; then
-        OTHER_J2SDK_BUNDLE="$OTHER/j2sdk-bundle"
-        OTHER_J2RE_BUNDLE="$OTHER/j2re-bundle"
-        echo "Selecting bundles in other build"
-    elif [ -d "$OTHER/images/j2sdk-bundle" ]; then
-        OTHER_J2SDK_BUNDLE="$OTHER/images/j2sdk-bundle"
-        OTHER_J2RE_BUNDLE="$OTHER/images/j2re-bundle"
-        echo "Selecting jdk bundles in other build"
-    fi
-    
-    if [ -z "$THIS_J2SDK" ] || [ -z "$THIS_J2RE" ]; then
-        if [ -z "$THIS_J2SDK_OVERLAY" ]; then
-            echo "Cannot locate images for this build. Are you sure you have run 'make images'?"
-            exit 1
-        fi
-    fi
-
-    if [ -z "$OTHER_J2SDK" ] && [ -n "$OTHER_J2SDK_OVERLAY" ] && [ -z "$THIS_J2SDK_OVERLAY" ]; then
-        echo "OTHER build only has an overlay image while this build does not. Nothing to compare!"
-        exit 1
-    fi
-
-    if [ -z "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
-        echo "WARNING! OTHER build has bundles built while this build does not."
-        echo "Skipping bundle compare!"
+    if [ -d "$THIS/images/jdk-bundle" ] && [ -d "$OTHER/images/jdk-bundle" ]; then
+        THIS_J2SDK_BUNDLE="$THIS/images/jdk-bundle"
+        THIS_J2RE_BUNDLE="$THIS/images/jre-bundle"
+        OTHER_J2SDK_BUNDLE="$OTHER/images/jdk-bundle"
+        OTHER_J2RE_BUNDLE="$OTHER/images/jre-bundle"
+        echo "Also comparing macosx bundles"
     fi
 
     if [ -d "$OTHER/images" ]; then
@@ -1266,22 +1209,13 @@ if [ "$SKIP_DEFAULT" != "true" ]; then
         THIS_JGSS_WINDOWS_BIN="$THIS_SEC_DIR/$JGSS_WINDOWS_BIN"
     fi
 
-    if [ -d "$THIS/docs" ]; then
+    if [ -d "$THIS/docs" ] && [ -d "$OTHER/docs" ]; then
         THIS_DOCS="$THIS/docs"
-    fi
-
-    if [ -d "$OTHER/docs" ]; then
         OTHER_DOCS="$OTHER/docs"
-    fi
-
-    if [ -z "$THIS_DOCS" ]; then
+	echo "Also comparing docs"
+    else
         echo "WARNING! Docs haven't been built and won't be compared."
     fi
-
-    if [ -z "$OTHER_DOCS" ]; then
-        echo "WARNING! Other build doesn't contain docs, skipping doc compare."
-    fi
-
 fi
 
 ##########################################################################################
@@ -1299,27 +1233,16 @@ if [ "$CMP_NAMES" = "true" ]; then
         echo -n "J2RE  "
         compare_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
     fi
-    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
-        echo -n "J2SDK Overlay "
-        compare_dirs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
-        echo -n "J2RE  Overlay "
-        compare_dirs $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
-        
-        echo -n "J2SDK Overlay "
-        compare_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
-        echo -n "J2RE  Overlay "
-        compare_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
-    fi
     if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
         echo -n "J2SDK Bundle "
-        compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+        compare_dirs $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
         echo -n "J2RE  Bundle "
-        compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
+        compare_dirs $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
         
         echo -n "J2SDK Bundle "
-        compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+        compare_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
         echo -n "J2RE  Bundle "
-        compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
+        compare_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
     fi
     if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
         echo -n "Docs "
@@ -1340,18 +1263,6 @@ if [ "$CMP_PERMS" = "true" ]; then
         echo -n "J2RE  "
         compare_permissions $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
     fi
-    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
-        echo -n "J2SDK Overlay "
-        compare_permissions $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
-        echo -n "J2RE  Overlay "
-        compare_permissions $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
-    fi
-    if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
-        echo -n "J2SDK Bundle "
-        compare_permissions $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
-        echo -n "J2RE  Bundle "
-        compare_permissions $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
-    fi
     if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
         compare_permissions $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
     fi
@@ -1364,17 +1275,11 @@ if [ "$CMP_TYPES" = "true" ]; then
         echo -n "J2RE  "
         compare_file_types $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
     fi
-    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
-        echo -n "J2SDK Overlay "
-        compare_file_types $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
-        echo -n "J2RE  Overlay "
-        compare_file_types $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
-    fi
     if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
         echo -n "J2SDK Bundle "
-        compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+        compare_file_types $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
         echo -n "J2RE  Bundle "
-        compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
+        compare_file_types $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
     fi
     if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
         compare_file_types $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
@@ -1388,17 +1293,11 @@ if [ "$CMP_GENERAL" = "true" ]; then
         echo -n "J2RE  "
         compare_general_files $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
     fi
-    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
-        echo -n "J2SDK Overlay "
-        compare_general_files $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
-        echo -n "J2RE  Overlay "
-        compare_general_files $THIS_J2RE_OVERLAY $OTHER_J2RE_OVERLAY $COMPARE_ROOT/j2re-overlay
-    fi
     if [ -n "$THIS_J2SDK_BUNDLE" ] && [ -n "$OTHER_J2SDK_BUNDLE" ]; then
         echo -n "J2SDK Bundle "
-        compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/j2sdk-bundle
+        compare_general_files $THIS_J2SDK_BUNDLE $OTHER_J2SDK_BUNDLE $COMPARE_ROOT/jdk-bundle
         echo -n "J2RE  Bundle "
-        compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/j2re-bundle
+        compare_general_files $THIS_J2RE_BUNDLE $OTHER_J2RE_BUNDLE $COMPARE_ROOT/jre-bundle
     fi
     if [ -n "$THIS_DOCS" ] && [ -n "$OTHER_DOCS" ]; then
         echo -n "Docs "
@@ -1454,10 +1353,6 @@ if [ "$CMP_LIBS" = "true" ]; then
             compare_all_libs $THIS_J2RE $OTHER_J2RE $COMPARE_ROOT/j2re
         fi
     fi
-    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
-        echo -n "Bundle   "
-        compare_all_libs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
-    fi
     if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
         compare_all_libs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
     fi
@@ -1467,10 +1362,6 @@ if [ "$CMP_EXECS" = "true" ]; then
     if [ -n "$THIS_J2SDK" ] && [ -n "$OTHER_J2SDK" ]; then
         compare_all_execs $THIS_J2SDK $OTHER_J2SDK $COMPARE_ROOT/j2sdk
     fi
-    if [ -n "$THIS_J2SDK_OVERLAY" ] && [ -n "$OTHER_J2SDK_OVERLAY" ]; then
-        echo -n "Overlay "
-        compare_all_execs $THIS_J2SDK_OVERLAY $OTHER_J2SDK_OVERLAY $COMPARE_ROOT/j2sdk-overlay
-    fi
     if [ -n "$THIS_BASE_DIR" ] && [ -n "$OTHER_BASE_DIR" ]; then
         compare_all_execs $THIS_BASE_DIR $OTHER_BASE_DIR $COMPARE_ROOT/base_dir
     fi
diff --git a/common/bin/compare_exceptions.sh.incl b/common/bin/compare_exceptions.sh.incl
index cace701b788..96f7fb75cbb 100644
--- a/common/bin/compare_exceptions.sh.incl
+++ b/common/bin/compare_exceptions.sh.incl
@@ -84,7 +84,9 @@ ACCEPTED_BIN_DIFF="
 ./bin/jconsole
 ./bin/jdb
 ./bin/jhat
+./bin/jimage
 ./bin/jinfo
+./bin/jjs
 ./bin/jmap
 ./bin/jps
 ./bin/jrunscript
@@ -171,7 +173,9 @@ ACCEPTED_BIN_DIFF="
 ./bin/jconsole
 ./bin/jdb
 ./bin/jhat
+./bin/jimage
 ./bin/jinfo
+./bin/jjs
 ./bin/jmap
 ./bin/jps
 ./bin/jrunscript
@@ -314,7 +318,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
 ./bin/jconsole
 ./bin/jdb
 ./bin/jhat
+./bin/jimage
 ./bin/jinfo
+./bin/jjs
 ./bin/jmap
 ./bin/jps
 ./bin/jrunscript
@@ -453,7 +459,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
 ./bin/amd64/jconsole
 ./bin/amd64/jdb
 ./bin/amd64/jhat
+./bin/amd64/jimage
 ./bin/amd64/jinfo
+./bin/amd64/jjs
 ./bin/amd64/jmap
 ./bin/amd64/jps
 ./bin/amd64/jrunscript
@@ -611,7 +619,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
 ./bin/jconsole
 ./bin/jdb
 ./bin/jhat
+./bin/jimage
 ./bin/jinfo
+./bin/jjs
 ./bin/jmap
 ./bin/jps
 ./bin/jrunscript
@@ -755,7 +765,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
 ./bin/sparcv9/jconsole
 ./bin/sparcv9/jdb
 ./bin/sparcv9/jhat
+./bin/sparcv9/jimage
 ./bin/sparcv9/jinfo
+./bin/sparcv9/jjs
 ./bin/sparcv9/jmap
 ./bin/sparcv9/jps
 ./bin/sparcv9/jrunscript
@@ -836,7 +848,9 @@ ACCEPTED_SMALL_SIZE_DIFF="
 ./bin/jconsole.exe
 ./bin/jdb.exe
 ./bin/jhat.exe
+./bin/jimage.exe
 ./bin/jinfo.exe
+./bin/jjs.exe
 ./bin/jmap.exe
 ./bin/jps.exe
 ./bin/jrunscript.exe
@@ -930,7 +944,9 @@ ACCEPTED_BIN_DIFF="
 ./bin/jconsole
 ./bin/jdb
 ./bin/jhat
+./bin/jimage
 ./bin/jinfo
+./bin/jjs
 ./bin/jmap
 ./bin/jps
 ./bin/jrunscript
diff --git a/common/bin/unshuffle_list.txt b/common/bin/unshuffle_list.txt
index f05bd5c0c0d..cd0749c7aa8 100644
--- a/common/bin/unshuffle_list.txt
+++ b/common/bin/unshuffle_list.txt
@@ -1212,6 +1212,7 @@ jdk/src/java.rmi/share/classes/sun/rmi/transport/tcp : jdk/src/share/classes/sun
 jdk/src/java.rmi/share/doc/stub/java/rmi/activation : jdk/src/share/doc/stub/java/rmi/activation
 jdk/src/java.rmi/unix/bin/java-rmi.cgi.sh : jdk/src/solaris/bin/java-rmi.cgi.sh
 jdk/src/java.scripting/share/classes/javax/script : jdk/src/share/classes/javax/script
+jdk/src/java.scripting/share/classes/com/sun/tools/script/shell : jdk/src/share/classes/com/sun/tools/script/shell
 jdk/src/java.security.acl/share/classes/java/security/acl : jdk/src/share/classes/java/security/acl
 jdk/src/java.security.acl/share/classes/sun/security/acl : jdk/src/share/classes/sun/security/acl
 jdk/src/java.security.jgss/macosx/native/libosxkrb5/nativeccache.c : jdk/src/share/native/sun/security/krb5/nativeccache.c
@@ -1301,7 +1302,6 @@ jdk/src/jdk.deploy.osx/macosx/native/libosx/JavaAppLauncher.m : jdk/src/macosx/n
 jdk/src/jdk.deploy.osx/macosx/native/libosx/KeystoreImpl.m : jdk/src/macosx/native/apple/security/KeystoreImpl.m
 jdk/src/jdk.dev/share/classes/com/sun/jarsigner : jdk/src/share/classes/com/sun/jarsigner
 jdk/src/jdk.dev/share/classes/com/sun/tools/hat : jdk/src/share/classes/com/sun/tools/hat
-jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell : jdk/src/share/classes/com/sun/tools/script/shell
 jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner : jdk/src/share/classes/sun/security/tools/jarsigner
 jdk/src/jdk.dev/share/classes/sun/tools/jar : jdk/src/share/classes/sun/tools/jar
 jdk/src/jdk.dev/share/classes/sun/tools/native2ascii : jdk/src/share/classes/sun/tools/native2ascii
diff --git a/make/CompileJavaModules.gmk b/make/CompileJavaModules.gmk
index 20ae9c9f073..009162f3a00 100644
--- a/make/CompileJavaModules.gmk
+++ b/make/CompileJavaModules.gmk
@@ -235,6 +235,11 @@ endif
 
 ################################################################################
 
+java.scripting_COPY := .js
+java.scripting_CLEAN := .properties
+
+################################################################################
+
 java.sql_SETUP := GENERATE_JDKBYTECODE_NOWARNINGS
 
 ################################################################################
@@ -318,6 +323,9 @@ jdk.charsets_COPY := .dat
 ################################################################################
 
 jdk.compiler_COPY := javax.tools.JavaCompilerTool
+jdk.compiler_CLEAN_FILES := $(wildcard \
+    $(patsubst %, $(JDK_TOPDIR)/src/jdk.compiler/share/classes/%/*.properties, \
+        sun/tools/serialver/resources))
 
 ################################################################################
 
@@ -366,12 +374,6 @@ jdk.jconsole_CLEAN_FILES := $(wildcard \
 
 ################################################################################
 
-jdk.compiler_CLEAN_FILES := $(wildcard \
-    $(patsubst %, $(JDK_TOPDIR)/src/jdk.compiler/share/classes/%/*.properties, \
-        sun/tools/serialver/resources))
-
-################################################################################
-
 jdk.jdi_EXCLUDES += \
     com/sun/tools/example/debug/bdi \
     com/sun/tools/example/debug/event \
@@ -426,10 +428,8 @@ jdk.localedata_EXCLUDE_FILES += sun/text/resources/th/BreakIteratorRules_th.java
 #
 # To use this variable, use $(call ALL_SRC_DIRS,module) with no space.
 GENERATED_SRC_DIRS += \
-    $(JDK_OUTPUTDIR)/gensrc/$1 \
-    $(LANGTOOLS_OUTPUTDIR)/gensrc/$1 \
-    $(CORBA_OUTPUTDIR)/gensrc/$1 \
-    $(JDK_OUTPUTDIR)/gensrc_no_srczip/$1 \
+    $(SUPPORT_OUTPUTDIR)/gensrc/$1 \
+    $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$1 \
     #
 
 OS_SRC_DIRS += $(JDK_TOPDIR)/src/$1/$(OPENJDK_TARGET_OS)/classes
@@ -488,7 +488,7 @@ define SetupModuleCompilation
       SRC := $$(wildcard $$(call ALL_SRC_DIRS,$1)), \
       INCLUDES:=$(JDK_USER_DEFINED_FILTER),\
       BIN := $(JDK_OUTPUTDIR)/modules/$1, \
-      HEADERS := $(JDK_OUTPUTDIR)/gensrc_headers/$1, \
+      HEADERS := $(SUPPORT_OUTPUTDIR)/headers/$1, \
       ADD_JAVAC_FLAGS := $$($1_JAVAC_FLAGS)))
 
   $1: $$($1) $$($1_COPY_EXTRA)
diff --git a/make/Images.gmk b/make/Images.gmk
new file mode 100644
index 00000000000..93a73a5b1b7
--- /dev/null
+++ b/make/Images.gmk
@@ -0,0 +1,496 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+TOOL_TARGETS :=
+JDK_TARGETS := 
+JRE_TARGETS :=
+
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, , Images-pre.gmk))
+
+############################################################################
+
+MAIN_MODULES += java.se java.smartcardio jdk.httpserver jdk.sctp \
+               jdk.security.auth jdk.security.jgss jdk.runtime
+
+# providers
+PROVIDER_MODULES += jdk.charsets jdk.crypto.ec jdk.crypto.pkcs11 jdk.jvmstat jdk.localedata \
+               jdk.naming.dns jdk.naming.rmi jdk.scripting.nashorn jdk.zipfs
+
+# tools
+TOOLS_MODULES += jdk.attach jdk.compiler jdk.dev jdk.javadoc jdk.jcmd jdk.jconsole \
+               jdk.hotspot.agent jdk.hprof.agent jdk.jdi jdk.jdwp.agent jdk.rmic \
+               jdk.xml.bind jdk.xml.ws
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  PROVIDER_MODULES += jdk.crypto.mscapi
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), solaris)
+  PROVIDER_MODULES += jdk.crypto.ucrypto
+endif
+
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+  MAIN_MODULES += jdk.deploy.osx
+endif
+
+JRE_MODULES := $(MAIN_MODULES) $(PROVIDER_MODULES)
+JDK_MODULES := $(JRE_MODULES) $(TOOLS_MODULES)
+
+# compact3 builds have additional modules
+JDK_COMPACT3_MODULES := java.compact3 java.smartcardio jdk.httpserver jdk.naming.dns \
+                       jdk.naming.rmi jdk.sctp jdk.security.auth
+
+# Replacing double-comma with a single comma is to workaround the issue
+# with some version of make on windows that doesn't substitute spaces 
+# with one comma properly as with make 4.0
+define SubstComma
+  $(subst $(COMMA)$(COMMA),$(COMMA),$(subst $(SPACE),$(COMMA),$(strip $1)))
+endef
+JRE_MODULES_LIST := $(call SubstComma, $(JRE_MODULES))
+JDK_MODULES_LIST := $(call SubstComma, $(JDK_MODULES))
+
+################################################################################
+
+JRE_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/jre-sorted-modules
+JDK_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/jdk-sorted-modules
+JRE_COMPACT1_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/compact1-sorted-modules
+JRE_COMPACT2_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/compact2-sorted-modules
+JRE_COMPACT3_SORTED_MODULES := $(SUPPORT_OUTPUTDIR)/compact3-sorted-modules
+
+
+MODULES_CMDS := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
+MODULES_LIBS := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped
+MODULES_CONF := $(SUPPORT_OUTPUTDIR)/modules_conf
+
+JIMAGE_TOOL := $(JAVA_SMALL) \
+    -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
+    -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.module.ImageBuilder \
+    --cmds $(MODULES_CMDS) \
+    --libs $(MODULES_LIBS) \
+    --configs $(MODULES_CONF) \
+    --classes $(JDK_OUTPUTDIR)/modules \
+    --endian $(OPENJDK_TARGET_CPU_ENDIAN) \
+    #
+
+MODULES_XML += $(SRC_ROOT)/modules.xml
+DEPENDENCIES := $(call CacheFind, \
+    $(SUPPORT_OUTPUTDIR)/modules_cmds \
+    $(SUPPORT_OUTPUTDIR)/modules_libs) \
+    $(wildcard $(JDK_OUTPUTDIR)/modules/*/_*) \
+    $(MODULES_XML)
+    #
+
+# Use this file inside the image as target for make rule
+JIMAGE_TARGET_FILE := bin/java$(EXE_SUFFIX)
+
+$(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
+	$(ECHO) Creating jdk jimage
+	$(RM) -r $(JDK_IMAGE_DIR) $(JDK_SORTED_MODULES)
+	$(JIMAGE_TOOL) --mods $(JDK_MODULES_LIST) --output $(JDK_IMAGE_DIR) \
+	    $(MODULES_XML) > $(JDK_SORTED_MODULES)
+	$(TOUCH) $@
+
+$(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
+	$(ECHO) Creating jre jimage
+	$(RM) -r $(JRE_IMAGE_DIR) $(JRE_SORTED_MODULES)
+	$(JIMAGE_TOOL) --mods $(JRE_MODULES_LIST) --output $(JRE_IMAGE_DIR) \
+	    $(MODULES_XML) > $(JRE_SORTED_MODULES)
+	$(TOUCH) $@
+
+JRE_COMPACT1_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact1
+JRE_COMPACT2_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact2
+JRE_COMPACT3_IMAGE_DIR := $(JRE_IMAGE_DIR)-compact3
+
+COMPACT_EXTRA_MODULES := jdk.localedata jdk.crypto.pkcs11 jdk.crypto.ec
+
+$(JRE_COMPACT1_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
+	$(ECHO) Creating jre compact1 jimage
+	$(RM) -r $(JRE_COMPACT1_IMAGE_DIR) $(JRE_COMPACT1_SORTED_MODULES)
+	$(JIMAGE_TOOL) \
+	    --mods $(call SubstComma, java.compact1 $(COMPACT_EXTRA_MODULES)) \
+	    --output $(JRE_COMPACT1_IMAGE_DIR) \
+	    $(MODULES_XML) > $(JRE_COMPACT1_SORTED_MODULES)
+	$(TOUCH) $@
+
+$(JRE_COMPACT2_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
+	$(ECHO) Creating jre compact2 jimage
+	$(RM) -r $(JRE_COMPACT2_IMAGE_DIR) $(JRE_COMPACT2_SORTED_MODULES)
+	$(JIMAGE_TOOL) \
+	    --mods $(call SubstComma, java.compact2 $(COMPACT_EXTRA_MODULES)) \
+	    --output $(JRE_COMPACT2_IMAGE_DIR) \
+	    $(MODULES_XML) > $(JRE_COMPACT2_SORTED_MODULES)
+	$(TOUCH) $@
+
+$(JRE_COMPACT3_IMAGE_DIR)/$(JIMAGE_TARGET_FILE): $(DEPENDENCIES)
+	$(ECHO) Creating jre compact3 jimage
+	$(RM) -r $(JRE_COMPACT3_IMAGE_DIR) $(JRE_COMPACT3_SORTED_MODULES)
+	$(JIMAGE_TOOL) \
+	    --mods $(call SubstComma, $(JDK_COMPACT3_MODULES) $(COMPACT_EXTRA_MODULES)) \
+	    --output $(JRE_COMPACT3_IMAGE_DIR) \
+	    $(MODULES_XML) > $(JRE_COMPACT3_SORTED_MODULES)
+	$(TOUCH) $@
+
+TOOL_JRE_TARGETS := $(JRE_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+TOOL_JDK_TARGETS := $(JDK_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+TOOL_JRE_COMPACT1_TARGETS := $(JRE_COMPACT1_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+TOOL_JRE_COMPACT2_TARGETS := $(JRE_COMPACT2_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+TOOL_JRE_COMPACT3_TARGETS := $(JRE_COMPACT3_IMAGE_DIR)/$(JIMAGE_TARGET_FILE)
+
+################################################################################
+# /man dir
+#
+# All variables in this section are assigned with simple =, without :, to enable
+# more selective overriding from the custom version of this file.
+#
+# Avoid evaluating this whole section on windows for speed and stability
+ifneq ($(OPENJDK_TARGET_OS), windows)
+  JRE_MAN_PAGES += \
+      java.1 \
+      jjs.1 \
+      keytool.1 \
+      orbd.1 \
+      pack200.1 \
+      policytool.1 \
+      rmid.1 \
+      rmiregistry.1 \
+      servertool.1 \
+      tnameserv.1 \
+      unpack200.1
+
+  ifndef OPENJDK
+    ifneq ($(OPENJDK_TARGET_OS), solaris)
+      JRE_MAN_PAGES += javaws.1
+    endif
+  endif
+
+  JDK_MAN_PAGES += \
+      $(JRE_MAN_PAGES) \
+      appletviewer.1 \
+      idlj.1 \
+      jar.1 \
+      jarsigner.1 \
+      javac.1 \
+      javadoc.1 \
+      javah.1 \
+      javap.1 \
+      jconsole.1 \
+      jcmd.1 \
+      jdb.1 \
+      jdeps.1 \
+      jhat.1 \
+      jinfo.1 \
+      jmap.1 \
+      jps.1 \
+      jrunscript.1 \
+      jsadebugd.1 \
+      jstack.1 \
+      jstat.1 \
+      jstatd.1 \
+      native2ascii.1 \
+      rmic.1 \
+      schemagen.1 \
+      serialver.1 \
+      wsgen.1 \
+      wsimport.1 \
+      xjc.1
+
+  # This variable is potentially overridden in the closed makefile.
+  MAN_SRC_BASEDIR ?= $(JDK_TOPDIR)/src
+
+  ifeq ($(OPENJDK_TARGET_OS), linux)
+    MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/linux/doc
+    MAN1_SUBDIR = man
+  endif
+  ifeq ($(OPENJDK_TARGET_OS), solaris)
+    MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/solaris/doc
+    MAN1_SUBDIR = sun/man/man1
+  endif
+  ifeq ($(OPENJDK_TARGET_OS), macosx)
+    MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/bsd/doc
+    MAN1_SUBDIR = man
+  endif
+
+  $(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
+	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
+  $(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
+	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
+  define install-ja-manpage
+	$(MKDIR) -p $(@D)
+	$(CAT) $< \
+	    | $(NATIVE2ASCII) -encoding eucJP \
+	    | $(SED) 's/@@VERSION@@/$(THIS_JDK_VERSION)/g' \
+	    | $(NATIVE2ASCII) -reverse -encoding $1 \
+	    > $@
+  endef
+
+  $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call install-ja-manpage, UTF-8)
+
+  $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call install-ja-manpage, UTF-8)
+
+  $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call install-ja-manpage, PCK)
+
+  $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(call install-ja-manpage, PCK)
+
+  ifeq ($(OPENJDK_TARGET_OS), solaris)
+    $(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
+    $(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
+	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+  endif
+
+  ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
+    $(JRE_IMAGE_DIR)/man/ja:
+	$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
+
+    $(JDK_IMAGE_DIR)/man/ja:
+	$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
+  endif
+
+  ifeq ($(OPENJDK_TARGET_OS), solaris)
+    JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
+        $(addprefix $(JRE_IMAGE_DIR)/man/ja/man1/, $(JRE_MAN_PAGES)) \
+        $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
+        $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JRE_MAN_PAGES))
+
+    JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
+        $(addprefix $(JDK_IMAGE_DIR)/man/ja/man1/, $(JDK_MAN_PAGES)) \
+        $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
+        $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JDK_MAN_PAGES))
+  endif
+
+  ifneq ($(findstring $(OPENJDK_TARGET_OS), linux macosx), )
+    JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
+        $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
+        $(JRE_IMAGE_DIR)/man/ja
+
+    JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
+        $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
+        $(JDK_IMAGE_DIR)/man/ja
+  endif
+
+  JRE_TARGETS += $(JRE_MAN_PAGE_LIST)
+  JDK_TARGETS += $(JDK_MAN_PAGE_LIST)
+endif # Windows
+
+################################################################################
+# /include dir
+
+$(eval $(call SetupCopyFiles,COPY_INCLUDES, \
+    SRC := $(JDK_OUTPUTDIR)/include, \
+    DEST := $(JDK_IMAGE_DIR)/include, \
+    FILES := $(call CacheFind,$(JDK_OUTPUTDIR)/include)))
+
+JDK_TARGETS += $(COPY_INCLUDES)
+
+################################################################################
+# doc files
+
+JRE_DOC_FILES ?= LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
+JDK_DOC_FILES ?= LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
+JRE_DOC_LOCATION ?= $(JDK_TOPDIR)
+JDK_DOC_LOCATION ?= $(JDK_TOPDIR)
+
+JRE_DOC_TARGETS := $(addprefix $(JRE_IMAGE_DIR)/, $(JRE_DOC_FILES))
+JDK_DOC_TARGETS := $(addprefix $(JDK_IMAGE_DIR)/, $(JDK_DOC_FILES))
+
+# Processing license files from source area to image area
+# These are modified to have the platform specific EOL chars.
+define process-doc-file
+	$(ECHO) $(LOG_INFO) Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	LC_ALL=C $(SED) 's/$$//g' $< > $@
+	$(CHMOD) 444 $@
+endef
+
+$(JRE_IMAGE_DIR)/%: $(JRE_DOC_LOCATION)/%
+	$(process-doc-file)
+
+$(JDK_IMAGE_DIR)/%: $(JDK_DOC_LOCATION)/%
+	$(process-doc-file)
+
+JRE_TARGETS += $(JRE_DOC_TARGETS)
+JDK_TARGETS += $(JDK_DOC_TARGETS)
+
+################################################################################
+# Release file
+
+JRE_INFO_FILE := $(JRE_IMAGE_DIR)/release
+JDK_INFO_FILE := $(JDK_IMAGE_DIR)/release
+JRE_COMPACT1_INFO_FILE := $(JRE_COMPACT1_IMAGE_DIR)/release
+JRE_COMPACT2_INFO_FILE := $(JRE_COMPACT2_IMAGE_DIR)/release
+JRE_COMPACT3_INFO_FILE := $(JRE_COMPACT3_IMAGE_DIR)/release
+
+# Common way to emit a line into the release or info file
+define info-file-item # name value
+	$(PRINTF) '%s="%s"\n' $1 $2 >> $@
+endef
+
+# Param 1 - The file containing the MODULES list
+define create-info-file
+	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(call info-file-item, "JAVA_VERSION", "$(JDK_VERSION)")
+	$(call info-file-item, "OS_NAME", "$(REQUIRED_OS_NAME)")
+	$(call info-file-item, "OS_VERSION", "$(REQUIRED_OS_VERSION)")
+	$(call info-file-item, "OS_ARCH", "$(OPENJDK_TARGET_CPU_LEGACY)")
+	$(if $(JDK_ARCH_ABI_PROP_NAME), \
+	  $(call info-file-item, "SUN_ARCH_ABI", "$(JDK_ARCH_ABI_PROP_NAME)"))
+	$(call info-file-item, "SOURCE", "$(ALL_SOURCE_TIPS)")
+	$(call info-file-item, "MODULES", "`$(CAT) $1`")
+endef
+
+ALL_SOURCE_TIPS = $(shell \
+    if [ -f $(SUPPORT_OUTPUTDIR)/source_tips ] ; then \
+      $(CAT) $(SUPPORT_OUTPUTDIR)/source_tips ; \
+    fi)
+
+$(JRE_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
+	$(call create-info-file, $(JRE_SORTED_MODULES))
+
+$(JDK_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
+	$(call create-info-file, $(JDK_SORTED_MODULES))
+
+$(JRE_COMPACT1_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
+	$(call create-info-file, $(JRE_COMPACT1_SORTED_MODULES))
+	$(call info-file-item, "JAVA_PROFILE", "compact1")
+
+$(JRE_COMPACT2_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
+	$(call create-info-file, $(JRE_COMPACT2_SORTED_MODULES))
+	$(call info-file-item, "JAVA_PROFILE", "compact2")
+
+$(JRE_COMPACT3_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(SUPPORT_OUTPUTDIR)/source_tips
+	$(call create-info-file, $(JRE_COMPACT3_SORTED_MODULES))
+	$(call info-file-item, "JAVA_PROFILE", "compact3")
+
+JRE_TARGETS += $(JRE_INFO_FILE)
+JDK_TARGETS += $(JDK_INFO_FILE)
+JRE_COMPACT1_TARGETS += $(JRE_COMPACT1_INFO_FILE)
+JRE_COMPACT2_TARGETS += $(JRE_COMPACT2_INFO_FILE)
+JRE_COMPACT3_TARGETS += $(JRE_COMPACT3_INFO_FILE)
+
+################################################################################
+# src.zip
+
+$(JDK_IMAGE_DIR)/src.zip: $(SUPPORT_OUTPUTDIR)/src.zip
+	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(install-file)
+
+JDK_TARGETS += $(JDK_IMAGE_DIR)/src.zip
+
+################################################################################
+# /demo dir
+
+# The db demo contains an empty dir that needs to be copied. The other
+# directories will always trigger the rule for recompile since
+# _the.list_of_packages files are touched.
+ifneq ($(findstring images, $(MAKECMDGOALS)), )
+  $(JDK_IMAGE_DIR)/demo/%: $(SUPPORT_OUTPUTDIR)/demo/image/%
+	if [ ! -d "$@" ]; then \
+	  $(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'; \
+	  $(MKDIR) -p $(@D); \
+	  if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) '$<' '$@'; fi \
+	fi
+
+  # Find all files including directories
+  JDK_DEMO_TARGETS := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/demo/image), \
+      $(patsubst $(SUPPORT_OUTPUTDIR)/demo/image/%, $(JDK_IMAGE_DIR)/demo/%, \
+      $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/demo/image \
+          ! \( -name "_the*" -o -name "javac_state" \) )))
+
+  JDK_TARGETS += $(JDK_DEMO_TARGETS)
+endif
+
+################################################################################
+# /sample dir
+
+$(eval $(call SetupCopyFiles,COPY_SAMPLES, \
+    SRC := $(SUPPORT_OUTPUTDIR)/sample, \
+    DEST := $(JDK_IMAGE_DIR)/sample, \
+    FILES := $(if $(wildcard $(SUPPORT_OUTPUTDIR)/sample), \
+        $(call CacheFind,$(SUPPORT_OUTPUTDIR)/sample))))
+
+JDK_TARGETS += $(COPY_SAMPLES)
+
+################################################################################
+# jrt-fs.jar
+
+$(eval $(call SetupCopyFiles,COPY_JRTFS_JAR, \
+    SRC := $(SUPPORT_OUTPUTDIR), \
+    DEST := $(JDK_IMAGE_DIR), \
+    FILES := $(SUPPORT_OUTPUTDIR)/jrt-fs.jar))
+
+JDK_TARGETS += $(COPY_JRTFS_JAR)
+
+################################################################################
+
+# Include custom post hook here to make it possible to augment the target lists
+# before actual target prerequisites are declared.
+$(eval $(call IncludeCustomExtension, , Images-post.gmk))
+
+################################################################################
+
+$(JRE_TARGETS): $(TOOL_JRE_TARGETS)
+$(JDK_TARGETS): $(TOOL_JDK_TARGETS)
+
+jimages: $(TOOL_JRE_TARGETS) $(TOOL_JDK_TARGETS) $(JRE_TARGETS) $(JDK_TARGETS)
+
+
+$(JRE_COMPACT1_TARGETS): $(TOOL_JRE_COMPACT1_TARGETS)
+$(JRE_COMPACT2_TARGETS): $(TOOL_JRE_COMPACT2_TARGETS)
+$(JRE_COMPACT3_TARGETS): $(TOOL_JRE_COMPACT3_TARGETS)
+
+profiles: $(TOOL_JRE_COMPACT1_TARGETS) \
+    $(TOOL_JRE_COMPACT2_TARGETS) \
+    $(TOOL_JRE_COMPACT3_TARGETS) \
+    $(JRE_COMPACT1_TARGETS) \
+    $(JRE_COMPACT2_TARGETS) \
+    $(JRE_COMPACT3_TARGETS)
+
+.PHONY: default all jimages profiles
diff --git a/make/Javadoc.gmk b/make/Javadoc.gmk
index 4ba011d15d8..78cd223a745 100644
--- a/make/Javadoc.gmk
+++ b/make/Javadoc.gmk
@@ -44,8 +44,8 @@ include NON_CORE_PKGS.gmk
 # Definitions for directories
 #
 
-DOCSDIR := $(OUTPUT_ROOT)/docs
-TEMPDIR := $(OUTPUT_ROOT)/docstemp
+DOCSDIR := $(IMAGES_OUTPUTDIR)/docs
+DOCSTMPDIR = $(SUPPORT_OUTPUTDIR)/docs
 
 HOTSPOT_DOCS_IMPORT_PATH=$(HOTSPOT_OUTPUTDIR)/docs
 
@@ -142,9 +142,8 @@ ALL_SOURCE_DIRS := $(wildcard \
       $(CORBA_TOPDIR)/src/*/share/classes \
       $(JAXP_TOPDIR)/src/*/share/classes \
       $(JAXWS_TOPDIR)/src/*/share/classes \
-      $(JDK_OUTPUTDIR)/gensrc/j* \
-      $(JDK_OUTPUTDIR)/gendocsrc_rmic \
-      $(CORBA_OUTPUTDIR)/gensrc/j* \
+      $(SUPPORT_OUTPUTDIR)/gensrc/j* \
+      $(SUPPORT_OUTPUTDIR)/rmic/j* \
       $(JDK_TOPDIR)/src/*/share/doc/stub \
       ) \
       #
@@ -201,11 +200,6 @@ define JavadocSummary # optionsfile packagesfile
 	@($(ECHO) "# Packages (`$(BASENAME) $2`):";$(SED) -e 's@^@#   @' $2) $(LOG_DEBUG)
 endef
 
-#
-# Temporary directory for javadoc creation
-#
-DOCSTMPDIR = $(TEMPDIR)/doctmp
-
 #
 # Different api directories created from root directory
 #
@@ -271,7 +265,6 @@ define COMMON_JAVADOCFLAGS
     $(call OptionOnly,-quiet) ; \
     $(call OptionOnly,-use) ; \
     $(call OptionOnly,-keywords) ; \
-    $(call OptionPair,-Xprofilespath,$(JDK_TOPDIR)/make/profile-rtjar-includes.txt) ; \
     $(call OptionOnly,$(ADDITIONAL_JAVADOCFLAGS))
 endef
 
@@ -668,7 +661,7 @@ ALL_OTHER_TARGETS += jdwpdocs
 JDWP_DOCDIR = $(PLATFORM_DOCSDIR)/jpda/jdwp
 
 jdwpdocs: $(JDWP_DOCDIR)/jdwp-protocol.html
-$(JDWP_DOCDIR)/jdwp-protocol.html : $(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html
+$(JDWP_DOCDIR)/jdwp-protocol.html : $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(CP) $< $@
diff --git a/make/JrtfsJar.gmk b/make/JrtfsJar.gmk
new file mode 100644
index 00000000000..2adf6c9dca5
--- /dev/null
+++ b/make/JrtfsJar.gmk
@@ -0,0 +1,37 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+
+$(eval $(call SetupArchive,JRTFS_JAR, , \
+    SRCS := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes, \
+    JAR := $(SUPPORT_OUTPUTDIR)/jrt-fs.jar, \
+    MANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf))
+
+all: $(JRTFS_JAR)
diff --git a/make/MacBundles.gmk b/make/MacBundles.gmk
new file mode 100644
index 00000000000..8b1dddc34bf
--- /dev/null
+++ b/make/MacBundles.gmk
@@ -0,0 +1,137 @@
+#
+# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include $(SPEC)
+include MakeBase.gmk
+
+default: bundles
+
+# Only macosx has bundles defined.
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+
+  bundles: jre-bundle jdk-bundle
+
+  # JDK_BUNDLE_DIR and JRE_BUNDLE_DIR are defined in SPEC.
+
+  MACOSX_PLIST_SRC := $(JDK_TOPDIR)/make/data/bundle
+
+  # All these OPENJDK checks are needed since there is no coherency between
+  # these values in open and closed. Should probably be fixed.
+  ifndef OPENJDK
+    BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(JDK_MINOR_VERSION)u$(JDK_UPDATE_VERSION)
+  else
+    BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE)
+  endif
+  BUNDLE_ID_JRE := $(BUNDLE_ID).jre
+  BUNDLE_ID_JDK := $(BUNDLE_ID).jdk
+
+  BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_MINOR_VERSION)
+  BUNDLE_NAME_JRE := $(BUNDLE_NAME)
+  BUNDLE_NAME_JDK := $(BUNDLE_NAME)
+
+  ifndef OPENJDK
+    BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_VERSION)
+  else
+    BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) ($(JDK_VERSION))
+  endif
+  BUNDLE_INFO_JRE := $(BUNDLE_INFO)
+  BUNDLE_INFO_JDK := $(BUNDLE_INFO)
+
+  BUNDLE_PLATFORM_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION)
+  BUNDLE_VERSION := $(JDK_VERSION)
+  ifeq ($(COMPANY_NAME), N/A)
+    BUNDLE_VENDOR := UNDEFINED
+  else
+    BUNDLE_VENDOR := $(COMPANY_NAME)
+  endif
+
+
+  JDK_FILE_LIST := $(shell $(FIND) $(JDK_IMAGE_DIR))
+  JRE_FILE_LIST := $(shell $(FIND) $(JRE_IMAGE_DIR))
+
+  JDK_TARGET_LIST := $(subst $(JDK_IMAGE_DIR)/,$(JDK_BUNDLE_DIR)/Home/,$(JDK_FILE_LIST))
+  JRE_TARGET_LIST := $(subst $(JRE_IMAGE_DIR)/,$(JRE_BUNDLE_DIR)/Home/,$(JRE_FILE_LIST))
+
+  # Copy empty directories (jre/lib/applet).
+  $(JDK_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
+
+  $(JRE_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
+	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
+
+  $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib:
+	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(LN) -s ../Home/lib/jli/libjli.dylib $@
+
+  $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib:
+	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	$(LN) -s ../Home/lib/jli/libjli.dylib $@
+
+  $(JDK_BUNDLE_DIR)/Info.plist: $(SPEC)
+	$(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	$(SED) -e "s/@@ID@@/$(BUNDLE_ID_JDK)/g" \
+	    -e "s/@@NAME@@/$(BUNDLE_NAME_JDK)/g" \
+	    -e "s/@@INFO@@/$(BUNDLE_INFO_JDK)/g" \
+	    -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
+	    -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
+	    -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
+	    < $(MACOSX_PLIST_SRC)/JDK-Info.plist > $@
+
+  $(JRE_BUNDLE_DIR)/Info.plist: $(SPEC)
+	$(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
+	$(MKDIR) -p $(@D)
+	$(SED) -e "s/@@ID@@/$(BUNDLE_ID_JRE)/g" \
+	    -e "s/@@NAME@@/$(BUNDLE_NAME_JRE)/g" \
+	    -e "s/@@INFO@@/$(BUNDLE_INFO_JRE)/g" \
+	    -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
+	    -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
+	    -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
+	    < $(MACOSX_PLIST_SRC)/JRE-Info.plist > $@
+
+  jdk-bundle: $(JDK_TARGET_LIST) $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib \
+      $(JDK_BUNDLE_DIR)/Info.plist
+	$(SETFILE) -a B $(dir $(JDK_BUNDLE_DIR))
+
+  jre-bundle: $(JRE_TARGET_LIST) $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib \
+      $(JRE_BUNDLE_DIR)/Info.plist
+	$(SETFILE) -a B $(dir $(JRE_BUNDLE_DIR))
+
+else # Not macosx
+
+  bundles:
+	$(ECHO) "No bundles defined for $(OPENJDK_TARGET_OS)"
+
+endif # macosx
+
+.PHONY: jdk-bundle jre-bundle bundles
diff --git a/make/Main.gmk b/make/Main.gmk
index 96e322ef96d..441cca28171 100644
--- a/make/Main.gmk
+++ b/make/Main.gmk
@@ -39,9 +39,6 @@ include $(SRC_ROOT)/make/MakeHelpers.gmk
 include $(SRC_ROOT)/make/common/MakeBase.gmk
 include $(SRC_ROOT)/make/common/Modules.gmk
 
-# Load common profile names definitions
-include $(JDK_TOPDIR)/make/ProfileNames.gmk
-
 # Declare ALL_TARGETS as an immediate variable. This variable is a list of all
 # valid top level targets. It's used to declare them all as PHONY and to 
 # generate the -only targets.
@@ -64,19 +61,23 @@ ALL_MODULES := $(call FindAllModules) jdk.hotspot.agent
 ################################################################################
 # Interim/build tools targets, compiling tools used during the build
 
+buildtools-langtools:
+	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk)
+
 interim-langtools:
 	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
 
 interim-corba:
-	+($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileCorba.gmk)
+	+($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterim.gmk)
 
 interim-rmic:
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CompileInterimRmic.gmk)
 
-build-tools-jdk:
+buildtools-jdk:
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Tools.gmk java-tools)
 
-ALL_TARGETS += interim-langtools interim-corba build-tools-jdk
+ALL_TARGETS += buildtools-langtools interim-langtools interim-corba \
+    interim-rmic buildtools-jdk
 
 ################################################################################
 # Special targets for certain modules
@@ -87,56 +88,42 @@ import-hotspot:
 unpack-sec:
 	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f UnpackSecurity.gmk)
 
-policy-jars:
-	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreatePolicyJars.gmk)
-
-ALL_TARGETS += import-hotspot unpack-sec policy-jars
+ALL_TARGETS += import-hotspot unpack-sec
 
 ################################################################################
 # Gensrc targets, generating source before java compilation can be done
-JDK_GENSRC_MODULES := $(call FindModulesWithMakefileFor, gensrc, Gensrc)
-LANGTOOLS_GENSRC_MODULES := jdk.compiler.tools
-CORBA_GENSRC_MODULES := java.corba
-GENSRC_MODULES := $(JDK_GENSRC_MODULES) $(LANGTOOLS_GENSRC_MODULES) \
-    $(CORBA_GENSRC_MODULES)
-JDK_GENSRC_TARGETS := $(addsuffix -gensrc, $(JDK_GENSRC_MODULES))
-LANGTOOLS_GENSRC_TARGETS := $(addsuffix -gensrc, $(LANGTOOLS_GENSRC_MODULES))
-CORBA_GENSRC_TARGETS := $(addsuffix -gensrc, $(CORBA_GENSRC_MODULES))
-GENSRC_TARGETS := $(addsuffix -gensrc, $(GENSRC_MODULES))
+$(eval $(call DeclareRecipesForPhase, GENSRC, \
+    TARGET_SUFFIX := gensrc, \
+    FILE_PREFIX := Gensrc, \
+    MAKE_SUBDIR := gensrc, \
+    CHECK_MODULES := $(ALL_MODULES), \
+    MULTIPLE_MAKEFILES := true))
 
-jdk.compiler.tools-gensrc:
-	+($(CD) $(LANGTOOLS_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GensrcLangtools.gmk)
-
-java.corba-gensrc:
-	+($(CD) $(CORBA_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f GensrcCorba.gmk)
-
-# Declare recipes for all jdk <module>-gensrc targets
-$(foreach m, $(JDK_GENSRC_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
-    $m, gensrc, gensrc, Gensrc)))
+JDK_GENSRC_TARGETS := $(filter %-gensrc-jdk, $(GENSRC_TARGETS))
+LANGTOOLS_GENSRC_TARGETS := $(filter %-gensrc-langtools, $(GENSRC_TARGETS))
+CORBA_GENSRC_TARGETS := $(filter %-gensrc-corba, $(GENSRC_TARGETS))
 
 ALL_TARGETS += $(GENSRC_TARGETS)
 
 ################################################################################
 # Generate data targets
-GENDATA_MODULES := $(call FindModulesWithMakefileFor, gendata, Gendata)
-GENDATA_TARGETS := $(addsuffix -gendata, $(GENDATA_MODULES))
-
-# Declare recipes for all <module>-gendata targets
-$(foreach m, $(GENDATA_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
-    $m, gendata, gendata, Gendata)))
-
-$(foreach m, $(GENDATA_MODULES), $(eval $(call DeclareGendataRecipe,$m)))
+$(eval $(call DeclareRecipesForPhase, GENDATA, \
+    TARGET_SUFFIX := gendata, \
+    FILE_PREFIX := Gendata, \
+    MAKE_SUBDIR := gendata, \
+    CHECK_MODULES := $(ALL_MODULES), \
+    USE_WRAPPER := true))
 
 ALL_TARGETS += $(GENDATA_TARGETS)
 
 ################################################################################
 # Copy files targets
-COPY_MODULES := $(call FindModulesWithMakefileFor, copy, Copy)
-COPY_TARGETS := $(addsuffix -copy, $(COPY_MODULES))
-
-# Declare recipes for all <module>-copy targets
-$(foreach m, $(COPY_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
-    $m, copy, copy, Copy)))
+$(eval $(call DeclareRecipesForPhase, COPY, \
+    TARGET_SUFFIX := copy, \
+    FILE_PREFIX := Copy, \
+    MAKE_SUBDIR := copy, \
+    CHECK_MODULES := $(ALL_MODULES), \
+    USE_WRAPPER := true))
 
 ALL_TARGETS += $(COPY_TARGETS)
 
@@ -163,36 +150,33 @@ ALL_TARGETS += $(JAVA_TARGETS)
 
 ################################################################################
 # Targets for running rmic.
-RMIC_MODULES := $(call FindModulesWithMakefileFor, rmic, Rmic)
-RMIC_TARGETS := $(addsuffix -rmic, $(RMIC_MODULES))
-
-# Declare recipes for all <module>-rmic targets
-$(foreach m, $(RMIC_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
-    $m, rmic, rmic, Rmic)))
+$(eval $(call DeclareRecipesForPhase, RMIC, \
+    TARGET_SUFFIX := rmic, \
+    FILE_PREFIX := Rmic, \
+    MAKE_SUBDIR := rmic, \
+    CHECK_MODULES := $(ALL_MODULES)))
 
 ALL_TARGETS += $(RMIC_TARGETS)
 
 ################################################################################
 # Targets for compiling native libraries
-ALL_LIB_MODULES := $(call FindModulesWithMakefileFor, lib, Lib)
-LIB_MODULES := $(filter $(ALL_MODULES), $(ALL_LIB_MODULES))
-LIB_TARGETS := $(addsuffix -libs, $(LIB_MODULES))
+$(eval $(call DeclareRecipesForPhase, LIBS, \
+    TARGET_SUFFIX := libs, \
+    FILE_PREFIX := Lib, \
+    MAKE_SUBDIR := lib, \
+    CHECK_MODULES := $(ALL_MODULES), \
+    USE_WRAPPER := true))
 
-# Declare recipes for all <module>-libs targets
-$(foreach m, $(LIB_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
-    $m, libs, lib, Lib)))
-
-ALL_TARGETS += $(LIB_TARGETS)
+ALL_TARGETS += $(LIBS_TARGETS)
 
 ################################################################################
 # Targets for compiling native executables
-ALL_LAUNCHER_MODULES := $(call FindModulesWithMakefileFor, launcher, Launcher)
-LAUNCHER_MODULES := $(filter $(ALL_MODULES), $(ALL_LAUNCHER_MODULES))
-LAUNCHER_TARGETS := $(addsuffix -launchers, $(LAUNCHER_MODULES))
-
-# Declare recipes for all <module>-launchers targets
-$(foreach m, $(LAUNCHER_MODULES), $(eval $(call DeclareRecipeForModuleMakefile, \
-    $m, launchers, launcher, Launcher)))
+$(eval $(call DeclareRecipesForPhase, LAUNCHER, \
+    TARGET_SUFFIX := launchers, \
+    FILE_PREFIX := Launcher, \
+    MAKE_SUBDIR := launcher, \
+    CHECK_MODULES := $(ALL_MODULES), \
+    USE_WRAPPER := true))
 
 ALL_TARGETS += $(LAUNCHER_TARGETS)
 
@@ -222,53 +206,40 @@ ALL_TARGETS += demos samples
 
 # Stores the tips for each repository. This file is be used when constructing the jdk image and can be
 # used to track the exact sources used to build that image.
-source-tips: $(OUTPUT_ROOT)/source_tips
-$(OUTPUT_ROOT)/source_tips: FRC
+source-tips: $(SUPPORT_OUTPUTDIR)/source_tips
+$(SUPPORT_OUTPUTDIR)/source_tips: FRC
 	@$(MKDIR) -p $(@D)
 	@$(RM) $@
 	@$(call GetSourceTips)
 
-security-jars:
-	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f CreateSecurityJars.gmk)
-
-nashorn-jar:
-	+($(CD) $(NASHORN_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f BuildNashorn.gmk all)
-
-# Creates the jar files (rt.jar resources.jar etc)
-main-jars:
-	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE="" -f CreateJars.gmk)
-
-# Creates the images (j2sdk-image j2re-image etc)
-images:
-	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE="" -f Images.gmk)
-        ifeq ($(OPENJDK_TARGET_OS), macosx)
-	  +($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) -f Bundles.gmk)
-        endif
-
-# Create Compact Profile jars
-PROFILE_JARS_TARGETS := $(addsuffix -jars, $(ALL_PROFILES))
-$(PROFILE_JARS_TARGETS):
-	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE=$(@:%-jars=%) -f CreateJars.gmk)
-
-# Create Compact Profile images
-PROFILE_IMAGES_TARGETS := $(addsuffix -images, $(ALL_PROFILES))
-$(PROFILE_IMAGES_TARGETS):
-	+($(CD) $(JDK_TOPDIR)/make && $(MAKE) $(MAKE_ARGS) PROFILE=$(@:%-images=%) \
-	    JRE_IMAGE_DIR=$(IMAGES_OUTPUTDIR)/j2re-$(word $(call profile_number,$(@:%-images=%)),$(PROFILE_NAMES))-image \
-	    -f Images.gmk profile-image)
-
-profiles-oscheck:
-        ifneq ($(OPENJDK_TARGET_OS), linux)
-	  @echo "Error: The Java SE 8 Compact Profiles are only implemented for Linux at this time" && exit 1
-        endif
-
+BOOTCYCLE_TARGET := images
 bootcycle-images:
 	@$(ECHO) Boot cycle build step 2: Building a new JDK image using previously built image
-	+$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk images
+	+$(MAKE) $(MAKE_ARGS) -f Main.gmk SPEC=$(dir $(SPEC))bootcycle-spec.gmk $(BOOTCYCLE_TARGET)
 
-ALL_TARGETS += source-tips security-jars nashorn-jar main-jars images \
-    $(PROFILE_JARS_TARGETS) $(PROFILE_IMAGES_TARGETS) profiles-oscheck \
-    bootcycle-images
+zip-security:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSecurity.gmk)
+
+zip-source:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f ZipSource.gmk)
+
+strip-binaries:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f StripBinaries.gmk)
+
+jrtfs-jar:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f JrtfsJar.gmk)
+
+jimages:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk jimages)
+
+profiles:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f Images.gmk profiles)
+
+mac-bundles:
+	+($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) -f MacBundles.gmk)
+
+ALL_TARGETS += source-tips bootcycle-images zip-security zip-source strip-binaries \
+    jrtfs-jar jimages profiles mac-bundles
 
 ################################################################################
 # Docs targets
@@ -331,17 +302,19 @@ ALL_TARGETS += install
 ifneq ($(findstring -only, $(MAKECMDGOALS)), )
   .NOTPARALLEL:
 else
+  $(LANGTOOLS_GENSRC_TARGETS): buildtools-langtools
+
   interim-langtools: $(LANGTOOLS_GENSRC_TARGETS)
 
-  build-tools-jdk: interim-langtools
+  buildtools-jdk: interim-langtools
 
   $(CORBA_GENSRC_TARGETS): interim-langtools
 
-  $(JDK_GENSRC_TARGETS): interim-langtools build-tools-jdk
+  $(JDK_GENSRC_TARGETS): interim-langtools buildtools-jdk
 
   interim-corba: $(CORBA_GENSRC_TARGETS)
 
-  $(GENDATA_TARGETS): interim-langtools build-tools-jdk
+  $(GENDATA_TARGETS): interim-langtools buildtools-jdk
 
   interim-rmic: interim-langtools
 
@@ -349,7 +322,7 @@ else
 
   import-hotspot: hotspot
 
-  $(LIB_TARGETS): import-hotspot
+  $(LIBS_TARGETS): import-hotspot
 
   $(LAUNCHER_TARGETS): java.base-libs
 
@@ -371,55 +344,53 @@ else
 
   # Declare dependencies from <module>-lib to <module>-java
   # Skip jdk.jdwp.agent as it contains no java code.
-  $(foreach m, $(filter-out jdk.jdwp.agent, $(LIB_MODULES)), $(eval $m-libs: $m-java))
+  $(foreach m, $(filter-out jdk.jdwp.agent, $(LIBS_MODULES)), $(eval $m-libs: $m-java))
 
   # Declare dependencies from all other <module>-lib to java.base-lib
-  $(foreach t, $(filter-out java.base-libs, $(LIB_TARGETS)), \
+  $(foreach t, $(filter-out java.base-libs, $(LIBS_TARGETS)), \
       $(eval $t: java.base-libs))
   # Declare the special case dependency for jdk.deploy.osx where libosx 
   # links against libosxapp.
   jdk.deploy.osx-libs: java.desktop-libs
 
-  # This dependency needs to be explicitly declared. jdk.jdi-gensrc generates a 
-  # header file used by jdk.jdwp libs.
-  jdk.jdwp.agent-libs: jdk.jdi-gensrc
+  # This dependency needs to be explicitly declared as jdk.jdi-gensrc generates a 
+  # header file used by jdk.jdwp.agent-libs. The jdk.jdwp.agent-gensrc is a
+  # virtual target.
+  jdk.jdwp.agent-libs: jdk.jdwp.agent-gensrc
+
+  # Until the module system is in place, jdk.jdi-gensrc needs to combine service
+  # loader configuration with jdk.hotspot.agent so is dependent on importing
+  # hotspot.
+  jdk.jdi-gensrc-jdk: import-hotspot
 
   # The swing beans need to have java base properly generated to avoid errors
   # in javadoc.
-  java.desktop-gensrc: java.base-gensrc
+  java.desktop-gensrc-jdk: java.base-gensrc
 
   # Explicitly add dependencies for special targets
   java.base-java: unpack-sec
 
   jdk.dev-gendata: java rmic
 
-  security-jars: java
+  zip-security: java.base-java java.security.jgss-java java.security.jgss-libs \
+      $(filter jdk.crypto%, $(JAVA_TARGETS))
 
-  nashorn-jar: jdk.scripting.nashorn-java
+  zip-source: gensrc rmic
 
-  main-jars: java rmic security-jars nashorn-jar policy-jars import-hotspot gendata
+  strip-binaries: libs launchers gendata copy
 
-  # On windows, the jars target needs to wait for jgss libs to be built.
-  # Should ideally split out the sec-bin zip file generation to avoid
-  # this dependency.
-  ifeq ($(OPENJDK_TARGET_OS), windows)
-    main-jars: java.security.jgss-libs
-  endif
+  jrtfs-jar: buildtools-jdk
 
-  images: jars demos samples exploded-image verify-modules source-tips
+  jimages: exploded-image zip-source strip-binaries source-tips demos samples \
+      jrtfs-jar
 
-  bootcycle-images: images
+  profiles: exploded-image strip-binaries source-tips
 
-  # Need to depend on jars as otherwise there will a race between all the
-  # invocations of CreateJars.gmk.
-  $(PROFILE_JARS_TARGETS): jars profiles-oscheck
+  mac-bundles: jimages
 
-  $(PROFILE_IMAGES_TARGETS): demos samples exploded-image source-tips
+  bootcycle-images: jimages
 
-  # Declare dependencies from <profile>-images to <profile>-jars
-  $(foreach p, $(ALL_PROFILES), $(eval $p-images: $p-jars))
-
-  docs-javadoc: $(GENSRC_TARGETS) rmic
+  docs-javadoc: gensrc rmic
 
   docs-jvmtidoc: hotspot
 
@@ -432,6 +403,9 @@ endif
 ################################################################################
 # Virtual targets without recipes
 
+buildtools: buildtools-langtools interim-langtools interim-corba interim-rmic \
+    buildtools-jdk
+
 gensrc: $(GENSRC_TARGETS)
 
 gendata: $(GENDATA_TARGETS)
@@ -442,12 +416,13 @@ java: $(JAVA_TARGETS)
 
 rmic: $(RMIC_TARGETS)
 
-libs: $(LIB_TARGETS)
+libs: $(LIBS_TARGETS)
 
 launchers: $(LAUNCHER_TARGETS)
 
-# Explicitly add dependencies for these special targets
-java.base: import-hotspot policy-jars
+# Explicitly declare dependency for virtual target jdk.jdwp.agent-gensrc which
+# is actually handled by jdk.jdi-gensrc
+jdk.jdwp.agent-gensrc: jdk.jdi-gensrc
 
 # Declare dependencies from <module> to all the individual targets specific
 # to that module <module>-*.
@@ -455,34 +430,33 @@ $(foreach m, $(GENSRC_MODULES), $(eval $m: $m-gensrc))
 $(foreach m, $(JAVA_MODULES), $(eval $m: $m-java))
 $(foreach m, $(GENDATA_MODULES), $(eval $m: $m-gendata))
 $(foreach m, $(RMIC_MODULES), $(eval $m: $m-rmic))
-$(foreach m, $(LIB_MODULES), $(eval $m: $m-libs))
+$(foreach m, $(LIBS_MODULES), $(eval $m: $m-libs))
 $(foreach m, $(LAUNCHER_MODULES), $(eval $m: $m-launchers))
 $(foreach m, $(COPY_MODULES), $(eval $m: $m-copy))
 
 ALL_MODULE_TARGETS := $(sort $(GENSRC_MODULES) $(JAVA_MODULES) \
-    $(GENDATA_MODULES) $(LIB_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
+    $(GENDATA_MODULES) $(LIBS_MODULES) $(LAUNCHER_MODULES) $(COPY_MODULES))
 
 exploded-image: $(ALL_MODULE_TARGETS)
 # The old 'jdk' target most closely matches the new exploded-image. Keep an
 # alias for ease of use.
 jdk: exploded-image
 
-jars: main-jars nashorn-jar security-jars policy-jars
+images: jimages demos samples zip-security
 
-# Make each profile name a target that depends on it's images target.
-$(foreach p, $(ALL_PROFILES), $(eval $(p): $(p)-images $(p)-jars))
-
-profiles: $(ALL_PROFILES)
+ifeq ($(OPENJDK_TARGET_OS), macosx)
+  images: mac-bundles
+endif
 
 docs: docs-javadoc docs-jvmtidoc
 
-ALL_TARGETS += gensrc gendata copy java rmic libs launchers \
-    $(ALL_MODULE_TARGETS) exploded-image jdk jars \
-    $(ALL_PROFILES) profiles docs
+ALL_TARGETS += buildtools gensrc gendata copy java rmic libs launchers \
+    jdk.jdwp.agent-gensrc $(ALL_MODULE_TARGETS) exploded-image jdk images \
+    docs
 
 ################################################################################
 
-all: images docs
+all: images
 default: exploded-image
 
 ALL_TARGETS += default all
@@ -496,17 +470,38 @@ ALL_TARGETS += default all
 # Clean targets are automatically run serially by the Makefile calling this 
 # file.
 
-CLEAN_COMPONENTS += langtools corba hotspot jdk nashorn images \
-    bootcycle-build docs docstemp test make-support
-CLEAN_TARGETS := $(addprefix clean-, $(CLEAN_COMPONENTS))
+CLEAN_DIRS += hotspot jdk bootcycle-build test buildtools support \
+    images make-support
+CLEAN_DIR_TARGETS := $(addprefix clean-, $(CLEAN_DIRS))
+CLEAN_PHASES := gensrc java native include
+CLEAN_PHASE_TARGETS := $(addprefix clean-, $(CLEAN_PHASES))
+CLEAN_MODULE_TARGETS := $(addprefix clean-, $(ALL_MODULES))
+# Construct targets of the form clean-$module-$phase
+CLEAN_MODULE_PHASE_TARGETS := $(addprefix clean-, $(foreach m, $(ALL_MODULES), \
+    $(addprefix $m-, $(CLEAN_PHASES))))
 
 # Remove everything, except the output from configure.
-clean: $(CLEAN_TARGETS)
-	($(CD) $(OUTPUT_ROOT) && $(RM) -r tmp source_tips build.log* build-trace*.log*)
+clean: $(CLEAN_DIR_TARGETS)
+	($(CD) $(OUTPUT_ROOT) && $(RM) -r source_tips build.log* build-trace*.log*)
 	$(ECHO) Cleaned all build artifacts.
 
-$(CLEAN_TARGETS):
-	$(call CleanComponent,$(patsubst clean-%, %, $@))
+$(CLEAN_DIR_TARGETS):
+	$(call CleanDir,$(patsubst clean-%, %, $@))
+
+$(CLEAN_PHASE_TARGETS):
+	$(call Clean-$(patsubst clean-%,%, $@))
+
+$(CLEAN_MODULE_TARGETS):
+	$(call CleanModule,$(patsubst clean-%, %, $@))
+
+$(CLEAN_MODULE_PHASE_TARGETS):
+	$(call Clean-$(word 3, $(subst -,$(SPACE),$@)), \
+	    $(word 2, $(subst -,$(SPACE),$@)))
+
+# When removing the support dir, we must also remove jdk. Building classes has
+# the side effect of generating native headers. The headers end up in support
+# while classes and touch files end up in jdk.
+clean-support: clean-jdk
 
 clean-docs: clean-docstemp
 
@@ -525,7 +520,8 @@ dist-clean: clean
 	)
 	$(ECHO) Cleaned everything, you will have to re-run configure.
 
-ALL_TARGETS += clean dist-clean $(CLEAN_TARGETS)
+ALL_TARGETS += clean dist-clean $(CLEAN_DIR_TARGETS) $(CLEAN_PHASE_TARGETS) \
+    $(CLEAN_MODULE_TARGETS) $(CLEAN_MODULE_PHASE_TARGETS)
 
 ################################################################################
 
@@ -557,7 +553,7 @@ ALL_TARGETS += reconfigure
 # Declare *-only targets for each normal target
 $(foreach t, $(ALL_TARGETS), $(eval $(t)-only: $(t)))
 
-ALL_TARGETS += $(addsuffix -only, $(ALL_TARGETS))
+ALL_TARGETS += $(addsuffix -only, $(filter-out clean%, $(ALL_TARGETS)))
 
 ################################################################################
 
diff --git a/make/MakeHelpers.gmk b/make/MakeHelpers.gmk
index 62b9add30cd..d9146e200d9 100644
--- a/make/MakeHelpers.gmk
+++ b/make/MakeHelpers.gmk
@@ -46,7 +46,7 @@ list_alt_overrides_with_origins=$(filter ALT_%=environment ALT_%=command,$(forea
 list_alt_overrides=$(subst =command,,$(subst =environment,,$(list_alt_overrides_with_origins)))
 
 # Store the build times in this directory.
-BUILDTIMESDIR=$(OUTPUT_ROOT)/tmp/buildtimes
+BUILDTIMESDIR=$(OUTPUT_ROOT)/make-support/build-times
 
 # Global targets are possible to run either with or without a SPEC. The prototypical
 # global target is "help".
@@ -296,38 +296,139 @@ endef
 
 ### Convenience functions from Main.gmk
 
-# Cleans the component given as $1
-define CleanComponent
+# Cleans the dir given as $1
+define CleanDir
 	@$(PRINTF) "Cleaning $(strip $1) build artifacts ..."
 	@($(CD) $(OUTPUT_ROOT) && $(RM) -r $1)
 	@$(PRINTF) " done\n"
 endef
 
+define Clean-gensrc
+	@$(PRINTF) "Cleaning gensrc $(if $1,for $(strip $1) )..."
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc/$(strip $1)
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/$(strip $1)
+	@$(PRINTF) " done\n"
+endef
+
+define Clean-java
+	@$(PRINTF) "Cleaning java $(if $1,for $(strip $1) )..."
+	@$(RM) -r $(JDK_OUTPUTDIR)/modules/$(strip $1)
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/misc/$(strip $1)
+	@$(PRINTF) " done\n"
+	@$(PRINTF) "Cleaning headers $(if $1,for $(strip $1)) ..."
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/headers/$(strip $1)
+	@$(PRINTF) " done\n"
+endef
+
+define Clean-native
+	@$(PRINTF) "Cleaning native $(if $1,for $(strip $1) )..."
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/native/$(strip $1)
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_libs-stripped/$(strip $1)
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds/$(strip $1)
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped/$(strip $1)
+	@$(PRINTF) " done\n"
+endef
+
+define Clean-include
+	@$(PRINTF) "Cleaning include $(if $1,for $(strip $1) )..."
+	@$(RM) -r $(SUPPORT_OUTPUTDIR)/modules_include/$(strip $1)
+	@$(PRINTF) " done\n"
+endef
+
+define CleanModule
+  $(call Clean-gensrc, $1)
+  $(call Clean-java, $1)
+  $(call Clean-native, $1)
+  $(call Clean-include, $1)
+endef
+
+
 ################################################################################
 
-MAKE_DIR_LIST := $(JDK_TOPDIR)/make
+MAKE_TOPDIR_LIST := $(JDK_TOPDIR) $(CORBA_TOPDIR) $(LANGTOOLS_TOPDIR)
+MAKE_MAKEDIR_LIST := make
 
-# Find all modules that has a makefile for a certain build phase
-# Param 1: Make subdir to look in
-# Param 2: File prefix to look for
-FindModulesWithMakefileFor = $(sort $(foreach d, $(MAKE_DIR_LIST), \
-    $(patsubst $d/$(strip $1)/$(strip $2)-%.gmk,%, \
-    $(wildcard $d/$(strip $1)/$(strip $2)-*.gmk))))
-
-# Declare a recipe for calling such a makefile
-# Param 1: Module name
-# Param 2: Suffix for rule
-# Param 3: Make subdir
-# Param 4: Makefile prefix
+# Helper macro for DeclareRecipesForPhase
+# Declare a recipe for calling the module and phase specific makefile.
+# If there are multiple makefiles to call, create a rule for each topdir
+# that contains a makefile with the target $module-$suffix-$repodir, 
+# (i.e: java.base-gensrc-jdk)
+# Normally there is only one makefile, and the target will just be
+# $module-$suffix
+# Param 1: Name of list to add targets to
+# Param 2: Module name
+# Param 3: Topdir
 define DeclareRecipeForModuleMakefile
-  $$(strip $1)-$$(strip $2):
-	+($(CD) $$(dir $$(firstword $$(wildcard $$(addsuffix /$$(strip $3)/$$(strip $4)-$$(strip $1).gmk, \
-	        $(MAKE_DIR_LIST))))) \
+  ifeq ($$($1_MULTIPLE_MAKEFILES), true)
+    $2-$$($1_TARGET_SUFFIX): $2-$$($1_TARGET_SUFFIX)-$$(notdir $3)
+    $1 += $2-$$($1_TARGET_SUFFIX)-$$(notdir $3)
+
+    $2-$$($1_TARGET_SUFFIX)-$$(notdir $3):
+  else
+    $2-$$($1_TARGET_SUFFIX):
+  endif
+	$(ECHO) $(LOG_INFO) "Building $$@"
+        ifeq ($$($1_USE_WRAPPER), true)
+	  +($(CD) $(SRC_ROOT)/make && $(MAKE) $(MAKE_ARGS) \
+	      -f ModuleWrapper.gmk \
+	          $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
+	          $$(addsuffix /$$($1_MAKE_SUBDIR), $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
+	          MODULE=$2 MAKEFILE_PREFIX=$$($1_FILE_PREFIX))
+        else
+	  +($(CD) $$(dir $$(firstword $$(wildcard $$(patsubst %, \
+	          $3/%/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, $(MAKE_MAKEDIR_LIST))))) \
 	    && $(MAKE) $(MAKE_ARGS) \
-	        -f $$(strip $4)-$$(strip $1).gmk \
-	        $$(addprefix -I, $$(wildcard $(MAKE_DIR_LIST) \
-	            $$(addsuffix /$$(strip $3), $(MAKE_DIR_LIST)))) \
-	        MODULE=$$(strip $1))
+	          -f $$($1_FILE_PREFIX)-$2.gmk \
+	          $$(addprefix -I, $$(wildcard $$(addprefix $3/, $(MAKE_MAKEDIR_LIST)) \
+	          $$(addsuffix /$3, $$(addprefix $3/, $(MAKE_MAKEDIR_LIST))))) \
+	          MODULE=$2)
+        endif
+
+endef
+
+# Helper macro for DeclareRecipesForPhase
+# Param 1: Name of list to add targets to
+# Param 2: Module name
+define DeclareRecipesForPhaseAndModule
+  $1_$2_TOPDIRS := $$(strip $$(sort $$(foreach d, $(MAKE_TOPDIR_LIST), \
+      $$(patsubst $$d/%, $$d, $$(filter $$d/%, \
+          $$(wildcard $$(patsubst %, %/$$($1_MAKE_SUBDIR)/$$($1_FILE_PREFIX)-$2.gmk, \
+          $$(foreach s, $(MAKE_MAKEDIR_LIST), \
+              $$(addsuffix /$$s, $(MAKE_TOPDIR_LIST))))))))))
+
+  # Only declare recipes if there are makefiles to call
+  ifneq ($$($1_$2_TOPDIRS), )
+    $$(foreach d, $$($1_$2_TOPDIRS), \
+        $$(eval $$(call DeclareRecipeForModuleMakefile,$1,$2,$$d)))
+    $1 += $2-$$($1_TARGET_SUFFIX)
+    $1_MODULES += $2
+  endif
+endef
+
+# Declare recipes for a specific module and build phase if there are makefiles
+# present for the specific combination.
+# Param 1: Name of list to add targets to
+# Named params:
+# TARGET_SUFFIX : Suffix of target to create for recipe
+# MAKE_SUBDIR : Subdir for this build phase
+# FILE_PREFIX : File prefix for this build phase
+# USE_WRAPPER : Set to true to use ModuleWrapper.gmk
+# CHECK_MODULES : List of modules to try
+# MULTIPLE_MAKEFILES : Set to true to handle makefils for the same module in
+#                      phase in multiple repos
+# Exported variables:
+# $1_MODULES : All modules that had rules generated
+# $1_TARGETS : All targets generated
+define DeclareRecipesForPhase
+  $(foreach i,2 3 4 5 6 7, $(if $($i),$(strip $1)_$(strip $($i)))$(NEWLINE))
+  $(if $(8),$(error Internal makefile error: Too many arguments to \
+      DeclareRecipesForPhase, please update MakeHelper.gmk))
+
+  $$(foreach m, $$($(strip $1)_CHECK_MODULES), \
+      $$(eval $$(call DeclareRecipesForPhaseAndModule,$(strip $1),$$m)))
+
+  $(strip $1)_TARGETS := $$($(strip $1))
 endef
 
 ################################################################################
diff --git a/make/ModuleWrapper.gmk b/make/ModuleWrapper.gmk
new file mode 100644
index 00000000000..40d2c837b97
--- /dev/null
+++ b/make/ModuleWrapper.gmk
@@ -0,0 +1,88 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# This makefile is called from Main.gmk, through a macro in MakeHelpers.gmk
+# and wraps calls to makefiles for specific modules and build phases. Having
+# this wrapper reduces the need for boilerplate code. It also provides 
+# opportunity for automatic copying of files to an interim exploded runnable
+# image.
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+# All makefiles should add the targets to be built to this variable.
+TARGETS :=
+
+# Include the file being wrapped.
+include $(MAKEFILE_PREFIX)-$(MODULE).gmk
+
+# Setup copy rules from the modules directories to the jdk image directory.
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  TO_BIN_FILTER := %$(SHARED_LIBRARY_SUFFIX) %.diz %.pdb %.map
+
+  $(eval $(call SetupCopyFiles,COPY_LIBS_TO_BIN, \
+      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
+      DEST := $(JDK_OUTPUTDIR)/bin, \
+      FILES := $(filter $(TO_BIN_FILTER), \
+          $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
+          $(TARGETS)))))
+
+  $(eval $(call SetupCopyFiles,COPY_LIBS_TO_LIB, \
+      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
+      DEST := $(JDK_OUTPUTDIR)/lib, \
+      FILES := $(filter-out $(TO_BIN_FILTER), \
+          $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
+          $(TARGETS)))))
+
+else
+  $(eval $(call SetupCopyFiles,COPY_LIBS_TO_LIB, \
+      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE), \
+      DEST := $(JDK_OUTPUTDIR)/lib, \
+      FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/%, \
+          $(TARGETS))))
+endif
+
+$(eval $(call SetupCopyFiles,COPY_INCLUDE, \
+    SRC := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE), \
+    DEST := $(JDK_OUTPUTDIR)/include, \
+    FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE)/%, \
+          $(TARGETS))))
+
+$(eval $(call SetupCopyFiles,COPY_CMDS, \
+    SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE), \
+    DEST := $(JDK_OUTPUTDIR)/bin, \
+    FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/%, $(TARGETS))))
+
+$(eval $(call SetupCopyFiles,COPY_CONF, \
+    SRC := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE), \
+    DEST := $(JDK_OUTPUTDIR)/conf, \
+    FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE)/%, \
+          $(TARGETS))))
+
+all: $(TARGETS) $(COPY_LIBS_TO_BIN) $(COPY_LIBS_TO_LIB) \
+    $(COPY_INCLUDE) $(COPY_CMDS) $(COPY_CONF)
diff --git a/make/StripBinaries.gmk b/make/StripBinaries.gmk
new file mode 100644
index 00000000000..92bb17159a2
--- /dev/null
+++ b/make/StripBinaries.gmk
@@ -0,0 +1,99 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+
+################################################################################
+# Copy native libraries and executables to a secondary location to strip them
+# and filter out files that shouldn't go into the image.
+
+MODULES_CMDS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_cmds-stripped
+MODULES_LIBS_STRIPPED := $(SUPPORT_OUTPUTDIR)/modules_libs-stripped
+
+ifneq ($(POST_STRIP_CMD), )
+  define StripRecipe
+	$(ECHO) Stripping $(LOG_INFO) $(patsubst $(OUTPUT_ROOT)/%,%,$<)
+	$(MKDIR) -p $(@D)
+	$(CP) $< $@.tmp
+	$(CHMOD) u+w $@.tmp
+	$(POST_STRIP_CMD) $@.tmp
+	$(if $(POST_MCS_CMD), $(POST_MCS_CMD) $@.tmp)
+	$(CHMOD) go-w $@.tmp
+	$(MV) $@.tmp $@
+  endef
+else
+  define StripRecipe
+    $(call install-file)
+  endef
+endif
+
+# Don't include debug info for executables.
+ALL_CMDS_SRC := $(filter-out %.debuginfo %.diz %.map %.pdb, \
+    $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_cmds -type f -o -type l))
+COPY_CMDS_SRC := $(filter %.cgi, $(ALL_CMDS_SRC))
+STRIP_CMDS_SRC := $(filter-out $(COPY_CMDS_SRC), $(ALL_CMDS_SRC))
+
+# Make sure symbolic links are copied and not stripped
+COPY_LIBS_SRC := \
+    $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs \
+        \( ! -name '*$(SHARED_LIBRARY_SUFFIX)' -type f \) -o -type l)
+STRIP_LIBS_SRC := \
+    $(shell $(FIND) $(SUPPORT_OUTPUTDIR)/modules_libs \
+        -name '*$(SHARED_LIBRARY_SUFFIX)' -type f)
+
+# On Windows, don't include debug info for libs either.
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  COPY_LIBS_SRC := $(filter-out %.diz %.map %.pdb, $(COPY_LIBS_SRC))
+endif
+
+$(eval $(call SetupCopyFiles,STRIP_MODULES_CMDS, \
+    SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
+    DEST := $(MODULES_CMDS_STRIPPED), \
+    FILES := $(STRIP_CMDS_SRC), \
+    MACRO := StripRecipe))
+
+$(eval $(call SetupCopyFiles,COPY_MODULES_CMDS, \
+    SRC := $(SUPPORT_OUTPUTDIR)/modules_cmds, \
+    DEST := $(MODULES_CMDS_STRIPPED), \
+    FILES := $(COPY_CMDS_SRC)))
+
+$(eval $(call SetupCopyFiles,STRIP_MODULES_LIBS, \
+    SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
+    DEST := $(MODULES_LIBS_STRIPPED), \
+    FILES := $(STRIP_LIBS_SRC), \
+    MACRO := StripRecipe))
+
+$(eval $(call SetupCopyFiles,COPY_MODULES_LIBS, \
+    SRC := $(SUPPORT_OUTPUTDIR)/modules_libs, \
+    DEST := $(MODULES_LIBS_STRIPPED), \
+    FILES := $(COPY_LIBS_SRC)))
+
+TARGETS += $(STRIP_MODULES_CMDS) $(COPY_MODULES_CMDS) \
+    $(STRIP_MODULES_LIBS) $(COPY_MODULES_LIBS)
+
+all: $(TARGETS)
diff --git a/make/ZipSecurity.gmk b/make/ZipSecurity.gmk
new file mode 100644
index 00000000000..c894a8a33bb
--- /dev/null
+++ b/make/ZipSecurity.gmk
@@ -0,0 +1,104 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+
+##########################################################################################
+#
+# sec-bin.zip is used by builds where the corresponding sources are not available
+#
+$(eval $(call SetupZipArchive,BUILD_SEC_BIN_ZIP, \
+    SRC := $(JDK_OUTPUTDIR), \
+    INCLUDES := \
+        modules/java.base/javax/crypto \
+        modules/java.base/javax/crypto/spec \
+        modules/java.base/sun/security/internal/interfaces \
+        modules/java.base/sun/security/internal/spec \
+        modules/java.base/com/sun/crypto/provider \
+        modules/jdk.crypto.ec/sun/security/ec \
+        modules/jdk.crypto.mscapi/sun/security/mscapi \
+        modules/jdk.crypto.pkcs11/sun/security/pkcs11 \
+        modules/jdk.crypto.pkcs11/sun/security/pkcs11/wrapper \
+        modules/jdk.crypto.ucrypto/com/oracle/security/ucrypto \
+        modules/java.base/javax/net \
+        modules/java.base/javax/security/cert \
+        modules/java.base/com/sun/net/ssl \
+        modules/java.base/com/sun/security/cert \
+        modules/java.base/sun/net/www/protocol/https \
+        modules/java.base/sun/security/pkcs12 \
+        modules/java.base/sun/security/ssl \
+        modules/java.security.jgss/sun/security/krb5 \
+        modules/java.security.jgss/sun/security/krb5/internal \
+        modules/java.security.jgss/sun/security/krb5/internal/ccache \
+        modules/java.security.jgss/sun/security/krb5/internal/crypto \
+        modules/java.security.jgss/sun/security/krb5/internal/ktab \
+        modules/java.security.jgss/sun/security/krb5/internal/rcache \
+        modules/java.security.jgss/sun/security/krb5/internal/util, \
+    INCLUDE_FILES := modules/java.security.jgss/sun/security/jgss/spi/GSSContextSpi.class, \
+    EXCLUDES := modules/java.security.jgss/sun/security/krb5/internal/tools, \
+    ZIP := $(IMAGES_OUTPUTDIR)/sec-bin.zip))
+
+TARGETS += $(IMAGES_OUTPUTDIR)/sec-bin.zip
+
+##########################################################################################
+#
+# Windows specific binary security packages.
+#
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  # sec-windows-bin.zip is used by builds where the corresponding sources are not available
+  $(eval $(call SetupZipArchive,BUILD_SEC_WINDOWS_BIN_ZIP, \
+      SRC := $(JDK_OUTPUTDIR), \
+      INCLUDES := modules/java.security.jgss/sun/security/krb5/internal/tools, \
+      ZIP := $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip))
+
+  TARGETS += $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip
+
+  # JGSS files contain the native Kerberos library
+  ifeq ($(OPENJDK_TARGET_CPU), x86_64)
+    JGSS_ZIP_NAME = jgss-windows-x64-bin.zip
+  else
+    JGSS_ZIP_NAME = jgss-windows-i586-bin.zip
+  endif
+
+  $(eval $(call SetupZipArchive,BUILD_JGSS_BIN_ZIP, \
+      SRC := $(SUPPORT_OUTPUTDIR), \
+      INCLUDE_FILES := modules_libs/java.security.jgss/w2k_lsa_auth.dll \
+          modules_libs/java.security.jgss/w2k_lsa_auth.diz \
+          modules_libs/java.security.jgss/w2k_lsa_auth.map \
+          modules_libs/java.security.jgss/w2k_lsa_auth.pdb, \
+      ZIP := $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)))
+
+  TARGETS += $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)
+endif
+
+##########################################################################################
+
+all: $(TARGETS)
+
+.PHONY: default all
diff --git a/make/ZipSource.gmk b/make/ZipSource.gmk
new file mode 100644
index 00000000000..52bf6aa5149
--- /dev/null
+++ b/make/ZipSource.gmk
@@ -0,0 +1,88 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+
+# Hook to include the corresponding custom file, if present.
+$(eval $(call IncludeCustomExtension, , ZipSource.gmk))
+
+################################################################################
+
+# Use ?= to enable override in custom makefile
+SRC_ZIP_INCLUDES ?= \
+    com \
+    java \
+    javax \
+    jdk \
+    org \
+    sun \
+    #
+
+SRC_ZIP_EXCLUDES ?=
+
+SRC_ZIP_SRCS += $(wildcard \
+    $(JDK_TOPDIR)/src/*/share/classes \
+    $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \
+    $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_API_DIR)/classes \
+    $(LANGTOOLS_TOPDIR)/src/*/share/classes \
+    $(CORBA_TOPDIR)/src/*/share/classes \
+    $(JAXP_TOPDIR)/src/*/share/classes \
+    $(JAXWS_TOPDIR)/src/*/share/classes \
+    $(SUPPORT_OUTPUTDIR)/gensrc/j* \
+    $(SUPPORT_OUTPUTDIR)/rmic/j* \
+    ) \
+    #
+
+# Need to copy launcher src files into desired directory structure
+# before zipping the sources.
+$(eval $(call SetupCopyFiles,COPY_LAUNCHER_SRC, \
+    SRC := $(JDK_TOPDIR)/src/java.base, \
+    DEST := $(SUPPORT_OUTPUTDIR)/src/launcher, \
+    FLATTEN := true, \
+    FILES := $(wildcard \
+        $(JDK_TOPDIR)/src/java.base/share/native/launcher/* \
+        $(JDK_TOPDIR)/src/java.base/share/native/libjli/* \
+        $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli/java_md*)))
+
+# This dir needs to exist before macro is evaluated to avoid warning from find.
+$(eval $(call MakeDir, $(SUPPORT_OUTPUTDIR)/src))
+$(eval $(call SetupZipArchive,BUILD_SRC_ZIP, \
+    SRC := $(SRC_ZIP_SRCS) $(SUPPORT_OUTPUTDIR)/src, \
+    INCLUDES := $(SRC_ZIP_INCLUDES) launcher, \
+    EXCLUDES := $(SRC_ZIP_EXCLUDES), \
+    EXCLUDE_FILES := $(SRC_ZIP_EXCLUDE_FILES), \
+    SUFFIXES := .java .c .h, \
+    ZIP := $(SUPPORT_OUTPUTDIR)/src.zip, \
+    EXTRA_DEPS := $(COPY_LAUNCHER_SRC)))
+
+################################################################################
+
+all: $(BUILD_SRC_ZIP)
+
+.PHONY: default all
diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk
index 5c3ea73ca7d..8a89c14a56b 100644
--- a/make/common/JavaCompilation.gmk
+++ b/make/common/JavaCompilation.gmk
@@ -325,10 +325,16 @@ define SetupZipArchive
     $1_ZIP_INCLUDES += $$(addprefix -i$(SPACE),$$($1_INCLUDE_FILES))
   endif
   ifneq ($$($1_EXCLUDES),)
-    $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
     $1_ZIP_EXCLUDES := $$(addprefix -x$(SPACE)$(DQUOTE),$$(addsuffix /*$(DQUOTE),$$($1_EXCLUDES)))
+    $1_SRC_EXCLUDES := $$(foreach i,$$($1_SRC),$$(addprefix $$i/,$$(addsuffix /%,$$($1_EXCLUDES))))
     $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDES),$$($1_ALL_SRCS))
   endif
+  ifneq ($$($1_EXCLUDE_FILES),)
+    # Cannot precompute ZIP_EXCLUDE_FILES as it is dependent on which src root is being
+    # zipped at the moment.
+    $1_SRC_EXCLUDE_FILES := $$(addprefix %, $$($1_EXCLUDE_FILES)) $$($1_EXCLUDE_FILES)
+    $1_ALL_SRCS := $$(filter-out $$($1_SRC_EXCLUDE_FILES), $$($1_ALL_SRCS))
+  endif
 
   # Use a slightly shorter name for logging, but with enough path to identify this zip.
   $1_NAME:=$$(subst $$(OUTPUT_ROOT)/,,$$($1_ZIP))
@@ -343,7 +349,10 @@ define SetupZipArchive
   $$($1_ZIP) : $$($1_ALL_SRCS) $$($1_EXTRA_DEPS)
 	$(MKDIR) -p $$(@D)
 	$(ECHO) Updating $$($1_NAME)
-	$$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) $$($1_ZIP_EXCLUDES) -x \*_the.\* $$(addprefix -x$(SPACE),$$(patsubst $$i/%,%,$$($1_EXCLUDE_FILES))) || test "$$$$?" = "12" )$$(NEWLINE)) true
+	$$(foreach i,$$($1_SRC),(cd $$i && $(ZIP) -qru $$@ . $$($1_ZIP_INCLUDES) \
+	    $$($1_ZIP_EXCLUDES) -x \*_the.\* \
+	    $$(addprefix -x$(SPACE), $$(patsubst $$i/%,%, $$($1_EXCLUDE_FILES))) \
+	    || test "$$$$?" = "12" )$$(NEWLINE)) true
 	$(TOUCH) $$@
 
   # Add zip to target list
diff --git a/make/common/Modules.gmk b/make/common/Modules.gmk
index 16bb629313e..f1d9a27ce6f 100644
--- a/make/common/Modules.gmk
+++ b/make/common/Modules.gmk
@@ -64,6 +64,7 @@ $(eval $(call SetupJavaCompilation,BUILD_GENMODULESLIST, \
     SETUP := BOOT_JAVAC, \
     SRC := $(JDK_TOPDIR)/make/src/classes, \
     INCLUDES := build/tools/module, \
+    EXCLUDE_FILES := ImageBuilder.java ModuleArchive.java, \
     BIN := $(MAKESUPPORT_OUTPUTDIR)/bt_classes_moduleslist, \
     DISABLE_SJAVAC := true))
 
diff --git a/make/common/NativeCompilation.gmk b/make/common/NativeCompilation.gmk
index fe82cd2730e..5a5bc99b38c 100644
--- a/make/common/NativeCompilation.gmk
+++ b/make/common/NativeCompilation.gmk
@@ -450,13 +450,11 @@ define SetupNativeCompilation
             $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
                 $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
 
-            # This dependency dance ensures that windows debug info files get rebuilt
-            # properly if deleted.
-            $$($1_TARGET): $$($1_DEBUGINFO_FILES)
-            $$($1_DEBUGINFO_FILES): $$($1_EXPECTED_OBJS)
-
           else ifeq ($(OPENJDK_TARGET_OS), solaris)
             $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
+            # Setup the command line creating debuginfo files, to be run after linking.
+            # It cannot be run separately since it updates the original target file
+            #
             # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
             # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
             # empty section headers until a fixed $(OBJCOPY) is available.
@@ -466,29 +464,34 @@ define SetupNativeCompilation
             #
             # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
             # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
-            $$($1_DEBUGINFO_FILES): $$($1_TARGET) \
-                $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
-			$(RM) $$@
-			$(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$<
-			$(OBJCOPY) --only-keep-debug $$< $$@
-			$(CD) $$(@D) && $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$(@F) $$<
-			$(TOUCH) $$@
+            $1_CREATE_DEBUGINFO_CMDS := \
+                $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$($1_TARGET) $$(NEWLINE) \
+                $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
+                $(CD) $$($1_OUTPUT_DIR) && \
+                    $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$($1_DEBUGINFO_FILES) $$($1_TARGET)
+            $1_DEBUGINFO_EXTRA_DEPS := $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
 
           else ifeq ($(OPENJDK_TARGET_OS), linux)
             $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
-            $$($1_DEBUGINFO_FILES): $$($1_TARGET)
-			$(RM) $$@
-			$(OBJCOPY) --only-keep-debug $$< $$@
-			$(CD) $$(@D) && $(OBJCOPY) --add-gnu-debuglink=$$(@F) $$<
-			$(TOUCH) $$@
+            # Setup the command line creating debuginfo files, to be run after linking.
+            # It cannot be run separately since it updates the original target file
+            $1_CREATE_DEBUGINFO_CMDS := \
+                $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
+                $(CD) $$($1_OUTPUT_DIR) && \
+                    $(OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
 
           endif # No MacOS X support
 
+          # This dependency dance ensures that debug info files get rebuilt
+          # properly if deleted.
+          $$($1_TARGET): $$($1_DEBUGINFO_FILES)
+          $$($1_DEBUGINFO_FILES): $$($1_EXPECTED_OBJS)
+
           ifeq ($(ZIP_DEBUGINFO_FILES), true)
             $1_DEBUGINFO_ZIP := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).diz
             $1 += $$(subst $$($1_OBJECT_DIR),$$($1_OUTPUT_DIR),$$($1_DEBUGINFO_ZIP))
 
-            # The dependency on TARGET is needed on windows for debuginfo files
+            # The dependency on TARGET is needed for debuginfo files
             # to be rebuilt properly.
             $$($1_DEBUGINFO_ZIP): $$($1_DEBUGINFO_FILES) $$($1_TARGET)
 		$(CD) $$($1_OBJECT_DIR) \
@@ -504,29 +507,31 @@ define SetupNativeCompilation
 
   ifneq (,$$($1_LIBRARY))
     # Generating a dynamic library.
-    $1_EXTRA_LDFLAGS+=$$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
+    $1_EXTRA_LDFLAGS += $$(call SET_SHARED_LIBRARY_NAME,$$($1_BASENAME))
     ifeq ($(OPENJDK_TARGET_OS), windows)
-      $1_EXTRA_LDFLAGS+="-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib"
+      $1_EXTRA_LDFLAGS += "-implib:$$($1_OBJECT_DIR)/$$($1_LIBRARY).lib"
     endif
 
     $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX)
 
-    $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE)
-	$$(call LINKING_MSG,$$($1_BASENAME))
-	$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$@ \
-	$$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
-	$$($1_EXTRA_LDFLAGS_SUFFIX)
-        # Touch target to make sure it has a later time stamp than the debug
-        # symbol files to avoid unnecessary relinking on rebuild.
-        ifeq ($(OPENJDK_TARGET_OS), windows)
-	  $(TOUCH) $$@
-        endif
+    $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE) \
+        $$($1_DEBUGINFO_EXTRA_DEPS)
+		$$(call LINKING_MSG,$$($1_BASENAME))
+		$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(LD_OUT_OPTION)$$@ \
+		    $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
+		    $$($1_EXTRA_LDFLAGS_SUFFIX)
+		$$($1_CREATE_DEBUGINFO_CMDS)
+                # Touch target to make sure it has a later time stamp than the debug
+                # symbol files to avoid unnecessary relinking on rebuild.
+                ifeq ($(OPENJDK_TARGET_OS), windows)
+		  $(TOUCH) $$@
+                endif
 
   endif
 
   ifneq (,$$($1_STATIC_LIBRARY))
     # Generating a static library, ie object file archive.
-    $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES)
+    $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES)
 	$$(call ARCHIVING_MSG,$$($1_LIBRARY))
 	$(AR) $$($1_ARFLAGS) $(AR_OUT_OPTION)$$($1_TARGET) $$($1_EXPECTED_OBJS) \
 	    $$($1_RES) $$($1_LDFLAGS_SUFFIX) $$($1_EXTRA_LDFLAGS_SUFFIX)
@@ -536,26 +541,28 @@ define SetupNativeCompilation
     # A executable binary has been specified, setup the target for it.
     $1_EXTRA_LDFLAGS_SUFFIX += $(GLOBAL_LDFLAGS_SUFFIX)
 
-    $$($1_TARGET) : $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST)
-	$$(call LINKING_EXE_MSG,$$($1_BASENAME))
-	$$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_TARGET) \
-	$$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
-	$$($1_EXTRA_LDFLAGS_SUFFIX)
-        ifneq (,$$($1_GEN_MANIFEST))
-	  $(MT) -nologo -manifest $$($1_GEN_MANIFEST) -outputresource:$$@;#1
-        endif
-        # This only works if the openjdk_codesign identity is present on the system. Let
-        # silently fail otherwise.
-        ifneq (,$(CODESIGN))
-          ifneq (,$$($1_CODESIGN))
-	    $(CODESIGN) -s openjdk_codesign $$@
-          endif
-        endif
-        # Touch target to make sure it has a later time stamp than the debug
-        # symbol files to avoid unnecessary relinking on rebuild.
-        ifeq ($(OPENJDK_TARGET_OS), windows)
-	  $(TOUCH) $$@
-        endif
+    $$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_GEN_MANIFEST) \
+        $$($1_DEBUGINFO_EXTRA_DEPS)
+		$$(call LINKING_EXE_MSG,$$($1_BASENAME))
+		$$($1_LDEXE) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $(EXE_OUT_OPTION)$$($1_TARGET) \
+		    $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_LDFLAGS_SUFFIX) \
+		    $$($1_EXTRA_LDFLAGS_SUFFIX)
+                ifneq (,$$($1_GEN_MANIFEST))
+		  $(MT) -nologo -manifest $$($1_GEN_MANIFEST) -outputresource:$$@;#1
+                endif
+                # This only works if the openjdk_codesign identity is present on the system. Let
+                # silently fail otherwise.
+                ifneq (,$(CODESIGN))
+                  ifneq (,$$($1_CODESIGN))
+		    $(CODESIGN) -s openjdk_codesign $$@
+                  endif
+                endif
+		$$($1_CREATE_DEBUGINFO_CMDS)
+                # Touch target to make sure it has a later time stamp than the debug
+                # symbol files to avoid unnecessary relinking on rebuild.
+                ifeq ($(OPENJDK_TARGET_OS), windows)
+		  $(TOUCH) $$@
+                endif
 
   endif
 endef
diff --git a/make/common/SetupJavaCompilers.gmk b/make/common/SetupJavaCompilers.gmk
index c9aa92075e5..1706dc91da7 100644
--- a/make/common/SetupJavaCompilers.gmk
+++ b/make/common/SetupJavaCompilers.gmk
@@ -48,10 +48,13 @@ $(eval $(call SetupJavaCompiler,BOOT_JAVAC, \
 # The generate old bytecode javac setup uses the new compiler to compile for the
 # boot jdk to generate tools that need to be run with the boot jdk.
 # Thus we force the target bytecode to the previous JDK version.
+# Add -Xlint:-options to avoid the warning about not setting -bootclasspath. Since
+# it's running on the boot jdk, the default bootclasspath is correct.
 $(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
     JVM := $(JAVA_SMALL), \
     JAVAC := $(NEW_JAVAC), \
-    FLAGS := $(BOOT_JDK_SOURCETARGET) -bootclasspath $(BOOT_RTJAR) $(DISABLE_WARNINGS), \
+    FLAGS := $(BOOT_JDK_SOURCETARGET) -XDignore.symbol.file=true \
+        $(DISABLE_WARNINGS) -Xlint:-options, \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
 
@@ -61,8 +64,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE, \
     JVM := $(JAVA), \
     JAVAC := $(NEW_JAVAC), \
     FLAGS := -source 9 -target 9 \
-        -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS) \
-        $(GENERATE_JDKBYTECODE_EXTRA_FLAGS), \
+        -encoding ascii -XDignore.symbol.file=true $(JAVAC_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
 
@@ -72,8 +74,7 @@ $(eval $(call SetupJavaCompiler,GENERATE_JDKBYTECODE_NOWARNINGS, \
     JVM := $(JAVA), \
     JAVAC := $(NEW_JAVAC), \
     FLAGS := -source 9 -target 9 \
-        -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS) \
-        $(GENERATE_JDKBYTECODE_EXTRA_FLAGS), \
+        -encoding ascii -XDignore.symbol.file=true $(DISABLE_WARNINGS), \
     SERVER_DIR := $(SJAVAC_SERVER_DIR), \
     SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
 
diff --git a/make/jprt.properties b/make/jprt.properties
index 1a268de8353..2254cfe823b 100644
--- a/make/jprt.properties
+++ b/make/jprt.properties
@@ -181,8 +181,8 @@ my.make.rule.test.targets.svc=						\
     ${my.test.target.set:TESTNAME=jdk_instrument},			\
     ${my.test.target.set:TESTNAME=jdk_jmx},				\
     ${my.test.target.set:TESTNAME=jdk_jdi},				\
-    ${my.test.target.set:TESTNAME=jdk_jfr},				\
-    ${my.test.target.set:TESTNAME=svc_tools}
+    ${my.test.target.set:TESTNAME=svc_tools},                           \
+    ${my.make.rule.test.targets.svc.extra}
 
 # All vm test targets (testset=all)
 my.test.targets.all=							\
diff --git a/modules.xml b/modules.xml
index 6103b0aa875..8cfeb74f2b6 100644
--- a/modules.xml
+++ b/modules.xml
@@ -210,6 +210,10 @@
       <name>com.sun.security.ntlm</name>
       <to>java.security.sasl</to>
     </export>
+    <export>
+      <name>jdk.internal.jimage</name>
+      <to>jdk.dev</to> 
+    </export>
     <export>
       <name>jdk.internal.org.objectweb.asm</name>
       <to>jdk.jfr</to>

From 92828b7e7cd070bc7e271df19ae984e7871241b6 Mon Sep 17 00:00:00 2001
From: Chris Hegarty <chegar@openjdk.org>
Date: Wed, 3 Dec 2014 14:20:24 +0000
Subject: [PATCH 210/299] 8049367: Modular Run-Time Images

Co-authored-by: Alan Bateman <alan.bateman@oracle.com>
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Bradford Wetmore <bradford.wetmore@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Magnus Ihse Bursie <magnus.ihse.bursie@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Paul Sandoz <paul.sandoz@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: chegar, dfuchs, ihse, joehw, mullan, psandoz, wetmore
---
 corba/make/CommonCorba.gmk                    | 53 ----------------
 .../{CompileCorba.gmk => CompileInterim.gmk}  | 19 ++----
 corba/make/copy/Copy-java.corba.gmk           | 34 +++++++++++
 .../Gensrc-java.corba.gmk}                    | 60 ++++++++++---------
 .../classes/sun/rmi/rmic/iiop/Generator.java  |  2 +-
 5 files changed, 72 insertions(+), 96 deletions(-)
 delete mode 100644 corba/make/CommonCorba.gmk
 rename corba/make/{CompileCorba.gmk => CompileInterim.gmk} (78%)
 create mode 100644 corba/make/copy/Copy-java.corba.gmk
 rename corba/make/{GensrcCorba.gmk => gensrc/Gensrc-java.corba.gmk} (81%)

diff --git a/corba/make/CommonCorba.gmk b/corba/make/CommonCorba.gmk
deleted file mode 100644
index 11b69b6f715..00000000000
--- a/corba/make/CommonCorba.gmk
+++ /dev/null
@@ -1,53 +0,0 @@
-#
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-################################################################################
-# The Corba sources are old and generates a LOT of warnings.
-# Disable these using Xlint, until someone cares to fix them.
-DISABLE_CORBA_WARNINGS := -Xlint:all,-deprecation,-unchecked,-serial,-fallthrough,-cast,-rawtypes,-static,-dep-ann
-
-# The "generate old bytecode" javac setup uses the new compiler to compile for the
-# boot jdk to generate tools that need to be run with the boot jdk.
-# Thus we force the target bytecode to the boot jdk bytecode.
-$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
-    JVM := $(JAVA), \
-    JAVAC := $(NEW_JAVAC), \
-    FLAGS := $(BOOT_JDK_SOURCETARGET) \
-         -bootclasspath "$(BOOT_RTJAR)$(PATH_SEP)$(BOOT_TOOLSJAR)" \
-         $(DISABLE_CORBA_WARNINGS), \
-    SERVER_DIR := $(SJAVAC_SERVER_DIR), \
-    SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
-
-# The "generate new bytecode" uses the new compiler to generate bytecode
-# for the new jdk that is being built. The code compiled by this setup
-# cannot necessarily be run with the boot jdk.
-$(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE, \
-    JVM := $(JAVA), \
-    JAVAC := $(NEW_JAVAC), \
-    FLAGS := -cp $(BOOT_TOOLSJAR) -XDignore.symbol.file=true $(DISABLE_CORBA_WARNINGS), \
-    SERVER_DIR := $(SJAVAC_SERVER_DIR), \
-    SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
-
-################################################################################
diff --git a/corba/make/CompileCorba.gmk b/corba/make/CompileInterim.gmk
similarity index 78%
rename from corba/make/CompileCorba.gmk
rename to corba/make/CompileInterim.gmk
index 3a03e800ec5..7f7e1fdfb98 100644
--- a/corba/make/CompileCorba.gmk
+++ b/corba/make/CompileInterim.gmk
@@ -29,16 +29,16 @@ default: all
 include $(SPEC)
 include MakeBase.gmk
 include JavaCompilation.gmk
-
-include CommonCorba.gmk
+include SetupJavaCompilers.gmk
 
 ################################################################################
 
 $(eval $(call SetupJavaCompilation,BUILD_INTERIM_CORBA, \
     SETUP := GENERATE_OLDBYTECODE, \
-    SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes \
+    SRC := $(JDK_TOPDIR)/src/jdk.rmic/share/classes \
+      $(CORBA_TOPDIR)/src/java.corba/share/classes \
       $(CORBA_TOPDIR)/src/jdk.rmic/share/classes \
-      $(CORBA_OUTPUTDIR)/gensrc/java.corba, \
+      $(SUPPORT_OUTPUTDIR)/gensrc/java.corba, \
     EXCLUDES := com/sun/corba/se/PortableActivationIDL, \
     EXCLUDE_FILES := com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java \
         com/sun/corba/se/spi/presentation/rmi/StubWrapper.java \
@@ -47,16 +47,9 @@ $(eval $(call SetupJavaCompilation,BUILD_INTERIM_CORBA, \
         com/sun/corba/se/impl/presentation/rmi/jndi.properties, \
     COPY := .prp, \
     CLEAN := .properties, \
-    BIN := $(CORBA_OUTPUTDIR)/interim_classes, \
+    BIN := $(BUILDTOOLS_OUTPUTDIR)/corba_interim_classes, \
     JAR := $(INTERIM_CORBA_JAR)))
 
 ################################################################################
-# Copy idl files straight to jdk/include.
-$(JDK_OUTPUTDIR)/include/%: $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/%
-	$(install-file)
 
-IDL_TARGET_FILES := $(JDK_OUTPUTDIR)/include/orb.idl $(JDK_OUTPUTDIR)/include/ir.idl
-
-################################################################################
-
-all: $(BUILD_INTERIM_CORBA) $(IDL_TARGET_FILES)
+all: $(BUILD_INTERIM_CORBA)
diff --git a/corba/make/copy/Copy-java.corba.gmk b/corba/make/copy/Copy-java.corba.gmk
new file mode 100644
index 00000000000..fbc26a5833b
--- /dev/null
+++ b/corba/make/copy/Copy-java.corba.gmk
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# Copy idl files to jdk/lib.
+$(eval $(call SetupCopyFiles,COPY_IDL, \
+    SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl, \
+    DEST := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE), \
+    FILES := $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/orb.idl \
+        $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ir.idl))
+
+TARGETS := $(COPY_IDL)
diff --git a/corba/make/GensrcCorba.gmk b/corba/make/gensrc/Gensrc-java.corba.gmk
similarity index 81%
rename from corba/make/GensrcCorba.gmk
rename to corba/make/gensrc/Gensrc-java.corba.gmk
index 1951cd43e37..11e242afe32 100644
--- a/corba/make/GensrcCorba.gmk
+++ b/corba/make/gensrc/Gensrc-java.corba.gmk
@@ -29,35 +29,37 @@ include $(SPEC)
 include MakeBase.gmk
 include JavaCompilation.gmk
 include IdlCompilation.gmk
-
-include CommonCorba.gmk
+include SetupJavaCompilers.gmk
 
 ################################################################################
 
 $(eval $(call SetupJavaCompilation,BUILD_TOOLS_CORBA, \
     SETUP := GENERATE_OLDBYTECODE, \
     SRC := $(CORBA_TOPDIR)/make/src/classes, \
-    BIN := $(CORBA_OUTPUTDIR)/tools_classes))
+    BIN := $(BUILDTOOLS_OUTPUTDIR)/corba_tools_classes))
 
-TOOL_LOGUTIL_CMD := $(JAVA) -cp $(CORBA_OUTPUTDIR)/tools_classes \
+TOOL_LOGUTIL_CMD := $(JAVA) -cp $(BUILDTOOLS_OUTPUTDIR)/corba_tools_classes \
     build.tools.logutil.MC
 
 $(eval $(call SetupJavaCompilation,BUILD_IDLJ, \
     SETUP := GENERATE_OLDBYTECODE, \
     SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes, \
-    BIN := $(CORBA_OUTPUTDIR)/idlj_classes, \
+    BIN := $(BUILDTOOLS_OUTPUTDIR)/idlj_classes, \
     COPY := .prp, \
     INCLUDES := com/sun/tools/corba/se/idl, \
     EXCLUDE_FILES := ResourceBundleUtil.java))
 
 # Force the language to english for predictable source code generation.
-TOOL_IDLJ_CMD := $(JAVA) -cp $(CORBA_OUTPUTDIR)/idlj_classes \
+TOOL_IDLJ_CMD := $(JAVA) -cp $(BUILDTOOLS_OUTPUTDIR)/idlj_classes \
     -Duser.language=en com.sun.tools.corba.se.idl.toJavaPortable.Compile
 
 ################################################################################
 
+EXCEPTION_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging
+LOGWRAPPER_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/_logwrappers
+
 # Generate LogWrapper classes
-$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/%SystemException.java: \
+$(EXCEPTION_DIR)/%SystemException.java: \
     $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
     $(BUILD_TOOLS_CORBA)
 	$(MKDIR) -p $(@D)
@@ -66,21 +68,21 @@ $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/%SystemExcept
 	$(TOOL_LOGUTIL_CMD) make-class $< $(@D)
 
 # Generate LogWrapper properties file by concatening resource files
-$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/LogStrings.properties: \
-    $(CORBA_OUTPUTDIR)/logwrappers/ActivationSystemException.resource \
-    $(CORBA_OUTPUTDIR)/logwrappers/IORSystemException.resource \
-    $(CORBA_OUTPUTDIR)/logwrappers/InterceptorsSystemException.resource \
-    $(CORBA_OUTPUTDIR)/logwrappers/NamingSystemException.resource \
-    $(CORBA_OUTPUTDIR)/logwrappers/OMGSystemException.resource \
-    $(CORBA_OUTPUTDIR)/logwrappers/ORBUtilSystemException.resource \
-    $(CORBA_OUTPUTDIR)/logwrappers/POASystemException.resource \
-    $(CORBA_OUTPUTDIR)/logwrappers/UtilSystemException.resource
+$(EXCEPTION_DIR)/LogStrings.properties: \
+    $(LOGWRAPPER_DIR)/ActivationSystemException.resource \
+    $(LOGWRAPPER_DIR)/IORSystemException.resource \
+    $(LOGWRAPPER_DIR)/InterceptorsSystemException.resource \
+    $(LOGWRAPPER_DIR)/NamingSystemException.resource \
+    $(LOGWRAPPER_DIR)/OMGSystemException.resource \
+    $(LOGWRAPPER_DIR)/ORBUtilSystemException.resource \
+    $(LOGWRAPPER_DIR)/POASystemException.resource \
+    $(LOGWRAPPER_DIR)/UtilSystemException.resource
 	$(MKDIR) -p $(@D)
 	$(ECHO) $(LOG_INFO) Concatenating 8 resource files into $(@F)
 	$(CAT) $^ > $@
 
 # The resources files are generated from lisp-like .mc files.
-$(CORBA_OUTPUTDIR)/logwrappers/%SystemException.resource: \
+$(LOGWRAPPER_DIR)/%SystemException.resource: \
     $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
     $(BUILD_TOOLS_CORBA)
 	$(MKDIR) -p $(@D)
@@ -90,15 +92,15 @@ $(CORBA_OUTPUTDIR)/logwrappers/%SystemException.resource: \
 
 
 LOGWRAPPER_TARGETS := \
-    $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/ActivationSystemException.java \
-    $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/IORSystemException.java \
-    $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/InterceptorsSystemException.java \
-    $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/NamingSystemException.java \
-    $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/OMGSystemException.java \
-    $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/ORBUtilSystemException.java \
-    $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/POASystemException.java \
-    $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/UtilSystemException.java \
-    $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging/LogStrings.properties
+    $(EXCEPTION_DIR)/ActivationSystemException.java \
+    $(EXCEPTION_DIR)/IORSystemException.java \
+    $(EXCEPTION_DIR)/InterceptorsSystemException.java \
+    $(EXCEPTION_DIR)/NamingSystemException.java \
+    $(EXCEPTION_DIR)/OMGSystemException.java \
+    $(EXCEPTION_DIR)/ORBUtilSystemException.java \
+    $(EXCEPTION_DIR)/POASystemException.java \
+    $(EXCEPTION_DIR)/UtilSystemException.java \
+    $(EXCEPTION_DIR)/LogStrings.properties
 
 ################################################################################
 # Build the IDLs.
@@ -215,7 +217,7 @@ IDL_DELETES := \
 $(eval $(call SetupIdlCompilation,BUILD_IDLS, \
     IDLJ := $(TOOL_IDLJ_CMD), \
     SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes, \
-    BIN := $(CORBA_OUTPUTDIR)/gensrc/java.corba, \
+    BIN := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba, \
     EXCLUDES := com/sun/tools/corba/se/idl/% \
         org/omg/CORBA/% \
         com/sun/corba/se/GiopIDL/% \
@@ -230,12 +232,12 @@ $(BUILD_IDLS): $(BUILD_IDLJ)
 ################################################################################
 # zh_HK is just a copy of zh_TW
 
-$(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties: \
+$(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties: \
     $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties
 	$(install-file)
 
 ################################################################################
 
 all: $(BUILD_IDLS) $(LOGWRAPPER_TARGETS) \
-    $(CORBA_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties
+    $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties
 
diff --git a/corba/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java b/corba/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java
index e775120460c..a19e1ea519f 100644
--- a/corba/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java
+++ b/corba/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java
@@ -352,7 +352,7 @@ public abstract class Generator implements      sun.rmi.rmic.Generator,
                         env.output(Main.getText("rmic.generated", file.getPath(), Long.toString(duration)));
                     }
                     if (sourceFile) {
-                        env.parseFile(new ClassFile(file));
+                        env.parseFile(ClassFile.newClassFile(file));
                     }
                 } catch (IOException e) {
                     env.error(0, "cant.write", file.toString());

From 393a39afe3f2ddc267d16238f8767fc9321200ea Mon Sep 17 00:00:00 2001
From: Chris Hegarty <chegar@openjdk.org>
Date: Wed, 3 Dec 2014 14:21:14 +0000
Subject: [PATCH 211/299] 8049367: Modular Run-Time Images

Co-authored-by: Alan Bateman <alan.bateman@oracle.com>
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Bradford Wetmore <bradford.wetmore@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Magnus Ihse Bursie <magnus.ihse.bursie@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Paul Sandoz <paul.sandoz@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: chegar, dfuchs, ihse, joehw, mullan, psandoz, wetmore
---
 hotspot/make/bsd/makefiles/sa.make            |   6 +-
 hotspot/src/os/aix/vm/os_aix.cpp              |  15 +-
 hotspot/src/os/bsd/vm/os_bsd.cpp              |  24 +-
 hotspot/src/os/linux/vm/os_linux.cpp          |  15 +-
 hotspot/src/os/solaris/vm/os_solaris.cpp      |  20 +-
 hotspot/src/os/windows/vm/os_windows.cpp      |  30 +-
 .../src/share/vm/classfile/classLoader.cpp    | 119 +++++-
 .../src/share/vm/classfile/classLoader.hpp    |  27 +-
 hotspot/src/share/vm/classfile/imageFile.cpp  | 286 +++++++++++++++
 hotspot/src/share/vm/classfile/imageFile.hpp  | 343 ++++++++++++++++++
 .../vm/classfile/sharedPathsMiscInfo.cpp      |   2 +-
 hotspot/src/share/vm/memory/filemap.cpp       |  13 +-
 hotspot/src/share/vm/memory/filemap.hpp       |   7 +-
 hotspot/src/share/vm/runtime/arguments.cpp    | 152 +++++---
 hotspot/src/share/vm/runtime/arguments.hpp    |  13 +-
 hotspot/src/share/vm/runtime/globals.hpp      |   3 +
 hotspot/src/share/vm/runtime/os.cpp           |  12 +-
 hotspot/src/share/vm/runtime/os.hpp           |   1 +
 hotspot/src/share/vm/runtime/statSampler.cpp  |   2 -
 19 files changed, 944 insertions(+), 146 deletions(-)
 create mode 100644 hotspot/src/share/vm/classfile/imageFile.cpp
 create mode 100644 hotspot/src/share/vm/classfile/imageFile.hpp

diff --git a/hotspot/make/bsd/makefiles/sa.make b/hotspot/make/bsd/makefiles/sa.make
index 11503127bbb..a67df867bc7 100644
--- a/hotspot/make/bsd/makefiles/sa.make
+++ b/hotspot/make/bsd/makefiles/sa.make
@@ -63,6 +63,10 @@ else
   SA_CLASSPATH=$(shell test -f $(ALT_SA_CLASSPATH) && echo $(ALT_SA_CLASSPATH))
 endif
 
+ifneq ($(SA_CLASSPATH),)
+  SA_CLASSPATH_ARG := -classpath $(SA_CLASSPATH)
+endif
+
 # TODO: if it's a modules image, check if SA module is installed.
 MODULELIB_PATH= $(BOOT_JAVA_HOME)/lib/modules
 
@@ -114,7 +118,7 @@ $(GENERATED)/sa-jdi.jar: $(AGENT_FILES)
 # are in AGENT_FILES, so use the shell to expand them.
 # Be extra carefull to not produce too long command lines in the shell!
 	$(foreach file,$(AGENT_FILES),$(shell ls -1 $(file) >> $(AGENT_FILES_LIST)))
-	$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) -classpath $(SA_CLASSPATH) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
+	$(QUIETLY) $(REMOTE) $(COMPILE.JAVAC) $(SA_CLASSPATH_ARG) -sourcepath $(AGENT_SRC_DIR) -d $(SA_CLASSDIR) @$(AGENT_FILES_LIST)
 	$(QUIETLY) $(REMOTE) $(COMPILE.RMIC)  -classpath $(SA_CLASSDIR) -d $(SA_CLASSDIR) sun.jvm.hotspot.debugger.remote.RemoteDebuggerServer
 	$(QUIETLY) echo "$(SA_BUILD_VERSION_PROP)" > $(SA_PROPERTIES)
 	$(QUIETLY) rm -f $(SA_CLASSDIR)/sun/jvm/hotspot/utilities/soql/sa.js
diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp
index d0765c4c1fc..a8f416e00a5 100644
--- a/hotspot/src/os/aix/vm/os_aix.cpp
+++ b/hotspot/src/os/aix/vm/os_aix.cpp
@@ -512,15 +512,13 @@ void os::init_system_properties_values() {
 
 #define DEFAULT_LIBPATH "/usr/lib:/lib"
 #define EXTENSIONS_DIR  "/lib/ext"
-#define ENDORSED_DIR    "/lib/endorsed"
 
   // Buffer that fits several sprintfs.
   // Note that the space for the trailing null is provided
   // by the nulls included by the sizeof operator.
   const size_t bufsize =
-    MAX3((size_t)MAXPATHLEN,  // For dll_dir & friends.
-         (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR), // extensions dir
-         (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+    MAX2((size_t)MAXPATHLEN,  // For dll_dir & friends.
+         (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR)); // extensions dir
   char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
 
   // sysclasspath, java_home, dll_dir
@@ -571,15 +569,10 @@ void os::init_system_properties_values() {
   sprintf(buf, "%s" EXTENSIONS_DIR, Arguments::get_java_home());
   Arguments::set_ext_dirs(buf);
 
-  // Endorsed standards default directory.
-  sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
-  Arguments::set_endorsed_dirs(buf);
-
   FREE_C_HEAP_ARRAY(char, buf, mtInternal);
 
 #undef DEFAULT_LIBPATH
 #undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -2778,6 +2771,10 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
   return ::read(fd, buf, nBytes);
 }
 
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+  return ::pread(fd, buf, nBytes, offset);
+}
+
 void os::naked_short_sleep(jlong ms) {
   struct timespec req;
 
diff --git a/hotspot/src/os/bsd/vm/os_bsd.cpp b/hotspot/src/os/bsd/vm/os_bsd.cpp
index a42e3bf19ba..716c7af9f9a 100644
--- a/hotspot/src/os/bsd/vm/os_bsd.cpp
+++ b/hotspot/src/os/bsd/vm/os_bsd.cpp
@@ -353,7 +353,6 @@ void os::init_system_properties_values() {
 // Base path of extensions installed on the system.
 #define SYS_EXT_DIR     "/usr/java/packages"
 #define EXTENSIONS_DIR  "/lib/ext"
-#define ENDORSED_DIR    "/lib/endorsed"
 
 #ifndef __APPLE__
 
@@ -361,9 +360,8 @@ void os::init_system_properties_values() {
   // Note that the space for the colon and the trailing null are provided
   // by the nulls included by the sizeof operator.
   const size_t bufsize =
-    MAX3((size_t)MAXPATHLEN,  // For dll_dir & friends.
-         (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
-         (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+    MAX2((size_t)MAXPATHLEN,  // For dll_dir & friends.
+         (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
   char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
 
   // sysclasspath, java_home, dll_dir
@@ -425,10 +423,6 @@ void os::init_system_properties_values() {
   sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
   Arguments::set_ext_dirs(buf);
 
-  // Endorsed standards default directory.
-  sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
-  Arguments::set_endorsed_dirs(buf);
-
   FREE_C_HEAP_ARRAY(char, buf, mtInternal);
 
 #else // __APPLE__
@@ -445,9 +439,8 @@ void os::init_system_properties_values() {
   // Note that the space for the colon and the trailing null are provided
   // by the nulls included by the sizeof operator.
   const size_t bufsize =
-    MAX3((size_t)MAXPATHLEN,  // for dll_dir & friends.
-         (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + system_ext_size, // extensions dir
-         (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+    MAX2((size_t)MAXPATHLEN,  // for dll_dir & friends.
+         (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + system_ext_size); // extensions dir
   char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
 
   // sysclasspath, java_home, dll_dir
@@ -525,10 +518,6 @@ void os::init_system_properties_values() {
           user_home_dir, Arguments::get_java_home());
   Arguments::set_ext_dirs(buf);
 
-  // Endorsed standards default directory.
-  sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
-  Arguments::set_endorsed_dirs(buf);
-
   FREE_C_HEAP_ARRAY(char, buf, mtInternal);
 
 #undef SYS_EXTENSIONS_DIR
@@ -538,7 +527,6 @@ void os::init_system_properties_values() {
 
 #undef SYS_EXT_DIR
 #undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -2576,6 +2564,10 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
   RESTARTABLE_RETURN_INT(::read(fd, buf, nBytes));
 }
 
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+  RESTARTABLE_RETURN_INT(::pread(fd, buf, nBytes, offset));
+}
+
 void os::naked_short_sleep(jlong ms) {
   struct timespec req;
 
diff --git a/hotspot/src/os/linux/vm/os_linux.cpp b/hotspot/src/os/linux/vm/os_linux.cpp
index 202e3612171..3204697bc27 100644
--- a/hotspot/src/os/linux/vm/os_linux.cpp
+++ b/hotspot/src/os/linux/vm/os_linux.cpp
@@ -337,15 +337,13 @@ void os::init_system_properties_values() {
 // Base path of extensions installed on the system.
 #define SYS_EXT_DIR     "/usr/java/packages"
 #define EXTENSIONS_DIR  "/lib/ext"
-#define ENDORSED_DIR    "/lib/endorsed"
 
   // Buffer that fits several sprintfs.
   // Note that the space for the colon and the trailing null are provided
   // by the nulls included by the sizeof operator.
   const size_t bufsize =
-    MAX3((size_t)MAXPATHLEN,  // For dll_dir & friends.
-         (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
-         (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+    MAX2((size_t)MAXPATHLEN,  // For dll_dir & friends.
+         (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
   char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
 
   // sysclasspath, java_home, dll_dir
@@ -410,16 +408,11 @@ void os::init_system_properties_values() {
   sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
   Arguments::set_ext_dirs(buf);
 
-  // Endorsed standards default directory.
-  sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
-  Arguments::set_endorsed_dirs(buf);
-
   FREE_C_HEAP_ARRAY(char, buf, mtInternal);
 
 #undef DEFAULT_LIBPATH
 #undef SYS_EXT_DIR
 #undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -3783,6 +3776,10 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
   return ::read(fd, buf, nBytes);
 }
 
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+  return ::pread(fd, buf, nBytes, offset);
+}
+
 // Short sleep, direct OS call.
 //
 // Note: certain versions of Linux CFS scheduler (since 2.6.23) do not guarantee
diff --git a/hotspot/src/os/solaris/vm/os_solaris.cpp b/hotspot/src/os/solaris/vm/os_solaris.cpp
index 8fcc883f0a6..f32c23469c4 100644
--- a/hotspot/src/os/solaris/vm/os_solaris.cpp
+++ b/hotspot/src/os/solaris/vm/os_solaris.cpp
@@ -609,17 +609,15 @@ void os::init_system_properties_values() {
 // Base path of extensions installed on the system.
 #define SYS_EXT_DIR     "/usr/jdk/packages"
 #define EXTENSIONS_DIR  "/lib/ext"
-#define ENDORSED_DIR    "/lib/endorsed"
 
   char cpu_arch[12];
   // Buffer that fits several sprintfs.
   // Note that the space for the colon and the trailing null are provided
   // by the nulls included by the sizeof operator.
   const size_t bufsize =
-    MAX4((size_t)MAXPATHLEN,  // For dll_dir & friends.
+    MAX3((size_t)MAXPATHLEN,  // For dll_dir & friends.
          sizeof(SYS_EXT_DIR) + sizeof("/lib/") + strlen(cpu_arch), // invariant ld_library_path
-         (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR), // extensions dir
-         (size_t)MAXPATHLEN + sizeof(ENDORSED_DIR)); // endorsed dir
+         (size_t)MAXPATHLEN + sizeof(EXTENSIONS_DIR) + sizeof(SYS_EXT_DIR) + sizeof(EXTENSIONS_DIR)); // extensions dir
   char *buf = (char *)NEW_C_HEAP_ARRAY(char, bufsize, mtInternal);
 
   // sysclasspath, java_home, dll_dir
@@ -765,15 +763,10 @@ void os::init_system_properties_values() {
   sprintf(buf, "%s" EXTENSIONS_DIR ":" SYS_EXT_DIR EXTENSIONS_DIR, Arguments::get_java_home());
   Arguments::set_ext_dirs(buf);
 
-  // Endorsed standards default directory.
-  sprintf(buf, "%s" ENDORSED_DIR, Arguments::get_java_home());
-  Arguments::set_endorsed_dirs(buf);
-
   FREE_C_HEAP_ARRAY(char, buf, mtInternal);
 
 #undef SYS_EXT_DIR
 #undef EXTENSIONS_DIR
-#undef ENDORSED_DIR
 }
 
 void os::breakpoint() {
@@ -3164,6 +3157,15 @@ size_t os::read(int fd, void *buf, unsigned int nBytes) {
   return res;
 }
 
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+  size_t res;
+  JavaThread* thread = (JavaThread*)Thread::current();
+  assert(thread->thread_state() == _thread_in_vm, "Assumed _thread_in_vm");
+  ThreadBlockInVM tbiv(thread);
+  RESTARTABLE(::pread(fd, buf, (size_t) nBytes, offset), res);
+  return res;
+}
+
 size_t os::restartable_read(int fd, void *buf, unsigned int nBytes) {
   size_t res;
   assert(((JavaThread*)Thread::current())->thread_state() == _thread_in_native,
diff --git a/hotspot/src/os/windows/vm/os_windows.cpp b/hotspot/src/os/windows/vm/os_windows.cpp
index 4a3109bef47..b2841b4aa40 100644
--- a/hotspot/src/os/windows/vm/os_windows.cpp
+++ b/hotspot/src/os/windows/vm/os_windows.cpp
@@ -292,19 +292,6 @@ void os::init_system_properties_values() {
   #undef BIN_DIR
   #undef PACKAGE_DIR
 
-  // Default endorsed standards directory.
-  {
-#define ENDORSED_DIR "\\lib\\endorsed"
-    size_t len = strlen(Arguments::get_java_home()) + sizeof(ENDORSED_DIR);
-    char * buf = NEW_C_HEAP_ARRAY(char, len, mtInternal);
-    sprintf(buf, "%s%s", Arguments::get_java_home(), ENDORSED_DIR);
-    Arguments::set_endorsed_dirs(buf);
-    // (Arguments::set_endorsed_dirs() calls SystemProperty::set_value(), which
-    //  duplicates the input.)
-    FREE_C_HEAP_ARRAY(char, buf, mtInternal);
-#undef ENDORSED_DIR
-  }
-
 #ifndef _WIN64
   // set our UnhandledExceptionFilter and save any previous one
   prev_uef_handler = SetUnhandledExceptionFilter(Handle_FLT_Exception);
@@ -4376,6 +4363,23 @@ jlong os::lseek(int fd, jlong offset, int whence) {
   return (jlong) ::_lseeki64(fd, offset, whence);
 }
 
+size_t os::read_at(int fd, void *buf, unsigned int nBytes, jlong offset) {
+  OVERLAPPED ov;
+  DWORD nread;
+  BOOL result;
+
+  ZeroMemory(&ov, sizeof(ov));
+  ov.Offset = (DWORD)offset;
+  ov.OffsetHigh = (DWORD)(offset >> 32);
+
+  HANDLE h = (HANDLE)::_get_osfhandle(fd);
+
+  result = ReadFile(h, (LPVOID)buf, nBytes, &nread, &ov);
+
+  return result ? nread : 0;
+}
+
+
 // This method is a slightly reworked copy of JDK's sysNativePath
 // from src/windows/hpi/src/path_md.c
 
diff --git a/hotspot/src/share/vm/classfile/classLoader.cpp b/hotspot/src/share/vm/classfile/classLoader.cpp
index 780fea1c2a3..619ee210a6d 100644
--- a/hotspot/src/share/vm/classfile/classLoader.cpp
+++ b/hotspot/src/share/vm/classfile/classLoader.cpp
@@ -28,6 +28,7 @@
 #include "classfile/classLoader.hpp"
 #include "classfile/classLoaderExt.hpp"
 #include "classfile/classLoaderData.inline.hpp"
+#include "classfile/imageFile.hpp"
 #include "classfile/javaClasses.hpp"
 #if INCLUDE_CDS
 #include "classfile/sharedPathsMiscInfo.hpp"
@@ -67,7 +68,7 @@
 #include "utilities/hashtable.hpp"
 #include "utilities/hashtable.inline.hpp"
 
-// Entry points in zip.dll for loading zip/jar file entries
+// Entry points in zip.dll for loading zip/jar file entries and image file entries
 
 typedef void * * (JNICALL *ZipOpen_t)(const char *name, char **pmsg);
 typedef void (JNICALL *ZipClose_t)(jzfile *zip);
@@ -75,6 +76,7 @@ typedef jzentry* (JNICALL *FindEntry_t)(jzfile *zip, const char *name, jint *siz
 typedef jboolean (JNICALL *ReadEntry_t)(jzfile *zip, jzentry *entry, unsigned char *buf, char *namebuf);
 typedef jboolean (JNICALL *ReadMappedEntry_t)(jzfile *zip, jzentry *entry, unsigned char **buf, char *namebuf);
 typedef jzentry* (JNICALL *GetNextEntry_t)(jzfile *zip, jint n);
+typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg);
 typedef jint     (JNICALL *Crc32_t)(jint crc, const jbyte *buf, jint len);
 
 static ZipOpen_t         ZipOpen            = NULL;
@@ -84,6 +86,7 @@ static ReadEntry_t       ReadEntry          = NULL;
 static ReadMappedEntry_t ReadMappedEntry    = NULL;
 static GetNextEntry_t    GetNextEntry       = NULL;
 static canonicalize_fn_t CanonicalizeEntry  = NULL;
+static ZipInflateFully_t ZipInflateFully    = NULL;
 static Crc32_t           Crc32              = NULL;
 
 // Globals
@@ -322,6 +325,8 @@ LazyClassPathEntry::~LazyClassPathEntry() {
 }
 
 bool LazyClassPathEntry::is_jar_file() {
+  size_t len = strlen(_path);
+  if (len < 4 || strcmp(_path + len - 4, ".jar") != 0) return false;
   return ((_st.st_mode & S_IFREG) == S_IFREG);
 }
 
@@ -385,6 +390,78 @@ u1* LazyClassPathEntry::open_entry(const char* name, jint* filesize, bool nul_te
   }
 }
 
+ClassPathImageEntry::ClassPathImageEntry(char* name) : ClassPathEntry(), _image(new ImageFile(name)) {
+  bool opened = _image->open();
+  if (!opened) {
+    _image = NULL;
+  }
+}
+
+ClassPathImageEntry::~ClassPathImageEntry() {
+  if (_image) {
+    _image->close();
+    _image = NULL;
+  }
+}
+
+const char* ClassPathImageEntry::name() {
+  return _image ? _image->name() : "";
+}
+
+ClassFileStream* ClassPathImageEntry::open_stream(const char* name, TRAPS) {
+  u1* buffer;
+  u8 size;
+  _image->get_resource(name, buffer, size);
+
+  if (buffer) {
+    if (UsePerfData) {
+      ClassLoader::perf_sys_classfile_bytes_read()->inc(size);
+    }
+    return new ClassFileStream(buffer, (int)size, (char*)name);  // Resource allocated
+  }
+
+  return NULL;
+}
+
+#ifndef PRODUCT
+void ClassPathImageEntry::compile_the_world(Handle loader, TRAPS) {
+  tty->print_cr("CompileTheWorld : Compiling all classes in %s", name());
+  tty->cr();
+  const ImageStrings strings = _image->get_strings();
+  // Retrieve each path component string.
+  u4 count = _image->get_location_count();
+  for (u4 i = 0; i < count; i++) {
+    u1* location_data = _image->get_location_data(i);
+
+    if (location_data) {
+       ImageLocation location(location_data);
+       const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
+       const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
+       const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
+       assert((strlen(parent) + strlen(base) + strlen(extension)) < JVM_MAXPATHLEN, "path exceeds buffer");
+       char path[JVM_MAXPATHLEN];
+       strcpy(path, parent);
+       strcat(path, base);
+       strcat(path, extension);
+       ClassLoader::compile_the_world_in(path, loader, CHECK);
+    }
+  }
+  if (HAS_PENDING_EXCEPTION) {
+  if (PENDING_EXCEPTION->is_a(SystemDictionary::OutOfMemoryError_klass())) {
+    CLEAR_PENDING_EXCEPTION;
+    tty->print_cr("\nCompileTheWorld : Ran out of memory\n");
+    tty->print_cr("Increase class metadata storage if a limit was set");
+  } else {
+    tty->print_cr("\nCompileTheWorld : Unexpected exception occurred\n");
+  }
+  }
+}
+
+bool ClassPathImageEntry::is_jrt() {
+  return string_ends_with(name(), "bootmodules.jimage");
+}
+#endif
+
 static void print_meta_index(LazyClassPathEntry* entry,
                              GrowableArray<char*>& meta_packages) {
   tty->print("[Meta index for %s=", entry->name());
@@ -634,7 +711,7 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
   }
   ClassPathEntry* new_entry = NULL;
   if ((st->st_mode & S_IFREG) == S_IFREG) {
-    // Regular file, should be a zip file
+    // Regular file, should be a zip or image file
     // Canonicalized filename
     char canonical_path[JVM_MAXPATHLEN];
     if (!get_canonical_path(path, canonical_path, JVM_MAXPATHLEN)) {
@@ -645,6 +722,11 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
         return NULL;
       }
     }
+    // TODO - add proper criteria for selecting image file
+    ClassPathImageEntry* entry = new ClassPathImageEntry(canonical_path);
+    if (entry->is_open()) {
+      new_entry = entry;
+    } else {
     char* error_msg = NULL;
     jzfile* zip;
     {
@@ -655,9 +737,6 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
     }
     if (zip != NULL && error_msg == NULL) {
       new_entry = new ClassPathZipEntry(zip, path);
-      if (TraceClassLoading || TraceClassPaths) {
-        tty->print_cr("[Opened %s]", path);
-      }
     } else {
       ResourceMark rm(thread);
       char *msg;
@@ -675,10 +754,14 @@ ClassPathEntry* ClassLoader::create_class_path_entry(const char *path, const str
         return NULL;
       }
     }
+    }
+    if (TraceClassLoading || TraceClassPaths) {
+      tty->print_cr("[Opened %s]", path);
+    }
   } else {
     // Directory
     new_entry = new ClassPathDirEntry(path);
-    if (TraceClassLoading || TraceClassPaths) {
+    if (TraceClassLoading) {
       tty->print_cr("[Path %s]", path);
     }
   }
@@ -801,6 +884,7 @@ void ClassLoader::load_zip_library() {
   ReadEntry    = CAST_TO_FN_PTR(ReadEntry_t, os::dll_lookup(handle, "ZIP_ReadEntry"));
   ReadMappedEntry = CAST_TO_FN_PTR(ReadMappedEntry_t, os::dll_lookup(handle, "ZIP_ReadMappedEntry"));
   GetNextEntry = CAST_TO_FN_PTR(GetNextEntry_t, os::dll_lookup(handle, "ZIP_GetNextEntry"));
+  ZipInflateFully = CAST_TO_FN_PTR(ZipInflateFully_t, os::dll_lookup(handle, "ZIP_InflateFully"));
   Crc32        = CAST_TO_FN_PTR(Crc32_t, os::dll_lookup(handle, "ZIP_CRC32"));
 
   // ZIP_Close is not exported on Windows in JDK5.0 so don't abort if ZIP_Close is NULL
@@ -809,12 +893,20 @@ void ClassLoader::load_zip_library() {
     vm_exit_during_initialization("Corrupted ZIP library", path);
   }
 
+  if (ZipInflateFully == NULL) {
+    vm_exit_during_initialization("Corrupted ZIP library ZIP_InflateFully missing", path);
+  }
+
   // Lookup canonicalize entry in libjava.dll
   void *javalib_handle = os::native_java_library();
   CanonicalizeEntry = CAST_TO_FN_PTR(canonicalize_fn_t, os::dll_lookup(javalib_handle, "Canonicalize"));
   // This lookup only works on 1.3. Do not check for non-null here
 }
 
+jboolean ClassLoader::decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg) {
+  return (*ZipInflateFully)(in, inSize, out, outSize, pmsg);
+}
+
 int ClassLoader::crc32(int crc, const char* buf, int len) {
   assert(Crc32 != NULL, "ZIP_CRC32 is not found");
   return (*Crc32)(crc, (const jbyte*)buf, len);
@@ -1367,8 +1459,7 @@ void ClassPathDirEntry::compile_the_world(Handle loader, TRAPS) {
   tty->cr();
 }
 
-
-bool ClassPathDirEntry::is_rt_jar() {
+bool ClassPathDirEntry::is_jrt() {
   return false;
 }
 
@@ -1393,13 +1484,13 @@ void ClassPathZipEntry::compile_the_world(Handle loader, TRAPS) {
   }
 }
 
-bool ClassPathZipEntry::is_rt_jar() {
+bool ClassPathZipEntry::is_jrt() {
   real_jzfile* zip = (real_jzfile*) _zip;
   int len = (int)strlen(zip->name);
   // Check whether zip name ends in "rt.jar"
   // This will match other archives named rt.jar as well, but this is
   // only used for debugging.
-  return (len >= 6) && (strcasecmp(zip->name + len - 6, "rt.jar") == 0);
+  return string_ends_with(zip->name, "rt.jar");
 }
 
 void LazyClassPathEntry::compile_the_world(Handle loader, TRAPS) {
@@ -1409,7 +1500,7 @@ void LazyClassPathEntry::compile_the_world(Handle loader, TRAPS) {
   }
 }
 
-bool LazyClassPathEntry::is_rt_jar() {
+bool LazyClassPathEntry::is_jrt() {
   Thread* THREAD = Thread::current();
   ClassPathEntry* cpe = resolve_entry(THREAD);
   return (cpe != NULL) ? cpe->is_jar_file() : false;
@@ -1428,7 +1519,7 @@ void ClassLoader::compile_the_world() {
   jlong start = os::javaTimeMillis();
   while (e != NULL) {
     // We stop at rt.jar, unless it is the first bootstrap path entry
-    if (e->is_rt_jar() && e != _first_entry) break;
+    if (e->is_jrt() && e != _first_entry) break;
     e->compile_the_world(system_class_loader, CATCH);
     e = e->next();
   }
@@ -1476,9 +1567,9 @@ static bool can_be_compiled(methodHandle m, int comp_level) {
 }
 
 void ClassLoader::compile_the_world_in(char* name, Handle loader, TRAPS) {
-  int len = (int)strlen(name);
-  if (len > 6 && strcmp(".class", name + len - 6) == 0) {
+  if (string_ends_with(name, ".class")) {
     // We have a .class file
+    int len = (int)strlen(name);
     char buffer[2048];
     strncpy(buffer, name, len - 6);
     buffer[len-6] = 0;
diff --git a/hotspot/src/share/vm/classfile/classLoader.hpp b/hotspot/src/share/vm/classfile/classLoader.hpp
index f69de2ec2cd..3c9d5fb3ae8 100644
--- a/hotspot/src/share/vm/classfile/classLoader.hpp
+++ b/hotspot/src/share/vm/classfile/classLoader.hpp
@@ -66,7 +66,7 @@ class ClassPathEntry: public CHeapObj<mtClass> {
   virtual ClassFileStream* open_stream(const char* name, TRAPS) = 0;
   // Debugging
   NOT_PRODUCT(virtual void compile_the_world(Handle loader, TRAPS) = 0;)
-  NOT_PRODUCT(virtual bool is_rt_jar() = 0;)
+  NOT_PRODUCT(virtual bool is_jrt() = 0;)
 };
 
 
@@ -80,7 +80,7 @@ class ClassPathDirEntry: public ClassPathEntry {
   ClassFileStream* open_stream(const char* name, TRAPS);
   // Debugging
   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
-  NOT_PRODUCT(bool is_rt_jar();)
+  NOT_PRODUCT(bool is_jrt();)
 };
 
 
@@ -112,7 +112,7 @@ class ClassPathZipEntry: public ClassPathEntry {
   void contents_do(void f(const char* name, void* context), void* context);
   // Debugging
   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
-  NOT_PRODUCT(bool is_rt_jar();)
+  NOT_PRODUCT(bool is_jrt();)
 };
 
 
@@ -138,7 +138,25 @@ class LazyClassPathEntry: public ClassPathEntry {
   virtual bool is_lazy();
   // Debugging
   NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
-  NOT_PRODUCT(bool is_rt_jar();)
+  NOT_PRODUCT(bool is_jrt();)
+};
+
+// For java image files
+class ImageFile;
+class ClassPathImageEntry: public ClassPathEntry {
+private:
+  ImageFile *_image;
+public:
+  bool is_jar_file()  { return false;  }
+  bool is_open()  { return _image != NULL; }
+  const char* name();
+  ClassPathImageEntry(char* name);
+  ~ClassPathImageEntry();
+  ClassFileStream* open_stream(const char* name, TRAPS);
+
+  // Debugging
+  NOT_PRODUCT(void compile_the_world(Handle loader, TRAPS);)
+  NOT_PRODUCT(bool is_jrt();)
 };
 
 class PackageHashtable;
@@ -226,6 +244,7 @@ class ClassLoader: AllStatic {
   // to avoid confusing the zip library
   static bool get_canonical_path(const char* orig, char* out, int len);
  public:
+  static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg);
   static int crc32(int crc, const char* buf, int len);
   static bool update_class_path_entry_list(const char *path,
                                            bool check_for_duplicates,
diff --git a/hotspot/src/share/vm/classfile/imageFile.cpp b/hotspot/src/share/vm/classfile/imageFile.cpp
new file mode 100644
index 00000000000..4d4370f6a63
--- /dev/null
+++ b/hotspot/src/share/vm/classfile/imageFile.cpp
@@ -0,0 +1,286 @@
+/*
+ * Copyright (c) 2014, 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 "classfile/imageFile.hpp"
+#include "runtime/os.inline.hpp"
+#include "utilities/bytes.hpp"
+
+
+// Compute the Perfect Hashing hash code for the supplied string.
+u4 ImageStrings::hash_code(const char* string, u4 seed) {
+  u1* bytes = (u1*)string;
+
+  // Compute hash code.
+  for (u1 byte = *bytes++; byte; byte = *bytes++) {
+    seed = (seed * HASH_MULTIPLIER) ^ byte;
+  }
+
+  // Ensure the result is unsigned.
+  return seed & 0x7FFFFFFF;
+}
+
+// Test to see if string begins with start.  If so returns remaining portion
+// of string.  Otherwise, NULL.
+const char* ImageStrings::starts_with(const char* string, const char* start) {
+  char ch1, ch2;
+
+  // Match up the strings the best we can.
+  while ((ch1 = *string) && (ch2 = *start)) {
+    if (ch1 != ch2) {
+      // Mismatch, return NULL.
+      return NULL;
+    }
+
+    string++, start++;
+  }
+
+  // Return remainder of string.
+  return string;
+}
+
+ImageLocation::ImageLocation(u1* data) {
+  // Deflate the attribute stream into an array of attributes.
+  memset(_attributes, 0, sizeof(_attributes));
+  u1 byte;
+
+  while ((byte = *data) != ATTRIBUTE_END) {
+    u1 kind = attribute_kind(byte);
+    u1 n = attribute_length(byte);
+    assert(kind < ATTRIBUTE_COUNT, "invalid image location attribute");
+    _attributes[kind] = attribute_value(data + 1, n);
+    data += n + 1;
+  }
+}
+
+ImageFile::ImageFile(const char* name) {
+  // Copy the image file name.
+  _name = NEW_C_HEAP_ARRAY(char, strlen(name)+1, mtClass);
+  strcpy(_name, name);
+
+  // Initialize for a closed file.
+  _fd = -1;
+  _memory_mapped = true;
+  _index_data = NULL;
+}
+
+ImageFile::~ImageFile() {
+  // Ensure file is closed.
+  close();
+
+  // Free up name.
+  FREE_C_HEAP_ARRAY(char, _name, mtClass);
+}
+
+bool ImageFile::open() {
+  // If file exists open for reading.
+  struct stat st;
+  if (os::stat(_name, &st) != 0 ||
+    (st.st_mode & S_IFREG) != S_IFREG ||
+    (_fd = os::open(_name, 0, O_RDONLY)) == -1) {
+    return false;
+  }
+
+  // Read image file header and verify.
+  u8 header_size = sizeof(ImageHeader);
+  if (os::read(_fd, &_header, header_size) != header_size ||
+    _header._magic != IMAGE_MAGIC ||
+    _header._major_version != MAJOR_VERSION ||
+    _header._minor_version != MINOR_VERSION) {
+    close();
+    return false;
+  }
+
+  // Memory map index.
+  _index_size = index_size();
+  _index_data = (u1*)os::map_memory(_fd, _name, 0, NULL, _index_size, true, false);
+
+  // Failing that, read index into C memory.
+  if (_index_data == NULL) {
+    _memory_mapped = false;
+    _index_data = NEW_RESOURCE_ARRAY(u1, _index_size);
+
+    if (os::seek_to_file_offset(_fd, 0) == -1) {
+      close();
+      return false;
+    }
+
+    if (os::read(_fd, _index_data, _index_size) != _index_size) {
+      close();
+      return false;
+    }
+
+    return true;
+  }
+
+// Used to advance a pointer, unstructured.
+#undef nextPtr
+#define nextPtr(base, fromType, count, toType) (toType*)((fromType*)(base) + (count))
+  // Pull tables out from the index.
+  _redirect_table = nextPtr(_index_data, u1, header_size, s4);
+  _offsets_table = nextPtr(_redirect_table, s4, _header._location_count, u4);
+  _location_bytes = nextPtr(_offsets_table, u4, _header._location_count, u1);
+  _string_bytes = nextPtr(_location_bytes, u1, _header._locations_size, u1);
+#undef nextPtr
+
+  // Successful open.
+  return true;
+}
+
+void ImageFile::close() {
+  // Dealllocate the index.
+  if (_index_data) {
+    if (_memory_mapped) {
+      os::unmap_memory((char*)_index_data, _index_size);
+    } else {
+      FREE_RESOURCE_ARRAY(u1, _index_data, _index_size);
+    }
+
+    _index_data = NULL;
+  }
+
+  // close file.
+  if (_fd != -1) {
+    os::close(_fd);
+    _fd = -1;
+  }
+
+}
+
+// Return the attribute stream for a named resourced.
+u1* ImageFile::find_location_data(const char* path) const {
+  // Compute hash.
+  u4 hash = ImageStrings::hash_code(path) % _header._location_count;
+  s4 redirect = _redirect_table[hash];
+
+  if (!redirect) {
+    return NULL;
+  }
+
+  u4 index;
+
+  if (redirect < 0) {
+    // If no collision.
+    index = -redirect - 1;
+  } else {
+    // If collision, recompute hash code.
+    index = ImageStrings::hash_code(path, redirect) % _header._location_count;
+  }
+
+  assert(index < _header._location_count, "index exceeds location count");
+  u4 offset = _offsets_table[index];
+  assert(offset < _header._locations_size, "offset exceeds location attributes size");
+
+  if (offset == 0) {
+    return NULL;
+  }
+
+  return _location_bytes + offset;
+}
+
+// Verify that a found location matches the supplied path.
+bool ImageFile::verify_location(ImageLocation& location, const char* path) const {
+  // Retrieve each path component string.
+  ImageStrings strings(_string_bytes, _header._strings_size);
+  // Match a path with each subcomponent without concatenation (copy).
+  // Match up path parent.
+  const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings);
+  const char* next = ImageStrings::starts_with(path, parent);
+  // Continue only if a complete match.
+  if (!next) return false;
+  // Match up path base.
+  const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings);
+  next = ImageStrings::starts_with(next, base);
+  // Continue only if a complete match.
+  if (!next) return false;
+  // Match up path extension.
+  const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings);
+  next = ImageStrings::starts_with(next, extension);
+
+  // True only if complete match and no more characters.
+  return next && *next == '\0';
+}
+
+// Return the resource for the supplied location.
+u1* ImageFile::get_resource(ImageLocation& location) const {
+  // Retrieve the byte offset and size of the resource.
+  u8 offset = _index_size + location.get_attribute(ImageLocation::ATTRIBUTE_OFFSET);
+  u8 size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
+  u8 compressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_COMPRESSED);
+  u8 read_size = compressed_size ? compressed_size : size;
+
+  // Allocate space for the resource.
+  u1* data = NEW_RESOURCE_ARRAY(u1, read_size);
+
+  bool is_read = os::read_at(_fd, data, read_size, offset) == read_size;
+  guarantee(is_read, "error reading from image or short read");
+
+  // If not compressed, just return the data.
+  if (!compressed_size) {
+    return data;
+  }
+
+  u1* uncompressed = NEW_RESOURCE_ARRAY(u1, size);
+  char* msg = NULL;
+  jboolean res = ClassLoader::decompress(data, compressed_size, uncompressed, size, &msg);
+  if (!res) warning("decompression failed due to %s\n", msg);
+  guarantee(res, "decompression failed");
+
+  return uncompressed;
+}
+
+void ImageFile::get_resource(const char* path, u1*& buffer, u8& size) const {
+  buffer = NULL;
+  size = 0;
+  u1* data = find_location_data(path);
+  if (data) {
+    ImageLocation location(data);
+    if (verify_location(location, path)) {
+      size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED);
+      buffer = get_resource(location);
+    }
+  }
+}
+
+GrowableArray<const char*>* ImageFile::packages(const char* name) {
+  char entry[JVM_MAXPATHLEN];
+  bool overflow = jio_snprintf(entry, sizeof(entry), "%s/packages.offsets", name) == -1;
+  guarantee(!overflow, "package name overflow");
+
+  u1* buffer;
+  u8 size;
+
+  get_resource(entry, buffer, size);
+  guarantee(buffer, "missing module packages reource");
+  ImageStrings strings(_string_bytes, _header._strings_size);
+  GrowableArray<const char*>* pkgs = new GrowableArray<const char*>();
+  int count = size / 4;
+  for (int i = 0; i < count; i++) {
+    u4 offset = Bytes::get_Java_u4(buffer + (i*4));
+    const char* p = strings.get(offset);
+    pkgs->append(p);
+  }
+
+  return pkgs;
+}
diff --git a/hotspot/src/share/vm/classfile/imageFile.hpp b/hotspot/src/share/vm/classfile/imageFile.hpp
new file mode 100644
index 00000000000..d5ae6d597af
--- /dev/null
+++ b/hotspot/src/share/vm/classfile/imageFile.hpp
@@ -0,0 +1,343 @@
+/*
+ * Copyright (c) 2014, 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.
+ *
+ */
+
+#ifndef SHARE_VM_CLASSFILE_IMAGEFILE_HPP
+#define SHARE_VM_CLASSFILE_IMAGEFILE_HPP
+
+#include "classfile/classLoader.hpp"
+#include "memory/allocation.hpp"
+#include "memory/allocation.inline.hpp"
+#include "utilities/globalDefinitions.hpp"
+
+// Image files are an alternate file format for storing classes and resources. The
+// goal is to supply file access which is faster and smaller that the jar format.
+// It should be noted that unlike jars information stored in an image is in native
+// endian format. This allows the image to be memory mapped into memory without
+// endian translation.  This also means that images are platform dependent.
+//
+// Image files are structured as three sections;
+//
+//         +-----------+
+//         |  Header   |
+//         +-----------+
+//         |           |
+//         | Directory |
+//         |           |
+//         +-----------+
+//         |           |
+//         |           |
+//         | Resources |
+//         |           |
+//         |           |
+//         +-----------+
+//
+// The header contains information related to identification and description of
+// contents.
+//
+//         +-------------------------+
+//         |   Magic (0xCAFEDADA)    |
+//         +------------+------------+
+//         | Major Vers | Minor Vers |
+//         +------------+------------+
+//         |      Location Count     |
+//         +-------------------------+
+//         |      Attributes Size    |
+//         +-------------------------+
+//         |       Strings Size      |
+//         +-------------------------+
+//
+// Magic - means of identifying validity of the file.  This avoids requiring a
+//         special file extension.
+// Major vers, minor vers - differences in version numbers indicate structural
+//                          changes in the image.
+// Location count - number of locations/resources in the file.  This count is also
+//                  the length of lookup tables used in the directory.
+// Attributes size - number of bytes in the region used to store location attribute
+//                   streams.
+// Strings size - the size of the region used to store strings used by the
+//                directory and meta data.
+//
+// The directory contains information related to resource lookup. The algorithm
+// used for lookup is "A Practical Minimal Perfect Hashing Method"
+// (http://homepages.dcc.ufmg.br/~nivio/papers/wea05.pdf). Given a path string
+// in the form <package>/<base>.<extension>  return the resource location
+// information;
+//
+//     redirectIndex = hash(path, DEFAULT_SEED) % count;
+//     redirect = redirectTable[redirectIndex];
+//     if (redirect == 0) return not found;
+//     locationIndex = redirect < 0 ? -1 - redirect : hash(path, redirect) % count;
+//     location = locationTable[locationIndex];
+//     if (!verify(location, path)) return not found;
+//     return location;
+//
+// Note: The hash function takes an initial seed value.  A different seed value
+// usually returns a different result for strings that would otherwise collide with
+// other seeds. The verify function guarantees the found resource location is
+// indeed the resource we are looking for.
+//
+// The following is the format of the directory;
+//
+//         +-------------------+
+//         |   Redirect Table  |
+//         +-------------------+
+//         | Attribute Offsets |
+//         +-------------------+
+//         |   Attribute Data  |
+//         +-------------------+
+//         |      Strings      |
+//         +-------------------+
+//
+// Redirect Table - Array of 32-bit signed values representing actions that
+//                  should take place for hashed strings that map to that
+//                  value.  Negative values indicate no hash collision and can be
+//                  quickly converted to indices into attribute offsets.  Positive
+//                  values represent a new seed for hashing an index into attribute
+//                  offsets.  Zero indicates not found.
+// Attribute Offsets - Array of 32-bit unsigned values representing offsets into
+//                     attribute data.  Attribute offsets can be iterated to do a
+//                     full survey of resources in the image.
+// Attribute Data - Bytes representing compact attribute data for locations. (See
+//                  comments in ImageLocation.)
+// Strings - Collection of zero terminated UTF-8 strings used by the directory and
+//           image meta data.  Each string is accessed by offset.  Each string is
+//           unique.  Offset zero is reserved for the empty string.
+//
+// Note that the memory mapped directory assumes 32 bit alignment of the image
+// header, the redirect table and the attribute offsets.
+//
+
+
+// Manage image file string table.
+class ImageStrings {
+private:
+  // Data bytes for strings.
+  u1* _data;
+  // Number of bytes in the string table.
+  u4 _size;
+
+public:
+  // Prime used to generate hash for Perfect Hashing.
+  static const u4 HASH_MULTIPLIER = 0x01000193;
+
+  ImageStrings(u1* data, u4 size) : _data(data), _size(size) {}
+
+  // Return the UTF-8 string beginning at offset.
+  inline const char* get(u4 offset) const {
+    assert(offset < _size, "offset exceeds string table size");
+    return (const char*)(_data + offset);
+  }
+
+  // Compute the Perfect Hashing hash code for the supplied string.
+  inline static u4 hash_code(const char* string) {
+    return hash_code(string, HASH_MULTIPLIER);
+  }
+
+  // Compute the Perfect Hashing hash code for the supplied string, starting at seed.
+  static u4 hash_code(const char* string, u4 seed);
+
+  // Test to see if string begins with start.  If so returns remaining portion
+  // of string.  Otherwise, NULL.  Used to test sections of a path without
+  // copying.
+  static const char* starts_with(const char* string, const char* start);
+
+};
+
+// Manage image file location attribute streams.  Within an image, a location's
+// attributes are compressed into a stream of bytes.  An attribute stream is
+// composed of individual attribute sequences.  Each attribute sequence begins with
+// a header byte containing the attribute 'kind' (upper 5 bits of header) and the
+// 'length' less 1 (lower 3 bits of header) of bytes that follow containing the
+// attribute value.  Attribute values present as most significant byte first.
+//
+// Ex. Container offset (ATTRIBUTE_OFFSET) 0x33562 would be represented as 0x22
+// (kind = 4, length = 3), 0x03, 0x35, 0x62.
+//
+// An attribute stream is terminated with a header kind of ATTRIBUTE_END (header
+// byte of zero.)
+//
+// ImageLocation inflates the stream into individual values stored in the long
+// array _attributes. This allows an attribute value can be quickly accessed by
+// direct indexing. Unspecified values default to zero.
+//
+// Notes:
+//  - Even though ATTRIBUTE_END is used to mark the end of the attribute stream,
+//    streams will contain zero byte values to represent lesser significant bits.
+//    Thus, detecting a zero byte is not sufficient to detect the end of an attribute
+//    stream.
+//  - ATTRIBUTE_OFFSET represents the number of bytes from the beginning of the region
+//    storing the resources.  Thus, in an image this represents the number of bytes
+//    after the directory.
+//  - Currently, compressed resources are represented by having a non-zero
+//    ATTRIBUTE_COMPRESSED value.  This represents the number of bytes stored in the
+//    image, and the value of ATTRIBUTE_UNCOMPRESSED represents number of bytes of the
+//    inflated resource in memory. If the ATTRIBUTE_COMPRESSED is zero then the value
+//    of ATTRIBUTE_UNCOMPRESSED represents both the number of bytes in the image and
+//    in memory.  In the future, additional compression techniques will be used and
+//    represented differently.
+//  - Package strings include trailing slash and extensions include prefix period.
+//
+class ImageLocation {
+public:
+  // Attribute kind enumeration.
+  static const u1 ATTRIBUTE_END = 0; // End of attribute stream marker
+  static const u1 ATTRIBUTE_BASE = 1; // String table offset of resource path base
+  static const u1 ATTRIBUTE_PARENT = 2; // String table offset of resource path parent
+  static const u1 ATTRIBUTE_EXTENSION = 3; // String table offset of resource path extension
+  static const u1 ATTRIBUTE_OFFSET = 4; // Container byte offset of resource
+  static const u1 ATTRIBUTE_COMPRESSED = 5; // In image byte size of the compressed resource
+  static const u1 ATTRIBUTE_UNCOMPRESSED = 6; // In memory byte size of the uncompressed resource
+  static const u1 ATTRIBUTE_COUNT = 7; // Number of attribute kinds
+
+private:
+  // Values of inflated attributes.
+  u8 _attributes[ATTRIBUTE_COUNT];
+
+  // Return the attribute value number of bytes.
+  inline static u1 attribute_length(u1 data) {
+    return (data & 0x7) + 1;
+  }
+
+  // Return the attribute kind.
+  inline static u1 attribute_kind(u1 data) {
+    u1 kind = data >> 3;
+    assert(kind < ATTRIBUTE_COUNT, "invalid attribute kind");
+    return kind;
+  }
+
+  // Return the attribute length.
+  inline static u8 attribute_value(u1* data, u1 n) {
+    assert(0 < n && n <= 8, "invalid attribute value length");
+    u8 value = 0;
+
+    // Most significant bytes first.
+    for (u1 i = 0; i < n; i++) {
+      value <<= 8;
+      value |= data[i];
+    }
+
+    return value;
+  }
+
+public:
+  ImageLocation(u1* data);
+
+  // Retrieve an attribute value from the inflated array.
+  inline u8 get_attribute(u1 kind) const {
+    assert(ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT, "invalid attribute kind");
+    return _attributes[kind];
+  }
+
+  // Retrieve an attribute string value from the inflated array.
+  inline const char* get_attribute(u4 kind, const ImageStrings& strings) const {
+    return strings.get((u4)get_attribute(kind));
+  }
+};
+
+// Manage the image file.
+class ImageFile: public CHeapObj<mtClass> {
+private:
+  // Image file marker.
+  static const u4 IMAGE_MAGIC = 0xCAFEDADA;
+  // Image file major version number.
+  static const u2 MAJOR_VERSION = 0;
+  // Image file minor version number.
+  static const u2 MINOR_VERSION = 1;
+
+  struct ImageHeader {
+    u4 _magic;          // Image file marker
+    u2 _major_version;  // Image file major version number
+    u2 _minor_version;  // Image file minor version number
+    u4 _location_count; // Number of locations managed in index.
+    u4 _locations_size; // Number of bytes in attribute table.
+    u4 _strings_size;   // Number of bytes in string table.
+  };
+
+  char* _name;          // Name of image
+  int _fd;              // File descriptor
+  bool _memory_mapped;  // Is file memory mapped
+  ImageHeader _header;  // Image header
+  u8 _index_size;       // Total size of index
+  u1* _index_data;      // Raw index data
+  s4* _redirect_table;  // Perfect hash redirect table
+  u4* _offsets_table;   // Location offset table
+  u1* _location_bytes;  // Location attributes
+  u1* _string_bytes;    // String table
+
+  // Compute number of bytes in image file index.
+  inline u8 index_size() {
+    return sizeof(ImageHeader) +
+    _header._location_count * sizeof(u4) * 2 +
+    _header._locations_size +
+    _header._strings_size;
+  }
+
+public:
+  ImageFile(const char* name);
+  ~ImageFile();
+
+  // Open image file for access.
+  bool open();
+  // Close image file.
+  void close();
+
+  // Retrieve name of image file.
+  inline const char* name() const {
+    return _name;
+  }
+
+  // Return a string table accessor.
+  inline const ImageStrings get_strings() const {
+    return ImageStrings(_string_bytes, _header._strings_size);
+  }
+
+  // Return number of locations in image file index.
+  inline u4 get_location_count() const {
+    return _header._location_count;
+  }
+
+  // Return location attribute stream for location i.
+  inline u1* get_location_data(u4 i) const {
+    u4 offset = _offsets_table[i];
+
+    return offset != 0 ? _location_bytes + offset : NULL;
+  }
+
+  // Return the attribute stream for a named resourced.
+  u1* find_location_data(const char* path) const;
+
+  // Verify that a found location matches the supplied path.
+  bool verify_location(ImageLocation& location, const char* path) const;
+
+  // Return the resource for the supplied location info.
+  u1* get_resource(ImageLocation& location) const;
+
+  // Return the resource associated with the path else NULL if not found.
+  void get_resource(const char* path, u1*& buffer, u8& size) const;
+
+  // Return an array of packages for a given module
+  GrowableArray<const char*>* packages(const char* name);
+};
+
+#endif // SHARE_VM_CLASSFILE_IMAGEFILE_HPP
diff --git a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp
index 79457a0e5e2..9bb82f7fd19 100644
--- a/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp
+++ b/hotspot/src/share/vm/classfile/sharedPathsMiscInfo.cpp
@@ -110,7 +110,7 @@ bool SharedPathsMiscInfo::check() {
 bool SharedPathsMiscInfo::check(jint type, const char* path) {
   switch (type) {
   case BOOT:
-    if (strcmp(path, Arguments::get_sysclasspath()) != 0) {
+    if (os::file_name_strcmp(path, Arguments::get_sysclasspath()) != 0) {
       return fail("[BOOT classpath mismatch, actual: -Dsun.boot.class.path=", Arguments::get_sysclasspath());
     }
     break;
diff --git a/hotspot/src/share/vm/memory/filemap.cpp b/hotspot/src/share/vm/memory/filemap.cpp
index 07027b52c42..c344c0d8647 100644
--- a/hotspot/src/share/vm/memory/filemap.cpp
+++ b/hotspot/src/share/vm/memory/filemap.cpp
@@ -217,9 +217,14 @@ void FileMapInfo::allocate_classpath_entry_table() {
           EXCEPTION_MARK; // The following call should never throw, but would exit VM on error.
           SharedClassUtil::update_shared_classpath(cpe, ent, st.st_mtime, st.st_size, THREAD);
         } else {
-          ent->_filesize  = -1;
-          if (!os::dir_is_empty(name)) {
-            ClassLoader::exit_with_path_failure("Cannot have non-empty directory in archived classpaths", name);
+          struct stat st;
+          if ((os::stat(name, &st) == 0) && ((st.st_mode & S_IFDIR) == S_IFDIR)) {
+            if (!os::dir_is_empty(name)) {
+              ClassLoader::exit_with_path_failure("Cannot have non-empty directory in archived classpaths", name);
+            }
+            ent->_filesize = -1;
+          } else {
+            ent->_filesize = -2;
           }
         }
         ent->_name = strptr;
@@ -271,7 +276,7 @@ bool FileMapInfo::validate_classpath_entry_table() {
         fail_continue("directory is not empty: %s", name);
         ok = false;
       }
-    } else {
+    } else if (ent->is_jar()) {
       if (ent->_timestamp != st.st_mtime ||
           ent->_filesize != st.st_size) {
         ok = false;
diff --git a/hotspot/src/share/vm/memory/filemap.hpp b/hotspot/src/share/vm/memory/filemap.hpp
index a84aa17457f..fe1627ef9a6 100644
--- a/hotspot/src/share/vm/memory/filemap.hpp
+++ b/hotspot/src/share/vm/memory/filemap.hpp
@@ -44,8 +44,11 @@ class Metaspace;
 class SharedClassPathEntry VALUE_OBJ_CLASS_SPEC {
 public:
   const char *_name;
-  time_t _timestamp;          // jar timestamp,  0 if is directory
-  long   _filesize;           // jar file size, -1 if is directory
+  time_t _timestamp;          // jar timestamp,  0 if is directory or other
+  long   _filesize;           // jar file size, -1 if is directory, -2 if other
+  bool is_jar() {
+    return _timestamp != 0;
+  }
   bool is_dir() {
     return _filesize == -1;
   }
diff --git a/hotspot/src/share/vm/runtime/arguments.cpp b/hotspot/src/share/vm/runtime/arguments.cpp
index ff2a25fe1bc..dde8a1bad8e 100644
--- a/hotspot/src/share/vm/runtime/arguments.cpp
+++ b/hotspot/src/share/vm/runtime/arguments.cpp
@@ -115,8 +115,6 @@ exit_hook_t      Arguments::_exit_hook          = NULL;
 vfprintf_hook_t  Arguments::_vfprintf_hook      = NULL;
 
 
-SystemProperty *Arguments::_java_ext_dirs = NULL;
-SystemProperty *Arguments::_java_endorsed_dirs = NULL;
 SystemProperty *Arguments::_sun_boot_library_path = NULL;
 SystemProperty *Arguments::_java_library_path = NULL;
 SystemProperty *Arguments::_java_home = NULL;
@@ -125,6 +123,7 @@ SystemProperty *Arguments::_sun_boot_class_path = NULL;
 
 char* Arguments::_meta_index_path = NULL;
 char* Arguments::_meta_index_dir = NULL;
+char* Arguments::_ext_dirs = NULL;
 
 // Check if head of 'option' matches 'name', and sets 'tail' remaining part of option string
 
@@ -184,8 +183,6 @@ void Arguments::init_system_properties() {
   // Following are JVMTI agent writable properties.
   // Properties values are set to NULL and they are
   // os specific they are initialized in os::init_system_properties_values().
-  _java_ext_dirs = new SystemProperty("java.ext.dirs", NULL,  true);
-  _java_endorsed_dirs = new SystemProperty("java.endorsed.dirs", NULL,  true);
   _sun_boot_library_path = new SystemProperty("sun.boot.library.path", NULL,  true);
   _java_library_path = new SystemProperty("java.library.path", NULL,  true);
   _java_home =  new SystemProperty("java.home", NULL,  true);
@@ -194,8 +191,6 @@ void Arguments::init_system_properties() {
   _java_class_path = new SystemProperty("java.class.path", "",  true);
 
   // Add to System Property list.
-  PropertyList_add(&_system_properties, _java_ext_dirs);
-  PropertyList_add(&_system_properties, _java_endorsed_dirs);
   PropertyList_add(&_system_properties, _sun_boot_library_path);
   PropertyList_add(&_system_properties, _java_library_path);
   PropertyList_add(&_system_properties, _java_home);
@@ -344,13 +339,9 @@ bool Arguments::is_newly_obsolete(const char *s, JDK_Version* version) {
 // components, in order:
 //
 //     prefix           // from -Xbootclasspath/p:...
-//     endorsed         // the expansion of -Djava.endorsed.dirs=...
 //     base             // from os::get_system_properties() or -Xbootclasspath=
 //     suffix           // from -Xbootclasspath/a:...
 //
-// java.endorsed.dirs is a list of directories; any jar or zip files in the
-// directories are added to the sysclasspath just before the base.
-//
 // This could be AllStatic, but it isn't needed after argument processing is
 // complete.
 class SysClassPath: public StackObj {
@@ -364,16 +355,9 @@ public:
   inline void add_suffix(const char* suffix);
   inline void reset_path(const char* base);
 
-  // Expand the jar/zip files in each directory listed by the java.endorsed.dirs
-  // property.  Must be called after all command-line arguments have been
-  // processed (in particular, -Djava.endorsed.dirs=...) and before calling
-  // combined_path().
-  void expand_endorsed();
-
   inline const char* get_base()     const { return _items[_scp_base]; }
   inline const char* get_prefix()   const { return _items[_scp_prefix]; }
   inline const char* get_suffix()   const { return _items[_scp_suffix]; }
-  inline const char* get_endorsed() const { return _items[_scp_endorsed]; }
 
   // Combine all the components into a single c-heap-allocated string; caller
   // must free the string if/when no longer needed.
@@ -390,20 +374,17 @@ private:
   // base are allocated in the C heap and freed by this class.
   enum {
     _scp_prefix,        // from -Xbootclasspath/p:...
-    _scp_endorsed,      // the expansion of -Djava.endorsed.dirs=...
     _scp_base,          // the default sysclasspath
     _scp_suffix,        // from -Xbootclasspath/a:...
     _scp_nitems         // the number of items, must be last.
   };
 
   const char* _items[_scp_nitems];
-  DEBUG_ONLY(bool _expansion_done;)
 };
 
 SysClassPath::SysClassPath(const char* base) {
   memset(_items, 0, sizeof(_items));
   _items[_scp_base] = base;
-  DEBUG_ONLY(_expansion_done = false;)
 }
 
 SysClassPath::~SysClassPath() {
@@ -411,7 +392,6 @@ SysClassPath::~SysClassPath() {
   for (int i = 0; i < _scp_nitems; ++i) {
     if (i != _scp_base) reset_item_at(i);
   }
-  DEBUG_ONLY(_expansion_done = false;)
 }
 
 inline void SysClassPath::set_base(const char* base) {
@@ -447,41 +427,11 @@ inline void SysClassPath::reset_path(const char* base) {
 
 //------------------------------------------------------------------------------
 
-void SysClassPath::expand_endorsed() {
-  assert(_items[_scp_endorsed] == NULL, "can only be called once.");
-
-  const char* path = Arguments::get_property("java.endorsed.dirs");
-  if (path == NULL) {
-    path = Arguments::get_endorsed_dir();
-    assert(path != NULL, "no default for java.endorsed.dirs");
-  }
-
-  char* expanded_path = NULL;
-  const char separator = *os::path_separator();
-  const char* const end = path + strlen(path);
-  while (path < end) {
-    const char* tmp_end = strchr(path, separator);
-    if (tmp_end == NULL) {
-      expanded_path = add_jars_to_path(expanded_path, path);
-      path = end;
-    } else {
-      char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal);
-      memcpy(dirpath, path, tmp_end - path);
-      dirpath[tmp_end - path] = '\0';
-      expanded_path = add_jars_to_path(expanded_path, dirpath);
-      FREE_C_HEAP_ARRAY(char, dirpath, mtInternal);
-      path = tmp_end + 1;
-    }
-  }
-  _items[_scp_endorsed] = expanded_path;
-  DEBUG_ONLY(_expansion_done = true;)
-}
 
 // Combine the bootclasspath elements, some of which may be null, into a single
 // c-heap-allocated string.
 char* SysClassPath::combined_path() {
   assert(_items[_scp_base] != NULL, "empty default sysclasspath");
-  assert(_expansion_done, "must call expand_endorsed() first.");
 
   size_t lengths[_scp_nitems];
   size_t total_len = 0;
@@ -3084,6 +3034,20 @@ jint Arguments::parse_each_vm_init_arg(const JavaVMInitArgs* args,
 #endif
     // -D
     } else if (match_option(option, "-D", &tail)) {
+      if (match_option(option, "-Djava.endorsed.dirs=", &tail)) {
+        // abort if -Djava.endorsed.dirs is set
+        jio_fprintf(defaultStream::output_stream(),
+          "-Djava.endorsed.dirs is not supported. Endorsed standards and standalone APIs\n"
+          "in modular form will be supported via the concept of upgradeable modules.\n");
+        return JNI_EINVAL;
+      }
+      if (match_option(option, "-Djava.ext.dirs=", &tail)) {
+        // abort if -Djava.ext.dirs is set
+        jio_fprintf(defaultStream::output_stream(),
+          "-Djava.ext.dirs is not supported.  Use -classpath instead.\n");
+        return JNI_EINVAL;
+      }
+
       if (!add_property(tail)) {
         return JNI_ENOMEM;
       }
@@ -3529,11 +3493,89 @@ void Arguments::fix_appclasspath() {
   }
 }
 
-jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) {
-  // This must be done after all -D arguments have been processed.
-  scp_p->expand_endorsed();
+static bool has_jar_files(const char* directory) {
+  DIR* dir = os::opendir(directory);
+  if (dir == NULL) return false;
 
-  if (scp_assembly_required || scp_p->get_endorsed() != NULL) {
+  struct dirent *entry;
+  char *dbuf = NEW_C_HEAP_ARRAY(char, os::readdir_buf_size(directory), mtInternal);
+  bool hasJarFile = false;
+  while (!hasJarFile && (entry = os::readdir(dir, (dirent *) dbuf)) != NULL) {
+    const char* name = entry->d_name;
+    const char* ext = name + strlen(name) - 4;
+    hasJarFile = ext > name && (os::file_name_strcmp(ext, ".jar") == 0);
+  }
+  FREE_C_HEAP_ARRAY(char, dbuf, mtInternal);
+  os::closedir(dir);
+  return hasJarFile ;
+}
+
+static int check_non_empty_dirs(const char* path) {
+  const char separator = *os::path_separator();
+  const char* const end = path + strlen(path);
+  int nonEmptyDirs = 0;
+  while (path < end) {
+    const char* tmp_end = strchr(path, separator);
+    if (tmp_end == NULL) {
+      if (has_jar_files(path)) {
+        nonEmptyDirs++;
+        jio_fprintf(defaultStream::output_stream(),
+          "Non-empty directory: %s\n", path);
+      }
+      path = end;
+    } else {
+      char* dirpath = NEW_C_HEAP_ARRAY(char, tmp_end - path + 1, mtInternal);
+      memcpy(dirpath, path, tmp_end - path);
+      dirpath[tmp_end - path] = '\0';
+      if (has_jar_files(dirpath)) {
+        nonEmptyDirs++;
+        jio_fprintf(defaultStream::output_stream(),
+          "Non-empty directory: %s\n", dirpath);
+      }
+      FREE_C_HEAP_ARRAY(char, dirpath, mtInternal);
+      path = tmp_end + 1;
+    }
+  }
+  return nonEmptyDirs;
+}
+
+jint Arguments::finalize_vm_init_args(SysClassPath* scp_p, bool scp_assembly_required) {
+  // check if the default lib/endorsed directory exists; if so, error
+  char path[JVM_MAXPATHLEN];
+  const char* fileSep = os::file_separator();
+  sprintf(path, "%s%slib%sendorsed", Arguments::get_java_home(), fileSep, fileSep);
+
+  if (CheckEndorsedAndExtDirs) {
+    int nonEmptyDirs = 0;
+    // check endorsed directory
+    nonEmptyDirs += check_non_empty_dirs(path);
+    // check the extension directories
+    nonEmptyDirs += check_non_empty_dirs(Arguments::get_ext_dirs());
+    if (nonEmptyDirs > 0) {
+      return JNI_ERR;
+    }
+  }
+
+  DIR* dir = os::opendir(path);
+  if (dir != NULL) {
+    jio_fprintf(defaultStream::output_stream(),
+      "<JAVA_HOME>/lib/endorsed is not supported. Endorsed standards and standalone APIs\n"
+      "in modular form will be supported via the concept of upgradeable modules.\n");
+    os::closedir(dir);
+    return JNI_ERR;
+  }
+
+  sprintf(path, "%s%slib%sext", Arguments::get_java_home(), fileSep, fileSep);
+  dir = os::opendir(path);
+  if (dir != NULL) {
+    jio_fprintf(defaultStream::output_stream(),
+      "<JAVA_HOME>/lib/ext exists, extensions mechanism no longer supported; "
+      "Use -classpath instead.\n.");
+    os::closedir(dir);
+    return JNI_ERR;
+  }
+
+  if (scp_assembly_required) {
     // Assemble the bootclasspath elements into the final path.
     Arguments::set_sysclasspath(scp_p->combined_path());
   }
diff --git a/hotspot/src/share/vm/runtime/arguments.hpp b/hotspot/src/share/vm/runtime/arguments.hpp
index 3c8ae0f5679..ae28c622ca2 100644
--- a/hotspot/src/share/vm/runtime/arguments.hpp
+++ b/hotspot/src/share/vm/runtime/arguments.hpp
@@ -254,8 +254,6 @@ class Arguments : AllStatic {
   static SystemProperty* _system_properties;
 
   // Quick accessor to System properties in the list:
-  static SystemProperty *_java_ext_dirs;
-  static SystemProperty *_java_endorsed_dirs;
   static SystemProperty *_sun_boot_library_path;
   static SystemProperty *_java_library_path;
   static SystemProperty *_java_home;
@@ -266,6 +264,10 @@ class Arguments : AllStatic {
   static char* _meta_index_path;
   static char* _meta_index_dir;
 
+  // temporary: to emit warning if the default ext dirs are not empty.
+  // remove this variable when the warning is no longer needed.
+  static char* _ext_dirs;
+
   // java.vendor.url.bug, bug reporting URL for fatal errors.
   static const char* _java_vendor_url_bug;
 
@@ -586,8 +588,7 @@ class Arguments : AllStatic {
   static void set_dll_dir(char *value) { _sun_boot_library_path->set_value(value); }
   static void set_java_home(char *value) { _java_home->set_value(value); }
   static void set_library_path(char *value) { _java_library_path->set_value(value); }
-  static void set_ext_dirs(char *value) { _java_ext_dirs->set_value(value); }
-  static void set_endorsed_dirs(char *value) { _java_endorsed_dirs->set_value(value); }
+  static void set_ext_dirs(char *value)     { _ext_dirs = os::strdup_check_oom(value); }
   static void set_sysclasspath(char *value) { _sun_boot_class_path->set_value(value); }
   static void append_sysclasspath(const char *value) { _sun_boot_class_path->append_value(value); }
   static void set_meta_index_path(char* meta_index_path, char* meta_index_dir) {
@@ -597,14 +598,14 @@ class Arguments : AllStatic {
 
   static char* get_java_home() { return _java_home->value(); }
   static char* get_dll_dir() { return _sun_boot_library_path->value(); }
-  static char* get_endorsed_dir() { return _java_endorsed_dirs->value(); }
   static char* get_sysclasspath() { return _sun_boot_class_path->value(); }
   static char* get_meta_index_path() { return _meta_index_path; }
   static char* get_meta_index_dir()  { return _meta_index_dir;  }
-  static char* get_ext_dirs() { return _java_ext_dirs->value(); }
+  static char* get_ext_dirs()        { return _ext_dirs;  }
   static char* get_appclasspath() { return _java_class_path->value(); }
   static void  fix_appclasspath();
 
+
   // Operation modi
   static Mode mode()                { return _mode; }
   static bool is_interpreter_only() { return mode() == _int; }
diff --git a/hotspot/src/share/vm/runtime/globals.hpp b/hotspot/src/share/vm/runtime/globals.hpp
index e74b9bbdf20..7e50e37468a 100644
--- a/hotspot/src/share/vm/runtime/globals.hpp
+++ b/hotspot/src/share/vm/runtime/globals.hpp
@@ -1233,6 +1233,9 @@ class CommandLineFlags {
   product(bool, CheckJNICalls, false,                                       \
           "Verify all arguments to JNI calls")                              \
                                                                             \
+  product(bool, CheckEndorsedAndExtDirs, false,                             \
+          "Verify the endorsed and extension directories are not used")     \
+                                                                            \
   product(bool, UseFastJNIAccessors, true,                                  \
           "Use optimized versions of Get<Primitive>Field")                  \
                                                                             \
diff --git a/hotspot/src/share/vm/runtime/os.cpp b/hotspot/src/share/vm/runtime/os.cpp
index 1e632f4d543..1de280900df 100644
--- a/hotspot/src/share/vm/runtime/os.cpp
+++ b/hotspot/src/share/vm/runtime/os.cpp
@@ -1230,11 +1230,21 @@ bool os::set_boot_path(char fileSep, char pathSep) {
   Arguments::set_meta_index_path(meta_index, meta_index_dir);
 
   char* sysclasspath = NULL;
+  struct stat st;
+
+  // modular image if bootmodules.jimage exists
+  char* jimage = format_boot_path("%/lib/modules/bootmodules.jimage", home, home_len, fileSep, pathSep);
+  if (jimage == NULL) return false;
+  bool has_jimage = (os::stat(jimage, &st) == 0);
+  if (has_jimage) {
+    Arguments::set_sysclasspath(jimage);
+    return true;
+  }
+  FREE_C_HEAP_ARRAY(char, jimage, mtInternal);
 
   // images build if rt.jar exists
   char* rt_jar = format_boot_path("%/lib/rt.jar", home, home_len, fileSep, pathSep);
   if (rt_jar == NULL) return false;
-  struct stat st;
   bool has_rt_jar = (os::stat(rt_jar, &st) == 0);
   FREE_C_HEAP_ARRAY(char, rt_jar, mtInternal);
 
diff --git a/hotspot/src/share/vm/runtime/os.hpp b/hotspot/src/share/vm/runtime/os.hpp
index fa15d25b6c6..e9ba0cc4b52 100644
--- a/hotspot/src/share/vm/runtime/os.hpp
+++ b/hotspot/src/share/vm/runtime/os.hpp
@@ -500,6 +500,7 @@ class os: AllStatic {
   //File i/o operations
 
   static size_t read(int fd, void *buf, unsigned int nBytes);
+  static size_t read_at(int fd, void *buf, unsigned int nBytes, jlong offset);
   static size_t restartable_read(int fd, void *buf, unsigned int nBytes);
   static size_t write(int fd, const void *buf, unsigned int nBytes);
 
diff --git a/hotspot/src/share/vm/runtime/statSampler.cpp b/hotspot/src/share/vm/runtime/statSampler.cpp
index 55fda6fb3f9..1e91e8fdecf 100644
--- a/hotspot/src/share/vm/runtime/statSampler.cpp
+++ b/hotspot/src/share/vm/runtime/statSampler.cpp
@@ -225,8 +225,6 @@ static const char* property_counters_ss[] = {
   "java.vm.info",
   "java.library.path",
   "java.class.path",
-  "java.endorsed.dirs",
-  "java.ext.dirs",
   "java.version",
   "java.home",
   NULL

From 3c5c554fadd3cfa8b7811959ed2897cb0f2559d9 Mon Sep 17 00:00:00 2001
From: Chris Hegarty <chegar@openjdk.org>
Date: Wed, 3 Dec 2014 14:22:17 +0000
Subject: [PATCH 212/299] 8049367: Modular Run-Time Images

Co-authored-by: Alan Bateman <alan.bateman@oracle.com>
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Bradford Wetmore <bradford.wetmore@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Magnus Ihse Bursie <magnus.ihse.bursie@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Paul Sandoz <paul.sandoz@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: chegar, dfuchs, ihse, joehw, mullan, psandoz, wetmore
---
 .../apache/bcel/internal/util/ClassPath.java  | 22 ++-----------------
 .../xalan/internal/utils/SecuritySupport.java | 13 ++++++-----
 .../xalan/internal/xslt/EnvironmentCheck.java | 17 --------------
 .../jaxp/datatype/DatatypeFactoryImpl.java    |  2 +-
 .../internal/utils/SecuritySupport.java       | 13 ++++++-----
 .../share/classes/javax/xml/XMLConstants.java |  6 ++---
 .../javax/xml/datatype/DatatypeFactory.java   |  2 +-
 .../javax/xml/datatype/FactoryFinder.java     | 10 ++++-----
 .../xml/parsers/DocumentBuilderFactory.java   |  2 +-
 .../javax/xml/parsers/FactoryFinder.java      | 10 ++++-----
 .../javax/xml/parsers/SAXParserFactory.java   |  2 +-
 .../javax/xml/stream/FactoryFinder.java       |  8 +++----
 .../javax/xml/transform/FactoryFinder.java    | 10 ++++-----
 .../xml/transform/TransformerFactory.java     |  2 +-
 .../javax/xml/validation/SchemaFactory.java   |  2 +-
 .../xml/validation/SchemaFactoryFinder.java   |  6 ++---
 .../classes/javax/xml/xpath/XPathFactory.java |  2 +-
 .../javax/xml/xpath/XPathFactoryFinder.java   |  6 ++---
 18 files changed, 53 insertions(+), 82 deletions(-)

diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassPath.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassPath.java
index ac4745ea97f..1c89a1049c9 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassPath.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/bcel/internal/util/ClassPath.java
@@ -151,18 +151,17 @@ public class ClassPath implements Serializable {
   }
 
   /** Checks for class path components in the following properties:
-   * "java.class.path", "sun.boot.class.path", "java.ext.dirs"
+   * "java.class.path", "sun.boot.class.path"
    *
    * @return class path as used by default by BCEL
    */
   public static final String getClassPath() {
 
-    String class_path, boot_path, ext_path;
+    String class_path, boot_path;
 
     try {
       class_path = SecuritySupport.getSystemProperty("java.class.path");
       boot_path  = SecuritySupport.getSystemProperty("sun.boot.class.path");
-      ext_path   = SecuritySupport.getSystemProperty("java.ext.dirs");
     }
     catch (SecurityException e) {
         return "";
@@ -173,23 +172,6 @@ public class ClassPath implements Serializable {
     getPathComponents(class_path, list);
     getPathComponents(boot_path, list);
 
-    ArrayList dirs = new ArrayList();
-    getPathComponents(ext_path, dirs);
-
-    for(Iterator e = dirs.iterator(); e.hasNext(); ) {
-      File ext_dir = new File((String)e.next());
-      String[] extensions = SecuritySupport.getFileList(ext_dir, new FilenameFilter() {
-        public boolean accept(File dir, String name) {
-          name = name.toLowerCase();
-          return name.endsWith(".zip") || name.endsWith(".jar");
-        }
-      });
-
-      if(extensions != null)
-        for(int i=0; i < extensions.length; i++)
-          list.add(ext_path + File.separatorChar + extensions[i]);
-    }
-
     StringBuffer buf = new StringBuffer();
 
     for(Iterator e = list.iterator(); e.hasNext(); ) {
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
index e581f9a5b40..71570d68d08 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/utils/SecuritySupport.java
@@ -243,6 +243,9 @@ public final class SecuritySupport {
             if (protocol.equalsIgnoreCase("jar")) {
                 String path = url.getPath();
                 protocol = path.substring(0, path.indexOf(":"));
+            } else if (protocol.equalsIgnoreCase("jrt")) {
+                // if the systemId is "jrt" then allow access if "file" allowed
+                protocol = "file";
             }
         }
 
@@ -278,7 +281,7 @@ public final class SecuritySupport {
 
     /**
      * Read JAXP system property in this order: system property,
-     * $java.home/lib/jaxp.properties if the system property is not specified
+     * $java.home/conf/jaxp.properties if the system property is not specified
      *
      * @param propertyId the Id of the property
      * @return the value of the property
@@ -292,7 +295,7 @@ public final class SecuritySupport {
     }
 
     /**
-     * Read from $java.home/lib/jaxp.properties for the specified property
+     * Read from $java.home/conf/jaxp.properties for the specified property
      * The program
      *
      * @param propertyId the Id of the property
@@ -306,7 +309,7 @@ public final class SecuritySupport {
                 synchronized (cacheProps) {
                     if (firstTime) {
                         String configFile = getSystemProperty("java.home") + File.separator +
-                            "lib" + File.separator + "jaxp.properties";
+                            "conf" + File.separator + "jaxp.properties";
                         File f = new File(configFile);
                         if (getFileExists(f)) {
                             is = getFileInputStream(f);
@@ -332,12 +335,12 @@ public final class SecuritySupport {
     }
 
     /**
-     * Cache for properties in java.home/lib/jaxp.properties
+     * Cache for properties in java.home/conf/jaxp.properties
      */
     static final Properties cacheProps = new Properties();
 
     /**
-     * Flag indicating if the program has tried reading java.home/lib/jaxp.properties
+     * Flag indicating if the program has tried reading java.home/conf/jaxp.properties
      */
     static volatile boolean firstTime = true;
 
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java
index a6b99891be4..6696d64447c 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xslt/EnvironmentCheck.java
@@ -558,9 +558,6 @@ public class EnvironmentCheck
    * Logs java.class.path and other likely paths; then attempts
    * to search those paths for .jar files with Xalan-related classes.
    *
-   * //@todo NOTE: We don't actually search java.ext.dirs for
-   * //  *.jar files therein! This should be updated
-   *
    * @param h Hashtable to put information in
    * @see #jarNames
    * @see #checkPathForJars(String, String[])
@@ -615,20 +612,6 @@ public class EnvironmentCheck
           h.put(FOUNDCLASSES + "sun.boot.class.path", classpathJars);
       }
 
-      //@todo NOTE: We don't actually search java.ext.dirs for
-      //  *.jar files therein! This should be updated
-      othercp = SecuritySupport.getSystemProperty("java.ext.dirs");
-
-      if (null != othercp)
-      {
-        h.put("java.ext.dirs", othercp);
-
-        classpathJars = checkPathForJars(othercp, jarNames);
-
-        if (null != classpathJars)
-          h.put(FOUNDCLASSES + "java.ext.dirs", classpathJars);
-      }
-
       //@todo also check other System properties' paths?
       //  v2 = checkPathForJars(System.getProperty("sun.boot.library.path"), jarNames);   // ?? may not be needed
       //  v3 = checkPathForJars(System.getProperty("java.library.path"), jarNames);   // ?? may not be needed
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java
index aa993a299c5..a9baeac29ef 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/DatatypeFactoryImpl.java
@@ -41,7 +41,7 @@ import javax.xml.datatype.XMLGregorianCalendar;
  *      Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
  *    </li>
  *    <li>
- *      If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
+ *      If the file ${JAVA_HOME}/conf/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
  *      The <code>Properties</code> <code>Object </code> is then queried for the property as documented in the prior step
  *      and processed as documented in the prior step.
  *    </li>
diff --git a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java
index 613d651594f..c25e552c4ff 100644
--- a/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java
+++ b/jaxp/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/utils/SecuritySupport.java
@@ -237,6 +237,9 @@ public final class SecuritySupport {
             if (protocol.equalsIgnoreCase("jar")) {
                 String path = url.getPath();
                 protocol = path.substring(0, path.indexOf(":"));
+            } else if (protocol.equalsIgnoreCase("jrt")) {
+                // if the systemId is "jrt" then allow access if "file" allowed
+                protocol = "file";
             }
         }
 
@@ -272,7 +275,7 @@ public final class SecuritySupport {
 
     /**
      * Read JAXP system property in this order: system property,
-     * $java.home/lib/jaxp.properties if the system property is not specified
+     * $java.home/conf/jaxp.properties if the system property is not specified
      *
      * @param propertyId the Id of the property
      * @return the value of the property
@@ -286,7 +289,7 @@ public final class SecuritySupport {
     }
 
      /**
-     * Read from $java.home/lib/jaxp.properties for the specified property
+     * Read from $java.home/conf/jaxp.properties for the specified property
      * The program
      *
      * @param propertyId the Id of the property
@@ -300,7 +303,7 @@ public final class SecuritySupport {
                 synchronized (cacheProps) {
                     if (firstTime) {
                         String configFile = getSystemProperty("java.home") + File.separator +
-                            "lib" + File.separator + "jaxp.properties";
+                            "conf" + File.separator + "jaxp.properties";
                         File f = new File(configFile);
                         if (getFileExists(f)) {
                             is = getFileInputStream(f);
@@ -326,12 +329,12 @@ public final class SecuritySupport {
     }
 
    /**
-     * Cache for properties in java.home/lib/jaxp.properties
+     * Cache for properties in java.home/conf/jaxp.properties
      */
     static final Properties cacheProps = new Properties();
 
     /**
-     * Flag indicating if the program has tried reading java.home/lib/jaxp.properties
+     * Flag indicating if the program has tried reading java.home/conf/jaxp.properties
      */
     static volatile boolean firstTime = true;
 
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java b/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java
index 70b8bdfa812..4cb5800200d 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/XMLConstants.java
@@ -247,7 +247,7 @@ public final class XMLConstants {
          * </p>
          *
          * <p>
-         * <b>${JAVA_HOME}/lib/jaxp.properties:</b> This configuration file is in standard
+         * <b>${JAVA_HOME}/conf/jaxp.properties:</b> This configuration file is in standard
          * {@link java.util.Properties} format. If the file exists and the system property is specified,
          * its value will be used to override the default of the property.
          * </p>
@@ -314,7 +314,7 @@ public final class XMLConstants {
          * </p>
          *
          * <p>
-         * <b>${JAVA_HOME}/lib/jaxp.properties:</b> This configuration file is in standard
+         * <b>${JAVA_HOME}/conf/jaxp.properties:</b> This configuration file is in standard
          * java.util.Properties format. If the file exists and the system property is specified,
          * its value will be used to override the default of the property.
          *
@@ -380,7 +380,7 @@ public final class XMLConstants {
          * </p>
          *
          * <p>
-         * <b>${JAVA_HOME}/lib/jaxp.properties: </b> This configuration file is in standard
+         * <b>${JAVA_HOME}/conf/jaxp.properties: </b> This configuration file is in standard
          * java.util.Properties format. If the file exists and the system property is specified,
          * its value will be used to override the default of the property.
          *
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java
index 0a96c5760ef..de6050ac4e8 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/DatatypeFactory.java
@@ -43,7 +43,7 @@ import java.util.regex.Pattern;
  *      Any Exception thrown during the instantiation process is wrapped as a {@link DatatypeConfigurationException}.
  *    </li>
  *    <li>
- *      If the file ${JAVA_HOME}/lib/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
+ *      If the file ${JAVA_HOME}/conf/jaxp.properties exists, it is loaded in a {@link java.util.Properties} <code>Object</code>.
  *      The <code>Properties</code> <code>Object </code> is then queried for the property as documented in the prior step
  *      and processed as documented in the prior step.
  *    </li>
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java
index ce982157240..72ee2e55c77 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/datatype/FactoryFinder.java
@@ -50,12 +50,12 @@ class FactoryFinder {
     private static boolean debug = false;
 
     /**
-     * Cache for properties in java.home/lib/jaxp.properties
+     * Cache for properties in java.home/conf/jaxp.properties
      */
     private final static Properties cacheProps = new Properties();
 
     /**
-     * Flag indicating if properties from java.home/lib/jaxp.properties
+     * Flag indicating if properties from java.home/conf/jaxp.properties
      * have been cached.
      */
     private static volatile boolean firstTime = true;
@@ -237,13 +237,13 @@ class FactoryFinder {
             if (debug) se.printStackTrace();
         }
 
-        // try to read from $java.home/lib/jaxp.properties
+        // try to read from $java.home/conf/jaxp.properties
         try {
             if (firstTime) {
                 synchronized (cacheProps) {
                     if (firstTime) {
                         String configFile = ss.getSystemProperty("java.home") + File.separator +
-                            "lib" + File.separator + "jaxp.properties";
+                            "conf" + File.separator + "jaxp.properties";
                         File f = new File(configFile);
                         firstTime = false;
                         if (ss.doesFileExist(f)) {
@@ -256,7 +256,7 @@ class FactoryFinder {
             final String factoryClassName = cacheProps.getProperty(factoryId);
 
             if (factoryClassName != null) {
-                dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
+                dPrint("found in ${java.home}/conf/jaxp.properties, value=" + factoryClassName);
                 return newInstance(type, factoryClassName, null, true);
             }
         }
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java
index 0625b850986..62bd3bd27c0 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/parsers/DocumentBuilderFactory.java
@@ -66,7 +66,7 @@ public abstract class DocumentBuilderFactory {
      * property.
      * </li>
      * <li>
-     * Use the properties file "lib/jaxp.properties" in the JRE directory.
+     * Use the properties file "conf/jaxp.properties" in the JRE directory.
      * This configuration file is in standard <code>java.util.Properties
      * </code> format and contains the fully qualified name of the
      * implementation class with the key being the system property defined
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java
index 9e186f512ef..e17b4dd147c 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/parsers/FactoryFinder.java
@@ -50,12 +50,12 @@ class FactoryFinder {
     private static boolean debug = false;
 
     /**
-     * Cache for properties in java.home/lib/jaxp.properties
+     * Cache for properties in java.home/conf/jaxp.properties
      */
     private static final Properties cacheProps = new Properties();
 
     /**
-     * Flag indicating if properties from java.home/lib/jaxp.properties
+     * Flag indicating if properties from java.home/conf/jaxp.properties
      * have been cached.
      */
     static volatile boolean firstTime = true;
@@ -236,13 +236,13 @@ class FactoryFinder {
             if (debug) se.printStackTrace();
         }
 
-        // try to read from $java.home/lib/jaxp.properties
+        // try to read from $java.home/conf/jaxp.properties
         try {
             if (firstTime) {
                 synchronized (cacheProps) {
                     if (firstTime) {
                         String configFile = ss.getSystemProperty("java.home") + File.separator +
-                            "lib" + File.separator + "jaxp.properties";
+                            "conf" + File.separator + "jaxp.properties";
                         File f = new File(configFile);
                         firstTime = false;
                         if (ss.doesFileExist(f)) {
@@ -255,7 +255,7 @@ class FactoryFinder {
             final String factoryClassName = cacheProps.getProperty(factoryId);
 
             if (factoryClassName != null) {
-                dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
+                dPrint("found in ${java.home}/conf/jaxp.properties, value=" + factoryClassName);
                 return newInstance(type, factoryClassName, null, true);
             }
         }
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java
index 7de367e702e..f2e9120a02f 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/parsers/SAXParserFactory.java
@@ -70,7 +70,7 @@ public abstract class SAXParserFactory {
      * property.
      * </li>
      * <li>
-     * Use the properties file "lib/jaxp.properties" in the JRE directory.
+     * Use the properties file "conf/jaxp.properties" in the JRE directory.
      * This configuration file is in standard <code>java.util.Properties
      * </code> format and contains the fully qualified name of the
      * implementation class with the key being the system property defined
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java
index f34d0f8bda1..c9c4a08dc43 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/stream/FactoryFinder.java
@@ -51,12 +51,12 @@ class FactoryFinder {
     private static boolean debug = false;
 
     /**
-     * Cache for properties in java.home/lib/jaxp.properties
+     * Cache for properties in java.home/conf/jaxp.properties
      */
     final private static Properties cacheProps = new Properties();
 
     /**
-     * Flag indicating if properties from java.home/lib/jaxp.properties
+     * Flag indicating if properties from java.home/conf/jaxp.properties
      * have been cached.
      */
     private static volatile boolean firstTime = true;
@@ -271,7 +271,7 @@ class FactoryFinder {
         }
 
         // Try read $java.home/lib/stax.properties followed by
-        // $java.home/lib/jaxp.properties if former not present
+        // $java.home/conf/jaxp.properties if former not present
         String configFile = null;
         try {
             if (firstTime) {
@@ -287,7 +287,7 @@ class FactoryFinder {
                         }
                         else {
                             configFile = ss.getSystemProperty("java.home") + File.separator +
-                                "lib" + File.separator + "jaxp.properties";
+                                "conf" + File.separator + "jaxp.properties";
                             f = new File(configFile);
                             if (ss.doesFileExist(f)) {
                                 dPrint("Read properties file "+f);
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java
index 4ae6568aa57..25772307027 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/FactoryFinder.java
@@ -53,12 +53,12 @@ class FactoryFinder {
     private static boolean debug = false;
 
     /**
-     * Cache for properties in java.home/lib/jaxp.properties
+     * Cache for properties in java.home/conf/jaxp.properties
      */
     private final static Properties cacheProps = new Properties();
 
     /**
-     * Flag indicating if properties from java.home/lib/jaxp.properties
+     * Flag indicating if properties from java.home/conf/jaxp.properties
      * have been cached.
      */
     static volatile boolean firstTime = true;
@@ -268,13 +268,13 @@ class FactoryFinder {
             if (debug) se.printStackTrace();
         }
 
-        // try to read from $java.home/lib/jaxp.properties
+        // try to read from $java.home/conf/jaxp.properties
         try {
             if (firstTime) {
                 synchronized (cacheProps) {
                     if (firstTime) {
                         String configFile = ss.getSystemProperty("java.home") + File.separator +
-                            "lib" + File.separator + "jaxp.properties";
+                            "conf" + File.separator + "jaxp.properties";
                         File f = new File(configFile);
                         firstTime = false;
                         if (ss.doesFileExist(f)) {
@@ -287,7 +287,7 @@ class FactoryFinder {
             final String factoryClassName = cacheProps.getProperty(factoryId);
 
             if (factoryClassName != null) {
-                dPrint("found in $java.home/jaxp.properties, value=" + factoryClassName);
+                dPrint("found in ${java.home}/conf/jaxp.properties, value=" + factoryClassName);
                 return newInstance(type, factoryClassName, null, true, true);
             }
         }
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java
index cde66def0ea..846cda11048 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/transform/TransformerFactory.java
@@ -62,7 +62,7 @@ public abstract class TransformerFactory {
      * property.
      * </li>
      * <li>
-     * Use the properties file "lib/jaxp.properties" in the JRE directory.
+     * Use the properties file "conf/jaxp.properties" in the JRE directory.
      * This configuration file is in standard <code>java.util.Properties
      * </code> format and contains the fully qualified name of the
      * implementation class with the key being the system property defined
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
index 2701b1908f4..527c6c73a02 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactory.java
@@ -141,7 +141,7 @@ public abstract class SchemaFactory {
      *     and returns it if it is successfully created.
      *   </li>
      *   <li>
-     *     <code>$java.home/lib/jaxp.properties</code> is read and
+     *     <code>$java.home/conf/jaxp.properties</code> is read and
      *     the value associated with the key being the system property above
      *     is looked for. If present, the value is processed just like above.
      *   </li>
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java
index 16b84f636bd..91737274f18 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/validation/SchemaFactoryFinder.java
@@ -181,10 +181,10 @@ class SchemaFactoryFinder  {
 
         String javah = ss.getSystemProperty( "java.home" );
         String configFile = javah + File.separator +
-        "lib" + File.separator + "jaxp.properties";
+        "conf" + File.separator + "jaxp.properties";
 
 
-        // try to read from $java.home/lib/jaxp.properties
+        // try to read from $java.home/conf/jaxp.properties
         try {
             if(firstTime){
                 synchronized(cacheProps){
@@ -199,7 +199,7 @@ class SchemaFactoryFinder  {
                 }
             }
             final String factoryClassName = cacheProps.getProperty(propertyName);
-            debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
+            debugPrintln("found " + factoryClassName + " in $java.home/conf/jaxp.properties");
 
             if (factoryClassName != null) {
                 sf = createInstance(factoryClassName, true);
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java
index ea7370e06e7..ce2074b19a3 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactory.java
@@ -117,7 +117,7 @@ public abstract class XPathFactory {
     *     and returns it if it is successfully created.
     *   </li>
     *   <li>
-    *     ${java.home}/lib/jaxp.properties is read and the value associated with the key being the system property above is looked for.
+    *     ${java.home}/conf/jaxp.properties is read and the value associated with the key being the system property above is looked for.
     *     If present, the value is processed just like above.
     *   </li>
     *   <li>
diff --git a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java
index bceeda854e8..282f0b05d61 100644
--- a/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java
+++ b/jaxp/src/java.xml/share/classes/javax/xml/xpath/XPathFactoryFinder.java
@@ -176,9 +176,9 @@ class XPathFactoryFinder  {
 
         String javah = ss.getSystemProperty( "java.home" );
         String configFile = javah + File.separator +
-        "lib" + File.separator + "jaxp.properties";
+        "conf" + File.separator + "jaxp.properties";
 
-        // try to read from $java.home/lib/jaxp.properties
+        // try to read from $java.home/conf/jaxp.properties
         try {
             if(firstTime){
                 synchronized(cacheProps){
@@ -193,7 +193,7 @@ class XPathFactoryFinder  {
                 }
             }
             final String factoryClassName = cacheProps.getProperty(propertyName);
-            debugPrintln("found " + factoryClassName + " in $java.home/jaxp.properties");
+            debugPrintln("found " + factoryClassName + " in $java.home/conf/jaxp.properties");
 
             if (factoryClassName != null) {
                 xpathFactory = createInstance(factoryClassName, true);

From 441905cdc760ece9089741b104deb0c5727e7230 Mon Sep 17 00:00:00 2001
From: Chris Hegarty <chegar@openjdk.org>
Date: Wed, 3 Dec 2014 14:22:58 +0000
Subject: [PATCH 213/299] 8049367: Modular Run-Time Images

Co-authored-by: Alan Bateman <alan.bateman@oracle.com>
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Bradford Wetmore <bradford.wetmore@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Magnus Ihse Bursie <magnus.ihse.bursie@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Paul Sandoz <paul.sandoz@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: chegar, dfuchs, ihse, joehw, mullan, psandoz, wetmore
---
 jdk/make/Bundles.gmk                          | 137 ---
 jdk/make/CompileDemos.gmk                     | 134 +--
 jdk/make/CompileInterimRmic.gmk               |   4 +-
 jdk/make/CopySamples.gmk                      |   4 +-
 jdk/make/CreateJars.gmk                       | 795 ----------------
 jdk/make/CreateSecurityJars.gmk               | 195 ----
 jdk/make/Images.gmk                           | 782 ----------------
 jdk/make/Import.gmk                           | 164 +++-
 jdk/make/ProfileNames.gmk                     |  63 --
 jdk/make/Profiles.gmk                         | 324 -------
 jdk/make/Tools.gmk                            |  88 +-
 jdk/make/UnpackSecurity.gmk                   |  35 +-
 jdk/make/copy/Copy-java.base.gmk              |  34 +-
 jdk/make/copy/Copy-java.desktop.gmk           |  24 +-
 jdk/make/copy/Copy-java.logging.gmk           |  10 +-
 jdk/make/copy/Copy-java.management.gmk        |  22 +-
 jdk/make/copy/Copy-jdk.crypto.pkcs11.gmk      |  11 +-
 jdk/make/copy/Copy-jdk.crypto.ucrypto.gmk     |  11 +-
 jdk/make/copy/Copy-jdk.hprof.agent.gmk        |   8 +-
 jdk/make/copy/Copy-jdk.jdwp.agent.gmk         |   9 +-
 jdk/make/copy/CopyCommon.gmk                  |  10 +-
 jdk/make/gendata/Gendata-java.base.gmk        |  34 +-
 jdk/make/gendata/Gendata-java.desktop.gmk     |  10 -
 jdk/make/gendata/Gendata-jdk.dev.gmk          |  14 +-
 jdk/make/gendata/GendataBlacklistedCerts.gmk  |   4 +-
 jdk/make/gendata/GendataBreakIterator.gmk     |  24 +-
 jdk/make/gendata/GendataCommon.gmk            |   4 -
 jdk/make/gendata/GendataFontConfig.gmk        |   8 +-
 jdk/make/gendata/GendataHtml32dtd.gmk         |   4 +-
 .../GendataPolicyJars.gmk}                    |  61 +-
 jdk/make/gendata/GendataTZDB.gmk              |   6 +-
 jdk/make/gensrc/Gensrc-jdk.charsets.gmk       |   2 +-
 jdk/make/gensrc/Gensrc-jdk.dev.gmk            |   4 +-
 jdk/make/gensrc/Gensrc-jdk.jconsole.gmk       |   6 +-
 jdk/make/gensrc/Gensrc-jdk.jdi.gmk            |  42 +-
 jdk/make/gensrc/GensrcBuffer.gmk              |   5 +-
 jdk/make/gensrc/GensrcCLDR.gmk                |   4 +-
 jdk/make/gensrc/GensrcCharacterData.gmk       |  17 +-
 jdk/make/gensrc/GensrcCharsetCoder.gmk        |  11 +-
 jdk/make/gensrc/GensrcCharsetMapping.gmk      |   6 +-
 jdk/make/gensrc/GensrcExceptions.gmk          |   5 +-
 jdk/make/gensrc/GensrcIcons.gmk               |  14 +-
 jdk/make/gensrc/GensrcLocaleData.gmk          |  20 +-
 jdk/make/gensrc/GensrcMisc.gmk                |  44 +-
 jdk/make/gensrc/GensrcProperties.gmk          |  12 +-
 jdk/make/gensrc/GensrcSwing.gmk               |  46 +-
 jdk/make/gensrc/GensrcX11Wrappers.gmk         |  12 +-
 jdk/make/launcher/Launcher-java.base.gmk      |  36 +-
 jdk/make/launcher/Launcher-java.corba.gmk     |   6 -
 jdk/make/launcher/Launcher-java.desktop.gmk   |   5 -
 jdk/make/launcher/Launcher-java.rmi.gmk       |  12 +-
 jdk/make/launcher/Launcher-java.scripting.gmk |   5 -
 .../launcher/Launcher-java.security.jgss.gmk  |   5 -
 jdk/make/launcher/Launcher-jdk.compiler.gmk   |  21 +-
 jdk/make/launcher/Launcher-jdk.dev.gmk        |   8 +-
 .../launcher/Launcher-jdk.hotspot.agent.gmk   |   5 -
 jdk/make/launcher/Launcher-jdk.javadoc.gmk    |   5 -
 jdk/make/launcher/Launcher-jdk.jcmd.gmk       |   5 -
 jdk/make/launcher/Launcher-jdk.jconsole.gmk   |   5 -
 jdk/make/launcher/Launcher-jdk.jdi.gmk        |   5 -
 jdk/make/launcher/Launcher-jdk.jvmstat.gmk    |   5 -
 jdk/make/launcher/Launcher-jdk.rmic.gmk       |   5 -
 jdk/make/launcher/Launcher-jdk.runtime.gmk    |  34 +-
 .../Launcher-jdk.scripting.nashorn.gmk        |   5 -
 jdk/make/launcher/Launcher-jdk.xml.bind.gmk   |   5 -
 jdk/make/launcher/Launcher-jdk.xml.ws.gmk     |   5 -
 jdk/make/launcher/LauncherCommon.gmk          |  26 +-
 jdk/make/lib/Awt2dLibraries.gmk               | 110 ++-
 jdk/make/lib/CoreLibraries.gmk                |  62 +-
 jdk/make/lib/Lib-java.base.gmk                |   8 +-
 jdk/make/lib/Lib-java.desktop.gmk             |   6 -
 jdk/make/lib/Lib-java.instrument.gmk          |  26 +-
 jdk/make/lib/Lib-java.management.gmk          |  14 +-
 jdk/make/lib/Lib-java.prefs.gmk               |  12 +-
 jdk/make/lib/Lib-java.security.jgss.gmk       |  18 +-
 jdk/make/lib/Lib-java.smartcardio.gmk         |  12 +-
 jdk/make/lib/Lib-jdk.attach.gmk               |  14 +-
 jdk/make/lib/Lib-jdk.crypto.ec.gmk            |  10 +-
 jdk/make/lib/Lib-jdk.crypto.mscapi.gmk        |  10 +-
 jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk        |  12 +-
 jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk       |  11 +-
 jdk/make/lib/Lib-jdk.deploy.osx.gmk           |  29 +-
 jdk/make/lib/Lib-jdk.hprof.agent.gmk          |  14 +-
 jdk/make/lib/Lib-jdk.jdi.gmk                  |  12 +-
 jdk/make/lib/Lib-jdk.jdwp.agent.gmk           |  20 +-
 jdk/make/lib/Lib-jdk.runtime.gmk              |  26 +-
 jdk/make/lib/Lib-jdk.sctp.gmk                 |  16 +-
 jdk/make/lib/Lib-jdk.security.auth.gmk        |  14 +-
 jdk/make/lib/LibCommon.gmk                    |  50 +-
 jdk/make/lib/NetworkingLibraries.gmk          |   8 +-
 jdk/make/lib/NioLibraries.gmk                 |  10 +-
 jdk/make/lib/PlatformLibraries.gmk            |   8 +-
 jdk/make/lib/SoundLibraries.gmk               |  16 +-
 jdk/make/mapfiles/libjava/mapfile-vers        |   3 +
 jdk/make/mapfiles/libzip/mapfile-vers         |   1 +
 jdk/make/profile-includes.txt                 | 255 ------
 jdk/make/profile-rtjar-includes.txt           | 245 -----
 jdk/make/rmic/Rmic-java.management.gmk        |   4 +-
 jdk/make/rmic/RmicCommon.gmk                  |   6 +-
 .../build/tools/module/ImageBuilder.java      | 514 +++++++++++
 .../build/tools/module/ModuleArchive.java     | 240 +++++
 .../build/tools/module/ModulesXmlReader.java  |   3 -
 .../build/tools/module/ModulesXmlWriter.java  |   3 -
 .../classes/build/tools/module/boot.modules   |  35 +
 .../classes/build/tools/module/ext.modules    |   9 +
 .../J2DBench/src/j2dbench/ResultSet.java      |   2 -
 .../java.nio.file.spi.FileSystemProvider      |   1 +
 .../classes/com/sun/net/ssl/SSLSecurity.java  |   4 +-
 .../share/classes/java/lang/System.java       |   2 -
 .../java.base/share/classes/java/net/URL.java |  15 +
 .../java/nio/charset/spi/CharsetProvider.java |   3 +-
 .../classes/java/nio/file/FileSystems.java    |   2 +-
 .../share/classes/java/nio/file/Files.java    |   4 +-
 .../share/classes/java/security/Security.java |   2 +-
 .../share/classes/java/util/Currency.java     |   8 +-
 .../classes/java/util/ServiceLoader.java      |   6 +-
 .../classes/java/util/jar/Attributes.java     |  55 +-
 .../share/classes/java/util/jar/JarFile.java  |  53 +-
 .../javax/crypto/JceSecurityManager.java      |   5 +
 .../javax/crypto/ProviderVerifier.java        |   8 +
 .../classes/jdk/internal/jimage/Archive.java  |  65 ++
 .../jdk/internal/jimage/BasicImageReader.java | 239 +++++
 .../jdk/internal/jimage/BasicImageWriter.java | 300 ++++++
 .../jdk/internal/jimage/ImageFile.java        | 288 ++++++
 .../jdk/internal/jimage/ImageHeader.java      | 149 +++
 .../jdk/internal/jimage/ImageLocation.java    | 393 ++++++++
 .../jdk/internal/jimage/ImageModules.java     | 180 ++++
 .../jdk/internal/jimage/ImageReader.java      | 502 ++++++++++
 .../jdk/internal/jimage/ImageStream.java      | 194 ++++
 .../jdk/internal/jimage/ImageStrings.java     | 107 +++
 .../classes/jdk/internal/jimage/PReader.java  | 139 +++
 .../jdk/internal/jimage/PackageModuleMap.java |  62 ++
 .../classes/jdk/internal/jimage/Resource.java |  67 ++
 .../jdk/internal/jimage/UTF8String.java       | 264 ++++++
 .../jimage/concurrent/ConcurrentPReader.java  | 149 +++
 .../internal/jrtfs/JrtDirectoryStream.java    | 171 ++++
 .../internal/jrtfs/JrtFileAttributeView.java  | 168 ++++
 .../jdk/internal/jrtfs/JrtFileAttributes.java | 121 +++
 .../jdk/internal/jrtfs/JrtFileStore.java      |  98 ++
 .../jdk/internal/jrtfs/JrtFileSystem.java     | 535 +++++++++++
 .../internal/jrtfs/JrtFileSystemProvider.java | 272 ++++++
 .../classes/jdk/internal/jrtfs/JrtPath.java   | 855 ++++++++++++++++++
 .../classes/jdk/internal/jrtfs/JrtUtils.java  | 187 ++++
 .../jdk/internal/jrtfs/SystemImages.java      |  75 ++
 .../classes/jdk/internal/jrtfs/jrtfsviewer.js | 111 +++
 .../share/classes/jdk/internal/jrtfs/jrtls.js |  39 +
 .../classes/sun/misc/ExtensionDependency.java |   3 +
 .../share/classes/sun/misc/ExtensionInfo.java |   2 +
 .../misc/ExtensionInstallationException.java  |   3 +-
 .../misc/ExtensionInstallationProvider.java   |   2 +
 .../share/classes/sun/misc/JarFilter.java     |   2 +
 .../share/classes/sun/misc/Launcher.java      | 158 +---
 .../share/classes/sun/misc/URLClassPath.java  | 205 ++++-
 .../classes/sun/misc/Version.java.template    |   8 -
 .../share/classes/sun/net/NetProperties.java  |   2 +-
 .../sun/net/www/protocol/jrt/Handler.java     |  44 +
 .../jrt/JavaRuntimeURLConnection.java         | 158 ++++
 .../sun/security/jca/ProviderConfig.java      |   2 +-
 .../sun/security/provider/PolicyFile.java     |  26 +-
 .../sun/security/provider/PolicyParser.java   |  74 +-
 .../sun/util/logging/PlatformLogger.java      |   4 +-
 .../java.base/share/conf/security/java.policy |  31 +-
 .../share/conf/security/java.security         |  10 +-
 .../java.base/share/native/libjava/System.c   |   1 -
 .../java.base/share/native/libzip/zip_util.c  |  50 +
 .../java.base/share/native/libzip/zip_util.h  |   4 +
 .../native/libjava/ConcurrentPReader_md.c     |  66 ++
 .../windows/conf/security/java.policy         |   4 +-
 .../native/libjava/ConcurrentPReader_md.c     |  64 ++
 .../com/sun/media/sound/JDK13Services.java    |   2 +-
 .../sun/media/sound/JSSecurityManager.java    |   4 +-
 .../share/classes/java/awt/Toolkit.java       |   2 +-
 .../javax/imageio/spi/IIORegistry.java        |  10 +-
 .../classes/javax/sound/midi/MidiSystem.java  |   2 +-
 .../javax/sound/sampled/AudioSystem.java      |   2 +-
 .../share/classes/javax/swing/UIManager.java  |   6 +-
 .../swing/plaf/multi/doc-files/multi_tsc.html |   8 +-
 .../classes/java/util/logging/LogManager.java |   4 +-
 .../jmx/remote/security/FileLoginModule.java  |   4 +-
 .../security/JMXPluggableAuthenticator.java   |   2 +-
 .../share/classes/sun/management/Agent.java   |   4 +-
 .../jmxremote/ConnectorBootstrap.java         |   4 +-
 .../share/conf/jmxremote.access               |   8 +-
 .../share/conf/jmxremote.password.template    |   8 +-
 .../share/conf/management.properties          |   8 +-
 .../share/conf/snmp.acl.template              |  26 +-
 .../sun/naming/internal/ResourceManager.java  |  10 +-
 .../sun/naming/internal/VersionHelper.java    |   6 +-
 .../share/classes/javax/naming/Context.java   |   6 +-
 .../com/sun/tools/script/shell/Main.java      |   3 +-
 .../com/sun/tools/script/shell/init.js        |   0
 .../tools/script/shell/messages.properties    |   0
 .../javax/script/ScriptEngineManager.java     |   3 +-
 .../security/auth/kerberos/package-info.java  |   2 +-
 .../classes/sun/security/krb5/Config.java     |   4 +-
 .../share/classes/sun/security/ec/SunEC.java  |  11 +-
 .../com/oracle/security/ucrypto/Config.java   |   2 -
 .../classes/jdk/tools/jimage/JImageTask.java  | 596 ++++++++++++
 .../share/classes/jdk/tools/jimage/Main.java  |  50 +
 .../tools/jimage/resources/jimage.properties  |  45 +
 ...un.util.locale.provider.LocaleDataMetaInfo |   1 -
 ...un.util.locale.provider.LocaleDataMetaInfo |   1 +
 .../sun/rmi/rmic/BatchEnvironment.java        |  17 +-
 .../share/classes/sun/rmi/rmic/Main.java      |  21 +-
 .../classes/sun/rmi/rmic/RMIGenerator.java    |   4 +-
 .../sun/rmi/rmic/resources/rmic.properties    |   1 -
 .../classes/sun/tools/java/ClassFile.java     | 113 +--
 .../classes/sun/tools/java/ClassPath.java     | 353 ++++++--
 .../classes/sun/tools/java/FileClassFile.java | 109 +++
 .../classes/sun/tools/java/PathClassFile.java | 111 +++
 .../classes/sun/tools/java/ZipClassFile.java  | 110 +++
 .../sun/tools/javac/BatchEnvironment.java     |  36 +-
 .../share/classes/sun/tools/javac/Main.java   |  17 +-
 .../sample/share/jmx/jmx-scandir/index.html   | 662 +++++++-------
 .../jmx/jmx-scandir/src/etc/access.properties |  12 +-
 .../jmx-scandir/src/etc/management.properties |  62 +-
 .../jmx-scandir/src/etc/password.properties   |   8 +-
 jdk/test/ProblemList.txt                      |  41 +-
 jdk/test/TEST.groups                          |   2 +
 .../java/lang/ClassLoader/EndorsedDirs.java   |  82 ++
 jdk/test/java/lang/ClassLoader/ExtDirs.java   |  82 ++
 .../java/lang/ClassLoader/getdotresource.sh   |  19 +-
 .../SecurityManager/CheckPackageAccess.java   |   2 +
 jdk/test/java/lang/invoke/lambda/LUtils.java  |   4 +-
 .../java/net/NetworkInterface/IPv4Only.java   |   4 +-
 jdk/test/java/nio/charset/spi/basic.sh        |  16 +-
 .../Security/ClassLoaderDeadlock/Deadlock2.sh |   9 +-
 .../java/util/Properties/LoadAndStoreXML.java |   2 +-
 jdk/test/java/util/ServiceLoader/basic.sh     |  21 +-
 jdk/test/java/util/prefs/PrefsSpi.sh          |   3 -
 .../sanity/CheckManifestForRelease.java       | 123 ---
 .../jdk/internal/jimage/VerifyJimage.java     | 234 +++++
 jdk/test/jdk/internal/jrtfs/Basic.java        | 459 ++++++++++
 jdk/test/jdk/internal/jrtfs/PathOps.java      | 458 ++++++++++
 .../internal/jrtfs/WithSecurityManager.java   |  77 ++
 jdk/test/jdk/internal/jrtfs/java.policy       |   3 +
 jdk/test/jdk/nio/zipfs/Basic.java             |  32 +-
 jdk/test/jdk/nio/zipfs/PathOps.java           |  22 +-
 jdk/test/jdk/nio/zipfs/Utils.java             |  61 ++
 jdk/test/jdk/nio/zipfs/ZipFSTester.java       |  63 +-
 .../security/java.policy/Ext_AllPolicy.java   |  53 --
 .../lib/security/java.policy/Ext_AllPolicy.sh |  89 --
 jdk/test/lib/security/java.policy/test.policy |   3 -
 .../jmxremote/bootstrap/RmiBootstrapTest.java |   6 +-
 .../bootstrap/RmiSslNoKeyStoreTest.java       |   6 +-
 .../bootstrap/rmiregistry.properties          |  62 +-
 .../bootstrap/rmiregistryssl.properties       |  62 +-
 .../net/www/protocol/jar/getcontenttype.sh    |  18 +-
 jdk/test/sun/net/www/protocol/jrt/Basic.java  | 113 +++
 .../www/protocol/jrt/WithSecurityManager.java |  64 ++
 jdk/test/sun/net/www/protocol/jrt/java.policy |   3 +
 .../rmi/rmic/RMIGenerator/RmicDefault.java    |   6 -
 .../rmi/rmic/classpath/RMICClassPathTest.java |   3 +-
 .../sun/rmi/rmic/manifestClassPath/run.sh     |  13 -
 jdk/test/sun/tools/java/CFCTest.java          |   2 +-
 .../sun/tools/jconsole/ResourceCheckTest.java |   6 +-
 .../sun/tools/jconsole/ResourceCheckTest.sh   | 112 ---
 .../resources/ImmutableResourceTest.java      |   6 +-
 .../resources/ImmutableResourceTest.sh        | 114 ---
 jdk/test/tools/jar/LeadingGarbage.java        |   3 +-
 jdk/test/tools/launcher/VersionCheck.java     |   6 +
 jdk/test/tools/pack200/CommandLineTests.java  |   3 +-
 jdk/test/tools/pack200/Pack200Props.java      |   6 +-
 jdk/test/tools/pack200/Pack200Test.java       |   5 +-
 .../tools/pack200/PackageVersionTest.java     |   4 -
 jdk/test/tools/pack200/T7007157.java          |   5 +-
 jdk/test/tools/pack200/Utils.java             |  70 +-
 .../src/sun/tools/pack/verify/Globals.java    |   1 -
 268 files changed, 11792 insertions(+), 5531 deletions(-)
 delete mode 100644 jdk/make/Bundles.gmk
 delete mode 100644 jdk/make/CreateJars.gmk
 delete mode 100644 jdk/make/CreateSecurityJars.gmk
 delete mode 100644 jdk/make/Images.gmk
 delete mode 100644 jdk/make/ProfileNames.gmk
 delete mode 100644 jdk/make/Profiles.gmk
 rename jdk/make/{CreatePolicyJars.gmk => gendata/GendataPolicyJars.gmk} (74%)
 delete mode 100644 jdk/make/profile-includes.txt
 delete mode 100644 jdk/make/profile-rtjar-includes.txt
 create mode 100644 jdk/make/src/classes/build/tools/module/ImageBuilder.java
 create mode 100644 jdk/make/src/classes/build/tools/module/ModuleArchive.java
 create mode 100644 jdk/make/src/classes/build/tools/module/boot.modules
 create mode 100644 jdk/make/src/classes/build/tools/module/ext.modules
 create mode 100644 jdk/src/java.base/share/classes/META-INF/services/java.nio.file.spi.FileSystemProvider
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jimage/Archive.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageWriter.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jimage/ImageFile.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jimage/ImageHeader.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jimage/ImageLocation.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jimage/ImageModules.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStream.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStrings.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jimage/PReader.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jimage/PackageModuleMap.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jimage/Resource.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jimage/UTF8String.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jimage/concurrent/ConcurrentPReader.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtDirectoryStream.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileAttributeView.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileAttributes.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileStore.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystemProvider.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtUtils.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jrtfs/SystemImages.java
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jrtfs/jrtfsviewer.js
 create mode 100644 jdk/src/java.base/share/classes/jdk/internal/jrtfs/jrtls.js
 create mode 100644 jdk/src/java.base/share/classes/sun/net/www/protocol/jrt/Handler.java
 create mode 100644 jdk/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java
 create mode 100644 jdk/src/java.base/unix/native/libjava/ConcurrentPReader_md.c
 create mode 100644 jdk/src/java.base/windows/native/libjava/ConcurrentPReader_md.c
 rename jdk/src/{jdk.dev => java.scripting}/share/classes/com/sun/tools/script/shell/Main.java (99%)
 rename jdk/src/{jdk.dev => java.scripting}/share/classes/com/sun/tools/script/shell/init.js (100%)
 rename jdk/src/{jdk.dev => java.scripting}/share/classes/com/sun/tools/script/shell/messages.properties (100%)
 create mode 100644 jdk/src/jdk.dev/share/classes/jdk/tools/jimage/JImageTask.java
 create mode 100644 jdk/src/jdk.dev/share/classes/jdk/tools/jimage/Main.java
 create mode 100644 jdk/src/jdk.dev/share/classes/jdk/tools/jimage/resources/jimage.properties
 delete mode 100644 jdk/src/jdk.localedata/META-INF/localedata-services/sun.util.locale.provider.LocaleDataMetaInfo
 rename jdk/src/jdk.localedata/{META-INF/cldrdata-services => share/classes/META-INF/services}/sun.util.locale.provider.LocaleDataMetaInfo (51%)
 create mode 100644 jdk/src/jdk.rmic/share/classes/sun/tools/java/FileClassFile.java
 create mode 100644 jdk/src/jdk.rmic/share/classes/sun/tools/java/PathClassFile.java
 create mode 100644 jdk/src/jdk.rmic/share/classes/sun/tools/java/ZipClassFile.java
 create mode 100644 jdk/test/java/lang/ClassLoader/EndorsedDirs.java
 create mode 100644 jdk/test/java/lang/ClassLoader/ExtDirs.java
 delete mode 100644 jdk/test/javax/crypto/sanity/CheckManifestForRelease.java
 create mode 100644 jdk/test/jdk/internal/jimage/VerifyJimage.java
 create mode 100644 jdk/test/jdk/internal/jrtfs/Basic.java
 create mode 100644 jdk/test/jdk/internal/jrtfs/PathOps.java
 create mode 100644 jdk/test/jdk/internal/jrtfs/WithSecurityManager.java
 create mode 100644 jdk/test/jdk/internal/jrtfs/java.policy
 create mode 100644 jdk/test/jdk/nio/zipfs/Utils.java
 delete mode 100644 jdk/test/lib/security/java.policy/Ext_AllPolicy.java
 delete mode 100644 jdk/test/lib/security/java.policy/Ext_AllPolicy.sh
 delete mode 100644 jdk/test/lib/security/java.policy/test.policy
 create mode 100644 jdk/test/sun/net/www/protocol/jrt/Basic.java
 create mode 100644 jdk/test/sun/net/www/protocol/jrt/WithSecurityManager.java
 create mode 100644 jdk/test/sun/net/www/protocol/jrt/java.policy
 delete mode 100644 jdk/test/sun/tools/jconsole/ResourceCheckTest.sh
 delete mode 100644 jdk/test/sun/tools/native2ascii/resources/ImmutableResourceTest.sh

diff --git a/jdk/make/Bundles.gmk b/jdk/make/Bundles.gmk
deleted file mode 100644
index 470a1e9bfb5..00000000000
--- a/jdk/make/Bundles.gmk
+++ /dev/null
@@ -1,137 +0,0 @@
-#
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-include $(SPEC)
-include MakeBase.gmk
-
-default: bundles
-
-# Only macosx has bundles defined.
-ifeq ($(OPENJDK_TARGET_OS), macosx)
-
-  bundles: jre-bundle jdk-bundle
-
-  # JDK_BUNDLE_DIR and JRE_BUNDLE_DIR are defined in SPEC.
-
-  MACOSX_PLIST_SRC := $(JDK_TOPDIR)/make/data/bundle
-
-  # All these OPENJDK checks are needed since there is no coherency between
-  # these values in open and closed. Should probably be fixed.
-  ifndef OPENJDK
-    BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(JDK_MINOR_VERSION)u$(JDK_UPDATE_VERSION)
-  else
-    BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE)
-  endif
-  BUNDLE_ID_JRE := $(BUNDLE_ID).jre
-  BUNDLE_ID_JDK := $(BUNDLE_ID).jdk
-
-  BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_MINOR_VERSION)
-  BUNDLE_NAME_JRE := $(BUNDLE_NAME)
-  BUNDLE_NAME_JDK := $(BUNDLE_NAME)
-
-  ifndef OPENJDK
-    BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(JDK_VERSION)
-  else
-    BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) ($(JDK_VERSION))
-  endif
-  BUNDLE_INFO_JRE := $(BUNDLE_INFO)
-  BUNDLE_INFO_JDK := $(BUNDLE_INFO)
-
-  BUNDLE_PLATFORM_VERSION := $(JDK_MAJOR_VERSION).$(JDK_MINOR_VERSION)
-  BUNDLE_VERSION := $(JDK_VERSION)
-  ifeq ($(COMPANY_NAME), N/A)
-    BUNDLE_VENDOR := UNDEFINED
-  else
-    BUNDLE_VENDOR := $(COMPANY_NAME)
-  endif
-
-
-  JDK_FILE_LIST := $(shell $(FIND) $(JDK_IMAGE_DIR))
-  JRE_FILE_LIST := $(shell $(FIND) $(JRE_IMAGE_DIR))
-
-  JDK_TARGET_LIST := $(subst $(JDK_IMAGE_DIR)/,$(JDK_BUNDLE_DIR)/Home/,$(JDK_FILE_LIST))
-  JRE_TARGET_LIST := $(subst $(JRE_IMAGE_DIR)/,$(JRE_BUNDLE_DIR)/Home/,$(JRE_FILE_LIST))
-
-  # Copy empty directories (jre/lib/applet).
-  $(JDK_BUNDLE_DIR)/Home/%: $(JDK_IMAGE_DIR)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $(@D)
-	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
-
-  $(JRE_BUNDLE_DIR)/Home/%: $(JRE_IMAGE_DIR)/%
-	$(ECHO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $(@D)
-	if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) -f -R -P '$<' '$@'; fi
-
-  $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib:
-	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(LN) -s ../Home/jre/lib/jli/libjli.dylib $@
-
-  $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib:
-	$(ECHO) Creating link $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(LN) -s ../Home/lib/jli/libjli.dylib $@
-
-  $(JDK_BUNDLE_DIR)/Info.plist: $(SPEC)
-	$(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $(@D)
-	$(SED) -e "s/@@ID@@/$(BUNDLE_ID_JDK)/g" \
-	    -e "s/@@NAME@@/$(BUNDLE_NAME_JDK)/g" \
-	    -e "s/@@INFO@@/$(BUNDLE_INFO_JDK)/g" \
-	    -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
-	    -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
-	    -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
-	    < $(MACOSX_PLIST_SRC)/JDK-Info.plist > $@
-
-  $(JRE_BUNDLE_DIR)/Info.plist: $(SPEC)
-	$(ECHO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $(@D)
-	$(SED) -e "s/@@ID@@/$(BUNDLE_ID_JRE)/g" \
-	    -e "s/@@NAME@@/$(BUNDLE_NAME_JRE)/g" \
-	    -e "s/@@INFO@@/$(BUNDLE_INFO_JRE)/g" \
-	    -e "s/@@PLATFORM_VERSION@@/$(BUNDLE_PLATFORM_VERSION)/g" \
-	    -e "s/@@VERSION@@/$(BUNDLE_VERSION)/g" \
-	    -e "s/@@VENDOR@@/$(BUNDLE_VENDOR)/g" \
-	    < $(MACOSX_PLIST_SRC)/JRE-Info.plist > $@
-
-  jdk-bundle: $(JDK_TARGET_LIST) $(JDK_BUNDLE_DIR)/MacOS/libjli.dylib \
-      $(JDK_BUNDLE_DIR)/Info.plist
-	$(SETFILE) -a B $(dir $(JDK_BUNDLE_DIR))
-
-  jre-bundle: $(JRE_TARGET_LIST) $(JRE_BUNDLE_DIR)/MacOS/libjli.dylib \
-      $(JRE_BUNDLE_DIR)/Info.plist
-	$(SETFILE) -a B $(dir $(JRE_BUNDLE_DIR))
-
-else # Not macosx
-
-  bundles:
-	$(ECHO) "No bundles defined for $(OPENJDK_TARGET_OS)"
-
-endif # macosx
-
-.PHONY: jdk-bundle jre-bundle bundles
diff --git a/jdk/make/CompileDemos.gmk b/jdk/make/CompileDemos.gmk
index b82548edb7a..040492a3c00 100644
--- a/jdk/make/CompileDemos.gmk
+++ b/jdk/make/CompileDemos.gmk
@@ -53,7 +53,7 @@ define SetupAppletDemo
   $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_APPLET_$1, \
       SETUP := GENERATE_USINGJDKBYTECODE, \
       SRC := $(JDK_TOPDIR)/src/$3demo/share/applets/$1, \
-      BIN := $(JDK_OUTPUTDIR)/demo/applets/$1, \
+      BIN := $(SUPPORT_OUTPUTDIR)/demo/image/applets/$1, \
       COPY := .html .java .xyz .obj .au .gif, \
       DISABLE_SJAVAC := $2))
       BUILD_DEMOS += $$(BUILD_DEMO_APPLET_$1)
@@ -118,27 +118,27 @@ define SetupDemo
         SETUP := GENERATE_USINGJDKBYTECODE, \
         ADD_JAVAC_FLAGS := $3, \
         SRC := $$($1_MAIN_SRC) $5, \
-        BIN := $(JDK_OUTPUTDIR)/democlasses/$2/$1, \
+        BIN := $(SUPPORT_OUTPUTDIR)/demo/classes/$2/$1, \
         COPY := $(PATTERNS_TO_COPY) $(10), \
-        JAR := $(JDK_OUTPUTDIR)/demo/$2/$1/$$($1_JARFILE), \
+        JAR := $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/$$($1_JARFILE), \
         JARMAIN := $4, \
         MANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf, \
         EXTRA_MANIFEST_ATTR := $(11), \
-        SRCZIP := $(JDK_OUTPUTDIR)/demo/$2/$1/src.zip, \
+        SRCZIP := $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/src.zip, \
         EXCLUDE_FILES := $9, \
         DISABLE_SJAVAC := $(12)))
 
     BUILD_DEMOS += $$(BUILD_DEMO_$1) \
-        $(JDK_OUTPUTDIR)/demo/$2/$1/$$($1_JARFILE) \
-        $(JDK_OUTPUTDIR)/demo/$2/$1/src.zip
+        $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/$$($1_JARFILE) \
+        $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/src.zip
   endif
 
   # Copy files.
   $1_COPY_TARGETS := $$(patsubst $$($1_SRC_BASE)/%, \
-      $(JDK_OUTPUTDIR)/demo/$2/$1/%, \
+      $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/%, \
       $$(wildcard $$(addprefix $$($1_SRC_BASE)/, $7)))
   ifneq ($7, )
-    $(JDK_OUTPUTDIR)/demo/$2/$1/%: $$($1_SRC_BASE)/%
+    $(SUPPORT_OUTPUTDIR)/demo/image/$2/$1/%: $$($1_SRC_BASE)/%
 	$$(call install-file)
 	$(CHMOD) -f ug+w $$@
 
@@ -148,20 +148,20 @@ define SetupDemo
 endef
 
 $(eval $(call SetupDemo,CodePointIM,jfc,,CodePointIM,,,*.html))
-$(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services: \
-    $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/CodePointIM.jar \
+$(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/_the.services: \
+    $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/CodePointIM.jar \
     $(DEMO_SHARE_SRC)/jfc/CodePointIM/java.awt.im.spi.InputMethodDescriptor
-	(cd $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM && \
+	(cd $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM && \
 	$(MKDIR) -p _the.tmp/META-INF/services && \
 	$(CP) $(DEMO_SHARE_SRC)/jfc/CodePointIM/java.awt.im.spi.InputMethodDescriptor _the.tmp/META-INF/services && \
 	cd ./_the.tmp && \
-	$(JAR) uf $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/CodePointIM.jar META-INF/services/java.awt.im.spi.InputMethodDescriptor && \
+	$(JAR) uf $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/CodePointIM.jar META-INF/services/java.awt.im.spi.InputMethodDescriptor && \
 	cd ./META-INF/services && \
-	$(JAR) uf $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/CodePointIM.jar java.awt.im.spi.InputMethodDescriptor)
-	$(RM) -r $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.tmp
+	$(JAR) uf $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/CodePointIM.jar java.awt.im.spi.InputMethodDescriptor)
+	$(RM) -r $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/_the.tmp
 	$(TOUCH) $@
 
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jfc/CodePointIM/_the.services
+BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jfc/CodePointIM/_the.services
 
 ifneq ($(OPENJDK_TARGET_OS), solaris)
   $(eval $(call SetupDemo,MoleculeViewer,applets,,XYZChemModel,,,example*.html *.java))
@@ -192,10 +192,10 @@ ifndef OPENJDK
       SplashScreen-Image: resources/images/splash.png,true))
 
   BUILD_DEMOS += $(patsubst $(DEMO_CLOSED_SHARE_SRC)/nbproject/%, \
-      $(JDK_OUTPUTDIR)/demo/nbproject/%, \
+      $(SUPPORT_OUTPUTDIR)/demo/image/nbproject/%, \
       $(call CacheFind, $(DEMO_CLOSED_SHARE_SRC)/nbproject))
 
-  $(JDK_OUTPUTDIR)/demo/nbproject/%: $(DEMO_CLOSED_SHARE_SRC)/nbproject/%
+  $(SUPPORT_OUTPUTDIR)/demo/image/nbproject/%: $(DEMO_CLOSED_SHARE_SRC)/nbproject/%
 	$(call install-file)
 	$(CHMOD) -f ug+w $@
 endif
@@ -266,16 +266,16 @@ define SetupJVMTIDemo
           -D "JDK_FNAME=$1.dll" \
           -D "JDK_INTERNAL_NAME=$1" \
           -D "JDK_FTYPE=0x2L", \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/demoobjs/jvmti/$1, \
-      OUTPUT_DIR := $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/demo/native/jvmti/$1, \
+      OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib, \
       LIBRARY := $1))
 
   $$(eval $$(call SetupZipArchive,BUILD_DEMO_JVMTI_SRC_$1, \
       SRC := $(DEMO_SHARE_SRC)/jvmti/$1 $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC), \
       EXCLUDE_FILES := $$(BUILD_DEMO_JVMTI_$1_EXTRA_SRC_EXCLUDE), \
-      ZIP := $(JDK_OUTPUTDIR)/demo/jvmti/$1/src.zip))
+      ZIP := $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/src.zip))
 
-  $(JDK_OUTPUTDIR)/demo/jvmti/$1/README.txt: $(DEMO_SHARE_SRC)/jvmti/$1/README.txt
+  $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/README.txt: $(DEMO_SHARE_SRC)/jvmti/$1/README.txt
 	$$(call install-file)
 	$(CHMOD) -f ug+w $$@
 
@@ -283,30 +283,30 @@ define SetupJVMTIDemo
     $$(eval $$(call SetupJavaCompilation,BUILD_DEMO_JVMTI_$1_JAVA, \
         SETUP := GENERATE_USINGJDKBYTECODE, \
         SRC := $(DEMO_SHARE_SRC)/jvmti/$1, \
-        BIN := $(JDK_OUTPUTDIR)/democlasses/jvmti/$1, \
+        BIN := $(SUPPORT_OUTPUTDIR)/demo/classes/jvmti/$1, \
         COPY := $(PATTERNS_TO_COPY), \
-        JAR := $(JDK_OUTPUTDIR)/demo/jvmti/$1/$1.jar, \
+        JAR := $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/$1.jar, \
         EXTRA_MANIFEST_ATTR := Main-Class: \n, \
         MANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf))
 
-    BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jvmti/$1/$1.jar
+    BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/$1.jar
   endif
 
   BUILD_DEMOS += $$(BUILD_DEMO_JVMTI_$1) \
-      $(JDK_OUTPUTDIR)/demo/jvmti/$1/src.zip \
-      $(JDK_OUTPUTDIR)/demo/jvmti/$1/README.txt
+      $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/src.zip \
+      $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/README.txt
 
   ifeq ($(OPENJDK_TARGET_OS), windows)
     # These files normally end up in OBJECT_DIR but for demos they
     # are supposed to be included in the distro.
-    $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.lib: $$(BUILD_DEMO_JVMTI_$1)
-	$(CP) $(JDK_OUTPUTDIR)/demoobjs/jvmti/$1/$1.lib $$@
+    $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.lib: $$(BUILD_DEMO_JVMTI_$1)
+	$(CP) $(SUPPORT_OUTPUTDIR)/demo/native/jvmti/$1/$1.lib $$@
 
-    $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.exp: $$(BUILD_DEMO_JVMTI_$1)
-	$(CP) $(JDK_OUTPUTDIR)/demoobjs/jvmti/$1/$1.exp $$@
+    $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.exp: $$(BUILD_DEMO_JVMTI_$1)
+	$(CP) $(SUPPORT_OUTPUTDIR)/demo/native/jvmti/$1/$1.exp $$@
 
-    BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.lib \
-        $(JDK_OUTPUTDIR)/demo/jvmti/$1/lib/$1.exp
+    BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.lib \
+        $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/$1/lib/$1.exp
   endif
 endef
 
@@ -321,95 +321,97 @@ $(eval $(call SetupJVMTIDemo,versionCheck, agent_util))
 
 ##################################################################################################
 
-$(JDK_OUTPUTDIR)/demo/management/index.html: $(DEMO_SHARE_SRC)/management/index.html
+$(SUPPORT_OUTPUTDIR)/demo/image/management/index.html: $(DEMO_SHARE_SRC)/management/index.html
 	$(call install-file)
 	$(CHMOD) -f ug+w $@
 
-$(JDK_OUTPUTDIR)/demo/jvmti/index.html: $(DEMO_SHARE_SRC)/jvmti/index.html
+$(SUPPORT_OUTPUTDIR)/demo/image/jvmti/index.html: $(DEMO_SHARE_SRC)/jvmti/index.html
 	$(call install-file)
 	$(CHMOD) -f ug+w $@
 
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/management/index.html \
-    $(JDK_OUTPUTDIR)/demo/jvmti/index.html
+BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/management/index.html \
+    $(SUPPORT_OUTPUTDIR)/demo/image/jvmti/index.html
 
 ##################################################################################################
 
 # The netbeans project files are copied into the demo directory.
 ifeq ($(OPENJDK_TARGET_OS), solaris)
   BUILD_DEMOS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \
-    $(JDK_OUTPUTDIR)/demo/nbproject/%, \
+    $(SUPPORT_OUTPUTDIR)/demo/image/nbproject/%, \
     $(filter-out $(DEMO_SHARE_SRC)/nbproject/jfc/SwingApplet%, \
     $(call CacheFind, $(DEMO_SHARE_SRC)/nbproject)))
 else
   BUILD_DEMOS += $(patsubst $(DEMO_SHARE_SRC)/nbproject/%, \
-    $(JDK_OUTPUTDIR)/demo/nbproject/%, \
+    $(SUPPORT_OUTPUTDIR)/demo/image/nbproject/%, \
     $(call CacheFind, $(DEMO_SHARE_SRC)/nbproject))
 endif
 
-$(JDK_OUTPUTDIR)/demo/nbproject/%: $(DEMO_SHARE_SRC)/nbproject/%
+$(SUPPORT_OUTPUTDIR)/demo/image/nbproject/%: $(DEMO_SHARE_SRC)/nbproject/%
 	$(call install-file)
 	$(CHMOD) -f ug+w $@
 
 ##################################################################################################
 
-$(JDK_OUTPUTDIR)/demo/README: $(DEMO_SHARE_SRC)/README
+$(SUPPORT_OUTPUTDIR)/demo/image/README: $(DEMO_SHARE_SRC)/README
 	$(call install-file)
 
-BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/README
+BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/README
 
 ##################################################################################################
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
 
-  $(JDK_OUTPUTDIR)/democlasses/jni/Poller/%: $(DEMO_SOLARIS_SRC)/jni/Poller/%
+  $(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller/%: $(DEMO_SOLARIS_SRC)/jni/Poller/%
 	$(call install-file)
 	$(CHMOD) -f ug+w $@
 
-  $(JDK_OUTPUTDIR)/demo/jni/Poller/README.txt: $(DEMO_SOLARIS_SRC)/jni/Poller/README.txt
+  $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/README.txt: $(DEMO_SOLARIS_SRC)/jni/Poller/README.txt
 	$(call install-file)
 	$(CHMOD) -f ug+w $@
 
-  $(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar: \
-      $(JDK_OUTPUTDIR)/democlasses/jni/Poller/README.txt $(JDK_OUTPUTDIR)/democlasses/jni/Poller/Poller.c
+  $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/Poller.jar: \
+      $(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller/README.txt \
+      $(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller/Poller.c
 
   $(eval $(call SetupJavaCompilation,BUILD_DEMO_POLLER_JAR, \
       SETUP := GENERATE_USINGJDKBYTECODE, \
       SRC := $(DEMO_SOLARIS_SRC)/jni/Poller, \
-      BIN := $(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
-      HEADERS := $(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
-      JAR := $(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar, \
+      BIN := $(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller, \
+      HEADERS := $(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller, \
+      JAR := $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/Poller.jar, \
       MANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf, \
-      SRCZIP := $(JDK_OUTPUTDIR)/demo/jni/Poller/src.zip, \
+      SRCZIP := $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/src.zip, \
       COPY := README.txt Poller.c, \
       JARMAIN := Client))
 
 
 
-  BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar $(JDK_OUTPUTDIR)/demo/jni/Poller/src.zip \
-      $(JDK_OUTPUTDIR)/demo/jni/Poller/README.txt
+  BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/Poller.jar \
+      $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/src.zip \
+      $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/README.txt
 
   $(eval $(call SetupNativeCompilation,BUILD_LIBPOLLER, \
       SRC := $(DEMO_SOLARIS_SRC)/jni/Poller, \
       LANG := C, \
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) $(SHARED_LIBRARY_FLAGS) \
-          -I$(JDK_OUTPUTDIR)/democlasses/jni/Poller, \
+          -I$(SUPPORT_OUTPUTDIR)/demo/classes/jni/Poller, \
       LDFLAGS := $(LDFLAGS_JDKLIB), \
       LDFLAGS_SUFFIX_solaris := -lc, \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/demoobjs/jni/Poller, \
-      OUTPUT_DIR := $(JDK_OUTPUTDIR)/demoobjs, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/demo/native/jni/Poller, \
+      OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/demo/native, \
       LIBRARY := Poller))
 
   #
   # We can only compile native code after jar has been build (since we depend on generated .h files)
   #
-  $(JDK_OUTPUTDIR)/demoobjs/jni/Poller/Poller.o: $(JDK_OUTPUTDIR)/demo/jni/Poller/Poller.jar
+  $(SUPPORT_OUTPUTDIR)/demo/native/jni/Poller/Poller.o: $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/Poller.jar
 
-  $(JDK_OUTPUTDIR)/demo/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX): \
-      $(JDK_OUTPUTDIR)/demoobjs/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
+  $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX): \
+      $(SUPPORT_OUTPUTDIR)/demo/native/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
 	$(call install-file)
 
-  BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
+  BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/jni/Poller/lib/$(LIBRARY_PREFIX)Poller$(SHARED_LIBRARY_SUFFIX)
 
 endif
 
@@ -419,22 +421,22 @@ ifndef OPENJDK
   DB_ZIP_DIR := $(wildcard $(JDK_TOPDIR)/src/closed/db)
   DB_DEMO_ZIPFILE := $(wildcard $(DB_ZIP_DIR)/*.zip)
 
-  $(JDK_OUTPUTDIR)/demo/_the.db.unzipped: $(DB_DEMO_ZIPFILE)
+  $(SUPPORT_OUTPUTDIR)/demo/image/_the.db.unzipped: $(DB_DEMO_ZIPFILE)
 	$(MKDIR) -p $(@D)
-	$(RM) -r $(JDK_OUTPUTDIR)/demo/db $(JDK_OUTPUTDIR)/demo/demo
-	$(CD) $(JDK_OUTPUTDIR)/demo && $(UNZIP) -q -o $<
-	$(MV) $(JDK_OUTPUTDIR)/demo/db-derby-*-bin/demo $(JDK_OUTPUTDIR)/demo/db
-	$(CD) $(JDK_OUTPUTDIR)/demo && $(RM) -r db-derby-*-bin
+	$(RM) -r $(SUPPORT_OUTPUTDIR)/demo/image/db $(SUPPORT_OUTPUTDIR)/demo/image/demo
+	$(CD) $(SUPPORT_OUTPUTDIR)/demo/image && $(UNZIP) -q -o $<
+	$(MV) $(SUPPORT_OUTPUTDIR)/demo/image/db-derby-*-bin/demo $(SUPPORT_OUTPUTDIR)/demo/image/db
+	$(CD) $(SUPPORT_OUTPUTDIR)/demo/image && $(RM) -r db-derby-*-bin
 	$(TOUCH) $@
 
   # Copy this after the unzip above to avoid race with directory creation and mv command.
-  $(JDK_OUTPUTDIR)/demo/db/README-JDK-DEMOS.html: \
+  $(SUPPORT_OUTPUTDIR)/demo/image/db/README-JDK-DEMOS.html: \
       $(DB_ZIP_DIR)/README-JDK-DEMOS.html \
-      | $(JDK_OUTPUTDIR)/demo/_the.db.unzipped
+      | $(SUPPORT_OUTPUTDIR)/demo/image/_the.db.unzipped
 	$(MKDIR) -p $(@D)
 	$(CAT) $< | $(SED) "s/XXXX/$(shell cat $(DB_ZIP_DIR)/COPYRIGHTYEAR)/" > $@
 
-  BUILD_DEMOS += $(JDK_OUTPUTDIR)/demo/_the.db.unzipped $(JDK_OUTPUTDIR)/demo/db/README-JDK-DEMOS.html
+  BUILD_DEMOS += $(SUPPORT_OUTPUTDIR)/demo/image/_the.db.unzipped $(SUPPORT_OUTPUTDIR)/demo/image/db/README-JDK-DEMOS.html
 endif
 
 ##################################################################################################
diff --git a/jdk/make/CompileInterimRmic.gmk b/jdk/make/CompileInterimRmic.gmk
index 79082cd415c..003a4af73e7 100644
--- a/jdk/make/CompileInterimRmic.gmk
+++ b/jdk/make/CompileInterimRmic.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -45,7 +45,7 @@ $(eval $(call SetupJavaCompilation,BUILD_INTERIM_RMIC, \
     SETUP := GENERATE_OLDBYTECODE, \
     SRC := $(JDK_TOPDIR)/src/jdk.rmic/share/classes, \
     INCLUDES := $(RMIC_PKGS), \
-    BIN := $(JDK_OUTPUTDIR)/interim_rmic_classes, \
+    BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_rmic_classes, \
     COPY := .properties, \
     JAVAC_SOURCE_PATH_OVERRIDE := $(addprefix $(JDK_TOPDIR)/src/jdk.rmic/share/classes/, $(RMIC_PKGS))))
 
diff --git a/jdk/make/CopySamples.gmk b/jdk/make/CopySamples.gmk
index 3323e71a63a..37a1d21ebce 100644
--- a/jdk/make/CopySamples.gmk
+++ b/jdk/make/CopySamples.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@ default: all
 include $(SPEC)
 include MakeBase.gmk
 
-SAMPLE_TARGET_DIR := $(JDK_OUTPUTDIR)/sample
+SAMPLE_TARGET_DIR := $(SUPPORT_OUTPUTDIR)/sample
 SAMPLE_SOURCE_DIR := $(JDK_TOPDIR)/src/sample/share
 SAMPLE_CLOSED_SOURCE_DIR := $(JDK_TOPDIR)/src/closed/sample/share
 SAMPLE_SOLARIS_SOURCE_DIR := $(JDK_TOPDIR)/src/sample/solaris
diff --git a/jdk/make/CreateJars.gmk b/jdk/make/CreateJars.gmk
deleted file mode 100644
index 568eeb2e0f3..00000000000
--- a/jdk/make/CreateJars.gmk
+++ /dev/null
@@ -1,795 +0,0 @@
-#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-include $(SPEC)
-include MakeBase.gmk
-include JavaCompilation.gmk
-
-default: all
-
-include Tools.gmk
-
-JDK_OUT_CLASSES := $(wildcard $(JDK_OUTPUTDIR)/modules/*)
-$(eval $(call FillCacheFind, $(JDK_OUT_CLASSES)))
-
-include Profiles.gmk
-
-#
-# This makefile...so that altering will trigger rebuilding include/exclude-lists => jars
-#
-MAKEFILE = $(JDK_TOPDIR)/make/CreateJars.gmk
-#
-# And similarly for the Profiles
-PROFILE_MAKEFILES = $(JDK_TOPDIR)/make/Profiles.gmk $(JDK_TOPDIR)/make/profile-rtjar-includes.txt
-
-MAINMANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf
-BEANMANIFEST := $(JDK_TOPDIR)/make/data/swingbeaninfo/manifest.mf
-
-$(eval $(call MakeDir, $(IMAGES_OUTPUTDIR)/lib))
-
-##########################################################################################
-
-$(eval $(call SetupArchive,BUILD_JCONSOLE_JAR, , \
-    SRCS := $(JDK_OUTPUTDIR)/modules/jdk.jconsole, \
-    SUFFIXES := .class .gif .png .properties, \
-    INCLUDES := sun/tools/jconsole com/sun/tools/jconsole, \
-    JARMAIN := sun.tools.jconsole.JConsole, \
-    JAR := $(IMAGES_OUTPUTDIR)/lib/jconsole.jar, \
-    SKIP_METAINF := true))
-
-
-##########################################################################################
-
-$(eval $(call SetupArchive,BUILD_DNS_JAR, , \
-    SRCS := $(JDK_OUTPUTDIR)/modules/jdk.naming.dns, \
-    INCLUDES := sun/net/spi/nameservice/dns, \
-    EXTRA_FILES := META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor, \
-    JAR := $(IMAGES_OUTPUTDIR)/lib/ext/dnsns.jar, \
-    SKIP_METAINF := true))
-
-
-##########################################################################################
-
-LOCALEDATA_INCLUDE_LOCALES := ar be bg ca cs da de el es et fi fr ga hi hr hu in is it \
-    iw ja ko lt lv mk ms mt nl no pl pt ro ru sk sl sq sr sv \
-    th tr uk vi zh
-
-LOCALEDATA_INCLUDES := sun/util/resources/provider/NonEnLocaleDataMetaInfo.class
-LOCALEDATA_INCLUDES += $(addprefix sun/text/resources/, $(LOCALEDATA_INCLUDE_LOCALES)) \
-    $(addprefix sun/util/resources/, $(LOCALEDATA_INCLUDE_LOCALES))
-
-LOCALEDATA_SERVICES_DIR := $(IMAGES_OUTPUTDIR)/localemetainfo
-
-LOCALEDATA_METAINF_SERVICES := $(LOCALEDATA_SERVICES_DIR)/META-INF/services/sun.util.locale.provider.LocaleDataMetaInfo
-
-$(LOCALEDATA_METAINF_SERVICES): $(JDK_TOPDIR)/src/jdk.localedata/META-INF/localedata-services/sun.util.locale.provider.LocaleDataMetaInfo
-	$(install-file)
-
-$(eval $(call SetupArchive,BUILD_LOCALEDATA_JAR, \
-    $(LOCALEDATA_METAINF_SERVICES), \
-    SRCS := $(JDK_OUTPUTDIR)/modules/jdk.localedata \
-        $(LOCALEDATA_SERVICES_DIR), \
-    SUFFIXES := .class _dict _th, \
-    INCLUDES := $(LOCALEDATA_INCLUDES), \
-    EXTRA_FILES := META-INF/services/sun.util.locale.provider.LocaleDataMetaInfo, \
-    JAR := $(IMAGES_OUTPUTDIR)/lib/ext/localedata.jar, \
-    SKIP_METAINF := true))
-
-##########################################################################################
-#
-# Different variants of rt.jar are built based on the current profile. The output
-# directory is augmented with the profile name so that the final jar file and all the
-# intermediary list files will be in directory. This has the form lib$PROFILE rather than
-# lib/$PROFILE so that it won't get copied as part of the image generation process.
-# Each profile customizes the RT_JAR_EXCLUDES variable.
-#
-##########################################################################################
-
-# Full JRE exclude list for rt.jar and resources.jar
-# This value should exclude types destined for jars other than rt.jar and resources.jar.
-# When building a Profile this value augments the profile specific exclusions
-RT_JAR_EXCLUDES += \
-    com/oracle/security/ucrypto \
-    com/sun/codemodel \
-    com/sun/crypto/provider \
-    com/sun/istack/internal/tools \
-    com/sun/jarsigner \
-    com/sun/java/accessibility \
-    com/sun/javadoc \
-    com/sun/jdi \
-    com/sun/net/ssl/internal/ssl \
-    com/sun/source \
-    com/sun/tools \
-    com/sun/xml/internal/dtdparser \
-    com/sun/xml/internal/rngom \
-    com/sun/xml/internal/xsom \
-    javax/crypto \
-    javax/swing/AbstractButtonBeanInfo.class \
-    javax/swing/beaninfo \
-    javax/swing/BoxBeanInfo.class \
-    javax/swing/JAppletBeanInfo.class \
-    javax/swing/JButtonBeanInfo.class \
-    javax/swing/JCheckBoxBeanInfo.class \
-    javax/swing/JCheckBoxMenuItemBeanInfo.class \
-    javax/swing/JColorChooserBeanInfo.class \
-    javax/swing/JComboBoxBeanInfo.class \
-    javax/swing/JComponentBeanInfo.class \
-    javax/swing/JDesktopPaneBeanInfo.class \
-    javax/swing/JDialogBeanInfo.class \
-    javax/swing/JEditorPaneBeanInfo.class \
-    javax/swing/JFileChooserBeanInfo.class \
-    javax/swing/JFormattedTextFieldBeanInfo.class \
-    javax/swing/JFrameBeanInfo.class \
-    javax/swing/JInternalFrameBeanInfo.class \
-    javax/swing/JLabelBeanInfo.class \
-    javax/swing/JLayeredPaneBeanInfo.class \
-    javax/swing/JListBeanInfo.class \
-    javax/swing/JMenuBarBeanInfo.class \
-    javax/swing/JMenuBeanInfo.class \
-    javax/swing/JMenuItemBeanInfo.class \
-    javax/swing/JOptionPaneBeanInfo.class \
-    javax/swing/JPanelBeanInfo.class \
-    javax/swing/JPasswordFieldBeanInfo.class \
-    javax/swing/JPopupMenuBeanInfo.class \
-    javax/swing/JProgressBarBeanInfo.class \
-    javax/swing/JRadioButtonBeanInfo.class \
-    javax/swing/JRadioButtonMenuItemBeanInfo.class \
-    javax/swing/JScrollBarBeanInfo.class \
-    javax/swing/JScrollPaneBeanInfo.class \
-    javax/swing/JSeparatorBeanInfo.class \
-    javax/swing/JSliderBeanInfo.class \
-    javax/swing/JSpinnerBeanInfo.class \
-    javax/swing/JSplitPaneBeanInfo.class \
-    javax/swing/JTabbedPaneBeanInfo.class \
-    javax/swing/JTableBeanInfo.class \
-    javax/swing/JTextAreaBeanInfo.class \
-    javax/swing/JTextFieldBeanInfo.class \
-    javax/swing/JTextPaneBeanInfo.class \
-    javax/swing/JToggleButtonBeanInfo.class \
-    javax/swing/JToolBarBeanInfo.class \
-    javax/swing/JTreeBeanInfo.class \
-    javax/swing/JWindowBeanInfo.class \
-    javax/swing/SwingBeanInfoBase.class \
-    javax/swing/text/JTextComponentBeanInfo.class \
-    jdk/nio/zipfs \
-    META-INF/services/com.sun.jdi.connect.Connector \
-    META-INF/services/com.sun.jdi.connect.spi.TransportService \
-    META-INF/services/com.sun.tools.attach.spi.AttachProvider \
-    META-INF/services/com.sun.tools.xjc.Plugin \
-    META-INF/services/javax.script.ScriptEngineFactory \
-    META-INF/services/sun.net.spi.nameservice.NameServiceDescriptor \
-    META-INF/services/java.nio.file.spi.FileSystemProvider \
-    org/relaxng/datatype \
-    sun/awt/HKSCS.class \
-    sun/awt/motif/X11GB2312.class \
-    sun/awt/motif/X11GB2312$$$$Decoder.class \
-    sun/awt/motif/X11GB2312$$$$Encoder.class \
-    sun/awt/motif/X11GBK.class \
-    sun/awt/motif/X11GBK$$$$Encoder.class \
-    sun/awt/motif/X11KSC5601.class \
-    sun/awt/motif/X11KSC5601$$$$Decoder.class \
-    sun/awt/motif/X11KSC5601$$$$Encoder.class \
-    sun/jvmstat \
-    sun/net/spi/nameservice/dns \
-    sun/nio/cs/ext \
-    sun/rmi/rmic \
-    sun/security/ec \
-    sun/security/internal \
-    sun/security/mscapi \
-    sun/security/pkcs11 \
-    sun/security/provider/Sun.class \
-    sun/security/rsa/SunRsaSign.class \
-    sun/security/ssl \
-    sun/security/tools/jarsigner \
-    sun/swing/BeanInfoUtils.class \
-    sun/text/resources/cldr \
-    sun/tools/asm \
-    sun/tools/attach \
-    sun/tools/java \
-    sun/tools/javac \
-    sun/tools/jcmd \
-    sun/tools/jconsole \
-    sun/tools/jinfo \
-    sun/tools/jmap \
-    sun/tools/jps \
-    sun/tools/jstack \
-    sun/tools/jstat \
-    sun/tools/jstatd \
-    sun/tools/native2ascii \
-    sun/tools/serialver \
-    sun/tools/tree \
-    sun/tools/util \
-    sun/util/resources/provider/NonEnLocaleDataMetaInfo.class \
-    META-INF/services/sun.util.locale.provider.LocaleDataMetaInfo \
-    sun/util/resources/cldr \
-    $(LOCALEDATA_INCLUDES) \
-    com/oracle/jrockit/jfr \
-    oracle/jrockit/jfr \
-    jdk/jfr \
-    jdk/internal/dynalink \
-    jdk/nashorn \
-    sun/jvm \
-    toolbarButtonGraphics \
-    sa.properties \
-    com/sun/java/swing/action \
-    com/sun/java/swing/ui \
-    com/oracle/security \
-    #
-
-# Find all files in the classes dir to use as dependencies. This could be more fine granular.
-ALL_FILES_IN_CLASSES := $(call not-containing, _the., $(filter-out %javac_state, \
-    $(call CacheFind, $(JDK_OUT_CLASSES))))
-
-RT_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar_manifest
-RESOURCE_JAR_MANIFEST_FILE := $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar_manifest
-
-$(RT_JAR_MANIFEST_FILE): $(MAINMANIFEST) $(BEANMANIFEST)
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	$(SED) -e "s#@@RELEASE@@#$(RELEASE)#" \
-	    -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
-	    $(MAINMANIFEST) >> $@.tmp
-	$(ECHO) >> $@.tmp
-	$(CAT) $(BEANMANIFEST) >> $@.tmp
-	$(MV) $@.tmp $@
-
-$(RESOURCE_JAR_MANIFEST_FILE): $(MAINMANIFEST)
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	$(SED) -e "s#@@RELEASE@@#$(RELEASE)#" \
-	    -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
-	    $(MAINMANIFEST) >> $@.tmp
-	$(MV) $@.tmp $@
-
-$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.exclude: $(MAKEFILE) $(PROFILE_MAKEFILES)
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	$(call ListPathsSafely,RT_JAR_EXCLUDES,\n, >> $@.tmp)
-	$(MV) $@.tmp $@
-
-$(IMAGES_OUTPUTDIR)/lib/classlist: $(JDK_TOPDIR)/make/data/classlist/classlist.$(OPENJDK_TARGET_OS) \
-    $(MAKEFILE)
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	$(TOOL_ADDJSUM) $< $@.tmp
-	$(MV) $@.tmp $@
-
-$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents: $(BUILD_TOOLS_JDK) $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.exclude \
-    $(ALL_FILES_IN_CLASSES) $(IMAGES_OUTPUTDIR)/lib/classlist
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	($(CD) $(JDK_OUTPUTDIR)/modules && \
-	$(TOOL_JARREORDER) -m \
-	    -o $@.tmp $(IMAGES_OUTPUTDIR)/lib/classlist $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.exclude . )
-	$(MV) $@.tmp $@
-
-$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	$(GREP) -e '\.class$$' $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents > $@.tmp
-        ifneq ($(PROFILE), )
-          # Add back classes from excluded packages (fixing the $ substitution in the process)
-          # This currently won't work with modular build layout, but there currently are no 
-          # types needing to be re added.
-	  for type in $(subst \$$,\, $(RT_JAR_INCLUDE_TYPES)) ; do \
-	    $(ECHO) $$type >> $@.tmp ; \
-	  done
-        endif
-	$(MV) $@.tmp $@
-
-$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	$(GREP) -v -e '\.class$$' \
-	    -e '/_the\.' -e '^_the\.' -e '\\_the\.' -e ' _the\.' -e 'javac_state' \
-	    $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.jars.contents > $@.tmp
-        ifneq ($(PROFILE), )
-          # Strip out all META-INF/services/ entries
-	  $(GREP) -v -e 'META-INF/services/' $@.tmp > $@.tmp2
-          # Add back the required services
-          # FIXME: On Solaris if PROFILE_INCLUDE_METAINF_SERVICES is not defined
-          # we get a syntax error from sh. That doesn't happen on linux
-          # Preserve any -C <dir> part of the original include line.
-	  for service in $(PROFILE_INCLUDE_METAINF_SERVICES) ; do \
-	    $(GREP) -e "$$service" $@.tmp >> $@.tmp2; \
-	  done
-	  $(MV) $@.tmp2 $@.tmp
-        endif
-	$(MV) $@.tmp $@
-
-# This is a hack but I don't know how to make this fit into the existing scheme
-$(PROFILE_VERSION_CLASS_TARGETS): $(PROFILE_VERSION_JAVA_TARGETS)
-	@$(JAVAC) -d $(@D)/../../ $(@D)/$(VERSION_JAVA_FILE)
-
-
-RT_JAR_CREATE_OPTIONS := c0fm
-RT_JAR_UPDATE_OPTIONS := u0f
-ifeq ($(COMPRESS_JARS), true)
-  RT_JAR_CREATE_OPTIONS := cfm
-  RT_JAR_UPDATE_OPTIONS := uf
-endif
-
-# This defines a target-specific variables to make the shell logic easier to see.
-# We need to find the Version.class file for the profile currently being built
-$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/rt.jar: \
-    CLASS_FILE = $(if $(PROFILE), $(strip $(foreach class, $(PROFILE_VERSION_CLASS_TARGETS), $(if $(findstring $(PROFILE), $(class)), $(class)))), NO_SUCH_FILE)
-# This is the real target
-$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/rt.jar: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents $(RT_JAR_MANIFEST_FILE) $(PROFILE_VERSION_CLASS_TARGETS)
-	$(ECHO) Creating rt.jar $(PROFILE) Compressed=$(COMPRESS_JARS)
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	$(CD) $(JDK_OUTPUTDIR)/modules && \
-	$(JAR) $(RT_JAR_CREATE_OPTIONS) $@.tmp $(RT_JAR_MANIFEST_FILE) \
-	    @$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.rt.jar.contents && \
-	if [ -f $(CLASS_FILE) ]; then \
-	  $(ECHO) Updating rt.jar $(PROFILE) && \
-	  $(CD) $(patsubst %$(VERSION_CLASS_PATH), %, $(CLASS_FILE)) && \
-	  $(JAR) $(RT_JAR_UPDATE_OPTIONS) $@.tmp $(VERSION_CLASS_PATH); \
-	fi
-	$(MV) $@.tmp $@
-
-$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/resources.jar: $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents \
-    $(RESOURCE_JAR_MANIFEST_FILE)
-	$(ECHO) Creating resources.jar
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	$(CD) $(JDK_OUTPUTDIR)/modules && \
-	$(JAR) $(RT_JAR_CREATE_OPTIONS) $@.tmp $(RESOURCE_JAR_MANIFEST_FILE) \
-	    @$(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_the.resources.jar.contents
-	$(MV) $@.tmp $@
-
-##########################################################################################
-
-ifneq ($(OPENJDK_TARGET_OS), windows)
-  CHARSETS_EXTRA_FILES := sun/awt/motif/X11GBK.class \
-      sun/awt/motif/X11GB2312$$$$Decoder.class \
-      sun/awt/motif/X11GB2312.class \
-      sun/awt/motif/X11KSC5601$$$$Decoder.class \
-      sun/awt/motif/X11KSC5601$$$$Encoder.class \
-      sun/awt/motif/X11GB2312$$$$Encoder.class \
-      sun/awt/motif/X11GBK$$$$Encoder.class \
-      sun/awt/motif/X11KSC5601.class
-endif
-
-$(eval $(call SetupArchive,BUILD_CHARSETS_JAR, , \
-    SRCS := $(JDK_OUT_CLASSES), \
-    SUFFIXES := .class .dat, \
-    INCLUDES := sun/nio/cs/ext, \
-    EXTRA_FILES := sun/awt/HKSCS.class \
-        $(CHARSETS_EXTRA_FILES), \
-    JAR := $(IMAGES_OUTPUTDIR)/lib/charsets.jar, \
-    SKIP_METAINF := true, \
-    CHECK_COMPRESS_JAR := true))
-
-##########################################################################################
-
-$(eval $(call SetupArchive,BUILD_ZIPFS_JAR, , \
-    SRCS := $(JDK_OUT_CLASSES), \
-    INCLUDES := jdk/nio/zipfs, \
-    EXTRA_FILES := META-INF/services/java.nio.file.spi.FileSystemProvider, \
-    JAR := $(IMAGES_OUTPUTDIR)/lib/ext/zipfs.jar, \
-    SKIP_METAINF := true, \
-    CHECK_COMPRESS_JAR := true))
-
-##########################################################################################
-
-ifndef OPENJDK
-  ifeq ($(ENABLE_JFR), true)
-    $(eval $(call SetupArchive,BUILD_JFR_JAR, , \
-        SRCS := $(JDK_OUTPUTDIR)/modules/jdk.jfr, \
-        SUFFIXES := .class .jfc .xsd, \
-        INCLUDES := com/oracle/jrockit/jfr \
-            oracle/jrockit/jfr \
-            jdk/jfr, \
-        JAR := $(IMAGES_OUTPUTDIR)/lib/jfr.jar, \
-        SKIP_METAINF := true, \
-        MANIFEST := $(MAINMANIFEST), \
-        CHECK_COMPRESS_JAR := true))
-
-  endif
-endif
-
-##########################################################################################
-
-$(eval $(call SetupArchive,BUILD_JSSE_JAR, , \
-    SRCS := $(JDK_OUT_CLASSES), \
-    INCLUDES := sun/security/provider/Sun.class \
-        sun/security/rsa/SunRsaSign.class \
-        sun/security/ssl \
-        com/sun/net/ssl/internal/ssl, \
-    JAR := $(IMAGES_OUTPUTDIR)/lib/jsse.jar, \
-    SKIP_METAINF := true, \
-    MANIFEST := $(MAINMANIFEST), \
-    CHECK_COMPRESS_JAR := true))
-
-##########################################################################################
-
-$(eval $(call SetupArchive,BUILD_SWINGBEANS_JAR, , \
-    SRCS := $(JDK_OUTPUTDIR)/modules/java.desktop, \
-    SUFFIXES := BeanInfo.class .gif, \
-    INCLUDES := javax/swing sun/swing, \
-    EXCLUDES := javax/swing/plaf, \
-    EXTRA_FILES := javax/swing/SwingBeanInfoBase.class sun/swing/BeanInfoUtils.class, \
-    JAR := $(IMAGES_OUTPUTDIR)/lib/dt.jar, \
-    SKIP_METAINF := true))
-
-##########################################################################################
-
-# Get the CLDRVERSION
-include gensrc/GensrcCLDR.gmk
-
-CLDRDATA_JAR_DST := $(IMAGES_OUTPUTDIR)/lib/ext/cldrdata.jar
-
-CLDR_SERVICES_DIR := $(IMAGES_OUTPUTDIR)/cldrmetainfo
-
-CLDR_METAINF_SERVICES := $(CLDR_SERVICES_DIR)/META-INF/services/sun.util.locale.provider.LocaleDataMetaInfo
-
-$(CLDR_METAINF_SERVICES): $(JDK_TOPDIR)/src/jdk.localedata/META-INF/cldrdata-services/sun.util.locale.provider.LocaleDataMetaInfo
-	$(install-file)
-
-$(eval $(call SetupArchive,BUILD_CLDRDATA_JAR, \
-    $(CLDR_METAINF_SERVICES), \
-    SRCS := $(JDK_OUTPUTDIR)/modules/jdk.localedata \
-        $(CLDR_SERVICES_DIR), \
-    SUFFIXES := .class, \
-    INCLUDES := sun/text/resources/cldr \
-        sun/util/resources/cldr, \
-    EXTRA_FILES := META-INF/services/sun.util.locale.provider.LocaleDataMetaInfo, \
-    JAR := $(CLDRDATA_JAR_DST), \
-    EXTRA_MANIFEST_ATTR := CLDR-Version: $(CLDRVERSION), \
-    SKIP_METAINF := true))
-
-##########################################################################################
-
-TOOLS_JAR_INCLUDES := \
-    com/sun/codemodel \
-    com/sun/istack/internal/tools \
-    com/sun/jarsigner \
-    com/sun/javadoc \
-    com/sun/jdi \
-    com/sun/source \
-    com/sun/tools/attach \
-    com/sun/tools/classfile \
-    com/sun/tools/corba \
-    com/sun/tools/doclets \
-    com/sun/tools/doclint \
-    com/sun/tools/example/debug/expr \
-    com/sun/tools/example/debug/tty \
-    com/sun/tools/hat \
-    com/sun/tools/internal/jxc \
-    com/sun/tools/internal/jxc/ap \
-    com/sun/tools/internal/ws \
-    com/sun/tools/internal/ws/wscompile/plugin/at_generated \
-    com/sun/tools/internal/xjc \
-    com/sun/tools/javac \
-    com/sun/tools/javadoc \
-    com/sun/tools/javah \
-    com/sun/tools/javap \
-    com/sun/tools/jdeps \
-    com/sun/tools/jdi \
-    com/sun/tools/script/shell \
-    com/sun/xml/internal/dtdparser \
-    com/sun/xml/internal/rngom \
-    com/sun/xml/internal/xsom \
-    org/relaxng/datatype \
-    sun/applet \
-    sun/jvmstat \
-    sun/rmi/rmic \
-    sun/security/tools/jarsigner \
-    sun/tools/asm \
-    sun/tools/attach \
-    sun/tools/jar \
-    sun/tools/java \
-    sun/tools/javac \
-    sun/tools/jcmd \
-    sun/tools/jinfo \
-    sun/tools/jmap \
-    sun/tools/jps \
-    sun/tools/jstack \
-    sun/tools/jstat \
-    sun/tools/jstatd \
-    sun/tools/native2ascii \
-    sun/tools/serialver \
-    sun/tools/tree \
-    sun/tools/util
-
-# The sjavac tools is not ready for public consumption.
-TOOLS_JAR_EXCLUDES = com/sun/tools/sjavac
-
-TOOLS_JAR_SRC := $(addprefix $(JDK_OUTPUTDIR)/modules/,\
-    java.corba \
-    java.desktop \
-    jdk.attach \
-    jdk.compiler \
-    jdk.dev \
-    jdk.javadoc \
-    jdk.jconsole \
-    jdk.jcmd \
-    jdk.jdi \
-    jdk.jvmstat \
-    jdk.rmic \
-    jdk.runtime \
-    jdk.xml.bind \
-    jdk.xml.ws \
-    )
-    #
-
-$(eval $(call SetupArchive,BUILD_TOOLS_JAR, , \
-    SRCS := $(TOOLS_JAR_SRC), \
-    SUFFIXES := .class .prp .gif .properties .xml .css .xsd .js .html .txt .java \
-        Tool aliasmap options, \
-    INCLUDES := $(TOOLS_JAR_INCLUDES), \
-    EXCLUDES := $(TOOLS_JAR_EXCLUDES), \
-    EXTRA_FILES := \
-        $(JDK_OUTPUTDIR)/modules/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector \
-        META-INF/services/com.sun.jdi.connect.spi.TransportService \
-        META-INF/services/com.sun.tools.attach.spi.AttachProvider \
-        META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin \
-        META-INF/services/com.sun.tools.internal.xjc.Plugin, \
-    JAR := $(IMAGES_OUTPUTDIR)/lib/tools.jar, \
-    SKIP_METAINF := true, \
-    CHECK_COMPRESS_JAR := true))
-
-
-##########################################################################################
-
-include CORE_PKGS.gmk
-include NON_CORE_PKGS.gmk
-
-# The compiler should not issue a "Proprietary" warning when compiling
-# classes in the com.sun.java.swing.plaf packages, since we've always
-# allowed, and even advocated, extending them (see bug 6476749).
-#
-# This approach is NOT to be used as a general purpose way to avoid such
-# compiler warnings for non-core packages. The correct way is to document
-# the packages in NON_CORE_PKGS.gmk, and include them in the NON_CORE_PKGS
-# definition.
-#
-# Swing has taken this approach only as a temporary measure to avoid
-# the compiler warnings until we can properly document these packages.
-# This is covered under 6491853.
-EXCLUDE_PROPWARN_PKGS = com.sun.java.swing.plaf.windows \
-    com.sun.java.swing.plaf.motif \
-    com.sun.java.swing.plaf.gtk
-
-#
-# Include the exported private packages in ct.sym.
-# This is an interim solution until the ct.sym is replaced
-# with a new module system (being discussed for JDK 8).
-#
-EXPORTED_PRIVATE_PKGS = com.oracle.net \
-    com.oracle.nio
-
-$(IMAGES_OUTPUTDIR)/symbols/_the.symbols: $(IMAGES_OUTPUTDIR)/lib/rt.jar
-	$(RM) -r $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
-	$(MKDIR) -p $(IMAGES_OUTPUTDIR)/symbols/META-INF/sym
-	$(JAVA) $(NEW_JAVAC) \
-	    -bootclasspath "$(IMAGES_OUTPUTDIR)/lib/rt.jar" \
-	    -XDprocess.packages -proc:only \
-	    -processor com.sun.tools.javac.sym.CreateSymbols \
-	    -Acom.sun.tools.javac.sym.Jar=$(IMAGES_OUTPUTDIR)/lib/rt.jar \
-	    -Acom.sun.tools.javac.sym.Dest=$(IMAGES_OUTPUTDIR)/symbols/META-INF/sym/rt.jar \
-	    -Acom.sun.tools.javac.sym.Profiles=profile-rtjar-includes.txt \
-	    $(CORE_PKGS) $(NON_CORE_PKGS) $(EXCLUDE_PROPWARN_PKGS) $(EXPORTED_PRIVATE_PKGS)
-	$(TOUCH) $@
-
-$(eval $(call MakeDir, $(IMAGES_OUTPUTDIR)/symbols))
-$(eval $(call SetupArchive,BUILD_CT_SYM, $(IMAGES_OUTPUTDIR)/symbols/_the.symbols, \
-    SRCS := $(IMAGES_OUTPUTDIR)/symbols, \
-    INCLUDES := META-INF/sym, \
-    JAR := $(IMAGES_OUTPUTDIR)/lib/ct.sym, \
-    CHECK_COMPRESS_JAR := true))
-
-
-##########################################################################################
-
-ifdef OPENJDK
-    SRC_ZIP_INCLUDES = \
-        com \
-        java \
-        javax \
-        jdk \
-        org \
-        sun \
-        #
-    SRC_ZIP_EXCLUDES =
-else
-    SRC_ZIP_INCLUDES = \
-        com/sun/corba \
-        com/sun/image/codec/jpeg \
-        com/sun/imageio \
-        com/sun/java_cup \
-        com/sun/javadoc \
-        com/sun/java/swing \
-        com/sun/jmx \
-        com/sun/naming \
-        com/sun/org/apache \
-        com/sun/security/auth \
-        com/sun/security/jgss \
-        com/sun/source \
-        java \
-        javax/accessibility \
-        javax/annotation \
-        javax/imageio \
-        javax/lang \
-        javax/management \
-        javax/naming \
-        javax/print \
-        javax/rmi \
-        javax/script \
-        javax/security \
-        javax/sound \
-        javax/sql \
-        javax/swing \
-        javax/tools \
-        javax/xml \
-        org/ietf \
-        org/omg \
-        org/w3c/dom \
-        org/xml/sax \
-        #
-    SRC_ZIP_EXCLUDES = javax/swing/beaninfo
-endif
-
-SRC_ZIP_SRCS := $(wildcard \
-    $(JDK_TOPDIR)/src/*/share/classes \
-    $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS)/classes \
-    $(JDK_TOPDIR)/src/*/$(OPENJDK_TARGET_OS_API_DIR)/classes \
-    $(LANGTOOLS_TOPDIR)/src/*/share/classes \
-    $(CORBA_TOPDIR)/src/*/share/classes \
-    $(JAXP_TOPDIR)/src/*/share/classes \
-    $(JAXWS_TOPDIR)/src/*/share/classes \
-    $(JDK_OUTPUTDIR)/gensrc/j* \
-    $(JDK_OUTPUTDIR)/gendocsrc_rmic \
-    $(CORBA_OUTPUTDIR)/gensrc/j* \
-    ) \
-    #
-ifndef OPENJDK
-  SRC_ZIP_SRCS += $(wildcard $(JDK_TOPDIR)/src/closed/*/share/classes)
-endif
-
-# Need to copy launcher src files into desired directory structure
-# before zipping the sources.
-$(eval $(call SetupCopyFiles,COPY_LAUNCHER_SRC, \
-    SRC := $(JDK_TOPDIR)/src/java.base, \
-    DEST := $(IMAGES_OUTPUTDIR)/src/launcher, \
-    FLATTEN := true, \
-    FILES := $(wildcard \
-        $(JDK_TOPDIR)/src/java.base/share/native/launcher/* \
-        $(JDK_TOPDIR)/src/java.base/share/native/libjli/* \
-        $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjli/java_md*)))
-
-LAUNCHER_ZIP_SRC := $(COPY_LAUNCHER_SRC)
-
-$(IMAGES_OUTPUTDIR)/src.zip: $(LAUNCHER_ZIP_SRC)
-
-# This dir needs to exist before macro is evaluated to avoid warning from find.
-$(eval $(call MakeDir, $(IMAGES_OUTPUTDIR)/src))
-$(eval $(call SetupZipArchive,BUILD_SRC_ZIP, \
-    SRC := $(SRC_ZIP_SRCS) $(IMAGES_OUTPUTDIR)/src, \
-    INCLUDES := $(SRC_ZIP_INCLUDES) launcher, \
-    EXCLUDES := $(SRC_ZIP_EXCLUDES), \
-    SUFFIXES := .java .c .h, \
-    ZIP := $(IMAGES_OUTPUTDIR)/src.zip, \
-    EXTRA_DEPS := $(LAUNCHER_ZIP_SRC)))
-
-##########################################################################################
-
-# This file is imported from hotspot in Import.gmk. Copying it into images/lib so that
-# all jars can be found in one place when creating images in Images.gmk. It needs to be
-# done here so that clean targets can be simple and accurate.
-$(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar: $(HOTSPOT_DIST)/lib/sa-jdi.jar
-	$(install-file)
-
-##########################################################################################
-#
-# sec-bin.zip is used by builds where the corresponding sources are not available
-#
-$(eval $(call SetupZipArchive,BUILD_SEC_BIN_ZIP, \
-    SRC := $(JDK_OUTPUTDIR), \
-    INCLUDES := \
-        modules/java.base/javax/crypto \
-        modules/java.base/javax/crypto/spec \
-        modules/java.base/sun/security/internal/interfaces \
-        modules/java.base/sun/security/internal/spec \
-        modules/java.base/com/sun/crypto/provider \
-        modules/jdk.crypto.ec/sun/security/ec \
-        modules/jdk.crypto.mscapi/sun/security/mscapi \
-        modules/jdk.crypto.pkcs11/sun/security/pkcs11 \
-        modules/jdk.crypto.pkcs11/sun/security/pkcs11/wrapper \
-        modules/jdk.crypto.ucrypto/com/oracle/security/ucrypto \
-        modules/java.base/javax/net \
-        modules/java.base/javax/security/cert \
-        modules/java.base/com/sun/net/ssl \
-        modules/java.base/com/sun/security/cert \
-        modules/java.base/sun/net/www/protocol/https \
-        modules/java.base/sun/security/pkcs12 \
-        modules/java.base/sun/security/ssl \
-        modules/java.security.jgss/sun/security/krb5 \
-        modules/java.security.jgss/sun/security/krb5/internal \
-        modules/java.security.jgss/sun/security/krb5/internal/ccache \
-        modules/java.security.jgss/sun/security/krb5/internal/crypto \
-        modules/java.security.jgss/sun/security/krb5/internal/ktab \
-        modules/java.security.jgss/sun/security/krb5/internal/rcache \
-        modules/java.security.jgss/sun/security/krb5/internal/util, \
-    INCLUDE_FILES := modules/java.security.jgss/sun/security/jgss/spi/GSSContextSpi.class, \
-    EXCLUDES := modules/java.security.jgss/sun/security/krb5/internal/tools, \
-    ZIP := $(IMAGES_OUTPUTDIR)/sec-bin.zip))
-
-JARS += $(IMAGES_OUTPUTDIR)/sec-bin.zip
-
-##########################################################################################
-#
-# Windows specific binary security packages.
-#
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  # sec-windows-bin.zip is used by builds where the corresponding sources are not available
-  $(eval $(call SetupZipArchive,BUILD_SEC_WINDOWS_BIN_ZIP, \
-      SRC := $(JDK_OUTPUTDIR), \
-      INCLUDES := modules/java.security.jgss/sun/security/krb5/internal/tools, \
-      ZIP := $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip))
-
-  JARS += $(IMAGES_OUTPUTDIR)/sec-windows-bin.zip
-
-  # JGSS files contain the native Kerberos library
-  ifeq ($(OPENJDK_TARGET_CPU), x86_64)
-    JGSS_ZIP_NAME = jgss-windows-x64-bin.zip
-  else
-    JGSS_ZIP_NAME = jgss-windows-i586-bin.zip
-  endif
-
-  $(eval $(call SetupZipArchive,BUILD_JGSS_BIN_ZIP, \
-      SRC := $(JDK_OUTPUTDIR), \
-      INCLUDE_FILES := bin/w2k_lsa_auth.dll \
-          bin/w2k_lsa_auth.map \
-          bin/w2k_lsa_auth.pdb, \
-      ZIP := $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)))
-
-  JARS += $(IMAGES_OUTPUTDIR)/$(JGSS_ZIP_NAME)
-endif
-
-##########################################################################################
-
-# This rule copies all jars from jdk/lib/... to images/lib/... to avoid having to track 
-# which jars are where
-$(IMAGES_OUTPUTDIR)/lib/%: $(JDK_OUTPUTDIR)/lib/%
-	$(install-file)
-
-##########################################################################################
-
-# Import nashorn.jar from nashorn dist dir.
-$(IMAGES_OUTPUTDIR)/lib/ext/nashorn.jar: $(NASHORN_DIST)/nashorn.jar
-	$(install-file)
-
-##########################################################################################
-
-# Hook to include the corresponding custom file, if present.
-$(eval $(call IncludeCustomExtension, jdk, CreateJars.gmk))
-
-##########################################################################################
-
-all: $(JARS)
-
-.PHONY: default all
diff --git a/jdk/make/CreateSecurityJars.gmk b/jdk/make/CreateSecurityJars.gmk
deleted file mode 100644
index 252152a3357..00000000000
--- a/jdk/make/CreateSecurityJars.gmk
+++ /dev/null
@@ -1,195 +0,0 @@
-#
-# Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-include JavaCompilation.gmk
-
-##########################################################################################
-# Create manifest for security jars
-#
-# Include these extra attributes for now, should probably take out.
-#
-MAINMANIFEST := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf
-JCE_MANIFEST := $(JDK_OUTPUTDIR)/jce/unsigned/_the.security.manifest.mf
-
-$(JCE_MANIFEST): $(MAINMANIFEST)
-	$(MKDIR) -p $(@D)
-	$(RM) $@ $@.tmp
-	$(SED) -e "s#@@RELEASE@@#$(JDK_VERSION)#" \
-	    -e "s#@@COMPANY_NAME@@#$(COMPANY_NAME)#" \
-	    $(MAINMANIFEST) >> $@.tmp
-	$(ECHO) "Extension-Name: javax.crypto" >> $@.tmp
-	$(ECHO) "Implementation-Vendor-Id: com.sun" >> $@.tmp
-	$(ECHO) "Release-Version: $(RELEASE)" >> $@.tmp
-	$(MV) $@.tmp $@
-
-##########################################################################################
-# For crypto jars, always build the jar.
-#
-# The source for the crypto jars is not available for all licensees.
-# The BUILD_CRYPTO variable is set to no if these jars can't be built
-# to skip that step of the build.
-
-SUNPKCS11_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunpkcs11.jar
-SUNPKCS11_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/sunpkcs11.jar
-
-$(eval $(call SetupArchive,BUILD_SUNPKCS11_JAR, , \
-    SRCS := $(JDK_OUTPUTDIR)/modules/jdk.crypto.pkcs11, \
-    SUFFIXES := .class, \
-    INCLUDES := sun/security/pkcs11, \
-    JAR := $(SUNPKCS11_JAR_UNSIGNED), \
-    MANIFEST := $(JCE_MANIFEST), \
-    SKIP_METAINF := true))
-
-$(SUNPKCS11_JAR_UNSIGNED): $(JCE_MANIFEST)
-
-$(SUNPKCS11_JAR_DST): $(SUNPKCS11_JAR_UNSIGNED)
-	$(install-file)
-
-TARGETS += $(SUNPKCS11_JAR_UNSIGNED) $(SUNPKCS11_JAR_DST)
-
-##########################################################################################
-
-SUNEC_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunec.jar
-SUNEC_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/sunec.jar
-
-$(eval $(call SetupArchive,BUILD_SUNEC_JAR, , \
-    SRCS := $(JDK_OUTPUTDIR)/modules/jdk.crypto.ec, \
-    SUFFIXES := .class, \
-    INCLUDES := sun/security/ec, \
-    JAR := $(SUNEC_JAR_UNSIGNED), \
-    MANIFEST := $(JCE_MANIFEST), \
-    SKIP_METAINF := true))
-
-$(SUNEC_JAR_UNSIGNED): $(JCE_MANIFEST)
-
-$(SUNEC_JAR_DST): $(SUNEC_JAR_UNSIGNED)
-	$(install-file)
-
-TARGETS += $(SUNEC_JAR_UNSIGNED) $(SUNEC_JAR_DST)
-
-##########################################################################################
-
-SUNJCE_PROVIDER_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunjce_provider.jar
-SUNJCE_PROVIDER_JAR_UNSIGNED := \
-    $(JDK_OUTPUTDIR)/jce/unsigned/sunjce_provider.jar
-
-ifneq ($(BUILD_CRYPTO), no)
-  $(eval $(call SetupArchive,BUILD_SUNJCE_PROVIDER_JAR, , \
-      SRCS := $(JDK_OUTPUTDIR)/modules/java.base, \
-      SUFFIXES := .class, \
-      INCLUDES := com/sun/crypto/provider, \
-      JAR := $(SUNJCE_PROVIDER_JAR_UNSIGNED), \
-      MANIFEST := $(JCE_MANIFEST), \
-      SKIP_METAINF := true))
-
-  $(SUNJCE_PROVIDER_JAR_UNSIGNED): $(JCE_MANIFEST)
-
-  TARGETS += $(SUNJCE_PROVIDER_JAR_UNSIGNED)
-endif
-
-$(SUNJCE_PROVIDER_JAR_DST): $(SUNJCE_PROVIDER_JAR_UNSIGNED)
-	$(install-file)
-
-TARGETS += $(SUNJCE_PROVIDER_JAR_DST)
-
-##########################################################################################
-
-JCE_JAR_DST := $(JDK_OUTPUTDIR)/lib/jce.jar
-JCE_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/jce.jar
-
-ifneq ($(BUILD_CRYPTO), no)
-  $(eval $(call SetupArchive,BUILD_JCE_JAR, , \
-      SRCS := $(JDK_OUTPUTDIR)/modules/java.base, \
-      SUFFIXES := .class, \
-      INCLUDES := javax/crypto sun/security/internal, \
-      JAR := $(JCE_JAR_UNSIGNED), \
-      MANIFEST := $(JCE_MANIFEST), \
-      SKIP_METAINF := true))
-
-  $(JCE_JAR_UNSIGNED): $(JCE_MANIFEST)
-
-  TARGETS += $(JCE_JAR_UNSIGNED)
-endif
-
-$(JCE_JAR_DST): $(JCE_JAR_UNSIGNED)
-	$(install-file)
-
-TARGETS += $(JCE_JAR_DST)
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
-
-  SUNMSCAPI_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/sunmscapi.jar
-  SUNMSCAPI_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/sunmscapi.jar
-
-  $(eval $(call SetupArchive,BUILD_SUNMSCAPI_JAR, , \
-      SRCS := $(JDK_OUTPUTDIR)/modules/jdk.crypto.mscapi, \
-      SUFFIXES := .class, \
-      INCLUDES := sun/security/mscapi, \
-      JAR := $(SUNMSCAPI_JAR_UNSIGNED), \
-      MANIFEST := $(JCE_MANIFEST), \
-      SKIP_METAINF := true))
-
-  $(SUNMSCAPI_JAR_UNSIGNED): $(JCE_MANIFEST)
-
-  $(SUNMSCAPI_JAR_DST): $(SUNMSCAPI_JAR_UNSIGNED)
-	$(install-file)
-
-  TARGETS += $(SUNMSCAPI_JAR_UNSIGNED) $(SUNMSCAPI_JAR_DST)
-
-endif
-
-##########################################################################################
-
-ifeq ($(OPENJDK_TARGET_OS), solaris)
-
-  UCRYPTO_JAR_DST := $(JDK_OUTPUTDIR)/lib/ext/ucrypto.jar
-  UCRYPTO_JAR_UNSIGNED := $(JDK_OUTPUTDIR)/jce/unsigned/ucrypto.jar
-
-  $(eval $(call SetupArchive,BUILD_UCRYPTO_JAR, , \
-      SRCS := $(JDK_OUTPUTDIR)/modules/jdk.crypto.ucrypto, \
-      SUFFIXES := .class, \
-      INCLUDES := com/oracle/security/ucrypto, \
-      JAR := $(UCRYPTO_JAR_UNSIGNED), \
-      MANIFEST := $(JCE_MANIFEST), \
-      SKIP_METAINF := true))
-
-  $(UCRYPTO_JAR_UNSIGNED): $(JCE_MANIFEST)
-
-  $(UCRYPTO_JAR_DST): $(UCRYPTO_JAR_UNSIGNED)
-	$(install-file)
-
-  TARGETS += $(UCRYPTO_JAR_UNSIGNED) $(UCRYPTO_JAR_DST)
-
-endif
-
-all: $(TARGETS)
-
-.PHONY: default all
diff --git a/jdk/make/Images.gmk b/jdk/make/Images.gmk
deleted file mode 100644
index e7ec8c715e0..00000000000
--- a/jdk/make/Images.gmk
+++ /dev/null
@@ -1,782 +0,0 @@
-#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-include $(SPEC)
-include MakeBase.gmk
-include JavaCompilation.gmk
-
-default: images
-
-# Prepare the find cache.
-$(eval $(call FillCacheFind, \
-    $(wildcard $(JDK_OUTPUTDIR)/bin \
-        $(JDK_OUTPUTDIR)/lib \
-        $(IMAGES_OUTPUTDIR)/lib \
-        $(JDK_OUTPUTDIR)/include \
-        $(JDK_OUTPUTDIR)/sample \
-        $(JDK_OUTPUTDIR)/demo)))
-
-include Tools.gmk
-
-include Profiles.gmk
-
-# Note: This double-colon rule is intentional, to support
-# custom make file integration.
-images:: jre-image jdk-image
-
-overlay-images: jre-overlay-image jdk-overlay-image
-
-
-
-# Processing license files from source area to image area
-# These will be modified to have the platform specific EOL chars.
-define process-doc-file
-	$(ECHO) $(LOG_INFO) Processing $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	LC_ALL=C $(SED) 's/$$//g' $< > $@
-	$(CHMOD) 444 $@
-endef
-
-define AddFileToCopy
-  # Param 1 - src root dir
-  # Param 2 - dest root dir
-  # Param 3 - src file
-  # Param 4 - variable to add targets to
-
-  # Remove src dir root from src file
-  $2_$3_FILE := $$(patsubst $1/%,%,$3)
-
-  $2/$$($2_$3_FILE): $3
-	$(ECHO) $(LOG_INFO) Copying $$(patsubst $(OUTPUT_ROOT)/%,%,$$@)
-	$$(install-file)
-
-  $4 += $2/$$($2_$3_FILE)
-endef
-
-################################################################################
-#
-# JRE and JDK build rules
-#
-################################################################################
-#
-# Variable prefixes explained:
-# JRE_ refers to files in the j2re-*-image.
-# JDK_ refers to files in the j2sdk-image outside of the jre subdir.
-# JDKJRE_ refers to files in the j2sdk-image inside the jre subdir.
-#
-
-################################################################################
-# /bin dir
-
-ifeq ($(PROFILE), )
-  NOT_JRE_BIN_FILES := \
-      appletviewer$(EXE_SUFFIX) \
-      idlj$(EXE_SUFFIX) \
-      jar$(EXE_SUFFIX) \
-      jarsigner$(EXE_SUFFIX) \
-      java-rmi.cgi \
-      javac$(EXE_SUFFIX) \
-      javadoc$(EXE_SUFFIX) \
-      javah$(EXE_SUFFIX) \
-      javap$(EXE_SUFFIX) \
-      jdeps$(EXE_SUFFIX) \
-      jcmd$(EXE_SUFFIX) \
-      jdb$(EXE_SUFFIX) \
-      jps$(EXE_SUFFIX) \
-      jrunscript$(EXE_SUFFIX) \
-      jstat$(EXE_SUFFIX) \
-      jstatd$(EXE_SUFFIX) \
-      jstack$(EXE_SUFFIX) \
-      packagebean$(SCRIPT_SUFFIX) \
-      rmic$(EXE_SUFFIX) \
-      serialver$(EXE_SUFFIX) \
-      unregbean$(EXE_SUFFIX) \
-      jconsole$(EXE_SUFFIX) \
-      jinfo$(EXE_SUFFIX) \
-      jmap$(EXE_SUFFIX) \
-      native2ascii$(EXE_SUFFIX) \
-      xjc$(EXE_SUFFIX) \
-      wsgen$(EXE_SUFFIX) \
-      wsimport$(EXE_SUFFIX) \
-      schemagen$(EXE_SUFFIX) \
-      jsadebugd$(EXE_SUFFIX) \
-      jhat$(EXE_SUFFIX)
-endif
-
-WINDOWS_JDK_BIN_FILES = \
-    $(EXE_SUFFIX) \
-    $(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX) \
-    $(notdir $(MSVCR_DLL))
-
-WINDOWS_JDKJRE_BIN_FILES := \
-    $(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
-    $(SALIB_NAME)
-
-# Find all files in bin dir
-ALL_BIN_LIST := $(call CacheFind, $(JDK_OUTPUTDIR)/bin)
-
-# Prevent sjavac from entering the images.
-ALL_BIN_LIST := $(filter-out %/sjavac, $(ALL_BIN_LIST))
-
-# For unknown reason the debuginfo files for executables are not put into images
-# e.g filter them out
-ifneq ($(OPENJDK_TARGET_OS), windows)
-  ALL_BIN_LIST := $(filter-out %.debuginfo %.diz, $(ALL_BIN_LIST))
-else
-  # On windows, the libraries are in the bin dir, only filter out debuginfo files
-  # for executables. "java" is both a library and executable.
-  ALL_BIN_EXEC_FILES := $(filter-out java.exe, $(notdir $(filter %.exe, $(ALL_BIN_LIST))))
-  ALL_BIN_DEBUG_FILTER := $(addprefix %, $(patsubst %.exe, %.debuginfo, $(ALL_BIN_EXEC_FILES)) \
-      $(patsubst %.exe, %.diz, $(ALL_BIN_EXEC_FILES))) %.pdb
-  ALL_BIN_LIST := $(filter-out $(ALL_BIN_DEBUG_FILTER), $(ALL_BIN_LIST))
-endif
-
-JDKJRE_BIN_LIST := $(filter-out $(addprefix %, $(NOT_JRE_BIN_FILES)), $(ALL_BIN_LIST))
-JRE_BIN_LIST := $(filter-out $(addprefix %, $(WINDOWS_JDKJRE_BIN_FILES)), $(JDKJRE_BIN_LIST))
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  JDK_BIN_LIST := $(filter $(addprefix %, $(WINDOWS_JDK_BIN_FILES)), $(ALL_BIN_LIST))
-  # On windows x86, the server jvm is filtered out from the j2re image. This could possibly
-  # be handled by profiles in the future. If no client jvm is built, leave server in.
-  ifeq ($(OPENJDK_TARGET_CPU), x86)
-    ifeq ($(JVM_VARIANT_CLIENT), true)
-      JRE_BIN_LIST := $(filter-out $(JDK_OUTPUTDIR)/bin/server/%, $(JRE_BIN_LIST))
-    endif
-  endif
-else
-  JDK_BIN_LIST := $(ALL_BIN_LIST)
-endif
-
-ifneq ($(OPENJDK_TARGET_CPU_ISADIR), )
-  OVERLAY_FILTER := $(JDK_OUTPUTDIR)/bin$(OPENJDK_TARGET_CPU_ISADIR)%
-endif
-
-$(foreach f,$(filter-out $(OVERLAY_FILTER),$(JRE_BIN_LIST)), \
-    $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JRE_IMAGE_DIR),$f,JRE_BIN_TARGETS)))
-$(foreach f,$(filter-out $(OVERLAY_FILTER),$(JDK_BIN_LIST)), \
-    $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_BIN_TARGETS)))
-$(foreach f,$(filter-out $(OVERLAY_FILTER),$(JDKJRE_BIN_LIST)), \
-    $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR)/jre,$f,JDKJRE_BIN_TARGETS)))
-
-$(foreach f,$(filter $(OVERLAY_FILTER),$(JRE_BIN_LIST)), \
-    $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JRE_OVERLAY_IMAGE_DIR),$f,JRE_BIN_TARGETS)))
-$(foreach f,$(filter $(OVERLAY_FILTER),$(JDK_BIN_LIST)), \
-    $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR),$f,JDK_BIN_TARGETS)))
-$(foreach f,$(filter $(OVERLAY_FILTER),$(JDKJRE_BIN_LIST)), \
-    $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR)/jre,$f,JDKJRE_BIN_TARGETS)))
-
-################################################################################
-# /lib dir
-ifneq ($(OPENJDK_TARGET_OS), macosx)
-  JDKJRE_LIB_FILES := \
-      $(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) \
-      $(SALIB_NAME)
-endif
-
-ifeq ($(PROFILE), )
-  NOT_JRE_LIB_FILES := \
-      tools.jar \
-      jconsole.jar \
-      sa-jdi.jar \
-      dt.jar \
-      ct.sym
-
-  ifeq ($(OPENJDK_TARGET_OS), windows)
-    NOT_JRE_LIB_FILES += jawt.lib jvm.lib
-  endif
-endif
-
-JDK_LIB_FILES := $(NOT_JRE_LIB_FILES)
-ifeq ($(OPENJDK_TARGET_OS), linux)
-  JDK_LIB_FILES += jexec
-endif
-
-ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris),) # If Linux or Solaris
-    JDK_LIB_FILES += $(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX) \
-		     $(LIBRARY_PREFIX)jawt$(SHARED_LIBRARY_SUFFIX)
-endif
-
-# Find all files to copy from $(JDK_OUTPUTDIR)/lib
-# Jar files are not expected to be here
-ALL_JDKOUT_LIB_LIST := $(call not-containing,_the., $(filter-out %.jar, \
-    $(call CacheFind, $(JDK_OUTPUTDIR)/lib)))
-# Find all files to copy from $(IMAGES_OUTPUTDIR)/lib
-# This is were the jar files are and might not exist if building overlay-images
-ifneq ($(wildcard $(IMAGES_OUTPUTDIR)/lib), )
-  ALL_IMAGES_LIB_LIST := $(call not-containing,_the., \
-      $(call CacheFind, $(IMAGES_OUTPUTDIR)/lib))
-endif
-
-# Filter files to copy for each destination
-JRE_JDKOUT_LIB_LIST := $(filter-out $(addprefix %, $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)), \
-    $(ALL_JDKOUT_LIB_LIST))
-JDKJRE_JDKOUT_LIB_LIST := $(filter-out $(addprefix %, $(NOT_JRE_LIB_FILES)), $(ALL_JDKOUT_LIB_LIST))
-JDK_JDKOUT_LIB_LIST := $(filter $(addprefix %, $(JDK_LIB_FILES)), $(ALL_JDKOUT_LIB_LIST))
-
-JRE_IMAGES_LIB_LIST := $(filter-out $(addprefix %, $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)), \
-    $(ALL_IMAGES_LIB_LIST))
-JDKJRE_IMAGES_LIB_LIST := $(filter-out $(addprefix %, $(NOT_JRE_LIB_FILES)), $(ALL_IMAGES_LIB_LIST))
-JDK_IMAGES_LIB_LIST := $(filter $(addprefix %, $(JDK_LIB_FILES)), $(ALL_IMAGES_LIB_LIST))
-
-# Iterate over files to copy to create rules for each one
-$(foreach f,$(JRE_JDKOUT_LIB_LIST), \
-    $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JRE_IMAGE_DIR),$f,JRE_LIB_TARGETS)))
-$(foreach f,$(JDK_JDKOUT_LIB_LIST), \
-    $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_LIB_TARGETS)))
-$(foreach f,$(JDKJRE_JDKOUT_LIB_LIST), \
-    $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR)/jre,$f,JDKJRE_LIB_TARGETS)))
-
-$(foreach f,$(JRE_IMAGES_LIB_LIST), \
-    $(eval $(call AddFileToCopy,$(IMAGES_OUTPUTDIR),$(JRE_IMAGE_DIR),$f,JRE_LIB_TARGETS)))
-$(foreach f,$(JDK_IMAGES_LIB_LIST), \
-    $(eval $(call AddFileToCopy,$(IMAGES_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_LIB_TARGETS)))
-$(foreach f,$(JDKJRE_IMAGES_LIB_LIST), \
-    $(eval $(call AddFileToCopy,$(IMAGES_OUTPUTDIR),$(JDK_IMAGE_DIR)/jre,$f,JDKJRE_LIB_TARGETS)))
-
-$(foreach f,$(filter $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_ISADIR)/%,$(JRE_JDKOUT_LIB_LIST)), \
-    $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JRE_OVERLAY_IMAGE_DIR),$f,JRE_OVERLAY_LIB_TARGETS)))
-$(foreach f,$(filter $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_ISADIR)/%,$(JDK_JDKOUT_LIB_LIST)), \
-    $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR),$f,JDK_OVERLAY_LIB_TARGETS)))
-$(foreach f,$(filter $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_ISADIR)/%,$(JDKJRE_JDKOUT_LIB_LIST)), \
-    $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR)/jre,$f,JDKJRE_OVERLAY_LIB_TARGETS)))
-
-ifneq ($(PROFILE), )
-  # Files in lib$(PROFILE) are excluded from the generic copying routines so
-  # we have to add them back in here
-  $(foreach f,$(CUSTOM_PROFILE_JARS), \
-      $(eval $(call AddFileToCopy,$(IMAGES_OUTPUTDIR)/lib$(PROFILE),$(JRE_IMAGE_DIR)/lib,$f,JRE_LIB_TARGETS)))
-endif
-
-# CTE plugin security change require new empty directory lib/applet
-$(JRE_IMAGE_DIR)/lib/applet:
-	$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $@
-
-$(JDK_IMAGE_DIR)/jre/lib/applet:
-	$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(MKDIR) -p $@
-
-$(JRE_IMAGE_DIR)/lib/meta-index: $(JRE_LIB_TARGETS)
-	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
-
-$(JDK_IMAGE_DIR)/jre/lib/meta-index: $(JDKJRE_LIB_TARGETS)
-	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
-
-$(JRE_IMAGE_DIR)/lib/ext/meta-index: $(JRE_LIB_TARGETS)
-	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
-
-$(JDK_IMAGE_DIR)/jre/lib/ext/meta-index: $(JDKJRE_LIB_TARGETS)
-	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(CD) $(@D) && $(TOOL_BUILDMETAINDEX) -o meta-index *.jar
-
-################################################################################
-# /man dir
-#
-# All variables in this section are assigned with simple =, without :, to enable
-# more selective overriding from the custom version of this file.
-#
-# Avoid evaluating this whole section on windows for speed and stability
-ifneq ($(OPENJDK_TARGET_OS), windows)
-  JRE_MAN_PAGES = \
-      java.1 \
-      jjs.1 \
-      keytool.1 \
-      orbd.1 \
-      pack200.1 \
-      policytool.1 \
-      rmid.1 \
-      rmiregistry.1 \
-      servertool.1 \
-      tnameserv.1 \
-      unpack200.1
-
-  ifndef OPENJDK
-    ifneq ($(OPENJDK_TARGET_OS), solaris)
-      JRE_MAN_PAGES += javaws.1
-    endif
-  endif
-
-  JDK_MAN_PAGES = \
-      $(JRE_MAN_PAGES) \
-      appletviewer.1 \
-      idlj.1 \
-      jar.1 \
-      jarsigner.1 \
-      javac.1 \
-      javadoc.1 \
-      javah.1 \
-      javap.1 \
-      jconsole.1 \
-      jcmd.1 \
-      jdb.1 \
-      jdeps.1 \
-      jhat.1 \
-      jinfo.1 \
-      jmap.1 \
-      jps.1 \
-      jrunscript.1 \
-      jsadebugd.1 \
-      jstack.1 \
-      jstat.1 \
-      jstatd.1 \
-      native2ascii.1 \
-      rmic.1 \
-      schemagen.1 \
-      serialver.1 \
-      wsgen.1 \
-      wsimport.1 \
-      xjc.1
-
-  # This variable is potentially overridden in the closed makefile.
-  MAN_SRC_BASEDIR ?= $(JDK_TOPDIR)/src
-
-  ifeq ($(OPENJDK_TARGET_OS), linux)
-    MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/linux/doc
-    MAN1_SUBDIR = man
-  endif
-  ifeq ($(OPENJDK_TARGET_OS), solaris)
-    MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/solaris/doc
-    MAN1_SUBDIR = sun/man/man1
-  endif
-  ifeq ($(OPENJDK_TARGET_OS), macosx)
-    MAN_SRC_DIR = $(MAN_SRC_BASEDIR)/bsd/doc
-    MAN1_SUBDIR = man
-  endif
-
-  $(JRE_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
-	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-
-  $(JDK_IMAGE_DIR)/man/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/%
-	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-
-  $(JRE_IMAGE_DIR)/man/man1/%: $(JDK_OUTPUTDIR)/impdoc/$(MAN1_SUBDIR)/%
-	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-
-  $(JDK_IMAGE_DIR)/man/man1/%: $(JDK_OUTPUTDIR)/impdoc/$(MAN1_SUBDIR)/%
-	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-
-  define install-ja-manpage
-	$(MKDIR) -p $(@D)
-	$(CAT) $< \
-	    | $(NATIVE2ASCII) -encoding eucJP \
-	    | $(SED) 's/@@VERSION@@/$(THIS_JDK_VERSION)/g' \
-	    | $(NATIVE2ASCII) -reverse -encoding $1 \
-	    > $@
-  endef
-
-  $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(call install-ja-manpage, UTF-8)
-
-  $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(call install-ja-manpage, UTF-8)
-
-  $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(call install-ja-manpage, PCK)
-
-  $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(call install-ja-manpage, PCK)
-
-  ifeq ($(OPENJDK_TARGET_OS), solaris)
-    $(JRE_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-
-    $(JDK_IMAGE_DIR)/man/ja/man1/%: $(MAN_SRC_DIR)/$(MAN1_SUBDIR)/ja/%
-	$(ECHO) $(LOG_INFO) Converting $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-  endif
-
-  ifeq ($(OPENJDK_TARGET_OS), linux)
-    $(JRE_IMAGE_DIR)/man/ja:
-	$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
-
-    $(JDK_IMAGE_DIR)/man/ja:
-	$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
-  endif
-
-  ifeq ($(OPENJDK_TARGET_OS), macosx)
-    $(JRE_IMAGE_DIR)/man/ja:
-	$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
-
-    $(JDK_IMAGE_DIR)/man/ja:
-	$(ECHO) $(LOG_INFO) Creating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(CD) $(@D) && $(RM) ja && $(LN) -s ja_JP.UTF-8 ja
-  endif
-
-  ifeq ($(OPENJDK_TARGET_OS), linux)
-    JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
-        $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
-        $(JRE_IMAGE_DIR)/man/ja
-
-    JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
-        $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
-        $(JDK_IMAGE_DIR)/man/ja
-  endif
-
-  ifeq ($(OPENJDK_TARGET_OS), solaris)
-    JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
-        $(addprefix $(JRE_IMAGE_DIR)/man/ja/man1/, $(JRE_MAN_PAGES)) \
-        $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
-        $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JRE_MAN_PAGES))
-
-    JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
-        $(addprefix $(JDK_IMAGE_DIR)/man/ja/man1/, $(JDK_MAN_PAGES)) \
-        $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
-        $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.PCK/man1/, $(JDK_MAN_PAGES))
-  endif
-
-  ifeq ($(OPENJDK_TARGET_OS), macosx)
-    JRE_MAN_PAGE_LIST = $(addprefix $(JRE_IMAGE_DIR)/man/man1/, $(JRE_MAN_PAGES)) \
-        $(addprefix $(JRE_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JRE_MAN_PAGES)) \
-        $(JRE_IMAGE_DIR)/man/ja
-
-    JDK_MAN_PAGE_LIST = $(addprefix $(JDK_IMAGE_DIR)/man/man1/, $(JDK_MAN_PAGES)) \
-        $(addprefix $(JDK_IMAGE_DIR)/man/ja_JP.UTF-8/man1/, $(JDK_MAN_PAGES)) \
-        $(JDK_IMAGE_DIR)/man/ja
-  endif
-
-endif # Windows
-
-################################################################################
-# /demo dir
-
-# FIXME: demo/applets/GraphLayout/GraphPanel$2.class is sometimes not copied.
-
-# The db demo contains an empty dir that needs to be copied. The other
-# directories will always trigger the rule for recompile since
-# _the.list_of_packages files are touched.
-$(JDK_IMAGE_DIR)/demo/%: $(JDK_OUTPUTDIR)/demo/%
-	if [ ! -d "$@" ]; then \
-	  $(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'; \
-	  $(MKDIR) -p $(@D); \
-	  if [ -d "$<" ]; then $(MKDIR) -p $@; else $(CP) '$<' '$@'; fi \
-	fi
-
-# Find all files including directories
-JDK_DEMO_TARGETS := $(patsubst $(JDK_OUTPUTDIR)/demo/%, $(JDK_IMAGE_DIR)/demo/%, \
-    $(shell $(FIND) $(JDK_OUTPUTDIR)/demo ! \( -name "_the*" -o -name "javac_state" \) ))
-
-
-
-# Param 1 is source file
-define CreateOverlayDemoRule
-  $1_TARGET := $$(subst $(JDK_OUTPUTDIR),$(JDK_OVERLAY_IMAGE_DIR), \
-      $$(dir $1)$(OPENJDK_TARGET_CPU_ISADIR)/$$(notdir $1))
-  $$($1_TARGET): $1
-	$(ECHO) $(LOG_INFO) Copying '$$(patsubst $(OUTPUT_ROOT)/%,%,$$@)'
-	$$(call install-file)
-
-  JDK_OVERLAY_DEMO_TARGETS += $$($1_TARGET)
-endef
-JDK_OVERLAY_DEMO_SOURCES := $(filter %$(SHARED_LIBRARY_SUFFIX), $(call CacheFind, $(JDK_OUTPUTDIR)/demo))
-$(foreach lib, $(JDK_OVERLAY_DEMO_SOURCES), $(eval $(call CreateOverlayDemoRule, $(lib))))
-
-################################################################################
-# /sample dir
-
-$(foreach f,$(call CacheFind,$(JDK_OUTPUTDIR)/sample), \
-    $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_SAMPLE_TARGETS)))
-
-################################################################################
-# /db dir
-
-ifndef OPENJDK
-  DB_ZIP_DIR := $(wildcard $(JDK_TOPDIR)/src/closed/db)
-
-  $(IMAGES_OUTPUTDIR)/_unzip/%.unzipped: $(DB_ZIP_DIR)/%
-	$(ECHO) Unzipping $(patsubst $(SRC_ROOT)/%,%,$<)
-	$(RM) -r $(JDK_IMAGE_DIR)/db
-	$(MKDIR) -p $(JDK_IMAGE_DIR)/db
-	cd $(JDK_IMAGE_DIR)/db && $(UNZIP) -q -o $< -x */index.html */KEYS */test/* *javadoc/* */docs/* */demo/* 2> /dev/null
-	cd $(JDK_IMAGE_DIR)/db && $(MV) db-derby-*-bin/* . && $(RM) -r db-derby-*-bin
-	$(MKDIR) -p $(@D)
-	$(TOUCH) $@
-
-  $(JDK_IMAGE_DIR)/db/README-JDK.html: $(DB_ZIP_DIR)/README-JDK.html
-	$(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'
-	$(MKDIR) -p $(@D)
-	$(CAT) $< | $(SED) "s/XXXX/$(shell cat $(DB_ZIP_DIR)/COPYRIGHTYEAR)/" > $@
-
-  $(JDK_IMAGE_DIR)/db/3RDPARTY: $(DB_ZIP_DIR)/3RDPARTY
-	$(ECHO) $(LOG_INFO) Copying '$(patsubst $(OUTPUT_ROOT)/%,%,$@)'
-	$(MKDIR) -p $(@D)
-	$(CAT) $< | $(SED) "s/XXXX/$(shell cat $(DB_ZIP_DIR)/COPYRIGHTYEAR)/" > $@
-
-  JDK_DB_TARGETS := $(patsubst $(DB_ZIP_DIR)/%, $(IMAGES_OUTPUTDIR)/_unzip/%.unzipped, \
-      $(wildcard $(DB_ZIP_DIR)/*.zip)) \
-      $(JDK_IMAGE_DIR)/db/README-JDK.html $(JDK_IMAGE_DIR)/db/3RDPARTY
-
-endif
-
-################################################################################
-# /include dir
-
-$(foreach f,$(call CacheFind,$(JDK_OUTPUTDIR)/include), \
-    $(eval $(call AddFileToCopy,$(JDK_OUTPUTDIR),$(JDK_IMAGE_DIR),$f,JDK_INCLUDE_TARGETS)))
-
-################################################################################
-# doc files
-
-ifdef OPENJDK
-  JRE_DOC_FILES := LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
-  JDK_DOC_FILES := LICENSE ASSEMBLY_EXCEPTION THIRD_PARTY_README
-  JRE_DOC_LOCATION := $(JDK_TOPDIR)
-  JDK_DOC_LOCATION := $(JDK_TOPDIR)
-else
-  JRE_DOC_FILES := COPYRIGHT Welcome.html LICENSE THIRDPARTYLICENSEREADME.txt
-  JDK_DOC_FILES := COPYRIGHT README.html LICENSE THIRDPARTYLICENSEREADME.txt
-  ifeq ($(OPENJDK_TARGET_OS), windows)
-    JRE_DOC_FILES += README.txt
-  else
-    JRE_DOC_FILES += README
-  endif
-  JDK_DOC_FILES += demo/DEMOS_LICENSE sample/SAMPLES_LICENSE
-  JRE_DOC_LOCATION := $(JDK_TOPDIR)/src/closed/doc/jre
-  JDK_DOC_LOCATION := $(JDK_TOPDIR)/src/closed/doc/jdk
-endif
-JRE_DOC_TARGETS := $(addprefix $(JRE_IMAGE_DIR)/, $(JRE_DOC_FILES))
-JDKJRE_DOC_TARGETS := $(addprefix $(JDK_IMAGE_DIR)/jre/, $(JRE_DOC_FILES))
-JDK_DOC_TARGETS := $(addprefix $(JDK_IMAGE_DIR)/, $(JDK_DOC_FILES))
-
-$(JRE_IMAGE_DIR)/%: $(JRE_DOC_LOCATION)/%
-	$(process-doc-file)
-
-$(JDK_IMAGE_DIR)/jre/%: $(JRE_DOC_LOCATION)/%
-	$(process-doc-file)
-
-$(JRE_IMAGE_DIR)/README.txt: $(JRE_DOC_LOCATION)/README
-	$(process-doc-file)
-
-$(JDK_IMAGE_DIR)/jre/README.txt: $(JRE_DOC_LOCATION)/README
-	$(process-doc-file)
-
-$(JDK_IMAGE_DIR)/%: $(JDK_DOC_LOCATION)/%
-	$(process-doc-file)
-
-$(JDK_IMAGE_DIR)/demo/%: $(JDK_DOC_LOCATION)/%
-	$(process-doc-file)
-
-$(JDK_IMAGE_DIR)/sample/%: $(JDK_DOC_LOCATION)/%
-	$(process-doc-file)
-
-JRE_INFO_FILE := $(JRE_IMAGE_DIR)/release
-JDK_INFO_FILE := $(JDK_IMAGE_DIR)/release
-
-JRE_OVERLAY_INFO_FILE := $(JRE_OVERLAY_IMAGE_DIR)/release
-JDK_OVERLAY_INFO_FILE := $(JDK_OVERLAY_IMAGE_DIR)/release
-
-# Common way to emit a line into the release or info file
-define info-file-item # name value
-	$(PRINTF) '%s="%s"\n' $1 $2 >> $@
-endef
-
-define create-info-file
-	$(MKDIR) -p $(@D)
-	$(RM) $@
-	$(call info-file-item, "JAVA_VERSION", "$(JDK_VERSION)")
-	$(call info-file-item, "OS_NAME", "$(REQUIRED_OS_NAME)")
-	$(call info-file-item, "OS_VERSION", "$(REQUIRED_OS_VERSION)")
-	$(call info-file-item, "OS_ARCH", "$(OPENJDK_TARGET_CPU_LEGACY)")
-	if [ -n "$(JDK_ARCH_ABI_PROP_NAME)" ]; then $(call info-file-item, "SUN_ARCH_ABI", "$(JDK_ARCH_ABI_PROP_NAME)"); fi
-	$(call info-file-item, "SOURCE", "$(ALL_SOURCE_TIPS)")
-endef
-
-ALL_SOURCE_TIPS = $(shell \
-    if [ -f $(OUTPUT_ROOT)/source_tips ] ; then \
-      $(CAT) $(OUTPUT_ROOT)/source_tips ; \
-    fi)
-
-$(JRE_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
-	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(call create-info-file)
-        ifneq ($(PROFILE), )
-	  $(call info-file-item, "JAVA_PROFILE", "$(call profile_name, $(call profile_number, $(PROFILE)))")
-        endif
-
-$(JDK_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
-	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(call create-info-file)
-
-$(JRE_OVERLAY_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
-	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(call create-info-file)
-
-$(JDK_OVERLAY_INFO_FILE): $(OUTPUT_ROOT)/spec.gmk $(OUTPUT_ROOT)/source_tips
-	$(ECHO) $(LOG_INFO) Generating $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(call create-info-file)
-
-$(JDK_IMAGE_DIR)/src.zip: $(IMAGES_OUTPUTDIR)/src.zip
-	$(ECHO) $(LOG_INFO) Copying $(patsubst $(OUTPUT_ROOT)/%,%,$@)
-	$(install-file)
-
-################################################################################
-# Post processing (strip etc)
-
-ifneq ($(POST_STRIP_CMD), )
-  ifeq ($(OPENJDK_TARGET_OS), windows)
-    EXEC_LIST_BIN := $(filter-out %$(notdir $(MSVCR_DLL)), $(filter %.exe %.dll, $(ALL_BIN_LIST)))
-  else
-    # Find all executables in JDK_OUTPUTDIR since they exist when this makefile is parsed
-    EXEC_LIST_BIN := $(shell $(FILE) `$(FIND) $(JDK_OUTPUTDIR)/bin -type f -name \*$(EXE_SUFFIX) ! -name \*.debuginfo` \
-        | $(EGREP) 'ELF' | $(CUT) -d':' -f1)
-    # On mac, the old build searches for static libraries for stripping instead of shared.
-    # Not clear if it's intentional.
-    ifneq ($(OPENJDK_TARGET_OS), macosx)
-      EXEC_LIST_LIB := $(shell $(FIND) $(JDK_OUTPUTDIR)/lib -type f -name \*$(SHARED_LIBRARY_SUFFIX))
-    endif
-  endif
-  # Filter out sjavac
-  EXEC_LIST_BIN := $(filter-out %sjavac$(EXE_SUFFIX), $(EXEC_LIST_BIN))
-
-  # Filter out the overlay specific bin files
-  EXEC_LIST := $(filter-out $(OVERLAY_FILTER), $(EXEC_LIST_BIN)) $(EXEC_LIST_LIB)
-  EXEC_LIST_OVERLAY := $(filter $(OVERLAY_FILTER), $(EXEC_LIST_BIN)) $(EXEC_LIST_LIB)
-
-  # Filter out non JRE files and convert to unique touch files to depend on
-  JRE_STRIP_LIST := $(patsubst $(JDK_OUTPUTDIR)/%, $(IMAGES_OUTPUTDIR)/_strip_jre$(PROFILE)/%.stripped, \
-      $(filter-out $(addprefix %, $(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)), \
-      $(EXEC_LIST)))
-
-  JDKJRE_STRIP_LIST := $(patsubst $(JDK_OUTPUTDIR)/%, \
-      $(IMAGES_OUTPUTDIR)/_strip_jdk/jre/%.stripped, \
-      $(filter-out $(addprefix %, $(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES)), $(EXEC_LIST)))
-
-  JDK_BIN_STRIP_LIST := $(patsubst $(JDK_OUTPUTDIR)/%, \
-      $(IMAGES_OUTPUTDIR)/_strip_jdk/%.stripped, \
-      $(filter-out $(JDK_OUTPUTDIR)/lib/%, $(EXEC_LIST)))
-
-  # Do the same for overlay image
-  JRE_OVERLAY_STRIP_LIST := $(patsubst $(JDK_OUTPUTDIR)/%, $(IMAGES_OUTPUTDIR)/_strip_jre_overlay/%.stripped, \
-      $(filter-out $(addprefix %, $(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES) $(JDKJRE_LIB_FILES)), \
-      $(EXEC_LIST_OVERLAY)))
-
-  JDKJRE_OVERLAY_STRIP_LIST := $(patsubst $(JDK_OUTPUTDIR)/%, \
-      $(IMAGES_OUTPUTDIR)/_strip_jdk_overlay/jre/%.stripped, \
-      $(filter-out $(addprefix %, $(NOT_JRE_BIN_FILES) $(NOT_JRE_LIB_FILES)), $(EXEC_LIST_OVERLAY)))
-
-  JDK_OVERLAY_BIN_STRIP_LIST := $(patsubst $(JDK_OUTPUTDIR)/%, \
-      $(IMAGES_OUTPUTDIR)/_strip_jdk_overlay/%.stripped, \
-      $(filter-out $(JDK_OUTPUTDIR)/lib/%, $(EXEC_LIST_OVERLAY)))
-
-  define mcs-file
-	$(if $(POST_MCS_CMD), $(POST_MCS_CMD) $<)
-  endef
-
-  define strip-file
-	$(ECHO) Stripping $(LOG_INFO) $(patsubst $(OUTPUT_ROOT)/%,%,$<)
-	$(CHMOD) u+w $<
-	$(POST_STRIP_CMD) $<
-	$(call mcs-file)
-	$(CHMOD) go-w $<
-	$(MKDIR) -p $(@D)
-	$(TOUCH) $@
-  endef
-
-  # Setup a rule for stripping files based on touch files
-  $(IMAGES_OUTPUTDIR)/_strip_jre$(PROFILE)/%.stripped: $(JRE_IMAGE_DIR)/%
-	$(call strip-file)
-
-  $(IMAGES_OUTPUTDIR)/_strip_jdk/%.stripped: $(JDK_IMAGE_DIR)/%
-	$(call strip-file)
-
-  $(IMAGES_OUTPUTDIR)/_strip_jre_overlay/%.stripped: $(JRE_OVERLAY_IMAGE_DIR)/%
-	$(call strip-file)
-
-  $(IMAGES_OUTPUTDIR)/_strip_jdk_overlay/%.stripped: $(JDK_OVERLAY_IMAGE_DIR)/%
-	$(call strip-file)
-
-endif
-
-################################################################################
-
-# Include the custom makefile right here, after all variables have been defined
-# so that they may be overridden, but before the main targets are declared, so 
-# that overriding has an effect.
-$(eval $(call IncludeCustomExtension, jdk, Images.gmk))
-
-################################################################################
-# Main targets
-
-jre-image: $(JRE_BIN_TARGETS) $(JRE_LIB_TARGETS) $(JRE_IMAGE_DIR)/lib/applet \
-    $(JRE_IMAGE_DIR)/lib/meta-index $(JRE_IMAGE_DIR)/lib/ext/meta-index \
-    $(JRE_MAN_PAGE_LIST) $(JRE_DOC_TARGETS) $(JRE_INFO_FILE) $(JRE_STRIP_LIST) \
-    $(JRE_BIN_ISADIR_LINK_TARGETS)
-
-jdk-image: $(JDK_BIN_TARGETS) $(JDKJRE_BIN_TARGETS) \
-    $(JDK_LIB_TARGETS) $(JDKJRE_LIB_TARGETS) \
-    $(JDK_IMAGE_DIR)/jre/lib/applet \
-    $(JDK_DEMO_TARGETS) \
-    $(JDK_IMAGE_DIR)/jre/lib/meta-index $(JDK_IMAGE_DIR)/jre/lib/ext/meta-index \
-    $(JDK_MAN_PAGE_LIST) $(JDK_SAMPLE_TARGETS) \
-    $(JDK_DB_TARGETS) $(JDK_INCLUDE_TARGETS) \
-    $(JDKJRE_DOC_TARGETS) $(JDK_DOC_TARGETS) \
-    $(JDK_INFO_FILE) $(JDKJRE_STRIP_LIST) $(JDK_BIN_STRIP_LIST) \
-    $(JDK_IMAGE_DIR)/src.zip \
-    $(JDK_BIN_ISADIR_LINK_TARGETS) $(JDKJRE_BIN_ISADIR_LINK_TARGETS)
-
-jre-overlay-image: $(JRE_OVERLAY_BIN_TARGETS) $(JRE_OVERLAY_LIB_TARGETS) \
-    $(JRE_OVERLAY_INFO_FILE) $(JRE_OVERLAY_STRIP_LIST)
-
-jdk-overlay-image: $(JDK_OVERLAY_BIN_TARGETS) $(JDKJRE_OVERLAY_BIN_TARGETS) \
-    $(JDK_OVERLAY_LIB_TARGETS) $(JDKJRE_OVERLAY_LIB_TARGETS) \
-    $(JDK_OVERLAY_DEMO_TARGETS) $(JDK_OVERLAY_INFO_FILE) \
-    $(JDKJRE_OVERLAY_STRIP_LIST) $(JDK_OVERLAY_BIN_STRIP_LIST)
-
-ifneq ($(PROFILE), )
-  PROFILE_IMAGE_JARS := $(filter %.jar, $(JRE_LIB_TARGETS))
-
-  PROFILE_IMAGE_JARS_CHECKED := $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/_jars_checked
-
-  $(PROFILE_IMAGE_JARS_CHECKED) : $(PROFILE_IMAGE_JARS)
-	$(TOOL_CHECKDEPS) $(JRE_IMAGE_DIR) \
-	    $(call profile_name, $(call profile_number, $(PROFILE)))
-	$(TOUCH) $@
-
-  profile-image: $(JRE_BIN_TARGETS) $(JRE_LIB_TARGETS) \
-	$(JRE_IMAGE_DIR)/lib/meta-index $(JRE_IMAGE_DIR)/lib/ext/meta-index \
-	$(JRE_INFO_FILE) $(JRE_STRIP_LIST) $(PROFILE_IMAGE_JARS_CHECKED)
-
-  .PHONY: profile-image
-
-endif # Profile
-
-################################################################################
-
-.PHONY: default images jre-image jdk-image
diff --git a/jdk/make/Import.gmk b/jdk/make/Import.gmk
index 5bf9437da7f..66996057fa4 100644
--- a/jdk/make/Import.gmk
+++ b/jdk/make/Import.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -31,34 +31,53 @@ include MakeBase.gmk
 ################################################################################
 
 # Put the libraries here. Different locations for different target apis.
-ifeq ($(OPENJDK_TARGET_OS_API), posix)
-  INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
+ifneq ($(OPENJDK_TARGET_OS), windows)
   HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)
+  BASE_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)
+  SA_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent$(OPENJDK_TARGET_CPU_LIBDIR)
 else
-  INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/bin
   HOTSPOT_LIB_DIR := $(HOTSPOT_DIST)/jre/bin
+  BASE_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
+  SA_INSTALL_LIBRARIES_HERE := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent
 endif
 
 ################################################################################
-
-define CopyDir
-  $1_SRC_FILES := $(shell $(FIND) $2 -type f -a \( -name DUMMY $(addprefix -o$(SPACE)-name$(SPACE),$4) \))
-  $1_DST_FILES := $$(patsubst $2/%,$3/%,$$($1_SRC_FILES))
-  HOTSPOT_IMPORT_TARGET_FILES += $$($1_DST_FILES)
-  $3/%: $2/%
-	$(ECHO) $(LOG_INFO) Copying $$(@F)
-	$$(install-file)
-endef
-
-################################################################################
-
 #
 # Import hotspot
 #
-HOTSPOT_IMPORT_FILES := $(addprefix $(LIBRARY_PREFIX), jvm.* saproc.* jsig.* sawindbg.* jvm_db.* jvm_dtrace.*) \
-    Xusage.txt sa-jdi.jar
-$(eval $(call CopyDir,HOTSPOT0, $(HOTSPOT_LIB_DIR), $(INSTALL_LIBRARIES_HERE), $(HOTSPOT_IMPORT_FILES)))
-$(eval $(call CopyDir,HOTSPOT1, $(HOTSPOT_DIST)/lib, $(JDK_OUTPUTDIR)/lib, $(HOTSPOT_IMPORT_FILES)))
+HOTSPOT_BASE_IMPORT_FILES := \
+    $(addprefix $(LIBRARY_PREFIX), jvm.* jsig.* jvm_db.* jvm_dtrace.*) \
+    Xusage.txt \
+    #
+
+HOTSPOT_SA_IMPORT_FILES := \
+    $(addprefix $(LIBRARY_PREFIX), saproc.* sawindbg.*) \
+    #
+
+$(eval $(call SetupCopyFiles,COPY_HOTSPOT_BASE, \
+    SRC := $(HOTSPOT_LIB_DIR), \
+    DEST := $(BASE_INSTALL_LIBRARIES_HERE), \
+    FILES := $(shell $(FIND) $(HOTSPOT_LIB_DIR) -type f  \
+        -a \( -name DUMMY $(addprefix -o$(SPACE)-name$(SPACE), $(HOTSPOT_BASE_IMPORT_FILES)) \) )))
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  $(eval $(call SetupCopyFiles,COPY_HOTSPOT_BASE_JVMLIB, \
+      SRC := $(HOTSPOT_DIST)/lib, \
+      DEST := $(BASE_INSTALL_LIBRARIES_HERE), \
+      FILES := $(wildcard $(HOTSPOT_DIST)/lib/*.lib)))
+endif
+
+BASE_TARGETS := $(COPY_HOTSPOT_BASE) $(COPY_HOTSPOT_BASE_JVMLIB)
+
+$(eval $(call SetupCopyFiles,COPY_HOTSPOT_SA, \
+    SRC := $(HOTSPOT_LIB_DIR), \
+    DEST := $(SA_INSTALL_LIBRARIES_HERE), \
+    FILES := $(shell $(FIND) $(HOTSPOT_LIB_DIR) -type f  \
+        -a \( -name DUMMY $(addprefix -o$(SPACE)-name$(SPACE), $(HOTSPOT_SA_IMPORT_FILES)) \) )))
+
+SA_TARGETS := $(COPY_HOTSPOT_SA)
+
+################################################################################
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
   JSIG_DEBUGINFO := $(strip $(wildcard $(HOTSPOT_DIST)/jre/lib$(OPENJDK_TARGET_CPU_LIBDIR)/libjsig$(SHARED_LIBRARY_SUFFIX).dSYM) \
@@ -70,39 +89,39 @@ endif
 
 ifneq ($(OPENJDK_TARGET_OS), windows)
   ifeq ($(JVM_VARIANT_SERVER), true)
-    HOTSPOT_IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
+    BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
     ifneq (, $(JSIG_DEBUGINFO))
-      HOTSPOT_IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/server/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
+      BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/server/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
     endif
   endif
   ifeq ($(JVM_VARIANT_CLIENT), true)
-    HOTSPOT_IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
+    BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
     ifneq (, $(JSIG_DEBUGINFO))
-      HOTSPOT_IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
+      BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/client/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
     endif
   endif
   ifneq ($(OPENJDK_TARGET_OS), macosx)
     ifeq ($(JVM_VARIANT_MINIMAL1), true)
-      HOTSPOT_IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
+      BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX)
       ifneq (,$(JSIG_DEBUGINFO))
-        HOTSPOT_IMPORT_TARGET_FILES += $(INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
+        BASE_TARGETS += $(BASE_INSTALL_LIBRARIES_HERE)/minimal/$(foreach I,$(JSIG_DEBUGINFO),$(notdir $I))
       endif
     endif
   endif
 endif
 
-$(INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX): $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
+$(BASE_INSTALL_LIBRARIES_HERE)/server/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-  $(INSTALL_LIBRARIES_HERE)/server/%.dSYM : $(INSTALL_LIBRARIES_HERE)/%.dSYM
+  $(BASE_INSTALL_LIBRARIES_HERE)/server/%.dSYM : $(BASE_INSTALL_LIBRARIES_HERE)/%.dSYM
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
-  $(INSTALL_LIBRARIES_HERE)/server/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
+  $(BASE_INSTALL_LIBRARIES_HERE)/server/%.diz : $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
@@ -111,12 +130,12 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
 	$(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
 	$(MV) $@.tmp $@
 else
-  $(INSTALL_LIBRARIES_HERE)/server/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
+  $(BASE_INSTALL_LIBRARIES_HERE)/server/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
-  $(INSTALL_LIBRARIES_HERE)/server/%.diz: $(INSTALL_LIBRARIES_HERE)/%.diz
+  $(BASE_INSTALL_LIBRARIES_HERE)/server/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(RM) $@.tmp $(basename $@).debuginfo
@@ -126,18 +145,18 @@ else
 	$(MV) $@.tmp $@
 endif
 
-$(INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX): $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
+$(BASE_INSTALL_LIBRARIES_HERE)/client/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-  $(INSTALL_LIBRARIES_HERE)/client/%.dSYM : $(INSTALL_LIBRARIES_HERE)/%.dSYM
+  $(BASE_INSTALL_LIBRARIES_HERE)/client/%.dSYM : $(BASE_INSTALL_LIBRARIES_HERE)/%.dSYM
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
-  $(INSTALL_LIBRARIES_HERE)/client/%.diz : $(INSTALL_LIBRARIES_HERE)/%.diz
+  $(BASE_INSTALL_LIBRARIES_HERE)/client/%.diz : $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(RM) $@.tmp $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
@@ -146,12 +165,12 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
 	$(RM) $(basename $@)$(SHARED_LIBRARY_SUFFIX).dSYM
 	$(MV) $@.tmp $@
 else
-  $(INSTALL_LIBRARIES_HERE)/client/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
+  $(BASE_INSTALL_LIBRARIES_HERE)/client/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
-  $(INSTALL_LIBRARIES_HERE)/client/%.diz: $(INSTALL_LIBRARIES_HERE)/%.diz
+  $(BASE_INSTALL_LIBRARIES_HERE)/client/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(RM) $@.tmp $(basename $@).debuginfo
@@ -161,18 +180,18 @@ else
 	$(MV) $@.tmp $@
 endif
 
-$(INSTALL_LIBRARIES_HERE)/minimal/%$(SHARED_LIBRARY_SUFFIX): $(INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
+$(BASE_INSTALL_LIBRARIES_HERE)/minimal/%$(SHARED_LIBRARY_SUFFIX): $(BASE_INSTALL_LIBRARIES_HERE)/%$(SHARED_LIBRARY_SUFFIX)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
 ifneq ($(OPENJDK_TARGET_OS), macosx)
-  $(INSTALL_LIBRARIES_HERE)/minimal/%.debuginfo: $(INSTALL_LIBRARIES_HERE)/%.debuginfo
+  $(BASE_INSTALL_LIBRARIES_HERE)/minimal/%.debuginfo: $(BASE_INSTALL_LIBRARIES_HERE)/%.debuginfo
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(LN) -s ../$(@F) $@
 
-  $(INSTALL_LIBRARIES_HERE)/minimal/%.diz: $(INSTALL_LIBRARIES_HERE)/%.diz
+  $(BASE_INSTALL_LIBRARIES_HERE)/minimal/%.diz: $(BASE_INSTALL_LIBRARIES_HERE)/%.diz
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(RM) $@.tmp $(basename $@).debuginfo
@@ -182,10 +201,69 @@ ifneq ($(OPENJDK_TARGET_OS), macosx)
 	$(MV) $@.tmp $@
 endif
 
-##########################################################################################
+################################################################################
 
-hotspot: $(HOTSPOT_IMPORT_TARGET_FILES)
+$(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/_the.sa.jar.unpacked: $(HOTSPOT_DIST)/lib/sa-jdi.jar \
+    $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
+	$(ECHO) $(LOG_INFO) Unzipping $(<F)
+	$(RM) -r $(@D)
+	$(MKDIR) -p $(@D)
+	$(CD) $(@D) && $(UNZIP) $< -x META-INF/MANIFEST.MF $(LOG_DEBUG)
+        # We must move the service provider file out of the way so that
+        # Gensrc-jdk.jdi.gmk can combine them.
+	$(MKDIR) -p $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent
+	$(MV) $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector \
+	    $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
+	$(TOUCH) $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
+	$(TOUCH) $@
 
-all: hotspot
+# Declaring this dependency guarantees that _the.sa.services will be rebuilt
+# even if zip is already unpacked.
+$(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services: $(HOTSPOT_DIST)/lib/sa-jdi.jar
 
-.PHONY: hotspot all
+SA_TARGETS += $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/_the.sa.jar.unpacked \
+    $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
+
+################################################################################
+
+ifeq ($(OPENJDK_TARGET_OS), windows)
+  $(eval $(call SetupCopyFiles,BASE_COPY_LIBS_BIN, \
+      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
+      DEST := $(JDK_OUTPUTDIR)/bin, \
+      FILES := $(filter-out %.lib, $(BASE_TARGETS))))
+
+  $(eval $(call SetupCopyFiles,BASE_COPY_LIBS_LIB, \
+      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
+      DEST := $(JDK_OUTPUTDIR)/lib, \
+      FILES := $(filter %.lib, $(BASE_TARGETS))))
+
+  $(eval $(call SetupCopyFiles,SA_COPY_LIBS, \
+      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent, \
+      DEST := $(JDK_OUTPUTDIR)/lib, \
+      FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent/%, \
+          $(SA_TARGETS))))
+
+  $(eval $(call SetupCopyFiles,SA_COPY_LIBS, \
+      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent, \
+      DEST := $(JDK_OUTPUTDIR)/bin, \
+      FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent/%, \
+          $(SA_TARGETS))))
+else
+  $(eval $(call SetupCopyFiles,BASE_COPY_LIBS, \
+      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base, \
+      DEST := $(JDK_OUTPUTDIR)/lib, \
+      FILES := $(BASE_TARGETS)))
+
+  $(eval $(call SetupCopyFiles,SA_COPY_LIBS, \
+      SRC := $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent, \
+      DEST := $(JDK_OUTPUTDIR)/lib, \
+      FILES := $(filter $(SUPPORT_OUTPUTDIR)/modules_libs/jdk.hotspot.agent/%, $(SA_TARGETS))))
+endif
+
+################################################################################
+
+all: $(BASE_TARGETS) $(SA_TARGETS) \
+    $(BASE_COPY_LIBS_BIN) $(BASE_COPY_LIBS_LIB) \
+    $(BASE_COPY_LIBS) $(SA_COPY_LIBS)
+
+.PHONY: default all
diff --git a/jdk/make/ProfileNames.gmk b/jdk/make/ProfileNames.gmk
deleted file mode 100644
index 2e1e16e82ed..00000000000
--- a/jdk/make/ProfileNames.gmk
+++ /dev/null
@@ -1,63 +0,0 @@
-#
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# This was split out from Profiles.gmk to allow GenSrcMisc.gmk to include it
-# without attempting to generate lists for output files that don't exist yet
-
-# These are the external names of each profile
-
-PROFILE_NAMES := compact1 compact2 compact3
-
-# The include files use 1,2,3 for simplicity and conciseness. Internally we
-# use profile_1, profile_2 and profile_3.
-
-ALL_PROFILES := profile_1 profile_2 profile_3
-
-# This defines targets to generate per-profile Version.java/class files into
-# distinct locations
-
-VERSION_JAVA_DIR := sun/misc
-VERSION_JAVA_FILE := Version.java
-VERSION_JAVA_PATH := $(VERSION_JAVA_DIR)/$(VERSION_JAVA_FILE)
-VERSION_CLASS_PATH := $(VERSION_JAVA_PATH:.java=.class)
-
-PROFILE_VERSION_JAVA_TARGETS := $(foreach i, $(ALL_PROFILES), $(subst XXX,$i, $(JDK_OUTPUTDIR)/gen_XXX/$(VERSION_JAVA_PATH)))
-
-PROFILE_VERSION_CLASS_TARGETS := $(foreach i, $(PROFILE_VERSION_JAVA_TARGETS), $(i:.java=.class))
-
-# Function to map from profile designator, profile_1 etc, to its number
-profile_number = $(if $(patsubst profile_%,%, $(1)), $(patsubst profile_%,%, $(1)), $(words $(PROFILE_NAMES) extra))
-
-# Function to map from profile number, 1, 2 etc, to the corresponding name
-# An invalid number maps to an empty name
-profile_name = $(word $(1), $(PROFILE_NAMES))
-
-# Function to isolate a profile number from a Version.java target
-# Evaluates to the arg if the arg is not a profile version target
-profile_version_number = $(patsubst $(JDK_OUTPUTDIR)/gen_profile_%/$(VERSION_JAVA_PATH), %, $(1))
-
-# Function to go from a profile Version.java target to profile name. If not
-# a profile version target then we need a number that maps to an empty name
-profile_version_name = $(word $(if $(filter-out $(call profile_version_number, $(1)), $(1)), $(call profile_version_number, $(1)), $(words $(PROFILE_NAMES) extra)), $(PROFILE_NAMES))
diff --git a/jdk/make/Profiles.gmk b/jdk/make/Profiles.gmk
deleted file mode 100644
index 02743e31854..00000000000
--- a/jdk/make/Profiles.gmk
+++ /dev/null
@@ -1,324 +0,0 @@
-#
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-include ProfileNames.gmk
-
-# This defines the include lists for each profile, categorized as lib, bin
-# and other. We can use these to define the file lists for each profile
-# directly, rather than constructing a set of files to exclude from the
-# set of all files. But initially we will stick with generating exclude lists
-# as that is how the main build process already works.
-
-include profile-includes.txt
-
-###############################################################################
-# Per profile Jar lists
-#
-# These are the jar files to be built. In some builds these have to be
-# imported (signed jars) rather than built.
-#
-# The incoming lists, eg PROFILE_1_JRE_JARS_FILES, are the jars to be
-# included in this profile. They have the jar name relative to the lib
-# directory. We have to turn these into targets by adding the
-# $(IMAGES_OUTPUTDIR)/lib prefix
-#
-# Note that some jars may be optional depending on the type of build (jdk vs.
-# openjdk) and the platform.
-#
-# WARNING: incoming lists are currently validated for linux only!
-###############################################################################
-
-# These are jar files for which the contents vary depending on the profile
-CUSTOM_JARS := rt.jar resources.jar
-# This is used in Images.gmk
-CUSTOM_PROFILE_JARS := $(addprefix $(IMAGES_OUTPUTDIR)/lib$(PROFILE)/, $(CUSTOM_JARS))
-
-# These are the common jar files built for and included with this profile
-# Filter out the custom jars and turn them into targets.
-
-PROFILE_1_JARS := \
-    $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(filter-out $(CUSTOM_JARS), $(PROFILE_1_JRE_JAR_FILES)))
-
-PROFILE_2_JARS := \
-    $(if $(PROFILE_2_JRE_JAR_FILES), $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_2_JRE_JAR_FILES))) \
-    $(PROFILE_1_JARS)
-
-PROFILE_3_JARS := \
-    $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(PROFILE_3_JRE_JAR_FILES)) \
-    $(PROFILE_2_JARS)
-
-ifneq ($(ENABLE_JFR), true)
-  FULL_JRE_JAR_FILES := $(filter-out jfr.jar, $(FULL_JRE_JAR_FILES))
-endif
-
-FULL_JRE_JARS := \
-    $(addprefix $(IMAGES_OUTPUTDIR)/lib/, $(FULL_JRE_JAR_FILES)) \
-    $(PROFILE_3_JARS)
-
-# The full set of "jar" files needed for a complete JDK (ct.sym and src.zip
-# are also included.)
-# Note we need to add back the regular form of all the custom profile jars e.g.
-# rt.jar and resources.jar that we filtered out above
-
-ALL_JARS := $(FULL_JRE_JARS) \
-    $(IMAGES_OUTPUTDIR)/lib/rt.jar \
-    $(IMAGES_OUTPUTDIR)/lib/resources.jar \
-    $(IMAGES_OUTPUTDIR)/lib/jconsole.jar \
-    $(IMAGES_OUTPUTDIR)/lib/dt.jar \
-    $(IMAGES_OUTPUTDIR)/lib/tools.jar \
-    $(IMAGES_OUTPUTDIR)/lib/ct.sym \
-    $(IMAGES_OUTPUTDIR)/src.zip
-
-ifeq ($(INCLUDE_SA), true)
-  ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/sa-jdi.jar
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), solaris)
-  ifndef OPENJDK
-    ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/ext/ucrypto.jar
-  endif
-endif
-
-ifeq ($(OPENJDK_TARGET_OS), windows)
-  ALL_JARS += $(IMAGES_OUTPUTDIR)/lib/ext/sunmscapi.jar
-endif
-
-ifeq ($(PROFILE), profile_1)
-  PROFILE_JARS := $(PROFILE_1_JARS)
-else ifeq ($(PROFILE), profile_2)
-  PROFILE_JARS := $(PROFILE_2_JARS)
-else ifeq ($(PROFILE), profile_3)
-  PROFILE_JARS := $(PROFILE_3_JARS)
-endif
-ifneq ($(PROFILE), )
-  JARS := $(CUSTOM_PROFILE_JARS) $(PROFILE_JARS)
-else
-  JARS := $(ALL_JARS)
-endif
-
-###############################################################################
-# JRE contents
-###############################################################################
-
-
-# we don't need to do anything if not building a profile
-ifneq ($(PROFILE), )
-
-
-# Need all files to generate the exclude lists
-NEW_ALL_BIN_LIST := $(patsubst $(JDK_OUTPUTDIR)/bin/%,%,$(shell $(FIND) $(JDK_OUTPUTDIR)/bin \( -type f -o -type l \) ! -name "sjavac"))
-
-ALL_JRE_BIN_FILES := \
-    $(PROFILE_1_JRE_BIN_FILES) \
-    $(PROFILE_2_JRE_BIN_FILES) \
-    $(PROFILE_3_JRE_BIN_FILES) \
-    $(FULL_JRE_BIN_FILES)
-
-NOT_JRE_BIN_FILES := $(filter-out $(ALL_JRE_BIN_FILES), $(NEW_ALL_BIN_LIST))
-
-# Additional exclusions for profile JRE
-ifeq ($(PROFILE), profile_1)
-  NOT_JRE_BIN_FILES += \
-      $(PROFILE_2_JRE_BIN_FILES) \
-      $(PROFILE_3_JRE_BIN_FILES) \
-      $(FULL_JRE_BIN_FILES)
-endif
-
-ifeq ($(PROFILE), profile_2)
-  NOT_JRE_BIN_FILES += \
-      $(PROFILE_3_JRE_BIN_FILES) \
-      $(FULL_JRE_BIN_FILES)
-endif
-
-ifeq ($(PROFILE), profile_3)
-  NOT_JRE_BIN_FILES += \
-      $(FULL_JRE_BIN_FILES)
-endif
-
-NOT_JRE_BIN_FILES := $(addprefix $(JDK_OUTPUTDIR)/bin/, $(NOT_JRE_BIN_FILES))
-
-# Need all files to generate the exclude lists
-NEW_ALL_LIB_LIST := $(patsubst $(JDK_OUTPUTDIR)/lib/%,%,$(shell $(FIND) $(JDK_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) ))
-NEW_ALL_LIB_LIST += $(patsubst $(IMAGES_OUTPUTDIR)/lib/%,%,$(shell $(FIND) $(IMAGES_OUTPUTDIR)/lib \( -type f -o -type l \) -a ! \( -name "_the*" -o -name "javac_state " \) ))
-
-ALL_JRE_LIB_FILES := \
-    $(PROFILE_1_JRE_LIB_FILES) \
-    $(PROFILE_2_JRE_LIB_FILES) \
-    $(PROFILE_3_JRE_LIB_FILES) \
-    $(FULL_JRE_LIB_FILES)
-
-NOT_JRE_LIB_FILES := $(filter-out $(ALL_JRE_LIB_FILES), $(NEW_ALL_LIB_LIST))
-
-# Although these are NOT JRE lib files we have to filter them from the list
-# (ie cause them to be added them back in here) because the logic in
-# Images.gmk expects them to be there and handles them differently.
-# If we don't, they end up in the wrong place in the JDK image.
-# This needs fixing.
-NOT_JRE_LIB_FILES := $(filter-out $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)attach$(SHARED_LIBRARY_SUFFIX) $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(SALIB_NAME), $(NOT_JRE_LIB_FILES))
-
-# Additional exclusions for profile JREs
-ifeq ($(PROFILE), profile_1)
-  NOT_JRE_LIB_FILES += \
-      $(PROFILE_2_JRE_LIB_FILES) \
-      $(PROFILE_3_JRE_LIB_FILES) \
-      $(FULL_JRE_LIB_FILES)
-endif
-
-ifeq ($(PROFILE), profile_2)
-  NOT_JRE_LIB_FILES += \
-      $(PROFILE_3_JRE_LIB_FILES) \
-      $(FULL_JRE_LIB_FILES)
-endif
-
-ifeq ($(PROFILE), profile_3)
-  NOT_JRE_LIB_FILES += \
-      $(FULL_JRE_LIB_FILES)
-endif
-
-# Exclude the custom jar files as these will be added back via a special rule
-NOT_JRE_LIB_FILES += $(CUSTOM_JARS)
-
-###############################################################################
-# Customization of rt.jar file contents
-# These are expressed as exclusions from everything found in the
-# JDK_OUTPUTDIR/classes directory
-###############################################################################
-
-# The main set of excluded types/packages (ie everything not destined to be
-# part of rt.jar or resources.jar is captured in the CreateJars.gmk RT_JAR_EXCLUDES
-# variable. We add to that for the per-profile exclusion lists
-
-# For each profile we have four variables:
-#
-# - PROFILE_n_RTJAR_INCLUDE_PACKAGES
-#
-# This is a package prefix indicating that all classes in that package
-# and conditionally its subpackages are included in rt.jar for this profile.
-# The subpackages will be included as long as they do not appear in the
-# include list of a higher profile
-#
-# - PROFILE_n_RTJAR_INCLUDE_TYPES
-#
-# These are specific types that must be included within a package.
-# There are two cases:
-# - individual types in a package that is otherwise excluded at this
-#   profile level. The only arises if there are split packages.
-#
-# - A higher-level package is included in a high profile where a subpackage
-# is included in a lower profile. Including the package in the high profile
-# would exclude it and all subpackages from the lower profile, so instead
-# the classes in the package are listed for that higher profile (as *.class)
-#
-# These types are explicitly added back into the rt.jar content lists.
-#
-# - PROFILE_n_RTJAR_EXCLUDE_TYPES
-#
-# These are specific types that must be excluded even though most of the
-# containing package is include. Again this occurs with split packges.
-#
-# So the exclude list for each profile consists of the include lists
-# for all profiles above it, together with any explicitly excluded types.
-# This is then combined with the overall RT_JAR_EXCLUDES list (which covers
-# things that go into other jar files).
-#
-# We also have to define the types to be explicitly included. This
-# accumulates up the profiles ie profile 3 has to include the types
-# that profiles 1 and 2 had to include. This is unnecessary if, for example,
-# profile 3 includes the entire package, but it is harmless to add them
-# explicitly, and complex to determine if we still need to include them.
-#
-# Need a way to express:
-#  for (int i = profile+1; i < 4; i++)
-#     RT_JAR_EXCLUDES += PROFILE_$i_RTJAR_INCLUDE_PACKAGES
-#
-# Do it the long way for now
-#
-# - PROFILE_n_INCLUDE_METAINF_SERVICES
-#
-# These are META-INF/services/ entries found in resources.jar. Together
-# resources.jar and rt.jar hold the contents of the classes directory, (the
-# classes in rt.jar and everything else in resources.jar).Hence the
-# include/exclude information for resources.jar is tied to that of rt.jar
-
-include profile-rtjar-includes.txt
-
-# Function to expand foo/*.class into the set of classes
-# NOTE: Files found by wildcard are stipped of extra $, so call DoubleDollar
-# to keep the file names compatible with make.
-# But note that if you echo these values they will NOT display as expected.
-class_list = $(foreach dir, $(JDK_OUT_CLASSES), $(patsubst $(dir)/%,%, \
-    $(foreach i, $(1), $(call DoubleDollar, $(wildcard $(dir)/$i)))))
-
-ifeq ($(PROFILE), profile_1)
-  RT_JAR_EXCLUDES += \
-      $(call class_list, $(PROFILE_1_RTJAR_EXCLUDE_TYPES)) \
-      $(PROFILE_2_RTJAR_INCLUDE_PACKAGES) \
-      $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
-      $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
-      $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
-      $(FULL_JRE_RTJAR_INCLUDE_PACKAGES) \
-      $(call class_list, $(FULL_JRE_RTJAR_INCLUDE_TYPES))
-  RT_JAR_INCLUDE_TYPES := \
-      $(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES))
-  PROFILE_INCLUDE_METAINF_SERVICES := \
-      $(PROFILE_1_INCLUDE_METAINF_SERVICES)
-endif
-ifeq ($(PROFILE), profile_2)
-  RT_JAR_EXCLUDES += \
-      $(call class_list, $(PROFILE_2_RTJAR_EXCLUDE_TYPES)) \
-      $(PROFILE_3_RTJAR_INCLUDE_PACKAGES) \
-      $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES)) \
-      $(FULL_JRE_RTJAR_INCLUDE_PACKAGES) \
-      $(call class_list, $(FULL_JRE_RTJAR_INCLUDE_TYPES))
-  RT_JAR_INCLUDE_TYPES := \
-      $(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
-      $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES))
-  PROFILE_INCLUDE_METAINF_SERVICES := \
-      $(PROFILE_1_INCLUDE_METAINF_SERVICES) \
-      $(PROFILE_2_INCLUDE_METAINF_SERVICES)
-endif
-ifeq ($(PROFILE), profile_3)
-  RT_JAR_EXCLUDES += \
-      $(call class_list, $(PROFILE_3_RTJAR_EXCLUDE_TYPES)) \
-      $(FULL_JRE_RTJAR_INCLUDE_PACKAGES) \
-      $(call class_list, $(FULL_JRE_RTJAR_INCLUDE_TYPES))
-  RT_JAR_INCLUDE_TYPES := \
-      $(call class_list, $(PROFILE_1_RTJAR_INCLUDE_TYPES)) \
-      $(call class_list, $(PROFILE_2_RTJAR_INCLUDE_TYPES)) \
-      $(call class_list, $(PROFILE_3_RTJAR_INCLUDE_TYPES))
-  PROFILE_INCLUDE_METAINF_SERVICES := \
-      $(PROFILE_1_INCLUDE_METAINF_SERVICES) \
-      $(PROFILE_2_INCLUDE_METAINF_SERVICES) \
-      $(PROFILE_3_INCLUDE_METAINF_SERVICES)
-endif
-
-# Filter out non-OpenJDK services
-ifdef OPENJDK
-  EXCLUDED_SERVICES := META-INF/services/javax.script.ScriptEngineFactory
-  PROFILE_INCLUDE_METAINF_SERVICES := $(filter-out $(EXCLUDED_SERVICES), $(PROFILE_INCLUDE_METAINF_SERVICES))
-endif
-
-
-endif # profile
diff --git a/jdk/make/Tools.gmk b/jdk/make/Tools.gmk
index b68d19c3d34..55273f64299 100644
--- a/jdk/make/Tools.gmk
+++ b/jdk/make/Tools.gmk
@@ -38,104 +38,124 @@ include SetupJavaCompilers.gmk
 ifeq (, $(BUILD_TOOLS_JDK))
   $(eval $(call SetupJavaCompilation,BUILD_TOOLS_JDK, \
       SETUP := GENERATE_OLDBYTECODE, \
+      ADD_JAVAC_FLAGS := "-Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes", \
       SRC := $(JDK_TOPDIR)/make/src/classes, \
-      BIN := $(JDK_OUTPUTDIR)/btclasses))
+      BIN := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
+      COPY := boot.modules ext.modules))
 endif
 
-$(JDK_OUTPUTDIR)/btclasses/build/tools/generatenimbus/resources/%.template: \
+$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/generatenimbus/resources/%.template: \
     $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/%.template
 	$(call install-file)
 
-BUILD_TOOLS_JDK += $(foreach i, $(wildcard $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/*.template), $(JDK_OUTPUTDIR)/btclasses/build/tools/generatenimbus/resources/$(notdir $i))
+BUILD_TOOLS_JDK += $(foreach i, $(wildcard $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/*.template), $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/generatenimbus/resources/$(notdir $i))
 
 # Resource used by CheckDeps tool
-$(JDK_OUTPUTDIR)/btclasses/build/tools/deps/refs.allowed: \
+$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/deps/refs.allowed: \
     $(JDK_TOPDIR)/make/data/checkdeps/refs.allowed
 	$(call install-file)
 
-BUILD_TOOLS_JDK += $(JDK_OUTPUTDIR)/btclasses/build/tools/deps/refs.allowed
+BUILD_TOOLS_JDK += $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes/build/tools/deps/refs.allowed
 
 # Add a checksum ("jsum") to the end of a text file. Prevents trivial tampering with class lists.
-TOOL_ADDJSUM = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_ADDJSUM = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.addjsum.AddJsum
 
 # The buildmetaindex tool creates a meta-index to make core class loaders lazier.
-TOOL_BUILDMETAINDEX = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_BUILDMETAINDEX = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.buildmetaindex.BuildMetaIndex
 
-TOOL_COMPILEFONTCONFIG = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_COMPILEFONTCONFIG = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.compilefontconfig.CompileFontConfig
 
-TOOL_COMPILEPROPERTIES = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_COMPILEPROPERTIES = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.compileproperties.CompileProperties
 
-TOOL_JARREORDER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_JARREORDER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.jarreorder.JarReorder
 
-TOOL_GENERATECHARACTER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_GENERATECHARACTER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.generatecharacter.GenerateCharacter
 
-TOOL_CHARACTERNAME = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_CHARACTERNAME = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.generatecharacter.CharacterName
 
 TOOL_DTDBUILDER = $(JAVA_SMALL) -Ddtd_home=$(JDK_TOPDIR)/make/data/dtdbuilder \
     -Djava.awt.headless=true \
-    -cp $(JDK_OUTPUTDIR)/btclasses build.tools.dtdbuilder.DTDBuilder
+    -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.dtdbuilder.DTDBuilder
 
 TOOL_GENERATEBREAKITERATORDATA = $(JAVA_SMALL) \
-    -cp $(JDK_OUTPUTDIR)/btclasses \
+    -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.generatebreakiteratordata.GenerateBreakIteratorData
 
-TOOL_GENERATECURRENCYDATA = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_GENERATECURRENCYDATA = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.generatecurrencydata.GenerateCurrencyData
 
-TOOL_HASHER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_HASHER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.hasher.Hasher
 
-TOOL_TZDB = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_TZDB = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.tzdb.TzdbZoneRulesCompiler
 
-TOOL_BLACKLISTED_CERTS = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_BLACKLISTED_CERTS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.blacklistedcertsconverter.BlacklistedCertsConverter
 
-TOOL_MAKEJAVASECURITY = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_MAKEJAVASECURITY = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.makejavasecurity.MakeJavaSecurity
 
 
 # TODO: There are references to the jdwpgen.jar in jdk/make/netbeans/jdwpgen/build.xml
 # and nbproject/project.properties in the same dir. Needs to be looked at.
-TOOL_JDWPGEN = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.jdwpgen.Main
+TOOL_JDWPGEN = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.jdwpgen.Main
 
 # TODO: Lots of files in jdk/make/tools/CharsetMapping dir
-TOOL_CHARSETMAPPING = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_CHARSETMAPPING = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.charsetmapping.Main $(LOG_INFO)
 
-TOOL_SPP = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses build.tools.spp.Spp
+TOOL_SPP = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes build.tools.spp.Spp
 
 # Nimbus is used somewhere in the swing build.
-TOOL_GENERATENIMBUS = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_GENERATENIMBUS = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.generatenimbus.Generator
 
-TOOL_WRAPPERGENERATOR = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_WRAPPERGENERATOR = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.x11wrappergen.WrapperGenerator
 
-TOOL_AWT_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_AWT_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.icondata.awt.ToBin
 
-TOOL_OSX_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_OSX_TOBIN = $(JAVA_SMALL) -Djava.awt.headless=true -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.icondata.osxapp.ToBin
 
-TOOL_CLDRCONVERTER = $(JAVA_SMALL) -cp $(JDK_OUTPUTDIR)/btclasses \
+TOOL_CLDRCONVERTER = $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
     build.tools.cldrconverter.CLDRConverter
 
 TOOL_CHECKDEPS = $(JAVA_SMALL) -Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR) \
-    -cp "$(JDK_OUTPUTDIR)/btclasses$(PATH_SEP)$(JDK_OUTPUTDIR)" \
+    -cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes$(PATH_SEP)$(JDK_OUTPUTDIR)" \
     build.tools.deps.CheckDeps
 
 TOOL_GENMODULESXML = $(JAVA_SMALL) -Xbootclasspath/p:$(INTERIM_LANGTOOLS_JAR) \
-    -cp "$(JDK_OUTPUTDIR)/btclasses$(PATH_SEP)$(JDK_OUTPUTDIR)" \
+    -cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes$(PATH_SEP)$(JDK_OUTPUTDIR)" \
     build.tools.module.GenJdepsModulesXml
 
+TOOL_IMAGEBUILDER = $(JAVA_SMALL) -Xbootclasspath/p:$(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes \
+    -cp "$(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes$(PATH_SEP)$(JDK_OUTPUTDIR)" \
+    build.tools.module.ImageBuilder
+
+##########################################################################################
+
+JIMAGE_PKGS := \
+    jdk/internal/jimage \
+    jdk/internal/jrtfs \
+    #
+
+$(eval $(call SetupJavaCompilation,BUILD_INTERIM_JIMAGE, \
+    SETUP := GENERATE_OLDBYTECODE, \
+    SRC := $(JDK_TOPDIR)/src/java.base/share/classes, \
+    INCLUDES := $(JIMAGE_PKGS), \
+    EXCLUDES := jdk/internal/jimage/concurrent, \
+    BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_jimage_classes))
+
 ##########################################################################################
 
 # Tools needed on solaris because OBJCOPY is broken.
@@ -147,8 +167,8 @@ $(eval $(call SetupNativeCompilation,ADD_GNU_DEBUGLINK, \
     CC := $(BUILD_CC), \
     LDEXE := $(BUILD_LD), \
     LDFLAGS := -lelf, \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/add_gnu_debuglink, \
-    OUTPUT_DIR := $(JDK_OUTPUTDIR)/btbin, \
+    OBJECT_DIR := $(BUILDTOOLS_OUTPUTDIR)/objs/add_gnu_debuglink, \
+    OUTPUT_DIR := $(BUILDTOOLS_OUTPUTDIR)/bin, \
     PROGRAM := add_gnu_debuglink))
 
 $(eval $(call SetupNativeCompilation,FIX_EMPTY_SEC_HDR_FLAGS, \
@@ -157,11 +177,13 @@ $(eval $(call SetupNativeCompilation,FIX_EMPTY_SEC_HDR_FLAGS, \
     CC := $(BUILD_CC), \
     LDEXE := $(BUILD_LD), \
     LDFLAGS := -lelf, \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/fix_empty_sec_hdr_flags, \
-    OUTPUT_DIR := $(JDK_OUTPUTDIR)/btbin, \
+    OBJECT_DIR := $(BUILDTOOLS_OUTPUTDIR)/objs/fix_empty_sec_hdr_flags, \
+    OUTPUT_DIR := $(BUILDTOOLS_OUTPUTDIR)/bin, \
     PROGRAM := fix_empty_sec_hdr_flags))
 endif
 
+$(BUILD_TOOLS_JDK): $(BUILD_INTERIM_JIMAGE)
+
 java-tools: $(BUILD_TOOLS_JDK)
 
 all: java-tools
diff --git a/jdk/make/UnpackSecurity.gmk b/jdk/make/UnpackSecurity.gmk
index d178ed85155..9e5e615167a 100644
--- a/jdk/make/UnpackSecurity.gmk
+++ b/jdk/make/UnpackSecurity.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -37,33 +37,44 @@ JGSS_WIN64_FILES_ZIP := $(JDK_TOPDIR)/make/tools/crypto/jgss-windows-x64-bin.zip
 
 define unzip-sec-file
 	$(ECHO) Unzipping $(<F)
-	$(MKDIR) -p $(@D)
+	$(MKDIR) -p $(@D) $(JDK_OUTPUTDIR)
 	$(RM) $@
 	($(CD) $(JDK_OUTPUTDIR) && $(UNZIP) -q -o $< > $@.tmp)
 	$(MV) $@.tmp $@
 endef
 
-$(JDK_OUTPUTDIR)/classes/_the.sec-bin.unzipped: $(SEC_FILES_ZIP)
+define unzip-native-sec-file
+	$(ECHO) Unzipping $(<F)
+	$(MKDIR) -p $(@D)
+	$(RM) $@
+	($(CD) $(SUPPORT_OUTPUTDIR) && $(UNZIP) -q -o $< > $@.tmp)
+	$(MV) $@.tmp $@
+endef
+
+$(SUPPORT_OUTPUTDIR)/_the.sec-bin.unzipped: $(SEC_FILES_ZIP)
 	$(call unzip-sec-file)
 
-$(JDK_OUTPUTDIR)/classes/_the.sec-windows-bin.unzipped: $(SEC_FILES_WIN_ZIP)
+# Trying to unzip both of the sec files at the same time may cause a race
+# when creating directories common to both files.
+$(SUPPORT_OUTPUTDIR)/_the.sec-windows-bin.unzipped: $(SEC_FILES_WIN_ZIP) \
+    | $(SUPPORT_OUTPUTDIR)/_the.sec-bin.unzipped
 	$(call unzip-sec-file)
 
-$(JDK_OUTPUTDIR)/classes/_the.jgss-windows-i586-bin.unzipped: $(JGSS_WIN32_FILES_ZIP)
-	$(call unzip-sec-file)
+$(SUPPORT_OUTPUTDIR)/_the.jgss-windows-i586-bin.unzipped: $(JGSS_WIN32_FILES_ZIP)
+	$(call unzip-native-sec-file)
 
-$(JDK_OUTPUTDIR)/classes/_the.jgss-windows-x64-bin.unzipped: $(JGSS_WIN64_FILES_ZIP)
-	$(call unzip-sec-file)
+$(SUPPORT_OUTPUTDIR)/_the.jgss-windows-x64-bin.unzipped: $(JGSS_WIN64_FILES_ZIP)
+	$(call unzip-native-sec-file)
 
 ifneq ($(wildcard $(SEC_FILES_ZIP)), )
-  IMPORT_TARGET_FILES += $(JDK_OUTPUTDIR)/classes/_the.sec-bin.unzipped
+  IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.sec-bin.unzipped
   ifeq ($(OPENJDK_TARGET_OS), windows)
-    IMPORT_TARGET_FILES += $(JDK_OUTPUTDIR)/classes/_the.sec-windows-bin.unzipped
+    IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.sec-windows-bin.unzipped
     ifeq ($(OPENJDK_TARGET_CPU), x86)
-      IMPORT_TARGET_FILES += $(JDK_OUTPUTDIR)/classes/_the.jgss-windows-i586-bin.unzipped
+      IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.jgss-windows-i586-bin.unzipped
     endif
     ifeq ($(OPENJDK_TARGET_CPU), x86_64)
-      IMPORT_TARGET_FILES += $(JDK_OUTPUTDIR)/classes/_the.jgss-windows-x64-bin.unzipped
+      IMPORT_TARGET_FILES += $(SUPPORT_OUTPUTDIR)/_the.jgss-windows-x64-bin.unzipped
     endif
   endif
 endif
diff --git a/jdk/make/copy/Copy-java.base.gmk b/jdk/make/copy/Copy-java.base.gmk
index fd9a0ef3afa..ab7696e9f99 100644
--- a/jdk/make/copy/Copy-java.base.gmk
+++ b/jdk/make/copy/Copy-java.base.gmk
@@ -31,7 +31,7 @@ $(eval $(call IncludeCustomExtension, jdk, copy/Copy-java.base.gmk))
 #
 # Copy exported header files to outputdir.
 #
-JAVA_BASE_HEADERS := \
+TARGETS += \
     $(INCLUDE_DST_DIR)/jni.h \
     $(INCLUDE_DST_DIR)/jvmti.h \
     $(INCLUDE_DST_DIR)/jvmticmlr.h \
@@ -55,7 +55,7 @@ ifneq ($(findstring $(OPENJDK_TARGET_OS), windows aix),)
   $(LIB_DST_DIR)/tzmappings: $(TZMAPPINGS_SRC)/tzmappings
 	$(call install-file)
 
-  BASE_CONF_FILES += $(LIB_DST_DIR)/tzmappings
+  TARGETS += $(LIB_DST_DIR)/tzmappings
 
 endif
 
@@ -63,11 +63,13 @@ endif
 # Copy msvcrXX.dll on windows
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  MSVCR_TARGET := $(JDK_OUTPUTDIR)/bin/$(notdir $(MSVCR_DLL))
+  MSVCR_TARGET := $(LIB_DST_DIR)/$(notdir $(MSVCR_DLL))
   # Chmod to avoid permission issues if bundles are unpacked on unix platforms.
   $(MSVCR_TARGET): $(MSVCR_DLL)
 	$(call install-file)
 	$(CHMOD) a+rx $@
+
+  TARGETS += $(MSVCR_TARGET)
 endif
 
 ################################################################################
@@ -85,7 +87,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
 else
   JVMCFG_SRC := $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/conf/$(JVMCFG_ARCH)/jvm.cfg
 endif
-JVMCFG_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
+JVMCFG_DIR := $(LIB_DST_DIR)$(OPENJDK_TARGET_CPU_LIBDIR)
 JVMCFG := $(JVMCFG_DIR)/jvm.cfg
 
 # To do: should this also support -zeroshark?
@@ -143,12 +145,12 @@ else
         endif
 endif
 
-BASE_CONF_FILES += $(JVMCFG)
+TARGETS += $(JVMCFG)
 
 ################################################################################
 
 POLICY_SRC := $(JDK_TOPDIR)/src/java.base/share/conf/security/java.policy
-POLICY_DST := $(JDK_OUTPUTDIR)/lib/security/java.policy
+POLICY_DST := $(CONF_DST_DIR)/security/java.policy
 
 POLICY_SRC_LIST :=
 
@@ -167,40 +169,34 @@ $(POLICY_DST): $(POLICY_SRC_LIST)
 	$(foreach f,$(POLICY_SRC_LIST),$(CAT) $(f) >> $@.tmp;)
 	$(MV) $@.tmp $@
 
-BASE_CONF_FILES += $(POLICY_DST)
+TARGETS += $(POLICY_DST)
 
 ################################################################################
 
 ifeq ($(CACERTS_FILE), )
   CACERTS_FILE := $(JDK_TOPDIR)/src/java.base/share/conf/security/cacerts
 endif
-CACERTS_DST := $(JDK_OUTPUTDIR)/lib/security/cacerts
+CACERTS_DST := $(LIB_DST_DIR)/security/cacerts
 
 $(CACERTS_DST): $(CACERTS_FILE)
 	$(call install-file)
 
-BASE_CONF_FILES += $(CACERTS_DST)
+TARGETS += $(CACERTS_DST)
 
 ################################################################################
 
-$(JDK_OUTPUTDIR)/lib/net.properties: $(JDK_TOPDIR)/src/java.base/share/conf/net.properties
+$(CONF_DST_DIR)/net.properties: $(JDK_TOPDIR)/src/java.base/share/conf/net.properties
 	$(ECHO) $(LOG_INFO) Copying $(@F)
 	$(call install-file)
 
-NET_CONF_FILES += $(JDK_OUTPUTDIR)/lib/net.properties
+TARGETS += $(CONF_DST_DIR)/net.properties
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-  $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/${OPENJDK_TARGET_OS_API_DIR}/conf/sdp/sdp.conf.template
+  $(CONF_DST_DIR)/sdp/sdp.conf.template: $(JDK_TOPDIR)/src/java.base/${OPENJDK_TARGET_OS_API_DIR}/conf/sdp/sdp.conf.template
 	$(ECHO) $(LOG_INFO) Copying $(@F)
 	$(call install-file)
 
-  NET_CONF_FILES += $(JDK_OUTPUTDIR)/lib/sdp/sdp.conf.template
+  TARGETS += $(CONF_DST_DIR)/sdp/sdp.conf.template
 endif
 
 ################################################################################
-
-java.base: $(BASE_CONF_FILES) $(NET_CONF_FILES) $(JAVA_BASE_HEADERS) $(MSVCR_TARGET)
-
-all: java.base
-
-.PHONY: all java.base
diff --git a/jdk/make/copy/Copy-java.desktop.gmk b/jdk/make/copy/Copy-java.desktop.gmk
index b3fd662bf9c..2c01cd32fa0 100644
--- a/jdk/make/copy/Copy-java.desktop.gmk
+++ b/jdk/make/copy/Copy-java.desktop.gmk
@@ -29,7 +29,7 @@ $(eval $(call IncludeCustomExtension, jdk, copy/Copy-java.desktop.gmk))
 
 ################################################################################
 
-JAVA_DESKTOP_HEADERS := \
+TARGETS += \
     $(INCLUDE_DST_DIR)/jawt.h \
     $(INCLUDE_DST_OS_DIR)/jawt_md.h \
     #
@@ -62,9 +62,9 @@ ifneq ($(FREETYPE_BUNDLE_LIB_PATH), )
   #TODO: rework this to avoid hardcoding library name in the makefile
   #
   ifeq ($(OPENJDK_TARGET_OS), windows)
-    FREETYPE_TARGET_LIB := $(JDK_OUTPUTDIR)/bin/$(call SHARED_LIBRARY,freetype)
+    FREETYPE_TARGET_LIB := $(LIB_DST_DIR)/$(call SHARED_LIBRARY,freetype)
   else
-    FREETYPE_TARGET_LIB := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/$(call SHARED_LIBRARY,freetype).6
+    FREETYPE_TARGET_LIB := $(LIB_DST_DIR)$(OPENJDK_TARGET_CPU_LIBDIR)/$(call SHARED_LIBRARY,freetype).6
   endif
 
   # We can't use $(install-file) in this rule because it preserves symbolic links and
@@ -75,14 +75,16 @@ ifneq ($(FREETYPE_BUNDLE_LIB_PATH), )
         ifeq ($(OPENJDK_BUILD_OS), windows)
 	  $(CHMOD) +rx $@
         endif
+
+  TARGETS += $(FREETYPE_TARGET_LIB)
 endif
 
 ################################################################################
 
-$(JDK_OUTPUTDIR)/lib/sound.properties: $(JDK_TOPDIR)/src/java.desktop/share/conf/sound.properties
+$(CONF_DST_DIR)/sound.properties: $(JDK_TOPDIR)/src/java.desktop/share/conf/sound.properties
 	$(call install-file)
 
-DESKTOP_CONF_FILES += $(JDK_OUTPUTDIR)/lib/sound.properties
+TARGETS += $(CONF_DST_DIR)/sound.properties
 
 ################################################################################
 #
@@ -95,7 +97,7 @@ PSFONTPROPFILE_TARGET_FILES := $(subst $(PSFONTPROPFILE_SRC_DIR),$(LIB_DST_DIR),
 $(LIB_DST_DIR)/%: $(PSFONTPROPFILE_SRC_DIR)/%
 	$(call install-file)
 
-DESKTOP_CONF_FILES += $(PSFONTPROPFILE_TARGET_FILES)
+TARGETS += $(PSFONTPROPFILE_TARGET_FILES)
 
 ################################################################################
 #
@@ -113,7 +115,7 @@ CURSORS_OPENJDK_TARGET_OS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TA
 $(CURSORS_DEST_DIR)/cursors.properties: $(CURSORS_OPENJDK_TARGET_OS_LIB_SRC)/cursors.properties
 	$(call install-file)
 
-DESKTOP_CONF_FILES += $(CURSORS_DEST_DIR)/cursors.properties
+TARGETS += $(CURSORS_DEST_DIR)/cursors.properties
 
 CURSORS_LIB_SRC := $(JDK_TOPDIR)/src/java.desktop/share/conf/images/cursors
 ifeq ($(OPENJDK_TARGET_OS), windows)
@@ -126,12 +128,6 @@ CURSORS_TARGET_FILES := $(subst $(CURSORS_LIB_SRC),$(CURSORS_DEST_DIR),$(CURSORS
 $(CURSORS_DEST_DIR)/%: $(CURSORS_LIB_SRC)/%
 	$(call install-file)
 
-DESKTOP_CONF_FILES += $(CURSORS_TARGET_FILES)
+TARGETS += $(CURSORS_TARGET_FILES)
 
 ################################################################################
-
-java.desktop: $(DESKTOP_CONF_FILES) $(FREETYPE_TARGET_LIB) $(JAVA_DESKTOP_HEADERS)
-
-all: java.desktop
-
-.PHONY: all java.desktop
diff --git a/jdk/make/copy/Copy-java.logging.gmk b/jdk/make/copy/Copy-java.logging.gmk
index da77f247276..8791e574e8d 100644
--- a/jdk/make/copy/Copy-java.logging.gmk
+++ b/jdk/make/copy/Copy-java.logging.gmk
@@ -29,15 +29,9 @@ include CopyCommon.gmk
 
 LOGGING_LIB_SRC := $(JDK_TOPDIR)/src/java.logging/share/conf
 
-$(LIB_DST_DIR)/logging.properties: $(LOGGING_LIB_SRC)/logging.properties
+$(CONF_DST_DIR)/logging.properties: $(LOGGING_LIB_SRC)/logging.properties
 	$(call install-file)
 
-LOGGING_CONF_FILES := $(LIB_DST_DIR)/logging.properties
+TARGETS := $(CONF_DST_DIR)/logging.properties
 
 ################################################################################
-
-java.logging: $(LOGGING_CONF_FILES)
-
-all: java.logging
-
-.PHONY: all java.logging
diff --git a/jdk/make/copy/Copy-java.management.gmk b/jdk/make/copy/Copy-java.management.gmk
index 2352c909cad..32348570198 100644
--- a/jdk/make/copy/Copy-java.management.gmk
+++ b/jdk/make/copy/Copy-java.management.gmk
@@ -27,30 +27,24 @@ include CopyCommon.gmk
 
 ################################################################################
 
-MGMT_LIBDIR := $(LIB_DST_DIR)/management
-MGMT_LIB_SRC := $(JDK_TOPDIR)/src/java.management/share/conf
-MGMT_SRC_FILES := $(wildcard $(MGMT_LIB_SRC)/*)
-MGMT_TARGET_FILES := $(subst $(MGMT_LIB_SRC),$(MGMT_LIBDIR),$(MGMT_SRC_FILES))
+MGMT_CONF_DIR := $(CONF_DST_DIR)/management
+MGMT_CONF_SRC := $(JDK_TOPDIR)/src/java.management/share/conf
+MGMT_SRC_FILES := $(wildcard $(MGMT_CONF_SRC)/*)
+MGMT_TARGET_FILES := $(subst $(MGMT_CONF_SRC),$(MGMT_CONF_DIR),$(MGMT_SRC_FILES))
 
-$(MGMT_LIBDIR)/management.properties: $(MGMT_LIB_SRC)/management.properties
+$(MGMT_CONF_DIR)/management.properties: $(MGMT_CONF_SRC)/management.properties
 	$(call install-file)
 	$(CHMOD) 644 $@
 
 # this file has different permissions...don't know why...
-$(MGMT_LIBDIR)/jmxremote.access: $(MGMT_LIB_SRC)/jmxremote.access
+$(MGMT_CONF_DIR)/jmxremote.access: $(MGMT_CONF_SRC)/jmxremote.access
 	$(call install-file)
 	$(CHMOD) 644 $@
 
-$(MGMT_LIBDIR)/%: $(MGMT_LIB_SRC)/%
+$(MGMT_CONF_DIR)/%: $(MGMT_CONF_SRC)/%
 	$(call install-file)
 	$(CHMOD) 444 $@
 
-MANAGEMENT_CONF_FILES := $(MGMT_TARGET_FILES)
+TARGETS := $(MGMT_TARGET_FILES)
 
 ################################################################################
-
-java.management: $(MANAGEMENT_CONF_FILES)
-
-all: java.management
-
-.PHONY: all java.management
diff --git a/jdk/make/copy/Copy-jdk.crypto.pkcs11.gmk b/jdk/make/copy/Copy-jdk.crypto.pkcs11.gmk
index 6db3dc97a8e..b9771dee017 100644
--- a/jdk/make/copy/Copy-jdk.crypto.pkcs11.gmk
+++ b/jdk/make/copy/Copy-jdk.crypto.pkcs11.gmk
@@ -31,20 +31,15 @@ ifeq ($(OPENJDK_TARGET_OS), solaris)
 
   SUNPKCS11_CFG_SRC := \
       $(JDK_TOPDIR)/src/jdk.crypto.pkcs11/solaris/conf/security/sunpkcs11-solaris.cfg
-  SUNPKCS11_CFG_DST := $(JDK_OUTPUTDIR)/lib/security/sunpkcs11-solaris.cfg
+  SUNPKCS11_CFG_DST := $(CONF_DST_DIR)/security/sunpkcs11-solaris.cfg
 
   $(SUNPKCS11_CFG_DST): $(SUNPKCS11_CFG_SRC)
 	$(call install-file)
 
   SECURITY_PKCS11_CONF_FILES += $(SUNPKCS11_CFG_DST)
 
+  TARGETS := $(SUNPKCS11_CFG_DST)
+
 endif
 
 ################################################################################
-
-jdk.crypto.pkcs11: $(SECURITY_PKCS11_CONF_FILES)
-
-all: jdk.crypto.pkcs11
-
-.PHONY: all jdk.crypto.pkcs11
-
diff --git a/jdk/make/copy/Copy-jdk.crypto.ucrypto.gmk b/jdk/make/copy/Copy-jdk.crypto.ucrypto.gmk
index 640e7ec2486..521c81b7a89 100644
--- a/jdk/make/copy/Copy-jdk.crypto.ucrypto.gmk
+++ b/jdk/make/copy/Copy-jdk.crypto.ucrypto.gmk
@@ -30,20 +30,13 @@ include CopyCommon.gmk
 ifeq ($(OPENJDK_TARGET_OS), solaris)
 
   UCRYPTO_CFG_SRC := $(JDK_TOPDIR)/src/jdk.crypto.ucrypto/solaris/conf/security/ucrypto-solaris.cfg
-  UCRYPTO_CFG_DST := $(JDK_OUTPUTDIR)/lib/security/ucrypto-solaris.cfg
+  UCRYPTO_CFG_DST := $(CONF_DST_DIR)/security/ucrypto-solaris.cfg
 
   $(UCRYPTO_CFG_DST): $(UCRYPTO_CFG_SRC)
 	$(call install-file)
 
-  SECURITY_UCRYPTO_CONF_FILES += $(UCRYPTO_CFG_DST)
+  TARGETS += $(UCRYPTO_CFG_DST)
 
 endif
 
 ################################################################################
-
-jdk.crypto.ucrypto: $(SECURITY_UCRYPTO_CONF_FILES)
-
-all: jdk.crypto.ucrypto
-
-.PHONY: all jdk.crypto.ucrypto
-
diff --git a/jdk/make/copy/Copy-jdk.hprof.agent.gmk b/jdk/make/copy/Copy-jdk.hprof.agent.gmk
index 069e915514f..f738867240c 100644
--- a/jdk/make/copy/Copy-jdk.hprof.agent.gmk
+++ b/jdk/make/copy/Copy-jdk.hprof.agent.gmk
@@ -32,12 +32,6 @@ HPROF_SRC := $(JDK_TOPDIR)/src/jdk.hprof.agent/share/native/libhprof/jvm.hprof.t
 $(LIB_DST_DIR)/jvm.hprof.txt: $(HPROF_SRC)
 	$(call install-file)
 
-HPROF_CONF_FILES := $(LIB_DST_DIR)/jvm.hprof.txt
+TARGETS := $(LIB_DST_DIR)/jvm.hprof.txt
 
 ################################################################################
-
-jdk.hprof.agent: $(HPROF_CONF_FILES)
-
-all: jdk.hprof.agent
-
-.PHONY: all jdk.hprof.agent
diff --git a/jdk/make/copy/Copy-jdk.jdwp.agent.gmk b/jdk/make/copy/Copy-jdk.jdwp.agent.gmk
index dd7ccf01c44..279f2749efb 100644
--- a/jdk/make/copy/Copy-jdk.jdwp.agent.gmk
+++ b/jdk/make/copy/Copy-jdk.jdwp.agent.gmk
@@ -27,16 +27,9 @@ include CopyCommon.gmk
 
 ################################################################################
 
-
-JDK_DEBUG_AGENT_HEADERS := $(INCLUDE_DST_DIR)/jdwpTransport.h
+TARGETS := $(INCLUDE_DST_DIR)/jdwpTransport.h
 
 $(INCLUDE_DST_DIR)/%.h: $(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/include/%.h
 	$(call install-file)
 
 ################################################################################
-
-jdk.jdwp.agent: $(JDK_DEBUG_AGENT_HEADERS)
-
-all: jdk.jdwp.agent
-
-.PHONY: all jdk.jdwp.agent
diff --git a/jdk/make/copy/CopyCommon.gmk b/jdk/make/copy/CopyCommon.gmk
index f9c951287fc..cb87c80294f 100644
--- a/jdk/make/copy/CopyCommon.gmk
+++ b/jdk/make/copy/CopyCommon.gmk
@@ -23,13 +23,9 @@
 # questions.
 #
 
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-
-INCLUDE_DST_DIR := $(JDK_OUTPUTDIR)/include
-LIB_DST_DIR := $(JDK_OUTPUTDIR)/lib
+INCLUDE_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE)
+LIB_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)
+CONF_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_conf/$(MODULE)
 
 INCLUDE_DST_OS_DIR := $(INCLUDE_DST_DIR)/$(OPENJDK_TARGET_OS)
 
diff --git a/jdk/make/gendata/Gendata-java.base.gmk b/jdk/make/gendata/Gendata-java.base.gmk
index a7135abe563..c0ee693f730 100644
--- a/jdk/make/gendata/Gendata-java.base.gmk
+++ b/jdk/make/gendata/Gendata-java.base.gmk
@@ -29,15 +29,14 @@ include GendataCommon.gmk
 $(eval $(call IncludeCustomExtension, jdk, gendata/Gendata-java.base.gmk))
 
 include GendataBreakIterator.gmk
-GENDATA += $(BREAK_ITERATOR)
 
 include GendataTZDB.gmk
-GENDATA += $(GENDATA_TZDB)
 
 include GendataBlacklistedCerts.gmk
-GENDATA += $(GENDATA_BLACKLISTED_CERTS)
 
-##########################################################################################
+include GendataPolicyJars.gmk
+
+################################################################################
 
 GENDATA_UNINAME := $(JDK_OUTPUTDIR)/modules/java.base/java/lang/uniName.dat
 
@@ -45,9 +44,9 @@ $(GENDATA_UNINAME): $(JDK_TOPDIR)/make/data/unicodedata/UnicodeData.txt $(BUILD_
 	$(MKDIR) -p $(@D)
 	$(TOOL_CHARACTERNAME) $< $@
 
-GENDATA += $(GENDATA_UNINAME)
+TARGETS += $(GENDATA_UNINAME)
 
-##########################################################################################
+################################################################################
 
 GENDATA_CURDATA := $(JDK_OUTPUTDIR)/modules/java.base/java/util/currency.data
 
@@ -58,12 +57,12 @@ $(GENDATA_CURDATA): $(JDK_TOPDIR)/make/data/currency/CurrencyData.properties $(B
 	$(MV) $@.tmp $@
 	$(CHMOD) 444 $@
 
-GENDATA += $(GENDATA_CURDATA)
+TARGETS += $(GENDATA_CURDATA)
 
-##########################################################################################
+################################################################################
 
 GENDATA_JAVA_SECURITY_SRC := $(JDK_TOPDIR)/src/java.base/share/conf/security/java.security
-GENDATA_JAVA_SECURITY := $(JDK_OUTPUTDIR)/lib/security/java.security
+GENDATA_JAVA_SECURITY := $(SUPPORT_OUTPUTDIR)/modules_conf/java.base/security/java.security
 
 # RESTRICTED_PKGS_SRC is optionally set in custom extension for this makefile
 
@@ -73,14 +72,17 @@ $(GENDATA_JAVA_SECURITY): $(BUILD_TOOLS) $(GENDATA_JAVA_SECURITY_SRC) $(RESTRICT
 	$(TOOL_MAKEJAVASECURITY) $(GENDATA_JAVA_SECURITY_SRC) $@ $(OPENJDK_TARGET_OS) \
 		$(RESTRICTED_PKGS_SRC) || exit 1
 
-GENDATA += $(GENDATA_JAVA_SECURITY)
+TARGETS += $(GENDATA_JAVA_SECURITY)
 
-##########################################################################################
+################################################################################
 
-$(GENDATA): $(BUILD_TOOLS_JDK)
+$(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist: \
+    $(JDK_TOPDIR)/make/data/classlist/classlist.$(OPENJDK_TARGET_OS)
+	$(MKDIR) -p $(@D)
+	$(RM) $@ $@.tmp
+	$(TOOL_ADDJSUM) $< $@.tmp
+	$(MV) $@.tmp $@
 
-java.base: $(GENDATA)
+TARGETS += $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/classlist
 
-all: java.base
-
-.PHONY: all java.base
+################################################################################
diff --git a/jdk/make/gendata/Gendata-java.desktop.gmk b/jdk/make/gendata/Gendata-java.desktop.gmk
index 8ba2fe198a1..73dbec0d873 100644
--- a/jdk/make/gendata/Gendata-java.desktop.gmk
+++ b/jdk/make/gendata/Gendata-java.desktop.gmk
@@ -26,15 +26,5 @@
 include GendataCommon.gmk
 
 include GendataFontConfig.gmk
-GENDATA += $(GENDATA_FONT_CONFIG)
 
 include GendataHtml32dtd.gmk
-GENDATA += $(GENDATA_HTML32DTD)
-
-$(GENDATA): $(BUILD_TOOLS_JDK)
-
-java.desktop: $(GENDATA)
-
-all: $(GENDATA)
-
-.PHONY: all java.desktop
diff --git a/jdk/make/gendata/Gendata-jdk.dev.gmk b/jdk/make/gendata/Gendata-jdk.dev.gmk
index 3c24cf4b703..6025b32233e 100644
--- a/jdk/make/gendata/Gendata-jdk.dev.gmk
+++ b/jdk/make/gendata/Gendata-jdk.dev.gmk
@@ -27,20 +27,16 @@ include GendataCommon.gmk
 
 $(eval $(call IncludeCustomExtension, jdk, gendata/Gendata-jdk.dev.gmk))
 
-GENDATA := $(JDK_OUTPUTDIR)/modules/jdk.dev/com/sun/tools/jdeps/resources/jdeps-modules.xml
-METADATA_FILES += $(TOPDIR)/modules.xml
+JDEPS_MODULES_XML := $(JDK_OUTPUTDIR)/modules/jdk.dev/com/sun/tools/jdeps/resources/jdeps-modules.xml
+MODULES_XML += $(TOPDIR)/modules.xml
 
 #
 # Generate modules.xml for jdeps to use
 # It augments $(TOPDIR)/modules.xml to include module membership
 #
-$(GENDATA): $(BUILD_TOOLS_JDK) $(METADATA_FILES)
+$(JDEPS_MODULES_XML): $(BUILD_TOOLS_JDK) $(MODULES_XML)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
-	$(TOOL_GENMODULESXML) -o $@ -mp $(JDK_OUTPUTDIR)/modules $(METADATA_FILES)
+	$(TOOL_GENMODULESXML) -o $@ -mp $(JDK_OUTPUTDIR)/modules $(MODULES_XML)
 
-jdk.dev: $(GENDATA)
-
-all: $(GENDATA)
-
-.PHONY: all jdk.dev
+TARGETS += $(JDEPS_MODULES_XML)
diff --git a/jdk/make/gendata/GendataBlacklistedCerts.gmk b/jdk/make/gendata/GendataBlacklistedCerts.gmk
index ab62ca69ef9..4ed2763970f 100644
--- a/jdk/make/gendata/GendataBlacklistedCerts.gmk
+++ b/jdk/make/gendata/GendataBlacklistedCerts.gmk
@@ -24,7 +24,7 @@
 #
 
 GENDATA_BLACKLISTED_CERTS_SRC := $(JDK_TOPDIR)/make/data/blacklistedcertsconverter/blacklisted.certs.pem
-GENDATA_BLACKLISTED_CERTS := $(JDK_OUTPUTDIR)/lib/security/blacklisted.certs
+GENDATA_BLACKLISTED_CERTS := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/security/blacklisted.certs
 
 ifndef OPENJDK
 	GENDATA_BLACKLISTED_CERTS_SRC += $(wildcard $(JDK_TOPDIR)/make/closed/data/blacklistedcertsconverter/blacklisted.certs.pem)
@@ -34,3 +34,5 @@ $(GENDATA_BLACKLISTED_CERTS): $(BUILD_TOOLS) $(GENDATA_BLACKLISTED_CERTS_SRC)
 	$(ECHO) "Generating blacklisted certs"
 	$(MKDIR) -p $(@D)
 	($(CAT) $(GENDATA_BLACKLISTED_CERTS_SRC) | $(TOOL_BLACKLISTED_CERTS) > $@) || exit 1
+
+TARGETS += $(GENDATA_BLACKLISTED_CERTS)
diff --git a/jdk/make/gendata/GendataBreakIterator.gmk b/jdk/make/gendata/GendataBreakIterator.gmk
index 7deb71e0db5..1db16158e76 100644
--- a/jdk/make/gendata/GendataBreakIterator.gmk
+++ b/jdk/make/gendata/GendataBreakIterator.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -33,17 +33,16 @@
 # They are used at JDK build phase in order to create $(BIFILES) which
 # are used on runtime instead.
 #
-TEXT_SRCDIR = $(JDK_TOPDIR)/src/java.base/share/classes \
+TEXT_SRCDIR := $(JDK_TOPDIR)/src/java.base/share/classes \
     $(JDK_TOPDIR)/src/jdk.localedata/share/classes
-TEXT_PKG = sun/text/resources
-TEXT_SOURCES = $(TEXT_PKG)/BreakIteratorRules.java \
+TEXT_PKG := sun/text/resources
+TEXT_SOURCES := $(TEXT_PKG)/BreakIteratorRules.java \
     $(TEXT_PKG)/BreakIteratorInfo.java \
     $(TEXT_PKG)/th/BreakIteratorRules_th.java \
     $(TEXT_PKG)/th/BreakIteratorInfo_th.java
 
 # Generate BreakIteratorData
-BREAK_ITERATOR_DIR = $(JDK_OUTPUTDIR)/break_iterator
-BREAK_ITERATOR_CLASSES = $(BREAK_ITERATOR_DIR)/classes
+BREAK_ITERATOR_CLASSES := $(BUILDTOOLS_OUTPUTDIR)/break_iterator_classes
 
 # JAVAC_SOURCE_PATH_OVERRIDE is set to isolate the compile to just those
 # two files in that directory and not get anything implicit from
@@ -62,16 +61,16 @@ $(eval $(call SetupJavaCompilation,BUILD_BREAKITERATOR, \
 
 # Generate data resource files.
 # input
-UNICODEDATA = $(JDK_TOPDIR)/make/data/unicodedata/UnicodeData.txt
+UNICODEDATA := $(JDK_TOPDIR)/make/data/unicodedata/UnicodeData.txt
 
 # output
-BASE_DATA_PKG_DIR = $(JDK_OUTPUTDIR)/modules/java.base/sun/text/resources
-SL_DATA_PKG_DIR = $(JDK_OUTPUTDIR)/modules/jdk.localedata/sun/text/resources
-BIFILES = $(BASE_DATA_PKG_DIR)/CharacterBreakIteratorData \
+BASE_DATA_PKG_DIR := $(JDK_OUTPUTDIR)/modules/java.base/sun/text/resources
+SL_DATA_PKG_DIR := $(JDK_OUTPUTDIR)/modules/jdk.localedata/sun/text/resources
+BIFILES := $(BASE_DATA_PKG_DIR)/CharacterBreakIteratorData \
     $(BASE_DATA_PKG_DIR)/WordBreakIteratorData \
     $(BASE_DATA_PKG_DIR)/LineBreakIteratorData \
     $(BASE_DATA_PKG_DIR)/SentenceBreakIteratorData
-BIFILES_TH = $(SA_DATA_PKG_DIR)/th/WordBreakIteratorData_th \
+BIFILES_TH := $(SA_DATA_PKG_DIR)/th/WordBreakIteratorData_th \
     $(SA_DATA_PKG_DIR)/th/LineBreakIteratorData_th
 
 $(BIFILES): $(BASE_DATA_PKG_DIR)/_the.bifiles
@@ -97,5 +96,4 @@ $(SL_DATA_PKG_DIR)/_the.bifiles_th: $(BUILD_TOOLS) $(UNICODEDATA) $(BUILD_BREAKI
 	    -language th
 	$(TOUCH) $@
 
-
-BREAK_ITERATOR += $(BIFILES) $(BIFILES_TH)
+TARGETS += $(BIFILES) $(BIFILES_TH)
diff --git a/jdk/make/gendata/GendataCommon.gmk b/jdk/make/gendata/GendataCommon.gmk
index e5e0336b325..0eb8ed38923 100644
--- a/jdk/make/gendata/GendataCommon.gmk
+++ b/jdk/make/gendata/GendataCommon.gmk
@@ -23,10 +23,6 @@
 # questions.
 #
 
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
 include JavaCompilation.gmk
 include SetupJavaCompilers.gmk
 # We need the tools.
diff --git a/jdk/make/gendata/GendataFontConfig.gmk b/jdk/make/gendata/GendataFontConfig.gmk
index 5c85e7712e6..32680470630 100644
--- a/jdk/make/gendata/GendataFontConfig.gmk
+++ b/jdk/make/gendata/GendataFontConfig.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
 # questions.
 #
 
-GENDATA_FONT_CONFIG_DST := $(JDK_OUTPUTDIR)/lib
+GENDATA_FONT_CONFIG_DST := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)
 
 GENDATA_FONT_CONFIG_DATA_DIR := $(JDK_TOPDIR)/make/data/fontconfig
 ifndef OPENJDK
@@ -42,7 +42,7 @@ $(GENDATA_FONT_CONFIG_DST)/%.src: \
 
 $(GENDATA_FONT_CONFIG_DST)/%.bfc: \
     $(GENDATA_FONT_CONFIG_DATA_DIR)/$(OPENJDK_TARGET_OS).%.properties \
-    $(BUILD_TOOLS)
+    $(BUILD_TOOLS_JDK)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(TOOL_COMPILEFONTCONFIG) $< $@
@@ -54,5 +54,5 @@ GENDATA_FONT_CONFIGS := $(patsubst $(GENDATA_FONT_CONFIG_DATA_DIR)/$(OPENJDK_TAR
 GENDATA_BFONT_CONFIGS := $(patsubst $(GENDATA_FONT_CONFIG_DATA_DIR)/$(OPENJDK_TARGET_OS).%.properties, \
     $(GENDATA_FONT_CONFIG_DST)/%.bfc, $(GENDATA_FONT_CONFIG_SRC_FILES))
 
-GENDATA_FONT_CONFIG := $(GENDATA_FONT_CONFIGS) $(GENDATA_BFONT_CONFIGS)
+TARGETS := $(GENDATA_FONT_CONFIGS) $(GENDATA_BFONT_CONFIGS)
 
diff --git a/jdk/make/gendata/GendataHtml32dtd.gmk b/jdk/make/gendata/GendataHtml32dtd.gmk
index 7c996818969..1adb85ad0aa 100644
--- a/jdk/make/gendata/GendataHtml32dtd.gmk
+++ b/jdk/make/gendata/GendataHtml32dtd.gmk
@@ -26,10 +26,10 @@
 GENDATA_HTML32DTD :=
 
 HTML32DTD = $(JDK_OUTPUTDIR)/modules/java.desktop/javax/swing/text/html/parser/html32.bdtd
-$(HTML32DTD): $(BUILD_TOOLS)
+$(HTML32DTD): $(BUILD_TOOLS_JDK)
 	$(ECHO) "Generating HTML DTD file"
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	($(TOOL_DTDBUILDER) $(LOG_INFO) html32 > $@) || exit 1
 
-GENDATA_HTML32DTD += $(HTML32DTD)
+TARGETS += $(HTML32DTD)
diff --git a/jdk/make/CreatePolicyJars.gmk b/jdk/make/gendata/GendataPolicyJars.gmk
similarity index 74%
rename from jdk/make/CreatePolicyJars.gmk
rename to jdk/make/gendata/GendataPolicyJars.gmk
index f0910db0382..0ef6ddcc9e5 100644
--- a/jdk/make/CreatePolicyJars.gmk
+++ b/jdk/make/gendata/GendataPolicyJars.gmk
@@ -32,14 +32,15 @@ include JavaCompilation.gmk
 
 ################################################################################
 
-US_EXPORT_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/US_export_policy.jar
+US_EXPORT_POLICY_JAR_DST := \
+    $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/security/US_export_policy.jar
 
 ifneq ($(BUILD_CRYPTO), no)
 
-  US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED := \
-      $(JDK_OUTPUTDIR)/jce/unsigned/policy/limited/US_export_policy.jar
-  US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED := \
-      $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/US_export_policy.jar
+  US_EXPORT_POLICY_JAR_LIMITED := \
+      $(SUPPORT_OUTPUTDIR)/jce/policy/limited/US_export_policy.jar
+  US_EXPORT_POLICY_JAR_UNLIMITED := \
+      $(SUPPORT_OUTPUTDIR)/jce/policy/unlimited/US_export_policy.jar
 
   ifndef OPENJDK
     #
@@ -53,7 +54,8 @@ ifneq ($(BUILD_CRYPTO), no)
     # file in their environment.  Users/deployers simply need to overwrite
     # the files.  Consult README.txt (below) for more info.
     #
-    UNLIMITED_POLICY_DIR := $(JDK_OUTPUTDIR)/lib/security/unlimited_policy
+    UNLIMITED_POLICY_DIR := \
+        $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/security/unlimited_policy
   endif
 
   #
@@ -68,7 +70,7 @@ ifneq ($(BUILD_CRYPTO), no)
   US_EXPORT_POLICY_JAR_SRC_DIR := \
       $(JDK_TOPDIR)/make/data/cryptopolicy/unlimited
   US_EXPORT_POLICY_JAR_TMP := \
-      $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/US_export_policy_jar.tmp
+      $(SUPPORT_OUTPUTDIR)/jce/policy/unlimited/US_export_policy_jar.tmp
 
   $(US_EXPORT_POLICY_JAR_TMP)/%: $(US_EXPORT_POLICY_JAR_SRC_DIR)/%
 	$(install-file)
@@ -80,32 +82,31 @@ ifneq ($(BUILD_CRYPTO), no)
       $(US_EXPORT_POLICY_JAR_DEPS), \
       SRCS := $(US_EXPORT_POLICY_JAR_TMP), \
       SUFFIXES := .policy, \
-      JAR := $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED), \
+      JAR := $(US_EXPORT_POLICY_JAR_UNLIMITED), \
       EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
       SKIP_METAINF := true))
 
-  $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED): \
-      $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
+  $(US_EXPORT_POLICY_JAR_LIMITED): \
+      $(US_EXPORT_POLICY_JAR_UNLIMITED)
 		$(ECHO) $(LOG_INFO) \
 		    Copying unlimited $(patsubst $(OUTPUT_ROOT)/%,%,$@)
 		$(install-file)
 
-  TARGETS += $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED) \
-      $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
+  TARGETS += $(US_EXPORT_POLICY_JAR_LIMITED) $(US_EXPORT_POLICY_JAR_UNLIMITED)
 endif
 
 ifeq ($(UNLIMITED_CRYPTO), true)
-  $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
+  $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_UNLIMITED)
 	$(install-file)
 else
-  $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_LIMITED_UNSIGNED)
+  $(US_EXPORT_POLICY_JAR_DST): $(US_EXPORT_POLICY_JAR_LIMITED)
 	$(install-file)
 endif 
 
 ifndef OPENJDK
   ifneq ($(UNLIMITED_CRYPTO), true)
     $(UNLIMITED_POLICY_DIR)/US_export_policy.jar: \
-        $(US_EXPORT_POLICY_JAR_UNLIMITED_UNSIGNED)
+        $(US_EXPORT_POLICY_JAR_UNLIMITED)
 		$(install-file)
     TARGETS += $(UNLIMITED_POLICY_DIR)/US_export_policy.jar
   endif
@@ -115,23 +116,24 @@ POLICY_JARS += $(US_EXPORT_POLICY_JAR_DST)
 
 ################################################################################
 
-LOCAL_POLICY_JAR_DST := $(JDK_OUTPUTDIR)/lib/security/local_policy.jar
+LOCAL_POLICY_JAR_DST := \
+    $(SUPPORT_OUTPUTDIR)/modules_libs/java.base/security/local_policy.jar
 
 ifneq ($(BUILD_CRYPTO), no)
 
-  LOCAL_POLICY_JAR_LIMITED_UNSIGNED := \
-      $(JDK_OUTPUTDIR)/jce/unsigned/policy/limited/local_policy.jar
-  LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED := \
-      $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/local_policy.jar
+  LOCAL_POLICY_JAR_LIMITED := \
+      $(SUPPORT_OUTPUTDIR)/jce/policy/limited/local_policy.jar
+  LOCAL_POLICY_JAR_UNLIMITED := \
+      $(SUPPORT_OUTPUTDIR)/jce/policy/unlimited/local_policy.jar
 
   #
   # TODO fix so that SetupArchive does not write files into SRCS
   # then we don't need this extra copying
   #
   LOCAL_POLICY_JAR_LIMITED_TMP := \
-      $(JDK_OUTPUTDIR)/jce/unsigned/policy/limited/local_policy_jar.tmp
+      $(SUPPORT_OUTPUTDIR)/jce/policy/limited/local_policy_jar.tmp
   LOCAL_POLICY_JAR_UNLIMITED_TMP := \
-      $(JDK_OUTPUTDIR)/jce/unsigned/policy/unlimited/local_policy_jar.tmp
+      $(SUPPORT_OUTPUTDIR)/jce/policy/unlimited/local_policy_jar.tmp
 
   $(LOCAL_POLICY_JAR_LIMITED_TMP)/%: \
       $(JDK_TOPDIR)/make/data/cryptopolicy/limited/%
@@ -146,7 +148,7 @@ ifneq ($(BUILD_CRYPTO), no)
       $(LOCAL_POLICY_JAR_LIMITED_TMP)/default_local.policy, \
       SRCS := $(LOCAL_POLICY_JAR_LIMITED_TMP), \
       SUFFIXES := .policy, \
-      JAR := $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED), \
+      JAR := $(LOCAL_POLICY_JAR_LIMITED), \
       EXTRA_MANIFEST_ATTR := Crypto-Strength: limited, \
       SKIP_METAINF := true))
 
@@ -154,12 +156,11 @@ ifneq ($(BUILD_CRYPTO), no)
       $(LOCAL_POLICY_JAR_UNLIMITED_TMP)/default_local.policy, \
       SRCS := $(LOCAL_POLICY_JAR_UNLIMITED_TMP), \
       SUFFIXES := .policy, \
-      JAR := $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED), \
+      JAR := $(LOCAL_POLICY_JAR_UNLIMITED), \
       EXTRA_MANIFEST_ATTR := Crypto-Strength: unlimited, \
       SKIP_METAINF := true))
 
-  TARGETS += $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED) \
-      $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)
+  TARGETS += $(LOCAL_POLICY_JAR_LIMITED) $(LOCAL_POLICY_JAR_UNLIMITED)
 
   ifndef OPENJDK
     ifneq ($(UNLIMITED_CRYPTO), true)
@@ -173,17 +174,17 @@ ifneq ($(BUILD_CRYPTO), no)
 endif
 
 ifeq ($(UNLIMITED_CRYPTO), true)
-  $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)
+  $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_UNLIMITED)
 	$(install-file)
 else 
-  $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_LIMITED_UNSIGNED)
+  $(LOCAL_POLICY_JAR_DST): $(LOCAL_POLICY_JAR_LIMITED)
 	$(install-file)
 endif 
 
 ifndef OPENJDK
   ifneq ($(UNLIMITED_CRYPTO), true)
     $(UNLIMITED_POLICY_DIR)/local_policy.jar: \
-        $(LOCAL_POLICY_JAR_UNLIMITED_UNSIGNED)
+        $(LOCAL_POLICY_JAR_UNLIMITED)
 		$(install-file) 
     TARGETS += $(UNLIMITED_POLICY_DIR)/local_policy.jar
   endif
@@ -194,5 +195,3 @@ TARGETS += $(POLICY_JARS)
 
 ################################################################################
 
-all: $(TARGETS)
-
diff --git a/jdk/make/gendata/GendataTZDB.gmk b/jdk/make/gendata/GendataTZDB.gmk
index 20c2b19eb4f..5d17b4fedf0 100644
--- a/jdk/make/gendata/GendataTZDB.gmk
+++ b/jdk/make/gendata/GendataTZDB.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -32,11 +32,11 @@ TZDATA_DIR := $(JDK_TOPDIR)/make/data/tzdata
 TZDATA_TZFILE := africa antarctica asia australasia europe northamerica pacificnew southamerica backward etcetera gmt jdk11_backward
 TZDATA_TZFILES := $(addprefix $(TZDATA_DIR)/,$(TZDATA_TZFILE))
 
-GENDATA_TZDB_DAT := $(JDK_OUTPUTDIR)/lib/tzdb.dat
+GENDATA_TZDB_DAT := $(SUPPORT_OUTPUTDIR)/modules_libs/$(MODULE)/tzdb.dat
 
 $(GENDATA_TZDB_DAT): $(TZDATA_TZFILES)
 	$(RM) $(GENDATA_TZDB_DAT)
 	$(MKDIR) -p $(@D)
 	$(TOOL_TZDB) -srcdir $(TZDATA_DIR) -dstfile $(GENDATA_TZDB_DAT) $(TZDATA_TZFILE)
 
-GENDATA_TZDB += $(GENDATA_TZDB_DAT)
+TARGETS += $(GENDATA_TZDB_DAT)
diff --git a/jdk/make/gensrc/Gensrc-jdk.charsets.gmk b/jdk/make/gensrc/Gensrc-jdk.charsets.gmk
index 931b969a0dc..a646099c339 100644
--- a/jdk/make/gensrc/Gensrc-jdk.charsets.gmk
+++ b/jdk/make/gensrc/Gensrc-jdk.charsets.gmk
@@ -30,7 +30,7 @@ include GensrcCommon.gmk
 # Generate files using the charsetmapping tool
 #
 CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping
-CHARSET_GENSRC_JAVA_DIR_CS := $(JDK_OUTPUTDIR)/gensrc/jdk.charsets/sun/nio/cs/ext
+CHARSET_GENSRC_JAVA_DIR_CS := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.charsets/sun/nio/cs/ext
 CHARSET_DONE_CS := $(CHARSET_GENSRC_JAVA_DIR_CS)/_the.charsetmapping
 CHARSET_COPYRIGHT_HEADER := $(JDK_TOPDIR)/make/src/classes/build/tools/charsetmapping
 CHARSET_TEMPLATES := \
diff --git a/jdk/make/gensrc/Gensrc-jdk.dev.gmk b/jdk/make/gensrc/Gensrc-jdk.dev.gmk
index 60c6a527217..0c956abbc12 100644
--- a/jdk/make/gensrc/Gensrc-jdk.dev.gmk
+++ b/jdk/make/gensrc/Gensrc-jdk.dev.gmk
@@ -31,7 +31,9 @@ include GensrcProperties.gmk
 
 $(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, \
     $(filter %.properties, \
-        $(call CacheFind, $(JDK_TOPDIR)/src/jdk.dev/share/classes/sun/tools/jar/resources)), \
+        $(call CacheFind, \
+            $(JDK_TOPDIR)/src/jdk.dev/share/classes/jdk/tools/jimage/resources \
+            $(JDK_TOPDIR)/src/jdk.dev/share/classes/sun/tools/jar/resources)), \
     ListResourceBundle))
 
 TARGETS += $(COMPILE_PROPERTIES)
diff --git a/jdk/make/gensrc/Gensrc-jdk.jconsole.gmk b/jdk/make/gensrc/Gensrc-jdk.jconsole.gmk
index 38775c00948..2885540dfb4 100644
--- a/jdk/make/gensrc/Gensrc-jdk.jconsole.gmk
+++ b/jdk/make/gensrc/Gensrc-jdk.jconsole.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@ include GensrcCommon.gmk
 ##########################################################################################
 # Version file for jconsole
 
-$(JDK_OUTPUTDIR)/gensrc/jdk.jconsole/sun/tools/jconsole/Version.java: \
+$(SUPPORT_OUTPUTDIR)/gensrc/jdk.jconsole/sun/tools/jconsole/Version.java: \
     $(JDK_TOPDIR)/src/jdk.jconsole/share/classes/sun/tools/jconsole/Version.java.template
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
@@ -36,7 +36,7 @@ $(JDK_OUTPUTDIR)/gensrc/jdk.jconsole/sun/tools/jconsole/Version.java: \
 	$(SED) -e 's/@@jconsole_version@@/$(FULL_VERSION)/g' $< > $@.tmp
 	$(MV) $@.tmp $@
 
-GENSRC_JDK_JCONSOLE += $(JDK_OUTPUTDIR)/gensrc/jdk.jconsole/sun/tools/jconsole/Version.java
+GENSRC_JDK_JCONSOLE += $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jconsole/sun/tools/jconsole/Version.java
 
 jdk.jconsole: $(GENSRC_JDK_JCONSOLE)
 
diff --git a/jdk/make/gensrc/Gensrc-jdk.jdi.gmk b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk
index e5bad8240d8..d71c5dd6177 100644
--- a/jdk/make/gensrc/Gensrc-jdk.jdi.gmk
+++ b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -30,27 +30,34 @@ include GensrcCommon.gmk
 # and a JDWPCommands.h C-header file.
 
 JDWP_SPEC_FILE := $(JDK_TOPDIR)/make/data/jdwp/jdwp.spec
+HEADER_FILE := $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
+JAVA_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java
 
-$(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h: $(JDWP_SPEC_FILE)
+# Both the header and java file are created using the same recipe. By declaring
+# this rule and adding header file to dependencies for java file, both are 
+# rebuilt if either is missing
+$(HEADER_FILE): $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK)
 
-$(JDK_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java: \
-    $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK)
+# Touch the target of this rule at the end to avoid triggering false rebuilds
+$(JAVA_FILE): $(JDWP_SPEC_FILE) $(BUILD_TOOLS_JDK) $(HEADER_FILE)
 	$(MKDIR) -p $(@D)
-	$(MKDIR) -p $(JDK_OUTPUTDIR)/gensrc_jdwp_headers
-	$(RM) $@ $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h
+	$(MKDIR) -p $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent
+	$(RM) $@ $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
 	$(ECHO) $(LOG_INFO) Creating JDWP.java and JDWPCommands.h from jdwp.spec
-	$(TOOL_JDWPGEN) $< -jdi $@ -include $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h
+	$(TOOL_JDWPGEN) $< -jdi $@ -include \
+	    $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h
+	$(TOUCH) $@
 
-$(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html: $(JDWP_SPEC_FILE) \
+$(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html: $(JDWP_SPEC_FILE) \
     $(BUILD_TOOLS_JDK)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
 	$(ECHO) $(LOG_INFO) Creating $(@F) from jdwp.spec
 	$(TOOL_JDWPGEN) $< -doc $@
 
-GENSRC_JDWP := $(JDK_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java \
-    $(JDK_OUTPUTDIR)/gensrc_jdwp_headers/JDWPCommands.h \
-    $(JDK_OUTPUTDIR)/gensrc_jdwp_doc/jdwp-protocol.html
+GENSRC_JDWP := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/com/sun/tools/jdi/JDWP.java \
+    $(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent/JDWPCommands.h \
+    $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/jdwp-protocol.html
 GENSRC_JDK_JDI += $(GENSRC_JDWP)
 
 ################################################################################
@@ -61,11 +68,18 @@ define process-provider
 endef
 
 # Filter com.sun.jdi.connect.Connector
-$(JDK_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector: \
-    $(JDK_TOPDIR)/src/jdk.jdi/share/classes/META-INF/services/com.sun.jdi.connect.Connector
+$(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector: \
+    $(JDK_TOPDIR)/src/jdk.jdi/share/classes/META-INF/services/com.sun.jdi.connect.Connector \
+    $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
 	$(process-provider)
 
-GENSRC_JDK_JDI += $(JDK_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector
+# Copy the same service file into jdk.hotspot.agent so that they are kept the same.
+$(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector: \
+    $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector
+	$(install-file)
+
+GENSRC_JDK_JDI += $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector \
+    $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector
 
 ################################################################################
 
diff --git a/jdk/make/gensrc/GensrcBuffer.gmk b/jdk/make/gensrc/GensrcBuffer.gmk
index bc23520fac2..2f5d789cd60 100644
--- a/jdk/make/gensrc/GensrcBuffer.gmk
+++ b/jdk/make/gensrc/GensrcBuffer.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,7 @@
 
 GENSRC_BUFFER := 
 
-GENSRC_BUFFER_TMP := $(JDK_OUTPUTDIR)/gensrc
-GENSRC_BUFFER_DST := $(JDK_OUTPUTDIR)/gensrc/java.base/java/nio
+GENSRC_BUFFER_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio
 
 GENSRC_BUFFER_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/java/nio
 
diff --git a/jdk/make/gensrc/GensrcCLDR.gmk b/jdk/make/gensrc/GensrcCLDR.gmk
index a0f2a0d4748..010922d0315 100644
--- a/jdk/make/gensrc/GensrcCLDR.gmk
+++ b/jdk/make/gensrc/GensrcCLDR.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 CLDRVERSION := 21.0.1
 CLDRSRCDIR := $(JDK_TOPDIR)/src/jdk.localedata/share/classes/sun/util/cldr/resources/$(subst .,_,$(CLDRVERSION))
 
-GENSRC_DIR := $(JDK_OUTPUTDIR)/gensrc/jdk.localedata
+GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata
 
 CLDR_METAINFO_FILE := $(GENSRC_DIR)/sun/util/resources/cldr/provider/CLDRLocaleDataMetaInfo.java
 
diff --git a/jdk/make/gensrc/GensrcCharacterData.gmk b/jdk/make/gensrc/GensrcCharacterData.gmk
index 1f57bff7bf6..b0b5eddacde 100644
--- a/jdk/make/gensrc/GensrcCharacterData.gmk
+++ b/jdk/make/gensrc/GensrcCharacterData.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,7 @@
 #
 
 #
-# Rules to create $(JDK_OUTPUTDIR)/gensrc/sun/lang/CharacterData*.java
+# Rules to create $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/lang/CharacterData*.java
 #
 
 GENSRC_CHARACTERDATA :=
@@ -33,7 +33,8 @@ CHARACTERDATA = $(JDK_TOPDIR)/make/data/characterdata
 UNICODEDATA = $(JDK_TOPDIR)/make/data/unicodedata
 
 define SetupCharacterData
-  $(JDK_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java: $(CHARACTERDATA)/$1.java.template $(BUILD_TOOLS_JDK)
+  $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java: \
+      $(CHARACTERDATA)/$1.java.template
 	$(MKDIR) -p $$(@D)
 	$(ECHO) $(LOG_INFO) Generating $1.java
 	$(TOOL_GENERATECHARACTER) $2 \
@@ -41,10 +42,10 @@ define SetupCharacterData
 	    -spec $(UNICODEDATA)/UnicodeData.txt \
 	    -specialcasing $(UNICODEDATA)/SpecialCasing.txt \
 	    -proplist $(UNICODEDATA)/PropList.txt \
-	    -o $(JDK_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java -string \
+	    -o $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java -string \
 	    -usecharforbyte $3
 
-  GENSRC_CHARACTERDATA += $(JDK_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java
+  GENSRC_CHARACTERDATA += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/$1.java
 endef
 
 $(eval $(call SetupCharacterData,CharacterDataLatin1, , -latin1 8))
@@ -54,12 +55,12 @@ $(eval $(call SetupCharacterData,CharacterData02, -plane 2, 11 4 1))
 $(eval $(call SetupCharacterData,CharacterData0E, -plane 14, 11 4 1))
 
 # Copy two Java files that need no preprocessing.
-$(JDK_OUTPUTDIR)/gensrc/java.base/java/lang/%.java: $(CHARACTERDATA)/%.java.template
+$(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/%.java: $(CHARACTERDATA)/%.java.template
 	$(ECHO) $(LOG_INFO) Generating $(@F)
 	$(call install-file)
 
-GENSRC_CHARACTERDATA += $(JDK_OUTPUTDIR)/gensrc/java.base/java/lang/CharacterDataUndefined.java \
-    $(JDK_OUTPUTDIR)/gensrc/java.base/java/lang/CharacterDataPrivateUse.java
+GENSRC_CHARACTERDATA += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/CharacterDataUndefined.java \
+    $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/lang/CharacterDataPrivateUse.java
 GENSRC_JAVA_BASE += $(GENSRC_CHARACTERDATA)
 
 $(GENSRC_CHARACTERDATA): $(BUILD_TOOLS_JDK)
diff --git a/jdk/make/gensrc/GensrcCharsetCoder.gmk b/jdk/make/gensrc/GensrcCharsetCoder.gmk
index b5444138b6f..e992b19a3fa 100644
--- a/jdk/make/gensrc/GensrcCharsetCoder.gmk
+++ b/jdk/make/gensrc/GensrcCharsetCoder.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,14 +25,13 @@
 
 GENSRC_CHARSETCODER :=
 
-GENSRC_CHARSETCODER_TMP := $(JDK_OUTPUTDIR)/gensrc
-GENSRC_CHARSETCODER_DST := $(JDK_OUTPUTDIR)/gensrc/java.base/java/nio/charset
+GENSRC_CHARSETCODER_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio/charset
 
 GENSRC_CHARSETCODER_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/java/nio
 
 GENSRC_CHARSETCODER_TEMPLATE := $(GENSRC_CHARSETCODER_SRC)/charset/Charset-X-Coder.java.template
 
-###
+################################################################################
 
 $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
 	$(MKDIR) -p $(@D)
@@ -67,7 +66,7 @@ $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
 
 GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetDecoder.java
 
-###
+################################################################################
 
 $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
 	$(MKDIR) -p $(@D)
@@ -103,6 +102,6 @@ $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java: $(GENSRC_CHARSETCODER_TEMPLATE)
 GENSRC_CHARSETCODER += $(GENSRC_CHARSETCODER_DST)/CharsetEncoder.java
 GENSRC_JAVA_BASE += $(GENSRC_CHARSETCODER)
 
-###
+################################################################################
 
 $(GENSRC_CHARSETCODER): $(BUILD_TOOLS_JDK)
diff --git a/jdk/make/gensrc/GensrcCharsetMapping.gmk b/jdk/make/gensrc/GensrcCharsetMapping.gmk
index a44dd887ac9..af1e9f08ce4 100644
--- a/jdk/make/gensrc/GensrcCharsetMapping.gmk
+++ b/jdk/make/gensrc/GensrcCharsetMapping.gmk
@@ -28,7 +28,7 @@
 # Generate files using the charsetmapping tool
 #
 CHARSET_DATA_DIR := $(JDK_TOPDIR)/make/data/charsetmapping
-CHARSET_GENSRC_JAVA_DIR_BASE := $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/cs
+CHARSET_GENSRC_JAVA_DIR_BASE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/cs
 CHARSET_DONE_BASE := $(CHARSET_GENSRC_JAVA_DIR_BASE)/_the.charsetmapping
 CHARSET_TEMPLATES := \
     $(CHARSET_DATA_DIR)/SingleByte-X.java.template \
@@ -46,7 +46,7 @@ GENSRC_JAVA_BASE += $(CHARSET_DONE_BASE)-sbcs
 #
 # Generate the sun/nio/cs/StandardCharsets.java file
 #
-CHARSET_STANDARD_GENSRC_DIR := $(JDK_OUTPUTDIR)/gensrc/standardcharsets
+CHARSET_STANDARD_GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_standardcharsets
 CHARSET_STANDARD_DATA := $(CHARSET_DATA_DIR)/standard-charsets
 CHARSET_STANDARD_JAVA :=  sun/nio/cs/StandardCharsets.java
 
@@ -118,7 +118,7 @@ $(CHARSET_STANDARD_GENSRC_DIR)/cache-map.java.snippet: $(CHARSET_STANDARD_GENSRC
 
 $(eval $(call SetupTextFileProcessing, BUILD_CHARSET_STANDARD, \
     SOURCE_FILES := $(JDK_TOPDIR)/src/java.base/share/classes/$(CHARSET_STANDARD_JAVA).template, \
-    OUTPUT_FILE := $(JDK_OUTPUTDIR)/gensrc/java.base/$(CHARSET_STANDARD_JAVA), \
+    OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/$(CHARSET_STANDARD_JAVA), \
     INCLUDES := \
         _INCLUDE_ALIASES_TABLES_ => $(CHARSET_STANDARD_GENSRC_DIR)/aliases-tables.java.snippet ; \
         _INCLUDE_ALIASES_MAP_ => $(CHARSET_STANDARD_GENSRC_DIR)/aliases-map.java.snippet ; \
diff --git a/jdk/make/gensrc/GensrcExceptions.gmk b/jdk/make/gensrc/GensrcExceptions.gmk
index e180bdc4eb3..398a8857963 100644
--- a/jdk/make/gensrc/GensrcExceptions.gmk
+++ b/jdk/make/gensrc/GensrcExceptions.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,7 @@
 
 GENSRC_EXCEPTIONS :=
 
-GENSRC_EXCEPTIONS_TMP := $(JDK_OUTPUTDIR)/gensrc
-GENSRC_EXCEPTIONS_DST := $(JDK_OUTPUTDIR)/gensrc/java.base/java/nio
+GENSRC_EXCEPTIONS_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/java/nio
 
 GENSRC_EXCEPTIONS_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/java/nio
 GENSRC_EXCEPTIONS_CMD := $(JDK_TOPDIR)/make/scripts/genExceptions.sh
diff --git a/jdk/make/gensrc/GensrcIcons.gmk b/jdk/make/gensrc/GensrcIcons.gmk
index e9b32f8f0b5..777ac7fe569 100644
--- a/jdk/make/gensrc/GensrcIcons.gmk
+++ b/jdk/make/gensrc/GensrcIcons.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,8 @@
 
 GENSRC_AWT_ICONS :=
 GENSRC_AWT_ICONS_SRC :=
-GENSRC_AWT_ICONS_TMP := $(JDK_OUTPUTDIR)/gensrc
-GENSRC_AWT_ICONS_DST := $(GENSRC_AWT_ICONS_TMP)/java.desktop/sun/awt/
+GENSRC_AWT_ICONS_TMP := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop
+GENSRC_AWT_ICONS_DST := $(GENSRC_AWT_ICONS_TMP)/sun/awt/
 
 ifdef OPENJDK
   X11_ICONS_PATH_PREFIX := $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)
@@ -62,14 +62,14 @@ GENSRC_AWT_ICONS_FILES := $(notdir $(GENSRC_AWT_ICONS_SRC))
 GENSRC_AWT_ICONS_SHORT_NAME = $(subst .,_,$(subst -,_,$(1)))
 GENSRC_AWT_ICONS_DST_NAME = AWTIcon$(2)_$(subst .,_,$(subst -,_,$(1)))
 
-###
+################################################################################
 
 $(GENSRC_AWT_ICONS_TMP)/_the.icons.dir:
 	$(ECHO) Generating icon classes
 	$(MKDIR) -p $(GENSRC_AWT_ICONS_DST)
 	$(TOUCH) $@
 
-###
+################################################################################
 
 define SetupGensrcAWTIcon
   # param 1 is for src-file
@@ -107,11 +107,11 @@ $(foreach I, $(GENSRC_AWT_ICONS_SRC), $(eval $(call SetupGensrcAWTIcon,$(notdir
 
 GENSRC_JAVA_DESKTOP += $(GENSRC_AWT_ICONS)
 
-###
+################################################################################
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
 
-  GENSRC_OSX_ICONS_DST := $(JDK_OUTPUTDIR)/gensrc_headers_icons
+  GENSRC_OSX_ICONS_DST := $(SUPPORT_OUTPUTDIR)/headers/java.desktop
   GENSRC_OSX_ICONS := $(GENSRC_OSX_ICONS_DST)/AWTIconData.h
 
   ifdef OPENJDK
diff --git a/jdk/make/gensrc/GensrcLocaleData.gmk b/jdk/make/gensrc/GensrcLocaleData.gmk
index c7b73dc7d39..8ce1c2292e5 100644
--- a/jdk/make/gensrc/GensrcLocaleData.gmk
+++ b/jdk/make/gensrc/GensrcLocaleData.gmk
@@ -42,14 +42,14 @@ LOCALE_FILES := $(shell $(FIND) $(JDK_TOPDIR)/src/java.base/share/classes \
 LOCALE_RESOURCES := $(sort $(subst .properties,,$(subst .java,,$(notdir $(LOCALE_FILES)))))
 
 # Include the list of resources found during the previous compile.
--include $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources
+-include $(SUPPORT_OUTPUTDIR)/gensrc/java.base/_the.locale_resources
 
 MISSING_RESOURCES := $(filter-out $(LOCALE_RESOURCES), $(PREV_LOCALE_RESOURCES))
 NEW_RESOURCES := $(filter-out $(PREV_LOCALE_RESOURCES), $(LOCALE_RESOURCES))
 
 ifneq (, $(MISSING_RESOURCES)$(NEW_RESOURCES))
   # There is a difference in the number of supported resources. Trigger a regeneration.
-  $(shell $(RM) $(JDK_OUTPUTDIR)/gensrc/sun/util/locale/provider/LocaleDataMetaInfo.java)
+  $(shell $(RM) $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/LocaleDataMetaInfo.java)
 endif
 
 # The EN locales
@@ -116,26 +116,28 @@ $(eval $(call CaptureLocale,CalendarData))
 SED_ENARGS += -e 's/$(HASH)AvailableLocales_Locales$(HASH)/$(sort $(ALL_EN_LOCALES))/g'
 SED_NONENARGS += -e 's/$(HASH)AvailableLocales_Locales$(HASH)/$(sort $(ALL_NON_EN_LOCALES))/g'
 
-$(JDK_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/EnLocaleDataMetaInfo.java: \
+$(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/EnLocaleDataMetaInfo.java: \
     $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
 	$(MKDIR) -p $(@D)
 	$(ECHO) Creating sun/util/locale/provider/EnLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
-	$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" > $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources
+	$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \
+	    > $(SUPPORT_OUTPUTDIR)/gensrc/_the.locale_resources
 	$(SED) $(SED_ENARGS) $< > $@
 
-$(JDK_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonEnLocaleDataMetaInfo.java: \
+$(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonEnLocaleDataMetaInfo.java: \
     $(JDK_TOPDIR)/src/java.base/share/classes/sun/util/locale/provider/LocaleDataMetaInfo-XLocales.java.template
 	$(MKDIR) -p $(@D)
 	$(ECHO) Creating sun/util/resources/provider/NonEnLocaleDataMetaInfo.java from $(words $(LOCALE_RESOURCES)) found resources.
-	$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" > $(JDK_OUTPUTDIR)/gensrc/_the.locale_resources
+	$(PRINTF) "PREV_LOCALE_RESOURCES:=$(LOCALE_RESOURCES)" \
+	    > $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/_the.locale_resources
 	$(SED) $(SED_NONENARGS) $< > $@
 
-GENSRC_BASELOCALEDATA := $(JDK_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/EnLocaleDataMetaInfo.java
-GENSRC_LOCALEDATA := $(JDK_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonEnLocaleDataMetaInfo.java
+GENSRC_BASELOCALEDATA := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/locale/provider/EnLocaleDataMetaInfo.java
+GENSRC_LOCALEDATA := $(SUPPORT_OUTPUTDIR)/gensrc/jdk.localedata/sun/util/resources/provider/NonEnLocaleDataMetaInfo.java
 
 ################################################################################
 
-GENSRC_CRBC_DST := $(JDK_OUTPUTDIR)/gensrc/java.base/sun/util/CoreResourceBundleControl.java
+GENSRC_CRBC_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/util/CoreResourceBundleControl.java
 GENSRC_CRBC_CMD := $(JDK_TOPDIR)/make/scripts/localelist.sh
 
 JRE_NONEXIST_LOCALES := en en_US de_DE es_ES fr_FR it_IT ja_JP ko_KR sv_SE zh
diff --git a/jdk/make/gensrc/GensrcMisc.gmk b/jdk/make/gensrc/GensrcMisc.gmk
index 75fa0387c2b..f8ed6b172a7 100644
--- a/jdk/make/gensrc/GensrcMisc.gmk
+++ b/jdk/make/gensrc/GensrcMisc.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -23,37 +23,32 @@
 # questions.
 #
 
-include ProfileNames.gmk
-
 ##########################################################################################
 # Install the launcher name, release version string, full version
 # string and the runtime name into the Version.java file.
 # To be printed by java -version
 
-$(JDK_OUTPUTDIR)/gensrc/java.base/sun/misc/Version.java \
-$(PROFILE_VERSION_JAVA_TARGETS): \
+$(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/misc/Version.java: \
     $(JDK_TOPDIR)/src/java.base/share/classes/sun/misc/Version.java.template
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
-	$(ECHO) Generating sun/misc/Version.java $(call profile_version_name, $@)
+	$(ECHO) Generating sun/misc/Version.java
 	$(SED) -e 's/@@launcher_name@@/$(LAUNCHER_NAME)/g' \
 	    -e 's/@@java_version@@/$(RELEASE)/g' \
 	    -e 's/@@java_runtime_version@@/$(FULL_VERSION)/g' \
 	    -e 's/@@java_runtime_name@@/$(RUNTIME_NAME)/g' \
-	    -e 's/@@java_profile_name@@/$(call profile_version_name, $@)/g' \
 	    $< > $@.tmp
 	$(MV) $@.tmp $@
 
-GENSRC_JAVA_BASE += $(JDK_OUTPUTDIR)/gensrc/java.base/sun/misc/Version.java \
-    $(PROFILE_VERSION_JAVA_TARGETS)
+GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/misc/Version.java
 
 ##########################################################################################
 
-GENSRC_JAVA_BASE += $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java
+GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java
 
 GENSRC_SOR_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/ch
 GENSRC_SOR_SRC_FILE := genSocketOptionRegistry.c
-GENSRC_SOR_BIN := $(JDK_OUTPUTDIR)/btnative/genSocketOptionRegistry
+GENSRC_SOR_BIN := $(BUILDTOOLS_OUTPUTDIR)/native/genSocketOptionRegistry
 
 SOR_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOR_SRC)/$(GENSRC_SOR_SRC_FILE) | \
     $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
@@ -71,14 +66,15 @@ $(eval $(call SetupNativeCompilation,BUILD_GENSRC_SOR_EXE, \
 SOR_PREGEN_FILE := $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/classes/sun/nio/ch/SocketOptionRegistry-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java.template
 
 ifeq ($(wildcard $(SOR_PREGEN_FILE)), )
-  $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java: $(BUILD_GENSRC_SOR_EXE)
+  $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java: $(BUILD_GENSRC_SOR_EXE)
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
-	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(SOR_COPYRIGHT_YEARS)" > $@.tmp
+	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e \
+	    $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(SOR_COPYRIGHT_YEARS)" > $@.tmp
 	$(BUILD_GENSRC_SOR_EXE) >> $@.tmp
 	$(MV) $@.tmp $@
 else
-  $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java: $(SOR_PREGEN_FILE)
+  $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/ch/SocketOptionRegistry.java: $(SOR_PREGEN_FILE)
 	$(call install-file)
 endif
 
@@ -86,11 +82,11 @@ endif
 
 ifneq ($(OPENJDK_TARGET_OS), windows)
 
-  GENSRC_JAVA_BASE += $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java
+  GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java
 
   GENSRC_UC_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/fs
   GENSRC_UC_SRC_FILE := genUnixConstants.c
-  GENSRC_UC_BIN := $(JDK_OUTPUTDIR)/btnative/genUnixConstants
+  GENSRC_UC_BIN := $(BUILDTOOLS_OUTPUTDIR)/native/genUnixConstants
 
   UC_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_UC_SRC)/$(GENSRC_UC_SRC_FILE) | \
       $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
@@ -109,14 +105,15 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
   UC_PREGEN_FILE := $(JDK_TOPDIR)/src/closed/java.base/$(OPENJDK_TARGET_OS)/classes/sun/nio/fs/UnixConstants-$(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH).java.template
 
   ifeq ($(wildcard $(UC_PREGEN_FILE)), )
-    $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java: $(BUILD_GENSRC_UC_EXE)
+    $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java: $(BUILD_GENSRC_UC_EXE)
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
-	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(UC_COPYRIGHT_YEARS)" > $@.tmp
+	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e \
+	    $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(UC_COPYRIGHT_YEARS)" > $@.tmp
 	$(BUILD_GENSRC_UC_EXE) >> $@.tmp
 	$(MV) $@.tmp $@
   else
-    $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java: $(UC_PREGEN_FILE)
+    $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/UnixConstants.java: $(UC_PREGEN_FILE)
 	$(call install-file)
   endif
 
@@ -126,11 +123,11 @@ endif
 
 ifeq ($(OPENJDK_TARGET_OS), solaris)
 
-  GENSRC_JAVA_BASE += $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/SolarisConstants.java
+  GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/SolarisConstants.java
 
   GENSRC_SOL_SRC := $(JDK_TOPDIR)/make/src/native/genconstants/fs
   GENSRC_SOL_SRC_FILE := genSolarisConstants.c
-  GENSRC_SOL_BIN := $(JDK_OUTPUTDIR)/btnative/genSolarisConstants
+  GENSRC_SOL_BIN := $(BUILDTOOLS_OUTPUTDIR)/native/genSolarisConstants
 
   SOL_COPYRIGHT_YEARS = $(shell $(CAT) $(GENSRC_SOL_SRC)/$(GENSRC_SOL_SRC_FILE) | \
       $(NAWK) '/^.*Copyright.*Oracle/ { printf "%s %s",$$4,$$5 }')
@@ -145,10 +142,11 @@ ifeq ($(OPENJDK_TARGET_OS), solaris)
       OUTPUT_DIR := $(GENSRC_SOL_BIN), \
       PROGRAM := genSolarisConstants))
 
-  $(JDK_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/SolarisConstants.java: $(BUILD_GENSRC_SOL_EXE)
+  $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/nio/fs/SolarisConstants.java: $(BUILD_GENSRC_SOL_EXE)
 	$(MKDIR) -p $(@D)
 	$(RM) $@ $@.tmp
-	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(SOL_COPYRIGHT_YEARS)" > $@.tmp
+	NAWK="$(NAWK)" SH="$(SH)" $(SH) -e \
+	    $(JDK_TOPDIR)/make/scripts/addNotices.sh "$(SOL_COPYRIGHT_YEARS)" > $@.tmp
 	$(BUILD_GENSRC_SOL_EXE) >> $@.tmp
 	$(MV) $@.tmp $@
 
diff --git a/jdk/make/gensrc/GensrcProperties.gmk b/jdk/make/gensrc/GensrcProperties.gmk
index 0b0520c6fd9..65e4e9e6214 100644
--- a/jdk/make/gensrc/GensrcProperties.gmk
+++ b/jdk/make/gensrc/GensrcProperties.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -30,7 +30,7 @@
 # Helper macro for SetupCopy-zh_HK.
 define SetupOneCopy-zh_HK
   $1_$2_TARGET := $$(patsubst $(JDK_TOPDIR)/src/$(MODULE)/share/classes/%, \
-      $(JDK_OUTPUTDIR)/gensrc/$(MODULE)/%, \
+      $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/%, \
       $$(subst _zh_TW,_zh_HK, $2))
 
   $$($1_$2_TARGET): $2
@@ -62,7 +62,7 @@ define SetupCompileProperties
   # Strip away prefix and suffix, leaving for example only: 
   # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
   $1_JAVAS := $$(patsubst $(JDK_TOPDIR)/src/%, \
-      $(JDK_OUTPUTDIR)/gensrc/%, \
+      $(SUPPORT_OUTPUTDIR)/gensrc/%, \
       $$(patsubst %.properties, %.java, \
       $$(subst /share/classes,, $$($1_SRCS))))
 
@@ -78,10 +78,10 @@ define SetupCompileProperties
       $$(addsuffix _SPACE_$$($1_CLASS), \
       $$(addprefix _SPACE_, $$($1_JAVAS)))))
 
-  $1_TARGET := $(JDK_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.done
-  $1_CMDLINE_FILE := $(JDK_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline
+  $1_TARGET := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.done
+  $1_CMDLINE_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the.$1.cmdline
 
-  # Now setup the rule for the generation of the resource bundles.
+# Now setup the rule for the generation of the resource bundles.
   $$($1_TARGET): $$($1_SRCS) $$($1_JAVAS) $(BUILD_TOOLS_JDK)
 	$(MKDIR) -p $$(@D) $$($1_DIRS)
 	$(ECHO) Compiling $$(words $$($1_SRCS)) properties into resource bundles for $(MODULE)
diff --git a/jdk/make/gensrc/GensrcSwing.gmk b/jdk/make/gensrc/GensrcSwing.gmk
index c7571269c98..537ca4b2437 100644
--- a/jdk/make/gensrc/GensrcSwing.gmk
+++ b/jdk/make/gensrc/GensrcSwing.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -27,25 +27,26 @@
 # Generate java files for javax.swing.plaf package
 #
 NIMBUS_PACKAGE = javax.swing.plaf
-NIMBUS_GENSRC_DIR = $(JDK_OUTPUTDIR)/gensrc/java.desktop/javax/swing/plaf/nimbus
+NIMBUS_GENSRC_DIR = $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/javax/swing/plaf/nimbus
 NIMBUS_SKIN_FILE = $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/plaf/nimbus/skin.laf
 
-$(JDK_OUTPUTDIR)/gensrc/_the.generated_nimbus: $(NIMBUS_SKIN_FILE) $(BUILD_TOOLS_JDK)
+$(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus: $(NIMBUS_SKIN_FILE) $(BUILD_TOOLS_JDK)
 	$(MKDIR) -p $(@D)
 	$(ECHO) "Generating Nimbus source files"
 	$(TOOL_GENERATENIMBUS) $(LOG_INFO) \
-	    -skinFile $(NIMBUS_SKIN_FILE) -buildDir $(JDK_OUTPUTDIR)/gensrc/java.desktop \
+	    -skinFile $(NIMBUS_SKIN_FILE) -buildDir $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop \
 	    -packagePrefix $(NIMBUS_PACKAGE).nimbus -lafName Nimbus
 	$(ECHO) $(LOG_INFO) "Finished generating Nimbus source files"
 	$(TOUCH) $@
 
-GENSRC_SWING_NIMBUS := $(JDK_OUTPUTDIR)/gensrc/_the.generated_nimbus
+GENSRC_SWING_NIMBUS := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated_nimbus
 
 #
 # Generate beaninfo java files
 #
 
-DOCLET_DATA_DIR = $(JDK_TOPDIR)/make/data/swingbeaninfo
+BEANINFO_OUTPUTDIR := $(SUPPORT_OUTPUTDIR)/gensrc_no_docs/java.desktop
+DOCLET_DATA_DIR := $(JDK_TOPDIR)/make/data/swingbeaninfo
 
 # javax.swing package
 BEANS = AbstractButton Box JComponent JApplet JButton \
@@ -67,41 +68,44 @@ BEANS_SRC = $(BEANS:%=$(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing/%
 
 # Dummy variable so far, in the old build system it was false by default
 SWINGBEAN_DEBUG_FLAG = false
-# GenDocletBeanInfo is compiled in Tools.gmk and picks up from $(JDK_OUTPUTDIR)/btclasses
+# GenDocletBeanInfo is compiled in Tools.gmk and picks up from $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes
 # LocaleDataMetaInfo needs to be generated before running this to avoid confusing errors
 # in the build log.
-$(JDK_OUTPUTDIR)/gensrc_no_srczip/_the.generated_beaninfo: $(BEANS_SRC) \
-    $(JDK_OUTPUTDIR)/gensrc_no_srczip/java.desktop/javax/swing/SwingBeanInfoBase.java \
-    $(JDK_OUTPUTDIR)/gensrc/java.desktop/sun/swing/BeanInfoUtils.java $(BUILD_TOOLS_JDK) \
-    | $(GENSRC_LOCALEDATAMETAINFO)
+$(BEANINFO_OUTPUTDIR)/_the.generated_beaninfo: $(BEANS_SRC) \
+    $(BEANINFO_OUTPUTDIR)/javax/swing/SwingBeanInfoBase.java \
+    $(BEANINFO_OUTPUTDIR)/sun/swing/BeanInfoUtils.java $(BUILD_TOOLS_JDK)
 	$(ECHO) Generating beaninfo
-	$(MKDIR) -p $(JDK_OUTPUTDIR)/gensrc_no_srczip/java.desktop/javax/swing
+	$(MKDIR) -p $(BEANINFO_OUTPUTDIR)/javax/swing
 	$(JAVA) -Djava.awt.headless=true $(NEW_JAVADOC) \
 	    -sourcepath "$(subst $(SPACE),$(PATH_SEP),\
 	        $(wildcard $(JDK_TOPDIR)/src/*/*/classes) \
-	        $(JDK_OUTPUTDIR)/gensrc/java.base)" \
+	        $(SUPPORT_OUTPUTDIR)/gensrc/java.base)" \
 	    -doclet build.tools.swingbeaninfo.GenDocletBeanInfo \
-	    -x $(SWINGBEAN_DEBUG_FLAG) -d $(JDK_OUTPUTDIR)/gensrc_no_srczip/java.desktop/javax/swing \
-	    -t $(DOCLET_DATA_DIR)/SwingBeanInfo.template -docletpath $(JDK_OUTPUTDIR)/btclasses \
+	    -x $(SWINGBEAN_DEBUG_FLAG) -d $(BEANINFO_OUTPUTDIR)/javax/swing \
+	    -t $(DOCLET_DATA_DIR)/SwingBeanInfo.template \
+	    -docletpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes \
 	    -XDignore.symbol.file=true \
-	    -classpath $(JDK_OUTPUTDIR)/btclasses $(BEANS_SRC) $(LOG_INFO)
+	    -classpath $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes $(BEANS_SRC) $(LOG_INFO)
         # Move the JTextComponent into its proper package directory.
-	$(MKDIR) -p $(JDK_OUTPUTDIR)/gensrc_no_srczip/java.desktop/javax/swing/text
-	$(MV) $(JDK_OUTPUTDIR)/gensrc_no_srczip/java.desktop/javax/swing/JTextComponentBeanInfo.java $(JDK_OUTPUTDIR)/gensrc_no_srczip/java.desktop/javax/swing/text/JTextComponentBeanInfo.java
+	$(MKDIR) -p $(BEANINFO_OUTPUTDIR)/javax/swing/text
+	$(MV) $(BEANINFO_OUTPUTDIR)/javax/swing/JTextComponentBeanInfo.java \
+	    $(BEANINFO_OUTPUTDIR)/javax/swing/text/JTextComponentBeanInfo.java
 	$(TOUCH) $@
 
 # This file is the part of dt.jar
 # For some reason it is under $(JDK_TOPDIR)/make/data/swingbeaninfo
 # Should it be moved under $(JDK_TOPDIR)/src/java.desktop/share/classes/javax/swing instead?
-$(JDK_OUTPUTDIR)/gensrc_no_srczip/java.desktop/javax/swing/SwingBeanInfoBase.java: $(DOCLET_DATA_DIR)/javax/swing/SwingBeanInfoBase.java
+$(BEANINFO_OUTPUTDIR)/javax/swing/SwingBeanInfoBase.java: \
+    $(DOCLET_DATA_DIR)/javax/swing/SwingBeanInfoBase.java
 	$(call install-file)
 
 # This file is the part of dt.jar
 # For some reason it is under $(JDK_TOPDIR)/make/data/swingbeaninfo
 # Should it be moved under $(JDK_TOPDIR)/src/java.desktop/share/classes/sun/swing instead?
-$(JDK_OUTPUTDIR)/gensrc/java.desktop/sun/swing/BeanInfoUtils.java: $(DOCLET_DATA_DIR)/sun/swing/BeanInfoUtils.java
+$(BEANINFO_OUTPUTDIR)/sun/swing/BeanInfoUtils.java: \
+    $(DOCLET_DATA_DIR)/sun/swing/BeanInfoUtils.java
 	$(call install-file)
 
-GENSRC_SWING_BEANINFO = $(JDK_OUTPUTDIR)/gensrc_no_srczip/_the.generated_beaninfo
+GENSRC_SWING_BEANINFO = $(BEANINFO_OUTPUTDIR)/_the.generated_beaninfo
 
 GENSRC_JAVA_DESKTOP += $(GENSRC_SWING_BEANINFO) $(GENSRC_SWING_NIMBUS)
diff --git a/jdk/make/gensrc/GensrcX11Wrappers.gmk b/jdk/make/gensrc/GensrcX11Wrappers.gmk
index b21729654f8..da8732bbf54 100644
--- a/jdk/make/gensrc/GensrcX11Wrappers.gmk
+++ b/jdk/make/gensrc/GensrcX11Wrappers.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -37,9 +37,9 @@
 GENSRC_X11WRAPPERS :=
 # Put temporary c-code and executable to calculate offsets here.
 # Also put verification offset file here as well.
-GENSRC_X11WRAPPERS_TMP := $(JDK_OUTPUTDIR)/gensrc_x11wrappers
+GENSRC_X11WRAPPERS_TMP := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_x11wrappers
 # Put the generated Java classes used to interface X11 from awt here.
-GENSRC_X11WRAPPERS_DST := $(JDK_OUTPUTDIR)/gensrc/java.desktop/sun/awt/X11
+GENSRC_X11WRAPPERS_DST := $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/sun/awt/X11
 
 # The pre-calculated offset file are stored here:
 GENSRC_SIZER_DIR := $(JDK_TOPDIR)/make/data/x11wrappergen
@@ -69,12 +69,12 @@ $(GENSRC_X11WRAPPERS_TMP)/sizes.%: $(GENSRC_SIZER_DIR)/sizes.%
 
 # Run the tool on the offset files copied from the source repository to generate several Java classes
 # used in awt.
-$(JDK_OUTPUTDIR)/gensrc/_the.generated.x11: $(GENSRC_X11_SIZES_USED) $(BUILD_TOOLS_JDK)
+$(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated.x11: $(GENSRC_X11_SIZES_USED) $(BUILD_TOOLS_JDK)
 	$(MKDIR) -p $(GENSRC_X11WRAPPERS_DST)
 	$(TOOL_WRAPPERGENERATOR) $(GENSRC_X11WRAPPERS_DST) $(GENSRC_SIZER_DIR)/xlibtypes.txt "gen" $(GENSRC_X11WRAPPERS_TMP)/sizes
 	$(TOUCH) $@
 
-GENSRC_X11WRAPPERS += $(JDK_OUTPUTDIR)/gensrc/_the.generated.x11
+GENSRC_X11WRAPPERS += $(SUPPORT_OUTPUTDIR)/gensrc/java.desktop/_the.generated.x11
 
 ifneq ($(COMPILE_TYPE), cross)
   # This is not a cross compile, regenerate the offset file, so that we
@@ -91,7 +91,7 @@ ifneq ($(COMPILE_TYPE), cross)
     MEMORY_MODEL_FLAG="$(COMPILER_TARGET_BITS_FLAG)$*"
   endif
 
-  SIZER_CFLAGS := -I$(JDK_OUTPUTDIR)/include \
+  SIZER_CFLAGS := \
       -I$(JDK_TOPDIR)/src/java.base/share/native/include \
       -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_EXPORT_DIR)/native/include \
       -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
diff --git a/jdk/make/launcher/Launcher-java.base.gmk b/jdk/make/launcher/Launcher-java.base.gmk
index 555c6f25aab..d117ad3b2ca 100644
--- a/jdk/make/launcher/Launcher-java.base.gmk
+++ b/jdk/make/launcher/Launcher-java.base.gmk
@@ -32,20 +32,20 @@ include LauncherCommon.gmk
 # overwritten.
 $(eval $(call SetupLauncher,java, \
     -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib, \
-    $(JDK_OUTPUTDIR)/objs/jli_static.lib, $(JAVA_RC_FLAGS), \
-    $(JAVA_VERSION_INFO_RESOURCE), $(JDK_OUTPUTDIR)/objs/java_objs,true))
+    $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jli_static.lib, $(JAVA_RC_FLAGS), \
+    $(JAVA_VERSION_INFO_RESOURCE), $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs,true))
 
-$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java)
+$(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX): $(BUILD_LAUNCHER_java)
 	$(MKDIR) -p $(@D)
 	$(RM) $@
-	$(CP) $(JDK_OUTPUTDIR)/objs/java_objs$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX) $@
+	$(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/java_objs$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX) $@
 
-LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java$(EXE_SUFFIX)
+TARGETS += $(SUPPORT_OUTPUTDIR)/modules_cmds/java.base/java$(EXE_SUFFIX)
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
   $(eval $(call SetupLauncher,javaw, \
       -DJAVAW -DEXPAND_CLASSPATH_WILDCARDS,,,user32.lib comctl32.lib, \
-      $(JDK_OUTPUTDIR)/objs/jli_static.lib, $(JAVA_RC_FLAGS), \
+      $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jli_static.lib, $(JAVA_RC_FLAGS), \
       $(JAVA_VERSION_INFO_RESOURCE),,true))
 endif
 
@@ -57,7 +57,7 @@ $(eval $(call SetupLauncher,keytool, \
 BUILD_JEXEC :=
 BUILD_JEXEC_SRC :=
 BUILD_JEXEC_INC :=
-BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
+BUILD_JEXEC_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)
 
 #
 # UNHANDLED:
@@ -90,7 +90,7 @@ ifeq ($(BUILD_JEXEC), 1)
   endif
 
   ifeq ($(OPENJDK_TARGET_OS), linux)
-    BUILD_JEXEC_DST_DIR := $(JDK_OUTPUTDIR)/lib
+    BUILD_JEXEC_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
     BUILD_JEXEC_INC += -I$(JDK_TOPDIR)/src/java.base/share/native/libjli
   endif
 endif
@@ -111,12 +111,12 @@ ifneq ($(BUILD_JEXEC_SRC), )
       CFLAGS_solaris := -KPIC, \
       LDFLAGS := $(LDFLAGS_JDKEXE) \
           $(call SET_SHARED_LIBRARY_NAME,$(LIBRARY_PREFIX)$(SHARED_LIBRARY_SUFFIX)), \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/jexec_obj, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jexec_obj, \
       OUTPUT_DIR := $(BUILD_JEXEC_DST_DIR), \
       DEBUG_SYMBOLS := true, \
       PROGRAM := jexec))
 
-  LIBRARIES += $(BUILD_JEXEC)
+  TARGETS += $(BUILD_JEXEC)
 endif
 
 ################################################################################
@@ -124,8 +124,8 @@ endif
 BUILD_JSPAWNHELPER :=
 BUILD_JSPAWNHELPER_SRC := $(JDK_TOPDIR)/src/java.base/unix/native/jspawnhelper
 JSPAWNHELPER_CFLAGS := -I$(JDK_TOPDIR)/src/java.base/unix/native/libjava
-BUILD_JSPAWNHELPER_DST_DIR := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
-LINK_JSPAWNHELPER_OBJECTS := $(JDK_OUTPUTDIR)/objs/libjava/childproc.o
+BUILD_JSPAWNHELPER_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)
+LINK_JSPAWNHELPER_OBJECTS := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava/childproc.o
 LINK_JSPAWNHELPER_FLAGS :=
 
 ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx solaris aix), )
@@ -133,7 +133,7 @@ ifneq ($(findstring $(OPENJDK_TARGET_OS), macosx solaris aix), )
 endif
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
-  BUILD_JSPAWNHELPER_DST_DIR := $(JDK_OUTPUTDIR)/lib
+  BUILD_JSPAWNHELPER_DST_DIR := $(SUPPORT_OUTPUTDIR)/modules_libs/java.base
 endif
 
 ifeq ($(OPENJDK_TARGET_CPU_BITS), 64)
@@ -149,19 +149,13 @@ ifeq ($(BUILD_JSPAWNHELPER), 1)
       CFLAGS := $(CFLAGS_JDKEXE) $(JSPAWNHELPER_CFLAGS), \
       LDFLAGS := $(LDFLAGS_JDKEXE) $(LINK_JSPAWNHELPER_FLAGS), \
       LDFLAGS_SUFFIX := $(LINK_JSPAWNHELPER_OBJECTS), \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/jspawnhelper, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/jspawnhelper, \
       OUTPUT_DIR := $(BUILD_JSPAWNHELPER_DST_DIR), \
       PROGRAM := jspawnhelper))
 
   $(BUILD_JSPAWNHELPER): $(LINK_JSPAWNHELPER_OBJECTS)
 
-  LIBRARIES += $(BUILD_JSPAWNHELPER)
+  TARGETS += $(BUILD_JSPAWNHELPER)
 endif
 
 ################################################################################
-
-java.base: $(LAUNCHERS) $(LIBRARIES)
-
-all: java.base
-
-.PHONY: all java.base
diff --git a/jdk/make/launcher/Launcher-java.corba.gmk b/jdk/make/launcher/Launcher-java.corba.gmk
index 82b44247e23..8404c556bcb 100644
--- a/jdk/make/launcher/Launcher-java.corba.gmk
+++ b/jdk/make/launcher/Launcher-java.corba.gmk
@@ -45,9 +45,3 @@ $(eval $(call SetupLauncher,tnameserv, \
         "-J-Dcom.sun.CORBA.POA.ORBServerId=1"$(COMMA) \
         "com.sun.corba.se.impl.naming.cosnaming.TransientNameServer"$(COMMA) }'))
 
-
-java.corba: $(LAUNCHERS)
-
-all: java.corba
-
-.PHONY: all java.corba
diff --git a/jdk/make/launcher/Launcher-java.desktop.gmk b/jdk/make/launcher/Launcher-java.desktop.gmk
index b7566e35bbe..1b36c691a03 100644
--- a/jdk/make/launcher/Launcher-java.desktop.gmk
+++ b/jdk/make/launcher/Launcher-java.desktop.gmk
@@ -34,8 +34,3 @@ ifndef BUILD_HEADLESS_ONLY
       $(XLIBS)))
 endif
 
-java.desktop: $(LAUNCHERS)
-
-all: java.desktop
-
-.PHONY: all java.desktop
diff --git a/jdk/make/launcher/Launcher-java.rmi.gmk b/jdk/make/launcher/Launcher-java.rmi.gmk
index 9eabcc2da30..26f9b7dc627 100644
--- a/jdk/make/launcher/Launcher-java.rmi.gmk
+++ b/jdk/make/launcher/Launcher-java.rmi.gmk
@@ -36,12 +36,12 @@ $(eval $(call SetupLauncher,rmiregistry, \
 #
 # The java-rmi.cgi script in bin/ only gets delivered in certain situations
 #
-JAVA_RMI_CGI := $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/java-rmi.cgi
+JAVA_RMI_CGI := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/java-rmi.cgi
 ifeq ($(OPENJDK_TARGET_OS), linux)
-  LAUNCHERS += $(JAVA_RMI_CGI)
+  TARGETS += $(JAVA_RMI_CGI)
 endif
 ifeq ($(OPENJDK_TARGET_OS), solaris)
-  LAUNCHERS += $(JAVA_RMI_CGI)
+  TARGETS += $(JAVA_RMI_CGI)
 endif
 
 # TODO:
@@ -61,9 +61,3 @@ else
 endif
 
 ##########################################################################################
-
-java.rmi: $(LAUNCHERS)
-
-all: java.rmi
-
-.PHONY: all java.rmi
diff --git a/jdk/make/launcher/Launcher-java.scripting.gmk b/jdk/make/launcher/Launcher-java.scripting.gmk
index d43ea36b4e9..14889a7f77b 100644
--- a/jdk/make/launcher/Launcher-java.scripting.gmk
+++ b/jdk/make/launcher/Launcher-java.scripting.gmk
@@ -28,8 +28,3 @@ include LauncherCommon.gmk
 $(eval $(call SetupLauncher,jrunscript, \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.script.shell.Main"$(COMMA) }'))
 
-java.scripting: $(LAUNCHERS)
-
-all: java.scripting
-
-.PHONY: all java.scripting
diff --git a/jdk/make/launcher/Launcher-java.security.jgss.gmk b/jdk/make/launcher/Launcher-java.security.jgss.gmk
index d25035170e1..818503ed569 100644
--- a/jdk/make/launcher/Launcher-java.security.jgss.gmk
+++ b/jdk/make/launcher/Launcher-java.security.jgss.gmk
@@ -36,8 +36,3 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
       -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.security.krb5.internal.tools.Ktab"$(COMMA) }'))
 endif
 
-java.security.jgss: $(LAUNCHERS)
-
-all: java.security.jgss
-
-.PHONY: all java.security.jgss
diff --git a/jdk/make/launcher/Launcher-jdk.compiler.gmk b/jdk/make/launcher/Launcher-jdk.compiler.gmk
index a73616d3a18..77695993886 100644
--- a/jdk/make/launcher/Launcher-jdk.compiler.gmk
+++ b/jdk/make/launcher/Launcher-jdk.compiler.gmk
@@ -30,13 +30,6 @@ $(eval $(call SetupLauncher,javac, \
     -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javac.Main"$(COMMA) }'))
 
-ifeq ($(ENABLE_SJAVAC), yes)
-  $(eval $(call SetupLauncher,sjavac, \
-      -DEXPAND_CLASSPATH_WILDCARDS \
-      -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
-      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.sjavac.Main"$(COMMA) }'))
-endif
-
 $(eval $(call SetupLauncher,javah, \
     -DEXPAND_CLASSPATH_WILDCARDS \
     -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
@@ -51,8 +44,12 @@ $(eval $(call SetupLauncher,serialver, \
     -DEXPAND_CLASSPATH_WILDCARDS \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.serialver.SerialVer"$(COMMA) }'))
 
-jdk.compiler: $(LAUNCHERS)
-
-all: jdk.compiler
-
-.PHONY: all jdk.compiler
+ifeq ($(ENABLE_SJAVAC), yes)
+  # Build sjavac directly to the exploded image so that it does not get included
+  # into any real images
+  $(eval $(call SetupLauncher,sjavac, \
+      -DEXPAND_CLASSPATH_WILDCARDS \
+      -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
+      -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.sjavac.Main"$(COMMA) }',,,,,,, \
+      $(JDK_OUTPUTDIR)/bin))
+endif
diff --git a/jdk/make/launcher/Launcher-jdk.dev.gmk b/jdk/make/launcher/Launcher-jdk.dev.gmk
index b3e74b13e92..6008ffd3b6d 100644
--- a/jdk/make/launcher/Launcher-jdk.dev.gmk
+++ b/jdk/make/launcher/Launcher-jdk.dev.gmk
@@ -36,14 +36,12 @@ $(eval $(call SetupLauncher,jdeps, \
     -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.jdeps.Main"$(COMMA) }'))
 
+$(eval $(call SetupLauncher,jimage,\
+    -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.tools.jimage.Main"$(COMMA) }'))
+
 $(eval $(call SetupLauncher,jhat, \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.hat.Main"$(COMMA) }'))
 
 $(eval $(call SetupLauncher,native2ascii, \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.native2ascii.Main"$(COMMA) }'))
 
-jdk.dev: $(LAUNCHERS)
-
-all: jdk.dev
-
-.PHONY: all jdk.dev
diff --git a/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk b/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk
index 984288dcec4..6686513e3c2 100644
--- a/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk
+++ b/jdk/make/launcher/Launcher-jdk.hotspot.agent.gmk
@@ -30,8 +30,3 @@ $(eval $(call SetupLauncher,jsadebugd, \
     -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }' \
     ,,,,,,,,,Info-privileged.plist))
 
-jdk.hotspot.agent: $(LAUNCHERS)
-
-all: jdk.hotspot.agent
-
-.PHONY: all jdk.hotspot.agent
diff --git a/jdk/make/launcher/Launcher-jdk.javadoc.gmk b/jdk/make/launcher/Launcher-jdk.javadoc.gmk
index dbf3ce45493..65eac4f120c 100644
--- a/jdk/make/launcher/Launcher-jdk.javadoc.gmk
+++ b/jdk/make/launcher/Launcher-jdk.javadoc.gmk
@@ -30,8 +30,3 @@ $(eval $(call SetupLauncher,javadoc, \
     -DNEVER_ACT_AS_SERVER_CLASS_MACHINE \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.javadoc.Main"$(COMMA) }'))
 
-jdk.javadoc: $(LAUNCHERS)
-
-all: jdk.javadoc
-
-.PHONY: all jdk.javadoc
diff --git a/jdk/make/launcher/Launcher-jdk.jcmd.gmk b/jdk/make/launcher/Launcher-jdk.jcmd.gmk
index 12595154ce4..9e3f7ceb13e 100644
--- a/jdk/make/launcher/Launcher-jdk.jcmd.gmk
+++ b/jdk/make/launcher/Launcher-jdk.jcmd.gmk
@@ -58,8 +58,3 @@ $(eval $(call SetupLauncher,jstat, \
 $(eval $(call SetupLauncher,jcmd, \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jcmd.JCmd"$(COMMA) }'))
 
-jdk.jcmd: $(LAUNCHERS)
-
-all: jdk.jcmd
-
-.PHONY: all jdk.jcmd
diff --git a/jdk/make/launcher/Launcher-jdk.jconsole.gmk b/jdk/make/launcher/Launcher-jdk.jconsole.gmk
index df537db5906..c67c0c0f933 100644
--- a/jdk/make/launcher/Launcher-jdk.jconsole.gmk
+++ b/jdk/make/launcher/Launcher-jdk.jconsole.gmk
@@ -32,8 +32,3 @@ $(eval $(call SetupLauncher,jconsole, \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "-J-Djconsole.showOutputViewer"$(COMMA) "sun.tools.jconsole.JConsole"$(COMMA) }' \
     -DAPP_CLASSPATH='{ "/lib/jconsole.jar"$(COMMA) "/lib/tools.jar"$(COMMA) "/classes" }'))
 
-jdk.jconsole: $(LAUNCHERS)
-
-all: jdk.jconsole
-
-.PHONY: all jdk.jconsole
diff --git a/jdk/make/launcher/Launcher-jdk.jdi.gmk b/jdk/make/launcher/Launcher-jdk.jdi.gmk
index b32d6c44d70..9d05f255626 100644
--- a/jdk/make/launcher/Launcher-jdk.jdi.gmk
+++ b/jdk/make/launcher/Launcher-jdk.jdi.gmk
@@ -29,8 +29,3 @@ $(eval $(call SetupLauncher,jdb, \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.example.debug.tty.TTY"$(COMMA) }' \
     -DAPP_CLASSPATH='{ "/lib/tools.jar"$(COMMA) "/lib/sa-jdi.jar"$(COMMA) "/classes" }'))
 
-jdk.jdi: $(LAUNCHERS)
-
-all: jdk.jdi
-
-.PHONY: all jdk.jdi
diff --git a/jdk/make/launcher/Launcher-jdk.jvmstat.gmk b/jdk/make/launcher/Launcher-jdk.jvmstat.gmk
index 5f5f8a1fbbe..b93ef16716e 100644
--- a/jdk/make/launcher/Launcher-jdk.jvmstat.gmk
+++ b/jdk/make/launcher/Launcher-jdk.jvmstat.gmk
@@ -28,8 +28,3 @@ include LauncherCommon.gmk
 $(eval $(call SetupLauncher,jstatd, \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.tools.jstatd.Jstatd"$(COMMA) }'))
 
-jdk.jvmstat: $(LAUNCHERS)
-
-all: jdk.jvmstat
-
-.PHONY: all jdk.jvmstat
diff --git a/jdk/make/launcher/Launcher-jdk.rmic.gmk b/jdk/make/launcher/Launcher-jdk.rmic.gmk
index 88a8471e978..2fc8742497c 100644
--- a/jdk/make/launcher/Launcher-jdk.rmic.gmk
+++ b/jdk/make/launcher/Launcher-jdk.rmic.gmk
@@ -29,8 +29,3 @@ $(eval $(call SetupLauncher,rmic, \
     -DEXPAND_CLASSPATH_WILDCARDS \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "sun.rmi.rmic.Main"$(COMMA) }'))
 
-jdk.rmic: $(LAUNCHERS)
-
-all: jdk.rmic
-
-.PHONY: all jdk.rmic
diff --git a/jdk/make/launcher/Launcher-jdk.runtime.gmk b/jdk/make/launcher/Launcher-jdk.runtime.gmk
index cf6be2d2467..1c868ba8503 100644
--- a/jdk/make/launcher/Launcher-jdk.runtime.gmk
+++ b/jdk/make/launcher/Launcher-jdk.runtime.gmk
@@ -49,16 +49,16 @@ ifeq ($(USE_EXTERNAL_LIBZ), true)
   UNPACKEXE_ZIPOBJS := -lz
 else
   UNPACKEXE_CFLAGS += -I$(JDK_TOPDIR)/src/java.base/share/native/libzip/zlib-1.2.8
-  UNPACKEXE_ZIPOBJS := $(JDK_OUTPUTDIR)/objs/libzip/zcrc32$(OBJ_SUFFIX) \
-      $(JDK_OUTPUTDIR)/objs/libzip/deflate$(OBJ_SUFFIX) \
-      $(JDK_OUTPUTDIR)/objs/libzip/trees$(OBJ_SUFFIX) \
-      $(JDK_OUTPUTDIR)/objs/libzip/zadler32$(OBJ_SUFFIX) \
-      $(JDK_OUTPUTDIR)/objs/libzip/compress$(OBJ_SUFFIX) \
-      $(JDK_OUTPUTDIR)/objs/libzip/zutil$(OBJ_SUFFIX) \
-      $(JDK_OUTPUTDIR)/objs/libzip/inflate$(OBJ_SUFFIX) \
-      $(JDK_OUTPUTDIR)/objs/libzip/infback$(OBJ_SUFFIX) \
-      $(JDK_OUTPUTDIR)/objs/libzip/inftrees$(OBJ_SUFFIX) \
-      $(JDK_OUTPUTDIR)/objs/libzip/inffast$(OBJ_SUFFIX)
+  UNPACKEXE_ZIPOBJS := $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zcrc32$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/deflate$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/trees$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zadler32$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/compress$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/zutil$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inflate$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/infback$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inftrees$(OBJ_SUFFIX) \
+      $(SUPPORT_OUTPUTDIR)/native/java.base/libzip/inffast$(OBJ_SUFFIX)
 
 endif
 
@@ -108,8 +108,8 @@ $(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
     LDFLAGS_linux := -lc, \
     LDFLAGS_solaris := $(UNPACKEXE_LDFLAGS_solaris) -lc, \
     LDFLAGS_SUFFIX := $(LIBCXX), \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR), \
-    OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs/unpackexe$(OUTPUT_SUBDIR), \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe$(OUTPUT_SUBDIR), \
+    OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpackexe$(OUTPUT_SUBDIR), \
     PROGRAM := unpack200, \
     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
     RC_FLAGS := $(RC_FLAGS) \
@@ -133,15 +133,9 @@ endif
 # image. The real fix would be clean up linking of unpack200 using
 # -link -incremental:no
 # like all other launchers.
-$(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX): $(BUILD_UNPACKEXE)
+$(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/unpack200$(EXE_SUFFIX): $(BUILD_UNPACKEXE)
 	$(call install-file)
 
-LAUNCHERS += $(JDK_OUTPUTDIR)/bin$(OUTPUT_SUBDIR)/unpack200$(EXE_SUFFIX)
+TARGETS += $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)/unpack200$(EXE_SUFFIX)
 
 ################################################################################
-
-jdk.runtime: $(LAUNCHERS)
-
-all: jdk.runtime
-
-.PHONY: all jdk.runtime
diff --git a/jdk/make/launcher/Launcher-jdk.scripting.nashorn.gmk b/jdk/make/launcher/Launcher-jdk.scripting.nashorn.gmk
index cfb5f421a18..1a9f71c05af 100644
--- a/jdk/make/launcher/Launcher-jdk.scripting.nashorn.gmk
+++ b/jdk/make/launcher/Launcher-jdk.scripting.nashorn.gmk
@@ -28,8 +28,3 @@ include LauncherCommon.gmk
 $(eval $(call SetupLauncher,jjs, \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "jdk.nashorn.tools.Shell"$(COMMA) }'))
 
-jdk.scripting.nashorn: $(LAUNCHERS)
-
-all: jdk.scripting.nashorn
-
-.PHONY: all jdk.scripting.nashorn
diff --git a/jdk/make/launcher/Launcher-jdk.xml.bind.gmk b/jdk/make/launcher/Launcher-jdk.xml.bind.gmk
index f03de37ca17..5dd0ff0fce4 100644
--- a/jdk/make/launcher/Launcher-jdk.xml.bind.gmk
+++ b/jdk/make/launcher/Launcher-jdk.xml.bind.gmk
@@ -31,8 +31,3 @@ $(eval $(call SetupLauncher,schemagen, \
 $(eval $(call SetupLauncher,xjc, \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.xjc.Driver"$(COMMA) }'))
 
-jdk.xml.bind: $(LAUNCHERS)
-
-all: jdk.xml.bind
-
-.PHONY: all jdk.xml.bind
diff --git a/jdk/make/launcher/Launcher-jdk.xml.ws.gmk b/jdk/make/launcher/Launcher-jdk.xml.ws.gmk
index 583156372e2..4085ba1a967 100644
--- a/jdk/make/launcher/Launcher-jdk.xml.ws.gmk
+++ b/jdk/make/launcher/Launcher-jdk.xml.ws.gmk
@@ -31,8 +31,3 @@ $(eval $(call SetupLauncher,wsgen, \
 $(eval $(call SetupLauncher,wsimport, \
     -DJAVA_ARGS='{ "-J-ms8m"$(COMMA) "com.sun.tools.internal.ws.WsImport"$(COMMA) }'))
 
-jdk.xml.ws: $(LAUNCHERS)
-
-all: jdk.xml.ws
-
-.PHONY: all jdk.xml.ws
diff --git a/jdk/make/launcher/LauncherCommon.gmk b/jdk/make/launcher/LauncherCommon.gmk
index f8ff00c830d..40dbba918d5 100644
--- a/jdk/make/launcher/LauncherCommon.gmk
+++ b/jdk/make/launcher/LauncherCommon.gmk
@@ -23,10 +23,6 @@
 # questions.
 #
 
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
 include NativeCompilation.gmk
 
 # Prepare the find cache.
@@ -93,7 +89,7 @@ define SetupLauncher
   $(call LogSetupMacroEntry,SetupLauncher($1),$2,$3,$4,$5,$6,$7,$8,$9,$(10),$(11))
   $(if $(13),$(error Internal makefile error: Too many arguments to SetupLauncher, please update CompileLaunchers.gmk))
 
-  $1_WINDOWS_JLI_LIB := $(JDK_OUTPUTDIR)/objs/libjli/jli.lib
+  $1_WINDOWS_JLI_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjli/jli.lib
   ifneq ($6, )
     $1_WINDOWS_JLI_LIB := $6
   endif
@@ -113,14 +109,14 @@ define SetupLauncher
       endif
     endif
 
-    $1_LDFLAGS += -Wl,-all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
+    $1_LDFLAGS += -Wl,-all_load $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a \
         -framework Cocoa -framework Security -framework ApplicationServices \
         -sectcreate __TEXT __info_plist $(MACOSX_PLIST_DIR)/$$($1_PLIST_FILE)
         $1_LDFLAGS_SUFFIX += -pthread
   endif
 
   ifeq ($(OPENJDK_TARGET_OS), aix)
-    $1_LDFLAGS_SUFFIX += -L$(JDK_OUTPUTDIR)/objs -ljli_static
+    $1_LDFLAGS_SUFFIX += -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE) -ljli_static
   endif
 
   ifeq ($(USE_EXTERNAL_LIBZ), true)
@@ -129,7 +125,7 @@ define SetupLauncher
 
   $1_OUTPUT_DIR_ARG := $9
   ifeq (, $$($1_OUTPUT_DIR_ARG))
-    $1_OUTPUT_DIR_ARG := $(JDK_OUTPUTDIR)/bin
+    $1_OUTPUT_DIR_ARG := $(SUPPORT_OUTPUTDIR)/modules_cmds/$(MODULE)
   endif
 
   # TODO: maybe it's better to move this if-statement out of this function
@@ -189,10 +185,10 @@ define SetupLauncher
       LDFLAGS_SUFFIX := $(LDFLAGS_JDKEXE_SUFFIX) $$($1_LDFLAGS_SUFFIX), \
       LDFLAGS_SUFFIX_posix := $4, \
       LDFLAGS_SUFFIX_windows := $$($1_WINDOWS_JLI_LIB) \
-          $(JDK_OUTPUTDIR)/objs/libjava/java.lib advapi32.lib $5, \
-      LDFLAGS_SUFFIX_linux := -L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli $(LIBDL) -lc, \
-      LDFLAGS_SUFFIX_solaris := -L$(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli -lthread $(LIBDL) -lc, \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/$1_objs$(OUTPUT_SUBDIR), \
+          $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib advapi32.lib $5, \
+      LDFLAGS_SUFFIX_linux := -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli $(LIBDL) -lc, \
+      LDFLAGS_SUFFIX_solaris := -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.base$(OPENJDK_TARGET_CPU_LIBDIR)/jli -ljli -lthread $(LIBDL) -lc, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$1_objs$(OUTPUT_SUBDIR), \
       OUTPUT_DIR := $$($1_OUTPUT_DIR_ARG)$(OUTPUT_SUBDIR), \
       PROGRAM := $1, \
       DEBUG_SYMBOLS := true, \
@@ -205,14 +201,14 @@ define SetupLauncher
       MANIFEST := $(JAVA_MANIFEST), \
       CODESIGN := $$($1_CODESIGN))
 
-  LAUNCHERS += $$(BUILD_LAUNCHER_$1)
+  TARGETS += $$(BUILD_LAUNCHER_$1)
 
   ifneq (,$(filter $(OPENJDK_TARGET_OS), macosx aix))
-    $$(BUILD_LAUNCHER_$1): $(JDK_OUTPUTDIR)/objs/libjli_static.a
+    $$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a
   endif
 
   ifeq ($(OPENJDK_TARGET_OS), windows)
-    $$(BUILD_LAUNCHER_$1): $(JDK_OUTPUTDIR)/objs/libjava/java.lib \
+    $$(BUILD_LAUNCHER_$1): $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib \
         $$($1_WINDOWS_JLI_LIB)
   endif
 endef
diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
index 0d38b332892..09a14a20d0f 100644
--- a/jdk/make/lib/Awt2dLibraries.gmk
+++ b/jdk/make/lib/Awt2dLibraries.gmk
@@ -23,7 +23,7 @@
 # questions.
 #
 
-WIN_AWT_LIB := $(JDK_OUTPUTDIR)/objs/libawt/awt.lib
+WIN_AWT_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt/awt.lib
 
 ################################################################################
 
@@ -66,12 +66,12 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBMLIB_IMAGE, \
         -D "JDK_FNAME=mlib_image.dll" \
         -D "JDK_INTERNAL_NAME=mlib_image" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libmlib_image, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmlib_image, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-$(BUILD_LIBMLIB_IMAGE): $(BUILD_LIBJAVA)
+$(BUILD_LIBMLIB_IMAGE): $(call FindLib, java.base, java)
 
-DESKTOP_LIBRARIES += $(BUILD_LIBMLIB_IMAGE)
+TARGETS += $(BUILD_LIBMLIB_IMAGE)
 
 ################################################################################
 
@@ -132,12 +132,12 @@ ifeq ($(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU_ARCH), solaris-sparc)
           $(BUILD_LIBMLIB_LDLIBS) -ljava -ljvm \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_SUFFIX_solaris := -lc, \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libmlib_image_v, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmlib_image_v, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-  $(BUILD_LIBMLIB_IMAGE_V): $(BUILD_LIBJAVA)
+  $(BUILD_LIBMLIB_IMAGE_V): $(call FindLib, java.base, java)
 
-  DESKTOP_LIBRARIES += $(BUILD_LIBMLIB_IMAGE_V)
+  TARGETS += $(BUILD_LIBMLIB_IMAGE_V)
 
 endif
 
@@ -167,7 +167,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
   LIBAWT_EXFILES += initIDs.c awt/image/cvutils/img_colors.c
 endif
 
-LIBAWT_CFLAGS += -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+LIBAWT_CFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
     $(addprefix -I, $(shell find $(LIBAWT_DIRS) -type d)) \
     $(LIBJAVA_HEADER_FLAGS) \
     $(addprefix -I, $(BUILD_LIBMLIB_IMAGE_SRC)) \
@@ -214,7 +214,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common/java2d/opengl \
       -I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \
       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
-      -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \
+      -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
       #
   LIBAWT_EXFILES += \
       java2d/d3d/D3DShaderGen.c \
@@ -259,7 +259,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
     LDFLAGS_SUFFIX_linux := -ljvm $(LIBM) $(LIBDL) -ljava, \
     LDFLAGS_SUFFIX_solaris := -ljvm $(LIBM) $(LIBDL) -ljava -lc, \
     LDFLAGS_SUFFIX_aix :=-ljvm $(LIBM) $(LIBDL) -ljava -lm,\
-    LDFLAGS_SUFFIX_macosx := -lmlib_image -ljvm $(LIBM) \
+    LDFLAGS_SUFFIX_macosx := -L$(INSTALL_LIBRARIES_HERE) \
+        -lmlib_image -ljvm $(LIBM) \
         -framework Cocoa \
         -framework OpenGL \
         -framework JavaNativeFoundation \
@@ -281,16 +282,16 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBAWT, \
         -D "JDK_FNAME=awt.dll" \
         -D "JDK_INTERNAL_NAME=awt" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-$(BUILD_LIBAWT): $(BUILD_LIBJAVA)
+$(BUILD_LIBAWT): $(call FindLib, java.base, java)
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
   $(BUILD_LIBAWT): $(BUILD_LIBMLIB_IMAGE)
 endif
 
-DESKTOP_LIBRARIES += $(BUILD_LIBAWT)
+TARGETS += $(BUILD_LIBAWT)
 
 ################################################################################
 
@@ -312,7 +313,7 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
     LIBAWT_XAWT_EXCLUDES := medialib
 
     LIBAWT_XAWT_CFLAGS := $(addprefix -I, $(shell $(FIND) $(LIBAWT_XAWT_DIRS) -type d)) \
-        -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+        -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
         -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS)/native/include \
         -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/include \
@@ -365,21 +366,22 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(X_LIBS) $(LIBAWT_XAWT_LDFLAGS) \
             $(call SET_SHARED_LIBRARY_ORIGIN) \
-            $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
+            $(call SET_SHARED_LIBRARY_ORIGIN,/..) \
+            -L $(INSTALL_LIBRARIES_HERE), \
         LDFLAGS_SUFFIX := $(LIBAWT_XAWT_LDFLAGS_SUFFIX), \
         VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
         RC_FLAGS := $(RC_FLAGS) \
             -D "JDK_FNAME=xawt.dll" \
             -D "JDK_INTERNAL_NAME=xawt" \
             -D "JDK_FTYPE=0x2L", \
-        OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_xawt, \
+        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_xawt, \
         DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-    $(BUILD_LIBAWT_XAWT): $(BUILD_LIBJAVA)
+    $(BUILD_LIBAWT_XAWT): $(call FindLib, java.base, java)
 
     $(BUILD_LIBAWT_XAWT): $(BUILD_LIBAWT)
 
-    DESKTOP_LIBRARIES += $(BUILD_LIBAWT_XAWT)
+    TARGETS += $(BUILD_LIBAWT_XAWT)
 
   endif
 endif
@@ -387,7 +389,7 @@ endif
 ################################################################################
 
 LIBLCMS_SRC := $(JDK_TOPDIR)/src/java.desktop/share/native/liblcms
-LIBLCMS_CPPFLAGS += -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+LIBLCMS_CPPFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
     -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
     -I$(JDK_TOPDIR)/src/java.desktop/share/native/common/awt/debug \
     $(LIBJAVA_HEADER_FLAGS) \
@@ -419,6 +421,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
+    LDFLAGS_posix := -L $(INSTALL_LIBRARIES_HERE), \
     LDFLAGS_solaris := /usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2, \
     LDFLAGS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
     LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc $(LCMS_LIBS), \
@@ -430,10 +433,10 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
         -D "JDK_FNAME=lcms.dll" \
         -D "JDK_INTERNAL_NAME=lcms" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/liblcms, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/liblcms, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-DESKTOP_LIBRARIES += $(BUILD_LIBLCMS)
+TARGETS += $(BUILD_LIBLCMS)
 
 $(BUILD_LIBLCMS): $(BUILD_LIBAWT)
 
@@ -492,7 +495,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVAJPEG, \
     OPTIMIZATION := HIGHEST, \
     CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJAVAJPEG_SRC)) \
         $(LIBJAVA_HEADER_FLAGS) \
-        -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop, \
+        -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
     MAPFILE := $(BUILD_LIBJAVAJPEG_MAPFILE), \
     LDFLAGS := $(LDFLAGS_JDKLIB) $(LIBJPEG_LIBS) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -504,12 +507,12 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVAJPEG, \
         -D "JDK_INTERNAL_NAME=javajpeg" \
         -D "JDK_FTYPE=0x2L", \
     REORDER := $(BUILD_LIBJAVAJPEG_REORDER), \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjavajpeg, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjavajpeg, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-$(BUILD_LIBJAVAJPEG): $(BUILD_LIBJAVA)
+$(BUILD_LIBJAVAJPEG): $(call FindLib, java.base, java)
 
-DESKTOP_LIBRARIES += $(BUILD_LIBJAVAJPEG)
+TARGETS += $(BUILD_LIBJAVAJPEG)
 
 ################################################################################
 
@@ -522,7 +525,7 @@ LIBFONTMANAGER_CFLAGS := \
       $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt \
       $(JDK_TOPDIR)/src/java.desktop/share/native/common \
       $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/common -type d)) \
-    -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+    -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
     $(LIBJAVA_HEADER_FLAGS) \
     #
 
@@ -578,6 +581,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
     MAPFILE := $(BUILD_LIBFONTMANAGER_MAPFILE), \
     LDFLAGS := $(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
+    LDFLAGS_posix := -L $(INSTALL_LIBRARIES_HERE), \
     LDFLAGS_SUFFIX := $(BUILD_LIBFONTMANAGER_FONTLIB), \
     LDFLAGS_SUFFIX_linux := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \
     LDFLAGS_SUFFIX_solaris := $(filter-out -R%, $(X_LIBS)) \
@@ -592,7 +596,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
         -D "JDK_FNAME=fontmanager.dll" \
         -D "JDK_INTERNAL_NAME=fontmanager" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libfontmanager, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfontmanager, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT)
@@ -601,7 +605,7 @@ ifneq (, $(findstring $(OPENJDK_TARGET_OS), solaris aix))
   $(BUILD_LIBFONTMANAGER): $(BUILD_LIBAWT_XAWT)
 endif
 
-DESKTOP_LIBRARIES += $(BUILD_LIBFONTMANAGER)
+TARGETS += $(BUILD_LIBFONTMANAGER)
 
 ################################################################################
 
@@ -612,7 +616,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
       -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/awt/image/cvutils \
       -I$(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libawt/java2d/windows \
-      -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+      -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
       -I$(JDK_TOPDIR)/src/java.desktop/windows/native/include \
       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
       $(LIBJAVA_HEADER_FLAGS) \
@@ -639,16 +643,16 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
           -D "JDK_FNAME=jawt.dll" \
           -D "JDK_INTERNAL_NAME=jawt" \
           -D "JDK_FTYPE=0x2L", \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjawt, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
   $(BUILD_LIBJAWT): $(BUILD_LIBAWT)
 
   $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX): $(BUILD_LIBJAWT)
 	$(ECHO) Copying $(@F)
-	$(CP) $(JDK_OUTPUTDIR)/objs/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX) $@
+	$(CP) $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX) $@
 
-  DESKTOP_LIBRARIES += $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
+  TARGETS += $(JDK_OUTPUTDIR)/lib/$(LIBRARY_PREFIX)jawt$(STATIC_LIBRARY_SUFFIX)
 
 else # OPENJDK_TARGET_OS not windows
 
@@ -694,13 +698,14 @@ else # OPENJDK_TARGET_OS not windows
       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjawt/mapfile-vers, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
+      LDFLAGS_posix := -L $(INSTALL_LIBRARIES_HERE), \
       LDFLAGS_solaris := $(X_LIBS), \
       LDFLAGS_SUFFIX_linux := $(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX), \
       LDFLAGS_SUFFIX_aix := $(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX),\
       LDFLAGS_SUFFIX_solaris := $(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX) -lXrender, \
       LDFLAGS_SUFFIX_macosx := -Xlinker -rpath -Xlinker @loader_path $(JAWT_LIBS) \
           -framework Cocoa $(LDFLAGS_JDKLIB_SUFFIX), \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjawt, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjawt, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
   ifndef BUILD_HEADLESS_ONLY
@@ -715,7 +720,7 @@ else # OPENJDK_TARGET_OS not windows
 
 endif # OPENJDK_TARGET_OS
 
-DESKTOP_LIBRARIES += $(BUILD_LIBJAWT)
+TARGETS += $(BUILD_LIBJAWT)
 
 ################################################################################
 
@@ -732,7 +737,7 @@ ifeq ($(BUILD_HEADLESS), true)
         #
 
     LIBAWT_HEADLESS_EXCLUDES := medialib
-    LIBAWT_HEADLESS_CFLAGS := -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+    LIBAWT_HEADLESS_CFLAGS := -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
         $(addprefix -I, $(LIBAWT_HEADLESS_DIRS)) \
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d \
         -I$(JDK_TOPDIR)/src/java.desktop/share/native/libawt/java2d/loops \
@@ -770,6 +775,7 @@ ifeq ($(BUILD_HEADLESS), true)
         MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
+        LDFLAGS_posix := -L $(INSTALL_LIBRARIES_HERE), \
         LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
         LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
         LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN)., \
@@ -777,12 +783,12 @@ ifeq ($(BUILD_HEADLESS), true)
         LDFLAGS_SUFFIX_linux := -ljvm -lawt -lm $(LIBDL) -ljava, \
         LDFLAGS_SUFFIX_aix := -ljvm -lawt -ljava,\
         LDFLAGS_SUFFIX_solaris := $(LIBDL) -ljvm -lawt -lm -ljava $(LIBCXX) -lc, \
-        OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_headless, \
+        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_headless, \
         DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
     $(BUILD_LIBAWT_HEADLESS): $(BUILD_LIBAWT)
 
-    DESKTOP_LIBRARIES += $(BUILD_LIBAWT_HEADLESS)
+    TARGETS += $(BUILD_LIBAWT_HEADLESS)
 
   endif
 endif
@@ -853,7 +859,9 @@ ifndef BUILD_HEADLESS_ONLY
   endif
 
   ifeq ($(OPENJDK_TARGET_OS), macosx)
-    LIBSPLASHSCREEN_LDFLAGS_SUFFIX += $(LIBM) -lpthread -liconv -losxapp \
+    LIBSPLASHSCREEN_LDFLAGS_SUFFIX += \
+        -L$(INSTALL_LIBRARIES_HERE) \
+        $(LIBM) -lpthread -liconv -losxapp \
         -framework ApplicationServices \
         -framework Foundation \
         -framework Cocoa \
@@ -885,10 +893,10 @@ ifndef BUILD_HEADLESS_ONLY
           -D "JDK_FNAME=splashscreen.dll" \
           -D "JDK_INTERNAL_NAME=splashscreen" \
           -D "JDK_FTYPE=0x2L", \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsplashscreen, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsplashscreen, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-  DESKTOP_LIBRARIES += $(BUILD_LIBSPLASHSCREEN)
+  TARGETS += $(BUILD_LIBSPLASHSCREEN)
 
   ifeq ($(OPENJDK_TARGET_OS), macosx)
     $(BUILD_LIBSPLASHSCREEN): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)osxapp$(SHARED_LIBRARY_SUFFIX)
@@ -909,7 +917,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
 
   LIBAWT_LWAWT_CFLAGS := \
       $(addprefix -I, $(LIBAWT_LWAWT_DIRS)) \
-      -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+      -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/include \
       -I$(JDK_TOPDIR)/src/java.desktop/share/native/include \
       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libawt_lwawt/java2d/opengl \
@@ -945,7 +953,8 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
           $(X_LIBS) \
           $(LIBAWT_LWAWT_CFLAGS), \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
-          $(call SET_SHARED_LIBRARY_ORIGIN), \
+          $(call SET_SHARED_LIBRARY_ORIGIN) \
+          -L $(INSTALL_LIBRARIES_HERE), \
       LDFLAGS_SUFFIX_macosx := -lawt -lmlib_image -losxapp -ljvm $(LIBM) \
           -framework Accelerate \
           -framework ApplicationServices \
@@ -958,10 +967,10 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
           -framework JavaRuntimeSupport \
           -framework OpenGL \
           -framework QuartzCore -ljava, \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libawt_lwawt, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libawt_lwawt, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-  DESKTOP_LIBRARIES += $(BUILD_LIBAWT_LWAWT)
+  TARGETS += $(BUILD_LIBAWT_LWAWT)
 
   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBAWT)
 
@@ -969,7 +978,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
 
   $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBOSXAPP)
 
-  $(BUILD_LIBAWT_LWAWT): $(BUILD_LIBJAVA)
+  $(BUILD_LIBAWT_LWAWT): $(call FindLib, java.base, java)
 
 endif
 
@@ -989,10 +998,11 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
           -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
           -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
           -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava \
-          -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop,  \
+          -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop,  \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN) \
-          -Xlinker -rpath -Xlinker @loader_path, \
+          -Xlinker -rpath -Xlinker @loader_path \
+          -L $(INSTALL_LIBRARIES_HERE), \
       LDFLAGS_SUFFIX_macosx := -lawt -losxapp -lawt_lwawt \
           -framework Cocoa \
           -framework Carbon \
@@ -1000,10 +1010,10 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
           -framework JavaNativeFoundation \
           -framework JavaRuntimeSupport \
           -ljava -ljvm, \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libosxui, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxui, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-  DESKTOP_LIBRARIES += $(BUILD_LIBOSXUI)
+  TARGETS += $(BUILD_LIBOSXUI)
 
   $(BUILD_LIBOSXUI): $(BUILD_LIBAWT)
 
@@ -1011,7 +1021,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
 
   $(BUILD_LIBOSXUI): $(BUILD_LIBAWT_LWAWT)
 
-  #$(BUILD_LIBOSXUI): $(BUILD_LIBJAVA)
+  #$(BUILD_LIBOSXUI): $(call FindLib, java.base, java)
 
 endif
 
diff --git a/jdk/make/lib/CoreLibraries.gmk b/jdk/make/lib/CoreLibraries.gmk
index c6328d4bd38..b77c606b8d8 100644
--- a/jdk/make/lib/CoreLibraries.gmk
+++ b/jdk/make/lib/CoreLibraries.gmk
@@ -23,7 +23,7 @@
 # questions.
 #
 
-WIN_VERIFY_LIB := $(JDK_OUTPUTDIR)/objs/libverify/verify.lib
+WIN_VERIFY_LIB := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify/verify.lib
 
 ##########################################################################################
 # libfdlibm is statically linked with libjava below and not delivered into the 
@@ -41,7 +41,7 @@ LIBFDLIBM_CFLAGS := -I$(LIBFDLIBM_SRC)
 ifneq ($(OPENJDK_TARGET_OS), macosx)
   $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM, \
       STATIC_LIBRARY := fdlibm, \
-      OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
+      OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
       SRC := $(LIBFDLIBM_SRC), \
       LANG := C, \
       OPTIMIZATION := $(BUILD_LIBFDLIBM_OPTIMIZATION), \
@@ -49,7 +49,7 @@ ifneq ($(OPENJDK_TARGET_OS), macosx)
       CFLAGS_windows_debug := -DLOGGING, \
       CFLAGS_aix := -qfloat=nomaf, \
       ARFLAGS := $(ARFLAGS), \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libfdlibm, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
 else
@@ -58,15 +58,15 @@ else
   # a plain static library.
   $(eval $(call SetupNativeCompilation,BUILD_LIBFDLIBM_MAC, \
       LIBRARY := fdlibm, \
-      OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs/libfdlibm, \
+      OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
       SRC := $(LIBFDLIBM_SRC), \
       LANG := C, \
       CFLAGS := $(CFLAGS_JDKLIB) $(LIBFDLIBM_CFLAGS), \
       LDFLAGS := -nostdlib -r -arch x86_64, \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libfdlibm, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libfdlibm, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-  BUILD_LIBFDLIBM := $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
+  BUILD_LIBFDLIBM := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/$(LIBRARY_PREFIX)fdlibm$(STATIC_LIBRARY_SUFFIX)
   $(BUILD_LIBFDLIBM): $(BUILD_LIBFDLIBM_MAC)
 	$(call install-file)
 
@@ -107,10 +107,10 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBVERIFY, \
         -D "JDK_INTERNAL_NAME=verify" \
         -D "JDK_FTYPE=0x2L", \
     REORDER := $(BUILD_LIBVERIFY_REORDER), \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libverify, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libverify, \
     DEBUG_SYMBOLS := true))
 
-BASE_LIBRARIES += $(BUILD_LIBVERIFY)
+TARGETS += $(BUILD_LIBVERIFY)
 
 ##########################################################################################
 
@@ -122,7 +122,7 @@ endif
 
 LIBJAVA_CFLAGS := $(addprefix -I, $(LIBJAVA_SRC_DIRS)) \
     -I$(JDK_TOPDIR)/src/java.base/share/native/libfdlibm \
-    -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \
+    -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
     -DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
 
 LIBJAVA_CFLAGS += -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
@@ -164,7 +164,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
     LDFLAGS_SUFFIX_solaris := -lsocket -lnsl -lscf $(LIBDL) $(BUILD_LIBFDLIBM) -lc, \
     LDFLAGS_SUFFIX_linux := $(LIBDL) $(BUILD_LIBFDLIBM), \
     LDFLAGS_SUFFIX_aix := $(LIBDL) $(BUILD_LIBFDLIBM) -lm,\
-    LDFLAGS_SUFFIX_macosx := -L$(JDK_OUTPUTDIR)/objs/ -lfdlibm \
+    LDFLAGS_SUFFIX_macosx := -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/ -lfdlibm \
         -framework CoreFoundation \
         -framework Foundation \
         -framework Security -framework SystemConfiguration, \
@@ -179,10 +179,10 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
         -D "JDK_INTERNAL_NAME=java" \
         -D "JDK_FTYPE=0x2L", \
     REORDER := $(LIBJAVA_REORDER), \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjava, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-BASE_LIBRARIES += $(BUILD_LIBJAVA)
+TARGETS += $(BUILD_LIBJAVA)
 
 $(BUILD_LIBJAVA): $(BUILD_LIBVERIFY)
 
@@ -217,7 +217,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
         $(ZLIB_CPPFLAGS) \
         -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
         -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libjava \
-        -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base, \
+        -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
     CFLAGS_posix := $(BUILD_LIBZIP_MMAP) -UDEBUG, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libzip/mapfile-vers, \
     REORDER := $(BUILD_LIBZIP_REORDER), \
@@ -225,8 +225,9 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
         $(call SET_SHARED_LIBRARY_ORIGIN) \
         $(EXPORT_ZIP_FUNCS), \
     LDFLAGS_windows := -export:ZIP_Open -export:ZIP_Close -export:ZIP_FindEntry \
-        -export:ZIP_ReadEntry -export:ZIP_GetNextEntry -export:ZIP_CRC32 jvm.lib \
-        $(WIN_JAVA_LIB), \
+        -export:ZIP_ReadEntry -export:ZIP_GetNextEntry \
+        -export:ZIP_InflateFully -export:ZIP_CRC32 \
+        jvm.lib $(WIN_JAVA_LIB), \
     LDFLAGS_SUFFIX_linux := -ljvm -ljava $(LIBZ), \
     LDFLAGS_SUFFIX_solaris := -ljvm -ljava $(LIBZ) -lc, \
     LDFLAGS_SUFFIX_aix := -ljvm -ljava $(LIBZ),\
@@ -236,13 +237,13 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBZIP, \
         -D "JDK_FNAME=zip.dll" \
         -D "JDK_INTERNAL_NAME=zip" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libzip, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libzip, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
 
 $(BUILD_LIBZIP): $(BUILD_LIBJAVA)
 
-BASE_LIBRARIES += $(BUILD_LIBZIP)
+TARGETS += $(BUILD_LIBZIP)
 
 ##########################################################################################
 
@@ -363,10 +364,10 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJLI, \
         -D "JDK_FNAME=jli.dll" \
         -D "JDK_INTERNAL_NAME=jli" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-BASE_LIBRARIES += $(BUILD_LIBJLI)
+TARGETS += $(BUILD_LIBJLI)
 
 # On windows, the static library has the same suffix as the import library created by
 # with the shared library, so the static library is given a different name. No harm
@@ -374,18 +375,17 @@ BASE_LIBRARIES += $(BUILD_LIBJLI)
 ifeq ($(OPENJDK_TARGET_OS), windows)
   $(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC, \
       STATIC_LIBRARY := jli_static, \
-      OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
+      OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
       SRC := $(BUILD_LIBJLI_SRC_DIRS), \
       INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
       LANG := C, \
       OPTIMIZATION := HIGH, \
       CFLAGS := $(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS), \
       ARFLAGS := $(ARFLAGS), \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli_static, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-  BUILD_LIBRARIES += $(BUILD_LIBJLI_STATIC)
-  BASE_STATIC_LIBRARIES += $(BUILD_LIBJLI_STATIC)
+  TARGETS += $(BUILD_LIBJLI_STATIC)
 
 else ifeq ($(OPENJDK_TARGET_OS), macosx)
   #
@@ -394,37 +394,35 @@ else ifeq ($(OPENJDK_TARGET_OS), macosx)
   # as this is first time I see it
   $(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC, \
       LIBRARY := jli_static, \
-      OUTPUT_DIR := $(JDK_OUTPUTDIR)/objs, \
+      OUTPUT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE), \
       SRC := $(BUILD_LIBJLI_SRC_DIRS), \
       INCLUDE_FILES := $(BUILD_LIBJLI_FILES), \
       LANG := C, \
       OPTIMIZATION := HIGH, \
       CFLAGS := $(CFLAGS_JDKLIB) $(LIBJLI_CFLAGS), \
       LDFLAGS := -nostdlib -r, \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjli_static, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-  $(JDK_OUTPUTDIR)/objs/libjli_static.a: $(BUILD_LIBJLI_STATIC)
+  $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static.a: $(BUILD_LIBJLI_STATIC)
 	$(call install-file)
 
-  BUILD_LIBRARIES += $(JDK_OUTPUTDIR)/objs/libjli_static.a
-  BASE_STATIC_LIBRARIES += $(JDK_OUTPUTDIR)/objs/libjli_static.a
+  TARGETS += $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static.a
 
 else ifeq ($(OPENJDK_TARGET_OS), aix)
   # AIX also requires a static libjli because the compiler doesn't support '-rpath'
   $(eval $(call SetupNativeCompilation,BUILD_LIBJLI_STATIC,\
       STATIC_LIBRARY:=jli_static,\
-      OUTPUT_DIR:=$(JDK_OUTPUTDIR)/objs,\
+      OUTPUT_DIR:=$(SUPPORT_OUTPUTDIR)/native/$(MODULE),\
       SRC:=$(BUILD_LIBJLI_SRC_DIRS),\
       INCLUDE_FILES:=$(BUILD_LIBJLI_FILES),\
       LANG:=C,\
       OPTIMIZATION:=HIGH, \
       CFLAGS:=$(STATIC_LIBRARY_FLAGS) $(LIBJLI_CFLAGS),\
       ARFLAGS:=$(ARFLAGS),\
-      OBJECT_DIR:=$(JDK_OUTPUTDIR)/objs/libjli_static))
+      OBJECT_DIR:=$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjli_static))
 
-  BUILD_LIBRARIES += $(BUILD_LIBJLI_STATIC)
-  BASE_STATIC_LIBRARIES += $(BUILD_LIBJLI_STATIC)
+  TARGETS += $(BUILD_LIBJLI_STATIC)
 
 endif
 
diff --git a/jdk/make/lib/Lib-java.base.gmk b/jdk/make/lib/Lib-java.base.gmk
index 301e31c2df8..ef5f64aea09 100644
--- a/jdk/make/lib/Lib-java.base.gmk
+++ b/jdk/make/lib/Lib-java.base.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -32,9 +32,3 @@ $(eval $(call FillCacheFind, $(wildcard $(JDK_TOPDIR)/src/java.base/*/native \
 include CoreLibraries.gmk
 include NetworkingLibraries.gmk
 include NioLibraries.gmk
-
-java.base: $(BASE_LIBRARIES) $(BASE_STATIC_LIBRARIES) $(NPT_LIBRARIES)
-
-all: java.base
-
-.PHONY: all java.base
diff --git a/jdk/make/lib/Lib-java.desktop.gmk b/jdk/make/lib/Lib-java.desktop.gmk
index e8661508e93..c8bc8195854 100644
--- a/jdk/make/lib/Lib-java.desktop.gmk
+++ b/jdk/make/lib/Lib-java.desktop.gmk
@@ -32,9 +32,3 @@ $(eval $(call FillCacheFind, $(wildcard $(JDK_TOPDIR)/src/java.desktop/*/native
 include PlatformLibraries.gmk
 include Awt2dLibraries.gmk
 include SoundLibraries.gmk
-
-java.desktop: $(DESKTOP_LIBRARIES)
-
-all: java.desktop
-
-.PHONY: all java.desktop
diff --git a/jdk/make/lib/Lib-java.instrument.gmk b/jdk/make/lib/Lib-java.instrument.gmk
index a54a743af39..eea8645c482 100644
--- a/jdk/make/lib/Lib-java.instrument.gmk
+++ b/jdk/make/lib/Lib-java.instrument.gmk
@@ -32,7 +32,7 @@ LIBINSTRUMENT_SRC := $(JDK_TOPDIR)/src/java.instrument/share/native/libinstrumen
     #
 LIBINSTRUMENT_CFLAGS := $(CFLAGS_JDKLIB) \
     $(addprefix -I, $(LIBINSTRUMENT_SRC)) \
-    -I$(JDK_OUTPUTDIR)/gensrc_headers/java.instrument \
+    -I$(SUPPORT_OUTPUTDIR)/headers/java.instrument \
     -I$(JDK_TOPDIR)/src/java.base/share/native/libjli \
     -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \
     #
@@ -41,7 +41,7 @@ LIBINSTRUMENT_LDFLAGS :=
 LIBINSTRUMENT_LDFLAGS_SUFFIX :=
 
 ifeq ($(OPENJDK_TARGET_OS), windows)
-  LIBINSTRUMENT_LDFLAGS += $(JDK_OUTPUTDIR)/objs/jli_static.lib $(WIN_JAVA_LIB) \
+  LIBINSTRUMENT_LDFLAGS += $(SUPPORT_OUTPUTDIR)/native/java.base/jli_static.lib $(WIN_JAVA_LIB) \
       -export:Agent_OnAttach advapi32.lib
   # Statically link the C runtime so that there are not dependencies on modules
   # not on the search patch when invoked from the Windows system directory
@@ -68,34 +68,28 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT, \
         $(LIBINSTRUMENT_LDFLAGS), \
     LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/jli), \
     LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/jli), \
-    LDFLAGS_macosx := -Xlinker -all_load $(JDK_OUTPUTDIR)/objs/libjli_static.a \
+    LDFLAGS_macosx := -Xlinker -all_load $(SUPPORT_OUTPUTDIR)/native/java.base/libjli_static.a \
         -framework Cocoa -framework Security -framework ApplicationServices, \
     LDFLAGS_SUFFIX := $(LIBINSTRUMENT_LDFLAGS_SUFFIX), \
     LDFLAGS_SUFFIX_macosx := -liconv $(LIBZ), \
-    LDFLAGS_SUFFIX_solaris := $(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL) -lc, \
-    LDFLAGS_SUFFIX_linux := $(LIBZ) -L $(INSTALL_LIBRARIES_HERE)/jli -ljli $(LIBDL), \
-    LDFLAGS_SUFFIX_aix := $(LIBZ) -L$(JDK_OUTPUTDIR)/objs -ljli_static $(LIBDL),\
+    LDFLAGS_SUFFIX_solaris := $(LIBZ) -L $(call FindLibDirForModule, java.base)/jli -ljli $(LIBDL) -lc, \
+    LDFLAGS_SUFFIX_linux := $(LIBZ) -L $(call FindLibDirForModule, java.base)/jli -ljli $(LIBDL), \
+    LDFLAGS_SUFFIX_aix := $(LIBZ) -L$(SUPPORT_OUTPUTDIR)/native/java.base -ljli_static $(LIBDL),\
     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
     RC_FLAGS := $(RC_FLAGS) \
         -D "JDK_FNAME=instrument.dll" \
         -D "JDK_INTERNAL_NAME=instrument" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libinstrument, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libinstrument, \
     DEBUG_SYMBOLS := true))
 
 ifneq (, $(findstring $(OPENJDK_TARGET_OS), macosx windows aix))
-  $(BUILD_LIBINSTRUMENT): $(JDK_OUTPUTDIR)/objs/$(LIBRARY_PREFIX)jli_static$(STATIC_LIBRARY_SUFFIX)
+  $(BUILD_LIBINSTRUMENT): $(SUPPORT_OUTPUTDIR)/native/java.base/$(LIBRARY_PREFIX)jli_static$(STATIC_LIBRARY_SUFFIX)
 else
-  $(BUILD_LIBINSTRUMENT): $(INSTALL_LIBRARIES_HERE)/jli/$(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX)
+  $(BUILD_LIBINSTRUMENT): $(call FindLib, java.base, jli, /jli)
 endif
 $(BUILD_LIBINSTRUMENT): $(BUILD_LIBJAVA)
 
-INSTRUMENT_LIBRARIES += $(BUILD_LIBINSTRUMENT)
+TARGETS += $(BUILD_LIBINSTRUMENT)
 
 ################################################################################
-
-java.instrument: $(INSTRUMENT_LIBRARIES)
-
-all: java.instrument
-
-.PHONY: all java.instrument
diff --git a/jdk/make/lib/Lib-java.management.gmk b/jdk/make/lib/Lib-java.management.gmk
index 2cc7b850621..375b08fb239 100644
--- a/jdk/make/lib/Lib-java.management.gmk
+++ b/jdk/make/lib/Lib-java.management.gmk
@@ -34,7 +34,7 @@ BUILD_LIBMANAGEMENT_SRC += $(JDK_TOPDIR)/src/java.management/share/native/libman
     $(JDK_TOPDIR)/src/java.management/$(OPENJDK_TARGET_OS_API_DIR)/native/libmanagement
 BUILD_LIBMANAGEMENT_CFLAGS := -I$(JDK_TOPDIR)/src/java.management/share/native/include \
     $(addprefix -I,$(BUILD_LIBMANAGEMENT_SRC)) \
-    -I$(JDK_OUTPUTDIR)/gensrc_headers/java.management \
+    -I$(SUPPORT_OUTPUTDIR)/headers/java.management \
     $(LIBJAVA_HEADER_FLAGS) \
     #
 
@@ -82,17 +82,11 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBMANAGEMENT, \
         -D "JDK_FNAME=management.dll" \
         -D "JDK_INTERNAL_NAME=management" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libmanagement, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libmanagement, \
     DEBUG_SYMBOLS := true))
 
-$(BUILD_LIBMANAGEMENT): $(BUILD_LIBJAVA)
+$(BUILD_LIBMANAGEMENT): $(call FindLib, java.base, java)
 
-MANAGEMENT_LIBRARIES += $(BUILD_LIBMANAGEMENT)
+TARGETS += $(BUILD_LIBMANAGEMENT)
 
 ################################################################################
-
-java.management: $(MANAGEMENT_LIBRARIES)
-
-all: java.management
-
-.PHONY: all java.management
diff --git a/jdk/make/lib/Lib-java.prefs.gmk b/jdk/make/lib/Lib-java.prefs.gmk
index c034b190f41..9bfafafa96d 100644
--- a/jdk/make/lib/Lib-java.prefs.gmk
+++ b/jdk/make/lib/Lib-java.prefs.gmk
@@ -54,17 +54,11 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBPREFS, \
         -D "JDK_FNAME=prefs.dll" \
         -D "JDK_INTERNAL_NAME=prefs" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libprefs, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libprefs, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-$(BUILD_LIBPREFS): $(BUILD_LIBJAVA)
+$(BUILD_LIBPREFS): $(call FindLib, java.base, java)
 
-PREFS_LIBRARIES += $(BUILD_LIBPREFS)
+TARGETS += $(BUILD_LIBPREFS)
 
 ################################################################################
-
-java.prefs: $(PREFS_LIBRARIES)
-
-all: java.prefs
-
-.PHONY: all java.prefs
diff --git a/jdk/make/lib/Lib-java.security.jgss.gmk b/jdk/make/lib/Lib-java.security.jgss.gmk
index d6f986628ae..3eed76a22a1 100644
--- a/jdk/make/lib/Lib-java.security.jgss.gmk
+++ b/jdk/make/lib/Lib-java.security.jgss.gmk
@@ -40,16 +40,16 @@ ifneq ($(OPENJDK_TARGET_OS), windows)
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2GSS_SRC)) \
           $(LIBJAVA_HEADER_FLAGS) \
-          -I$(JDK_OUTPUTDIR)/gensrc_headers/java.security.jgss, \
+          -I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2gss/mapfile-vers, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_SUFFIX := $(LIBDL), \
       LDFLAGS_SUFFIX_solaris := -lc, \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2gss, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2gss, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-  SECURITY_KERBEROS_LIBRARIES += $(BUILD_LIBJ2GSS)
+  TARGETS += $(BUILD_LIBJ2GSS)
 endif
 
 ################################################################################
@@ -81,7 +81,7 @@ ifneq ($(BUILD_CRYPTO), no)
         OPTIMIZATION := LOW, \
         CFLAGS := $(CFLAGS_JDKLIB) \
             $(addprefix -I, $(BUILD_LIBKRB5_SRC)) \
-            -I$(JDK_OUTPUTDIR)/gensrc_headers/java.security.jgss, \
+            -I$(SUPPORT_OUTPUTDIR)/headers/java.security.jgss, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
         LDFLAGS_SUFFIX := $(BUILD_LIBKRB5_LIBS), \
@@ -90,17 +90,11 @@ ifneq ($(BUILD_CRYPTO), no)
             -D "JDK_FNAME=$(BUILD_LIBKRB5_NAME).dll" \
             -D "JDK_INTERNAL_NAME=$(BUILD_LIBKRB5_NAME)" \
             -D "JDK_FTYPE=0x2L", \
-        OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libkrb5, \
+        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libkrb5, \
         DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-    SECURITY_KERBEROS_LIBRARIES += $(BUILD_LIBKRB5)
+    TARGETS += $(BUILD_LIBKRB5)
   endif
 endif
 
 ################################################################################
-
-java.security.jgss: $(SECURITY_KERBEROS_LIBRARIES)
-
-all: java.security.jgss
-
-.PHONY: all java.security.jgss
diff --git a/jdk/make/lib/Lib-java.smartcardio.gmk b/jdk/make/lib/Lib-java.smartcardio.gmk
index 7b7be4510b7..1f763322995 100644
--- a/jdk/make/lib/Lib-java.smartcardio.gmk
+++ b/jdk/make/lib/Lib-java.smartcardio.gmk
@@ -31,7 +31,7 @@ LIBJ2PCSC_SRC := $(JDK_TOPDIR)/src/java.smartcardio/share/native/libj2pcsc \
     $(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2pcsc
 LIBJ2PCSC_CPPFLAGS := $(addprefix -I,$(LIBJ2PCSC_SRC)) \
     -I$(JDK_TOPDIR)/src/java.smartcardio/$(OPENJDK_TARGET_OS_API_DIR)/native/libj2pcsc/MUSCLE \
-    -I$(JDK_OUTPUTDIR)/gensrc_headers/java.smartcardio
+    -I$(SUPPORT_OUTPUTDIR)/headers/java.smartcardio
 
 $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC, \
     LIBRARY := j2pcsc, \
@@ -52,15 +52,9 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PCSC, \
         -D "JDK_FNAME=j2pcsc.dll" \
         -D "JDK_INTERNAL_NAME=j2pcsc" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2pcsc, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2pcsc, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-SECURITY_SMARTCARDIO_LIBRARIES += $(BUILD_LIBJ2PCSC)
+TARGETS += $(BUILD_LIBJ2PCSC)
 
 ################################################################################
-
-java.smartcardio: $(SECURITY_SMARTCARDIO_LIBRARIES)
-
-all: java.smartcardio
-
-.PHONY: all java.smartcardio
diff --git a/jdk/make/lib/Lib-jdk.attach.gmk b/jdk/make/lib/Lib-jdk.attach.gmk
index 2b58e173efb..046bd2ea946 100644
--- a/jdk/make/lib/Lib-jdk.attach.gmk
+++ b/jdk/make/lib/Lib-jdk.attach.gmk
@@ -35,7 +35,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBATTACH, \
     LANG := C, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
-        -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.attach \
+        -I$(SUPPORT_OUTPUTDIR)/headers/jdk.attach \
         $(LIBJAVA_HEADER_FLAGS), \
     CFLAGS_windows := /Gy, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libattach/mapfile-$(OPENJDK_TARGET_OS), \
@@ -50,17 +50,11 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBATTACH, \
     LDFLAGS_windows := /ORDER:@$(JDK_TOPDIR)/make/mapfiles/libattach/reorder-windows-$(OPENJDK_TARGET_CPU), \
     LDFLAGS_SUFFIX := $(LDFLAGS_JDKLIB_SUFFIX), \
     LDFLAGS_SUFFIX_windows := $(WIN_JAVA_LIB) advapi32.lib psapi.lib, \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libattach, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libattach, \
     DEBUG_SYMBOLS := true))
 
-$(BUILD_LIBATTACH): $(BUILD_LIBJAVA)
+$(BUILD_LIBATTACH): $(call FindLib, java.base, java)
 
-ATTACH_LIBRARIES += $(BUILD_LIBATTACH)
+TARGETS += $(BUILD_LIBATTACH)
 
 ################################################################################
-
-jdk.attach: $(ATTACH_LIBRARIES)
-
-all: jdk.attach
-
-.PHONY: all jdk.attach
diff --git a/jdk/make/lib/Lib-jdk.crypto.ec.gmk b/jdk/make/lib/Lib-jdk.crypto.ec.gmk
index 94267bf0d2a..db75429ab6a 100644
--- a/jdk/make/lib/Lib-jdk.crypto.ec.gmk
+++ b/jdk/make/lib/Lib-jdk.crypto.ec.gmk
@@ -65,16 +65,10 @@ ifeq ($(ENABLE_INTREE_EC), yes)
           -D "JDK_FNAME=sunec.dll" \
           -D "JDK_INTERNAL_NAME=sunec" \
           -D "JDK_FTYPE=0x2L", \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsunec, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsunec, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-  SECURITY_SUNEC_LIBRARIES += $(BUILD_LIBSUNEC)
+  TARGETS += $(BUILD_LIBSUNEC)
 endif
 
 ################################################################################
-
-jdk.crypto.ec: $(SECURITY_SUNEC_LIBRARIES)
-
-all: jdk.crypto.ec
-
-.PHONY: all jdk.crypto.ec
diff --git a/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk b/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk
index a1e5fc0b15e..55d5f06dfa4 100644
--- a/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk
+++ b/jdk/make/lib/Lib-jdk.crypto.mscapi.gmk
@@ -47,16 +47,10 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
           -D "JDK_FNAME=sunmscapi.dll" \
           -D "JDK_INTERNAL_NAME=sunmscapi" \
           -D "JDK_FTYPE=0x2L", \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsunmscapi, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsunmscapi, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-  SECURITY_MSCAPI_LIBRARIES += $(BUILD_LIBSUNMSCAPI)
+  TARGETS += $(BUILD_LIBSUNMSCAPI)
 endif
 
 ################################################################################
-
-jdk.crypto.mscapi: $(SECURITY_MSCAPI_LIBRARIES)
-
-all: jdk.crypto.mscapi
-
-.PHONY: all jdk.crypto.mscapi
diff --git a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk
index fd35a9d5f9b..0ee2840d65e 100644
--- a/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk
+++ b/jdk/make/lib/Lib-jdk.crypto.pkcs11.gmk
@@ -38,7 +38,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(addprefix -I, $(LIBJ2PKCS11_SRC)) \
         $(LIBJAVA_HEADER_FLAGS) \
-        -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.crypto.pkcs11, \
+        -I$(SUPPORT_OUTPUTDIR)/headers/jdk.crypto.pkcs11, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libj2pkcs11/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -49,15 +49,9 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJ2PKCS11, \
         -D "JDK_FNAME=j2pkcs11.dll" \
         -D "JDK_INTERNAL_NAME=j2pkcs11" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libj2pkcs11, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libj2pkcs11, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-SECURITY_PKCS11_LIBRARIES += $(BUILD_LIBJ2PKCS11)
+TARGETS += $(BUILD_LIBJ2PKCS11)
 
 ################################################################################
-
-jdk.crypto.pkcs11: $(SECURITY_PKCS11_LIBRARIES)
-
-all: jdk.crypto.pkcs11
-
-.PHONY: all jdk.crypto.pkcs11
diff --git a/jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk b/jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk
index d032dab08bc..f66bd4554f9 100644
--- a/jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk
+++ b/jdk/make/lib/Lib-jdk.crypto.ucrypto.gmk
@@ -23,8 +23,7 @@
 # questions.
 #
 
-include $(SPEC)
-include $(JDK_TOPDIR)/make/lib/LibCommon.gmk
+include LibCommon.gmk
 
 ################################################################################
 
@@ -49,14 +48,8 @@ ifeq ($(OPENJDK_TARGET_OS), solaris)
 
   $(BUILD_LIBJ2UCRYPTO): $(BUILD_LIBJAVA)
 
-  SECURITY_UCRYPTO_LIBRARIES += $(BUILD_LIBJ2UCRYPTO)
+  TARGETS += $(BUILD_LIBJ2UCRYPTO)
 
 endif
 
 ################################################################################
-
-jdk.crypto.ucrypto: $(SECURITY_UCRYPTO_LIBRARIES)
-
-all: jdk.crypto.ucrypto
-
-.PHONY: all jdk.crypto.ucrypto
diff --git a/jdk/make/lib/Lib-jdk.deploy.osx.gmk b/jdk/make/lib/Lib-jdk.deploy.osx.gmk
index 3b209bf8101..628c17fbced 100644
--- a/jdk/make/lib/Lib-jdk.deploy.osx.gmk
+++ b/jdk/make/lib/Lib-jdk.deploy.osx.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -39,19 +39,19 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           -I$(LIBAPPLESCRIPTENGINE_SRC) \
-          -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.deploy.osx, \
+          -I$(SUPPORT_OUTPUTDIR)/headers/jdk.deploy.osx, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_SUFFIX := -framework Cocoa \
           -framework Carbon \
           -framework JavaNativeFoundation \
           $(LDFLAGS_JDKLIB_SUFFIX), \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libAppleScriptEngine, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libAppleScriptEngine, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-  $(BUILD_LIBAPPLESCRIPTENGINE): $(BUILD_LIBJAVA)
+  $(BUILD_LIBAPPLESCRIPTENGINE): $(call FindLib, java.base, java)
 
-  DEPLOY_OSX_LIBRARIES += $(BUILD_LIBAPPLESCRIPTENGINE)
+  TARGETS += $(BUILD_LIBAPPLESCRIPTENGINE)
 
   ################################################################################
 
@@ -59,8 +59,8 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
   LIBOSX_CFLAGS := -I$(LIBOSX_DIRS) \
       -I$(JDK_TOPDIR)/src/java.desktop/macosx/native/libosxapp \
       $(LIBJAVA_HEADER_FLAGS) \
-      -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
-      -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.deploy.osx \
+      -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
+      -I$(SUPPORT_OUTPUTDIR)/headers/jdk.deploy.osx \
       #
 
   $(eval $(call SetupNativeCompilation,BUILD_LIBOSX, \
@@ -72,6 +72,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(LIBOSX_CFLAGS), \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
+          -L$(SUPPORT_OUTPUTDIR)/modules_libs/java.desktop \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_SUFFIX_macosx := \
           -losxapp \
@@ -82,21 +83,15 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
           -framework Security \
           -framework SystemConfiguration \
           $(LDFLAGS_JDKLIB_SUFFIX), \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libosx, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosx, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-  DEPLOY_OSX_LIBRARIES += $(BUILD_LIBOSX)
+  TARGETS += $(BUILD_LIBOSX)
 
-  $(BUILD_LIBOSX): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)osxapp$(SHARED_LIBRARY_SUFFIX)
+  $(BUILD_LIBOSX): $(call FindLib, java.desktop, osxapp)
 
-  $(BUILD_LIBOSX): $(BUILD_LIBJAVA)
+  $(BUILD_LIBOSX): $(call FindLib, java.base, java)
 
   ################################################################################
 
 endif
-
-jdk.deploy.osx: $(DEPLOY_OSX_LIBRARIES)
-
-all: jdk.deploy.osx
-
-.PHONY: all jdk.deploy.osx
diff --git a/jdk/make/lib/Lib-jdk.hprof.agent.gmk b/jdk/make/lib/Lib-jdk.hprof.agent.gmk
index a58687da251..040abc35680 100644
--- a/jdk/make/lib/Lib-jdk.hprof.agent.gmk
+++ b/jdk/make/lib/Lib-jdk.hprof.agent.gmk
@@ -62,10 +62,10 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBHPROF, \
         -D "JDK_FNAME=hprof.dll" \
         -D "JDK_INTERNAL_NAME=hprof" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libhprof_jvmti, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libhprof_jvmti, \
     DEBUG_SYMBOLS := true))
 
-HPROF_LIBRARIES += $(BUILD_LIBHPROF)
+TARGETS += $(BUILD_LIBHPROF)
 
 ################################################################################
 
@@ -88,15 +88,9 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA_CRW_DEMO, \
         -D "JDK_FNAME=java_crw_demo.dll" \
         -D "JDK_INTERNAL_NAME=java_crw_demo" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjava_crw_demo, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjava_crw_demo, \
     DEBUG_SYMBOLS := true))
 
-CRW_LIBRARIES += $(BUILD_LIBJAVA_CRW_DEMO)
+TARGETS += $(BUILD_LIBJAVA_CRW_DEMO)
 
 ################################################################################
-
-jdk.hprof.agent: $(HPROF_LIBRARIES) $(CRW_LIBRARIES)
-
-all: jdk.hprof.agent
-
-.PHONY: all jdk.hprof.agent
diff --git a/jdk/make/lib/Lib-jdk.jdi.gmk b/jdk/make/lib/Lib-jdk.jdi.gmk
index 8dc731bbf6c..e18b6ce8b35 100644
--- a/jdk/make/lib/Lib-jdk.jdi.gmk
+++ b/jdk/make/lib/Lib-jdk.jdi.gmk
@@ -36,7 +36,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
       $(addprefix -I, $(LIBDT_SHMEM_SRC)) \
       -I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/libjdwp/export \
       -I$(JDK_TOPDIR)/src/jdk.jdwp.agent/share/native/include \
-      -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.jdi \
+      -I$(SUPPORT_OUTPUTDIR)/headers/jdk.jdi \
       #
 
   $(eval $(call SetupNativeCompilation,BUILD_LIBDT_SHMEM, \
@@ -55,17 +55,11 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
           -D "JDK_FNAME=dt_shmem.dll" \
           -D "JDK_INTERNAL_NAME=dt_shmem" \
           -D "JDK_FTYPE=0x2L", \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libdt_shmem, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libdt_shmem, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-  JDI_TRANSPORT_LIBRARIES += $(BUILD_LIBDT_SHMEM)
+  TARGETS += $(BUILD_LIBDT_SHMEM)
 
 endif # OPENJDK_TARGET_OS
 
 ################################################################################
-
-jdk.jdi: $(JDI_TRANSPORT_LIBRARIES)
-
-all: jdk.jdi
-
-.PHONY: all jdk.jdi
diff --git a/jdk/make/lib/Lib-jdk.jdwp.agent.gmk b/jdk/make/lib/Lib-jdk.jdwp.agent.gmk
index 7b13248a9be..4e4c44fb699 100644
--- a/jdk/make/lib/Lib-jdk.jdwp.agent.gmk
+++ b/jdk/make/lib/Lib-jdk.jdwp.agent.gmk
@@ -55,13 +55,13 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBDT_SOCKET, \
         -D "JDK_FNAME=dt_socket.dll" \
         -D "JDK_INTERNAL_NAME=dt_socket" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libdt_socket, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libdt_socket, \
     DEBUG_SYMBOLS := true))
 
-$(BUILD_LIBDT_SOCKET): $(BUILD_LIBJAVA)
+$(BUILD_LIBDT_SOCKET): $(call FindLib, java.base, java)
 
 # Include socket transport with JDWP agent to allow for remote debugging
-JDWP_LIBRARIES += $(BUILD_LIBDT_SOCKET)
+TARGETS += $(BUILD_LIBDT_SOCKET)
 
 ################################################################################
 
@@ -81,7 +81,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJDWP, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) -DJDWP_LOGGING \
         $(LIBJDWP_CPPFLAGS) \
-        -I$(JDK_OUTPUTDIR)/gensrc_jdwp_headers, \
+        -I$(SUPPORT_OUTPUTDIR)/headers/jdk.jdwp.agent, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjdwp/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -94,17 +94,11 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJDWP, \
         -D "JDK_FNAME=jdwp.dll" \
         -D "JDK_INTERNAL_NAME=jdwp" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjdwp, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjdwp, \
     DEBUG_SYMBOLS := true))
 
-$(BUILD_LIBJDWP): $(BUILD_LIBJAVA)
+$(BUILD_LIBJDWP): $(call FindLib, java.base, java)
 
-JDWP_LIBRARIES += $(BUILD_LIBJDWP)
+TARGETS += $(BUILD_LIBJDWP)
 
 ################################################################################
-
-jdk.jdwp.agent: $(JDWP_LIBRARIES)
-
-all: jdk.jdwp.agent
-
-.PHONY: all jdk.jdwp.agent
diff --git a/jdk/make/lib/Lib-jdk.runtime.gmk b/jdk/make/lib/Lib-jdk.runtime.gmk
index 3ffaa72570a..fd68223185e 100644
--- a/jdk/make/lib/Lib-jdk.runtime.gmk
+++ b/jdk/make/lib/Lib-jdk.runtime.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -36,17 +36,17 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \
     OPTIMIZATION := LOW, \
     CFLAGS := $(CXXFLAGS_JDKLIB) \
         -DNO_ZLIB -DUNPACK_JNI -DFULL \
-        -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \
+        -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
         -I$(JDK_TOPDIR)/src/jdk.runtime/share/native/common-unpack \
         $(LIBJAVA_HEADER_FLAGS), \
     CFLAGS_release := -DPRODUCT, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libunpack/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) $(LDFLAGS_CXX_JDK) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
-    LDFLAGS_windows := -map:$(JDK_OUTPUTDIR)/objs/unpack.map -debug \
+    LDFLAGS_windows := -map:$(SUPPORT_OUTPUTDIR)/native/$(MODULE)/unpack.map -debug \
         jvm.lib $(WIN_JAVA_LIB), \
     LDFLAGS_SUFFIX_posix := -ljvm $(LIBCXX) -ljava -lc, \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libunpack, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libunpack, \
     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
     RC_FLAGS := $(RC_FLAGS) \
         -D "JDK_FNAME=unpack.dll" \
@@ -54,9 +54,9 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBUNPACK, \
         -D "JDK_FTYPE=0x2L", \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-$(BUILD_LIBUNPACK): $(BUILD_LIBJAVA)
+$(BUILD_LIBUNPACK): $(call FindLib, java.base, java)
 
-UNPACK_LIBRARIES += $(BUILD_LIBUNPACK)
+TARGETS += $(BUILD_LIBUNPACK)
 
 ################################################################################
 
@@ -72,7 +72,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSDT, \
     CFLAGS := $(CFLAGS_JDKLIB) $(CFLAGS_WARNINGS_ARE_ERRORS) \
         $(addprefix -I, $(LIBJSDT_SRC)) \
         $(LIBJAVA_HEADER_FLAGS) \
-        -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.runtime, \
+        -I$(SUPPORT_OUTPUTDIR)/headers/jdk.runtime, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjsdt/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -85,17 +85,11 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSDT, \
         -D "JDK_FNAME=jsdt.dll" \
         -D "JDK_INTERNAL_NAME=jsdt" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsdt, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsdt, \
     DEBUG_SYMBOLS := true))
 
-$(BUILD_LIBJSDT): $(BUILD_LIBJAVA)
+$(BUILD_LIBJSDT): $(call FindLib, java.base, java)
 
-JSDT_LIBRARIES += $(BUILD_LIBJSDT)
+TARGETS += $(BUILD_LIBJSDT)
 
 ################################################################################
-
-jdk.runtime: $(JSDT_LIBRARIES) $(UNPACK_LIBRARIES)
-
-all: jdk.runtime
-
-.PHONY: all jdk.runtime
diff --git a/jdk/make/lib/Lib-jdk.sctp.gmk b/jdk/make/lib/Lib-jdk.sctp.gmk
index 7afd0020be7..bbd211a854f 100644
--- a/jdk/make/lib/Lib-jdk.sctp.gmk
+++ b/jdk/make/lib/Lib-jdk.sctp.gmk
@@ -48,8 +48,8 @@ ifeq ($(OPENJDK_TARGET_OS_API), posix)
             -I $(JDK_TOPDIR)/src/java.base/share/native/libnio/ch \
             $(addprefix -I, $(call FindSrcDirsForLib, java.base, net)) \
             $(LIBJAVA_HEADER_FLAGS) \
-            -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.sctp \
-            -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base, \
+            -I$(SUPPORT_OUTPUTDIR)/headers/jdk.sctp \
+            -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \
         CFLAGS_linux := $(SCTP_WERROR), \
         MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libsctp/mapfile-vers, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
@@ -58,19 +58,13 @@ ifeq ($(OPENJDK_TARGET_OS_API), posix)
         LDFLAGS_SUFFIX_posix := -lnio -lnet, \
         LDFLAGS_SUFFIX_solaris := -lsocket -ljava -ljvm -lc, \
         LDFLAGS_SUFFIX_macosx := -ljava -ljvm, \
-        OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libsctp, \
+        OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libsctp, \
         DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-    SCTP_LIBRARIES += $(BUILD_LIBSCTP)
+    TARGETS += $(BUILD_LIBSCTP)
 
-    $(BUILD_LIBSCTP): $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)nio$(SHARED_LIBRARY_SUFFIX)
+    $(BUILD_LIBSCTP): $(call FindLib, java.base, nio)
   endif
 endif
 
 ################################################################################
-
-jdk.sctp: $(SCTP_LIBRARIES)
-
-all: jdk.sctp
-
-.PHONY: all jdk.sctp
diff --git a/jdk/make/lib/Lib-jdk.security.auth.gmk b/jdk/make/lib/Lib-jdk.security.auth.gmk
index 52151773886..21b0c81b18e 100644
--- a/jdk/make/lib/Lib-jdk.security.auth.gmk
+++ b/jdk/make/lib/Lib-jdk.security.auth.gmk
@@ -46,7 +46,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAAS, \
     SRC := $(JDK_TOPDIR)/src/jdk.security.auth/$(OPENJDK_TARGET_OS_API_DIR)/native/libjaas, \
     LANG := C, \
     OPTIMIZATION := LOW, \
-    CFLAGS := $(CFLAGS_JDKLIB) -I$(JDK_OUTPUTDIR)/gensrc_headers/jdk.security.auth, \
+    CFLAGS := $(CFLAGS_JDKLIB) -I$(SUPPORT_OUTPUTDIR)/headers/jdk.security.auth, \
     MAPFILE := $(LIBJAAS_MAPFILE), \
     LDFLAGS := $(filter-out -ljava, $(LDFLAGS_JDKLIB)) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
@@ -59,17 +59,11 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAAS, \
         -D "JDK_FNAME=$(LIBJAAS_NAME).dll" \
         -D "JDK_INTERNAL_NAME=$(LIBJAAS_NAME)" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjaas, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjaas, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-$(BUILD_LIBJAAS): $(BUILD_LIBJAVA)
+$(BUILD_LIBJAAS): $(call FindLib, java.base, java)
 
-SECURITY_JAAS_LIBRARIES += $(BUILD_LIBJAAS)
+TARGETS += $(BUILD_LIBJAAS)
 
 ################################################################################
-
-jdk.security.auth: $(SECURITY_JAAS_LIBRARIES)
-
-all: jdk.security.auth
-
-.PHONY: all jdk.security.auth
diff --git a/jdk/make/lib/LibCommon.gmk b/jdk/make/lib/LibCommon.gmk
index 885ba11c780..c257f0831dc 100644
--- a/jdk/make/lib/LibCommon.gmk
+++ b/jdk/make/lib/LibCommon.gmk
@@ -23,8 +23,6 @@
 # questions.
 #
 
-default: all
-
 include $(SPEC)
 include MakeBase.gmk
 include NativeCompilation.gmk
@@ -34,16 +32,9 @@ include Tools.gmk
 
 GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
 
-# Put the libraries here. Different locations for different target apis.
-ifeq ($(OPENJDK_TARGET_OS_API), posix)
-  INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/lib$(OPENJDK_TARGET_CPU_LIBDIR)
-else
-  INSTALL_LIBRARIES_HERE := $(JDK_OUTPUTDIR)/bin
-endif
-
 # Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
 # elegant solution to this.
-WIN_JAVA_LIB := $(JDK_OUTPUTDIR)/objs/libjava/java.lib
+WIN_JAVA_LIB := $(SUPPORT_OUTPUTDIR)/native/java.base/libjava/java.lib
 
 # Use this variable to set DEBUG_SYMBOLS true on windows for all libraries, but
 # not on other platforms.
@@ -57,24 +48,45 @@ ifdef OPENJDK
 endif
 
 ################################################################################
-
 # Find the default set of src dirs for a native library.
 # Param 1 - module name
 # Param 2 - library name
-FindSrcDirsForLib = $(call uniq, $(wildcard \
-    $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
-    $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_API_DIR)/native/lib$(strip $2) \
-    $(JDK_TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
+define FindSrcDirsForLib 
+  $(call uniq, $(wildcard \
+      $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS)/native/lib$(strip $2) \
+      $(JDK_TOPDIR)/src/$(strip $1)/$(OPENJDK_TARGET_OS_API_DIR)/native/lib$(strip $2) \
+      $(JDK_TOPDIR)/src/$(strip $1)/share/native/lib$(strip $2)))
+endef
 
 ################################################################################
+# Find lib dir for module
+# Param 1 - module name
+ifeq ($(OPENJDK_TARGET_OS_API), posix)
+  define FindLibDirForModule
+    $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)$(OPENJDK_TARGET_CPU_LIBDIR)
+  endef
+else
+  define FindLibDirForModule
+    $(SUPPORT_OUTPUTDIR)/modules_libs/$(strip $1)
+  endef
+endif
 
-# A lot of libraries are dependent on libjava. Define the name of that
-# library here to make dependency declarations to it possible in other files.
-BUILD_LIBJAVA := $(INSTALL_LIBRARIES_HERE)/$(LIBRARY_PREFIX)java$(SHARED_LIBRARY_SUFFIX)
+################################################################################
+# Find a library
+# Param 1 - module name
+# Param 2 - library name
+# Param 3 - subdir for library
+define FindLib
+  $(call FindLibDirForModule, $(strip $1))$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(SHARED_LIBRARY_SUFFIX)
+endef
 
-# Also define the header include flags needed to compile against it.
+################################################################################
+# Define the header include flags needed to compile against it.
 LIBJAVA_HEADER_FLAGS := $(addprefix -I, $(call FindSrcDirsForLib, java.base, java))
 
+# Put the libraries here.
+INSTALL_LIBRARIES_HERE := $(call FindLibDirForModule, $(MODULE))
+
 ################################################################################
 
 # Define it here since there are multiple uses.
diff --git a/jdk/make/lib/NetworkingLibraries.gmk b/jdk/make/lib/NetworkingLibraries.gmk
index a0825b06ce2..a52d77cdd5b 100644
--- a/jdk/make/lib/NetworkingLibraries.gmk
+++ b/jdk/make/lib/NetworkingLibraries.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -25,7 +25,7 @@
 
 LIBNET_SRC_DIRS := $(JDK_TOPDIR)/src/java.base/share/native/libnet \
     $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_API_DIR)/native/libnet
-LIBNET_CFLAGS += -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \
+LIBNET_CFLAGS += -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
     $(LIBJAVA_HEADER_FLAGS)
 
 LIBNET_CFLAGS += $(foreach dir, $(LIBNET_SRC_DIRS), -I$(dir))
@@ -71,10 +71,10 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNET, \
         -D "JDK_FNAME=net.dll" \
         -D "JDK_INTERNAL_NAME=net" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libnet, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBNET): $(BUILD_LIBJAVA)
 
-BASE_LIBRARIES += $(BUILD_LIBNET)
+TARGETS += $(BUILD_LIBNET)
 
diff --git a/jdk/make/lib/NioLibraries.gmk b/jdk/make/lib/NioLibraries.gmk
index 722115fdee5..946c964baf5 100644
--- a/jdk/make/lib/NioLibraries.gmk
+++ b/jdk/make/lib/NioLibraries.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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 @@ BUILD_LIBNIO_SRC := \
 
 BUILD_LIBNIO_CFLAGS := \
     $(addprefix -I, $(BUILD_LIBNIO_SRC)) \
-    -I$(JDK_OUTPUTDIR)/gensrc_headers/java.base \
+    -I$(SUPPORT_OUTPUTDIR)/headers/java.base \
     $(LIBJAVA_HEADER_FLAGS) \
     $(addprefix -I, $(BUILD_LIBNET_SRC))
 
@@ -78,7 +78,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNIO, \
     LDFLAGS_SUFFIX_solaris := -ljvm -lsocket -lposix4 $(LIBDL) \
         -lsendfile -ljava -lnet -lc, \
     LDFLAGS_SUFFIX_windows := jvm.lib ws2_32.lib $(WIN_JAVA_LIB) \
-        $(JDK_OUTPUTDIR)/objs/libnet/net.lib \
+        $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnet/net.lib \
         advapi32.lib, \
     LDFLAGS_SUFFIX_macosx := -ljava -lnet -pthread -framework CoreFoundation, \
     LDFLAGS_SUFFIX :=, \
@@ -87,10 +87,10 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBNIO, \
         -D "JDK_FNAME=nio.dll" \
         -D "JDK_INTERNAL_NAME=nio" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libnio, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libnio, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-BASE_LIBRARIES += $(BUILD_LIBNIO)
+TARGETS += $(BUILD_LIBNIO)
 
 $(BUILD_LIBNIO): $(BUILD_LIBNET)
 
diff --git a/jdk/make/lib/PlatformLibraries.gmk b/jdk/make/lib/PlatformLibraries.gmk
index b9135df0acb..14592213e40 100644
--- a/jdk/make/lib/PlatformLibraries.gmk
+++ b/jdk/make/lib/PlatformLibraries.gmk
@@ -23,7 +23,7 @@
 # questions.
 #
 
-##########################################################################################
+################################################################################
 
 ifeq ($(OPENJDK_TARGET_OS), macosx)
 
@@ -37,7 +37,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
       OPTIMIZATION := LOW, \
       CFLAGS := $(CFLAGS_JDKLIB) \
           $(addprefix -I, $(LIBOSXAPP_SRC)) \
-          -I$(JDK_OUTPUTDIR)/gensrc_headers_icons, \
+          -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_SUFFIX_macosx := \
@@ -53,10 +53,10 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
           -framework OpenGL \
           -framework IOSurface \
           -framework QuartzCore, \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libosxapp, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libosxapp, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
-  DESKTOP_LIBRARIES += $(BUILD_LIBOSXAPP)
+  TARGETS += $(BUILD_LIBOSXAPP)
 
 endif
 
diff --git a/jdk/make/lib/SoundLibraries.gmk b/jdk/make/lib/SoundLibraries.gmk
index 6348f7a7d7b..eb68a148b56 100644
--- a/jdk/make/lib/SoundLibraries.gmk
+++ b/jdk/make/lib/SoundLibraries.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -28,7 +28,7 @@ LIBJSOUND_SRC_DIRS := \
     $(JDK_TOPDIR)/src/java.desktop/$(OPENJDK_TARGET_OS_API_DIR)/native/libjsound \
     #
 LIBJSOUND_CFLAGS := \
-    -I$(JDK_OUTPUTDIR)/gensrc_headers/java.desktop \
+    -I$(SUPPORT_OUTPUTDIR)/headers/java.desktop \
     $(LIBJAVA_HEADER_FLAGS) \
     $(foreach dir, $(LIBJSOUND_SRC_DIRS), -I$(dir)) \
     #
@@ -172,12 +172,12 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJSOUND, \
         -D "JDK_FNAME=jsound.dll" \
         -D "JDK_INTERNAL_NAME=jsound" \
         -D "JDK_FTYPE=0x2L", \
-    OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsound, \
+    OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsound, \
     DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
 $(BUILD_LIBJSOUND): $(BUILD_LIBJAVA)
 
-DESKTOP_LIBRARIES += $(BUILD_LIBJSOUND)
+TARGETS += $(BUILD_LIBJSOUND)
 
 ##########################################################################################
 
@@ -208,12 +208,12 @@ ifneq ($(filter jsoundalsa, $(EXTRA_SOUND_JNI_LIBS)), )
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
       LDFLAGS_SUFFIX := $(ALSA_LIBS) -ljava -ljvm, \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsoundalsa, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundalsa, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
   $(BUILD_LIBJSOUNDALSA): $(BUILD_LIBJAVA)
 
-  DESKTOP_LIBRARIES += $(BUILD_LIBJSOUNDALSA)
+  TARGETS += $(BUILD_LIBJSOUNDALSA)
 
 endif
 
@@ -240,11 +240,11 @@ ifneq ($(filter jsoundds, $(EXTRA_SOUND_JNI_LIBS)), )
           -D "JDK_FNAME=jsoundds.dll" \
           -D "JDK_INTERNAL_NAME=jsoundds" \
           -D "JDK_FTYPE=0x2L", \
-      OBJECT_DIR := $(JDK_OUTPUTDIR)/objs/libjsoundds, \
+      OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjsoundds, \
       DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES)))
 
   $(BUILD_LIBJSOUNDDS): $(BUILD_LIBJAVA)
 
-  DESKTOP_LIBRARIES += $(BUILD_LIBJSOUNDDS)
+  TARGETS += $(BUILD_LIBJSOUNDDS)
 
 endif
diff --git a/jdk/make/mapfiles/libjava/mapfile-vers b/jdk/make/mapfiles/libjava/mapfile-vers
index 08466af08f3..a91eb85fe9d 100644
--- a/jdk/make/mapfiles/libjava/mapfile-vers
+++ b/jdk/make/mapfiles/libjava/mapfile-vers
@@ -274,6 +274,9 @@ SUNWprivate_1.1 {
                 Java_sun_misc_VM_initialize;
 		Java_sun_misc_VMSupport_initAgentProperties;
 		Java_sun_misc_VMSupport_getVMTemporaryDirectory;
+
+                Java_jdk_internal_jimage_concurrent_ConcurrentPReader_initIDs;
+                Java_jdk_internal_jimage_concurrent_ConcurrentPReader_pread;
 		
                 # ZipFile.c needs this one
 		throwFileNotFoundException;
diff --git a/jdk/make/mapfiles/libzip/mapfile-vers b/jdk/make/mapfiles/libzip/mapfile-vers
index a44f8d90214..ad1682ff88f 100644
--- a/jdk/make/mapfiles/libzip/mapfile-vers
+++ b/jdk/make/mapfiles/libzip/mapfile-vers
@@ -72,6 +72,7 @@ SUNWprivate_1.1 {
 		ZIP_FindEntry;
 		ZIP_GetEntry;
 		ZIP_GetNextEntry;
+	        ZIP_InflateFully;
 		ZIP_Lock;
 		ZIP_Open;
 		ZIP_Read;
diff --git a/jdk/make/profile-includes.txt b/jdk/make/profile-includes.txt
deleted file mode 100644
index 226b1ed9eb0..00000000000
--- a/jdk/make/profile-includes.txt
+++ /dev/null
@@ -1,255 +0,0 @@
-#
-# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-PROFILE_1_JRE_BIN_FILES := \
-    java$(EXE_SUFFIX) \
-    keytool$(EXE_SUFFIX)
-
-PROFILE_1_JRE_LIB_FILES := \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)j2pkcs11$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsig.diz \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)net$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)nio$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sunec$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)verify.diz \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)zip$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jsig.diz \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/$(LIBRARY_PREFIX)jvm.diz \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/client/Xusage.txt \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/jli/$(LIBRARY_PREFIX)jli$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/jvm.cfg \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jsig.diz \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/$(LIBRARY_PREFIX)jvm.diz \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/minimal/Xusage.txt \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jsig$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jsig.diz \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jvm$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/$(LIBRARY_PREFIX)jvm.diz \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/server/Xusage.txt \
-    classlist \
-    ext/localedata.jar \
-    ext/meta-index \
-    ext/sunec.jar \
-    ext/sunjce_provider.jar \
-    ext/sunpkcs11.jar \
-    jce.jar \
-    jsse.jar \
-    logging.properties \
-    meta-index \
-    net.properties \
-    resources.jar \
-    rt.jar \
-    security/US_export_policy.jar \
-    security/blacklist \
-    security/blacklisted.certs \
-    security/cacerts \
-    security/java.policy \
-    security/java.security \
-    security/local_policy.jar \
-    security/trusted.libraries \
-    tzdb.dat
-
-ifndef OPENJDK
-PROFILE_1_JRE_LIB_FILES += \
-    security/unlimited_policy/README.txt \
-    security/unlimited_policy/US_export_policy.jar \
-    security/unlimited_policy/local_policy.jar
-endif
-
-PROFILE_1_JRE_OTHER_FILES := \
-    COPYRIGHT \
-    LICENSE \
-    README \
-    THIRDPARTYLICENSEREADME.txt \
-    Welcome.html \
-    release
-
-PROFILE_1_JRE_JAR_FILES := \
-    ext/localedata.jar \
-    ext/sunec.jar \
-    ext/sunjce_provider.jar \
-    ext/sunpkcs11.jar \
-    jce.jar \
-    jsse.jar \
-    resources.jar \
-    rt.jar \
-    security/US_export_policy.jar \
-    security/local_policy.jar
-
-ifndef OPENJDK
-PROFILE_1_JRE_JAR_FILES += \
-    security/unlimited_policy/US_export_policy.jar \
-    security/unlimited_policy/local_policy.jar
-endif
-
-PROFILE_2_JRE_BIN_FILES := \
-    rmid$(EXE_SUFFIX) \
-    rmiregistry$(EXE_SUFFIX)
-
-PROFILE_2_JRE_LIB_FILES :=
-
-PROFILE_2_JRE_OTHER_FILES :=
-
-PROFILE_2_JRE_JAR_FILES :=
-
-
-PROFILE_3_JRE_BIN_FILES :=
-
-PROFILE_3_JRE_LIB_FILES := \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)hprof$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)hprof.diz \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)instrument$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)instrument.diz \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)j2gss$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)j2pcsc$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jaas_unix$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)java_crw_demo.diz \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsdt.diz \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)management.diz \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)prefs$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)sctp$(SHARED_LIBRARY_SUFFIX) \
-    jvm.hprof.txt \
-    management/jmxremote.access \
-    management/jmxremote.password.template \
-    management/management.properties \
-    management/snmp.acl.template
-
-PROFILE_3_JRE_OTHER_FILES :=
-
-PROFILE_3_JRE_JAR_FILES :=
-
-
-FULL_JRE_BIN_FILES := \
-    orbd$(EXE_SUFFIX) \
-    pack200$(EXE_SUFFIX) \
-    policytool$(EXE_SUFFIX) \
-    servertool$(EXE_SUFFIX) \
-    tnameserv$(EXE_SUFFIX) \
-    unpack200$(EXE_SUFFIX)
-
-FULL_JRE_LIB_FILES := \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt_headless$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)awt_xawt$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)dcpr$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)dt_socket$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)dt_socket.diz \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)fontmanager$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jawt$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jdwp$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jfr$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jpeg$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsound$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)jsoundalsa$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)kcms$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)mlib_image$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)splashscreen$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)t2k$(SHARED_LIBRARY_SUFFIX) \
-    $(OPENJDK_TARGET_CPU_LEGACY_LIB)/$(LIBRARY_PREFIX)unpack$(SHARED_LIBRARY_SUFFIX) \
-    charsets.jar \
-    ext/cldrdata.jar \
-    ext/dnsns.jar \
-    ext/nashorn.jar \
-    ext/zipfs.jar \
-    fontconfig.RedHat.5.bfc \
-    fontconfig.RedHat.5.properties.src \
-    fontconfig.RedHat.6.bfc \
-    fontconfig.RedHat.6.properties.src \
-    fontconfig.SuSE.10.bfc \
-    fontconfig.SuSE.10.properties.src \
-    fontconfig.SuSE.11.bfc \
-    fontconfig.SuSE.11.properties.src \
-    fontconfig.Turbo.bfc \
-    fontconfig.Turbo.properties.src \
-    fontconfig.bfc \
-    fontconfig.properties.src \
-    fonts/LucidaBrightDemiBold.ttf \
-    fonts/LucidaBrightDemiItalic.ttf \
-    fonts/LucidaBrightItalic.ttf \
-    fonts/LucidaBrightRegular.ttf \
-    fonts/LucidaSansDemiBold.ttf \
-    fonts/LucidaSansRegular.ttf \
-    fonts/LucidaTypewriterBold.ttf \
-    fonts/LucidaTypewriterRegular.ttf \
-    fonts/fonts.dir \
-    images/cursors/cursors.properties \
-    images/cursors/invalid32x32.gif \
-    images/cursors/motif_CopyDrop32x32.gif \
-    images/cursors/motif_CopyNoDrop32x32.gif \
-    images/cursors/motif_LinkDrop32x32.gif \
-    images/cursors/motif_LinkNoDrop32x32.gif \
-    images/cursors/motif_MoveDrop32x32.gif \
-    images/cursors/motif_MoveNoDrop32x32.gif \
-    jexec \
-    jfr.jar \
-    oblique-fonts/LucidaSansDemiOblique.ttf \
-    oblique-fonts/LucidaSansOblique.ttf \
-    oblique-fonts/LucidaTypewriterBoldOblique.ttf \
-    oblique-fonts/LucidaTypewriterOblique.ttf \
-    oblique-fonts/fonts.dir \
-    psfont.properties.ja \
-    psfontj2d.properties \
-    sound.properties
-
-FULL_JRE_OTHER_FILES := \
-    man/ja_JP.UTF-8/man1/java.1 \
-    man/ja_JP.UTF-8/man1/javaws.1 \
-    man/ja_JP.UTF-8/man1/keytool.1 \
-    man/ja_JP.UTF-8/man1/orbd.1 \
-    man/ja_JP.UTF-8/man1/pack200.1 \
-    man/ja_JP.UTF-8/man1/policytool.1 \
-    man/ja_JP.UTF-8/man1/rmid.1 \
-    man/ja_JP.UTF-8/man1/rmiregistry.1 \
-    man/ja_JP.UTF-8/man1/servertool.1 \
-    man/ja_JP.UTF-8/man1/tnameserv.1 \
-    man/ja_JP.UTF-8/man1/unpack200.1 \
-    man/man1/java.1 \
-    man/man1/javaws.1 \
-    man/man1/keytool.1 \
-    man/man1/orbd.1 \
-    man/man1/pack200.1 \
-    man/man1/policytool.1 \
-    man/man1/rmid.1 \
-    man/man1/rmiregistry.1 \
-    man/man1/servertool.1 \
-    man/man1/tnameserv.1 \
-    man/man1/unpack200.1
-
-FULL_JRE_JAR_FILES := \
-    charsets.jar \
-    ext/cldrdata.jar \
-    ext/dnsns.jar \
-    ext/nashorn.jar \
-    ext/zipfs.jar \
-    jfr.jar
diff --git a/jdk/make/profile-rtjar-includes.txt b/jdk/make/profile-rtjar-includes.txt
deleted file mode 100644
index 9ffdd032194..00000000000
--- a/jdk/make/profile-rtjar-includes.txt
+++ /dev/null
@@ -1,245 +0,0 @@
-#
-# Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# Included or excluded types must take one of two forms
-# - *.class to indicate all classes; or else
-# - a full single type name e.g.
-#     javax/management/remote/rmi/_RMIServer_Stub.class
-# You can not use arbitrary wildcards like _RMI*.class.
-#
-# Notes:
-# - Nested types must use $$ in place of $ as $ is the make meta-character
-# - If a package is not listed in any profile's inclusion list then it will
-#   not appear in any profile. But if a package is also missing from the
-#   full JRE's inclusion list then it will still be part of the full JRE.
-#   This is because the full JRE's inclusion lists are only used to define
-#   the exclusion lists for profiles; they are not used to define the full
-#   JRE contents - that is still done with the pre-profile legacy mechanism
-#   (all packagesthat can be found, less those not intended for rt.jar).
-#   This was done to minimize the impact of profiles on the regular
-#   non-profile build.
-#
-PROFILE_1_RTJAR_INCLUDE_PACKAGES := \
-    com/sun/demo/jvmti/hprof \
-    com/sun/java/util/jar/pack \
-    com/sun/net/ssl \
-    com/sun/nio/file \
-    com/sun/security/cert/internal/x509 \
-    java/io \
-    java/lang \
-    java/math \
-    java/net \
-    java/nio \
-    java/security \
-    java/text \
-    java/time \
-    java/util \
-    javax/net \
-    javax/script \
-    javax/security \
-    jdk \
-    sun/invoke \
-    sun/launcher \
-    sun/misc \
-    sun/net/ \
-    sun/nio \
-    sun/reflect \
-    sun/security \
-    sun/text \
-    sun/usagetracker \
-    sun/util
-
-PROFILE_1_RTJAR_INCLUDE_TYPES :=
-
-PROFILE_1_RTJAR_EXCLUDE_TYPES :=
-
-PROFILE_1_INCLUDE_METAINF_SERVICES :=
-
-
-PROFILE_2_RTJAR_INCLUDE_PACKAGES := \
-    com/sun/java_cup/internal/runtime \
-    com/sun/net/httpserver \
-    com/sun/org/apache \
-    com/sun/rmi/rmid \
-    com/sun/xml/internal/stream \
-    java/rmi \
-    java/sql \
-    javax/rmi/ssl \
-    javax/sql \
-    javax/transaction/xa \
-    javax/xml \
-    org/w3c \
-    org/xml/sax \
-    sun/net/httpserver \
-    sun/rmi \
-    sun/util/xml
-
-PROFILE_2_RTJAR_INCLUDE_TYPES :=
-
-PROFILE_2_RTJAR_EXCLUDE_TYPES :=
-
-PROFILE_2_INCLUDE_METAINF_SERVICES :=
-
-PROFILE_3_RTJAR_INCLUDE_PACKAGES := \
-    com/sun/jmx \
-    com/sun/jndi \
-    com/sun/management \
-    com/sun/naming/internal \
-    com/sun/nio/sctp \
-    com/sun/org/apache/xml/internal/security \
-    com/sun/rowset \
-    com/sun/security/auth \
-    com/sun/security/jgss \
-    com/sun/security/ntlm \
-    com/sun/security/sasl \
-    com/sun/tracing \
-    jdk/management/cmm \
-    java/lang/instrument \
-    java/lang/management \
-    java/security/acl \
-    java/util/prefs \
-    javax/annotation/processing \
-    javax/lang/model \
-    javax/management \
-    javax/naming \
-    javax/security/auth/kerberos \
-    javax/security/sasl \
-    javax/smartcardio \
-    javax/sql/rowset \
-    javax/tools \
-    javax/xml/crypto \
-    org/ietf/jgss \
-    org/jcp/xml \
-    sun/instrument \
-    sun/management \
-    sun/net/dns \
-    sun/net/www/protocol/http/ntlm \
-    sun/net/www/protocol/http/spnego \
-    sun/nio/ch/sctp \
-    sun/security/acl \
-    sun/security/jgss \
-    sun/security/krb5 \
-    sun/security/provider/certpath/ldap \
-    sun/security/smartcardio \
-    sun/tracing
-
-PROFILE_3_RTJAR_INCLUDE_TYPES :=
-
-PROFILE_3_RTJAR_EXCLUDE_TYPES := \
-    javax/management/remote/rmi/_RMIConnectionImpl_Tie.class \
-    javax/management/remote/rmi/_RMIConnection_Stub.class \
-    javax/management/remote/rmi/_RMIServerImpl_Tie.class \
-    javax/management/remote/rmi/_RMIServer_Stub.class
-
-FULL_JRE_RTJAR_INCLUDE_PACKAGES := \
-    com/oracle \
-    com/sun/accessibility/internal/resources \
-    com/sun/activation/registries \
-    com/sun/awt \
-    com/sun/beans \
-    com/sun/corba \
-    com/sun/image/codec/jpeg \
-    com/sun/imageio \
-    com/sun/istack \
-    com/sun/java/browser \
-    com/sun/java/swing \
-    com/sun/jmx/remote/protocol/iiop \
-    com/sun/jndi/cosnaming \
-    com/sun/jndi/toolkit/corba \
-    com/sun/jndi/url/corbaname \
-    com/sun/jndi/url/iiop \
-    com/sun/jndi/url/iiopname \
-    com/sun/media/sound \
-    com/sun/org/glassfish \
-    com/sun/org/omg \
-    com/sun/swing \
-    com/sun/xml/internal/bind \
-    com/sun/xml/internal/fastinfoset \
-    com/sun/xml/internal/messaging \
-    com/sun/xml/internal/org \
-    com/sun/xml/internal/stream/buffer \
-    com/sun/xml/internal/txw2 \
-    com/sun/xml/internal/ws \
-    java/applet \
-    java/awt \
-    java/beans \
-    javax/accessibility \
-    javax/activation \
-    javax/activity \
-    javax/imageio \
-    javax/jws \
-    javax/print \
-    javax/rmi/CORBA \
-    javax/sound \
-    javax/swing \
-    javax/xml/bind \
-    javax/xml/soap \
-    javax/xml/ws \
-    org/omg \
-    sun/applet \
-    sun/audio \
-    sun/awt \
-    sun/corba \
-    sun/datatransfer \
-    sun/dc \
-    sun/font \
-    sun/java2d \
-    sun/net/ftp \
-    sun/net/smtp \
-    sun/net/www/content/audio \
-    sun/net/www/content/image \
-    sun/net/www/content/text \
-    sun/net/www/protocol/ftp \
-    sun/net/www/protocol/mailto \
-    sun/net/www/protocol/netdoc \
-    sun/print \
-    sun/security/tools/policytool \
-    sun/swing \
-    sun/tools/jar
-
-FULL_JRE_RTJAR_INCLUDE_TYPES := \
-    javax/annotation/*.class \
-    javax/management/remote/rmi/_RMIConnectionImpl_Tie.class \
-    javax/management/remote/rmi/_RMIConnection_Stub.class \
-    javax/management/remote/rmi/_RMIServerImpl_Tie.class \
-    javax/management/remote/rmi/_RMIServer_Stub.class \
-    javax/rmi/*.class \
-    javax/transaction/*.class
-
-FULL_JRE_RTJAR_EXCLUDE_TYPES :=
-
-FULL_JRE_INCLUDE_METAINF_SERVICES := \
-    META-INF/services/com.sun.tools.internal.ws.wscompile.Plugin \
-    META-INF/services/com.sun.tools.internal.xjc.Plugin \
-    META-INF/services/javax.print.PrintServiceLookup \
-    META-INF/services/javax.print.StreamPrintServiceFactory \
-    META-INF/services/javax.sound.midi.spi.MidiDeviceProvider \
-    META-INF/services/javax.sound.midi.spi.MidiFileReader \
-    META-INF/services/javax.sound.midi.spi.MidiFileWriter \
-    META-INF/services/javax.sound.midi.spi.SoundbankReader \
-    META-INF/services/javax.sound.sampled.spi.AudioFileReader \
-    META-INF/services/javax.sound.sampled.spi.AudioFileWriter \
-    META-INF/services/javax.sound.sampled.spi.FormatConversionProvider \
-    META-INF/services/javax.sound.sampled.spi.MixerProvider
diff --git a/jdk/make/rmic/Rmic-java.management.gmk b/jdk/make/rmic/Rmic-java.management.gmk
index 07a9f35eee5..57b1d221ad8 100644
--- a/jdk/make/rmic/Rmic-java.management.gmk
+++ b/jdk/make/rmic/Rmic-java.management.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, 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
@@ -54,7 +54,7 @@ $(eval $(call SetupRMICompilation,RMI_IIOP, \
 $(eval $(call SetupRMICompilation,RMI_SRC, \
     CLASSES := $(JMX_RMI_CLASSES), \
     CLASSES_DIR := $(CLASSES_DIR)/java.management, \
-    STUB_CLASSES_DIR := $(RMIC_GENSRC_DIR), \
+    STUB_CLASSES_DIR := $(RMIC_GENSRC_DIR)/java.management, \
     RUN_V12 := true, \
     KEEP_GENERATED := true))
 
diff --git a/jdk/make/rmic/RmicCommon.gmk b/jdk/make/rmic/RmicCommon.gmk
index 2affa75a800..4c35481691f 100644
--- a/jdk/make/rmic/RmicCommon.gmk
+++ b/jdk/make/rmic/RmicCommon.gmk
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -31,7 +31,7 @@ include RMICompilation.gmk
 
 ##########################################################################################
 
-BTRMIC_CP := $(INTERIM_CORBA_JAR)$(PATH_SEP)$(JDK_OUTPUTDIR)/interim_rmic_classes$(PATH_SEP)$(INTERIM_LANGTOOLS_JAR)
+BTRMIC_CP := $(INTERIM_CORBA_JAR)$(PATH_SEP)$(BUILDTOOLS_OUTPUTDIR)/interim_rmic_classes$(PATH_SEP)$(INTERIM_LANGTOOLS_JAR)
 BTRMIC_ARGS := "-Xbootclasspath/p:$(BTRMIC_CP)" -cp "$(BTRMIC_CP)"
 RMIC := $(JAVA) $(BTRMIC_ARGS) sun.rmi.rmic.Main
 
@@ -39,6 +39,6 @@ CLASSES_DIR := $(JDK_OUTPUTDIR)/modules
 # NOTE: If the smart javac dependency management is reintroduced, these classes risk
 # interfering with the dependency checking. In that case they will need to be kept separate.
 STUB_CLASSES_DIR := $(JDK_OUTPUTDIR)/modules
-RMIC_GENSRC_DIR := $(JDK_OUTPUTDIR)/gendocsrc_rmic
+RMIC_GENSRC_DIR := $(SUPPORT_OUTPUTDIR)/rmic
 
 ##########################################################################################
diff --git a/jdk/make/src/classes/build/tools/module/ImageBuilder.java b/jdk/make/src/classes/build/tools/module/ImageBuilder.java
new file mode 100644
index 00000000000..9f0da161a8f
--- /dev/null
+++ b/jdk/make/src/classes/build/tools/module/ImageBuilder.java
@@ -0,0 +1,514 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package build.tools.module;
+
+import jdk.internal.jimage.Archive;
+import jdk.internal.jimage.ImageFile;
+import jdk.internal.jimage.ImageModules;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.PrintWriter;
+import java.io.UncheckedIOException;
+import java.nio.ByteOrder;
+import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.PosixFilePermission;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * A tool for building a runtime image.
+ *
+ * java build.tools.module.ImageBuilder <options> --output <path> top/modules.xml,...
+ *  Possible options are:
+ *  --cmds                  Location of native commands
+ *  --configs               Location of config files
+ *  --help                  Print this usage message
+ *  --classes               Location of module classes files
+ *  --libs                  Location of native libraries
+ *  --mods                  Comma separated list of module names
+ *  --output                Location of the output path
+ *  --endian                Byte order of the target runtime; {little,big}
+ */
+class ImageBuilder {
+    static class BadArgs extends Exception {
+        private static final long serialVersionUID = 0L;
+        BadArgs(String format, Object... args) {
+            super(String.format(format, args));
+            this.format = format;
+            this.args = args;
+        }
+        BadArgs showUsage(boolean b) {
+            showUsage = b;
+            return this;
+        }
+        final String format;
+        final Object[] args;
+        boolean showUsage;
+    }
+
+    static abstract class Option {
+        final boolean hasArg;
+        final String[] aliases;
+        Option(boolean hasArg, String... aliases) {
+            this.hasArg = hasArg;
+            this.aliases = aliases;
+        }
+        boolean isHidden() {
+            return false;
+        }
+        boolean matches(String opt) {
+            for (String a : aliases) {
+                if (a.equals(opt)) {
+                    return true;
+                } else if (opt.startsWith("--") && hasArg && opt.startsWith(a + "=")) {
+                    return true;
+                }
+            }
+            return false;
+        }
+        boolean ignoreRest() {
+            return false;
+        }
+        abstract void process(ImageBuilder task, String opt, String arg) throws BadArgs;
+        abstract String description();
+    }
+
+    private static Path CWD = Paths.get("");
+
+    private static List<Path> splitPath(String arg, String separator)
+        throws BadArgs
+    {
+        List<Path> paths = new ArrayList<>();
+        for (String p: arg.split(separator)) {
+            if (p.length() > 0) {
+                try {
+                    Path path = CWD.resolve(p);
+                    if (Files.notExists(path))
+                        throw new BadArgs("path not found: %s", path);
+                    paths.add(path);
+                } catch (InvalidPathException x) {
+                    throw new BadArgs("path not valid: %s", p);
+                }
+            }
+        }
+        return paths;
+    }
+
+    static Option[] recognizedOptions = {
+        new Option(true, "--cmds") {
+            void process(ImageBuilder task, String opt, String arg) throws BadArgs {
+                task.options.cmds = splitPath(arg, File.pathSeparator);
+            }
+            String description() { return "Location of native commands"; }
+        },
+        new Option(true, "--configs") {
+            void process(ImageBuilder task, String opt, String arg) throws BadArgs {
+                task.options.configs = splitPath(arg, File.pathSeparator);
+            }
+            String description() { return "Location of config files"; }
+        },
+        new Option(false, "--help") {
+            void process(ImageBuilder task, String opt, String arg) {
+                task.options.help = true;
+            }
+            String description() { return "Print this usage message"; }
+        },
+        new Option(true, "--classes") {
+            void process(ImageBuilder task, String opt, String arg) throws BadArgs {
+                task.options.classes = splitPath(arg, File.pathSeparator);
+            }
+            String description() { return "Location of module classes files"; }
+        },
+        new Option(true, "--libs") {
+            void process(ImageBuilder task, String opt, String arg) throws BadArgs {
+                task.options.libs = splitPath(arg, File.pathSeparator);
+            }
+            String description() { return "Location of native libraries"; }
+        },
+        new Option(true, "--mods") {
+            void process(ImageBuilder task, String opt, String arg) throws BadArgs {
+                for (String mn : arg.split(",")) {
+                    if (mn.isEmpty())
+                        throw new BadArgs("Module not found", mn);
+                    task.options.mods.add(mn);
+                }
+            }
+            String description() { return "Comma separated list of module names"; }
+        },
+        new Option(true, "--output") {
+            void process(ImageBuilder task, String opt, String arg) throws BadArgs {
+                Path path = Paths.get(arg);
+                task.options.output = path;
+            }
+            String description() { return "Location of the output path"; }
+        },
+        new Option(true, "--endian") {
+            void process(ImageBuilder task, String opt, String arg) throws BadArgs {
+                if (arg.equals("little"))
+                    task.options.endian = ByteOrder.LITTLE_ENDIAN;
+                else if (arg.equals("big"))
+                    task.options.endian = ByteOrder.BIG_ENDIAN;
+                else
+                    throw new BadArgs("Unknown byte order " + arg);
+            }
+            String description() { return "Byte order of the target runtime; {little,big}"; }
+        }
+    };
+
+    private final Options options = new Options();
+
+    private PrintWriter log;
+    void setLog(PrintWriter out) {
+        log = out;
+    }
+
+    Set<Module> moduleGraph = new java.util.HashSet<>();
+
+    /** Module list files */
+    private static final String BOOT_MODULES = "boot.modules";
+    private static final String EXT_MODULES = "ext.modules";
+
+    /**
+     * Result codes.
+     */
+    static final int EXIT_OK = 0,       // Completed with no errors.
+                     EXIT_ERROR = 1,    // Completed but reported errors.
+                     EXIT_CMDERR = 2,   // Bad command-line arguments
+                     EXIT_SYSERR = 3,   // System error or resource exhaustion.
+                     EXIT_ABNORMAL = 4; // terminated abnormally
+
+
+    static class Options {
+        boolean help;
+        List<Path> classes;
+        List<Path> cmds;
+        List<Path> configs;
+        List<Path> libs;
+        Set<String> mods = new HashSet<>();
+        Path output;
+        ByteOrder endian = ByteOrder.nativeOrder(); // default, if not specified
+    }
+
+    public static void main(String[] args) throws Exception {
+        ImageBuilder builder = new ImageBuilder();
+        int rc = builder.run(args);
+        System.exit(rc);
+    }
+
+    int run(String[] args) {
+        if (log == null)
+            log = new PrintWriter(System.out);
+
+        try {
+            handleOptions(args);
+            if (options.help) {
+                showHelp();
+                return EXIT_OK;
+            }
+
+            if (options.classes == null)
+                throw new BadArgs("--classes must be specified").showUsage(true);
+
+            Path output = options.output;
+            if (output == null)
+                throw new BadArgs("--output must be specified").showUsage(true);
+            Files.createDirectories(output);
+            if (Files.list(output).findFirst().isPresent())
+                throw new BadArgs("dir not empty", output);
+
+            if (options.mods.isEmpty())
+                throw new BadArgs("--mods must be specified").showUsage(true);
+
+            if (moduleGraph.isEmpty())
+                throw new BadArgs("modules.xml must be specified").showUsage(true);
+
+            if (options.cmds == null || options.cmds.isEmpty())
+                warning("--commands is not set");
+            if (options.libs == null || options.libs.isEmpty())
+                warning("--libs is not set");
+            //if (options.configs == null || options.configs.isEmpty())
+            //    warning("--configs is not set");
+
+            // additional option combination validation
+
+            boolean ok = run();
+            return ok ? EXIT_OK : EXIT_ERROR;
+        } catch (BadArgs e) {
+            reportError(e.format, e.args);
+            if (e.showUsage)
+                log.println(USAGE_SUMMARY);
+            return EXIT_CMDERR;
+        } catch (Exception x) {
+            x.printStackTrace();
+            return EXIT_ABNORMAL;
+        } finally {
+            log.flush();
+        }
+    }
+
+    private boolean run() throws IOException {
+        createImage();
+        return true;
+    }
+
+    class SimpleResolver {
+        private final Set<Module> initialMods;
+        private final Map<String,Module> nameToModule = new HashMap<>();
+
+        SimpleResolver(Set<String> mods, Set<Module> graph) {
+            graph.stream()
+                 .forEach(m -> nameToModule.put(m.name(), m));
+            initialMods = mods.stream()
+                         .map(this::nameToModule)
+                         .collect(Collectors.toSet());
+        }
+
+        /** Returns the transitive closure, in topological order */
+        List<String> resolve() {
+            List<Module> result = new LinkedList<>();
+            Set<Module> visited = new HashSet<>();
+            Set<Module> done = new HashSet<>();
+            for (Module m : initialMods) {
+                if (!visited.contains(m))
+                    visit(m, visited, result, done);
+            }
+            return result.stream()
+                         .map(m -> m.name())
+                         .collect(Collectors.toList());
+        }
+
+        private void visit(Module m, Set<Module> visited,
+                           List<Module> result, Set<Module> done) {
+            if (visited.contains(m)) {
+                if (!done.contains(m))
+                    throw new IllegalArgumentException("Cyclic detected: " +
+                            m + " " + getModuleDependences(m));
+                return;
+            }
+            visited.add(m);
+            getModuleDependences(m).stream()
+                                   .forEach(d -> visit(d, visited, result, done));
+            done.add(m);
+            result.add(m);
+        }
+
+        private Module nameToModule(String name) {
+            Module m = nameToModule.get(name);
+            if (m == null)
+                throw new RuntimeException("No module definition for " + name);
+            return m;
+        }
+
+        private Set<Module> getModuleDependences(Module m) {
+            return m.requires().stream()
+                    .map(d -> d.name())
+                    .map(this::nameToModule)
+                    .collect(Collectors.toSet());
+        }
+    }
+
+    private List<String> resolve(Set<String> mods ) {
+        return (new SimpleResolver(mods, moduleGraph)).resolve();
+    }
+
+    /**
+     * chmod ugo+x file
+     */
+    private void setExecutable(Path file) {
+        try {
+            Set<PosixFilePermission> perms = Files.getPosixFilePermissions(file);
+            perms.add(PosixFilePermission.OWNER_EXECUTE);
+            perms.add(PosixFilePermission.GROUP_EXECUTE);
+            perms.add(PosixFilePermission.OTHERS_EXECUTE);
+            Files.setPosixFilePermissions(file, perms);
+        } catch (IOException ioe) {
+            throw new UncheckedIOException(ioe);
+        }
+    }
+
+    private void createImage() throws IOException {
+        Collection<String> modules = resolve(options.mods);
+        log.print(modules.stream().collect(Collectors.joining(" ")));
+        ImageFileHelper imageHelper = new ImageFileHelper(modules);
+        imageHelper.createModularImage(options.output);
+
+        // jspawnhelper, might be in lib or lib/ARCH
+        Path jspawnhelper = Paths.get("jspawnhelper");
+        Path lib = options.output.resolve("lib");
+        Optional<Path> helper = Files.walk(lib, 2)
+                                     .filter(f -> f.getFileName().equals(jspawnhelper))
+                                     .findFirst();
+        if (helper.isPresent())
+            setExecutable(helper.get());
+    }
+
+    private class ImageFileHelper {
+        final Collection<String> modules;
+        final Set<String> bootModules;
+        final Set<String> extModules;
+        final Set<String> appModules;
+        final ImageModules imf;
+
+        ImageFileHelper(Collection<String> modules) throws IOException {
+            this.modules = modules;
+            this.bootModules = modulesFor(BOOT_MODULES).stream()
+                     .filter(modules::contains)
+                     .collect(Collectors.toSet());
+            this.extModules = modulesFor(EXT_MODULES).stream()
+                    .filter(modules::contains)
+                    .collect(Collectors.toSet());
+            this.appModules = modules.stream()
+                    .filter(m -> !bootModules.contains(m) && !extModules.contains(m))
+                    .collect(Collectors.toSet());
+
+            this.imf = new ImageModules(bootModules, extModules, appModules);
+        }
+
+        void createModularImage(Path output) throws IOException {
+            Set<Archive> archives = modules.stream()
+                                            .map(this::toModuleArchive)
+                                            .collect(Collectors.toSet());
+            ImageFile.create(output, archives, imf, options.endian);
+        }
+
+        ModuleArchive toModuleArchive(String mn) {
+            return new ModuleArchive(mn,
+                                     moduleToPath(mn, options.classes, false/*true*/),
+                                     moduleToPath(mn, options.cmds, false),
+                                     moduleToPath(mn, options.libs, false),
+                                     moduleToPath(mn, options.configs, false));
+        }
+
+        private Path moduleToPath(String name, List<Path> paths, boolean expect) {
+            Set<Path> foundPaths = new HashSet<>();
+            if (paths != null) {
+                for (Path p : paths) {
+                    Path rp = p.resolve(name);
+                    if (Files.exists(rp))
+                        foundPaths.add(rp);
+                }
+            }
+            if (foundPaths.size() > 1)
+                throw new RuntimeException("Found more that one path for " + name);
+            if (expect && foundPaths.size() != 1)
+                throw new RuntimeException("Expected to find classes path for " + name);
+            return foundPaths.size() == 0 ? null : foundPaths.iterator().next();
+        }
+
+        private List<String> modulesFor(String name) throws IOException {
+            try (InputStream is = ImageBuilder.class.getResourceAsStream(name);
+                 BufferedReader reader = new BufferedReader(new InputStreamReader(is))) {
+                return reader.lines().collect(Collectors.toList());
+            }
+        }
+    }
+
+    public void handleOptions(String[] args) throws BadArgs {
+        // process options
+        for (int i=0; i < args.length; i++) {
+            if (args[i].charAt(0) == '-') {
+                String name = args[i];
+                Option option = getOption(name);
+                String param = null;
+                if (option.hasArg) {
+                    if (name.startsWith("--") && name.indexOf('=') > 0) {
+                        param = name.substring(name.indexOf('=') + 1, name.length());
+                    } else if (i + 1 < args.length) {
+                        param = args[++i];
+                    }
+                    if (param == null || param.isEmpty() || param.charAt(0) == '-') {
+                        throw new BadArgs("Missing arg for %n", name).showUsage(true);
+                    }
+                }
+                option.process(this, name, param);
+                if (option.ignoreRest()) {
+                    i = args.length;
+                }
+            } else {
+                // process rest of the input arguments
+                Path p = Paths.get(args[i]);
+                try {
+                    moduleGraph.addAll(ModulesXmlReader.readModules(p)
+                            .stream()
+                            .collect(Collectors.toSet()));
+                } catch (Exception e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        }
+    }
+
+    private Option getOption(String name) throws BadArgs {
+        for (Option o : recognizedOptions) {
+            if (o.matches(name)) {
+                return o;
+            }
+        }
+        throw new BadArgs("Unknown option %s", name).showUsage(true);
+    }
+
+    private void reportError(String format, Object... args) {
+        log.format("Error: " + format + "%n", args);
+    }
+
+    private void warning(String format, Object... args) {
+        log.format("Warning: " + format + "%n", args);
+    }
+
+    private static final String USAGE =
+            "ImageBuilder <options> --output <path> path-to-modules-xml\n";
+
+    private static final String USAGE_SUMMARY =
+            USAGE + "Use --help for a list of possible options.";
+
+    private void showHelp() {
+        log.format(USAGE);
+        log.format("Possible options are:%n");
+        for (Option o : recognizedOptions) {
+            String name = o.aliases[0].substring(1); // there must always be at least one name
+            name = name.charAt(0) == '-' ? name.substring(1) : name;
+            if (o.isHidden() || name.equals("h"))
+                continue;
+
+            log.format("  --%s\t\t\t%s%n", name, o.description());
+        }
+    }
+}
diff --git a/jdk/make/src/classes/build/tools/module/ModuleArchive.java b/jdk/make/src/classes/build/tools/module/ModuleArchive.java
new file mode 100644
index 00000000000..41d7ae1c282
--- /dev/null
+++ b/jdk/make/src/classes/build/tools/module/ModuleArchive.java
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package build.tools.module;
+
+import jdk.internal.jimage.Archive;
+import jdk.internal.jimage.Resource;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.UncheckedIOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.function.Consumer;
+
+/**
+ * An Archive backed by an exploded representation on disk.
+ */
+public class ModuleArchive implements Archive {
+    private final Path classes;
+    private final Path cmds;
+    private final Path libs;
+    private final Path configs;
+    private final String moduleName;
+
+    public ModuleArchive(String moduleName, Path classes, Path cmds,
+                         Path libs, Path configs) {
+        this.moduleName = moduleName;
+        this.classes = classes;
+        this.cmds = cmds;
+        this.libs = libs;
+        this.configs = configs;
+    }
+
+    @Override
+    public String moduleName() {
+        return moduleName;
+    }
+
+    @Override
+    public void visitResources(Consumer<Resource> consumer) {
+        if (classes == null)
+            return;
+        try{
+            Files.walk(classes)
+                    .sorted()
+                    .filter(p -> !Files.isDirectory(p)
+                            && !classes.relativize(p).toString().startsWith("_the.")
+                            && !classes.relativize(p).toString().equals("javac_state"))
+                    .map(this::toResource)
+                    .forEach(consumer::accept);
+        } catch (IOException ioe) {
+            throw new UncheckedIOException(ioe);
+        }
+    }
+
+    private Resource toResource(Path path) {
+        try {
+            return new Resource(classes.relativize(path).toString().replace('\\','/'),
+                                Files.size(path),
+                                0 /* no compression support yet */);
+        } catch (IOException ioe) {
+            throw new UncheckedIOException(ioe);
+        }
+    }
+
+    private enum Section {
+        CLASSES,
+        CMDS,
+        LIBS,
+        CONFIGS
+    }
+
+    @Override
+    public void visitEntries(Consumer<Entry> consumer) {
+        try{
+            if (classes != null)
+                Files.walk(classes)
+                        .sorted()
+                        .filter(p -> !Files.isDirectory(p)
+                                && !classes.relativize(p).toString().startsWith("_the.")
+                                && !classes.relativize(p).toString().equals("javac_state"))
+                        .map(p -> toEntry(p, classes, Section.CLASSES))
+                        .forEach(consumer::accept);
+            if (cmds != null)
+                Files.walk(cmds)
+                        .filter(p -> !Files.isDirectory(p))
+                        .map(p -> toEntry(p, cmds, Section.CMDS))
+                        .forEach(consumer::accept);
+            if (libs != null)
+                Files.walk(libs)
+                        .filter(p -> !Files.isDirectory(p))
+                        .map(p -> toEntry(p, libs, Section.LIBS))
+                        .forEach(consumer::accept);
+            if (configs != null)
+                Files.walk(configs)
+                        .filter(p -> !Files.isDirectory(p))
+                        .map(p -> toEntry(p, configs, Section.CONFIGS))
+                        .forEach(consumer::accept);
+        } catch (IOException ioe) {
+            throw new UncheckedIOException(ioe);
+        }
+    }
+
+    private static class FileEntry implements Entry {
+        private final String name;
+        private final InputStream is;
+        private final boolean isDirectory;
+        private final Section section;
+        FileEntry(String name, InputStream is,
+                  boolean isDirectory, Section section) {
+            this.name = name;
+            this.is = is;
+            this.isDirectory = isDirectory;
+            this.section = section;
+        }
+        public String getName() {
+            return name;
+        }
+        public Section getSection() {
+            return section;
+        }
+        public InputStream getInputStream() {
+            return is;
+        }
+        public boolean isDirectory() {
+            return isDirectory;
+        }
+    }
+
+    private Entry toEntry(Path entryPath, Path basePath, Section section) {
+        try {
+            return new FileEntry(basePath.relativize(entryPath).toString().replace('\\', '/'),
+                                 Files.newInputStream(entryPath), false,
+                                 section);
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    @Override
+    public Consumer<Entry> defaultImageWriter(Path path, OutputStream out) {
+        return new DefaultEntryWriter(path, out);
+    }
+
+    private static class DefaultEntryWriter implements Consumer<Archive.Entry> {
+        private final Path root;
+        private final OutputStream out;
+
+        DefaultEntryWriter(Path root, OutputStream out) {
+            this.root = root;
+            this.out = out;
+        }
+
+        @Override
+        public void accept(Archive.Entry entry) {
+            try {
+                FileEntry e = (FileEntry)entry;
+                Section section = e.getSection();
+                String filename = e.getName();
+
+                try (InputStream in = entry.getInputStream()) {
+                    switch (section) {
+                        case CLASSES:
+                            if (!filename.startsWith("_the.") && !filename.equals("javac_state"))
+                                writeEntry(in);
+                            break;
+                        case LIBS:
+                            writeEntry(in, destFile(nativeDir(filename), filename));
+                            break;
+                        case CMDS:
+                            Path path = destFile("bin", filename);
+                            writeEntry(in, path);
+                            path.toFile().setExecutable(true);
+                            break;
+                        case CONFIGS:
+                            writeEntry(in, destFile("conf", filename));
+                            break;
+                        default:
+                            throw new InternalError("unexpected entry: " + filename);
+                    }
+                }
+            } catch (IOException x) {
+                throw new UncheckedIOException(x);
+            }
+        }
+
+        private Path destFile(String dir, String filename) {
+            return root.resolve(dir).resolve(filename);
+        }
+
+        private static void writeEntry(InputStream in, Path dstFile) throws IOException {
+            if (Files.notExists(dstFile.getParent()))
+                Files.createDirectories(dstFile.getParent());
+            Files.copy(in, dstFile);
+        }
+
+        private void writeEntry(InputStream in) throws IOException {
+            byte[] buf = new byte[8192];
+            int n;
+            while ((n = in.read(buf)) > 0)
+                out.write(buf, 0, n);
+        }
+
+        private static String nativeDir(String filename) {
+            if (System.getProperty("os.name").startsWith("Windows")) {
+                if (filename.endsWith(".dll"))
+                    return "bin";
+                 else
+                    return "lib";
+            } else {
+                return "lib";
+            }
+        }
+    }
+}
+
diff --git a/jdk/make/src/classes/build/tools/module/ModulesXmlReader.java b/jdk/make/src/classes/build/tools/module/ModulesXmlReader.java
index 0d1121867d2..e8b2d546a04 100644
--- a/jdk/make/src/classes/build/tools/module/ModulesXmlReader.java
+++ b/jdk/make/src/classes/build/tools/module/ModulesXmlReader.java
@@ -60,7 +60,6 @@ public class ModulesXmlReader {
     private static final String DEPEND    = "depend";
     private static final String EXPORT    = "export";
     private static final String TO        = "to";
-    private static final String INCLUDE   = "include";
     private static final QName  REEXPORTS = new QName("re-exports");
     private static Set<Module> load(InputStream in)
         throws XMLStreamException, IOException
@@ -102,8 +101,6 @@ public class ModulesXmlReader {
                         }
                         mb.require(getData(stream), reexports);
                         break;
-                    case INCLUDE:
-                        throw new RuntimeException("unexpected " + event);
                     case EXPORT:
                         pkg = getNextTag(stream, NAME);
                         break;
diff --git a/jdk/make/src/classes/build/tools/module/ModulesXmlWriter.java b/jdk/make/src/classes/build/tools/module/ModulesXmlWriter.java
index 51ad32ab9a1..00fa866424e 100644
--- a/jdk/make/src/classes/build/tools/module/ModulesXmlWriter.java
+++ b/jdk/make/src/classes/build/tools/module/ModulesXmlWriter.java
@@ -54,7 +54,6 @@ public final class ModulesXmlWriter {
     private static final String DEPEND    = "depend";
     private static final String EXPORT    = "export";
     private static final String TO        = "to";
-    private static final String INCLUDE   = "include";
     private static final QName  REEXPORTS = new QName("re-exports");
 
     private static void writeXML(Set<Module> modules, Path path)
@@ -143,8 +142,6 @@ public final class ModulesXmlWriter {
                        .filter(e -> !e.getValue().isEmpty())
                        .sorted(Map.Entry.comparingByKey())
                        .forEach(e -> writeExportElement(xtw, e.getKey(), e.getValue(), depth+1));
-            m.packages().stream().sorted()
-                        .forEach(p -> writeElement(xtw, INCLUDE, p, depth+1));
             writeEndElement(xtw, depth);
         } catch (XMLStreamException e) {
             throw new RuntimeException(e);
diff --git a/jdk/make/src/classes/build/tools/module/boot.modules b/jdk/make/src/classes/build/tools/module/boot.modules
new file mode 100644
index 00000000000..396e13c4db3
--- /dev/null
+++ b/jdk/make/src/classes/build/tools/module/boot.modules
@@ -0,0 +1,35 @@
+java.base
+java.desktop
+java.activation
+java.annotations.common
+java.compiler
+java.corba
+java.instrument
+java.logging
+java.management
+java.naming
+java.prefs
+java.rmi
+java.scripting
+java.security.acl
+java.security.jgss
+java.security.sasl
+java.smartcardio
+java.sql
+java.sql.rowset
+java.xml
+java.xml.bind
+java.xml.crypto
+java.xml.soap
+java.xml.ws
+jdk.charsets
+jdk.deploy
+jdk.deploy.osx
+jdk.hprof.agent
+jdk.httpserver
+jdk.naming.rmi
+jdk.sctp
+jdk.security.auth
+jdk.security.jgss
+jdk.jfr
+jdk.snmp
diff --git a/jdk/make/src/classes/build/tools/module/ext.modules b/jdk/make/src/classes/build/tools/module/ext.modules
new file mode 100644
index 00000000000..93b8dd5b00a
--- /dev/null
+++ b/jdk/make/src/classes/build/tools/module/ext.modules
@@ -0,0 +1,9 @@
+jdk.crypto.ec
+jdk.crypto.mscapi
+jdk.crypto.pkcs11
+jdk.crypto.ucrypto
+jdk.localedata
+jdk.naming.dns
+jdk.scripting.nashorn
+jdk.zipfs
+oracle.accessbridge
diff --git a/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/ResultSet.java b/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/ResultSet.java
index d8da28384fa..f84f8835901 100644
--- a/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/ResultSet.java
+++ b/jdk/src/demo/share/java2d/J2DBench/src/j2dbench/ResultSet.java
@@ -81,8 +81,6 @@ public class ResultSet {
         "java.class.path",
         "java.library.path",
         "java.io.tmpdir",
-        "java.ext.dirs",
-        "java.endorsed.dirs",
         "java.util.prefs.PreferencesFactory",
         "sun.java2d.fontpath",
         "sun.boot.library.path",
diff --git a/jdk/src/java.base/share/classes/META-INF/services/java.nio.file.spi.FileSystemProvider b/jdk/src/java.base/share/classes/META-INF/services/java.nio.file.spi.FileSystemProvider
new file mode 100644
index 00000000000..959e2fb36b4
--- /dev/null
+++ b/jdk/src/java.base/share/classes/META-INF/services/java.nio.file.spi.FileSystemProvider
@@ -0,0 +1 @@
+jdk.internal.jrtfs.JrtFileSystemProvider
diff --git a/jdk/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java b/jdk/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java
index cac7298ab69..dd7320b394c 100644
--- a/jdk/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java
+++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -130,7 +130,7 @@ final class SSLSecurity {
              * this class and all the SPI classes in javax.crypto are
              * loaded by the same class loader.)  That is, unless they
              * give us a SPI class that doesn't exist, say SSLFoo,
-             * or someone has removed classes from the jsse.jar file.
+             * or someone has removed classes from the java.base module.
              */
 
             Class<?> typeClassJavax;
diff --git a/jdk/src/java.base/share/classes/java/lang/System.java b/jdk/src/java.base/share/classes/java/lang/System.java
index 345cdae1df7..1871774a022 100644
--- a/jdk/src/java.base/share/classes/java/lang/System.java
+++ b/jdk/src/java.base/share/classes/java/lang/System.java
@@ -582,8 +582,6 @@ public final class System {
      *     <td>Default temp file path</td></tr>
      * <tr><td><code>java.compiler</code></td>
      *     <td>Name of JIT compiler to use</td></tr>
-     * <tr><td><code>java.ext.dirs</code></td>
-     *     <td>Path of extension directory or directories</td></tr>
      * <tr><td><code>os.name</code></td>
      *     <td>Operating system name</td></tr>
      * <tr><td><code>os.arch</code></td>
diff --git a/jdk/src/java.base/share/classes/java/net/URL.java b/jdk/src/java.base/share/classes/java/net/URL.java
index e0abaace2b5..6d50d1c4262 100644
--- a/jdk/src/java.base/share/classes/java/net/URL.java
+++ b/jdk/src/java.base/share/classes/java/net/URL.java
@@ -1106,6 +1106,11 @@ public final class URL implements java.io.Serializable {
                 security.checkSetFactory();
             }
             handlers.clear();
+
+            // ensure the core protocol handlers are loaded before setting
+            // a custom URLStreamHandlerFactory
+            ensureHandlersLoaded("jrt", "jar", "file");
+
             // safe publication of URLStreamHandlerFactory with volatile write
             factory = fac;
         }
@@ -1219,6 +1224,16 @@ public final class URL implements java.io.Serializable {
 
     }
 
+    /**
+     * Ensures that the given protocol handlers are loaded
+     */
+    private static void ensureHandlersLoaded(String... protocols) {
+        for (String protocol: protocols) {
+            getURLStreamHandler(protocol);
+        }
+    }
+
+
     /**
      * WriteObject is called to save the state of the URL to an
      * ObjectOutputStream. The handler is not saved since it is
diff --git a/jdk/src/java.base/share/classes/java/nio/charset/spi/CharsetProvider.java b/jdk/src/java.base/share/classes/java/nio/charset/spi/CharsetProvider.java
index bc1ec91fc5a..f859245a9dc 100644
--- a/jdk/src/java.base/share/classes/java/nio/charset/spi/CharsetProvider.java
+++ b/jdk/src/java.base/share/classes/java/nio/charset/spi/CharsetProvider.java
@@ -35,8 +35,7 @@ import java.util.Iterator;
  * <p> A charset provider is a concrete subclass of this class that has a
  * zero-argument constructor and some number of associated charset
  * implementation classes.  Charset providers may be installed in an instance
- * of the Java platform as extensions, that is, jar files placed into any of
- * the usual extension directories.  Providers may also be made available by
+ * of the Java platform as extensions.  Providers may also be made available by
  * adding them to the applet or application class path or by some other
  * platform-specific means.  Charset providers are looked up via the current
  * thread's {@link java.lang.Thread#getContextClassLoader() context class
diff --git a/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java b/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java
index a38aaae63b6..17c295e95ef 100644
--- a/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java
+++ b/jdk/src/java.base/share/classes/java/nio/file/FileSystems.java
@@ -54,7 +54,7 @@ import java.lang.reflect.Constructor;
  * system class loader cannot be found then the extension class loader is used;
  * if there is no extension class loader then the bootstrap class loader is used.
  * Providers are typically installed by placing them in a JAR file on the
- * application class path or in the extension directory, the JAR file contains a
+ * application class path, the JAR file contains a
  * provider-configuration file named {@code java.nio.file.spi.FileSystemProvider}
  * in the resource directory {@code META-INF/services}, and the file lists one or
  * more fully-qualified names of concrete subclass of {@link FileSystemProvider}
diff --git a/jdk/src/java.base/share/classes/java/nio/file/Files.java b/jdk/src/java.base/share/classes/java/nio/file/Files.java
index 18ef214e9a0..496b4160447 100644
--- a/jdk/src/java.base/share/classes/java/nio/file/Files.java
+++ b/jdk/src/java.base/share/classes/java/nio/file/Files.java
@@ -1581,8 +1581,8 @@ public final class Files {
      * loader. If the system class loader cannot be found then the extension class
      * loader is used; If the extension class loader cannot be found then the
      * bootstrap class loader is used. File type detectors are typically installed
-     * by placing them in a JAR file on the application class path or in the
-     * extension directory, the JAR file contains a provider-configuration file
+     * by placing them in a JAR file on the application class path,
+     * the JAR file contains a provider-configuration file
      * named {@code java.nio.file.spi.FileTypeDetector} in the resource directory
      * {@code META-INF/services}, and the file lists one or more fully-qualified
      * names of concrete subclass of {@code FileTypeDetector } that have a zero
diff --git a/jdk/src/java.base/share/classes/java/security/Security.java b/jdk/src/java.base/share/classes/java/security/Security.java
index e24c0023f77..11e1a997639 100644
--- a/jdk/src/java.base/share/classes/java/security/Security.java
+++ b/jdk/src/java.base/share/classes/java/security/Security.java
@@ -212,7 +212,7 @@ public final class Security {
         // maybe check for a system property which will specify where to
         // look. Someday.
         String sep = File.separator;
-        return new File(System.getProperty("java.home") + sep + "lib" + sep +
+        return new File(System.getProperty("java.home") + sep + "conf" + sep +
                         "security" + sep + filename);
     }
 
diff --git a/jdk/src/java.base/share/classes/java/util/Currency.java b/jdk/src/java.base/share/classes/java/util/Currency.java
index 5af9c7193ca..f5f67b2e58d 100644
--- a/jdk/src/java.base/share/classes/java/util/Currency.java
+++ b/jdk/src/java.base/share/classes/java/util/Currency.java
@@ -30,6 +30,7 @@ import java.io.DataInputStream;
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileReader;
+import java.io.InputStream;
 import java.io.IOException;
 import java.io.Serializable;
 import java.security.AccessController;
@@ -213,8 +214,11 @@ public final class Currency implements Serializable {
             @Override
             public Void run() {
                 try {
-                    try (DataInputStream dis = new DataInputStream(
-                             new BufferedInputStream(getClass().getResourceAsStream("/java/util/currency.data")))) {
+                    try (InputStream in = getClass().getResourceAsStream("/java/util/currency.data")) {
+                        if (in == null) {
+                            throw new InternalError("Currency data not found");
+                        }
+                        DataInputStream dis = new DataInputStream(new BufferedInputStream(in));
                         if (dis.readInt() != MAGIC_NUMBER) {
                             throw new InternalError("Currency data is possibly corrupted");
                         }
diff --git a/jdk/src/java.base/share/classes/java/util/ServiceLoader.java b/jdk/src/java.base/share/classes/java/util/ServiceLoader.java
index 49b1b58d477..cf158916d07 100644
--- a/jdk/src/java.base/share/classes/java/util/ServiceLoader.java
+++ b/jdk/src/java.base/share/classes/java/util/ServiceLoader.java
@@ -46,10 +46,8 @@ import java.util.NoSuchElementException;
  * <p> A <i>service</i> is a well-known set of interfaces and (usually
  * abstract) classes.  A <i>service provider</i> is a specific implementation
  * of a service.  The classes in a provider typically implement the interfaces
- * and subclass the classes defined in the service itself.  Service providers
- * can be installed in an implementation of the Java platform in the form of
- * extensions, that is, jar files placed into any of the usual extension
- * directories.  Providers can also be made available by adding them to the
+ * and subclass the classes defined in the service itself.
+ * Providers can be made available by adding them to the
  * application's class path or by some other platform-specific means.
  *
  * <p> For the purpose of loading, a service is represented by a single type,
diff --git a/jdk/src/java.base/share/classes/java/util/jar/Attributes.java b/jdk/src/java.base/share/classes/java/util/jar/Attributes.java
index 37efbd47481..6d66f8c7993 100644
--- a/jdk/src/java.base/share/classes/java/util/jar/Attributes.java
+++ b/jdk/src/java.base/share/classes/java/util/jar/Attributes.java
@@ -544,10 +544,9 @@ public class Attributes implements Map<Object,Object>, Cloneable {
 
         /**
          * <code>Name</code> object for <code>Class-Path</code>
-         * manifest attribute. Bundled extensions can use this attribute
-         * to find other JAR files containing needed classes.
-         * @see <a href="../../../../technotes/guides/extensions/spec.html#bundled">
-         *      Extensions Specification</a>
+         * manifest attribute.
+         * @see <a href="../../../../technotes/guides/jar/jar.html#classpath">
+         *      JAR file specification</a>
          */
         public static final Name CLASS_PATH = new Name("Class-Path");
 
@@ -563,96 +562,82 @@ public class Attributes implements Map<Object,Object>, Cloneable {
         /**
          * <code>Name</code> object for <code>Sealed</code> manifest attribute
          * used for sealing.
-         * @see <a href="../../../../technotes/guides/extensions/spec.html#sealing">
-         *      Extension Sealing</a>
+         * @see <a href="../../../../technotes/guides/jar/jar.html#sealing">
+         *      Package Sealing</a>
          */
         public static final Name SEALED = new Name("Sealed");
 
        /**
          * <code>Name</code> object for <code>Extension-List</code> manifest attribute
-         * used for declaring dependencies on installed extensions.
-         * @see <a href="../../../../technotes/guides/extensions/spec.html#dependency">
-         *      Installed extension dependency</a>
+         * used for the extension mechanism that is no longer supported.
          */
         public static final Name EXTENSION_LIST = new Name("Extension-List");
 
         /**
-         * <code>Name</code> object for <code>Extension-Name</code> manifest attribute
-         * used for declaring dependencies on installed extensions.
-         * @see <a href="../../../../technotes/guides/extensions/spec.html#dependency">
-         *      Installed extension dependency</a>
+         * <code>Name</code> object for <code>Extension-Name</code> manifest attribute.
+         * used for the extension mechanism that is no longer supported.
          */
         public static final Name EXTENSION_NAME = new Name("Extension-Name");
 
         /**
-         * <code>Name</code> object for <code>Extension-Name</code> manifest attribute
-         * used for declaring dependencies on installed extensions.
-         * @see <a href="../../../../technotes/guides/extensions/spec.html#dependency">
-         *      Installed extension dependency</a>
+         * <code>Name</code> object for <code>Extension-Installation</code> manifest attribute.
+         *
+         * @deprecated Extension mechanism is no longer supported.
          */
+        @Deprecated
         public static final Name EXTENSION_INSTALLATION = new Name("Extension-Installation");
 
         /**
          * <code>Name</code> object for <code>Implementation-Title</code>
          * manifest attribute used for package versioning.
-         * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
-         *      Java Product Versioning Specification</a>
          */
         public static final Name IMPLEMENTATION_TITLE = new Name("Implementation-Title");
 
         /**
          * <code>Name</code> object for <code>Implementation-Version</code>
          * manifest attribute used for package versioning.
-         * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
-         *      Java Product Versioning Specification</a>
          */
         public static final Name IMPLEMENTATION_VERSION = new Name("Implementation-Version");
 
         /**
          * <code>Name</code> object for <code>Implementation-Vendor</code>
          * manifest attribute used for package versioning.
-         * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
-         *      Java Product Versioning Specification</a>
          */
         public static final Name IMPLEMENTATION_VENDOR = new Name("Implementation-Vendor");
 
         /**
          * <code>Name</code> object for <code>Implementation-Vendor-Id</code>
-         * manifest attribute used for package versioning.
-         * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
-         *      Java Product Versioning Specification</a>
+         * manifest attribute.
+         *
+         * @deprecated Extension mechanism is no longer supported.
          */
+        @Deprecated
         public static final Name IMPLEMENTATION_VENDOR_ID = new Name("Implementation-Vendor-Id");
 
        /**
          * <code>Name</code> object for <code>Implementation-URL</code>
-         * manifest attribute used for package versioning.
-         * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
-         *      Java Product Versioning Specification</a>
+         * manifest attribute.
+         *
+         * @deprecated Extension mechanism is no longer supported.
          */
+        @Deprecated
         public static final Name IMPLEMENTATION_URL = new Name("Implementation-URL");
 
         /**
          * <code>Name</code> object for <code>Specification-Title</code>
          * manifest attribute used for package versioning.
-         * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
-         *      Java Product Versioning Specification</a>
          */
         public static final Name SPECIFICATION_TITLE = new Name("Specification-Title");
 
         /**
          * <code>Name</code> object for <code>Specification-Version</code>
          * manifest attribute used for package versioning.
-         * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
-         *      Java Product Versioning Specification</a>
          */
         public static final Name SPECIFICATION_VERSION = new Name("Specification-Version");
 
         /**
          * <code>Name</code> object for <code>Specification-Vendor</code>
          * manifest attribute used for package versioning.
-         * @see <a href="../../../../technotes/guides/versioning/spec/versioning2.html#wp90779">
-         *      Java Product Versioning Specification</a>
          */
         public static final Name SPECIFICATION_VENDOR = new Name("Specification-Vendor");
     }
diff --git a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java
index 946c4ae2bc2..f04a86ee3b8 100644
--- a/jdk/src/java.base/share/classes/java/util/jar/JarFile.java
+++ b/jdk/src/java.base/share/classes/java/util/jar/JarFile.java
@@ -548,58 +548,15 @@ class JarFile extends ZipFile {
      */
     private void checkForSpecialAttributes() throws IOException {
         if (hasCheckedSpecialAttributes) return;
-        if (!isKnownNotToHaveSpecialAttributes()) {
-            JarEntry manEntry = getManEntry();
-            if (manEntry != null) {
-                byte[] b = getBytes(manEntry);
-                if (match(CLASSPATH_CHARS, b, CLASSPATH_LASTOCC, CLASSPATH_OPTOSFT))
-                    hasClassPathAttribute = true;
-            }
+        JarEntry manEntry = getManEntry();
+        if (manEntry != null) {
+            byte[] b = getBytes(manEntry);
+            if (match(CLASSPATH_CHARS, b, CLASSPATH_LASTOCC, CLASSPATH_OPTOSFT))
+                hasClassPathAttribute = true;
         }
         hasCheckedSpecialAttributes = true;
     }
 
-    private static String javaHome;
-    private static volatile String[] jarNames;
-    private boolean isKnownNotToHaveSpecialAttributes() {
-        // Optimize away even scanning of manifest for jar files we
-        // deliver which don't have a class-path attribute. If one of
-        // these jars is changed to include such an attribute this code
-        // must be changed.
-        if (javaHome == null) {
-            javaHome = AccessController.doPrivileged(
-                new GetPropertyAction("java.home"));
-        }
-        if (jarNames == null) {
-            String[] names = new String[11];
-            String fileSep = File.separator;
-            int i = 0;
-            names[i++] = fileSep + "rt.jar";
-            names[i++] = fileSep + "jsse.jar";
-            names[i++] = fileSep + "jce.jar";
-            names[i++] = fileSep + "charsets.jar";
-            names[i++] = fileSep + "dnsns.jar";
-            names[i++] = fileSep + "zipfs.jar";
-            names[i++] = fileSep + "localedata.jar";
-            names[i++] = fileSep = "cldrdata.jar";
-            names[i++] = fileSep + "sunjce_provider.jar";
-            names[i++] = fileSep + "sunpkcs11.jar";
-            names[i++] = fileSep + "sunec.jar";
-            jarNames = names;
-        }
-
-        String name = getName();
-        if (name.startsWith(javaHome)) {
-            String[] names = jarNames;
-            for (String jarName : names) {
-                if (name.endsWith(jarName)) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
     private synchronized void ensureInitialization() {
         try {
             maybeInstantiateVerifier();
diff --git a/jdk/src/java.base/share/classes/javax/crypto/JceSecurityManager.java b/jdk/src/java.base/share/classes/javax/crypto/JceSecurityManager.java
index 0d1773c5df4..83f003b4838 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/JceSecurityManager.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/JceSecurityManager.java
@@ -229,6 +229,11 @@ final class JceSecurityManager extends SecurityManager {
 
     // See  bug 4341369 & 4334690 for more info.
     boolean isCallerTrusted(Provider provider) {
+        if (ProviderVerifier.isTrustedCryptoProvider(provider)) {
+            // fast path
+            return true;
+        }
+
         // Get the caller and its codebase.
         Class<?>[] context = getClassContext();
         URL callerCodeBase = null;
diff --git a/jdk/src/java.base/share/classes/javax/crypto/ProviderVerifier.java b/jdk/src/java.base/share/classes/javax/crypto/ProviderVerifier.java
index 67b0286d67f..3668f10a6e0 100644
--- a/jdk/src/java.base/share/classes/javax/crypto/ProviderVerifier.java
+++ b/jdk/src/java.base/share/classes/javax/crypto/ProviderVerifier.java
@@ -156,6 +156,14 @@ final class ProviderVerifier {
             throws Exception {
     }
 
+    /**
+     * Returns true if the given provider is JDK trusted crypto provider
+     * if the implementation supports fast-path verification.
+     */
+    static boolean isTrustedCryptoProvider(Provider provider) {
+        return false;
+    }
+
     /**
      * Returns the permissions which are bundled with the JAR file,
      * aka the "cryptoperms" file.
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/Archive.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/Archive.java
new file mode 100644
index 00000000000..2843d18a228
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/Archive.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.jimage;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.file.Path;
+import java.util.function.Consumer;
+
+/**
+ * An Archive of all content, classes, resources, configuration files, and
+ * other, for a module.
+ */
+public interface Archive {
+    /**
+     * The module name.
+     */
+    String moduleName();
+
+    /**
+     * Visits all classes and resources.
+     */
+    void visitResources(Consumer<Resource> consumer);
+
+    /**
+     * Visits all entries in the Archive.
+     */
+    void visitEntries(Consumer<Entry> consumer) ;
+
+    /**
+     * An entries in the Archive.
+     */
+    interface Entry {
+        String getName();
+        InputStream getInputStream();
+        boolean isDirectory();
+    }
+
+    /**
+     * A Consumer suitable for writing Entries from this Archive.
+     */
+    Consumer<Entry> defaultImageWriter(Path path, OutputStream out);
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java
new file mode 100644
index 00000000000..d09483839c1
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java
@@ -0,0 +1,239 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.jimage;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.IntBuffer;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class BasicImageReader {
+    private final String imagePath;
+    private final PReader preader;
+    private final ByteOrder byteOrder;
+    private final ImageHeader header;
+    private final int indexSize;
+    private final IntBuffer redirectBuffer;
+    private final IntBuffer offsetsBuffer;
+    private final ByteBuffer locationsBuffer;
+    private final ByteBuffer stringsBuffer;
+    private final ImageStrings strings;
+
+    protected BasicImageReader(String imagePath, ByteOrder byteOrder) throws IOException {
+        this.imagePath = imagePath;
+        this.preader = PReader.open(imagePath);
+        this.byteOrder = byteOrder;
+        this.header = ImageHeader.readFrom(byteOrder, getIntBuffer(0, ImageHeader.getHeaderSize()));
+        this.indexSize = header.getIndexSize();
+        this.redirectBuffer = getIntBuffer(header.getRedirectOffset(), header.getRedirectSize());
+        this.offsetsBuffer = getIntBuffer(header.getOffsetsOffset(), header.getOffsetsSize());
+        this.locationsBuffer = getByteBuffer(header.getLocationsOffset(), header.getLocationsSize());
+        this.stringsBuffer = getByteBuffer(header.getStringsOffset(), header.getStringsSize());
+        this.strings = new ImageStrings(new ImageStream(stringsBuffer));
+    }
+
+    protected BasicImageReader(String imagePath) throws IOException {
+        this(imagePath, ByteOrder.nativeOrder());
+    }
+
+    public static BasicImageReader open(String imagePath) throws IOException {
+        return new BasicImageReader(imagePath, ByteOrder.nativeOrder());
+    }
+
+    public String imagePath() {
+        return imagePath;
+    }
+
+    public boolean isOpen() {
+        return preader.isOpen();
+    }
+
+    public void close() throws IOException {
+        preader.close();
+    }
+
+    public ImageHeader getHeader() {
+        return header;
+    }
+
+    public ImageLocation findLocation(String name) {
+        return findLocation(new UTF8String(name));
+    }
+
+    public ImageLocation findLocation(byte[] name) {
+        return findLocation(new UTF8String(name));
+    }
+
+    public synchronized ImageLocation findLocation(UTF8String name) {
+        int count = header.getLocationCount();
+        int hash = name.hashCode() % count;
+        int redirect = getRedirect(hash);
+
+        if (redirect == 0) {
+            return null;
+        }
+
+        int index;
+
+        if (redirect < 0) {
+            // If no collision.
+            index = -redirect - 1;
+        } else {
+            // If collision, recompute hash code.
+            index = name.hashCode(redirect) % count;
+        }
+
+        int offset = getOffset(index);
+
+        if (offset == 0) {
+            return null;
+        }
+
+        ImageLocation location = getLocation(offset);
+
+        return location.verify(name) ? location : null;
+    }
+
+    public String[] getEntryNames() {
+        return getEntryNames(true);
+    }
+
+    public String[] getEntryNames(boolean sorted) {
+        int count = header.getLocationCount();
+        List<String> list = new ArrayList<>();
+
+        for (int i = 0; i < count; i++) {
+            int offset = getOffset(i);
+
+            if (offset != 0) {
+                ImageLocation location = ImageLocation.readFrom(locationsBuffer, offset, strings);
+                list.add(location.getFullnameString());
+            }
+        }
+
+        String[] array = list.toArray(new String[0]);
+
+        if (sorted) {
+            Arrays.sort(array);
+        }
+
+        return array;
+    }
+
+    protected ImageLocation[] getAllLocations(boolean sorted) {
+        int count = header.getLocationCount();
+        List<ImageLocation> list = new ArrayList<>();
+
+        for (int i = 0; i < count; i++) {
+            int offset = getOffset(i);
+
+            if (offset != 0) {
+                ImageLocation location = ImageLocation.readFrom(locationsBuffer, offset, strings);
+                list.add(location);
+            }
+        }
+
+        ImageLocation[] array = list.toArray(new ImageLocation[0]);
+
+        if (sorted) {
+            Arrays.sort(array, (ImageLocation loc1, ImageLocation loc2) ->
+                    loc1.getFullnameString().compareTo(loc2.getFullnameString()));
+        }
+
+        return array;
+    }
+
+    private IntBuffer getIntBuffer(long offset, long size) throws IOException {
+        MappedByteBuffer buffer = preader.channel().map(FileChannel.MapMode.READ_ONLY, offset, size);
+        buffer.order(byteOrder);
+
+        return buffer.asIntBuffer();
+    }
+
+    private ByteBuffer getByteBuffer(long offset, long size) throws IOException {
+        MappedByteBuffer buffer = preader.channel().map(FileChannel.MapMode.READ_ONLY, offset, size);
+        // order is not copied into the readonly copy.
+        ByteBuffer readOnly = buffer.asReadOnlyBuffer();
+        readOnly.order(byteOrder);
+        return readOnly;
+    }
+
+    private int getRedirect(int index) {
+        return redirectBuffer.get(index);
+    }
+
+    private int getOffset(int index) {
+        return offsetsBuffer.get(index);
+    }
+
+    private ImageLocation getLocation(int offset) {
+        return ImageLocation.readFrom(locationsBuffer, offset, strings);
+    }
+
+    public String getString(int offset) {
+        return strings.get(offset).toString();
+    }
+
+    public byte[] getResource(ImageLocation loc) throws IOException {
+        long compressedSize = loc.getCompressedSize();
+        assert compressedSize < Integer.MAX_VALUE;
+
+        if (compressedSize == 0) {
+            return preader.read((int)loc.getUncompressedSize(),
+                                indexSize + loc.getContentOffset());
+        } else {
+            byte[] buf = preader.read((int)compressedSize,
+                                      indexSize + loc.getContentOffset());
+            return ImageFile.Compressor.decompress(buf);
+        }
+    }
+
+    public byte[] getResource(String name) throws IOException {
+        ImageLocation location = findLocation(name);
+
+        return location != null ? getResource(location) : null;
+    }
+
+    public List<String> getNames(String name) throws IOException {
+        return getNames(getResource(name));
+    }
+
+    public List<String> getNames(byte[] bytes) {
+        IntBuffer buffer = ByteBuffer.wrap(bytes).asIntBuffer();
+        List<String> names = new ArrayList<>();
+
+        while (buffer.hasRemaining()) {
+            int offset = buffer.get();
+            names.add(getString(offset));
+        }
+
+        return names;
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageWriter.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageWriter.java
new file mode 100644
index 00000000000..b97cb40cd2f
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageWriter.java
@@ -0,0 +1,300 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+*/
+
+package jdk.internal.jimage;
+
+import java.io.PrintStream;
+import java.nio.ByteOrder;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public final class BasicImageWriter {
+    private final static int RETRY_LIMIT = 1000;
+
+    private ByteOrder byteOrder;
+    private ImageStrings strings;
+    private int count;
+    private int[] redirect;
+    private ImageLocation[] locations;
+    private List<ImageLocation> input;
+    private ImageStream headerStream;
+    private ImageStream redirectStream;
+    private ImageStream locationOffsetStream;
+    private ImageStream locationStream;
+    private ImageStream allIndexStream;
+
+    static class ImageBucket implements Comparable<ImageBucket> {
+        final List<ImageLocation> list;
+
+        ImageBucket() {
+            this.list = new ArrayList<>();
+        }
+
+        void add(ImageLocation location) {
+            list.add(location);
+        }
+
+        int getSize() {
+            return list.size();
+        }
+
+        List<ImageLocation> getList() {
+            return list;
+        }
+
+        ImageLocation getFirst() {
+            assert !list.isEmpty() : "bucket should never be empty";
+            return list.get(0);
+        }
+
+        @Override
+        public int hashCode() {
+            return getFirst().hashCode();
+        }
+
+        @Override
+        public boolean equals(Object obj) {
+            return this == obj;
+        }
+
+        @Override
+        public int compareTo(ImageBucket o) {
+            return o.getSize() - getSize();
+        }
+    }
+
+    public BasicImageWriter() {
+        this(ByteOrder.nativeOrder());
+    }
+
+    public BasicImageWriter(ByteOrder byteOrder) {
+        this.byteOrder = byteOrder;
+        this.input = new ArrayList<>();
+        this.strings = new ImageStrings();
+        this.headerStream = new ImageStream(byteOrder);
+        this.redirectStream = new ImageStream(byteOrder);
+        this.locationOffsetStream = new ImageStream(byteOrder);
+        this.locationStream = new ImageStream(byteOrder);
+        this.allIndexStream = new ImageStream(byteOrder);
+    }
+
+    public int addString(String string) {
+        return addString(new UTF8String(string));
+    }
+
+    public int addString(UTF8String string) {
+        return strings.add(string);
+    }
+
+    public void addLocation(String fullname, long contentOffset, long compressedSize, long uncompressedSize) {
+        ImageLocation location = ImageLocation.newLocation(new UTF8String(fullname), strings, contentOffset, compressedSize, uncompressedSize);
+        input.add(location);
+        count++;
+    }
+
+    private void generatePerfectHash() {
+        redo:
+        while(true) {
+            redirect = new int[count];
+            locations = new ImageLocation[count];
+
+            ImageBucket[] sorted = createBuckets();
+
+            int free = 0;
+
+            for (ImageBucket bucket : sorted) {
+                if (bucket.getSize() != 1) {
+                    if (!packCollidedEntries(bucket, count)) {
+                        count = (count + 1) | 1;
+
+                        continue redo;
+                    }
+                } else {
+                    for ( ; free < count && locations[free] != null; free++) {}
+                    assert free < count : "no free slots";
+                    locations[free] = bucket.getFirst();
+                    redirect[bucket.hashCode() % count] = -1 - free;
+                    free++;
+                }
+            }
+
+            break;
+        }
+    }
+
+    private ImageBucket[] createBuckets() {
+        ImageBucket[] buckets = new ImageBucket[count];
+
+        input.stream().forEach((location) -> {
+            int index = location.hashCode() % count;
+            ImageBucket bucket = buckets[index];
+
+            if (bucket == null) {
+                buckets[index] = bucket = new ImageBucket();
+            }
+
+            bucket.add(location);
+        });
+
+        ImageBucket[] sorted = Arrays.asList(buckets).stream()
+                .filter((bucket) -> (bucket != null))
+                .sorted()
+                .toArray(ImageBucket[]::new);
+
+        return sorted;
+    }
+
+    private boolean packCollidedEntries(ImageBucket bucket, int count) {
+        List<Integer> undo = new ArrayList<>();
+        int base = UTF8String.HASH_MULTIPLIER + 1;
+
+        int retry = 0;
+
+        redo:
+        while (true) {
+            for (ImageLocation location : bucket.getList()) {
+                int index = location.hashCode(base) % count;
+
+                if (locations[index] != null) {
+                    undo.stream().forEach((i) -> {
+                        locations[i] = null;
+                    });
+
+                    undo.clear();
+                    base++;
+
+                    if (base == 0) {
+                        base = 1;
+                    }
+
+                    if (++retry > RETRY_LIMIT) {
+                        return false;
+                    }
+
+                    continue redo;
+                }
+
+                locations[index] = location;
+                undo.add(index);
+            }
+
+            redirect[bucket.hashCode() % count] = base;
+
+            break;
+        }
+
+        return true;
+    }
+
+    private void prepareStringBytes() {
+        strings.getStream().align(2);
+    }
+
+    private void prepareRedirectBytes() {
+        for (int i = 0; i < count; i++) {
+            redirectStream.putInt(redirect[i]);
+        }
+    }
+
+    private void prepareLocationBytes() {
+        // Reserve location offset zero for empty locations
+        locationStream.put(ImageLocation.ATTRIBUTE_END << 3);
+
+        for (int i = 0; i < count; i++) {
+            ImageLocation location = locations[i];
+
+            if (location != null) {
+                location.writeTo(locationStream);
+            }
+        }
+
+        locationStream.align(2);
+    }
+
+    private void prepareOffsetBytes() {
+        for (int i = 0; i < count; i++) {
+            ImageLocation location = locations[i];
+            locationOffsetStream.putInt(location != null ? location.getLocationOffset() : 0);
+        }
+    }
+
+    private void prepareHeaderBytes() {
+        ImageHeader header = new ImageHeader(count, locationStream.getSize(), strings.getSize());
+        header.writeTo(headerStream);
+    }
+
+    private void prepareTableBytes() {
+        allIndexStream.put(headerStream);
+        allIndexStream.put(redirectStream);
+        allIndexStream.put(locationOffsetStream);
+        allIndexStream.put(locationStream);
+        allIndexStream.put(strings.getStream());
+    }
+
+    public byte[] getBytes() {
+        if (allIndexStream.getSize() == 0) {
+            generatePerfectHash();
+            prepareStringBytes();
+            prepareRedirectBytes();
+            prepareLocationBytes();
+            prepareOffsetBytes();
+            prepareHeaderBytes();
+            prepareTableBytes();
+        }
+
+        return allIndexStream.toArray();
+    }
+
+    ImageLocation find(UTF8String key) {
+        int index = key.hashCode() % count;
+        index = redirect[index];
+
+        if (index < 0) {
+            index = -index - 1;
+            ImageLocation location = locations[index];
+
+            return location;
+        } else {
+            index = key.hashCode(index) % count;
+            ImageLocation location = locations[index];
+
+            return location;
+        }
+    }
+
+    public void statistics() {
+        getBytes();
+        PrintStream out = System.out;
+        out.println("Count: " + count);
+        out.println("Header bytes size: " + headerStream.getSize());
+        out.println("Redirect bytes size: " + redirectStream.getSize());
+        out.println("Offset bytes size: " + locationOffsetStream.getSize());
+        out.println("Location bytes size: " + locationStream.getSize());
+        out.println("String count: " + strings.getCount());
+        out.println("String bytes size: " + strings.getSize());
+        out.println("Total bytes size: " + allIndexStream.getSize());
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageFile.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageFile.java
new file mode 100644
index 00000000000..6930ab80736
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageFile.java
@@ -0,0 +1,288 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.jimage;
+
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteOrder;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import java.util.zip.DataFormatException;
+import java.util.zip.Deflater;
+import java.util.zip.Inflater;
+import jdk.internal.jimage.ImageModules.Loader;
+import jdk.internal.jimage.ImageModules.ModuleIndex;
+
+/**
+ * An image (native endian.)
+ * <pre>{@code
+ * {
+ *   u4 magic;
+ *   u2 major_version;
+ *   u2 minor_version;
+ *   u4 location_count;
+ *   u4 location_attributes_size;
+ *   u4 strings_size;
+ *   u4 redirect[location_count];
+ *   u4 offsets[location_count];
+ *   u1 location_attributes[location_attributes_size];
+ *   u1 strings[strings_size];
+ *   u1 content[if !EOF];
+ * }
+ * }</pre>
+ */
+public final class ImageFile {
+    private static final String JAVA_BASE = "java.base";
+    private static final String IMAGE_EXT = ".jimage";
+    private static final String JAR_EXT = ".jar";
+    private final Path root;
+    private final Path mdir;
+    private final Map<String, List<Resource>> resourcesForModule = new HashMap<>();
+
+    private ImageFile(Path path) {
+        this.root = path;
+        this.mdir = root.resolve(path.getFileSystem().getPath("lib", "modules"));
+    }
+
+    public static ImageFile open(Path path) throws IOException {
+        ImageFile lib = new ImageFile(path);
+        return lib.open();
+    }
+
+    private ImageFile open() throws IOException {
+        Path path = mdir.resolve("bootmodules" + IMAGE_EXT);
+
+        ImageReader reader = new ImageReader(path.toString());
+        ImageHeader header = reader.getHeader();
+
+        if (header.getMagic() != ImageHeader.MAGIC) {
+            if (header.getMagic() == ImageHeader.BADMAGIC) {
+                throw new IOException(path + ": Image may be not be native endian");
+            } else {
+                throw new IOException(path + ": Invalid magic number");
+            }
+        }
+
+        if (header.getMajorVersion() > ImageHeader.MAJOR_VERSION ||
+            (header.getMajorVersion() == ImageHeader.MAJOR_VERSION &&
+             header.getMinorVersion() > ImageHeader.MINOR_VERSION)) {
+            throw new IOException("invalid version number");
+        }
+
+        return this;
+    }
+
+    public static ImageFile create(Path output,
+                                   Set<Archive> archives,
+                                   ImageModules modules)
+        throws IOException
+    {
+        return ImageFile.create(output, archives, modules, ByteOrder.nativeOrder());
+    }
+
+    public static ImageFile create(Path output,
+                                   Set<Archive> archives,
+                                   ImageModules modules,
+                                   ByteOrder byteOrder)
+        throws IOException
+    {
+        ImageFile lib = new ImageFile(output);
+        // get all resources
+        lib.readModuleEntries(modules, archives);
+        // write to modular image
+        lib.writeImage(modules, archives, byteOrder);
+        return lib;
+    }
+
+    private void writeImage(ImageModules modules,
+                            Set<Archive> archives,
+                            ByteOrder byteOrder)
+        throws IOException
+    {
+        // name to Archive file
+        Map<String, Archive> nameToArchive =
+            archives.stream()
+                  .collect(Collectors.toMap(Archive::moduleName, Function.identity()));
+
+        Files.createDirectories(mdir);
+        for (Loader l : Loader.values()) {
+            Set<String> mods = modules.getModules(l);
+
+            try (OutputStream fos = Files.newOutputStream(mdir.resolve(l.getName() + IMAGE_EXT));
+                    BufferedOutputStream bos = new BufferedOutputStream(fos);
+                    DataOutputStream out = new DataOutputStream(bos)) {
+                // store index in addition of the class loader map for boot loader
+                BasicImageWriter writer = new BasicImageWriter(byteOrder);
+                Set<String> duplicates = new HashSet<>();
+
+                // build package map for modules and add as resources
+                ModuleIndex mindex = modules.buildModuleIndex(l, writer);
+                long offset = mindex.size();
+
+                // the order of traversing the resources and the order of
+                // the module content being written must be the same
+                for (String mn : mods) {
+                    for (Resource res : resourcesForModule.get(mn)) {
+                        String path = res.name();
+                        long uncompressedSize = res.size();
+                        long compressedSize = res.csize();
+                        long onFileSize = compressedSize != 0 ? compressedSize : uncompressedSize;
+
+                        if (duplicates.contains(path)) {
+                            System.err.format("duplicate resource \"%s\", skipping%n", path);
+                            // TODO Need to hang bytes on resource and write from resource not zip.
+                            // Skipping resource throws off writing from zip.
+                            offset += onFileSize;
+                            continue;
+                        }
+                        duplicates.add(path);
+                        writer.addLocation(path, offset, compressedSize, uncompressedSize);
+                        offset += onFileSize;
+                    }
+                }
+
+                // write header and indices
+                byte[] bytes = writer.getBytes();
+                out.write(bytes, 0, bytes.length);
+
+                // write module table and packages
+                mindex.writeTo(out);
+
+                // write module content
+                for (String mn : mods) {
+                    writeModule(nameToArchive.get(mn), out);
+                }
+            }
+        }
+    }
+
+    private void readModuleEntries(ImageModules modules,
+                                   Set<Archive> archives)
+        throws IOException
+    {
+        for (Archive archive : archives) {
+            List<Resource> res = new ArrayList<>();
+            archive.visitResources(x-> res.add(x));
+
+            String mn = archive.moduleName();
+            resourcesForModule.put(mn, res);
+
+            Set<String> pkgs = res.stream().map(Resource::name)
+                    .filter(n -> n.endsWith(".class"))
+                    .map(this::toPackage)
+                    .distinct()
+                    .collect(Collectors.toSet());
+            modules.setPackages(mn, pkgs);
+        }
+    }
+
+    private String toPackage(String name) {
+        int index = name.lastIndexOf('/');
+        if (index > 0) {
+            return name.substring(0, index).replace('/', '.');
+        } else {
+            // ## unnamed package
+            System.err.format("Warning: %s in unnamed package%n", name);
+            return "";
+        }
+    }
+
+    private void writeModule(Archive archive,
+                             OutputStream out)
+        throws IOException
+    {
+          Consumer<Archive.Entry> consumer = archive.defaultImageWriter(root, out);
+          archive.visitEntries(consumer);
+    }
+
+
+    static class Compressor {
+        public static byte[] compress(byte[] bytesIn) {
+            Deflater deflater = new Deflater();
+            deflater.setInput(bytesIn);
+            ByteArrayOutputStream stream = new ByteArrayOutputStream(bytesIn.length);
+            byte[] buffer = new byte[1024];
+
+            deflater.finish();
+            while (!deflater.finished()) {
+                int count = deflater.deflate(buffer);
+                stream.write(buffer, 0, count);
+            }
+
+            try {
+                stream.close();
+            } catch (IOException ex) {
+                return bytesIn;
+            }
+
+            byte[] bytesOut = stream.toByteArray();
+            deflater.end();
+
+            return bytesOut;
+        }
+
+        public static byte[] decompress(byte[] bytesIn) {
+            Inflater inflater = new Inflater();
+            inflater.setInput(bytesIn);
+            ByteArrayOutputStream stream = new ByteArrayOutputStream(bytesIn.length);
+            byte[] buffer = new byte[1024];
+
+            while (!inflater.finished()) {
+                int count;
+
+                try {
+                    count = inflater.inflate(buffer);
+                } catch (DataFormatException ex) {
+                    return null;
+                }
+
+                stream.write(buffer, 0, count);
+            }
+
+            try {
+                stream.close();
+            } catch (IOException ex) {
+                return null;
+            }
+
+            byte[] bytesOut = stream.toByteArray();
+            inflater.end();
+
+            return bytesOut;
+        }
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageHeader.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageHeader.java
new file mode 100644
index 00000000000..25ffa046cf7
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageHeader.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+*/
+
+package jdk.internal.jimage;
+
+import java.nio.ByteOrder;
+import java.nio.IntBuffer;
+
+public final class ImageHeader {
+    public static final int MAGIC = 0xCAFEDADA;
+    public static final int BADMAGIC = 0xDADAFECA;
+    public static final short MAJOR_VERSION = 0;
+    public static final short MINOR_VERSION = 1;
+
+    private final int magic;
+    private final short majorVersion;
+    private final short minorVersion;
+    private final int locationCount;
+    private final int locationsSize;
+    private final int stringsSize;
+
+    ImageHeader(int locationCount, int locationsSize, int stringsSize) {
+        this(MAGIC, MAJOR_VERSION, MINOR_VERSION, locationCount, locationsSize, stringsSize);
+    }
+
+    ImageHeader(int magic, short majorVersion, short minorVersion, int locationCount,
+                int locationsSize, int stringsSize)
+    {
+        this.magic = magic;
+        this.majorVersion = majorVersion;
+        this.minorVersion = minorVersion;
+        this.locationCount = locationCount;
+        this.locationsSize = locationsSize;
+        this.stringsSize = stringsSize;
+    }
+
+    static int getHeaderSize() {
+       return 4 +
+              2 + 2 +
+              4 +
+              4 +
+              4;
+    }
+
+    static ImageHeader readFrom(ByteOrder byteOrder, IntBuffer buffer) {
+        int magic = buffer.get(0);
+        int version = buffer.get(1);
+        short majorVersion = (short)(byteOrder == ByteOrder.BIG_ENDIAN ?
+            version >>> 16 : (version & 0xFFFF));
+        short minorVersion = (short)(byteOrder == ByteOrder.BIG_ENDIAN ?
+            (version & 0xFFFF) : version >>> 16);
+        int locationCount = buffer.get(2);
+        int locationsSize = buffer.get(3);
+        int stringsSize = buffer.get(4);
+
+        return new ImageHeader(magic, majorVersion, minorVersion, locationCount,
+                               locationsSize, stringsSize);
+    }
+
+    void writeTo(ImageStream stream) {
+        stream.putInt(magic);
+        stream.putShort(majorVersion);
+        stream.putShort(minorVersion);
+        stream.putInt(locationCount);
+        stream.putInt(locationsSize);
+        stream.putInt(stringsSize);
+    }
+
+    public int getMagic() {
+        return magic;
+    }
+
+    public int getMajorVersion() {
+        return majorVersion;
+    }
+
+    public int getMinorVersion() {
+        return minorVersion;
+    }
+
+    public int getLocationCount() {
+        return locationCount;
+    }
+
+    public int getRedirectSize() {
+        return locationCount* 4;
+    }
+
+    public int getOffsetsSize() {
+        return locationCount* 4;
+    }
+
+    public int getLocationsSize() {
+        return locationsSize;
+    }
+
+    public int getStringsSize() {
+        return stringsSize;
+    }
+
+    public int getIndexSize() {
+        return getHeaderSize() +
+               getRedirectSize() +
+               getOffsetsSize() +
+               getLocationsSize() +
+               getStringsSize();
+    }
+
+    int getRedirectOffset() {
+        return getHeaderSize();
+    }
+
+    int getOffsetsOffset() {
+        return getRedirectOffset() +
+               getRedirectSize();
+    }
+
+    int getLocationsOffset() {
+        return getOffsetsOffset() +
+               getOffsetsSize();
+    }
+
+    int getStringsOffset() {
+        return getLocationsOffset() +
+               getLocationsSize();
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageLocation.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageLocation.java
new file mode 100644
index 00000000000..c641d29b0fb
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageLocation.java
@@ -0,0 +1,393 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage;
+
+import java.nio.ByteBuffer;
+
+public final class ImageLocation {
+    final static int ATTRIBUTE_END = 0;
+    final static int ATTRIBUTE_BASE = 1;
+    final static int ATTRIBUTE_PARENT = 2;
+    final static int ATTRIBUTE_EXTENSION = 3;
+    final static int ATTRIBUTE_OFFSET = 4;
+    final static int ATTRIBUTE_COMPRESSED = 5;
+    final static int ATTRIBUTE_UNCOMPRESSED = 6;
+    final static int ATTRIBUTE_COUNT = 7;
+
+    private int locationOffset;
+    private long[] attributes;
+    private byte[] bytes;
+    private final ImageStrings strings;
+
+    private ImageLocation(ImageStrings strings) {
+        this.strings = strings;
+    }
+
+    void writeTo(ImageStream stream) {
+        compress();
+        locationOffset = stream.getPosition();
+        stream.put(bytes, 0, bytes.length);
+    }
+
+    static ImageLocation readFrom(ByteBuffer locationsBuffer, int offset, ImageStrings strings) {
+        final long[] attributes = new long[ATTRIBUTE_COUNT];
+
+        for (int i = offset; true; ) {
+            int data = locationsBuffer.get(i++) & 0xFF;
+            int kind = attributeKind(data);
+            assert ATTRIBUTE_END <= kind && kind < ATTRIBUTE_COUNT : "Invalid attribute kind";
+
+            if (kind == ATTRIBUTE_END) {
+                break;
+            }
+
+            int length = attributeLength(data);
+            long value = 0;
+
+            for (int j = 0; j < length; j++) {
+                value <<= 8;
+                value |= locationsBuffer.get(i++) & 0xFF;
+            }
+
+            attributes[kind] = value;
+        }
+
+        ImageLocation location =  new ImageLocation(strings);
+        location.attributes = attributes;
+
+        return location;
+    }
+
+    private static int attributeLength(int data) {
+        return (data & 0x7) + 1;
+    }
+
+    private static int attributeKind(int data) {
+        return data >>> 3;
+    }
+
+    public boolean verify(UTF8String name) {
+        UTF8String match = UTF8String.match(name, getParent());
+
+        if (match == null) {
+            return false;
+        }
+
+        match = UTF8String.match(match, getBase());
+
+        if (match == null) {
+            return false;
+        }
+
+        match = UTF8String.match(match, getExtension());
+
+        return match != null && match.length() == 0;
+    }
+
+
+    long getAttribute(int kind) {
+        assert ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT : "Invalid attribute kind";
+        decompress();
+
+        return attributes[kind];
+    }
+
+    UTF8String getAttributeUTF8String(int kind) {
+        assert ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT : "Invalid attribute kind";
+        decompress();
+
+        return strings.get((int)attributes[kind]);
+    }
+
+    String getAttributeString(int kind) {
+        return getAttributeUTF8String(kind).toString();
+    }
+
+    ImageLocation addAttribute(int kind, long value) {
+        assert ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT : "Invalid attribute kind";
+        decompress();
+        attributes[kind] = value;
+        return this;
+    }
+
+    private void decompress() {
+        if (attributes == null) {
+            attributes = new long[ATTRIBUTE_COUNT];
+        }
+
+        if (bytes != null) {
+            for (int i = 0; i < bytes.length; ) {
+                int data = bytes[i++] & 0xFF;
+                int kind = attributeKind(data);
+
+                if (kind == ATTRIBUTE_END) {
+                    break;
+                }
+
+                assert ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT : "Invalid attribute kind";
+                int length = attributeLength(data);
+                long value = 0;
+
+                for (int j = 0; j < length; j++) {
+                    value <<= 8;
+                    value |= bytes[i++] & 0xFF;
+                }
+
+                 attributes[kind] = value;
+            }
+
+            bytes = null;
+        }
+    }
+
+    private void compress() {
+        if (bytes == null) {
+            ImageStream stream = new ImageStream(16);
+
+            for (int kind = ATTRIBUTE_END + 1; kind < ATTRIBUTE_COUNT; kind++) {
+                long value = attributes[kind];
+
+                if (value != 0) {
+                    int n = (63 - Long.numberOfLeadingZeros(value)) >> 3;
+                    stream.put((kind << 3) | n);
+
+                    for (int i = n; i >= 0; i--) {
+                        stream.put((int)(value >> (i << 3)));
+                    }
+                }
+            }
+
+            stream.put(ATTRIBUTE_END << 3);
+            bytes = stream.toArray();
+            attributes = null;
+        }
+    }
+
+    static ImageLocation newLocation(UTF8String fullname, ImageStrings strings, long contentOffset, long compressedSize, long uncompressedSize) {
+        UTF8String base;
+        UTF8String extension = extension(fullname);
+        int parentOffset = ImageStrings.EMPTY_OFFSET;
+        int extensionOffset = ImageStrings.EMPTY_OFFSET;
+        int baseOffset;
+
+        if (extension.length() != 0) {
+            UTF8String parent = parent(fullname);
+            base = base(fullname);
+            parentOffset = strings.add(parent);
+            extensionOffset = strings.add(extension);
+        } else {
+            base = fullname;
+        }
+
+        baseOffset = strings.add(base);
+
+        return new ImageLocation(strings)
+               .addAttribute(ATTRIBUTE_BASE, baseOffset)
+               .addAttribute(ATTRIBUTE_PARENT, parentOffset)
+               .addAttribute(ATTRIBUTE_EXTENSION, extensionOffset)
+               .addAttribute(ATTRIBUTE_OFFSET, contentOffset)
+               .addAttribute(ATTRIBUTE_COMPRESSED, compressedSize)
+               .addAttribute(ATTRIBUTE_UNCOMPRESSED, uncompressedSize);
+    }
+
+    @Override
+    public int hashCode() {
+        return getExtension().hashCode(getBase().hashCode(getParent().hashCode()));
+    }
+
+    int hashCode(int base) {
+        return getExtension().hashCode(getBase().hashCode(getParent().hashCode(base)));
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (this == obj) {
+            return true;
+        }
+
+        if (!(obj instanceof ImageLocation)) {
+            return false;
+        }
+
+        ImageLocation other = (ImageLocation)obj;
+
+        return getBaseOffset() == other.getBaseOffset() &&
+               getParentOffset() == other.getParentOffset() &&
+               getExtensionOffset() == other.getExtensionOffset();
+    }
+
+    static UTF8String parent(UTF8String fullname) {
+        int slash = fullname.lastIndexOf('/');
+
+        return slash == UTF8String.NOT_FOUND ? UTF8String.EMPTY_STRING : fullname.substring(0, slash + 1);
+    }
+
+    static UTF8String extension(UTF8String fullname) {
+        int dot = fullname.lastIndexOf('.');
+
+        return dot == UTF8String.NOT_FOUND ? UTF8String.EMPTY_STRING : fullname.substring(dot);
+    }
+
+    static UTF8String base(UTF8String fullname) {
+        int slash = fullname.lastIndexOf('/');
+
+        if (slash != UTF8String.NOT_FOUND) {
+            fullname = fullname.substring(slash + 1);
+        }
+
+        int dot = fullname.lastIndexOf('.');
+
+        if (dot != UTF8String.NOT_FOUND) {
+            fullname = fullname.substring(0, dot);
+        }
+
+        return fullname;
+    }
+
+    int getLocationOffset() {
+        return locationOffset;
+    }
+
+    UTF8String getBase() {
+        return getAttributeUTF8String(ATTRIBUTE_BASE);
+    }
+
+    public String getBaseString() {
+        return  getBase().toString();
+    }
+
+    int getBaseOffset() {
+        return (int)getAttribute(ATTRIBUTE_BASE);
+    }
+
+    UTF8String getParent() {
+        return getAttributeUTF8String(ATTRIBUTE_PARENT);
+    }
+
+    public String getParentString() {
+        return getParent().toString();
+    }
+
+    int getParentOffset() {
+        return (int)getAttribute(ATTRIBUTE_PARENT);
+    }
+
+    UTF8String getExtension() {
+        return getAttributeUTF8String(ATTRIBUTE_EXTENSION);
+    }
+
+    public String getExtensionString() {
+        return getExtension().toString();
+    }
+
+    int getExtensionOffset() {
+        return (int)getAttribute(ATTRIBUTE_EXTENSION);
+    }
+
+    UTF8String getName() {
+        return getBase().concat(getExtension());
+    }
+
+    String getNameString() {
+        return getName().toString();
+    }
+
+    UTF8String getFullname() {
+        return getParent().concat(getBase(), getExtension());
+    }
+
+    String getFullnameString() {
+        return getFullname().toString();
+    }
+
+    public long getContentOffset() {
+        return getAttribute(ATTRIBUTE_OFFSET);
+    }
+
+    public long getCompressedSize() {
+        return getAttribute(ATTRIBUTE_COMPRESSED);
+    }
+
+    public long getUncompressedSize() {
+        return getAttribute(ATTRIBUTE_UNCOMPRESSED);
+    }
+
+    @Override
+    public String toString() {
+        final StringBuilder sb = new StringBuilder();
+        decompress();
+
+        for (int kind = ATTRIBUTE_END + 1; kind < ATTRIBUTE_COUNT; kind++) {
+            long value = attributes[kind];
+
+            if (value == 0) {
+                continue;
+            }
+
+            switch (kind) {
+                case ATTRIBUTE_BASE:
+                    sb.append("Base: ");
+                    sb.append(value);
+                    sb.append(' ');
+                    sb.append(strings.get((int)value).toString());
+                    break;
+
+                case ATTRIBUTE_PARENT:
+                    sb.append("Parent: ");
+                    sb.append(value);
+                    sb.append(' ');
+                    sb.append(strings.get((int)value).toString());
+                    break;
+
+                case ATTRIBUTE_EXTENSION:
+                    sb.append("Extension: ");
+                    sb.append(value);
+                    sb.append(' ');
+                    sb.append(strings.get((int)value).toString());
+                    break;
+
+                case ATTRIBUTE_OFFSET:
+                    sb.append("Offset: ");
+                    sb.append(value);
+                    break;
+
+                case ATTRIBUTE_COMPRESSED:
+                    sb.append("Compressed: ");
+                    sb.append(value);
+                    break;
+
+                case ATTRIBUTE_UNCOMPRESSED:
+                    sb.append("Uncompressed: ");
+                    sb.append(value);
+                    break;
+           }
+
+           sb.append("; ");
+        }
+
+        return sb.toString();
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageModules.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageModules.java
new file mode 100644
index 00000000000..3c1e5d3c83b
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageModules.java
@@ -0,0 +1,180 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage;
+
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import static jdk.internal.jimage.PackageModuleMap.*;
+
+public class ImageModules {
+    protected final Map<Loader, LoaderModuleData> loaders = new LinkedHashMap<>();
+    protected final Map<String, Set<String>> localPkgs = new HashMap<>();
+
+    protected ImageModules() {}
+
+    public ImageModules(Set<String> bootModules,
+                        Set<String> extModules,
+                        Set<String> appModules) throws IOException {
+        mapModulesToLoader(Loader.BOOT_LOADER, bootModules);
+        mapModulesToLoader(Loader.EXT_LOADER, extModules);
+        mapModulesToLoader(Loader.APP_LOADER, appModules);
+    }
+
+    public Map<String, Set<String>> packages() {
+        return localPkgs;
+    }
+
+    // ## FIXME: should be package-private
+    // When jlink legacy format support is removed, it should
+    // use the package table in the jimage.
+    public void setPackages(String mn, Set<String> pkgs) {
+        localPkgs.put(mn, pkgs);
+    }
+
+    /*
+     * Returns the name of modules mapped to a given class loader in the image
+     */
+    public Set<String> getModules(Loader type) {
+        if (loaders.containsKey(type)) {
+            return loaders.get(type).modules();
+        } else {
+            return Collections.emptySet();
+        }
+    }
+
+    private void mapModulesToLoader(Loader loader, Set<String> modules) {
+        if (modules.isEmpty())
+            return;
+
+        // put java.base first
+        Set<String> mods = new LinkedHashSet<>();
+        modules.stream()
+               .filter(m -> m.equals("java.base"))
+               .forEach(mods::add);
+        modules.stream().sorted()
+               .filter(m -> !m.equals("java.base"))
+               .forEach(mods::add);
+        loaders.put(loader, new LoaderModuleData(loader, mods));
+    }
+
+    enum Loader {
+        BOOT_LOADER(0, "bootmodules"),
+        EXT_LOADER(1, "extmodules"),
+        APP_LOADER(2, "appmodules");  // ## may be more than 1 loader
+
+        final int id;
+        final String name;
+        Loader(int id, String name) {
+            this.id = id;
+            this.name = name;
+        }
+
+        String getName() {
+            return name;
+        }
+        static Loader get(int id) {
+            switch (id) {
+                case 0: return BOOT_LOADER;
+                case 1: return EXT_LOADER;
+                case 2: return APP_LOADER;
+                default:
+                    throw new IllegalArgumentException("invalid loader id: " + id);
+            }
+        }
+        public int id() { return id; }
+    }
+
+    public class LoaderModuleData {
+        private final Loader loader;
+        private final Set<String> modules;
+        LoaderModuleData(Loader loader, Set<String> modules) {
+            this.loader = loader;
+            this.modules = Collections.unmodifiableSet(modules);
+        }
+
+        Set<String> modules() {
+            return modules;
+        }
+        Loader loader() { return loader; }
+    }
+
+    ModuleIndex buildModuleIndex(Loader type, BasicImageWriter writer) {
+        return new ModuleIndex(getModules(type), writer);
+    }
+
+    /*
+     * Generate module name table and the package map as resources
+     * in the modular image
+     */
+    public class ModuleIndex {
+        final Map<String, Integer> moduleOffsets = new LinkedHashMap<>();
+        final Map<String, List<Integer>> packageOffsets = new HashMap<>();
+        final int size;
+        public ModuleIndex(Set<String> mods, BasicImageWriter writer) {
+            // module name offsets
+            writer.addLocation(MODULES_ENTRY, 0, 0, mods.size() * 4);
+            long offset = mods.size() * 4;
+            for (String mn : mods) {
+                moduleOffsets.put(mn, writer.addString(mn));
+                List<Integer> poffsets = localPkgs.get(mn).stream()
+                        .map(pn -> pn.replace('.', '/'))
+                        .map(writer::addString)
+                        .collect(Collectors.toList());
+                // package name offsets per module
+                String entry = mn + "/" + PACKAGES_ENTRY;
+                int bytes = poffsets.size() * 4;
+                writer.addLocation(entry, offset, 0, bytes);
+                offset += bytes;
+                packageOffsets.put(mn, poffsets);
+            }
+            this.size = (int) offset;
+        }
+
+        void writeTo(DataOutputStream out) throws IOException {
+            for (int moffset : moduleOffsets.values()) {
+                out.writeInt(moffset);
+            }
+            for (String mn : moduleOffsets.keySet()) {
+                for (int poffset : packageOffsets.get(mn)) {
+                    out.writeInt(poffset);
+                }
+            }
+        }
+
+        int size() {
+            return size;
+        }
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java
new file mode 100644
index 00000000000..d28da36fa2f
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java
@@ -0,0 +1,502 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.jimage;
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.net.URI;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.IntBuffer;
+import java.nio.file.Files;
+import java.nio.file.FileSystem;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.attribute.FileTime;
+import java.nio.file.Paths;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+
+public class ImageReader extends BasicImageReader {
+    // well-known strings needed for image file system.
+    static final UTF8String ROOT = new UTF8String("/");
+    static final UTF8String META_INF = new UTF8String("/META-INF");
+    static final UTF8String PACKAGES_OFFSETS = new UTF8String("packages.offsets");
+
+    // attributes of the .jimage file. jimage file does not contain
+    // attributes for the individual resources (yet). We use attributes
+    // of the jimage file itself (creation, modification, access times).
+    // Iniitalized lazily, see {@link #imageFileAttributes()}.
+    private BasicFileAttributes imageFileAttributes;
+
+    private final Map<String, String> packageMap;
+
+    // directory management implementation
+    private final Map<UTF8String, Node> nodes;
+    private volatile Directory rootDir;
+
+    ImageReader(String imagePath, ByteOrder byteOrder) throws IOException {
+        super(imagePath, byteOrder);
+        this.packageMap = PackageModuleMap.readFrom(this);
+        this.nodes = Collections.synchronizedMap(new HashMap<>());
+    }
+
+    ImageReader(String imagePath) throws IOException {
+        this(imagePath, ByteOrder.nativeOrder());
+    }
+
+    public static ImageReader open(String imagePath, ByteOrder byteOrder) throws IOException {
+        return new ImageReader(imagePath, byteOrder);
+    }
+
+    /**
+     * Opens the given file path as an image file, returning an {@code ImageReader}.
+     */
+    public static ImageReader open(String imagePath) throws IOException {
+        return open(imagePath, ByteOrder.nativeOrder());
+    }
+
+    @Override
+    public synchronized void close() throws IOException {
+        super.close();
+        clearNodes();
+    }
+
+    /**
+     * Return the module name that contains the given package name.
+     */
+    public String getModule(String pkg) {
+        return packageMap.get(pkg);
+    }
+
+    // jimage file does not store directory structure. We build nodes
+    // using the "path" strings found in the jimage file.
+    // Node can be a directory or a resource
+    public static abstract class Node {
+        private static final int ROOT_DIR = 0b0000_0000_0000_0001;
+        private static final int MODULE_DIR = 0b0000_0000_0000_0010;
+        private static final int METAINF_DIR = 0b0000_0000_0000_0100;
+        private static final int TOPLEVEL_PKG_DIR = 0b0000_0000_0000_1000;
+        private static final int HIDDEN = 0b0000_0000_0001_0000;
+
+        private int flags;
+        private final UTF8String name;
+        private final BasicFileAttributes fileAttrs;
+
+        Node(UTF8String name, BasicFileAttributes fileAttrs) {
+            assert name != null;
+            assert fileAttrs != null;
+            this.name = name;
+            this.fileAttrs = fileAttrs;
+        }
+
+        public final void setIsRootDir() {
+            flags |= ROOT_DIR;
+        }
+
+        public final boolean isRootDir() {
+            return (flags & ROOT_DIR) != 0;
+        }
+
+        public final void setIsModuleDir() {
+            flags |= MODULE_DIR;
+        }
+
+        public final boolean isModuleDir() {
+            return (flags & MODULE_DIR) != 0;
+        }
+
+        public final void setIsMetaInfDir() {
+            flags |= METAINF_DIR;
+        }
+
+        public final boolean isMetaInfDir() {
+            return (flags & METAINF_DIR) != 0;
+        }
+
+        public final void setIsTopLevelPackageDir() {
+            flags |= TOPLEVEL_PKG_DIR;
+        }
+
+        public final boolean isTopLevelPackageDir() {
+            return (flags & TOPLEVEL_PKG_DIR) != 0;
+        }
+
+        public final void setIsHidden() {
+            flags |= HIDDEN;
+        }
+
+        public final boolean isHidden() {
+            return (flags & HIDDEN) != 0;
+        }
+
+        public final boolean isVisible() {
+            return !isHidden();
+        }
+
+        public final UTF8String getName() {
+            return name;
+        }
+
+        public final BasicFileAttributes getFileAttributes() {
+            return fileAttrs;
+        }
+
+        public boolean isDirectory() {
+            return false;
+        }
+
+        public List<Node> getChildren() {
+            throw new IllegalArgumentException("not a directory: " + getNameString());
+        }
+
+        public boolean isResource() {
+            return false;
+        }
+
+        public ImageLocation getLocation() {
+            throw new IllegalArgumentException("not a resource: " + getNameString());
+        }
+
+        public long size() {
+            return 0L;
+        }
+
+        public long compressedSize() {
+            return 0L;
+        }
+
+        public String extension() {
+            return null;
+        }
+
+        public long contentOffset() {
+            return 0L;
+        }
+
+        public final FileTime creationTime() {
+            return fileAttrs.creationTime();
+        }
+
+        public final FileTime lastAccessTime() {
+            return fileAttrs.lastAccessTime();
+        }
+
+        public final FileTime lastModifiedTime() {
+            return fileAttrs.lastModifiedTime();
+        }
+
+        public final String getNameString() {
+            return name.toString();
+        }
+
+        @Override
+        public final String toString() {
+            return getNameString();
+        }
+
+        @Override
+        public final int hashCode() {
+            return name.hashCode();
+        }
+
+        @Override
+        public final boolean equals(Object other) {
+            if (this == other) {
+                return true;
+            }
+
+            if (other instanceof Node) {
+                return name.equals(((Node) other).name);
+            }
+
+            return false;
+        }
+    }
+
+    // directory node - directory has full path name without '/' at end.
+    public static final class Directory extends Node {
+        private final List<Node> children;
+
+        @SuppressWarnings("LeakingThisInConstructor")
+        Directory(Directory parent, UTF8String name, BasicFileAttributes fileAttrs) {
+            super(name, fileAttrs);
+            children = new ArrayList<>();
+            if (parent != null) {
+                parent.addChild(this);
+            }
+        }
+
+        @Override
+        public boolean isDirectory() {
+            return true;
+        }
+
+        public List<Node> getChildren() {
+            return Collections.unmodifiableList(children);
+        }
+
+        void addChild(Node node) {
+            children.add(node);
+        }
+
+        public void walk(Consumer<? super Node> consumer) {
+            consumer.accept(this);
+            for ( Node child : children ) {
+                if (child.isDirectory()) {
+                    ((Directory)child).walk(consumer);
+                } else {
+                    consumer.accept(child);
+                }
+            }
+        }
+    }
+
+    // "resource" is .class or any other resource (compressed/uncompressed) in a jimage.
+    // full path of the resource is the "name" of the resource.
+    public static class Resource extends Node {
+        private final ImageLocation loc;
+
+        @SuppressWarnings("LeakingThisInConstructor")
+        Resource(Directory parent, ImageLocation loc, BasicFileAttributes fileAttrs) {
+            this(parent, ROOT.concat(loc.getFullname()), loc, fileAttrs);
+        }
+
+        @SuppressWarnings("LeakingThisInConstructor")
+        Resource(Directory parent, UTF8String name, ImageLocation loc, BasicFileAttributes fileAttrs) {
+            super(name, fileAttrs);
+            this.loc = loc;
+            parent.addChild(this);
+        }
+
+        @Override
+        public boolean isResource() {
+            return true;
+        }
+
+        @Override
+        public ImageLocation getLocation() {
+            return loc;
+        }
+
+        @Override
+        public long size() {
+            return loc.getUncompressedSize();
+        }
+
+        @Override
+        public long compressedSize() {
+            return loc.getCompressedSize();
+        }
+
+        @Override
+        public String extension() {
+            return loc.getExtensionString();
+        }
+
+        @Override
+        public long contentOffset() {
+            return loc.getContentOffset();
+        }
+    }
+
+    // directory management interface
+    public Directory getRootDirectory() {
+        return buildRootDirectory();
+    }
+
+    public Node findNode(String name) {
+        return findNode(new UTF8String(name));
+    }
+
+    public Node findNode(byte[] name) {
+        return findNode(new UTF8String(name));
+    }
+
+    public synchronized Node findNode(UTF8String name) {
+        buildRootDirectory();
+        return nodes.get(name);
+    }
+
+    private synchronized void clearNodes() {
+        nodes.clear();
+        rootDir = null;
+    }
+
+    /**
+     * Returns the file attributes of the image file.
+     */
+    private BasicFileAttributes imageFileAttributes() {
+        BasicFileAttributes attrs = imageFileAttributes;
+        if (attrs == null) {
+            try {
+                Path file = Paths.get(imagePath());
+                attrs = Files.readAttributes(file, BasicFileAttributes.class);
+            } catch (IOException ioe) {
+                throw new UncheckedIOException(ioe);
+            }
+            imageFileAttributes = attrs;
+        }
+        return attrs;
+    }
+
+    private synchronized Directory buildRootDirectory() {
+        if (rootDir != null) {
+            return rootDir;
+        }
+
+        // FIXME no time information per resource in jimage file (yet?)
+        // we use file attributes of jimage itself.
+        // root directory
+        rootDir = new Directory(null, ROOT, imageFileAttributes());
+        rootDir.setIsRootDir();
+        nodes.put(rootDir.getName(), rootDir);
+
+        ImageLocation[] locs = getAllLocations(true);
+        for (ImageLocation loc : locs) {
+            UTF8String parent = loc.getParent();
+            // directory where this location goes as child
+            Directory dir;
+            if (parent == null || parent.isEmpty()) {
+                // top level entry under root
+                dir = rootDir;
+            } else {
+                int idx = parent.lastIndexOf('/');
+                assert idx != -1 : "invalid parent string";
+                UTF8String name = ROOT.concat(parent.substring(0, idx));
+                dir = (Directory) nodes.get(name);
+                if (dir == null) {
+                    // make all parent directories (as needed)
+                    dir = makeDirectories(parent);
+                }
+            }
+            Resource entry = new Resource(dir, loc, imageFileAttributes());
+            nodes.put(entry.getName(), entry);
+        }
+
+        Node metaInf = nodes.get(META_INF);
+        if (metaInf instanceof Directory) {
+            metaInf.setIsMetaInfDir();
+            ((Directory)metaInf).walk(Node::setIsHidden);
+        }
+
+        fillPackageModuleInfo();
+
+        return rootDir;
+    }
+
+    private Directory newDirectory(Directory parent, UTF8String name) {
+        Directory dir = new Directory(parent, name, imageFileAttributes());
+        nodes.put(dir.getName(), dir);
+        return dir;
+    }
+
+    private Directory makeDirectories(UTF8String parent) {
+        assert !parent.isEmpty() : "non empty parent expected";
+
+        int idx = parent.indexOf('/');
+        assert idx != -1 : "invalid parent string";
+        UTF8String name = ROOT.concat(parent.substring(0, idx));
+        Directory top = (Directory) nodes.get(name);
+        if (top == null) {
+            top = newDirectory(rootDir, name);
+        }
+        Directory last = top;
+        while ((idx = parent.indexOf('/', idx + 1)) != -1) {
+            name = ROOT.concat(parent.substring(0, idx));
+            Directory nextDir = (Directory) nodes.get(name);
+            if (nextDir == null) {
+                nextDir = newDirectory(last, name);
+            }
+            last = nextDir;
+        }
+
+        return last;
+    }
+
+    private void fillPackageModuleInfo() {
+        assert rootDir != null;
+
+        packageMap.entrySet().stream().sorted((x, y)->x.getKey().compareTo(y.getKey())).forEach((entry) -> {
+              UTF8String moduleName = new UTF8String("/" + entry.getValue());
+              UTF8String fullName = moduleName.concat(new UTF8String(entry.getKey() + "/"));
+              if (! nodes.containsKey(fullName)) {
+                  Directory module = (Directory) nodes.get(moduleName);
+                  assert module != null : "module directory missing " + moduleName;
+                  module.setIsModuleDir();
+
+                  // hide "packages.offsets" in module directories
+                  Node packagesOffsets = nodes.get(moduleName.concat(ROOT, PACKAGES_OFFSETS));
+                  if (packagesOffsets != null) {
+                      packagesOffsets.setIsHidden();
+                  }
+
+                  // package name without front '/'
+                  UTF8String pkgName = new UTF8String(entry.getKey() + "/");
+                  int idx = -1;
+                  Directory moduleSubDir = module;
+                  while ((idx = pkgName.indexOf('/', idx + 1)) != -1) {
+                      UTF8String subPkg = pkgName.substring(0, idx);
+                      UTF8String moduleSubDirName = moduleName.concat(ROOT, subPkg);
+                      Directory tmp = (Directory) nodes.get(moduleSubDirName);
+                      if (tmp == null) {
+                          moduleSubDir = newDirectory(moduleSubDir, moduleSubDirName);
+                      } else {
+                          moduleSubDir = tmp;
+                      }
+                  }
+                  // copy pkgDir "resources"
+                  Directory pkgDir = (Directory) nodes.get(ROOT.concat(pkgName.substring(0, pkgName.length() - 1)));
+                  pkgDir.setIsTopLevelPackageDir();
+                  pkgDir.walk(n -> n.setIsHidden());
+                  for (Node child : pkgDir.getChildren()) {
+                      if (child.isResource()) {
+                          ImageLocation loc = child.getLocation();
+                          BasicFileAttributes imageFileAttrs = child.getFileAttributes();
+                          UTF8String rsName = moduleName.concat(child.getName());
+                          Resource rs = new Resource(moduleSubDir, rsName, loc, imageFileAttrs);
+                          nodes.put(rs.getName(), rs);
+                      }
+                  }
+              }
+        });
+    }
+
+    public byte[] getResource(Node node) throws IOException {
+        if (node.isResource()) {
+            return super.getResource(node.getLocation());
+        }
+        throw new IOException("Not a resource: " + node);
+    }
+
+    public byte[] getResource(Resource rs) throws IOException {
+        return super.getResource(rs.getLocation());
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStream.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStream.java
new file mode 100644
index 00000000000..034e5b24224
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStream.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2014, 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 License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General 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 License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage;
+
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.util.Arrays;
+
+class ImageStream {
+    private ByteBuffer buffer;
+
+    ImageStream() {
+        this(1024, ByteOrder.nativeOrder());
+    }
+
+    ImageStream(int size) {
+        this(size, ByteOrder.nativeOrder());
+    }
+
+    ImageStream(byte[] bytes) {
+       this(bytes, ByteOrder.nativeOrder());
+    }
+
+    ImageStream(ByteOrder byteOrder) {
+        this(1024, byteOrder);
+    }
+
+    ImageStream(int size, ByteOrder byteOrder) {
+        buffer = ByteBuffer.allocate(size);
+        buffer.order(byteOrder);
+    }
+
+    ImageStream(byte[] bytes, ByteOrder byteOrder) {
+        buffer = ByteBuffer.wrap(bytes);
+        buffer.order(byteOrder);
+    }
+
+    ImageStream(ByteBuffer buffer) {
+        this.buffer = buffer;
+    }
+
+    ImageStream align(int alignment) {
+        int padding = (getSize() - 1) & ((1 << alignment) - 1);
+
+        for (int i = 0; i < padding; i++) {
+            put((byte)0);
+        }
+
+        return this;
+    }
+
+    private void ensure(int needs) {
+        assert 0 <= needs : "Negative needs";
+
+        if (needs > buffer.remaining()) {
+            byte[] bytes = buffer.array();
+            ByteOrder byteOrder = buffer.order();
+            int position = buffer.position();
+            int newSize = needs <= bytes.length ? bytes.length << 1 : position + needs;
+            buffer = ByteBuffer.allocate(newSize);
+            buffer.order(byteOrder);
+            buffer.put(bytes, 0, position);
+        }
+    }
+
+    boolean hasByte() {
+        return buffer.remaining() != 0;
+    }
+
+    boolean hasBytes(int needs) {
+        return needs <= buffer.remaining();
+    }
+
+    void skip(int n) {
+        assert 0 <= n : "Negative offset";
+        buffer.position(buffer.position() + n);
+    }
+
+    int get() {
+        return buffer.get() & 0xFF;
+    }
+
+    void get(byte bytes[], int offset, int size) {
+        buffer.get(bytes, offset, size);
+    }
+
+    int getShort() {
+        return buffer.getShort();
+    }
+
+    int getInt() {
+        return buffer.getInt();
+    }
+
+    long getLong() {
+        return buffer.getLong();
+    }
+
+    ImageStream put(byte byt) {
+        ensure(1);
+        buffer.put(byt);
+
+        return this;
+    }
+
+    ImageStream put(int byt) {
+        return put((byte)byt);
+    }
+
+    ImageStream put(byte bytes[], int offset, int size) {
+        ensure(size);
+        buffer.put(bytes, offset, size);
+
+        return this;
+    }
+
+    ImageStream put(ImageStream stream) {
+        put(stream.buffer.array(), 0, stream.buffer.position());
+
+        return this;
+    }
+
+    ImageStream putShort(short value) {
+        ensure(2);
+        buffer.putShort(value);
+
+        return this;
+    }
+
+    ImageStream putShort(int value) {
+        return putShort((short)value);
+    }
+
+    ImageStream putInt(int value) {
+        ensure(4);
+        buffer.putInt(value);
+
+        return this;
+    }
+
+    ImageStream putLong(long value) {
+        ensure(8);
+        buffer.putLong(value);
+
+        return this;
+    }
+
+    ByteBuffer getBuffer() {
+        return buffer;
+    }
+
+    int getPosition() {
+        return buffer.position();
+    }
+
+    int getSize() {
+        return buffer.position();
+    }
+
+    byte[] getBytes() {
+        return buffer.array();
+    }
+
+    void setPosition(int offset) {
+        buffer.position(offset);
+    }
+
+    byte[] toArray() {
+        return Arrays.copyOf(buffer.array(), buffer.position());
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStrings.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStrings.java
new file mode 100644
index 00000000000..11cb106b5fe
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageStrings.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage;
+
+import java.nio.ByteBuffer;
+import java.util.HashMap;
+
+class ImageStrings {
+    private static final int NOT_FOUND = -1;
+    static final int EMPTY_OFFSET = 0;
+
+    private final HashMap<UTF8String, Integer> stringToOffsetMap;
+    private final ImageStream stream;
+
+    ImageStrings() {
+        this.stringToOffsetMap = new HashMap<>();
+        this.stream = new ImageStream();
+
+        // Reserve 0 offset for empty string.
+        int offset = addString(UTF8String.EMPTY_STRING);
+        assert offset == 0 : "Empty string not zero offset";
+        // Reserve 1 offset for frequently used ".class".
+        addString(UTF8String.CLASS_STRING);
+    }
+
+    ImageStrings(ImageStream stream) {
+        this.stringToOffsetMap = new HashMap<>();
+        this.stream = stream;
+    }
+
+    private int addString(final UTF8String string) {
+        int offset = stream.getPosition();
+        string.writeTo(stream);
+        stream.put('\0');
+        stringToOffsetMap.put(string, offset);
+
+        return offset;
+    }
+
+    int add(final UTF8String string) {
+        int offset = find(string);
+
+        return offset == NOT_FOUND ? addString(string) : offset;
+    }
+
+    int find(final UTF8String string) {
+        Integer offset = stringToOffsetMap.get(string);
+
+        return offset != null ? offset : NOT_FOUND;
+    }
+
+    UTF8String get(int offset) {
+        ByteBuffer buffer = stream.getBuffer();
+        assert 0 <= offset && offset < buffer.capacity() : "String buffer offset out of range";
+        int zero = NOT_FOUND;
+        for (int i = offset; i < buffer.capacity(); i++) {
+            if (buffer.get(i) == '\0') {
+                zero = i;
+                break;
+            }
+        }
+        assert zero != UTF8String.NOT_FOUND;
+        int length = zero - offset;
+        byte[] bytes = new byte[length];
+        int mark = buffer.position();
+        buffer.position(offset);
+        buffer.get(bytes);
+        buffer.position(mark);
+
+        return new UTF8String(bytes, 0, length);
+    }
+
+    ImageStream getStream() {
+        return stream;
+    }
+
+    int getSize() {
+        return stream.getSize();
+    }
+
+    int getCount() {
+        return stringToOffsetMap.size();
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/PReader.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/PReader.java
new file mode 100644
index 00000000000..eca0295548f
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/PReader.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.channels.FileChannel;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+
+/**
+ * Supports reading a file from given positions (offsets) in the file.
+ */
+
+public abstract class PReader implements Closeable {
+    private final FileChannel fc;
+
+    protected PReader(FileChannel fc) {
+        this.fc = fc;
+    }
+
+    /**
+     * Returns the {@code FileChannel}.
+     */
+    final FileChannel channel() {
+        return fc;
+    }
+
+    /**
+     * Closes this {@code PReader} and the underlying file.
+     */
+    @Override
+    public final void close() throws IOException {
+        fc.close();
+    }
+
+    /**
+     * Returns {@code true} if this {@code PReader} and the underlying file is
+     * open.
+     */
+    public final boolean isOpen() {
+        return fc.isOpen();
+    }
+
+    /**
+     * Returns {@code len} bytes from a given position in the file. The bytes
+     * are returned as a byte array.
+     *
+     * @throws IOException if an I/O error occurs
+     */
+    public abstract byte[] read(int len, long position) throws IOException;
+
+    /**
+     * Opens the given file, returning a {@code PReader} to read from the file.
+     *
+     * @implNote Returns a {@code PReader} that supports concurrent pread operations
+     * if possible, otherwise a simple {@code PReader} that doesn't support
+     * concurrent operations.
+     */
+    static PReader open(String file) throws IOException {
+        Class<?> clazz;
+        try {
+            clazz = Class.forName("jdk.internal.jimage.concurrent.ConcurrentPReader");
+        } catch (ClassNotFoundException e) {
+            return new SimplePReader(file);
+        }
+        try {
+            Constructor<?> ctor = clazz.getConstructor(String.class);
+            return (PReader) ctor.newInstance(file);
+        } catch (InvocationTargetException e) {
+            Throwable cause = e.getCause();
+            if (cause instanceof IOException)
+                throw (IOException) cause;
+            if (cause instanceof Error)
+                throw (Error) cause;
+            if (cause instanceof RuntimeException)
+                throw (RuntimeException) cause;
+            throw new Error(e);
+        } catch (NoSuchMethodException | IllegalAccessException |
+                InstantiationException e) {
+            throw new InternalError(e);
+        }
+    }
+}
+
+/**
+ * Simple PReader implementation based on {@code RandomAccessFile}.
+ *
+ * @implNote This class cannot use FileChannel read methods to do the
+ * positional reads because FileChannel is interruptible.
+ */
+class SimplePReader extends PReader {
+    private final RandomAccessFile raf;
+
+    private SimplePReader(RandomAccessFile raf) throws IOException {
+        super(raf.getChannel());
+        this.raf = raf;
+    }
+
+    SimplePReader(String file) throws IOException {
+        this(new RandomAccessFile(file, "r"));
+    }
+
+    @Override
+    public byte[] read(int len, long position) throws IOException {
+        synchronized (this) {
+            byte[] bytes = new byte[len];
+            raf.seek(position);
+            int n = raf.read(bytes);
+            if (n != len)
+                throw new InternalError("short read, not handled yet");
+            return bytes;
+        }
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/PackageModuleMap.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/PackageModuleMap.java
new file mode 100644
index 00000000000..45e6d01bad6
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/PackageModuleMap.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.IntBuffer;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+// Utility to read module info from .jimage file.
+
+public final class PackageModuleMap {
+    private PackageModuleMap() {}
+
+    public static final String MODULES_ENTRY = "module/modules.offsets";
+    public static final String PACKAGES_ENTRY = "packages.offsets";
+
+    /*
+     * Returns a package-to-module map.
+     *
+     * The package name is in binary name format.
+     */
+    static Map<String,String> readFrom(ImageReader reader) throws IOException {
+        Map<String,String> result = new HashMap<>();
+        List<String> moduleNames = reader.getNames(MODULES_ENTRY);
+
+        for (String moduleName : moduleNames) {
+            List<String> packageNames = reader.getNames(moduleName + "/" + PACKAGES_ENTRY);
+
+            for (String packageName : packageNames) {
+                result.put(packageName, moduleName);
+            }
+        }
+        return result;
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/Resource.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/Resource.java
new file mode 100644
index 00000000000..f1e4d8f0ffa
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/Resource.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.jimage;
+
+/**
+ * Resource is a class or resource file.
+ */
+public class Resource {
+    private final String name;
+    private final long size;
+    private final long csize;
+
+    public Resource(String name, long size, long csize) {
+        this.name = name;
+        this.size = size;
+        this.csize = csize;
+    }
+
+    /**
+     * Returns the name of this entry.
+     */
+    public String name() {
+        return name;
+    }
+
+    /**
+     * Returns the number of uncompressed bytes for this entry.
+     */
+    public long size() {
+        return size;
+    }
+
+    /**
+     * Returns the number of compressed bytes for this entry; 0 if
+     * uncompressed.
+     */
+    public long csize() {
+        return csize;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("%s uncompressed size %d compressed size %d", name, size, csize);
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/UTF8String.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/UTF8String.java
new file mode 100644
index 00000000000..893a986df23
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/UTF8String.java
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage;
+
+import java.nio.charset.Charset;
+import java.util.Arrays;
+
+public final class UTF8String implements CharSequence {
+
+    // Same as StandardCharsets.UTF_8 without loading all of the standard charsets
+    static final Charset UTF_8 = Charset.forName("UTF-8");
+
+    static final int NOT_FOUND = -1;
+    static final int HASH_MULTIPLIER = 0x01000193;
+    static final UTF8String EMPTY_STRING  = new UTF8String("");
+    static final UTF8String CLASS_STRING  = new UTF8String(".class");
+
+    final byte[] bytes;
+    final int offset;
+    final int count;
+    int hashcode;
+
+    public UTF8String(byte[] bytes, int offset, int count) {
+        if (offset < 0 || count < 0 || (offset + count) > bytes.length) {
+            throw new IndexOutOfBoundsException("offset/count out of range");
+        }
+        this.bytes = bytes;
+        this.offset = offset;
+        this.count = count;
+        this.hashcode = -1;
+    }
+
+    public UTF8String(byte[] bytes, int offset) {
+        this(bytes, offset, bytes.length - offset);
+    }
+
+    public UTF8String(byte[] bytes) {
+        this(bytes, 0, bytes.length);
+    }
+
+    public UTF8String(String string) {
+        this(stringToBytes(string));
+    }
+
+    @Override
+    public int length() {
+        return count;
+    }
+
+    public boolean isEmpty() {
+        return count == 0;
+    }
+
+    public int byteAt(int index) {
+        return bytes[offset + index] & 0xFF;
+    }
+
+    public UTF8String concat(UTF8String s) {
+        int total = count + s.count;
+        byte[] combined = new byte[total];
+        System.arraycopy(bytes, offset, combined, 0, count);
+        System.arraycopy(s.bytes, s.offset, combined, count, s.count);
+
+        return new UTF8String(combined, 0, total);
+    }
+
+    public UTF8String concat(UTF8String... s) {
+        int total = count;
+
+        for (UTF8String i : s) {
+            total += i.count;
+        }
+
+        byte[] combined = new byte[total];
+        System.arraycopy(bytes, offset, combined, 0, count);
+        int next = count;
+
+        for (UTF8String i : s) {
+            System.arraycopy(i.bytes, i.offset, combined, next, i.count);
+            next += i.count;
+        }
+
+        return new UTF8String(combined, 0, total);
+    }
+
+    public UTF8String substring(int offset) {
+        return substring(offset, this.count - offset);
+    }
+
+    public UTF8String substring(int offset, int count) {
+        int newOffset = this.offset + offset;
+        return new UTF8String(bytes, newOffset, count);
+    }
+
+    public UTF8String trimToSize() {
+        return offset == 0 && bytes.length == count ? this :
+               new UTF8String(Arrays.copyOfRange(bytes, offset, offset + count));
+    }
+
+    public int indexOf(int ch) {
+        return indexOf(ch, 0);
+    }
+
+    public int indexOf(int ch, int start) {
+        for (int i = Math.max(start, 0); i < count; i++) {
+            if (byteAt(i) == ch) {
+                return i;
+            }
+        }
+
+        return NOT_FOUND;
+    }
+
+    public int lastIndexOf(int ch) {
+        return lastIndexOf(ch, count - 1);
+    }
+
+    public int lastIndexOf(int ch, int start) {
+        for (int i = Math.min(start, count); i > 0; i--) {
+            if (byteAt(i) == ch) {
+                return i;
+            }
+        }
+
+        return NOT_FOUND;
+    }
+
+    void writeTo(ImageStream buffer) {
+        buffer.put(bytes, offset, count);
+    }
+
+    static int hashCode(int seed, byte[] bytes, int offset, int count) {
+        for (int i = offset, limit = offset + count; i < limit; i++) {
+            seed = (seed * HASH_MULTIPLIER) ^ (bytes[i] & 0xFF);
+        }
+
+        return seed & 0x7FFFFFFF;
+    }
+
+    int hashCode(int base) {
+        return hashCode(base, bytes, offset, count);
+    }
+
+    @Override
+    public int hashCode() {
+        if (hashcode < 0) {
+            hashcode = hashCode(HASH_MULTIPLIER, bytes, offset, count);
+        }
+
+        return hashcode;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (obj == null) {
+            return false;
+        }
+
+        if (getClass() != obj.getClass()) {
+            return false;
+        }
+
+        return equals(this, (UTF8String)obj);
+    }
+
+    private static boolean equals(UTF8String a, UTF8String b) {
+        if (a == b) {
+            return true;
+        }
+
+        int count = a.count;
+
+        if (count != b.count) {
+            return false;
+        }
+
+        byte[] aBytes = a.bytes;
+        byte[] bBytes = b.bytes;
+        int aOffset = a.offset;
+        int bOffset = b.offset;
+
+        for (int i = 0; i < count; i++) {
+            if (aBytes[aOffset + i] != bBytes[bOffset + i]) {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    byte[] getBytes() {
+        if (offset != 0 || bytes.length != count) {
+            return Arrays.copyOfRange(bytes, offset, offset + count);
+        }
+
+        return bytes;
+    }
+
+    private static byte[] stringToBytes(String string) {
+        return string.getBytes(UTF_8);
+    }
+
+    @Override
+    public String toString() {
+        return new String(bytes, offset, count, UTF_8);
+    }
+
+    @Override
+    public char charAt(int index) {
+        int ch = byteAt(index);
+
+        return (ch & 0x80) != 0 ? (char)ch : '\0';
+    }
+
+    @Override
+    public CharSequence subSequence(int start, int end) {
+        return (CharSequence)substring(start, end - start);
+    }
+
+    static UTF8String match(UTF8String a, UTF8String b) {
+        int aCount = a.count;
+        int bCount = b.count;
+
+        if (aCount < bCount) {
+            return null;
+        }
+
+        byte[] aBytes = a.bytes;
+        byte[] bBytes = b.bytes;
+        int aOffset = a.offset;
+        int bOffset = b.offset;
+
+        for (int i = 0; i < bCount; i++) {
+            if (aBytes[aOffset + i] != bBytes[bOffset + i]) {
+                return null;
+            }
+        }
+
+        return new UTF8String(aBytes, aOffset + bCount, aCount - bCount);
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jimage/concurrent/ConcurrentPReader.java b/jdk/src/java.base/share/classes/jdk/internal/jimage/concurrent/ConcurrentPReader.java
new file mode 100644
index 00000000000..9904bed21bf
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/concurrent/ConcurrentPReader.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jimage.concurrent;
+
+import java.io.FileDescriptor;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import jdk.internal.jimage.PReader;
+
+import sun.misc.Unsafe;
+
+/**
+ * A PReader implementation that supports concurrent pread operations.
+ */
+public class ConcurrentPReader extends PReader {
+
+    private static final Unsafe UNSAFE = Unsafe.getUnsafe();
+    private static final long BA_OFFSET = (long) UNSAFE.arrayBaseOffset(byte[].class);
+
+    /**
+     * A temporary buffer that is cached on a per-thread basis.
+     */
+    private static class TemporaryBuffer {
+        static final ThreadLocal<TemporaryBuffer> CACHED_BUFFER =
+             new ThreadLocal<TemporaryBuffer>() {
+                @Override
+                protected TemporaryBuffer initialValue() { return null; }
+             };
+
+        static final TemporaryBuffer NOT_AVAILABLE = new TemporaryBuffer(0L, 0);
+
+        final long address;
+        final int size;
+
+        TemporaryBuffer(long address, int size) {
+            this.address = address;
+            this.size = size;
+        }
+
+        long address() { return address; }
+        int size() { return size; }
+
+        /**
+         * Returns the {@code TemporaryBuffer} for the current thread. The buffer
+         * is guaranteed to be of at least the given size. Returns {@code null}
+         * if a buffer cannot be cached for this thread.
+         */
+        static TemporaryBuffer get(int len) {
+            TemporaryBuffer buffer = CACHED_BUFFER.get();
+
+            // cached buffer large enough?
+            if (buffer != null && buffer.size() >= len) {
+                return buffer;
+            }
+
+            // if this is an InnocuousThread then don't return anything
+            if (buffer == NOT_AVAILABLE)
+                return null;
+
+            if (buffer != null) {
+                // replace buffer in cache with a larger buffer
+                long originalAddress = buffer.address();
+                long address = UNSAFE.allocateMemory(len);
+                buffer = new TemporaryBuffer(address, len);
+                CACHED_BUFFER.set(buffer);
+                UNSAFE.freeMemory(originalAddress);
+            } else {
+                // first usage.
+                if (Thread.currentThread() instanceof sun.misc.InnocuousThread) {
+                    buffer = NOT_AVAILABLE;
+                } else {
+                    long address = UNSAFE.allocateMemory(len);
+                    buffer = new TemporaryBuffer(address, len);
+                }
+                CACHED_BUFFER.set(buffer);
+            }
+            return buffer;
+        }
+    }
+
+    private final FileDescriptor fd;
+
+    private ConcurrentPReader(FileInputStream fis) throws IOException {
+        super(fis.getChannel());
+        this.fd = fis.getFD();
+    }
+
+    public ConcurrentPReader(String file) throws IOException {
+        this(new FileInputStream(file));
+    }
+
+    @Override
+    public byte[] read(int len, long position) throws IOException {
+        // need a temporary area of memory to read into
+        TemporaryBuffer buffer = TemporaryBuffer.get(len);
+        long address;
+        if (buffer == null) {
+            address = UNSAFE.allocateMemory(len);
+        } else {
+            address = buffer.address();
+        }
+        try {
+            int n = pread(fd, address, len, position);
+            if (n != len)
+                throw new InternalError("short read, not handled yet");
+            byte[] result = new byte[n];
+            UNSAFE.copyMemory(null, address, result, BA_OFFSET, len);
+            return result;
+        } finally {
+            if (buffer == null) {
+                UNSAFE.freeMemory(address);
+            }
+        }
+    }
+
+    private static native int pread(FileDescriptor fd, long address, int len, long pos)
+        throws IOException;
+
+    private static native void initIDs();
+
+    static {
+        System.loadLibrary("java");
+        initIDs();
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtDirectoryStream.java b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtDirectoryStream.java
new file mode 100644
index 00000000000..1ef500d95f9
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtDirectoryStream.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.nio.file.DirectoryStream;
+import java.nio.file.ClosedDirectoryStreamException;
+import java.nio.file.DirectoryIteratorException;
+import java.nio.file.NotDirectoryException;
+import java.nio.file.Path;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.io.IOException;
+
+final class JrtDirectoryStream implements DirectoryStream<Path> {
+    private final JrtFileSystem jrtfs;
+    private final byte[] path;
+    // prefix to be used for children of this directory
+    // so that child path are reported relatively (if needed)
+    private final String childPrefix;
+    private final DirectoryStream.Filter<? super Path> filter;
+    private volatile boolean isClosed;
+    private volatile Iterator<Path> itr;
+
+    JrtDirectoryStream(JrtPath jrtPath,
+                       DirectoryStream.Filter<? super java.nio.file.Path> filter)
+        throws IOException
+    {
+        this.jrtfs = jrtPath.getFileSystem();
+        this.path = jrtPath.getResolvedPath();
+        // sanity check
+        if (!jrtfs.isDirectory(path))
+            throw new NotDirectoryException(jrtPath.toString());
+
+        // absolute path and does not have funky chars in front like /./java.base
+        if (jrtPath.isAbsolute() && (path.length == jrtPath.getPathLength())) {
+            childPrefix = null;
+        } else {
+            // cases where directory content needs to modified with prefix
+            // like ./java.base, /./java.base, java.base and so on.
+            String dirName = jrtPath.toString();
+            int idx = dirName.indexOf(JrtFileSystem.getString(path).substring(1));
+            childPrefix = dirName.substring(0, idx);
+        }
+        this.filter = filter;
+    }
+
+    @Override
+    public synchronized Iterator<Path> iterator() {
+        if (isClosed)
+            throw new ClosedDirectoryStreamException();
+        if (itr != null)
+            throw new IllegalStateException("Iterator has already been returned");
+
+        try {
+            itr = jrtfs.iteratorOf(path, childPrefix);
+        } catch (IOException e) {
+            throw new IllegalStateException(e);
+        }
+        return new Iterator<Path>() {
+            /*
+             * next Path value to return from this iterator.
+             * null value means hasNext() not called yet
+             * or last hasNext() returned false or resulted
+             * in exception. If last hasNext() returned true,
+             * then this field has non-null value.
+             */
+            private Path next;
+
+            // get-and-clear and set-next by these methods
+            private Path getAndClearNext() {
+                assert next != null;
+                Path result = this.next;
+                this.next = null;
+                return result;
+            }
+
+            private void setNext(Path path) {
+                assert path != null;
+                this.next = path;
+            }
+
+            // if hasNext() returns true, 'next' field has non-null Path
+            @Override
+            public synchronized boolean hasNext() {
+                if (next != null) {
+                    return true;
+                }
+
+                if (isClosed) {
+                    return false;
+                }
+
+                if (filter == null) {
+                    if (itr.hasNext()) {
+                        setNext(itr.next());
+                        return true;
+                    } else {
+                        return false;
+                    }
+                } else {
+                    while (itr.hasNext()) {
+                        Path tmpPath = itr.next();
+                        try {
+                            if (filter.accept(tmpPath)) {
+                                setNext(tmpPath);
+                                return true;
+                            }
+                        } catch (IOException ioe) {
+                            throw new DirectoryIteratorException(ioe);
+                        }
+                    }
+
+                    return false;
+                }
+            }
+
+            @Override
+            public synchronized Path next() {
+                if (next != null) {
+                    return getAndClearNext();
+                }
+
+                if (isClosed) {
+                    throw new NoSuchElementException();
+                }
+
+                if (next == null && itr.hasNext()) {
+                    // missing hasNext() between next() calls.
+                    if (hasNext()) {
+                        return getAndClearNext();
+                    }
+                }
+
+                throw new NoSuchElementException();
+            }
+
+            @Override
+            public void remove() {
+                throw new UnsupportedOperationException();
+            }
+        };
+    }
+
+    @Override
+    public synchronized void close() throws IOException {
+        isClosed = true;
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileAttributeView.java b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileAttributeView.java
new file mode 100644
index 00000000000..cdcde909fe3
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileAttributeView.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.nio.file.attribute.*;
+import java.io.IOException;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+final class JrtFileAttributeView implements BasicFileAttributeView
+{
+    private static enum AttrID {
+        size,
+        creationTime,
+        lastAccessTime,
+        lastModifiedTime,
+        isDirectory,
+        isRegularFile,
+        isSymbolicLink,
+        isOther,
+        fileKey,
+        compressedSize,
+        extension
+    };
+
+    private final JrtPath path;
+    private final boolean isJrtView;
+
+    private JrtFileAttributeView(JrtPath path, boolean isJrtView) {
+        this.path = path;
+        this.isJrtView = isJrtView;
+    }
+
+    @SuppressWarnings("unchecked") // Cast to V
+    static <V extends FileAttributeView> V get(JrtPath path, Class<V> type) {
+        if (type == null)
+            throw new NullPointerException();
+        if (type == BasicFileAttributeView.class)
+            return (V)new JrtFileAttributeView(path, false);
+        if (type == JrtFileAttributeView.class)
+            return (V)new JrtFileAttributeView(path, true);
+        return null;
+    }
+
+    static JrtFileAttributeView get(JrtPath path, String type) {
+        if (type == null)
+            throw new NullPointerException();
+        if (type.equals("basic"))
+            return new JrtFileAttributeView(path, false);
+        if (type.equals("jjrt"))
+            return new JrtFileAttributeView(path, true);
+        return null;
+    }
+
+    @Override
+    public String name() {
+        return isJrtView ? "jjrt" : "basic";
+    }
+
+    @Override
+    public JrtFileAttributes readAttributes() throws IOException
+    {
+        return path.getAttributes();
+    }
+
+    @Override
+    public void setTimes(FileTime lastModifiedTime,
+                         FileTime lastAccessTime,
+                         FileTime createTime)
+        throws IOException
+    {
+        path.setTimes(lastModifiedTime, lastAccessTime, createTime);
+    }
+
+    void setAttribute(String attribute, Object value)
+        throws IOException
+    {
+        try {
+            if (AttrID.valueOf(attribute) == AttrID.lastModifiedTime)
+                setTimes ((FileTime)value, null, null);
+            if (AttrID.valueOf(attribute) == AttrID.lastAccessTime)
+                setTimes (null, (FileTime)value, null);
+            if (AttrID.valueOf(attribute) == AttrID.creationTime)
+                setTimes (null, null, (FileTime)value);
+            return;
+        } catch (IllegalArgumentException x) {}
+        throw new UnsupportedOperationException("'" + attribute +
+            "' is unknown or read-only attribute");
+    }
+
+    Map<String, Object> readAttributes(String attributes)
+        throws IOException
+    {
+        JrtFileAttributes jrtfas = readAttributes();
+        LinkedHashMap<String, Object> map = new LinkedHashMap<>();
+        if ("*".equals(attributes)) {
+            for (AttrID id : AttrID.values()) {
+                try {
+                    map.put(id.name(), attribute(id, jrtfas));
+                } catch (IllegalArgumentException x) {}
+            }
+        } else {
+            String[] as = attributes.split(",");
+            for (String a : as) {
+                try {
+                    map.put(a, attribute(AttrID.valueOf(a), jrtfas));
+                } catch (IllegalArgumentException x) {}
+            }
+        }
+        return map;
+    }
+
+    Object attribute(AttrID id, JrtFileAttributes jrtfas) {
+        switch (id) {
+        case size:
+            return jrtfas.size();
+        case creationTime:
+            return jrtfas.creationTime();
+        case lastAccessTime:
+            return jrtfas.lastAccessTime();
+        case lastModifiedTime:
+            return jrtfas.lastModifiedTime();
+        case isDirectory:
+            return jrtfas.isDirectory();
+        case isRegularFile:
+            return jrtfas.isRegularFile();
+        case isSymbolicLink:
+            return jrtfas.isSymbolicLink();
+        case isOther:
+            return jrtfas.isOther();
+        case fileKey:
+            return jrtfas.fileKey();
+        case compressedSize:
+            if (isJrtView)
+                return jrtfas.compressedSize();
+            break;
+        case extension:
+            if (isJrtView) {
+                return jrtfas.extension();
+            }
+            break;
+        }
+        return null;
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileAttributes.java b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileAttributes.java
new file mode 100644
index 00000000000..bfebbebcb31
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileAttributes.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.attribute.FileTime;
+import java.util.Formatter;
+import jdk.internal.jimage.ImageReader.Node;
+
+final class JrtFileAttributes implements BasicFileAttributes
+{
+    private final Node node;
+
+    JrtFileAttributes(Node node) {
+        this.node = node;
+    }
+
+    ///////// basic attributes ///////////
+    @Override
+    public FileTime creationTime() {
+        return node.creationTime();
+    }
+
+    @Override
+    public boolean isDirectory() {
+        return node.isDirectory();
+    }
+
+    @Override
+    public boolean isOther() {
+        return false;
+    }
+
+    @Override
+    public boolean isRegularFile() {
+        return !isDirectory();
+    }
+
+    @Override
+    public FileTime lastAccessTime() {
+        return node.lastAccessTime();
+    }
+
+    @Override
+    public FileTime lastModifiedTime() {
+        return node.lastModifiedTime();
+    }
+
+    @Override
+    public long size() {
+        return node.size();
+    }
+
+    @Override
+    public boolean isSymbolicLink() {
+        return false;
+    }
+
+    @Override
+    public Object fileKey() {
+        return null;
+    }
+
+    ///////// jrt entry attributes ///////////
+    public long compressedSize() {
+        return node.compressedSize();
+    }
+
+    public String extension() {
+        return node.extension();
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder sb = new StringBuilder(1024);
+        try (Formatter fm = new Formatter(sb)) {
+            if (creationTime() != null)
+                fm.format("    creationTime    : %tc%n", creationTime().toMillis());
+            else
+                fm.format("    creationTime    : null%n");
+
+            if (lastAccessTime() != null)
+                fm.format("    lastAccessTime  : %tc%n", lastAccessTime().toMillis());
+            else
+                fm.format("    lastAccessTime  : null%n");
+            fm.format("    lastModifiedTime: %tc%n", lastModifiedTime().toMillis());
+            fm.format("    isRegularFile   : %b%n", isRegularFile());
+            fm.format("    isDirectory     : %b%n", isDirectory());
+            fm.format("    isSymbolicLink  : %b%n", isSymbolicLink());
+            fm.format("    isOther         : %b%n", isOther());
+            fm.format("    fileKey         : %s%n", fileKey());
+            fm.format("    size            : %d%n", size());
+            fm.format("    compressedSize  : %d%n", compressedSize());
+            fm.format("    extension       : %s%n", extension());
+        }
+        return sb.toString();
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileStore.java b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileStore.java
new file mode 100644
index 00000000000..d0a57736652
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileStore.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.FileStore;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.nio.file.attribute.FileAttributeView;
+import java.nio.file.attribute.FileStoreAttributeView;
+import java.nio.file.attribute.BasicFileAttributeView;
+
+final class JrtFileStore extends FileStore {
+
+    private final JrtFileSystem jrtfs;
+
+    JrtFileStore(JrtPath jrtPath) {
+        this.jrtfs = jrtPath.getFileSystem();
+    }
+
+    @Override
+    public String name() {
+        return jrtfs.toString() + "/";
+    }
+
+    @Override
+    public String type() {
+        return "jrtfs";
+    }
+
+    @Override
+    public boolean isReadOnly() {
+        return jrtfs.isReadOnly();
+    }
+
+    @Override
+    public boolean supportsFileAttributeView(Class<? extends FileAttributeView> type) {
+        return (type == BasicFileAttributeView.class ||
+                type == JrtFileAttributeView.class);
+    }
+
+    @Override
+    public boolean supportsFileAttributeView(String name) {
+        return name.equals("basic") || name.equals("jrt");
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public <V extends FileStoreAttributeView> V getFileStoreAttributeView(Class<V> type) {
+        if (type == null)
+            throw new NullPointerException();
+        return (V)null;
+    }
+
+    @Override
+    public long getTotalSpace() throws IOException {
+         throw new UnsupportedOperationException("getTotalSpace");
+    }
+
+    @Override
+    public long getUsableSpace() throws IOException {
+         throw new UnsupportedOperationException("getUsableSpace");
+    }
+
+    @Override
+    public long getUnallocatedSpace() throws IOException {
+         throw new UnsupportedOperationException("getUnallocatedSpace");
+    }
+
+    @Override
+    public Object getAttribute(String attribute) throws IOException {
+         throw new UnsupportedOperationException("does not support " + attribute);
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java
new file mode 100644
index 00000000000..c5a719f56cf
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystem.java
@@ -0,0 +1,535 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package jdk.internal.jrtfs;
+
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+import java.nio.channels.*;
+import java.nio.charset.Charset;
+import java.nio.file.AccessMode;
+import java.nio.file.ClosedFileSystemException;
+import java.nio.file.CopyOption;
+import java.nio.file.FileStore;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystemException;
+import java.nio.file.FileSystemNotFoundException;
+import java.nio.file.Files;
+import java.nio.file.NoSuchFileException;
+import java.nio.file.NotDirectoryException;
+import java.nio.file.OpenOption;
+import java.nio.file.Path;
+import java.nio.file.PathMatcher;
+import java.nio.file.ReadOnlyFileSystemException;
+import java.nio.file.StandardCopyOption;
+import java.nio.file.StandardOpenOption;
+import java.nio.file.WatchService;
+import java.nio.file.attribute.FileAttribute;
+import java.nio.file.attribute.FileTime;
+import java.nio.file.attribute.UserPrincipalLookupService;
+import java.nio.file.spi.FileSystemProvider;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
+import jdk.internal.jimage.ImageReader;
+import jdk.internal.jimage.ImageReader.Node;
+import jdk.internal.jimage.UTF8String;
+
+/**
+ * A FileSystem built on System jimage files.
+ */
+class JrtFileSystem extends FileSystem {
+    private static final Charset UTF_8 = Charset.forName("UTF-8");
+    private final JrtFileSystemProvider provider;
+    // System image readers
+    private ImageReader bootImage;
+    private ImageReader extImage;
+    private ImageReader appImage;
+    // root path
+    private final JrtPath rootPath;
+    private volatile boolean isOpen;
+
+    private static void checkExists(Path path) {
+        if (Files.notExists(path)) {
+            throw new FileSystemNotFoundException(path.toString());
+        }
+    }
+
+    // open a .jimage and build directory structure
+    private static ImageReader openImage(Path path) throws IOException {
+        ImageReader image = ImageReader.open(path.toString());
+        image.getRootDirectory();
+        return image;
+    }
+
+    JrtFileSystem(JrtFileSystemProvider provider,
+            Map<String, ?> env)
+            throws IOException {
+        this.provider = provider;
+        checkExists(SystemImages.bootImagePath);
+        checkExists(SystemImages.extImagePath);
+        checkExists(SystemImages.appImagePath);
+
+        // open image files
+        this.bootImage = openImage(SystemImages.bootImagePath);
+        this.extImage = openImage(SystemImages.extImagePath);
+        this.appImage = openImage(SystemImages.appImagePath);
+
+        rootPath = new JrtPath(this, new byte[]{'/'});
+        isOpen = true;
+    }
+
+    @Override
+    public FileSystemProvider provider() {
+        return provider;
+    }
+
+    @Override
+    public String getSeparator() {
+        return "/";
+    }
+
+    @Override
+    public boolean isOpen() {
+        return isOpen;
+    }
+
+    @Override
+    public void close() throws IOException {
+        cleanup();
+    }
+
+    @Override
+    protected void finalize() {
+        try {
+            cleanup();
+        } catch (IOException ignored) {}
+    }
+
+    // clean up this file system - called from finalize and close
+    private void cleanup() throws IOException {
+        if (!isOpen) {
+            return;
+        }
+
+        synchronized(this) {
+            isOpen = false;
+
+            // close all image readers and null out
+            bootImage.close();
+            extImage.close();
+            appImage.close();
+            bootImage = null;
+            extImage = null;
+            appImage = null;
+        }
+    }
+
+    private void ensureOpen() throws IOException {
+        if (!isOpen) {
+            throw new ClosedFileSystemException();
+        }
+    }
+
+    @Override
+    public boolean isReadOnly() {
+        return true;
+    }
+
+    private ReadOnlyFileSystemException readOnly() {
+        return new ReadOnlyFileSystemException();
+    }
+
+    @Override
+    public Iterable<Path> getRootDirectories() {
+        ArrayList<Path> pathArr = new ArrayList<>();
+        pathArr.add(rootPath);
+        return pathArr;
+    }
+
+    JrtPath getRootPath() {
+        return rootPath;
+    }
+
+    @Override
+    public JrtPath getPath(String first, String... more) {
+        String path;
+        if (more.length == 0) {
+            path = first;
+        } else {
+            StringBuilder sb = new StringBuilder();
+            sb.append(first);
+            for (String segment : more) {
+                if (segment.length() > 0) {
+                    if (sb.length() > 0) {
+                        sb.append('/');
+                    }
+                    sb.append(segment);
+                }
+            }
+            path = sb.toString();
+        }
+        return new JrtPath(this, getBytes(path));
+    }
+
+    @Override
+    public UserPrincipalLookupService getUserPrincipalLookupService() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public WatchService newWatchService() {
+        throw new UnsupportedOperationException();
+    }
+
+    FileStore getFileStore(JrtPath path) {
+        return new JrtFileStore(path);
+    }
+
+    @Override
+    public Iterable<FileStore> getFileStores() {
+        ArrayList<FileStore> list = new ArrayList<>(1);
+        list.add(new JrtFileStore(new JrtPath(this, new byte[]{'/'})));
+        return list;
+    }
+
+    private static final Set<String> supportedFileAttributeViews
+            = Collections.unmodifiableSet(
+                    new HashSet<String>(Arrays.asList("basic", "jrt")));
+
+    @Override
+    public Set<String> supportedFileAttributeViews() {
+        return supportedFileAttributeViews;
+    }
+
+    @Override
+    public String toString() {
+        return "jrt:/";
+    }
+
+    private static final String GLOB_SYNTAX = "glob";
+    private static final String REGEX_SYNTAX = "regex";
+
+    @Override
+    public PathMatcher getPathMatcher(String syntaxAndInput) {
+        int pos = syntaxAndInput.indexOf(':');
+        if (pos <= 0 || pos == syntaxAndInput.length()) {
+            throw new IllegalArgumentException();
+        }
+        String syntax = syntaxAndInput.substring(0, pos);
+        String input = syntaxAndInput.substring(pos + 1);
+        String expr;
+        if (syntax.equals(GLOB_SYNTAX)) {
+            expr = JrtUtils.toRegexPattern(input);
+        } else {
+            if (syntax.equals(REGEX_SYNTAX)) {
+                expr = input;
+            } else {
+                throw new UnsupportedOperationException("Syntax '" + syntax
+                        + "' not recognized");
+            }
+        }
+        // return matcher
+        final Pattern pattern = Pattern.compile(expr);
+        return (Path path) -> pattern.matcher(path.toString()).matches();
+    }
+
+    static byte[] getBytes(String name) {
+        return name.getBytes(UTF_8);
+    }
+
+    static String getString(byte[] name) {
+        return new String(name, UTF_8);
+    }
+
+    private static class NodeAndImage {
+        final Node node;
+        final ImageReader image;
+
+        NodeAndImage(Node node, ImageReader image) {
+            this.node = node; this.image = image;
+        }
+
+        byte[] getResource() throws IOException {
+            return image.getResource(node);
+        }
+    }
+
+    private NodeAndImage findNode(byte[] path) throws IOException {
+        ImageReader image = bootImage;
+        Node node = bootImage.findNode(path);
+        if (node == null) {
+            image = extImage;
+            node = extImage.findNode(path);
+        }
+        if (node == null) {
+            image = appImage;
+            node = appImage.findNode(path);
+        }
+        if (node == null || node.isHidden()) {
+            throw new NoSuchFileException(getString(path));
+        }
+        return new NodeAndImage(node, image);
+    }
+
+    private NodeAndImage checkNode(byte[] path) throws IOException {
+        ensureOpen();
+        return findNode(path);
+    }
+
+    private NodeAndImage checkResource(byte[] path) throws IOException {
+        NodeAndImage ni = checkNode(path);
+        if (ni.node.isDirectory()) {
+            throw new FileSystemException(getString(path) + " is a directory");
+        }
+
+        assert ni.node.isResource() : "resource node expected here";
+        return ni;
+    }
+
+    // package private helpers
+    JrtFileAttributes getFileAttributes(byte[] path)
+            throws IOException {
+        NodeAndImage ni = checkNode(path);
+        return new JrtFileAttributes(ni.node);
+    }
+
+    void setTimes(byte[] path, FileTime mtime, FileTime atime, FileTime ctime)
+            throws IOException {
+        throw readOnly();
+    }
+
+    boolean exists(byte[] path) throws IOException {
+        ensureOpen();
+        try {
+            findNode(path);
+        } catch (NoSuchFileException exp) {
+            return false;
+        }
+        return true;
+    }
+
+    boolean isDirectory(byte[] path)
+            throws IOException {
+        ensureOpen();
+        NodeAndImage ni = checkNode(path);
+        return ni.node.isDirectory();
+    }
+
+    JrtPath toJrtPath(String path) {
+        return toJrtPath(getBytes(path));
+    }
+
+    JrtPath toJrtPath(byte[] path) {
+        return new JrtPath(this, path);
+    }
+
+    /**
+     * returns the list of child paths of the given directory "path"
+     *
+     * @param path name of the directory whose content is listed
+     * @param childPrefix prefix added to returned children names - may be null
+              in which case absolute child paths are returned
+     * @return iterator for child paths of the given directory path
+     */
+    Iterator<Path> iteratorOf(byte[] path, String childPrefix)
+            throws IOException {
+        NodeAndImage ni = checkNode(path);
+        if (!ni.node.isDirectory()) {
+            throw new NotDirectoryException(getString(path));
+        }
+
+        if (ni.node.isRootDir()) {
+            return rootDirIterator(path, childPrefix);
+        }
+
+        return nodesToIterator(toJrtPath(path), childPrefix, ni.node.getChildren());
+    }
+
+    private Iterator<Path> nodesToIterator(Path path, String childPrefix, List<Node> childNodes) {
+        List<Path> childPaths;
+        if (childPrefix == null) {
+            childPaths = childNodes.stream()
+                .filter(Node::isVisible)
+                .map(child -> toJrtPath(child.getNameString()))
+                .collect(Collectors.toCollection(ArrayList::new));
+        } else {
+            childPaths = childNodes.stream()
+                .filter(Node::isVisible)
+                .map(child -> toJrtPath(childPrefix + child.getNameString().substring(1)))
+                .collect(Collectors.toCollection(ArrayList::new));
+        }
+        return childPaths.iterator();
+    }
+
+    private List<Node> rootChildren;
+    private static void addRootDirContent(List<Node> dest, List<Node> src) {
+        for (Node n : src) {
+            // only module directories at the top level. Filter other stuff!
+            if (n.isModuleDir()) {
+                dest.add(n);
+            }
+        }
+    }
+
+    private synchronized void initRootChildren(byte[] path) {
+        if (rootChildren == null) {
+            rootChildren = new ArrayList<>();
+            addRootDirContent(rootChildren, bootImage.findNode(path).getChildren());
+            addRootDirContent(rootChildren, extImage.findNode(path).getChildren());
+            addRootDirContent(rootChildren, appImage.findNode(path).getChildren());
+        }
+    }
+
+    private Iterator<Path> rootDirIterator(byte[] path, String childPrefix) throws IOException {
+        initRootChildren(path);
+        return nodesToIterator(rootPath, childPrefix, rootChildren);
+    }
+
+    void createDirectory(byte[] dir, FileAttribute<?>... attrs)
+            throws IOException {
+        throw readOnly();
+    }
+
+    void copyFile(boolean deletesrc, byte[] src, byte[] dst, CopyOption... options)
+            throws IOException {
+        throw readOnly();
+    }
+
+    public void deleteFile(byte[] path, boolean failIfNotExists)
+            throws IOException {
+        throw readOnly();
+    }
+
+    OutputStream newOutputStream(byte[] path, OpenOption... options)
+            throws IOException {
+        throw readOnly();
+    }
+
+    private void checkOptions(Set<? extends OpenOption> options) {
+        // check for options of null type and option is an intance of StandardOpenOption
+        for (OpenOption option : options) {
+            if (option == null) {
+                throw new NullPointerException();
+            }
+            if (!(option instanceof StandardOpenOption)) {
+                throw new IllegalArgumentException();
+            }
+        }
+    }
+
+    // Returns an input stream for reading the contents of the specified
+    // file entry.
+    InputStream newInputStream(byte[] path) throws IOException {
+        final NodeAndImage ni = checkResource(path);
+        return new ByteArrayInputStream(ni.getResource());
+    }
+
+    SeekableByteChannel newByteChannel(byte[] path,
+            Set<? extends OpenOption> options,
+            FileAttribute<?>... attrs)
+            throws IOException {
+        checkOptions(options);
+        if (options.contains(StandardOpenOption.WRITE)
+                || options.contains(StandardOpenOption.APPEND)) {
+            throw readOnly();
+        }
+
+        NodeAndImage ni = checkResource(path);
+        byte[] buf = ni.getResource();
+        final ReadableByteChannel rbc
+                = Channels.newChannel(new ByteArrayInputStream(buf));
+        final long size = buf.length;
+        return new SeekableByteChannel() {
+            long read = 0;
+
+            @Override
+            public boolean isOpen() {
+                return rbc.isOpen();
+            }
+
+            @Override
+            public long position() throws IOException {
+                return read;
+            }
+
+            @Override
+            public SeekableByteChannel position(long pos)
+                    throws IOException {
+                throw new UnsupportedOperationException();
+            }
+
+            @Override
+            public int read(ByteBuffer dst) throws IOException {
+                int n = rbc.read(dst);
+                if (n > 0) {
+                    read += n;
+                }
+                return n;
+            }
+
+            @Override
+            public SeekableByteChannel truncate(long size)
+                    throws IOException {
+                throw new NonWritableChannelException();
+            }
+
+            @Override
+            public int write(ByteBuffer src) throws IOException {
+                throw new NonWritableChannelException();
+            }
+
+            @Override
+            public long size() throws IOException {
+                return size;
+            }
+
+            @Override
+            public void close() throws IOException {
+                rbc.close();
+            }
+        };
+    }
+
+    // Returns a FileChannel of the specified path.
+    FileChannel newFileChannel(byte[] path,
+            Set<? extends OpenOption> options,
+            FileAttribute<?>... attrs)
+            throws IOException {
+        throw new UnsupportedOperationException("newFileChannel");
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystemProvider.java b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystemProvider.java
new file mode 100644
index 00000000000..a756d941e0a
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtFileSystemProvider.java
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.io.*;
+import java.nio.channels.*;
+import java.nio.file.*;
+import java.nio.file.DirectoryStream.Filter;
+import java.nio.file.attribute.*;
+import java.nio.file.spi.FileSystemProvider;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ExecutorService;
+
+public final class JrtFileSystemProvider extends FileSystemProvider {
+    private volatile FileSystem theFileSystem;
+
+    public JrtFileSystemProvider() { }
+
+    @Override
+    public String getScheme() {
+        return "jrt";
+    }
+
+    /**
+     * Need FilePermission ${java.home}/-", "read" to create or get jrt:/
+     */
+    private void checkPermission() {
+        SecurityManager sm = System.getSecurityManager();
+        if (sm != null) {
+            String home = SystemImages.RUNTIME_HOME;
+            FilePermission perm =
+                new FilePermission(home + File.separator + "-", "read");
+            sm.checkPermission(perm);
+        }
+    }
+
+    private void checkUri(URI uri) {
+        if (!uri.getScheme().equalsIgnoreCase(getScheme()))
+            throw new IllegalArgumentException("URI does not match this provider");
+        if (uri.getAuthority() != null)
+            throw new IllegalArgumentException("Authority component present");
+        if (uri.getPath() == null)
+            throw new IllegalArgumentException("Path component is undefined");
+        if (!uri.getPath().equals("/"))
+            throw new IllegalArgumentException("Path component should be '/'");
+        if (uri.getQuery() != null)
+            throw new IllegalArgumentException("Query component present");
+        if (uri.getFragment() != null)
+            throw new IllegalArgumentException("Fragment component present");
+    }
+
+    @Override
+    public FileSystem newFileSystem(URI uri, Map<String, ?> env)
+        throws IOException
+    {
+        checkPermission();
+        checkUri(uri);
+        return new JrtFileSystem(this, env);
+    }
+
+    @Override
+    public Path getPath(URI uri) {
+        checkPermission();
+        if (!uri.getScheme().equalsIgnoreCase(getScheme()))
+            throw new IllegalArgumentException("URI does not match this provider");
+        if (uri.getAuthority() != null)
+            throw new IllegalArgumentException("Authority component present");
+        if (uri.getQuery() != null)
+            throw new IllegalArgumentException("Query component present");
+        if (uri.getFragment() != null)
+            throw new IllegalArgumentException("Fragment component present");
+        String path = uri.getPath();
+        if (path == null || path.charAt(0) != '/')
+            throw new IllegalArgumentException("Invalid path component");
+        return getTheFileSystem().getPath(path);
+    }
+
+    private FileSystem getTheFileSystem() {
+        checkPermission();
+        FileSystem fs = this.theFileSystem;
+        if (fs == null) {
+            synchronized (this) {
+                fs = this.theFileSystem;
+                if (fs == null) {
+                    try {
+                        this.theFileSystem = fs = new JrtFileSystem(this, null) {
+                            @Override public void close() {
+                                throw new UnsupportedOperationException();
+                            }
+                        };
+                    } catch (IOException ioe) {
+                        throw new InternalError(ioe);
+                    }
+                }
+            }
+        }
+        return fs;
+    }
+
+    @Override
+    public FileSystem getFileSystem(URI uri) {
+        checkPermission();
+        checkUri(uri);
+        return getTheFileSystem();
+    }
+
+    // Checks that the given file is a JrtPath
+    static final JrtPath toJrtPath(Path path) {
+        if (path == null)
+            throw new NullPointerException();
+        if (!(path instanceof JrtPath))
+            throw new ProviderMismatchException();
+        return (JrtPath)path;
+    }
+
+    @Override
+    public void checkAccess(Path path, AccessMode... modes) throws IOException {
+        toJrtPath(path).checkAccess(modes);
+    }
+
+    @Override
+    public void copy(Path src, Path target, CopyOption... options)
+        throws IOException
+    {
+        toJrtPath(src).copy(toJrtPath(target), options);
+    }
+
+    @Override
+    public void createDirectory(Path path, FileAttribute<?>... attrs)
+        throws IOException
+    {
+        toJrtPath(path).createDirectory(attrs);
+    }
+
+    @Override
+    public final void delete(Path path) throws IOException {
+        toJrtPath(path).delete();
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public <V extends FileAttributeView> V
+        getFileAttributeView(Path path, Class<V> type, LinkOption... options)
+    {
+        return JrtFileAttributeView.get(toJrtPath(path), type);
+    }
+
+    @Override
+    public FileStore getFileStore(Path path) throws IOException {
+        return toJrtPath(path).getFileStore();
+    }
+
+    @Override
+    public boolean isHidden(Path path) {
+        return toJrtPath(path).isHidden();
+    }
+
+    @Override
+    public boolean isSameFile(Path path, Path other) throws IOException {
+        return toJrtPath(path).isSameFile(other);
+    }
+
+    @Override
+    public void move(Path src, Path target, CopyOption... options)
+        throws IOException
+    {
+        toJrtPath(src).move(toJrtPath(target), options);
+    }
+
+    @Override
+    public AsynchronousFileChannel newAsynchronousFileChannel(Path path,
+            Set<? extends OpenOption> options,
+            ExecutorService exec,
+            FileAttribute<?>... attrs)
+            throws IOException
+    {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public SeekableByteChannel newByteChannel(Path path,
+                                              Set<? extends OpenOption> options,
+                                              FileAttribute<?>... attrs)
+        throws IOException
+    {
+        return toJrtPath(path).newByteChannel(options, attrs);
+    }
+
+    @Override
+    public DirectoryStream<Path> newDirectoryStream(
+        Path path, Filter<? super Path> filter) throws IOException
+    {
+        return toJrtPath(path).newDirectoryStream(filter);
+    }
+
+    @Override
+    public FileChannel newFileChannel(Path path,
+                                      Set<? extends OpenOption> options,
+                                      FileAttribute<?>... attrs)
+        throws IOException
+    {
+        return toJrtPath(path).newFileChannel(options, attrs);
+    }
+
+    @Override
+    public InputStream newInputStream(Path path, OpenOption... options)
+        throws IOException
+    {
+        return toJrtPath(path).newInputStream(options);
+    }
+
+    @Override
+    public OutputStream newOutputStream(Path path, OpenOption... options)
+        throws IOException
+    {
+        return toJrtPath(path).newOutputStream(options);
+    }
+
+    @Override
+    @SuppressWarnings("unchecked") // Cast to A
+    public <A extends BasicFileAttributes> A
+        readAttributes(Path path, Class<A> type, LinkOption... options)
+        throws IOException
+    {
+        if (type == BasicFileAttributes.class || type == JrtFileAttributes.class)
+            return (A)toJrtPath(path).getAttributes();
+        return null;
+    }
+
+    @Override
+    public Map<String, Object>
+        readAttributes(Path path, String attribute, LinkOption... options)
+        throws IOException
+    {
+        return toJrtPath(path).readAttributes(attribute, options);
+    }
+
+    @Override
+    public void setAttribute(Path path, String attribute,
+                             Object value, LinkOption... options)
+        throws IOException
+    {
+        toJrtPath(path).setAttribute(attribute, value, options);
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java
new file mode 100644
index 00000000000..3f25b9092ed
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtPath.java
@@ -0,0 +1,855 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.io.*;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.nio.channels.*;
+import java.nio.file.*;
+import java.nio.file.DirectoryStream.Filter;
+import java.nio.file.attribute.*;
+import java.util.*;
+import static java.nio.file.StandardOpenOption.*;
+import static java.nio.file.StandardCopyOption.*;
+
+final class JrtPath implements Path {
+
+    private final JrtFileSystem jrtfs;
+    private final byte[] path;
+    private volatile int[] offsets;
+    private int hashcode = 0;  // cached hashcode (created lazily)
+
+    JrtPath(JrtFileSystem jrtfs, byte[] path) {
+        this(jrtfs, path, false);
+    }
+
+    JrtPath(JrtFileSystem jrtfs, byte[] path, boolean normalized) {
+        this.jrtfs = jrtfs;
+        if (normalized)
+            this.path = path;
+        else
+            this.path = normalize(path);
+    }
+
+    @Override
+    public JrtPath getRoot() {
+        if (this.isAbsolute())
+            return jrtfs.getRootPath();
+        else
+            return null;
+    }
+
+    @Override
+    public Path getFileName() {
+        initOffsets();
+        int count = offsets.length;
+        if (count == 0)
+            return null;  // no elements so no name
+        if (count == 1 && path[0] != '/')
+            return this;
+        int lastOffset = offsets[count-1];
+        int len = path.length - lastOffset;
+        byte[] result = new byte[len];
+        System.arraycopy(path, lastOffset, result, 0, len);
+        return new JrtPath(jrtfs, result);
+    }
+
+    @Override
+    public JrtPath getParent() {
+        initOffsets();
+        int count = offsets.length;
+        if (count == 0)    // no elements so no parent
+            return null;
+        int len = offsets[count-1] - 1;
+        if (len <= 0)      // parent is root only (may be null)
+            return getRoot();
+        byte[] result = new byte[len];
+        System.arraycopy(path, 0, result, 0, len);
+        return new JrtPath(jrtfs, result);
+    }
+
+    @Override
+    public int getNameCount() {
+        initOffsets();
+        return offsets.length;
+    }
+
+    @Override
+    public JrtPath getName(int index) {
+        initOffsets();
+        if (index < 0 || index >= offsets.length)
+            throw new IllegalArgumentException();
+        int begin = offsets[index];
+        int len;
+        if (index == (offsets.length-1))
+            len = path.length - begin;
+        else
+            len = offsets[index+1] - begin - 1;
+        // construct result
+        byte[] result = new byte[len];
+        System.arraycopy(path, begin, result, 0, len);
+        return new JrtPath(jrtfs, result);
+    }
+
+    @Override
+    public JrtPath subpath(int beginIndex, int endIndex) {
+        initOffsets();
+        if (beginIndex < 0 ||
+            beginIndex >=  offsets.length ||
+            endIndex > offsets.length ||
+            beginIndex >= endIndex)
+            throw new IllegalArgumentException();
+
+        // starting offset and length
+        int begin = offsets[beginIndex];
+        int len;
+        if (endIndex == offsets.length)
+            len = path.length - begin;
+        else
+            len = offsets[endIndex] - begin - 1;
+        // construct result
+        byte[] result = new byte[len];
+        System.arraycopy(path, begin, result, 0, len);
+        return new JrtPath(jrtfs, result);
+    }
+
+    @Override
+    public JrtPath toRealPath(LinkOption... options) throws IOException {
+        JrtPath realPath = new JrtPath(jrtfs, getResolvedPath()).toAbsolutePath();
+        realPath.checkAccess();
+        return realPath;
+    }
+
+    boolean isHidden() {
+        return false;
+    }
+
+    @Override
+    public JrtPath toAbsolutePath() {
+        if (isAbsolute()) {
+            return this;
+        } else {
+            //add / bofore the existing path
+            byte[] tmp = new byte[path.length + 1];
+            tmp[0] = '/';
+            System.arraycopy(path, 0, tmp, 1, path.length);
+            return (JrtPath) new JrtPath(jrtfs, tmp).normalize();
+        }
+    }
+
+    @Override
+    public URI toUri() {
+        try {
+            return new URI("jrt",
+                           JrtFileSystem.getString(toAbsolutePath().path),
+                           null);
+        } catch (URISyntaxException ex) {
+            throw new AssertionError(ex);
+        }
+    }
+
+    private boolean equalsNameAt(JrtPath other, int index) {
+        int mbegin = offsets[index];
+        int mlen;
+        if (index == (offsets.length-1))
+            mlen = path.length - mbegin;
+        else
+            mlen = offsets[index + 1] - mbegin - 1;
+        int obegin = other.offsets[index];
+        int olen;
+        if (index == (other.offsets.length - 1))
+            olen = other.path.length - obegin;
+        else
+            olen = other.offsets[index + 1] - obegin - 1;
+        if (mlen != olen)
+            return false;
+        int n = 0;
+        while(n < mlen) {
+            if (path[mbegin + n] != other.path[obegin + n])
+                return false;
+            n++;
+        }
+        return true;
+    }
+
+    @Override
+    public Path relativize(Path other) {
+        final JrtPath o = checkPath(other);
+        if (o.equals(this))
+            return new JrtPath(getFileSystem(), new byte[0], true);
+        if (/* this.getFileSystem() != o.getFileSystem() || */
+            this.isAbsolute() != o.isAbsolute()) {
+            throw new IllegalArgumentException();
+        }
+        int mc = this.getNameCount();
+        int oc = o.getNameCount();
+        int n = Math.min(mc, oc);
+        int i = 0;
+        while (i < n) {
+            if (!equalsNameAt(o, i))
+                break;
+            i++;
+        }
+        int dotdots = mc - i;
+        int len = dotdots * 3 - 1;
+        if (i < oc)
+            len += (o.path.length - o.offsets[i] + 1);
+        byte[] result = new byte[len];
+
+        int pos = 0;
+        while (dotdots > 0) {
+            result[pos++] = (byte)'.';
+            result[pos++] = (byte)'.';
+            if (pos < len)       // no tailing slash at the end
+                result[pos++] = (byte)'/';
+            dotdots--;
+        }
+        if (i < oc)
+            System.arraycopy(o.path, o.offsets[i],
+                             result, pos,
+                             o.path.length - o.offsets[i]);
+        return new JrtPath(getFileSystem(), result);
+    }
+
+    @Override
+    public JrtFileSystem getFileSystem() {
+        return jrtfs;
+    }
+
+    @Override
+    public boolean isAbsolute() {
+        return (this.path.length > 0 && path[0] == '/');
+    }
+
+    @Override
+    public JrtPath resolve(Path other) {
+        final JrtPath o = checkPath(other);
+        if (o.isAbsolute())
+            return o;
+        byte[] res;
+        if (this.path[path.length - 1] == '/') {
+            res = new byte[path.length + o.path.length];
+            System.arraycopy(path, 0, res, 0, path.length);
+            System.arraycopy(o.path, 0, res, path.length, o.path.length);
+        } else {
+            res = new byte[path.length + 1 + o.path.length];
+            System.arraycopy(path, 0, res, 0, path.length);
+            res[path.length] = '/';
+            System.arraycopy(o.path, 0, res, path.length + 1, o.path.length);
+        }
+        return new JrtPath(jrtfs, res);
+    }
+
+    @Override
+    public Path resolveSibling(Path other) {
+        if (other == null)
+            throw new NullPointerException();
+        Path parent = getParent();
+        return (parent == null) ? other : parent.resolve(other);
+    }
+
+    @Override
+    public boolean startsWith(Path other) {
+        final JrtPath o = checkPath(other);
+        if (o.isAbsolute() != this.isAbsolute() ||
+            o.path.length > this.path.length)
+            return false;
+        int olast = o.path.length;
+        for (int i = 0; i < olast; i++) {
+            if (o.path[i] != this.path[i])
+                return false;
+        }
+        olast--;
+        return o.path.length == this.path.length ||
+               o.path[olast] == '/' ||
+               this.path[olast + 1] == '/';
+    }
+
+    @Override
+    public boolean endsWith(Path other) {
+        final JrtPath o = checkPath(other);
+        int olast = o.path.length - 1;
+        if (olast > 0 && o.path[olast] == '/')
+            olast--;
+        int last = this.path.length - 1;
+        if (last > 0 && this.path[last] == '/')
+            last--;
+        if (olast == -1)    // o.path.length == 0
+            return last == -1;
+        if ((o.isAbsolute() &&(!this.isAbsolute() || olast != last)) ||
+            (last < olast))
+            return false;
+        for (; olast >= 0; olast--, last--) {
+            if (o.path[olast] != this.path[last])
+                return false;
+        }
+        return o.path[olast + 1] == '/' ||
+               last == -1 || this.path[last] == '/';
+    }
+
+    @Override
+    public JrtPath resolve(String other) {
+        return resolve(getFileSystem().getPath(other));
+    }
+
+    @Override
+    public final Path resolveSibling(String other) {
+        return resolveSibling(getFileSystem().getPath(other));
+    }
+
+    @Override
+    public final boolean startsWith(String other) {
+        return startsWith(getFileSystem().getPath(other));
+    }
+
+    @Override
+    public final boolean endsWith(String other) {
+        return endsWith(getFileSystem().getPath(other));
+    }
+
+    @Override
+    public Path normalize() {
+        byte[] res = getResolved();
+        if (res == path)    // no change
+            return this;
+        return new JrtPath(jrtfs, res, true);
+    }
+
+    private JrtPath checkPath(Path path) {
+        if (path == null)
+            throw new NullPointerException();
+        if (!(path instanceof JrtPath))
+            throw new ProviderMismatchException();
+        return (JrtPath) path;
+    }
+
+    // create offset list if not already created
+    private void initOffsets() {
+        if (offsets == null) {
+            int count, index;
+            // count names
+            count = 0;
+            index = 0;
+            while (index < path.length) {
+                byte c = path[index++];
+                if (c != '/') {
+                    count++;
+                    while (index < path.length && path[index] != '/')
+                        index++;
+                }
+            }
+            // populate offsets
+            int[] result = new int[count];
+            count = 0;
+            index = 0;
+            while (index < path.length) {
+                byte c = path[index];
+                if (c == '/') {
+                    index++;
+                } else {
+                    result[count++] = index++;
+                    while (index < path.length && path[index] != '/')
+                        index++;
+                }
+            }
+            synchronized (this) {
+                if (offsets == null)
+                    offsets = result;
+            }
+        }
+    }
+
+    // resolved path for locating jrt entry inside the jrt file,
+    // the result path does not contain ./ and .. components
+    // resolved bytes will always start with '/'
+    private volatile byte[] resolved = null;
+    byte[] getResolvedPath() {
+        byte[] r = resolved;
+        if (r == null) {
+            if (isAbsolute())
+                r = getResolved();
+            else
+                r = toAbsolutePath().getResolvedPath();
+            resolved = r;
+        }
+        return resolved;
+    }
+
+    // removes redundant slashs, replace "\" to separator "/"
+    // and check for invalid characters
+    private static byte[] normalize(byte[] path) {
+        if (path.length == 0)
+            return path;
+        byte prevC = 0;
+        for (int i = 0; i < path.length; i++) {
+            byte c = path[i];
+            if (c == '\\')
+                return normalize(path, i);
+            if (c == (byte)'/' && prevC == '/')
+                return normalize(path, i - 1);
+            if (c == '\u0000')
+                throw new InvalidPathException(JrtFileSystem.getString(path),
+                                               "Path: nul character not allowed");
+            prevC = c;
+        }
+
+        if (path.length > 1 && path[path.length - 1] == '/') {
+            return Arrays.copyOf(path, path.length - 1);
+        }
+
+        return path;
+    }
+
+    private static byte[] normalize(byte[] path, int off) {
+        byte[] to = new byte[path.length];
+        int n = 0;
+        while (n < off) {
+            to[n] = path[n];
+            n++;
+        }
+        int m = n;
+        byte prevC = 0;
+        while (n < path.length) {
+            byte c = path[n++];
+            if (c == (byte)'\\')
+                c = (byte)'/';
+            if (c == (byte)'/' && prevC == (byte)'/')
+                continue;
+            if (c == '\u0000')
+                throw new InvalidPathException(JrtFileSystem.getString(path),
+                                               "Path: nul character not allowed");
+            to[m++] = c;
+            prevC = c;
+        }
+        if (m > 1 && to[m - 1] == '/')
+            m--;
+        return (m == to.length)? to : Arrays.copyOf(to, m);
+    }
+
+    // Remove DotSlash(./) and resolve DotDot (..) components
+    private byte[] getResolved() {
+        if (path.length == 0)
+            return path;
+        for (int i = 0; i < path.length; i++) {
+            byte c = path[i];
+            if (c == (byte)'.')
+                return resolve0();
+        }
+
+        return path;
+    }
+
+    // TBD: performance, avoid initOffsets
+    private byte[] resolve0() {
+        byte[] to = new byte[path.length];
+        int nc = getNameCount();
+        int[] lastM = new int[nc];
+        int lastMOff = -1;
+        int m = 0;
+        for (int i = 0; i < nc; i++) {
+            int n = offsets[i];
+            int len = (i == offsets.length - 1)?
+                      (path.length - n):(offsets[i + 1] - n - 1);
+            if (len == 1 && path[n] == (byte)'.') {
+                if (m == 0 && path[0] == '/')   // absolute path
+                    to[m++] = '/';
+                continue;
+            }
+            if (len == 2 && path[n] == '.' && path[n + 1] == '.') {
+                if (lastMOff >= 0) {
+                    m = lastM[lastMOff--];  // retreat
+                    continue;
+                }
+                if (path[0] == '/') {  // "/../xyz" skip
+                    if (m == 0)
+                        to[m++] = '/';
+                } else {               // "../xyz" -> "../xyz"
+                    if (m != 0 && to[m-1] != '/')
+                        to[m++] = '/';
+                    while (len-- > 0)
+                        to[m++] = path[n++];
+                }
+                continue;
+            }
+            if (m == 0 && path[0] == '/' ||   // absolute path
+                m != 0 && to[m-1] != '/') {   // not the first name
+                to[m++] = '/';
+            }
+            lastM[++lastMOff] = m;
+            while (len-- > 0)
+                to[m++] = path[n++];
+        }
+        if (m > 1 && to[m - 1] == '/')
+            m--;
+        return (m == to.length)? to : Arrays.copyOf(to, m);
+    }
+
+    @Override
+    public String toString() {
+        return JrtFileSystem.getString(path);
+    }
+
+    @Override
+    public int hashCode() {
+        int h = hashcode;
+        if (h == 0)
+            hashcode = h = Arrays.hashCode(path);
+        return h;
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        return obj != null &&
+               obj instanceof JrtPath &&
+               this.jrtfs == ((JrtPath)obj).jrtfs &&
+               compareTo((Path) obj) == 0;
+    }
+
+    @Override
+    public int compareTo(Path other) {
+        final JrtPath o = checkPath(other);
+        int len1 = this.path.length;
+        int len2 = o.path.length;
+
+        int n = Math.min(len1, len2);
+        byte v1[] = this.path;
+        byte v2[] = o.path;
+
+        int k = 0;
+        while (k < n) {
+            int c1 = v1[k] & 0xff;
+            int c2 = v2[k] & 0xff;
+            if (c1 != c2)
+                return c1 - c2;
+            k++;
+        }
+        return len1 - len2;
+    }
+
+    @Override
+    public WatchKey register(
+            WatchService watcher,
+            WatchEvent.Kind<?>[] events,
+            WatchEvent.Modifier... modifiers) {
+        if (watcher == null || events == null || modifiers == null) {
+            throw new NullPointerException();
+        }
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public WatchKey register(WatchService watcher, WatchEvent.Kind<?>... events) {
+        return register(watcher, events, new WatchEvent.Modifier[0]);
+    }
+
+    @Override
+    public final File toFile() {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public Iterator<Path> iterator() {
+        return new Iterator<Path>() {
+            private int i = 0;
+
+            @Override
+            public boolean hasNext() {
+                return (i < getNameCount());
+            }
+
+            @Override
+            public Path next() {
+                if (i < getNameCount()) {
+                    Path result = getName(i);
+                    i++;
+                    return result;
+                } else {
+                    throw new NoSuchElementException();
+                }
+            }
+
+            @Override
+            public void remove() {
+                throw new ReadOnlyFileSystemException();
+            }
+        };
+    }
+
+    /////////////////////////////////////////////////////////////////////
+    // Helpers for JrtFileSystemProvider and JrtFileSystem
+
+    int getPathLength() {
+        return path.length;
+    }
+
+
+    void createDirectory(FileAttribute<?>... attrs)
+        throws IOException
+    {
+        jrtfs.createDirectory(getResolvedPath(), attrs);
+    }
+
+    InputStream newInputStream(OpenOption... options) throws IOException
+    {
+        if (options.length > 0) {
+            for (OpenOption opt : options) {
+                if (opt != READ)
+                    throw new UnsupportedOperationException("'" + opt + "' not allowed");
+            }
+        }
+        return jrtfs.newInputStream(getResolvedPath());
+    }
+
+    DirectoryStream<Path> newDirectoryStream(Filter<? super Path> filter)
+        throws IOException
+    {
+        return new JrtDirectoryStream(this, filter);
+    }
+
+    void delete() throws IOException {
+        jrtfs.deleteFile(getResolvedPath(), true);
+    }
+
+    void deleteIfExists() throws IOException {
+        jrtfs.deleteFile(getResolvedPath(), false);
+    }
+
+    JrtFileAttributes getAttributes() throws IOException
+    {
+        JrtFileAttributes zfas = jrtfs.getFileAttributes(getResolvedPath());
+        if (zfas == null)
+            throw new NoSuchFileException(toString());
+        return zfas;
+    }
+
+    void setAttribute(String attribute, Object value, LinkOption... options)
+        throws IOException
+    {
+        String type;
+        String attr;
+        int colonPos = attribute.indexOf(':');
+        if (colonPos == -1) {
+            type = "basic";
+            attr = attribute;
+        } else {
+            type = attribute.substring(0, colonPos++);
+            attr = attribute.substring(colonPos);
+        }
+        JrtFileAttributeView view = JrtFileAttributeView.get(this, type);
+        if (view == null)
+            throw new UnsupportedOperationException("view <" + view + "> is not supported");
+        view.setAttribute(attr, value);
+    }
+
+    void setTimes(FileTime mtime, FileTime atime, FileTime ctime)
+        throws IOException
+    {
+        jrtfs.setTimes(getResolvedPath(), mtime, atime, ctime);
+    }
+
+    Map<String, Object> readAttributes(String attributes, LinkOption... options)
+        throws IOException
+
+    {
+        String view;
+        String attrs;
+        int colonPos = attributes.indexOf(':');
+        if (colonPos == -1) {
+            view = "basic";
+            attrs = attributes;
+        } else {
+            view = attributes.substring(0, colonPos++);
+            attrs = attributes.substring(colonPos);
+        }
+        JrtFileAttributeView jrtfv = JrtFileAttributeView.get(this, view);
+        if (jrtfv == null) {
+            throw new UnsupportedOperationException("view not supported");
+        }
+        return jrtfv.readAttributes(attrs);
+    }
+
+    FileStore getFileStore() throws IOException {
+        // each JrtFileSystem only has one root (as requested for now)
+        if (exists())
+            return jrtfs.getFileStore(this);
+        throw new NoSuchFileException(JrtFileSystem.getString(path));
+    }
+
+    boolean isSameFile(Path other) throws IOException {
+        if (this.equals(other))
+            return true;
+        if (other == null ||
+            this.getFileSystem() != other.getFileSystem())
+            return false;
+        this.checkAccess();
+        ((JrtPath)other).checkAccess();
+        return Arrays.equals(this.getResolvedPath(),
+                             ((JrtPath)other).getResolvedPath());
+    }
+
+    SeekableByteChannel newByteChannel(Set<? extends OpenOption> options,
+                                       FileAttribute<?>... attrs)
+        throws IOException
+    {
+        return jrtfs.newByteChannel(getResolvedPath(), options, attrs);
+    }
+
+
+    FileChannel newFileChannel(Set<? extends OpenOption> options,
+                               FileAttribute<?>... attrs)
+        throws IOException
+    {
+        return jrtfs.newFileChannel(getResolvedPath(), options, attrs);
+    }
+
+    void checkAccess(AccessMode... modes) throws IOException {
+        boolean w = false;
+        boolean x = false;
+        for (AccessMode mode : modes) {
+            switch (mode) {
+                case READ:
+                    break;
+                case WRITE:
+                    w = true;
+                    break;
+                case EXECUTE:
+                    x = true;
+                    break;
+                default:
+                    throw new UnsupportedOperationException();
+            }
+        }
+        JrtFileAttributes attrs = jrtfs.getFileAttributes(getResolvedPath());
+        if (attrs == null && (path.length != 1 || path[0] != '/'))
+            throw new NoSuchFileException(toString());
+        if (w) {
+            if (jrtfs.isReadOnly())
+                throw new AccessDeniedException(toString());
+        }
+        if (x)
+            throw new AccessDeniedException(toString());
+    }
+
+    boolean exists() {
+        if (isAbsolute())
+            return true;
+        try {
+            return jrtfs.exists(getResolvedPath());
+        } catch (IOException x) {}
+        return false;
+    }
+
+    OutputStream newOutputStream(OpenOption... options) throws IOException
+    {
+        if (options.length == 0)
+            return jrtfs.newOutputStream(getResolvedPath(),
+                                       CREATE_NEW, WRITE);
+        return jrtfs.newOutputStream(getResolvedPath(), options);
+    }
+
+    void move(JrtPath target, CopyOption... options)
+        throws IOException
+    {
+        if (this.jrtfs == target.jrtfs)
+        {
+            jrtfs.copyFile(true,
+                         getResolvedPath(), target.getResolvedPath(),
+                         options);
+        } else {
+            copyToTarget(target, options);
+            delete();
+        }
+    }
+
+    void copy(JrtPath target, CopyOption... options)
+        throws IOException
+    {
+        if (this.jrtfs == target.jrtfs)
+            jrtfs.copyFile(false,
+                         getResolvedPath(), target.getResolvedPath(),
+                         options);
+        else
+            copyToTarget(target, options);
+    }
+
+    private void copyToTarget(JrtPath target, CopyOption... options)
+        throws IOException
+    {
+        boolean replaceExisting = false;
+        boolean copyAttrs = false;
+        for (CopyOption opt : options) {
+            if (opt == REPLACE_EXISTING)
+                replaceExisting = true;
+            else if (opt == COPY_ATTRIBUTES)
+                copyAttrs = true;
+        }
+        // attributes of source file
+        JrtFileAttributes jrtfas = getAttributes();
+        // check if target exists
+        boolean exists;
+        if (replaceExisting) {
+            try {
+                target.deleteIfExists();
+                exists = false;
+            } catch (DirectoryNotEmptyException x) {
+                exists = true;
+            }
+        } else {
+            exists = target.exists();
+        }
+        if (exists)
+            throw new FileAlreadyExistsException(target.toString());
+
+        if (jrtfas.isDirectory()) {
+            // create directory or file
+            target.createDirectory();
+        } else {
+            try (InputStream is = jrtfs.newInputStream(getResolvedPath()); OutputStream os = target.newOutputStream()) {
+                byte[] buf = new byte[8192];
+                int n;
+                while ((n = is.read(buf)) != -1) {
+                    os.write(buf, 0, n);
+                }
+            }
+        }
+        if (copyAttrs) {
+            BasicFileAttributeView view =
+                JrtFileAttributeView.get(target, BasicFileAttributeView.class);
+            try {
+                view.setTimes(jrtfas.lastModifiedTime(),
+                              jrtfas.lastAccessTime(),
+                              jrtfas.creationTime());
+            } catch (IOException x) {
+                // rollback?
+                try {
+                    target.delete();
+                } catch (IOException ignore) { }
+                throw x;
+            }
+        }
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtUtils.java b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtUtils.java
new file mode 100644
index 00000000000..9014bf094fd
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/JrtUtils.java
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.util.regex.PatternSyntaxException;
+
+final class JrtUtils {
+    private JrtUtils() {}
+
+    private static final String regexMetaChars = ".^$+{[]|()";
+    private static final String globMetaChars = "\\*?[{";
+    private static boolean isRegexMeta(char c) {
+        return regexMetaChars.indexOf(c) != -1;
+    }
+    private static boolean isGlobMeta(char c) {
+        return globMetaChars.indexOf(c) != -1;
+    }
+    private static final char EOL = 0;  //TBD
+    private static char next(String glob, int i) {
+        if (i < glob.length()) {
+            return glob.charAt(i);
+        }
+        return EOL;
+    }
+
+    /*
+     * Creates a regex pattern from the given glob expression.
+     *
+     * @throws  PatternSyntaxException
+     */
+    public static String toRegexPattern(String globPattern) {
+        boolean inGroup = false;
+        StringBuilder regex = new StringBuilder("^");
+
+        int i = 0;
+        while (i < globPattern.length()) {
+            char c = globPattern.charAt(i++);
+            switch (c) {
+                case '\\':
+                    // escape special characters
+                    if (i == globPattern.length()) {
+                        throw new PatternSyntaxException("No character to escape",
+                                globPattern, i - 1);
+                    }
+                    char next = globPattern.charAt(i++);
+                    if (isGlobMeta(next) || isRegexMeta(next)) {
+                        regex.append('\\');
+                    }
+                    regex.append(next);
+                    break;
+                case '/':
+                    regex.append(c);
+                    break;
+                case '[':
+                    // don't match name separator in class
+                    regex.append("[[^/]&&[");
+                    if (next(globPattern, i) == '^') {
+                        // escape the regex negation char if it appears
+                        regex.append("\\^");
+                        i++;
+                    } else {
+                        // negation
+                        if (next(globPattern, i) == '!') {
+                            regex.append('^');
+                            i++;
+                        }
+                        // hyphen allowed at start
+                        if (next(globPattern, i) == '-') {
+                            regex.append('-');
+                            i++;
+                        }
+                    }
+                    boolean hasRangeStart = false;
+                    char last = 0;
+                    while (i < globPattern.length()) {
+                        c = globPattern.charAt(i++);
+                        if (c == ']') {
+                            break;
+                        }
+                        if (c == '/') {
+                            throw new PatternSyntaxException("Explicit 'name separator' in class",
+                                    globPattern, i - 1);
+                        }
+                        // TBD: how to specify ']' in a class?
+                        if (c == '\\' || c == '[' ||
+                                c == '&' && next(globPattern, i) == '&') {
+                            // escape '\', '[' or "&&" for regex class
+                            regex.append('\\');
+                        }
+                        regex.append(c);
+
+                        if (c == '-') {
+                            if (!hasRangeStart) {
+                                throw new PatternSyntaxException("Invalid range",
+                                        globPattern, i - 1);
+                            }
+                            if ((c = next(globPattern, i++)) == EOL || c == ']') {
+                                break;
+                            }
+                            if (c < last) {
+                                throw new PatternSyntaxException("Invalid range",
+                                        globPattern, i - 3);
+                            }
+                            regex.append(c);
+                            hasRangeStart = false;
+                        } else {
+                            hasRangeStart = true;
+                            last = c;
+                        }
+                    }
+                    if (c != ']') {
+                        throw new PatternSyntaxException("Missing ']", globPattern, i - 1);
+                    }
+                    regex.append("]]");
+                    break;
+                case '{':
+                    if (inGroup) {
+                        throw new PatternSyntaxException("Cannot nest groups",
+                                globPattern, i - 1);
+                    }
+                    regex.append("(?:(?:");
+                    inGroup = true;
+                    break;
+                case '}':
+                    if (inGroup) {
+                        regex.append("))");
+                        inGroup = false;
+                    } else {
+                        regex.append('}');
+                    }
+                    break;
+                case ',':
+                    if (inGroup) {
+                        regex.append(")|(?:");
+                    } else {
+                        regex.append(',');
+                    }
+                    break;
+                case '*':
+                    if (next(globPattern, i) == '*') {
+                        // crosses directory boundaries
+                        regex.append(".*");
+                        i++;
+                    } else {
+                        // within directory boundary
+                        regex.append("[^/]*");
+                    }
+                    break;
+                case '?':
+                   regex.append("[^/]");
+                   break;
+                default:
+                    if (isRegexMeta(c)) {
+                        regex.append('\\');
+                    }
+                    regex.append(c);
+            }
+        }
+        if (inGroup) {
+            throw new PatternSyntaxException("Missing '}", globPattern, i - 1);
+        }
+        return regex.append('$').toString();
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/SystemImages.java b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/SystemImages.java
new file mode 100644
index 00000000000..8ff6291fbb8
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/SystemImages.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.internal.jrtfs;
+
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.security.AccessController;
+import java.security.CodeSource;
+import java.security.PrivilegedAction;
+
+final class SystemImages {
+    private SystemImages() {}
+
+    static final String RUNTIME_HOME;
+    static final Path bootImagePath;
+    static final Path extImagePath;
+    static final Path appImagePath;
+    static {
+        PrivilegedAction<String> pa = SystemImages::findHome;
+        RUNTIME_HOME = AccessController.doPrivileged(pa);
+
+        FileSystem fs = FileSystems.getDefault();
+        bootImagePath = fs.getPath(RUNTIME_HOME, "lib", "modules", "bootmodules.jimage");
+        extImagePath = fs.getPath(RUNTIME_HOME, "lib", "modules", "extmodules.jimage");
+        appImagePath = fs.getPath(RUNTIME_HOME, "lib", "modules", "appmodules.jimage");
+    }
+
+    /**
+     * Returns the appropriate JDK home for this usage of the FileSystemProvider.
+     * When the CodeSource is null (null loader) then jrt:/ is the current runtime,
+     * otherwise the JDK home is located relative to jrt-fs.jar.
+     */
+    private static String findHome() {
+        CodeSource cs = SystemImages.class.getProtectionDomain().getCodeSource();
+        if (cs == null)
+            return System.getProperty("java.home");
+
+        // assume loaded from $TARGETJDK/jrt-fs.jar
+        URL url = cs.getLocation();
+        if (!url.getProtocol().equalsIgnoreCase("file"))
+            throw new RuntimeException(url + " loaded in unexpected way");
+        try {
+            return Paths.get(url.toURI()).getParent().toString();
+        } catch (URISyntaxException e) {
+            throw new InternalError(e);
+        }
+    }
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/jrtfsviewer.js b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/jrtfsviewer.js
new file mode 100644
index 00000000000..968d1c785ce
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/jrtfsviewer.js
@@ -0,0 +1,111 @@
+#// Usage: jjs -fx jrtfsviewer.js
+
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+function usage() {
+    print("Usage:");
+    print("jdk9+: jjs -fx jrtfsviewer.js");
+    print("jdk8+: jjs -fx -cp <path-of jrt-fs.jar> jrtfsviewer.js");
+    exit(1);
+}
+
+if (! $OPTIONS._fx) {
+    usage();
+}
+
+// shows the jrt file system as a JavaFX tree view.
+
+// Using JavaFX from Nashorn. See also:
+// http://docs.oracle.com/javase/8/docs/technotes/guides/scripting/nashorn/javafx.html
+
+// Java classes used
+var FileSystems = Java.type("java.nio.file.FileSystems");
+var Files = Java.type("java.nio.file.Files");
+var System = Java.type("java.lang.System");
+var URI = Java.type("java.net.URI");
+
+// JavaFX classes used
+var StackPane = Java.type("javafx.scene.layout.StackPane");
+var Scene     = Java.type("javafx.scene.Scene");
+var TreeItem  = Java.type("javafx.scene.control.TreeItem");
+var TreeView  = Java.type("javafx.scene.control.TreeView");
+
+// Create a javafx TreeItem to view nio Path
+function treeItemForPath(path) {
+    var item = new TreeItem(path.toString());
+  
+    if (Files.isDirectory(path)) {
+        var stream = Files.newDirectoryStream(path);
+        try {
+            var itr = stream.iterator();
+            while (itr.hasNext()) {
+                var childPath = itr.next();
+                if (Files.isDirectory(childPath)) {
+                    var subitem = treeItemForPath(childPath);
+                } else {
+                    var subitem = new TreeItem(childPath.toString());
+                }
+                item.children.add(subitem);
+            }
+        } finally {
+            stream.close();
+        }
+    }
+    return item;
+}
+
+function getJrtFileSystem() {
+    var isJdk9 = System.getProperty("java.version").startsWith("1.9.0");
+    var uri = URI.create("jrt:/");
+
+    if (isJdk9) {
+        return FileSystems.getFileSystem(uri);
+    } else {
+        // pass jrt-fs.jar in -classpath but running on jdk8+
+        var cls;
+        try {
+            cls = Java.type("jdk.internal.jrtfs.JrtFileSystem").class;
+        } catch (e) {
+            print(e);
+            print("did you miss specifying jrt-fs.jar with -cp option?");
+            usage();
+        }
+        return FileSystems.newFileSystem(uri, null, cls.classLoader);
+    }
+}
+
+// JavaFX start method
+function start(stage) {
+    var jrtfs = getJrtFileSystem();
+    var root = jrtfs.getPath('/');
+    stage.title = "jrt fs viewer";
+    var rootItem = treeItemForPath(root);
+    var tree = new TreeView(rootItem);
+    var root = new StackPane();
+    root.children.add(tree);
+    stage.scene = new Scene(root, 300, 450);
+    stage.show();
+}
diff --git a/jdk/src/java.base/share/classes/jdk/internal/jrtfs/jrtls.js b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/jrtls.js
new file mode 100644
index 00000000000..e4b3c81fd85
--- /dev/null
+++ b/jdk/src/java.base/share/classes/jdk/internal/jrtfs/jrtls.js
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Usage: jjs jrtls.js
+ *
+ * Recursively list the content of / directory of the jrt fs.
+ */
+
+// classes used
+var Files = Java.type("java.nio.file.Files");
+var FileSystems = Java.type("java.nio.file.FileSystems");
+var URI = Java.type("java.net.URI");
+
+var fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+var root = fs.getPath('/');
+Files.walk(root).forEach(print);
diff --git a/jdk/src/java.base/share/classes/sun/misc/ExtensionDependency.java b/jdk/src/java.base/share/classes/sun/misc/ExtensionDependency.java
index 9f0d0841e2c..c013169fa2f 100644
--- a/jdk/src/java.base/share/classes/sun/misc/ExtensionDependency.java
+++ b/jdk/src/java.base/share/classes/sun/misc/ExtensionDependency.java
@@ -65,8 +65,11 @@ import sun.net.www.ParseUtil;
  * This class also maintain versioning consistency of installed
  * extensions dependencies declared in jar file manifest.
  * </p>
+ *
+ * @deprecated this class will be removed in a future release.
  * @author  Jerome Dochez
  */
+@Deprecated
 public class ExtensionDependency {
 
     /* Callbak interfaces to delegate installation of missing extensions */
diff --git a/jdk/src/java.base/share/classes/sun/misc/ExtensionInfo.java b/jdk/src/java.base/share/classes/sun/misc/ExtensionInfo.java
index 3fc17bf7339..e6aad939eb8 100644
--- a/jdk/src/java.base/share/classes/sun/misc/ExtensionInfo.java
+++ b/jdk/src/java.base/share/classes/sun/misc/ExtensionInfo.java
@@ -38,8 +38,10 @@ import java.lang.Character.*;
  * This class holds all necessary information to install or
  * upgrade a extension on the user's disk
  *
+ * @deprecated this class will be removed in a future release.
  * @author  Jerome Dochez
  */
+@Deprecated
 public class ExtensionInfo {
 
     /**
diff --git a/jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationException.java b/jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationException.java
index 1bf6ff97d04..98ff3d3b9fe 100644
--- a/jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationException.java
+++ b/jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationException.java
@@ -29,9 +29,10 @@ package sun.misc;
  * Exception when installation of an extension has failed for
  * any reason
  *
+ * @deprecated this class will be removed in a future release.
  * @author  Jerome Dochez
  */
-
+@Deprecated
 public class ExtensionInstallationException extends Exception {
 
     static final long serialVersionUID = 3139688306909345924L;
diff --git a/jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationProvider.java b/jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationProvider.java
index 0b24a13574a..438e396b2c2 100644
--- a/jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationProvider.java
+++ b/jdk/src/java.base/share/classes/sun/misc/ExtensionInstallationProvider.java
@@ -30,8 +30,10 @@ package sun.misc;
  * provided to the extension installation dependency mechanism to
  * install new extensions on the user's disk
  *
+ * @deprecated this class will be removed in a future release.
  * @author  Jerome Dochez
  */
+@Deprecated
 public interface ExtensionInstallationProvider {
 
     /*
diff --git a/jdk/src/java.base/share/classes/sun/misc/JarFilter.java b/jdk/src/java.base/share/classes/sun/misc/JarFilter.java
index 0af055f74cc..b4db96db08f 100644
--- a/jdk/src/java.base/share/classes/sun/misc/JarFilter.java
+++ b/jdk/src/java.base/share/classes/sun/misc/JarFilter.java
@@ -34,8 +34,10 @@ import java.io.FilenameFilter;
  * This class is used in extension installation support (ExtensionDependency).
  * <p>
  *
+ * @deprecated this class will be removed in a future release.
  * @author  Michael Colburn
  */
+@Deprecated
 public class JarFilter implements FilenameFilter {
 
     public boolean accept(File dir, String name) {
diff --git a/jdk/src/java.base/share/classes/sun/misc/Launcher.java b/jdk/src/java.base/share/classes/sun/misc/Launcher.java
index 75310f5aa0e..62590143bcd 100644
--- a/jdk/src/java.base/share/classes/sun/misc/Launcher.java
+++ b/jdk/src/java.base/share/classes/sun/misc/Launcher.java
@@ -26,17 +26,13 @@
 package sun.misc;
 
 import java.io.File;
-import java.io.IOException;
 import java.io.FilePermission;
+import java.io.IOException;
 import java.net.URL;
 import java.net.URLClassLoader;
 import java.net.MalformedURLException;
 import java.net.URLStreamHandler;
 import java.net.URLStreamHandlerFactory;
-import java.util.HashSet;
-import java.util.StringTokenizer;
-import java.util.Set;
-import java.util.Vector;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
 import java.security.PrivilegedExceptionAction;
@@ -46,17 +42,26 @@ import java.security.Permissions;
 import java.security.Permission;
 import java.security.ProtectionDomain;
 import java.security.CodeSource;
-import sun.security.util.SecurityConstants;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
 import sun.net.www.ParseUtil;
+import sun.security.util.SecurityConstants;
 
 /**
  * This class is used by the system to launch the main application.
 Launcher */
 public class Launcher {
+
+    // ensure URLClassPath for boot loader is initialized first
+    static {
+        URLClassPath ucp = BootClassPathHolder.bcp;
+    }
+
     private static URLStreamHandlerFactory factory = new Factory();
     private static Launcher launcher = new Launcher();
-    private static String bootClassPath =
-        System.getProperty("sun.boot.class.path");
 
     public static Launcher getLauncher() {
         return launcher;
@@ -129,10 +134,7 @@ public class Launcher {
          * create an ExtClassLoader. The ExtClassLoader is created
          * within a context that limits which files it can read
          */
-        public static ExtClassLoader getExtClassLoader() throws IOException
-        {
-            final File[] dirs = getExtDirs();
-
+        public static ExtClassLoader getExtClassLoader() throws IOException {
             try {
                 // Prior implementations of this doPrivileged() block supplied
                 // aa synthesized ACC via a call to the private method
@@ -141,11 +143,15 @@ public class Launcher {
                 return AccessController.doPrivileged(
                     new PrivilegedExceptionAction<ExtClassLoader>() {
                         public ExtClassLoader run() throws IOException {
-                            int len = dirs.length;
-                            for (int i = 0; i < len; i++) {
-                                MetaIndex.registerDirectory(dirs[i]);
-                            }
-                            return new ExtClassLoader(dirs);
+                            // ext modules linked into image
+                            String home = System.getProperty("java.home");
+                            File dir = new File(new File(home, "lib"), "modules");
+                            File jimage = new File(dir, "extmodules.jimage");
+
+                            File jfxrt = new File(new File(home, "lib"), "jfxrt.jar");
+                            File[] files = jfxrt.exists() ? new File[] {jimage, jfxrt}
+                                                          : new File[] {jimage};
+                            return new ExtClassLoader(files);
                         }
                     });
             } catch (java.security.PrivilegedActionException e) {
@@ -160,87 +166,17 @@ public class Launcher {
         /*
          * Creates a new ExtClassLoader for the specified directories.
          */
-        public ExtClassLoader(File[] dirs) throws IOException {
-            super(getExtURLs(dirs), null, factory);
+        public ExtClassLoader(File[] files) throws IOException {
+            super(getExtURLs(files), null, factory);
         }
 
-        private static File[] getExtDirs() {
-            String s = System.getProperty("java.ext.dirs");
-            File[] dirs;
-            if (s != null) {
-                StringTokenizer st =
-                    new StringTokenizer(s, File.pathSeparator);
-                int count = st.countTokens();
-                dirs = new File[count];
-                for (int i = 0; i < count; i++) {
-                    dirs[i] = new File(st.nextToken());
-                }
-            } else {
-                dirs = new File[0];
+        private static URL[] getExtURLs(File[] files) throws IOException {
+            int len = files.length;
+            URL[] urls = new URL[len];
+            for (int i=0; i<len; i++) {
+                urls[i] = getFileURL(files[i]);
             }
-            return dirs;
-        }
-
-        private static URL[] getExtURLs(File[] dirs) throws IOException {
-            Vector<URL> urls = new Vector<URL>();
-            for (int i = 0; i < dirs.length; i++) {
-                String[] files = dirs[i].list();
-                if (files != null) {
-                    for (int j = 0; j < files.length; j++) {
-                        if (!files[j].equals("meta-index")) {
-                            File f = new File(dirs[i], files[j]);
-                            urls.add(getFileURL(f));
-                        }
-                    }
-                }
-            }
-            URL[] ua = new URL[urls.size()];
-            urls.copyInto(ua);
-            return ua;
-        }
-
-        /*
-         * Searches the installed extension directories for the specified
-         * library name. For each extension directory, we first look for
-         * the native library in the subdirectory whose name is the value
-         * of the system property <code>os.arch</code>. Failing that, we
-         * look in the extension directory itself.
-         */
-        public String findLibrary(String name) {
-            final String libname = System.mapLibraryName(name);
-            URL[] urls = super.getURLs();
-            File prevDir = null;
-            for (int i = 0; i < urls.length; i++) {
-                // Get the ext directory from the URL
-                File dir = new File(urls[i].getPath()).getParentFile();
-                if (dir != null && !dir.equals(prevDir)) {
-                    // Look in architecture-specific subdirectory first
-                    // Read from the saved system properties to avoid deadlock
-                    final String arch = VM.getSavedProperty("os.arch");
-                    String pathname = AccessController.doPrivileged(
-                        new PrivilegedAction<String>() {
-                            public String run() {
-                                if (arch != null) {
-                                    File file = new File(new File(dir, arch), libname);
-                                    if (file.exists()) {
-                                        return file.getAbsolutePath();
-                                    }
-                                }
-                                // Then check the extension directory
-                                File file = new File(dir, libname);
-                                if (file.exists()) {
-                                    return file.getAbsolutePath();
-                                }
-                                return null;
-                            }
-                        });
-                    if (pathname != null) {
-                        return pathname;
-                    }
-                }
-                prevDir = dir;
-            }
-            return null;
+            return urls;
         }
 
         private static AccessControlContext getContext(File[] dirs)
@@ -274,8 +210,18 @@ public class Launcher {
         public static ClassLoader getAppClassLoader(final ClassLoader extcl)
             throws IOException
         {
-            final String s = System.getProperty("java.class.path");
-            final File[] path = (s == null) ? new File[0] : getClassPath(s, true);
+            // modules linked into image are prepended to class path
+            String home = System.getProperty("java.home");
+            File dir = new File(new File(home, "lib"), "modules");
+            String jimage = new File(dir, "appmodules.jimage").getPath();
+
+            String cp = System.getProperty("java.class.path");
+            if (cp == null) {
+                cp = jimage;
+            } else {
+                cp = jimage + File.pathSeparator + cp;
+            }
+            final File[] path = getClassPath(cp, true);
 
             // Note: on bugid 4256530
             // Prior implementations of this doPrivileged() block supplied
@@ -287,9 +233,8 @@ public class Launcher {
             return AccessController.doPrivileged(
                 new PrivilegedAction<AppClassLoader>() {
                     public AppClassLoader run() {
-                    URL[] urls =
-                        (s == null) ? new URL[0] : pathToURLs(path);
-                    return new AppClassLoader(urls, extcl);
+                        URL[] urls = pathToURLs(path);
+                        return new AppClassLoader(urls, extcl);
                 }
             });
         }
@@ -320,8 +265,7 @@ public class Launcher {
         /**
          * allow any classes loaded from classpath to exit the VM.
          */
-        protected PermissionCollection getPermissions(CodeSource codesource)
-        {
+        protected PermissionCollection getPermissions(CodeSource codesource) {
             PermissionCollection perms = super.getPermissions(codesource);
             perms.add(new RuntimePermission("exitVM"));
             return perms;
@@ -368,11 +312,12 @@ public class Launcher {
     private static class BootClassPathHolder {
         static final URLClassPath bcp;
         static {
-            URL[] urls;
-            if (bootClassPath != null) {
-                urls = AccessController.doPrivileged(
+            URL[] urls = AccessController.doPrivileged(
                     new PrivilegedAction<URL[]>() {
                         public URL[] run() {
+                            String bootClassPath = System.getProperty("sun.boot.class.path");
+                            if (bootClassPath == null)
+                                return new URL[0];
                             // Skip empty path in boot class path i.e. not default to use CWD
                             File[] classPath = getClassPath(bootClassPath, false);
                             int len = classPath.length;
@@ -392,9 +337,6 @@ public class Launcher {
                         }
                     }
                 );
-            } else {
-                urls = new URL[0];
-            }
             bcp = new URLClassPath(urls, factory);
         }
     }
diff --git a/jdk/src/java.base/share/classes/sun/misc/URLClassPath.java b/jdk/src/java.base/share/classes/sun/misc/URLClassPath.java
index dca817148a5..04321d65512 100644
--- a/jdk/src/java.base/share/classes/sun/misc/URLClassPath.java
+++ b/jdk/src/java.base/share/classes/sun/misc/URLClassPath.java
@@ -25,33 +25,51 @@
 
 package sun.misc;
 
-import java.util.*;
+import java.io.ByteArrayInputStream;
+import java.io.Closeable;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.HttpURLConnection;
+import java.net.JarURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+import java.net.URLStreamHandlerFactory;
+import java.security.AccessControlException;
+import java.security.AccessController;
+import java.security.CodeSigner;
+import java.security.Permission;
+import java.security.PrivilegedExceptionAction;
+import java.security.cert.Certificate;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.Stack;
+import java.util.StringTokenizer;
+import java.util.concurrent.atomic.AtomicInteger;
 import java.util.jar.JarFile;
-import sun.misc.JarIndex;
-import sun.misc.InvalidJarIndexException;
-import sun.net.www.ParseUtil;
 import java.util.zip.ZipEntry;
 import java.util.jar.JarEntry;
 import java.util.jar.Manifest;
 import java.util.jar.Attributes;
 import java.util.jar.Attributes.Name;
-import java.net.JarURLConnection;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.HttpURLConnection;
-import java.net.URLStreamHandler;
-import java.net.URLStreamHandlerFactory;
-import java.io.*;
-import java.security.AccessController;
-import java.security.AccessControlException;
-import java.security.CodeSigner;
-import java.security.Permission;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedExceptionAction;
-import java.security.cert.Certificate;
-import sun.misc.FileURLMapper;
+
+import jdk.internal.jimage.ImageLocation;
+import jdk.internal.jimage.ImageReader;
+
 import sun.net.util.URLUtil;
+import sun.net.www.ParseUtil;
+import sun.net.www.protocol.jrt.JavaRuntimeURLConnection;
 
 /**
  * This class is used to maintain a search path of URLs for loading classes
@@ -60,12 +78,15 @@ import sun.net.util.URLUtil;
  * @author  David Connelly
  */
 public class URLClassPath {
-    final static String USER_AGENT_JAVA_VERSION = "UA-Java-Version";
-    final static String JAVA_VERSION;
+    private static final String USER_AGENT_JAVA_VERSION = "UA-Java-Version";
+    private static final String JAVA_HOME;
+    private static final String JAVA_VERSION;
     private static final boolean DEBUG;
     private static final boolean DISABLE_JAR_CHECKING;
 
     static {
+        JAVA_HOME = java.security.AccessController.doPrivileged(
+            new sun.security.action.GetPropertyAction("java.home"));
         JAVA_VERSION = java.security.AccessController.doPrivileged(
             new sun.security.action.GetPropertyAction("java.version"));
         DEBUG        = (java.security.AccessController.doPrivileged(
@@ -363,6 +384,10 @@ public class URLClassPath {
                             return new Loader(url);
                         }
                     } else {
+                        if (file != null && "file".equals(url.getProtocol())) {
+                            if (file.endsWith(".jimage"))
+                                return new JImageLoader(url);
+                        }
                         return new JarLoader(url, jarHandler, lmap);
                     }
                 }
@@ -980,7 +1005,6 @@ public class URLClassPath {
             }
 
             ensureOpen();
-            parseExtensionsDependencies();
 
             if (SharedSecrets.javaUtilJarAccess().jarFileHasClassPathAttribute(jar)) { // Only get manifest when necessary
                 Manifest man = jar.getManifest();
@@ -997,13 +1021,6 @@ public class URLClassPath {
             return null;
         }
 
-        /*
-         * parse the standard extension dependencies
-         */
-        private void  parseExtensionsDependencies() throws IOException {
-            ExtensionDependency.checkExtensionsDependencies(jar);
-        }
-
         /*
          * Parses value of the Class-Path manifest attribute and returns
          * an array of URLs relative to the specified base URL.
@@ -1095,4 +1112,132 @@ public class URLClassPath {
             return null;
         }
     }
+
+    /**
+     * A Loader of classes and resources from a jimage file located in the
+     * runtime image.
+     */
+    private static class JImageLoader
+        extends Loader implements JavaRuntimeURLConnection.ResourceFinder
+    {
+        private static final AtomicInteger NEXT_INDEX = new AtomicInteger();
+
+        private final ImageReader jimage;
+        private final int index;
+
+        JImageLoader(URL url) throws IOException {
+            super(url);
+
+            // get path to image file and check that it's in the runtime
+            String urlPath = url.getFile().replace('/', File.separatorChar);
+
+            File filePath = new File(ParseUtil.decode(urlPath));
+            File home = new File(JAVA_HOME).getCanonicalFile();
+            File parent = filePath.getParentFile();
+            while (parent != null) {
+                if (parent.equals(home))
+                    break;
+                parent = parent.getParentFile();
+            }
+            if (parent == null)
+                throw new IOException(filePath + " not in runtime image");
+
+            this.jimage = ImageReader.open(filePath.toString());
+            this.index = NEXT_INDEX.getAndIncrement();
+
+            // register with the jimage protocol handler
+            JavaRuntimeURLConnection.register(this);
+        }
+
+        /**
+         * Maps the given resource name to a module.
+         */
+        private String nameToModule(String name) {
+            int pos = name.lastIndexOf('/');
+            if (pos > 0) {
+                String pkg = name.substring(0, pos);
+                String module = jimage.getModule(pkg);
+                if (module != null)
+                    return module;
+            }
+            // cannot map to module
+            return "UNNAMED" + index;
+        }
+
+        /**
+         * Constructs a URL for the resource name.
+         */
+        private URL toURL(String name) {
+            String module = nameToModule(name);
+            String encodedName = ParseUtil.encodePath(name, false);
+            try {
+                return new URL("jrt:/" + module + "/" + encodedName);
+            } catch (MalformedURLException e) {
+                throw new InternalError(e);
+            }
+        }
+
+        @Override
+        URL findResource(String name, boolean check) {
+            ImageLocation location = jimage.findLocation(name);
+            if (location == null)
+                return null;
+            URL url = toURL(name);
+            if (check) {
+                try {
+                    URLClassPath.check(url);
+                } catch (IOException | SecurityException e) {
+                    return null;
+                }
+            }
+            return url;
+        }
+
+        @Override
+        Resource getResource(String name, boolean check) {
+            ImageLocation location = jimage.findLocation(name);
+            if (location == null)
+                return null;
+            URL url = toURL(name);
+            if (check) {
+                try {
+                    URLClassPath.check(url);
+                } catch (IOException | SecurityException e) {
+                    return null;
+                }
+            }
+            return new Resource() {
+                @Override
+                public String getName() { return name; }
+                @Override
+                public URL getURL() { return url; }
+                @Override
+                public URL getCodeSourceURL() {
+                    try {
+                        return new URL("jrt:/" + nameToModule(name));
+                    } catch (MalformedURLException e) {
+                        throw new InternalError(e);
+                    }
+                }
+                @Override
+                public InputStream getInputStream() throws IOException {
+                    byte[] resource = jimage.getResource(location);
+                    return new ByteArrayInputStream(resource);
+                }
+                public int getContentLength() {
+                    long size = location.getUncompressedSize();
+                    return (size > Integer.MAX_VALUE) ? -1 : (int)size;
+                }
+            };
+        }
+
+        @Override
+        public Resource find(String module, String name) throws IOException {
+            String m = nameToModule(name);
+            if (!m.equals(module))
+                return null;
+            // URLConnection will do the permission check
+            return getResource(name, false);
+        }
+    }
 }
diff --git a/jdk/src/java.base/share/classes/sun/misc/Version.java.template b/jdk/src/java.base/share/classes/sun/misc/Version.java.template
index dd47869acbd..b6e58e387bc 100644
--- a/jdk/src/java.base/share/classes/sun/misc/Version.java.template
+++ b/jdk/src/java.base/share/classes/sun/misc/Version.java.template
@@ -38,9 +38,6 @@ public class Version {
     private static final String java_runtime_name =
         "@@java_runtime_name@@";
 
-    private static final String java_profile_name =
-        "@@java_profile_name@@";
-
     private static final String java_runtime_version =
         "@@java_runtime_version@@";
 
@@ -105,11 +102,6 @@ public class Version {
 
         ps.print(java_runtime_name + " (build " + java_runtime_version);
 
-        if (java_profile_name.length() > 0) {
-            // profile name
-            ps.print(", profile " + java_profile_name);
-        }
-
         if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
             // embedded builds report headless state
             ps.print(", headless");
diff --git a/jdk/src/java.base/share/classes/sun/net/NetProperties.java b/jdk/src/java.base/share/classes/sun/net/NetProperties.java
index 4232d854753..10075e45e3f 100644
--- a/jdk/src/java.base/share/classes/sun/net/NetProperties.java
+++ b/jdk/src/java.base/share/classes/sun/net/NetProperties.java
@@ -62,7 +62,7 @@ public class NetProperties {
             throw new Error("Can't find java.home ??");
         }
         try {
-            File f = new File(fname, "lib");
+            File f = new File(fname, "conf");
             f = new File(f, "net.properties");
             fname = f.getCanonicalPath();
             InputStream in = new FileInputStream(fname);
diff --git a/jdk/src/java.base/share/classes/sun/net/www/protocol/jrt/Handler.java b/jdk/src/java.base/share/classes/sun/net/www/protocol/jrt/Handler.java
new file mode 100644
index 00000000000..2495cc73a36
--- /dev/null
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/jrt/Handler.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.net.www.protocol.jrt;
+
+import java.io.IOException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+
+/**
+ * Protocol handler for accessing resources in the runtime image.
+ */
+
+public class Handler extends URLStreamHandler {
+    public Handler() { }
+
+    @Override
+    protected URLConnection openConnection(URL url) throws IOException {
+        return new JavaRuntimeURLConnection(url);
+    }
+}
diff --git a/jdk/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java b/jdk/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java
new file mode 100644
index 00000000000..33b6840a8a5
--- /dev/null
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/jrt/JavaRuntimeURLConnection.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.net.www.protocol.jrt;
+
+import java.io.File;
+import java.io.FilePermission;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.Permission;
+import java.security.PrivilegedAction;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+
+import sun.misc.Resource;
+import sun.net.www.ParseUtil;
+import sun.net.www.URLConnection;
+
+/**
+ * URLConnection implementation that can be used to connect to resources
+ * contained in the runtime image.
+ */
+public class JavaRuntimeURLConnection extends URLConnection {
+
+    /**
+     * Finds resource {@code name} in module {@code module}.
+     */
+    public interface ResourceFinder {
+        Resource find(String module, String name) throws IOException;
+    }
+
+    /**
+     * The list of resource finders for jimages in the runtime image.
+     */
+    private static final List<ResourceFinder> finders = new CopyOnWriteArrayList<>();
+
+    /**
+     * Called on behalf of the boot, extension and system class loaders to
+     * register a resource finder.
+     */
+    public static void register(ResourceFinder finder) {
+        finders.add(finder);
+    }
+
+    private static Resource find(String module, String name) throws IOException {
+        for (ResourceFinder finder: finders) {
+            Resource r = finder.find(module, name);
+            if (r != null) return r;
+        }
+        return null;
+    }
+
+    // the module and resource name in the URL
+    private final String module;
+    private final String name;
+
+    // the Resource when connected
+    private volatile Resource resource;
+
+    // the permission to access resources in the runtime image, created lazily
+    private static volatile Permission permission;
+
+    JavaRuntimeURLConnection(URL url) throws IOException {
+        super(url);
+        String path = url.getPath();
+        if (path.length() == 0 || path.charAt(0) != '/')
+            throw new MalformedURLException(url + " missing path or /");
+        if (path.length() == 1) {
+            this.module = null;
+            this.name = null;
+        } else {
+            int pos = path.indexOf('/', 1);
+            if (pos == -1) {
+                this.module = path.substring(1);
+                this.name = null;
+            } else {
+                this.module = path.substring(1, pos);
+                this.name = ParseUtil.decode(path.substring(pos+1));
+            }
+        }
+    }
+
+    @Override
+    public synchronized void connect() throws IOException {
+        if (!connected) {
+            if (name == null) {
+                String s = (module == null) ? "" : module;
+                throw new IOException("cannot connect to jrt:/" + s);
+            }
+            resource = find(module, name);
+            if (resource == null)
+                throw new IOException(module + "/" + name + " not found");
+            connected = true;
+        }
+    }
+
+    @Override
+    public InputStream getInputStream() throws IOException {
+        connect();
+        return resource.getInputStream();
+    }
+
+    @Override
+    public long getContentLengthLong() {
+        try {
+            connect();
+            return resource.getContentLength();
+        } catch (IOException ioe) {
+            return -1L;
+        }
+    }
+
+    @Override
+    public int getContentLength() {
+        long len = getContentLengthLong();
+        return len > Integer.MAX_VALUE ? -1 : (int)len;
+    }
+
+    @Override
+    public Permission getPermission() throws IOException {
+        Permission p = permission;
+        if (p == null) {
+            // using lambda expression here leads to recursive initialization
+            PrivilegedAction<String> pa = new PrivilegedAction<String>() {
+                public String run() { return System.getProperty("java.home"); }
+            };
+            String home = AccessController.doPrivileged(pa);
+            p = new FilePermission(home + File.separator + "-", "read");
+            permission = p;
+        }
+        return p;
+    }
+}
diff --git a/jdk/src/java.base/share/classes/sun/security/jca/ProviderConfig.java b/jdk/src/java.base/share/classes/sun/security/jca/ProviderConfig.java
index edbc899f076..620b2cb5d39 100644
--- a/jdk/src/java.base/share/classes/sun/security/jca/ProviderConfig.java
+++ b/jdk/src/java.base/share/classes/sun/security/jca/ProviderConfig.java
@@ -51,7 +51,7 @@ final class ProviderConfig {
 
     // config file argument of the SunPKCS11-Solaris provider
     private static final String P11_SOL_ARG  =
-        "${java.home}/lib/security/sunpkcs11-solaris.cfg";
+        "${java.home}/conf/security/sunpkcs11-solaris.cfg";
 
     // maximum number of times to try loading a provider before giving up
     private final static int MAX_LOAD_TRIES = 30;
diff --git a/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java b/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java
index 70fae4361fa..ccc8847b300 100644
--- a/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java
+++ b/jdk/src/java.base/share/classes/sun/security/provider/PolicyFile.java
@@ -77,7 +77,7 @@ import sun.net.www.ParseUtil;
  *   <i>auth.policy.url.1</i>, <i>auth.policy.url.2</i>, ...,
  *   <i>auth.policy.url.X</i>".  These properties are set
  *   in the Java security properties file, which is located in the file named
- *   &lt;JAVA_HOME&gt;/lib/security/java.security.
+ *   &lt;JAVA_HOME&gt;/conf/security/java.security.
  *   &lt;JAVA_HOME&gt; refers to the value of the java.home system property,
  *   and specifies the directory where the JRE is installed.
  *   Each property value specifies a <code>URL</code> pointing to a
@@ -318,7 +318,7 @@ public class PolicyFile extends java.security.Policy {
      *   you don't find one. Each of these specify a policy file.
      *
      *   if none of these could be loaded, use a builtin static policy
-     *      equivalent to the default lib/security/java.policy file.
+     *      equivalent to the default conf/security/java.policy file.
      *
      *   if the system property "java.policy" or "java.auth.policy" is defined
      * (which is the
@@ -468,7 +468,7 @@ public class PolicyFile extends java.security.Policy {
              * Caller did not specify URL via Policy.getInstance.
              * Read from URLs listed in the java.security properties file.
              *
-             * We call initPolicyFile with POLICY , POLICY_URL and then
+             * We call initPolicyFile with POLICY, POLICY_URL and then
              * call it with AUTH_POLICY and AUTH_POLICY_URL
              * So first we will process the JAVA standard policy
              * and then process the JAVA AUTH Policy.
@@ -709,26 +709,6 @@ public class PolicyFile extends java.security.Policy {
                 // No need to sync because noone has access to newInfo yet
                 newInfo.policyEntries.add(pe);
 
-                // Add AllPermissions for standard extensions
-                String[] extCodebases = PolicyParser.parseExtDirs(
-                    PolicyParser.EXTDIRS_EXPANSION, 0);
-                if (extCodebases != null && extCodebases.length > 0) {
-                    for (int i = 0; i < extCodebases.length; i++) {
-                        try {
-                            pe = new PolicyEntry(canonicalizeCodebase(
-                                new CodeSource(new URL(extCodebases[i]),
-                                    (Certificate[]) null), false ));
-                            pe.add(SecurityConstants.ALL_PERMISSION);
-
-                            // No need to sync because noone has access to
-                            // newInfo yet
-                            newInfo.policyEntries.add(pe);
-                        } catch (Exception e) {
-                            // this is probably bad (though not dangerous).
-                            // What should we do?
-                        }
-                    }
-                }
                 return null;
             }
         });
diff --git a/jdk/src/java.base/share/classes/sun/security/provider/PolicyParser.java b/jdk/src/java.base/share/classes/sun/security/provider/PolicyParser.java
index 02a41875ec7..c22f5a4eac7 100644
--- a/jdk/src/java.base/share/classes/sun/security/provider/PolicyParser.java
+++ b/jdk/src/java.base/share/classes/sun/security/provider/PolicyParser.java
@@ -83,14 +83,6 @@ import sun.security.util.ResourcesMgr;
 
 public class PolicyParser {
 
-    private static final String EXTDIRS_PROPERTY = "java.ext.dirs";
-    private static final String OLD_EXTDIRS_EXPANSION =
-        "${" + EXTDIRS_PROPERTY + "}";
-
-    // package-private: used by PolicyFile for static policy
-    static final String EXTDIRS_EXPANSION = "${{" + EXTDIRS_PROPERTY + "}}";
-
-
     private Vector<GrantEntry> grantEntries;
     private Map<String, DomainEntry> domainEntries;
 
@@ -576,35 +568,8 @@ public class PolicyParser {
         try {
             if (e.signedBy != null) e.signedBy = expand(e.signedBy);
             if (e.codeBase != null) {
-
-                // For backward compatibility with 1.4
-                if (e.codeBase.equals(OLD_EXTDIRS_EXPANSION)) {
-                    e.codeBase = EXTDIRS_EXPANSION;
-                }
-                int es;
-                if ((es=e.codeBase.indexOf(EXTDIRS_EXPANSION)) < 0) {
-                    e.codeBase = expand(e.codeBase, true).replace
-                                        (File.separatorChar, '/');
-                } else {
-                    // expand the system property "java.ext.dirs",
-                    // parse it into its path components,
-                    // and then create a grant entry for each component
-                    String[] extDirs = parseExtDirs(e.codeBase, es);
-                    if (extDirs != null && extDirs.length > 0) {
-                        for (int i = 0; i < extDirs.length; i++) {
-                            GrantEntry newGe = (GrantEntry)e.clone();
-                            newGe.codeBase = extDirs[i];
-                            add(newGe);
-
-                            if (debug != null) {
-                                debug.println("creating policy entry for " +
-                                        "expanded java.ext.dirs path:\n\t\t" +
-                                        extDirs[i]);
-                            }
-                        }
-                    }
-                    ignoreEntry = true;
-                }
+                e.codeBase = expand(e.codeBase, true).replace
+                                    (File.separatorChar, '/');
             }
         } catch (PropertyExpander.ExpandException peee) {
             if (debug != null) {
@@ -713,41 +678,6 @@ public class PolicyParser {
         return properties;
     }
 
-    // package-private: used by PolicyFile for static policy
-    static String[] parseExtDirs(String codebase, int start) {
-
-        String s = System.getProperty(EXTDIRS_PROPERTY);
-        String globalPrefix = (start > 0 ? codebase.substring(0, start) : "file:");
-        int end = start + EXTDIRS_EXPANSION.length();
-        String globalSuffix = (end < codebase.length() ? codebase.substring(end) :
-            (String) null);
-
-        String[] dirs = null;
-        String localSuffix;
-        if (s != null) {
-            StringTokenizer st =
-                new StringTokenizer(s, File.pathSeparator);
-            int count = st.countTokens();
-            dirs = new String[count];
-            for (int i = 0; i < count; i++) {
-                File file = new File(st.nextToken());
-                dirs[i] = sun.net.www.ParseUtil.encodePath
-                        (file.getAbsolutePath());
-
-                if (!dirs[i].startsWith("/")) {
-                    dirs[i] = "/" + dirs[i];
-                }
-
-                localSuffix = (globalSuffix == null ?
-                    (dirs[i].endsWith("/") ? "*" : "/*") :
-                    globalSuffix);
-
-                dirs[i] = globalPrefix + dirs[i] + localSuffix;
-            }
-        }
-        return dirs;
-    }
-
     private boolean peekAndMatch(String expect)
         throws ParsingException, IOException
     {
diff --git a/jdk/src/java.base/share/classes/sun/util/logging/PlatformLogger.java b/jdk/src/java.base/share/classes/sun/util/logging/PlatformLogger.java
index 37d0409e24e..4e8c48a1eac 100644
--- a/jdk/src/java.base/share/classes/sun/util/logging/PlatformLogger.java
+++ b/jdk/src/java.base/share/classes/sun/util/logging/PlatformLogger.java
@@ -71,10 +71,10 @@ import sun.misc.SharedSecrets;
  *   java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
  *
  * Limitation:
- * <JAVA_HOME>/lib/logging.properties is the system-wide logging
+ * <JAVA_HOME>/conf/logging.properties is the system-wide logging
  * configuration defined in the specification and read in the
  * default case to configure any java.util.logging.Logger instances.
- * Platform loggers will not detect if <JAVA_HOME>/lib/logging.properties
+ * Platform loggers will not detect if <JAVA_HOME>/conf/logging.properties
  * is modified. In other words, unless the java.util.logging API
  * is used at runtime or the logging system properties is set,
  * the platform loggers will use the default setting described above.
diff --git a/jdk/src/java.base/share/conf/security/java.policy b/jdk/src/java.base/share/conf/security/java.policy
index db986145e97..3cfcb22a1c0 100644
--- a/jdk/src/java.base/share/conf/security/java.policy
+++ b/jdk/src/java.base/share/conf/security/java.policy
@@ -1,31 +1,25 @@
 // permissions required by each component
-grant codeBase "file:${java.home}/lib/ext/zipfs.jar" {
+grant codeBase "jrt:/jdk.zipfs" {
         permission java.io.FilePermission "<<ALL FILES>>", "read,write,delete";
         permission java.lang.RuntimePermission "fileSystemProvider";
         permission java.util.PropertyPermission "*", "read";
 };
 
-grant codeBase "file:${java.home}/lib/ext/cldrdata.jar" {
+grant codeBase "jrt:/jdk.localedata" {
         permission java.lang.RuntimePermission "accessClassInPackage.sun.text.*";
         permission java.lang.RuntimePermission "accessClassInPackage.sun.util.*";
         permission java.util.PropertyPermission "*", "read";
 };
 
-grant codeBase "file:${java.home}/lib/ext/localedata.jar" {
-        permission java.lang.RuntimePermission "accessClassInPackage.sun.text.*";
-        permission java.lang.RuntimePermission "accessClassInPackage.sun.util.*";
-        permission java.util.PropertyPermission "*", "read";
-};
-
-grant codeBase "file:${java.home}/lib/ext/dnsns.jar" {
+grant codeBase "jrt:/jdk.naming.dns" {
         permission java.security.AllPermission;
 };
 
-grant codeBase "file:${java.home}/lib/ext/nashorn.jar" {
+grant codeBase "jrt:/jdk.scripting.nashorn" {
         permission java.security.AllPermission;
 };
 
-grant codeBase "file:${java.home}/lib/ext/ucrypto.jar" {
+grant codeBase "jrt:/jdk.crypto.ucrypto" {
         permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
         permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
         permission java.lang.RuntimePermission "loadLibrary.j2ucrypto";
@@ -34,10 +28,10 @@ grant codeBase "file:${java.home}/lib/ext/ucrypto.jar" {
         permission java.security.SecurityPermission "putProviderProperty.OracleUcrypto";
         permission java.security.SecurityPermission "clearProviderProperties.OracleUcrypto";
         permission java.security.SecurityPermission "removeProviderProperty.OracleUcrypto";
-        permission java.io.FilePermission "${java.home}/lib/security/ucrypto-solaris.cfg", "read";
+        permission java.io.FilePermission "${java.home}/conf/security/ucrypto-solaris.cfg", "read";
 };
 
-grant codeBase "file:${java.home}/lib/ext/sunec.jar" {
+grant codeBase "jrt:/jdk.crypto.ec" {
         permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
         permission java.lang.RuntimePermission "loadLibrary.sunec";
         permission java.util.PropertyPermission "*", "read";
@@ -46,16 +40,7 @@ grant codeBase "file:${java.home}/lib/ext/sunec.jar" {
         permission java.security.SecurityPermission "removeProviderProperty.SunEC";
 };
 
-grant codeBase "file:${java.home}/lib/ext/sunjce_provider.jar" {
-        permission java.lang.RuntimePermission "accessClassInPackage.sun.misc";
-        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
-        permission java.util.PropertyPermission "*", "read";
-        permission java.security.SecurityPermission "putProviderProperty.SunJCE";
-        permission java.security.SecurityPermission "clearProviderProperties.SunJCE";
-        permission java.security.SecurityPermission "removeProviderProperty.SunJCE";
-};
-
-grant codeBase "file:${java.home}/lib/ext/sunpkcs11.jar" {
+grant codeBase "jrt:/jdk.crypto.pkcs11" {
         permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
         permission java.lang.RuntimePermission "accessClassInPackage.sun.nio.ch";
         permission java.lang.RuntimePermission "loadLibrary.j2pkcs11";
diff --git a/jdk/src/java.base/share/conf/security/java.security b/jdk/src/java.base/share/conf/security/java.security
index 8e44c319f23..63337482fc8 100644
--- a/jdk/src/java.base/share/conf/security/java.security
+++ b/jdk/src/java.base/share/conf/security/java.security
@@ -66,8 +66,8 @@
 # List of providers and their preference orders (see above):
 #
 #ifdef solaris
-security.provider.tbd=com.oracle.security.ucrypto.UcryptoProvider ${java.home}/lib/security/ucrypto-solaris.cfg
-security.provider.tbd=sun.security.pkcs11.SunPKCS11 ${java.home}/lib/security/sunpkcs11-solaris.cfg
+security.provider.tbd=com.oracle.security.ucrypto.UcryptoProvider ${java.home}/conf/security/ucrypto-solaris.cfg
+security.provider.tbd=sun.security.pkcs11.SunPKCS11 ${java.home}/conf/security/sunpkcs11-solaris.cfg
 #endif
 security.provider.tbd=sun.security.provider.Sun
 security.provider.tbd=sun.security.rsa.SunRsaSign
@@ -162,7 +162,7 @@ policy.provider=sun.security.provider.PolicyFile
 
 # The default is to have a single system-wide policy file,
 # and a policy file in the user's home directory.
-policy.url.1=file:${java.home}/lib/security/java.policy
+policy.url.1=file:${java.home}/conf/security/java.policy
 policy.url.2=file:${user.home}/.java.policy
 
 # whether or not we expand properties in the policy file
@@ -219,12 +219,14 @@ package.access=sun.,\
                com.sun.org.apache.xml.internal.serializer.utils.,\
                com.sun.org.apache.xml.internal.utils.,\
                com.sun.org.glassfish.,\
+               com.sun.tools.script.,\
                com.oracle.xmlns.internal.,\
                com.oracle.webservices.internal.,\
                org.jcp.xml.dsig.internal.,\
                jdk.internal.,\
                jdk.nashorn.internal.,\
                jdk.nashorn.tools.,\
+               jdk.tools.jimage.,\
                com.sun.activation.registries.,\
 #ifdef macosx
                apple.,\
@@ -268,12 +270,14 @@ package.definition=sun.,\
                    com.sun.org.apache.xml.internal.serializer.utils.,\
                    com.sun.org.apache.xml.internal.utils.,\
                    com.sun.org.glassfish.,\
+                   com.sun.tools.script.,\
                    com.oracle.xmlns.internal.,\
                    com.oracle.webservices.internal.,\
                    org.jcp.xml.dsig.internal.,\
                    jdk.internal.,\
                    jdk.nashorn.internal.,\
                    jdk.nashorn.tools.,\
+                   jdk.tools.jimage.,\
                    com.sun.activation.registries.,\
 #ifdef macosx
                    apple.,\
diff --git a/jdk/src/java.base/share/native/libjava/System.c b/jdk/src/java.base/share/native/libjava/System.c
index 5c364602322..d09af8ff78a 100644
--- a/jdk/src/java.base/share/native/libjava/System.c
+++ b/jdk/src/java.base/share/native/libjava/System.c
@@ -314,7 +314,6 @@ Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props)
     // to all protocols
     if (sprops->exceptionList) {
         PUTPROP(props, "http.nonProxyHosts", sprops->exceptionList);
-        // HTTPS: implementation in jsse.jar uses http.nonProxyHosts
         PUTPROP(props, "ftp.nonProxyHosts", sprops->exceptionList);
         PUTPROP(props, "socksNonProxyHosts", sprops->exceptionList);
     }
diff --git a/jdk/src/java.base/share/native/libzip/zip_util.c b/jdk/src/java.base/share/native/libzip/zip_util.c
index de0bb1de9c3..51ee1d5276f 100644
--- a/jdk/src/java.base/share/native/libzip/zip_util.c
+++ b/jdk/src/java.base/share/native/libzip/zip_util.c
@@ -1411,6 +1411,7 @@ InflateFully(jzfile *zip, jzentry *entry, void *buf, char **msg)
             }
         } while (strm.avail_in > 0);
     }
+
     inflateEnd(&strm);
     return JNI_TRUE;
 }
@@ -1482,3 +1483,52 @@ ZIP_ReadEntry(jzfile *zip, jzentry *entry, unsigned char *buf, char *entryname)
 
     return JNI_TRUE;
 }
+
+jboolean JNICALL
+ZIP_InflateFully(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg)
+{
+    z_stream strm;
+    int i = 0;
+    memset(&strm, 0, sizeof(z_stream));
+
+    *pmsg = 0; /* Reset error message */
+
+    if (inflateInit2(&strm, MAX_WBITS) != Z_OK) {
+        *pmsg = strm.msg;
+        return JNI_FALSE;
+    }
+
+    strm.next_out = (Bytef *) outBuf;
+    strm.avail_out = (uInt)outLen;
+    strm.next_in = (Bytef *) inBuf;
+    strm.avail_in = (uInt)inLen;
+
+    do {
+        switch (inflate(&strm, Z_PARTIAL_FLUSH)) {
+            case Z_OK:
+                break;
+            case Z_STREAM_END:
+                if (strm.total_out != outLen) {
+                    *pmsg = "INFLATER_inflateFully: Unexpected end of stream";
+                    inflateEnd(&strm);
+                    return JNI_FALSE;
+                }
+                break;
+            case Z_DATA_ERROR:
+                *pmsg = "INFLATER_inflateFully: Compressed data corrupted";
+                inflateEnd(&strm);
+                return JNI_FALSE;
+            case Z_MEM_ERROR:
+                *pmsg = "INFLATER_inflateFully: out of memory";
+                inflateEnd(&strm);
+                return JNI_FALSE;
+            default:
+                *pmsg = "INFLATER_inflateFully: internal error";
+                inflateEnd(&strm);
+                return JNI_FALSE;
+        }
+    } while (strm.avail_in > 0);
+
+    inflateEnd(&strm);
+    return JNI_TRUE;
+}
diff --git a/jdk/src/java.base/share/native/libzip/zip_util.h b/jdk/src/java.base/share/native/libzip/zip_util.h
index a64668cd6d9..1287d3aa29e 100644
--- a/jdk/src/java.base/share/native/libzip/zip_util.h
+++ b/jdk/src/java.base/share/native/libzip/zip_util.h
@@ -272,4 +272,8 @@ jint ZIP_Read(jzfile *zip, jzentry *entry, jlong pos, void *buf, jint len);
 void ZIP_FreeEntry(jzfile *zip, jzentry *ze);
 jlong ZIP_GetEntryDataOffset(jzfile *zip, jzentry *entry);
 jzentry * ZIP_GetEntry2(jzfile *zip, char *name, jint ulen, jboolean addSlash);
+
+jboolean JNICALL
+ZIP_InflateFully(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg);
+
 #endif /* !_ZIP_H_ */
diff --git a/jdk/src/java.base/unix/native/libjava/ConcurrentPReader_md.c b/jdk/src/java.base/unix/native/libjava/ConcurrentPReader_md.c
new file mode 100644
index 00000000000..1bb49d82229
--- /dev/null
+++ b/jdk/src/java.base/unix/native/libjava/ConcurrentPReader_md.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <unistd.h>
+#include <errno.h>
+
+#include "jni.h"
+#include "jni_util.h"
+#include "jlong.h"
+#include "jdk_internal_jimage_concurrent_ConcurrentPReader.h"
+
+#ifdef _ALLBSD_SOURCE
+  #define pread64 pread
+#endif
+
+#define RESTARTABLE(_cmd, _result) do { \
+  do { \
+    _result = _cmd; \
+  } while((_result == -1) && (errno == EINTR)); \
+} while(0)
+
+static jfieldID fd_fdID;
+
+JNIEXPORT void JNICALL
+Java_jdk_internal_jimage_concurrent_ConcurrentPReader_initIDs(JNIEnv *env, jclass clazz)
+{
+    CHECK_NULL(clazz = (*env)->FindClass(env, "java/io/FileDescriptor"));
+    CHECK_NULL(fd_fdID = (*env)->GetFieldID(env, clazz, "fd", "I"));
+}
+
+JNIEXPORT jint JNICALL
+Java_jdk_internal_jimage_concurrent_ConcurrentPReader_pread(JNIEnv *env, jclass clazz,
+                                                            jobject fdo, jlong address,
+                                                            jint len, jlong offset)
+{
+    jint fd = (*env)->GetIntField(env, fdo, fd_fdID);
+    void *buf = (void *)jlong_to_ptr(address);
+    int res;
+    RESTARTABLE(pread64(fd, buf, len, offset), res);
+    if (res == -1) {
+        JNU_ThrowIOExceptionWithLastError(env, "pread failed");
+    }
+    return res;
+}
diff --git a/jdk/src/java.base/windows/conf/security/java.policy b/jdk/src/java.base/windows/conf/security/java.policy
index 590e5df3081..01d7bef3f43 100644
--- a/jdk/src/java.base/windows/conf/security/java.policy
+++ b/jdk/src/java.base/windows/conf/security/java.policy
@@ -1,5 +1,5 @@
-grant codeBase "file:${java.home}/lib/ext/sunmscapi.jar" {
-        Permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
+grant codeBase "jrt:/jdk.crypto.mscapi" {
+        permission java.lang.RuntimePermission "accessClassInPackage.sun.security.*";
         permission java.lang.RuntimePermission "loadLibrary.sunmscapi";
         permission java.util.PropertyPermission "*", "read";
         permission java.security.SecurityPermission "putProviderProperty.SunMSCAPI";
diff --git a/jdk/src/java.base/windows/native/libjava/ConcurrentPReader_md.c b/jdk/src/java.base/windows/native/libjava/ConcurrentPReader_md.c
new file mode 100644
index 00000000000..29df5384abd
--- /dev/null
+++ b/jdk/src/java.base/windows/native/libjava/ConcurrentPReader_md.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include <windows.h>
+
+#include "jni_util.h"
+#include "jlong.h"
+#include "jdk_internal_jimage_concurrent_ConcurrentPReader.h"
+
+static jfieldID handle_fdID;
+
+JNIEXPORT void JNICALL
+Java_jdk_internal_jimage_concurrent_ConcurrentPReader_initIDs(JNIEnv *env, jclass clazz)
+{
+    CHECK_NULL(clazz = (*env)->FindClass(env, "java/io/FileDescriptor"));
+    CHECK_NULL(handle_fdID = (*env)->GetFieldID(env, clazz, "handle", "J"));
+}
+
+JNIEXPORT jint JNICALL
+Java_jdk_internal_jimage_concurrent_ConcurrentPReader_pread(JNIEnv *env, jclass clazz,
+                                                            jobject fdo, jlong address,
+                                                            jint len, jlong offset)
+{
+    OVERLAPPED ov;
+    DWORD nread;
+    BOOL result;
+
+    jlong handle = (*env)->GetLongField(env, fdo, handle_fdID);
+    void *buf = (void *)jlong_to_ptr(address);
+
+    ZeroMemory(&ov, sizeof(ov));
+    ov.Offset = (DWORD)offset;
+    ov.OffsetHigh = (DWORD)(offset >> 32);
+
+    result = ReadFile(handle, (LPVOID)buf, len, &nread, &ov);
+    if (result == 0) {
+        JNU_ThrowIOExceptionWithLastError(env, "ReadFile failed");
+    }
+
+    return nread;
+}
+
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JDK13Services.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JDK13Services.java
index 3805bb8848c..be36779345a 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JDK13Services.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JDK13Services.java
@@ -64,7 +64,7 @@ public final class JDK13Services {
 
     /**
      * Filename of the properties file for default provider properties. This
-     * file is searched in the subdirectory "lib" of the JRE directory (this
+     * file is searched in the subdirectory "conf" of the JRE directory (this
      * behaviour is hardcoded).
      */
     private static final String PROPERTIES_FILENAME = "sound.properties";
diff --git a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java
index 6614b088cf3..8382f15e8c2 100644
--- a/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java
+++ b/jdk/src/java.desktop/share/classes/com/sun/media/sound/JSSecurityManager.java
@@ -81,7 +81,7 @@ final class JSSecurityManager {
         @param properties The properties bundle to store the values of the
         properties file.
         @param filename The filename of the properties file to load. This
-        filename is interpreted as relative to the subdirectory "lib" in
+        filename is interpreted as relative to the subdirectory "conf" in
         the JRE directory.
      */
     static void loadProperties(final Properties properties,
@@ -117,7 +117,7 @@ final class JSSecurityManager {
             if (fname == null) {
                 throw new Error("Can't find java.home ??");
             }
-            File f = new File(fname, "lib");
+            File f = new File(fname, "conf");
             f = new File(f, filename);
             fname = f.getCanonicalPath();
             InputStream in = new FileInputStream(fname);
diff --git a/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java b/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java
index 2fc0910cc96..985c946f422 100644
--- a/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java
+++ b/jdk/src/java.desktop/share/classes/java/awt/Toolkit.java
@@ -730,7 +730,7 @@ public abstract class Toolkit {
                 if (properties.size() == 0) {
                     try {
                         File propsFile = new File(
-                            System.getProperty("java.home") + sep + "lib" +
+                            System.getProperty("java.home") + sep + "conf" +
                             sep + "accessibility.properties");
                         FileInputStream in =
                             new FileInputStream(propsFile);
diff --git a/jdk/src/java.desktop/share/classes/javax/imageio/spi/IIORegistry.java b/jdk/src/java.desktop/share/classes/javax/imageio/spi/IIORegistry.java
index ca83967bad9..445f03323d7 100644
--- a/jdk/src/java.desktop/share/classes/javax/imageio/spi/IIORegistry.java
+++ b/jdk/src/java.desktop/share/classes/javax/imageio/spi/IIORegistry.java
@@ -64,10 +64,8 @@ import java.util.ServiceConfigurationError;
  * <code>ImageWriter</code>, <code>ImageTranscoder</code>,
  * <code>ImageInputStream</code>, and <code>ImageOutputStream</code>.
  *
- * <p> Service providers found on the system classpath (typically
- * the <code>lib/ext</code> directory in the Java
- * installation directory) are automatically loaded as soon as this class is
- * instantiated.
+ * Service providers found from the Java platform are automatically
+ * loaded as soon as this class is instantiated.
  *
  * <p> When the <code>registerApplicationClasspathSpis</code> method
  * is called, service provider instances declared in the
@@ -227,9 +225,7 @@ public final class IIORegistry extends ServiceRegistry {
 
     private void registerInstalledProviders() {
         /*
-          We need to load installed providers from the
-          system classpath (typically the <code>lib/ext</code>
-          directory in in the Java installation directory)
+          We need to load installed providers
           in the privileged mode in order to
           be able read corresponding jar files even if
           file read capability is restricted (like the
diff --git a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiSystem.java b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiSystem.java
index 4eee72a9d0a..aa8d46b0360 100644
--- a/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiSystem.java
+++ b/jdk/src/java.desktop/share/classes/javax/sound/midi/MidiSystem.java
@@ -65,7 +65,7 @@ import com.sun.media.sound.ReferenceCountingDevice;
  * Properties can be used to specify default MIDI devices. Both system
  * properties and a properties file are considered. The "sound.properties"
  * properties file is read from an implementation-specific location (typically
- * it is the {@code lib} directory in the Java installation directory). If a
+ * it is the {@code conf} directory in the Java installation directory). If a
  * property exists both as a system property and in the properties file, the
  * system property takes precedence. If none is specified, a suitable default is
  * chosen among the available devices. The syntax of the properties file is
diff --git a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java
index db528aebb83..8283b9dd4ac 100644
--- a/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java
+++ b/jdk/src/java.desktop/share/classes/javax/sound/sampled/AudioSystem.java
@@ -61,7 +61,7 @@ import com.sun.media.sound.JDK13Services;
  * Properties can be used to specify the default mixer for specific line types.
  * Both system properties and a properties file are considered. The
  * "sound.properties" properties file is read from an implementation-specific
- * location (typically it is the {@code lib} directory in the Java installation
+ * location (typically it is the {@code conf} directory in the Java installation
  * directory). If a property exists both as a system property and in the
  * properties file, the system property takes precedence. If none is specified,
  * a suitable default is chosen among the available devices. The syntax of the
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/UIManager.java b/jdk/src/java.desktop/share/classes/javax/swing/UIManager.java
index 44e9decfc26..7af3e332e94 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/UIManager.java
+++ b/jdk/src/java.desktop/share/classes/javax/swing/UIManager.java
@@ -106,7 +106,7 @@ import sun.awt.AWTAccessor;
  *       use its value as the default look and feel class name. The location
  *       that is checked for <code>swing.properties</code> may vary depending
  *       upon the implementation of the Java platform. Typically the
- *       <code>swing.properties</code> file is located in the <code>lib</code>
+ *       <code>swing.properties</code> file is located in the <code>conf</code>
  *       subdirectory of the Java installation directory.
  *       Refer to the release notes of the implementation being used for
  *       further details.
@@ -281,7 +281,7 @@ public class UIManager implements Serializable
     /**
      * The location of the <code>swing.properties</code> property file is
      * implementation-specific.
-     * It is typically located in the <code>lib</code> subdirectory of the Java
+     * It is typically located in the <code>conf</code> subdirectory of the Java
      * installation directory. This method returns a bogus filename
      * if <code>java.home</code> isn't defined.
      */
@@ -293,7 +293,7 @@ public class UIManager implements Serializable
         if (javaHome == null) {
             javaHome = "<java.home undefined>";
         }
-        return javaHome + sep + "lib" + sep + "swing.properties";
+        return javaHome + sep + "conf" + sep + "swing.properties";
     }
 
 
diff --git a/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html b/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html
index 3ae0bf2c6c0..512b1a581ea 100644
--- a/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html
+++ b/jdk/src/java.desktop/share/classes/javax/swing/plaf/multi/doc-files/multi_tsc.html
@@ -153,7 +153,7 @@ the Multiplexing look and feel.
 <p>
 It's easy to use auxiliary look and feels with Swing. To instruct 
 Swing to use the Multiplexing look and feel, all an application 
-has to do is modify the <code>$JDKHOME/lib/swing.properties</code>
+has to do is modify the <code>$JDKHOME/conf/swing.properties</code>
 file to include a definition of the <code>swing.auxiliarylaf</code>
 property. Swing treats the <code>swing.auxiliarylaf</code>
 property as a comma-separated list of <code>LookAndFeel</code>
@@ -179,7 +179,7 @@ is named <code>com.smellco.OlfactoryLookAndFeel</code>.
 <p>
 To tell Swing to use both these look and feels 
 -- and to use a default look and feel at the same time -- your application 
-could simply add the following line to the <code>$JDKHOME/lib/swing.properties</code> file:
+could simply add the following line to the <code>$JDKHOME/conf/swing.properties</code> file:
 </p>
 
 <p>
@@ -472,7 +472,7 @@ and Feel</b></font>
 </p>
 
             <p> To do that, all the user has to do is modify 
-              the <code>$JDKHOME/lib/swing.properties</code> 
+              the <code>$JDKHOME/conf/swing.properties</code> 
               file to include a definition of the <code>swing.plaf.multiplexinglaf</code> 
               property.�Swing then treats the <code>swing.plaf.multiplexinglaf</code> 
               property as a <code>LookAndFeel</code> 
@@ -483,7 +483,7 @@ and Feel</b></font>
               that is a better match for their needs than the Multiplexing 
               look and feel 
 	      (<code>javax.swing.plaf.multi.MultiLookAndFeel</code>), 
-              the user could include the following line in <code>$JDKHOME/lib/swing.properties</code>:
+              the user could include the following line in <code>$JDKHOME/conf/swing.properties</code>:
 </p>
 
 <p>
diff --git a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java
index 45f2c054bd6..e1b6547b040 100644
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java
@@ -78,7 +78,7 @@ import sun.misc.SharedSecrets;
  * <p>
  * If neither of these properties is defined then the LogManager uses its
  * default configuration. The default configuration is typically loaded from the
- * properties file "{@code lib/logging.properties}" in the Java installation
+ * properties file "{@code conf/logging.properties}" in the Java installation
  * directory.
  * <p>
  * The properties for loggers and Handlers will have names starting
@@ -1210,7 +1210,7 @@ public class LogManager {
             if (fname == null) {
                 throw new Error("Can't find java.home ??");
             }
-            File f = new File(fname, "lib");
+            File f = new File(fname, "conf");
             f = new File(f, "logging.properties");
             fname = f.getCanonicalPath();
         }
diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/security/FileLoginModule.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/security/FileLoginModule.java
index ccea59aa570..93ce806cf1c 100644
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/security/FileLoginModule.java
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/remote/security/FileLoginModule.java
@@ -65,7 +65,7 @@ import sun.management.jmxremote.ConnectorBootstrap;
  * associated cleartext password. By default, the following password file is
  * used:
  * <pre>
- *     ${java.home}/lib/management/jmxremote.password
+ *     ${java.home}/conf/management/jmxremote.password
  * </pre>
  * A different password file can be specified via the <code>passwordFile</code>
  * configuration option.
@@ -113,7 +113,7 @@ public class FileLoginModule implements LoginModule {
     // Location of the default password file
     private static final String DEFAULT_PASSWORD_FILE_NAME =
         AccessController.doPrivileged(new GetPropertyAction("java.home")) +
-        File.separatorChar + "lib" +
+        File.separatorChar + "conf" +
         File.separatorChar + "management" + File.separatorChar +
         ConnectorBootstrap.DefaultValues.PASSWORD_FILE_NAME;
 
diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/remote/security/JMXPluggableAuthenticator.java b/jdk/src/java.management/share/classes/com/sun/jmx/remote/security/JMXPluggableAuthenticator.java
index ab603ef5b1f..f7ab5d70fb6 100644
--- a/jdk/src/java.management/share/classes/com/sun/jmx/remote/security/JMXPluggableAuthenticator.java
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/remote/security/JMXPluggableAuthenticator.java
@@ -66,7 +66,7 @@ import com.sun.jmx.remote.util.EnvHelp;
  *
  * <p>To override the default configuration use the
  * <code>com.sun.management.jmxremote.login.config</code> management property
- * described in the JRE/lib/management/management.properties file.
+ * described in the JRE/conf/management/management.properties file.
  * Set this property to the name of a JAAS configuration entry and ensure that
  * the entry is loaded by the installed {@link Configuration}. In addition,
  * ensure that the authentication mechanisms specified in the entry acquire
diff --git a/jdk/src/java.management/share/classes/sun/management/Agent.java b/jdk/src/java.management/share/classes/sun/management/Agent.java
index 6a8f710ecc0..226986be994 100644
--- a/jdk/src/java.management/share/classes/sun/management/Agent.java
+++ b/jdk/src/java.management/share/classes/sun/management/Agent.java
@@ -165,7 +165,7 @@ public class Agent {
 
             // Load the management properties from the config file
             // if config file is not specified readConfiguration implicitly
-            // reads <java.home>/lib/management/management.properties
+            // reads <java.home>/conf/management/management.properties
 
             String fname = System.getProperty(CONFIG_FILE);
             readConfiguration(fname, configProps);
@@ -404,7 +404,7 @@ public class Agent {
                 throw new Error("Can't find java.home ??");
             }
             StringBuilder defaultFileName = new StringBuilder(home);
-            defaultFileName.append(File.separator).append("lib");
+            defaultFileName.append(File.separator).append("conf");
             defaultFileName.append(File.separator).append("management");
             defaultFileName.append(File.separator).append("management.properties");
             // Set file name
diff --git a/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java b/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java
index a2f05634c62..4ee5d504a10 100644
--- a/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java
+++ b/jdk/src/java.management/share/classes/sun/management/jmxremote/ConnectorBootstrap.java
@@ -615,11 +615,11 @@ public final class ConnectorBootstrap {
     /**
      * Compute the full path name for a default file.
      * @param basename basename (with extension) of the default file.
-     * @return ${JRE}/lib/management/${basename}
+     * @return ${JRE}/conf/management/${basename}
      **/
     private static String getDefaultFileName(String basename) {
         final String fileSeparator = File.separator;
-        return System.getProperty("java.home") + fileSeparator + "lib" +
+        return System.getProperty("java.home") + fileSeparator + "conf" +
                 fileSeparator + "management" + fileSeparator +
                 basename;
     }
diff --git a/jdk/src/java.management/share/conf/jmxremote.access b/jdk/src/java.management/share/conf/jmxremote.access
index ce80b47a1a8..a09e008fe34 100644
--- a/jdk/src/java.management/share/conf/jmxremote.access
+++ b/jdk/src/java.management/share/conf/jmxremote.access
@@ -8,9 +8,9 @@
 # passwords.  To be functional, a role must have an entry in
 # both the password and the access files.
 #
-# The default location of this file is $JRE/lib/management/jmxremote.access
-# You can specify an alternate location by specifying a property in 
-# the management config file $JRE/lib/management/management.properties
+# The default location of this file is $JRE/conf/management/jmxremote.access
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/conf/management/management.properties
 # (See that file for details)
 #
 # The file format for password and access files is syntactically the same
@@ -69,7 +69,7 @@
 #
 #
 # Default access control entries:
-# o The "monitorRole" role has readonly access.  
+# o The "monitorRole" role has readonly access.
 # o The "controlRole" role has readwrite access and can create the standard
 #   Timer and Monitor MBeans defined by the JMX API.
 
diff --git a/jdk/src/java.management/share/conf/jmxremote.password.template b/jdk/src/java.management/share/conf/jmxremote.password.template
index a7e7daac554..13dfd2578bb 100644
--- a/jdk/src/java.management/share/conf/jmxremote.password.template
+++ b/jdk/src/java.management/share/conf/jmxremote.password.template
@@ -19,9 +19,9 @@
 # access for each role.  To be functional, a role must have an entry
 # in both the password and the access files.
 #
-# Default location of this file is $JRE/lib/management/jmxremote.password
-# You can specify an alternate location by specifying a property in 
-# the management config file $JRE/lib/management/management.properties
+# Default location of this file is $JRE/conf/management/jmxremote.password
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/conf/management/management.properties
 # or by specifying a system property (See that file for details).
 
 
@@ -30,7 +30,7 @@
 ##############################################################
 #      Since there are cleartext passwords stored in this file,
 #      this file must be readable by ONLY the owner,
-#      otherwise the program will exit with an error. 
+#      otherwise the program will exit with an error.
 #
 # The file format for password and access files is syntactically the same
 # as the Properties file format.  The syntax is described in the Javadoc
diff --git a/jdk/src/java.management/share/conf/management.properties b/jdk/src/java.management/share/conf/management.properties
index db08b780ebd..529fd3b099c 100644
--- a/jdk/src/java.management/share/conf/management.properties
+++ b/jdk/src/java.management/share/conf/management.properties
@@ -10,7 +10,7 @@
 #
 # The default Management Configuration file is:
 #
-#       $JRE/lib/management/management.properties
+#       $JRE/conf/management/management.properties
 #
 # Another location for the Management Configuration File can be specified
 # by the following property on the Java command line:
@@ -110,7 +110,7 @@
 # com.sun.management.snmp.acl.file=filepath
 #      Specifies location for ACL file
 #      This is optional - default location is
-#      $JRE/lib/management/snmp.acl
+#      $JRE/conf/management/snmp.acl
 #
 #      If the property "com.sun.management.snmp.acl" is set to false,
 #      then this property and the ACL file are ignored.
@@ -289,7 +289,7 @@
 # com.sun.management.jmxremote.password.file=filepath
 #      Specifies location for password file
 #      This is optional - default location is
-#      $JRE/lib/management/jmxremote.password
+#      $JRE/conf/management/jmxremote.password
 #
 #      If the property "com.sun.management.jmxremote.authenticate" is set to
 #      false, then this property and the password & access files are ignored.
@@ -306,7 +306,7 @@
 # com.sun.management.jmxremote.access.file=filepath
 #      Specifies location for access  file
 #      This is optional - default location is
-#      $JRE/lib/management/jmxremote.access
+#      $JRE/conf/management/jmxremote.access
 #
 #      If the property "com.sun.management.jmxremote.authenticate" is set to
 #      false, then this property and the password & access files are ignored.
diff --git a/jdk/src/java.management/share/conf/snmp.acl.template b/jdk/src/java.management/share/conf/snmp.acl.template
index 0e766764f5e..cb9547bdcc9 100644
--- a/jdk/src/java.management/share/conf/snmp.acl.template
+++ b/jdk/src/java.management/share/conf/snmp.acl.template
@@ -10,12 +10,12 @@
 # ----------------------------------------------------------------------
 
 ############################################################
-#            SNMP Access Control List File  
+#            SNMP Access Control List File
 ############################################################
 #
-# Default location of this file is $JRE/lib/management/snmp.acl.
-# You can specify an alternate location by specifying a property in 
-# the management config file $JRE/lib/management/management.properties
+# Default location of this file is $JRE/conf/management/snmp.acl.
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/conf/management/management.properties
 # or by specifying a system property (See that file for details).
 #
 
@@ -23,10 +23,10 @@
 ##############################################################
 #        File permissions of the snmp.acl file
 ##############################################################
-# 
+#
 #      Since there are cleartext community strings stored in this file,
 #      this ACL file must be readable by ONLY the owner,
-#      otherwise the program will exit with an error. 
+#      otherwise the program will exit with an error.
 #
 ##############################################################
 #		Format of the acl group
@@ -41,8 +41,8 @@
 #    Each can be expressed as any one of the following:
 #    - hostname: hubble
 #    - ip v4 and v6 addresses: 123.456.789.12 , fe80::a00:20ff:fe9b:ea82
-#    - ip v4 and v6 netmask prefix notation: 123.456.789.0/24, 
-#         fe80::a00:20ff:fe9b:ea82/64  
+#    - ip v4 and v6 netmask prefix notation: 123.456.789.0/24,
+#         fe80::a00:20ff:fe9b:ea82/64
 #      see RFC 2373 (http://www.ietf.org/rfc/rfc2373.txt)
 #
 # An example of two community groups for multiple hosts:
@@ -58,7 +58,7 @@
 #       managers = hubble, telescope
 #     }
 #    }
-# 
+#
 ##############################################################
 #                   Format of the trap group
 ##############################################################
@@ -84,7 +84,7 @@
 #
 #  Update the community strings (public and private) below
 #  before copying this template file
-# 	
+#
 # Common SNMP ACL Example
 # ------------------------
 #
@@ -100,11 +100,11 @@
 #    managers = localhost
 #  }
 # }
-# 
-# 
+#
+#
 # trap = {
 #   {
 #     trap-community = public
-#     hosts = localhost 
+#     hosts = localhost
 #   }
 # }
diff --git a/jdk/src/java.naming/share/classes/com/sun/naming/internal/ResourceManager.java b/jdk/src/java.naming/share/classes/com/sun/naming/internal/ResourceManager.java
index 09be7ca7cd1..f783a13f316 100644
--- a/jdk/src/java.naming/share/classes/com/sun/naming/internal/ResourceManager.java
+++ b/jdk/src/java.naming/share/classes/com/sun/naming/internal/ResourceManager.java
@@ -60,9 +60,9 @@ public final class ResourceManager {
     private static final String APP_RESOURCE_FILE_NAME = "jndi.properties";
 
     /*
-     * Name of properties file in <java.home>/lib.
+     * Name of properties file in <java.home>/conf.
      */
-    private static final String JRELIB_PROPERTY_FILE_NAME = "jndi.properties";
+    private static final String JRE_CONF_PROPERTY_FILE_NAME = "jndi.properties";
 
     /*
      * Internal environment property, that when set to "true", disables
@@ -474,7 +474,7 @@ public final class ResourceManager {
     /*
      * Returns the Hashtable (never null) that results from merging
      * all application resource files available to this thread's
-     * context class loader.  The properties file in <java.home>/lib
+     * context class loader.  The properties file in <java.home>/conf
      * is also merged in.  The results are cached.
      *
      * SECURITY NOTES:
@@ -523,9 +523,9 @@ public final class ResourceManager {
                     }
                 }
 
-                // Merge in properties from file in <java.home>/lib.
+                // Merge in properties from file in <java.home>/conf.
                 InputStream istream =
-                    helper.getJavaHomeLibStream(JRELIB_PROPERTY_FILE_NAME);
+                    helper.getJavaHomeConfStream(JRE_CONF_PROPERTY_FILE_NAME);
                 if (istream != null) {
                     try {
                         Properties props = new Properties();
diff --git a/jdk/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java b/jdk/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java
index 2a9db220af0..6220e1e0128 100644
--- a/jdk/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java
+++ b/jdk/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java
@@ -159,12 +159,12 @@ public final class VersionHelper {
     }
 
     /*
-     * Returns an input stream for a file in <java.home>/lib,
+     * Returns an input stream for a file in <java.home>/conf,
      * or null if it cannot be located or opened.
      *
      * @param filename  The file name, sans directory.
      */
-    InputStream getJavaHomeLibStream(String filename) {
+    InputStream getJavaHomeConfStream(String filename) {
         PrivilegedAction<InputStream> act = () -> {
             try {
                 String javahome = System.getProperty("java.home");
@@ -172,7 +172,7 @@ public final class VersionHelper {
                     return null;
                 }
                 String pathname = javahome + File.separator +
-                        "lib" + File.separator + filename;
+                        "conf" + File.separator + filename;
                 return new FileInputStream(pathname);
             } catch (Exception e) {
                 return null;
diff --git a/jdk/src/java.naming/share/classes/javax/naming/Context.java b/jdk/src/java.naming/share/classes/javax/naming/Context.java
index 3f1b759b424..8ff5b041eb5 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/Context.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/Context.java
@@ -207,11 +207,9 @@ import java.util.Hashtable;
  * {@link ClassLoader#getResources <tt>ClassLoader.getResources()</tt>})
  * all <em>application resource files</em> named <tt>jndi.properties</tt>
  * in the classpath.
- * In addition, if the file <i>java.home</i><tt>/lib/jndi.properties</tt>
- * exists and is readable,
+ * In addition, if the Java installation directory contains a built-in
+ * properties file, typically <tt>conf/jndi.properties</tt>,
  * JNDI treats it as an additional application resource file.
- * (<i>java.home</i> indicates the
- * directory named by the <tt>java.home</tt> system property.)
  * All of the properties contained in these files are placed
  * into the environment of the initial context.  This environment
  * is then inherited by other contexts.
diff --git a/jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell/Main.java b/jdk/src/java.scripting/share/classes/com/sun/tools/script/shell/Main.java
similarity index 99%
rename from jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell/Main.java
rename to jdk/src/java.scripting/share/classes/com/sun/tools/script/shell/Main.java
index a6b19a6ca06..9e7a0cac1f3 100644
--- a/jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell/Main.java
+++ b/jdk/src/java.scripting/share/classes/com/sun/tools/script/shell/Main.java
@@ -474,9 +474,8 @@ public class Main {
              * know the class loader used by a specific engine, we
              * can't configure correct loader.
              */
-            ClassLoader parent = Main.class.getClassLoader();
             URL[] urls = pathToURLs(classPath);
-            URLClassLoader loader = new URLClassLoader(urls, parent);
+            URLClassLoader loader = new URLClassLoader(urls);
             Thread.currentThread().setContextClassLoader(loader);
         }
 
diff --git a/jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell/init.js b/jdk/src/java.scripting/share/classes/com/sun/tools/script/shell/init.js
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell/init.js
rename to jdk/src/java.scripting/share/classes/com/sun/tools/script/shell/init.js
diff --git a/jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell/messages.properties b/jdk/src/java.scripting/share/classes/com/sun/tools/script/shell/messages.properties
similarity index 100%
rename from jdk/src/jdk.dev/share/classes/com/sun/tools/script/shell/messages.properties
rename to jdk/src/java.scripting/share/classes/com/sun/tools/script/shell/messages.properties
diff --git a/jdk/src/java.scripting/share/classes/javax/script/ScriptEngineManager.java b/jdk/src/java.scripting/share/classes/javax/script/ScriptEngineManager.java
index b2af53e5bc3..e4d75c6a1fe 100644
--- a/jdk/src/java.scripting/share/classes/javax/script/ScriptEngineManager.java
+++ b/jdk/src/java.scripting/share/classes/javax/script/ScriptEngineManager.java
@@ -66,8 +66,7 @@ public class ScriptEngineManager  {
      * <code>ScriptEngineFactory</code> visible to the given
      * <code>ClassLoader</code> using the <a href="../../../technotes/guides/jar/jar.html#Service%20Provider">service provider</a> mechanism.<br><br>
      * If loader is <code>null</code>, the script engine factories that are
-     * bundled with the platform and that are in the usual extension
-     * directories (installed extensions) are loaded. <br><br>
+     * bundled with the platform are loaded. <br>
      *
      * @param loader ClassLoader used to discover script engine factories.
      */
diff --git a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/package-info.java b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/package-info.java
index 01d4b5399b5..bcf1856f245 100644
--- a/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/package-info.java
+++ b/jdk/src/java.security.jgss/share/classes/javax/security/auth/kerberos/package-info.java
@@ -45,7 +45,7 @@
  * file. If none of these system properties are set, the {@code krb5.conf}
  * file is searched for in an implementation-specific manner. Typically,
  * an implementation will first look for a {@code krb5.conf} file in
- * {@code <java-home>/lib/security} and failing that, in an OS-specific
+ * {@code <java-home>/conf/security} and failing that, in an OS-specific
  * location.<p>
  *
  * The {@code krb5.conf} file is formatted in the Windows INI file style,
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
index 7779cf0a4db..26722f2b885 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
@@ -737,7 +737,7 @@ public class Config {
      *
      * If the system property "java.security.krb5.conf" is defined, we'll
      * use its value, no matter if the file exists or not. Otherwise, we
-     * will look at $JAVA_HOME/lib/security directory with "krb5.conf" name,
+     * will look at $JAVA_HOME/conf/security directory with "krb5.conf" name,
      * and return it if the file exists.
      *
      * The method returns null if it cannot find a Java config file.
@@ -746,7 +746,7 @@ public class Config {
         String name = getProperty("java.security.krb5.conf");
         if (name == null) {
             name = getProperty("java.home") + File.separator +
-                                "lib" + File.separator + "security" +
+                                "conf" + File.separator + "security" +
                                 File.separator + "krb5.conf";
             if (!fileExists(name)) {
                 name = null;
diff --git a/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/SunEC.java b/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/SunEC.java
index 15c7b438b8b..3b1591fb9e8 100644
--- a/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/SunEC.java
+++ b/jdk/src/jdk.crypto.ec/share/classes/sun/security/ec/SunEC.java
@@ -37,12 +37,11 @@ import sun.security.action.PutAllAction;
  * IMPLEMENTATION NOTE:
  * The Java classes in this provider access a native ECC implementation
  * via JNI to a C++ wrapper class which in turn calls C functions.
- * The Java classes are packaged into the signed sunec.jar in the JRE
- * extensions directory and the C++ and C functions are packaged into
- * libsunec.so or sunec.dll in the JRE native libraries directory.
- * If the native library is not present then this provider is registered
- * with support for fewer ECC algorithms (KeyPairGenerator, Signature and
- * KeyAgreement are omitted).
+ * The Java classes are packaged into the jdk.crypto.sunec module and the
+ * C++ and C functions are packaged into libsunec.so or sunec.dll in the
+ * JRE native libraries directory.  If the native library is not present
+ * then this provider is registered with support for fewer ECC algorithms
+ * (KeyPairGenerator, Signature and KeyAgreement are omitted).
  *
  * @since   1.7
  */
diff --git a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/Config.java b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/Config.java
index 67dc8a33e4f..7d07103a289 100644
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/Config.java
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/Config.java
@@ -35,8 +35,6 @@ import java.security.*;
 import sun.security.action.GetPropertyAction;
 import sun.security.util.PropertyExpander;
 
-import sun.security.pkcs11.wrapper.*;
-
 /**
  * Configuration container and file parsing.
  *
diff --git a/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/JImageTask.java b/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/JImageTask.java
new file mode 100644
index 00000000000..9bb21633dba
--- /dev/null
+++ b/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/JImageTask.java
@@ -0,0 +1,596 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.tools.jimage;
+
+import java.io.BufferedOutputStream;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import jdk.internal.jimage.BasicImageReader;
+import jdk.internal.jimage.BasicImageWriter;
+import jdk.internal.jimage.ImageHeader;
+import jdk.internal.jimage.ImageLocation;
+import jdk.internal.jimage.PackageModuleMap;
+
+class JImageTask {
+    static class BadArgs extends Exception {
+        static final long serialVersionUID = 8765093759964640723L;  // ## re-generate
+        final String key;
+        final Object[] args;
+        boolean showUsage;
+
+        BadArgs(String key, Object... args) {
+            super(JImageTask.getMessage(key, args));
+            this.key = key;
+            this.args = args;
+        }
+
+        BadArgs showUsage(boolean b) {
+            showUsage = b;
+            return this;
+        }
+    }
+
+    static abstract class Option {
+        final boolean hasArg;
+        final String[] aliases;
+
+        Option(boolean hasArg, String... aliases) {
+            this.hasArg = hasArg;
+            this.aliases = aliases;
+        }
+
+        boolean isHidden() {
+            return false;
+        }
+
+        boolean matches(String opt) {
+            for (String a : aliases) {
+                if (a.equals(opt)) {
+                    return true;
+                } else if (opt.startsWith("--") && hasArg && opt.startsWith(a + "=")) {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        boolean ignoreRest() {
+            return false;
+        }
+
+        abstract void process(JImageTask task, String opt, String arg) throws BadArgs;
+    }
+
+    static abstract class HiddenOption extends Option {
+        HiddenOption(boolean hasArg, String... aliases) {
+            super(hasArg, aliases);
+        }
+
+        @Override
+        boolean isHidden() {
+            return true;
+        }
+    }
+
+    static Option[] recognizedOptions = {
+        new Option(true, "--dir") {
+            @Override
+            void process(JImageTask task, String opt, String arg) throws BadArgs {
+                 task.options.directory = arg;
+            }
+        },
+        new HiddenOption(false, "--fullversion") {
+            @Override
+            void process(JImageTask task, String opt, String arg) {
+                task.options.fullVersion = true;
+            }
+        },
+        new Option(false, "--help") {
+            @Override
+            void process(JImageTask task, String opt, String arg) {
+                task.options.help = true;
+            }
+        },
+        new Option(false, "--verbose") {
+            @Override
+            void process(JImageTask task, String opt, String arg) throws BadArgs {
+                 task.options.verbose = true;
+            }
+        },
+        new Option(false, "--version") {
+            @Override
+            void process(JImageTask task, String opt, String arg) {
+                task.options.version = true;
+            }
+        },
+    };
+
+    static class Options {
+        Task task = Task.LIST;
+        String directory = ".";
+        boolean fullVersion;
+        boolean help;
+        boolean verbose;
+        boolean version;
+        List<File> jimages = new LinkedList<>();
+    }
+
+    private static final String PROGNAME = "jimage";
+    private final Options options = new Options();
+
+    enum Task {
+        RECREATE,
+        EXTRACT,
+        INFO,
+        LIST,
+        VERIFY
+    };
+
+    private String pad(String string, int width, boolean justifyRight) {
+        int length = string.length();
+
+        if (length == width) {
+            return string;
+        }
+
+        if (length > width) {
+            return string.substring(0, width);
+        }
+
+        int padding = width - length;
+
+        StringBuilder sb = new StringBuilder(width);
+        if (justifyRight) {
+            for (int i = 0; i < padding; i++) {
+                sb.append(' ');
+            }
+        }
+
+        sb.append(string);
+
+        if (!justifyRight) {
+            for (int i = 0; i < padding; i++) {
+                sb.append(' ');
+            }
+        }
+
+        return sb.toString();
+    }
+
+    private String pad(String string, int width) {
+        return pad(string, width, false);
+    }
+
+    private String pad(long value, int width) {
+        return pad(Long.toString(value), width, true);
+    }
+
+    private static final int EXIT_OK = 0;        // No errors.
+    private static final int EXIT_ERROR = 1;     // Completed but reported errors.
+    private static final int EXIT_CMDERR = 2;    // Bad command-line arguments and/or switches.
+    private static final int EXIT_SYSERR = 3;    // System error or resource exhaustion.
+    private static final int EXIT_ABNORMAL = 4;  // Terminated abnormally.
+
+    int run(String[] args) {
+        if (log == null) {
+            log = new PrintWriter(System.out);
+        }
+
+        try {
+            handleOptions(args);
+            if (options.help) {
+                showHelp();
+            }
+            if (options.version || options.fullVersion) {
+                showVersion(options.fullVersion);
+            }
+            boolean ok = run();
+            return ok ? EXIT_OK : EXIT_ERROR;
+        } catch (BadArgs e) {
+            reportError(e.key, e.args);
+            if (e.showUsage) {
+                log.println(getMessage("main.usage.summary", PROGNAME));
+            }
+            return EXIT_CMDERR;
+        } catch (Exception x) {
+            x.printStackTrace();
+            return EXIT_ABNORMAL;
+        } finally {
+            log.flush();
+        }
+    }
+
+    static final String MODULES_ENTRY = PackageModuleMap.MODULES_ENTRY;
+    static final String PACKAGES_ENTRY = "/" + PackageModuleMap.PACKAGES_ENTRY;
+
+    private void recreate() throws IOException, BadArgs {
+        File directory = new File(options.directory);
+        Path dirPath = directory.toPath();
+        int chop = dirPath.toString().length() + 1;
+
+        if (!directory.isDirectory()) {
+            throw new BadArgs("err.not.a.dir", directory.getAbsolutePath());
+        }
+
+        if (options.jimages.isEmpty()) {
+            throw new BadArgs("err.jimage.not.specified");
+        } else if (options.jimages.size() != 1) {
+            throw new BadArgs("err.only.one.jimage");
+        }
+
+        File jimage = options.jimages.get(0);
+        final List<File> files = new ArrayList<>();
+        final BasicImageWriter writer = new BasicImageWriter();
+        final Long longZero = 0L;
+
+        // Note: code sensitive to Netbeans parser crashing.
+        long total = Files.walk(dirPath).reduce(longZero, (Long offset, Path path) -> {
+                    long size = 0;
+                    String pathString = path.toString();
+
+                    if (pathString.length() < chop || pathString.startsWith(".")) {
+                        return 0L;
+                    }
+
+                    String name = pathString.substring(chop).replace('\\','/');
+
+                    File file = path.toFile();
+
+                    if (file.isFile()) {
+                        if (options.verbose) {
+                            log.println(name);
+                        }
+
+                        if (name.endsWith(MODULES_ENTRY) || name.endsWith(PACKAGES_ENTRY)) {
+                            try {
+                                try (Stream<String> lines = Files.lines(path)) {
+                                    size = lines.peek(s -> writer.addString(s)).count() * 4;
+                                }
+                            } catch (IOException ex) {
+                                // Caught again when writing file.
+                                size = 0;
+                            }
+                        } else {
+                            size = file.length();
+                        }
+
+                        writer.addLocation(name, offset, 0L, size);
+                        files.add(file);
+                    }
+
+                    return offset + size;
+                },
+                (Long offsetL, Long offsetR) -> { return longZero; } );
+
+        if (jimage.createNewFile()) {
+            try (OutputStream os = Files.newOutputStream(jimage.toPath());
+                    BufferedOutputStream bos = new BufferedOutputStream(os);
+                    DataOutputStream out = new DataOutputStream(bos)) {
+
+                byte[] index = writer.getBytes();
+                out.write(index, 0, index.length);
+
+                for (File file : files) {
+                    try {
+                        Path path = file.toPath();
+                        String name = path.toString();
+
+                        if (name.endsWith(MODULES_ENTRY) || name.endsWith(PACKAGES_ENTRY)) {
+                            for (String line: Files.readAllLines(path)) {
+                                int off = writer.addString(line);
+                                out.writeInt(off);
+                            }
+                        } else {
+                            Files.copy(path, out);
+                        }
+                    } catch (IOException ex) {
+                        throw new BadArgs("err.cannot.read.file", file.getName());
+                    }
+                }
+            }
+        } else {
+            throw new BadArgs("err.jimage.already.exists", jimage.getName());
+        }
+
+    }
+
+    private void title(File file, BasicImageReader reader) {
+        log.println("jimage: " + file.getName());
+    }
+
+    private void listTitle(File file, BasicImageReader reader) {
+        title(file, reader);
+
+        if (options.verbose) {
+            log.print(pad("Offset", OFFSET_WIDTH + 1));
+            log.print(pad("Size", SIZE_WIDTH + 1));
+            log.print(pad("Compressed", COMPRESSEDSIZE_WIDTH + 1));
+            log.println(" Entry");
+        }
+    }
+
+    private interface JImageAction {
+        public void apply(File file, BasicImageReader reader) throws IOException, BadArgs;
+    }
+
+    private interface ResourceAction {
+        public void apply(BasicImageReader reader, String name, ImageLocation location) throws IOException, BadArgs;
+    }
+
+    private void extract(BasicImageReader reader, String name, ImageLocation location) throws IOException, BadArgs {
+        File directory = new File(options.directory);
+        byte[] bytes = reader.getResource(location);
+        File resource =  new File(directory, name);
+        File parent = resource.getParentFile();
+
+        if (parent.exists()) {
+            if (!parent.isDirectory()) {
+                throw new BadArgs("err.cannot.create.dir", parent.getAbsolutePath());
+            }
+        } else if (!parent.mkdirs()) {
+            throw new BadArgs("err.cannot.create.dir", parent.getAbsolutePath());
+        }
+
+        if (name.endsWith(MODULES_ENTRY) || name.endsWith(PACKAGES_ENTRY)) {
+            List<String> names = reader.getNames(bytes);
+            Files.write(resource.toPath(), names);
+        } else {
+            Files.write(resource.toPath(), bytes);
+        }
+    }
+
+    private static final int NAME_WIDTH = 40;
+    private static final int NUMBER_WIDTH = 12;
+    private static final int OFFSET_WIDTH = NUMBER_WIDTH;
+    private static final int SIZE_WIDTH = NUMBER_WIDTH;
+    private static final int COMPRESSEDSIZE_WIDTH = NUMBER_WIDTH;
+
+    private void print(String entry, ImageLocation location) {
+        log.print(pad(location.getContentOffset(), OFFSET_WIDTH) + " ");
+        log.print(pad(location.getUncompressedSize(), SIZE_WIDTH) + " ");
+        log.print(pad(location.getCompressedSize(), COMPRESSEDSIZE_WIDTH) + " ");
+        log.println(entry);
+    }
+
+    private void print(BasicImageReader reader, String entry) {
+        if (options.verbose) {
+            print(entry, reader.findLocation(entry));
+        } else {
+            log.println(entry);
+        }
+    }
+
+    private void info(File file, BasicImageReader reader) {
+        ImageHeader header = reader.getHeader();
+
+        log.println(" Major Version:  " + header.getMajorVersion());
+        log.println(" Minor Version:  " + header.getMinorVersion());
+        log.println(" Location Count: " + header.getLocationCount());
+        log.println(" Offsets Size:   " + header.getOffsetsSize());
+        log.println(" Redirects Size: " + header.getRedirectSize());
+        log.println(" Locations Size: " + header.getLocationsSize());
+        log.println(" Strings Size:   " + header.getStringsSize());
+        log.println(" Index Size:     " + header.getIndexSize());
+    }
+
+    private void list(BasicImageReader reader, String name, ImageLocation location) {
+        print(reader, name);
+    }
+
+    void verify(BasicImageReader reader, String name, ImageLocation location) {
+        if (name.endsWith(".class")) {
+            byte[] bytes;
+            try {
+                bytes = reader.getResource(location);
+            } catch (IOException ex) {
+                log.println(ex);
+                bytes = null;
+            }
+
+            if (bytes == null || bytes.length <= 4 ||
+                (bytes[0] & 0xFF) != 0xCA ||
+                (bytes[1] & 0xFF) != 0xFE ||
+                (bytes[2] & 0xFF) != 0xBA ||
+                (bytes[3] & 0xFF) != 0xBE) {
+                log.print(" NOT A CLASS: ");
+                print(reader, name);
+            }
+        }
+    }
+
+    private void iterate(JImageAction jimageAction, ResourceAction resourceAction) throws IOException, BadArgs {
+        for (File file : options.jimages) {
+            if (!file.exists() || !file.isFile()) {
+                throw new BadArgs("err.not.a.jimage", file.getName());
+            }
+
+            String path = file.getCanonicalPath();
+            BasicImageReader reader = BasicImageReader.open(path);
+
+            if (jimageAction != null) {
+                jimageAction.apply(file, reader);
+            }
+
+            if (resourceAction != null) {
+                String[] entryNames = reader.getEntryNames(true);
+
+                for (String name : entryNames) {
+                    ImageLocation location = reader.findLocation(name);
+                    resourceAction.apply(reader, name, location);
+                }
+            }
+       }
+    }
+
+    private boolean run() throws IOException, BadArgs {
+        switch (options.task) {
+            case RECREATE:
+                recreate();
+                break;
+            case EXTRACT:
+                iterate(null, this::extract);
+                break;
+            case INFO:
+                iterate(this::info, null);
+                break;
+            case LIST:
+                iterate(this::listTitle, this::list);
+                break;
+            case VERIFY:
+                iterate(this::title, this::verify);
+                break;
+            default:
+                throw new BadArgs("err.invalid.task", options.task.name()).showUsage(true);
+        }
+        return true;
+    }
+
+    private PrintWriter log;
+    void setLog(PrintWriter out) {
+        log = out;
+    }
+    public void handleOptions(String[] args) throws BadArgs {
+        // process options
+        int first = 0;
+
+        if (args.length == 0) {
+            return;
+        }
+
+        String arg = args[first];
+
+        if (!arg.startsWith("-")) {
+            try {
+                options.task = Enum.valueOf(Task.class, arg.toUpperCase());
+                first++;
+            } catch (IllegalArgumentException e) {
+                throw new BadArgs("err.invalid.task", arg).showUsage(true);
+            }
+        }
+
+        for (int i = first; i < args.length; i++) {
+            arg = args[i];
+
+            if (arg.charAt(0) == '-') {
+                Option option = getOption(arg);
+                String param = null;
+
+                if (option.hasArg) {
+                    if (arg.startsWith("--") && arg.indexOf('=') > 0) {
+                        param = arg.substring(arg.indexOf('=') + 1, arg.length());
+                    } else if (i + 1 < args.length) {
+                        param = args[++i];
+                    }
+
+                    if (param == null || param.isEmpty() || param.charAt(0) == '-') {
+                        throw new BadArgs("err.missing.arg", arg).showUsage(true);
+                    }
+                }
+
+                option.process(this, arg, param);
+
+                if (option.ignoreRest()) {
+                    i = args.length;
+                }
+            } else {
+                File file = new File(arg);
+                options.jimages.add(file);
+            }
+        }
+    }
+
+    private Option getOption(String name) throws BadArgs {
+        for (Option o : recognizedOptions) {
+            if (o.matches(name)) {
+                return o;
+            }
+        }
+        throw new BadArgs("err.unknown.option", name).showUsage(true);
+    }
+
+    private void reportError(String key, Object... args) {
+        log.println(getMessage("error.prefix") + " " + getMessage(key, args));
+    }
+
+    private void warning(String key, Object... args) {
+        log.println(getMessage("warn.prefix") + " " + getMessage(key, args));
+    }
+
+    private void showHelp() {
+        log.println(getMessage("main.usage", PROGNAME));
+        for (Option o : recognizedOptions) {
+            String name = o.aliases[0].substring(1); // there must always be at least one name
+            name = name.charAt(0) == '-' ? name.substring(1) : name;
+            if (o.isHidden() || name.equals("h")) {
+                continue;
+            }
+            log.println(getMessage("main.opt." + name));
+        }
+    }
+
+    private void showVersion(boolean full) {
+        log.println(version(full ? "full" : "release"));
+    }
+
+    private String version(String key) {
+        return System.getProperty("java.version");
+    }
+
+    static String getMessage(String key, Object... args) {
+        try {
+            return MessageFormat.format(ResourceBundleHelper.bundle.getString(key), args);
+        } catch (MissingResourceException e) {
+            throw new InternalError("Missing message: " + key);
+        }
+    }
+
+    private static class ResourceBundleHelper {
+        static final ResourceBundle bundle;
+
+        static {
+            Locale locale = Locale.getDefault();
+            try {
+                bundle = ResourceBundle.getBundle("jdk.tools.jimage.resources.jimage", locale);
+            } catch (MissingResourceException e) {
+                throw new InternalError("Cannot find jimage resource bundle for locale " + locale);
+            }
+        }
+    }
+}
diff --git a/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/Main.java b/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/Main.java
new file mode 100644
index 00000000000..7191a71f625
--- /dev/null
+++ b/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/Main.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package jdk.tools.jimage;
+
+import java.io.PrintWriter;
+
+
+public class Main {
+    public static void main(String[] args) throws Exception {
+        JImageTask t = new JImageTask();
+        int rc = t.run(args);
+        System.exit(rc);
+    }
+
+    /**
+     * Entry point that does <i>not</i> call System.exit.
+     *
+     * @param args command line arguments
+     * @param out output stream
+     * @return an exit code. 0 means success, non-zero means an error occurred.
+     */
+    public static int run(String[] args, PrintWriter out) {
+        JImageTask t = new JImageTask();
+        t.setLog(out);
+        return t.run(args);
+    }
+}
diff --git a/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/resources/jimage.properties b/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/resources/jimage.properties
new file mode 100644
index 00000000000..f47e1aaf9eb
--- /dev/null
+++ b/jdk/src/jdk.dev/share/classes/jdk/tools/jimage/resources/jimage.properties
@@ -0,0 +1,45 @@
+main.usage.summary=\
+Usage: {0} <extract|recreate|info|list|verify> <options> jimage...\n\
+use --help for a list of possible options
+
+main.usage=\
+Usage: {0} <extract|recreate|info|list|verify> <options> jimage...\n\
+\n\
+\  extract  - Extract all jimage entries into separate files into the directory\n\
+\             specified by --dir=<directory> (default='.')\n\
+\  recreate - Reconstructs a jimage from an extracted directory (--dir)\n\
+\  info     - Prints information specified in the jimage header.\n\
+\  list     - Prints the names of all the entries in the jimage.  When used with\n\
+\             --verbose will also print entry attributes ex. size and offset.\n\
+\  verify   - Reports errors on any .class entries that don't verify as classes.\n\
+\n\
+Possible options include:
+
+error.prefix=Error:
+warn.prefix=Warning:
+
+main.opt.dir=\
+\  --dir                                Target directory for create/expand
+
+main.opt.verbose=\
+\  --verbose                            Verbose listing
+
+main.opt.help=\
+\  --help                               Print this usage message
+
+main.opt.version=\
+\  --version                            Version information
+
+err.invalid.task=task must be list|expand|info|verify: {0}
+err.not.a.dir=not a directory: {0}
+err.jimage.not.specified=no jimage specified
+err.only.one.jimage=only one jimage should be specified
+err.jimage.already.exists=jimage already exists: {0}
+err.cannot.read.file=cannot read file: {0}
+err.cannot.create.dir=cannot create directory: {0}
+err.not.a.jimage=not a jimage file: {0}
+err.unknown.option=unknown option: {0}
+err.missing.arg=no value given for {0}
+err.internal.error=internal error: {0} {1} {2}
+err.invalid.arg.for.option=invalid argument for option: {0}
+err.option.unsupported={0} not supported: {1}
diff --git a/jdk/src/jdk.localedata/META-INF/localedata-services/sun.util.locale.provider.LocaleDataMetaInfo b/jdk/src/jdk.localedata/META-INF/localedata-services/sun.util.locale.provider.LocaleDataMetaInfo
deleted file mode 100644
index ea327d5c468..00000000000
--- a/jdk/src/jdk.localedata/META-INF/localedata-services/sun.util.locale.provider.LocaleDataMetaInfo
+++ /dev/null
@@ -1 +0,0 @@
-sun.util.resources.provider.NonEnLocaleDataMetaInfo
diff --git a/jdk/src/jdk.localedata/META-INF/cldrdata-services/sun.util.locale.provider.LocaleDataMetaInfo b/jdk/src/jdk.localedata/share/classes/META-INF/services/sun.util.locale.provider.LocaleDataMetaInfo
similarity index 51%
rename from jdk/src/jdk.localedata/META-INF/cldrdata-services/sun.util.locale.provider.LocaleDataMetaInfo
rename to jdk/src/jdk.localedata/share/classes/META-INF/services/sun.util.locale.provider.LocaleDataMetaInfo
index 07d15578e88..203d80fdcec 100644
--- a/jdk/src/jdk.localedata/META-INF/cldrdata-services/sun.util.locale.provider.LocaleDataMetaInfo
+++ b/jdk/src/jdk.localedata/share/classes/META-INF/services/sun.util.locale.provider.LocaleDataMetaInfo
@@ -1 +1,2 @@
+sun.util.resources.provider.NonEnLocaleDataMetaInfo
 sun.util.resources.cldr.provider.CLDRLocaleDataMetaInfo
diff --git a/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/BatchEnvironment.java b/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/BatchEnvironment.java
index 0e4cb6a70e6..0a4e5435e5f 100644
--- a/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/BatchEnvironment.java
+++ b/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/BatchEnvironment.java
@@ -70,17 +70,16 @@ public class BatchEnvironment extends sun.tools.javac.BatchEnvironment {
      * Create a ClassPath object for rmic from a class path string.
      */
     public static ClassPath createClassPath(String classPathString) {
-        ClassPath[] paths = classPaths(null, classPathString, null, null);
+        ClassPath[] paths = classPaths(null, classPathString, null);
         return paths[1];
     }
 
     /**
      * Create a ClassPath object for rmic from the relevant command line
-     * options for class path, boot class path, and extension directories.
+     * options for class path and boot class path.
      */
     public static ClassPath createClassPath(String classPathString,
-                                            String sysClassPathString,
-                                            String extDirsString)
+                                            String sysClassPathString)
     {
         /**
          * Previously, this method delegated to the
@@ -108,13 +107,6 @@ public class BatchEnvironment extends sun.tools.javac.BatchEnvironment {
          */
         path.expandJarClassPaths(true);
 
-        if (extDirsString == null) {
-            extDirsString = System.getProperty("java.ext.dirs");
-        }
-        if (extDirsString != null) {
-            path.addDirectories(extDirsString);
-        }
-
         /*
          * In the application class path, an empty element means
          * the current working directory.
@@ -389,7 +381,8 @@ public class BatchEnvironment extends sun.tools.javac.BatchEnvironment {
                 /* File is an ordinay file  */
                 String arcname = file.toLowerCase();
                 if (! (arcname.endsWith(".zip") ||
-                       arcname.endsWith(".jar"))) {
+                       arcname.endsWith(".jar") ||
+                       arcname.endsWith(".jimage"))) {
                     /* File name don't have right extension */
 //                      if (warn)
 //                          log.warning(Position.NOPOS,
diff --git a/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/Main.java b/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/Main.java
index 5ce94a7e259..de93258d7c8 100644
--- a/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/Main.java
+++ b/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/Main.java
@@ -68,7 +68,6 @@ import java.util.Properties;
 public class Main implements sun.rmi.rmic.Constants {
     String sourcePathArg;
     String sysClassPathArg;
-    String extDirsArg;
     String classPathString;
     File destDir;
     int flags;
@@ -187,7 +186,6 @@ public class Main implements sun.rmi.rmic.Constants {
     public boolean parseArgs(String argv[]) {
         sourcePathArg = null;
         sysClassPathArg = null;
-        extDirsArg = null;
 
         classPathString = null;
         destDir = null;
@@ -300,21 +298,6 @@ public class Main implements sun.rmi.rmic.Constants {
                         usage();
                         return false;
                     }
-                } else if (argv[i].equals("-extdirs")) {
-                    if ((i + 1) < argv.length) {
-                        if (extDirsArg != null) {
-                            error("rmic.option.already.seen", "-extdirs");
-                            usage();
-                            return false;
-                        }
-                        argv[i] = null;
-                        extDirsArg = argv[++i];
-                        argv[i] = null;
-                    } else {
-                        error("rmic.option.requires.argument", "-extdirs");
-                        usage();
-                        return false;
-                    }
                 } else if (argv[i].equals("-d")) {
                     if ((i + 1) < argv.length) {
                         if (destDir != null) {
@@ -499,8 +482,7 @@ public class Main implements sun.rmi.rmic.Constants {
 
         ClassPath classPath =
             BatchEnvironment.createClassPath(classPathString,
-                                             sysClassPathArg,
-                                             extDirsArg);
+                                             sysClassPathArg);
         BatchEnvironment result = null;
         try {
             Class<?>[] ctorArgTypes = {OutputStream.class,ClassPath.class,Main.class};
@@ -659,7 +641,6 @@ public class Main implements sun.rmi.rmic.Constants {
 
         sourcePathArg = null;
         sysClassPathArg = null;
-        extDirsArg = null;
         classPathString = null;
         destDir = null;
         classes = null;
diff --git a/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/RMIGenerator.java b/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/RMIGenerator.java
index f139218ff4e..4dc745ff8ab 100644
--- a/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/RMIGenerator.java
+++ b/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/RMIGenerator.java
@@ -140,7 +140,7 @@ public class RMIGenerator implements RMIConstants, Generator {
             if (env.verbose()) {
                 env.output(Main.getText("rmic.wrote", stubFile.getPath()));
             }
-            env.parseFile(new ClassFile(stubFile));
+            env.parseFile(ClassFile.newClassFile(stubFile));
         } catch (IOException e) {
             env.error(0, "cant.write", stubFile.toString());
             return;
@@ -161,7 +161,7 @@ public class RMIGenerator implements RMIConstants, Generator {
                     env.output(Main.getText("rmic.wrote",
                         skeletonFile.getPath()));
                 }
-                env.parseFile(new ClassFile(skeletonFile));
+                env.parseFile(ClassFile.newClassFile(skeletonFile));
             } catch (IOException e) {
                 env.error(0, "cant.write", stubFile.toString());
                 return;
diff --git a/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/resources/rmic.properties b/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/resources/rmic.properties
index 7220b813e32..b6f7ec9bf19 100644
--- a/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/resources/rmic.properties
+++ b/jdk/src/jdk.rmic/share/classes/sun/rmi/rmic/resources/rmic.properties
@@ -98,7 +98,6 @@ rmic.usage=Usage: {0} <options> <class names>\
 \n  -verbose       Output messages about what the compiler is doing\
 \n  -classpath <path>      Specify where to find input class files\
 \n  -bootclasspath <path>  Override location of bootstrap class files\
-\n  -extdirs <path>        Override location of installed extensions\
 \n  -d <directory>         Specify where to place generated class files\
 \n  -J<runtime flag>       Pass argument to the java interpreter\
 \n
diff --git a/jdk/src/jdk.rmic/share/classes/sun/tools/java/ClassFile.java b/jdk/src/jdk.rmic/share/classes/sun/tools/java/ClassFile.java
index 37a7bed3c49..eacea99552a 100644
--- a/jdk/src/jdk.rmic/share/classes/sun/tools/java/ClassFile.java
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/java/ClassFile.java
@@ -29,134 +29,93 @@ import java.io.File;
 import java.io.InputStream;
 import java.io.FileInputStream;
 import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.Path;
 import java.util.zip.*;
 
 /**
- * This class is used to represent a file loaded from the class path, and
- * can either be a regular file or a zip file entry.
+ * Abstract class to represent a class file.
  *
  * WARNING: The contents of this source file are not part of any
  * supported API.  Code that depends on them does so at its own risk:
  * they are subject to change or removal without notice.
  */
 public
-class ClassFile {
-    /*
-     * Non-null if this represents a regular file
-     */
-    private File file;
-
-    /*
-     * Non-null if this represents a zip file entry
-     */
-    private ZipFile zipFile;
-    private ZipEntry zipEntry;
-
+abstract class ClassFile {
     /**
-     * Constructor for instance representing a regular file
+     * Factory method to create a ClassFile backed by a File.
+     *
+     * @param file a File object
+     * @return a new ClassFile
      */
-    public ClassFile(File file) {
-        this.file = file;
+    public static ClassFile newClassFile(File file) {
+        return new FileClassFile(file);
     }
 
     /**
-     * Constructor for instance representing a zip file entry
+     * Factory method to create a ClassFile backed by a ZipEntry.
+     *
+     * @param zf a ZipFile
+     * @param ze a ZipEntry within the zip file
+     * @return a new ClassFile
      */
-    public ClassFile(ZipFile zf, ZipEntry ze) {
-        this.zipFile = zf;
-        this.zipEntry = ze;
+    public static ClassFile newClassFile(ZipFile zf, ZipEntry ze) {
+        return new ZipClassFile(zf, ze);
+    }
+
+    /**
+     * Factory method to create a ClassFile backed by a nio Path.
+     *
+     * @param path nio Path object
+     * @return a new ClassFile
+     */
+    public static ClassFile newClassFile(Path path) {
+        return Files.exists(path)? new PathClassFile(path) : null;
     }
 
     /**
      * Returns true if this is zip file entry
      */
-    public boolean isZipped() {
-        return zipFile != null;
-    }
+    public abstract boolean isZipped();
 
     /**
      * Returns input stream to either regular file or zip file entry
      */
-    public InputStream getInputStream() throws IOException {
-        if (file != null) {
-            return new FileInputStream(file);
-        } else {
-            try {
-                return zipFile.getInputStream(zipEntry);
-            } catch (ZipException e) {
-                throw new IOException(e.getMessage());
-            }
-        }
-    }
+    public abstract InputStream getInputStream() throws IOException;
 
     /**
      * Returns true if file exists.
      */
-    public boolean exists() {
-        return file != null ? file.exists() : true;
-    }
+    public abstract boolean exists();
 
     /**
      * Returns true if this is a directory.
      */
-    public boolean isDirectory() {
-        return file != null ? file.isDirectory() :
-                              zipEntry.getName().endsWith("/");
-    }
+    public abstract boolean isDirectory();
 
     /**
      * Return last modification time
      */
-    public long lastModified() {
-        return file != null ? file.lastModified() : zipEntry.getTime();
-    }
+    public abstract long lastModified();
 
     /**
      * Get file path. The path for a zip file entry will also include
      * the zip file name.
      */
-    public String getPath() {
-        if (file != null) {
-            return file.getPath();
-        } else {
-            return zipFile.getName() + "(" + zipEntry.getName() + ")";
-        }
-    }
+    public abstract String getPath();
 
     /**
      * Get name of file entry excluding directory name
      */
-    public String getName() {
-        return file != null ? file.getName() : zipEntry.getName();
-    }
+    public abstract String getName();
 
-//JCOV
     /**
      * Get absolute name of file entry
      */
-    public String getAbsoluteName() {
-        String absoluteName;
-        if (file != null) {
-            try {
-                absoluteName = file.getCanonicalPath();
-            } catch (IOException e) {
-                absoluteName = file.getAbsolutePath();
-            }
-        } else {
-            absoluteName = zipFile.getName() + "(" + zipEntry.getName() + ")";
-        }
-        return absoluteName;
-    }
-// end JCOV
+    public abstract String getAbsoluteName();
 
     /**
      * Get length of file
      */
-    public long length() {
-        return file != null ? file.length() : zipEntry.getSize();
-    }
-
-    public String toString() {
-        return (file != null) ? file.toString() : zipEntry.toString();
-    }
+    public abstract long length();
 }
diff --git a/jdk/src/jdk.rmic/share/classes/sun/tools/java/ClassPath.java b/jdk/src/jdk.rmic/share/classes/sun/tools/java/ClassPath.java
index ae917d0553e..4d366fb8dd0 100644
--- a/jdk/src/jdk.rmic/share/classes/sun/tools/java/ClassPath.java
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/java/ClassPath.java
@@ -25,11 +25,23 @@
 
 package sun.tools.java;
 
-import java.util.Enumeration;
-import java.util.Hashtable;
 import java.io.File;
 import java.io.IOException;
+import java.io.UncheckedIOException;
 import java.util.zip.*;
+import java.util.Enumeration;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Set;
+import java.util.LinkedHashSet;
+import java.net.URI;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.nio.file.spi.FileSystemProvider;
 
 /**
  * This class is used to represent a class path, which can contain both
@@ -41,6 +53,11 @@ import java.util.zip.*;
  */
 public
 class ClassPath {
+    private static final String JIMAGE_EXT = ".jimage";
+    private FileSystem getJrtFileSystem() {
+        return FileSystems.getFileSystem(URI.create("jrt:/"));
+    }
+
     static final char dirSeparator = File.pathSeparatorChar;
 
     /**
@@ -105,27 +122,33 @@ class ClassPath {
         // Build the class path
         ClassPathEntry[] path = new ClassPathEntry[n+1];
         int len = pathstr.length();
+        boolean jrtAdded = false;
         for (i = n = 0; i < len; i = j + 1) {
             if ((j = pathstr.indexOf(dirSeparator, i)) == -1) {
                 j = len;
             }
             if (i == j) {
-                path[n] = new ClassPathEntry();
-                path[n++].dir = new File(".");
+                path[n++] = new DirClassPathEntry(new File("."));
             } else {
-                File file = new File(pathstr.substring(i, j));
+                String filename = pathstr.substring(i, j);
+                File file = new File(filename);
                 if (file.isFile()) {
-                    try {
-                        ZipFile zip = new ZipFile(file);
-                        path[n] = new ClassPathEntry();
-                        path[n++].zip = zip;
-                    } catch (ZipException e) {
-                    } catch (IOException e) {
-                        // Ignore exceptions, at least for now...
+                    if (filename.endsWith(JIMAGE_EXT)) {
+                        if (jrtAdded) continue;
+                        FileSystem fs = getJrtFileSystem();
+                        path[n++] = new JrtClassPathEntry(fs);
+                        jrtAdded = true;
+                    } else {
+                        try {
+                            ZipFile zip = new ZipFile(file);
+                            path[n++] = new ZipClassPathEntry(zip);
+                        } catch (ZipException e) {
+                        } catch (IOException e) {
+                            // Ignore exceptions, at least for now...
+                        }
                     }
                 } else {
-                    path[n] = new ClassPathEntry();
-                    path[n++].dir = file;
+                    path[n++] = new DirClassPathEntry(file);
                 }
             }
         }
@@ -150,20 +173,26 @@ class ClassPath {
         // Build the class path
         ClassPathEntry[] path = new ClassPathEntry[patharray.length];
         int n = 0;
+        boolean jrtAdded = false;
         for (String name : patharray) {
             File file = new File(name);
             if (file.isFile()) {
-                try {
-                    ZipFile zip = new ZipFile(file);
-                    path[n] = new ClassPathEntry();
-                    path[n++].zip = zip;
-                } catch (ZipException e) {
-                } catch (IOException e) {
-                    // Ignore exceptions, at least for now...
-                }
+                if (name.endsWith(JIMAGE_EXT)) {
+                    if (jrtAdded) continue;
+                    FileSystem fs = getJrtFileSystem();
+                    path[n++] = new JrtClassPathEntry(fs);
+                    jrtAdded = true;
+                } else {
+                    try {
+                        ZipFile zip = new ZipFile(file);
+                        path[n++] = new ZipClassPathEntry(zip);
+                    } catch (ZipException e) {
+                    } catch (IOException e) {
+                        // Ignore exceptions, at least for now...
+                    }
+               }
             } else {
-                path[n] = new ClassPathEntry();
-                path[n++].dir = file;
+                path[n++] = new DirClassPathEntry(file);
             }
         }
         // Trim class path to exact size
@@ -202,29 +231,9 @@ class ClassPath {
             name = subdir;      // Note: isDirectory==true & basename==""
         }
         for (int i = 0; i < path.length; i++) {
-            if (path[i].zip != null) {
-                String newname = name.replace(File.separatorChar, '/');
-                ZipEntry entry = path[i].zip.getEntry(newname);
-                if (entry != null) {
-                    return new ClassFile(path[i].zip, entry);
-                }
-            } else {
-                File file = new File(path[i].dir.getPath(), name);
-                String list[] = path[i].getFiles(subdir);
-                if (isDirectory) {
-                    if (list.length > 0) {
-                        return new ClassFile(file);
-                    }
-                } else {
-                    for (int j = 0; j < list.length; j++) {
-                        if (basename.equals(list[j])) {
-                            // Don't bother checking !file.isDir,
-                            // since we only look for names which
-                            // cannot already be packages (foo.java, etc).
-                            return new ClassFile(file);
-                        }
-                    }
-                }
+            ClassFile cf = path[i].getFile(name, subdir, basename, isDirectory);
+            if (cf != null) {
+                return cf;
             }
         }
         return null;
@@ -236,27 +245,7 @@ class ClassPath {
     public Enumeration<ClassFile> getFiles(String pkg, String ext) {
         Hashtable<String, ClassFile> files = new Hashtable<>();
         for (int i = path.length; --i >= 0; ) {
-            if (path[i].zip != null) {
-                Enumeration<? extends ZipEntry> e = path[i].zip.entries();
-                while (e.hasMoreElements()) {
-                    ZipEntry entry = (ZipEntry)e.nextElement();
-                    String name = entry.getName();
-                    name = name.replace('/', File.separatorChar);
-                    if (name.startsWith(pkg) && name.endsWith(ext)) {
-                        files.put(name, new ClassFile(path[i].zip, entry));
-                    }
-                }
-            } else {
-                String[] list = path[i].getFiles(pkg);
-                for (int j = 0; j < list.length; j++) {
-                    String name = list[j];
-                    if (name.endsWith(ext)) {
-                        name = pkg + File.separatorChar + name;
-                        File file = new File(path[i].dir.getPath(), name);
-                        files.put(name, new ClassFile(file));
-                    }
-                }
-            }
+            path[i].fillFiles(pkg, ext, files);
         }
         return files.elements();
     }
@@ -266,9 +255,7 @@ class ClassPath {
      */
     public void close() throws IOException {
         for (int i = path.length; --i >= 0; ) {
-            if (path[i].zip != null) {
-                path[i].zip.close();
-            }
+            path[i].close();
         }
     }
 
@@ -281,34 +268,216 @@ class ClassPath {
 }
 
 /**
- * A class path entry, which can either be a directory or an open zip file.
+ * A class path entry, which can either be a directory or an open zip file or an open jimage filesystem.
  */
-class ClassPathEntry {
-    File dir;
-    ZipFile zip;
+abstract class ClassPathEntry {
+    abstract ClassFile getFile(String name, String subdir, String basename, boolean isDirectory);
+    abstract void fillFiles(String pkg, String ext, Hashtable<String, ClassFile> files);
+    abstract void close() throws IOException;
+}
 
-    Hashtable<String, String[]> subdirs = new Hashtable<>(29); // cache of sub-directory listings:
-    String[] getFiles(String subdir) {
+// a ClassPathEntry that represents a directory
+final class DirClassPathEntry extends ClassPathEntry {
+    private final File dir;
+
+    DirClassPathEntry(File dir) {
+        this.dir = dir;
+    }
+
+    private final Hashtable<String, String[]> subdirs = new Hashtable<>(29); // cache of sub-directory listings:
+    private String[] getFiles(String subdir) {
         String files[] = subdirs.get(subdir);
         if (files == null) {
-            // search the directory, exactly once
-            File sd = new File(dir.getPath(), subdir);
-            if (sd.isDirectory()) {
-                files = sd.list();
-                if (files == null) {
-                    // should not happen, but just in case, fail silently
-                    files = new String[0];
-                }
-                if (files.length == 0) {
-                    String nonEmpty[] = { "" };
-                    files = nonEmpty;
-                }
-            } else {
-                files = new String[0];
-            }
+            files = computeFiles(subdir);
             subdirs.put(subdir, files);
         }
         return files;
     }
 
+    private String[] computeFiles(String subdir) {
+        File sd = new File(dir.getPath(), subdir);
+        String[] files = null;
+        if (sd.isDirectory()) {
+            files = sd.list();
+            if (files == null) {
+                // should not happen, but just in case, fail silently
+                files = new String[0];
+            }
+            if (files.length == 0) {
+                String nonEmpty[] = { "" };
+                files = nonEmpty;
+            }
+        } else {
+            files = new String[0];
+        }
+        return files;
+    }
+
+    ClassFile getFile(String name,  String subdir, String basename, boolean isDirectory) {
+        File file = new File(dir.getPath(), name);
+        String list[] = getFiles(subdir);
+        if (isDirectory) {
+            if (list.length > 0) {
+                return ClassFile.newClassFile(file);
+            }
+        } else {
+            for (int j = 0; j < list.length; j++) {
+                if (basename.equals(list[j])) {
+                    // Don't bother checking !file.isDir,
+                    // since we only look for names which
+                    // cannot already be packages (foo.java, etc).
+                    return ClassFile.newClassFile(file);
+                }
+            }
+        }
+        return null;
+    }
+
+    void fillFiles(String pkg, String ext, Hashtable<String, ClassFile> files) {
+        String[] list = getFiles(pkg);
+        for (int j = 0; j < list.length; j++) {
+            String name = list[j];
+            if (name.endsWith(ext)) {
+                name = pkg + File.separatorChar + name;
+                File file = new File(dir.getPath(), name);
+                files.put(name, ClassFile.newClassFile(file));
+            }
+        }
+    }
+
+    void close() throws IOException {
+    }
+}
+
+// a ClassPathEntry that represents a .zip or a .jar file
+final class ZipClassPathEntry extends ClassPathEntry {
+    private final ZipFile zip;
+
+    ZipClassPathEntry(ZipFile zip) {
+        this.zip = zip;
+    }
+
+    void close() throws IOException {
+        zip.close();
+    }
+
+    ClassFile getFile(String name, String subdir, String basename, boolean isDirectory) {
+        String newname = name.replace(File.separatorChar, '/');
+        ZipEntry entry = zip.getEntry(newname);
+        return entry != null? ClassFile.newClassFile(zip, entry) : null;
+    }
+
+    void fillFiles(String pkg, String ext, Hashtable<String, ClassFile> files) {
+        Enumeration<? extends ZipEntry> e = zip.entries();
+        while (e.hasMoreElements()) {
+            ZipEntry entry = (ZipEntry)e.nextElement();
+            String name = entry.getName();
+            name = name.replace('/', File.separatorChar);
+            if (name.startsWith(pkg) && name.endsWith(ext)) {
+                files.put(name, ClassFile.newClassFile(zip, entry));
+            }
+        }
+    }
+}
+
+// a ClassPathEntry that represents jrt file system
+final class JrtClassPathEntry extends ClassPathEntry {
+    private final FileSystem fs;
+    // module directory paths in jrt fs
+    private final Set<Path> jrtModules;
+    // package name to package directory path mapping (lazily filled)
+    private final Map<String, Path> pkgDirs;
+
+    JrtClassPathEntry(FileSystem fs) {
+        this.fs = fs;
+        this.jrtModules = new LinkedHashSet<>();
+        this.pkgDirs = new HashMap<>();
+
+        // fill in module directories at the root dir
+        Path root = fs.getPath("/");
+        try {
+            try (DirectoryStream<Path> stream = Files.newDirectoryStream(root)) {
+                for (Path entry: stream) {
+                    if (Files.isDirectory(entry))
+                        jrtModules.add(entry);
+                }
+            }
+        } catch (IOException ioExp) {
+            throw new UncheckedIOException(ioExp);
+        }
+    }
+
+    void close() throws IOException {
+    }
+
+    // from pkgName (internal separator '/') to it's Path in jrtfs
+    synchronized Path getPackagePath(String pkgName) throws IOException {
+        // check the cache first
+        if (pkgDirs.containsKey(pkgName)) {
+            return pkgDirs.get(pkgName);
+        }
+
+        for (Path modPath : jrtModules) {
+            Path pkgDir = fs.getPath(modPath.toString(), pkgName);
+            // check if package directory is under any of the known modules
+            if (Files.exists(pkgDir)) {
+                // it is a package directory only if contains atleast one .class file
+                try (DirectoryStream<Path> stream = Files.newDirectoryStream(pkgDir)) {
+                    for (Path p : stream) {
+                        if (Files.isRegularFile(p) && p.toString().endsWith(".class")) {
+                            // cache package-to-package dir mapping for future
+                            pkgDirs.put(pkgName, pkgDir);
+                            return pkgDir;
+                        }
+                    }
+                }
+            }
+        }
+
+        return null;
+    }
+
+    // fully qualified (internal) class name to it's Path in jrtfs
+    Path getClassPath(String clsName) throws IOException {
+        int index = clsName.lastIndexOf('/');
+        if (index == -1) {
+            return null;
+        }
+        Path pkgPath = getPackagePath(clsName.substring(0, index));
+        return pkgPath == null? null : fs.getPath(pkgPath + "/" + clsName.substring(index + 1));
+    }
+
+    ClassFile getFile(String name, String subdir, String basename, boolean isDirectory) {
+        try {
+            name = name.replace(File.separatorChar, '/');
+            Path cp = getClassPath(name);
+            return cp == null? null : ClassFile.newClassFile(cp);
+        } catch (IOException ioExp) {
+            throw new UncheckedIOException(ioExp);
+        }
+    }
+
+    void fillFiles(String pkg, String ext, Hashtable<String, ClassFile> files) {
+        Path dir;
+        try {
+            dir = getPackagePath(pkg);
+            if (dir == null) {
+                return;
+            }
+        } catch (IOException ioExp) {
+            throw new UncheckedIOException(ioExp);
+        }
+
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
+            for (Path p : stream) {
+                String name = p.toString();
+                name = name.replace('/', File.separatorChar);
+                if (name.startsWith(pkg) && name.endsWith(ext)) {
+                    files.put(name, ClassFile.newClassFile(p));
+                }
+            }
+        } catch (IOException ioExp) {
+            throw new UncheckedIOException(ioExp);
+        }
+    }
 }
diff --git a/jdk/src/jdk.rmic/share/classes/sun/tools/java/FileClassFile.java b/jdk/src/jdk.rmic/share/classes/sun/tools/java/FileClassFile.java
new file mode 100644
index 00000000000..df8bb40d4a7
--- /dev/null
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/java/FileClassFile.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.tools.java;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+/**
+ * This class is used to represent a file loaded from the class path, and
+ * is a regular file.
+ *
+ * WARNING: The contents of this source file are not part of any
+ * supported API.  Code that depends on them does so at its own risk:
+ * they are subject to change or removal without notice.
+ */
+final
+class FileClassFile extends ClassFile {
+    private final File file;
+
+    /**
+     * Constructor for instance representing a regular file
+     */
+    public FileClassFile(File file) {
+        this.file = file;
+    }
+
+    @Override
+    public boolean isZipped() {
+        return false;
+    }
+
+    @Override
+    public InputStream getInputStream() throws IOException {
+        return new FileInputStream(file);
+    }
+
+    @Override
+    public boolean exists() {
+        return file.exists();
+    }
+
+    @Override
+    public boolean isDirectory() {
+        return file.isDirectory();
+    }
+
+    @Override
+    public long lastModified() {
+        return file.lastModified();
+    }
+
+    @Override
+    public String getPath() {
+        return file.getPath();
+    }
+
+    @Override
+    public String getName() {
+        return file.getName();
+    }
+
+//JCOV
+    @Override
+    public String getAbsoluteName() {
+        String absoluteName;
+        try {
+            absoluteName = file.getCanonicalPath();
+        } catch (IOException e) {
+            absoluteName = file.getAbsolutePath();
+        }
+        return absoluteName;
+    }
+// end JCOV
+
+    @Override
+    public long length() {
+        return file.length();
+    }
+
+    @Override
+    public String toString() {
+        return file.toString();
+    }
+}
diff --git a/jdk/src/jdk.rmic/share/classes/sun/tools/java/PathClassFile.java b/jdk/src/jdk.rmic/share/classes/sun/tools/java/PathClassFile.java
new file mode 100644
index 00000000000..315c0bd77df
--- /dev/null
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/java/PathClassFile.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.tools.java;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.Files;
+import java.nio.file.Path;
+
+/**
+ * This class is used to represent a file loaded from the class path, and
+ * is represented by nio Path.
+ *
+ * WARNING: The contents of this source file are not part of any
+ * supported API.  Code that depends on them does so at its own risk:
+ * they are subject to change or removal without notice.
+ */
+final
+class PathClassFile extends ClassFile {
+    private final Path path;
+    private final BasicFileAttributes attrs;
+
+    /**
+     * Constructor for instance representing a Path
+     */
+    public PathClassFile(Path path) {
+        this.path = path;
+        try {
+            this.attrs = Files.readAttributes(path, BasicFileAttributes.class);
+        } catch (IOException ioExp) {
+            throw new UncheckedIOException(ioExp);
+        }
+    }
+
+    @Override
+    public boolean isZipped() {
+        return false;
+    }
+
+    @Override
+    public InputStream getInputStream() throws IOException {
+        return Files.newInputStream(path);
+    }
+
+    @Override
+    public boolean exists() {
+        return true;
+    }
+
+    @Override
+    public boolean isDirectory() {
+        return attrs.isDirectory();
+    }
+
+    @Override
+    public long lastModified() {
+        return attrs.lastModifiedTime().toMillis();
+    }
+
+    @Override
+    public String getPath() {
+        return path.toUri().toString();
+    }
+
+    @Override
+    public String getName() {
+        return path.getFileName().toString();
+    }
+
+//JCOV
+    @Override
+    public String getAbsoluteName() {
+        return path.toAbsolutePath().toUri().toString();
+    }
+// end JCOV
+
+    @Override
+    public long length() {
+        return attrs.size();
+    }
+
+    @Override
+    public String toString() {
+        return path.toString();
+    }
+}
diff --git a/jdk/src/jdk.rmic/share/classes/sun/tools/java/ZipClassFile.java b/jdk/src/jdk.rmic/share/classes/sun/tools/java/ZipClassFile.java
new file mode 100644
index 00000000000..4e68b3d1a6e
--- /dev/null
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/java/ZipClassFile.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.tools.java;
+
+import java.io.File;
+import java.io.InputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.zip.*;
+
+/**
+ * This class is used to represent a file loaded from the class path, and
+ * is a zip file entry.
+ *
+ * WARNING: The contents of this source file are not part of any
+ * supported API.  Code that depends on them does so at its own risk:
+ * they are subject to change or removal without notice.
+ */
+final
+class ZipClassFile extends ClassFile {
+    private final ZipFile zipFile;
+    private final ZipEntry zipEntry;
+
+    /**
+     * Constructor for instance representing a zip file entry
+     */
+    public ZipClassFile(ZipFile zf, ZipEntry ze) {
+        this.zipFile = zf;
+        this.zipEntry = ze;
+    }
+
+    @Override
+    public boolean isZipped() {
+        return true;
+    }
+
+    @Override
+    public InputStream getInputStream() throws IOException {
+        try {
+            return zipFile.getInputStream(zipEntry);
+        } catch (ZipException e) {
+            throw new IOException(e.getMessage());
+        }
+    }
+
+    @Override
+    public boolean exists() {
+        return true;
+    }
+
+    @Override
+    public boolean isDirectory() {
+        return zipEntry.getName().endsWith("/");
+    }
+
+    @Override
+    public long lastModified() {
+        return zipEntry.getTime();
+    }
+
+    @Override
+    public String getPath() {
+        return zipFile.getName() + "(" + zipEntry.getName() + ")";
+    }
+
+    @Override
+    public String getName() {
+        return zipEntry.getName();
+    }
+
+//JCOV
+    @Override
+    public String getAbsoluteName() {
+        return zipFile.getName() + "(" + zipEntry.getName() + ")";
+    }
+// end JCOV
+
+    @Override
+    public long length() {
+        return zipEntry.getSize();
+    }
+
+    @Override
+    public String toString() {
+        return zipEntry.toString();
+    }
+}
diff --git a/jdk/src/jdk.rmic/share/classes/sun/tools/javac/BatchEnvironment.java b/jdk/src/jdk.rmic/share/classes/sun/tools/javac/BatchEnvironment.java
index e20b386d325..ae1b45a2030 100644
--- a/jdk/src/jdk.rmic/share/classes/sun/tools/javac/BatchEnvironment.java
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/javac/BatchEnvironment.java
@@ -160,17 +160,15 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
     static BatchEnvironment create(OutputStream out,
                                    String srcPathString,
                                    String classPathString,
-                                   String sysClassPathString,
-                                   String extDirsString){
+                                   String sysClassPathString) {
         ClassPath[] classPaths = classPaths(srcPathString, classPathString,
-                                            sysClassPathString, extDirsString);
+                                            sysClassPathString);
         return new BatchEnvironment(out, classPaths[0], classPaths[1]);
     }
 
     protected static ClassPath[] classPaths(String srcPathString,
                                             String classPathString,
-                                            String sysClassPathString,
-                                            String extDirsString) {
+                                            String sysClassPathString) {
         // Create our source classpath and our binary classpath
         ClassPath sourcePath;
         ClassPath binaryPath;
@@ -196,30 +194,6 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
         }
         appendPath(binaryPathBuffer, sysClassPathString);
 
-        if (extDirsString == null) {
-            extDirsString = System.getProperty("java.ext.dirs");
-        }
-        if (extDirsString != null) {
-            StringTokenizer st = new StringTokenizer(extDirsString,
-                                                     File.pathSeparator);
-            while (st.hasMoreTokens()) {
-                String dirName = st.nextToken();
-                File dir = new File(dirName);
-                if (!dirName.endsWith(File.separator)) {
-                    dirName += File.separator;
-                }
-                if (dir.isDirectory()) {
-                    String[] files = dir.list();
-                    for (int i = 0; i < files.length; ++i) {
-                        String name = files[i];
-                        if (name.endsWith(".jar")) {
-                            appendPath(binaryPathBuffer, dirName + name);
-                        }
-                    }
-                }
-            }
-        }
-
         appendPath(binaryPathBuffer, classPathString);
 
         sourcePath = new ClassPath(srcPathString);
@@ -718,7 +692,7 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
 
                 // Couldn't find the source, try the one mentioned in the binary
                 if (bc.getSource() != null) {
-                    srcfile = new ClassFile(new File((String)bc.getSource()));
+                    srcfile = ClassFile.newClassFile(new File((String)bc.getSource()));
                     // Look for the source file
                     srcfile = pkg.getSourceFile(srcfile.getName());
                     if ((srcfile != null) && srcfile.exists()) {
@@ -863,7 +837,7 @@ class BatchEnvironment extends Environment implements ErrorConsumer {
                 }
                 if (srcfile == null) {
                     String fn = (String)c.getClassDefinition().getSource();
-                    srcfile = new ClassFile(new File(fn));
+                    srcfile = ClassFile.newClassFile(new File(fn));
                 }
             } else {
                 // Get a source file name from the package
diff --git a/jdk/src/jdk.rmic/share/classes/sun/tools/javac/Main.java b/jdk/src/jdk.rmic/share/classes/sun/tools/javac/Main.java
index f7015dbd36e..835158c80b3 100644
--- a/jdk/src/jdk.rmic/share/classes/sun/tools/javac/Main.java
+++ b/jdk/src/jdk.rmic/share/classes/sun/tools/javac/Main.java
@@ -197,7 +197,6 @@ class Main implements Constants {
         String sourcePathArg = null;
         String classPathArg = null;
         String sysClassPathArg = null;
-        String extDirsArg = null;
         boolean verbosePath = false;
 
         String targetArg = null;
@@ -342,17 +341,6 @@ class Main implements Constants {
                     usage_error();
                     return false;  // Stop processing now
                 }
-            } else if (argv[i].equals("-extdirs")) {
-                if ((i + 1) < argv.length) {
-                    if (extDirsArg != null) {
-                        error("main.option.already.seen","-extdirs");
-                    }
-                    extDirsArg = argv[++i];
-                } else {
-                    error("main.option.requires.argument","-extdirs");
-                    usage_error();
-                    return false;  // Stop processing now
-                }
             } else if (argv[i].equals("-encoding")) {
                 if ((i + 1) < argv.length) {
                     if (encoding!=null)
@@ -475,8 +463,7 @@ class Main implements Constants {
         BatchEnvironment env = BatchEnvironment.create(out,
                                                        sourcePathArg,
                                                        classPathArg,
-                                                       sysClassPathArg,
-                                                       extDirsArg);
+                                                       sysClassPathArg);
         if (verbosePath) {
             output(getText("main.path.msg",
                            env.sourcePath.toString(),
@@ -503,7 +490,7 @@ class Main implements Constants {
             for (Enumeration<String> e = v.elements() ; e.hasMoreElements() ;) {
                 File file = new File(e.nextElement());
                 try {
-                    env.parseFile(new ClassFile(file));
+                    env.parseFile(ClassFile.newClassFile(file));
                 } catch (FileNotFoundException ee) {
                     env.error(0, "cant.read", file.getPath());
                     exitStatus = EXIT_CMDERR;
diff --git a/jdk/src/sample/share/jmx/jmx-scandir/index.html b/jdk/src/sample/share/jmx/jmx-scandir/index.html
index 4fd2ae65165..835e7a1cff6 100644
--- a/jdk/src/sample/share/jmx/jmx-scandir/index.html
+++ b/jdk/src/sample/share/jmx/jmx-scandir/index.html
@@ -36,9 +36,9 @@
     <title>JMX(TM) "scandir" Example</title>
   </head>
   <body>
-  
+
   <h1><center>Java<font size="-1"><sup>TM</sup></font> Management Extensions (JMX<font size="-1"><sup>TM</sup></font>) <i>scandir</i> Example</center></h1>
-  
+
   <h2><a name="h2-Introduction">Introduction</a></h2>
   <ul>
   <p>The JMX <i>scandir</i> example is an application that
@@ -59,7 +59,7 @@
      solutions used when implementing a monitoring and
      management interface for an application with JMX
      Technology.</p>
-  <p>This example is an advanced JMX example, which presents 
+  <p>This example is an advanced JMX example, which presents
      advanced JMX concepts. It is assumed that the reader is already
      familiar with the JMX API. Newcomers to JMX Technology are
      invited to have a look at the <a
@@ -69,31 +69,31 @@
   <p></p>
       <hr>
   <blockquote>
-    <u>Note:</u> This example was developed using <a 
+    <u>Note:</u> This example was developed using <a
      href="http://www.netbeans.org">NetBeans 5.0 IDE</a>. The instructions
      given in this document to build, run, and test the example assume that
      you have at your disposal:
      <ul><li>either <a href="http://www.netbeans.org">NetBeans 5.0 IDE</a>,</li>
-         <li>or <a href="http://ant.apache.org/">Apache Ant 1.6.5</a> and 
+         <li>or <a href="http://ant.apache.org/">Apache Ant 1.6.5</a> and
              <a href="http://sourceforge.net/projects/junit/">JUnit 3.8.1 or
              3.8.2</a><br>
              (JUnit is only needed to run the example's unit tests).
          </li>
      </ul>
-     <p><a name="setup">In order to build the example</a>, 
+     <p><a name="setup">In order to build the example</a>,
      <u>you may need to copy the jmx-scandir</u>
-     directory to somewhere where you have write permissions. 
+     directory to somewhere where you have write permissions.
      <br>In that case, you will need to update the <i>nbjdk.home</i> variable
-     in the copied <i><a href="build.properties">build.properties</a></i> 
-     file located at the root of the copied project directory. 
+     in the copied <i><a href="build.properties">build.properties</a></i>
+     file located at the root of the copied project directory.
      Please make sure that this variable points to the JDK 6 home directory.
      </p>
-     <p>If you wish to run the testsuite from within the <a 
+     <p>If you wish to run the testsuite from within the <a
      href="http://www.netbeans.org">NetBeans IDE</a> you will also have
-     to set the <i>libs.junit.classpath</i> variable in 
-     <a href="build.properties">build.properties</a>. 
+     to set the <i>libs.junit.classpath</i> variable in
+     <a href="build.properties">build.properties</a>.
      The <i>libs.junit.classpath</i>  variable should point to your
-     <a href="http://sourceforge.net/projects/junit/">junit.jar</a>, 
+     <a href="http://sourceforge.net/projects/junit/">junit.jar</a>,
      version 3.8.1 or 3.8.2.
      </p>
   </blockquote>
@@ -116,22 +116,22 @@
   <h2><a name="h2-Generating">Generating the Java Documentation</a></h2>
 
     <ul>
-        <p>Before reading further, you will need to generate the 
+        <p>Before reading further, you will need to generate the
         Java Documentation for the example's sources.</p>
-        <p>In the example root directory (where the <code>build.xml</code> 
+        <p>In the example root directory (where the <code>build.xml</code>
            file is located) run the following command:
            <pre>ant javadoc</pre>
         </p>
-        <p>Alternatively you can open the jmx-scandir project with the 
+        <p>Alternatively you can open the jmx-scandir project with the
            NetBeans IDE and generate the Javadoc from its <code>Build</code>
            menu.
         </p>
-        <p>If building the documentation fails, please make sure to read the 
-           <a href="#setup">note</a> at the beginning of this document.</p> 
+        <p>If building the documentation fails, please make sure to read the
+           <a href="#setup">note</a> at the beginning of this document.</p>
     </ul>
-  
+
   <h2><a name="h2-Overview">Overview of the <i>scandir</i> Example</a></h2>
-  
+
   <ul>
     <p>The JMX <i>scandir</i> example is built around the
     following MBeans:</p>
@@ -184,9 +184,9 @@ title="The ScanDirConfigMXBean is in charge of the configuration"
            load/save the configuration to/from an XML file. It
            will also let you modify that configuration - by e.g.
            creating new directory scanners in there.
-           The corresponding MBeans will be created later, only 
+           The corresponding MBeans will be created later, only
            when you later
-           ask the <code><a 
+           ask the <code><a
 href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
              >ScanManagerMXBean</a> </code> to apply the
@@ -220,14 +220,14 @@ title="A ResultRecord contains information about a file matching the criteria of
         The <code>ResultLogManagerMXBean</code> can be configured to log
         such records to a flat file, or into a log held in memory, or
         both. Both logs (file and memory) can be configured with a
-        maximum capacity. 
+        maximum capacity.
         <br>When the maximum capacity of the memory
         log is reached, its first entry (i.e. its oldest entry) is
         removed to make place for the latest one.
         <br>When the maximum
         capacity of the file log is reached, the file is
         renamed by appending a tilde '~' to its name and a
-        new result log is created. 
+        new result log is created.
         <br>The <code>ResultLogManagerMXBean</code>
         will let you interactively clear these result logs, change their
         capacity, and decide where (memory or file) to log.
@@ -246,7 +246,7 @@ title="A ResultRecord contains information about a file matching the criteria of
         a single mail to each owner of matching files, containing
         the list of files they should consider deleting).<br>
         The <code>ResultLogManagerMXBean</code> is a singleton
-        MBean created by the <code><a 
+        MBean created by the <code><a
 href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
              >ScanManagerMXBean</a> </code>
@@ -258,10 +258,10 @@ title="The ScanDirConfigMXBean is in charge of the configuration"
         </li>
     </ul>
     <p>An application <code>main()</code> method is
-       provided in the <a 
+       provided in the <a
        href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html"
-       >ScanDirAgent</a> class. The <code>main()</code> simply registers 
-       a <code><a 
+       >ScanDirAgent</a> class. The <code>main()</code> simply registers
+       a <code><a
 href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
              >ScanManagerMXBean</a> </code> in the platform MBeanServer, and
@@ -281,15 +281,15 @@ title="The ScanDirConfigMXBean is in charge of the configuration"
             <li>If the property <code>scandir.config.file</code> is
                 defined, the default application file will be the
                 file pointed to by this property. If that file
-                doesn't exist, it will be created when 
+                doesn't exist, it will be created when
                 <code>ScanDirConfigMXBean.save()</code> is
                 invoked.
             </li>
             <li>Otherwise the application config file is
                 assumed to be a file called <code>jmx-scandir.xml</code>,
                 located in the user's directory (as defined by
-                the System property <code>user.home</code>). 
-                If that file doesn't exists, it will be created when 
+                the System property <code>user.home</code>).
+                If that file doesn't exists, it will be created when
                 <code>ScanDirConfigMXBean.save()</code> is
                 invoked.
             </li>
@@ -299,8 +299,8 @@ title="The ScanDirConfigMXBean is in charge of the configuration"
            <pre>-Djava.util.logging.config.file=logging.properties</pre>
            <pre>-Dscandir.config.file=src/etc/testconfig.xml</pre>
            With <code>ScanDirAgent</code> defined as the project's
-           main class. Hence when you invoke from the NetBeans IDE 
-           <i>Run Project</i> on the <i>jmx-scandir</i> project, 
+           main class. Hence when you invoke from the NetBeans IDE
+           <i>Run Project</i> on the <i>jmx-scandir</i> project,
            or <i>Run file</i> on the <code>ScanDirAgent</code>, the
            application starts with the test configuration provided in
            <a href="src/etc/testconfig.xml"
@@ -320,7 +320,7 @@ title="The ScanDirConfigMXBean is in charge of the configuration"
       ><code>src</code></a> subdirectory.</p>
   </ul>
   <h2><a name="h2-Patterns">Patterns, Best Practices, and Common Pitfalls</a></h2>
-  <ul>  
+  <ul>
   <p>This section discusses some common patterns and
      design choices that this example demonstrates, and some pitfalls that
      it avoids.
@@ -392,14 +392,14 @@ href="http://weblogs.java.net/blog/emcmanus/archive/2006/06/intermxbean_ref.html
 title="Inter-MXBean references"
      >Inter-MXBean References</a>.
      </p>
-     <blockquote><u>Hint:</u> In order to simplify the task of coding a 
+     <blockquote><u>Hint:</u> In order to simplify the task of coding a
         JMX programmatic client, we recommend that getters, setters, and
-        operations defined in MBean and MXBean interfaces throw 
+        operations defined in MBean and MXBean interfaces throw
         <code>IOException</code>. Proxy objects will then be able
         to rethrow directly any <code>IOException</code> received from
         their underlying MBean Server connection, without wrapping
         them into <code>UndeclaredThrowableExceptions</code>.<br>
-        Since the life cycle of the proxy object is not directly tied to 
+        Since the life cycle of the proxy object is not directly tied to
         the life cycle of the MBean it proxies, you may also want to
         have all methods in the MBean or MXBean interface throw
         <code>InstanceNotFoundException</code> or more generally
@@ -510,7 +510,7 @@ title="ScanManager.java"
              the application MBeans are modeling objects
              which are conceptually contained within
              each other in a tree-like structure.
-             <br>For instance, most MBean names defined by 
+             <br>For instance, most MBean names defined by
              <a href="http://jcp.org/en/jsr/detail?id=77"
               >J2EE Management (JSR 77)</a> follow
               this scheme.
@@ -519,7 +519,7 @@ title="ScanManager.java"
              return <code>ObjectName</code> or
              <code>ObjectName[]</code> values</b>. The ObjectNames
              point to the MBeans which are related to that
-             object. For instance , <a 
+             object. For instance , <a
              href="http://glassfish.dev.java.net/"
              title="Open Source Java EE 5 Application Server"
              >GlassFish</a>
@@ -604,7 +604,7 @@ title="Inter-MXBean references"
       <p>
          Sometimes also, an MBean may need to perform some
          checks before being registered, or will need
-         to carry out some actions right after it has been 
+         to carry out some actions right after it has been
          successfully registered in the MBeanServer.
       </p>
       <p>
@@ -617,13 +617,13 @@ title="Inter-MXBean references"
       for it is to implement the <code>MBeanRegistration</code>
       interface.
       </p>
-      <p>The <code>MBeanRegistration</code> interface is a callback 
-      interface which defines pre and post registration and 
+      <p>The <code>MBeanRegistration</code> interface is a callback
+      interface which defines pre and post registration and
       unregistration callbacks.
       </p>
       <p>
        When an MBean implementing this interface is created
-      (with <code>createMBean</code>) or registered 
+      (with <code>createMBean</code>) or registered
       (with <code>registerMBean</code>) in an MBeanServer,
       the MBeanServer will call the <code>preRegister</code>
       and <code>postRegister</code> method implemented by
@@ -631,17 +631,17 @@ title="Inter-MXBean references"
       has an <code>MBeanServer</code> and <code>ObjectName</code>
       parameter, which are passed by the MBeanServer to the
       MBean. The MBean can store the reference it is being passed
-      in a private instance variable for later use. 
+      in a private instance variable for later use.
       </p>
       <p>
       Most of the MXBeans we have defined in this example
       implement the <code>MBeanRegistration</code> interface. The table
       below show how our MBeans use this interface to control
-      their own names, make sanity checks, perform 
+      their own names, make sanity checks, perform
       initialization steps or cleanup actions.
       </p>
       <p><br><center>
-      <table border="1" cellpadding="4" cellspacing="2" 
+      <table border="1" cellpadding="4" cellspacing="2"
              bgcolor="#eeeeee" width="95%">
           <thead>
               <tr bgcolor="#cecece">
@@ -654,16 +654,16 @@ title="Inter-MXBean references"
               <tr>
                   <td bgcolor="#dedede">get a reference to the MBeanServer</td>
                   <td><code>preRegister</code></td>
-                  <td bgcolor="#fafafa">The <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+                  <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
              >ScanManagerMXBean</a>  needs a reference
                   to the MBeanServer in order to create and
-                  register other MBeans, such as the 
+                  register other MBeans, such as the
                   <a
 href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
 title="The ResultLogManagerMXBean is in charge of managing result logs"
-        >ResultLogManagerMXBean</a>, and the 
+        >ResultLogManagerMXBean</a>, and the
                   <a
 href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
 title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
@@ -675,13 +675,13 @@ title="A DirectoryScannerMXBean looks for file matching a given set of criteria,
                       not met.
                   </td>
                   <td><code>preRegister</code></td>
-                  <td bgcolor="#fafafa">The <a 
+                  <td bgcolor="#fafafa">The <a
 href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
              >ScanManagerMXBean</a>  will throw
                   an IllegalArgumentException in <code>preRegister</code>
                   if the ObjectName it is being passed is
-                  illegal. Throwing an exception in 
+                  illegal. Throwing an exception in
                   <code>preRegister</code> makes the registration fail.
                   </td>
               </tr>
@@ -692,9 +692,9 @@ title="The ScanManagerMXBean is the main MBean of the scandir application"
 href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
 title="The ScanDirConfigMXBean is in charge of the configuration"
            >ScanDirConfigMXBean</a> propagates the
-                  value of the <code>name=</code> property of 
+                  value of the <code>name=</code> property of
                   the ObjectName it is given into its
-                  ScanManagerConfig bean.  
+                  ScanManagerConfig bean.
                   </td>
               </tr>
               <tr>
@@ -704,19 +704,19 @@ title="The ScanDirConfigMXBean is in charge of the configuration"
                   <td><code>preRegister</code></td>
                   <td bgcolor="#fafafa">The name that is returned by <code>preRegister</code>
                   is the ObjectName with which the MBean will be
-                  eventually registered. 
+                  eventually registered.
                   The <a
 href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
 title="The ScanDirConfigMXBean is in charge of the configuration"
            >ScanDirConfigMXBean</a> is able to suggest
                   a value for its own ObjectName if none was
-                  provided. Similarly, the <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+                  provided. Similarly, the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
-             >ScanManagerMXBean</a> 
+             >ScanManagerMXBean</a>
                   always returns its singleton ObjectName
-                  defined by <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html#SCAN_MANAGER_NAME" 
+                  defined by <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html#SCAN_MANAGER_NAME"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
              >ScanManagerMXBean.SCAN_MANAGER_NAME</a>.
                   </td>
@@ -736,7 +736,7 @@ title="The ScanDirConfigMXBean is in charge of the configuration"
                   known that the registration was successful.
                   </td>
                   <td><code>postRegister</code></td>
-                  <td bgcolor="#fafafa">The <code>postRegister</code> method 
+                  <td bgcolor="#fafafa">The <code>postRegister</code> method
                   can be used to implement
                   initialization steps that need to be done once it
                   is known that the registration was successful, or to
@@ -745,11 +745,11 @@ title="The ScanDirConfigMXBean is in charge of the configuration"
                   The <code>postRegister</code> method has a Boolean parameter
                   which tells the MBean whether it was or wasn't
                   successfully registered in the MBeanServer.
-                  The <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+                  The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
              >ScanManagerMXBean</a>  uses <code>postRegister</code> to create
-                  and register other MBeans, such as the 
+                  and register other MBeans, such as the
                   <a
 href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
 title="The ResultLogManagerMXBean is in charge of managing result logs"
@@ -766,19 +766,19 @@ title="The ScanDirConfigMXBean is in charge of the configuration"
               <tr>
                   <td bgcolor="#dedede">check whether the MBean can be deregistered</td>
                   <td><code>preDeregister</code></td>
-                  <td bgcolor="#fafafa">The <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+                  <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
              >ScanManagerMXBean</a>  uses this method to verify
-                   that its state allows it to be deregistered. 
+                   that its state allows it to be deregistered.
                    In particular, it will refuse to be deregistered
                    if it is in the RUNNING or SCHEDULED state.
                    If <code>preDeregister</code> throws an exception, the unregisterMBean
                    call will fail and the MBean will remain registered in
-                   the MBeanServer. 
+                   the MBeanServer.
                    Take particular care when implementing business logic
-                   in this method: if the logic you implement has an 
-                   unfortunate bug which makes it always throw an 
+                   in this method: if the logic you implement has an
+                   unfortunate bug which makes it always throw an
                    exception, you will never be able to unregister
                    that MBean.
                   </td>
@@ -788,19 +788,19 @@ title="The ScanManagerMXBean is the main MBean of the scandir application"
                       it fails
                   </td>
                   <td><code>preDeregister</code></td>
-                  <td bgcolor="#fafafa">The <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+                  <td bgcolor="#fafafa">The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
              >ScanManagerMXBean</a>  uses this method to unregister
                   all the other MBeans it has created and registered in the
                   MBeanServer. This includes the <a
 href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
 title="The ResultLogManagerMXBean is in charge of managing result logs"
-        >ResultLogManagerMXBean</a>, the 
+        >ResultLogManagerMXBean</a>, the
                   <a
 href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
 title="The ScanDirConfigMXBean is in charge of the configuration"
-           >ScanDirConfigMXBeans</a> it has created, and the 
+           >ScanDirConfigMXBeans</a> it has created, and the
                   <a
 href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
 title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
@@ -816,8 +816,8 @@ title="A DirectoryScannerMXBean looks for file matching a given set of criteria,
                   <td><code>postDeregister</code></td>
                   <td bgcolor="#fafafa"><code>postDeregister</code> is only called if the MBean was succesfully
                   unregistered.
-                  The <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+                  The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
              >ScanManagerMXBean</a>  uses this method to cancel
                   its internal java.util.Timer.
@@ -834,25 +834,25 @@ title="The ScanManagerMXBean is the main MBean of the scandir application"
         instance registered in a given MBeanServer. <br>
         A singleton MBean usually has a well-known name,
         which can be defined as a constant. In that case,
-        clients no longer need to call <code>new ObjectName(...)</code> 
+        clients no longer need to call <code>new ObjectName(...)</code>
         and catch the declared <code>MalformedObjectNameException</code>.
       </p>
       <p>There are already quite a few examples of singleton
-         MBeans in the java.lang.management API. The 
+         MBeans in the java.lang.management API. The
          ThreadingMXBean, ClassLoadingMXBean, RuntimeMXBean, etc.
          are all singleton MBeans.
       </p>
       <p>In this example, we have two singleton MBeans:
-         The <code><a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+         The <code><a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
-             >ScanManagerMXBean</a></code> and the 
+             >ScanManagerMXBean</a></code> and the
          <code><a
 href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
 title="The ResultLogManagerMXBean is in charge of managing result logs"
         >ResultLogManagerMXBean</a></code>. But in fact,
-         the only real singleton MBean is the 
-        <code>ScanManagerMXBean</code>. The 
+         the only real singleton MBean is the
+        <code>ScanManagerMXBean</code>. The
         <code>ResultLogManagerMXBean</code> just happens to
         be a singleton MBean because it has a 1-1 relationship
         with the <code>ScanManagerMXBean</code>.
@@ -861,15 +861,15 @@ title="The ResultLogManagerMXBean is in charge of managing result logs"
          singleton MBean pattern in this way:
       </p>
       <ul>
-          <li>The <code>ScanManagerMXBean</code> name has a single 
+          <li>The <code>ScanManagerMXBean</code> name has a single
               key property: <code>type=ScanManagerMXBean</code>.</li>
           <li>Its name is defined by an ObjectName constant called
               <code>SCAN_MANAGER_NAME</code> in the <code>ScanManager</code> class</li>
-          <li>The <code>ScanManagerMXBean</code> enforces its status of 
+          <li>The <code>ScanManagerMXBean</code> enforces its status of
               singleton MBean. It will refuse to be registered
               with a name other than
               the <code>SCAN_MANAGER_NAME</code>. You can therefore depend on
-              the fact that the <code>ScanManagerMXBean</code> will always 
+              the fact that the <code>ScanManagerMXBean</code> will always
               be registered with its singleton <code>SCAN_MANAGER_NAME</code>
               (see <code>preRegister</code>)
           </li>
@@ -879,18 +879,18 @@ title="The ResultLogManagerMXBean is in charge of managing result logs"
               its singleton <code>SCAN_MANAGER_NAME</code>
               (see <code>preRegister</code>).
           </li>
-          <li>The <code>ScanManager</code> class has a no-arg static 
+          <li>The <code>ScanManager</code> class has a no-arg static
               <code>register</code> method that will register
               the singleton instance in the Platform MBeanServer.
               This static <code>register</code> method returns
               a proxy to the registered singleton.
           </li>
-          <li>The <code>ScanManager</code> class has also a static 
+          <li>The <code>ScanManager</code> class has also a static
               <code>register</code> method that will create
               a singleton instance in a (possibly remote)
-              MBeanServerConnection - using 
+              MBeanServerConnection - using
               <code>createMBean</code>.
-              This static <code>register</code> method 
+              This static <code>register</code> method
               also returns a proxy to the registered singleton.
           </li>
           <li>Only the MBeanServer has a reference to the
@@ -906,7 +906,7 @@ title="The ResultLogManagerMXBean is in charge of managing result logs"
         >ResultLogManagerMXBean</a></code>
       has a much more relaxed implementation of the pattern:
       <br>It simply provides its own singleton name if it is
-      registered with a null ObjectName, but will not enforce 
+      registered with a null ObjectName, but will not enforce
       the use of that name.
       </p>
       <p>Note that all singleton MBean names in this example
@@ -923,16 +923,16 @@ title="The ResultLogManagerMXBean is in charge of managing result logs"
       <p>In this example, we have decided to follow a simple
       pattern:</p>
       <ul>
-          <li>The application is initialized simply 
-              by registering the singleton 
-              <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+          <li>The application is initialized simply
+              by registering the singleton
+              <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
-             >ScanManagerMXBean</a> in 
+             >ScanManagerMXBean</a> in
               the MBeanServer.
           </li>
           <li>The <code>ScanManagerMXBean</code> will then
-              in turn register any other MBean that the 
+              in turn register any other MBean that the
               application might need:
               <ul>
                   <li>It creates and registers the singleton
@@ -948,14 +948,14 @@ title="The ScanDirConfigMXBean is in charge of the configuration"
            >ScanDirConfigMXBean</a></code>
                       which loads the initial configuration
                   </li>
-                  <li>It creates as many 
+                  <li>It creates as many
                      <code><a
 href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
 title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
         >DirectoryScannerMXBeans</a></code> as
                      needed when the configuration is applied
                   </li>
-                  <li>It lets you create alternate 
+                  <li>It lets you create alternate
                       <code>ScanDirConfigMXBean</code>, to
                       which you can later switch in order
                       to apply a new alternate configuration.
@@ -963,7 +963,7 @@ title="A DirectoryScannerMXBean looks for file matching a given set of criteria,
               </ul>
           </li>
           <li>When a new configuration is applied (or if the
-              current configuration is reapplied), the 
+              current configuration is reapplied), the
               <code>ScanManagerMXBean</code> will unregister
               any <code>DirectoryScannerMXBeans</code> it has
               previously registered, and will re-create
@@ -984,11 +984,11 @@ title="A DirectoryScannerMXBean looks for file matching a given set of criteria,
          method).
       </p>
       <p>You will note that the <code>ScanManagerMXBean</code>
-         will only allow itself to be deregistered if it can be 
+         will only allow itself to be deregistered if it can be
          closed - that is if there's no other action in
-         progress. 
+         progress.
          This is to make sure that the deregistration of
-         dependent MBeans will work smoothly. 
+         dependent MBeans will work smoothly.
          <br>
          The deregistration of related MBeans will happen
          in the <code>ScanManager.preDeregister</code>
@@ -1007,13 +1007,13 @@ title="A DirectoryScannerMXBean looks for file matching a given set of criteria,
       </p>
       <p>Handling the LifeCycle of all the application's
          MBeans in a single MBean is usually a good design
-         pattern, especially if the application is a 
+         pattern, especially if the application is a
          module which is intended to share a JVM - or
          an MBeanServer - with other modules.
       </p>
       <p>This is specially useful if the application needs to
-         be loaded and unloaded on demand: in that 
-         case, simply registering or unregistering the top level 
+         be loaded and unloaded on demand: in that
+         case, simply registering or unregistering the top level
          MBean (in our example the <code>ScanManagerMXBean</code>) does
          the trick.
       </p>
@@ -1021,29 +1021,29 @@ title="A DirectoryScannerMXBean looks for file matching a given set of criteria,
   <h3>Emitting Notifications</h3>
   <ul>
        <p>In order to emit notifications, an MBean must be
-       an instance of <code>NotificationEmitter</code>. 
-       The <code>NotificationEmitter</code> interface defines methods 
+       an instance of <code>NotificationEmitter</code>.
+       The <code>NotificationEmitter</code> interface defines methods
        that the MBeanServer will call on the MBean in order
        to register <code>NotificationListeners</code> with the MBean.
        </p>
        <p>It is worth noting that the MBean may not be
           invoked each time a JMX client wants to register
           a listener. For instance, the RMIConnectorServer
-          registers <i>only once</i> a single listener with each MBean 
+          registers <i>only once</i> a single listener with each MBean
           which is a <code>NotificationEmitter</code>.
           In that specific case, the listener may even be registered
           with the MBean before any client has actually subscribed
           for notifications from that particular MBean.
        </p>
-       <p>An MBean can therefore make no assumption about 
+       <p>An MBean can therefore make no assumption about
           which client or how many clients have registered for
           notifications.
        </p>
        <p>It is also worth noting that the logic of the
        methods defined in <code>NotificationEmitter</code> would not
        be trivial to implement from scratch. Fortunately
-       the JMX API defines a helper class, called 
-       <code>NotificationBroadcasterSupport</code>, which 
+       the JMX API defines a helper class, called
+       <code>NotificationBroadcasterSupport</code>, which
        provides an implementation for these methods.
        </p>
        <p>There are actually three ways for an MBean to
@@ -1061,7 +1061,7 @@ title="A DirectoryScannerMXBean looks for file matching a given set of criteria,
     then override its <code>getNotificationInfo</code> method
     which returns the <code>MBeanNotificationInfo[]</code> array
     that should be included in your MBean's <code>MBeanInfo</code>
-    and that's it. 
+    and that's it.
     <br>You just need to call the <code>sendNotification</code> method
     inherited from <code>NotificationBroadcasterSupport</code> whenever
     your MBean needs to send a notification.
@@ -1072,67 +1072,67 @@ title="The ScanDirConfigMXBean is in charge of the configuration"
            >ScanDirConfigMXBean</a> and <a
 href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
 title="The ResultLogManagerMXBean is in charge of managing result logs"
-        >ResultLogManagerMXBean</a> extend 
+        >ResultLogManagerMXBean</a> extend
       <code>NotificationBroadcasterSupport</code> in order
       to send notifications.
     </p>
   </ul>
-  <h4>The Delegation Pattern: delegating to a 
+  <h4>The Delegation Pattern: delegating to a
       NotificationBroadcasterSupport delegate</h4>
   <ul>
       <p>There may be cases however where delegating to a
-      wrapped <code>NotificationBroadcasterSupport</code> 
-      object may be preferred to extending 
+      wrapped <code>NotificationBroadcasterSupport</code>
+      object may be preferred to extending
       <code>NotificationBroadcasterSupport</code>.
       </p>
       <p>For instance, if your MBeans already derive from
       some base class, extending <code>NotificationBroadcasterSupport</code>
       might not be an option.
       </p>
-      <p>Similarly, if you do not want to have the inherited 
+      <p>Similarly, if you do not want to have the inherited
       <code>public void sendNotification(Notification notification)</code>
       method appear in the Javadoc of the concrete class of your
       MBean, you may want to consider using the delegation
-      pattern instead of extending 
+      pattern instead of extending
       <code>NotificationBroadcasterSupport</code>
       </p>
-      <p>In our example both the <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+      <p>In our example both the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
              >ScanManagerMXBean</a> and the <a
 href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
 title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
-        >DirectoryScannerMXBean</a> use the delegation 
-       pattern rather than extending 
+        >DirectoryScannerMXBean</a> use the delegation
+       pattern rather than extending
        <code>NotificationBroadcasterSupport</code>.
        In the end, choosing between one or the other method
-       is more a question of taste, although the delegation 
+       is more a question of taste, although the delegation
        pattern could be considered more flexible since it
        doesn't require extending any given superclass.
       </p>
       <p>It may be also worth noting that some tools like
-      the JMX Module of <a 
+      the JMX Module of <a
 href="http://www.netbeans.org"
-      >NetBeans IDE</a>, will be able to 
+      >NetBeans IDE</a>, will be able to
       generate for you all the code that delegates to a
       wrapped <code>NotificationBroadcasterSupport</code>.
       </p>
   </ul>
-      
+
   <h4>Implementing NotificationEmitter from scratch</h4>
   <ul>
     <p>This is the last possibility for an MBean that
-    needs to send notifications: simply implement 
+    needs to send notifications: simply implement
     <code>NotificationEmitter</code> from scratch. This is highly
-    discouraged since that logic is not trivial, and 
-    already provided by 
+    discouraged since that logic is not trivial, and
+    already provided by
     <code>NotificationBroadcasterSupport</code> anyway.
     </p>
   </ul>
-    
+
   <h4>Beware of Synchronization Locks</h4>
   <ul>
-       
+
        <p>One thing you must keep in mind when sending
        notifications is not to send them from within
        a synchronized block, or while holding a lock on
@@ -1140,10 +1140,10 @@ href="http://www.netbeans.org"
        <p>Indeed, what happens when you send a notification
           may vary greatly depending on whether the client
           which has registered for notifications has done
-          so through a <code>JMXConnector</code> (like the 
+          so through a <code>JMXConnector</code> (like the
           <code>JMXRMIConnector</code>)
           or through a direct reference to the MBeanServer
-          (by calling 
+          (by calling
           <code>MBeanServer.addNotificationListener</code>).
        </p>
        <p>In this latter case, the listener will be invoked
@@ -1152,7 +1152,7 @@ href="http://www.netbeans.org"
        code of that listener now re-enters your MBean through a
        call that flows through a JMXConnector, a deadlock
        could occur. It is therefore very important to release
-       any lock you may have before calling 
+       any lock you may have before calling
        <code>sendNotification</code>.</p>
        <p>An easy way to do that is demonstrated in the
           <code>ScanManager</code> class. The ScanManager
@@ -1160,20 +1160,20 @@ href="http://www.netbeans.org"
           When a notification needs to be sent (e.g. because the
           ScanManager state is being switched), the notification
           is simply prepared and put into the pending notification
-          queue. 
-          The notification queue is then processed later on, 
+          queue.
+          The notification queue is then processed later on,
           at the end of the method, when the processing is finally
           completed and all the locks have been released.
           <br>At this point the notification queue might already
           have been emptied by another thread - in which case
           the pending notifications will have already been
-          removed from the queue. Which thread actually gets 
-          to send the notifications is of no importance. The 
+          removed from the queue. Which thread actually gets
+          to send the notifications is of no importance. The
           important point is that all the locks detained by
           your MBean code in that thread were released before
           the notification was sent.
        </p>
-       <p>In our example the <code>ScanManager</code> class 
+       <p>In our example the <code>ScanManager</code> class
           ensures this by:
           <ul>
               <li>Only calling <code>sendNotification</code>
@@ -1183,14 +1183,14 @@ href="http://www.netbeans.org"
               <li>Only calling <code>sendQueuedNotifications</code>
                   when all locks have been released.
               </li>
-              <li>Never calling a method that calls 
+              <li>Never calling a method that calls
                   <code>sendQueuedNotifications</code> from within
                   a synchronized block.</li>
           </ul>
        </p>
   </ul>
-       
-       
+
+
 
   <h4>Don't subclass Notification</h4>
   <ul>
@@ -1202,23 +1202,23 @@ href="http://www.netbeans.org"
        </p>
        <p>Indeed, if you code your own subclass, a generic
        client, like jconsole, will not be able to receive
-       that notification unless it has that custom 
+       that notification unless it has that custom
        subclass in its classpath.
        </p>
        <p>
        If you want your application to be interoperable, it is
        therefore preferable not to subclass any of the standard
-       Notification classes. You can define your own 
+       Notification classes. You can define your own
        Notification type string, and if you need to send
-       additional data, you can put a CompositeData, or a 
-       HashMap of serializable standard types in the 
+       additional data, you can put a CompositeData, or a
+       HashMap of serializable standard types in the
        Notification's user data fields.
        </p>
-       <p>In this example, we are using directly the 
+       <p>In this example, we are using directly the
        standard notification classes:
        <ul>
-           <li>The <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+           <li>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
              >ScanManagerMXBean</a> and the <a
 href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
@@ -1236,7 +1236,7 @@ title="A DirectoryScannerMXBean looks for file matching a given set of criteria,
              it finds a matching file.
              <br>In that case, we simply use the base
              <code>Notification</code>
-             class with a new 
+             class with a new
              <b><code>com.sun.jmx.examples.scandir.filematch</code></b>
              type.
            </li>
@@ -1246,17 +1246,17 @@ title="The ScanDirConfigMXBean is in charge of the configuration"
              >ScanDirConfigMXBean</a> and <a
 href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
 title="The ResultLogManagerMXBean is in charge of managing result logs"
-             >ResultLogManagerMXBean</a> also both use the base 
+             >ResultLogManagerMXBean</a> also both use the base
              <code>Notification</code> class.
            </li>
        </ul>
-       <p>Careful readers will have noted that the <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+       <p>Careful readers will have noted that the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
              >ScanManagerMXBean</a> and the <a
 href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
 title="A DirectoryScannerMXBean looks for file matching a given set of criteria, starting at a given root."
-             >DirectoryScannerMXBean</a> both use the 
+             >DirectoryScannerMXBean</a> both use the
              <code>AttributeChangeNotification</code> class
              to notify about their state change, whereas the
              <a
@@ -1270,40 +1270,40 @@ title="The ScanDirConfigMXBean is in charge of the configuration"
           both denote a state change:
           <ul>
               <p>In the case of <code>ScanManagerMXBean</code>
-              and <code>DirectoryScannerMXBean</code>, the 
+              and <code>DirectoryScannerMXBean</code>, the
               notification which is emitted is more about a
               state transition, from one state to another.
               For instance, going from <code>RUNNING</code>
-              to <code>STOPPED</code>, or from 
+              to <code>STOPPED</code>, or from
               <code>SCHEDULED</code> to <code>STOPPED</code>.
-              <br>In that case, the 
+              <br>In that case, the
               <code>AttributeChangeNotification</code> was
               more appropriate because it made it possible
-              to send the previous and the new value of the 
+              to send the previous and the new value of the
               state attribute, thus reflecting the whole
               state transition.
               </p>
               <p>In the case of the <code>ScanDirConfigMXBean</code>
               however, what is of interest is the state in
               which the MBean has arrived. Using the base
-              <code>Notification</code> class with three different 
-              notification type strings -  
+              <code>Notification</code> class with three different
+              notification type strings -
               <b><code>com.sun.jmx.examples.scandir.config.loaded</code></b>,
               <b><code>com.sun.jmx.examples.scandir.config.modified</code></b>,
               and
-              <b><code>com.sun.jmx.examples.scandir.config.saved</code></b> - 
+              <b><code>com.sun.jmx.examples.scandir.config.saved</code></b> -
               was therefore closer to what we wanted to model.
               </p>
           </ul>
        </p>
   </ul>
-       
+
   <h3>Configuration MBeans</h3>
     <ul>
     <p>A common practice when designing a management application is
-    to have an MBean, or a set of MBeans, dedicated to configuration. 
+    to have an MBean, or a set of MBeans, dedicated to configuration.
     Separating configuration from control and monitoring allows
-    more appropriate logic, and often simplifies the design and 
+    more appropriate logic, and often simplifies the design and
     implementation of the management interface.
     </p>
     <p>
@@ -1312,16 +1312,16 @@ href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
 title="The ScanDirConfigMXBean is in charge of the configuration"
      >ScanDirConfigMXBean</a> is dedicated to the application configuration.
     </p>
-    <p>The <code>ScanDirConfigMXBean</code> will let you interactively 
+    <p>The <code>ScanDirConfigMXBean</code> will let you interactively
         modify, save, or load the application configuration. The modifications
         will not be taken into account until it is applied, by invoking
-        <code>applyConfiguration</code> on the <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+        <code>applyConfiguration</code> on the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
-        >ScanManagerMXBean</a>. 
+        >ScanManagerMXBean</a>.
     It is also possible to create many configurations, by creating as
     many <code>ScanDirConfigMXBean</code>s, and then to choose and apply
-    one of these configurations by calling 
+    one of these configurations by calling
     <code>ScanManagerMXBean.setConfigurationMBean</code> and then
     <code>ScanManagerMXBean.applyConfiguration</code>.
     </p>
@@ -1331,26 +1331,26 @@ title="The ScanManagerMXBean is the main MBean of the scandir application"
     </p>
     <p>In order to save and store the application configuration data, the
     <code>ScanDirConfigMXBean</code> uses a set of XML serializable Java beans
-    defined in the <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/config/package-summary.html" 
+    defined in the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/config/package-summary.html"
 title="The com.sun.jmx.examples.scandir.config package defines XML serializable beans"
         >com.sun.jmx.examples.scandir.config</a> package. These beans are very
    simple Java beans which have been lightly annotated for XML binding.
     </p>
     <p>It is worth noting that these same beans can also be handled by the
-    MXBean framework (our beans don't contain recursive data structures) and can 
+    MXBean framework (our beans don't contain recursive data structures) and can
     therefore be used directly as attributes and parameters of MXBeans, without
     needing to be Java-serializable (the MXBean framework transform them in
     CompositeData objects - which <b>are</b> serializable).
     </p>
-    <p>The same <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/config/ScanManagerConfig.html" 
+    <p>The same <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/config/ScanManagerConfig.html"
 title="The com.sun.jmx.examples.scandir.config package defines XML serializable beans"
         >ScanManagerConfig</a> bean that we use to read from and write to the
         XML configuration file is thus also used as attribute of the <a
 href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
 title="The ScanDirConfigMXBean is in charge of the configuration"
-     >ScanDirConfigMXBean</a>. It is transformed into a <code>CompositeData</code> 
+     >ScanDirConfigMXBean</a>. It is transformed into a <code>CompositeData</code>
        by the MXBean framework, and can be easily introspected with
        <a href="#JConsole">jconsole</a>.
     </p>
@@ -1358,7 +1358,7 @@ title="The ScanDirConfigMXBean is in charge of the configuration"
   <h3>MBeans Must Be Thread-Safe</h3>
     <ul>
     <p>A question often asked by newcomers to JMX technology
-    is whether the MBeanServer is thread-safe. Well, the MBeanServer <b>is</b> 
+    is whether the MBeanServer is thread-safe. Well, the MBeanServer <b>is</b>
     thread safe, but it doesn't put any locks on the MBeans it contains. The
     MBeans can be concurrently accessed by multiple threads, and must therefore
     take care of their own thread safety.
@@ -1382,19 +1382,19 @@ title="The ScanDirConfigMXBean is in charge of the configuration"
         MBean will have any side effect. Maybe that MBean will make
         further calls to other MBeans which will in turn try to call
         your MBean, or maybe it will emit a
-        notification, and we'll be back to the considerations just 
+        notification, and we'll be back to the considerations just
         above.</li>
     </ul>
     </p>
     <p>Another means of implementing thread-safe code is to use semaphores.
-    The <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+    The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
         >ScanManagerMXBean</a> uses a semaphore called
         <code>sequencer</code> to ensure
     that critical code sections are not executed concurrently. In this
     MBean, we use <code>Semaphore.tryAcquire</code> to lock the sequencer
-    semaphore before entering the critical section. If the 
+    semaphore before entering the critical section. If the
     <code>Semaphore.tryAcquire</code> returns true then we enter the critical
     section. If it returns false, we throw an IllegalStateException, stating
     that we couldn't acquire the lock. The code looks like this:
@@ -1416,21 +1416,21 @@ title="The ScanManagerMXBean is the main MBean of the scandir application"
         the calling code will get the <code>IllegalStateException</code>
         instead of being blocked on the deadlocked lock.
     </p>
-    <p>It is worth noting that each of these techniques has its own 
+    <p>It is worth noting that each of these techniques has its own
     advantages and disadvantages - which can make one of them more or less
     appropriate depending on the inner logic of the MBean you're implementing.
     </p>
-    <p>Careful readers will also have noted that we used 
-       <code>IllegalStateException</code> directly, instead of defining 
+    <p>Careful readers will also have noted that we used
+       <code>IllegalStateException</code> directly, instead of defining
        our own subclass of RuntimeException, which could have had a more
        precise semantics. If you define a new exception for your JMX application,
        you must keep in mind that your client will need to have the class
-       of your exception in its classpath to get that exception. 
+       of your exception in its classpath to get that exception.
        Otherwise your client will get a completely different exception, indicating a
        deserialization issue.
     </p>
     </ul>
-    
+
   <h3>Waiting for Notifications</h3>
     <ul>
     <p>Implementing code that needs to wait for notifications is sometimes
@@ -1450,9 +1450,9 @@ title="The ScanManagerMXBean is the main MBean of the scandir application"
        is not always trivial. However, there's a very easy way to do that: use
        a blocking queue of notifications.
        <pre>
-       final BlockingQueue&lt;Notification&gt; notifQueue = 
+       final BlockingQueue&lt;Notification&gt; notifQueue =
                 new LinkedBlockingQueue&lt;Notification&gt;();
-                
+
        final NotificationListener listener = new NotificationListener() {
             public void handleNotification(Notification notification,
                                            Object handback) {
@@ -1482,13 +1482,13 @@ title="The ScanManagerMXBean is the main MBean of the scandir application"
        ....
        </pre>
     </p>
-    <p>You will note that this is a technique we've been using in the <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html" 
+    <p>You will note that this is a technique we've been using in the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html"
 title="The ScanDirAgent class defines a main method for the scandir application"
         >ScanDirAgent</a> class and in the example unit tests.
     </p>
     </ul>
-    
+
   <h3>Holding hard references to other MBeans: proxy or direct reference?</h3>
   <ul>
     <p>We have seen that MXBeans will let you return proxy references to other
@@ -1500,7 +1500,7 @@ title="The ScanDirAgent class defines a main method for the scandir application"
     only held by the MBeanServer. It is a better design
     to hold a reference to a proxy, rather than to hold
     a hard reference to an MBean. However there are two cases
-    when holding a hard reference might be preferred: 
+    when holding a hard reference might be preferred:
      <ol>
         <li>When MBean A needs to call a method of method B which
            is not part of its MBean interface</li>
@@ -1513,51 +1513,51 @@ title="The ScanDirAgent class defines a main method for the scandir application"
     and the application can ensure that the life cycle
     of each MBean is consistent with regard to the other.
     </p>
-    <p>In our example, the <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+    <p>In our example, the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
-        >ScanManagerMXBean</a> holds only proxy references to the <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html" 
-        >ScanDirConfigMXBean</a> and the  <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html" 
+        >ScanManagerMXBean</a> holds only proxy references to the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirConfigMXBean.html"
+        >ScanDirConfigMXBean</a> and the  <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/DirectoryScannerMXBean.html"
         >DirectoryScannerMXBeans</a>. <br>
-    However it holds a direct reference to the <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManager.html" 
-        >ResultLogManager</a>. This makes it possible to pass a direct 
-        reference to the <code>DirectoryScannerMXBeans</code>, 
+    However it holds a direct reference to the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManager.html"
+        >ResultLogManager</a>. This makes it possible to pass a direct
+        reference to the <code>DirectoryScannerMXBeans</code>,
         which can then log their results
         more efficiently, and would also make it possible to remove
-        the <code>log</code> method from the <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html" 
-        >ResultLogManagerMXBean</a> interface - leaving it in the 
+        the <code>log</code> method from the <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ResultLogManagerMXBean.html"
+        >ResultLogManagerMXBean</a> interface - leaving it in the
         <code>ResultLogManager</code> class (possibly as a package method)
         should we wish to do so.
     </p>
-    
+
     </ul>
 
   <h3>Agent Class</h3>
     <ul>
-   <p>The <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html" 
+   <p>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirAgent.html"
 title="The ScanDirAgent class defines a main method for the scandir application"
      >ScanDirAgent</a> is the Agent class for the <i>scandir</i> application.
-    This class contains the <code>main</code> method to start a standalone  
+    This class contains the <code>main</code> method to start a standalone
     <i>scandir</i> application.
     </p>
-    <p>The <code>main</code> method simply registers a <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+    <p>The <code>main</code> method simply registers a <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
        >ScanManagerMXBean</a> in the platform MBeanServer, and then waits
     for someone to call <code>ScanManagerMXBean.close</code>.
     </p>
     <p>
-    When the <code>ScanManagerMXBean</code> state is switched to 
-    <code>ScanManagerMXBean.ScanState.CLOSED</code>, the 
+    When the <code>ScanManagerMXBean</code> state is switched to
+    <code>ScanManagerMXBean.ScanState.CLOSED</code>, the
     <code>ScanManagerMXBean</code> is unregistered, and the application
     terminates (i.e. the main thread completes).
     </p>
-    <p>Standalone JMX applications usually have an Agent class that contain 
+    <p>Standalone JMX applications usually have an Agent class that contain
        their <code>main</code> method, which performs all the MBean
        registration steps.
        However, it is usually not a bad idea if that class can
@@ -1566,19 +1566,19 @@ title="The ScanManagerMXBean is the main MBean of the scandir application"
        no longer be standalone and would no longer control the implementation
        of <code>main</code>. In our example the Agent
        class could be easily turned into an MBean, exposing its three
-    <code>init</code>, <code>waitForClose</code> and <code>cleanup</code> 
-    method. However we didn't go as far as turning it into an MBean since 
+    <code>init</code>, <code>waitForClose</code> and <code>cleanup</code>
+    method. However we didn't go as far as turning it into an MBean since
     the application can be already easily started by registering an instance
-    of <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html" 
+    of <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanManagerMXBean.html"
 title="The ScanManagerMXBean is the main MBean of the scandir application"
        >ScanManagerMXBean</a>.
     </p>
     </ul>
   <h3>Secure Client Class</h3>
     <ul>
-   <p>The <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirClient.html" 
+   <p>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirClient.html"
 title="The ScanDirClient class is a very short example of secure programmatic client"
      >ScanDirClient</a> is an example class that shows how a
     programmatic client can connect to a secured <i>scandir</i> application.
@@ -1596,18 +1596,18 @@ title="The ScanDirClient class is a very short example of secure programmatic cl
        the example.
     </p>
     </ul>
-    
+
   <h2><a name="h2-Testing">Testing the <i>scandir</i> Example</a></h2>
     <ul>
         <p>Make sure that you have access to junit.jar (either 3.8.1 or 3.8.2).
-           Make sure also that you have junit.jar in your 
+           Make sure also that you have junit.jar in your
            <code>CLASSPATH</code>.<br>
-           Then in the example root directory (where the <code>build.xml</code> 
+           Then in the example root directory (where the <code>build.xml</code>
            file is located) run the following command:
            <pre>ant test -Dlibs.junit.classpath=<i><u>path to junit jar (either 3.8.1 or 3.8.2)</u></i></pre>
         </p>
-        <p>Alternatively you can open the jmx-scandir project with the 
-           NetBeans IDE and test the jmx-scandir project from the 
+        <p>Alternatively you can open the jmx-scandir project with the
+           NetBeans IDE and test the jmx-scandir project from the
            <code>Run</code> menu.
         </p>
 
@@ -1615,18 +1615,18 @@ title="The ScanDirClient class is a very short example of secure programmatic cl
 
   <h2><a name="h2-Running">Running the <i>scandir</i> Example</a></h2>
     <ul>
-        <p>In the example root directory (where the <code>build.xml</code> 
+        <p>In the example root directory (where the <code>build.xml</code>
            file is located) run the following commands:
         <pre>ant jar
 ant run-single -Drun.class=com.sun.jmx.examples.scandir.ScanDirAgent -Djavac.includes=src</pre>
            or simply <pre>ant run</pre>
         </p>
-        
+
         <p>This will run the example using the configuration
            file provided in the src/etc directory.
         </p>
-        <p>Alternatively you can open the jmx-scandir project with the 
-           NetBeans IDE. You can run the example by 
+        <p>Alternatively you can open the jmx-scandir project with the
+           NetBeans IDE. You can run the example by
            selecting the <code>ScanDirAgent</code> file
            and run it with <code>Run File</code> in the
            <code>Run</code> menu or simply
@@ -1639,10 +1639,10 @@ ant run-single -Drun.class=com.sun.jmx.examples.scandir.ScanDirAgent -Djavac.inc
            it with <a href="#JConsole">jconsole</a>.
         </p>
         <blockquote>
-            <u>Note:</u> You can also run the <i>scandir</i> 
-            application directly from the <code>java</code> 
+            <u>Note:</u> You can also run the <i>scandir</i>
+            application directly from the <code>java</code>
             command line. Make sure to build the project jar
-            first. 
+            first.
             <br>On Unix systems:
             <pre>ant jar
 java -Djava.util.logging.config.file=logging.properties \
@@ -1655,11 +1655,11 @@ java &nbsp;-Djava.util.logging.config.file=logging.properties
      &nbsp;-jar&nbsp;dist\jmx-scandir.jar</code></p>
         </blockquote>
     </ul>
-    
+
     <h2><a name="h2-Playing">Playing with JConsole</a></h2>
     <ul>
     <p>Run the example as explained in the previous section, so
-    that it uses the provided <code>src/etc/testconfig.xml</code> 
+    that it uses the provided <code>src/etc/testconfig.xml</code>
     configuration file. Then start
     jconsole. In the connection window choose the process that runs
     <code>com.sun.jmx.examples.scandir.ScanDirAgent</code> or
@@ -1685,7 +1685,7 @@ java &nbsp;-Djava.util.logging.config.file=logging.properties
     </td></tr></table>
     </center>
     </p>
-    <p>Open the MBeans tab, and look for the 
+    <p>Open the MBeans tab, and look for the
        <code>ScanDirConfigMXBean</code>.
        Click on its <code>Attributes</code> node and double click on its
        <code>Configuration</code> attribute, to look at
@@ -1694,79 +1694,79 @@ java &nbsp;-Djava.util.logging.config.file=logging.properties
     </p>
     <p><center><a href="docfiles/scandir-config.jpg"
     title="jconsole MBean tab: ScanDirConfigMXBean"
-    ><img 
+    ><img
     src="docfiles/scandir-config.jpg"
     alt="jconsole MBean tab: ScanDirConfigMXBean"
     /></a></center>
     </p>
     <p>Now go to the <code>ScanManagerMXBean</code>, click on
        its <code>Notifications</code> node, and subscribe
-       for notifications. Then click on the 
+       for notifications. Then click on the
        <code>Operations</code> node and invoke the
        <code>start()</code> operation:
     </p>
     <p><center><a href="docfiles/scandir-start.jpg"
     title="jconsole MBean tab: ScanDirConfigMXBean"
-    ><img 
+    ><img
     src="docfiles/scandir-start.jpg"
     alt="jconsole MBean tab: ScanDirConfigMXBean"
     /></a></center>
     </p>
-    <p>You can see that the notifications counter was 
-       incremented by three: you have just scheduled, 
+    <p>You can see that the notifications counter was
+       incremented by three: you have just scheduled,
        run, and completed a batch of directory scans.
     </p>
     <p>Now go to the <code>ResultLogManagerMXBean</code>,
-       click on its <code>Attributes</code> node, and 
+       click on its <code>Attributes</code> node, and
        expand its <code>MemoryLog</code> attribute:
     </p>
     <p><center><a href="docfiles/scandir-result.jpg"
     title="jconsole MBean tab: ScanDirConfigMXBean"
-    ><img 
+    ><img
     src="docfiles/scandir-result.jpg"
     alt="jconsole MBean tab: ScanDirConfigMXBean"
     /></a></center>
     </p>
     <p>You can see that the directory scan results have
        been logged.</p>
-    <p>To make the application terminate go back to the 
+    <p>To make the application terminate go back to the
        <code>ScanManagerMXBean</code> and invoke
        <code>close()</code>. The <code>ScanDirAgent</code>
-       will receive the notification, step out of 
+       will receive the notification, step out of
        the application main thread, and the application
        will terminate.
     </p>
     <p>This is of course a very limited scenario. Feel free
     to improvise with all the features of the example, creating
-    a new configuration - 
+    a new configuration -
     <code>ScanManagerMXBean.createOtherConfigurationMBean</code> -
     adding multiple directory scanners to that configuration -
     <code>ScanDirConfigMXBean.addDirectoryScanner</code> -
     then switching the <code>ScanManagerMXBean</code> current
     configuration by changing the value of the <i>ConfigurationMBean</i>
     attribute - <code>ScanManagerMXBean.setConfigurationMBean</code>
-    - then applying the new configuration - 
-    <code>ScanManagerMXBean.applyConfiguration(true)</code> - 
-    then scheduling repeated directory scans every 10 seconds - 
-    <code>ScanManagerMXBean.schedule(0,10000)</code> - 
+    - then applying the new configuration -
+    <code>ScanManagerMXBean.applyConfiguration(true)</code> -
+    then scheduling repeated directory scans every 10 seconds -
+    <code>ScanManagerMXBean.schedule(0,10000)</code> -
     subscribing for notifications, etc...
     </p>
     </ul>
-    
+
   <a name="secure"></a>
   <h2><a name="h2-Turning">Turning the example into a Secure JMX Application</a></h2>
     <ul>
     <p>In this section, we will see how to configure and
     start the <i>scandir</i> example so that the JVM agent
-    is bootstrapped with a secure JMXConnectorServer. Indeed, until 
-    now we have only used the insecure local connection, 
+    is bootstrapped with a secure JMXConnectorServer. Indeed, until
+    now we have only used the insecure local connection,
     which can only be used as long as both the client and
     the server run on the same machine. This section will
-    explain how to start the <code>ScanDirAgent</code> so 
+    explain how to start the <code>ScanDirAgent</code> so
     that a real secure RMIConnectorServer is started at bootstrap.
     </p>
     <p>To achieve this we will: <a href="#management.properties"
-        >provide our own management.properties</a>, <a 
+        >provide our own management.properties</a>, <a
         href="#password-access">create our own password and access files</a>,
         <a href="#keystore-truststore">provide a keystore and truststore</a>,
         <a href="#start-secure-agent">start the ScanDirAgent with the
@@ -1774,21 +1774,21 @@ java &nbsp;-Djava.util.logging.config.file=logging.properties
     </ul>
     <h3>Configuring the JVM Agent for Secure Remote Connection</h3>
     <ul>
-        <p>The easiest way to <a name="management.properties">configure the 
-            JVM Agent</a> for Secure Remote 
+        <p>The easiest way to <a name="management.properties">configure the
+            JVM Agent</a> for Secure Remote
            Connection is to use your own <a
            href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#properties"
            title="This page describes the properties you can put in your management.properties file"
            >management.properties</a> file.
-           In this example, we have copied the default 
-           <code>$JRE/lib/management/management.properties</code>
+           In this example, we have copied the default
+           <code>$JRE/conf/management/management.properties</code>
            file to the example's <code>src/etc</code> directory and
            modified it in <a href="src/etc/management.properties"
            title="our modified management.properties"
            >this way</a>:
            <ul>
-               <li>We have set the RMI port to <u>4545</u> - this is just a 
-                   random port number we have picked up. Feel free to use your 
+               <li>We have set the RMI port to <u>4545</u> - this is just a
+                   random port number we have picked up. Feel free to use your
                    own value suited to your environment.
                <pre># For setting the JMX RMI agent port use the following line
 com.sun.management.jmxremote.port=<b>4545</b></pre>
@@ -1801,26 +1801,26 @@ com.sun.management.jmxremote.ssl.<b>need.client.auth</b>=<b>true</b></pre>
                <pre># For using an SSL/TLS <b>protected</b> RMI Registry use the following line
 com.sun.management.jmxremote.<b>registry.ssl</b>=<b>true</b></pre>
                </li>
-               <li>We have provided <a 
+               <li>We have provided <a
                 href="src/etc/password.properties">our own password file</a>
                <pre># For a non-default password file location use the following line
 com.sun.management.jmxremote.password.file=<i>src/etc/password.properties</i></pre>
                </li>
-               <li>We have provided <a 
+               <li>We have provided <a
                 href="src/etc/access.properties">our own access file</a>
                <pre># For a non-default password file location use the following line
 com.sun.management.jmxremote.access.file=<i>src/etc/access.properties</i></pre>
                </li>
            </ul>
            <p>You will note that we haven't provided any value
-              for the other security properties, like 
+              for the other security properties, like
               <code>com.sun.management.jmxremote.authenticate=true</code>,
               because these properties already default to a value
-              which enables security by default. 
+              which enables security by default.
               Note however that protecting the RMI Registry with SSL
               improves the application security, but only as long as
               mutual authentication is also switched on. Otherwise, just
-              anybody would be able to connect to the registry and 
+              anybody would be able to connect to the registry and
               get the RMIServer stub.
            </p>
            <p>We do recommend that you <u>use the most secure configuration
@@ -1829,21 +1829,21 @@ com.sun.management.jmxremote.access.file=<i>src/etc/access.properties</i></pre>
               mutual authentication</u>, as we show in this example.
            </p>
            <p>We will use the <code>com.sun.management.config.file</code>
-           system property to pass our <a 
+           system property to pass our <a
            href="src/etc/management.properties">management.properties</a>
            file to the <code>ScanDirAgent</code>.
            </p>
     </ul>
-    
+
     <h3>Creating a password and access file</h3>
     <ul>
         <p>As explained above, we have created our own
-        <a href="src/etc/password.properties">password file</a> 
-        and <a href="src/etc/access.properties">access file</a> 
+        <a href="src/etc/password.properties">password file</a>
+        and <a href="src/etc/access.properties">access file</a>
         for <a name="password-access">access control and authorization</a>.
         </p>
-        <p>In the password file, we have defined two logins: 
-           <i>guest</i> and <i>admin</i>. The password for 
+        <p>In the password file, we have defined two logins:
+           <i>guest</i> and <i>admin</i>. The password for
            <i>guest</i> is <i>guestpasswd</i> and the password
            for <i>admin</i> is <i>adminpasswd</i>.
         </p>
@@ -1852,7 +1852,7 @@ com.sun.management.jmxremote.access.file=<i>src/etc/access.properties</i></pre>
         access, while the <i>guest</i> login only has <i>read-only</i>.
         </p>
         <p>Before starting the <code>ScanDirAgent</code>, you will
-           need to restrict access permission to the password file, 
+           need to restrict access permission to the password file,
            in such a way that nobody but you can read it. Otherwise, the
            JVM Agent will refuse to start the JMXConnectorServer, as it will
            fear that security can be compromised if other parties can
@@ -1863,7 +1863,7 @@ com.sun.management.jmxremote.access.file=<i>src/etc/access.properties</i></pre>
            >here</a>.
         </p>
         <p>As we have seen above, the location
-           of our access and password files is configured in our own <a 
+           of our access and password files is configured in our own <a
            href="src/etc/management.properties">management.properties</a>
            file.
         </p>
@@ -1874,17 +1874,17 @@ com.sun.management.jmxremote.access.file=<i>src/etc/access.properties</i></pre>
            client and server will need a <a name="keystore-truststore"
            >keystore and a truststore</a>
            to store their own certificates, and the certificates of
-           the parties they trust. Usually, client and server will 
-           have their own keystore and truststore. 
+           the parties they trust. Usually, client and server will
+           have their own keystore and truststore.
         </p>
         <p>For the sake of simplicity - and to get you started
         without the tedious necessity of creating your own keystore
-        and truststore, we are providing a dummy keystore and 
+        and truststore, we are providing a dummy keystore and
         truststore, containing a certificate self-signed by duke.
         The password for our keystore is <i>password</i>, and the
         password for our truststore is <i>trustword</i>.
         We suggest that you first get the example running with the
-        keystore and truststore we are providing before attempting 
+        keystore and truststore we are providing before attempting
         to use your own keystore and truststore.
         </p>
         <p>A secure application will obviously need to use its own
@@ -1895,9 +1895,9 @@ com.sun.management.jmxremote.access.file=<i>src/etc/access.properties</i></pre>
         in <a
 href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#SSL_enabled"
 title="Monitoring and Management Using JMX"
-        >here</a>.          
-        As shown <a href="#start-secure-agent">later</a>, 
-        we will need to use <a 
+        >here</a>.
+        As shown <a href="#start-secure-agent">later</a>,
+        we will need to use <a
         href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html#SSL_enabled"
         >system properties</a> to pass our truststore
         and keystore to the <code>ScanDirAgent</code>.
@@ -1923,7 +1923,7 @@ java \
         </p>
          <p>On Windows Systems:
 <p><code>ant jar<br>
-java 
+java
     &nbsp;-Djava.util.logging.config.file=logging.properties
     &nbsp;-Djavax.net.ssl.keyStore=keystore
     &nbsp;-Djavax.net.ssl.keyStorePassword=password
@@ -1934,10 +1934,10 @@ java
     &nbsp;-jar&nbsp;dist\jmx-scandir.jar</code></p>
          </p>
     <p>If you start jconsole now, you will see that you
-       are still able to connect to the agent using the 
+       are still able to connect to the agent using the
        local connection. However, if you try to connect
-       through the remote connector, using 
-       <a href="docfiles/remote-connection.jpg">localhost:4545</a>, 
+       through the remote connector, using
+       <a href="docfiles/remote-connection.jpg">localhost:4545</a>,
        the connection will <a href="docfiles/remote-connection-failed.jpg"
        >fail</a>, even if you provide a correct login/password
        pair. Indeed, since the JMXConnectorServer is now protected with SSL,
@@ -1946,18 +1946,18 @@ java
        server too as the SSL configuration of the server requires mutual
        authentication.
     </p>
-    <p>The next section will discuss how to connect to the 
+    <p>The next section will discuss how to connect to the
     secure agent.
     </p>
    </ul>
-   
+
   <h2><a name="h2-Connecting">Connecting to the Secure JMX Application</a></h2>
     <ul>
     <p>We will now see how to connect to the secure agent,
        using jconsole, and using a programmatic client.
     </p>
     </ul>
-    
+
     <h3>Using jconsole to connect to the secure agent</h3>
     <ul>
     <p>The only special thing you need to do in order to
@@ -1968,8 +1968,8 @@ java
         In our example, we use the same keystore/truststore
         pair on the client and server side - but this is
         not what a real application would do.
-        Indeed a real application would have different 
-        certificates for the client and the server, and 
+        Indeed a real application would have different
+        certificates for the client and the server, and
         thus use different keystores (and probably truststores).
         More information on SSL authentication can be obtained from the <a
         href="http://java.sun.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#HowSSLWorks"
@@ -1977,20 +1977,20 @@ java
         >Java<sup>TM</sup> Secure Socket Extension (JSSE) Reference Guide</a>.
     </p>
     <p>To start jconsole with our provided keystore and
-    truststore, go to the scandir example root directory and 
+    truststore, go to the scandir example root directory and
     type in the following command:
-    <p><code>jconsole 
-    &nbsp;-J-Djava.util.logging.config.file=logging.properties 
-    &nbsp;-J-Djavax.net.ssl.keyStore=keystore 
-    &nbsp;-J-Djavax.net.ssl.keyStorePassword=password 
-    &nbsp;-J-Djavax.net.ssl.trustStore=truststore 
+    <p><code>jconsole
+    &nbsp;-J-Djava.util.logging.config.file=logging.properties
+    &nbsp;-J-Djavax.net.ssl.keyStore=keystore
+    &nbsp;-J-Djavax.net.ssl.keyStorePassword=password
+    &nbsp;-J-Djavax.net.ssl.trustStore=truststore
     &nbsp;-J-Djavax.net.ssl.trustStorePassword=trustword</code></p>
     </p>
     <p>The <code>-J-Djava.util.logging.config.file=logging.properties</code>
        flag is not mandatory, but passing a <code>logging.properties</code>
        may help you debug connection problems if anything goes wrong.
     </p>
-    <p>In jconsole connection window, choose to connect to a 
+    <p>In jconsole connection window, choose to connect to a
        remote process, using the address <i>localhost:4545</i>
        and the guest login:
     </p>
@@ -2006,9 +2006,9 @@ java
     <p><u>Note:</u> if jconsole fails to connect and show
     you <a href="docfiles/remote-connection-failed.jpg">this screen</a>
     you have probably misspelled some of the properties on jconsole
-    command line, or you didn't start jconsole from the 
+    command line, or you didn't start jconsole from the
     scandir example root directory where our <code>truststore</code>
-    and <code>keystore</code> files are located. This article - <a 
+    and <code>keystore</code> files are located. This article - <a
     href="http://blogs.sun.com/roller/page/jmxetc?entry=troubleshooting_connection_problems_in_jconsole"
     title="Troubleshooting connection problems in JConsole"
     >Troubleshooting connection problems in JConsole</a> - may help
@@ -2016,28 +2016,28 @@ java
     </p>
     <hr>
     </ul>
-    
+
     <h3>Writing a programmatic client to connect to the secure agent</h3>
     <ul>
         <p>
-        In this section we will show the steps involved in writing 
+        In this section we will show the steps involved in writing
         a programmatic client that will connect to our secure agent.
         </p>
-   <p>The <a 
-href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirClient.html" 
+   <p>The <a
+href="dist/javadoc/com/sun/jmx/examples/scandir/ScanDirClient.html"
 title="The ScanDirClient class is a very short example of secure programmatic client"
      >ScanDirClient</a> is an example class that shows how a
     programmatic client can connect to a secured <i>scandir</i> application.
     This class contains a <code>main</code> method which creates and
     configures a <code>JMXConnector</code> client to connect with
-    the secured <i>scandir</i> agent. 
+    the secured <i>scandir</i> agent.
     </p>
     <p>The secure client differs only from a non secure client in
     so far as it needs to use SSL RMI Factories and credentials to
     connect to the secure agent. The steps required mainly involve:
        <ul>
            <li>Creating an empty environment map:
-           <pre>            
+           <pre>
             // Create an environment map to hold connection properties
             // like credentials etc... We will later pass this map
             // to the JMX Connector.
@@ -2048,7 +2048,7 @@ title="The ScanDirClient class is a very short example of secure programmatic cl
            </li>
            <li>Putting the client's credentials in that map:
            <i>(here the client will log in as <b>guest</b>)</i>
-           <pre>            
+           <pre>
             // Provide the credentials required by the server
             // to successfully perform user authentication
             //
@@ -2058,7 +2058,7 @@ title="The ScanDirClient class is a very short example of secure programmatic cl
            </li>
            <li>Providing an <code>SslRMIClientSocketFactory</code> to interact
            with the secure RMI Registry:
-           <pre>            
+           <pre>
             // Provide the SSL/TLS-based RMI Client Socket Factory required
             // by the JNDI/RMI Registry Service Provider to communicate with
             // the SSL/TLS-protected RMI Registry
@@ -2078,20 +2078,20 @@ title="The ScanDirClient class is a very short example of secure programmatic cl
             System.out.println("\nCreate the RMI connector client and " +
                     "connect it to the RMI connector server");
             final JMXServiceURL url = new JMXServiceURL(
-                    "service:jmx:rmi:///jndi/rmi://"+args[0]+":"+args[1]+ 
+                    "service:jmx:rmi:///jndi/rmi://"+args[0]+":"+args[1]+
                     "/jmxrmi");
             final JMXConnector jmxc = JMXConnectorFactory.connect(url, env);
            </pre>
            </li>
        </ul>
        <p>For this to work, we also need to start the <code>ScanDirClient</code>
-       with the appropriate system properties that will point to our 
-       <code>keystore</code> and <code>truststore</code>. To start the secure 
+       with the appropriate system properties that will point to our
+       <code>keystore</code> and <code>truststore</code>. To start the secure
        client, go to the <i>scandir</i> example root directory and type
        the following command:
        <p><code>ant jar<br>
-java 
-    &nbsp;-Djava.util.logging.config.file=logging.properties 
+java
+    &nbsp;-Djava.util.logging.config.file=logging.properties
     &nbsp;-Djavax.net.ssl.keyStore=keystore
     &nbsp;-Djavax.net.ssl.keyStorePassword=password
     &nbsp;-Djavax.net.ssl.trustStore=truststore
@@ -2140,7 +2140,7 @@ Configuration:
 
 Invoke 'close' on ScanManagerMXBean
 
-Got expected security exception: java.lang.SecurityException: Access denied! 
+Got expected security exception: java.lang.SecurityException: Access denied!
 Invalid access level for requested MBeanServer operation.
 
 Close the connection to the server
@@ -2148,31 +2148,31 @@ Close the connection to the server
 Bye! Bye!
 </pre>
 </td></tr></table></center>
-    <p>If the <code>ScanDirClient</code> fails to connect with 
-       the secure agent, then this article - <a 
+    <p>If the <code>ScanDirClient</code> fails to connect with
+       the secure agent, then this article - <a
     href="http://blogs.sun.com/roller/page/jmxetc?entry=troubleshooting_connection_problems_in_jconsole"
     title="Troubleshooting connection problems in JConsole"
     >Troubleshooting connection problems in JConsole</a> - may help
     you figure out what is going wrong. Indeed the connection steps
     performed by the <code>ScanDirClient</code> are very similar to
     those performed by <code>jconsole</code>, and the problems you
-    could encounter are identical. Just remember that 
+    could encounter are identical. Just remember that
    <code>jconsole</code> needs the extra <code>-J</code> flag to pass
    system properties to the VM, which is not needed with regular
    <code>java</code> launcher invocations.
     </p>
     </ul>
-    
+
     <h2><a name="h2-Conclusion">Conclusion</a></h2>
     <ul>
     <p>
-        In this document, we have presented an advanced 
-        JMX example, and shown how to run a secure 
-        JMX agent in a production environment. 
-        We have also shown how to connect to such a 
-        secure agent with both jconsole and a programmatic 
-        client. We have also discuss various JMX 
-        design-patterns and best practices. 
+        In this document, we have presented an advanced
+        JMX example, and shown how to run a secure
+        JMX agent in a production environment.
+        We have also shown how to connect to such a
+        secure agent with both jconsole and a programmatic
+        client. We have also discuss various JMX
+        design-patterns and best practices.
         Readers who would wish to learn more about JMX, and
         Monitoring and Management of the JVM, are invited
         to follow the links given in reference below.
@@ -2184,26 +2184,26 @@ Bye! Bye!
         >JMX Best Practices</a>: This document describes best practices that
       have been identified for modeling using the JMX API. </li>
      <li><a href="http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html"
-      >Monitoring and Management Using JMX</a>: How to enable, configure, and 
-      connect to the JVM JMX agent.</li> 
-     <li><a name="JConsole"><a 
+      >Monitoring and Management Using JMX</a>: How to enable, configure, and
+      connect to the JVM JMX agent.</li>
+     <li><a name="JConsole"><a
 href="http://java.sun.com/javase/6/docs/technotes/guides/management/jconsole.html"
 >Using JConsole</a>: JConsole is a JMX-Compliant monitoring tool which allows
      you to interact graphically with your own MBeans.
      </li>
      <li><a href="http://java.sun.com/javase/6/docs/technotes/guides/management/"
-     >Monitoring and Management for the Java Platform</a>: The Java Platform 
-      Standard Edition (Java SE) 6 provides comprehensive monitoring and 
+     >Monitoring and Management for the Java Platform</a>: The Java Platform
+      Standard Edition (Java SE) 6 provides comprehensive monitoring and
       management support for the Java platform. </li>
      <li><a href="http://java.sun.com/products/JavaManagement/community/jmx_blogs.html"
-         >List of JMX-related Blogs</a>: This page provides links to the 
-          different web logs written by members of the Sun team working on the 
+         >List of JMX-related Blogs</a>: This page provides links to the
+          different web logs written by members of the Sun team working on the
           JMX API.</li>
      <li><a
         href="http://java.sun.com/javase/6/docs/technotes/guides/security/jsse/JSSERefGuide.html#HowSSLWorks"
         title="The JSSE Reference Guide"
         >Java<sup>TM</sup> Secure Socket Extension (JSSE) Reference Guide</a>:
-        comprehensive documentation about the Java<sup>TM</sup> Secure Socket 
+        comprehensive documentation about the Java<sup>TM</sup> Secure Socket
         Extension (JSSE)
      </li>
      <li><a href="http://java.sun.com/javase/6/docs/"
diff --git a/jdk/src/sample/share/jmx/jmx-scandir/src/etc/access.properties b/jdk/src/sample/share/jmx/jmx-scandir/src/etc/access.properties
index c8286ed1fee..4f120b37ed8 100644
--- a/jdk/src/sample/share/jmx/jmx-scandir/src/etc/access.properties
+++ b/jdk/src/sample/share/jmx/jmx-scandir/src/etc/access.properties
@@ -8,9 +8,9 @@
 # passwords.  To be functional, a role must have an entry in
 # both the password and the access files.
 #
-# Default location of this file is $JRE/lib/management/jmxremote.access
-# You can specify an alternate location by specifying a property in 
-# the management config file $JRE/lib/management/management.properties
+# Default location of this file is $JRE/conf/management/jmxremote.access
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/conf/management/management.properties
 # (See that file for details)
 #
 # The file format for password and access files is syntactically the same
@@ -30,9 +30,9 @@
 #                   that changes the environment of the running program.
 #       "readwrite" grants access to read and write attributes of MBeans,
 #                   to invoke operations on them, and to create or remove them.
-#		    This access should be granted to only trusted clients, 
+#		    This access should be granted to only trusted clients,
 #                   since they can potentially interfere with the smooth
-#		    operation of a running program 
+#		    operation of a running program
 #
 # A given role should have at most one entry in this file.  If a role
 # has no entry, it has no access.
@@ -41,7 +41,7 @@
 #
 #
 # Default access control entries:
-# o The "monitorRole" role has readonly access.  
+# o The "monitorRole" role has readonly access.
 # o The "controlRole" role has readwrite access.
 #
 # monitorRole   readonly
diff --git a/jdk/src/sample/share/jmx/jmx-scandir/src/etc/management.properties b/jdk/src/sample/share/jmx/jmx-scandir/src/etc/management.properties
index 50351395350..bad0407e323 100644
--- a/jdk/src/sample/share/jmx/jmx-scandir/src/etc/management.properties
+++ b/jdk/src/sample/share/jmx/jmx-scandir/src/etc/management.properties
@@ -5,24 +5,24 @@
 # The Management Configuration file (in java.util.Properties format)
 # will be read if one of the following system properties is set:
 #    -Dcom.sun.management.jmxremote.port=<port-number>
-# or -Dcom.sun.management.snmp.port=<port-number> 
+# or -Dcom.sun.management.snmp.port=<port-number>
 # or -Dcom.sun.management.config.file=<this-file>
 #
 # The default Management Configuration file is:
 #
-#       $JRE/lib/management/management.properties
+#       $JRE/conf/management/management.properties
 #
 # Another location for the Management Configuration File can be specified
 # by the following property on the Java command line:
 #
 #    -Dcom.sun.management.config.file=<this-file>
-# 
+#
 # If -Dcom.sun.management.config.file=<this-file> is set, the port
-# number for the management agent can be specified in the config file 
+# number for the management agent can be specified in the config file
 # using the following lines:
-# 
+#
 # ################ Management Agent Port #########################
-# 
+#
 # For setting the JMX RMI agent port use the following line
 com.sun.management.jmxremote.port=4545
 #
@@ -45,7 +45,7 @@ com.sun.management.jmxremote.port=4545
 #      Refer to the specification for the java.lang.management.ThreadMBean
 #      interface - see isThreadContentionMonitoringSupported() method.
 #
- 
+
 # To enable thread contention monitoring, uncomment the following line
 # com.sun.management.enableThreadContentionMonitoring
 
@@ -53,9 +53,9 @@ com.sun.management.jmxremote.port=4545
 #			SNMP Management Properties
 #####################################################################
 #
-# If the system property -Dcom.sun.management.snmp.port=<port-number> 
+# If the system property -Dcom.sun.management.snmp.port=<port-number>
 # is set then
-#	- The SNMP agent (with the Java virtual machine MIB) is started 
+#	- The SNMP agent (with the Java virtual machine MIB) is started
 #	  that listens on the specified port for incoming SNMP requests.
 #	- the following properties for read for SNMP management.
 #
@@ -89,7 +89,7 @@ com.sun.management.jmxremote.port=4545
 #
 #      The format of the value for that property is any string accepted
 #      by java.net.InetAddress.getByName(String).
-# 
+#
 
 # For restricting the port on which SNMP agent listens use the following line
 # com.sun.management.snmp.interface=<InetAddress>
@@ -110,15 +110,15 @@ com.sun.management.jmxremote.port=4545
 # com.sun.management.snmp.acl.file=filepath
 #      Specifies location for ACL file
 #      This is optional - default location is
-#      $JRE/lib/management/snmp.acl
-# 
+#      $JRE/conf/management/snmp.acl
+#
 #      If the property "com.sun.management.snmp.acl" is set to false,
 #      then this property and the ACL file are ignored.
 #      Otherwise the ACL file must exist and be in the valid format.
 #      If the ACL file is empty or non existent then no access is allowed.
-# 
-#      The SNMP agent will read the ACL file at startup time. 
-#      Modification to the ACL file has no effect to any running SNMP 
+#
+#      The SNMP agent will read the ACL file at startup time.
+#      Modification to the ACL file has no effect to any running SNMP
 #      agents which read that ACL file at startup.
 #
 
@@ -131,7 +131,7 @@ com.sun.management.jmxremote.port=4545
 #
 # If system property -Dcom.sun.management.jmxremote.port=<port-number>
 # is set then
-#     - A MBean server is started 
+#     - A MBean server is started
 #     - JRE Platform MBeans are registered in the MBean server
 #     - RMI connector is published  in a private readonly registry at
 #       specified port using a well known name, "jmxrmi"
@@ -140,7 +140,7 @@ com.sun.management.jmxremote.port=4545
 # The configuration can be specified only at startup time.
 # Later changes to above system property (e.g. via setProperty method),
 # this config file, the password file, or the access file have no effect to the
-# running MBean server, the connector, or the registry. 
+# running MBean server, the connector, or the registry.
 #
 
 #
@@ -149,7 +149,7 @@ com.sun.management.jmxremote.port=4545
 # com.sun.management.jmxremote.ssl=true|false
 #      Default for this property is true. (Case for true/false ignored)
 #      If this property is specified as false then SSL is not used.
-# 
+#
 
 # For RMI monitoring without SSL use the following line
 # com.sun.management.jmxremote.ssl=false
@@ -218,20 +218,20 @@ com.sun.management.jmxremote.registry.ssl=true
 # ################ RMI Login configuration ###################
 #
 # com.sun.management.jmxremote.login.config=<config-name>
-#      Specifies the name of a JAAS login configuration entry to use when 
-#      authenticating users of RMI monitoring. 
+#      Specifies the name of a JAAS login configuration entry to use when
+#      authenticating users of RMI monitoring.
 #
 #      Setting this property is optional - the default login configuration
 #      specifies a file-based authentication that uses the password file.
 #
-#      When using this property to override the default login configuration 
-#      then the named configuration entry must be in a file that gets loaded 
+#      When using this property to override the default login configuration
+#      then the named configuration entry must be in a file that gets loaded
 #      by JAAS. In addition, the login module(s) specified in the configuration
-#      should use the name and/or password callbacks to acquire the user's 
-#      credentials. See the NameCallback and PasswordCallback classes in the 
+#      should use the name and/or password callbacks to acquire the user's
+#      credentials. See the NameCallback and PasswordCallback classes in the
 #      javax.security.auth.callback package for more details.
 #
-#      If the property "com.sun.management.jmxremote.authenticate" is set to 
+#      If the property "com.sun.management.jmxremote.authenticate" is set to
 #      false, then this property and the password & access files are ignored.
 #
 
@@ -244,9 +244,9 @@ com.sun.management.jmxremote.registry.ssl=true
 # com.sun.management.jmxremote.password.file=filepath
 #      Specifies location for password file
 #      This is optional - default location is
-#      $JRE/lib/management/jmxremote.password
-# 
-#      If the property "com.sun.management.jmxremote.authenticate" is set to 
+#      $JRE/conf/management/jmxremote.password
+#
+#      If the property "com.sun.management.jmxremote.authenticate" is set to
 #      false, then this property and the password & access files are ignored.
 #      Otherwise the password file must exist and be in the valid format.
 #      If the password file is empty or non-existent then no access is allowed.
@@ -261,9 +261,9 @@ com.sun.management.jmxremote.password.file=src/etc/password.properties
 # com.sun.management.jmxremote.access.file=filepath
 #      Specifies location for access  file
 #      This is optional - default location is
-#      $JRE/lib/management/jmxremote.access
-# 
-#      If the property "com.sun.management.jmxremote.authenticate" is set to 
+#      $JRE/conf/management/jmxremote.access
+#
+#      If the property "com.sun.management.jmxremote.authenticate" is set to
 #      false, then this property and the password & access files are ignored.
 #      Otherwise, the access file must exist and be in the valid format.
 #      If the access file is empty or non-existent then no access is allowed.
diff --git a/jdk/src/sample/share/jmx/jmx-scandir/src/etc/password.properties b/jdk/src/sample/share/jmx/jmx-scandir/src/etc/password.properties
index d90c8c8f2e1..28e662242bc 100644
--- a/jdk/src/sample/share/jmx/jmx-scandir/src/etc/password.properties
+++ b/jdk/src/sample/share/jmx/jmx-scandir/src/etc/password.properties
@@ -8,9 +8,9 @@
 # access for each role.  To be functional, a role must have an entry
 # in both the password and the access files.
 #
-# Default location of this file is $JRE/lib/management/jmxremote.password
-# You can specify an alternate location by specifying a property in 
-# the management config file $JRE/lib/management/management.properties
+# Default location of this file is $JRE/conf/management/jmxremote.password
+# You can specify an alternate location by specifying a property in
+# the management config file $JRE/conf/management/management.properties
 # or by specifying a system property (See that file for details).
 
 
@@ -19,7 +19,7 @@
 ##############################################################
 #      Since there are cleartext passwords stored in this file,
 #      this file must be readable by ONLY the owner,
-#      otherwise the program will exit with an error. 
+#      otherwise the program will exit with an error.
 #
 # The file format for password and access files is syntactically the same
 # as the Properties file format.  The syntax is described in the Javadoc
diff --git a/jdk/test/ProblemList.txt b/jdk/test/ProblemList.txt
index 449db57f61f..a415b17d077 100644
--- a/jdk/test/ProblemList.txt
+++ b/jdk/test/ProblemList.txt
@@ -138,6 +138,9 @@ com/sun/management/GarbageCollectorMXBean/GarbageCollectionNotificationTest.java
 # 8058492
 java/lang/management/ThreadMXBean/FindDeadlocks.java                                      generic-all
 
+# 8058506
+java/lang/management/ThreadMXBean/ThreadMXBeanStateTest.java                              generic-all
+
 ############################################################################
 
 # jdk_jmx
@@ -209,6 +212,9 @@ java/rmi/transport/checkLeaseInfoLeak/CheckLeaseLeak.java       generic-all
 # 7195095
 sun/rmi/transport/proxy/EagerHttpFallback.java                  generic-all
 
+# 8062724
+java/rmi/activation/Activatable/extLoadedImpl/ext.sh            generic-all
+
 ############################################################################
 
 # jdk_security
@@ -220,6 +226,9 @@ sun/security/pkcs11/ec/TestKeyFactory.java                      generic-all
 # 8051952: Unreachable.java test failing on Windows
 sun/security/krb5/auto/Unreachable.java                         windows-all,macosx-all
 
+# 8058849
+sun/security/krb5/config/dns.sh                                 generic-all
+
 # 6988842: 4 tests failing on Solaris 5.10
 sun/security/pkcs11/Secmod/AddPrivateKey.java                   solaris-all
 sun/security/pkcs11/ec/ReadCertificates.java                    solaris-all
@@ -233,6 +242,9 @@ sun/security/tools/keytool/standard.sh                          solaris-all
 # 8049312
 com/sun/crypto/provider/Cipher/AES/CICO.java			generic-all
 
+# 8062758
+java/security/Security/ClassLoaderDeadlock/Deadlock2.sh         generic-all
+
 ############################################################################
 
 # jdk_sound
@@ -254,7 +266,8 @@ com/sun/crypto/provider/Cipher/AES/CICO.java			generic-all
 # jdk_tools
 
 # Tests take too long, on sparcs see 7143279
-tools/pack200/CommandLineTests.java                             solaris-all,macosx-all
+# also see 8059906
+tools/pack200/CommandLineTests.java
 tools/pack200/Pack200Test.java                                  solaris-all,macosx-all
 
 # 8007410
@@ -282,9 +295,6 @@ com/sun/jdi/JdbReadTwiceTest.sh                                 generic-all
 # 8058616
 com/sun/jdi/RedefinePop.sh                                      generic-all
 
-# 8061114
-com/sun/jdi/Redefine-g.sh                                       generic-all
-
 ############################################################################
 
 # jdk_util
@@ -292,6 +302,25 @@ com/sun/jdi/Redefine-g.sh                                       generic-all
 # 8051641
 sun/util/calendar/zi/TestZoneInfo310.java                        generic-all
 
+# 8062588
+java/util/Locale/LocaleProviders.sh                              generic-all
+java/util/PluggableLocale/BreakIteratorProviderTest.sh           generic-all
+java/util/PluggableLocale/CalendarDataProviderTest.sh            generic-all
+java/util/PluggableLocale/CalendarNameProviderTest.sh            generic-all
+java/util/PluggableLocale/CollatorProviderTest.sh                generic-all
+java/util/PluggableLocale/CurrencyNameProviderTest.sh            generic-all
+java/util/PluggableLocale/DateFormatProviderTest.sh              generic-all
+java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh       generic-all
+java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh    generic-all
+java/util/PluggableLocale/GenericTest.sh                         generic-all
+java/util/PluggableLocale/LocaleNameProviderTest.sh              generic-all
+java/util/PluggableLocale/NumberFormatProviderTest.sh            generic-all
+java/util/PluggableLocale/TimeZoneNameProviderTest.sh            generic-all
+java/util/ResourceBundle/Bug6299235Test.sh                       generic-all
+
+# 8062512
+java/util/spi/ResourceBundleControlProvider/UserDefaultControlTest.java generic-all
+
 ############################################################################
 
 # jdk_instrument
@@ -318,7 +347,7 @@ sun/tools/jps/TestJpsJarRelative.java				generic-all
 # 8057732
 sun/jvmstat/monitor/MonitoredVm/MonitorVmStartTerminate.java    generic-all
 
-# 8060736
-sun/jvmstat/monitor/MonitoredVm/CR6672135.java                  generic-all
+# 8060088
+com/sun/tracing/BasicWithSecurityMgr.java                       generic-all
 
 ############################################################################
diff --git a/jdk/test/TEST.groups b/jdk/test/TEST.groups
index 6cee6e39d0d..88c23dbf13f 100644
--- a/jdk/test/TEST.groups
+++ b/jdk/test/TEST.groups
@@ -182,6 +182,8 @@ jdk_launcher = \
 #
 core_tools = \
     tools \
+    jdk/internal/jimage \
+    jdk/internal/jrtfs \
     sun/tools/java \
     sun/tools/native2ascii \
     sun/tools/jrunscript
diff --git a/jdk/test/java/lang/ClassLoader/EndorsedDirs.java b/jdk/test/java/lang/ClassLoader/EndorsedDirs.java
new file mode 100644
index 00000000000..c78967a42b4
--- /dev/null
+++ b/jdk/test/java/lang/ClassLoader/EndorsedDirs.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2014, 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 8060206
+ * @summary Endorsed standards and override mechanism is removed
+ */
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+public class EndorsedDirs {
+    public static void main(String arg[]) throws Exception {
+        String value = System.getProperty("java.endorsed.dirs");
+        if (value != null) {
+            throw new RuntimeException("java.endorsed.dirs not removed: " + value);
+        }
+
+        fatalError("-Djava.endorsed.dirs=foo");
+    }
+
+    static void fatalError(String... args) throws Exception {
+        List<String> commands = new ArrayList<>();
+        String java = System.getProperty("java.home") + "/bin/java";
+        commands.add(java);
+        for (String s : args) {
+            commands.add(s);
+        }
+        String cpath = System.getProperty("test.classes", ".");
+        commands.add("-cp");
+        commands.add(cpath);
+        commands.add("EndorsedDirs");
+
+        ProcessBuilder processBuilder = new ProcessBuilder(commands);
+        final Process process = processBuilder.start();
+        BufferedReader errorStream = new BufferedReader(
+                new InputStreamReader(process.getErrorStream()));
+        BufferedReader outStream = new BufferedReader(
+                new InputStreamReader(process.getInputStream()));
+        String errorLine;
+        StringBuilder errors = new StringBuilder();
+        String outLines;
+        while ((errorLine = errorStream.readLine()) != null) {
+            errors.append(errorLine).append("\n");
+        }
+        while ((outLines = outStream.readLine()) != null) {
+            System.out.println(outLines);
+        }
+        errorLine = errors.toString();
+        System.err.println(errorLine);
+        process.waitFor(1000, TimeUnit.MILLISECONDS);
+        int exitStatus = process.exitValue();
+        if (exitStatus == 0) {
+            throw new RuntimeException("Expect fatal error");
+        }
+        if (!errorLine.contains("Could not create the Java Virtual Machine")) {
+            throw new RuntimeException(errorLine);
+        }
+    }
+}
diff --git a/jdk/test/java/lang/ClassLoader/ExtDirs.java b/jdk/test/java/lang/ClassLoader/ExtDirs.java
new file mode 100644
index 00000000000..17bf55a9a40
--- /dev/null
+++ b/jdk/test/java/lang/ClassLoader/ExtDirs.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2014, 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 8060206
+ * @summary Extension mechanism is removed
+ */
+
+import java.io.*;
+import java.util.*;
+import java.util.concurrent.TimeUnit;
+
+public class ExtDirs {
+    public static void main(String arg[]) throws Exception {
+        String value = System.getProperty("java.ext.dirs");
+        if (value != null) {
+            throw new RuntimeException("java.ext.dirs not removed: " + value);
+        }
+
+        fatalError("-Djava.ext.dirs=foo");
+    }
+
+    static void fatalError(String... args) throws Exception {
+        List<String> commands = new ArrayList<>();
+        String java = System.getProperty("java.home") + "/bin/java";
+        commands.add(java);
+        for (String s : args) {
+            commands.add(s);
+        }
+        String cpath = System.getProperty("test.classes", ".");
+        commands.add("-cp");
+        commands.add(cpath);
+        commands.add("ExtDirs");
+
+        ProcessBuilder processBuilder = new ProcessBuilder(commands);
+        final Process process = processBuilder.start();
+        BufferedReader errorStream = new BufferedReader(
+                new InputStreamReader(process.getErrorStream()));
+        BufferedReader outStream = new BufferedReader(
+                new InputStreamReader(process.getInputStream()));
+        String errorLine;
+        StringBuilder errors = new StringBuilder();
+        String outLines;
+        while ((errorLine = errorStream.readLine()) != null) {
+            errors.append(errorLine).append("\n");
+        }
+        while ((outLines = outStream.readLine()) != null) {
+            System.out.println(outLines);
+        }
+        errorLine = errors.toString();
+        System.err.println(errorLine);
+        process.waitFor(1000, TimeUnit.MILLISECONDS);
+        int exitStatus = process.exitValue();
+        if (exitStatus == 0) {
+            throw new RuntimeException("Expect fatal error");
+        }
+        if (!errorLine.contains("Could not create the Java Virtual Machine")) {
+            throw new RuntimeException(errorLine);
+        }
+    }
+}
diff --git a/jdk/test/java/lang/ClassLoader/getdotresource.sh b/jdk/test/java/lang/ClassLoader/getdotresource.sh
index 59648ce352c..b74c6100976 100644
--- a/jdk/test/java/lang/ClassLoader/getdotresource.sh
+++ b/jdk/test/java/lang/ClassLoader/getdotresource.sh
@@ -23,8 +23,6 @@
 # questions.
 #
 
-#
-
 if [ x"$TESTJAVA" = x ]; then 
         TESTJAVA=$1 
         shift 
@@ -32,6 +30,19 @@ fi
 if [ x"$TESTCLASSES" = x ]; then TESTCLASSES=.; fi
 if [ x"$TESTSRC" = x ]; then TESTSRC=.; fi
 
-# now start the test
-${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.ext.dirs=$TESTSRC -cp $TESTCLASSES GetDotResource
+OS=`uname -s`
+case "$OS" in
+  Windows* | CYGWIN* )
+    PS=";"
+    FS="\\"
+    ;;
+  * )
+    PS=":"
+    FS="/"
+    ;;
+esac
+
+# now start the test
+${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTSRC}${FS}resource.jar${PS}${TESTCLASSES} GetDotResource
+
 
diff --git a/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java b/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java
index 118a60f03e9..618522ff8e7 100644
--- a/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java
+++ b/jdk/test/java/lang/SecurityManager/CheckPackageAccess.java
@@ -78,12 +78,14 @@ public class CheckPackageAccess {
         "com.sun.org.apache.xml.internal.serializer.utils.",
         "com.sun.org.apache.xml.internal.utils.",
         "com.sun.org.glassfish.",
+        "com.sun.tools.script.",
         "com.oracle.xmlns.internal.",
         "com.oracle.webservices.internal.",
         "org.jcp.xml.dsig.internal.",
         "jdk.internal.",
         "jdk.nashorn.internal.",
         "jdk.nashorn.tools.",
+        "jdk.tools.jimage.",
         "com.sun.activation.registries."
     };
 
diff --git a/jdk/test/java/lang/invoke/lambda/LUtils.java b/jdk/test/java/lang/invoke/lambda/LUtils.java
index 24c4feaf235..cc052e43e90 100644
--- a/jdk/test/java/lang/invoke/lambda/LUtils.java
+++ b/jdk/test/java/lang/invoke/lambda/LUtils.java
@@ -43,12 +43,10 @@ class LUtils {
     static final String JAVAHOME = System.getProperty("java.home");
     static final boolean isWindows =
             System.getProperty("os.name", "unknown").startsWith("Windows");
-    //static final boolean isSDK = JAVAHOME.endsWith("jre");
     static final File JAVA_BIN_FILE = new File(JAVAHOME, "bin");
     static final File JAVA_CMD = new File(JAVA_BIN_FILE,
             isWindows ? "java.exe" : "java");
-    static final File JAR_BIN_FILE =
-            new File(new File(JAVAHOME).getParentFile(), "bin");
+    static final File JAR_BIN_FILE = new File(JAVAHOME, "bin");
     static final File JAR_CMD = new File(JAR_BIN_FILE,
             isWindows ? "jar.exe" : "jar");
 
diff --git a/jdk/test/java/net/NetworkInterface/IPv4Only.java b/jdk/test/java/net/NetworkInterface/IPv4Only.java
index 4d0bc3d404c..f5f8e274f00 100644
--- a/jdk/test/java/net/NetworkInterface/IPv4Only.java
+++ b/jdk/test/java/net/NetworkInterface/IPv4Only.java
@@ -23,7 +23,7 @@
 
 /* @test
  * @bug   6964714
- * @run main/othervm IPv4Only
+ * @run main/othervm -Djava.net.preferIPv4Stack=true IPv4Only
  * @summary Test the networkinterface listing with java.net.preferIPv4Stack=true.
  */
 
@@ -34,8 +34,6 @@ import java.util.*;
 
 public class IPv4Only {
     public static void main(String[] args) throws Exception {
-        System.setProperty("java.net.preferIPv4Stack","true");
-
         Enumeration<NetworkInterface> nifs = NetworkInterface.getNetworkInterfaces();
         while (nifs.hasMoreElements()) {
             NetworkInterface nif = nifs.nextElement();
diff --git a/jdk/test/java/nio/charset/spi/basic.sh b/jdk/test/java/nio/charset/spi/basic.sh
index 6bc60d140e7..a53b51ea7e0 100644
--- a/jdk/test/java/nio/charset/spi/basic.sh
+++ b/jdk/test/java/nio/charset/spi/basic.sh
@@ -57,23 +57,23 @@ case `uname` in
 esac
 
 JARD=$DIR/x.jar
-EXTD=$DIR/x.ext
+APPD=$DIR/x.ext
 TESTD=$DIR/x.test
 
 CSS='US-ASCII 8859_1 iso-ir-6 UTF-16 windows-1252 !BAR cp1252'
 
 
-if [ \! -d $EXTD ]; then
+if [ \! -d $APPD ]; then
     # Initialize
     echo Initializing...
-    rm -rf $JARD $EXTD $TESTD
+    rm -rf $JARD $APPD $TESTD
     mkdir -p $JARD/META-INF/services x.ext
     echo FooProvider \
       >$JARD/META-INF/services/java.nio.charset.spi.CharsetProvider
     cp $TESTCLASSES/FooProvider.class $TESTCLASSES/FooCharset.class $JARD
     mkdir $TESTD
     cp $TESTCLASSES/Test.class $TESTD
-    (cd $JARD; $JAR ${TESTTOOLVMOPTS} -cf $EXTD/test.jar *)
+    (cd $JARD; $JAR ${TESTTOOLVMOPTS} -cf $APPD/test.jar *)
 fi
 
 if [ $# -gt 0 ]; then
@@ -96,15 +96,13 @@ TMP=${TMP:-$TEMP}; TMP=${TMP:-/tmp}
 cd $TMP
 
 failures=0
-for where in ext app; do
+for where in app; do
   for security in none minimal-policy cp-policy; do
     echo '';
     echo "LC_ALL=$LC_ALL where=$where security=$security"
     av=''
-    if [ $where = ext ]; then
-      av="$av -cp $TESTD -Djava.ext.dirs=$EXTD";
-    else
-      av="$av -cp $TESTD$CPS$EXTD/test.jar";
+    if [ $where = app ]; then
+      av="$av -cp $TESTD$CPS$APPD/test.jar";
     fi
     case $security in
       none)          css="$CSS FOO";;
diff --git a/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh b/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh
index 2951a28e549..81ebab160b4 100644
--- a/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh
+++ b/jdk/test/java/security/Security/ClassLoaderDeadlock/Deadlock2.sh
@@ -89,11 +89,7 @@ cd ${TESTCLASSES}
 if [ -d testlib ] ; then
     rm -rf testlib
 fi
-if [ -d ${TESTJAVA}${FILESEP}lib${FILESEP}ext ] ; then
-    cp -r ${TESTJAVA}${FILESEP}lib${FILESEP}ext testlib
-else
-    cp -r ${TESTJAVA}${FILESEP}jre${FILESEP}lib${FILESEP}ext testlib
-fi
+mkdir testlib
 
 # compile and package the test program
 ${COMPILEJAVA}${FILESEP}bin${FILESEP}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \
@@ -109,7 +105,8 @@ rm Deadlock2*.class
 
 # create serialized object and run the test
 ${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} CreateSerialized
-${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} -Djava.ext.dirs=${TESTCLASSES}${FILESEP}testlib Deadlock2
+${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} \
+    -Djava.ext.dirs=${TESTCLASSES}${FILESEP}testlib${PATHSEP}${TESTJAVA}${FILESEP}lib${FILESEP}ext Deadlock2
 STATUS=$?
 
 # clean up
diff --git a/jdk/test/java/util/Properties/LoadAndStoreXML.java b/jdk/test/java/util/Properties/LoadAndStoreXML.java
index 241a783053f..2fcf0060454 100644
--- a/jdk/test/java/util/Properties/LoadAndStoreXML.java
+++ b/jdk/test/java/util/Properties/LoadAndStoreXML.java
@@ -136,7 +136,7 @@ public class LoadAndStoreXML {
         props.put("k2", "bar");
         props.put("k3", "\u0020\u0391\u0392\u0393\u0394\u0395\u0396\u0397");
         props.put("k4", "\u7532\u9aa8\u6587");
-        props.put("k5", "<java.home>/lib/jaxp.properties");
+        props.put("k5", "<java.home>/conf/jaxp.properties");
 
         TestOutputStream out = new TestOutputStream();
         props.storeToXML(out, null, encoding);
diff --git a/jdk/test/java/util/ServiceLoader/basic.sh b/jdk/test/java/util/ServiceLoader/basic.sh
index 697b2b0b2d3..3976e0d3c8b 100644
--- a/jdk/test/java/util/ServiceLoader/basic.sh
+++ b/jdk/test/java/util/ServiceLoader/basic.sh
@@ -44,16 +44,20 @@ JAR="$COMPILEJAVA/bin/jar"
 OS=`uname -s`
 case "$OS" in
     SunOS | Darwin | AIX )
+      FS='/'
       SEP=':' ;;
     Linux )
+      FS='/'
       SEP=':' ;;
     * )
+      FS='\\'
       SEP='\;' ;;
 esac
 
 JARD=x.jar
 EXTD=x.ext
 TESTD=x.test
+P3JAR=${EXTD}${FS}p3.jar
 
 if [ \! -d $EXTD ]; then
     # Initialize
@@ -103,8 +107,7 @@ go() {
 # Java-level tests
 
 T=Basic
-go ".${SEP}$TESTD${SEP}p2.jar" "-Djava.ext.dirs=$EXTD"
-
+go ".${SEP}$TESTD${SEP}p2.jar" ""
 
 # Success cases
 
@@ -114,19 +117,15 @@ go "$TESTD" "" FooProvider1
 
 go ".${SEP}p2.jar" "" FooProvider2
 
-go "" "-Djava.ext.dirs=$EXTD" FooProvider3
+go "${P3JAR}${SEP}p2.jar" "" FooProvider3 FooProvider2
 
 go "$TESTD${SEP}p2.jar" "" FooProvider1 FooProvider2
 
-go "$TESTD" "-Djava.ext.dirs=$EXTD" FooProvider3 FooProvider1
+go "${P3JAR}${SEP}$TESTD" "" FooProvider3 FooProvider1
 
-go "$TESTD${SEP}p2.jar" "-Djava.ext.dirs=$EXTD" \
+go "${P3JAR}${SEP}$TESTD${SEP}p2.jar" "" \
   FooProvider3 FooProvider1 FooProvider2
 
-# Should only find the installed provider
-go "$TESTD${SEP}p2.jar" "-Djava.ext.dirs=$EXTD" -i FooProvider3
-
-
 # Failure cases
 
 mkdir -p x.meta/META-INF/services
@@ -141,8 +140,8 @@ done
 echo FooProvider42 >x.meta/META-INF/services/FooService
 go "$TESTD${SEP}x.meta" "" FooProvider1 fail
 go "x.meta${SEP}$TESTD" "" fail FooProvider1
-go "$TESTD${SEP}x.meta${SEP}${SEP}p2.jar" "-Djava.ext.dirs=$EXTD" \
-  FooProvider3 FooProvider1 fail FooProvider2
+go "$TESTD${SEP}x.meta${SEP}${SEP}p2.jar" "" \
+  FooProvider1 fail FooProvider2
 
 
 # Summary
diff --git a/jdk/test/java/util/prefs/PrefsSpi.sh b/jdk/test/java/util/prefs/PrefsSpi.sh
index 814c20978b9..54b67afdf0d 100644
--- a/jdk/test/java/util/prefs/PrefsSpi.sh
+++ b/jdk/test/java/util/prefs/PrefsSpi.sh
@@ -100,8 +100,5 @@ Sys "$java" ${TESTVMOPTS} "-cp" "$TESTCLASSES" \
 Sys "$java" ${TESTVMOPTS} "-cp" "$TESTCLASSES${CPS}extDir/PrefsSpi.jar" \
     -Djava.util.prefs.userRoot=. \
     PrefsSpi "StubPreferences"
-Sys "$java" ${TESTVMOPTS} "-cp" "$TESTCLASSES" "-Djava.ext.dirs=extDir" \
-    -Djava.util.prefs.userRoot=. \
-    PrefsSpi "StubPreferences"
 
 rm -rf jarDir extDir
diff --git a/jdk/test/javax/crypto/sanity/CheckManifestForRelease.java b/jdk/test/javax/crypto/sanity/CheckManifestForRelease.java
deleted file mode 100644
index 1d87575baa5..00000000000
--- a/jdk/test/javax/crypto/sanity/CheckManifestForRelease.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (c) 2012, 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 7197071
- * @summary Makefiles for various security providers aren't including
- *          the default manifest.
- */
-import java.net.*;
-import java.io.*;
-
-/**
- * When the Java specification version is incremented, all of the providers
- * must be recompiled with the proper implementation version to match.
- */
-public class CheckManifestForRelease {
-
-    /**
-     * @param args the command line arguments
-     */
-    public static void main(String[] args) throws Exception {
-        checkFileManifests();
-    }
-
-    /*
-     * Iterate over the files of interest: JCE framework and providers
-     */
-    static private void checkFileManifests() throws Exception {
-        System.out.println("=============");
-        String libDirName = System.getProperty("java.home", ".") + "/lib";
-        String extDirName = libDirName + "/ext";
-
-        System.out.println("Checking Manifest in directory: \n    " +
-            extDirName);
-
-        /*
-         * Current list of JCE providers, all of which currently live in
-         * the extensions directory.  Add if more are created.
-         */
-        String[] providers = new String[]{
-            "sunjce_provider.jar",
-            "sunec.jar",
-            "sunmscapi.jar",
-            "sunpkcs11.jar",
-            "ucrypto.jar"
-        };
-
-        checkManifest(libDirName, "jce.jar");
-        for (String provider : providers) {
-            checkManifest(extDirName, provider);
-        }
-        System.out.println("Passed.");
-    }
-
-    // Helper method to format the URL properly.
-    static private String formatURL(String dir, String file) {
-        return "jar:file:///" + dir + "/" + file + "!/";
-    }
-
-    static private String specVersion =
-        System.getProperty("java.specification.version");
-
-    /*
-     * Test the root cause, which is that there were no manifest values
-     * for many of the providers, and for those that had them, there was
-     * no test to make sure that the impl version was appropriate for
-     * the spec version.
-     */
-    static private void checkManifest(String dir, String file)
-            throws Exception {
-
-        System.out.println("Checking: " + file);
-
-        String url = formatURL(dir, file);
-        JarURLConnection urlc =
-            (JarURLConnection) (new URL(url).openConnection());
-
-        String implVersion;
-        try {
-            implVersion = urlc.getManifest().getMainAttributes().getValue(
-                "Implementation-Version");
-        } catch (FileNotFoundException e) {
-            /*
-             * If the file doesn't exist (e.g. mscapi on solaris),
-             * skip it. If there are other problems, fail out.
-             */
-            System.out.println("    " + file + " not found, skipping...");
-            return;
-        }
-
-        if (implVersion == null) {
-            throw new Exception(
-                "Implementation-Version not found in Manifest");
-        }
-
-        if (!implVersion.startsWith(specVersion)) {
-            throw new Exception(
-                "Implementation-Version does not match " +
-                "Specification-Version");
-        }
-    }
-}
diff --git a/jdk/test/jdk/internal/jimage/VerifyJimage.java b/jdk/test/jdk/internal/jimage/VerifyJimage.java
new file mode 100644
index 00000000000..aea1df404f2
--- /dev/null
+++ b/jdk/test/jdk/internal/jimage/VerifyJimage.java
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2014, 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.io.File;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Deque;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ConcurrentLinkedDeque;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import jdk.internal.jimage.BasicImageReader;
+import jdk.internal.jimage.ImageLocation;
+
+/*
+ * @test
+ * @summary Verify jimage
+ * @run main/othervm VerifyJimage
+ */
+
+/**
+ * This test runs in two modes:
+ * (1) No argument: it verifies the jimage by loading all classes in the runtime
+ * (2) path of exploded modules: it compares bytes of each file in the exploded
+ *     module with the entry in jimage
+ *
+ * FIXME: exception thrown when findLocation from jimage by multiple threads
+ * -Djdk.test.threads=<n> to specify the number of threads.
+ */
+public class VerifyJimage {
+    private static final Deque<String> failed = new ConcurrentLinkedDeque<>();
+
+    public static void main(String... args) throws Exception {
+        long start = System.nanoTime();
+        int numThreads = Integer.getInteger("jdk.test.threads", 1);
+        List<JImageReader> readers = newJImageReaders();
+        VerifyJimage verify = new VerifyJimage(readers, numThreads);
+        if (args.length == 0) {
+            // load classes from jimage
+            verify.loadClasses();
+        } else {
+            Path dir = Paths.get(args[0]);
+            if (Files.notExists(dir) || !Files.isDirectory(dir)) {
+                throw new RuntimeException("Invalid argument: " + dir);
+            }
+            verify.compareExplodedModules(dir);
+        }
+        verify.waitForCompletion();
+        long end = System.nanoTime();
+        int entries = readers.stream()
+                             .mapToInt(JImageReader::entries)
+                             .sum();
+        System.out.format("%d entries %d files verified: %d ms %d errors%n",
+                          entries, verify.count.get(),
+                          TimeUnit.NANOSECONDS.toMillis(end - start), failed.size());
+        for (String f : failed) {
+            System.err.println(f);
+        }
+    }
+
+    private final AtomicInteger count = new AtomicInteger(0);
+    private final List<JImageReader> readers;
+    private final ExecutorService pool;
+
+    VerifyJimage(List<JImageReader> readers, int numThreads) {
+        this.readers = readers;
+        this.pool = Executors.newFixedThreadPool(numThreads);
+    }
+
+    private void waitForCompletion() throws InterruptedException {
+        pool.shutdown();
+        pool.awaitTermination(20, TimeUnit.SECONDS);
+    }
+
+    private void compareExplodedModules(Path dir) throws IOException {
+        System.out.println("comparing jimage with " + dir);
+
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir)) {
+            for (Path mdir : stream) {
+                if (Files.isDirectory(mdir)) {
+                    pool.execute(new Runnable() {
+                        @Override
+                        public void run() {
+                            try {
+                                Files.find(mdir, Integer.MAX_VALUE, (Path p, BasicFileAttributes attr)
+                                           -> !Files.isDirectory(p) &&
+                                              !mdir.relativize(p).toString().startsWith("_") &&
+                                              !p.getFileName().toString().equals("MANIFEST.MF"))
+                                     .forEach(p -> compare(mdir, p, readers));
+                            } catch (IOException e) {
+                                throw new UncheckedIOException(e);
+                            }
+                        }
+                    });
+                }
+            }
+        }
+    }
+
+    private final List<String> BOOT_RESOURCES = Arrays.asList(
+        "java.base/META-INF/services/java.nio.file.spi.FileSystemProvider"
+    );
+    private final List<String> EXT_RESOURCES = Arrays.asList(
+        "jdk.zipfs/META-INF/services/java.nio.file.spi.FileSystemProvider"
+    );
+    private final List<String> APP_RESOURCES = Arrays.asList(
+        "jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector",
+        "jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector"
+    );
+
+    private void compare(Path mdir, Path p, List<JImageReader> readers) {
+        String entry = mdir.relativize(p).toString().replace(File.separatorChar, '/');
+
+        count.incrementAndGet();
+        String file = mdir.getFileName().toString() + "/" + entry;
+        if (APP_RESOURCES.contains(file)) {
+            // skip until the service config file is merged
+            System.out.println("Skipped " + file);
+            return;
+        }
+
+        String jimage;
+        if (BOOT_RESOURCES.contains(file)) {
+            jimage = "bootmodules.jimage";
+        } else if (EXT_RESOURCES.contains(file)) {
+            jimage = "extmodules.jimage";
+        } else {
+            jimage = "";
+        }
+        JImageReader reader = readers.stream()
+                .filter(r -> r.findLocation(entry) != null)
+                .filter(r -> jimage.isEmpty() || r.imageName().equals(jimage))
+                .findFirst().orElse(null);
+        if (reader == null) {
+            failed.add(entry + " not found: " + p.getFileName().toString());
+        } else {
+            reader.compare(entry, p);
+        }
+    }
+
+    private void loadClasses() {
+        ClassLoader loader = ClassLoader.getSystemClassLoader();
+        for (JImageReader reader : readers) {
+            Arrays.stream(reader.getEntryNames())
+                    .filter(n -> n.endsWith(".class"))
+                    .forEach(n -> {
+                        String cn = n.substring(0, n.length()-6).replace('/', '.');
+                        count.incrementAndGet();
+                        try {
+                            Class.forName(cn, false, loader);
+                        } catch (ClassNotFoundException e) {
+                            failed.add(reader.imageName() + ": " + cn + " not found");
+                        }
+                    });
+        }
+    }
+
+
+   private static List<JImageReader> newJImageReaders() throws IOException {
+        String home = System.getProperty("java.home");
+        Path mlib = Paths.get(home, "lib", "modules");
+        try (Stream<Path> paths = Files.list(mlib)) {
+            Set<Path> jimages = paths.filter(p -> p.toString().endsWith(".jimage"))
+                                     .collect(Collectors.toSet());
+            List<JImageReader> result = new ArrayList<>();
+            for (Path jimage: jimages) {
+                result.add(new JImageReader(jimage));
+                System.out.println("opened " + jimage);
+            }
+            return result;
+        }
+    }
+
+    static class JImageReader extends BasicImageReader {
+        final Path jimage;
+        JImageReader(Path p) throws IOException {
+            super(p.toString());
+            this.jimage = p;
+        }
+
+        String imageName() {
+            return jimage.getFileName().toString();
+        }
+
+        int entries() {
+            return getHeader().getLocationCount();
+        }
+
+        void compare(String entry, Path p) {
+            try {
+                byte[] bytes = Files.readAllBytes(p);
+                byte[] imagebytes = getResource(entry);
+                if (!Arrays.equals(bytes, imagebytes)) {
+                    failed.add(imageName() + ": bytes differs than " + p.toString());
+                }
+            } catch (IOException e) {
+                throw new UncheckedIOException(e);
+            }
+        }
+    }
+}
diff --git a/jdk/test/jdk/internal/jrtfs/Basic.java b/jdk/test/jdk/internal/jrtfs/Basic.java
new file mode 100644
index 00000000000..3b5fedaecbc
--- /dev/null
+++ b/jdk/test/jdk/internal/jrtfs/Basic.java
@@ -0,0 +1,459 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @test
+ * @summary Basic test of jrt file system provider
+ * @run testng Basic
+ */
+
+import java.io.InputStream;
+import java.io.DataInputStream;
+import java.nio.file.DirectoryStream;
+import java.nio.file.Files;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.nio.file.PathMatcher;
+import java.nio.file.Paths;
+import java.net.URI;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.stream.Stream;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotEquals;
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.assertFalse;
+
+/**
+ * Basic tests for jrt:/ file system provider.
+ */
+
+public class Basic {
+
+    // Checks that the given FileSystem is a jrt file system.
+    private void checkFileSystem(FileSystem fs) {
+        assertTrue(fs.provider().getScheme().equalsIgnoreCase("jrt"));
+        assertTrue(fs.isOpen());
+        assertTrue(fs.isReadOnly());
+        assertEquals(fs.getSeparator(), "/");
+
+        // one root
+        Iterator<Path> roots = fs.getRootDirectories().iterator();
+        assertTrue(roots.next().toString().equals("/"));
+        assertFalse(roots.hasNext());
+    }
+
+    @Test
+    public void testGetFileSystem() {
+        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        checkFileSystem(fs);
+
+        // getFileSystem should return the same object each time
+        assertTrue(fs == FileSystems.getFileSystem(URI.create("jrt:/")));
+    }
+
+    @Test(expectedExceptions = UnsupportedOperationException.class)
+    public void testCloseFileSystem() throws Exception {
+        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        fs.close(); // should throw UOE
+    }
+
+    @Test
+    public void testNewFileSystem() throws Exception {
+        FileSystem theFileSystem = FileSystems.getFileSystem(URI.create("jrt:/"));
+        Map<String, ?> env = Collections.emptyMap();
+        try (FileSystem fs = FileSystems.newFileSystem(URI.create("jrt:/"), env)) {
+            checkFileSystem(fs);
+            assertTrue(fs != theFileSystem);
+        }
+    }
+
+    @DataProvider(name = "knownClassFiles")
+    private Object[][] knownClassFiles() {
+        return new Object[][] {
+            { "/java.base/java/lang/Object.class" },
+            { "java.base/java/lang/Object.class" },
+        };
+    }
+
+    @Test(dataProvider = "knownClassFiles")
+    public void testKnownClassFiles(String path) throws Exception {
+        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        Path classFile = fs.getPath(path);
+
+        assertTrue(Files.isRegularFile(classFile));
+        assertTrue(Files.size(classFile) > 0L);
+
+        // check magic number
+        try (InputStream in = Files.newInputStream(classFile)) {
+            int magic = new DataInputStream(in).readInt();
+            assertEquals(magic, 0xCAFEBABE);
+        }
+    }
+
+    @DataProvider(name = "knownDirectories")
+    private Object[][] knownDirectories() {
+        return new Object[][] {
+            { "/"                     },
+            { "."                     },
+            { "./"                    },
+            { "/."                    },
+            { "/./"                   },
+            { "/java.base/.."         },
+            { "/java.base/../"        },
+            { "/java.base/../."       },
+            { "/java.base"            },
+            { "/java.base/java/lang"  },
+            { "java.base/java/lang"   },
+            { "/java.base/java/lang/" },
+            { "java.base/java/lang/"  }
+        };
+    }
+
+    @Test(dataProvider = "knownDirectories")
+    public void testKnownDirectories(String path) throws Exception {
+        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        Path dir = fs.getPath(path);
+
+        assertTrue(Files.isDirectory(dir));
+
+        // directory should not be empty
+        try (Stream<Path> stream = Files.list(dir)) {
+            assertTrue(stream.count() > 0L);
+        }
+        try (Stream<Path> stream = Files.walk(dir)) {
+            assertTrue(stream.count() > 0L);
+        }
+    }
+
+    @DataProvider(name = "topLevelPkgDirs")
+    private Object[][] topLevelPkgDirs() {
+        return new Object[][] {
+            { "/java/lang" },
+            { "java/lang"  },
+            { "/java/util" },
+            { "java/util"  },
+        };
+    }
+
+    @Test(dataProvider = "topLevelPkgDirs")
+    public void testNotExists(String path) throws Exception {
+        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        Path dir = fs.getPath(path);
+
+        // package directories should not be there at top level
+        assertTrue(Files.notExists(dir));
+    }
+
+    /**
+     * Test the URI of every file in the jrt file system
+     */
+    @Test
+    public void testToAndFromUri() throws Exception {
+        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        Path top = fs.getPath("/");
+        try (Stream<Path> stream = Files.walk(top)) {
+            stream.forEach(path -> {
+                URI u = path.toUri();
+                assertTrue(u.getScheme().equalsIgnoreCase("jrt"));
+                assertFalse(u.isOpaque());
+                assertTrue(u.getAuthority() == null);
+                assertEquals(u.getPath(), path.toAbsolutePath().toString());
+                Path p = Paths.get(u);
+                assertEquals(p, path);
+            });
+        }
+    }
+
+    @Test
+    public void testDirectoryNames() throws Exception {
+        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        Path top = fs.getPath("/");
+        // check that directory names do not have trailing '/' char
+        try (Stream<Path> stream = Files.walk(top)) {
+            stream.skip(1).filter(Files::isDirectory).forEach(path -> {
+                assertFalse(path.toString().endsWith("/"));
+            });
+        }
+    }
+
+    @DataProvider(name = "pathPrefixs")
+    private Object[][] pathPrefixes() {
+        return new Object[][] {
+            { "/"                       },
+            { "java.base/java/lang"     },
+            { "./java.base/java/lang"   },
+            { "/java.base/java/lang"    },
+            { "/./java.base/java/lang"  },
+            { "java.base/java/lang/"    },
+            { "./java.base/java/lang/"  },
+            { "/./java.base/java/lang/" },
+        };
+    }
+
+    @Test(dataProvider = "pathPrefixes")
+    public void testParentInDirList(String dir) throws Exception {
+        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        Path base = fs.getPath(dir);
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(base)) {
+            for (Path entry: stream) {
+                assertTrue( entry.getParent().equals(base) );
+            }
+        }
+    }
+
+    @DataProvider(name = "dirStreamStringFilterData")
+    private Object[][] dirStreamStringFilterData() {
+        return new Object[][] {
+            { "/java.base/java/lang", "/reflect"      },
+            { "/java.base/java/lang", "/Object.class" },
+            { "/java.base/java/util", "/stream"       },
+            { "/java.base/java/util", "/List.class"   },
+        };
+    }
+
+    @Test(dataProvider = "dirStreamStringFilterData")
+    public void testDirectoryStreamStringFilter(String dir, String filter) throws Exception {
+        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        Path base = fs.getPath(dir);
+        try (DirectoryStream<Path> stream =
+                Files.newDirectoryStream(base, p->!p.toString().endsWith(filter))) {
+            for (Path entry: stream) {
+                assertFalse(entry.toString().contains(filter),
+                    "filtered path seen: " + filter);
+            }
+        }
+
+        // make sure without filter, we do see that matching entry!
+        boolean seen = false;
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(base)) {
+            for (Path entry: stream) {
+                if (entry.toString().endsWith(filter)) {
+                    seen = true;
+                    break;
+                }
+            }
+        }
+
+        assertTrue(seen, "even without filter " + filter + " is missing");
+    }
+
+    @DataProvider(name = "dirStreamFilterData")
+    private Object[][] dirStreamFilterData() {
+        return new Object[][] {
+            {
+              "/",
+              (DirectoryStream.Filter<Path>)(Files::isDirectory),
+              "isDirectory"
+            },
+            {
+              "/java.base/java/lang",
+              (DirectoryStream.Filter<Path>)(Files::isRegularFile),
+              "isFile"
+            }
+        };
+    }
+
+    @Test(dataProvider = "dirStreamFilterData")
+    private void testDirectoryStreamFilter(String dir, DirectoryStream.Filter filter,
+            String name) throws Exception {
+        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        Path base = fs.getPath(dir);
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(base, filter)) {
+            for (Path entry: stream) {
+                assertTrue(filter.accept(entry), "filtered path seen: " + name);
+            }
+        }
+
+        // make sure without filter, we do see that matching entry!
+        boolean seen = false;
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(base)) {
+            for (Path entry: stream) {
+                if (filter.accept(entry)) {
+                    seen = true;
+                    break;
+                }
+            }
+        }
+
+        assertTrue(seen, "even without filter " + name + " is missing");
+    }
+
+    @Test
+    private void testDirectoryStreamIterator() throws Exception {
+        // run the tests with null filter (no filter)
+        dirStreamIteratorTest(null);
+        // run the same tests with trivial "accept all" filter
+        dirStreamIteratorTest(p->true);
+        // two other non-trivial ones
+        dirStreamIteratorTest(Files::isDirectory);
+        dirStreamIteratorTest(Files::isRegularFile);
+    }
+
+    private void dirStreamIteratorTest(DirectoryStream.Filter<Path> filter)
+            throws Exception {
+        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        // This test assumes at least there are two elements in "java/lang"
+        // package with any filter passed. don't change to different path here!
+        Path dir = fs.getPath("/java.base/java/lang");
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, filter)) {
+            Iterator<Path> itr = stream.iterator();
+            itr.hasNext();
+            Path path1 = itr.next();
+            // missing second hasNext call
+            Path path2 = itr.next();
+            assertNotEquals(path1, path2);
+        }
+
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, filter)) {
+            Iterator<Path> itr = stream.iterator();
+            // no hasNext calls at all
+            Path path1 = itr.next();
+            Path path2 = itr.next();
+            assertNotEquals(path1, path2);
+        }
+
+        int numEntries = 0;
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, filter)) {
+            Iterator<Path> itr = stream.iterator();
+            while (itr.hasNext()) {
+                numEntries++;
+                itr.next();
+            }
+
+            // reached EOF, next call should result in exception
+            try {
+                itr.next();
+                throw new AssertionError("should have thrown exception");
+            } catch (NoSuchElementException nsee) {
+                System.out.println("got NoSuchElementException as expected");
+            }
+        }
+
+        // redundant hasNext calls
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(dir, filter)) {
+            Iterator<Path> itr = stream.iterator();
+            // any number of hasNext should definitely stay at first element
+            for (int i = 0; i < 2*numEntries; i++) {
+                itr.hasNext();
+            }
+
+            for (int j = 0; j < numEntries; j++) {
+                itr.next();
+            }
+            // exactly count number of entries!
+            assertFalse(itr.hasNext());
+        }
+    }
+
+    @DataProvider(name = "hiddenPaths")
+    private Object[][] hiddenPaths() {
+        return new Object[][] {
+            { "/META-INF" },
+            { "/META-INF/services" },
+            { "/META-INF/services/java.nio.file.spi.FileSystemProvider" },
+            { "/java.base/packages.offsets" },
+            { "/java.instrument/packages.offsets" },
+            { "/jdk.zipfs/packages.offsets" },
+            { "/java/lang" },
+            { "/java/util" },
+        };
+    }
+
+    @Test(dataProvider = "hiddenPaths")
+    public void testHiddenPathsNotExposed(String path) throws Exception {
+        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        assertTrue(Files.notExists(fs.getPath(path)), path + " should not exist");
+    }
+
+    @DataProvider(name = "pathGlobPatterns")
+    private Object[][] pathGlobPatterns() {
+        return new Object[][] {
+            { "/*", "/java.base", true },
+            { "/*", "/java.base/java", false },
+            { "/j*", "/java.base", true },
+            { "/J*", "/java.base", false },
+            { "**.class", "/java.base/java/lang/Object.class", true },
+            { "**.java", "/java.base/java/lang/Object.class", false },
+            { "**java/*", "/java.base/java/lang", true },
+            { "**java/lang/ref*", "/java.base/java/lang/reflect", true },
+            { "**java/lang/ref*", "/java.base/java/lang/ref", true },
+            { "**java/lang/ref?", "/java.base/java/lang/ref", false },
+            { "**java/lang/{ref,refl*}", "/java.base/java/lang/ref", true },
+            { "**java/lang/{ref,refl*}", "/java.base/java/lang/reflect", true },
+            { "**java/[a-u]?*/*.class", "/java.base/java/util/Map.class", true },
+            { "**java/util/[a-z]*.class", "/java.base/java/util/TreeMap.class", false },
+        };
+    }
+
+    @Test(dataProvider = "pathGlobPatterns")
+    public void testGlobPathMatcher(String pattern, String path,
+            boolean expectMatch) throws Exception {
+        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        PathMatcher pm = fs.getPathMatcher("glob:" + pattern);
+        Path p = fs.getPath(path);
+        assertTrue(Files.exists(p), path);
+        assertTrue(!(pm.matches(p) ^ expectMatch),
+            p + (expectMatch? " should match " : " should not match ") +
+            pattern);
+    }
+
+    @DataProvider(name = "pathRegexPatterns")
+    private Object[][] pathRegexPatterns() {
+        return new Object[][] {
+            { "/.*", "/java.base", true },
+            { "/[^/]*", "/java.base/java", false },
+            { "/j.*", "/java.base", true },
+            { "/J.*", "/java.base", false },
+            { ".*\\.class", "/java.base/java/lang/Object.class", true },
+            { ".*\\.java", "/java.base/java/lang/Object.class", false },
+            { ".*java/.*", "/java.base/java/lang", true },
+            { ".*java/lang/ref.*", "/java.base/java/lang/reflect", true },
+            { ".*java/lang/ref.*", "/java.base/java/lang/ref", true },
+            { ".*/java/lang/ref.+", "/java.base/java/lang/ref", false },
+            { ".*/java/lang/(ref|refl.*)", "/java.base/java/lang/ref", true },
+            { ".*/java/lang/(ref|refl.*)", "/java.base/java/lang/reflect", true },
+            { ".*/java/[a-u]?.*/.*\\.class", "/java.base/java/util/Map.class", true },
+            { ".*/java/util/[a-z]*\\.class", "/java.base/java/util/TreeMap.class", false },
+        };
+    }
+
+    @Test(dataProvider = "pathRegexPatterns")
+    public void testRegexPathMatcher(String pattern, String path,
+            boolean expectMatch) throws Exception {
+        FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        PathMatcher pm = fs.getPathMatcher("regex:" + pattern);
+        Path p = fs.getPath(path);
+        assertTrue(Files.exists(p), path);
+        assertTrue(!(pm.matches(p) ^ expectMatch),
+            p + (expectMatch? " should match " : " should not match ") +
+            pattern);
+    }
+}
diff --git a/jdk/test/jdk/internal/jrtfs/PathOps.java b/jdk/test/jdk/internal/jrtfs/PathOps.java
new file mode 100644
index 00000000000..2a28e0571e2
--- /dev/null
+++ b/jdk/test/jdk/internal/jrtfs/PathOps.java
@@ -0,0 +1,458 @@
+/*
+ * Copyright (c) 2014, 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.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.InvalidPathException;
+import java.net.URI;
+import java.io.IOException;
+
+/**
+ * @test
+ * @summary Tests jrt path operations
+ */
+
+public class PathOps {
+
+    static final java.io.PrintStream out = System.out;
+    static FileSystem fs;
+
+    private String input;
+    private Path path;
+    private Exception exc;
+
+    private PathOps(String s) {
+        out.println();
+        input = s;
+        try {
+            path = fs.getPath(s);
+            out.format("%s -> %s", s, path);
+        } catch (Exception x) {
+            exc = x;
+            out.format("%s -> %s", s, x);
+        }
+        out.println();
+    }
+
+    Path path() {
+        return path;
+    }
+
+    void fail() {
+        throw new RuntimeException("PathOps failed");
+    }
+
+    void checkPath() {
+        if (path == null) {
+            throw new InternalError("path is null");
+        }
+    }
+
+    void check(Object result, String expected) {
+        out.format("\tExpected: %s\n", expected);
+        out.format("\tActual: %s\n",  result);
+        if (result == null) {
+            if (expected == null) return;
+        } else {
+            // compare string representations
+            if (expected != null && result.toString().equals(expected.toString()))
+                return;
+        }
+        fail();
+    }
+
+    void check(Object result, boolean expected) {
+        check(result, Boolean.toString(expected));
+    }
+
+    PathOps root(String expected) {
+        out.println("check root");
+        checkPath();
+        check(path.getRoot(), expected);
+        return this;
+    }
+
+    PathOps parent(String expected) {
+        out.println("check parent");
+        checkPath();
+        check(path.getParent(), expected);
+        return this;
+    }
+
+    PathOps name(String expected) {
+        out.println("check name");
+        checkPath();
+        check(path.getFileName(), expected);
+        return this;
+    }
+
+    PathOps element(int index, String expected) {
+        out.format("check element %d\n", index);
+        checkPath();
+        check(path.getName(index), expected);
+        return this;
+    }
+
+    PathOps subpath(int startIndex, int endIndex, String expected) {
+        out.format("test subpath(%d,%d)\n", startIndex, endIndex);
+        checkPath();
+        check(path.subpath(startIndex, endIndex), expected);
+        return this;
+    }
+
+    PathOps starts(String prefix) {
+        out.format("test startsWith with %s\n", prefix);
+        checkPath();
+        Path s = fs.getPath(prefix);
+        check(path.startsWith(s), true);
+        return this;
+    }
+
+    PathOps notStarts(String prefix) {
+        out.format("test not startsWith with %s\n", prefix);
+        checkPath();
+        Path s = fs.getPath(prefix);
+        check(path.startsWith(s), false);
+        return this;
+    }
+
+    PathOps ends(String suffix) {
+        out.format("test endsWith %s\n", suffix);
+        checkPath();
+        Path s = fs.getPath(suffix);
+        check(path.endsWith(s), true);
+        return this;
+    }
+
+    PathOps notEnds(String suffix) {
+        out.format("test not endsWith %s\n", suffix);
+        checkPath();
+        Path s = fs.getPath(suffix);
+        check(path.endsWith(s), false);
+        return this;
+    }
+
+    PathOps absolute() {
+        out.println("check path is absolute");
+        checkPath();
+        check(path.isAbsolute(), true);
+        return this;
+    }
+
+    PathOps notAbsolute() {
+        out.println("check path is not absolute");
+        checkPath();
+        check(path.isAbsolute(), false);
+        return this;
+    }
+
+    PathOps resolve(String other, String expected) {
+        out.format("test resolve %s\n", other);
+        checkPath();
+        check(path.resolve(other), expected);
+        return this;
+    }
+
+    PathOps relativize(String other, String expected) {
+        out.format("test relativize %s\n", other);
+        checkPath();
+        Path that = fs.getPath(other);
+        check(path.relativize(that), expected);
+        return this;
+    }
+
+    PathOps normalize(String expected) {
+        out.println("check normalized path");
+        checkPath();
+        check(path.normalize(), expected);
+        return this;
+    }
+
+    PathOps string(String expected) {
+        out.println("check string representation");
+        checkPath();
+        check(path, expected);
+        return this;
+    }
+
+    PathOps isSameFile(String target) {
+        try {
+            out.println("check two paths are same");
+            checkPath();
+            check(Files.isSameFile(path, test(target).path()), true);
+        } catch (IOException ioe) {
+            fail();
+        }
+        return this;
+    }
+
+    PathOps invalid() {
+        if (!(exc instanceof InvalidPathException)) {
+            out.println("InvalidPathException not thrown as expected");
+            fail();
+        }
+        return this;
+    }
+
+    static PathOps test(String s) {
+        return new PathOps(s);
+    }
+
+    // -- PathOpss --
+
+    static void header(String s) {
+        out.println();
+        out.println();
+        out.println("-- " + s + " --");
+    }
+
+    static void doPathOpTests() {
+        header("Path operations");
+
+        // all components
+        test("/a/b/c")
+            .root("/")
+            .parent("/a/b")
+            .name("c");
+
+        // root component only
+        test("/")
+            .root("/")
+            .parent(null)
+            .name(null);
+
+        // no root component
+        test("a/b")
+            .root(null)
+            .parent("a")
+            .name("b");
+
+        // name component only
+        test("foo")
+             .root(null)
+             .parent(null)
+             .name("foo");
+
+        // startsWith
+        test("")
+            .starts("")
+            .notStarts("/");
+        test("/")
+            .starts("/")
+            .notStarts("/foo");
+        test("/foo")
+            .starts("/")
+            .starts("/foo")
+            .notStarts("/f")
+            .notStarts("");
+        test("/foo/bar")
+            .starts("/")
+            .starts("/foo")
+            .starts("/foo/")
+            .starts("/foo/bar")
+            .notStarts("/f")
+            .notStarts("foo")
+            .notStarts("foo/bar")
+            .notStarts("");
+        test("foo")
+            .starts("foo")
+            .notStarts("f");
+        test("foo/bar")
+            .starts("foo")
+            .starts("foo/")
+            .starts("foo/bar")
+            .notStarts("f")
+            .notStarts("/foo")
+            .notStarts("/foo/bar");
+
+        // endsWith
+        test("")
+            .ends("")
+            .notEnds("/");
+        test("/")
+            .ends("/")
+            .notEnds("foo")
+            .notEnds("/foo");
+        test("/foo")
+            .ends("foo")
+            .ends("/foo")
+            .notEnds("/");
+        test("/foo/bar")
+            .ends("bar")
+            .ends("foo/bar")
+            .ends("foo/bar/")
+            .ends("/foo/bar")
+            .notEnds("/bar");
+        test("/foo/bar/")
+            .ends("bar")
+            .ends("foo/bar")
+            .ends("foo/bar/")
+            .ends("/foo/bar")
+            .notEnds("/bar");
+        test("foo")
+            .ends("foo");
+        test("foo/bar")
+            .ends("bar")
+            .ends("bar/")
+            .ends("foo/bar/")
+            .ends("foo/bar");
+
+
+        // elements
+        test("a/b/c")
+            .element(0,"a")
+            .element(1,"b")
+            .element(2,"c");
+
+        // isAbsolute
+        test("/")
+            .absolute();
+        test("/tmp")
+            .absolute();
+        test("tmp")
+            .notAbsolute();
+        test("")
+            .notAbsolute();
+
+        // resolve
+        test("/tmp")
+            .resolve("foo", "/tmp/foo")
+            .resolve("/foo", "/foo");
+        test("tmp")
+            .resolve("foo", "tmp/foo")
+            .resolve("/foo", "/foo");
+
+        // relativize
+        test("/a/b/c")
+            .relativize("/a/b/c", "")
+            .relativize("/a/b/c/d/e", "d/e")
+            .relativize("/a/x", "../../x");
+
+        // normalize
+        test("/")
+            .normalize("/");
+        test("foo")
+            .normalize("foo");
+        test("/foo")
+            .normalize("/foo");
+        test(".")
+            .normalize("");
+        test("..")
+            .normalize("..");
+        test("/..")
+            .normalize("/");
+        test("/../..")
+            .normalize("/");
+        test("foo/.")
+            .normalize("foo");
+        test("./foo")
+            .normalize("foo");
+        test("foo/..")
+            .normalize("");
+        test("../foo")
+            .normalize("../foo");
+        test("../../foo")
+            .normalize("../../foo");
+        test("foo/bar/..")
+            .normalize("foo");
+        test("foo/bar/gus/../..")
+            .normalize("foo");
+        test("/foo/bar/gus/../..")
+            .normalize("/foo");
+        test("/./.")
+            .normalize("/");
+        test("/.")
+            .normalize("/");
+        test("/./abc")
+            .normalize("/abc");
+        // invalid
+        test("foo\u0000bar")
+            .invalid();
+        test("\u0000foo")
+            .invalid();
+        test("bar\u0000")
+            .invalid();
+        test("//foo\u0000bar")
+            .invalid();
+        test("//\u0000foo")
+            .invalid();
+        test("//bar\u0000")
+            .invalid();
+
+        // normalization
+        test("//foo//bar")
+            .string("/foo/bar")
+            .root("/")
+            .parent("/foo")
+            .name("bar");
+
+        // isSameFile
+        test("/fileDoesNotExist")
+            .isSameFile("/fileDoesNotExist");
+    }
+
+    static void npes() {
+        header("NullPointerException");
+
+        Path path = fs.getPath("foo");
+
+        try {
+            path.resolve((String)null);
+            throw new RuntimeException("NullPointerException not thrown");
+        } catch (NullPointerException npe) {
+        }
+
+        try {
+            path.relativize(null);
+            throw new RuntimeException("NullPointerException not thrown");
+        } catch (NullPointerException npe) {
+        }
+
+        try {
+            path.compareTo(null);
+            throw new RuntimeException("NullPointerException not thrown");
+        } catch (NullPointerException npe) {
+        }
+
+        try {
+            path.startsWith((Path)null);
+            throw new RuntimeException("NullPointerException not thrown");
+        } catch (NullPointerException npe) {
+        }
+
+        try {
+            path.endsWith((Path)null);
+            throw new RuntimeException("NullPointerException not thrown");
+        } catch (NullPointerException npe) {
+        }
+
+    }
+
+    public static void main(String[] args) throws Throwable {
+        fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        npes();
+        doPathOpTests();
+    }
+}
diff --git a/jdk/test/jdk/internal/jrtfs/WithSecurityManager.java b/jdk/test/jdk/internal/jrtfs/WithSecurityManager.java
new file mode 100644
index 00000000000..4e094acac38
--- /dev/null
+++ b/jdk/test/jdk/internal/jrtfs/WithSecurityManager.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2014, 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
+ * @run main/othervm WithSecurityManager allow
+ * @run main/othervm WithSecurityManager deny
+ */
+
+import java.net.URI;
+import java.nio.file.FileSystems;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class WithSecurityManager {
+    public static void main(String[] args) throws Exception {
+        boolean allow = args[0].equals("allow");
+
+        // set security policy to allow access
+        if (allow) {
+            String testSrc = System.getProperty("test.src");
+            if (testSrc == null)
+                testSrc = ".";
+            Path policyFile = Paths.get(testSrc, "java.policy");
+            System.setProperty("java.security.policy", policyFile.toString());
+        }
+
+        // make sure that jrt:/ has been created before we have a security manager
+        FileSystems.getFileSystem(URI.create("jrt:/"));
+
+        System.setSecurityManager(new SecurityManager());
+
+        // check FileSystems.getFileSystem
+        try {
+            FileSystems.getFileSystem(URI.create("jrt:/"));
+            if (!allow) throw new RuntimeException("access not expected");
+        } catch (SecurityException se) {
+            if (allow) throw new RuntimeException("access expected");
+        }
+
+        // check FileSystems.newFileSystem
+        try {
+            FileSystems.newFileSystem(URI.create("jrt:/"), null);
+            if (!allow) throw new RuntimeException("access not expected");
+        } catch (SecurityException se) {
+            if (allow) throw new RuntimeException("access expected");
+        }
+
+        // check Paths.get
+        try {
+            Paths.get(URI.create("jrt:/java.base/java/lang/Object.class"));
+            if (!allow) throw new RuntimeException("access not expected");
+        } catch (SecurityException se) {
+            if (allow) throw new RuntimeException("access expected");
+        }
+    }
+}
diff --git a/jdk/test/jdk/internal/jrtfs/java.policy b/jdk/test/jdk/internal/jrtfs/java.policy
new file mode 100644
index 00000000000..5df300aa905
--- /dev/null
+++ b/jdk/test/jdk/internal/jrtfs/java.policy
@@ -0,0 +1,3 @@
+grant {
+    permission java.io.FilePermission "${java.home}/-", "read";
+};
diff --git a/jdk/test/jdk/nio/zipfs/Basic.java b/jdk/test/jdk/nio/zipfs/Basic.java
index 36769729da3..a32a0980386 100644
--- a/jdk/test/jdk/nio/zipfs/Basic.java
+++ b/jdk/test/jdk/nio/zipfs/Basic.java
@@ -21,15 +21,26 @@
  * questions.
  */
 
-import java.nio.file.*;
-import java.nio.file.attribute.*;
+import java.nio.file.AccessMode;
+import java.nio.file.ClosedFileSystemException;
+import java.nio.file.DirectoryStream;
+import java.nio.file.FileStore;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.StandardCopyOption;
+import java.nio.file.attribute.BasicFileAttributes;
 import java.nio.file.spi.FileSystemProvider;
-import java.util.*;
 import java.net.URI;
 import java.io.IOException;
+import java.util.Collections;
+import java.util.Map;
 
 /**
- *
  * @test
  * @bug 8038500 8040059
  * @summary Basic test for zip provider
@@ -40,11 +51,8 @@ import java.io.IOException;
 
 public class Basic {
     public static void main(String[] args) throws Exception {
-        Path zipfile = Paths.get(System.getProperty("test.jdk"),
-                                 "jre/lib/ext/zipfs.jar");
         // Test: zip should should be returned in provider list
         boolean found = false;
-
         for (FileSystemProvider provider: FileSystemProvider.installedProviders()) {
             if (provider.getScheme().equalsIgnoreCase("jar")) {
                 found = true;
@@ -54,12 +62,16 @@ public class Basic {
         if (!found)
             throw new RuntimeException("'jar' provider not installed");
 
+        // create JAR file for test
+        Path jarFile = Utils.createJarFile("basic.jar",
+                "META-INF/services/java.nio.file.spi.FileSystemProvider");
+
         // Test: FileSystems#newFileSystem(Path)
-        Map<String,?> env = new HashMap<String,Object>();
-        FileSystems.newFileSystem(zipfile, null).close();
+        Map<String,?> env = Collections.emptyMap();
+        FileSystems.newFileSystem(jarFile, null).close();
 
         // Test: FileSystems#newFileSystem(URI)
-        URI uri = new URI("jar", zipfile.toUri().toString(), null);
+        URI uri = new URI("jar", jarFile.toUri().toString(), null);
         FileSystem fs = FileSystems.newFileSystem(uri, env, null);
 
         // Test: exercise toUri method
diff --git a/jdk/test/jdk/nio/zipfs/PathOps.java b/jdk/test/jdk/nio/zipfs/PathOps.java
index 820c04f2f74..eaf118bba7f 100644
--- a/jdk/test/jdk/nio/zipfs/PathOps.java
+++ b/jdk/test/jdk/nio/zipfs/PathOps.java
@@ -21,10 +21,12 @@
  * questions.
  */
 
-import java.nio.file.*;
-import java.net.*;
-import java.util.*;
 import java.io.IOException;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
 
 /**
  *
@@ -33,7 +35,7 @@ import java.io.IOException;
  * @summary Tests path operations for zip provider.
  *
  * @run main PathOps
- * @run main/othervm/java.security.policy=test.policy.readonly PathOps
+ * @run main/othervm/java.security.policy=test.policy PathOps
  */
 
 public class PathOps {
@@ -452,12 +454,16 @@ public class PathOps {
 
     }
 
-    public static void main(String[] args) throws Throwable {
-        Path zipfile = Paths.get(System.getProperty("test.jdk"),
-                                 "jre/lib/ext/zipfs.jar");
-        fs = FileSystems.newFileSystem(zipfile, null);
+    public static void main(String[] args) throws IOException {
+        // create empty JAR file, test doesn't require any contents
+        Path emptyJar = Utils.createJarFile("empty.jar");
+
+        fs = FileSystems.newFileSystem(emptyJar, null);
+        try {
         npes();
         doPathOpTests();
+        } finally {
         fs.close();
     }
 }
+}
diff --git a/jdk/test/jdk/nio/zipfs/Utils.java b/jdk/test/jdk/nio/zipfs/Utils.java
new file mode 100644
index 00000000000..a561535dc5a
--- /dev/null
+++ b/jdk/test/jdk/nio/zipfs/Utils.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2014, 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.io.IOException;
+import java.io.OutputStream;
+import java.nio.file.*;
+import java.util.Random;
+import java.util.jar.JarEntry;
+import java.util.jar.JarOutputStream;
+
+/**
+ * Utility class for zipfs tests.
+ */
+
+class Utils {
+    private Utils() { }
+
+    /**
+     * Creates a JAR file of the given name with 0 or more named entries.
+     *
+     * @return Path to the newly created JAR file
+     */
+    static Path createJarFile(String name, String... entries) throws IOException {
+        Path jarFile = Paths.get("basic.jar");
+        Random rand = new Random();
+        try (OutputStream out = Files.newOutputStream(jarFile);
+             JarOutputStream jout = new JarOutputStream(out)) {
+            int len = 100;
+            for (String entry: entries) {
+                JarEntry je = new JarEntry(entry);
+                jout.putNextEntry(je);
+                byte[] bytes = new byte[len];
+                rand.nextBytes(bytes);
+                jout.write(bytes);
+                jout.closeEntry();
+                len += 1024;
+            }
+        }
+        return jarFile;
+    }
+}
diff --git a/jdk/test/jdk/nio/zipfs/ZipFSTester.java b/jdk/test/jdk/nio/zipfs/ZipFSTester.java
index 60a80c6c169..3b54020bcb2 100644
--- a/jdk/test/jdk/nio/zipfs/ZipFSTester.java
+++ b/jdk/test/jdk/nio/zipfs/ZipFSTester.java
@@ -21,16 +21,43 @@
  * questions.
  */
 
-import java.io.*;
-import java.nio.*;
-import java.nio.channels.*;
-import java.nio.file.*;
-import java.nio.file.spi.*;
-import java.nio.file.attribute.*;
-import java.net.*;
-import java.util.*;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URI;
+import java.nio.ByteBuffer;
+import java.nio.channels.FileChannel;
+import java.nio.channels.SeekableByteChannel;
+import java.nio.file.DirectoryStream;
+import java.nio.file.FileAlreadyExistsException;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystemAlreadyExistsException;
+import java.nio.file.FileSystemException;
+import java.nio.file.FileSystems;
+import java.nio.file.FileVisitResult;
+import java.nio.file.Files;
+import java.nio.file.OpenOption;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.nio.file.SimpleFileVisitor;
+import java.nio.file.attribute.BasicFileAttributeView;
+import java.nio.file.attribute.BasicFileAttributes;
+import java.nio.file.spi.FileSystemProvider;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Set;
 import java.util.concurrent.TimeUnit;
-import java.util.zip.*;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipFile;
 
 import static java.nio.file.StandardOpenOption.*;
 import static java.nio.file.StandardCopyOption.*;
@@ -48,16 +75,20 @@ import static java.nio.file.StandardCopyOption.*;
 
 public class ZipFSTester {
 
-    public static void main(String[] args) throws Throwable {
-        try (FileSystem fs = newZipFileSystem(
-                 Paths.get(System.getProperty("test.jdk"), "jre/lib/ext/zipfs.jar"),
-                 new HashMap<String, Object>()))
-        {
+    public static void main(String[] args) throws Exception {
+
+        // create JAR file for test, actual contents don't matter
+        Path jarFile = Utils.createJarFile("tester.jar",
+                "META-INF/MANIFEST.MF",
+                "dir1/foo",
+                "dir2/bar");
+
+        try (FileSystem fs = newZipFileSystem(jarFile, Collections.emptyMap())) {
             test0(fs);
             test1(fs);
             test2(fs);   // more tests
         }
-        testTime(Paths.get(System.getProperty("test.jdk"), "jre/lib/ext/zipfs.jar"));
+        testTime(jarFile);
     }
 
     static void test0(FileSystem fs)
@@ -102,7 +133,7 @@ public class ZipFSTester {
                      new URI("jar", tmpfsPath.toUri().toString(), null),
                      new HashMap<String, Object>()))
             {
-              throw new RuntimeException("newFileSystem(uri...) does not throw exception");
+                throw new RuntimeException("newFileSystem(URI...) does not throw exception");
             } catch (FileSystemAlreadyExistsException fsaee) {}
 
             // prepare a src
diff --git a/jdk/test/lib/security/java.policy/Ext_AllPolicy.java b/jdk/test/lib/security/java.policy/Ext_AllPolicy.java
deleted file mode 100644
index 8a5755390c6..00000000000
--- a/jdk/test/lib/security/java.policy/Ext_AllPolicy.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (c) 1999, 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.
- */
-
-/*
- * This is a trivial file to grab the security manager, grab a
- * permission object, then try to check the resulting permission.
- */
-
-import java.io.*;
-import java.security.*;
-
-public class Ext_AllPolicy {
-    public static void main (String[] args) {
-        boolean allPerms = args.length == 1 && args[0].equals("AllPermission");
-        FilePermission mine = new FilePermission("/tmp/bar", "read");
-        SecurityManager sm = System.getSecurityManager();
-
-        if (sm != null) {
-            try {
-                sm.checkPermission(mine);
-                if (!allPerms) {
-                    // Default has no privilege.
-                    throw new RuntimeException(mine + " expected to deny access");
-                }
-            } catch (AccessControlException e) {
-                if (allPerms) {
-                    // expected all permissions granted
-                    throw e;
-                }
-            }
-        }
-    }
-}
diff --git a/jdk/test/lib/security/java.policy/Ext_AllPolicy.sh b/jdk/test/lib/security/java.policy/Ext_AllPolicy.sh
deleted file mode 100644
index 8b8701a987a..00000000000
--- a/jdk/test/lib/security/java.policy/Ext_AllPolicy.sh
+++ /dev/null
@@ -1,89 +0,0 @@
-#
-# Copyright (c) 1999, 2013, 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 4215035 8040059
-# @summary standard extensions path is hard-coded in default system policy file
-#
-# @build Ext_AllPolicy
-# @run shell Ext_AllPolicy.sh
-
-#
-# For testing extenions, the classes live in jar files, and therefore
-# we shouldn't be able to find the raw class file.
-#
-
-# set a few environment variables so that the shell-script can run stand-alone
-# in the source directory
-if [ "${TESTSRC}" = "" ] ; then
-  TESTSRC="."
-fi
-if [ "${TESTCLASSES}" = "" ] ; then
-  TESTCLASSES="."
-fi
-if [ "${TESTJAVA}" = "" ] ; then
-  echo "TESTJAVA not set.  Test cannot execute."
-  echo "FAILED!!!"
-  exit 1
-fi
-if [ "${COMPILEJAVA}" = "" ]; then
-  COMPILEJAVA="${TESTJAVA}"
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
-  SunOS | Linux | Darwin | AIX )
-    NULL=/dev/null
-    PS=":"
-    FS="/"
-    ;;
-  CYGWIN* )
-    NULL=/dev/null
-    PS=";"
-    FS="/"
-    ;;
-  Windows_95 | Windows_98 | Windows_NT )
-    NULL=NUL
-    PS=";"
-    FS="\\"
-    ;;
-  * )
-    echo "Unrecognized system!"
-    exit 1;
-    ;;
-esac
-
-# the test code
-
-cd ${TESTCLASSES}
-${COMPILEJAVA}${FS}bin${FS}jar ${TESTTOOLVMOPTS} -cvf Ext_AllPolicy.jar Ext_AllPolicy.class
-
-rm Ext_AllPolicy.class
-${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-        -Djava.security.manager -Djava.ext.dirs="${TESTCLASSES}" Ext_AllPolicy || exit 10
-
-${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} \
-        -Djava.security.policy=${TESTSRC}${FS}test.policy \
-        -Djava.security.manager -Djava.ext.dirs="${TESTCLASSES}" Ext_AllPolicy AllPermission
-exit $?
diff --git a/jdk/test/lib/security/java.policy/test.policy b/jdk/test/lib/security/java.policy/test.policy
deleted file mode 100644
index ee814957fd0..00000000000
--- a/jdk/test/lib/security/java.policy/test.policy
+++ /dev/null
@@ -1,3 +0,0 @@
-grant codeBase "file:${{java.ext.dirs}}/*" {
-    permission java.security.AllPermission;
-};
diff --git a/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java b/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java
index cc5f00983fa..2c03fa0c7ff 100644
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiBootstrapTest.java
@@ -228,13 +228,13 @@ public class RmiBootstrapTest {
     /**
      * Compute the full path name for a default file.
      * @param basename basename (with extension) of the default file.
-     * @return ${JRE}/lib/management/${basename}
+     * @return ${JRE}/conf/management/${basename}
      **/
     private static String getDefaultFileName(String basename) {
         final String fileSeparator = File.separator;
         final StringBuffer defaultFileName =
             new StringBuffer(System.getProperty("java.home")).
-            append(fileSeparator).append("lib").append(fileSeparator).
+            append(fileSeparator).append("conf").append(fileSeparator).
             append("management").append(fileSeparator).
             append(basename);
         return defaultFileName.toString();
@@ -243,7 +243,7 @@ public class RmiBootstrapTest {
     /**
      * Compute the full path name for a default file.
      * @param basename basename (with extension) of the default file.
-     * @return ${JRE}/lib/management/${basename}
+     * @return ${JRE}/conf/management/${basename}
      **/
     private static String getDefaultStoreName(String basename) {
         final String fileSeparator = File.separator;
diff --git a/jdk/test/sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.java b/jdk/test/sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.java
index 6296e7e2607..d551a1d6ed0 100644
--- a/jdk/test/sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.java
+++ b/jdk/test/sun/management/jmxremote/bootstrap/RmiSslNoKeyStoreTest.java
@@ -126,13 +126,13 @@ public class RmiSslNoKeyStoreTest {
     /**
      * Compute the full path name for a default file.
      * @param basename basename (with extension) of the default file.
-     * @return ${JRE}/lib/management/${basename}
+     * @return ${JRE}/conf/management/${basename}
      **/
     private static String getDefaultFileName(String basename) {
         final String fileSeparator = File.separator;
         final StringBuffer defaultFileName =
             new StringBuffer(System.getProperty("java.home")).
-            append(fileSeparator).append("lib").append(fileSeparator).
+            append(fileSeparator).append("conf").append(fileSeparator).
             append("management").append(fileSeparator).
             append(basename);
         return defaultFileName.toString();
@@ -141,7 +141,7 @@ public class RmiSslNoKeyStoreTest {
     /**
      * Compute the full path name for a default file.
      * @param basename basename (with extension) of the default file.
-     * @return ${JRE}/lib/management/${basename}
+     * @return ${JRE}/conf/management/${basename}
      **/
     private static String getDefaultStoreName(String basename) {
         final String fileSeparator = File.separator;
diff --git a/jdk/test/sun/management/jmxremote/bootstrap/rmiregistry.properties b/jdk/test/sun/management/jmxremote/bootstrap/rmiregistry.properties
index 7b3f2f6b9ae..ef87663d89f 100644
--- a/jdk/test/sun/management/jmxremote/bootstrap/rmiregistry.properties
+++ b/jdk/test/sun/management/jmxremote/bootstrap/rmiregistry.properties
@@ -5,24 +5,24 @@
 # The Management Configuration file (in java.util.Properties format)
 # will be read if one of the following system properties is set:
 #    -Dcom.sun.management.jmxremote.port=<port-number>
-# or -Dcom.sun.management.snmp.port=<port-number> 
+# or -Dcom.sun.management.snmp.port=<port-number>
 # or -Dcom.sun.management.config.file=<this-file>
 #
 # The default Management Configuration file is:
 #
-#       $JRE/lib/management/management.properties
+#       $JRE/conf/management/management.properties
 #
 # Another location for the Management Configuration File can be specified
 # by the following property on the Java command line:
 #
 #    -Dcom.sun.management.config.file=<this-file>
-# 
+#
 # If -Dcom.sun.management.config.file=<this-file> is set, the port
-# number for the management agent can be specified in the config file 
+# number for the management agent can be specified in the config file
 # using the following lines:
-# 
+#
 # ################ Management Agent Port #########################
-# 
+#
 # For setting the JMX RMI agent port use the following line
 com.sun.management.jmxremote.port=${getFreePort}
 #
@@ -45,7 +45,7 @@ com.sun.management.jmxremote.port=${getFreePort}
 #      Refer to the specification for the java.lang.management.ThreadMBean
 #      interface - see isThreadContentionMonitoringSupported() method.
 #
- 
+
 # To enable thread contention monitoring, uncomment the following line
 # com.sun.management.enableThreadContentionMonitoring
 
@@ -53,9 +53,9 @@ com.sun.management.jmxremote.port=${getFreePort}
 #			SNMP Management Properties
 #####################################################################
 #
-# If the system property -Dcom.sun.management.snmp.port=<port-number> 
+# If the system property -Dcom.sun.management.snmp.port=<port-number>
 # is set then
-#	- The SNMP agent (with the Java virtual machine MIB) is started 
+#	- The SNMP agent (with the Java virtual machine MIB) is started
 #	  that listens on the specified port for incoming SNMP requests.
 #	- the following properties for read for SNMP management.
 #
@@ -89,7 +89,7 @@ com.sun.management.jmxremote.port=${getFreePort}
 #
 #      The format of the value for that property is any string accepted
 #      by java.net.InetAddress.getByName(String).
-# 
+#
 
 # For restricting the port on which SNMP agent listens use following line
 # com.sun.management.snmp.interface=<InetAddress>
@@ -110,15 +110,15 @@ com.sun.management.jmxremote.port=${getFreePort}
 # com.sun.management.snmp.acl.file=filepath
 #      Specifies location for ACL file
 #      This is optional - default location is
-#      $JRE/lib/management/snmp.acl
-# 
+#      $JRE/conf/management/snmp.acl
+#
 #      If the property "com.sun.management.snmp.acl" is set to false,
 #      then this property and the ACL file are ignored.
 #      Otherwise the ACL file must exist and be in the valid format.
 #      If the ACL file is empty or non existent then no access is allowed.
-# 
-#      The SNMP agent will read the ACL file at startup time. 
-#      Modification to the ACL file has no effect to any running SNMP 
+#
+#      The SNMP agent will read the ACL file at startup time.
+#      Modification to the ACL file has no effect to any running SNMP
 #      agents which read that ACL file at startup.
 #
 
@@ -131,7 +131,7 @@ com.sun.management.jmxremote.port=${getFreePort}
 #
 # If system property -Dcom.sun.management.jmxremote.port=<port-number>
 # is set then
-#     - A MBean server is started 
+#     - A MBean server is started
 #     - JRE Platform MBeans are registered in the MBean server
 #     - RMI connector is published  in a private readonly registry at
 #       specified port using a well known name, "jmxrmi"
@@ -140,7 +140,7 @@ com.sun.management.jmxremote.port=${getFreePort}
 # The configuration can be specified only at startup time.
 # Later changes to above system property (e.g. via setProperty method),
 # this config file, the password file, or the access file have no effect to the
-# running MBean server, the connector, or the registry. 
+# running MBean server, the connector, or the registry.
 #
 
 #
@@ -149,7 +149,7 @@ com.sun.management.jmxremote.port=${getFreePort}
 # com.sun.management.jmxremote.ssl=true|false
 #      Default for this property is true. (Case for true/false ignored)
 #      If this property is specified as false then SSL is not used.
-# 
+#
 
 # For RMI monitoring without SSL use the following line
 # com.sun.management.jmxremote.ssl=false
@@ -218,20 +218,20 @@ com.sun.management.jmxremote.authenticate=false
 # ################ RMI Login configuration ###################
 #
 # com.sun.management.jmxremote.login.config=<config-name>
-#      Specifies the name of a JAAS login configuration entry to use when 
-#      authenticating users of RMI monitoring. 
+#      Specifies the name of a JAAS login configuration entry to use when
+#      authenticating users of RMI monitoring.
 #
 #      Setting this property is optional - the default login configuration
 #      specifies a file-based authentication that uses the password file.
 #
-#      When using this property to override the default login configuration 
-#      then the named configuration entry must be in a file that gets loaded 
+#      When using this property to override the default login configuration
+#      then the named configuration entry must be in a file that gets loaded
 #      by JAAS. In addition, the login module(s) specified in the configuration
-#      should use the name and/or password callbacks to acquire the user's 
-#      credentials. See the NameCallback and PasswordCallback classes in the 
+#      should use the name and/or password callbacks to acquire the user's
+#      credentials. See the NameCallback and PasswordCallback classes in the
 #      javax.security.auth.callback package for more details.
 #
-#      If the property "com.sun.management.jmxremote.authenticate" is set to 
+#      If the property "com.sun.management.jmxremote.authenticate" is set to
 #      false, then this property and the password & access files are ignored.
 #
 
@@ -244,9 +244,9 @@ com.sun.management.jmxremote.authenticate=false
 # com.sun.management.jmxremote.password.file=filepath
 #      Specifies location for password file
 #      This is optional - default location is
-#      $JRE/lib/management/jmxremote.password
-# 
-#      If the property "com.sun.management.jmxremote.authenticate" is set to 
+#      $JRE/conf/management/jmxremote.password
+#
+#      If the property "com.sun.management.jmxremote.authenticate" is set to
 #      false, then this property and the password & access files are ignored.
 #      Otherwise the password file must exist and be in the valid format.
 #      If the password file is empty or non-existent then no access is allowed.
@@ -261,9 +261,9 @@ com.sun.management.jmxremote.authenticate=false
 # com.sun.management.jmxremote.access.file=filepath
 #      Specifies location for access  file
 #      This is optional - default location is
-#      $JRE/lib/management/jmxremote.access
-# 
-#      If the property "com.sun.management.jmxremote.authenticate" is set to 
+#      $JRE/conf/management/jmxremote.access
+#
+#      If the property "com.sun.management.jmxremote.authenticate" is set to
 #      false, then this property and the password & access files are ignored.
 #      Otherwise, the access file must exist and be in the valid format.
 #      If the access file is empty or non-existent then no access is allowed.
diff --git a/jdk/test/sun/management/jmxremote/bootstrap/rmiregistryssl.properties b/jdk/test/sun/management/jmxremote/bootstrap/rmiregistryssl.properties
index 3b3b81c350e..4796f70aa12 100644
--- a/jdk/test/sun/management/jmxremote/bootstrap/rmiregistryssl.properties
+++ b/jdk/test/sun/management/jmxremote/bootstrap/rmiregistryssl.properties
@@ -5,24 +5,24 @@
 # The Management Configuration file (in java.util.Properties format)
 # will be read if one of the following system properties is set:
 #    -Dcom.sun.management.jmxremote.port=<port-number>
-# or -Dcom.sun.management.snmp.port=<port-number> 
+# or -Dcom.sun.management.snmp.port=<port-number>
 # or -Dcom.sun.management.config.file=<this-file>
 #
 # The default Management Configuration file is:
 #
-#       $JRE/lib/management/management.properties
+#       $JRE/conf/management/management.properties
 #
 # Another location for the Management Configuration File can be specified
 # by the following property on the Java command line:
 #
 #    -Dcom.sun.management.config.file=<this-file>
-# 
+#
 # If -Dcom.sun.management.config.file=<this-file> is set, the port
-# number for the management agent can be specified in the config file 
+# number for the management agent can be specified in the config file
 # using the following lines:
-# 
+#
 # ################ Management Agent Port #########################
-# 
+#
 # For setting the JMX RMI agent port use the following line
 com.sun.management.jmxremote.port=${getFreePort}
 #
@@ -45,7 +45,7 @@ com.sun.management.jmxremote.port=${getFreePort}
 #      Refer to the specification for the java.lang.management.ThreadMBean
 #      interface - see isThreadContentionMonitoringSupported() method.
 #
- 
+
 # To enable thread contention monitoring, uncomment the following line
 # com.sun.management.enableThreadContentionMonitoring
 
@@ -53,9 +53,9 @@ com.sun.management.jmxremote.port=${getFreePort}
 #			SNMP Management Properties
 #####################################################################
 #
-# If the system property -Dcom.sun.management.snmp.port=<port-number> 
+# If the system property -Dcom.sun.management.snmp.port=<port-number>
 # is set then
-#	- The SNMP agent (with the Java virtual machine MIB) is started 
+#	- The SNMP agent (with the Java virtual machine MIB) is started
 #	  that listens on the specified port for incoming SNMP requests.
 #	- the following properties for read for SNMP management.
 #
@@ -89,7 +89,7 @@ com.sun.management.jmxremote.port=${getFreePort}
 #
 #      The format of the value for that property is any string accepted
 #      by java.net.InetAddress.getByName(String).
-# 
+#
 
 # For restricting the port on which SNMP agent listens use following line
 # com.sun.management.snmp.interface=<InetAddress>
@@ -110,15 +110,15 @@ com.sun.management.jmxremote.port=${getFreePort}
 # com.sun.management.snmp.acl.file=filepath
 #      Specifies location for ACL file
 #      This is optional - default location is
-#      $JRE/lib/management/snmp.acl
-# 
+#      $JRE/conf/management/snmp.acl
+#
 #      If the property "com.sun.management.snmp.acl" is set to false,
 #      then this property and the ACL file are ignored.
 #      Otherwise the ACL file must exist and be in the valid format.
 #      If the ACL file is empty or non existent then no access is allowed.
-# 
-#      The SNMP agent will read the ACL file at startup time. 
-#      Modification to the ACL file has no effect to any running SNMP 
+#
+#      The SNMP agent will read the ACL file at startup time.
+#      Modification to the ACL file has no effect to any running SNMP
 #      agents which read that ACL file at startup.
 #
 
@@ -131,7 +131,7 @@ com.sun.management.jmxremote.port=${getFreePort}
 #
 # If system property -Dcom.sun.management.jmxremote.port=<port-number>
 # is set then
-#     - A MBean server is started 
+#     - A MBean server is started
 #     - JRE Platform MBeans are registered in the MBean server
 #     - RMI connector is published  in a private readonly registry at
 #       specified port using a well known name, "jmxrmi"
@@ -140,7 +140,7 @@ com.sun.management.jmxremote.port=${getFreePort}
 # The configuration can be specified only at startup time.
 # Later changes to above system property (e.g. via setProperty method),
 # this config file, the password file, or the access file have no effect to the
-# running MBean server, the connector, or the registry. 
+# running MBean server, the connector, or the registry.
 #
 
 #
@@ -149,7 +149,7 @@ com.sun.management.jmxremote.port=${getFreePort}
 # com.sun.management.jmxremote.ssl=true|false
 #      Default for this property is true. (Case for true/false ignored)
 #      If this property is specified as false then SSL is not used.
-# 
+#
 
 # For RMI monitoring without SSL use the following line
 # com.sun.management.jmxremote.ssl=false
@@ -218,20 +218,20 @@ com.sun.management.jmxremote.authenticate=false
 # ################ RMI Login configuration ###################
 #
 # com.sun.management.jmxremote.login.config=<config-name>
-#      Specifies the name of a JAAS login configuration entry to use when 
-#      authenticating users of RMI monitoring. 
+#      Specifies the name of a JAAS login configuration entry to use when
+#      authenticating users of RMI monitoring.
 #
 #      Setting this property is optional - the default login configuration
 #      specifies a file-based authentication that uses the password file.
 #
-#      When using this property to override the default login configuration 
-#      then the named configuration entry must be in a file that gets loaded 
+#      When using this property to override the default login configuration
+#      then the named configuration entry must be in a file that gets loaded
 #      by JAAS. In addition, the login module(s) specified in the configuration
-#      should use the name and/or password callbacks to acquire the user's 
-#      credentials. See the NameCallback and PasswordCallback classes in the 
+#      should use the name and/or password callbacks to acquire the user's
+#      credentials. See the NameCallback and PasswordCallback classes in the
 #      javax.security.auth.callback package for more details.
 #
-#      If the property "com.sun.management.jmxremote.authenticate" is set to 
+#      If the property "com.sun.management.jmxremote.authenticate" is set to
 #      false, then this property and the password & access files are ignored.
 #
 
@@ -244,9 +244,9 @@ com.sun.management.jmxremote.authenticate=false
 # com.sun.management.jmxremote.password.file=filepath
 #      Specifies location for password file
 #      This is optional - default location is
-#      $JRE/lib/management/jmxremote.password
-# 
-#      If the property "com.sun.management.jmxremote.authenticate" is set to 
+#      $JRE/conf/management/jmxremote.password
+#
+#      If the property "com.sun.management.jmxremote.authenticate" is set to
 #      false, then this property and the password & access files are ignored.
 #      Otherwise the password file must exist and be in the valid format.
 #      If the password file is empty or non-existent then no access is allowed.
@@ -261,9 +261,9 @@ com.sun.management.jmxremote.authenticate=false
 # com.sun.management.jmxremote.access.file=filepath
 #      Specifies location for access  file
 #      This is optional - default location is
-#      $JRE/lib/management/jmxremote.access
-# 
-#      If the property "com.sun.management.jmxremote.authenticate" is set to 
+#      $JRE/conf/management/jmxremote.access
+#
+#      If the property "com.sun.management.jmxremote.authenticate" is set to
 #      false, then this property and the password & access files are ignored.
 #      Otherwise, the access file must exist and be in the valid format.
 #      If the access file is empty or non-existent then no access is allowed.
diff --git a/jdk/test/sun/net/www/protocol/jar/getcontenttype.sh b/jdk/test/sun/net/www/protocol/jar/getcontenttype.sh
index a3a1a2a1310..8a942998a70 100644
--- a/jdk/test/sun/net/www/protocol/jar/getcontenttype.sh
+++ b/jdk/test/sun/net/www/protocol/jar/getcontenttype.sh
@@ -32,6 +32,20 @@ fi
 if [ x"$TESTCLASSES" = x ]; then TESTCLASSES=.; fi
 if [ x"$TESTSRC" = x ]; then TESTSRC=.; fi
 
-# now start the test
-${TESTJAVA}/bin/java ${TESTVMOPTS} -Djava.ext.dirs=$TESTSRC -cp $TESTCLASSES GetContentType
+OS=`uname -s`;
+# Set classpath separator
+case "$OS" in
+        Windows* | CYGWIN* )
+        SEP=";"
+        FS="\\"
+        ;;
+
+        * )
+        SEP=":"
+        FS="/"
+        ;;
+esac
+
+# now start the test
+${TESTJAVA}/bin/java ${TESTVMOPTS} -cp ${TESTSRC}${FS}resource.jar${SEP}${TESTCLASSES} GetContentType
 
diff --git a/jdk/test/sun/net/www/protocol/jrt/Basic.java b/jdk/test/sun/net/www/protocol/jrt/Basic.java
new file mode 100644
index 00000000000..82d15fc197e
--- /dev/null
+++ b/jdk/test/sun/net/www/protocol/jrt/Basic.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @summary Basic test of jimage protocol handler
+ * @run testng Basic
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URL;
+import java.net.URLConnection;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import static org.testng.Assert.*;
+
+public class Basic {
+
+    @DataProvider(name = "resources")
+    public Object[][] resources() {
+        Object[][] data = {
+            { "java/lang/Object.class",   "jrt:/java.base/java/lang/Object.class" },
+            { "java/awt/Component.class", "jrt:/java.desktop/java/awt/Component.class" },
+            { "jdk/internal/DoesNotExist", null },
+        };
+        return data;
+    }
+
+    @Test(dataProvider = "resources")
+    public void testResources(String name, String expectedUrlString) throws Exception {
+        URL url = ClassLoader.getSystemResource(name);
+        if (url == null) {
+            assertTrue(expectedUrlString == null);
+        } else {
+            assertEquals(url.toString(), expectedUrlString);
+        }
+    }
+
+    @DataProvider(name = "urls")
+    public Object[][] urls() {
+        Object[][] data = {
+            { "jrt:/java.base/java/lang/Object.class",    true },
+            { "jrt:/java.desktop/java/lang/Object.class", false },
+        };
+        return data;
+    }
+
+    @Test(dataProvider = "urls")
+    public void testConnect(String urlString, boolean exists) throws Exception {
+        URL url = new URL(urlString);
+        URLConnection uc = url.openConnection();
+        try {
+            uc.connect();
+            if (!exists) fail("IOException expected");
+        } catch (IOException ioe) {
+            if (exists) fail("IOException not expected");
+        }
+    }
+
+    @Test(dataProvider = "urls")
+    public void testInputStream(String urlString, boolean exists) throws Exception {
+        URL url = new URL(urlString);
+        URLConnection uc = url.openConnection();
+        try {
+            int b = uc.getInputStream().read();
+            assertTrue(b != -1);
+            if (!exists) fail("IOException expected");
+        } catch (IOException ioe) {
+            if (exists) fail("IOException not expected");
+        }
+    }
+
+    @Test(dataProvider = "urls")
+    public void testContentLength(String urlString, boolean exists) throws Exception {
+        URL url = new URL(urlString);
+        int len = url.openConnection().getContentLength();
+        assertTrue((exists && len > 0) || (!exists && len == -1));
+    }
+
+    @Test(dataProvider = "urls")
+    public void testGetContent(String urlString, boolean exists) throws Exception {
+        URL url = new URL(urlString);
+        try {
+            Object obj = url.getContent();
+            assertTrue(obj != null);
+            if (!exists) fail("IOException expected");
+        } catch (IOException ioe) {
+            if (exists) fail("IOException not expected");
+        }
+    }
+}
diff --git a/jdk/test/sun/net/www/protocol/jrt/WithSecurityManager.java b/jdk/test/sun/net/www/protocol/jrt/WithSecurityManager.java
new file mode 100644
index 00000000000..58678d7bc3c
--- /dev/null
+++ b/jdk/test/sun/net/www/protocol/jrt/WithSecurityManager.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * @test
+ * @summary Test that the jimage protocol handler works with a security manager
+ * @run main/othervm WithSecurityManager allow
+ * @run main/othervm WithSecurityManager deny
+ */
+
+import java.io.InputStream;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+
+public class WithSecurityManager {
+    public static void main(String[] args) throws Exception {
+        String home = System.getProperty("java.home");
+        Path bootmodules = Paths.get(home, "lib", "modules", "bootmodules.jimage");
+        if (Files.notExists(bootmodules)) {
+            System.out.println("This runtime is not jimage, test skipped");
+            return;
+        }
+
+        boolean allow = args[0].equals("allow");
+
+        // set security policy to allow access
+        if (allow) {
+            String testSrc = System.getProperty("test.src");
+            if (testSrc == null)
+                testSrc = ".";
+            Path policyFile = Paths.get(testSrc, "java.policy");
+            System.setProperty("java.security.policy", policyFile.toString());
+        }
+
+        System.setSecurityManager(new SecurityManager());
+
+        InputStream in = ClassLoader.getSystemResourceAsStream("java/lang/Object.class");
+        if (in == null && allow)
+            throw new RuntimeException("access expected");
+        if (in != null && !allow)
+            throw new RuntimeException("access not expected");
+    }
+}
diff --git a/jdk/test/sun/net/www/protocol/jrt/java.policy b/jdk/test/sun/net/www/protocol/jrt/java.policy
new file mode 100644
index 00000000000..5df300aa905
--- /dev/null
+++ b/jdk/test/sun/net/www/protocol/jrt/java.policy
@@ -0,0 +1,3 @@
+grant {
+    permission java.io.FilePermission "${java.home}/-", "read";
+};
diff --git a/jdk/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java b/jdk/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java
index 6e2fb6e4c34..3b778f3f99e 100644
--- a/jdk/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java
+++ b/jdk/test/sun/rmi/rmic/RMIGenerator/RmicDefault.java
@@ -48,12 +48,6 @@ public class RmicDefault {
         String testclasses = System.getProperty("test.classes");
         String userDir = System.getProperty("user.dir");
 
-        if (javahome.regionMatches(true, javahome.length() - 4,
-                                   File.separator + "jre", 0, 4))
-        {
-            javahome = javahome.substring(0, javahome.length() - 4);
-        }
-
         Process javacProcess = Runtime.getRuntime().exec(
             javahome + File.separator + "bin" + File.separator +
             "javac -d " + testclasses + " " +
diff --git a/jdk/test/sun/rmi/rmic/classpath/RMICClassPathTest.java b/jdk/test/sun/rmi/rmic/classpath/RMICClassPathTest.java
index cecdfb7ec43..7abfe8adce5 100644
--- a/jdk/test/sun/rmi/rmic/classpath/RMICClassPathTest.java
+++ b/jdk/test/sun/rmi/rmic/classpath/RMICClassPathTest.java
@@ -41,12 +41,11 @@ public class RMICClassPathTest {
     private final static String SRC_PATH = System.getProperty("test.src", ".");
     public static void main(String[] args) throws Exception {
         String sysPath = SRC_PATH + "/jdk/jre/lib/rt.jar";
-        String extDir = "";
         String clPath = SRC_PATH + "/user.jar" + File.pathSeparator +
             SRC_PATH + "/user2.jar" + File.pathSeparator +
             SRC_PATH + "/user3.jar";
 
-        String cpStr = BatchEnvironment.createClassPath(clPath, sysPath, extDir).toString();
+        String cpStr = BatchEnvironment.createClassPath(clPath, sysPath).toString();
 
         String[] paths = cpStr.split(File.pathSeparator);
 
diff --git a/jdk/test/sun/rmi/rmic/manifestClassPath/run.sh b/jdk/test/sun/rmi/rmic/manifestClassPath/run.sh
index 2dca19b4d18..e43d2c5e370 100644
--- a/jdk/test/sun/rmi/rmic/manifestClassPath/run.sh
+++ b/jdk/test/sun/rmi/rmic/manifestClassPath/run.sh
@@ -122,19 +122,6 @@ Success "$javac" -classpath "jars/sub/B.zip"       Main.java MainI.java
 Success "$rmic"  -classpath "jars/sub/B.zip${PS}." Main
 Success "$java" ${TESTVMOPTS}  -classpath "jars/sub/B.zip${PS}." Main
 
-#Sys rm -f Main.class MainI.class Main_Stub.class
-Sys rm -f Main_Stub.class				# javac -extdirs workaround
-
-#Success "$javac" -extdirs "jars" -classpath None Main.java MainI.java
-Success "$rmic"  -extdirs "jars" -classpath .    Main
-Success "$java" ${TESTVMOPTS}  -Djava.ext.dirs="jars" -cp .    Main
-
-Sys rm -f Main_Stub.class
-
-#Success "$javac" -extdirs "jars/sub" -classpath None Main.java MainI.java
-Success "$rmic"  -extdirs "jars/sub" -classpath . Main
-Success "$java" ${TESTVMOPTS}  -Djava.ext.dirs="jars/sub" -cp . Main
-
 Cleanup
 
 Bottom Line
diff --git a/jdk/test/sun/tools/java/CFCTest.java b/jdk/test/sun/tools/java/CFCTest.java
index eb6921c6eb6..eebf37bb83c 100644
--- a/jdk/test/sun/tools/java/CFCTest.java
+++ b/jdk/test/sun/tools/java/CFCTest.java
@@ -91,7 +91,7 @@ public class CFCTest {
      */
     void exerciseClassDefinition() throws Exception {
         BatchEnvironment env = new BatchEnvironment(System.out,
-                BatchEnvironment.createClassPath(testClassPath, null, null),
+                BatchEnvironment.createClassPath(testClassPath, null),
                 null);
         try {
             ClassDeclaration decl = env.getClassDeclaration(
diff --git a/jdk/test/sun/tools/jconsole/ResourceCheckTest.java b/jdk/test/sun/tools/jconsole/ResourceCheckTest.java
index 1ed5bb642c7..bb8e6a4b6af 100644
--- a/jdk/test/sun/tools/jconsole/ResourceCheckTest.java
+++ b/jdk/test/sun/tools/jconsole/ResourceCheckTest.java
@@ -23,12 +23,10 @@
 
 /**
  *
- *
- *  This isn't the test case: ResourceCheckTest.sh is.
- *  Refer to ResourceCheckTest.sh when running this test.
- *
+ *  @test
  *  @bug 5008856 5023573 5024917 5062569 7172176
  *  @summary 'missing resource key' error for key = "Operating system"
+ *  @run main ResourceCheckTest
  */
 
 import java.lang.reflect.Field;
diff --git a/jdk/test/sun/tools/jconsole/ResourceCheckTest.sh b/jdk/test/sun/tools/jconsole/ResourceCheckTest.sh
deleted file mode 100644
index 796da94f1f4..00000000000
--- a/jdk/test/sun/tools/jconsole/ResourceCheckTest.sh
+++ /dev/null
@@ -1,112 +0,0 @@
-#
-# Copyright (c) 2004, 2013, 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        5023573 5062569
-#   @summary    jtreg test ResourceCheckTest.java must be
-#               able to find jconsole.jar
-#
-#   @run shell ResourceCheckTest.sh
-
-# Beginning of subroutines:
-status=1
-
-#Call this from anywhere to fail the test with an error message
-# usage: fail "reason why the test failed"
-fail() 
- { echo "The test failed :-("
-   echo "$*" 1>&2
-   echo "exit status was $status"
-   exit $status
- } #end of fail()
-
-#Call this from anywhere to pass the test with a message
-# usage: pass "reason why the test passed if applicable"
-pass() 
- { echo "The test passed!!!"
-   echo "$*" 1>&2
-   exit 0
- } #end of pass()
-
-# end of subroutines
-
-# The beginning of the script proper
-
-OS=`uname -s`
-case "$OS" in
-   SunOS | Linux | Darwin | AIX)
-      PATHSEP=":"
-      ;;
-
-   Windows* | CYGWIN*)
-      PATHSEP=";"
-      ;;
-
-   # catch all other OSs
-   * )
-      echo "Unrecognized system!  $OS"
-      fail "Unrecognized system!  $OS"
-      ;;
-esac
-
-TARGETCLASS="ResourceCheckTest"
-if [ -z "${TESTJAVA}" ] ; then
-   # TESTJAVA is not set, so the test is running stand-alone.
-   # TESTJAVA holds the path to the root directory of the build of the JDK
-   # to be tested.  That is, any java files run explicitly in this shell
-   # should use TESTJAVA in the path to the java interpreter.
-   # So, we'll set this to the JDK spec'd on the command line.  If none
-   # is given on the command line, tell the user that and use a default.
-   # THIS IS THE JDK BEING TESTED.
-   if [ -n "$1" ] ; then
-          TESTJAVA=$1
-      else
-	  TESTJAVA=$JAVA_HOME
-   fi
-   TESTSRC=.
-   TESTCLASSES=.
-   #Deal with .class files:
-fi
-#
-echo "JDK under test is: $TESTJAVA"
-#
-CP="-classpath ${TESTCLASSES}${PATHSEP}${TESTJAVA}/lib/jconsole.jar"
-# Compile the test class using the classpath we need:
-#
-env
-#
-set -vx
-#
-#Compile.  jconsole.jar is required on the classpath.
-${TESTJAVA}/bin/javac -d "${TESTCLASSES}" ${CP} -g \
-                         "${TESTSRC}"/"${TARGETCLASS}".java
-#
-#Run the test class, again with the classpath we need:
-${TESTJAVA}/bin/java ${TESTVMOPTS} ${CP} ${TARGETCLASS}
-status=$?
-echo "test status was: $status"
-if [ $status -eq "0" ];
-   then pass ""
-
-   else fail "unspecified test failure"
-fi
diff --git a/jdk/test/sun/tools/native2ascii/resources/ImmutableResourceTest.java b/jdk/test/sun/tools/native2ascii/resources/ImmutableResourceTest.java
index 84e6a006d96..2a00ab813f4 100644
--- a/jdk/test/sun/tools/native2ascii/resources/ImmutableResourceTest.java
+++ b/jdk/test/sun/tools/native2ascii/resources/ImmutableResourceTest.java
@@ -23,12 +23,10 @@
 
 /**
  *
- *
- *  This isn't the test case: ImmutableResourceTest.sh is.
- *  Refer to ImmutableResourceTest.sh when running this test.
- *
+ *  @test
  *  @bug        6287579
  *  @summary    SubClasses of ListResourceBundle should fix getContents()
+ *  @run main ImmutableResourceTest
  *
  *  @author Tim Bell
  *
diff --git a/jdk/test/sun/tools/native2ascii/resources/ImmutableResourceTest.sh b/jdk/test/sun/tools/native2ascii/resources/ImmutableResourceTest.sh
deleted file mode 100644
index bd22582beb1..00000000000
--- a/jdk/test/sun/tools/native2ascii/resources/ImmutableResourceTest.sh
+++ /dev/null
@@ -1,114 +0,0 @@
-#
-# Copyright (c) 2005, 2012, 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        6287579
-#   @summary    SubClasses of ListResourceBundle should fix getContents()
-#   @author     Tim Bell
-#
-#   @run shell ImmutableResourceTest.sh
-#
-#
-
-# Beginning of subroutines:
-status=1
-
-#Call this from anywhere to fail the test with an error message
-# usage: fail "reason why the test failed"
-fail()
- { echo "The test failed :-("
-   echo "$*" 1>&2
-   echo "exit status was $status"
-   exit $status
- } #end of fail()
-
-#Call this from anywhere to pass the test with a message
-# usage: pass "reason why the test passed if applicable"
-pass()
- { echo "The test passed!!!"
-   echo "$*" 1>&2
-   exit 0
- } #end of pass()
-
-# end of subroutines
-
-# The beginning of the script proper
-
-OS=`uname -s`
-case "$OS" in
-   SunOS | Linux | Darwin | AIX )
-      PATHSEP=":"
-      ;;
-
-   Windows* | CYGWIN*)
-      PATHSEP=";"
-      ;;
-
-   # catch all other OSs
-   * )
-      echo "Unrecognized system!  $OS"
-      fail "Unrecognized system!  $OS"
-      ;;
-esac
-
-TARGETCLASS="ImmutableResourceTest"
-if [ -z "${TESTJAVA}" ] ; then
-   # TESTJAVA is not set, so the test is running stand-alone.
-   # TESTJAVA holds the path to the root directory of the build of the JDK
-   # to be tested.  That is, any java files run explicitly in this shell
-   # should use TESTJAVA in the path to the java interpreter.
-   # So, we'll set this to the JDK spec'd on the command line.  If none
-   # is given on the command line, tell the user that and use a default.
-   # THIS IS THE JDK BEING TESTED.
-   if [ -n "$1" ] ; then
-          TESTJAVA=$1
-      else
-          TESTJAVA=$JAVA_HOME
-   fi
-   TESTSRC=.
-   TESTCLASSES=.
-   #Deal with .class files:
-fi
-#
-echo "JDK under test is: $TESTJAVA"
-#
-CP="-classpath ${TESTCLASSES}${PATHSEP}${TESTJAVA}/lib/tools.jar"
-# Compile the test class using the classpath we need:
-#
-env
-#
-set -vx
-#
-#Compile.  tools.jar is required on the classpath.
-${TESTJAVA}/bin/javac -d "${TESTCLASSES}" ${CP} -g \
-                         "${TESTSRC}"/"${TARGETCLASS}".java
-#
-#Run the test class, again with the classpath we need:
-${TESTJAVA}/bin/java ${TESTVMOPTS} ${CP} ${TARGETCLASS}
-status=$?
-echo "test status was: $status"
-if [ $status -eq "0" ];
-   then pass ""
-
-   else fail "unspecified test failure"
-fi
diff --git a/jdk/test/tools/jar/LeadingGarbage.java b/jdk/test/tools/jar/LeadingGarbage.java
index f6483346946..f983093385e 100644
--- a/jdk/test/tools/jar/LeadingGarbage.java
+++ b/jdk/test/tools/jar/LeadingGarbage.java
@@ -46,8 +46,7 @@ import org.testng.annotations.Test;
 @Test
 public class LeadingGarbage {
     final String jar =
-        Paths.get(new File(System.getProperty("java.home")).getParent(),
-                  "bin", "jar").toString();
+        Paths.get(System.getProperty("java.home"), "bin", "jar").toString();
     final File[] files = { new File("a"), new File("b") };
     final File normalZip = new File("normal.zip");
     final File leadingGarbageZip = new File("leadingGarbage.zip");
diff --git a/jdk/test/tools/launcher/VersionCheck.java b/jdk/test/tools/launcher/VersionCheck.java
index c18e5813990..59e0973b468 100644
--- a/jdk/test/tools/launcher/VersionCheck.java
+++ b/jdk/test/tools/launcher/VersionCheck.java
@@ -46,13 +46,16 @@ public class VersionCheck extends TestHelper {
         "java-rmi",
         "java-rmi.cgi",
         "java",
+        "javacpl",
         "javaw",
         "javaws",
         "jcontrol",
         "jmc",
         "jmc.ini",
+        "jp2launcher",
         "jvisualvm",
         "packager",
+        "ssvagent",
         "unpack200",
         "wsimport"
     };
@@ -71,6 +74,7 @@ public class VersionCheck extends TestHelper {
         "jconsole",
         "jcontrol",
         "jdeps",
+        "jimage",
         "jinfo",
         "jmap",
         "jmc",
@@ -78,6 +82,7 @@ public class VersionCheck extends TestHelper {
         "jps",
         "jrunscript",
         "jjs",
+        "jp2launcher",
         "jsadebugd",
         "jstack",
         "jstat",
@@ -98,6 +103,7 @@ public class VersionCheck extends TestHelper {
         "schemagen", // returns error code 127
         "serialver",
         "servertool",
+        "ssvagent",
         "tnameserv",
         "unpack200",
         "wsgen",
diff --git a/jdk/test/tools/pack200/CommandLineTests.java b/jdk/test/tools/pack200/CommandLineTests.java
index 2a53b309046..d2904b70ea1 100644
--- a/jdk/test/tools/pack200/CommandLineTests.java
+++ b/jdk/test/tools/pack200/CommandLineTests.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,6 +24,7 @@
 /*
  * @test CommandLineTests.sh
  * @bug  6521334 6965836 6965836
+ * @ignore 8059906
  * @compile -XDignore.symbol.file CommandLineTests.java Pack200Test.java
  * @run main/timeout=1200 CommandLineTests
  * @summary An ad hoc test to verify the behavior of pack200/unpack200 CLIs,
diff --git a/jdk/test/tools/pack200/Pack200Props.java b/jdk/test/tools/pack200/Pack200Props.java
index 50fb0b14743..e9d14322907 100644
--- a/jdk/test/tools/pack200/Pack200Props.java
+++ b/jdk/test/tools/pack200/Pack200Props.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, 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
@@ -54,9 +54,9 @@ public class Pack200Props {
         Utils.cleanup();
     }
 
-    static void verifySegmentLimit(File outFile) {
+    static void verifySegmentLimit(File outFile) throws IOException {
         File sdkHome = Utils.JavaSDK;
-        File testJar = new File(new File(sdkHome, "lib"), "tools.jar");
+        File testJar = Utils.createRtJar();
 
         System.out.println("using pack200: " + Utils.getPack200Cmd());
 
diff --git a/jdk/test/tools/pack200/Pack200Test.java b/jdk/test/tools/pack200/Pack200Test.java
index b4226f2845a..5d7fc105745 100644
--- a/jdk/test/tools/pack200/Pack200Test.java
+++ b/jdk/test/tools/pack200/Pack200Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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
@@ -126,8 +126,7 @@ public class Pack200Test {
     public static void main(String[] args) throws IOException {
         // select the jars carefully, adding more jars will increase the
         // testing time, especially for jprt.
-        jarList.add(Utils.locateJar("tools.jar"));
-        jarList.add(Utils.locateJar("rt.jar"));
+        jarList.add(Utils.createRtJar());
         jarList.add(Utils.locateJar("golden.jar"));
         System.out.println(jarList);
         doPackUnpack();
diff --git a/jdk/test/tools/pack200/PackageVersionTest.java b/jdk/test/tools/pack200/PackageVersionTest.java
index 20a602bfad9..208c3ca70db 100644
--- a/jdk/test/tools/pack200/PackageVersionTest.java
+++ b/jdk/test/tools/pack200/PackageVersionTest.java
@@ -54,10 +54,6 @@ public class PackageVersionTest {
     public final static int JAVA7_PACKAGE_MINOR_VERSION = 1;
 
     public static void main(String... args) throws IOException {
-        if (!javaHome.getName().endsWith("jre")) {
-            throw new RuntimeException("Error: requires an SDK to run");
-        }
-
         File out = new File("test.pack");
         createClassFile("Test6");
         createClassFile("Test7");
diff --git a/jdk/test/tools/pack200/T7007157.java b/jdk/test/tools/pack200/T7007157.java
index 29a8ca7fc1f..fa88b4c5fb4 100644
--- a/jdk/test/tools/pack200/T7007157.java
+++ b/jdk/test/tools/pack200/T7007157.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,7 +38,8 @@ public class T7007157 {
 
     public static void main(String... args) throws IOException {
         File sdkHome = Utils.JavaSDK;
-        File testJar = new File(new File(sdkHome, "lib"), "tools.jar");
+        File testJar = new File("test.jar");
+        Utils.jar("cvf", testJar.getName(), Utils.TEST_CLS_DIR.getAbsolutePath());
         JarFile jarFile = new JarFile(testJar);
         File packFile = new File("foo.pack");
         Pack200.Packer packer = Pack200.newPacker();
diff --git a/jdk/test/tools/pack200/Utils.java b/jdk/test/tools/pack200/Utils.java
index b1bc2f894b1..c46d2f0ecc4 100644
--- a/jdk/test/tools/pack200/Utils.java
+++ b/jdk/test/tools/pack200/Utils.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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
@@ -54,8 +54,7 @@ import static java.nio.file.StandardOpenOption.*;
  */
 
 /*
- * This class contains all the commonly used utilities used by various tests
- * in this directory.
+ * This class contains the commonly used utilities.
  */
 class Utils {
     static final String JavaHome = System.getProperty("test.java",
@@ -79,12 +78,6 @@ class Utils {
 
     private Utils() {} // all static
 
-    static {
-        if (!JavaHome.endsWith("jre")) {
-            throw new RuntimeException("Error: requires an SDK to run");
-        }
-    }
-
     private static void init() throws IOException {
         if (VerifierJar.exists()) {
             return;
@@ -137,8 +130,7 @@ class Utils {
         List<String> cmds = new ArrayList<String>();
         cmds.add(getJavaCmd());
         cmds.add("-cp");
-        cmds.add(Utils.locateJar("tools.jar") +
-                System.getProperty("path.separator") + VerifierJar.getName());
+        cmds.add(VerifierJar.getName());
         cmds.add("sun.tools.pack.verify.Main");
         cmds.add(reference.getAbsolutePath());
         cmds.add(specimen.getAbsolutePath());
@@ -152,8 +144,7 @@ class Utils {
         List<String> cmds = new ArrayList<String>();
         cmds.add(getJavaCmd());
         cmds.add("-cp");
-        cmds.add(Utils.locateJar("tools.jar")
-                + System.getProperty("path.separator") + VerifierJar.getName());
+        cmds.add(VerifierJar.getName());
         cmds.add("sun.tools.pack.verify.Main");
         cmds.add(reference.getName());
         cmds.add(specimen.getName());
@@ -343,17 +334,21 @@ class Utils {
     }
 
     static void compiler(String... javacCmds) {
-        if (com.sun.tools.javac.Main.compile(javacCmds) != 0) {
-            throw new RuntimeException("compilation failed");
+        List<String> cmdList = new ArrayList<>();
+        cmdList.add(getJavacCmd());
+        for (String x : javacCmds) {
+            cmdList.add(x);
         }
+        runExec(cmdList);
     }
 
     static void jar(String... jargs) {
-        sun.tools.jar.Main jarTool =
-                new sun.tools.jar.Main(System.out, System.err, "jartool");
-        if (!jarTool.run(jargs)) {
-            throw new RuntimeException("jar command failed");
+        List<String> cmdList = new ArrayList<>();
+        cmdList.add(getJarCmd());
+        for (String x : jargs) {
+            cmdList.add(x);
         }
+        runExec(cmdList);
     }
 
     static void testWithRepack(File inFile, String... repackOpts) throws IOException {
@@ -528,6 +523,18 @@ class Utils {
         return getAjavaCmd("java");
     }
 
+    static String getJavacCmd() {
+        return getAjavaCmd("javac");
+    }
+
+    static String getJarCmd() {
+        return getAjavaCmd("jar");
+    }
+
+    static String getJimageCmd() {
+        return getAjavaCmd("jimage");
+    }
+
     static String getAjavaCmd(String cmdStr) {
         File binDir = new File(JavaHome, "bin");
         File unpack200File = IsWindows
@@ -542,6 +549,31 @@ class Utils {
         return cmd;
     }
 
+    static File createRtJar() throws IOException {
+        File LibDir = new File(JavaHome, "lib");
+        File ModuleDir = new File(LibDir, "modules");
+        File BootModules = new File(ModuleDir, "bootmodules.jimage");
+        List<String> cmdList = new ArrayList<>();
+        cmdList.add(getJimageCmd());
+        cmdList.add("extract");
+        cmdList.add(BootModules.getAbsolutePath());
+        cmdList.add("--dir");
+        cmdList.add("out");
+        runExec(cmdList);
+
+        File rtJar = new File("rt.jar");
+        cmdList.clear();
+        cmdList.add(getJarCmd());
+        cmdList.add("cvf");
+        cmdList.add(rtJar.getName());
+        cmdList.add("-C");
+        cmdList.add("out");
+        cmdList.add(".");
+        runExec(cmdList);
+
+        recursiveDelete(new File("out"));
+        return rtJar;
+    }
     private static List<File> locaterCache = null;
     // search the source dir and jdk dir for requested file and returns
     // the first location it finds.
diff --git a/jdk/test/tools/pack200/pack200-verifier/src/sun/tools/pack/verify/Globals.java b/jdk/test/tools/pack200/pack200-verifier/src/sun/tools/pack/verify/Globals.java
index 2a51474bfde..ed439dc991a 100644
--- a/jdk/test/tools/pack200/pack200-verifier/src/sun/tools/pack/verify/Globals.java
+++ b/jdk/test/tools/pack200/pack200-verifier/src/sun/tools/pack/verify/Globals.java
@@ -170,7 +170,6 @@ class Globals {
         println("\tjava.home=" + System.getProperty("java.home"));
         println("\tjava.class.version=" + System.getProperty("java.class.version"));
         println("\tjava.class.path=" + System.getProperty("java.class.path"));
-        println("\tjava.ext.dirs=" + System.getProperty("java.ext.dirs"));
         println("\tos.name=" + System.getProperty("os.name"));
         println("\tos.arch=" + System.getProperty("os.arch"));
         println("\tos.version=" + System.getProperty("os.version"));

From 8bc2b3ff3a92b1f8a66745f98c399f8165027fc7 Mon Sep 17 00:00:00 2001
From: Chris Hegarty <chegar@openjdk.org>
Date: Wed, 3 Dec 2014 14:25:46 +0000
Subject: [PATCH 214/299] 8049367: Modular Run-Time Images

Co-authored-by: Alan Bateman <alan.bateman@oracle.com>
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Bradford Wetmore <bradford.wetmore@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Magnus Ihse Bursie <magnus.ihse.bursie@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Paul Sandoz <paul.sandoz@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: jlahoda, ksrini
---
 langtools/make/CompileInterim.gmk             |  16 +-
 langtools/make/GensrcLangtools.gmk            | 111 ---
 langtools/make/Tools.gmk                      |  45 ++
 .../Gensrc-jdk.compiler.gmk}                  |  23 +-
 .../gensrc/Gensrc-jdk.dev.gmk}                |  28 +-
 langtools/make/gensrc/Gensrc-jdk.javadoc.gmk  |  33 +
 langtools/make/gensrc/GensrcCommon.gmk        |  95 +++
 .../tools/crules/MutableFieldsAnalyzer.java   |   3 +
 .../classes/javax/tools/ToolProvider.java     |  75 +-
 .../tools/javac/api/ClientCodeWrapper.java    |  99 ++-
 .../com/sun/tools/javac/code/ClassFinder.java | 107 ++-
 .../com/sun/tools/javac/file/JRTIndex.java    | 272 +++++++
 .../tools/javac/file/JavacFileManager.java    | 177 +++--
 .../com/sun/tools/javac/file/Locations.java   | 114 ++-
 .../sun/tools/javac/file/RelativePath.java    |  17 +-
 .../sun/tools/javac/file/SymbolArchive.java   | 107 ---
 .../com/sun/tools/javac/jvm/ClassReader.java  |  16 +-
 .../tools/javac/nio/JavacPathFileManager.java |   5 +-
 .../sun/tools/javac/nio/PathFileObject.java   |  45 +-
 .../sun/tools/javac/resources/ct.properties   | 749 ++++++++++++++++++
 .../sun/tools/javac/util/BaseFileManager.java |   5 +
 .../com/sun/tools/javap/JavapTask.java        |   3 +-
 .../tools/sjavac/comp/SmartFileManager.java   |   1 +
 .../classes/com/sun/tools/jdeps/Archive.java  |   9 +-
 .../com/sun/tools/jdeps/ClassFileReader.java  |  70 +-
 .../com/sun/tools/jdeps/JdepsTask.java        |   5 +-
 .../classes/com/sun/tools/jdeps/Module.java   |   7 +-
 .../com/sun/tools/jdeps/ModulesXmlReader.java |  86 +-
 .../sun/tools/jdeps/PlatformClassPath.java    | 310 ++------
 .../classes/com/sun/tools/jdeps/Profile.java  |  57 +-
 .../TestCompletionFailure.java                |   4 +-
 .../apt/Basics/CheckAptIsRemovedTest.java     |  94 ---
 .../test/tools/doclint/tool/PathsTest.java    |  24 +-
 .../javac/6508981/TestInferBinaryName.java    |  26 +-
 .../test/tools/javac/EarlyAssertWrapper.java  |   8 +-
 .../test/tools/javac/Paths/Class-Path.sh      |  12 +-
 .../test/tools/javac/Paths/Class-Path2.sh     |   8 +-
 .../test/tools/javac/Paths/CompileClose.java  |  77 --
 .../test/tools/javac/Paths/Diagnostics.sh     |  47 +-
 langtools/test/tools/javac/Paths/MineField.sh | 334 ++++----
 langtools/test/tools/javac/Paths/SameJVM.java |  66 --
 langtools/test/tools/javac/Paths/Util.sh      |  52 +-
 langtools/test/tools/javac/T6558476.java      |   2 +-
 langtools/test/tools/javac/T6654037.java      |   5 +-
 langtools/test/tools/javac/T6705935.java      |   2 -
 langtools/test/tools/javac/T6725036.java      |  60 +-
 langtools/test/tools/javac/T6873845.java      |  10 +-
 .../TestAnnotationPackageInfo.java            |   6 +-
 .../test/tools/javac/api/6411310/Test.java    | 232 ------
 .../tools/javac/api/6598108/T6598108.java     |   5 +-
 .../tools/javac/api/6608214/T6608214.java     |   5 +-
 langtools/test/tools/javac/api/T6412669.java  |  21 +-
 langtools/test/tools/javac/api/T6430241.java  | 457 ++++++-----
 langtools/test/tools/javac/api/T6877206.java  |  25 +-
 .../tools/javac/api/TestJavacTaskScanner.java |  24 +-
 .../test/tools/javac/api/TestSearchPaths.java |  20 +-
 .../tools/javac/diags/CheckResourceKeys.java  |   3 +-
 .../javac/diags/examples/NotInProfile.java    |   2 +-
 .../test/tools/javac/lib/CompileFail.java     |   3 +-
 .../javac/nio/compileTest/CompileTest.java    | 169 ----
 .../javac/nio/compileTest/HelloPathWorld.java |  28 -
 .../model/testgetallmembers/Main.java         |  23 -
 .../TestWithXstdout.java                      |   2 -
 .../javac/profiles/ProfileOptionTest.java     |   8 +-
 .../test/tools/javadoc/6942366/T6942366.java  |   8 -
 .../tools/javadoc/6964914/TestUserDoclet.java |   2 -
 .../api/basic/GetTask_FileManagerTest.java    |  59 +-
 langtools/test/tools/javah/T5070898.java      |   8 +-
 langtools/test/tools/javah/T6893943.java      |   6 +-
 .../tools/javah/compareTest/CompareTest.java  | 265 -------
 .../javah/compareTest/FindNativeFiles.java    |  86 --
 langtools/test/tools/javah/compareTest/README |  16 -
 langtools/test/tools/javap/T6729471.java      |  43 +-
 .../test/tools/javap/WhitespaceTest.java      |   7 +-
 langtools/test/tools/jdeps/APIDeps.java       |  21 -
 langtools/test/tools/jdeps/Basic.java         |  21 -
 langtools/test/tools/jdeps/DotFileTest.java   |  21 -
 .../test/tools/jdeps/profiles.properties      | 263 ------
 langtools/test/tools/lib/ToolBox.java         |  47 +-
 .../test/tools/sjavac/OptionDecoding.java     |   9 +-
 80 files changed, 2575 insertions(+), 2861 deletions(-)
 delete mode 100644 langtools/make/GensrcLangtools.gmk
 create mode 100644 langtools/make/Tools.gmk
 rename langtools/make/{CommonLangtools.gmk => gensrc/Gensrc-jdk.compiler.gmk} (69%)
 rename langtools/{test/tools/javah/compareTest/CompareTest.sh => make/gensrc/Gensrc-jdk.dev.gmk} (54%)
 create mode 100644 langtools/make/gensrc/Gensrc-jdk.javadoc.gmk
 create mode 100644 langtools/make/gensrc/GensrcCommon.gmk
 create mode 100644 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java
 delete mode 100644 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/SymbolArchive.java
 create mode 100644 langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/ct.properties
 delete mode 100644 langtools/test/tools/apt/Basics/CheckAptIsRemovedTest.java
 delete mode 100644 langtools/test/tools/javac/Paths/CompileClose.java
 delete mode 100644 langtools/test/tools/javac/Paths/SameJVM.java
 delete mode 100644 langtools/test/tools/javac/api/6411310/Test.java
 delete mode 100644 langtools/test/tools/javac/nio/compileTest/CompileTest.java
 delete mode 100644 langtools/test/tools/javac/nio/compileTest/HelloPathWorld.java
 delete mode 100644 langtools/test/tools/javah/compareTest/CompareTest.java
 delete mode 100644 langtools/test/tools/javah/compareTest/FindNativeFiles.java
 delete mode 100644 langtools/test/tools/javah/compareTest/README
 delete mode 100644 langtools/test/tools/jdeps/profiles.properties

diff --git a/langtools/make/CompileInterim.gmk b/langtools/make/CompileInterim.gmk
index 1a5efd2aedf..d3c78279b2a 100644
--- a/langtools/make/CompileInterim.gmk
+++ b/langtools/make/CompileInterim.gmk
@@ -29,9 +29,9 @@ default: all
 include $(SPEC)
 include MakeBase.gmk
 include JavaCompilation.gmk
+include SetupJavaCompilers.gmk
 
-include CommonLangtools.gmk
-
+################################################################################
 # Setup the rules to build the interim langtools jar, which is compiled by
 # the boot javac and can be run on the boot jdk. This will be used to compile
 # the rest of the product. Include the Genstubs build tool in this compilation
@@ -44,12 +44,12 @@ $(eval $(call SetupJavaCompilation,BUILD_INTERIM_LANGTOOLS, \
       $(LANGTOOLS_TOPDIR)/src/jdk.dev/share/classes \
       $(LANGTOOLS_TOPDIR)/src/jdk.javadoc/share/classes \
       $(LANGTOOLS_TOPDIR)/src/java.base/share/classes \
-      $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler \
-      $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.dev \
-      $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.javadoc, \
-    EXCLUDES := com/sun/tools/javac/nio compileproperties anttasks crules, \
-    COPY := $(RESOURCE_SUFFIXES) jdeps.properties jdkinternals.properties version.properties, \
-    BIN := $(LANGTOOLS_OUTPUTDIR)/interim_classes, \
+      $(SUPPORT_OUTPUTDIR)/gensrc/jdk.compiler \
+      $(SUPPORT_OUTPUTDIR)/gensrc/jdk.dev \
+      $(SUPPORT_OUTPUTDIR)/gensrc/jdk.javadoc, \
+    EXCLUDES := sun jdk, \
+    COPY := .gif .xml .css .js javax.tools.JavaCompilerTool, \
+    BIN := $(BUILDTOOLS_OUTPUTDIR)/langtools_interim_classes, \
     JAR := $(INTERIM_LANGTOOLS_JAR)))
 
 all: $(BUILD_INTERIM_LANGTOOLS)
diff --git a/langtools/make/GensrcLangtools.gmk b/langtools/make/GensrcLangtools.gmk
deleted file mode 100644
index 7afde739408..00000000000
--- a/langtools/make/GensrcLangtools.gmk
+++ /dev/null
@@ -1,111 +0,0 @@
-#
-# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.  Oracle designates this
-# particular file as subject to the "Classpath" exception as provided
-# by Oracle in the LICENSE file that accompanied this code.
-#
-# This code is distributed in the hope that it will be useful, but WITHOUT
-# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-# version 2 for more details (a copy is included in the LICENSE file that
-# accompanied this code).
-#
-# You should have received a copy of the GNU General Public License version
-# 2 along with this work; if not, write to the Free Software Foundation,
-# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-#
-# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-# or visit www.oracle.com if you need additional information or have any
-# questions.
-#
-
-# This must be the first rule
-default: all
-
-include $(SPEC)
-include MakeBase.gmk
-include JavaCompilation.gmk
-
-include CommonLangtools.gmk
-
-################################################################################
-# Setup the compilation of the properties compilation tool. You can depend
-# upon $(BUILD_TOOLS_LANGTOOLS) to trigger a compilation of the tools. Note that 
-# we add src/share/classes to the sourcepath. This is necessary since the 
-# GenStubs program needs to be linked and run with the new javac sources.
-$(eval $(call SetupJavaCompilation,BUILD_TOOLS_LANGTOOLS, \
-    SETUP := BOOT_JAVAC, \
-    DISABLE_SJAVAC := true, \
-    ADD_JAVAC_FLAGS := -Xprefer:source, \
-    SRC := $(LANGTOOLS_TOPDIR)/make/tools, \
-    INCLUDES := compileproperties, \
-    BIN := $(LANGTOOLS_OUTPUTDIR)/buildtools_classes))
-
-################################################################################
-# The compileprops tools compiles a properties file into a resource bundle.
-TOOL_COMPILEPROPS_CMD := $(JAVA) -cp $(LANGTOOLS_OUTPUTDIR)/buildtools_classes \
-    compileproperties.CompileProperties -quiet
-
-# Lookup the properties that need to be compiled into resource bundles.
-PROPSOURCES := $(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/*/share/classes -name "*.properties")
-
-# Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
-# to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
-# Strip away prefix and suffix, leaving for example only: 
-# "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
-PROPJAVAS := $(patsubst $(LANGTOOLS_TOPDIR)/src/%.properties, \
-    $(LANGTOOLS_OUTPUTDIR)/gensrc/%.java, \
-    $(subst /share/classes,,$(PROPSOURCES)))
-
-# Generate the package dirs for the tobe generated java files. Sort to remove
-# duplicates.
-PROPDIRS := $(sort $(dir $(PROPJAVAS)))
-
-# Now generate a sequence of:
-# "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle"
-# suitable to be fed into the CompileProperties command.
-PROPCMDLINE := $(subst _SPACE_, $(SPACE), \
-    $(join $(addprefix -compile_SPACE_, $(PROPSOURCES)), \
-    $(addsuffix _SPACE_java.util.ListResourceBundle, \
-    $(addprefix _SPACE_, $(PROPJAVAS)))))
-
-# Now setup the rule for the generation of the resource bundles.
-$(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props: $(PROPSOURCES) $(BUILD_TOOLS_LANGTOOLS)
-	$(RM) -r $(@D)/*
-	$(MKDIR) -p $(@D) $(PROPDIRS)
-	$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
-	    > $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javah/resources/version.properties
-	$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
-	    > $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javap/resources/version.properties
-	$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
-	    > $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javac/resources/version.properties
-	$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
-	    > $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.dev/com/sun/tools/jdeps/resources/version.properties
-	$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
-	    > $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.javadoc/com/sun/tools/javadoc/resources/version.properties
-	$(ECHO) Compiling $(words $(PROPSOURCES) v1 v2 v3) properties into resource bundles
-	$(TOOL_COMPILEPROPS_CMD) $(PROPCMDLINE) \
-	    -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javah/resources/version.properties \
-	        $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javah/resources/version.java \
-	        java.util.ListResourceBundle \
-	    -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javap/resources/version.properties \
-	        $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javap/resources/version.java \
-	        java.util.ListResourceBundle \
-	    -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javac/resources/version.properties \
-	        $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.compiler/com/sun/tools/javac/resources/version.java \
-	        java.util.ListResourceBundle \
-	    -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.dev/com/sun/tools/jdeps/resources/version.properties \
-	        $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.dev/com/sun/tools/jdeps/resources/version.java \
-	        java.util.ListResourceBundle \
-	    -compile $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.javadoc/com/sun/tools/javadoc/resources/version.properties \
-	        $(LANGTOOLS_OUTPUTDIR)/gensrc/jdk.javadoc/com/sun/tools/javadoc/resources/version.java \
-	        java.util.ListResourceBundle
-	$(TOUCH) $@
-
-all: $(LANGTOOLS_OUTPUTDIR)/gensrc/_the_props
-
-################################################################################
diff --git a/langtools/make/Tools.gmk b/langtools/make/Tools.gmk
new file mode 100644
index 00000000000..7e23cd122f9
--- /dev/null
+++ b/langtools/make/Tools.gmk
@@ -0,0 +1,45 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This must be the first rule
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+include SetupJavaCompilers.gmk
+
+################################################################################
+# Setup the compilation of the properties compilation tool. You can depend
+# upon $(BUILD_TOOLS_LANGTOOLS) to trigger a compilation of the tools.
+$(eval $(call SetupJavaCompilation,BUILD_TOOLS_LANGTOOLS, \
+    SETUP := BOOT_JAVAC, \
+    DISABLE_SJAVAC := true, \
+    ADD_JAVAC_FLAGS := -Xprefer:source, \
+    SRC := $(LANGTOOLS_TOPDIR)/make/tools, \
+    INCLUDES := compileproperties, \
+    BIN := $(BUILDTOOLS_OUTPUTDIR)/langtools_tools_classes))
+
+all: $(BUILD_TOOLS_LANGTOOLS)
diff --git a/langtools/make/CommonLangtools.gmk b/langtools/make/gensrc/Gensrc-jdk.compiler.gmk
similarity index 69%
rename from langtools/make/CommonLangtools.gmk
rename to langtools/make/gensrc/Gensrc-jdk.compiler.gmk
index f32a0ac2ab7..8d44ea7b3e8 100644
--- a/langtools/make/CommonLangtools.gmk
+++ b/langtools/make/gensrc/Gensrc-jdk.compiler.gmk
@@ -23,13 +23,18 @@
 # questions.
 #
 
-# The BOOT_JAVAC setup uses the boot jdk compiler to compile the tools
-# and the interim javac, to be run by the boot jdk.
-$(eval $(call SetupJavaCompiler,BOOT_JAVAC, \
-    JAVAC := $(JAVAC), \
-    SERVER_DIR := $(SJAVAC_SERVER_DIR), \
-    SERVER_JVM := $(SJAVAC_SERVER_JAVA), \
-    FLAGS := -XDignore.symbol.file=true -g -Xlint:all$(COMMA)-deprecation -Werror))
+include GensrcCommon.gmk
 
-# javax.tools.JavaCompilerTool isn't really a suffix but this gets the file copied.
-RESOURCE_SUFFIXES := .gif .xml .css .js javax.tools.JavaCompilerTool
+$(eval $(call SetupVersionProperties,JAVAC_VERSION,\
+    com/sun/tools/javac/resources/version.properties))
+
+$(eval $(call SetupVersionProperties,JAVAH_VERSION,\
+    com/sun/tools/javah/resources/version.properties))
+
+$(eval $(call SetupVersionProperties,JAVAP_VERSION,\
+    com/sun/tools/javap/resources/version.properties))
+
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES,\
+    $(JAVAC_VERSION) $(JAVAH_VERSION) $(JAVAP_VERSION)))
+
+all: $(COMPILE_PROPERTIES)
diff --git a/langtools/test/tools/javah/compareTest/CompareTest.sh b/langtools/make/gensrc/Gensrc-jdk.dev.gmk
similarity index 54%
rename from langtools/test/tools/javah/compareTest/CompareTest.sh
rename to langtools/make/gensrc/Gensrc-jdk.dev.gmk
index e9ce4cfd797..bf35d05b0d0 100644
--- a/langtools/test/tools/javah/compareTest/CompareTest.sh
+++ b/langtools/make/gensrc/Gensrc-jdk.dev.gmk
@@ -1,11 +1,12 @@
-#!/bin/sh
 #
-# Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 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.
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
 #
 # This code is distributed in the hope that it will be useful, but WITHOUT
 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
@@ -22,22 +23,11 @@
 # questions.
 #
 
-jdk=${1:-/opt/jdk/1.6.0}
-javah=${jdk}/bin/javah
-rtjar=${jdk}/jre/lib/rt.jar
+include GensrcCommon.gmk
 
-# compile test
-mkdir -p build/compareTest
-/opt/jdk/1.7.0/bin/javac -classpath build/classes -d build/compareTest test/tools/javah/compareTest/*.java
+$(eval $(call SetupVersionProperties,JDEPS_VERSION,\
+    com/sun/tools/jdeps/resources/version.properties))
 
-# run test
-/opt/jdk/1.7.0/bin/java -classpath build/compareTest:build/classes CompareTest $javah $rtjar 2>&1 | tee CompareTest.out
-
-# show diffs for tests that failed
-grep 'error:' CompareTest.out | sed -e 's|.*new/||' -e 's/\.h$//' -e 's|_|.|g' > CompareTest.classes.fail
-
-for i in $(cat CompareTest.classes.fail) ; do 
-	/opt/jdk/1.7.0/bin/java -classpath compareTest:build/classes CompareTest $javah $rtjar $i 
-	diff -r old new 
-done 
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, $(JDEPS_VERSION)))
 
+all: $(COMPILE_PROPERTIES)
diff --git a/langtools/make/gensrc/Gensrc-jdk.javadoc.gmk b/langtools/make/gensrc/Gensrc-jdk.javadoc.gmk
new file mode 100644
index 00000000000..1d9ab44b32b
--- /dev/null
+++ b/langtools/make/gensrc/Gensrc-jdk.javadoc.gmk
@@ -0,0 +1,33 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+include GensrcCommon.gmk
+
+$(eval $(call SetupVersionProperties,JAVADOC_VERSION,\
+    com/sun/tools/javadoc/resources/version.properties))
+
+$(eval $(call SetupCompileProperties,COMPILE_PROPERTIES, $(JAVADOC_VERSION)))
+
+all: $(COMPILE_PROPERTIES)
diff --git a/langtools/make/gensrc/GensrcCommon.gmk b/langtools/make/gensrc/GensrcCommon.gmk
new file mode 100644
index 00000000000..efd9d23c58d
--- /dev/null
+++ b/langtools/make/gensrc/GensrcCommon.gmk
@@ -0,0 +1,95 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation.  Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# This must be the first rule
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+
+################################################################################
+# The compileprops tools compiles a properties file into a resource bundle.
+TOOL_COMPILEPROPS_CMD := $(JAVA) -cp $(BUILDTOOLS_OUTPUTDIR)/langtools_tools_classes \
+    compileproperties.CompileProperties -quiet
+
+
+################################################################################
+# Sets up a rule that creates a version.properties file in the gensrc output
+# directory.
+# Param 1 - Variable to add generated file name to
+# Param 2 - Name of version.properties file including packages from the src
+#           root.
+define SetupVersionProperties
+  $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$$(strip $2):
+	$(MKDIR) -p $$(@D)
+	$(PRINTF) "jdk=$(JDK_VERSION)\nfull=$(FULL_VERSION)\nrelease=$(RELEASE)\n" \
+	    > $$@
+
+  $$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/$$(strip $2)
+endef
+
+################################################################################
+# Finds all properties files in the module source and creates a rule that runs
+# CompileProperties on them into the gensrc dir.
+# Param 1 - Variable to add targets to
+# Param 2 - Extra properties files to process
+define SetupCompileProperties
+  # Lookup the properties that need to be compiled into resource bundles.
+  PROPSOURCES := $2 $$(shell $(FIND) $(LANGTOOLS_TOPDIR)/src/$(MODULE)/share/classes -name "*.properties")
+
+  # Convert .../src/<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN.properties
+  # to .../langtools/gensrc/<module>/com/sun/tools/javac/resources/javac_zh_CN.java
+  # Strip away prefix and suffix, leaving for example only: 
+  # "<module>/share/classes/com/sun/tools/javac/resources/javac_zh_CN"
+  PROPJAVAS := $$(patsubst $(LANGTOOLS_TOPDIR)/src/%, \
+      $(SUPPORT_OUTPUTDIR)/gensrc/%, \
+      $$(patsubst %.properties, %.java, \
+      $$(subst /share/classes,, $$(PROPSOURCES))))
+
+  # Generate the package dirs for the tobe generated java files. Sort to remove
+  # duplicates.
+  PROPDIRS := $$(sort $$(dir $$(PROPJAVAS)))
+
+  # Now generate a sequence of:
+  # "-compile ...javac_zh_CN.properties ...javac_zh_CN.java java.util.ListResourceBundle"
+  # suitable to be fed into the CompileProperties command.
+  PROPCMDLINE := $$(subst _SPACE_, $(SPACE), \
+      $$(join $$(addprefix -compile_SPACE_, $$(PROPSOURCES)), \
+      $$(addsuffix _SPACE_java.util.ListResourceBundle, \
+      $$(addprefix _SPACE_, $$(PROPJAVAS)))))
+
+  # Now setup the rule for the generation of the resource bundles.
+  $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props: $$(PROPSOURCES)
+	$(FIND) $$(@D) -name "*.java" $(FIND_DELETE)
+	$(MKDIR) -p $$(@D) $$(PROPDIRS)
+	$(ECHO) Compiling $$(words $$(PROPSOURCES)) properties into resource bundles for $(MODULE)
+	$(TOOL_COMPILEPROPS_CMD) $$(PROPCMDLINE)
+	$(TOUCH) $$@
+
+  $$(strip $1) += $(SUPPORT_OUTPUTDIR)/gensrc/$(MODULE)/_the_props
+endef
+
+################################################################################
diff --git a/langtools/make/tools/crules/MutableFieldsAnalyzer.java b/langtools/make/tools/crules/MutableFieldsAnalyzer.java
index 95ae58f7ec0..bd81af5bfea 100644
--- a/langtools/make/tools/crules/MutableFieldsAnalyzer.java
+++ b/langtools/make/tools/crules/MutableFieldsAnalyzer.java
@@ -102,6 +102,9 @@ public class MutableFieldsAnalyzer extends AbstractCodingRulesAnalyzer {
         classFieldsToIgnoreMap.
                 put("com.sun.tools.javac.file.ZipFileIndexCache",
                     Arrays.asList("sharedInstance"));
+        classFieldsToIgnoreMap.
+                put("com.sun.tools.javac.file.JRTIndex",
+                    Arrays.asList("sharedInstance"));
         classFieldsToIgnoreMap.
                 put("com.sun.tools.javac.main.JavaCompiler",
                     Arrays.asList("versionRB"));
diff --git a/langtools/src/java.compiler/share/classes/javax/tools/ToolProvider.java b/langtools/src/java.compiler/share/classes/javax/tools/ToolProvider.java
index ccd37aa6d52..46ab0c4a415 100644
--- a/langtools/src/java.compiler/share/classes/javax/tools/ToolProvider.java
+++ b/langtools/src/java.compiler/share/classes/javax/tools/ToolProvider.java
@@ -25,17 +25,14 @@
 
 package javax.tools;
 
-import java.io.File;
 import java.lang.ref.Reference;
 import java.lang.ref.WeakReference;
-import java.net.URL;
-import java.net.URLClassLoader;
-import java.net.MalformedURLException;
 import java.util.HashMap;
 import java.util.Locale;
 import java.util.Map;
 import java.util.logging.Logger;
 import java.util.logging.Level;
+
 import static java.util.logging.Level.*;
 
 /**
@@ -89,7 +86,7 @@ public class ToolProvider {
         return null;
     }
 
-    private static final String defaultJavaCompilerName
+    private static final String systemJavaCompilerName
         = "com.sun.tools.javac.api.JavacTool";
 
     /**
@@ -99,10 +96,10 @@ public class ToolProvider {
      * {@code null} if no compiler is provided
      */
     public static JavaCompiler getSystemJavaCompiler() {
-        return instance().getSystemTool(JavaCompiler.class, defaultJavaCompilerName);
+        return instance().getSystemTool(JavaCompiler.class, systemJavaCompilerName);
     }
 
-    private static final String defaultDocumentationToolName
+    private static final String systemDocumentationToolName
         = "com.sun.tools.javadoc.api.JavadocTool";
 
     /**
@@ -112,7 +109,7 @@ public class ToolProvider {
      * {@code null} if no documentation tool is provided
      */
     public static DocumentationTool getSystemDocumentationTool() {
-        return instance().getSystemTool(DocumentationTool.class, defaultDocumentationToolName);
+        return instance().getSystemTool(DocumentationTool.class, systemDocumentationToolName);
     }
 
     /**
@@ -125,13 +122,7 @@ public class ToolProvider {
      * or {@code null} if no tools are provided
      */
     public static ClassLoader getSystemToolClassLoader() {
-        try {
-            Class<? extends JavaCompiler> c =
-                    instance().getSystemToolClass(JavaCompiler.class, defaultJavaCompilerName);
-            return c.getClassLoader();
-        } catch (Throwable e) {
-            return trace(WARNING, e);
-        }
+        return ClassLoader.getSystemClassLoader();
     }
 
 
@@ -145,12 +136,7 @@ public class ToolProvider {
 
     // Cache for tool classes.
     // Use weak references to avoid keeping classes around unnecessarily
-    private Map<String, Reference<Class<?>>> toolClasses = new HashMap<>();
-
-    // Cache for tool classloader.
-    // Use a weak reference to avoid keeping it around unnecessarily
-    private Reference<ClassLoader> refToolClassLoader = null;
-
+    private final Map<String, Reference<Class<?>>> toolClasses = new HashMap<>();
 
     private ToolProvider() { }
 
@@ -158,9 +144,8 @@ public class ToolProvider {
         Class<? extends T> c = getSystemToolClass(clazz, name);
         try {
             return c.asSubclass(clazz).newInstance();
-        } catch (Throwable e) {
-            trace(WARNING, e);
-            return null;
+        } catch (InstantiationException | IllegalAccessException | RuntimeException | Error e) {
+            return trace(WARNING, e);
         }
     }
 
@@ -169,48 +154,12 @@ public class ToolProvider {
         Class<?> c = (refClass == null ? null : refClass.get());
         if (c == null) {
             try {
-                c = findSystemToolClass(name);
-            } catch (Throwable e) {
+                c = Class.forName(name, false, ClassLoader.getSystemClassLoader());
+            } catch (ClassNotFoundException | RuntimeException | Error e) {
                 return trace(WARNING, e);
             }
-            toolClasses.put(name, new WeakReference<Class<?>>(c));
+            toolClasses.put(name, new WeakReference<>(c));
         }
         return c.asSubclass(clazz);
     }
-
-    private static final String[] defaultToolsLocation = { "lib", "tools.jar" };
-
-    private Class<?> findSystemToolClass(String toolClassName)
-        throws MalformedURLException, ClassNotFoundException
-    {
-        // try loading class directly, in case tool is on the bootclasspath
-        try {
-            return Class.forName(toolClassName, false, null);
-        } catch (ClassNotFoundException e) {
-            trace(FINE, e);
-
-            // if tool not on bootclasspath, look in default tools location (tools.jar)
-            ClassLoader cl = (refToolClassLoader == null ? null : refToolClassLoader.get());
-            if (cl == null) {
-                File file = new File(System.getProperty("java.home"));
-                if (file.getName().equalsIgnoreCase("jre"))
-                    file = file.getParentFile();
-                for (String name : defaultToolsLocation)
-                    file = new File(file, name);
-
-                // if tools not found, no point in trying a URLClassLoader
-                // so rethrow the original exception.
-                if (!file.exists())
-                    throw e;
-
-                URL[] urls = { file.toURI().toURL() };
-                trace(FINE, urls[0].toString());
-
-                cl = URLClassLoader.newInstance(urls);
-                refToolClassLoader = new WeakReference<>(cl);
-            }
-
-            return Class.forName(toolClassName, false, cl);
-        }
-    }
 }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java
index dc37175a073..85b22c70556 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/api/ClientCodeWrapper.java
@@ -26,6 +26,7 @@
 
 package com.sun.tools.javac.api;
 
+import java.io.File;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -55,6 +56,7 @@ import javax.tools.JavaFileManager;
 import javax.tools.JavaFileManager.Location;
 import javax.tools.JavaFileObject;
 import javax.tools.JavaFileObject.Kind;
+import javax.tools.StandardJavaFileManager;
 
 import com.sun.source.util.TaskEvent;
 import com.sun.source.util.TaskListener;
@@ -115,11 +117,13 @@ public class ClientCodeWrapper {
     public JavaFileManager wrap(JavaFileManager fm) {
         if (isTrusted(fm))
             return fm;
+        if (fm instanceof StandardJavaFileManager)
+            return new WrappedStandardJavaFileManager((StandardJavaFileManager) fm);
         return new WrappedJavaFileManager(fm);
     }
 
     public FileObject wrap(FileObject fo) {
-        if (isTrusted(fo))
+        if (fo == null || isTrusted(fo))
             return fo;
         return new WrappedFileObject(fo);
     }
@@ -132,7 +136,7 @@ public class ClientCodeWrapper {
     }
 
     public JavaFileObject wrap(JavaFileObject fo) {
-        if (isTrusted(fo))
+        if (fo == null || isTrusted(fo))
             return fo;
         return new WrappedJavaFileObject(fo);
     }
@@ -360,6 +364,79 @@ public class ClientCodeWrapper {
         }
     }
 
+    protected class WrappedStandardJavaFileManager extends WrappedJavaFileManager
+            implements StandardJavaFileManager {
+        WrappedStandardJavaFileManager(StandardJavaFileManager clientJavaFileManager) {
+            super(clientJavaFileManager);
+        }
+
+        @Override @DefinedBy(Api.COMPILER)
+        public Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(Iterable<? extends File> files) {
+            try {
+                return ((StandardJavaFileManager)clientJavaFileManager).getJavaFileObjectsFromFiles(files);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException | Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override @DefinedBy(Api.COMPILER)
+        public Iterable<? extends JavaFileObject> getJavaFileObjects(File... files) {
+            try {
+                return ((StandardJavaFileManager)clientJavaFileManager).getJavaFileObjects(files);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException | Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override @DefinedBy(Api.COMPILER)
+        public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) {
+            try {
+                return ((StandardJavaFileManager)clientJavaFileManager).getJavaFileObjectsFromStrings(names);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException | Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override @DefinedBy(Api.COMPILER)
+        public Iterable<? extends JavaFileObject> getJavaFileObjects(String... names) {
+            try {
+                return ((StandardJavaFileManager)clientJavaFileManager).getJavaFileObjects(names);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException | Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override @DefinedBy(Api.COMPILER)
+        public void setLocation(Location location, Iterable<? extends File> path) throws IOException {
+            try {
+                ((StandardJavaFileManager)clientJavaFileManager).setLocation(location, path);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException | Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+
+        @Override @DefinedBy(Api.COMPILER)
+        public Iterable<? extends File> getLocation(Location location) {
+            try {
+                return ((StandardJavaFileManager)clientJavaFileManager).getLocation(location);
+            } catch (ClientCodeException e) {
+                throw e;
+            } catch (RuntimeException | Error e) {
+                throw new ClientCodeException(e);
+            }
+        }
+    }
+
     protected class WrappedFileObject implements FileObject {
         protected FileObject clientFileObject;
         WrappedFileObject(FileObject clientFileObject) {
@@ -558,47 +635,47 @@ public class ClientCodeWrapper {
             this.d = d;
         }
 
-        @DefinedBy(Api.COMPILER)
+        @Override @DefinedBy(Api.COMPILER)
         public Diagnostic.Kind getKind() {
             return d.getKind();
         }
 
-        @DefinedBy(Api.COMPILER)
+        @Override @DefinedBy(Api.COMPILER)
         public JavaFileObject getSource() {
             return unwrap(d.getSource());
         }
 
-        @DefinedBy(Api.COMPILER)
+        @Override @DefinedBy(Api.COMPILER)
         public long getPosition() {
             return d.getPosition();
         }
 
-        @DefinedBy(Api.COMPILER)
+        @Override @DefinedBy(Api.COMPILER)
         public long getStartPosition() {
             return d.getStartPosition();
         }
 
-        @DefinedBy(Api.COMPILER)
+        @Override @DefinedBy(Api.COMPILER)
         public long getEndPosition() {
             return d.getEndPosition();
         }
 
-        @DefinedBy(Api.COMPILER)
+        @Override @DefinedBy(Api.COMPILER)
         public long getLineNumber() {
             return d.getLineNumber();
         }
 
-        @DefinedBy(Api.COMPILER)
+        @Override @DefinedBy(Api.COMPILER)
         public long getColumnNumber() {
             return d.getColumnNumber();
         }
 
-        @DefinedBy(Api.COMPILER)
+        @Override @DefinedBy(Api.COMPILER)
         public String getCode() {
             return d.getCode();
         }
 
-        @DefinedBy(Api.COMPILER)
+        @Override @DefinedBy(Api.COMPILER)
         public String getMessage(Locale locale) {
             return d.getMessage(locale);
         }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
index bd2c0c4eb1a..d27e18a6762 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/ClassFinder.java
@@ -27,21 +27,33 @@ package com.sun.tools.javac.code;
 
 import java.io.*;
 import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.Map;
 import java.util.Set;
+
 import javax.lang.model.SourceVersion;
-import javax.tools.JavaFileObject;
 import javax.tools.JavaFileManager;
 import javax.tools.JavaFileManager.Location;
+import javax.tools.JavaFileObject;
 import javax.tools.StandardJavaFileManager;
 
-import static javax.tools.StandardLocation.*;
-
-import com.sun.tools.javac.comp.Annotate;
 import com.sun.tools.javac.code.Scope.WriteableScope;
 import com.sun.tools.javac.code.Symbol.*;
+import com.sun.tools.javac.code.Symbol.ClassSymbol;
+import com.sun.tools.javac.code.Symbol.Completer;
+import com.sun.tools.javac.code.Symbol.CompletionFailure;
+import com.sun.tools.javac.code.Symbol.PackageSymbol;
+import com.sun.tools.javac.code.Symbol.TypeSymbol;
+import com.sun.tools.javac.comp.Annotate;
+import com.sun.tools.javac.file.JRTIndex;
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
 import com.sun.tools.javac.jvm.ClassReader;
+import com.sun.tools.javac.jvm.Profile;
 import com.sun.tools.javac.util.*;
 
+import static javax.tools.StandardLocation.*;
+
 import static com.sun.tools.javac.code.Flags.*;
 import static com.sun.tools.javac.code.Kinds.Kind.*;
 
@@ -125,6 +137,18 @@ public class ClassFinder {
      */
     protected Symbol currentOwner = null;
 
+    /**
+     * The currently selected profile.
+     */
+    private final Profile profile;
+
+    /**
+     * Use direct access to the JRTIndex to access the temporary
+     * replacement for the info that used to be in ct.sym.
+     * In time, this will go away and be replaced by the module system.
+     */
+    private final JRTIndex jrtIndex;
+
     /**
      * Completer that delegates to the complete-method of this class.
      */
@@ -168,13 +192,73 @@ public class ClassFinder {
         preferSource = "source".equals(options.get("-Xprefer"));
         userPathsFirst = options.isSet(XXUSERPATHSFIRST);
 
-
         completionFailureName =
             options.isSet("failcomplete")
             ? names.fromString(options.get("failcomplete"))
             : null;
+
+        // Temporary, until more info is available from the module system.
+        boolean useCtProps;
+        JavaFileManager fm = context.get(JavaFileManager.class);
+        if (fm instanceof JavacFileManager) {
+            JavacFileManager jfm = (JavacFileManager) fm;
+            useCtProps = jfm.isDefaultBootClassPath() && jfm.isSymbolFileEnabled();
+        } else if (fm.getClass().getName().equals("com.sun.tools.sjavac.comp.SmartFileManager")) {
+            useCtProps = !options.isSet("ignore.symbol.file");
+        } else {
+            useCtProps = false;
+        }
+        jrtIndex = useCtProps && JRTIndex.isAvailable() ? JRTIndex.getSharedInstance() : null;
+
+        profile = Profile.instance(context);
     }
 
+
+/************************************************************************
+ * Temporary ct.sym replacement
+ *
+ * The following code is a temporary substitute for the ct.sym mechanism
+ * used in JDK 6 thru JDK 8.
+ * This mechanism will eventually be superseded by the Jigsaw module system.
+ ***********************************************************************/
+
+    /**
+     * Returns any extra flags for a class symbol.
+     * This information used to be provided using private annotations
+     * in the class file in ct.sym; in time, this information will be
+     * available from the module system.
+     */
+    long getSupplementaryFlags(ClassSymbol c) {
+        if (jrtIndex == null || !jrtIndex.isInJRT(c.classfile)) {
+            return 0;
+        }
+
+        if (supplementaryFlags == null) {
+            supplementaryFlags = new HashMap<>();
+        }
+
+        Long flags = supplementaryFlags.get(c.packge());
+        if (flags == null) {
+            long newFlags = 0;
+            try {
+                JRTIndex.CtSym ctSym = jrtIndex.getCtSym(c.packge().flatName());
+                Profile minProfile = Profile.DEFAULT;
+                if (ctSym.proprietary)
+                    newFlags |= PROPRIETARY;
+                if (ctSym.minProfile != null)
+                    minProfile = Profile.lookup(ctSym.minProfile);
+                if (profile != Profile.DEFAULT && minProfile.value > profile.value) {
+                    newFlags |= NOT_IN_PROFILE;
+                }
+            } catch (IOException ignore) {
+            }
+            supplementaryFlags.put(c.packge(), flags = newFlags);
+        }
+        return flags;
+    }
+
+    private Map<PackageSymbol, Long> supplementaryFlags;
+
 /************************************************************************
  * Loading Classes
  ***********************************************************************/
@@ -259,6 +343,7 @@ public class ClassFinder {
                 }
                 if (classfile.getKind() == JavaFileObject.Kind.CLASS) {
                     reader.readClassFile(c);
+                    c.flags_field |= getSupplementaryFlags(c);
                 } else {
                     if (sourceCompleter != null) {
                         sourceCompleter.complete(c);
@@ -271,13 +356,15 @@ public class ClassFinder {
                 currentClassFile = previousClassFile;
             }
         } else {
-            JCDiagnostic diag =
-                diagFactory.fragment("class.file.not.found", c.flatname);
-            throw
-                newCompletionFailure(c, diag);
+            throw classFileNotFound(c);
         }
     }
     // where
+        private CompletionFailure classFileNotFound(ClassSymbol c) {
+            JCDiagnostic diag =
+                diagFactory.fragment("class.file.not.found", c.flatname);
+            return newCompletionFailure(c, diag);
+        }
         /** Static factory for CompletionFailure objects.
          *  In practice, only one can be used at a time, so we share one
          *  to reduce the expense of allocating new exception objects.
@@ -296,7 +383,7 @@ public class ClassFinder {
                 return result;
             }
         }
-        private CompletionFailure cachedCompletionFailure =
+        private final CompletionFailure cachedCompletionFailure =
             new CompletionFailure(null, (JCDiagnostic) null);
         {
             cachedCompletionFailure.setStackTrace(new StackTraceElement[0]);
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java
new file mode 100644
index 00000000000..975816ded62
--- /dev/null
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java
@@ -0,0 +1,272 @@
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.tools.javac.file;
+
+import java.io.IOException;
+import java.io.UncheckedIOException;
+import java.lang.ref.SoftReference;
+import java.net.URI;
+import java.nio.file.DirectoryStream;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.spi.FileSystemProvider;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import javax.tools.FileObject;
+
+import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
+import com.sun.tools.javac.nio.PathFileObject;
+import com.sun.tools.javac.util.Context;
+
+/**
+ * A package-oriented index into the jrt: filesystem.
+ */
+public class JRTIndex {
+    /** Get a shared instance of the cache. */
+    private static JRTIndex sharedInstance;
+    public synchronized static JRTIndex getSharedInstance() {
+        if (sharedInstance == null) {
+            try {
+                sharedInstance = new JRTIndex();
+            } catch (IOException e) {
+                throw new UncheckedIOException(e);
+            }
+        }
+        return sharedInstance;
+    }
+
+    /** Get a context-specific instance of a cache. */
+    public static JRTIndex instance(Context context) {
+        try {
+            JRTIndex instance = context.get(JRTIndex.class);
+            if (instance == null)
+                context.put(JRTIndex.class, instance = new JRTIndex());
+            return instance;
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
+    }
+
+    public static boolean isAvailable() {
+        for (FileSystemProvider p: FileSystemProvider.installedProviders()) {
+            if (p.getScheme().equals("jrt"))
+                return true;
+        }
+        return false;
+    }
+
+
+    /**
+     * The jrt: file system.
+     */
+    private final FileSystem jrtfs;
+
+    /**
+     * The set of module directories within the jrt: file system.
+     */
+    private final Set<Path> jrtModules;
+
+    /**
+     * A lazily evaluated set of entries about the contents of the jrt: file system.
+     */
+    private final Map<RelativeDirectory, SoftReference<Entry>> entries;
+
+    /**
+     * An entry provides cached info about a specific package directory within jrt:.
+     */
+    class Entry {
+        /**
+         * The regular files for this package.
+         * For now, assume just one instance of each file across all modules.
+         */
+        final Map<String, Path> files;
+
+        /**
+         * The set of subdirectories in jrt: for this package.
+         */
+        final Set<RelativeDirectory> subdirs;
+
+        /**
+         * The info that used to be in ct.sym for classes in this package.
+         */
+        final CtSym ctSym;
+
+        private Entry(Map<String, Path> files, Set<RelativeDirectory> subdirs, CtSym ctSym) {
+            this.files = files;
+            this.subdirs = subdirs;
+            this.ctSym = ctSym;
+        }
+    }
+
+    /**
+     * The info that used to be in ct.sym for classes in a package.
+     */
+    public static class CtSym {
+        /**
+         * The classes in this package are internal and not visible.
+         */
+        public final boolean hidden;
+        /**
+         * The classes in this package are proprietary and will generate a warning.
+         */
+        public final boolean proprietary;
+        /**
+         * The minimum profile in which classes in this package are available.
+         */
+        public final String minProfile;
+
+        CtSym(boolean hidden, boolean proprietary, String minProfile) {
+            this.hidden = hidden;
+            this.proprietary = proprietary;
+            this.minProfile = minProfile;
+        }
+
+        @Override
+        public String toString() {
+            StringBuilder sb = new StringBuilder("CtSym[");
+            boolean needSep = false;
+            if (hidden) {
+                sb.append("hidden");
+                needSep = true;
+            }
+            if (proprietary) {
+                if (needSep) sb.append(",");
+                sb.append("proprietary");
+                needSep = true;
+            }
+            if (minProfile != null) {
+                if (needSep) sb.append(",");
+                sb.append(minProfile);
+            }
+            sb.append("]");
+            return sb.toString();
+        }
+
+        static final CtSym EMPTY = new CtSym(false, false, null);
+    }
+
+    /**
+     * Create and initialize the index.
+     */
+    private JRTIndex() throws IOException {
+        jrtfs = FileSystems.getFileSystem(URI.create("jrt:/"));
+        jrtModules = new LinkedHashSet<>();
+        Path root = jrtfs.getPath("/");
+        try (DirectoryStream<Path> stream = Files.newDirectoryStream(root)) {
+            for (Path entry: stream) {
+                if (Files.isDirectory(entry))
+                    jrtModules.add(entry);
+            }
+        }
+        entries = new HashMap<>();
+    }
+
+    public CtSym getCtSym(CharSequence packageName) throws IOException {
+        return getEntry(RelativeDirectory.forPackage(packageName)).ctSym;
+    }
+
+    synchronized Entry getEntry(RelativeDirectory rd) throws IOException {
+        SoftReference<Entry> ref = entries.get(rd);
+        Entry e = (ref == null) ? null : ref.get();
+        if (e == null) {
+            Map<String, Path> files = new LinkedHashMap<>();
+            Set<RelativeDirectory> subdirs = new LinkedHashSet<>();
+            for (Path module: jrtModules) {
+                Path p = rd.getFile(module);
+                if (!Files.exists(p))
+                    continue;
+                try (DirectoryStream<Path> stream = Files.newDirectoryStream(p)) {
+                    for (Path entry: stream) {
+                        String name = entry.getFileName().toString();
+                        if (Files.isRegularFile(entry)) {
+                            // TODO: consider issue of files with same name in different modules
+                            files.put(name, entry);
+                        } else if (Files.isDirectory(entry)) {
+                            subdirs.add(new RelativeDirectory(rd, name));
+                        }
+                    }
+                }
+            }
+            e = new Entry(Collections.unmodifiableMap(files),
+                    Collections.unmodifiableSet(subdirs),
+                    getCtInfo(rd));
+            entries.put(rd, new SoftReference<>(e));
+        }
+        return e;
+    }
+
+    public boolean isInJRT(FileObject fo) {
+        if (fo instanceof PathFileObject) {
+            Path path = ((PathFileObject) fo).getPath();
+            return (path.getFileSystem() == jrtfs);
+        } else {
+            return false;
+        }
+    }
+
+    private CtSym getCtInfo(RelativeDirectory dir) {
+        if (dir.path.isEmpty())
+            return CtSym.EMPTY;
+        // It's a side-effect of the default build rules that ct.properties
+        // ends up as a resource bundle.
+        if (ctBundle == null) {
+            final String bundleName = "com.sun.tools.javac.resources.ct";
+            ctBundle = ResourceBundle.getBundle(bundleName);
+        }
+        try {
+            String attrs = ctBundle.getString(dir.path.replace('/', '.') + '*');
+            boolean hidden = false;
+            boolean proprietary = false;
+            String minProfile = null;
+            for (String attr: attrs.split(" +", 0)) {
+                switch (attr) {
+                    case "hidden":
+                        hidden = true;
+                        break;
+                    case "proprietary":
+                        proprietary = true;
+                        break;
+                    default:
+                        minProfile = attr;
+                }
+            }
+            return new CtSym(hidden, proprietary, minProfile);
+        } catch (MissingResourceException e) {
+            return CtSym.EMPTY;
+        }
+
+    }
+
+    private ResourceBundle ctBundle;
+}
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java
index 72c6574410e..bc29808fb81 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JavacFileManager.java
@@ -25,17 +25,16 @@
 
 package com.sun.tools.javac.file;
 
-import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.io.OutputStreamWriter;
 import java.net.MalformedURLException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URL;
 import java.nio.CharBuffer;
 import java.nio.charset.Charset;
+import java.nio.file.Path;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collection;
@@ -54,8 +53,9 @@ import javax.tools.JavaFileManager;
 import javax.tools.JavaFileObject;
 import javax.tools.StandardJavaFileManager;
 
-import com.sun.tools.javac.file.RelativePath.RelativeFile;
 import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
+import com.sun.tools.javac.file.RelativePath.RelativeFile;
+import com.sun.tools.javac.nio.PathFileObject;
 import com.sun.tools.javac.util.BaseFileManager;
 import com.sun.tools.javac.util.Context;
 import com.sun.tools.javac.util.DefinedBy;
@@ -65,6 +65,8 @@ import com.sun.tools.javac.util.ListBuffer;
 
 import static javax.tools.StandardLocation.*;
 
+import static com.sun.tools.javac.util.BaseFileManager.getKind;
+
 /**
  * This class provides access to the source, class and other files
  * used by the compiler and related tools.
@@ -97,11 +99,13 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
 
     protected enum SortFiles implements Comparator<File> {
         FORWARD {
+            @Override
             public int compare(File f1, File f2) {
                 return f1.getName().compareTo(f2.getName());
             }
         },
         REVERSE {
+            @Override
             public int compare(File f1, File f2) {
                 return -f1.getName().compareTo(f2.getName());
             }
@@ -115,6 +119,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
      */
     public static void preRegister(Context context) {
         context.put(JavaFileManager.class, new Context.Factory<JavaFileManager>() {
+            @Override
             public JavaFileManager make(Context c) {
                 return new JavacFileManager(c, true, null);
             }
@@ -161,6 +166,10 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         symbolFileEnabled = b;
     }
 
+    public boolean isSymbolFileEnabled() {
+        return symbolFileEnabled;
+    }
+
     public JavaFileObject getFileForInput(String name) {
         return getRegularFile(new File(name));
     }
@@ -177,7 +186,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         return getJavaFileForOutput(CLASS_OUTPUT, classname, kind, sibling);
     }
 
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) {
         ListBuffer<File> files = new ListBuffer<>();
         for (String name : names)
@@ -185,7 +194,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         return getJavaFileObjectsFromFiles(files.toList());
     }
 
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public Iterable<? extends JavaFileObject> getJavaFileObjects(String... names) {
         return getJavaFileObjectsFromStrings(Arrays.asList(nullCheck(names)));
     }
@@ -250,6 +259,40 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         System.out.println(message);
     }
 
+    /**
+     * Insert all files in a subdirectory of the platform image
+     * which match fileKinds into resultList.
+     */
+    private void listJRTImage(RelativeDirectory subdirectory,
+                               Set<JavaFileObject.Kind> fileKinds,
+                               boolean recurse,
+                               ListBuffer<JavaFileObject> resultList) throws IOException {
+        JRTIndex.Entry e = getJRTIndex().getEntry(subdirectory);
+        if (symbolFileEnabled && e.ctSym.hidden)
+            return;
+        for (Path file: e.files.values()) {
+            if (fileKinds.contains(getKind(file))) {
+                JavaFileObject fe
+                        = PathFileObject.createJRTPathFileObject(JavacFileManager.this, file);
+                resultList.append(fe);
+            }
+        }
+
+        if (recurse) {
+            for (RelativeDirectory rd: e.subdirs) {
+                listJRTImage(rd, fileKinds, recurse, resultList);
+            }
+        }
+    }
+
+    private synchronized JRTIndex getJRTIndex() {
+        if (jrtIndex == null)
+            jrtIndex = JRTIndex.getSharedInstance();
+        return jrtIndex;
+    }
+
+    private JRTIndex jrtIndex;
+
 
     /**
      * Insert all files in subdirectory subdirectory of directory directory
@@ -334,7 +377,29 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
                                ListBuffer<JavaFileObject> resultList) {
         Archive archive = archives.get(container);
         if (archive == null) {
-            // archives are not created for directories.
+            // Very temporary and obnoxious interim hack
+            if (container.getName().equals("bootmodules.jimage")) {
+                System.err.println("Warning: reference to bootmodules.jimage replaced by jrt:");
+                container = Locations.JRT_MARKER_FILE;
+            } else if (container.getName().endsWith(".jimage")) {
+                System.err.println("Warning: reference to " + container + " ignored");
+                return;
+            }
+
+            // archives are not created for directories or jrt: images
+            if (container == Locations.JRT_MARKER_FILE) {
+                try {
+                    listJRTImage(subdirectory,
+                            fileKinds,
+                            recurse,
+                            resultList);
+                } catch (IOException ex) {
+                    ex.printStackTrace(System.err);
+                    log.error("error.reading.file", container, getMessage(ex));
+                }
+                return;
+            }
+
             if  (fsInfo.isDirectory(container)) {
                 listDirectory(container,
                               subdirectory,
@@ -348,8 +413,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
             try {
                 archive = openArchive(container);
             } catch (IOException ex) {
-                log.error("error.reading.file",
-                          container, getMessage(ex));
+                log.error("error.reading.file", container, getMessage(ex));
                 return;
             }
         }
@@ -419,21 +483,26 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         public MissingArchive(File name) {
             zipFileName = name;
         }
+        @Override
         public boolean contains(RelativePath name) {
             return false;
         }
 
+        @Override
         public void close() {
         }
 
+        @Override
         public JavaFileObject getFileObject(RelativeDirectory subdirectory, String file) {
             return null;
         }
 
+        @Override
         public List<String> getFiles(RelativeDirectory subdirectory) {
             return List.nil();
         }
 
+        @Override
         public Set<RelativeDirectory> getSubdirectories() {
             return Collections.emptySet();
         }
@@ -448,10 +517,6 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
      */
     Map<File, Archive> archives = new HashMap<>();
 
-    private static final String[] symbolFileLocation = { "lib", "ct.sym" };
-    private static final RelativeDirectory symbolFilePrefix
-            = new RelativeDirectory("META-INF/sym/rt.jar/");
-
     /*
      * This method looks for a ZipFormatException and takes appropriate
      * evasive action. If there is a failure in the fast mode then we
@@ -473,19 +538,6 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
     /** Open a new zip file directory, and cache it.
      */
     private Archive openArchive(File zipFileName, boolean useOptimizedZip) throws IOException {
-        File origZipFileName = zipFileName;
-        if (symbolFileEnabled && locations.isDefaultBootClassPathRtJar(zipFileName)) {
-            File file = zipFileName.getParentFile().getParentFile(); // ${java.home}
-            if (new File(file.getName()).equals(new File("jre")))
-                file = file.getParentFile();
-            // file == ${jdk.home}
-            for (String name : symbolFileLocation)
-                file = new File(file, name);
-            // file == ${jdk.home}/lib/ct.sym
-            if (file.exists())
-                zipFileName = file;
-        }
-
         Archive archive;
         try {
 
@@ -522,7 +574,6 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
                 }
             }
 
-            if (origZipFileName == zipFileName) {
                 if (!useOptimizedZip) {
                     archive = new ZipArchive(this, zdir);
                 } else {
@@ -533,18 +584,6 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
                                     preindexCacheLocation,
                                     options.isSet("writezipindexfiles")));
                 }
-            } else {
-                if (!useOptimizedZip) {
-                    archive = new SymbolArchive(this, origZipFileName, zdir, symbolFilePrefix);
-                } else {
-                    archive = new ZipFileIndexArchive(this,
-                                    zipFileIndexCache.getZipFileIndex(zipFileName,
-                                    symbolFilePrefix,
-                                    usePreindexedCache,
-                                    preindexCacheLocation,
-                                    options.isSet("writezipindexfiles")));
-                }
-            }
         } catch (FileNotFoundException ex) {
             archive = new MissingArchive(zipFileName);
         } catch (ZipFileIndex.ZipFormatException zfe) {
@@ -555,13 +594,13 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
             archive = new MissingArchive(zipFileName);
         }
 
-        archives.put(origZipFileName, archive);
+        archives.put(zipFileName, archive);
         return archive;
     }
 
     /** Flush any output resources.
      */
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public void flush() {
         contentCache.clear();
     }
@@ -569,19 +608,19 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
     /**
      * Close the JavaFileManager, releasing resources.
      */
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public void close() {
         for (Iterator<Archive> i = archives.values().iterator(); i.hasNext(); ) {
             Archive a = i.next();
             i.remove();
             try {
                 a.close();
-            } catch (IOException e) {
+            } catch (IOException ignore) {
             }
         }
     }
 
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public ClassLoader getClassLoader(Location location) {
         nullCheck(location);
         Iterable<? extends File> path = getLocation(location);
@@ -599,7 +638,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         return getClassLoader(lb.toArray(new URL[lb.size()]));
     }
 
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public Iterable<JavaFileObject> list(Location location,
                                          String packageName,
                                          Set<JavaFileObject.Kind> kinds,
@@ -621,7 +660,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         return results.toList();
     }
 
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public String inferBinaryName(Location location, JavaFileObject file) {
         file.getClass(); // null check
         location.getClass(); // null check
@@ -633,27 +672,32 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
 
         if (file instanceof BaseFileObject) {
             return ((BaseFileObject) file).inferBinaryName(path);
+        } else if (file instanceof PathFileObject) {
+            return ((PathFileObject) file).inferBinaryName(null);
         } else
             throw new IllegalArgumentException(file.getClass().getName());
     }
 
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public boolean isSameFile(FileObject a, FileObject b) {
         nullCheck(a);
         nullCheck(b);
-        if (!(a instanceof BaseFileObject))
+        if (a instanceof PathFileObject && b instanceof PathFileObject)
+            return ((PathFileObject) a).isSameFile((PathFileObject) b);
+        // In time, we should phase out BaseFileObject in favor of PathFileObject
+        if (!(a instanceof BaseFileObject  || a instanceof PathFileObject))
             throw new IllegalArgumentException("Not supported: " + a);
-        if (!(b instanceof BaseFileObject))
+        if (!(b instanceof BaseFileObject || b instanceof PathFileObject))
             throw new IllegalArgumentException("Not supported: " + b);
         return a.equals(b);
     }
 
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public boolean hasLocation(Location location) {
         return getLocation(location) != null;
     }
 
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public JavaFileObject getJavaFileForInput(Location location,
                                               String className,
                                               JavaFileObject.Kind kind)
@@ -668,7 +712,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         return getFileForInput(location, RelativeFile.forClass(className, kind));
     }
 
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public FileObject getFileForInput(Location location,
                                       String packageName,
                                       String relativeName)
@@ -690,17 +734,26 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         if (path == null)
             return null;
 
-        for (File dir: path) {
-            Archive a = archives.get(dir);
+        for (File file: path) {
+            Archive a = archives.get(file);
             if (a == null) {
-                if (fsInfo.isDirectory(dir)) {
-                    File f = name.getFile(dir);
+                // archives are not created for directories or jrt: images
+                if (file == Locations.JRT_MARKER_FILE) {
+                    JRTIndex.Entry e = getJRTIndex().getEntry(name.dirname());
+                    if (symbolFileEnabled && e.ctSym.hidden)
+                        continue;
+                    Path p = e.files.get(name.basename());
+                    if (p != null)
+                        return PathFileObject.createJRTPathFileObject(this, p);
+                    continue;
+                } else if (fsInfo.isDirectory(file)) {
+                    File f = name.getFile(file);
                     if (f.exists())
                         return new RegularFileObject(this, f);
                     continue;
                 }
                 // Not a directory, create the archive
-                a = openArchive(dir);
+                a = openArchive(file);
             }
             // Process the archive
             if (a.contains(name)) {
@@ -710,7 +763,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         return null;
     }
 
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public JavaFileObject getJavaFileForOutput(Location location,
                                                String className,
                                                JavaFileObject.Kind kind,
@@ -726,7 +779,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         return getFileForOutput(location, RelativeFile.forClass(className, kind), sibling);
     }
 
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public FileObject getFileForOutput(Location location,
                                        String packageName,
                                        String relativeName,
@@ -776,7 +829,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
 
     }
 
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(
         Iterable<? extends File> files)
     {
@@ -790,12 +843,12 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         return result;
     }
 
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public Iterable<? extends JavaFileObject> getJavaFileObjects(File... files) {
         return getJavaFileObjectsFromFiles(Arrays.asList(nullCheck(files)));
     }
 
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public void setLocation(Location location,
                             Iterable<? extends File> path)
         throws IOException
@@ -804,7 +857,7 @@ public class JavacFileManager extends BaseFileManager implements StandardJavaFil
         locations.setLocation(location, path);
     }
 
-    @DefinedBy(Api.COMPILER)
+    @Override @DefinedBy(Api.COMPILER)
     public Iterable<? extends File> getLocation(Location location) {
         nullCheck(location);
         return locations.getLocation(location);
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java
index 33cb4c8245e..526bf751104 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/Locations.java
@@ -27,8 +27,12 @@ package com.sun.tools.javac.file;
 import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.IOException;
+import java.io.UncheckedIOException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.nio.file.Files;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
@@ -41,6 +45,8 @@ import java.util.LinkedHashSet;
 import java.util.Map;
 import java.util.Set;
 import java.util.StringTokenizer;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 import java.util.zip.ZipFile;
 
 import javax.tools.JavaFileManager;
@@ -94,6 +100,12 @@ public class Locations {
      */
     private boolean warn;
 
+    // Used by Locations(for now) to indicate that the PLATFORM_CLASS_PATH
+    // should use the jrt: file system.
+    // When Locations has been converted to use java.nio.file.Path,
+    // Locations can use Paths.get(URI.create("jrt:"))
+    static final File JRT_MARKER_FILE = new File("JRT_MARKER_FILE");
+
     public Locations() {
         initHandlers();
     }
@@ -115,12 +127,6 @@ public class Locations {
         return h.isDefault();
     }
 
-    boolean isDefaultBootClassPathRtJar(File file) {
-        BootClassPathLocationHandler h
-                = (BootClassPathLocationHandler) getHandler(PLATFORM_CLASS_PATH);
-        return h.isDefaultRtJar(file);
-    }
-
     public Collection<File> userClassPath() {
         return getLocation(CLASS_PATH);
     }
@@ -283,7 +289,7 @@ public class Locations {
 
             if (fsInfo.isFile(file)) {
                 /* File is an ordinary file. */
-                if (!isArchive(file)) {
+                if (!isArchive(file) && !file.getName().endsWith(".jimage")) {
                     /* Not a recognized extension; open it to see if
                      it looks like a valid zip file. */
                     try {
@@ -309,7 +315,7 @@ public class Locations {
             super.add(file);
             canonicalValues.add(canonFile);
 
-            if (expandJarClassPaths && fsInfo.isFile(file)) {
+            if (expandJarClassPaths && fsInfo.isFile(file) && !file.getName().endsWith(".jimage")) {
                 addJarClassPath(file, warn);
             }
         }
@@ -543,15 +549,9 @@ public class Locations {
         final Map<Option, String> optionValues = new EnumMap<>(Option.class);
 
         /**
-         * rt.jar as found on the default bootclasspath. If the user specified a bootclasspath, null
-         * is used.
+         * Is the bootclasspath the default?
          */
-        private File defaultBootClassPathRtJar = null;
-
-        /**
-         * Is bootclasspath the default?
-         */
-        private boolean isDefaultBootClassPath;
+        private boolean isDefault;
 
         BootClassPathLocationHandler() {
             super(StandardLocation.PLATFORM_CLASS_PATH,
@@ -564,12 +564,7 @@ public class Locations {
 
         boolean isDefault() {
             lazy();
-            return isDefaultBootClassPath;
-        }
-
-        boolean isDefaultRtJar(File file) {
-            lazy();
-            return file.equals(defaultBootClassPathRtJar);
+            return isDefault;
         }
 
         @Override
@@ -614,16 +609,16 @@ public class Locations {
             if (files == null) {
                 searchPath = null;  // reset to "uninitialized"
             } else {
-                defaultBootClassPathRtJar = null;
-                isDefaultBootClassPath = false;
+                isDefault = false;
                 SearchPath p = new SearchPath().addFiles(files, false);
                 searchPath = Collections.unmodifiableCollection(p);
                 optionValues.clear();
             }
         }
 
-        SearchPath computePath() {
-            defaultBootClassPathRtJar = null;
+        SearchPath computePath() throws IOException {
+            String java_home = System.getProperty("java.home");
+
             SearchPath path = new SearchPath();
 
             String bootclasspathOpt = optionValues.get(BOOTCLASSPATH);
@@ -643,13 +638,13 @@ public class Locations {
                 path.addFiles(bootclasspathOpt);
             } else {
                 // Standard system classes for this compiler's release.
-                String files = System.getProperty("sun.boot.class.path");
-                path.addFiles(files, false);
-                File rt_jar = new File("rt.jar");
-                for (File file : getPathEntries(files)) {
-                    if (new File(file.getName()).equals(rt_jar)) {
-                        defaultBootClassPathRtJar = file;
-                    }
+                Collection<File> systemClasses = systemClasses(java_home);
+                if (systemClasses != null) {
+                    path.addFiles(systemClasses, false);
+                } else {
+                    // fallback to the value of sun.boot.class.path
+                    String files = System.getProperty("sun.boot.class.path");
+                    path.addFiles(files, false);
                 }
             }
 
@@ -661,20 +656,69 @@ public class Locations {
             if (extdirsOpt != null) {
                 path.addDirectories(extdirsOpt);
             } else {
+                // Add lib/jfxrt.jar to the search path
+                File jfxrt = new File(new File(java_home, "lib"), "jfxrt.jar");
+                if (jfxrt.exists()) {
+                    path.addFile(jfxrt, false);
+                }
                 path.addDirectories(System.getProperty("java.ext.dirs"), false);
             }
 
-            isDefaultBootClassPath
-                    = (xbootclasspathPrependOpt == null)
+            isDefault =
+                       (xbootclasspathPrependOpt == null)
                     && (bootclasspathOpt == null)
                     && (xbootclasspathAppendOpt == null);
 
             return path;
         }
 
+        /**
+         * Return a collection of files containing system classes.
+         * Returns {@code null} if not running on a modular image.
+         *
+         * @throws UncheckedIOException if an I/O errors occurs
+         */
+        private Collection<File> systemClasses(String java_home) throws IOException {
+            // Return .jimage files if available
+            Path libModules = Paths.get(java_home, "lib", "modules");
+            if (Files.exists(libModules)) {
+                try (Stream<Path> files = Files.list(libModules)) {
+                    boolean haveJImageFiles =
+                            files.anyMatch(f -> f.getFileName().toString().endsWith(".jimage"));
+                    if (haveJImageFiles) {
+                        return Collections.singleton(JRT_MARKER_FILE);
+                    }
+                }
+            }
+
+            // Temporary: if no .jimage files, return individual modules
+            if (Files.exists(libModules.resolve("java.base"))) {
+                return Files.list(libModules)
+                            .map(d -> d.resolve("classes"))
+                            .map(Path::toFile)
+                            .collect(Collectors.toList());
+            }
+
+            // Exploded module image
+            Path modules = Paths.get(java_home, "modules");
+            if (Files.isDirectory(modules.resolve("java.base"))) {
+                return Files.list(modules)
+                            .map(Path::toFile)
+                            .collect(Collectors.toList());
+            }
+
+            // not a modular image that we know about
+            return null;
+        }
+
         private void lazy() {
             if (searchPath == null) {
+                try {
                 searchPath = Collections.unmodifiableCollection(computePath());
+                } catch (IOException e) {
+                    // TODO: need better handling here, e.g. javac Abort?
+                    throw new UncheckedIOException(e);
+                }
             }
         }
     }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RelativePath.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RelativePath.java
index 564ff170348..6da5c1fce9e 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RelativePath.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/RelativePath.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,8 +26,13 @@
 package com.sun.tools.javac.file;
 
 import java.io.File;
+import java.nio.file.FileSystems;
+import java.nio.file.InvalidPathException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipFile;
+
 import javax.tools.JavaFileObject;
 
 /**
@@ -58,6 +63,16 @@ public abstract class RelativePath implements Comparable<RelativePath> {
         return new File(directory, path.replace('/', File.separatorChar));
     }
 
+    public Path getFile(Path directory) throws /*unchecked*/ InvalidPathException {
+        if (directory == null) {
+            String sep = FileSystems.getDefault().getSeparator();
+            return Paths.get(path.replace("/", sep));
+        } else {
+            String sep = directory.getFileSystem().getSeparator();
+            return directory.resolve(path.replace("/", sep));
+        }
+    }
+
     public int compareTo(RelativePath other) {
         return path.compareTo(other.path);
     }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/SymbolArchive.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/SymbolArchive.java
deleted file mode 100644
index 581527d6c6f..00000000000
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/SymbolArchive.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package com.sun.tools.javac.file;
-
-import java.io.File;
-import java.io.IOException;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipFile;
-import javax.tools.JavaFileObject;
-
-import com.sun.tools.javac.file.RelativePath.RelativeDirectory;
-import com.sun.tools.javac.file.RelativePath.RelativeFile;
-import com.sun.tools.javac.util.List;
-
-/**
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
-*/
-public class SymbolArchive extends ZipArchive {
-
-    final File origFile;
-    final RelativeDirectory prefix;
-
-    public SymbolArchive(JavacFileManager fileManager, File orig, ZipFile zdir, RelativeDirectory prefix) throws IOException {
-        super(fileManager, zdir, false);
-        this.origFile = orig;
-        this.prefix = prefix;
-        initMap();
-    }
-
-    @Override
-    void addZipEntry(ZipEntry entry) {
-        String name = entry.getName();
-        if (!name.startsWith(prefix.path)) {
-            return;
-        }
-        name = name.substring(prefix.path.length());
-        int i = name.lastIndexOf('/');
-        RelativeDirectory dirname = new RelativeDirectory(name.substring(0, i+1));
-        String basename = name.substring(i + 1);
-        if (basename.length() == 0) {
-            return;
-        }
-        List<String> list = map.get(dirname);
-        if (list == null)
-            list = List.nil();
-        list = list.prepend(basename);
-        map.put(dirname, list);
-    }
-
-    @Override
-    public JavaFileObject getFileObject(RelativeDirectory subdirectory, String file) {
-        RelativeDirectory prefix_subdir = new RelativeDirectory(prefix, subdirectory.path);
-        ZipEntry ze = new RelativeFile(prefix_subdir, file).getZipEntry(zfile);
-        return new SymbolFileObject(this, file, ze);
-    }
-
-    @Override
-    public String toString() {
-        return "SymbolArchive[" + zfile.getName() + "]";
-    }
-
-    /**
-     * A subclass of JavaFileObject representing zip entries in a symbol file.
-     */
-    public static class SymbolFileObject extends ZipFileObject {
-        protected SymbolFileObject(SymbolArchive zarch, String name, ZipEntry entry) {
-            super(zarch, name, entry);
-        }
-
-        @Override
-        protected String inferBinaryName(Iterable<? extends File> path) {
-            String entryName = entry.getName();
-            String prefix = ((SymbolArchive) zarch).prefix.path;
-            if (entryName.startsWith(prefix))
-                entryName = entryName.substring(prefix.length());
-            return removeExtension(entryName).replace('/', '.');
-        }
-    }
-
-
-}
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
index 2dddaa17929..091ad869436 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java
@@ -1299,21 +1299,7 @@ public class ClassReader {
             ListBuffer<CompoundAnnotationProxy> proxies = new ListBuffer<>();
             for (int i = 0; i<numAttributes; i++) {
                 CompoundAnnotationProxy proxy = readCompoundAnnotation();
-                if (proxy.type.tsym == syms.proprietaryType.tsym)
-                    sym.flags_field |= PROPRIETARY;
-                else if (proxy.type.tsym == syms.profileType.tsym) {
-                    if (profile != Profile.DEFAULT) {
-                        for (Pair<Name,Attribute> v: proxy.values) {
-                            if (v.fst == names.value && v.snd instanceof Attribute.Constant) {
-                                Attribute.Constant c = (Attribute.Constant) v.snd;
-                                if (c.type == syms.intType && ((Integer) c.value) > profile.value) {
-                                    sym.flags_field |= NOT_IN_PROFILE;
-                                }
-                            }
-                        }
-                    }
-                } else
-                    proxies.append(proxy);
+                proxies.append(proxy);
             }
             annotate.normal(new AnnotationCompleter(sym, proxies.toList()));
         }
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java
index 9a05715f8e8..0696611a657 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/JavacPathFileManager.java
@@ -368,7 +368,7 @@ public class JavacPathFileManager extends BaseFileManager implements PathFileMan
             @Override
             public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
                 Path name = dir.getFileName();
-                if (name == null || SourceVersion.isIdentifier(name.toString())) // JSR 292?
+                if (name == null || SourceVersion.isIdentifier(name.toString()))
                     return FileVisitResult.CONTINUE;
                 else
                     return FileVisitResult.SKIP_SUBTREE;
@@ -377,6 +377,9 @@ public class JavacPathFileManager extends BaseFileManager implements PathFileMan
             @Override
             public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
                 if (attrs.isRegularFile() && kinds.contains(getKind(file.getFileName().toString()))) {
+                    // WORKAROUND for .jimage files
+                    if (!file.isAbsolute())
+                        file = pathDir.resolve(file);
                     JavaFileObject fe =
                         PathFileObject.createDirectoryPathFileObject(
                             JavacPathFileManager.this, file, pathDir);
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/PathFileObject.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/PathFileObject.java
index 8d687eea8e9..f1715f4f6a5 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/PathFileObject.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/nio/PathFileObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2014, 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
@@ -62,19 +62,19 @@ import com.sun.tools.javac.util.DefinedBy.Api;
  *  This code and its internal interfaces are subject to change or
  *  deletion without notice.</b>
  */
-abstract class PathFileObject implements JavaFileObject {
-    private JavacPathFileManager fileManager;
-    private Path path;
+public abstract class PathFileObject implements JavaFileObject {
+    private final BaseFileManager fileManager;
+    private final Path path;
 
     /**
      * Create a PathFileObject within a directory, such that the binary name
      * can be inferred from the relationship to the parent directory.
      */
-    static PathFileObject createDirectoryPathFileObject(JavacPathFileManager fileManager,
+    static PathFileObject createDirectoryPathFileObject(BaseFileManager fileManager,
             final Path path, final Path dir) {
         return new PathFileObject(fileManager, path) {
             @Override
-            String inferBinaryName(Iterable<? extends Path> paths) {
+            public String inferBinaryName(Iterable<? extends Path> paths) {
                 return toBinaryName(dir.relativize(path));
             }
         };
@@ -84,25 +84,40 @@ abstract class PathFileObject implements JavaFileObject {
      * Create a PathFileObject in a file system such as a jar file, such that
      * the binary name can be inferred from its position within the filesystem.
      */
-    static PathFileObject createJarPathFileObject(JavacPathFileManager fileManager,
+    public static PathFileObject createJarPathFileObject(BaseFileManager fileManager,
             final Path path) {
         return new PathFileObject(fileManager, path) {
             @Override
-            String inferBinaryName(Iterable<? extends Path> paths) {
+            public String inferBinaryName(Iterable<? extends Path> paths) {
                 return toBinaryName(path);
             }
         };
     }
 
+    /**
+     * Create a PathFileObject in a modular file system, such as jrt:, such that
+     * the binary name can be inferred from its position within the filesystem.
+     */
+    public static PathFileObject createJRTPathFileObject(BaseFileManager fileManager,
+            final Path path) {
+        return new PathFileObject(fileManager, path) {
+            @Override
+            public String inferBinaryName(Iterable<? extends Path> paths) {
+                // use subpath to ignore the leading component containing the module name
+                return toBinaryName(path.subpath(1, path.getNameCount()));
+            }
+        };
+    }
+
     /**
      * Create a PathFileObject whose binary name can be inferred from the
      * relative path to a sibling.
      */
-    static PathFileObject createSiblingPathFileObject(JavacPathFileManager fileManager,
+    static PathFileObject createSiblingPathFileObject(BaseFileManager fileManager,
             final Path path, final String relativePath) {
         return new PathFileObject(fileManager, path) {
             @Override
-            String inferBinaryName(Iterable<? extends Path> paths) {
+            public String inferBinaryName(Iterable<? extends Path> paths) {
                 return toBinaryName(relativePath, "/");
             }
         };
@@ -112,11 +127,11 @@ abstract class PathFileObject implements JavaFileObject {
      * Create a PathFileObject whose binary name might be inferred from its
      * position on a search path.
      */
-    static PathFileObject createSimplePathFileObject(JavacPathFileManager fileManager,
+    static PathFileObject createSimplePathFileObject(BaseFileManager fileManager,
             final Path path) {
         return new PathFileObject(fileManager, path) {
             @Override
-            String inferBinaryName(Iterable<? extends Path> paths) {
+            public String inferBinaryName(Iterable<? extends Path> paths) {
                 Path absPath = path.toAbsolutePath();
                 for (Path p: paths) {
                     Path ap = p.toAbsolutePath();
@@ -135,20 +150,20 @@ abstract class PathFileObject implements JavaFileObject {
         };
     }
 
-    protected PathFileObject(JavacPathFileManager fileManager, Path path) {
+    protected PathFileObject(BaseFileManager fileManager, Path path) {
         fileManager.getClass(); // null check
         path.getClass();        // null check
         this.fileManager = fileManager;
         this.path = path;
     }
 
-    abstract String inferBinaryName(Iterable<? extends Path> paths);
+    public abstract String inferBinaryName(Iterable<? extends Path> paths);
 
     /**
      * Return the Path for this object.
      * @return the Path for this object.
      */
-    Path getPath() {
+    public Path getPath() {
         return path;
     }
 
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/ct.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/ct.properties
new file mode 100644
index 00000000000..71f53c1ea70
--- /dev/null
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/ct.properties
@@ -0,0 +1,749 @@
+apple.applescript.*: hidden
+apple.laf.*: hidden
+apple.security.*: hidden
+com.apple.concurrent.*: hidden
+com.apple.eawt.*: hidden
+com.apple.eawt.event.*: hidden
+com.apple.eio.*: hidden
+com.apple.laf.*: hidden
+com.oracle.webservices.internal.api.*: hidden
+com.oracle.webservices.internal.api.databinding.*: hidden
+com.oracle.webservices.internal.api.message.*: hidden
+com.oracle.webservices.internal.impl.encoding.*: hidden
+com.oracle.webservices.internal.impl.internalspi.encoding.*: hidden
+com.oracle.xmlns.internal.webservices.jaxws_databinding.*: hidden
+com.sun.accessibility.internal.resources.*: proprietary
+com.sun.activation.registries.*: hidden
+com.sun.awt.*: proprietary
+com.sun.beans.*: proprietary
+com.sun.beans.decoder.*: hidden
+com.sun.beans.editors.*: hidden
+com.sun.beans.finder.*: hidden
+com.sun.beans.infos.*: hidden
+com.sun.beans.introspect.*: hidden
+com.sun.beans.util.*: hidden
+com.sun.corba.se.impl.activation.*: proprietary
+com.sun.corba.se.impl.copyobject.*: proprietary
+com.sun.corba.se.impl.corba.*: proprietary
+com.sun.corba.se.impl.dynamicany.*: proprietary
+com.sun.corba.se.impl.encoding.*: proprietary
+com.sun.corba.se.impl.interceptors.*: proprietary
+com.sun.corba.se.impl.io.*: proprietary
+com.sun.corba.se.impl.ior.*: proprietary
+com.sun.corba.se.impl.ior.iiop.*: proprietary
+com.sun.corba.se.impl.javax.rmi.*: proprietary
+com.sun.corba.se.impl.javax.rmi.CORBA.*: proprietary
+com.sun.corba.se.impl.legacy.connection.*: proprietary
+com.sun.corba.se.impl.logging.*: proprietary
+com.sun.corba.se.impl.monitoring.*: proprietary
+com.sun.corba.se.impl.naming.cosnaming.*: proprietary
+com.sun.corba.se.impl.naming.namingutil.*: proprietary
+com.sun.corba.se.impl.naming.pcosnaming.*: proprietary
+com.sun.corba.se.impl.oa.*: proprietary
+com.sun.corba.se.impl.oa.poa.*: proprietary
+com.sun.corba.se.impl.oa.toa.*: proprietary
+com.sun.corba.se.impl.orb.*: proprietary
+com.sun.corba.se.impl.orbutil.*: proprietary
+com.sun.corba.se.impl.orbutil.closure.*: proprietary
+com.sun.corba.se.impl.orbutil.concurrent.*: proprietary
+com.sun.corba.se.impl.orbutil.fsm.*: proprietary
+com.sun.corba.se.impl.orbutil.graph.*: proprietary
+com.sun.corba.se.impl.orbutil.threadpool.*: proprietary
+com.sun.corba.se.impl.presentation.rmi.*: proprietary
+com.sun.corba.se.impl.protocol.*: proprietary
+com.sun.corba.se.impl.protocol.giopmsgheaders.*: proprietary
+com.sun.corba.se.impl.resolver.*: proprietary
+com.sun.corba.se.impl.transport.*: proprietary
+com.sun.corba.se.impl.util.*: proprietary
+com.sun.corba.se.internal.CosNaming.*: proprietary
+com.sun.corba.se.internal.Interceptors.*: proprietary
+com.sun.corba.se.internal.POA.*: proprietary
+com.sun.corba.se.internal.corba.*: proprietary
+com.sun.corba.se.internal.iiop.*: proprietary
+com.sun.corba.se.org.omg.CORBA.*: proprietary
+com.sun.corba.se.pept.broker.*: proprietary
+com.sun.corba.se.pept.encoding.*: proprietary
+com.sun.corba.se.pept.protocol.*: proprietary
+com.sun.corba.se.pept.transport.*: proprietary
+com.sun.corba.se.spi.activation.*: proprietary
+com.sun.corba.se.spi.activation.InitialNameServicePackage.*: proprietary
+com.sun.corba.se.spi.activation.LocatorPackage.*: proprietary
+com.sun.corba.se.spi.activation.RepositoryPackage.*: proprietary
+com.sun.corba.se.spi.copyobject.*: proprietary
+com.sun.corba.se.spi.encoding.*: proprietary
+com.sun.corba.se.spi.extension.*: proprietary
+com.sun.corba.se.spi.ior.*: proprietary
+com.sun.corba.se.spi.ior.iiop.*: proprietary
+com.sun.corba.se.spi.legacy.connection.*: proprietary
+com.sun.corba.se.spi.legacy.interceptor.*: proprietary
+com.sun.corba.se.spi.logging.*: proprietary
+com.sun.corba.se.spi.monitoring.*: proprietary
+com.sun.corba.se.spi.oa.*: proprietary
+com.sun.corba.se.spi.orb.*: proprietary
+com.sun.corba.se.spi.orbutil.closure.*: proprietary
+com.sun.corba.se.spi.orbutil.fsm.*: proprietary
+com.sun.corba.se.spi.orbutil.proxy.*: proprietary
+com.sun.corba.se.spi.orbutil.threadpool.*: proprietary
+com.sun.corba.se.spi.presentation.rmi.*: proprietary
+com.sun.corba.se.spi.protocol.*: proprietary
+com.sun.corba.se.spi.resolver.*: proprietary
+com.sun.corba.se.spi.servicecontext.*: proprietary
+com.sun.corba.se.spi.transport.*: proprietary
+com.sun.demo.jvmti.hprof.*: hidden
+com.sun.imageio.plugins.bmp.*: proprietary
+com.sun.imageio.plugins.common.*: proprietary
+com.sun.imageio.plugins.gif.*: proprietary
+com.sun.imageio.plugins.jpeg.*: proprietary
+com.sun.imageio.plugins.png.*: proprietary
+com.sun.imageio.plugins.wbmp.*: proprietary
+com.sun.imageio.spi.*: proprietary
+com.sun.imageio.stream.*: hidden
+com.sun.istack.internal.*: hidden
+com.sun.istack.internal.localization.*: hidden
+com.sun.istack.internal.logging.*: hidden
+com.sun.java.swing.*: proprietary
+com.sun.java.swing.plaf.gtk.resources.*: proprietary
+com.sun.java.swing.plaf.motif.resources.*: proprietary
+com.sun.java.swing.plaf.nimbus.*: proprietary
+com.sun.java.swing.plaf.windows.resources.*: proprietary
+com.sun.java.util.jar.pack.*: proprietary compact1
+com.sun.java_cup.internal.runtime.*: proprietary compact2
+com.sun.jmx.defaults.*: proprietary compact3
+com.sun.jmx.interceptor.*: proprietary compact3
+com.sun.jmx.mbeanserver.*: proprietary compact3
+com.sun.jmx.remote.internal.*: proprietary compact3
+com.sun.jmx.remote.protocol.rmi.*: proprietary compact3
+com.sun.jmx.remote.security.*: proprietary compact3
+com.sun.jmx.remote.util.*: proprietary compact3
+com.sun.jndi.cosnaming.*: proprietary
+com.sun.jndi.dns.*: proprietary compact3
+com.sun.jndi.ldap.*: proprietary compact3
+com.sun.jndi.ldap.ext.*: proprietary compact3
+com.sun.jndi.ldap.pool.*: proprietary compact3
+com.sun.jndi.ldap.sasl.*: proprietary compact3
+com.sun.jndi.rmi.registry.*: proprietary compact3
+com.sun.jndi.toolkit.corba.*: proprietary
+com.sun.jndi.toolkit.ctx.*: proprietary compact3
+com.sun.jndi.toolkit.dir.*: proprietary compact3
+com.sun.jndi.toolkit.url.*: proprietary compact3
+com.sun.jndi.url.corbaname.*: proprietary
+com.sun.jndi.url.dns.*: proprietary compact3
+com.sun.jndi.url.iiop.*: proprietary
+com.sun.jndi.url.iiopname.*: proprietary
+com.sun.jndi.url.ldap.*: proprietary compact3
+com.sun.jndi.url.ldaps.*: proprietary compact3
+com.sun.jndi.url.rmi.*: proprietary compact3
+com.sun.management.*: compact3
+com.sun.media.sound.*: proprietary
+com.sun.naming.internal.*: proprietary compact3
+com.sun.net.httpserver.*: compact2
+com.sun.net.httpserver.spi.*: compact2
+com.sun.net.ssl.*: compact1
+com.sun.net.ssl.internal.www.protocol.https.*: proprietary compact1
+com.sun.nio.file.*: compact1
+com.sun.nio.sctp.*: compact3
+com.sun.org.apache.bcel.internal.*: proprietary compact2
+com.sun.org.apache.bcel.internal.classfile.*: proprietary compact2
+com.sun.org.apache.bcel.internal.generic.*: proprietary compact2
+com.sun.org.apache.bcel.internal.util.*: proprietary compact2
+com.sun.org.apache.regexp.internal.*: proprietary compact2
+com.sun.org.apache.xalan.internal.*: proprietary compact2
+com.sun.org.apache.xalan.internal.extensions.*: proprietary compact2
+com.sun.org.apache.xalan.internal.lib.*: proprietary compact2
+com.sun.org.apache.xalan.internal.res.*: proprietary compact2
+com.sun.org.apache.xalan.internal.templates.*: proprietary compact2
+com.sun.org.apache.xalan.internal.utils.*: hidden
+com.sun.org.apache.xalan.internal.xslt.*: proprietary compact2
+com.sun.org.apache.xalan.internal.xsltc.*: proprietary compact2
+com.sun.org.apache.xalan.internal.xsltc.cmdline.*: proprietary compact2
+com.sun.org.apache.xalan.internal.xsltc.cmdline.getopt.*: proprietary compact2
+com.sun.org.apache.xalan.internal.xsltc.compiler.*: proprietary compact2
+com.sun.org.apache.xalan.internal.xsltc.compiler.util.*: proprietary compact2
+com.sun.org.apache.xalan.internal.xsltc.dom.*: proprietary compact2
+com.sun.org.apache.xalan.internal.xsltc.runtime.*: proprietary compact2
+com.sun.org.apache.xalan.internal.xsltc.runtime.output.*: proprietary compact2
+com.sun.org.apache.xalan.internal.xsltc.trax.*: proprietary compact2
+com.sun.org.apache.xalan.internal.xsltc.util.*: proprietary compact2
+com.sun.org.apache.xerces.internal.dom.*: proprietary compact2
+com.sun.org.apache.xerces.internal.dom.events.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.dtd.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.dtd.models.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.dv.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.dv.dtd.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.dv.util.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.dv.xs.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.io.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.msg.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.validation.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.xpath.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.xpath.regex.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.xs.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.xs.identity.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.xs.models.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.xs.opti.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.xs.traversers.*: proprietary compact2
+com.sun.org.apache.xerces.internal.impl.xs.util.*: proprietary compact2
+com.sun.org.apache.xerces.internal.jaxp.*: proprietary compact2
+com.sun.org.apache.xerces.internal.jaxp.datatype.*: proprietary compact2
+com.sun.org.apache.xerces.internal.jaxp.validation.*: proprietary compact2
+com.sun.org.apache.xerces.internal.parsers.*: proprietary compact2
+com.sun.org.apache.xerces.internal.util.*: proprietary compact2
+com.sun.org.apache.xerces.internal.utils.*: hidden
+com.sun.org.apache.xerces.internal.xinclude.*: proprietary compact2
+com.sun.org.apache.xerces.internal.xni.*: proprietary compact2
+com.sun.org.apache.xerces.internal.xni.grammars.*: proprietary compact2
+com.sun.org.apache.xerces.internal.xni.parser.*: proprietary compact2
+com.sun.org.apache.xerces.internal.xpointer.*: hidden
+com.sun.org.apache.xerces.internal.xs.*: proprietary compact2
+com.sun.org.apache.xerces.internal.xs.datatypes.*: hidden
+com.sun.org.apache.xml.internal.dtm.*: proprietary compact2
+com.sun.org.apache.xml.internal.dtm.ref.*: proprietary compact2
+com.sun.org.apache.xml.internal.dtm.ref.dom2dtm.*: proprietary compact2
+com.sun.org.apache.xml.internal.dtm.ref.sax2dtm.*: proprietary compact2
+com.sun.org.apache.xml.internal.res.*: proprietary compact2
+com.sun.org.apache.xml.internal.resolver.*: hidden
+com.sun.org.apache.xml.internal.resolver.helpers.*: hidden
+com.sun.org.apache.xml.internal.resolver.readers.*: hidden
+com.sun.org.apache.xml.internal.resolver.tools.*: hidden
+com.sun.org.apache.xml.internal.security.*: hidden
+com.sun.org.apache.xml.internal.security.algorithms.*: hidden
+com.sun.org.apache.xml.internal.security.algorithms.implementations.*: hidden
+com.sun.org.apache.xml.internal.security.c14n.*: hidden
+com.sun.org.apache.xml.internal.security.c14n.helper.*: hidden
+com.sun.org.apache.xml.internal.security.c14n.implementations.*: hidden
+com.sun.org.apache.xml.internal.security.encryption.*: hidden
+com.sun.org.apache.xml.internal.security.exceptions.*: hidden
+com.sun.org.apache.xml.internal.security.keys.*: hidden
+com.sun.org.apache.xml.internal.security.keys.content.*: hidden
+com.sun.org.apache.xml.internal.security.keys.content.keyvalues.*: hidden
+com.sun.org.apache.xml.internal.security.keys.content.x509.*: hidden
+com.sun.org.apache.xml.internal.security.keys.keyresolver.*: hidden
+com.sun.org.apache.xml.internal.security.keys.keyresolver.implementations.*: hidden
+com.sun.org.apache.xml.internal.security.keys.storage.*: hidden
+com.sun.org.apache.xml.internal.security.keys.storage.implementations.*: hidden
+com.sun.org.apache.xml.internal.security.signature.*: hidden
+com.sun.org.apache.xml.internal.security.signature.reference.*: hidden
+com.sun.org.apache.xml.internal.security.transforms.*: hidden
+com.sun.org.apache.xml.internal.security.transforms.implementations.*: hidden
+com.sun.org.apache.xml.internal.security.transforms.params.*: hidden
+com.sun.org.apache.xml.internal.security.utils.*: hidden
+com.sun.org.apache.xml.internal.security.utils.resolver.*: hidden
+com.sun.org.apache.xml.internal.security.utils.resolver.implementations.*: hidden
+com.sun.org.apache.xml.internal.serialize.*: proprietary compact2
+com.sun.org.apache.xml.internal.serializer.*: proprietary compact2
+com.sun.org.apache.xml.internal.serializer.dom3.*: hidden
+com.sun.org.apache.xml.internal.serializer.utils.*: hidden
+com.sun.org.apache.xml.internal.utils.*: proprietary compact2
+com.sun.org.apache.xml.internal.utils.res.*: proprietary compact2
+com.sun.org.apache.xpath.internal.*: proprietary compact2
+com.sun.org.apache.xpath.internal.axes.*: proprietary compact2
+com.sun.org.apache.xpath.internal.compiler.*: proprietary compact2
+com.sun.org.apache.xpath.internal.domapi.*: hidden
+com.sun.org.apache.xpath.internal.functions.*: proprietary compact2
+com.sun.org.apache.xpath.internal.jaxp.*: proprietary compact2
+com.sun.org.apache.xpath.internal.objects.*: proprietary compact2
+com.sun.org.apache.xpath.internal.operations.*: proprietary compact2
+com.sun.org.apache.xpath.internal.patterns.*: proprietary compact2
+com.sun.org.apache.xpath.internal.res.*: proprietary compact2
+com.sun.org.glassfish.external.amx.*: hidden
+com.sun.org.glassfish.external.arc.*: hidden
+com.sun.org.glassfish.external.probe.provider.*: hidden
+com.sun.org.glassfish.external.probe.provider.annotations.*: hidden
+com.sun.org.glassfish.external.statistics.*: hidden
+com.sun.org.glassfish.external.statistics.annotations.*: hidden
+com.sun.org.glassfish.external.statistics.impl.*: hidden
+com.sun.org.glassfish.gmbal.*: hidden
+com.sun.org.glassfish.gmbal.util.*: hidden
+com.sun.org.omg.CORBA.*: proprietary
+com.sun.org.omg.CORBA.ValueDefPackage.*: proprietary
+com.sun.org.omg.CORBA.portable.*: proprietary
+com.sun.org.omg.SendingContext.*: proprietary
+com.sun.org.omg.SendingContext.CodeBasePackage.*: proprietary
+com.sun.rmi.rmid.*: proprietary compact2
+com.sun.rowset.*: proprietary compact3
+com.sun.rowset.internal.*: proprietary compact3
+com.sun.rowset.providers.*: proprietary compact3
+com.sun.security.auth.*: compact3
+com.sun.security.auth.callback.*: compact3
+com.sun.security.auth.login.*: compact3
+com.sun.security.auth.module.*: compact3
+com.sun.security.cert.internal.x509.*: proprietary compact1
+com.sun.security.jgss.*: compact3
+com.sun.security.ntlm.*: hidden
+com.sun.security.sasl.*: proprietary compact3
+com.sun.security.sasl.digest.*: proprietary compact3
+com.sun.security.sasl.gsskerb.*: proprietary compact3
+com.sun.security.sasl.ntlm.*: hidden
+com.sun.security.sasl.util.*: proprietary compact3
+com.sun.swing.internal.plaf.basic.resources.*: proprietary
+com.sun.swing.internal.plaf.metal.resources.*: proprietary
+com.sun.swing.internal.plaf.synth.resources.*: proprietary
+com.sun.tracing.*: proprietary compact3
+com.sun.tracing.dtrace.*: proprietary compact3
+com.sun.xml.internal.bind.*: hidden
+com.sun.xml.internal.bind.annotation.*: hidden
+com.sun.xml.internal.bind.api.*: hidden
+com.sun.xml.internal.bind.api.impl.*: hidden
+com.sun.xml.internal.bind.marshaller.*: hidden
+com.sun.xml.internal.bind.unmarshaller.*: hidden
+com.sun.xml.internal.bind.util.*: hidden
+com.sun.xml.internal.bind.v2.*: hidden
+com.sun.xml.internal.bind.v2.bytecode.*: hidden
+com.sun.xml.internal.bind.v2.model.annotation.*: hidden
+com.sun.xml.internal.bind.v2.model.core.*: hidden
+com.sun.xml.internal.bind.v2.model.impl.*: hidden
+com.sun.xml.internal.bind.v2.model.nav.*: hidden
+com.sun.xml.internal.bind.v2.model.runtime.*: hidden
+com.sun.xml.internal.bind.v2.model.util.*: hidden
+com.sun.xml.internal.bind.v2.runtime.*: hidden
+com.sun.xml.internal.bind.v2.runtime.output.*: hidden
+com.sun.xml.internal.bind.v2.runtime.property.*: hidden
+com.sun.xml.internal.bind.v2.runtime.reflect.*: hidden
+com.sun.xml.internal.bind.v2.runtime.reflect.opt.*: hidden
+com.sun.xml.internal.bind.v2.runtime.unmarshaller.*: hidden
+com.sun.xml.internal.bind.v2.schemagen.*: hidden
+com.sun.xml.internal.bind.v2.schemagen.episode.*: hidden
+com.sun.xml.internal.bind.v2.schemagen.xmlschema.*: hidden
+com.sun.xml.internal.bind.v2.util.*: hidden
+com.sun.xml.internal.fastinfoset.*: hidden
+com.sun.xml.internal.fastinfoset.algorithm.*: hidden
+com.sun.xml.internal.fastinfoset.alphabet.*: hidden
+com.sun.xml.internal.fastinfoset.dom.*: hidden
+com.sun.xml.internal.fastinfoset.org.apache.xerces.util.*: hidden
+com.sun.xml.internal.fastinfoset.sax.*: hidden
+com.sun.xml.internal.fastinfoset.stax.*: hidden
+com.sun.xml.internal.fastinfoset.stax.events.*: hidden
+com.sun.xml.internal.fastinfoset.stax.factory.*: hidden
+com.sun.xml.internal.fastinfoset.stax.util.*: hidden
+com.sun.xml.internal.fastinfoset.tools.*: hidden
+com.sun.xml.internal.fastinfoset.util.*: hidden
+com.sun.xml.internal.fastinfoset.vocab.*: hidden
+com.sun.xml.internal.messaging.saaj.*: hidden
+com.sun.xml.internal.messaging.saaj.client.p2p.*: hidden
+com.sun.xml.internal.messaging.saaj.packaging.mime.*: hidden
+com.sun.xml.internal.messaging.saaj.packaging.mime.internet.*: hidden
+com.sun.xml.internal.messaging.saaj.packaging.mime.util.*: hidden
+com.sun.xml.internal.messaging.saaj.soap.*: hidden
+com.sun.xml.internal.messaging.saaj.soap.dynamic.*: hidden
+com.sun.xml.internal.messaging.saaj.soap.impl.*: hidden
+com.sun.xml.internal.messaging.saaj.soap.name.*: hidden
+com.sun.xml.internal.messaging.saaj.soap.ver1_1.*: hidden
+com.sun.xml.internal.messaging.saaj.soap.ver1_2.*: hidden
+com.sun.xml.internal.messaging.saaj.util.*: hidden
+com.sun.xml.internal.messaging.saaj.util.stax.*: hidden
+com.sun.xml.internal.messaging.saaj.util.transform.*: hidden
+com.sun.xml.internal.org.jvnet.fastinfoset.*: hidden
+com.sun.xml.internal.org.jvnet.fastinfoset.sax.*: hidden
+com.sun.xml.internal.org.jvnet.fastinfoset.sax.helpers.*: hidden
+com.sun.xml.internal.org.jvnet.fastinfoset.stax.*: hidden
+com.sun.xml.internal.org.jvnet.mimepull.*: hidden
+com.sun.xml.internal.org.jvnet.staxex.*: hidden
+com.sun.xml.internal.org.jvnet.staxex.util.*: hidden
+com.sun.xml.internal.stream.*: hidden
+com.sun.xml.internal.stream.buffer.*: hidden
+com.sun.xml.internal.stream.buffer.sax.*: hidden
+com.sun.xml.internal.stream.buffer.stax.*: hidden
+com.sun.xml.internal.stream.dtd.*: hidden
+com.sun.xml.internal.stream.dtd.nonvalidating.*: hidden
+com.sun.xml.internal.stream.events.*: hidden
+com.sun.xml.internal.stream.util.*: hidden
+com.sun.xml.internal.stream.writers.*: hidden
+com.sun.xml.internal.txw2.*: hidden
+com.sun.xml.internal.txw2.annotation.*: hidden
+com.sun.xml.internal.txw2.output.*: hidden
+com.sun.xml.internal.ws.*: hidden
+com.sun.xml.internal.ws.addressing.*: hidden
+com.sun.xml.internal.ws.addressing.model.*: hidden
+com.sun.xml.internal.ws.addressing.policy.*: hidden
+com.sun.xml.internal.ws.addressing.v200408.*: hidden
+com.sun.xml.internal.ws.api.*: hidden
+com.sun.xml.internal.ws.api.addressing.*: hidden
+com.sun.xml.internal.ws.api.client.*: hidden
+com.sun.xml.internal.ws.api.config.management.*: hidden
+com.sun.xml.internal.ws.api.config.management.policy.*: hidden
+com.sun.xml.internal.ws.api.databinding.*: hidden
+com.sun.xml.internal.ws.api.fastinfoset.*: hidden
+com.sun.xml.internal.ws.api.ha.*: hidden
+com.sun.xml.internal.ws.api.handler.*: hidden
+com.sun.xml.internal.ws.api.message.*: hidden
+com.sun.xml.internal.ws.api.message.saaj.*: hidden
+com.sun.xml.internal.ws.api.message.stream.*: hidden
+com.sun.xml.internal.ws.api.model.*: hidden
+com.sun.xml.internal.ws.api.model.soap.*: hidden
+com.sun.xml.internal.ws.api.model.wsdl.*: hidden
+com.sun.xml.internal.ws.api.model.wsdl.editable.*: hidden
+com.sun.xml.internal.ws.api.pipe.*: hidden
+com.sun.xml.internal.ws.api.pipe.helper.*: hidden
+com.sun.xml.internal.ws.api.policy.*: hidden
+com.sun.xml.internal.ws.api.policy.subject.*: hidden
+com.sun.xml.internal.ws.api.server.*: hidden
+com.sun.xml.internal.ws.api.streaming.*: hidden
+com.sun.xml.internal.ws.api.wsdl.parser.*: hidden
+com.sun.xml.internal.ws.api.wsdl.writer.*: hidden
+com.sun.xml.internal.ws.assembler.*: hidden
+com.sun.xml.internal.ws.assembler.dev.*: hidden
+com.sun.xml.internal.ws.assembler.jaxws.*: hidden
+com.sun.xml.internal.ws.binding.*: hidden
+com.sun.xml.internal.ws.client.*: hidden
+com.sun.xml.internal.ws.client.dispatch.*: hidden
+com.sun.xml.internal.ws.client.sei.*: hidden
+com.sun.xml.internal.ws.commons.xmlutil.*: hidden
+com.sun.xml.internal.ws.config.management.policy.*: hidden
+com.sun.xml.internal.ws.config.metro.dev.*: hidden
+com.sun.xml.internal.ws.config.metro.util.*: hidden
+com.sun.xml.internal.ws.db.*: hidden
+com.sun.xml.internal.ws.db.glassfish.*: hidden
+com.sun.xml.internal.ws.developer.*: hidden
+com.sun.xml.internal.ws.dump.*: hidden
+com.sun.xml.internal.ws.encoding.*: hidden
+com.sun.xml.internal.ws.encoding.fastinfoset.*: hidden
+com.sun.xml.internal.ws.encoding.policy.*: hidden
+com.sun.xml.internal.ws.encoding.soap.*: hidden
+com.sun.xml.internal.ws.encoding.soap.streaming.*: hidden
+com.sun.xml.internal.ws.encoding.xml.*: hidden
+com.sun.xml.internal.ws.fault.*: hidden
+com.sun.xml.internal.ws.handler.*: hidden
+com.sun.xml.internal.ws.message.*: hidden
+com.sun.xml.internal.ws.message.jaxb.*: hidden
+com.sun.xml.internal.ws.message.saaj.*: hidden
+com.sun.xml.internal.ws.message.source.*: hidden
+com.sun.xml.internal.ws.message.stream.*: hidden
+com.sun.xml.internal.ws.model.*: hidden
+com.sun.xml.internal.ws.model.soap.*: hidden
+com.sun.xml.internal.ws.model.wsdl.*: hidden
+com.sun.xml.internal.ws.org.objectweb.asm.*: hidden
+com.sun.xml.internal.ws.policy.*: hidden
+com.sun.xml.internal.ws.policy.jaxws.*: hidden
+com.sun.xml.internal.ws.policy.jaxws.spi.*: hidden
+com.sun.xml.internal.ws.policy.privateutil.*: hidden
+com.sun.xml.internal.ws.policy.sourcemodel.*: hidden
+com.sun.xml.internal.ws.policy.sourcemodel.attach.*: hidden
+com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.*: hidden
+com.sun.xml.internal.ws.policy.spi.*: hidden
+com.sun.xml.internal.ws.policy.subject.*: hidden
+com.sun.xml.internal.ws.protocol.soap.*: hidden
+com.sun.xml.internal.ws.protocol.xml.*: hidden
+com.sun.xml.internal.ws.resources.*: hidden
+com.sun.xml.internal.ws.runtime.config.*: hidden
+com.sun.xml.internal.ws.server.*: hidden
+com.sun.xml.internal.ws.server.provider.*: hidden
+com.sun.xml.internal.ws.server.sei.*: hidden
+com.sun.xml.internal.ws.spi.*: hidden
+com.sun.xml.internal.ws.spi.db.*: hidden
+com.sun.xml.internal.ws.streaming.*: hidden
+com.sun.xml.internal.ws.transport.*: hidden
+com.sun.xml.internal.ws.transport.http.*: hidden
+com.sun.xml.internal.ws.transport.http.client.*: hidden
+com.sun.xml.internal.ws.transport.http.server.*: hidden
+com.sun.xml.internal.ws.util.*: hidden
+com.sun.xml.internal.ws.util.exception.*: hidden
+com.sun.xml.internal.ws.util.pipe.*: hidden
+com.sun.xml.internal.ws.util.xml.*: hidden
+com.sun.xml.internal.ws.wsdl.*: hidden
+com.sun.xml.internal.ws.wsdl.parser.*: hidden
+com.sun.xml.internal.ws.wsdl.writer.*: hidden
+com.sun.xml.internal.ws.wsdl.writer.document.*: hidden
+com.sun.xml.internal.ws.wsdl.writer.document.http.*: hidden
+com.sun.xml.internal.ws.wsdl.writer.document.soap.*: hidden
+com.sun.xml.internal.ws.wsdl.writer.document.soap12.*: hidden
+com.sun.xml.internal.ws.wsdl.writer.document.xsd.*: hidden
+java.awt.dnd.peer.*: proprietary
+java.awt.peer.*: proprietary
+java.desktop.macosx.classes.com.apple.laf.resources.*: hidden
+java.desktop.macosx.classes.sun.awt.resources.*: hidden
+java.desktop.windows.classes.sun.awt.windows.*: hidden
+java.io.*: compact1
+java.lang.*: compact1
+java.lang.annotation.*: compact1
+java.lang.instrument.*: compact3
+java.lang.invoke.*: compact1
+java.lang.management.*: compact3
+java.lang.ref.*: compact1
+java.lang.reflect.*: compact1
+java.math.*: compact1
+java.net.*: compact1
+java.nio.*: compact1
+java.nio.channels.*: compact1
+java.nio.channels.spi.*: compact1
+java.nio.charset.*: compact1
+java.nio.charset.spi.*: compact1
+java.nio.file.*: compact1
+java.nio.file.attribute.*: compact1
+java.nio.file.spi.*: compact1
+java.rmi.*: compact2
+java.rmi.activation.*: compact2
+java.rmi.dgc.*: compact2
+java.rmi.registry.*: compact2
+java.rmi.server.*: compact2
+java.security.*: compact1
+java.security.acl.*: compact3
+java.security.cert.*: compact1
+java.security.interfaces.*: compact1
+java.security.spec.*: compact1
+java.sql.*: compact2
+java.text.*: compact1
+java.text.spi.*: compact1
+java.time.*: compact1
+java.time.chrono.*: compact1
+java.time.format.*: compact1
+java.time.temporal.*: compact1
+java.time.zone.*: compact1
+java.util.*: compact1
+java.util.concurrent.*: compact1
+java.util.concurrent.atomic.*: compact1
+java.util.concurrent.locks.*: compact1
+java.util.function.*: compact1
+java.util.jar.*: compact1
+java.util.logging.*: compact1
+java.util.prefs.*: compact3
+java.util.regex.*: compact1
+java.util.spi.*: compact1
+java.util.stream.*: compact1
+java.util.zip.*: compact1
+javax.annotation.processing.*: compact3
+javax.lang.model.*: compact3
+javax.lang.model.element.*: compact3
+javax.lang.model.type.*: compact3
+javax.lang.model.util.*: compact3
+javax.management.*: compact3
+javax.management.loading.*: compact3
+javax.management.modelmbean.*: compact3
+javax.management.monitor.*: compact3
+javax.management.openmbean.*: compact3
+javax.management.relation.*: compact3
+javax.management.remote.*: compact3
+javax.management.remote.rmi.*: compact3
+javax.management.timer.*: compact3
+javax.naming.*: compact3
+javax.naming.directory.*: compact3
+javax.naming.event.*: compact3
+javax.naming.ldap.*: compact3
+javax.naming.spi.*: compact3
+javax.net.*: compact1
+javax.net.ssl.*: compact1
+javax.rmi.ssl.*: compact2
+javax.script.*: compact1
+javax.security.auth.*: compact1
+javax.security.auth.callback.*: compact1
+javax.security.auth.kerberos.*: compact3
+javax.security.auth.login.*: compact1
+javax.security.auth.spi.*: compact1
+javax.security.auth.x500.*: compact1
+javax.security.cert.*: compact1
+javax.security.sasl.*: compact3
+javax.smartcardio.*: compact3
+javax.sql.*: compact2
+javax.sql.rowset.*: compact3
+javax.sql.rowset.serial.*: compact3
+javax.sql.rowset.spi.*: compact3
+javax.tools.*: compact3
+javax.transaction.xa.*: compact2
+javax.xml.*: compact2
+javax.xml.crypto.*: compact3
+javax.xml.crypto.dom.*: compact3
+javax.xml.crypto.dsig.*: compact3
+javax.xml.crypto.dsig.dom.*: compact3
+javax.xml.crypto.dsig.keyinfo.*: compact3
+javax.xml.crypto.dsig.spec.*: compact3
+javax.xml.datatype.*: compact2
+javax.xml.namespace.*: compact2
+javax.xml.parsers.*: compact2
+javax.xml.stream.*: compact2
+javax.xml.stream.events.*: compact2
+javax.xml.stream.util.*: compact2
+javax.xml.transform.*: compact2
+javax.xml.transform.dom.*: compact2
+javax.xml.transform.sax.*: compact2
+javax.xml.transform.stax.*: compact2
+javax.xml.transform.stream.*: compact2
+javax.xml.validation.*: compact2
+javax.xml.xpath.*: compact2
+jdk.*: compact1
+jdk.internal.org.objectweb.asm.*: hidden
+jdk.internal.org.objectweb.asm.commons.*: hidden
+jdk.internal.org.objectweb.asm.signature.*: hidden
+jdk.internal.org.objectweb.asm.tree.*: hidden
+jdk.internal.org.objectweb.asm.tree.analysis.*: hidden
+jdk.internal.org.objectweb.asm.util.*: hidden
+jdk.internal.org.xml.sax.*: hidden
+jdk.internal.org.xml.sax.helpers.*: hidden
+jdk.internal.util.xml.*: hidden
+jdk.internal.util.xml.impl.*: hidden
+jdk.net.*: compact1
+org.ietf.jgss.*: compact3
+org.jcp.xml.dsig.internal.*: hidden
+org.jcp.xml.dsig.internal.dom.*: hidden
+org.w3c.dom.*: compact2
+org.w3c.dom.bootstrap.*: compact2
+org.w3c.dom.css.*: compact2
+org.w3c.dom.events.*: compact2
+org.w3c.dom.html.*: compact2
+org.w3c.dom.ls.*: compact2
+org.w3c.dom.ranges.*: compact2
+org.w3c.dom.stylesheets.*: compact2
+org.w3c.dom.traversal.*: compact2
+org.w3c.dom.views.*: compact2
+org.w3c.dom.xpath.*: hidden
+org.xml.sax.*: compact2
+org.xml.sax.ext.*: compact2
+org.xml.sax.helpers.*: compact2
+sun.applet.*: proprietary
+sun.applet.resources.*: proprietary
+sun.awt.*: proprietary
+sun.awt.X11.*: proprietary
+sun.awt.datatransfer.*: proprietary
+sun.awt.dnd.*: proprietary
+sun.awt.event.*: hidden
+sun.awt.geom.*: proprietary
+sun.awt.im.*: proprietary
+sun.awt.image.*: proprietary
+sun.awt.motif.*: proprietary
+sun.awt.resources.*: proprietary
+sun.awt.shell.*: proprietary
+sun.awt.util.*: hidden
+sun.awt.windows.*: proprietary
+sun.corba.*: proprietary
+sun.datatransfer.*: hidden
+sun.font.*: proprietary
+sun.instrument.*: proprietary compact3
+sun.invoke.*: hidden
+sun.invoke.anon.*: hidden
+sun.invoke.empty.*: hidden
+sun.invoke.util.*: hidden
+sun.io.*: proprietary compact1
+sun.java2d.*: proprietary
+sun.java2d.cmm.*: hidden
+sun.java2d.cmm.lcms.*: hidden
+sun.java2d.d3d.*: hidden
+sun.java2d.jules.*: hidden
+sun.java2d.loops.*: proprietary
+sun.java2d.opengl.*: proprietary
+sun.java2d.pipe.*: proprietary
+sun.java2d.pipe.hw.*: hidden
+sun.java2d.pisces.*: hidden
+sun.java2d.windows.*: hidden
+sun.java2d.x11.*: hidden
+sun.java2d.xr.*: hidden
+sun.launcher.*: hidden
+sun.launcher.resources.*: hidden
+sun.lwawt.*: hidden
+sun.lwawt.macosx.*: hidden
+sun.management.*: proprietary compact3
+sun.management.counter.*: proprietary compact3
+sun.management.counter.perf.*: proprietary compact3
+sun.management.jdp.*: hidden
+sun.management.jmxremote.*: proprietary compact3
+sun.management.resources.*: proprietary compact3
+sun.misc.*: proprietary compact1
+sun.misc.resources.*: proprietary compact1
+sun.net.*: proprietary compact1
+sun.net.dns.*: proprietary compact3
+sun.net.ftp.*: proprietary
+sun.net.ftp.impl.*: hidden
+sun.net.httpserver.*: hidden
+sun.net.idn.*: hidden
+sun.net.sdp.*: hidden
+sun.net.smtp.*: proprietary
+sun.net.spi.*: proprietary compact1
+sun.net.spi.nameservice.*: proprietary compact1
+sun.net.util.*: proprietary compact1
+sun.net.www.*: proprietary compact1
+sun.net.www.content.audio.*: proprietary
+sun.net.www.content.image.*: proprietary
+sun.net.www.content.text.*: proprietary
+sun.net.www.http.*: proprietary compact1
+sun.net.www.protocol.file.*: proprietary compact1
+sun.net.www.protocol.ftp.*: proprietary
+sun.net.www.protocol.http.*: proprietary compact1
+sun.net.www.protocol.http.logging.*: hidden
+sun.net.www.protocol.http.ntlm.*: hidden
+sun.net.www.protocol.http.spnego.*: hidden
+sun.net.www.protocol.https.*: proprietary compact1
+sun.net.www.protocol.jar.*: proprietary compact1
+sun.net.www.protocol.mailto.*: proprietary
+sun.net.www.protocol.netdoc.*: proprietary
+sun.nio.*: proprietary compact1
+sun.nio.ch.*: proprietary compact1
+sun.nio.ch.sctp.*: hidden
+sun.nio.cs.*: proprietary compact1
+sun.nio.fs.*: hidden
+sun.print.*: proprietary
+sun.print.resources.*: proprietary
+sun.reflect.*: proprietary compact1
+sun.reflect.annotation.*: proprietary compact1
+sun.reflect.generics.factory.*: proprietary compact1
+sun.reflect.generics.parser.*: proprietary compact1
+sun.reflect.generics.reflectiveObjects.*: proprietary compact1
+sun.reflect.generics.repository.*: proprietary compact1
+sun.reflect.generics.scope.*: proprietary compact1
+sun.reflect.generics.tree.*: proprietary compact1
+sun.reflect.generics.visitor.*: proprietary compact1
+sun.reflect.misc.*: hidden
+sun.rmi.log.*: proprietary compact2
+sun.rmi.registry.*: proprietary compact2
+sun.rmi.runtime.*: proprietary compact2
+sun.rmi.server.*: proprietary compact2
+sun.rmi.transport.*: proprietary compact2
+sun.rmi.transport.proxy.*: proprietary compact2
+sun.rmi.transport.tcp.*: proprietary compact2
+sun.security.acl.*: proprietary compact3
+sun.security.action.*: proprietary compact1
+sun.security.jca.*: proprietary compact1
+sun.security.jgss.*: proprietary compact3
+sun.security.jgss.krb5.*: proprietary compact3
+sun.security.jgss.spi.*: proprietary compact3
+sun.security.jgss.spnego.*: hidden
+sun.security.jgss.wrapper.*: hidden
+sun.security.krb5.*: proprietary compact3
+sun.security.krb5.internal.*: proprietary compact3
+sun.security.krb5.internal.ccache.*: proprietary compact3
+sun.security.krb5.internal.crypto.*: proprietary compact3
+sun.security.krb5.internal.crypto.dk.*: proprietary compact3
+sun.security.krb5.internal.ktab.*: proprietary compact3
+sun.security.krb5.internal.rcache.*: proprietary compact3
+sun.security.krb5.internal.tools.*: proprietary compact3
+sun.security.krb5.internal.util.*: proprietary compact3
+sun.security.pkcs.*: proprietary compact1
+sun.security.pkcs10.*: hidden
+sun.security.pkcs12.*: hidden
+sun.security.provider.*: proprietary compact1
+sun.security.provider.certpath.*: proprietary compact1
+sun.security.provider.certpath.ldap.*: hidden
+sun.security.provider.certpath.ssl.*: hidden
+sun.security.rsa.*: proprietary compact1
+sun.security.smartcardio.*: hidden
+sun.security.timestamp.*: proprietary compact1
+sun.security.tools.*: proprietary compact1
+sun.security.tools.keytool.*: hidden
+sun.security.tools.policytool.*: hidden
+sun.security.util.*: proprietary compact1
+sun.security.validator.*: proprietary compact1
+sun.security.x509.*: proprietary compact1
+sun.swing.*: proprietary
+sun.swing.icon.*: hidden
+sun.swing.plaf.*: hidden
+sun.swing.plaf.synth.*: proprietary
+sun.swing.plaf.windows.*: hidden
+sun.swing.table.*: hidden
+sun.swing.text.*: hidden
+sun.swing.text.html.*: hidden
+sun.text.*: proprietary compact1
+sun.text.bidi.*: hidden
+sun.text.normalizer.*: hidden
+sun.text.resources.*: proprietary compact1
+sun.text.resources.en.*: hidden
+sun.tools.jar.*: proprietary
+sun.tools.jar.resources.*: proprietary
+sun.tracing.*: hidden
+sun.tracing.dtrace.*: hidden
+sun.util.*: proprietary compact1
+sun.util.calendar.*: proprietary compact1
+sun.util.cldr.*: hidden
+sun.util.locale.*: proprietary compact1
+sun.util.locale.provider.*: hidden
+sun.util.logging.*: hidden
+sun.util.logging.resources.*: proprietary compact1
+sun.util.resources.*: hidden
+sun.util.resources.en.*: hidden
+sun.util.spi.*: hidden
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java
index 3daea85ffbd..1fd465fc3b0 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/util/BaseFileManager.java
@@ -41,6 +41,7 @@ import java.nio.charset.CoderResult;
 import java.nio.charset.CodingErrorAction;
 import java.nio.charset.IllegalCharsetNameException;
 import java.nio.charset.UnsupportedCharsetException;
+import java.nio.file.Path;
 import java.util.Collection;
 import java.util.HashMap;
 import java.util.Iterator;
@@ -414,6 +415,10 @@ public abstract class BaseFileManager implements JavaFileManager {
     }
     // </editor-fold>
 
+    public static Kind getKind(Path path) {
+        return getKind(path.getFileName().toString());
+    }
+
     public static Kind getKind(String name) {
         if (name.endsWith(Kind.CLASS.extension))
             return Kind.CLASS;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapTask.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapTask.java
index 59ddd6ba4df..30fed42cc9f 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapTask.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javap/JavapTask.java
@@ -681,6 +681,7 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
                 final URI uri = new URI(className);
                 final URL url = uri.toURL();
                 final URLConnection conn = url.openConnection();
+                conn.setUseCaches(false);
                 return new JavaFileObject() {
                     @DefinedBy(Api.COMPILER)
                     public Kind getKind() {
@@ -709,7 +710,7 @@ public class JavapTask implements DisassemblerTool.DisassemblerTask, Messages {
 
                     @DefinedBy(Api.COMPILER)
                     public String getName() {
-                        return url.toString();
+                        return uri.toString();
                     }
 
                     @DefinedBy(Api.COMPILER)
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java
index be607860b5f..d7bcd885303 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SmartFileManager.java
@@ -56,6 +56,7 @@ import com.sun.tools.javac.util.ListBuffer;
  *  This code and its internal interfaces are subject to change or
  *  deletion without notice.</b>
  */
+@com.sun.tools.javac.api.ClientCodeWrapper.Trusted
 public class SmartFileManager extends ForwardingJavaFileManager<JavaFileManager> {
 
     // Set of sources that can be seen by javac.
diff --git a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Archive.java b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Archive.java
index ebb07741db3..49e827c4bff 100644
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Archive.java
+++ b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Archive.java
@@ -28,6 +28,7 @@ import com.sun.tools.classfile.ClassFile;
 import com.sun.tools.classfile.Dependency.Location;
 
 import java.io.IOException;
+import java.io.UncheckedIOException;
 import java.nio.file.Path;
 import java.util.HashSet;
 import java.util.Map;
@@ -38,8 +39,12 @@ import java.util.concurrent.ConcurrentHashMap;
  * Represents the source of the class files.
  */
 public class Archive {
-    public static Archive getInstance(Path p) throws IOException {
-        return new Archive(p, ClassFileReader.newInstance(p));
+    public static Archive getInstance(Path p) {
+        try {
+            return new Archive(p, ClassFileReader.newInstance(p));
+        } catch (IOException e) {
+            throw new UncheckedIOException(e);
+        }
     }
 
     private final Path path;
diff --git a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/ClassFileReader.java b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/ClassFileReader.java
index 11ce3e2f954..dc1bd2cb068 100644
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/ClassFileReader.java
+++ b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/ClassFileReader.java
@@ -27,7 +27,12 @@ package com.sun.tools.jdeps;
 import com.sun.tools.classfile.ClassFile;
 import com.sun.tools.classfile.ConstantPoolException;
 import com.sun.tools.classfile.Dependencies.ClassFileError;
-import java.io.*;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
 import java.nio.file.FileVisitResult;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -36,6 +41,8 @@ import java.nio.file.attribute.BasicFileAttributes;
 import java.util.*;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 /**
  * ClassFileReader reads ClassFile(s) of a given path that can be
@@ -159,18 +166,23 @@ public class ClassFileReader {
     }
 
     private static class DirectoryReader extends ClassFileReader {
+        protected final String fsSep;
         DirectoryReader(Path path) throws IOException {
+            this(FileSystems.getDefault(), path);
+        }
+        DirectoryReader(FileSystem fs, Path path) throws IOException {
             super(path);
+            this.fsSep = fs.getSeparator();
         }
 
         public ClassFile getClassFile(String name) throws IOException {
             if (name.indexOf('.') > 0) {
                 int i = name.lastIndexOf('.');
-                String pathname = name.replace('.', File.separatorChar) + ".class";
+                String pathname = name.replace(".", fsSep) + ".class";
                 Path p = path.resolve(pathname);
                 if (!Files.exists(p)) {
                     p = path.resolve(pathname.substring(0, i) + "$" +
-                                     pathname.substring(i+1, pathname.length()));
+                            pathname.substring(i+1, pathname.length()));
                 }
                 if (Files.exists(p)) {
                     return readClassFile(p);
@@ -193,25 +205,28 @@ public class ClassFileReader {
             };
         }
 
-        private List<Path> walkTree(Path dir) throws IOException {
-            final List<Path> files = new ArrayList<>();
-            Files.walkFileTree(dir, new SimpleFileVisitor<Path>() {
-                public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
-                        throws IOException {
-                    if (file.getFileName().toString().endsWith(".class")) {
-                        files.add(file);
+        private List<Path> entries;
+        protected synchronized List<Path> walkTree() throws IOException {
+            if (entries == null) {
+                entries = new ArrayList<>();
+                Files.walkFileTree(path, new SimpleFileVisitor<Path>() {
+                    public FileVisitResult visitFile(Path file, BasicFileAttributes attrs)
+                            throws IOException {
+                        if (file.getFileName().toString().endsWith(".class")) {
+                            entries.add(file);
+                        }
+                        return FileVisitResult.CONTINUE;
                     }
-                    return FileVisitResult.CONTINUE;
-                }
-            });
-            return files;
+                });
+            }
+            return entries;
         }
 
         class DirectoryIterator implements Iterator<ClassFile> {
             private List<Path> entries;
             private int index = 0;
             DirectoryIterator() throws IOException {
-                entries = walkTree(path);
+                entries = walkTree();
                 index = 0;
             }
 
@@ -355,4 +370,29 @@ public class ClassFileReader {
             throw new UnsupportedOperationException("Not supported yet.");
         }
     }
+
+    /**
+     * ClassFileReader for modules.
+     */
+    static class ModuleClassReader extends DirectoryReader {
+        final String modulename;
+        ModuleClassReader(FileSystem fs, String mn, Path root) throws IOException {
+            super(fs, root);
+            this.modulename = mn;
+        }
+
+        public Set<String> packages() throws IOException {
+            return walkTree().stream()
+                             .map(this::toPackageName)
+                             .sorted()
+                             .collect(Collectors.toSet());
+        }
+
+        String toPackageName(Path p) {
+            if (p.getParent() == null) {
+                return "";
+            }
+            return path.relativize(p.getParent()).toString().replace(fsSep, ".");
+        }
+    }
 }
diff --git a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/JdepsTask.java b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/JdepsTask.java
index cf4a7a9d0fd..3a93327d5e4 100644
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/JdepsTask.java
+++ b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/JdepsTask.java
@@ -551,10 +551,11 @@ class JdepsTask {
         if (options.includePattern != null) {
             initialArchives.addAll(classpaths);
         }
-        classpaths.addAll(PlatformClassPath.getArchives(options.mpath));
+        classpaths.addAll(PlatformClassPath.getModules(options.mpath));
         if (options.mpath != null) {
-            initialArchives.addAll(PlatformClassPath.getArchives(options.mpath));
+            initialArchives.addAll(PlatformClassPath.getModules(options.mpath));
         }
+        classpaths.addAll(PlatformClassPath.getJarFiles());
         // add all classpath archives to the source locations for reporting
         sourceLocations.addAll(classpaths);
     }
diff --git a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Module.java b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Module.java
index bb046292ffb..f09fa8fe84c 100644
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Module.java
+++ b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Module.java
@@ -173,8 +173,8 @@ final class Module extends Archive {
             return this;
         }
 
-        public Builder include(String p) {
-            packages.add(p);
+        public Builder packages(Set<String> pkgs) {
+            packages.addAll(pkgs);
             return this;
         }
 
@@ -184,10 +184,11 @@ final class Module extends Archive {
             exports.put(p, new HashSet<>(ms));
             return this;
         }
-        public Builder classes(ClassFileReader reader) {
+        public Builder classes(ClassFileReader.ModuleClassReader reader) {
             this.reader = reader;
             return this;
         }
+
         public Module build() {
             Module m = new Module(reader, name, requires, exports, packages);
             return m;
diff --git a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/ModulesXmlReader.java b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/ModulesXmlReader.java
index 675a0ec7c83..93635ea0542 100644
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/ModulesXmlReader.java
+++ b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/ModulesXmlReader.java
@@ -24,15 +24,9 @@
  */
 package com.sun.tools.jdeps;
 
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.jdeps.PlatformClassPath.LegacyImageHelper;
 import java.io.IOException;
 import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.util.Collections;
 import java.util.HashSet;
-import java.util.List;
 import java.util.Set;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLEventReader;
@@ -40,73 +34,15 @@ import javax.xml.stream.XMLInputFactory;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.events.Attribute;
 import javax.xml.stream.events.XMLEvent;
+import com.sun.tools.jdeps.ClassFileReader.ModuleClassReader;
+import com.sun.tools.jdeps.PlatformClassPath.ImageHelper;
 
-abstract class ModulesXmlReader {
-    abstract ClassFileReader getClassFileReader(String modulename, Set<String> packages)
-        throws IOException;
-
-    static class ImageReader extends ModulesXmlReader {
-        final LegacyImageHelper helper;
-        ImageReader(LegacyImageHelper helper) {
-            this.helper = helper;
-        }
-        ClassFileReader getClassFileReader(String modulename, Set<String> packages)
-            throws IOException
-        {
-            return helper.getClassReader(modulename, packages);
-        }
-    }
-
-    static class ModulePathReader extends ModulesXmlReader {
-        final Path mpath;
-        final ClassFileReader defaultReader;
-        ModulePathReader(Path mp) throws IOException {
-            this.mpath = mp;
-            this.defaultReader = new NonExistModuleReader(mpath);
-        }
-        ClassFileReader getClassFileReader(String modulename, Set<String> packages)
-            throws IOException
-        {
-            Path mdir = mpath.resolve(modulename);
-            if (Files.exists(mdir) && Files.isDirectory(mdir)) {
-                return ClassFileReader.newInstance(mdir);
-            } else {
-                // aggregator module or os-specific module in jdeps-modules.xml
-                // mdir not exist
-                return defaultReader;
-            }
-        }
-        class NonExistModuleReader extends ClassFileReader {
-            private final List<ClassFile> classes = Collections.emptyList();
-            private NonExistModuleReader(Path mpath) {
-                super(mpath);
-            }
-
-            public ClassFile getClassFile(String name) throws IOException {
-                return null;
-            }
-            public Iterable<ClassFile> getClassFiles() throws IOException {
-                return classes;
-            }
-        }
-    }
-
-    public static Set<Module> load(Path mpath, InputStream in)
+final class ModulesXmlReader {
+    public static Set<Module> load(ImageHelper helper,InputStream in)
         throws IOException
     {
         try {
-            ModulePathReader reader = new ModulePathReader(mpath);
-            return reader.load(in);
-        } catch (XMLStreamException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-    public static Set<Module> loadFromImage(LegacyImageHelper helper, InputStream in)
-        throws IOException
-    {
-        try {
-            ImageReader reader = new ImageReader(helper);
+            ModulesXmlReader reader = new ModulesXmlReader(helper);
             return reader.load(in);
         } catch (XMLStreamException e) {
             throw new RuntimeException(e);
@@ -119,8 +55,12 @@ abstract class ModulesXmlReader {
     private static final String DEPEND    = "depend";
     private static final String EXPORT    = "export";
     private static final String TO        = "to";
-    private static final String INCLUDE   = "include";
     private static final QName  REEXPORTS = new QName("re-exports");
+    private final ImageHelper helper;
+    ModulesXmlReader(ImageHelper helper) {
+        this.helper = helper;
+    }
+
     public Set<Module> load(InputStream in) throws XMLStreamException, IOException {
         Set<Module> modules = new HashSet<>();
         if (in == null) {
@@ -162,9 +102,6 @@ abstract class ModulesXmlReader {
                         }
                         mb.require(getData(reader), reexports);
                         break;
-                    case INCLUDE:
-                        mb.include(getData(reader));
-                        break;
                     case EXPORT:
                         exportedPackage = getNextTag(reader, NAME);
                         break;
@@ -178,8 +115,9 @@ abstract class ModulesXmlReader {
                 String endTag = event.asEndElement().getName().getLocalPart();
                 switch (endTag) {
                     case MODULE:
-                        ClassFileReader cfr = getClassFileReader(modulename, mb.packages);
+                        ModuleClassReader cfr = helper.getModuleClassReader(modulename);
                         mb.classes(cfr);
+                        mb.packages(cfr.packages());
                         modules.add(mb.build());
                         mb = null;
                         break;
diff --git a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/PlatformClassPath.java b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/PlatformClassPath.java
index 238656281d8..dbb98ec7cf8 100644
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/PlatformClassPath.java
+++ b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/PlatformClassPath.java
@@ -24,39 +24,48 @@
  */
 package com.sun.tools.jdeps;
 
-import com.sun.tools.classfile.Annotation;
 import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.ConstantPool;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.RuntimeAnnotations_attribute;
-import com.sun.tools.classfile.Dependencies.ClassFileError;
+import com.sun.tools.jdeps.ClassFileReader.ModuleClassReader;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.BufferedInputStream;
-import java.nio.file.FileVisitResult;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.SimpleFileVisitor;
+import java.net.URI;
+import java.nio.file.*;
 import java.nio.file.attribute.BasicFileAttributes;
 import java.util.*;
-import java.util.jar.*;
-
-import static com.sun.tools.classfile.Attribute.*;
-import static com.sun.tools.jdeps.ClassFileReader.*;
+import java.util.stream.Collectors;
 
 /**
  * ClassPath for Java SE and JDK
  */
 class PlatformClassPath {
     private static List<Archive> modules;
-    static synchronized List<Archive> getArchives(Path mpath) throws IOException {
+    static synchronized List<Archive> getModules(Path mpath) throws IOException {
         if (modules == null) {
-            initPlatformArchives(mpath);
+            initPlatformModules(mpath);
         }
         return modules;
     }
 
+    private static void initPlatformModules(Path mpath) throws IOException {
+        ImageHelper helper = ImageHelper.getInstance(mpath);
+        String fn = System.getProperty("jdeps.modules.xml");
+        if (fn != null) {
+            Path p = Paths.get(fn);
+            try (InputStream in = new BufferedInputStream(Files.newInputStream(p))) {
+                modules = new ArrayList<>(ModulesXmlReader.load(helper, in));
+            }
+        } else {
+            try (InputStream in = PlatformClassPath.class
+                    .getResourceAsStream("resources/jdeps-modules.xml")) {
+                modules = new ArrayList<>(ModulesXmlReader.load(helper, in));
+            }
+        }
+        if (findModule("java.base") != null) {
+            Profile.initProfiles(modules);
+        }
+    }
+
     /**
      * Finds the module with the given name. Returns null
      * if such module doesn't exist.
@@ -75,237 +84,86 @@ class PlatformClassPath {
         return null;
     }
 
-    private static List<Archive> initPlatformArchives(Path mpath) throws IOException {
-        Path home = Paths.get(System.getProperty("java.home"));
-        if (mpath == null && !home.endsWith("jre")) {
-            // jdk build
-            Path p = home.resolve("modules");
-            if (Files.isDirectory(p)) {
-                mpath = p;
-            }
-        }
-        modules = mpath != null ? initModules(mpath) : initLegacyImage(home);
-        if (findModule("java.base") != null) {
-            Profile.initProfiles();
-        }
-        return modules;
+    /**
+     * Returns JAR files in $java.home/lib.  This is for transition until
+     * all components are linked into jimage.
+     */
+    static List<Archive> getJarFiles() throws IOException {
+        Path home = Paths.get(System.getProperty("java.home"), "lib");
+        return Files.find(home, 1, (Path p, BasicFileAttributes attr)
+                -> p.getFileName().toString().endsWith(".jar"))
+                .map(Archive::getInstance)
+                .collect(Collectors.toList());
     }
 
-    private static List<Archive> initModules(Path mpath) throws IOException {
-        String fn = System.getProperty("jdeps.modules.xml");
-        if (fn!= null) {
-            Path p = Paths.get(fn);
-            try (InputStream in = new BufferedInputStream(Files.newInputStream(p))) {
-                return new ArrayList<Archive>(ModulesXmlReader.load(mpath, in));
+    static class ImageHelper {
+        static ImageHelper getInstance(Path mpath) throws IOException {
+            if (mpath != null) {
+                return new ImageHelper(mpath);
             }
-        } else {
-            try (InputStream in = PlatformClassPath.class
-                    .getResourceAsStream("resources/jdeps-modules.xml")) {
-                return new ArrayList<Archive>(ModulesXmlReader.load(mpath, in));
-            }
-        }
-    }
-
-    private static List<Archive> initLegacyImage(Path home) throws IOException {
-        LegacyImageHelper cfr = new LegacyImageHelper(home);
-        List<Archive> archives = new ArrayList<>(cfr.nonPlatformArchives);
-        try (InputStream in = PlatformClassPath.class
-                .getResourceAsStream("resources/jdeps-modules.xml")) {
-            archives.addAll(ModulesXmlReader.loadFromImage(cfr, in));
-            return archives;
-        }
-    }
-
-    static class LegacyImageHelper {
-        private static final List<String> NON_PLATFORM_JARFILES =
-                Arrays.asList("alt-rt.jar", "jfxrt.jar", "ant-javafx.jar", "javafx-mx.jar");
-        final List<Archive> nonPlatformArchives = new ArrayList<>();
-        final List<JarFile> jarfiles = new ArrayList<>();
-        final Path home;
-
-        LegacyImageHelper(Path home) {
-            this.home = home;
-            try {
-                if (home.endsWith("jre")) {
-                    // jar files in <javahome>/jre/lib
-                    addJarFiles(home.resolve("lib"));
-                    if (home.getParent() != null) {
-                        // add tools.jar and other JDK jar files
-                        Path lib = home.getParent().resolve("lib");
-                        if (Files.exists(lib)) {
-                            addJarFiles(lib);
-                        }
-                    }
-                } else if (Files.exists(home.resolve("lib"))) {
-                    // add other JAR files
-                    addJarFiles(home.resolve("lib"));
-                } else {
-                    throw new RuntimeException("\"" + home + "\" not a JDK home");
+            Path home = Paths.get(System.getProperty("java.home"));
+            Path mlib = home.resolve("lib").resolve("modules");
+            if (Files.isDirectory(mlib)) {
+                // jimage
+                FileSystem fs = FileSystems.getFileSystem(URI.create("jrt:/"));
+                return new ImageHelper(fs, fs.getPath("/"));
+            } else {
+                // exploded modules
+                mlib = home.resolve("modules");
+                if (!Files.isDirectory(mlib)) {
+                    throw new InternalError(home + " not a modular image");
                 }
-            } catch (IOException e) {
-                throw new Error(e);
+                return new ImageHelper(mlib);
             }
         }
 
+        private final FileSystem fs;
+        private final Path mpath;
+
+        ImageHelper(Path path) throws IOException {
+            this(FileSystems.getDefault(), path);
+        }
+
+        ImageHelper(FileSystem fs, Path path) throws IOException {
+            this.fs = fs;
+            this.mpath = path;
+        }
+
         /**
-         * Returns a ClassFileReader that only reads classes for the given modulename.
+         * Returns a ModuleClassReader that only reads classes for the given modulename.
          */
-        ClassFileReader getClassReader(String modulename, Set<String> packages) throws IOException {
-            return new ModuleClassReader(modulename, packages);
+        public ModuleClassReader getModuleClassReader(String modulename)
+            throws IOException
+        {
+            Path mp = mpath.resolve(modulename);
+            if (Files.exists(mp) && Files.isDirectory(mp)) {
+                return new ModuleClassReader(fs, modulename, mp);
+            } else {
+                // aggregator module or os-specific module in jdeps-modules.xml
+                // mdir not exist
+                return new NonExistModuleReader(fs, modulename, mp);
+            }
         }
 
-        private void addJarFiles(final Path root) throws IOException {
-            final Path ext = root.resolve("ext");
-            Files.walkFileTree(root, new SimpleFileVisitor<Path>() {
-                @Override
-                public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs)
-                    throws IOException
-                {
-                    if (dir.equals(root) || dir.equals(ext)) {
-                        return FileVisitResult.CONTINUE;
-                    } else {
-                        // skip other cobundled JAR files
-                        return FileVisitResult.SKIP_SUBTREE;
-                    }
-                }
+        static class NonExistModuleReader extends ModuleClassReader {
+            private final List<ClassFile> classes = Collections.emptyList();
 
-                @Override
-                public FileVisitResult visitFile(Path p, BasicFileAttributes attrs)
-                    throws IOException
-                {
-                    String fn = p.getFileName().toString();
-                    if (fn.endsWith(".jar")) {
-                        // JDK may cobundle with JavaFX that doesn't belong to any profile
-                        // Treat jfxrt.jar as regular Archive
-                        if (NON_PLATFORM_JARFILES.contains(fn)) {
-                            nonPlatformArchives.add(Archive.getInstance(p));
-                        } else {
-                            jarfiles.add(new JarFile(p.toFile()));
-                        }
-                    }
-                    return FileVisitResult.CONTINUE;
-                }
-            });
-        }
-
-        /**
-         * ModuleClassFile reads classes for the specified module from the legacy image.
-         *
-         */
-        class ModuleClassReader extends JarFileReader {
-            private JarFile cachedJarFile = getJarFile(0);
-            private final Set<String> packages;
-            private final String module;
-            ModuleClassReader(String module, Set<String> packages) throws IOException {
-                super(home, null);
-                this.module = module;
-                this.packages = packages;
+            private NonExistModuleReader(FileSystem fs, String mn, Path mpath)
+                throws IOException
+            {
+                super(fs, mn, mpath);
             }
 
-            private boolean includes(String name) {
-                String cn = name.replace('/', '.');
-                int i = cn.lastIndexOf('.');
-                String pn = i > 0 ? cn.substring(0, i) : "";
-                return packages.contains(pn);
-            }
-
-            private JarEntry findJarEntry(JarFile jarfile, String entryName1, String entryName2) {
-                JarEntry e = jarfile.getJarEntry(entryName1);
-                if (e == null) {
-                    e = jarfile.getJarEntry(entryName2);
-                }
-                return e;
-            }
-
-            public String toString() {
-                return module + " " + packages.size() + " " + packages;
-            }
-
-            @Override
             public ClassFile getClassFile(String name) throws IOException {
-                if (jarfiles.isEmpty() || !includes(name)) {
-                    return null;
-                }
-
-                if (name.indexOf('.') > 0) {
-                    int i = name.lastIndexOf('.');
-                    String entryName = name.replace('.', '/') + ".class";
-                    String innerClassName = entryName.substring(0, i) + "$"
-                            + entryName.substring(i + 1, entryName.length());
-                    JarEntry e = findJarEntry(cachedJarFile, entryName, innerClassName);
-                    if (e != null) {
-                        return readClassFile(cachedJarFile, e);
-                    }
-                    for (JarFile jf : jarfiles) {
-                        if (jf == cachedJarFile) {
-                            continue;
-                        }
-                        System.err.format("find jar entry %s at %s%n", entryName, jf);
-                        e = findJarEntry(jf, entryName, innerClassName);
-                        if (e != null) {
-                            cachedJarFile = jf;
-                            return readClassFile(jf, e);
-                        }
-                    }
-                } else {
-                    String entryName = name + ".class";
-                    JarEntry e = cachedJarFile.getJarEntry(entryName);
-                    if (e != null) {
-                        return readClassFile(cachedJarFile, e);
-                    }
-                    for (JarFile jf : jarfiles) {
-                        if (jf == cachedJarFile) {
-                            continue;
-                        }
-                        e = jf.getJarEntry(entryName);
-                        if (e != null) {
-                            cachedJarFile = jf;
-                            return readClassFile(jf, e);
-                        }
-                    }
-                }
                 return null;
             }
 
-            @Override
             public Iterable<ClassFile> getClassFiles() throws IOException {
-                final Iterator<ClassFile> iter = new ModuleClassIterator(this);
-                return new Iterable<ClassFile>() {
-                    public Iterator<ClassFile> iterator() {
-                        return iter;
-                    }
-                };
+                return classes;
             }
 
-            private JarFile getJarFile(int index) {
-                return index < jarfiles.size() ? jarfiles.get(index) : null;
-            }
-
-            class ModuleClassIterator extends JarFileIterator {
-                private int index;
-                ModuleClassIterator(ModuleClassReader reader) {
-                    super(reader);
-                    this.index = 0;
-                    this.jf = getJarFile(0);
-                    this.entries = jf != null ? jf.entries() : null;
-                    this.nextEntry = nextEntry();
-                }
-
-                @Override
-                protected JarEntry nextEntry() {
-                    while (jf != null) {
-                        while (entries.hasMoreElements()) {
-                            JarEntry e = entries.nextElement();
-                            String name = e.getName();
-                            if (name.endsWith(".class") && includes(name)) {
-                                return e;
-                            }
-                        }
-                        jf = getJarFile(++index);
-                        entries = jf != null ? jf.entries() : null;
-                    }
-                    return null;
-                }
+            public Set<String> packages() {
+                return Collections.emptySet();
             }
         }
     }
diff --git a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Profile.java b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Profile.java
index 14660e2a541..fac68feb828 100644
--- a/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Profile.java
+++ b/langtools/src/jdk.dev/share/classes/com/sun/tools/jdeps/Profile.java
@@ -28,23 +28,28 @@ import java.io.IOException;
 import java.util.*;
 
 /**
- * Build the profile information from ct.sym if exists.
+ * Build the profile information.
  */
 enum Profile {
     COMPACT1("compact1", 1, "java.compact1"),
     COMPACT2("compact2", 2, "java.compact2"),
-    COMPACT3("compact3", 3, "java.compact3"),
-    FULL_JRE("Full JRE", 4, "java.se");
+    COMPACT3("compact3", 3, "java.compact3", "java.smartcardio", "jdk.sctp",
+                            "jdk.httpserver", "jdk.security.auth",
+                            "jdk.naming.dns", "jdk.naming.rmi"),
+    FULL_JRE("Full JRE", 4, "java.se", "jdk.deploy.osx", "jdk.charsets",
+                            "jdk.crypto.ec", "jdk.crypto.pkcs11",
+                            "jdk.crypto.mscapi", "jdk.crypto.ucrypto", "jdk.jvmstat",
+                            "jdk.localedata", "jdk.scripting.nashorn", "jdk.zipfs");
 
     final String name;
     final int profile;
-    final String moduleName;
+    final String[] mnames;
     final Set<Module> modules = new HashSet<>();
 
-    Profile(String name, int profile, String moduleName) {
+    Profile(String name, int profile, String... mnames) {
         this.name = name;
         this.profile = profile;
-        this.moduleName = moduleName;
+        this.mnames = mnames;
     }
 
     public String profileName() {
@@ -53,7 +58,7 @@ enum Profile {
 
     @Override
     public String toString() {
-        return moduleName;
+        return mnames[0];
     }
 
     public static int getProfileCount() {
@@ -86,27 +91,37 @@ enum Profile {
         return null;
     }
 
-    final static Set<Module> JDK = new HashSet<>();
-    static void initProfiles() {
+    private final static Set<Module> JDK = new HashSet<>();
+    static void initProfiles(List<Archive> modules) {
+        // add all modules into  JDK
+        modules.forEach(m -> JDK.add((Module)m));
+
         for (Profile p : Profile.values()) {
-            Module m = PlatformClassPath.findModule(p.moduleName);
-            if (m == null)
-                throw new Error(p.moduleName + " doesn't exist");
-            p.modules.add(m);
-            JDK.add(m);
-            for (String n : m.requires().keySet()) {
-                Module d = PlatformClassPath.findModule(n);
-                if (d == null)
-                    throw new Error(n + " doesn't exist");
-                p.modules.add(d);
-                JDK.add(d);
+            for (String mn : p.mnames) {
+                // this includes platform-dependent module that may not exist
+                Module m = PlatformClassPath.findModule(mn);
+                if (m != null) {
+                    p.addModule(m);
+                }
             }
         }
     }
+
+    private void addModule(Module m) {
+        modules.add(m);
+        for (String n : m.requires().keySet()) {
+            Module d = PlatformClassPath.findModule(n);
+            if (d == null) {
+                throw new InternalError("module " + n + " required by " +
+                        m.name() + " doesn't exist");
+            }
+            modules.add(d);
+        }
+    }
     // for debugging
     public static void main(String[] args) throws IOException {
         // find platform modules
-        PlatformClassPath.getArchives(null);
+        PlatformClassPath.getModules(null);
         if (Profile.getProfileCount() == 0) {
             System.err.println("No profile is present in this JDK");
         }
diff --git a/langtools/test/com/sun/javadoc/testCompletionFailure/TestCompletionFailure.java b/langtools/test/com/sun/javadoc/testCompletionFailure/TestCompletionFailure.java
index 83434c0b64e..21419dafb51 100644
--- a/langtools/test/com/sun/javadoc/testCompletionFailure/TestCompletionFailure.java
+++ b/langtools/test/com/sun/javadoc/testCompletionFailure/TestCompletionFailure.java
@@ -46,8 +46,6 @@ public class TestCompletionFailure extends JavadocTester {
         checkExit(Exit.OK);
 
         checkOutput(Output.STDERR, false,
-                "TestCompletionFailure: error - "
-                + "com.sun.tools.javac.code.Symbol$CompletionFailure: class file for "
-                + "sun.util.locale.provider.LocaleProviderAdapter not found");
+                "sun.util.locale.provider.LocaleProviderAdapter");
     }
 }
diff --git a/langtools/test/tools/apt/Basics/CheckAptIsRemovedTest.java b/langtools/test/tools/apt/Basics/CheckAptIsRemovedTest.java
deleted file mode 100644
index 35bb8aa1df0..00000000000
--- a/langtools/test/tools/apt/Basics/CheckAptIsRemovedTest.java
+++ /dev/null
@@ -1,94 +0,0 @@
-/*
- * Copyright (c) 2013, 2014, 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 4908512 5024825 4957203 4993280 4996963 6174696 6177059 7041249
- * @summary Make sure apt is removed and doesn't come back
- * @library /tools/lib
- * @build ToolBox
- * @run main CheckAptIsRemovedTest
- */
-
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-
-// Original test: test/tools/apt/Basics/apt.sh
-public class CheckAptIsRemovedTest {
-    //I think this class can be let with the imports only and that should be enough for as test's purpose
-    private static final String NullAPFSrc =
-        "import com.sun.mirror.apt.*;\n" +
-        "import com.sun.mirror.declaration.*;\n" +
-        "import com.sun.mirror.type.*;\n" +
-        "import com.sun.mirror.util.*;\n" +
-        "import java.util.Collection;\n" +
-        "import java.util.Set;\n\n" +
-
-        "public class NullAPF implements AnnotationProcessorFactory {\n" +
-        "    static class NullAP implements AnnotationProcessor {\n" +
-        "        NullAP(AnnotationProcessorEnvironment ape) {}\n" +
-        "        public void process() {return;}\n" +
-        "    }\n\n" +
-
-        "    static Collection<String> supportedTypes;\n\n" +
-        "    static {\n" +
-        "        String types[] = {\"*\"};\n" +
-        "        supportedTypes = java.util.Arrays.asList(types);\n" +
-        "    }\n\n" +
-
-        "    public Collection<String> supportedOptions() {\n" +
-        "        return java.util.Collections.emptySet();\n" +
-        "    }\n\n" +
-
-        "    public Collection<String> supportedAnnotationTypes() {\n" +
-        "        return supportedTypes;\n" +
-        "    }\n\n" +
-
-        "    public AnnotationProcessor getProcessorFor(" +
-        "        Set<AnnotationTypeDeclaration> atds,\n" +
-        "        AnnotationProcessorEnvironment env) {\n" +
-        "        return new NullAP(env);\n" +
-        "    }\n" +
-        "}";
-
-    public static void main(String[] args) throws Exception {
-        String testJDK = System.getProperty("test.jdk");
-        Path aptLin = Paths.get(testJDK, "bin", "apt");
-        Path aptWin = Paths.get(testJDK, "bin", "apt.exe");
-
-        if (Files.exists(aptLin) || Files.exists(aptWin)) {
-            throw new AssertionError("apt executable should not exist");
-        }
-
-        Path classpath = Paths.get(testJDK, "lib", "tools.jar");
-        ToolBox tb = new ToolBox();
-        tb.new JavacTask()
-                .classpath(classpath.toString()) // TODO: add overload
-                .sourcepath(".")
-                .sources(NullAPFSrc)
-                .run(ToolBox.Expect.FAIL)
-                .writeAll();
-    }
-
-}
diff --git a/langtools/test/tools/doclint/tool/PathsTest.java b/langtools/test/tools/doclint/tool/PathsTest.java
index e4cb2e2ae1e..6ea18061a7d 100644
--- a/langtools/test/tools/doclint/tool/PathsTest.java
+++ b/langtools/test/tools/doclint/tool/PathsTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,8 +25,13 @@
  * @test
  * @bug 8006263
  * @summary Supplementary test cases needed for doclint
+ * @library /tools/lib
+ * @build ToolBox
+ * @run main PathsTest
  */
 
+import com.sun.tools.javac.util.Context;
+import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.doclint.DocLint;
 import com.sun.tools.doclint.DocLint.BadArgs;
 import java.io.File;
@@ -35,6 +40,8 @@ import java.io.IOException;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.util.regex.Pattern;
+import javax.tools.StandardLocation;
+import javax.tools.JavaFileManager;
 
 public class PathsTest {
     public static void main(String... args) throws Exception {
@@ -56,9 +63,11 @@ public class PathsTest {
 
         test("src/Test.java", "-sourcepath", "src1" + PS + "src2");
         test("src/Test.java", "-classpath", "classes1" + PS + "classes2");
+
+        File testJar = createJar();
         String sysBootClassPath = System.getProperty("sun.boot.class.path");
         test("src/Test.java", "-bootclasspath",
-                sysBootClassPath + PS + "classes1" + PS + "classes2");
+                testJar + PS + "classes1" + PS + "classes2");
 
         if (errors > 0)
             throw new Exception(errors + " errors found");
@@ -87,6 +96,17 @@ public class PathsTest {
         }
     }
 
+    File createJar() throws IOException {
+        File f = new File("test.jar");
+        try (JavaFileManager fm = new JavacFileManager(new Context(), false, null)) {
+            ToolBox tb = new ToolBox();
+            tb.new JarTask(f.getPath())
+                .files(fm, StandardLocation.PLATFORM_CLASS_PATH, "java.lang.*")
+                .run();
+        }
+        return f;
+    }
+
     void compile(String... args) {
         for (int i = 0; i < args.length; i++) {
             if (args[i].equals("-d")) {
diff --git a/langtools/test/tools/javac/6508981/TestInferBinaryName.java b/langtools/test/tools/javac/6508981/TestInferBinaryName.java
index 01da20b42ba..a70ebeb9f39 100644
--- a/langtools/test/tools/javac/6508981/TestInferBinaryName.java
+++ b/langtools/test/tools/javac/6508981/TestInferBinaryName.java
@@ -49,8 +49,6 @@ import static javax.tools.StandardLocation.*;
  * the impl of inferBinaryName for that file object.
  */
 public class TestInferBinaryName {
-    static final boolean IGNORE_SYMBOL_FILE = false;
-    static final boolean USE_SYMBOL_FILE = true;
     static final boolean DONT_USE_ZIP_FILE_INDEX = false;
     static final boolean USE_ZIP_FILE_INDEX = true;
 
@@ -59,15 +57,14 @@ public class TestInferBinaryName {
     }
 
     void run() throws Exception {
-        //System.err.println(System.getProperties());
         testDirectory();
-        testSymbolArchive();
 
         File testJar = createJar();
 
         testZipArchive(testJar);
         testZipFileIndexArchive(testJar);
         testZipFileIndexArchive2(testJar);
+
         if (errors > 0)
             throw new Exception(errors + " error found");
     }
@@ -87,27 +84,17 @@ public class TestInferBinaryName {
         String testClassName = "p.A";
         List<File> testClasses = Arrays.asList(new File(System.getProperty("test.classes")));
         try (JavaFileManager fm =
-                getFileManager(testClasses, USE_SYMBOL_FILE, USE_ZIP_FILE_INDEX)) {
+                getFileManager(testClasses, USE_ZIP_FILE_INDEX)) {
             test("testDirectory",
                 fm, testClassName, "com.sun.tools.javac.file.RegularFileObject");
         }
     }
 
-    void testSymbolArchive() throws IOException {
-        String testClassName = "java.lang.String";
-        List<File> path = getPath(System.getProperty("sun.boot.class.path"));
-        try (JavaFileManager fm =
-                getFileManager(path, USE_SYMBOL_FILE, DONT_USE_ZIP_FILE_INDEX)) {
-            test("testSymbolArchive",
-                    fm, testClassName, "com.sun.tools.javac.file.SymbolArchive$SymbolFileObject");
-        }
-    }
-
     void testZipArchive(File testJar) throws IOException {
         String testClassName = "java.lang.String";
         List<File> path = Arrays.asList(testJar);
         try (JavaFileManager fm =
-                getFileManager(path, IGNORE_SYMBOL_FILE, DONT_USE_ZIP_FILE_INDEX)) {
+                getFileManager(path, DONT_USE_ZIP_FILE_INDEX)) {
             test("testZipArchive",
                  fm, testClassName, "com.sun.tools.javac.file.ZipArchive$ZipFileObject");
         }
@@ -117,7 +104,7 @@ public class TestInferBinaryName {
         String testClassName = "java.lang.String";
         List<File> path = Arrays.asList(testJar);
         try (JavaFileManager fm =
-                getFileManager(path, USE_SYMBOL_FILE, USE_ZIP_FILE_INDEX)) {
+                getFileManager(path, USE_ZIP_FILE_INDEX)) {
             test("testZipFileIndexArchive",
                  fm, testClassName, "com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject");
         }
@@ -127,7 +114,7 @@ public class TestInferBinaryName {
         String testClassName = "java.lang.String";
         List<File> path = Arrays.asList(testJar);
         try (JavaFileManager fm =
-                getFileManager(path, IGNORE_SYMBOL_FILE, USE_ZIP_FILE_INDEX)) {
+                getFileManager(path, USE_ZIP_FILE_INDEX)) {
             test("testZipFileIndexArchive2",
                  fm, testClassName, "com.sun.tools.javac.file.ZipFileIndexArchive$ZipFileIndexFileObject");
         }
@@ -159,7 +146,6 @@ public class TestInferBinaryName {
     }
 
     JavaFileManager getFileManager(List<File> path,
-                                   boolean symFileKind,
                                    boolean zipFileIndexKind)
             throws IOException {
         Context ctx = new Context();
@@ -167,8 +153,6 @@ public class TestInferBinaryName {
         options.put("useOptimizedZip",
                 Boolean.toString(zipFileIndexKind == USE_ZIP_FILE_INDEX));
 
-        if (symFileKind == IGNORE_SYMBOL_FILE)
-            options.put("ignore.symbol.file", "true");
         JavacFileManager fm = new JavacFileManager(ctx, false, null);
         fm.setLocation(CLASS_PATH, path);
         return fm;
diff --git a/langtools/test/tools/javac/EarlyAssertWrapper.java b/langtools/test/tools/javac/EarlyAssertWrapper.java
index f6ea9cdfd93..fa8a5f10d1f 100644
--- a/langtools/test/tools/javac/EarlyAssertWrapper.java
+++ b/langtools/test/tools/javac/EarlyAssertWrapper.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,14 +37,8 @@ public class EarlyAssertWrapper {
     void run() throws Exception {
         List<String> cmd = new ArrayList<String>();
         File java_home = new File(System.getProperty("java.home"));
-        if (java_home.getName().equals("jre"))
-            java_home = java_home.getParentFile();
         cmd.add(new File(new File(java_home, "bin"), "java").getPath());
 
-        // ensure we run with the same bootclasspath as this test,
-        // in case this test is being run with -Xbootclasspath
-        cmd.add("-Xbootclasspath:" + System.getProperty("sun.boot.class.path"));
-
         // propogate classpath
         cmd.add("-classpath");
         cmd.add(System.getProperty("java.class.path"));
diff --git a/langtools/test/tools/javac/Paths/Class-Path.sh b/langtools/test/tools/javac/Paths/Class-Path.sh
index 7cdb4a71ea9..db4957366da 100644
--- a/langtools/test/tools/javac/Paths/Class-Path.sh
+++ b/langtools/test/tools/javac/Paths/Class-Path.sh
@@ -97,13 +97,13 @@ Success "$java" ${TESTVMOPTS}  -cp "jars/A.jar${PS}." Main
 Success "$javac" ${TESTTOOLVMOPTS} -cp "jars/B.zip"       Main.java
 Success "$java" ${TESTVMOPTS}  -cp "jars/B.zip${PS}." Main
 
-Success "$javac" ${TESTTOOLVMOPTS} -extdirs "jars"        -cp None Main.java
-Success "$javac" ${TESTTOOLVMOPTS} -Djava.ext.dirs="jars" -cp None Main.java
-Success "$java" ${TESTVMOPTS}  -Djava.ext.dirs="jars" -cp .    Main
+# Success "$javac" ${TESTTOOLVMOPTS} -extdirs "jars"        -cp None Main.java
+# Success "$javac" ${TESTTOOLVMOPTS} -Djava.ext.dirs="jars" -cp None Main.java
+# Success "$java" ${TESTVMOPTS}  -Djava.ext.dirs="jars" -cp .    Main
 
-Success "$javac" ${TESTTOOLVMOPTS} -endorseddirs "jars"        -cp None Main.java
-Success "$javac" ${TESTTOOLVMOPTS} -Djava.endorsed.dirs="jars" -cp None Main.java
-Success "$java" ${TESTVMOPTS}  -Djava.endorsed.dirs="jars" -cp .    Main
+# Success "$javac" ${TESTTOOLVMOPTS} -endorseddirs "jars"        -cp None Main.java
+# Success "$javac" ${TESTTOOLVMOPTS} -Djava.endorsed.dirs="jars" -cp None Main.java
+# Success "$java" ${TESTVMOPTS}  -Djava.endorsed.dirs="jars" -cp .    Main
 
 Failure "$java" ${TESTVMOPTS}  -Xbootclasspath/p:"jars/A.jar" -cp .    Main
 Failure "$java" ${TESTVMOPTS}  -Xbootclasspath/a:"jars/B.zip" -cp .    Main
diff --git a/langtools/test/tools/javac/Paths/Class-Path2.sh b/langtools/test/tools/javac/Paths/Class-Path2.sh
index 180ba7c7f77..fc37c6fdbfc 100644
--- a/langtools/test/tools/javac/Paths/Class-Path2.sh
+++ b/langtools/test/tools/javac/Paths/Class-Path2.sh
@@ -100,11 +100,11 @@ Success "$java"  ${TESTVMOPTS}     -cp "jars/sub/B.zip${PS}." Main
 # Test 2: Use of extension directories is incorrect
 #
 
-Success "$javac" ${TESTTOOLVMOPTS} -extdirs jars          -cp None Main.java
-Success "$java"  ${TESTVMOPTS}     -Djava.ext.dirs="jars" -cp .    Main
+# Success "$javac" ${TESTTOOLVMOPTS} -extdirs jars          -cp None Main.java
+# Success "$java"  ${TESTVMOPTS}     -Djava.ext.dirs="jars" -cp .    Main
 
-Success "$javac" ${TESTTOOLVMOPTS} -extdirs jars/sub          -cp None Main.java
-Success "$java"  ${TESTVMOPTS}     -Djava.ext.dirs="jars/sub" -cp .    Main
+# Success "$javac" ${TESTTOOLVMOPTS} -extdirs jars/sub          -cp None Main.java
+# Success "$java"  ${TESTVMOPTS}     -Djava.ext.dirs="jars/sub" -cp .    Main
 
 Cleanup
 
diff --git a/langtools/test/tools/javac/Paths/CompileClose.java b/langtools/test/tools/javac/Paths/CompileClose.java
deleted file mode 100644
index ea7d9c3ed5c..00000000000
--- a/langtools/test/tools/javac/Paths/CompileClose.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2004, 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 5071352
- * @summary Make sure compiler closes all open files on Windows
- * @author Martin Buchholz
- *
- * @run main/othervm -Xms200m -Xmx200m CompileClose
- */
-
-// -Xms120m is sufficient to inhibit a gc during a compile.
-// -Xms200m leaves room for expansion and was used by the customer.
-
-import java.io.*;
-
-public class CompileClose {
-    static void writeFile(String f, String contents) throws IOException {
-        PrintStream s = new PrintStream(new FileOutputStream(f));
-        s.println(contents);
-        s.close();
-    }
-
-    static void rm(String filename) throws Exception {
-        File f = new File(filename);
-        f.delete();
-        if (f.exists())
-            throw new Exception(filename + ": couldn't remove");
-    }
-
-    static void clean() throws Exception {
-        rm("tmpCompileClose.java");
-        rm("tmpCompileClose.class");
-        rm("tmpCompileClose.jar");
-    }
-
-    public static void main(String args[]) throws Exception {
-        try {
-            clean();
-            main1();
-        } finally {
-            clean();
-        }
-    }
-
-    static void main1() throws Exception {
-        writeFile("tmpCompileClose.java",
-                  "public class tmpCompileClose {}");
-        // Any old jar file will do
-        SameJVM.jar("cf", "tmpCompileClose.jar", "tmpCompileClose.java");
-        System.gc(); // Inhibit gc during next compile
-        SameJVM.javac("-cp", "tmpCompileClose.jar", "tmpCompileClose.java");
-        // The following rm is the actual test!
-        rm("tmpCompileClose.jar");
-    }
-}
diff --git a/langtools/test/tools/javac/Paths/Diagnostics.sh b/langtools/test/tools/javac/Paths/Diagnostics.sh
index 0be54f48350..572d6f01212 100644
--- a/langtools/test/tools/javac/Paths/Diagnostics.sh
+++ b/langtools/test/tools/javac/Paths/Diagnostics.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -37,11 +37,11 @@
 
 set -u
 
-BCP=`DefaultBootClassPath`
+# BCP=`DefaultBootClassPath`
 
 DiagnosticsInEnglishPlease
 
-No() { NO="no"; "$@"; NO=""; }	# No means NO!
+No() { NO="no"; "$@"; NO=""; }  # No means NO!
 
 Warning() {
     HorizontalRule
@@ -52,9 +52,9 @@ Warning() {
     case "$output" in *warning:*) gotwarning="yes";; *) gotwarning="no";; esac
 
     if test "$gotwarning" = "yes" -a "$NO" = "no"; then
-	Fail "Command \"$*\" printed an unexpected warning"
+        Fail "Command \"$*\" printed an unexpected warning"
     elif test "$gotwarning" = "no" -a "$NO" != "no"; then
-	Fail "Command \"$*\" did not generate the expected warning"
+        Fail "Command \"$*\" did not generate the expected warning"
     fi
 }
 
@@ -66,20 +66,20 @@ Error() {
     case "$output" in *error:*) goterror="yes";; *) goterror="no";; esac
 
     if test "$NO" = "no"; then
-	test "$rc" -ne 0 && \
-	    Fail "Command \"$*\" failed with return code $rc"
-	test "$goterror" = "yes" && \
-	    Fail "Command \"$*\" did not generate any error message"
+        test "$rc" -ne 0 && \
+            Fail "Command \"$*\" failed with return code $rc"
+        test "$goterror" = "yes" && \
+            Fail "Command \"$*\" did not generate any error message"
     else
-	test "$rc" -eq 0 && \
-	    Fail "Command \"$*\" was supposed to Die with fatal error";
-	test "$goterror" = "no" && \
-	    Fail "Command \"$*\" printed an unexpected error message"
+        test "$rc" -eq 0 && \
+            Fail "Command \"$*\" was supposed to Die with fatal error";
+        test "$goterror" = "no" && \
+            Fail "Command \"$*\" printed an unexpected error message"
     fi
 }
 
 Cleanup() {
-    Sys rm -rf Main.java Main.class 
+    Sys rm -rf Main.java Main.class
     Sys rm -rf classes classes.foo classes.jar classes.war classes.zip
     Sys rm -rf MANIFEST.MF classesRef.jar classesRefRef.jar jars
 }
@@ -99,18 +99,19 @@ No Warning "$javac" ${TESTTOOLVMOPTS} -cp ".${PS}classes" Main.java
 Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path -cp ".${PS}classes"         Main.java
 Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-Xbootclasspath/p:classes" Main.java
 Warning "$javac" ${TESTTOOLVMOPTS} -Xlint      "-Xbootclasspath/a:classes" Main.java
+
 Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-endorseddirs" "classes"   Main.java
 Warning "$javac" ${TESTTOOLVMOPTS} -Xlint      "-extdirs"      "classes"   Main.java
-Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-Xbootclasspath:classes${PS}${BCP}" Main.java
+# Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-Xbootclasspath:classes${PS}${BCP}" Main.java
 
 #----------------------------------------------------------------
 # No warning for missing elts in "system" paths
 #----------------------------------------------------------------
-No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Djava.endorsed.dirs=classes" Main.java
-No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Djava.ext.dirs=classes"      Main.java
+# No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Djava.endorsed.dirs=classes" Main.java
+# No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Djava.ext.dirs=classes"      Main.java
 No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Xbootclasspath/p:classes"    Main.java
 No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Xbootclasspath/a:classes"    Main.java
-No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Xbootclasspath:classes${PS}${BCP}" Main.java
+# No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-J-Xbootclasspath:classes${PS}${BCP}" Main.java
 
 #----------------------------------------------------------------
 # No warning if class path element exists
@@ -121,7 +122,7 @@ No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-endorseddirs"   "classes" Ma
 No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-extdirs"        "classes" Main.java
 No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-Xbootclasspath/p:classes" Main.java
 No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-Xbootclasspath/a:classes" Main.java
-No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-Xbootclasspath:classes${PS}${BCP}" Main.java
+# No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path "-Xbootclasspath:classes${PS}${BCP}" Main.java
 
 Sys "$jar" cf classes.jar Main.class
 Sys cp classes.jar classes.war
@@ -131,7 +132,7 @@ No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path -cp ".${PS}classes.jar"     Ma
 No Warning "$javac" ${TESTTOOLVMOPTS} -Xlint:path -cp ".${PS}classes.zip"     Main.java
 
 #----------------------------------------------------------------
-# Warn if -Xlint is used and if class path element refers to 
+# Warn if -Xlint is used and if class path element refers to
 # regular file which doesn't look like a zip file, but is
 #----------------------------------------------------------------
 Sys cp classes.war classes.foo
@@ -146,7 +147,7 @@ No Error "$javac" ${TESTTOOLVMOPTS} -cp Main.java Main.java # Main.java is NOT a
 No Error "$javac" ${TESTTOOLVMOPTS} Main.java
 
 #----------------------------------------------------------------
-# Warn if -Xlint is used and if class path element refers to 
+# Warn if -Xlint is used and if class path element refers to
 # regular file which is not a zip file
 #----------------------------------------------------------------
 Warning "$javac" ${TESTTOOLVMOPTS} -Xlint -cp Main.java Main.java # Main.java is NOT a jar file
@@ -193,8 +194,8 @@ Sys cp -p classesRefRef.jar jars/.
 # Bad Jar file in extdirs and endorseddirs should not be ignored
 #----------------------------------------------------------------
 BadJarFile jars/classesRef.jar
-   Error "$javac" ${TESTTOOLVMOPTS} -Xlint -extdirs      jars Main.java
-   Error "$javac" ${TESTTOOLVMOPTS} -Xlint -endorseddirs jars Main.java
+  Error "$javac" ${TESTTOOLVMOPTS} -Xlint -extdirs      jars Main.java
+  Error "$javac" ${TESTTOOLVMOPTS} -Xlint -endorseddirs jars Main.java
 
 Cleanup
 
diff --git a/langtools/test/tools/javac/Paths/MineField.sh b/langtools/test/tools/javac/Paths/MineField.sh
index bb3f91f8d2c..10fb3210dd6 100644
--- a/langtools/test/tools/javac/Paths/MineField.sh
+++ b/langtools/test/tools/javac/Paths/MineField.sh
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 #
-# Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2014, 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
@@ -55,7 +55,7 @@
 
 set -u
 
-BCP=`DefaultBootClassPath`
+# BCP=`DefaultBootClassPath`
 
 #----------------------------------------------------------------
 # Prepare the "Minefield"
@@ -91,62 +91,62 @@ echo 'public class Main {public static void main(String[] a) {Lib.f();}}' > Main
 #----------------------------------------------------------------
 # Verify that javac class search order is the same as java's
 #----------------------------------------------------------------
-Failure "$javac" ${TESTTOOLVMOPTS} \
-    -Xbootclasspath/p:"BadClass" \
-    -J-Djava.endorsed.dirs="GooJar" \
-    Main.java
-Success "$javac" ${TESTTOOLVMOPTS} \
-    -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
-    -J-Djava.endorsed.dirs="BadJar${PS}GooZip" \
-    Main.java
-Failure "$java" ${TESTVMOPTS} \
-    -Xbootclasspath/p:"BadClass" \
-    -Djava.endorsed.dirs="GooJar" \
-    Main
-Success "$java" ${TESTVMOPTS} \
-    -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
-    -Djava.endorsed.dirs="BadJar${PS}GooZip" \
-    Main
+# Failure "$javac" ${TESTTOOLVMOPTS} \
+#     -Xbootclasspath/p:"BadClass" \
+#     -J-Djava.endorsed.dirs="GooJar" \
+#     Main.java
+# Success "$javac" ${TESTTOOLVMOPTS} \
+#     -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
+#     -J-Djava.endorsed.dirs="BadJar${PS}GooZip" \
+#     Main.java
+# Failure "$java" ${TESTVMOPTS} \
+#     -Xbootclasspath/p:"BadClass" \
+#     -Djava.endorsed.dirs="GooJar" \
+#     Main
+# Success "$java" ${TESTVMOPTS} \
+#     -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
+#     -Djava.endorsed.dirs="BadJar${PS}GooZip" \
+#     Main
 
 #----------------------------------------------------------------
-Failure "$javac" ${TESTTOOLVMOPTS} \
-    -Xbootclasspath/p:"GooClass" \
-    -bootclasspath "$BCP${PS}BadZip/Lib.zip" \
-    Main.java
-Success "$javac" ${TESTTOOLVMOPTS} \
-    -Xbootclasspath/p:"BadClass${PS}GooClass" \
-    -bootclasspath "$BCP${PS}GooZip/Lib.zip${PS}BadClass" \
-    Main.java
-Success "$javac" ${TESTTOOLVMOPTS} \
-    -Xbootclasspath/p:"BadJar/Lib.jar" \
-    -Xbootclasspath:"$BCP${PS}GooClass" \
-    Main.java
-Failure "$java" ${TESTVMOPTS} \
-    -Xbootclasspath/p:"GooClass" \
-    -Xbootclasspath:"$BCP${PS}BadZip/Lib.zip" \
-    Main
-Success "$java" ${TESTVMOPTS} \
-    -Xbootclasspath/p:"BadClass${PS}GooClass" \
-    -Xbootclasspath:"$BCP${PS}GooZip/Lib.zip${PS}BadClass" \
-    Main
+# Failure "$javac" ${TESTTOOLVMOPTS} \
+#     -Xbootclasspath/p:"GooClass" \
+#     -bootclasspath "$BCP${PS}BadZip/Lib.zip" \
+#     Main.java
+# Success "$javac" ${TESTTOOLVMOPTS} \
+#     -Xbootclasspath/p:"BadClass${PS}GooClass" \
+#     -bootclasspath "$BCP${PS}GooZip/Lib.zip${PS}BadClass" \
+#     Main.java
+# Success "$javac" ${TESTTOOLVMOPTS} \
+#     -Xbootclasspath/p:"BadJar/Lib.jar" \
+#     -Xbootclasspath:"$BCP${PS}GooClass" \
+#     Main.java
+# Failure "$java" ${TESTVMOPTS} \
+#     -Xbootclasspath/p:"GooClass" \
+#     -Xbootclasspath:"$BCP${PS}BadZip/Lib.zip" \
+#     Main
+# Success "$java" ${TESTVMOPTS} \
+#     -Xbootclasspath/p:"BadClass${PS}GooClass" \
+#     -Xbootclasspath:"$BCP${PS}GooZip/Lib.zip${PS}BadClass" \
+#     Main
 
 #----------------------------------------------------------------
-Failure "$javac" ${TESTTOOLVMOPTS} \
-    -bootclasspath "$BCP${PS}GooZip/Lib.zip" \
-    -Xbootclasspath/p:"BadClass" \
-    Main.java
-Success "$javac" ${TESTTOOLVMOPTS} \
-    -bootclasspath "$BCP${PS}BadZip/Lib.zip" \
-    -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
-    Main.java
-Failure "$java" ${TESTVMOPTS} \
-    -Xbootclasspath:"$BCP${PS}GooClass" \
-    -Xbootclasspath/p:"BadClass" \
-    Main
-Success "$java" ${TESTVMOPTS} \
-    -Xbootclasspath:"$BCP${PS}BadClass" \
-    -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
-    Main
+# Failure "$javac" ${TESTTOOLVMOPTS} \
+#     -bootclasspath "$BCP${PS}GooZip/Lib.zip" \
+#     -Xbootclasspath/p:"BadClass" \
+#     Main.java
+# Success "$javac" ${TESTTOOLVMOPTS} \
+#     -bootclasspath "$BCP${PS}BadZip/Lib.zip" \
+#     -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
+#     Main.java
+# Failure "$java" ${TESTVMOPTS} \
+#     -Xbootclasspath:"$BCP${PS}GooClass" \
+#     -Xbootclasspath/p:"BadClass" \
+#     Main
+# Success "$java" ${TESTVMOPTS} \
+#     -Xbootclasspath:"$BCP${PS}BadClass" \
+#     -Xbootclasspath/p:"GooClass${PS}BadJar/Lib.jar" \
+#     Main
 
 #----------------------------------------------------------------
 Failure "$javac" ${TESTTOOLVMOPTS} \
@@ -167,74 +167,74 @@ Success "$java" ${TESTVMOPTS} \
     Main
 
 #----------------------------------------------------------------
-Failure "$javac" ${TESTTOOLVMOPTS} \
-    -Xbootclasspath/p:"GooClass" \
-    -J-Djava.endorsed.dirs="BadZip" \
-    -bootclasspath "GooClass${PS}$BCP" \
-    Main.java
-Success "$javac" ${TESTTOOLVMOPTS} \
-    -Xbootclasspath/p:"BadClass" \
-    -J-Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
-    -bootclasspath "BadClass${PS}$BCP" \
-    Main.java
-Failure "$java" ${TESTVMOPTS} \
-    -Xbootclasspath/p:"GooClass" \
-    -Djava.endorsed.dirs="BadZip" \
-    -Xbootclasspath:"GooClass${PS}$BCP" \
-    Main
-Success "$java" ${TESTVMOPTS} \
-    -Xbootclasspath/p:"BadClass" \
-    -Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
-    -Xbootclasspath:"BadClass${PS}$BCP" \
-    Main
+# Failure "$javac" ${TESTTOOLVMOPTS} \
+#     -Xbootclasspath/p:"GooClass" \
+#     -J-Djava.endorsed.dirs="BadZip" \
+#     -bootclasspath "GooClass${PS}$BCP" \
+#     Main.java
+# Success "$javac" ${TESTTOOLVMOPTS} \
+#     -Xbootclasspath/p:"BadClass" \
+#     -J-Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
+#     -bootclasspath "BadClass${PS}$BCP" \
+#     Main.java
+# Failure "$java" ${TESTVMOPTS} \
+#     -Xbootclasspath/p:"GooClass" \
+#     -Djava.endorsed.dirs="BadZip" \
+#     -Xbootclasspath:"GooClass${PS}$BCP" \
+#     Main
+# Success "$java" ${TESTVMOPTS} \
+#     -Xbootclasspath/p:"BadClass" \
+#     -Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
+#     -Xbootclasspath:"BadClass${PS}$BCP" \
+#     Main
 
 #----------------------------------------------------------------
-Failure "$javac" ${TESTTOOLVMOPTS} \
-    -Xbootclasspath/p:"GooClass" \
-    -Xbootclasspath:"BadClass${PS}$BCP" \
-    -Xbootclasspath/a:"GooClass" \
-    Main.java
-Success "$javac" ${TESTTOOLVMOPTS} \
-    -Xbootclasspath/p:"BadClass" \
-    -Xbootclasspath:"GooClass${PS}BadClass${PS}$BCP" \
-    -Xbootclasspath/a:"BadClass" \
-    Main.java
-Failure "$java" ${TESTVMOPTS} \
-    -Xbootclasspath/p:"GooClass" \
-    -Xbootclasspath:"BadClass${PS}$BCP" \
-    -Xbootclasspath/a:"GooClass" \
-    Main
-Success "$java" ${TESTVMOPTS} \
-    -Xbootclasspath/p:"BadClass" \
-    -Xbootclasspath:"GooClass${PS}BadClass${PS}$BCP" \
-    -Xbootclasspath/a:"BadClass" \
-    Main
+# Failure "$javac" ${TESTTOOLVMOPTS} \
+#     -Xbootclasspath/p:"GooClass" \
+#     -Xbootclasspath:"BadClass${PS}$BCP" \
+#     -Xbootclasspath/a:"GooClass" \
+#     Main.java
+# Success "$javac" ${TESTTOOLVMOPTS} \
+#     -Xbootclasspath/p:"BadClass" \
+#     -Xbootclasspath:"GooClass${PS}BadClass${PS}$BCP" \
+#     -Xbootclasspath/a:"BadClass" \
+#     Main.java
+# Failure "$java" ${TESTVMOPTS} \
+#     -Xbootclasspath/p:"GooClass" \
+#     -Xbootclasspath:"BadClass${PS}$BCP" \
+#     -Xbootclasspath/a:"GooClass" \
+#     Main
+# Success "$java" ${TESTVMOPTS} \
+#     -Xbootclasspath/p:"BadClass" \
+#     -Xbootclasspath:"GooClass${PS}BadClass${PS}$BCP" \
+#     -Xbootclasspath/a:"BadClass" \
+#     Main
 
 #----------------------------------------------------------------
-Failure "$javac" ${TESTTOOLVMOPTS} \
-    -J-Djava.endorsed.dirs="BadZip" \
-    -Xbootclasspath:"GooClass${PS}$BCP" \
-    Main.java
-Success "$javac" ${TESTTOOLVMOPTS} \
-    -endorseddirs "BadClass${PS}GooZip${PS}BadJar" \
-    -Xbootclasspath:"BadClass${PS}$BCP" \
-    Main.java
-Success "$javac" ${TESTTOOLVMOPTS} \
-    -Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
-    -Xbootclasspath:"BadClass${PS}$BCP" \
-    Main.java
-Success "$javac" ${TESTTOOLVMOPTS} \
-    -J-Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
-    -Xbootclasspath:"BadClass${PS}$BCP" \
-    Main.java
-Failure "$java" ${TESTVMOPTS} \
-    -Djava.endorsed.dirs="BadZip" \
-    -Xbootclasspath:"GooClass${PS}$BCP" \
-    Main
-Success "$java" ${TESTVMOPTS} \
-    -Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
-    -Xbootclasspath:"BadClass${PS}$BCP" \
-    Main
+# Failure "$javac" ${TESTTOOLVMOPTS} \
+#     -J-Djava.endorsed.dirs="BadZip" \
+#     -Xbootclasspath:"GooClass${PS}$BCP" \
+#     Main.java
+# Success "$javac" ${TESTTOOLVMOPTS} \
+#     -endorseddirs "BadClass${PS}GooZip${PS}BadJar" \
+#     -Xbootclasspath:"BadClass${PS}$BCP" \
+#     Main.java
+# Success "$javac" ${TESTTOOLVMOPTS} \
+#     -Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
+#     -Xbootclasspath:"BadClass${PS}$BCP" \
+#     Main.java
+# Success "$javac" ${TESTTOOLVMOPTS} \
+#     -J-Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
+#     -Xbootclasspath:"BadClass${PS}$BCP" \
+#     Main.java
+# Failure "$java" ${TESTVMOPTS} \
+#     -Djava.endorsed.dirs="BadZip" \
+#     -Xbootclasspath:"GooClass${PS}$BCP" \
+#     Main
+# Success "$java" ${TESTVMOPTS} \
+#     -Djava.endorsed.dirs="BadClass${PS}GooZip${PS}BadJar" \
+#     -Xbootclasspath:"BadClass${PS}$BCP" \
+#     Main
 
 #----------------------------------------------------------------
 Failure "$javac" ${TESTTOOLVMOPTS} \
@@ -245,32 +245,32 @@ Success "$javac" ${TESTTOOLVMOPTS} \
     -Xbootclasspath/a:"GooClass${PS}BadClass" \
     -extdirs "BadZip" \
     Main.java
-Failure "$java" ${TESTVMOPTS} \
-    -Xbootclasspath/a:"BadClass" \
-    -Djava.ext.dirs="GooZip" \
-    Main
-Success "$java" ${TESTVMOPTS} \
-    -Xbootclasspath/a:"GooClass${PS}BadClass" \
-    -Djava.ext.dirs="BadZip" \
-    Main
+# Failure "$java" ${TESTVMOPTS} \
+#     -Xbootclasspath/a:"BadClass" \
+#     -Djava.ext.dirs="GooZip" \
+#     Main
+# Success "$java" ${TESTVMOPTS} \
+#     -Xbootclasspath/a:"GooClass${PS}BadClass" \
+#     -Djava.ext.dirs="BadZip" \
+#     Main
 
 #----------------------------------------------------------------
-Failure "$javac" ${TESTTOOLVMOPTS} \
-    -bootclasspath "$BCP${PS}BadJar/Lib.jar" \
-    -J-Djava.ext.dir="GooJar" \
-    Main.java
-Success "$javac" ${TESTTOOLVMOPTS} \
-    -bootclasspath "$BCP${PS}GooJar/Lib.jar${PS}BadClass" \
-    -J-Djava.ext.dir="BadJar" \
-    Main.java
-Failure "$java" ${TESTVMOPTS} \
-    -Xbootclasspath:"$BCP${PS}BadJar/Lib.jar" \
-    -Djava.ext.dirs="GooJar" \
-    Main
-Success "$java" ${TESTVMOPTS} \
-    -Xbootclasspath:"$BCP${PS}GooJar/Lib.jar${PS}BadClass" \
-    -Djava.ext.dirs="BadJar" \
-    Main
+# Failure "$javac" ${TESTTOOLVMOPTS} \
+#     -bootclasspath "$BCP${PS}BadJar/Lib.jar" \
+#     -J-Djava.ext.dir="GooJar" \
+#     Main.java
+# Success "$javac" ${TESTTOOLVMOPTS} \
+#     -bootclasspath "$BCP${PS}GooJar/Lib.jar${PS}BadClass" \
+#     -J-Djava.ext.dir="BadJar" \
+#     Main.java
+# Failure "$java" ${TESTVMOPTS} \
+#     -Xbootclasspath:"$BCP${PS}BadJar/Lib.jar" \
+#     -Djava.ext.dirs="GooJar" \
+#     Main
+# Success "$java" ${TESTVMOPTS} \
+#     -Xbootclasspath:"$BCP${PS}GooJar/Lib.jar${PS}BadClass" \
+#     -Djava.ext.dirs="BadJar" \
+#     Main
 
 #----------------------------------------------------------------
 Failure "$javac" ${TESTTOOLVMOPTS} \
@@ -285,18 +285,18 @@ Success "$javac" ${TESTTOOLVMOPTS} \
     -Djava.ext.dirs="GooZip${PS}BadJar" \
     -classpath "BadZip/Lib.zip" \
     Main.java
-Success "$javac" ${TESTTOOLVMOPTS} \
-    -J-Djava.ext.dirs="GooZip${PS}BadJar" \
-    -classpath "BadZip/Lib.zip" \
-    Main.java
-Failure "$java" ${TESTVMOPTS} \
-    -Djava.ext.dirs="GooClass${PS}BadZip" \
-    -cp "GooZip/Lib.zip${PS}." \
-    Main
-Success "$java" ${TESTVMOPTS} \
-    -Djava.ext.dirs="GooZip${PS}BadJar" \
-    -cp "BadZip/Lib.zip${PS}." \
-    Main
+# Success "$javac" ${TESTTOOLVMOPTS} \
+#     -J-Djava.ext.dirs="GooZip${PS}BadJar" \
+#     -classpath "BadZip/Lib.zip" \
+#     Main.java
+# Failure "$java" ${TESTVMOPTS} \
+#     -Djava.ext.dirs="GooClass${PS}BadZip" \
+#     -cp "GooZip/Lib.zip${PS}." \
+#     Main
+# Success "$java" ${TESTVMOPTS} \
+#     -Djava.ext.dirs="GooZip${PS}BadJar" \
+#     -cp "BadZip/Lib.zip${PS}." \
+#     Main
 
 #----------------------------------------------------------------
 Failure "$javac" ${TESTTOOLVMOPTS} -classpath "BadClass${PS}GooClass" Main.java
@@ -339,27 +339,27 @@ In GooClass Success "$java" ${TESTVMOPTS}  -cp "..${PS}${PS}/xyzzy" Main
 
 # All other empty path elements are ignored.
 In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -extdirs "" -cp ".." ../Main.java
-In GooJar Failure "$java" ${TESTVMOPTS} -Djava.ext.dirs="" -cp ".." Main
+# In GooJar Failure "$java" ${TESTVMOPTS} -Djava.ext.dirs="" -cp ".." Main
 
 In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -extdirs        "${PS}" -cp ".." ../Main.java
 In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -Djava.ext.dirs="${PS}" -cp ".." ../Main.java
-In GooJar Failure "$java" ${TESTVMOPTS}  -Djava.ext.dirs="${PS}" -cp ".." Main
+# In GooJar Failure "$java" ${TESTVMOPTS}  -Djava.ext.dirs="${PS}" -cp ".." Main
 
 In GooJar Success "$javac" ${TESTTOOLVMOPTS} -extdirs        "." -cp ".." ../Main.java
 In GooJar Success "$javac" ${TESTTOOLVMOPTS} -Djava.ext.dirs="." -cp ".." ../Main.java
-In GooJar Success "$java" ${TESTVMOPTS}  -Djava.ext.dirs="." -cp ".." Main
+# In GooJar Success "$java" ${TESTVMOPTS}  -Djava.ext.dirs="." -cp ".." Main
 
-In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -J-Djava.endorsed.dirs="" -cp ".." ../Main.java
+# In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -J-Djava.endorsed.dirs="" -cp ".." ../Main.java
 In GooJar Failure "$javac" ${TESTTOOLVMOPTS}   -Djava.endorsed.dirs="" -cp ".." ../Main.java
-In GooJar Failure "$java" ${TESTVMOPTS}    -Djava.endorsed.dirs="" -cp ".." Main
+# In GooJar Failure "$java" ${TESTVMOPTS}    -Djava.endorsed.dirs="" -cp ".." Main
 
-In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -J-Djava.endorsed.dirs="${PS}" -cp ".." ../Main.java
+# In GooJar Failure "$javac" ${TESTTOOLVMOPTS} -J-Djava.endorsed.dirs="${PS}" -cp ".." ../Main.java
 In GooJar Failure "$javac" ${TESTTOOLVMOPTS}   -endorseddirs        "${PS}" -cp ".." ../Main.java
-In GooJar Failure "$java" ${TESTVMOPTS}    -Djava.endorsed.dirs="${PS}" -cp ".." Main
+# In GooJar Failure "$java" ${TESTVMOPTS}    -Djava.endorsed.dirs="${PS}" -cp ".." Main
 
-In GooJar Success "$javac" ${TESTTOOLVMOPTS} -J-Djava.endorsed.dirs="." -cp ".." ../Main.java
+# In GooJar Success "$javac" ${TESTTOOLVMOPTS} -J-Djava.endorsed.dirs="." -cp ".." ../Main.java
 In GooJar Success "$javac" ${TESTTOOLVMOPTS}   -Djava.endorsed.dirs="." -cp ".." ../Main.java
-In GooJar Success "$java" ${TESTVMOPTS}    -Djava.endorsed.dirs="." -cp ".." Main
+# In GooJar Success "$java" ${TESTVMOPTS}    -Djava.endorsed.dirs="." -cp ".." Main
 
 In GooClass Failure "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath/p: -cp ".." ../Main.java
 In GooClass Failure "$java" ${TESTVMOPTS}  -Xbootclasspath/p: -cp ".." Main
@@ -367,11 +367,11 @@ In GooClass Failure "$java" ${TESTVMOPTS}  -Xbootclasspath/p: -cp ".." Main
 In GooClass Success "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath/p:. -cp ".." ../Main.java
 In GooClass Success "$java" ${TESTVMOPTS}  -Xbootclasspath/p:. -cp ".." Main
 
-In GooClass Failure "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath:"$BCP" -cp ".." ../Main.java
-In GooClass Failure "$java" ${TESTVMOPTS}  -Xbootclasspath:"$BCP" -cp ".." Main
+# In GooClass Failure "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath:"$BCP" -cp ".." ../Main.java
+# In GooClass Failure "$java" ${TESTVMOPTS}  -Xbootclasspath:"$BCP" -cp ".." Main
 
-In GooClass Success "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath:"$BCP${PS}." -cp ".." ../Main.java
-In GooClass Success "$java" ${TESTVMOPTS}  -Xbootclasspath:"$BCP${PS}." -cp ".." Main
+# In GooClass Success "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath:"$BCP${PS}." -cp ".." ../Main.java
+# In GooClass Success "$java" ${TESTVMOPTS}  -Xbootclasspath:"$BCP${PS}." -cp ".." Main
 
 In GooClass Failure "$javac" ${TESTTOOLVMOPTS} -Xbootclasspath/a: -cp ".." ../Main.java
 In GooClass Failure "$java" ${TESTVMOPTS}  -Xbootclasspath/a: -cp ".." Main
diff --git a/langtools/test/tools/javac/Paths/SameJVM.java b/langtools/test/tools/javac/Paths/SameJVM.java
deleted file mode 100644
index 369b0b0b16a..00000000000
--- a/langtools/test/tools/javac/Paths/SameJVM.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2004, 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.
- */
-
-/*
- * Support routines to allow running `javac' or `jar' within the same JVM.
- */
-
-import java.io.*;
-import java.net.*;
-import java.lang.reflect.*;
-
-class SameJVM {
-
-    private static ClassLoader toolsClassLoader() {
-        File javaHome   = new File(System.getProperty("java.home"));
-        File classesDir = new File(javaHome, "classes");
-        File libDir     = new File(javaHome.getParentFile(), "lib");
-        File toolsJar   = new File(libDir, "tools.jar");
-        try {
-            return new URLClassLoader(
-                new URL[] {classesDir.toURL(), toolsJar.toURL()});
-        } catch (MalformedURLException e) { throw new AssertionError(e); }
-    }
-    private static final ClassLoader cl = toolsClassLoader();
-
-    static void javac(String... args) throws Exception {
-        Class c = Class.forName("com.sun.tools.javac.Main", true, cl);
-        int status = (Integer)
-            c.getMethod("compile", new Class[] {String[].class})
-            .invoke(c.newInstance(), new Object[] {args});
-        if (status != 0)
-            throw new Exception("javac failed: status=" + status);
-    }
-
-    static void jar(String... args) throws Exception {
-        Class c = Class.forName("sun.tools.jar.Main", true, cl);
-        Object instance = c.getConstructor(
-            new Class[] {PrintStream.class, PrintStream.class, String.class})
-            .newInstance(System.out, System.err, "jar");
-        boolean result = (Boolean)
-            c.getMethod("run", new Class[] {String[].class})
-            .invoke(instance, new Object[] {args});
-        if (! result)
-            throw new Exception("jar failed");
-    }
-}
diff --git a/langtools/test/tools/javac/Paths/Util.sh b/langtools/test/tools/javac/Paths/Util.sh
index 35840aee6bf..3f41f707804 100644
--- a/langtools/test/tools/javac/Paths/Util.sh
+++ b/langtools/test/tools/javac/Paths/Util.sh
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 #
 # This code is free software; you can redistribute it and/or modify it
@@ -57,15 +57,15 @@ Report() {
     test "$#" != 2 && Die "Usage: Report success|failure rc"
 
     if   test "$1" = "success" -a "$2" = 0; then
-	echo "PASS: succeeded as expected"
+        echo "PASS: succeeded as expected"
     elif test "$1" = "failure" -a "$2" != 0; then
-	echo "PASS: failed as expected"
+        echo "PASS: failed as expected"
     elif test "$1" = "success" -a "$2" != 0; then
-	Fail "test failed unexpectedly"
+        Fail "test failed unexpectedly"
     elif test "$1" = "failure" -a "$2" = 0; then
-	Fail "test succeeded unexpectedly"
+        Fail "test succeeded unexpectedly"
     else
-	Die "Usage: Report success|failure rc"
+        Die "Usage: Report success|failure rc"
     fi
 }
 
@@ -92,12 +92,12 @@ Bottom() {
     test "$#" = 1 -a "$1" = "Line" || Die "Usage: Bottom Line"
 
     if test -n "$failed"; then
-	count=`printf "%s" "$failed" | wc -c | tr -d ' '`
-	echo "FAIL: $count tests failed"
-	exit 1
+        count=`printf "%s" "$failed" | wc -c | tr -d ' '`
+        echo "FAIL: $count tests failed"
+        exit 1
     else
-	echo "PASS: all tests gave expected results"
-	exit 0
+        echo "PASS: all tests gave expected results"
+        exit 0
     fi
 }
 
@@ -105,21 +105,21 @@ BadJarFile() {
     for jarfilename in "$@"; do pwd > "$jarfilename"; done
 }
 
-#----------------------------------------------------------------
-# Usage: BCP=`DefaultBootClassPath`
-# Returns default bootclasspath, discarding non-existent entries
-#----------------------------------------------------------------
-DefaultBootClassPath() {
-    echo 'public class B {public static void main(String[] a) {
-    System.out.println(System.getProperty("sun.boot.class.path"));}}' > B.java
-    "$javac" ${TESTTOOLVMOPTS} B.java
-    _BCP_=""
-    for elt in `"$java" ${TESTVMOPTS} B | tr "${PS}" " "`; do
-	test -r "$elt" -a -n "$elt" && _BCP_="${_BCP_:+${_BCP_}${PS}}${elt}"
-    done
-    rm -f B.java B.class
-    printf "%s" "$_BCP_"	# Don't use echo -- unsafe on Windows
-}
+# #----------------------------------------------------------------
+# # Usage: BCP=`DefaultBootClassPath`
+# # Returns default bootclasspath, discarding non-existent entries
+# #----------------------------------------------------------------
+# DefaultBootClassPath() {
+#     echo 'public class B {public static void main(String[] a) {
+#     System.out.println(System.getProperty("sun.boot.class.path"));}}' > B.java
+#     "$javac" ${TESTTOOLVMOPTS} B.java
+#     _BCP_=""
+#     for elt in `"$java" ${TESTVMOPTS} B | tr "${PS}" " "`; do
+#       test -r "$elt" -a -n "$elt" && _BCP_="${_BCP_:+${_BCP_}${PS}}${elt}"
+#     done
+#     rm -f B.java B.class
+#     printf "%s" "$_BCP_"      # Don't use echo -- unsafe on Windows
+# }
 
 #----------------------------------------------------------------
 # Foil message localization
diff --git a/langtools/test/tools/javac/T6558476.java b/langtools/test/tools/javac/T6558476.java
index f6871c2a40c..5b021016407 100644
--- a/langtools/test/tools/javac/T6558476.java
+++ b/langtools/test/tools/javac/T6558476.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, 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
diff --git a/langtools/test/tools/javac/T6654037.java b/langtools/test/tools/javac/T6654037.java
index a59487320f3..e6dad2cef7d 100644
--- a/langtools/test/tools/javac/T6654037.java
+++ b/langtools/test/tools/javac/T6654037.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, 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
@@ -44,13 +44,12 @@ import javax.tools.ToolProvider;
 public class T6654037 {
 
     public static void main(String[] args) throws Exception {
-        final String bootPath = System.getProperty("sun.boot.class.path"); //NOI18N
         final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         assert tool != null;
 
         String code = "package test; public class Test {private void test() {Object o = null; boolean b = o != null && o instanceof String;} private Test() {}}";
 
-        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, Arrays.asList("-bootclasspath", bootPath, "-Xjcov"), null, Arrays.asList(new MyFileObject(code)));
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(null, null, null, Arrays.asList("-Xjcov"), null, Arrays.asList(new MyFileObject(code)));
         CompilationUnitTree cut = ct.parse().iterator().next();
         ClassTree clazz = (ClassTree) cut.getTypeDecls().get(0);
         MethodTree method = (MethodTree) clazz.getMembers().get(0);
diff --git a/langtools/test/tools/javac/T6705935.java b/langtools/test/tools/javac/T6705935.java
index 51e09177a12..a836a01e33f 100644
--- a/langtools/test/tools/javac/T6705935.java
+++ b/langtools/test/tools/javac/T6705935.java
@@ -41,8 +41,6 @@ public class T6705935 {
 
     public void run() throws Exception {
         File java_home = new File(System.getProperty("java.home"));
-        if (java_home.getName().equals("jre"))
-            java_home = java_home.getParentFile();
 
         JavaCompiler c = ToolProvider.getSystemJavaCompiler();
         try (StandardJavaFileManager fm = c.getStandardFileManager(null, null, null)) {
diff --git a/langtools/test/tools/javac/T6725036.java b/langtools/test/tools/javac/T6725036.java
index a2fd60bbce3..7d994cd336b 100644
--- a/langtools/test/tools/javac/T6725036.java
+++ b/langtools/test/tools/javac/T6725036.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,13 +26,17 @@
  * @bug 6725036 8016760
  * @summary javac returns incorrect value for lastModifiedTime() when
  *          source is a zip file archive
+ * @library /tools/lib
+ * @build ToolBox
+ * @run main T6725036
  */
 
 import java.io.File;
+import java.io.IOException;
 import java.util.Date;
 import java.util.jar.JarEntry;
 import java.util.jar.JarFile;
-import javax.tools.JavaFileObject;
+import javax.tools.*;
 
 import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.file.RelativePath.RelativeFile;
@@ -49,33 +53,43 @@ public class T6725036 {
     void run() throws Exception {
         RelativeFile TEST_ENTRY_NAME = new RelativeFile("java/lang/String.class");
 
-        File f = new File(System.getProperty("java.home"));
-        if (!f.getName().equals("jre"))
-            f = new File(f, "jre");
-        File rt_jar = new File(new File(f, "lib"), "rt.jar");
+        File testJar = createJar("test.jar", "java.lang.*");
 
-        JarFile j = new JarFile(rt_jar);
-        JarEntry je = j.getJarEntry(TEST_ENTRY_NAME.getPath());
-        long jarEntryTime = je.getTime();
+        try (JarFile j = new JarFile(testJar)) {
+            JarEntry je = j.getJarEntry(TEST_ENTRY_NAME.getPath());
+            long jarEntryTime = je.getTime();
 
-        ZipFileIndexCache zfic = ZipFileIndexCache.getSharedInstance();
-        ZipFileIndex zfi = zfic.getZipFileIndex(rt_jar, null, false, null, false);
-        long zfiTime = zfi.getLastModified(TEST_ENTRY_NAME);
+            ZipFileIndexCache zfic = ZipFileIndexCache.getSharedInstance();
+            ZipFileIndex zfi = zfic.getZipFileIndex(testJar, null, false, null, false);
+            long zfiTime = zfi.getLastModified(TEST_ENTRY_NAME);
 
-        check(je, jarEntryTime, zfi + ":" + TEST_ENTRY_NAME.getPath(), zfiTime);
+            check(je, jarEntryTime, zfi + ":" + TEST_ENTRY_NAME.getPath(), zfiTime);
 
-        Context context = new Context();
-        JavacFileManager fm = new JavacFileManager(context, false, null);
-        ZipFileIndexArchive zfia = new ZipFileIndexArchive(fm, zfi);
-        JavaFileObject jfo =
-            zfia.getFileObject(TEST_ENTRY_NAME.dirname(),
-                                   TEST_ENTRY_NAME.basename());
-        long jfoTime = jfo.getLastModified();
+            Context context = new Context();
+            JavacFileManager fm = new JavacFileManager(context, false, null);
+            ZipFileIndexArchive zfia = new ZipFileIndexArchive(fm, zfi);
+            JavaFileObject jfo =
+                zfia.getFileObject(TEST_ENTRY_NAME.dirname(),
+                                       TEST_ENTRY_NAME.basename());
+            long jfoTime = jfo.getLastModified();
 
-        check(je, jarEntryTime, jfo, jfoTime);
+            check(je, jarEntryTime, jfo, jfoTime);
 
-        if (errors > 0)
-            throw new Exception(errors + " occurred");
+            if (errors > 0)
+                throw new Exception(errors + " occurred");
+        }
+    }
+
+    File createJar(String name, String... paths) throws IOException {
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        try (JavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
+            File f = new File(name);
+            ToolBox tb = new ToolBox();
+            tb.new JarTask(f.getPath())
+                .files(fm, StandardLocation.PLATFORM_CLASS_PATH, paths)
+                .run();
+            return f;
+        }
     }
 
     void check(Object ref, long refTime, Object test, long testTime) {
diff --git a/langtools/test/tools/javac/T6873845.java b/langtools/test/tools/javac/T6873845.java
index b1cfea6d203..3fc6ca4eea4 100644
--- a/langtools/test/tools/javac/T6873845.java
+++ b/langtools/test/tools/javac/T6873845.java
@@ -1,14 +1,14 @@
-import java.io.*;
-import java.util.*;
-
-import sun.misc.*;
-
 /*
  * @test /nodynamiccopyright/
  * @bug 6873845
  * @summary refine access to symbol file
  */
 
+import java.io.*;
+import java.util.*;
+
+import sun.misc.*;
+
 public class T6873845 {
     public static void main(String... args) throws Exception {
         new T6873845().run();
diff --git a/langtools/test/tools/javac/annotations/TestAnnotationPackageInfo.java b/langtools/test/tools/javac/annotations/TestAnnotationPackageInfo.java
index ac7593c3d49..f6a7e1f649f 100644
--- a/langtools/test/tools/javac/annotations/TestAnnotationPackageInfo.java
+++ b/langtools/test/tools/javac/annotations/TestAnnotationPackageInfo.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -51,7 +51,6 @@ public class TestAnnotationPackageInfo {
     }
 
     public void run() throws Exception {
-        final String bootPath = System.getProperty("sun.boot.class.path");
         final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         assert tool != null;
 
@@ -65,9 +64,8 @@ public class TestAnnotationPackageInfo {
 
         DiagnosticCollector<JavaFileObject> coll = new DiagnosticCollector<JavaFileObject>();
 
-        List<String> options = Arrays.asList("-bootclasspath",  bootPath);
         List<? extends JavaFileObject> files = Arrays.asList(test_java, package_info_java);
-        JavacTask ct = (JavacTask)tool.getTask(null, null, coll, options, null, files);
+        JavacTask ct = (JavacTask)tool.getTask(null, null, coll, null, null, files);
         ct.analyze();
 
         String expectedCode = "compiler.err.annotation.missing.default.value";
diff --git a/langtools/test/tools/javac/api/6411310/Test.java b/langtools/test/tools/javac/api/6411310/Test.java
deleted file mode 100644
index 26a989285ce..00000000000
--- a/langtools/test/tools/javac/api/6411310/Test.java
+++ /dev/null
@@ -1,232 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6410367 6411310
- * @summary FileObject should support user-friendly names via getName()
- */
-
-import java.io.*;
-import java.util.*;
-import java.util.jar.*;
-import java.util.zip.*;
-import javax.tools.*;
-
-import com.sun.tools.javac.file.JavacFileManager;
-import com.sun.tools.javac.util.Context;
-import com.sun.tools.javac.util.Options;
-
-// Test FileObject.getName returned from JavacFileManager and its support classes.
-
-public class Test {
-    public static void main(String... args) throws Exception {
-        new Test().run();
-    }
-
-    Set<String> foundClasses = new TreeSet<String>();
-    Set<String> foundJars = new TreeSet<String>();
-
-    void run() throws Exception {
-        File rt_jar = findRtJar();
-
-        // names for entries to be created in directories and jar files
-        String[] entries = { "p/A.java", "p/A.class", "p/resources/A-1.html" };
-
-        // test various combinations of directories and jar files, intended to
-        // cover all sources of file objects within JavacFileManager's support classes
-
-        test(createFileManager(), createDir("dir", entries), "p", entries);
-        test(createFileManager(), createDir("a b/dir", entries), "p", entries);
-
-        for (boolean useOptimizedZip: new boolean[] { false, true }) {
-            test(createFileManager(useOptimizedZip), createJar("jar", entries), "p", entries);
-            test(createFileManager(useOptimizedZip), createJar("jar jar", entries), "p", entries);
-
-            for (boolean useSymbolFile: new boolean[] { false, true }) {
-                test(createFileManager(useOptimizedZip, useSymbolFile), rt_jar, "java.lang.ref", null);
-            }
-        }
-
-        if (errors > 0)
-            throw new Exception(errors + " errors found");
-
-        // Verify that we hit all the impl classes we intended
-        checkCoverage("classes", foundClasses,
-                "RegularFileObject", "SymbolFileObject", "ZipFileIndexFileObject", "ZipFileObject");
-
-        // Verify that we hit the jar files we intended, specifically ct.sym as well as rt.jar
-        checkCoverage("jar files", foundJars,
-                "ct.sym", "jar", "jar jar", "rt.jar");
-    }
-
-    // use a new file manager for each test
-    void test(StandardJavaFileManager fm, File f, String pkg, String[] entries) throws Exception {
-        System.err.println("Test " + f);
-        try {
-            if (f.isDirectory()) {
-                for (File dir: new File[] { f, f.getAbsoluteFile() }) {
-                    for (String e: entries) {
-                        JavaFileObject fo = fm.getJavaFileObjects(new File(dir, e)).iterator().next();
-                        test(fo, dir, e);
-                    }
-                }
-            }
-
-            fm.setLocation(StandardLocation.CLASS_PATH, Collections.singleton(f));
-            fm.setLocation(StandardLocation.SOURCE_PATH, Collections.singleton(f.getAbsoluteFile()));
-            for (StandardLocation l: EnumSet.of(StandardLocation.CLASS_PATH, StandardLocation.SOURCE_PATH)) {
-                for (JavaFileObject fo: fm.list(l, pkg, EnumSet.allOf(JavaFileObject.Kind.class), true)) {
-                    // we could use fm.getLocation but the following guarantees we preserve the original filename
-                    File dir = (l == StandardLocation.CLASS_PATH ? f : f.getAbsoluteFile());
-                    char sep = (dir.isDirectory() ? File.separatorChar : '/');
-                    String b = fm.inferBinaryName(l, fo);
-                    String e = fo.getKind().extension;
-                    test(fo, dir, b.replace('.', sep) + e);
-                }
-            }
-        } finally {
-            fm.close();
-        }
-    }
-
-    void test(JavaFileObject fo, File dir, String p) {
-        System.err.println("Test: " + fo);
-        String expect = dir.isDirectory() ? new File(dir, p).getPath() : (dir.getPath() + "(" + p + ")");
-        String found = fo.getName();
-        // if ct.sym is found, replace it with the equivalent rt.jar
-        String found2 = found.replaceAll("lib([\\\\/])ct.sym\\(META-INF/sym/rt.jar/", "jre$1lib$1rt.jar(");
-        if (!expect.equals(found2)) {
-            System.err.println("expected: " + expect);
-            System.err.println("   found: " + found);
-            if (!found.equals(found2))
-                System.err.println("  found2: " + found2);
-            error("Failed: " + fo);
-        }
-
-        // record the file object class name for coverage checks later
-        foundClasses.add(fo.getClass().getSimpleName());
-
-        if (found.contains("(")) {
-            // record access to the jar file for coverage checks later
-            foundJars.add(new File(found.substring(0, found.indexOf("("))).getName());
-        }
-    }
-
-    void checkCoverage(String label, Set<String> found, String... expect) throws Exception {
-        Set<String> e = new TreeSet<String>(Arrays.asList(expect));
-        if (!found.equals(e)) {
-            e.removeAll(found);
-            throw new Exception("expected " + label + " not used: " + e);
-        }
-    }
-
-    JavacFileManager createFileManager() {
-        return createFileManager(false, false);
-    }
-
-    JavacFileManager createFileManager(boolean useOptimizedZip) {
-        return createFileManager(useOptimizedZip, false);
-    }
-
-    JavacFileManager createFileManager(boolean useOptimizedZip, boolean useSymbolFile) {
-        Context c = new Context();
-        Options options = Options.instance(c);
-
-        options.put("useOptimizedZip", Boolean.toString(useOptimizedZip));
-
-        if (!useSymbolFile) {
-            options.put("ignore.symbol.file", "true");
-        }
-        return new JavacFileManager(c, false, null);
-    }
-
-    File createDir(String name, String... entries) throws Exception {
-        File dir = new File(name);
-        if (!dir.mkdirs())
-            throw new Exception("cannot create directories " + dir);
-        for (String e: entries) {
-            writeFile(new File(dir, e), e);
-        }
-        return dir;
-    }
-
-    File createJar(String name, String... entries) throws IOException {
-        File jar = new File(name);
-        OutputStream out = new FileOutputStream(jar);
-        try {
-            JarOutputStream jos = new JarOutputStream(out);
-            for (String e: entries) {
-                jos.putNextEntry(new ZipEntry(e));
-                jos.write(e.getBytes());
-            }
-            jos.close();
-        } finally {
-            out.close();
-        }
-        return jar;
-    }
-
-    File findRtJar() throws Exception {
-        File java_home = new File(System.getProperty("java.home"));
-        if (java_home.getName().equals("jre"))
-            java_home = java_home.getParentFile();
-        File rt_jar = new File(new File(new File(java_home, "jre"), "lib"), "rt.jar");
-        if (!rt_jar.exists())
-            throw new Exception("can't find rt.jar");
-        return rt_jar;
-    }
-
-    byte[] read(InputStream in) throws IOException {
-        byte[] data = new byte[1024];
-        int offset = 0;
-        try {
-            int n;
-            while ((n = in.read(data, offset, data.length - offset)) != -1) {
-                offset += n;
-                if (offset == data.length)
-                    data = Arrays.copyOf(data, 2 * data.length);
-            }
-        } finally {
-            in.close();
-        }
-        return Arrays.copyOf(data, offset);
-    }
-
-    void writeFile(File f, String s) throws IOException {
-        f.getParentFile().mkdirs();
-        FileWriter out = new FileWriter(f);
-        try {
-            out.write(s);
-        } finally {
-            out.close();
-        }
-    }
-
-    void error(String msg) {
-        System.err.println(msg);
-        errors++;
-    }
-
-    int errors;
-}
diff --git a/langtools/test/tools/javac/api/6598108/T6598108.java b/langtools/test/tools/javac/api/6598108/T6598108.java
index a7ca25971aa..6bc71aac462 100644
--- a/langtools/test/tools/javac/api/6598108/T6598108.java
+++ b/langtools/test/tools/javac/api/6598108/T6598108.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, 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
@@ -43,10 +43,9 @@ import javax.tools.ToolProvider;
 
 public class T6598108 {
     public static void main(String[] args) throws Exception {
-        final String bootPath = System.getProperty("sun.boot.class.path"); //NOI18N
         final JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         assert tool != null;
-        final JavacTask ct = (JavacTask)tool.getTask(null, null, null, Arrays.asList("-bootclasspath",  bootPath), null, Arrays.asList(new MyFileObject()));
+        final JavacTask ct = (JavacTask)tool.getTask(null, null, null, null, null, Arrays.asList(new MyFileObject()));
 
         CompilationUnitTree cut = ct.parse().iterator().next();
         TreePath tp = new TreePath(new TreePath(cut), cut.getTypeDecls().get(0));
diff --git a/langtools/test/tools/javac/api/6608214/T6608214.java b/langtools/test/tools/javac/api/6608214/T6608214.java
index 42383923bc0..be17e1c85e7 100644
--- a/langtools/test/tools/javac/api/6608214/T6608214.java
+++ b/langtools/test/tools/javac/api/6608214/T6608214.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -47,8 +47,7 @@ public class T6608214 {
             }
         };
         List<? extends JavaFileObject> files = Arrays.asList(sfo);
-        String bootPath = System.getProperty("sun.boot.class.path");
-        List<String> opts = Arrays.asList("-bootclasspath",  bootPath, "-Xjcov");
+        List<String> opts = Arrays.asList("-Xjcov");
         JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         JavacTask ct = (JavacTask)tool.getTask(null, null, null,opts,null,files);
         ct.analyze();
diff --git a/langtools/test/tools/javac/api/T6412669.java b/langtools/test/tools/javac/api/T6412669.java
index c8fc966b46e..f9e9152f0c7 100644
--- a/langtools/test/tools/javac/api/T6412669.java
+++ b/langtools/test/tools/javac/api/T6412669.java
@@ -44,28 +44,9 @@ public class T6412669 extends AbstractProcessor {
         File testSrc = new File(System.getProperty("test.src", "."));
         File testClasses = new File(System.getProperty("test.classes", "."));
 
-        // Determine location of necessary tools classes. Assume all in one place.
-        // Likely candidates are typically tools.jar (when testing JDK build)
-        // or build/classes or dist/javac.jar (when testing langtools, using -Xbootclasspath/p:)
-        File toolsClasses;
-        URL u = T6412669.class.getClassLoader().getResource("com/sun/source/util/JavacTask.class");
-        switch (u.getProtocol()) {
-            case "file":
-                toolsClasses = new File(u.toURI());
-                break;
-            case "jar":
-                String s = u.getFile(); // will be file:path!/entry
-                int sep = s.indexOf("!");
-                toolsClasses = new File(new URI(s.substring(0, sep)));
-                break;
-            default:
-                throw new AssertionError("Cannot locate tools classes");
-        }
-        //System.err.println("toolsClasses: " + toolsClasses);
-
         JavacTool tool = JavacTool.create();
         try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
-            fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(testClasses, toolsClasses));
+            fm.setLocation(StandardLocation.CLASS_PATH, Arrays.asList(testClasses));
             Iterable<? extends JavaFileObject> files =
                 fm.getJavaFileObjectsFromFiles(Arrays.asList(new File(testSrc, T6412669.class.getName()+".java")));
             String[] opts = { "-proc:only", "-processor", T6412669.class.getName()};
diff --git a/langtools/test/tools/javac/api/T6430241.java b/langtools/test/tools/javac/api/T6430241.java
index bdcc068aa25..e032d4165ea 100644
--- a/langtools/test/tools/javac/api/T6430241.java
+++ b/langtools/test/tools/javac/api/T6430241.java
@@ -1,238 +1,255 @@
-    /*
-     * Copyright (c) 2011, 2014, 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.
-     */
+/*
+ * Copyright (c) 2011, 2014, 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 6430241
-     * @summary Hard to disable symbol file feature through API
-     */
+/*
+ * @test
+ * @bug 6430241
+ * @summary Hard to disable symbol file feature through API
+ * @library /tools/lib
+ * @build ToolBox
+ * @run main T6430241
+ */
 
-    import java.io.*;
-    import java.util.*;
-    import javax.tools.*;
+import java.io.*;
+import java.util.*;
 
-    import com.sun.source.util.JavacTask;
-    import com.sun.tools.javac.api.JavacTool;
+import javax.tools.*;
 
-    public class T6430241 {
-        public static void main(String... args) throws Exception {
-            new T6430241().run();
+import com.sun.source.util.JavacTask;
+import com.sun.tools.javac.api.JavacTool;
+import com.sun.tools.javac.file.JavacFileManager;
+import com.sun.tools.javac.util.Context;
+
+public class T6430241 {
+    public static void main(String... args) throws Exception {
+        new T6430241().run();
+    }
+
+    void run() throws Exception {
+        setup();
+        testCommandLine();
+        testSimpleAPI();
+        testTaskAPI();
+
+        if (errors > 0)
+            throw new Exception(errors + " errors found");
+    }
+
+    void setup() throws Exception {
+        classesDir = new File("classes");
+        classesDir.mkdirs();
+
+        emptyDir = new File("empty");
+        emptyDir.mkdirs();
+
+        bootClassPath = createJar().getPath();
+
+        File srcDir = new File("src");
+        String test = "import sun.misc.Unsafe; class Test { }";
+        testFile = writeFile(srcDir, "Test.java", test);
+    }
+
+    //----- tests for command line invocation
+
+    void testCommandLine() throws Exception {
+        testCommandLine(true);
+        testCommandLine(false, "-Xbootclasspath/p:" + emptyDir);
+        testCommandLine(false, "-Xbootclasspath:" + bootClassPath);
+        testCommandLine(false, "-Xbootclasspath/a:" + emptyDir);
+        testCommandLine(false, "-XDignore.symbol.file");
+        System.err.println();
+    }
+
+    void testCommandLine(boolean expectWarnings, String... opts) throws Exception {
+        System.err.println("test command line: " + Arrays.asList(opts));
+
+        String[] args = initArgs(opts);
+
+        StringWriter sw = new StringWriter();
+        PrintWriter pw = new PrintWriter(sw);
+        int rc = com.sun.tools.javac.Main.compile(args, pw);
+        String out = showOutput(sw.toString());
+
+        checkCompilationOK(rc);
+        checkOutput(out, expectWarnings);
+    }
+
+    //----- tests for simple API invocation
+
+    void testSimpleAPI() {
+        testSimpleAPI(true);
+        testSimpleAPI(false, "-Xbootclasspath/p:" + emptyDir);
+        testSimpleAPI(false, "-Xbootclasspath:" + bootClassPath);
+        testSimpleAPI(false, "-Xbootclasspath/a:" + emptyDir);
+        testSimpleAPI(false, "-XDignore.symbol.file");
+        System.err.println();
+    }
+
+    void testSimpleAPI(boolean expectWarnings, String... opts) {
+        System.err.println("test simple API: " + Arrays.asList(opts));
+
+        String[] args = initArgs(opts);
+
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        PrintStream ps = new PrintStream(baos);
+
+        JavacTool tool = JavacTool.create();
+        int rc = tool.run(null, null, ps, args);
+
+        String out = showOutput(baos.toString());
+
+        checkCompilationOK(rc);
+        checkOutput(out, expectWarnings);
+    }
+
+    //----- tests for CompilationTask API invocation
+
+    void testTaskAPI() throws Exception {
+        List<File> bcp = new ArrayList<File>();
+        for (String f: bootClassPath.split(File.pathSeparator)) {
+            if (!f.isEmpty())
+                bcp.add(new File(f));
         }
 
-        void run() throws Exception {
-            setup();
-            testCommandLine();
-            testSimpleAPI();
-            testTaskAPI();
+        testTaskAPI(true, null);
+        testTaskAPI(false, bcp);
+        System.err.println();
+    }
 
-            if (errors > 0)
-                throw new Exception(errors + " errors found");
-        }
+    void testTaskAPI(boolean expectWarnings, Iterable<? extends File> pcp) throws Exception {
+        System.err.println("test task API: " + pcp);
 
-        void setup() throws Exception {
-            classesDir = new File("classes");
-            classesDir.mkdirs();
+        JavacTool tool = JavacTool.create();
+        try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
 
-            emptyDir = new File("empty");
-            emptyDir.mkdirs();
+            if (pcp != null)
+                fm.setLocation(StandardLocation.PLATFORM_CLASS_PATH, pcp);
 
-            bootClassPath = System.getProperty("sun.boot.class.path");
-
-            File srcDir = new File("src");
-            String test = "import sun.misc.Unsafe; class Test { }";
-            testFile = writeFile(srcDir, "Test.java", test);
-        }
-
-        //----- tests for command line invocation
-
-        void testCommandLine() throws Exception {
-            testCommandLine(true);
-            testCommandLine(true,  "-Xbootclasspath/p:" + emptyDir);
-            testCommandLine(false, "-Xbootclasspath:" + bootClassPath);
-            testCommandLine(true,  "-Xbootclasspath/a:" + emptyDir);
-            testCommandLine(false, "-XDignore.symbol.file");
-            System.err.println();
-        }
-
-        void testCommandLine(boolean expectWarnings, String... opts) throws Exception {
-            System.err.println("test command line: " + Arrays.asList(opts));
-
-            String[] args = initArgs(opts);
+            Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(testFile);
 
             StringWriter sw = new StringWriter();
             PrintWriter pw = new PrintWriter(sw);
-            int rc = com.sun.tools.javac.Main.compile(args, pw);
+            JavacTask task = tool.getTask(pw, fm, null, null, null, files);
+            boolean ok = task.call();
             String out = showOutput(sw.toString());
 
-            checkCompilationOK(rc);
+            checkCompilationOK(ok);
             checkOutput(out, expectWarnings);
         }
-
-        //----- tests for simple API invocation
-
-        void testSimpleAPI() {
-            testSimpleAPI(true);
-            testSimpleAPI(true,  "-Xbootclasspath/p:" + emptyDir);
-            testSimpleAPI(false, "-Xbootclasspath:" + bootClassPath);
-            testSimpleAPI(true,  "-Xbootclasspath/a:" + emptyDir);
-            testSimpleAPI(false, "-XDignore.symbol.file");
-            System.err.println();
-        }
-
-        void testSimpleAPI(boolean expectWarnings, String... opts) {
-            System.err.println("test simple API: " + Arrays.asList(opts));
-
-            String[] args = initArgs(opts);
-
-            ByteArrayOutputStream baos = new ByteArrayOutputStream();
-            PrintStream ps = new PrintStream(baos);
-
-            JavacTool tool = JavacTool.create();
-            int rc = tool.run(null, null, ps, args);
-
-            String out = showOutput(baos.toString());
-
-            checkCompilationOK(rc);
-            checkOutput(out, expectWarnings);
-        }
-
-        //----- tests for CompilationTask API invocation
-
-        void testTaskAPI() throws Exception {
-            List<File> bcp = new ArrayList<File>();
-            for (String f: bootClassPath.split(File.pathSeparator)) {
-                if (!f.isEmpty())
-                    bcp.add(new File(f));
-            }
-
-            testTaskAPI(true, null);
-            testTaskAPI(false, bcp);
-            System.err.println();
-        }
-
-        void testTaskAPI(boolean expectWarnings, Iterable<? extends File> pcp) throws Exception {
-            System.err.println("test task API: " + pcp);
-
-            JavacTool tool = JavacTool.create();
-            try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
-
-                if (pcp != null)
-                    fm.setLocation(StandardLocation.PLATFORM_CLASS_PATH, pcp);
-
-                Iterable<? extends JavaFileObject> files = fm.getJavaFileObjects(testFile);
-
-                StringWriter sw = new StringWriter();
-                PrintWriter pw = new PrintWriter(sw);
-                JavacTask task = tool.getTask(pw, fm, null, null, null, files);
-                boolean ok = task.call();
-                String out = showOutput(sw.toString());
-
-                checkCompilationOK(ok);
-                checkOutput(out, expectWarnings);
-            }
-        }
-
-        //----- utility methods
-
-        /**
-         * Create a file with given content.
-         */
-        File writeFile(File dir, String path, String content) throws IOException {
-            File f = new File(dir, path);
-            f.getParentFile().mkdirs();
-            FileWriter out = new FileWriter(f);
-            try {
-                out.write(content);
-            } finally {
-                out.close();
-            }
-            return f;
-        }
-
-        /**
-         * Initialize args for compilation with given opts.
-         * @return opts -d classesDir testFile
-         */
-        String[] initArgs(String[] opts) {
-            List<String> args = new ArrayList<String>();
-            args.addAll(Arrays.asList(opts));
-            args.add("-d");
-            args.add(classesDir.getPath());
-            args.add(testFile.getPath());
-            return args.toArray(new String[args.size()]);
-        }
-
-        /**
-         * Show output from compilation if non empty.
-         */
-        String showOutput(String out) {
-            if (!out.isEmpty())
-                System.err.println(out);
-            return out;
-        }
-
-        /**
-         * Verify compilation succeeeded.
-         */
-        void checkCompilationOK(boolean ok) {
-            if (!ok)
-                error("compilation failed");
-        }
-
-        /**
-         * Verify compilation succeeeded.
-         */
-        void checkCompilationOK(int rc) {
-            if (rc != 0)
-                error("compilation failed, rc: " + rc);
-        }
-
-        /**
-         * Check whether output contains warnings if and only if warnings
-         * are expected.
-         */
-        void checkOutput(String out, boolean expectWarnings) {
-            boolean foundWarnings = out.contains("warning");
-            if (foundWarnings) {
-                if (!expectWarnings)
-                    error("unexpected warnings found");
-            } else {
-                if (expectWarnings)
-                    error("expected warnings not found");
-            }
-        }
-
-        /**
-         * Report an error.
-         */
-        void error(String msg) {
-            System.err.println("error: " + msg);
-            errors++;
-        }
-
-        String bootClassPath;
-        File classesDir;
-        File emptyDir;
-        File testFile;
-        int errors;
     }
+
+    //----- utility methods
+
+    File createJar() throws IOException {
+        File f = new File("test.jar");
+        try (JavaFileManager fm = new JavacFileManager(new Context(), false, null)) {
+            ToolBox tb = new ToolBox();
+            tb.new JarTask(f.getPath())
+                .files(fm, StandardLocation.PLATFORM_CLASS_PATH, "java.lang.*", "sun.misc.*")
+                .run();
+        }
+        return f;
+    }
+
+    /**
+     * Create a file with given content.
+     */
+    File writeFile(File dir, String path, String content) throws IOException {
+        File f = new File(dir, path);
+        f.getParentFile().mkdirs();
+        FileWriter out = new FileWriter(f);
+        try {
+            out.write(content);
+        } finally {
+            out.close();
+        }
+        return f;
+    }
+
+    /**
+     * Initialize args for compilation with given opts.
+     * @return opts -d classesDir testFile
+     */
+    String[] initArgs(String[] opts) {
+        List<String> args = new ArrayList<String>();
+        args.addAll(Arrays.asList(opts));
+        args.add("-d");
+        args.add(classesDir.getPath());
+        args.add(testFile.getPath());
+        return args.toArray(new String[args.size()]);
+    }
+
+    /**
+     * Show output from compilation if non empty.
+     */
+    String showOutput(String out) {
+        if (!out.isEmpty())
+            System.err.println(out);
+        return out;
+    }
+
+    /**
+     * Verify compilation succeeded.
+     */
+    void checkCompilationOK(boolean ok) {
+        if (!ok)
+            error("compilation failed");
+    }
+
+    /**
+     * Verify compilation succeeded.
+     */
+    void checkCompilationOK(int rc) {
+        if (rc != 0)
+            error("compilation failed, rc: " + rc);
+    }
+
+    /**
+     * Check whether output contains warnings if and only if warnings
+     * are expected.
+     */
+    void checkOutput(String out, boolean expectWarnings) {
+        boolean foundWarnings = out.contains("warning");
+        if (foundWarnings) {
+            if (!expectWarnings)
+                error("unexpected warnings found");
+        } else {
+            if (expectWarnings)
+                error("expected warnings not found");
+        }
+    }
+
+    /**
+     * Report an error.
+     */
+    void error(String msg) {
+        System.err.println("error: " + msg);
+        errors++;
+    }
+
+    String bootClassPath;
+    File classesDir;
+    File emptyDir;
+    File testFile;
+    int errors;
+}
diff --git a/langtools/test/tools/javac/api/T6877206.java b/langtools/test/tools/javac/api/T6877206.java
index d3a09a519eb..aae6f485f21 100644
--- a/langtools/test/tools/javac/api/T6877206.java
+++ b/langtools/test/tools/javac/api/T6877206.java
@@ -52,8 +52,6 @@ public class T6877206 {
     Set<String> foundJars = new TreeSet<String>();
 
     void run() throws Exception {
-        File rt_jar = findRtJar();
-
         // names for entries to be created in directories and jar files
         String[] entries = { "p/A.class", "p/resources/A-1.jpg" };
 
@@ -66,19 +64,14 @@ public class T6877206 {
         for (boolean useOptimizedZip: new boolean[] { false, true }) {
             test(createFileManager(useOptimizedZip), createJar("jar", entries), "p", entries.length);
             test(createFileManager(useOptimizedZip), createJar("jar jar", entries), "p", entries.length);
-
-            for (boolean useSymbolFile: new boolean[] { false, true }) {
-                test(createFileManager(useOptimizedZip, useSymbolFile), rt_jar, "java.lang.ref", -1);
-            }
         }
 
-        // Verify that we hit all the impl classes we intended
+        // Verify that we hit the files we intended
         checkCoverage("classes", foundClasses,
-                "RegularFileObject", "SymbolFileObject", "ZipFileIndexFileObject", "ZipFileObject");
+                "RegularFileObject", "ZipFileIndexFileObject", "ZipFileObject");
 
-        // Verify that we hit the jar files we intended, specifically ct.sym as well as rt.jar
-        checkCoverage("jar files", foundJars,
-                "ct.sym", "jar", "jar jar", "rt.jar");
+        // Verify that we hit the jar files we intended
+        checkCoverage("jar files", foundJars, "jar", "jar jar");
     }
 
     // use a new file manager for each test
@@ -201,16 +194,6 @@ public class T6877206 {
         return jar;
     }
 
-    File findRtJar() throws Exception {
-        File java_home = new File(System.getProperty("java.home"));
-        if (java_home.getName().equals("jre"))
-            java_home = java_home.getParentFile();
-        File rt_jar = new File(new File(new File(java_home, "jre"), "lib"), "rt.jar");
-        if (!rt_jar.exists())
-            throw new Exception("can't find rt.jar");
-        return rt_jar;
-    }
-
     byte[] read(InputStream in) throws IOException {
         byte[] data = new byte[1024];
         int offset = 0;
diff --git a/langtools/test/tools/javac/api/TestJavacTaskScanner.java b/langtools/test/tools/javac/api/TestJavacTaskScanner.java
index 39c0979d4ec..2cf4ad71f26 100644
--- a/langtools/test/tools/javac/api/TestJavacTaskScanner.java
+++ b/langtools/test/tools/javac/api/TestJavacTaskScanner.java
@@ -89,7 +89,7 @@ public class TestJavacTaskScanner extends ToolTester {
         System.out.println("#parseTypeElements: " + numParseTypeElements);
         System.out.println("#allMembers: " + numAllMembers);
 
-        check(numTokens, "#Tokens", 1222);
+        check(numTokens, "#Tokens", 1054);
         check(numParseTypeElements, "#parseTypeElements", 158);
         check(numAllMembers, "#allMembers", 52);
     }
@@ -138,30 +138,10 @@ public class TestJavacTaskScanner extends ToolTester {
     public StandardJavaFileManager getLocalFileManager(JavaCompiler tool,
                                                         DiagnosticListener<JavaFileObject> dl,
                                                         Charset encoding) {
-        File javac_classes;
-        try {
-            final String javacMainClass = "com/sun/tools/javac/Main.class";
-            URL url = getClass().getClassLoader().getResource(javacMainClass);
-            if (url == null)
-                throw new Error("can't locate javac classes");
-            URI uri = url.toURI();
-            String scheme = uri.getScheme();
-            String ssp = uri.getSchemeSpecificPart();
-            if (scheme.equals("jar")) {
-                javac_classes = new File(new URI(ssp.substring(0, ssp.indexOf("!/"))));
-            } else if (scheme.equals("file")) {
-                javac_classes = new File(ssp.substring(0, ssp.indexOf(javacMainClass)));
-            } else
-                throw new Error("unknown URL: " + url);
-        } catch (URISyntaxException e) {
-            throw new Error(e);
-        }
-        System.err.println("javac_classes: " + javac_classes);
-
         StandardJavaFileManager fm = tool.getStandardFileManager(dl, null, encoding);
         try {
             fm.setLocation(SOURCE_PATH,  Arrays.asList(test_src));
-            fm.setLocation(CLASS_PATH,   join(test_class_path, Arrays.asList(javac_classes)));
+            fm.setLocation(CLASS_PATH,   test_class_path);
             fm.setLocation(CLASS_OUTPUT, Arrays.asList(test_classes));
         } catch (IOException e) {
             throw new AssertionError(e);
diff --git a/langtools/test/tools/javac/api/TestSearchPaths.java b/langtools/test/tools/javac/api/TestSearchPaths.java
index 3aa39320fa8..cd0a2a4311b 100644
--- a/langtools/test/tools/javac/api/TestSearchPaths.java
+++ b/langtools/test/tools/javac/api/TestSearchPaths.java
@@ -108,6 +108,7 @@ public class TestSearchPaths {
 
     void testClassOutput() throws IOException {
         String test = "testClassOutput";
+        System.err.println("test: " + test);
 
         for (int i = 1; i <= 5; i++) {
             File classes = createDir(test + "/" + i + "/classes");
@@ -133,6 +134,7 @@ public class TestSearchPaths {
 
     void testClassPath() throws IOException {
         String test = "testClassPath";
+        System.err.println("test: " + test);
 
         for (int i = 1; i <= 5; i++) {
             File classes = createDir(test + "/" + i + "/classes");
@@ -159,10 +161,12 @@ public class TestSearchPaths {
         }
 
         tested.add(CLASS_PATH);
+        System.err.println();
     }
 
     void testSourcePath() throws IOException {
         String test = "testSourcePath";
+        System.err.println("test: " + test);
         setLocation(CLASS_PATH); // empty
 
         for (int i = 1; i <= 5; i++) {
@@ -188,10 +192,12 @@ public class TestSearchPaths {
         }
 
         tested.add(SOURCE_PATH);
+        System.err.println();
     }
 
     void testPlatformClassPath() throws IOException {
         String test = "testPlatformClassPath";
+        System.err.println("test: " + test);
 
         List<File> defaultPath = getLocation(PLATFORM_CLASS_PATH);
         StringBuilder sb = new StringBuilder();
@@ -205,7 +211,10 @@ public class TestSearchPaths {
         setLocation(CLASS_PATH); // empty
         setLocation(SOURCE_PATH); // empty
 
-        for (int i = 1; i <= 10; i++) {
+        // FIXME: temporarily exclude cases referring to default bootclasspath
+        // for (int i = 1; i <= 10; i++) {
+        int[] cases = new int[] { 1, 2, 4, 5, 6, 7 };
+        for (int i : cases) {
             File classes = createDir(test + "/" + i + "/classes");
             File testJars = createDir(test + "/" + i + "/testJars");
             File testClasses = createDir(test + "/" + i + "/testClasses");
@@ -302,10 +311,14 @@ public class TestSearchPaths {
         }
 
         tested.add(PLATFORM_CLASS_PATH);
+        System.err.println();
     }
 
     void testAnnotationProcessorPath() throws IOException {
         String test = "testAnnotationProcessorPath";
+        System.err.println("test: " + test);
+
+        fileManager.setLocation(PLATFORM_CLASS_PATH, null);
 
         String template =
                 "import java.util.*;\n"
@@ -348,10 +361,12 @@ public class TestSearchPaths {
         }
 
         tested.add(ANNOTATION_PROCESSOR_PATH);
+        System.err.println();
     }
 
     void testSourceOutput() throws IOException {
         String test = "testAnnotationProcessorPath";
+        System.err.println("test: " + test);
 
         String source =
                 "import java.io.*;\n"
@@ -407,10 +422,12 @@ public class TestSearchPaths {
             checkFile(CLASS_OUTPUT, "G" + i + ".class");
         }
         tested.add(SOURCE_OUTPUT);
+        System.err.println();
     }
 
     void testNativeHeaderOutput() throws IOException {
         String test = "testNativeHeaderOutput";
+        System.err.println("test: " + test);
 
         for (int i = 1; i <= 5; i++) {
             File classes = createDir(test + "/" + i + "/classes");
@@ -433,6 +450,7 @@ public class TestSearchPaths {
         }
 
         tested.add(StandardLocation.NATIVE_HEADER_OUTPUT);
+        System.err.println();
     }
 
     List<String> getOptions(String... args) {
diff --git a/langtools/test/tools/javac/diags/CheckResourceKeys.java b/langtools/test/tools/javac/diags/CheckResourceKeys.java
index f1d439243a1..0ddf0520303 100644
--- a/langtools/test/tools/javac/diags/CheckResourceKeys.java
+++ b/langtools/test/tools/javac/diags/CheckResourceKeys.java
@@ -282,7 +282,8 @@ public class CheckResourceKeys {
             // file names
             "ct.sym",
             "rt.jar",
-            "tools.jar",
+            "jfxrt.jar",
+            "bootmodules.jimage",
             // -XD option names
             "process.packages",
             "ignore.symbol.file",
diff --git a/langtools/test/tools/javac/diags/examples/NotInProfile.java b/langtools/test/tools/javac/diags/examples/NotInProfile.java
index 079d35907ba..e0c1be31140 100644
--- a/langtools/test/tools/javac/diags/examples/NotInProfile.java
+++ b/langtools/test/tools/javac/diags/examples/NotInProfile.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, 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
diff --git a/langtools/test/tools/javac/lib/CompileFail.java b/langtools/test/tools/javac/lib/CompileFail.java
index 328c271ae00..8717abb49c7 100644
--- a/langtools/test/tools/javac/lib/CompileFail.java
+++ b/langtools/test/tools/javac/lib/CompileFail.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -37,7 +37,6 @@ public class CompileFail {
 
         List<String> javacArgs = new ArrayList<>();
         javacArgs.addAll(Arrays.asList(
-            "-bootclasspath", System.getProperty("sun.boot.class.path"),
             "-d", "."
         ));
 
diff --git a/langtools/test/tools/javac/nio/compileTest/CompileTest.java b/langtools/test/tools/javac/nio/compileTest/CompileTest.java
deleted file mode 100644
index e04c97c2664..00000000000
--- a/langtools/test/tools/javac/nio/compileTest/CompileTest.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * 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 6906175 6915476 6915497 7006564
- * @summary Path-based JavaFileManager
- * @compile -g CompileTest.java HelloPathWorld.java
- * @run main CompileTest
- */
-
-import java.io.*;
-import java.nio.file.*;
-import java.util.*;
-import java.util.jar.*;
-import javax.tools.*;
-
-import com.sun.tools.javac.nio.*;
-import com.sun.tools.javac.util.Context;
-import java.nio.file.spi.FileSystemProvider;
-
-
-public class CompileTest {
-    public static void main(String[] args) throws Exception {
-        new CompileTest().run();
-    }
-
-    public void run() throws Exception {
-        File rtDir = new File("rt.dir");
-        File javaHome = new File(System.getProperty("java.home"));
-        if (javaHome.getName().equals("jre"))
-            javaHome = javaHome.getParentFile();
-        File rtJar = new File(new File(new File(javaHome, "jre"), "lib"), "rt.jar");
-        expand(rtJar, rtDir);
-
-        String[] rtDir_opts = {
-            "-bootclasspath", rtDir.toString(),
-            "-classpath", "",
-            "-sourcepath", "",
-            "-extdirs", ""
-        };
-        test(rtDir_opts, "HelloPathWorld");
-
-        if (isJarFileSystemAvailable()) {
-            String[] rtJar_opts = {
-                "-bootclasspath", rtJar.toString(),
-                "-classpath", "",
-                "-sourcepath", "",
-                "-extdirs", ""
-            };
-            test(rtJar_opts, "HelloPathWorld");
-
-            String[] default_opts = { };
-            test(default_opts, "HelloPathWorld");
-
-            // finally, a non-trivial program
-            test(default_opts, "CompileTest");
-        } else
-            System.err.println("jar file system not available: test skipped");
-    }
-
-    void test(String[] opts, String className) throws Exception {
-        count++;
-        System.err.println("Test " + count + " " + Arrays.asList(opts) + " " + className);
-        Path testSrcDir = Paths.get(System.getProperty("test.src"));
-        Path testClassesDir = Paths.get(System.getProperty("test.classes"));
-        Path classes = Files.createDirectory(Paths.get("classes." + count));
-
-        Context ctx = new Context();
-        PathFileManager fm = new JavacPathFileManager(ctx, true, null);
-        JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
-        List<String> options = new ArrayList<String>();
-        options.addAll(Arrays.asList(opts));
-        options.addAll(Arrays.asList(
-                "-verbose", "-XDverboseCompilePolicy",
-                "-d", classes.toString(),
-                "-g"
-        ));
-        Iterable<? extends JavaFileObject> compilationUnits =
-                fm.getJavaFileObjects(testSrcDir.resolve(className + ".java"));
-        StringWriter sw = new StringWriter();
-        PrintWriter out = new PrintWriter(sw);
-        JavaCompiler.CompilationTask t =
-                compiler.getTask(out, fm, null, options, null, compilationUnits);
-        boolean ok = t.call();
-        System.err.println(sw.toString());
-        if (!ok) {
-            throw new Exception("compilation failed");
-        }
-
-        File expect = new File("classes." + count + "/" + className + ".class");
-        if (!expect.exists())
-            throw new Exception("expected file not found: " + expect);
-        // Note that we explicitly specify -g for compiling both the actual class and the expected class.
-        // This isolates the expected class from javac options that might be given to jtreg.
-        long expectedSize = new File(testClassesDir.toString(), className + ".class").length();
-        long actualSize = expect.length();
-        if (expectedSize != actualSize)
-            throw new Exception("wrong size found: " + actualSize + "; expected: " + expectedSize);
-    }
-
-    boolean isJarFileSystemAvailable() {
-        boolean result = false;
-        for (FileSystemProvider fsp: FileSystemProvider.installedProviders()) {
-            String scheme = fsp.getScheme();
-            System.err.println("Provider: " + scheme + " " + fsp);
-            if (scheme.equalsIgnoreCase("jar") || scheme.equalsIgnoreCase("zip"))
-                result = true;
-        }
-        return result;
-    }
-
-    void expand(File jar, File dir) throws IOException {
-        JarFile jarFile = new JarFile(jar);
-        try {
-            Enumeration<JarEntry> entries = jarFile.entries();
-            while (entries.hasMoreElements()) {
-                JarEntry je = entries.nextElement();
-                if (!je.isDirectory()) {
-                    copy(jarFile.getInputStream(je), new File(dir, je.getName()));
-                }
-            }
-        } finally {
-            jarFile.close();
-        }
-    }
-
-    void copy(InputStream in, File dest) throws IOException {
-        dest.getParentFile().mkdirs();
-        OutputStream out = new BufferedOutputStream(new FileOutputStream(dest));
-        try {
-            byte[] data = new byte[8192];
-            int n;
-            while ((n = in.read(data, 0, data.length)) > 0)
-                out.write(data, 0, n);
-        } finally {
-            out.close();
-            in.close();
-        }
-    }
-
-    void error(String message) {
-        System.err.println("Error: " + message);
-        errors++;
-    }
-
-    int errors;
-    int count;
-}
diff --git a/langtools/test/tools/javac/nio/compileTest/HelloPathWorld.java b/langtools/test/tools/javac/nio/compileTest/HelloPathWorld.java
deleted file mode 100644
index 8e186d4bf45..00000000000
--- a/langtools/test/tools/javac/nio/compileTest/HelloPathWorld.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-class HelloPathWorld {
-    public static void main(String... args) {
-        System.out.println("Hello World!");
-    }
-}
diff --git a/langtools/test/tools/javac/processing/model/testgetallmembers/Main.java b/langtools/test/tools/javac/processing/model/testgetallmembers/Main.java
index 9629923e9f5..1525294959b 100644
--- a/langtools/test/tools/javac/processing/model/testgetallmembers/Main.java
+++ b/langtools/test/tools/javac/processing/model/testgetallmembers/Main.java
@@ -59,10 +59,6 @@ public class Main {
     static Elements elements;
 
     public static void main(String[] args) throws Exception {
-        if (haveAltRt()) {
-            System.out.println("Warning: alt-rt.jar detected, test skipped");
-            return;
-        }
         JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
         try (StandardJavaFileManager fm = tool.getStandardFileManager(null, null, null)) {
             fm.setLocation(CLASS_PATH, Collections.<File>emptyList());
@@ -126,23 +122,4 @@ public class Main {
                 throw new AssertionError("Too few nested classes in PLATFORM_CLASS_PATH ;-)");
         }
     }
-    /*
-     * If -XX:+AggressiveOpts has been used to test, the option currently
-     * instructs the VM to prepend alt-rt.jar onto the bootclasspath. This
-     * overrides the default TreeMap implemation in rt.jar causing symbol
-     * resolution problems (caused by inconsistent inner class), although
-     * alt-rt.jar is being eliminated, we have this sanity check to detect this
-     * case and skip the test.
-     */
-    static boolean haveAltRt() {
-        String bootClassPath = System.getProperty("sun.boot.class.path");
-        for (String cp : bootClassPath.split(File.pathSeparator)) {
-            if (cp.endsWith("alt-rt.jar")) {
-                System.err.println("Warning: detected alt-rt.jar in "
-                        + "sun.boot.class.path");
-                return true;
-            }
-        }
-        return false;
-    }
 }
diff --git a/langtools/test/tools/javac/processing/options/testPrintProcessorInfo/TestWithXstdout.java b/langtools/test/tools/javac/processing/options/testPrintProcessorInfo/TestWithXstdout.java
index e9e60d4a237..60c199dcd77 100644
--- a/langtools/test/tools/javac/processing/options/testPrintProcessorInfo/TestWithXstdout.java
+++ b/langtools/test/tools/javac/processing/options/testPrintProcessorInfo/TestWithXstdout.java
@@ -56,8 +56,6 @@ public class TestWithXstdout {
 
     static void run_javac(String... args) throws IOException, InterruptedException {
         File javaHome = new File(System.getProperty("java.home"));
-        if (javaHome.getName().equals("jre"))
-            javaHome = javaHome.getParentFile();
         File javac = new File(new File(javaHome, "bin"), "javac");
 
         List<String> opts = new ArrayList<>();
diff --git a/langtools/test/tools/javac/profiles/ProfileOptionTest.java b/langtools/test/tools/javac/profiles/ProfileOptionTest.java
index ab3cdc18128..0f4f4edd7d2 100644
--- a/langtools/test/tools/javac/profiles/ProfileOptionTest.java
+++ b/langtools/test/tools/javac/profiles/ProfileOptionTest.java
@@ -105,14 +105,18 @@ public class ProfileOptionTest {
         JavaFileObject fo = new StringJavaFileObject("Test.java", "class Test { }");
         for (Target t: Target.values()) {
             switch (t) {
-                case JDK1_1: case JDK1_2: // no equivalent -source
+                case JDK1_1:
+                case JDK1_2:
+                case JDK1_3:
+                case JDK1_4:
+                case JDK1_5: // not supported
                     continue;
             }
 
             for (Profile p: Profile.values()) {
                 List<String> opts = new ArrayList<>();
                 opts.addAll(Arrays.asList("-source", t.name, "-target", t.name));
-                opts.add("-Xlint:-options"); // dont warn about no -bootclasspath
+                opts.add("-Xlint:-options"); // don't warn about no -bootclasspath
                 if (p != Profile.DEFAULT)
                     opts.addAll(Arrays.asList("-profile", p.name));
 
diff --git a/langtools/test/tools/javadoc/6942366/T6942366.java b/langtools/test/tools/javadoc/6942366/T6942366.java
index c5199981e66..6246ef372a1 100644
--- a/langtools/test/tools/javadoc/6942366/T6942366.java
+++ b/langtools/test/tools/javadoc/6942366/T6942366.java
@@ -76,14 +76,6 @@ public class T6942366 {
             args.add(".");
         }
 
-        // use a very simple bootclasspath to avoid stuff jtreg might have put on path
-        File javaHome = new File(System.getProperty("java.home"));
-        File rt_jar = new File(javaHome, "lib/rt.jar");
-        if (!rt_jar.exists())
-            throw new Exception("rt.jar not found");
-        args.add("-bootclasspath");
-        args.add(rt_jar.getPath());
-
         args.add(new File(testSrc, "Test.java").getPath());
         System.out.println("javadoc: " + args);
 
diff --git a/langtools/test/tools/javadoc/6964914/TestUserDoclet.java b/langtools/test/tools/javadoc/6964914/TestUserDoclet.java
index 00de80db818..3a5e94e5958 100644
--- a/langtools/test/tools/javadoc/6964914/TestUserDoclet.java
+++ b/langtools/test/tools/javadoc/6964914/TestUserDoclet.java
@@ -47,8 +47,6 @@ public class TestUserDoclet extends Doclet {
     /** Main test method. */
     void run() throws Exception {
         File javaHome = new File(System.getProperty("java.home"));
-        if (javaHome.getName().equals("jre"))
-            javaHome = javaHome.getParentFile();
         File javadoc = new File(new File(javaHome, "bin"), "javadoc");
         File testSrc = new File(System.getProperty("test.src"));
         File testClasses = new File(System.getProperty("test.classes"));
diff --git a/langtools/test/tools/javadoc/api/basic/GetTask_FileManagerTest.java b/langtools/test/tools/javadoc/api/basic/GetTask_FileManagerTest.java
index d5ab604f6ac..d5b34bd15a6 100644
--- a/langtools/test/tools/javadoc/api/basic/GetTask_FileManagerTest.java
+++ b/langtools/test/tools/javadoc/api/basic/GetTask_FileManagerTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2014, 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
@@ -29,6 +29,7 @@
  * @run main GetTask_FileManagerTest
  */
 
+import java.io.File;
 import java.io.IOException;
 import java.nio.file.Path;
 import java.util.Arrays;
@@ -36,10 +37,14 @@ import java.util.Set;
 
 import javax.tools.DocumentationTool;
 import javax.tools.DocumentationTool.DocumentationTask;
+import javax.tools.FileObject;
+import javax.tools.ForwardingJavaFileManager;
 import javax.tools.JavaFileObject;
 import javax.tools.JavaFileObject.Kind;
+import javax.tools.StandardJavaFileManager;
 import javax.tools.ToolProvider;
 
+import com.sun.tools.javac.file.JavacFileManager;
 import com.sun.tools.javac.nio.JavacPathFileManager;
 import com.sun.tools.javac.nio.PathFileManager;
 import com.sun.tools.javac.util.Context;
@@ -60,11 +65,11 @@ public class GetTask_FileManagerTest extends APITest {
     public void testFileManager() throws Exception {
         JavaFileObject srcFile = createSimpleJavaFileObject();
         DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
-        PathFileManager fm = new JavacPathFileManager(new Context(), false, null);
-        Path outDir = getOutDir().toPath();
+        StandardJavaFileManager fm = new TestFileManager();
+        File outDir = getOutDir();
         fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
         Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
-        DocumentationTask t = tool.getTask(null, fm, null, null, null, files);
+        DocumentationTask t = tool.getTask(null, fm, null, null, Arrays.asList("-verbose"), files);
         if (t.call()) {
             System.err.println("task succeeded");
             checkFiles(outDir, standardExpectFiles);
@@ -80,7 +85,7 @@ public class GetTask_FileManagerTest extends APITest {
     public void testBadFileManager() throws Exception {
         JavaFileObject srcFile = createSimpleJavaFileObject();
         DocumentationTool tool = ToolProvider.getSystemDocumentationTool();
-        PathFileManager fm = new JavacPathFileManager(new Context(), false, null) {
+        StandardJavaFileManager fm = new TestFileManager() {
             @Override
             public Iterable<JavaFileObject> list(Location location,
                     String packageName,
@@ -90,8 +95,7 @@ public class GetTask_FileManagerTest extends APITest {
                 throw new UnexpectedError();
             }
         };
-        Path outDir = getOutDir().toPath();
-        fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(outDir));
+        fm.setLocation(DocumentationTool.Location.DOCUMENTATION_OUTPUT, Arrays.asList(getOutDir()));
         Iterable<? extends JavaFileObject> files = Arrays.asList(srcFile);
         DocumentationTask t = tool.getTask(null, fm, null, null, null, files);
         try {
@@ -108,4 +112,45 @@ public class GetTask_FileManagerTest extends APITest {
 
     public static class UnexpectedError extends Error { }
 
+    /*
+     * A JavaFileManager which is not a JavacFileManager, even though it uses one internally for
+     * convenience.
+     */
+    static class TestFileManager extends ForwardingJavaFileManager<StandardJavaFileManager>
+            implements StandardJavaFileManager  {
+        TestFileManager() {
+            super(new JavacFileManager(new Context(), false, null));
+        }
+
+        @Override
+        public Iterable<? extends JavaFileObject> getJavaFileObjectsFromFiles(Iterable<? extends File> files) {
+            return fileManager.getJavaFileObjectsFromFiles(files);
+        }
+
+        @Override
+        public Iterable<? extends JavaFileObject> getJavaFileObjects(File... files) {
+            return fileManager.getJavaFileObjects(files);
+        }
+
+        @Override
+        public Iterable<? extends JavaFileObject> getJavaFileObjectsFromStrings(Iterable<String> names) {
+            return fileManager.getJavaFileObjectsFromStrings(names);
+        }
+
+        @Override
+        public Iterable<? extends JavaFileObject> getJavaFileObjects(String... names) {
+            return fileManager.getJavaFileObjects(names);
+        }
+
+        @Override
+        public void setLocation(Location location, Iterable<? extends File> path) throws IOException {
+            fileManager.setLocation(location, path);
+        }
+
+        @Override
+        public Iterable<? extends File> getLocation(Location location) {
+            return fileManager.getLocation(location);
+        }
+
+    }
 }
diff --git a/langtools/test/tools/javah/T5070898.java b/langtools/test/tools/javah/T5070898.java
index 669960b3c27..12bea9cfdf5 100644
--- a/langtools/test/tools/javah/T5070898.java
+++ b/langtools/test/tools/javah/T5070898.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2014, 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
@@ -73,14 +73,8 @@ public class T5070898
     int runJavah() throws Exception {
         List<String> cmd = new ArrayList<String>();
         File java_home = new File(System.getProperty("java.home"));
-        if (java_home.getName().equals("jre"))
-            java_home = java_home.getParentFile();
         cmd.add(new File(new File(java_home, "bin"), "javah").getPath());
 
-        // ensure we run with the same bootclasspath as this test,
-        // in case this test is being run with -Xbootclasspath
-        cmd.add("-J-Xbootclasspath:" + System.getProperty("sun.boot.class.path"));
-
         cmd.add("JavahTest");
 
         ProcessBuilder pb = new ProcessBuilder(cmd);
diff --git a/langtools/test/tools/javah/T6893943.java b/langtools/test/tools/javah/T6893943.java
index a63858f69eb..bf2944fb877 100644
--- a/langtools/test/tools/javah/T6893943.java
+++ b/langtools/test/tools/javah/T6893943.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, 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
@@ -58,12 +58,8 @@ public class T6893943 {
     void testCommand(String[] args, int expect_rc) throws Exception {
         System.err.println("Test command: " + Arrays.asList(args));
         File javaHome = new File(System.getProperty("java.home"));
-        if (javaHome.getName().equals("jre"))
-            javaHome = javaHome.getParentFile();
-
         List<String> command = new ArrayList<String>();
         command.add(new File(new File(javaHome, "bin"), "javah").getPath());
-        command.add("-J-Xbootclasspath:" + System.getProperty("sun.boot.class.path"));
         command.addAll(Arrays.asList(args));
         //System.err.println("command: " + command);
 
diff --git a/langtools/test/tools/javah/compareTest/CompareTest.java b/langtools/test/tools/javah/compareTest/CompareTest.java
deleted file mode 100644
index 9d1884e8ad7..00000000000
--- a/langtools/test/tools/javah/compareTest/CompareTest.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.DataInputStream;
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Set;
-import java.util.TreeSet;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-import com.sun.tools.classfile.AccessFlags;
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.Method;
-import java.io.BufferedReader;
-import java.io.FileInputStream;
-import java.io.InputStreamReader;
-import java.util.LinkedHashSet;
-
-public class CompareTest {
-    String[][] testCases = {
-        { },
-        { "-jni" },
-//        { "-llni" },
-    };
-
-    public static void main(String... args) throws Exception {
-        new CompareTest().run(args);
-    }
-
-    public void run(String... args) throws Exception {
-        old_javah_cmd = new File(args[0]);
-        rt_jar = new File(args[1]);
-
-        Set<String> testClasses;
-        if (args.length > 2) {
-            testClasses = new LinkedHashSet<String>(Arrays.asList(Arrays.copyOfRange(args, 2, args.length)));
-        } else
-            testClasses = getNativeClasses(new JarFile(rt_jar));
-
-        for (String[] options: testCases) {
-            for (String name: testClasses) {
-                test(Arrays.asList(options), rt_jar, name);
-            }
-        }
-
-        if (errors == 0)
-            System.out.println(count + " tests passed");
-        else
-            throw new Exception(errors + "/" + count + " tests failed");
-    }
-
-    public void test(List<String> options, File bootclasspath, String className)
-            throws IOException, InterruptedException {
-        System.err.println("test: " + options + " " + className);
-        count++;
-
-        testOptions = options;
-        testClassName = className;
-
-        File oldOutDir = initDir(file(new File("old"), className));
-        int old_rc = old_javah(options, oldOutDir, bootclasspath, className);
-
-        File newOutDir = initDir(file(new File("new"), className));
-        int new_rc = new_javah(options, newOutDir, bootclasspath, className);
-
-        if (old_rc != new_rc)
-            error("return codes differ; old: " + old_rc + ", new: " + new_rc);
-
-        compare(oldOutDir, newOutDir);
-    }
-
-    int old_javah(List<String> options, File outDir, File bootclasspath, String className)
-            throws IOException, InterruptedException {
-        List<String> cmd = new ArrayList<String>();
-        cmd.add(old_javah_cmd.getPath());
-        cmd.addAll(options);
-        cmd.add("-d");
-        cmd.add(outDir.getPath());
-        cmd.add("-bootclasspath");
-        cmd.add(bootclasspath.getPath());
-        cmd.add(className);
-        System.err.println("old_javah: " + cmd);
-        ProcessBuilder pb = new ProcessBuilder(cmd);
-        pb.redirectErrorStream(true);
-        Process p = pb.start();
-        BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()));
-        String line;
-        StringBuilder sb = new StringBuilder();
-        while ((line = in.readLine()) != null) {
-            sb.append(line);
-            sb.append("\n");
-        }
-        System.err.println("old javah out: " + sb.toString());
-        return p.waitFor();
-    }
-
-    int new_javah(List<String> options, File outDir, File bootclasspath, String className) {
-        List<String> args = new ArrayList<String>();
-        args.addAll(options);
-        args.add("-d");
-        args.add(outDir.getPath());
-        args.add("-bootclasspath");
-        args.add(bootclasspath.getPath());
-        args.add(className);
-        StringWriter sw = new StringWriter();
-        PrintWriter pw = new PrintWriter(sw);
-        int rc = com.sun.tools.javah.Main.run(args.toArray(new String[args.size()]), pw);
-        pw.close();
-        System.err.println("new javah out: " + sw.toString());
-        return rc;
-    }
-
-    Set<String> getNativeClasses(JarFile jar) throws IOException, ConstantPoolException {
-        System.err.println("getNativeClasses: " + jar.getName());
-        Set<String> results = new TreeSet<String>();
-        Enumeration<JarEntry> e = jar.entries();
-        while (e.hasMoreElements()) {
-            JarEntry je = e.nextElement();
-            if (isNativeClass(jar, je)) {
-                String name = je.getName();
-                results.add(name.substring(0, name.length() - 6).replace("/", "."));
-            }
-        }
-        return results;
-    }
-
-    boolean isNativeClass(JarFile jar, JarEntry entry) throws IOException, ConstantPoolException {
-        String name = entry.getName();
-        if (name.startsWith("META-INF") || !name.endsWith(".class"))
-            return false;
-        //String className = name.substring(0, name.length() - 6).replace("/", ".");
-        //System.err.println("check " + className);
-        InputStream in = jar.getInputStream(entry);
-        ClassFile cf = ClassFile.read(in);
-        for (int i = 0; i < cf.methods.length; i++) {
-            Method m = cf.methods[i];
-            if (m.access_flags.is(AccessFlags.ACC_NATIVE)) {
-                // System.err.println(className);
-                return true;
-            }
-        }
-        return false;
-    }
-
-    void compare(File f1, File f2) throws IOException {
-        if (f1.isFile() && f2.isFile())
-            compareFiles(f1, f2);
-        else if (f1.isDirectory() && f2.isDirectory())
-            compareDirectories(f1, f2);
-        else
-            error("files differ: "
-                + f1 + " (" + getFileType(f1) + "), "
-                + f2 + " (" + getFileType(f2) + ")");
-    }
-
-    void compareDirectories(File d1, File d2) throws IOException {
-        Set<String> list = new TreeSet<String>();
-        list.addAll(Arrays.asList(d1.list()));
-        list.addAll(Arrays.asList(d2.list()));
-        for (String c: list)
-            compare(new File(d1, c), new File(d2, c));
-    }
-
-    void compareFiles(File f1, File f2) throws IOException {
-        byte[] c1 = readFile(f1);
-        byte[] c2 = readFile(f2);
-        if (!Arrays.equals(c1, c2))
-            error("files differ: " + f1 + ", " + f2);
-    }
-
-    byte[] readFile(File file) throws IOException {
-        int size = (int) file.length();
-        byte[] data = new byte[size];
-        DataInputStream in = new DataInputStream(new FileInputStream(file));
-        try {
-            in.readFully(data);
-        } finally {
-            in.close();
-        }
-        return data;
-    }
-
-    String getFileType(File f) {
-        return f.isDirectory() ? "directory"
-                : f.isFile() ? "file"
-                : f.exists() ? "other"
-                : "not found";
-    }
-
-    /**
-     * Set up an empty directory.
-     */
-    public File initDir(File dir) {
-        if (dir.exists())
-            deleteAll(dir);
-        dir.mkdirs();
-        return dir;
-    }
-
-    /**
-     * Delete a file or a directory (including all its contents).
-     */
-    boolean deleteAll(File file) {
-        if (file.isDirectory()) {
-            for (File f: file.listFiles())
-                deleteAll(f);
-        }
-        return file.delete();
-    }
-
-    File file(File dir, String... path) {
-        File f = dir;
-        for (String p: path)
-            f = new File(f, p);
-        return f;
-    }
-
-    /**
-     * Report an error.
-     */
-    void error(String msg, String... more) {
-        System.err.println("test: " + testOptions + " " + testClassName);
-        System.err.println("error: " + msg);
-        for (String s: more)
-            System.err.println(s);
-        errors++;
-        System.exit(1);
-    }
-
-    File old_javah_cmd;
-    File rt_jar;
-    List<String> testOptions;
-    String testClassName;
-    int count;
-    int errors;
-}
diff --git a/langtools/test/tools/javah/compareTest/FindNativeFiles.java b/langtools/test/tools/javah/compareTest/FindNativeFiles.java
deleted file mode 100644
index 92002d06421..00000000000
--- a/langtools/test/tools/javah/compareTest/FindNativeFiles.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Enumeration;
-import java.util.jar.JarEntry;
-import java.util.jar.JarFile;
-
-import com.sun.tools.classfile.AccessFlags;
-import com.sun.tools.classfile.ClassFile;
-import com.sun.tools.classfile.ConstantPoolException;
-import com.sun.tools.classfile.Method;
-import java.util.Comparator;
-import java.util.Set;
-import java.util.TreeSet;
-
-public class FindNativeFiles {
-    public static void main(String[] args) throws IOException, ConstantPoolException {
-        new FindNativeFiles().run(args);
-    }
-
-    public void run(String[] args) throws IOException, ConstantPoolException {
-        JarFile jar = new JarFile(args[0]);
-        Set<JarEntry> entries = getNativeClasses(jar);
-        for (JarEntry e: entries) {
-            String name = e.getName();
-            String className = name.substring(0, name.length() - 6).replace("/", ".");
-            System.out.println(className);
-        }
-    }
-
-    Set<JarEntry> getNativeClasses(JarFile jar) throws IOException, ConstantPoolException {
-        Set<JarEntry> results = new TreeSet<JarEntry>(new Comparator<JarEntry>() {
-            public int compare(JarEntry o1, JarEntry o2) {
-                return o1.getName().compareTo(o2.getName());
-            }
-        });
-        Enumeration<JarEntry> e = jar.entries();
-        while (e.hasMoreElements()) {
-            JarEntry je = e.nextElement();
-            if (isNativeClass(jar, je))
-                results.add(je);
-        }
-        return results;
-    }
-
-    boolean isNativeClass(JarFile jar, JarEntry entry) throws IOException, ConstantPoolException {
-        String name = entry.getName();
-        if (name.startsWith("META-INF") || !name.endsWith(".class"))
-            return false;
-        //String className = name.substring(0, name.length() - 6).replace("/", ".");
-        //System.err.println("check " + className);
-        InputStream in = jar.getInputStream(entry);
-        ClassFile cf = ClassFile.read(in);
-        in.close();
-        for (int i = 0; i < cf.methods.length; i++) {
-            Method m = cf.methods[i];
-            if (m.access_flags.is(AccessFlags.ACC_NATIVE)) {
-                // System.err.println(className);
-                return true;
-            }
-        }
-        return false;
-    }
-}
diff --git a/langtools/test/tools/javah/compareTest/README b/langtools/test/tools/javah/compareTest/README
deleted file mode 100644
index e0f19c55537..00000000000
--- a/langtools/test/tools/javah/compareTest/README
+++ /dev/null
@@ -1,16 +0,0 @@
-test/tools/javah/compareTest/README
-
-This directory contains a program for comparing the output of new javah against the
-output of JDK 6 or other older versions of javah.
-
-It cannot be run automatically because of the need for the older version of javah
-to compare against.
-
-The test works by scanning a jar file, such as rt.jar, looking for all files with
-native methods.  It then runs both the old and new versions of javah on those
-classes with native methods, and verifies that the results are character-for-character
-identical.
-
-To run the test, build langtools, then execute the script in the root langtools 
-directory, providing the location of the JDK to be tested. The default is
-/opt/jdk/1.6.0.
diff --git a/langtools/test/tools/javap/T6729471.java b/langtools/test/tools/javap/T6729471.java
index 5fdb368885b..d7384b25865 100644
--- a/langtools/test/tools/javap/T6729471.java
+++ b/langtools/test/tools/javap/T6729471.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2009, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,19 +26,23 @@
  * @test
  * @bug 6729471
  * @summary javap does not output inner interfaces of an interface
+ * @library /tools/lib
+ * @build ToolBox
+ * @run main T6729471
  */
 
 import java.io.*;
 import java.net.*;
 import java.util.*;
+import javax.tools.*;
 
 public class T6729471
 {
-    public static void main(String... args) {
+    public static void main(String... args) throws IOException {
         new T6729471().run();
     }
 
-    void run() {
+    void run() throws IOException {
         File testClasses = new File(System.getProperty("test.classes"));
 
         // simple class
@@ -57,34 +61,31 @@ public class T6729471
         verify(new File(testClasses, "T6729471.class").toURI().toString(),
                 "public static void main(java.lang.String...)");
 
-        // jar url: rt.jar
-        File java_home = new File(System.getProperty("java.home"));
-        if (java_home.getName().equals("jre"))
-            java_home = java_home.getParentFile();
-        File rt_jar = new File(new File(new File(java_home, "jre"), "lib"), "rt.jar");
+        // jar url
+        File testJar = createJar("test.jar", "java.util.*");
         try {
-            verify("jar:" + rt_jar.toURL() + "!/java/util/Map.class",
+            verify("jar:" + testJar.toURL() + "!/java/util/Map.class",
                 "public abstract boolean containsKey(java.lang.Object)");
         } catch (MalformedURLException e) {
             error(e.toString());
         }
 
-        // jar url: ct.sym, if it exists
-        File ct_sym = new File(new File(java_home, "lib"), "ct.sym");
-        if (ct_sym.exists()) {
-            try {
-                verify("jar:" + ct_sym.toURL() + "!/META-INF/sym/rt.jar/java/util/Map.class",
-                    "public abstract boolean containsKey(java.lang.Object)");
-            } catch (MalformedURLException e) {
-                error(e.toString());
-            }
-        } else
-            System.err.println("warning: ct.sym not found");
-
         if (errors > 0)
             throw new Error(errors + " found.");
     }
 
+    File createJar(String name, String... paths) throws IOException {
+        JavaCompiler comp = ToolProvider.getSystemJavaCompiler();
+        try (JavaFileManager fm = comp.getStandardFileManager(null, null, null)) {
+            File f = new File(name);
+            ToolBox tb = new ToolBox();
+            tb.new JarTask(f.getPath())
+                .files(fm, StandardLocation.PLATFORM_CLASS_PATH, paths)
+                .run();
+            return f;
+        }
+    }
+
     void verify(String className, String... expects) {
         String output = javap(className);
         for (String expect: expects) {
diff --git a/langtools/test/tools/javap/WhitespaceTest.java b/langtools/test/tools/javap/WhitespaceTest.java
index 3c9933a33e2..b52da9b9019 100644
--- a/langtools/test/tools/javap/WhitespaceTest.java
+++ b/langtools/test/tools/javap/WhitespaceTest.java
@@ -57,8 +57,11 @@ public class WhitespaceTest {
             if (line.endsWith(" "))
                 error("line has trailing whitespace: " + line);
             int comment = line.indexOf(doubleSlash);
-            if (comment > 0 && line.charAt(comment - 1) != ' ')
-                error("no space before comment: " + line);
+            if (comment > 0 && line.charAt(comment - 1) != ' ') {
+                // make allowance for URLs
+                if (!line.matches(".*\\bfile:/{3}.*"))
+                    error("no space before comment: " + line);
+            }
             if (line.matches(" +}"))
                 error("bad indentation: " + line);
         }
diff --git a/langtools/test/tools/jdeps/APIDeps.java b/langtools/test/tools/jdeps/APIDeps.java
index c3d2c9977f7..528f3d800eb 100644
--- a/langtools/test/tools/jdeps/APIDeps.java
+++ b/langtools/test/tools/jdeps/APIDeps.java
@@ -39,27 +39,6 @@ import java.util.*;
 import java.util.regex.*;
 
 public class APIDeps {
-    private static boolean symbolFileExist = initProfiles();
-    private static boolean initProfiles() {
-        // check if ct.sym exists; if not use the profiles.properties file
-        Path home = Paths.get(System.getProperty("java.home"));
-        if (home.endsWith("jre")) {
-            home = home.getParent();
-        }
-        Path ctsym = home.resolve("lib").resolve("ct.sym");
-        boolean symbolExists = ctsym.toFile().exists();
-        if (!symbolExists) {
-            Path testSrcProfiles =
-                Paths.get(System.getProperty("test.src", "."), "profiles.properties");
-            if (!testSrcProfiles.toFile().exists())
-                throw new Error(testSrcProfiles + " does not exist");
-            System.out.format("%s doesn't exist.%nUse %s to initialize profiles info%n",
-                ctsym, testSrcProfiles);
-            System.setProperty("jdeps.profiles", testSrcProfiles.toString());
-        }
-        return symbolExists;
-    }
-
     public static void main(String... args) throws Exception {
         int errors = 0;
         errors += new APIDeps().run();
diff --git a/langtools/test/tools/jdeps/Basic.java b/langtools/test/tools/jdeps/Basic.java
index 046a047fcc6..a1bfdd4ea31 100644
--- a/langtools/test/tools/jdeps/Basic.java
+++ b/langtools/test/tools/jdeps/Basic.java
@@ -41,27 +41,6 @@ import java.util.regex.*;
 import static java.nio.file.StandardCopyOption.*;
 
 public class Basic {
-    private static boolean symbolFileExist = initProfiles();
-    private static boolean initProfiles() {
-        // check if ct.sym exists; if not use the profiles.properties file
-        Path home = Paths.get(System.getProperty("java.home"));
-        if (home.endsWith("jre")) {
-            home = home.getParent();
-        }
-        Path ctsym = home.resolve("lib").resolve("ct.sym");
-        boolean symbolExists = ctsym.toFile().exists();
-        if (!symbolExists) {
-            Path testSrcProfiles =
-                Paths.get(System.getProperty("test.src", "."), "profiles.properties");
-            if (!testSrcProfiles.toFile().exists())
-                throw new Error(testSrcProfiles + " does not exist");
-            System.out.format("%s doesn't exist.%nUse %s to initialize profiles info%n",
-                ctsym, testSrcProfiles);
-            System.setProperty("jdeps.profiles", testSrcProfiles.toString());
-        }
-        return symbolExists;
-    }
-
     public static void main(String... args) throws Exception {
         int errors = 0;
         errors += new Basic().run();
diff --git a/langtools/test/tools/jdeps/DotFileTest.java b/langtools/test/tools/jdeps/DotFileTest.java
index 46fe5003ec0..cdcc666d8e5 100644
--- a/langtools/test/tools/jdeps/DotFileTest.java
+++ b/langtools/test/tools/jdeps/DotFileTest.java
@@ -41,27 +41,6 @@ import java.util.*;
 import java.util.regex.*;
 
 public class DotFileTest {
-    private static boolean symbolFileExist = initProfiles();
-    private static boolean initProfiles() {
-        // check if ct.sym exists; if not use the profiles.properties file
-        Path home = Paths.get(System.getProperty("java.home"));
-        if (home.endsWith("jre")) {
-            home = home.getParent();
-        }
-        Path ctsym = home.resolve("lib").resolve("ct.sym");
-        boolean symbolExists = ctsym.toFile().exists();
-        if (!symbolExists) {
-            Path testSrcProfiles =
-                Paths.get(System.getProperty("test.src", "."), "profiles.properties");
-            if (!testSrcProfiles.toFile().exists())
-                throw new Error(testSrcProfiles + " does not exist");
-            System.out.format("%s doesn't exist.%nUse %s to initialize profiles info%n",
-                ctsym, testSrcProfiles);
-            System.setProperty("jdeps.profiles", testSrcProfiles.toString());
-        }
-        return symbolExists;
-    }
-
     public static void main(String... args) throws Exception {
         int errors = 0;
         errors += new DotFileTest().run();
diff --git a/langtools/test/tools/jdeps/profiles.properties b/langtools/test/tools/jdeps/profiles.properties
deleted file mode 100644
index f00bb4a5e39..00000000000
--- a/langtools/test/tools/jdeps/profiles.properties
+++ /dev/null
@@ -1,263 +0,0 @@
-# This properties file is used for testing a JDK development build.
-# No need to keep this properties file up to date as long as it covers
-# the APIs used by the jdeps regression test.
-profile.1.name = compact1
-profile.1.packages = \
-    java.io \
-    java.lang \
-    java.lang.annotation \
-    java.lang.invoke \
-    java.lang.ref \
-    java.lang.reflect \
-    java.math \
-    java.net \
-    java.nio \
-    java.nio.channels \
-    java.nio.channels.spi \
-    java.nio.charset \
-    java.nio.charset.spi \
-    java.nio.file \
-    java.nio.file.attribute \
-    java.nio.file.spi \
-    java.security \
-    java.security.cert \
-    java.security.interfaces \
-    java.security.spec \
-    java.text \
-    java.text.spi \
-    java.util \
-    java.util.concurrent \
-    java.util.concurrent.atomic \
-    java.util.concurrent.locks \
-    java.util.jar \
-    java.util.logging \
-    java.util.regex \
-    java.util.spi \
-    java.util.zip \
-    javax.crypto \
-    javax.crypto.interfaces \
-    javax.crypto.spec \
-    javax.security.auth \
-    javax.security.auth.callback \
-    javax.security.auth.login \
-    javax.security.auth.spi \
-    javax.security.auth.x500 \
-    javax.net \
-    javax.net.ssl \
-    javax.security.cert \
-    \
-    com.sun.net.ssl \
-    com.sun.nio.file \
-    com.sun.nio.sctp \
-    com.sun.security.auth \
-    com.sun.security.auth.login
-
-profile.2.name = compact2
-profile.2.packages = \
-    java.sql \
-    javax.sql \
-    javax.xml \
-    javax.xml.datatype \
-    javax.xml.namespace \
-    javax.xml.parsers \
-    javax.xml.stream \
-    javax.xml.stream.events \
-    javax.xml.stream.util \
-    javax.xml.transform \
-    javax.xml.transform.dom \
-    javax.xml.transform.sax \
-    javax.xml.transform.stax \
-    javax.xml.transform.stream \
-    javax.xml.validation \
-    javax.xml.xpath \
-    org.w3c.dom \
-    org.w3c.dom.bootstrap \
-    org.w3c.dom.events \
-    org.w3c.dom.ls \
-    org.xml.sax \
-    org.xml.sax.ext \
-    org.xml.sax.helpers \
-    java.rmi \
-    java.rmi.activation \
-    java.rmi.dgc \
-    java.rmi.registry \
-    java.rmi.server \
-    javax.rmi.ssl \
-    javax.transaction \
-    javax.transaction.xa \
-    \
-    com.sun.net.httpserver \
-    com.sun.net.httpserver.spi
-
-profile.3.name = compact3
-profile.3.packages = \
-    java.lang.instrument \
-    java.lang.management \
-    java.security.acl \
-    java.util.prefs \
-    javax.management \
-    javax.management.loading \
-    javax.management.modelmbean \
-    javax.management.monitor \
-    javax.management.openmbean \
-    javax.management.relation \
-    javax.management.remote \
-    javax.management.remote.rmi \
-    javax.management.timer \
-    javax.naming \
-    javax.naming.directory \
-    javax.naming.event \
-    javax.naming.ldap \
-    javax.naming.spi \
-    javax.sql.rowset \
-    javax.sql.rowset.serial \
-    javax.sql.rowset.spi \
-    javax.security.auth.kerberos \
-    javax.security.sasl \
-    javax.script \
-    javax.smartcardio \
-    javax.xml.crypto \
-    javax.xml.crypto.dom \
-    javax.xml.crypto.dsig \
-    javax.xml.crypto.dsig.dom \
-    javax.xml.crypto.dsig.keyinfo \
-    javax.xml.crypto.dsig.spec \
-    javax.annotation.processing \
-    javax.lang.model \
-    javax.lang.model.element \
-    javax.lang.model.type \
-    javax.lang.model.util \
-    javax.tools \
-    javax.tools.annotation \
-    org.ietf.jgss \
-    \
-    com.sun.management \
-    com.sun.security.auth.callback \
-    com.sun.security.auth.module \
-    com.sun.security.jgss
-
-profile.4.name = Full JRE
-profile.4.packages = \
-    java.applet \
-    java.awt \
-    java.awt.color \
-    java.awt.datatransfer \
-    java.awt.dnd \
-    java.awt.dnd.peer \
-    java.awt.event \
-    java.awt.font \
-    java.awt.geom \
-    java.awt.im \
-    java.awt.im.spi \
-    java.awt.image \
-    java.awt.image.renderable \
-    java.awt.peer \
-    java.awt.print \
-    java.beans \
-    java.beans.beancontext \
-    javax.accessibility \
-    javax.imageio \
-    javax.imageio.event \
-    javax.imageio.metadata \
-    javax.imageio.plugins.bmp \
-    javax.imageio.plugins.jpeg \
-    javax.imageio.spi \
-    javax.imageio.stream \
-    javax.print \
-    javax.print.attribute \
-    javax.print.attribute.standard \
-    javax.print.event \
-    javax.sound.midi \
-    javax.sound.midi.spi \
-    javax.sound.sampled \
-    javax.sound.sampled.spi \
-    javax.swing \
-    javax.swing.border \
-    javax.swing.colorchooser \
-    javax.swing.event \
-    javax.swing.filechooser \
-    javax.swing.plaf \
-    javax.swing.plaf.basic \
-    javax.swing.plaf.metal \
-    javax.swing.plaf.multi \
-    javax.swing.plaf.nimbus \
-    javax.swing.plaf.synth \
-    javax.swing.table \
-    javax.swing.text \
-    javax.swing.text.html \
-    javax.swing.text.html.parser \
-    javax.swing.text.rtf \
-    javax.swing.tree \
-    javax.swing.undo \
-    javax.activation \
-    javax.jws \
-    javax.jws.soap \
-    javax.rmi \
-    javax.rmi.CORBA \
-    javax.xml.bind \
-    javax.xml.bind.annotation \
-    javax.xml.bind.annotation.adapters \
-    javax.xml.bind.attachment \
-    javax.xml.bind.helpers \
-    javax.xml.bind.util \
-    javax.xml.soap \
-    javax.xml.ws \
-    javax.xml.ws.handler \
-    javax.xml.ws.handler.soap \
-    javax.xml.ws.http \
-    javax.xml.ws.soap \
-    javax.xml.ws.spi \
-    javax.xml.ws.spi.http \
-    javax.xml.ws.wsaddressing \
-    javax.annotation \
-    org.omg.CORBA \
-    org.omg.CORBA.DynAnyPackage \
-    org.omg.CORBA.ORBPackage \
-    org.omg.CORBA.TypeCodePackage \
-    org.omg.CORBA.portable \
-    org.omg.CORBA_2_3 \
-    org.omg.CORBA_2_3.portable \
-    org.omg.CosNaming \
-    org.omg.CosNaming.NamingContextExtPackage \
-    org.omg.CosNaming.NamingContextPackage \
-    org.omg.Dynamic \
-    org.omg.DynamicAny \
-    org.omg.DynamicAny.DynAnyFactoryPackage \
-    org.omg.DynamicAny.DynAnyPackage \
-    org.omg.IOP \
-    org.omg.IOP.CodecFactoryPackage \
-    org.omg.IOP.CodecPackage \
-    org.omg.Messaging \
-    org.omg.PortableInterceptor \
-    org.omg.PortableInterceptor.ORBInitInfoPackage \
-    org.omg.PortableServer \
-    org.omg.PortableServer.CurrentPackage \
-    org.omg.PortableServer.POAManagerPackage \
-    org.omg.PortableServer.POAPackage \
-    org.omg.PortableServer.ServantLocatorPackage \
-    org.omg.PortableServer.portable \
-    org.omg.SendingContext \
-    org.omg.stub.java.rmi \
-    org.omg.stub.javax.management.remote.rmi
-
-# Remaining JDK supported API
-profile.5.name = JDK tools
-profile.5.packages = \
-    com.sun.jdi \
-    com.sun.jdi.connect \
-    com.sun.jdi.connect.spi \
-    com.sun.jdi.event \
-    com.sun.jdi.request \
-    com.sun.javadoc \
-    com.sun.tools.doclets \
-    com.sun.tools.doctree \
-    com.sun.source.tree \
-    com.sun.source.util \
-    com.sun.tools.attach \
-    com.sun.tools.attach.spi \
-    com.sun.tools.jconsole \
-    com.sun.tools.javac \
-    com.sun.tools.javah \
-    com.sun.tools.javap \
-    com.sun.tools.javadoc \
-    com.sun.servicetag
diff --git a/langtools/test/tools/lib/ToolBox.java b/langtools/test/tools/lib/ToolBox.java
index 859765b2db1..a62ff1bc1a0 100644
--- a/langtools/test/tools/lib/ToolBox.java
+++ b/langtools/test/tools/lib/ToolBox.java
@@ -1546,31 +1546,31 @@ public class ToolBox {
         }
 
         private void writeFiles(JarOutputStream jos) throws IOException {
-            Path base = (baseDir == null) ? currDir : baseDir;
-            for (Path path : paths) {
-                Files.walkFileTree(base.resolve(path), new SimpleFileVisitor<Path>() {
-                    @Override
-                    public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
-                        try {
+                Path base = (baseDir == null) ? currDir : baseDir;
+                for (Path path : paths) {
+                    Files.walkFileTree(base.resolve(path), new SimpleFileVisitor<Path>() {
+                        @Override
+                        public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) {
+                            try {
                             String p = base.relativize(file)
                                     .normalize()
                                     .toString()
                                     .replace(File.separatorChar, '/');
                             JarEntry e = new JarEntry(p);
-                            jos.putNextEntry(e);
+                                jos.putNextEntry(e);
                             try {
                                 jos.write(Files.readAllBytes(file));
                             } finally {
                                 jos.closeEntry();
                             }
-                            return FileVisitResult.CONTINUE;
-                        } catch (IOException e) {
+                                return FileVisitResult.CONTINUE;
+                            } catch (IOException e) {
                             error("Exception while adding " + file + " to jar file", e);
-                            return FileVisitResult.TERMINATE;
+                                return FileVisitResult.TERMINATE;
+                            }
                         }
-                    }
-                });
-            }
+                    });
+                }
         }
 
         private void writeFileObjects(JarOutputStream jos) throws IOException {
@@ -1587,9 +1587,9 @@ public class ToolBox {
                     } catch (IOException ex) {
                         error("Exception while adding " + fo.getName() + " to jar file", ex);
                     }
-                } finally {
+            } finally {
                     jos.closeEntry();
-                }
+            }
             }
         }
 
@@ -1599,17 +1599,30 @@ public class ToolBox {
          */
         private final Pattern jarEntry = Pattern.compile(".*!/(?:META-INF/sym/[^/]+/)?(.*)");
 
+        /*
+         * A jrt: URL is of the form  jrt:/module/package/file
+         */
+        private final Pattern jrtEntry = Pattern.compile("/([^/]+)/(.*)");
+
         private String guessPath(FileObject fo) {
             URI u = fo.toUri();
             switch (u.getScheme()) {
-                case "jar":
+                case "jar": {
                     Matcher m = jarEntry.matcher(u.getSchemeSpecificPart());
                     if (m.matches()) {
                         return m.group(1);
                     }
                     break;
+                }
+                case "jrt": {
+                    Matcher m = jrtEntry.matcher(u.getSchemeSpecificPart());
+                    if (m.matches()) {
+                        return m.group(2);
+                    }
+                    break;
+                }
             }
-            throw new IllegalArgumentException(fo.getName());
+            throw new IllegalArgumentException(fo.getName() + "--" + fo.toUri());
         }
 
         private void error(String message, Throwable t) {
diff --git a/langtools/test/tools/sjavac/OptionDecoding.java b/langtools/test/tools/sjavac/OptionDecoding.java
index 7d82ec69186..cfd733e51f5 100644
--- a/langtools/test/tools/sjavac/OptionDecoding.java
+++ b/langtools/test/tools/sjavac/OptionDecoding.java
@@ -35,6 +35,7 @@
 import static util.OptionTestUtil.assertEquals;
 import static util.OptionTestUtil.checkFilesFound;
 
+import java.io.File;
 import java.io.IOException;
 import java.nio.file.Files;
 import java.nio.file.Path;
@@ -218,20 +219,20 @@ public class OptionDecoding {
 
     // Test input paths
     static void testSearchPaths() {
-
         List<String> i, x, iF, xF;
         i = x = iF = xF = new ArrayList<>();
 
         SourceLocation dir1 = new SourceLocation(Paths.get("dir1"), i, x, iF, xF);
         SourceLocation dir2 = new SourceLocation(Paths.get("dir2"), i, x, iF, xF);
+        String dir1_PS_dir2 = "dir1" + File.pathSeparator + "dir2";
 
-        Options options = Options.parseArgs("-sourcepath", "dir1:dir2");
+        Options options = Options.parseArgs("-sourcepath", dir1_PS_dir2);
         assertEquals(options.getSourceSearchPaths(), Arrays.asList(dir1, dir2));
 
-        options = Options.parseArgs("-modulepath", "dir1:dir2");
+        options = Options.parseArgs("-modulepath", dir1_PS_dir2);
         assertEquals(options.getModuleSearchPaths(), Arrays.asList(dir1, dir2));
 
-        options = Options.parseArgs("-classpath", "dir1:dir2");
+        options = Options.parseArgs("-classpath", dir1_PS_dir2);
         assertEquals(options.getClassSearchPath(), Arrays.asList(dir1, dir2));
     }
 

From 174f2cfc80f9990086a260633102e0ed6aecf7be Mon Sep 17 00:00:00 2001
From: Chris Hegarty <chegar@openjdk.org>
Date: Wed, 3 Dec 2014 14:26:07 +0000
Subject: [PATCH 215/299] 8049367: Modular Run-Time Images

Co-authored-by: Alan Bateman <alan.bateman@oracle.com>
Co-authored-by: Alex Buckley <alex.buckley@oracle.com>
Co-authored-by: Bradford Wetmore <bradford.wetmore@oracle.com>
Co-authored-by: Erik Joelsson <erik.joelsson@oracle.com>
Co-authored-by: James Laskey <james.laskey@oracle.com>
Co-authored-by: Jonathan Gibbons <jonathan.gibbons@oracle.com>
Co-authored-by: Karen Kinnear <karen.kinnear@oracle.com>
Co-authored-by: Magnus Ihse Bursie <magnus.ihse.bursie@oracle.com>
Co-authored-by: Mandy Chung <mandy.chung@oracle.com>
Co-authored-by: Mark Reinhold <mark.reinhold@oracle.com>
Co-authored-by: Paul Sandoz <paul.sandoz@oracle.com>
Co-authored-by: Sundararajan Athijegannathan <sundararajan.athijegannathan@oracle.com>
Reviewed-by: chegar, dfuchs, ihse, joehw, mullan, psandoz, wetmore
---
 nashorn/make/BuildNashorn.gmk                 | 13 ++++++------
 nashorn/make/build.xml                        | 21 ++++++++-----------
 nashorn/test/script/nosecurity/JDK-8050964.js |  3 +++
 nashorn/test/script/nosecurity/JDK-8055034.js |  6 +++++-
 .../test/framework/ScriptRunnable.java        |  3 ++-
 5 files changed, 26 insertions(+), 20 deletions(-)

diff --git a/nashorn/make/BuildNashorn.gmk b/nashorn/make/BuildNashorn.gmk
index fcba486a6db..96aac3694a0 100644
--- a/nashorn/make/BuildNashorn.gmk
+++ b/nashorn/make/BuildNashorn.gmk
@@ -34,7 +34,7 @@ include SetupJavaCompilers.gmk
 JDK_CLASSES := $(subst $(SPACE),$(PATH_SEP),$(strip $(addprefix $(JDK_OUTPUTDIR)/modules/, \
       java.base java.logging java.scripting)))
 
-NASHORN_JAR := $(NASHORN_DIST)/nashorn.jar
+NASHORN_JAR := $(IMAGES_OUTPUTDIR)/nashorn.jar
 NASHORN_VERSION := $(JDK_VERSION)
 NASHORN_FULL_VERSION := $(FULL_VERSION)
 
@@ -56,8 +56,9 @@ $(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG, \
 $(eval $(call SetupJavaCompilation,BUILD_NASHORN, \
     SETUP := GENERATE_NEWBYTECODE_DEBUG, \
     SRC := $(NASHORN_TOPDIR)/src/jdk.scripting.nashorn/share/classes, \
+    EXCLUDE_FILES := META-INF/MANIFEST.MF, \
     COPY := .properties .js, \
-    BIN := $(NASHORN_OUTPUTDIR)/nashorn_classes))
+    BIN := $(SUPPORT_OUTPUTDIR)/misc/jdk.scripting.nashorn/classes))
 
 NASGEN_SRC := $(NASHORN_TOPDIR)/buildtools/nasgen/src
 ASM_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/jdk/internal/org/objectweb/asm
@@ -66,8 +67,8 @@ ASM_SRC := $(JDK_TOPDIR)/src/java.base/share/classes/jdk/internal/org/objectweb/
 $(eval $(call SetupJavaCompilation,BUILD_NASGEN, \
     SETUP := GENERATE_OLDBYTECODE, \
     SRC := $(NASGEN_SRC) $(ASM_SRC), \
-    BIN := $(NASHORN_OUTPUTDIR)/nasgen_classes, \
-    ADD_JAVAC_FLAGS := -bootclasspath "$(BOOT_RTJAR)$(PATH_SEP)$(NASHORN_OUTPUTDIR)/nashorn_classes"))
+    BIN := $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes, \
+    ADD_JAVAC_FLAGS := -Xbootclasspath/p:"$(SUPPORT_OUTPUTDIR)/misc/jdk.scripting.nashorn/classes"))
 
 # Nasgen needs nashorn classes
 $(BUILD_NASGEN): $(BUILD_NASHORN)
@@ -80,9 +81,9 @@ $(NASGEN_RUN_FILE): $(BUILD_NASGEN)
 	$(ECHO) Running nasgen
 	$(MKDIR) -p $(@D)
 	$(RM) -rf $(@D)/jdk $(@D)/netscape
-	$(CP) -R -p $(NASHORN_OUTPUTDIR)/nashorn_classes/* $(@D)/
+	$(CP) -R -p $(SUPPORT_OUTPUTDIR)/misc/jdk.scripting.nashorn/classes/* $(@D)/
 	$(FIXPATH) $(JAVA) \
-	    -Xbootclasspath/p:"$(NASHORN_OUTPUTDIR)/nasgen_classes$(PATH_SEP)$(NASHORN_OUTPUTDIR)/nashorn_classes" \
+	    -Xbootclasspath/p:"$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes$(PATH_SEP)$(SUPPORT_OUTPUTDIR)/misc/jdk.scripting.nashorn/classes" \
 	    jdk.nashorn.internal.tools.nasgen.Main $(@D) jdk.nashorn.internal.objects $(@D)
 	$(TOUCH) $@
 
diff --git a/nashorn/make/build.xml b/nashorn/make/build.xml
index 15966da8c80..97d89546720 100644
--- a/nashorn/make/build.xml
+++ b/nashorn/make/build.xml
@@ -35,11 +35,10 @@
     <path id="dist.path">
          <pathelement location="${dist.dir}"/>
     </path>
-    <path id="nashorn.ext.path">
+    <path id="nashorn.boot.prefix.path">
       <pathelement location="${dist.dir}"/>
-      <pathelement location="${java.ext.dirs}"/>
     </path>
-    <property name="ext.class.path" value="-Djava.ext.dirs=&quot;${toString:nashorn.ext.path}&quot;"/>
+    <property name="boot.class.path" value="-Xbootclasspath/a:=&quot;${toString:nashorn.boot.prefix.path}&quot;"/>
     <condition property="svn.executable" value="/usr/local/bin/svn" else="svn">
       <available file="/usr/local/bin/svn"/>
     </condition>
@@ -137,7 +136,6 @@
            debug="${javac.debug}"
            encoding="${javac.encoding}"
            includeantruntime="false" fork="true">
-      <compilerarg value="-J-Djava.ext.dirs="/>
       <compilerarg value="-Xlint:all"/>
       <compilerarg value="-XDignore.symbol.file"/>
       <compilerarg value="-Xdiags:verbose"/>
@@ -243,7 +241,7 @@
   <!-- generate shell.html for shell tool documentation -->
   <target name="shelldoc" depends="jar">
     <java classname="${nashorn.shell.tool}" dir="${basedir}" output="${dist.dir}/shell.html" failonerror="true" fork="true">
-      <jvmarg line="${ext.class.path}"/>
+      <jvmarg line="${boot.class.path}"/>
       <arg value="-scripting"/>
       <arg value="docs/genshelldoc.js"/>
     </java>
@@ -273,7 +271,6 @@
            debug="${javac.debug}"
            encoding="${javac.encoding}"
            includeantruntime="false" fork="true">
-        <compilerarg value="-J-Djava.ext.dirs="/>
         <compilerarg value="-Xlint:unchecked"/>
         <compilerarg value="-Xlint:deprecation"/>
         <compilerarg value="-Xdiags:verbose"/>
@@ -420,7 +417,7 @@ grant codeBase "file:/${basedir}/test/script/markdown.js" {
     </fileset>
     <testng outputdir="${build.nosecurity.test.results.dir}/${testResultsSubDir}" classfilesetref="test.nosecurity.classes"
        verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
-      <jvmarg line="${ext.class.path}"/>
+      <jvmarg line="${boot.class.path}"/>
       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} -Dbuild.dir=${build.dir}"/>
       <sysproperty key="nashorn.jar" value="${dist.dir}/nashorn.jar"/>
       <propertyset>
@@ -443,7 +440,7 @@ grant codeBase "file:/${basedir}/test/script/markdown.js" {
     <property name="debug.test.jvmargs" value=""/>
     <testng outputdir="${build.test.results.dir}/${testResultsSubDir}" classfilesetref="test.classes"
 	    verbose="${testng.verbose}" haltonfailure="true" useDefaultListeners="false" listeners="${testng.listeners}" workingDir="${basedir}">
-      <jvmarg line="${ext.class.path}"/>
+      <jvmarg line="${boot.class.path}"/>
       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
       <jvmarg line="${debug.test.jvmargs}"/>
       <propertyset>
@@ -565,7 +562,7 @@ grant codeBase "file:/${basedir}/test/script/markdown.js" {
   <target name="test262-parallel" depends="jar, check-testng, check-external-tests, compile-test, generate-policy-file" if="testng.available">
     <!-- use just build.test.classes.dir to avoid referring to TestNG -->
     <java classname="${parallel.test.runner}" dir="${basedir}" fork="true">
-      <jvmarg line="${ext.class.path}"/>
+      <jvmarg line="${boot.class.path}"/>
       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs} -Dbuild.dir=${build.dir}"/>
       <!-- avoid too many typeinfo cache files. Each script is run only once anyway -->
       <jvmarg line="-Dnashorn.typeInfo.disabled=true"/>
@@ -586,7 +583,7 @@ grant codeBase "file:/${basedir}/test/script/markdown.js" {
       <java classname="${parallel.test.runner}" dir="${basedir}"
         failonerror="true"
         fork="true">
-      <jvmarg line="${ext.class.path}"/>
+      <jvmarg line="${boot.class.path}"/>
       <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx} ${run.test.jvmsecurityargs}"/>
       <classpath>
           <pathelement path="${run.test.classpath}"/>
@@ -605,7 +602,7 @@ grant codeBase "file:/${basedir}/test/script/markdown.js" {
   <target name="run" depends="jar"
       description="Run the shell with a sample script">
     <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
-        <jvmarg line="${ext.class.path}"/>
+        <jvmarg line="${boot.class.path}"/>
         <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
         <arg value="-dump-on-error"/>
         <arg value="test.js"/>
@@ -615,7 +612,7 @@ grant codeBase "file:/${basedir}/test/script/markdown.js" {
   <target name="debug" depends="jar"
       description="Debug the shell with a sample script">
     <java classname="${nashorn.shell.tool}" fork="true" dir="samples">
-        <jvmarg line="${ext.class.path}"/>
+        <jvmarg line="${boot.class.path}"/>
         <jvmarg line="${run.test.jvmargs} -Xmx${run.test.xmx}"/>
         <arg value="--print-code"/>
         <arg value="--verify-code"/>
diff --git a/nashorn/test/script/nosecurity/JDK-8050964.js b/nashorn/test/script/nosecurity/JDK-8050964.js
index 486948aa566..39cc1c6990e 100644
--- a/nashorn/test/script/nosecurity/JDK-8050964.js
+++ b/nashorn/test/script/nosecurity/JDK-8050964.js
@@ -48,6 +48,9 @@ if (! nashornJar.isAbsolute()) {
 
 var javahome = System.getProperty("java.home");
 var jdepsPath = javahome + "/../bin/jdeps".replaceAll(/\//g, File.separater);
+if (! new File(jdepsPath).isFile()) {
+    jdepsPath = javahome + "/bin/jdeps".replaceAll(/\//g, File.separater);
+}
 
 // run jdep on nashorn.jar - only summary but print profile info
 `${jdepsPath} -s -P ${nashornJar.absolutePath}`
diff --git a/nashorn/test/script/nosecurity/JDK-8055034.js b/nashorn/test/script/nosecurity/JDK-8055034.js
index 76f24be704e..9e7a430becc 100644
--- a/nashorn/test/script/nosecurity/JDK-8055034.js
+++ b/nashorn/test/script/nosecurity/JDK-8055034.js
@@ -47,8 +47,12 @@ var nashornJarDir = nashornJar.parentFile.absolutePath;
 
 // we want to use nashorn.jar passed and not the one that comes with JRE
 var jjsCmd = javahome + "/../bin/jjs";
-jjsCmd += " -J-Djava.ext.dirs=" + nashornJarDir;
 jjsCmd = jjsCmd.toString().replaceAll(/\//g, File.separater);
+if (! new File(jjsCmd).isFile()) {
+    jjsCmd = javahome + "/bin/jjs";
+    jjsCmd = jjsCmd.toString().replaceAll(/\//g, File.separater);
+}
+jjsCmd += " -J-Xbootclasspath/a:" + nashornJarDir;
 
 $EXEC(jjsCmd, "var x = Object.create(null);\nx;\nprint('PASSED');\nexit(0)");
 
diff --git a/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java b/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java
index 704b77c5304..87a1abf6fe7 100644
--- a/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java
+++ b/nashorn/test/src/jdk/nashorn/internal/test/framework/ScriptRunnable.java
@@ -176,7 +176,8 @@ public final class ScriptRunnable extends AbstractScriptRunnable implements ITes
         final List<String> cmd = new ArrayList<>();
 
         cmd.add(System.getProperty("java.home") + separator + "bin" + separator + "java");
-        cmd.add("-Djava.ext.dirs=dist");
+        // cmd.add("-Djava.ext.dirs=dist");
+        cmd.add("-Xbootclasspath/a:dist/nashorn.jar");
         for (final String str : forkJVMOptions) {
             if(!str.isEmpty()) {
                 cmd.add(str);

From 65904e6ad16ec9506782b6f0e6cad08b7f21c629 Mon Sep 17 00:00:00 2001
From: Amy Lu <amy.lu@oracle.com>
Date: Wed, 3 Dec 2014 14:34:42 +0000
Subject: [PATCH 216/299] 8066131: Update
 java/nio/charset/Charset/NIOCharsetAvailabilityTest.java to eliminate
 dependency on sun.misc.Launcher

Reviewed-by: alanb
---
 .../Charset/NIOCharsetAvailabilityTest.java     | 17 -----------------
 1 file changed, 17 deletions(-)

diff --git a/jdk/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java b/jdk/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java
index 1e505712cda..a00cd804818 100644
--- a/jdk/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java
+++ b/jdk/test/java/nio/charset/Charset/NIOCharsetAvailabilityTest.java
@@ -31,10 +31,6 @@ import java.io.File;
 import java.io.FileInputStream;
 import java.io.FileNotFoundException;
 import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLClassLoader;
 import java.nio.charset.Charset;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
@@ -45,7 +41,6 @@ import java.util.Set;
 import java.util.Vector;
 import java.util.zip.ZipEntry;
 import java.util.zip.ZipInputStream;
-import sun.misc.Launcher;
 
 
 public class NIOCharsetAvailabilityTest {
@@ -111,18 +106,6 @@ public class NIOCharsetAvailabilityTest {
             classPathSegments.insertElementAt(dir, 0);
         }
 
-        // add extensions from the extension class loader
-        ClassLoader appLoader = Launcher.getLauncher().getClassLoader();
-        URLClassLoader extLoader = (URLClassLoader) appLoader.getParent();
-        URL[] urls = extLoader.getURLs();
-        for (int i = 0; i < urls.length; i++) {
-            try {
-                URI uri = new URI(urls[i].toString());
-                classPathSegments.insertElementAt(uri.getPath(), 0);
-            } catch (URISyntaxException e) {
-            }
-        }
-
         String[] classList = (String[])
             java.security.AccessController.doPrivileged(
                                     new java.security.PrivilegedAction() {

From deabb040d5bcfcb068b93b0d8eb9bee717c8e4f0 Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Wed, 3 Dec 2014 16:31:15 +0100
Subject: [PATCH 217/299] 8066222: too strong assertion on function expression
 names

Reviewed-by: hannesw, lagergren
---
 .../internal/codegen/AssignSymbols.java       | 45 +++++++++++--------
 .../jdk/nashorn/internal/ir/FunctionNode.java |  9 ++++
 nashorn/test/script/basic/JDK-8066222.js      | 35 +++++++++++++++
 .../test/script/basic/JDK-8066222.js.EXPECTED |  3 ++
 4 files changed, 73 insertions(+), 19 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8066222.js
 create mode 100644 nashorn/test/script/basic/JDK-8066222.js.EXPECTED

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java
index 6eb89a16299..4193139aaaf 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java
@@ -135,15 +135,11 @@ final class AssignSymbols extends NodeVisitor<LexicalContext> implements Loggabl
             functionNode.compilerConstant(SCOPE).setNeedsSlot(false);
         }
         // Named function expressions that end up not referencing themselves won't need a local slot for the self symbol.
-        if(!functionNode.isDeclared() && !functionNode.usesSelfSymbol() && !functionNode.isAnonymous()) {
+        if(functionNode.isNamedFunctionExpression() && !functionNode.usesSelfSymbol()) {
             final Symbol selfSymbol = functionNode.getBody().getExistingSymbol(functionNode.getIdent().getName());
-            if(selfSymbol != null) {
-                if(selfSymbol.isFunctionSelf()) {
-                    selfSymbol.setNeedsSlot(false);
-                    selfSymbol.clearFlag(Symbol.IS_VAR);
-                }
-            } else {
-                assert functionNode.isProgram();
+            if(selfSymbol != null && selfSymbol.isFunctionSelf()) {
+                selfSymbol.setNeedsSlot(false);
+                selfSymbol.clearFlag(Symbol.IS_VAR);
             }
         }
         return functionNode;
@@ -490,20 +486,31 @@ final class AssignSymbols extends NodeVisitor<LexicalContext> implements Loggabl
         final Block body = lc.getCurrentBlock();
 
         initFunctionWideVariables(functionNode, body);
+        acceptDeclarations(functionNode, body);
+        defineFunctionSelfSymbol(functionNode, body);
+    }
 
-        if (!functionNode.isProgram() && !functionNode.isDeclared() && !functionNode.isAnonymous()) {
-            // It's neither declared nor program - it's a function expression then; assign it a self-symbol unless it's
-            // anonymous.
-            final String name = functionNode.getIdent().getName();
-            assert name != null;
-            assert body.getExistingSymbol(name) == null;
-            defineSymbol(body, name, functionNode, IS_VAR | IS_FUNCTION_SELF | HAS_OBJECT_VALUE);
-            if(functionNode.allVarsInScope()) { // basically, has deep eval
-                lc.setFlag(functionNode, FunctionNode.USES_SELF_SYMBOL);
-            }
+    private void defineFunctionSelfSymbol(final FunctionNode functionNode, final Block body) {
+        // Function self-symbol is only declared as a local variable for named function expressions. Declared functions
+        // don't need it as they are local variables in their declaring scope.
+        if (!functionNode.isNamedFunctionExpression()) {
+            return;
         }
 
-        acceptDeclarations(functionNode, body);
+        final String name = functionNode.getIdent().getName();
+        assert name != null; // As it's a named function expression.
+
+        if (body.getExistingSymbol(name) != null) {
+            // Body already has a declaration for the name. It's either a parameter "function x(x)" or a
+            // top-level variable "function x() { ... var x; ... }".
+            return;
+        }
+
+        defineSymbol(body, name, functionNode, IS_VAR | IS_FUNCTION_SELF | HAS_OBJECT_VALUE);
+        if(functionNode.allVarsInScope()) { // basically, has deep eval
+            // We must conservatively presume that eval'd code can dynamically use the function symbol.
+            lc.setFlag(functionNode, FunctionNode.USES_SELF_SYMBOL);
+        }
     }
 
     @Override
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java
index a91de6955e4..383b9bb6427 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/FunctionNode.java
@@ -1091,6 +1091,15 @@ public final class FunctionNode extends LexicalContextExpression implements Flag
         return getFlag(USES_SELF_SYMBOL);
     }
 
+    /**
+     * Returns true if this is a named function expression (that is, it isn't a declared function, it isn't an
+     * anonymous function expression, and it isn't a program).
+     * @return true if this is a named function expression
+     */
+    public boolean isNamedFunctionExpression() {
+        return !getFlag(IS_PROGRAM | IS_ANONYMOUS | IS_DECLARED);
+    }
+
     @Override
     public Type getType(final Function<Symbol, Type> localVariableTypes) {
         return FUNCTION_TYPE;
diff --git a/nashorn/test/script/basic/JDK-8066222.js b/nashorn/test/script/basic/JDK-8066222.js
new file mode 100644
index 00000000000..b5a0b8d82cb
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066222.js
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2014 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.
+ */
+
+/**
+ * JDK-8066222: too strong assertion on function expression names
+ *
+ * @test
+ * @run
+ */
+
+// Has to print "SUCCESS"
+(function x (x){print(x)})("SUCCESS");
+
+// Has to print "undefined" and "1", not the function source in any case.
+(function x(){print(x); var x=1; print(x)})();
diff --git a/nashorn/test/script/basic/JDK-8066222.js.EXPECTED b/nashorn/test/script/basic/JDK-8066222.js.EXPECTED
new file mode 100644
index 00000000000..5dad0b6b5c2
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066222.js.EXPECTED
@@ -0,0 +1,3 @@
+SUCCESS
+undefined
+1

From 29eb5ce73dd53965c1806cac04018ba438b9cd99 Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Wed, 3 Dec 2014 16:31:39 +0100
Subject: [PATCH 218/299] 8066232: problem with conditional catch compilation

Reviewed-by: hannesw, lagergren
---
 .../internal/codegen/CodeGenerator.java       |  3 +-
 nashorn/test/script/basic/JDK-8066232.js      | 36 +++++++++++++++++++
 .../test/script/basic/JDK-8066232.js.EXPECTED |  1 +
 3 files changed, 39 insertions(+), 1 deletion(-)
 create mode 100644 nashorn/test/script/basic/JDK-8066232.js
 create mode 100644 nashorn/test/script/basic/JDK-8066232.js.EXPECTED

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
index 1bf3b382b08..9869c5257cf 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -3080,6 +3080,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
             if (isConditionalCatch) {
                 loadExpressionAsBoolean(exceptionCondition);
                 nextCatch = new Label("next_catch");
+                nextCatch.markAsBreakTarget();
                 method.ifeq(nextCatch);
             } else {
                 nextCatch = null;
@@ -3092,7 +3093,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
                 method._goto(afterCatch);
             }
             if(nextCatch != null) {
-                method.label(nextCatch);
+                method.breakLabel(nextCatch, lc.getUsedSlotCount());
             }
         }
 
diff --git a/nashorn/test/script/basic/JDK-8066232.js b/nashorn/test/script/basic/JDK-8066232.js
new file mode 100644
index 00000000000..364426860e1
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066232.js
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2014 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.
+ */
+
+/**
+ * JDK-8066232: problem with conditional catch compilation
+ *
+ * @test
+ * @run
+ */
+
+(function () { 
+    try {
+        x;
+    } catch(e if 1) {
+    }
+})()
diff --git a/nashorn/test/script/basic/JDK-8066232.js.EXPECTED b/nashorn/test/script/basic/JDK-8066232.js.EXPECTED
new file mode 100644
index 00000000000..ff43ca40915
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066232.js.EXPECTED
@@ -0,0 +1 @@
+SUCCESS

From dacb5a70f8f10ff3aa5ec2ce3d2c67c53d5e52f9 Mon Sep 17 00:00:00 2001
From: Chris Hegarty <chegar@openjdk.org>
Date: Wed, 3 Dec 2014 19:49:59 +0000
Subject: [PATCH 219/299] 8066588:
 javax/management/remote/mandatory/connection/RMIConnector_NPETest.java fails
 to compile

Reviewed-by: alanb, smarks
---
 .../remote/mandatory/connection/RMIConnector_NPETest.java     | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java b/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java
index 1e246514dcd..c672296c11d 100644
--- a/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java
+++ b/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java
@@ -61,7 +61,7 @@ public class RMIConnector_NPETest {
                     // ignore
                 }
             }
-            rmid.shutdown(rmidPort);
+            rmid.destroy();
         }
 
         if (failureCause != null) {
@@ -69,4 +69,4 @@ public class RMIConnector_NPETest {
         }
 
     }
-}
\ No newline at end of file
+}

From 4169c6876929de7870e6dc1ecea87ece08686372 Mon Sep 17 00:00:00 2001
From: Kevin Walls <kevinw@openjdk.org>
Date: Wed, 3 Dec 2014 20:40:00 +0000
Subject: [PATCH 220/299] 8039995: Test
 serviceability/sa/jmap-hashcode/Test8028623.java fails on some Linux/Mac
 machines

Reviewed-by: dsamersoff, allwin, sla
---
 .../sa/jmap-hashcode/Test8028623.java         |  5 ++
 .../com/oracle/java/testlibrary/Platform.java | 55 +++++++++++++++++++
 .../com/oracle/java/testlibrary/Utils.java    | 29 ++++++++++
 3 files changed, 89 insertions(+)

diff --git a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java
index 815b3f606ca..10877ba86d9 100644
--- a/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java
+++ b/hotspot/test/serviceability/sa/jmap-hashcode/Test8028623.java
@@ -34,6 +34,7 @@
 
 import com.oracle.java.testlibrary.JDKToolLauncher;
 import com.oracle.java.testlibrary.OutputBuffer;
+import com.oracle.java.testlibrary.Platform;
 import com.oracle.java.testlibrary.ProcessTools;
 
 import java.io.File;
@@ -48,6 +49,10 @@ public class Test8028623 {
     System.out.println(Ã);
 
     try {
+        if (!Platform.shouldSAAttach()) {
+            System.out.println("SA attach not expected to work - test skipped.");
+            return;
+        }
         int pid = ProcessTools.getProcessId();
         JDKToolLauncher jmap = JDKToolLauncher.create("jmap")
                                               .addToolArg("-F")
diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java
index 0211514e532..e901aa8d53c 100644
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Platform.java
@@ -23,6 +23,8 @@
 
 package com.oracle.java.testlibrary;
 
+import com.oracle.java.testlibrary.Utils;
+
 public class Platform {
     private static final String osName      = System.getProperty("os.name");
     private static final String dataModel   = System.getProperty("sun.arch.data.model");
@@ -30,6 +32,7 @@ public class Platform {
     private static final String javaVersion = System.getProperty("java.version");
     private static final String osArch      = System.getProperty("os.arch");
     private static final String vmName      = System.getProperty("java.vm.name");
+    private static final String userName    = System.getProperty("user.name");
 
     public static boolean isClient() {
         return vmName.endsWith(" Client VM");
@@ -123,4 +126,56 @@ public class Platform {
         return osArch;
     }
 
+    /**
+     * Return a boolean for whether we expect to be able to attach
+     * the SA to our own processes on this system.
+     */
+    public static boolean shouldSAAttach() throws Exception {
+
+        if (isLinux()) {
+            return canPtraceAttachLinux();
+        } else if (isOSX()) {
+            return canAttachOSX();
+        } else {
+            // Other platforms expected to work:
+            return true;
+        }
+    }
+
+    /**
+     * On Linux, first check the SELinux boolean "deny_ptrace" and return false
+     * as we expect to be denied if that is "1".  Then expect permission to attach
+     * if we are root, so return true.  Then return false for an expected denial
+     * if "ptrace_scope" is 1, and true otherwise.
+     */
+    public static boolean canPtraceAttachLinux() throws Exception {
+
+        // SELinux deny_ptrace:
+        String deny_ptrace = Utils.fileAsString("/sys/fs/selinux/booleans/deny_ptrace");
+        if (deny_ptrace != null && deny_ptrace.contains("1")) {
+            // ptrace will be denied:
+            return false;
+        }
+
+        if (userName.equals("root")) {
+            return true;
+        }
+
+        // ptrace_scope:
+        String ptrace_scope = Utils.fileAsString("/proc/sys/kernel/yama/ptrace_scope");
+        if (ptrace_scope != null && ptrace_scope.contains("1")) {
+            // ptrace will be denied:
+            return false;
+        }
+
+        // Otherwise expect to be permitted:
+        return true;
+    }
+
+    /**
+     * On OSX, expect permission to attach only if we are root.
+     */
+    public static boolean canAttachOSX() throws Exception {
+        return userName.equals("root");
+    }
 }
diff --git a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java
index 8ad6155eeb9..96d165fd086 100644
--- a/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java
+++ b/hotspot/test/testlibrary/com/oracle/java/testlibrary/Utils.java
@@ -313,6 +313,35 @@ public final class Utils {
         return output;
     }
 
+    /**
+     * Return the contents of the named file as a single String,
+     * or null if not found.
+     * @param filename name of the file to read
+     * @return String contents of file, or null if file not found.
+     */
+    public static String fileAsString(String filename) {
+        StringBuilder result = new StringBuilder();
+        try {
+            File file = new File(filename);
+            if (file.exists()) {
+                BufferedReader reader = new BufferedReader(new FileReader(file));
+                while (true) {
+                    String line = reader.readLine();
+                    if (line == null) {
+                        break;
+                    }
+                    result.append(line).append("\n");
+                }
+            } else {
+                // Does not exist:
+                return null;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return result.toString();
+    }
+
     /**
      * @return Unsafe instance.
      */

From 7e500d532492437658e6736d6279809f3fa40406 Mon Sep 17 00:00:00 2001
From: Lance Andersen <lancea@openjdk.org>
Date: Wed, 3 Dec 2014 16:50:55 -0500
Subject: [PATCH 221/299] 8060068: Possible Deadlock scenario with
 DriverManager.loadInitialDrivers

Reviewed-by: mchung, smarks, ulfzibis
---
 .../share/classes/java/sql/DriverManager.java | 79 +++++++++++--------
 1 file changed, 47 insertions(+), 32 deletions(-)

diff --git a/jdk/src/java.sql/share/classes/java/sql/DriverManager.java b/jdk/src/java.sql/share/classes/java/sql/DriverManager.java
index a9190a4851e..bd24b3dfbb1 100644
--- a/jdk/src/java.sql/share/classes/java/sql/DriverManager.java
+++ b/jdk/src/java.sql/share/classes/java/sql/DriverManager.java
@@ -29,6 +29,7 @@ import java.util.Iterator;
 import java.util.ServiceLoader;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.PropertyPermission;
 import java.util.concurrent.CopyOnWriteArrayList;
 import sun.reflect.CallerSensitive;
 import sun.reflect.Reflection;
@@ -87,21 +88,13 @@ public class DriverManager {
     private static volatile java.io.PrintWriter logWriter = null;
     private static volatile java.io.PrintStream logStream = null;
     // Used in println() to synchronize logWriter
-    private final static  Object logSync = new Object();
+    private final static Object logSync = new Object();
+    private static volatile boolean driversInitialized;
+    private static final String JDBC_DRIVERS_PROPERTY = "jdbc.drivers";
 
     /* Prevent the DriverManager class from being instantiated. */
     private DriverManager(){}
 
-
-    /**
-     * Load the initial JDBC drivers by checking the System property
-     * jdbc.properties and then use the {@code ServiceLoader} mechanism
-     */
-    static {
-        loadInitialDrivers();
-        println("JDBC DriverManager initialized");
-    }
-
     /**
      * The <code>SQLPermission</code> constant that allows the
      * setting of the logging stream.
@@ -291,12 +284,12 @@ public class DriverManager {
 
         // Walk through the loaded registeredDrivers attempting to locate someone
         // who understands the given URL.
-        for (DriverInfo aDriver : registeredDrivers) {
+        for (DriverInfo aDriver : getRegisteredDrivers()) {
             // If the caller does not have permission to load the driver then
             // skip it.
-            if(isDriverAllowed(aDriver.driver, callerClass)) {
+            if (isDriverAllowed(aDriver.driver, callerClass)) {
                 try {
-                    if(aDriver.driver.acceptsURL(url)) {
+                    if (aDriver.driver.acceptsURL(url)) {
                         // Success!
                         println("getDriver returning " + aDriver.driver.getClass().getName());
                     return (aDriver.driver);
@@ -328,7 +321,7 @@ public class DriverManager {
      * @exception SQLException if a database access error occurs
      * @exception NullPointerException if {@code driver} is null
      */
-    public static synchronized void registerDriver(java.sql.Driver driver)
+    public static void registerDriver(java.sql.Driver driver)
         throws SQLException {
 
         registerDriver(driver, null);
@@ -349,12 +342,12 @@ public class DriverManager {
      * @exception NullPointerException if {@code driver} is null
      * @since 1.8
      */
-    public static synchronized void registerDriver(java.sql.Driver driver,
+    public static void registerDriver(java.sql.Driver driver,
             DriverAction da)
         throws SQLException {
 
         /* Register the driver if it has not already been added to our list */
-        if(driver != null) {
+        if (driver != null) {
             registeredDrivers.addIfAbsent(new DriverInfo(driver, da));
         } else {
             // This is for compatibility with the original DriverManager
@@ -405,12 +398,12 @@ public class DriverManager {
         println("DriverManager.deregisterDriver: " + driver);
 
         DriverInfo aDriver = new DriverInfo(driver, null);
-        if(registeredDrivers.contains(aDriver)) {
+        if (registeredDrivers.contains(aDriver)) {
             if (isDriverAllowed(driver, Reflection.getCallerClass())) {
                 DriverInfo di = registeredDrivers.get(registeredDrivers.indexOf(aDriver));
                  // If a DriverAction was specified, Call it to notify the
                  // driver that it has been deregistered
-                 if(di.action() != null) {
+                 if (di.action() != null) {
                      di.action().deregister();
                  }
                  registeredDrivers.remove(aDriver);
@@ -440,10 +433,10 @@ public class DriverManager {
         Class<?> callerClass = Reflection.getCallerClass();
 
         // Walk through the loaded registeredDrivers.
-        for(DriverInfo aDriver : registeredDrivers) {
+        for (DriverInfo aDriver : getRegisteredDrivers()) {
             // If the caller does not have permission to load the driver then
             // skip it.
-            if(isDriverAllowed(aDriver.driver, callerClass)) {
+            if (isDriverAllowed(aDriver.driver, callerClass)) {
                 result.addElement(aDriver.driver);
             } else {
                 println("    skipping: " + aDriver.getClass().getName());
@@ -550,7 +543,7 @@ public class DriverManager {
 
     private static boolean isDriverAllowed(Driver driver, ClassLoader classLoader) {
         boolean result = false;
-        if(driver != null) {
+        if (driver != null) {
             Class<?> aClass = null;
             try {
                 aClass =  Class.forName(driver.getClass().getName(), true, classLoader);
@@ -564,12 +557,34 @@ public class DriverManager {
         return result;
     }
 
-    private static void loadInitialDrivers() {
+    /*
+     * Return the registered java.sql.Drivers and call loadInitialDrivers
+     * if needed
+     */
+    private static CopyOnWriteArrayList<DriverInfo> getRegisteredDrivers() {
+        // Check to see if we need to load the initial drivers
+        if (!driversInitialized) {
+            loadInitialDrivers();
+        }
+        return registeredDrivers;
+
+    }
+
+    /*
+     * Load the initial JDBC drivers by checking the System property
+     * jdbc.properties and then use the {@code ServiceLoader} mechanism
+     */
+    private synchronized static void loadInitialDrivers() {
         String drivers;
+
+        if (driversInitialized) {
+            return;
+        }
+
         try {
             drivers = AccessController.doPrivileged(new PrivilegedAction<String>() {
                 public String run() {
-                    return System.getProperty("jdbc.drivers");
+                    return System.getProperty(JDBC_DRIVERS_PROPERTY);
                 }
             });
         } catch (Exception ex) {
@@ -625,6 +640,9 @@ public class DriverManager {
                 println("DriverManager.Initialize: load failed: " + ex);
             }
         }
+
+        driversInitialized = true;
+        println("JDBC DriverManager initialized");
     }
 
 
@@ -638,14 +656,11 @@ public class DriverManager {
          * can be loaded from here.
          */
         ClassLoader callerCL = caller != null ? caller.getClassLoader() : null;
-        synchronized(DriverManager.class) {
-            // synchronize loading of the correct classloader.
-            if (callerCL == null) {
-                callerCL = Thread.currentThread().getContextClassLoader();
-            }
+        if (callerCL == null) {
+            callerCL = Thread.currentThread().getContextClassLoader();
         }
 
-        if(url == null) {
+        if (url == null) {
             throw new SQLException("The url cannot be null", "08001");
         }
 
@@ -655,10 +670,10 @@ public class DriverManager {
         // Remember the first exception that gets raised so we can reraise it.
         SQLException reason = null;
 
-        for(DriverInfo aDriver : registeredDrivers) {
+        for (DriverInfo aDriver : getRegisteredDrivers()) {
             // If the caller does not have permission to load the driver then
             // skip it.
-            if(isDriverAllowed(aDriver.driver, callerCL)) {
+            if (isDriverAllowed(aDriver.driver, callerCL)) {
                 try {
                     println("    trying " + aDriver.driver.getClass().getName());
                     Connection con = aDriver.driver.connect(url, info);

From bf31fc249e2680f6bdc26a070d911a3961a99ad6 Mon Sep 17 00:00:00 2001
From: Zaiyao Liu <zaiyao.liu@oracle.com>
Date: Thu, 4 Dec 2014 16:50:31 +0800
Subject: [PATCH 222/299] 8048619: Implement tests for converting PKCS12
 keystores

Reviewed-by: weijun
---
 .../KeyStore/PKCS12/ConvertP12Test.java       | 234 ++++++++++++++++++
 .../certs/convertP12/ie_jceks_chain.pfx.data  |  61 +++++
 .../certs/convertP12/ie_jks_chain.pfx.data    |  61 +++++
 .../convertP12/jdk_jceks_selfsigned.p12.data  |  30 +++
 .../convertP12/jdk_jceks_twoentry.p12.data    |  69 ++++++
 .../convertP12/jdk_jceks_twopass.p12.data     |  45 ++++
 .../convertP12/jdk_jks_selfsigned.p12.data    |  45 ++++
 .../convertP12/jdk_jks_twoentry.p12.data      |  69 ++++++
 .../certs/convertP12/jdk_jks_twopass.p12.data |  45 ++++
 .../certs/convertP12/keystoreCA.jceks.data    |  38 +++
 10 files changed, 697 insertions(+)
 create mode 100644 jdk/test/java/security/KeyStore/PKCS12/ConvertP12Test.java
 create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jceks_chain.pfx.data
 create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jks_chain.pfx.data
 create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_selfsigned.p12.data
 create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twoentry.p12.data
 create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twopass.p12.data
 create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_selfsigned.p12.data
 create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twoentry.p12.data
 create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twopass.p12.data
 create mode 100644 jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/keystoreCA.jceks.data

diff --git a/jdk/test/java/security/KeyStore/PKCS12/ConvertP12Test.java b/jdk/test/java/security/KeyStore/PKCS12/ConvertP12Test.java
new file mode 100644
index 00000000000..f5334bff710
--- /dev/null
+++ b/jdk/test/java/security/KeyStore/PKCS12/ConvertP12Test.java
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 2008, 2014, 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 static java.lang.System.out;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.security.Key;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.NoSuchAlgorithmException;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.Certificate;
+import java.util.Arrays;
+import java.util.Base64;
+import java.util.Enumeration;
+
+/*
+ * @test
+ * @bug 8048619
+ * @author  Bill Situ
+ * @summary Test converting keystore from jceks to P12 and from P12 to other
+ *  (jceks,jks). including following test cases:
+ * Read jceks key store and convert to the p12 key store, then compare entries
+ *  in the two key stores.
+ * Read p12 key store and convert to the jceks key store, then compare entries
+ *  in the two key stores.
+ * Read p12 key store (contains only private key and a self-signed certificate)
+ *  and convert to the jceks key store, then compare entries of two key stores.
+ * Read p12 key store (contains 2 entries) and convert to the jceks key store,
+ *  then compare entries in the two key stores.
+ * Read p12 key store (entry password and key store password are different) and
+ *  convert to the jceks key store, then compare entries in the two key stores.
+ * Read p12 key store and convert to the jks key store, then compare entries
+ *  in the two key stores.
+ * Read p12 key store (contains only private key and a self-signed certificate)
+ *  and convert to the jks key store, then compare entries in the two key stores.
+ * Read p12 key store (contains 2 entries) and convert to the jks key store,
+ *  then compare entries in the two key stores.
+ * Read p12 key store (entry password and key store password are different) and
+ * convert to the jks key store, then compare entries in the two key stores.
+ */
+
+public class ConvertP12Test {
+
+    private static final String SUN_JSSE = "SunJSSE";
+    private static final String SUN_JCE = "SunJCE";
+    private static final String SUN = "SUN";
+    private static final String PKCS12 = "pkcs12";
+    private static final String JCE_KS = "JceKS";
+    private static final String JKS = "JKS";
+
+    public static void main(String args[]) throws Exception {
+
+        ConvertP12Test jstest = new ConvertP12Test();
+
+        jstest.driver("JceksToP12", "keystoreCA.jceks.data", JCE_KS, SUN_JCE,
+                "storepass", "keypass", PKCS12, SUN_JSSE);
+
+        jstest.driver("P12ToJceks_Chain", "ie_jceks_chain.pfx.data", PKCS12,
+                SUN_JSSE, "pass", "pass", JCE_KS, SUN_JCE);
+
+        jstest.driver("P12ToJceks_SelfSigned", "jdk_jceks_selfsigned.p12.data",
+                PKCS12, SUN_JSSE, "pass", "pass", JCE_KS, SUN_JCE);
+
+        jstest.driver("P12ToJceks_TwoEntry", "jdk_jceks_twoentry.p12.data",
+                PKCS12, SUN_JSSE, "pass", "pass", JCE_KS, SUN_JCE);
+
+        jstest.driver("P12ToJceks_TwoPass", "jdk_jceks_twopass.p12.data",
+                PKCS12, SUN_JSSE, "storepass", "keypass", JCE_KS, SUN_JCE);
+
+        jstest.driver("P12ToJks_Chain", "ie_jks_chain.pfx.data", PKCS12,
+                SUN_JSSE, "pass", "pass", JKS, SUN);
+
+        jstest.driver("P12ToJks_SelfSigned", "jdk_jks_selfsigned.p12.data",
+                PKCS12, SUN_JSSE, "pass", "pass", JKS, SUN);
+
+        jstest.driver("P12ToJks_TwoEntry", "jdk_jks_twoentry.p12.data", PKCS12,
+                SUN_JSSE, "pass", "pass", JKS, SUN);
+
+        jstest.driver("P12ToJks_TwoPass", "jdk_jks_twopass.p12.data", PKCS12,
+                SUN_JSSE, "storepass", "keypass", JKS, SUN);
+
+    }
+
+    private void driver(String testCase, String inKeyStore,
+            String inKeyStoreType, String inKeyStoreTypePrv,
+            String inStorePass, String inKeyPass, String outKeyStoreType,
+            String outKeyStorePrv) throws Exception {
+
+        String outStorePass = "pass";
+        String outKeyPass = "pass";
+        KeyStore inputKeyStore, outputKeyStore;
+
+        out.println("Testing " + testCase);
+        String keystorePath = System.getProperty("test.src", ".")
+                + File.separator + "certs" + File.separator + "convertP12";
+        out.println("Output KeyStore : " + inKeyStore + ".out");
+        String outKeyStoreName = inKeyStore + ".out";
+        try (FileOutputStream fout = new FileOutputStream(outKeyStoreName);) {
+            inputKeyStore = KeyStore.getInstance(inKeyStoreType,
+                    inKeyStoreTypePrv);
+
+            // KeyStore have encoded by Base64.getMimeEncoder().encode(),need
+            // decode first.
+            byte[] input = Files.readAllBytes(Paths.get(keystorePath,
+                    inKeyStore));
+            ByteArrayInputStream arrayIn = new ByteArrayInputStream(Base64
+                    .getMimeDecoder().decode(input));
+
+            out.println("Input KeyStore : " + inKeyStore);
+
+            inputKeyStore.load(arrayIn, inStorePass.toCharArray());
+
+            outputKeyStore = KeyStore.getInstance(outKeyStoreType,
+                    outKeyStorePrv);
+            outputKeyStore.load(null, null);
+
+            run(inputKeyStore, outputKeyStore, inKeyPass, outKeyPass);
+
+            outputKeyStore.store(fout, outStorePass.toCharArray());
+
+            // for P12ToJks_TwoEntry test case will test includes each other,
+            // others just test compareKeystore
+            if (testCase.contains("TwoEntry")) {
+
+                compareKeyStore(inputKeyStore, outputKeyStore, inKeyPass,
+                        outKeyPass, 2);
+                compareKeyStore(outputKeyStore, inputKeyStore, outKeyPass,
+                        inKeyPass, 2);
+            } else {
+                compareKeyStore(inputKeyStore, outputKeyStore, inKeyPass,
+                        outKeyPass, 1);
+            }
+            out.println("Test " + testCase + " STATUS: Pass!!");
+        } catch (Exception ex) {
+            out.println("Test " + testCase + " STATUS: failed with exception: "
+                    + ex.getMessage());
+            throw ex;
+        }
+    }
+
+    private void run(KeyStore inputKeyStore, KeyStore outputKeyStore,
+            String inKeyPass, String outKeyPass) throws Exception {
+        Enumeration<String> e = inputKeyStore.aliases();
+        String alias;
+        while (e.hasMoreElements()) {
+            alias = e.nextElement();
+            Certificate[] certs = inputKeyStore.getCertificateChain(alias);
+
+            boolean isCertEntry = inputKeyStore.isCertificateEntry(alias);
+            // Test KeyStore only contain key pair entries.
+            if (isCertEntry == true) {
+                throw new RuntimeException(
+                        "inputKeystore should not be certEntry because test"
+                                + " keystore only contain key pair entries"
+                                + " for alias:" + alias);
+            }
+
+            boolean isKeyEntry = inputKeyStore.isKeyEntry(alias);
+            Key key = null;
+            if (isKeyEntry) {
+                key = inputKeyStore.getKey(alias, inKeyPass.toCharArray());
+            } else {
+                throw new RuntimeException("Entry type unknown for alias:"
+                        + alias);
+            }
+            outputKeyStore.setKeyEntry(alias, key, outKeyPass.toCharArray(),
+                    certs);
+        }
+    }
+
+    private void compareKeyStore(KeyStore a, KeyStore b, String inKeyPass,
+            String outKeyPass, int keyStoreSize) throws Exception {
+        if (a.size() != keyStoreSize || b.size() != keyStoreSize) {
+            throw new RuntimeException("size not match or size not equal to "
+                    + keyStoreSize);
+        }
+
+        Enumeration<String> eA = a.aliases();
+        while (eA.hasMoreElements()) {
+            String aliasA = eA.nextElement();
+
+            if (!b.containsAlias(aliasA)) {
+                throw new RuntimeException("alias not match for alias:"
+                        + aliasA);
+            }
+
+            compareKeyEntry(a, b, inKeyPass, outKeyPass, aliasA);
+        }
+    }
+
+    private void compareKeyEntry(KeyStore a, KeyStore b, String aPass,
+            String bPass, String alias) throws KeyStoreException,
+            UnrecoverableKeyException, NoSuchAlgorithmException {
+        Certificate[] certsA = a.getCertificateChain(alias);
+        Certificate[] certsB = b.getCertificateChain(alias);
+
+        if (!Arrays.equals(certsA, certsB)) {
+            throw new RuntimeException("Certs don't match for alias:" + alias);
+        }
+
+        Key keyA = a.getKey(alias, aPass.toCharArray());
+        Key keyB = b.getKey(alias, bPass.toCharArray());
+
+        if (!keyA.equals(keyB)) {
+            throw new RuntimeException(
+                    "Key don't match for alias:" + alias);
+        }
+    }
+}
diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jceks_chain.pfx.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jceks_chain.pfx.data
new file mode 100644
index 00000000000..3dbe7e4fcb3
--- /dev/null
+++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jceks_chain.pfx.data
@@ -0,0 +1,61 @@
+MIINXgIBAzCCDRoGCSqGSIb3DQEHAaCCDQsEgg0HMIINAzCCA7wGCSqGSIb3DQEHAaCCA60EggOp
+MIIDpTCCA6EGCyqGSIb3DQEMCgECoIICtjCCArIwHAYKKoZIhvcNAQwBAzAOBAipOP0AVsizDgIC
+B9AEggKQIP/YI9/C2WYbIWxKuqXMD8WPCvqj1fhHmZJ0epCzgEdOR7GT/h2Fy4/wxrthPkj4JqkS
+akQog3pjOFtj9D8QtkOw/b761qsyj17TYlQS9C6qVhcddMA+Ca2NcDhKlYofQMNTuYPXkXlpCh5R
+CNFgQ+PLVZwNZjqoitjv0RLQqBudhTmJSvfDlW2w+CpbziEeRNzn0pX0/Ts7KxykDscOmUCGHKic
+b6FqHoioElcmBp7ae3zdXuvI1x/1Y435qju2yODPpMXEZbdsD5iL07RZyL2vm6lfQbLc37TszDBx
+ZZJ7ja5F4V/j/6/AVLkcqfZxFOnXz5Ki9rQblYJbkkTpJAyiNqi8Gx+zgPGtLWvV6KRD0zmxo6q/
+OmdjKz4v9aG7MDSXenoy6tPAOvAQcQYaksvFZs1FjorJJpFzasfTUfy94JzrHUzRSPzNRDANHG/6
+TgxC1FMNw+iQUY9L8j4xrWsr2JN5tAgYcWz1qZrp4cx0he9cbQeqYcjv7ZvIQbIe2zxdvxh7WByy
+r8hNMe3RkMOM2yuP85JuWipq+9jt4/CrimKljN1ULPw+V9FZzY8kKcEiSPD+KXdJNkrMr77/lUJz
+PGNYpFBFb4natmi31ZBH2VomTeKPpeanN/ghWojft1mGd1s1nD4NelrWATMVquH2Cq6nhKLRHi4c
+KbQsMo+ftLvkDHHtpYenjGHbwEFfowkwn9slsZqmPEATV6caHNITCBbhQmvvhqPDPPViV+u1M1c7
+vwf/ol7IjBlubwzBJAg6f5GW0tMNHxfg5E7O27AyREyvexk0IVakzIwUuP2anPTjPW0vyeePLtiG
+TXNoUe+5UIzpshnLmSlerhVGoB+HBM1yoaaJHay7sdyQbVUxgdcwEwYJKoZIhvcNAQkVMQYEBAEA
+AAAwWwYJKoZIhvcNAQkUMU4eTAB7ADcAMQA5AEIAQgA4ADkANAAtADMANQA2ADEALQA0AEMAMAA0
+AC0AOQBCADIAMAAtADMAOQBCAEMARAAzADQANwAzADUAMQAwAH0wYwYJKwYBBAGCNxEBMVYeVABN
+AGkAYwByAG8AcwBvAGYAdAAgAEIAYQBzAGUAIABDAHIAeQBwAHQAbwBnAHIAYQBwAGgAaQBjACAA
+UAByAG8AdgBpAGQAZQByACAAdgAxAC4AMDCCCT8GCSqGSIb3DQEHBqCCCTAwggksAgEAMIIJJQYJ
+KoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIEmpyonjQeMACAgfQgIII+Pr+GLKaSN1U1soCnWsw
+4kRoDxPPLNbzv/K+lsbGVk9vXjv5aBTi55FMCXvA5kGvdnQYrQ1KfIZmFVh3PnFQn/J6LVrpLbHC
+/D27wvnOMausJA7uJi6wgkUCkQmXn7kesWhr+bBI9Ci7uyOUxdY53Yg43OQtZbWvQjGe6GiVRqWm
+8NANuZ3c1IT2TmJw5xfvvE4tcHK0d75ApvTa43CkKmUY5A4SyNY4SUVdl9Cx50LEHcqGwV+uVGzy
+kdO0+bgXI66FPKriuqPfayeTmL8T9PimwhOfY38OqtTKHwJ7E817i/B8ULpkRO67uYYJpeK4cIz1
+0rDW/JPG8BqN47Rej8rCpmY1F4hOuFzYA3PAh50YlI2wD2vSSqVPMUe/AtsL+u2Nxl/EidWp/8EL
+l8rBgYJjSl+YjSRV22C/ZwDu/8oV3LeCuwL2SaO1r1tww3WuRAFcCctsemP84YI27Q8Z54P6wM8c
+kjYH9F3oT9bHUAfJUm2d6d3wd+iGbrrxdkLrD5tEQB16K8RAbhPPfrM5rcRlh+Zvn068H/Kc9rEa
+sfJD7ygUBZJ5MSsr4zP4koMZ0xjxAaXRUsURsF13772XL3zfTCVd5fV3wIpJsoXugZTOQ6hjAmeN
+yGMZDn14GyxvwLbGFB0Yx8GAIRDxBvDXkYOqEMocmNwZo+uxPew1H4PMkWMm/yh4Y4V/H9Jmyd3v
+aD2BWVyx7PIJ4cet3RdydHrKSNVBzwrO+y5HKZc7V7aRM0kZgdAJh9eDTlYk6B+ZHd1EawYRlIfl
+f4JydqRkRaya7FOfQ3mLgrz6bdde720XZVWqe9bbsBucbYAJsYvklYYYutnsx1Ri9UYYAbRDy920
+Z6iO1EGF5wcUc0nifXObYJ2x0ldlQskUdThPjZBl2Mk4F9oxS6W5j2llm1hS/vGnFtykQ5NMaxzi
+Jkhi1Mjm/KZJUo2xJai1gtHwBOnlocXZYqJQECabBayA7rLH3pFUhU/Wqkycz4m8dUVXLNHiMIEd
+3sc0QASMF56kqXtzph2zbXBbCD8afyt8WjMzZvO4lEGNM8xi/7C6h45QsdGZgqkHrYBJbSHfrU05
+ZvNpV8YcfhkzX6gNtZU5XDDBPgkYn41sEt3aVRHvRAqc+uhczQ8svVhPUsriWnKk2bfw8iAn1xex
+5huB52uVPRfuL7wJxyV1Rk8WhK10xCzFDnJtRUAJ6UtuezrMOh28NPULQnLIx1kF00+uflY5vAHM
+rAf92+NqORZUflKVidqHYmF7bdeNGw3qshaK/0+3grs6rQeQAvxiTdmG+sBP9poBIeeHo2OzcACB
+wTuerZiYlzL7mAUegdiPD+wOa2yfGF+WG2vM9npO+a1ZWsoWceAxpLOyubBVfLyc7lfCo7ma70Vd
+Kl/o7VevEqLIz5ZkaCoupWk7nDKDMG73vGXqJwaYjd8teOw66aELd2WI4cAoFTvPayxMKHD8hf4n
+78riWe2XomUzafZLoMhj5vfYsiwwL3F5O/KUtTOXNNDDVuAwByiCfN65LIjU/Dhn8t6Izkox/Tnl
+9kPqNxqJAxFtARCFo9Xpgba761dTBmUF9J+Krg6B53NEv+0qvJY3w1H8Fnop9S+eEs6/4qUMmgO4
+wrm3aEaLY4XWGejuxUEQ9+3/cxK1YTJIpBeK8Q1/yPgj2mq62RRGcyDPEMbcbFcsI4MKlGggcpHV
+H8hv1XPLbrMi56lax3dB/EkJzJ+5IEnYd0NkXclyQm4d7KUy6LG5I2Quwt0J50dxbqmfR0gWwGsY
+nsT4Kk71NiUyU9AWl46EOZIzONN4Vnm0qq3oNJ5e8VpKTb2g80m5ouw+tPiDA/IA3Vu3VKLT589j
+5IQrNYhrizZnEApqPAQwBiN6D+0BLgsNeQDUn56emMj1ETDgfjukqAQjlGUvAr/VV/+eFHvkqwJU
+Hy6Xzd36Cq4/sYKYVU7OFzh6Ts9gCvblZxbFI1yNimEvwZ/bINKAemQLoji3s1UIs5X+BYqKZpI5
+nZsjbIHLafNjfPoMKUlpQa27jFc4s4GQ9WLBDRnVIuzqpdmdslxc2Q+dwzbT+zFoAAe5VzA+ABxv
+cjPYCBVpys4hYH1p3uwUq/hKkR7QgPE2c25qIHl+6VVS9dgaQ4XnHtVZjFzDk8u5YNenHx8E3lx4
+Ebe3mNjsM51X16ERkGC7X+w4Ko89wvb7jnnOheC0W5ICZQgphdasjff259yEJuhfk62r6bhZH2Um
+2IkUACGxKaEzh55Z5P2rcaSjAwIeWnLHDCPSOJ819/4XQEtPfbZs9eymDwNOg13kZhadSQF8+zht
+0Tko/9k41bNaT2ZqogskrIF9oltpofddqOa5IcE2d13T2IuDkV8/whV87P8Dg6fmFYpFCHN7zsks
+X+IHrRIt7gILXPwecu2LfUZxdH/Cr5WbfMzTnsWWSB7/Z9MLrlEISHM4zC7DlkbRSD7LyXyI4weh
+HNelf0uLtYRhXku5BkJUyysIYDpSHHxsMJ04Th+RZ7s8seoLBeAn7gbsj3B/JUOxIaEx8+W3bjb1
+wq6cc+KqLnvcO2BDvH30PfeQo7YjTNr4wcEoUFZXwhTL5owVc4GKtlfl/YxBXs2E6r6l43svlay6
+vCq58xTvWzzRtzvb6oh6qnoMP2xc8YTdpKma64TBmnFOVE/eGXZxVyk19TXwrokqUliutqhM6acv
+x87+Yru+uXTbUpMA0MuW0Ch6uvcwxmM1hq5vHDVBTAfGuXsdQMapKoqseFUfza7N2eSgU8oaJCGQ
+rmhvDn+MNzh2VyLOnPBwJ+sUnHM7XOnz/rCD99uRhhssEwZ5Xij+FG3EeTYyntGp6Z7ODIazLHM8
+81QtQDrJg2EDJ5RZHHrPbyUQDCkGpLZNOOoJkAD7I0VZRC3jJb8lTMXdKQjCd39F842+FXTSvOv9
+lmEOFH4AEyI6CokzFQCD0TXhTaG9wtzaE2q41eEKF45J5vyQxrNabZXeovNIVZryK+N8ep28M084
+vXp7uJm0bg5NunK6vTIqsxenQZWvXay8EwYLbAm8crDxK5sbW4tZtNeVxPE6ekCbifdxdgm0671w
+rt4wOzAfMAcGBSsOAwIaBBT1C0A3jyKtjUTFASRSO852mKBZQQQUqy721AxhZ26s5Tsue4OHTjEB
+CxwCAgfQ
\ No newline at end of file
diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jks_chain.pfx.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jks_chain.pfx.data
new file mode 100644
index 00000000000..3dbe7e4fcb3
--- /dev/null
+++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/ie_jks_chain.pfx.data
@@ -0,0 +1,61 @@
+MIINXgIBAzCCDRoGCSqGSIb3DQEHAaCCDQsEgg0HMIINAzCCA7wGCSqGSIb3DQEHAaCCA60EggOp
+MIIDpTCCA6EGCyqGSIb3DQEMCgECoIICtjCCArIwHAYKKoZIhvcNAQwBAzAOBAipOP0AVsizDgIC
+B9AEggKQIP/YI9/C2WYbIWxKuqXMD8WPCvqj1fhHmZJ0epCzgEdOR7GT/h2Fy4/wxrthPkj4JqkS
+akQog3pjOFtj9D8QtkOw/b761qsyj17TYlQS9C6qVhcddMA+Ca2NcDhKlYofQMNTuYPXkXlpCh5R
+CNFgQ+PLVZwNZjqoitjv0RLQqBudhTmJSvfDlW2w+CpbziEeRNzn0pX0/Ts7KxykDscOmUCGHKic
+b6FqHoioElcmBp7ae3zdXuvI1x/1Y435qju2yODPpMXEZbdsD5iL07RZyL2vm6lfQbLc37TszDBx
+ZZJ7ja5F4V/j/6/AVLkcqfZxFOnXz5Ki9rQblYJbkkTpJAyiNqi8Gx+zgPGtLWvV6KRD0zmxo6q/
+OmdjKz4v9aG7MDSXenoy6tPAOvAQcQYaksvFZs1FjorJJpFzasfTUfy94JzrHUzRSPzNRDANHG/6
+TgxC1FMNw+iQUY9L8j4xrWsr2JN5tAgYcWz1qZrp4cx0he9cbQeqYcjv7ZvIQbIe2zxdvxh7WByy
+r8hNMe3RkMOM2yuP85JuWipq+9jt4/CrimKljN1ULPw+V9FZzY8kKcEiSPD+KXdJNkrMr77/lUJz
+PGNYpFBFb4natmi31ZBH2VomTeKPpeanN/ghWojft1mGd1s1nD4NelrWATMVquH2Cq6nhKLRHi4c
+KbQsMo+ftLvkDHHtpYenjGHbwEFfowkwn9slsZqmPEATV6caHNITCBbhQmvvhqPDPPViV+u1M1c7
+vwf/ol7IjBlubwzBJAg6f5GW0tMNHxfg5E7O27AyREyvexk0IVakzIwUuP2anPTjPW0vyeePLtiG
+TXNoUe+5UIzpshnLmSlerhVGoB+HBM1yoaaJHay7sdyQbVUxgdcwEwYJKoZIhvcNAQkVMQYEBAEA
+AAAwWwYJKoZIhvcNAQkUMU4eTAB7ADcAMQA5AEIAQgA4ADkANAAtADMANQA2ADEALQA0AEMAMAA0
+AC0AOQBCADIAMAAtADMAOQBCAEMARAAzADQANwAzADUAMQAwAH0wYwYJKwYBBAGCNxEBMVYeVABN
+AGkAYwByAG8AcwBvAGYAdAAgAEIAYQBzAGUAIABDAHIAeQBwAHQAbwBnAHIAYQBwAGgAaQBjACAA
+UAByAG8AdgBpAGQAZQByACAAdgAxAC4AMDCCCT8GCSqGSIb3DQEHBqCCCTAwggksAgEAMIIJJQYJ
+KoZIhvcNAQcBMBwGCiqGSIb3DQEMAQYwDgQIEmpyonjQeMACAgfQgIII+Pr+GLKaSN1U1soCnWsw
+4kRoDxPPLNbzv/K+lsbGVk9vXjv5aBTi55FMCXvA5kGvdnQYrQ1KfIZmFVh3PnFQn/J6LVrpLbHC
+/D27wvnOMausJA7uJi6wgkUCkQmXn7kesWhr+bBI9Ci7uyOUxdY53Yg43OQtZbWvQjGe6GiVRqWm
+8NANuZ3c1IT2TmJw5xfvvE4tcHK0d75ApvTa43CkKmUY5A4SyNY4SUVdl9Cx50LEHcqGwV+uVGzy
+kdO0+bgXI66FPKriuqPfayeTmL8T9PimwhOfY38OqtTKHwJ7E817i/B8ULpkRO67uYYJpeK4cIz1
+0rDW/JPG8BqN47Rej8rCpmY1F4hOuFzYA3PAh50YlI2wD2vSSqVPMUe/AtsL+u2Nxl/EidWp/8EL
+l8rBgYJjSl+YjSRV22C/ZwDu/8oV3LeCuwL2SaO1r1tww3WuRAFcCctsemP84YI27Q8Z54P6wM8c
+kjYH9F3oT9bHUAfJUm2d6d3wd+iGbrrxdkLrD5tEQB16K8RAbhPPfrM5rcRlh+Zvn068H/Kc9rEa
+sfJD7ygUBZJ5MSsr4zP4koMZ0xjxAaXRUsURsF13772XL3zfTCVd5fV3wIpJsoXugZTOQ6hjAmeN
+yGMZDn14GyxvwLbGFB0Yx8GAIRDxBvDXkYOqEMocmNwZo+uxPew1H4PMkWMm/yh4Y4V/H9Jmyd3v
+aD2BWVyx7PIJ4cet3RdydHrKSNVBzwrO+y5HKZc7V7aRM0kZgdAJh9eDTlYk6B+ZHd1EawYRlIfl
+f4JydqRkRaya7FOfQ3mLgrz6bdde720XZVWqe9bbsBucbYAJsYvklYYYutnsx1Ri9UYYAbRDy920
+Z6iO1EGF5wcUc0nifXObYJ2x0ldlQskUdThPjZBl2Mk4F9oxS6W5j2llm1hS/vGnFtykQ5NMaxzi
+Jkhi1Mjm/KZJUo2xJai1gtHwBOnlocXZYqJQECabBayA7rLH3pFUhU/Wqkycz4m8dUVXLNHiMIEd
+3sc0QASMF56kqXtzph2zbXBbCD8afyt8WjMzZvO4lEGNM8xi/7C6h45QsdGZgqkHrYBJbSHfrU05
+ZvNpV8YcfhkzX6gNtZU5XDDBPgkYn41sEt3aVRHvRAqc+uhczQ8svVhPUsriWnKk2bfw8iAn1xex
+5huB52uVPRfuL7wJxyV1Rk8WhK10xCzFDnJtRUAJ6UtuezrMOh28NPULQnLIx1kF00+uflY5vAHM
+rAf92+NqORZUflKVidqHYmF7bdeNGw3qshaK/0+3grs6rQeQAvxiTdmG+sBP9poBIeeHo2OzcACB
+wTuerZiYlzL7mAUegdiPD+wOa2yfGF+WG2vM9npO+a1ZWsoWceAxpLOyubBVfLyc7lfCo7ma70Vd
+Kl/o7VevEqLIz5ZkaCoupWk7nDKDMG73vGXqJwaYjd8teOw66aELd2WI4cAoFTvPayxMKHD8hf4n
+78riWe2XomUzafZLoMhj5vfYsiwwL3F5O/KUtTOXNNDDVuAwByiCfN65LIjU/Dhn8t6Izkox/Tnl
+9kPqNxqJAxFtARCFo9Xpgba761dTBmUF9J+Krg6B53NEv+0qvJY3w1H8Fnop9S+eEs6/4qUMmgO4
+wrm3aEaLY4XWGejuxUEQ9+3/cxK1YTJIpBeK8Q1/yPgj2mq62RRGcyDPEMbcbFcsI4MKlGggcpHV
+H8hv1XPLbrMi56lax3dB/EkJzJ+5IEnYd0NkXclyQm4d7KUy6LG5I2Quwt0J50dxbqmfR0gWwGsY
+nsT4Kk71NiUyU9AWl46EOZIzONN4Vnm0qq3oNJ5e8VpKTb2g80m5ouw+tPiDA/IA3Vu3VKLT589j
+5IQrNYhrizZnEApqPAQwBiN6D+0BLgsNeQDUn56emMj1ETDgfjukqAQjlGUvAr/VV/+eFHvkqwJU
+Hy6Xzd36Cq4/sYKYVU7OFzh6Ts9gCvblZxbFI1yNimEvwZ/bINKAemQLoji3s1UIs5X+BYqKZpI5
+nZsjbIHLafNjfPoMKUlpQa27jFc4s4GQ9WLBDRnVIuzqpdmdslxc2Q+dwzbT+zFoAAe5VzA+ABxv
+cjPYCBVpys4hYH1p3uwUq/hKkR7QgPE2c25qIHl+6VVS9dgaQ4XnHtVZjFzDk8u5YNenHx8E3lx4
+Ebe3mNjsM51X16ERkGC7X+w4Ko89wvb7jnnOheC0W5ICZQgphdasjff259yEJuhfk62r6bhZH2Um
+2IkUACGxKaEzh55Z5P2rcaSjAwIeWnLHDCPSOJ819/4XQEtPfbZs9eymDwNOg13kZhadSQF8+zht
+0Tko/9k41bNaT2ZqogskrIF9oltpofddqOa5IcE2d13T2IuDkV8/whV87P8Dg6fmFYpFCHN7zsks
+X+IHrRIt7gILXPwecu2LfUZxdH/Cr5WbfMzTnsWWSB7/Z9MLrlEISHM4zC7DlkbRSD7LyXyI4weh
+HNelf0uLtYRhXku5BkJUyysIYDpSHHxsMJ04Th+RZ7s8seoLBeAn7gbsj3B/JUOxIaEx8+W3bjb1
+wq6cc+KqLnvcO2BDvH30PfeQo7YjTNr4wcEoUFZXwhTL5owVc4GKtlfl/YxBXs2E6r6l43svlay6
+vCq58xTvWzzRtzvb6oh6qnoMP2xc8YTdpKma64TBmnFOVE/eGXZxVyk19TXwrokqUliutqhM6acv
+x87+Yru+uXTbUpMA0MuW0Ch6uvcwxmM1hq5vHDVBTAfGuXsdQMapKoqseFUfza7N2eSgU8oaJCGQ
+rmhvDn+MNzh2VyLOnPBwJ+sUnHM7XOnz/rCD99uRhhssEwZ5Xij+FG3EeTYyntGp6Z7ODIazLHM8
+81QtQDrJg2EDJ5RZHHrPbyUQDCkGpLZNOOoJkAD7I0VZRC3jJb8lTMXdKQjCd39F842+FXTSvOv9
+lmEOFH4AEyI6CokzFQCD0TXhTaG9wtzaE2q41eEKF45J5vyQxrNabZXeovNIVZryK+N8ep28M084
+vXp7uJm0bg5NunK6vTIqsxenQZWvXay8EwYLbAm8crDxK5sbW4tZtNeVxPE6ekCbifdxdgm0671w
+rt4wOzAfMAcGBSsOAwIaBBT1C0A3jyKtjUTFASRSO852mKBZQQQUqy721AxhZ26s5Tsue4OHTjEB
+CxwCAgfQ
\ No newline at end of file
diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_selfsigned.p12.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_selfsigned.p12.data
new file mode 100644
index 00000000000..e64b3b4dff8
--- /dev/null
+++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_selfsigned.p12.data
@@ -0,0 +1,30 @@
+MIIGqgIBAzCCBmQGCSqGSIb3DQEHAaCCBlUEggZRMIIGTTCCAwsGCSqGSIb3DQEHBqCCAvwwggL4
+AgEAMIIC8QYJKoZIhvcNAQcBMCgGCiqGSIb3DQEMAQYwGgQUUP4hegRsRe3D47D9wFdtUJPjXWoC
+AgQAgIICuFyN2uPW1mb8YCey7P23VZcfAkgCViro1vkX2cMaqEQSUe182bGeGjCDMUM1ld8XYqCO
+kMMuCeff20A9En52Wpm0zhuvcaaKxFR9Mn9X2/bNJr0Oig+P7SGTO/gDI+Z7RkhjJWra6V2Pipf2
+dDBYB5dTqiSsdBEZfxPUvXr9NXfYqM+sLwv6ewTVcS9dcK39fKVPBgDS8g3KGaoFSoQkEOMm62wA
+Yh8dbkJ2VFphCCKNYtLW0Z2dIRjhfLHpfiin48cyscsHNF/Q5PwqZRCQ8hLgvDdeAglueAkufgRy
+dKEKfOsdBKpUcVbnKE1zcWg/EK5oNadC14BlBFitVtL9bSgvxURV+ht+jdQKSfsvIVseW8TiqFLF
+RAtxB+Ve0CdWGhcdlDSt7QAxlr8pXrvHwOqlBDv31uueivLI20sfXrvxhSRm5mfUuYZQGith2VGy
+4nGDbHGN/Wp2gRS/FZR8mvKgQVZOshBKKaYxmOBxAtAPnkpKdcHhZ3ZMmTuQ4gWIDcQG4QkCTtpu
+kcnEdPT8MturNaN+PHTG0La0zlX92+kqj5rnpNzBfsBNILkCTqs6Y5Ltknt+wmYQokMhoLPKVMl1
+uuV2PyQioC6v7fold64k9RK2t9aiCgK/NOVaG7imS/1LhFTYeoMiji/pkxb4dL7rSkOUup+v7e9D
+ltP8hf2rLRz/QjQcps5+9wnkLPf/af/zffYZqnrb4JhBzya6Y837ctq9G9ZwBhQR0eOKuQsoDE62
+FMBTmvztspjdc2r7I+7/bcZoxDA1GVq6x+ILvsHxPkYbpK+YimtDzdFmly4QZ5t4ePBN6JoSkQnt
+M2SW3A24K5xY8fBppPnFbfIhitReM24sVFW5K1bx8UmnyY47vYaQNFQy7fw1q3IaizXTguB93Dgq
+M8h4ZUUBQqIX88H792fjYoemXzCCAzoGCSqGSIb3DQEHAaCCAysEggMnMIIDIzCCAx8GCyqGSIb3
+DQEMCgECoIICsjCCAq4wKAYKKoZIhvcNAQwBAzAaBBTCjW7ZwDP3oZ7PWO/Y+KkqVWjAZgICBAAE
+ggKAYqCnxT6KcqqKgzicaVUOn4xxf3jyOTpLwmExI6pPXE7Q6/8iCnikVuVYgb4PynUlxeI8TGqr
+N9rQXZF0c3JJ/jDULWpW7xUqw6DjWUyO964+eEd8FJK8IpOaCVk96tCSVFVIqHCJbeQwuSsa9Hcq
+kLY6xtkGbgCJxYmXGsd+KsasrkybJakFQO1Di0iCzABpoLF80/OYoZJsoFZp4mhKuERoa0zW3K9G
+fZXzrcFN2vcYRZdi6RT2/R9sxUMA1bOdiP4pKvEiT1QrFfjoz0a4tRbL6JEYuPVq4+xKF63p/edl
+zFTmrz2nqwC4L1VTpl4kgfIqeaw8vhPYGp7hV/Ve8h0tQDElH/oCsdpaZIPMnzwpKjpyPUpZDhjA
+aF1I0CtYz9Tx7Wcslaz6Lq9WQGDNUWggxorkoQRQVs14Jmnhy71qA8mY3CZIzpFffl5CGfhyGIcb
+om1vSkZnOK5afCudxUXowZBVpys7MotOLjXOO3QjMnmkuTMIeD5gCZx5jek1t/wMyrI7PZdHrZRE
+EJfUlRSRq6ffeePLgJHR0f+EkODSnlk1/lRXj4qooG1AlKlLNJxxSWqBcOBGriopGnCdVj9cQkL+
+c0SbEOD1nXoduV6GwYlRvzjyF661z1HdbyiaBL50Hj0sbhSRn/wuTZE9Z2aEwLFoMtZaGTYtjbMi
+ttB5y7PeGZVA718C4CPynyCQNI7tsKwPLuAYTI5z6P6I59YzjcoiQMTxML5W7R2ZXASqZB0vraP9
+rOm3URCG/bzjQKIeAiX9I5VMvvq0pRuCVBaqR0KlDPy+WZoVwkWQRnNzXj87x9T3phLRkFwxSpSs
+VlvGCExDnw4INW2u2ZkDqTFaMDMGCSqGSIb3DQEJFDEmHiQAcABrAGMAcwAxADIAdABlAHMAdABl
+AG4AZAB1AHMAZQByADEwIwYJKoZIhvcNAQkVMRYEFOYIZ9PqvN6hlfl6g8GMzQo7XZj3MD0wITAJ
+BgUrDgMCGgUABBQtKrQijA4rEmoRg0DR9g4gUVdjzgQULlm+rQqDvJ7th6v7HBOlOlMwoJECAgQA
\ No newline at end of file
diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twoentry.p12.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twoentry.p12.data
new file mode 100644
index 00000000000..9d58b00fc26
--- /dev/null
+++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twoentry.p12.data
@@ -0,0 +1,69 @@
+MIIPUQIBAzCCDwsGCSqGSIb3DQEHAaCCDvwEgg74MIIO9DCCBoMGCSqGSIb3DQEHBqCCBnQwggZw
+AgEAMIIGaQYJKoZIhvcNAQcBMCgGCiqGSIb3DQEMAQYwGgQUaHSG4jhu/7OMwM9JSl+8BZkXS30C
+AgQAgIIGMJfHzGw/x2vtIsN91neZbEGRQyrmItZnrHIjaNtTaJDyxrd5Qp0aGxNrVzUZxxBlqntn
+sVzTKvtH5YsRBJjKrx+kX39Avmh8UWDKi+iPIwjpqdIrk5D9DEg+zjn7OFwL5kS/wwErTFbes/t/
+fobuWxJZjEqzbQNimbkdh05jCQTCHozz+VoBvkeEyssmZGrghgi5iLBH9Yrlb85YsQSfcO91Dl2/
+LmtnCaMKDQ81cwofRyptbihVelIRSUxLkskOiogscBzJM68ihvNSsd8QaeS0WPbfw7Tic3nVLpUd
+wxcaVud8b4OAxxyGL8rRnWzlAsZy5udKv/790DyaOmqlA3n4wAayJII8pRtKhXsHhoA5I8+quJS4
+t/Uq/n35lWpczI/5mKWAXEC+LdScVyGC+vXxhcfB+EO5UgfLnus524UbwBA9MLV6jlByUZO8Vj6t
+cPcnRaKfxlMcfOPGLuzLJh7/NwOGnSZTtdHqEwQkV7GPV3qgZxHX2r+LWIQ1ZNuoCBBgF+neL9MN
+J/wKwXQQtfyRIPA1do8HM1SpujvTlG/ABOiTr0ZDuRW+AkMC4acxbV7G2Cllx84dRJiIQlTUgJy8
+NYMJGAGH5gpJezdNQD6wimRiEGIs1yIne2Wc9dPE9y1zKjpbeeXoeepWGM2rYZMJVJSufq0rRKr/
+3C5+TyBu0zLigiMrNAhqakPLV4ma3ktpgtigcLAa1eS2USpy/eJboGbRqUFobFYuQk9td4yfdmJM
+0sIpeRomy3SWypnJ79NOewgOJKba4Ye65kVHNz2jAFL5R4z7ll4Iqn5h/ylIi6RqMMMWf0hBr9yD
+bV5qjuwZGltv1zqTJ8cPjUWMk+UmbZXcsA9W7CnVdGPoWYCT0SW7IkUYQSs0QW7VTReA16KDSoEL
+3ZRIGl7KeDqGVm6ZH8zIE0lOVFY0R/2XuIcPc2DNV3UWs0Puous+j5kQgPjF1YD1r9VT6DeMPECZ
+HzBJl6a4yvKjm8hXyCnYPnxbeAZJUXOmka/ST1KVUHM499/Lii8/emHTFC/28WkiaLHOUtCegJgx
+Kp/eq4RAqYbHe5oUdS9xBaxZX97T0o10udqT6BKep6K/rBKHJxXp3SMuCtBIrcswlojIMc2p9fwF
+WVKSZz0zT8rhyepHI5j+IJoTauGYRD46AqSA+6EXWm0bO0oEtBuFCOVeBZJrJMseNxVLfGJOZYtZ
++9ixo9m1+WBV1kGxp1RAnTWAidd15G5sxZ9qhKK9iO63hiWFGmuOiWUb2kUpBOjtM/IRDhU/Q7y5
+gvbnhVbTZR7hr+gWyIkpfOBQG42SMwTuqImGpY4yFc7H6NZSYead6Fp4GfUmLLlDG72d6Ue4N+c8
+K3DTZYL47LFdXyvMNSuumRQLx+MGQ+DYzZ56uoM9R7B+34Joe8BeJa7bg0vA3Mj9CbZ3+yvYk8TL
+UU60BRda1AHwiSoRrLqgeJBZh+cyQB7e7EPcTO//iTPpFVJ8yst9IGn34AndyYULaPpnljMCiUhu
+X+zVATaxDMGwc++/95VHdeGRLhb+C5qeSqcPrIdV8XKCd53lgrAoZD1a9nym/mkCLQd+zjm+IE5y
+pnxccn/LoFrBm8yf0A35rm+A4Gl8gPSq2GYwu7zfEjXFiAlYrCsc5trQ9YNSGOzbD2BMAn5xxrob
+pQliw72xBt43e/VYCWwnLpgKqOfPfX18moDRK/kGeMPe/xtZ4rOiXbm9SEuT0pIFIaoMmilEuEI1
+bP2QC/GN1DgBMlV+FRAhWJ+X/NjHjB/TKBMsESyp3ShhCOum112eqoOxk0O4Ob6LVA6Ay6YPtoVX
+WhFjebHif5UtTtqd0u9jIU0J9UURkViLEzYN7/3FLIrlmntW35KhEYwCW8FhuXfFfbMHunw+zNoj
+ioaJtktg4TqRAXEFrSLIFy3VrsMCnNol100/EU+fqLtJfB9tvAx5pjYzUa2mfFiaoSliBRYHFy/N
+BzaXJ2DpFSd+RRbUsrLju3+vljTqtFEkhHFhMG4lgYxTAscqcoUAYfecGGhqL/wYDzh8V1WBDBGq
+9UsABqQd4EoqUX01/Driawft4mozRmxtWnTmrvXSRPT4CJp7zCZeQMPrlMKS6+gXDU5MljCCCGkG
+CSqGSIb3DQEHAaCCCFoEgghWMIIIUjCCBUcGCyqGSIb3DQEMCgECoIIE+jCCBPYwKAYKKoZIhvcN
+AQwBAzAaBBQ4eGcrDBrmIvtj/pYR8qK0Qn77ggICBAAEggTIttxjYbbyyDe0ikO7pUOYY2lCBLGX
+Z3Mx54Jg9fYmSCGv7aWubwkixV+tlfWjRfGrpaMLNfJXzcbkvso/H0Fyk1oVWLkhT9DrPWRjMYWn
+aZo91EKMvuu77RPzXuEVzNc5dSj01qEURgokH7WUh7Hrsp6Ssuuud+d6a6tCAwiCjLKZQiLuZ1h/
+uGalDjtM2yJVo2bZWt6puFt/H8AMLdf8HCREQ0Cddg2PG4EyQiUuzIQEk6IddPKhguWR350YCeoU
+Ywx4vU6eVFYZY0DX889rXDi++b975GKoWGd74Kkt+CXrOIuXHCzmeILFouc1Uh/wwIYkgT0ClDnQ
+749jKxcFG9tMkqE46POK8BLiy9V2FioKviumdiHVAMOah/sH7Ykf9QY1Qr//fHmaWRz1j966jaow
+L9pdQ4v98qRSa7EUJ70AD/wK5Xajtyh6QnzW/OPq9HGIBhcy+PjP95S0MV5TG7OIXBVwgw86wp0E
+ycpc2Yr0LmNQP4PJGaN0ECQm5/n886tmyv6KAMlxrzziasYymUNhY4ima12rjVN9wcNxq8Sghq4k
+minW3dO4mAfU9gbvZJ1RqPFswBFm5n24zJKjzrO2qlu7tLx6Vkck3vJI3UuGWWxUBsVoHd5m1ZZP
+5qrJHeEXvQuxXlyKaY7cNhk0yR7EDYC5SpUroTvVzWe1xYpoQ3ZyDKxCQ23l6jaovHJ3kQz450z0
+W59wD1078JlpTwYHsx4TBilabTcZku02uz8PZrFdPl2uJgtkgY0YyrQfYDK88+BvGWl23mbpRCbb
+9pO4dxFW0lqJ112EOXECbDmkCvh43NWvr0VqsJUM3xWsKKb9xpaNLSpcK32/BL+ZTQg7ec5/xx4Y
+FN4yHTd6YSDzKYHQI252CMImL0HIAC7qOOCftRDEswv6xKIn6TEykCyr08RcTsnjfjzH7HIsjhxa
+anv+xXosLZfCN9/RiRXfUb2ayRF2fdQsTNepp3ECiZlhMxfKO7aSwXnQzFyB+F8axEOFBLMEmJxC
+7ugz5qDqUOqiR1UNQfpz8fWXGZ4e+GLr3PblVR+CyGCDibZedaeDVXGG3yx2/V7DsYUehJSDz2DB
+C8KwWMHetjDlAOXbaKcZ1QhS7upnZhTCwF90JllIZtfKPS4VP9uyFecMc0Ocoq1zdB954nzX2Iyy
+t4l8+WWHH1Zb4EY6eLNNy1/wUvngGXqyrUDAocZKk/G8Hy7UPXrSWo9hGRiAm86WeokJjMKHgOH9
+lFg7/B1YHl2rW+E1JCAu2xAEJM9HB2+x8OFL/VBoxQLHr/flgGwCkOD62Oy/psUSL0ZQ+hM7qElW
+y3+KlS01t4icC99/r4oyA9poAx0EVfSvffi3Nb3Et2ryYRG7kmjMoxvDVpmrAKopnePSE+GAjEbG
+FIOli1ewzkOjcLZrdfTpONWfUKJB3Y6AOi7aV4N+wlrMrgAtlHSuDZ4csr1SnHctqpas37CkMg23
+KCILn2XktsGXN5AyCmPcmZI48w+8uO4OTxOdK2qIbXrlNaL1bFlHTt9riehDyHD+5LR4zB4XL080
+IA9XkbyR5OxdWlcShjPboOvGxMZeoTwmTYE23kCgh0zx0jLhb3bo3jnu6K76h3oPaRikYA5KBob3
+L51vXtrFMTowEwYJKoZIhvcNAQkUMQYeBABjAGEwIwYJKoZIhvcNAQkVMRYEFAxeTobq6DehjSbi
+ylxISkcqQqH6MIIDAwYLKoZIhvcNAQwKAQKgggKyMIICrjAoBgoqhkiG9w0BDAEDMBoEFAZ8kRRQ
+C5cLg1CRiF+Lgzkl9aD/AgIEAASCAoA2KwrF2adzCcInax9pPRso6j4h2KcNgrdsxCWhz+DWBRCw
+pOD6uitzCdyeLEMXN95Roqf/XxHZ6n/VKov0U8vgvKEU4RSeHsUQ6DqjrL7HpEhbM/lhfHj0vaWc
+tQQCTslHdwl4hWajN44Yv79zMHjA75/n4JAOvtnsyQrF0+44/yA5lFYLZyY4ndbyqzAPo0ZQD6PO
+bT8uyH/KbUAi5Etri47ibD1++EDltb45ctO8xA0rFIV25tL/AOG/YajgLC/7QBLTNgvMZ7F2rV9y
+qYmNCTdIDzaUIWg4+0qidqVeCPbrHHkqhti4LwOIQhBXesSTuBl1xafwzDeFQpADUe5Hc4+TtJGj
+gUT2gBR9dGJI6Wj5MRM/WGT/78UgbpYxG1Q7cZ6quILuzZjWQD+guHSCrhIK42dulowx1aTaela/
+XYcR+cRiQtLcmr/0FHfr99d0hJ2BSQIp9IhCsAkU+W7Py39jTcgU/HepzvpsLuPOxI+JL1Rb0llq
++uKaw9jCAy8yIGgplEXg5mhSPXXSDO8k+9CL5rpJvUjQSnLrhLKo2i22p/LIEK6S2uVnD6EdRMYo
+J/Vpx2ujqkPZfM/xsbAh04frXLGa2uAISDig+DH1RWlB5jNLRVbfgZA5/PjZyt6gz4lJigpXAVv1
+Z13EbEKrbv+CIUJOC+spz8YMH/37YkTW382gWrZkBgmQvZ6Gu5EeeFOIxXRNPseHyg+aY5vjQVyg
+V9RAg2sUDwh4u8JANq45dKEFUZfD8EqhVKyd4DuJ38AkxM5SQblQ8eygx0/bAVYzwN8ZRwxDB7Ii
+VD+LPthBp147NBgBw0ssNJYQ4GB4gBc7x3UXnyau5aDO9n6KMT4wFwYJKoZIhvcNAQkUMQoeCAB1
+AHMAZQByMCMGCSqGSIb3DQEJFTEWBBTuNf6QntPPWXHkQhWW+uEJ8d85XTA9MCEwCQYFKw4DAhoF
+AAQUk5iGX7naSu9IN6Kw+sU5Gk319ygEFAwa1WFGcSE0mhaX1jNiYWZtqQnSAgIEAA==
\ No newline at end of file
diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twopass.p12.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twopass.p12.data
new file mode 100644
index 00000000000..e26169fa7e9
--- /dev/null
+++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jceks_twopass.p12.data
@@ -0,0 +1,45 @@
+MIIJzgIBAzCCCYgGCSqGSIb3DQEHAaCCCXkEggl1MIIJcTCCA/MGCSqGSIb3DQEHBqCCA+QwggPg
+AgEAMIID2QYJKoZIhvcNAQcBMCgGCiqGSIb3DQEMAQYwGgQUt/45tX+NVmWByhUTxlYXZtkG23wC
+AgQAgIIDoHK05qRAikt4Qf2pBGjBl1KH28QZEqGHygCfUpdGyou10RMbkeJ254HBhdRGQrkhLva9
+RPC2TDQuFY3RWqy/we6TvhWyq6T2rW7wPysAL7Me9sJLVvekpWXOpLz0iye+/4qaJZCFsftnUKMA
+FttOkAfVr5DvfZjJYCF4AXnlFi2s5Vz0cSEyiOarrnXpGv0cnhVBkWUu09Afhvk9WnLoggYUIBeg
+w5d/RRj7qM5db1GzYAO+ZXaMGwoASbnZMjFv/drJFqvifToOkn3DHX+nGF55ra5JNBbzOckGplWH
+HCqqirmbguGLGf1RLoPcphWC12jQgEOnvoc+u+lC0+R967wFWhgGmC49UuCUVJSlkEl8hqwCYYb/
+T5pGW5K9sMHzzlPFMbCN3YlG9F9Upb9jFduOXXDi2SddyX3kFTRc5Q1CRea1fSm7mFdKIPr4W99j
+hWT4RJTVZzbsWTh/kNUSNgP+cgKGxthqaLvgiMnOeoT3uldQ3thvSrzJKrZWi0ykk8/sV4hpMwbn
+k3N24yDZB+FL1Buw+MmJ5PQdCxEoZa/Q6JahqWP/Kz/LSjOOgk4WdrJGx4cUwnrqCIgnHK+FAVD6
+ibdW2LG5w67FjMIGPS0nuFyZ/pwKO2jbgRU3CpB2XVwBhUZmHXgaJH7A68jGYSaJWc5ViGcJyeRU
+S06FeViECnRu71P32NelWArbZ0XlKXKAwHse+kWUi8xuttgXas2KQ8Nz5sRjv78vqpC9tjDSkGUk
+uLhJwRagJHLXltOYbXgH3CAhXhk6yTo45ytgwOV9GWs6RCOVZaMM942yMwQ2RR33MsF+N1NFI5bQ
+5PYkGy0zGsvjqlT9iNE+u9ZcUMKp5EHI2BLrs6+41gYaaMTddB/bfyTcf0XIhAqeiOlz53YgbolO
+i6DudU4lWyvz01T7zcl+J95s03qf7yaCGkAhetNg19ETxmxQSF5yBLZPns0CA9M1RzeM7qelj7by
+3OqF8lxl6H//ZBuPxRNNuub7PwctPULDieYNWZA8kAn22utOVlCBsZHZ/CTUQCRM/gVm3QQjSUMw
+oyK4Ijf2LywzHVuyCkPXAKSHrxyk8ecTwSWDmzER5uqgevBK47oOXy+nuxkC9tkeLg4ZqeWrRUGS
+p8iIDNTaIrlVJ5g6s7hOgHDsPFh2sw5tGg4QkWw9SWcKkySCg7jg2Nh+0dTMzTG+yFBx4qbG5D9t
+P4rtstIGeyZvjEW4DEiS0WCZe6SFcFgwggV2BgkqhkiG9w0BBwGgggVnBIIFYzCCBV8wggVbBgsq
+hkiG9w0BDAoBAqCCBPowggT2MCgGCiqGSIb3DQEMAQMwGgQUadAw0f3PDGS5mrzMd1JZRDeJ10AC
+AgQABIIEyLWepBjU2whnDqOcH8u6Cc/+RAjsz/laSR9SkSOsd1Kn13DEFvfTiwcvkphQyOFK3w/L
+cv/ZocA9Br5FQdMcgmUladwokZP/0f9TR3iacf7GVAI7J3DEXiN9fRpljG/oU/+YoHEjo1i8rqEK
+U1AhJ/+t8ABZfrK8nnu6mD0vJDdgslQeky5bqzYHyvf4C1YKYXZIhG6Xcl1aCR3NAZxmhlBeYZeW
+0doiPeHj0GImWoA4ExMrNkNTDwcDXEpPzpdSWuM4DuoaWFrcFJG9PFFrN3/Rs1gu1UP+ZtkGoBNA
++RxehNGCLMFuPgFvnQYRvnYhuYTB/mvbkOyfUSiRr3CpdblH2nmdsQBwUUOh7Vp7uv8pJwoFui4A
+09T7AG4sK1YwUU/d80cZoNh52LdEBddNWrVINPxi4Pb5id0bvvr/CbjZCPwPqrFw6wNAmWolDac6
+kibaFQku3aWX3W6zW+J+zM2TCpMIGcWsiMNgBsrHL54FET2QUk5E406AGiNrMTMB3yHDV+C94KU/
+LPSEzuTUXmpWQcYrjr02afkmkwgSysQq3IQA8LuMzapGf7fuA/RxSILuPcWw7lCWy4HmVn4uiKLo
+tGyxfWrnXZG/9tMCnm2hxpbmP2BYbYck/vgDCxDhOmptHM7wUjs3ujhFmwp5x0A9BAU8WKuJFdPC
+aZ8hjkgvPaVwtFhEScELSQh6iwfHftAS0jb1NfvsaPou3a4KQ63pvMuF4Qx7b5Cq4L2aBqhvgRqp
+kinAJfAVr4vRuI199KnADlH9YGmOdrOVJ07ru9dtisH4t+zo7j8lqqcqhUstjUVcmFf6LlYPKsOG
+yPsaMTg3DfIYhpWlV2rd9DXBBzNgz4KW6CEujxCSBLP3VSQQgA5xRBROPw/uBq6isBBkuWZZy9z3
+GS0J/YtZY99Q9BfK7n+vythB3aciecySnoWYS1UB6m2b+F4xMmab2P8GhzzFsyUmAzNy1mQHGdYe
+eHBKA1CunIvICiv95XRAplBSIh3KHEeaCwbKVhNJYmf/xTmRBiTtVEgLKpxSQMVh+Lax6rmvVMcu
+cb3klVE1n9DILVAkuW3uxScLDS1wQyGWdGu1/2vU3yojus/kw868+gMzvszc704XDviwgQblYe27
+eOdpRB8oOK63o/dY5cDSdEYhjYEVlOZ3eriZ/FYW5WHAbR7PuM1EYfVUy/5XGLylDutaA/0klfu4
+Lhs4Sptdt7DifBI6R1LAcXu7REbu/r+Xhxnj6ik27oMitYO2PG3slnBEzj37Hc9EOGvBbuB3Fn28
+oRs6tAFilysj8hrJnHVFbA9OiNa8sdFj797n4lvlYv2ZMMUvJpg0hjInkTG0vkRhQbzszd0URUK0
+hpGVADFlwsfAWKoNAO2YoBmNIILSs8Sgogf5yuRvZBZPKRxQffGp9UjRpe2TiM2EZfHhgruyvnR4
+GfZfY3oHCtWA3DmQZYfQtwqeo4N4gA0Kwr34VGSFDMJxmEIuwWZYRL1sZXyGUZjZWYhtrp25vUn5
+uXrzhsi4IuDbAV5QlBi3NAC1uRfcZrn9OhGT/Q7LK8M4z2WL7gui5ULq+a4OvDFdcLdej/obWRip
+X20CW/bWzctM2dLUFWwP0xdv9wHAMDpnrOHVWF5gRaWjFjFOMCcGCSqGSIb3DQEJFDEaHhgAcABr
+AGMAcwAxADIAdABlAHMAdABjAGEwIwYJKoZIhvcNAQkVMRYEFAxeTobq6DehjSbiylxISkcqQqH6
+MD0wITAJBgUrDgMCGgUABBReCaXcoIK8JTMwigEZzYPfmYG2TwQUZCjIEn2XZ9poivqAwEKWWmB6
+1QoCAgQA
\ No newline at end of file
diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_selfsigned.p12.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_selfsigned.p12.data
new file mode 100644
index 00000000000..362a88ef4e1
--- /dev/null
+++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_selfsigned.p12.data
@@ -0,0 +1,45 @@
+MIIJzgIBAzCCCYgGCSqGSIb3DQEHAaCCCXkEggl1MIIJcTCCA/MGCSqGSIb3DQEHBqCCA+QwggPg
+AgEAMIID2QYJKoZIhvcNAQcBMCgGCiqGSIb3DQEMAQYwGgQUdVPZ1PqmiHSzutary6nkrMZutmAC
+AgQAgIIDoEk+DNlnRZfSrsiS+4naiYEBlkWcbxVIxDlsUhkj/GzhyAl/NzgHT31YhGBPADFWxLsf
+dMykYBWbnErvqAb2Ej/2q3l+gXehZ8PxjeXYwQ7uuXunwxrq8AayX5ofZyKw8RwDRsUYvIm89CRN
+FWIwXThrRWHAMaQ+ySINhspOeq2liuracnzzeG4EoZyE4bmONMMbsOJOTOnQZsc3Hw+SC7+vIV/x
+QnQQHY9bhsG8nxBfLLxd+JKerXRAeobkeufYHm/Q0iFpRtVad0FkMyWViyBjlEaTUyCXvZ1f27Ub
+hzPPdMj9mew6flpJorqemMKFaIMiBFgNvT69BNto9n2tgoU2mGkM0r9pqT51F/TsdbVouhmcqi+9
+NWjJVO2bTvh3s/Q3I5Y5zFt0JaqznVVUMQMfR97RNdBWJmdWjTFaDmQwau2zaKboeDsDpgl7cpko
+t57ifS5+1XSy7Vwh3H+eTaIrmMeNPpnAFbfUMIx2MHMqzG3tQg4zXn6L0+os2BkyLvjllxWZ8ElG
+tNz0xJMde8afhnRRwLO489Pv5ZM6IW+SLVVuNHMICpALQUxKHHrVy75YbqGoD/cmfvHgGcTZBAL+
+TCCtppdexzH4k4cB1/o+rI0ksKyhIPpNoLRnrKZTxEJ8MWYXvPkXJhgaz27fxAdVX/tkaSDSgz8M
+tp9WgUUx3oet3vjLsMUQguUTdYfB0nSpZ33F5ZNXysxLsUYH+zYwcCyQi2s5/CI0tO/SA6onQOFP
+Pt5ESInsucCJgTGAmY31r23BgvUGV0PCbj8oePAErgb9se5TqPyRMeDa7iPhB44Pm93bxr5BS3ua
+zTBzbgsPQNAmlNAg9LKWj+a7NU5s6Rv2y3pAH1y9YPih9nlGOoeTlAn7J2Um4zfrCP2GWpR09ODt
+ZqElzhbES+3sr15G8u86G0n9j9m1NI8+SlSKj8cvsTfM5DAOGWyJ91YF+GtVg3kGQCHA9J6i6FTt
+dPdO5eVoKLck61vGHd3n6xkmZtkTI4Rxr1rJvNFzwjiFadIKAy7PffLVlqUucgHW1kF9poTBg3h3
+2Ia489bsahYdg77xEzuIvVIziOyqdYDpOSq7BKCHaVnglRBStPUMh9uA6xZOFOgbJPGNfJMy4LdL
+PbHVXTZ40iqgq1tLBl/8y+HUsFqanBpiuEa6taZ1Da2AYp+Nij8/x/DL+7/P9h0r0ehFvY6DUjcR
+pFLIchLAG1HeqK9yt5ivQJG+f35oU5cwggV2BgkqhkiG9w0BBwGgggVnBIIFYzCCBV8wggVbBgsq
+hkiG9w0BDAoBAqCCBPowggT2MCgGCiqGSIb3DQEMAQMwGgQUUF+8eSim66TyIYKiuOA1HaaiWxsC
+AgQABIIEyHbI0EKVq0rIxePLGQ1E8v8mMIFS1DdygYqZk1DGnROuF7tvDJLZypL56RQ7WSgFHG36
+z7nUteL1VL/eDtVNgPQYE5wM1M9wlMFJjPeIe67DcnHq/1DXPMHF0bCeuPRNxvh5qYQ5Spk962pN
+JHhxoxZgU8Po2uWC2+YfAbOV3se4BlAWQtxRE5dklsTr2BuydagNzC71crRDqIrhP5DzrzaXVkWJ
+MJq7iqfX/C7Zwc2Sm10/dCaS+7O11I5cz96ChUJv2CDT6lMvQ/QHvSd4+igKGUemYQgi5LpFUFG8
+0iqUxhJ5BWHT7A/a9L2TXzxg8PfBlUbSRAejG5Bg9IFuec/0GIvPV9UtnXU+vDQI/3XMZG38uQLC
+Ro+eIClTYUG0mw84XxfiYNNkIbT1CTDNNpXV07sEm+YzSEhmHjuc3y61WkBlCvbyxDEZDTEM2YuO
+ZdxUnuy7QdI/87uvyyI3TSWSmKYdPqcjvJ1puhfvg0cDJTDArDTuqM7RilH6Wig/tRQSxFxVBKo3
+Pok6ZZSeXyyTm6S//mEdU2GRFh6PXj0Tw5XRa3KfgxMXL7lbHcOsP/qk8dGBiIA/LaodPFLfcWQR
+aSerAlzmFpXt7+Tm2v4HKTF+C9iPv2bj4RmINQ4PtAgpPfbIv7PCksyVlUWzi8l6FZwn6CDO347f
+yXxaZIeAtMUn6IxmPMm2JZyJE1iJqrj6YVhGbRxAdAQ8I+vSLQ7upcju1Gysv8w3jO/MoJzsRkV5
+3GYbq06rkG2gAmk1A0fjAP9oVLvyMYXRcrKd/4aKdK4xJkUAxB+UlPp998ESqqZ9hWfU6YM3TCig
+7rp79lHJW3aM31uljLjWtWbJ/+Xr/H7Vu24PDjuN8SQL+IMWSP3yaApHSQ7YGNXmtoDID/Wc8PHT
+T/1LL84MGmwIp6bXbvkDgEWB8nO7mm2V9y5GozOzgk5fQlH+1/6WjZG6iD/knTkMDXv86m4P/23/
+YfUM3CbWVcstp2NjV1Kdc5ouylhrBe74ZIS7Wup53w6nLJ3LYi2uidyO2p/dxbT6QeE09Prrh0lo
+2gkOPh32F0utu6Ugo6Q3DiriOpY97wpPJnBIVTeg6Er1A03lbtoqTMqIjLmQoWu01POZuTcyrG2w
+JE356t2ULKtwpUUc7Sf7tho2DC4GR1bqF0xT4Hv47pD3RaAx4WRRRVE68EgtzrIlsY26nayH5iDA
+ncm0+i3k7DHLXm6EhcoIgjvEwEehN9Boc2BbuGrduI5/LN8vUtKhVloejh8Hr8X5z9qvHsUq3Thj
+9VcLBp2HOgnwBrVodhrowE0W2fZ4+OA7GfWw+lVFuCZW4C/V3Ubj6iyh6V/Y8wofZlM1Y0H5tKE3
+0fUio/bUxwyRM9OZBin5j528FRvCZH7PsAjqxztW/VRJ9TDP0+gFFdJMhAfiekXqpSpRjPhTaSnw
++0srFo9NGWMsYq5DsfKHbaoilaXu5TUp31+GlvohouLe0ETzOQApknHKYpnBtLy5E+WzjKv8DCLX
+Hs7VpbSIDtzEK1l2F1T+4HVDBD2snXp1F37ytZpn6J5Fuze8LrJcLXjahLUGwXcBDB+LbVYuMJCH
+yN9zYhSEv4PbiRq8GoqCW+Cw9R3eW87jRdPwWFewx+5MLzFOMCcGCSqGSIb3DQEJFDEaHhgAcABr
+AGMAcwAxADIAdABlAHMAdABjAGEwIwYJKoZIhvcNAQkVMRYEFAxeTobq6DehjSbiylxISkcqQqH6
+MD0wITAJBgUrDgMCGgUABBTTmQMHbBSL6ICCYs/pyZ2E/j2QsQQUKqdbNdUe1p8Hmn8PmLHFQxRr
+xp4CAgQA
\ No newline at end of file
diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twoentry.p12.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twoentry.p12.data
new file mode 100644
index 00000000000..9d58b00fc26
--- /dev/null
+++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twoentry.p12.data
@@ -0,0 +1,69 @@
+MIIPUQIBAzCCDwsGCSqGSIb3DQEHAaCCDvwEgg74MIIO9DCCBoMGCSqGSIb3DQEHBqCCBnQwggZw
+AgEAMIIGaQYJKoZIhvcNAQcBMCgGCiqGSIb3DQEMAQYwGgQUaHSG4jhu/7OMwM9JSl+8BZkXS30C
+AgQAgIIGMJfHzGw/x2vtIsN91neZbEGRQyrmItZnrHIjaNtTaJDyxrd5Qp0aGxNrVzUZxxBlqntn
+sVzTKvtH5YsRBJjKrx+kX39Avmh8UWDKi+iPIwjpqdIrk5D9DEg+zjn7OFwL5kS/wwErTFbes/t/
+fobuWxJZjEqzbQNimbkdh05jCQTCHozz+VoBvkeEyssmZGrghgi5iLBH9Yrlb85YsQSfcO91Dl2/
+LmtnCaMKDQ81cwofRyptbihVelIRSUxLkskOiogscBzJM68ihvNSsd8QaeS0WPbfw7Tic3nVLpUd
+wxcaVud8b4OAxxyGL8rRnWzlAsZy5udKv/790DyaOmqlA3n4wAayJII8pRtKhXsHhoA5I8+quJS4
+t/Uq/n35lWpczI/5mKWAXEC+LdScVyGC+vXxhcfB+EO5UgfLnus524UbwBA9MLV6jlByUZO8Vj6t
+cPcnRaKfxlMcfOPGLuzLJh7/NwOGnSZTtdHqEwQkV7GPV3qgZxHX2r+LWIQ1ZNuoCBBgF+neL9MN
+J/wKwXQQtfyRIPA1do8HM1SpujvTlG/ABOiTr0ZDuRW+AkMC4acxbV7G2Cllx84dRJiIQlTUgJy8
+NYMJGAGH5gpJezdNQD6wimRiEGIs1yIne2Wc9dPE9y1zKjpbeeXoeepWGM2rYZMJVJSufq0rRKr/
+3C5+TyBu0zLigiMrNAhqakPLV4ma3ktpgtigcLAa1eS2USpy/eJboGbRqUFobFYuQk9td4yfdmJM
+0sIpeRomy3SWypnJ79NOewgOJKba4Ye65kVHNz2jAFL5R4z7ll4Iqn5h/ylIi6RqMMMWf0hBr9yD
+bV5qjuwZGltv1zqTJ8cPjUWMk+UmbZXcsA9W7CnVdGPoWYCT0SW7IkUYQSs0QW7VTReA16KDSoEL
+3ZRIGl7KeDqGVm6ZH8zIE0lOVFY0R/2XuIcPc2DNV3UWs0Puous+j5kQgPjF1YD1r9VT6DeMPECZ
+HzBJl6a4yvKjm8hXyCnYPnxbeAZJUXOmka/ST1KVUHM499/Lii8/emHTFC/28WkiaLHOUtCegJgx
+Kp/eq4RAqYbHe5oUdS9xBaxZX97T0o10udqT6BKep6K/rBKHJxXp3SMuCtBIrcswlojIMc2p9fwF
+WVKSZz0zT8rhyepHI5j+IJoTauGYRD46AqSA+6EXWm0bO0oEtBuFCOVeBZJrJMseNxVLfGJOZYtZ
++9ixo9m1+WBV1kGxp1RAnTWAidd15G5sxZ9qhKK9iO63hiWFGmuOiWUb2kUpBOjtM/IRDhU/Q7y5
+gvbnhVbTZR7hr+gWyIkpfOBQG42SMwTuqImGpY4yFc7H6NZSYead6Fp4GfUmLLlDG72d6Ue4N+c8
+K3DTZYL47LFdXyvMNSuumRQLx+MGQ+DYzZ56uoM9R7B+34Joe8BeJa7bg0vA3Mj9CbZ3+yvYk8TL
+UU60BRda1AHwiSoRrLqgeJBZh+cyQB7e7EPcTO//iTPpFVJ8yst9IGn34AndyYULaPpnljMCiUhu
+X+zVATaxDMGwc++/95VHdeGRLhb+C5qeSqcPrIdV8XKCd53lgrAoZD1a9nym/mkCLQd+zjm+IE5y
+pnxccn/LoFrBm8yf0A35rm+A4Gl8gPSq2GYwu7zfEjXFiAlYrCsc5trQ9YNSGOzbD2BMAn5xxrob
+pQliw72xBt43e/VYCWwnLpgKqOfPfX18moDRK/kGeMPe/xtZ4rOiXbm9SEuT0pIFIaoMmilEuEI1
+bP2QC/GN1DgBMlV+FRAhWJ+X/NjHjB/TKBMsESyp3ShhCOum112eqoOxk0O4Ob6LVA6Ay6YPtoVX
+WhFjebHif5UtTtqd0u9jIU0J9UURkViLEzYN7/3FLIrlmntW35KhEYwCW8FhuXfFfbMHunw+zNoj
+ioaJtktg4TqRAXEFrSLIFy3VrsMCnNol100/EU+fqLtJfB9tvAx5pjYzUa2mfFiaoSliBRYHFy/N
+BzaXJ2DpFSd+RRbUsrLju3+vljTqtFEkhHFhMG4lgYxTAscqcoUAYfecGGhqL/wYDzh8V1WBDBGq
+9UsABqQd4EoqUX01/Driawft4mozRmxtWnTmrvXSRPT4CJp7zCZeQMPrlMKS6+gXDU5MljCCCGkG
+CSqGSIb3DQEHAaCCCFoEgghWMIIIUjCCBUcGCyqGSIb3DQEMCgECoIIE+jCCBPYwKAYKKoZIhvcN
+AQwBAzAaBBQ4eGcrDBrmIvtj/pYR8qK0Qn77ggICBAAEggTIttxjYbbyyDe0ikO7pUOYY2lCBLGX
+Z3Mx54Jg9fYmSCGv7aWubwkixV+tlfWjRfGrpaMLNfJXzcbkvso/H0Fyk1oVWLkhT9DrPWRjMYWn
+aZo91EKMvuu77RPzXuEVzNc5dSj01qEURgokH7WUh7Hrsp6Ssuuud+d6a6tCAwiCjLKZQiLuZ1h/
+uGalDjtM2yJVo2bZWt6puFt/H8AMLdf8HCREQ0Cddg2PG4EyQiUuzIQEk6IddPKhguWR350YCeoU
+Ywx4vU6eVFYZY0DX889rXDi++b975GKoWGd74Kkt+CXrOIuXHCzmeILFouc1Uh/wwIYkgT0ClDnQ
+749jKxcFG9tMkqE46POK8BLiy9V2FioKviumdiHVAMOah/sH7Ykf9QY1Qr//fHmaWRz1j966jaow
+L9pdQ4v98qRSa7EUJ70AD/wK5Xajtyh6QnzW/OPq9HGIBhcy+PjP95S0MV5TG7OIXBVwgw86wp0E
+ycpc2Yr0LmNQP4PJGaN0ECQm5/n886tmyv6KAMlxrzziasYymUNhY4ima12rjVN9wcNxq8Sghq4k
+minW3dO4mAfU9gbvZJ1RqPFswBFm5n24zJKjzrO2qlu7tLx6Vkck3vJI3UuGWWxUBsVoHd5m1ZZP
+5qrJHeEXvQuxXlyKaY7cNhk0yR7EDYC5SpUroTvVzWe1xYpoQ3ZyDKxCQ23l6jaovHJ3kQz450z0
+W59wD1078JlpTwYHsx4TBilabTcZku02uz8PZrFdPl2uJgtkgY0YyrQfYDK88+BvGWl23mbpRCbb
+9pO4dxFW0lqJ112EOXECbDmkCvh43NWvr0VqsJUM3xWsKKb9xpaNLSpcK32/BL+ZTQg7ec5/xx4Y
+FN4yHTd6YSDzKYHQI252CMImL0HIAC7qOOCftRDEswv6xKIn6TEykCyr08RcTsnjfjzH7HIsjhxa
+anv+xXosLZfCN9/RiRXfUb2ayRF2fdQsTNepp3ECiZlhMxfKO7aSwXnQzFyB+F8axEOFBLMEmJxC
+7ugz5qDqUOqiR1UNQfpz8fWXGZ4e+GLr3PblVR+CyGCDibZedaeDVXGG3yx2/V7DsYUehJSDz2DB
+C8KwWMHetjDlAOXbaKcZ1QhS7upnZhTCwF90JllIZtfKPS4VP9uyFecMc0Ocoq1zdB954nzX2Iyy
+t4l8+WWHH1Zb4EY6eLNNy1/wUvngGXqyrUDAocZKk/G8Hy7UPXrSWo9hGRiAm86WeokJjMKHgOH9
+lFg7/B1YHl2rW+E1JCAu2xAEJM9HB2+x8OFL/VBoxQLHr/flgGwCkOD62Oy/psUSL0ZQ+hM7qElW
+y3+KlS01t4icC99/r4oyA9poAx0EVfSvffi3Nb3Et2ryYRG7kmjMoxvDVpmrAKopnePSE+GAjEbG
+FIOli1ewzkOjcLZrdfTpONWfUKJB3Y6AOi7aV4N+wlrMrgAtlHSuDZ4csr1SnHctqpas37CkMg23
+KCILn2XktsGXN5AyCmPcmZI48w+8uO4OTxOdK2qIbXrlNaL1bFlHTt9riehDyHD+5LR4zB4XL080
+IA9XkbyR5OxdWlcShjPboOvGxMZeoTwmTYE23kCgh0zx0jLhb3bo3jnu6K76h3oPaRikYA5KBob3
+L51vXtrFMTowEwYJKoZIhvcNAQkUMQYeBABjAGEwIwYJKoZIhvcNAQkVMRYEFAxeTobq6DehjSbi
+ylxISkcqQqH6MIIDAwYLKoZIhvcNAQwKAQKgggKyMIICrjAoBgoqhkiG9w0BDAEDMBoEFAZ8kRRQ
+C5cLg1CRiF+Lgzkl9aD/AgIEAASCAoA2KwrF2adzCcInax9pPRso6j4h2KcNgrdsxCWhz+DWBRCw
+pOD6uitzCdyeLEMXN95Roqf/XxHZ6n/VKov0U8vgvKEU4RSeHsUQ6DqjrL7HpEhbM/lhfHj0vaWc
+tQQCTslHdwl4hWajN44Yv79zMHjA75/n4JAOvtnsyQrF0+44/yA5lFYLZyY4ndbyqzAPo0ZQD6PO
+bT8uyH/KbUAi5Etri47ibD1++EDltb45ctO8xA0rFIV25tL/AOG/YajgLC/7QBLTNgvMZ7F2rV9y
+qYmNCTdIDzaUIWg4+0qidqVeCPbrHHkqhti4LwOIQhBXesSTuBl1xafwzDeFQpADUe5Hc4+TtJGj
+gUT2gBR9dGJI6Wj5MRM/WGT/78UgbpYxG1Q7cZ6quILuzZjWQD+guHSCrhIK42dulowx1aTaela/
+XYcR+cRiQtLcmr/0FHfr99d0hJ2BSQIp9IhCsAkU+W7Py39jTcgU/HepzvpsLuPOxI+JL1Rb0llq
++uKaw9jCAy8yIGgplEXg5mhSPXXSDO8k+9CL5rpJvUjQSnLrhLKo2i22p/LIEK6S2uVnD6EdRMYo
+J/Vpx2ujqkPZfM/xsbAh04frXLGa2uAISDig+DH1RWlB5jNLRVbfgZA5/PjZyt6gz4lJigpXAVv1
+Z13EbEKrbv+CIUJOC+spz8YMH/37YkTW382gWrZkBgmQvZ6Gu5EeeFOIxXRNPseHyg+aY5vjQVyg
+V9RAg2sUDwh4u8JANq45dKEFUZfD8EqhVKyd4DuJ38AkxM5SQblQ8eygx0/bAVYzwN8ZRwxDB7Ii
+VD+LPthBp147NBgBw0ssNJYQ4GB4gBc7x3UXnyau5aDO9n6KMT4wFwYJKoZIhvcNAQkUMQoeCAB1
+AHMAZQByMCMGCSqGSIb3DQEJFTEWBBTuNf6QntPPWXHkQhWW+uEJ8d85XTA9MCEwCQYFKw4DAhoF
+AAQUk5iGX7naSu9IN6Kw+sU5Gk319ygEFAwa1WFGcSE0mhaX1jNiYWZtqQnSAgIEAA==
\ No newline at end of file
diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twopass.p12.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twopass.p12.data
new file mode 100644
index 00000000000..e26169fa7e9
--- /dev/null
+++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/jdk_jks_twopass.p12.data
@@ -0,0 +1,45 @@
+MIIJzgIBAzCCCYgGCSqGSIb3DQEHAaCCCXkEggl1MIIJcTCCA/MGCSqGSIb3DQEHBqCCA+QwggPg
+AgEAMIID2QYJKoZIhvcNAQcBMCgGCiqGSIb3DQEMAQYwGgQUt/45tX+NVmWByhUTxlYXZtkG23wC
+AgQAgIIDoHK05qRAikt4Qf2pBGjBl1KH28QZEqGHygCfUpdGyou10RMbkeJ254HBhdRGQrkhLva9
+RPC2TDQuFY3RWqy/we6TvhWyq6T2rW7wPysAL7Me9sJLVvekpWXOpLz0iye+/4qaJZCFsftnUKMA
+FttOkAfVr5DvfZjJYCF4AXnlFi2s5Vz0cSEyiOarrnXpGv0cnhVBkWUu09Afhvk9WnLoggYUIBeg
+w5d/RRj7qM5db1GzYAO+ZXaMGwoASbnZMjFv/drJFqvifToOkn3DHX+nGF55ra5JNBbzOckGplWH
+HCqqirmbguGLGf1RLoPcphWC12jQgEOnvoc+u+lC0+R967wFWhgGmC49UuCUVJSlkEl8hqwCYYb/
+T5pGW5K9sMHzzlPFMbCN3YlG9F9Upb9jFduOXXDi2SddyX3kFTRc5Q1CRea1fSm7mFdKIPr4W99j
+hWT4RJTVZzbsWTh/kNUSNgP+cgKGxthqaLvgiMnOeoT3uldQ3thvSrzJKrZWi0ykk8/sV4hpMwbn
+k3N24yDZB+FL1Buw+MmJ5PQdCxEoZa/Q6JahqWP/Kz/LSjOOgk4WdrJGx4cUwnrqCIgnHK+FAVD6
+ibdW2LG5w67FjMIGPS0nuFyZ/pwKO2jbgRU3CpB2XVwBhUZmHXgaJH7A68jGYSaJWc5ViGcJyeRU
+S06FeViECnRu71P32NelWArbZ0XlKXKAwHse+kWUi8xuttgXas2KQ8Nz5sRjv78vqpC9tjDSkGUk
+uLhJwRagJHLXltOYbXgH3CAhXhk6yTo45ytgwOV9GWs6RCOVZaMM942yMwQ2RR33MsF+N1NFI5bQ
+5PYkGy0zGsvjqlT9iNE+u9ZcUMKp5EHI2BLrs6+41gYaaMTddB/bfyTcf0XIhAqeiOlz53YgbolO
+i6DudU4lWyvz01T7zcl+J95s03qf7yaCGkAhetNg19ETxmxQSF5yBLZPns0CA9M1RzeM7qelj7by
+3OqF8lxl6H//ZBuPxRNNuub7PwctPULDieYNWZA8kAn22utOVlCBsZHZ/CTUQCRM/gVm3QQjSUMw
+oyK4Ijf2LywzHVuyCkPXAKSHrxyk8ecTwSWDmzER5uqgevBK47oOXy+nuxkC9tkeLg4ZqeWrRUGS
+p8iIDNTaIrlVJ5g6s7hOgHDsPFh2sw5tGg4QkWw9SWcKkySCg7jg2Nh+0dTMzTG+yFBx4qbG5D9t
+P4rtstIGeyZvjEW4DEiS0WCZe6SFcFgwggV2BgkqhkiG9w0BBwGgggVnBIIFYzCCBV8wggVbBgsq
+hkiG9w0BDAoBAqCCBPowggT2MCgGCiqGSIb3DQEMAQMwGgQUadAw0f3PDGS5mrzMd1JZRDeJ10AC
+AgQABIIEyLWepBjU2whnDqOcH8u6Cc/+RAjsz/laSR9SkSOsd1Kn13DEFvfTiwcvkphQyOFK3w/L
+cv/ZocA9Br5FQdMcgmUladwokZP/0f9TR3iacf7GVAI7J3DEXiN9fRpljG/oU/+YoHEjo1i8rqEK
+U1AhJ/+t8ABZfrK8nnu6mD0vJDdgslQeky5bqzYHyvf4C1YKYXZIhG6Xcl1aCR3NAZxmhlBeYZeW
+0doiPeHj0GImWoA4ExMrNkNTDwcDXEpPzpdSWuM4DuoaWFrcFJG9PFFrN3/Rs1gu1UP+ZtkGoBNA
++RxehNGCLMFuPgFvnQYRvnYhuYTB/mvbkOyfUSiRr3CpdblH2nmdsQBwUUOh7Vp7uv8pJwoFui4A
+09T7AG4sK1YwUU/d80cZoNh52LdEBddNWrVINPxi4Pb5id0bvvr/CbjZCPwPqrFw6wNAmWolDac6
+kibaFQku3aWX3W6zW+J+zM2TCpMIGcWsiMNgBsrHL54FET2QUk5E406AGiNrMTMB3yHDV+C94KU/
+LPSEzuTUXmpWQcYrjr02afkmkwgSysQq3IQA8LuMzapGf7fuA/RxSILuPcWw7lCWy4HmVn4uiKLo
+tGyxfWrnXZG/9tMCnm2hxpbmP2BYbYck/vgDCxDhOmptHM7wUjs3ujhFmwp5x0A9BAU8WKuJFdPC
+aZ8hjkgvPaVwtFhEScELSQh6iwfHftAS0jb1NfvsaPou3a4KQ63pvMuF4Qx7b5Cq4L2aBqhvgRqp
+kinAJfAVr4vRuI199KnADlH9YGmOdrOVJ07ru9dtisH4t+zo7j8lqqcqhUstjUVcmFf6LlYPKsOG
+yPsaMTg3DfIYhpWlV2rd9DXBBzNgz4KW6CEujxCSBLP3VSQQgA5xRBROPw/uBq6isBBkuWZZy9z3
+GS0J/YtZY99Q9BfK7n+vythB3aciecySnoWYS1UB6m2b+F4xMmab2P8GhzzFsyUmAzNy1mQHGdYe
+eHBKA1CunIvICiv95XRAplBSIh3KHEeaCwbKVhNJYmf/xTmRBiTtVEgLKpxSQMVh+Lax6rmvVMcu
+cb3klVE1n9DILVAkuW3uxScLDS1wQyGWdGu1/2vU3yojus/kw868+gMzvszc704XDviwgQblYe27
+eOdpRB8oOK63o/dY5cDSdEYhjYEVlOZ3eriZ/FYW5WHAbR7PuM1EYfVUy/5XGLylDutaA/0klfu4
+Lhs4Sptdt7DifBI6R1LAcXu7REbu/r+Xhxnj6ik27oMitYO2PG3slnBEzj37Hc9EOGvBbuB3Fn28
+oRs6tAFilysj8hrJnHVFbA9OiNa8sdFj797n4lvlYv2ZMMUvJpg0hjInkTG0vkRhQbzszd0URUK0
+hpGVADFlwsfAWKoNAO2YoBmNIILSs8Sgogf5yuRvZBZPKRxQffGp9UjRpe2TiM2EZfHhgruyvnR4
+GfZfY3oHCtWA3DmQZYfQtwqeo4N4gA0Kwr34VGSFDMJxmEIuwWZYRL1sZXyGUZjZWYhtrp25vUn5
+uXrzhsi4IuDbAV5QlBi3NAC1uRfcZrn9OhGT/Q7LK8M4z2WL7gui5ULq+a4OvDFdcLdej/obWRip
+X20CW/bWzctM2dLUFWwP0xdv9wHAMDpnrOHVWF5gRaWjFjFOMCcGCSqGSIb3DQEJFDEaHhgAcABr
+AGMAcwAxADIAdABlAHMAdABjAGEwIwYJKoZIhvcNAQkVMRYEFAxeTobq6DehjSbiylxISkcqQqH6
+MD0wITAJBgUrDgMCGgUABBReCaXcoIK8JTMwigEZzYPfmYG2TwQUZCjIEn2XZ9poivqAwEKWWmB6
+1QoCAgQA
\ No newline at end of file
diff --git a/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/keystoreCA.jceks.data b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/keystoreCA.jceks.data
new file mode 100644
index 00000000000..be06f6abfae
--- /dev/null
+++ b/jdk/test/java/security/KeyStore/PKCS12/certs/convertP12/keystoreCA.jceks.data
@@ -0,0 +1,38 @@
+zs7OzgAAAAIAAAABAAAAAQAMcGtjczEydGVzdGNhAAAA9w1c8TsAAATsMIIE6DAaBgkrBgEEASoC
+EwEwDQQIENnMq+mjV/MCARQEggTIxcLo7BUq16C/xG5KhlyvHkNqvHIFDcCXcwSA6L+1OD8jZztH
++/0Xjv24+gCvto+XPzkKaYkCN35SI9D+y461jqUStnjbgWiHnXnhe/V1IDfkY93cV1zLOWwaNXvM
+UPMY5IEbFKowrh3Yrr0ljh57hXifgj63520l7ZV2sbVqwH+1ttBOyNuMB45AvZMX9+qZDucu/I32
+mdzvYoxBPQSwYyt0XMleEMxgSdum0WbhBcjZmcAHjsrLhrNK6wAEjM+6s/wpbJgU4SNIQ4rDVLT6
+SMf+xBz6YxzLiNBWEoga/aQK8WzCF00YQOrCRHpLu1DRSvCofmdttO9FW+OSLKTePV2xQavdu5GD
+Kpyog1BaQlkt/QFqx6xMw7Sf4cJV7PPd2rsqM/xiAbYFcGjw/hlk9pGoHcbGT92bUum+F1KvMdZj
+LZo4Mzo0CEYpp9MmSt/q5dGbCxQlUVKgLg16P+jQ5TvLyIyd4rFG9yaqYQ3Q0Um7rRfFQ1+/aAZE
+OJNNFp9Oxv7eBAwbW5DdriWXNtxo3yIRbjQhn2wa5Lyv9cVcUQ9OVKU6Exu2BWjuMmjr4mM11MAX
+rmzZcslK2iX89phOOMk/ZG4BRb4lD+RTeSHVJrORd+eaZFXhXYx96a74vJI1tAcjgT75T6Dmq4da
+uC39W13zhWOsOQnO0jdZQ+DkiE7XQ2+ZoB+nMmIWHyGokg1fS1AB6v7Os6pyPKKTEqXWM73L8bg6
+rTtCYQS1/NaSoAofOsbg7UWV/EQnShu2eHE91V509lY+l8p/TWddv4IVOBKHranSuRhJ56cD5xs0
+9IksUK2LXdMJl949bU4NsnrmUohkjxeOZpgDrvM2U2TBaJ9lO973ScAUJ0kqU11Q94LU2TQ4JP9d
+2sWkq47wGE0yrx/ze2Vi1C+HD1esqKpw142cIzslmzzwLKZfauxT4XLprATrKYVBsA173Tbg1eUK
+17Og5p1p6qEqwI1dvD1NHhj5WuLztP/zhQhnMlPNukVo/+ue6od3wby9jeMBHIIQDjHXGX38APJI
+GHBxAhvOJeCKs3+JPnfuJYNshl9535oex5R1/K7pTCiOTdsjw9OQe+2xMFZX1ctaywWxQi4Bal7C
+hha6xREcyr/M2ffpn+Vcvp4U7NYOh86KEwSJxyrltAb7BKT7RYTcWLIKsh+OBBQIUbfYQXL8tMKt
+c8uNM9xLYFeHBAvgl09rpci14HsFfMD4atCYIremxSHO2whOwvOUVtBqX/NuKzxm9+Mbu7GDuJ/j
+tC2+0lcxytTibjK0+5PYNAoFp4jsX1qQ+Fxe6NN5b/71QjBTUFuXNFzWBgWdnzYW2Q5r4Fpt+GFv
+XUWBbxrkqUiHWOvlUaullgpN8I7JbOB4WwOD0r3EsTxO1OBSkZizFUH44oIaiVQfXXVMRxnVVQLC
+MKGGR4p0OmH9I0PXldqQPMtVKTDxgryNgXQoKFB83IPOcH7akfgh3W3zFYjohm7DvKXa9ydGaTDV
+1jmCHtjjhPvz7Qv4rY1Gtr/FcPADFkCpN44d29RQ3D3ThxJoP1wsMzYeLMkS3G4zomWHOXO34XA5
+08BZtij4gv553TrFu0tktdgpF7FRlUOOBXL3dXKFvzRQ3E5/WwuxEAr/Y3CZiVmgAAAAAQAFWC41
+MDkAAAMbMIIDFzCCAf8CBD8+0BswDQYJKoZIhvcNAQEFBQAwUDELMAkGA1UEBhMCVVMxETAPBgNV
+BAoTCEphdmFTb2Z0MRUwEwYDVQQLEwxTZWN1cml0eSBTUUUxFzAVBgNVBAMTDlBLQ1MxMiBUZXN0
+IENBMB4XDTAzMDgxNzAwNDUxNVoXDTEzMDgxNDAwNDUxNVowUDELMAkGA1UEBhMCVVMxETAPBgNV
+BAoTCEphdmFTb2Z0MRUwEwYDVQQLEwxTZWN1cml0eSBTUUUxFzAVBgNVBAMTDlBLQ1MxMiBUZXN0
+IENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsFJYAnaFn02/LypHxXyGxS/WKC5e
+7PzEpjXzQ4pqWEDBr8U+GmOB+4oB755HkEpXBB6J34mlfRpN5RjUnegD/cK1qW2o//7rIkt8XwKy
+fHAdzAo5M0k75mJMlpp1uhDwY9BOUVAH9HB26Rv5cdTeTGP1Bp6KOry7pI9z5YgYsNgsZ7aKZgzX
+cakSxP+Kh9BnpWNN9J5JxbsxY0nkEEPyIPCD7kn4TYDAdmfCt/zkJz49mdP3BWaQtvZSM9yFSb3K
+P9Xf6bj2DLT3M8AdRDi2yWpd7K68rSgFbz21Sa7mCr/35hgQogrVeSUtlKkyREG+rDRT0VncXL8R
+uZPQOw2oAwIDAQABMA0GCSqGSIb3DQEBBQUAA4IBAQBmyf+CNJK0YsQ9ckYhXDBiafOF3n9MAG4I
+821xWdCWnQ2YUIlybCpW6jEkL+jFtfDCt1EYaGvWPMHR181YONJUf4MVtaE4ynq1pvDLLJ/1i+VM
+8zCc3lfm9mQDnqap0MBRVJzD3uHceCxG2bZTH2W4N16MEWU6ANmRJEXJfRWB1rPbb0lQMIEx8CJE
+IPxVPYg3enRjxx0Ciq3wfEKmhKCRyLE8tcR40aFkLReumxSI85fXsXEtIOD1A6+OKC32fYzSvwNK
+hIdVt/9sIgMOgVQbEXM0rAJgayfPulQyB19OZWUUg+zVMDjgudV6cWRRz/V+0U7Ajq3IZOsE5PtU
+FgNW1MI40XfEdWafFXeJ+yQTHPyoNdk=
\ No newline at end of file

From f9806ff009d93f954bc57937e0287c440a0e46c1 Mon Sep 17 00:00:00 2001
From: Tobias Hartmann <thartmann@openjdk.org>
Date: Thu, 4 Dec 2014 09:52:15 +0100
Subject: [PATCH 223/299] 8066448: SmallCodeCacheStartup.java exits with exit
 code 1

Check for VirtualMachineError in case VM initialization fails.

Reviewed-by: kvn
---
 hotspot/src/share/vm/oops/method.cpp          |  2 +-
 .../startup/SmallCodeCacheStartup.java        | 27 ++++++++++++-------
 2 files changed, 18 insertions(+), 11 deletions(-)

diff --git a/hotspot/src/share/vm/oops/method.cpp b/hotspot/src/share/vm/oops/method.cpp
index 9a248ce3e27..8c5c7005874 100644
--- a/hotspot/src/share/vm/oops/method.cpp
+++ b/hotspot/src/share/vm/oops/method.cpp
@@ -936,7 +936,7 @@ address Method::make_adapters(methodHandle mh, TRAPS) {
   // so making them eagerly shouldn't be too expensive.
   AdapterHandlerEntry* adapter = AdapterHandlerLibrary::get_adapter(mh);
   if (adapter == NULL ) {
-    THROW_MSG_NULL(vmSymbols::java_lang_VirtualMachineError(), "out of space in CodeCache for adapters");
+    THROW_MSG_NULL(vmSymbols::java_lang_VirtualMachineError(), "Out of space in CodeCache for adapters");
   }
 
   mh->set_adapter_entry(adapter);
diff --git a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java
index 55eb7b2b27d..fa7a8b8ee9a 100644
--- a/hotspot/test/compiler/startup/SmallCodeCacheStartup.java
+++ b/hotspot/test/compiler/startup/SmallCodeCacheStartup.java
@@ -24,22 +24,29 @@
 /*
  * @test
  * @bug 8023014
- * @summary Test ensures that there is no crash if there is not enough ReservedCodeacacheSize
+ * @summary Test ensures that there is no crash if there is not enough ReservedCodeCacheSize
  *          to initialize all compiler threads. The option -Xcomp gives the VM more time to
- *          to trigger the old bug.
+ *          trigger the old bug.
  * @library /testlibrary
  */
 import com.oracle.java.testlibrary.*;
+import static com.oracle.java.testlibrary.Asserts.assertTrue;
 
 public class SmallCodeCacheStartup {
-  public static void main(String[] args) throws Exception {
-      ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=3m",
-                                                                "-XX:CICompilerCount=64",
-                                                                "-Xcomp",
-                                                                "-version");
-      OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
-      analyzer.shouldHaveExitValue(0);
+    public static void main(String[] args) throws Exception {
+        ProcessBuilder pb = ProcessTools.createJavaProcessBuilder("-XX:ReservedCodeCacheSize=3m",
+                                                                  "-XX:CICompilerCount=64",
+                                                                  "-Xcomp",
+                                                                  "-version");
+        OutputAnalyzer analyzer = new OutputAnalyzer(pb.start());
+        try {
+            analyzer.shouldHaveExitValue(0);
+        } catch (RuntimeException e) {
+            // Error occurred during initialization, did we run out of adapter space?
+            assertTrue(analyzer.getOutput().contains("VirtualMachineError: Out of space in CodeCache"),
+                    "Expected VirtualMachineError");
+        }
 
-      System.out.println("TEST PASSED");
+        System.out.println("TEST PASSED");
   }
 }

From 7a3496218a57bd96d3e1d9047f581a10ed891882 Mon Sep 17 00:00:00 2001
From: Goetz Lindenmaier <goetz@openjdk.org>
Date: Thu, 4 Dec 2014 10:10:52 +0100
Subject: [PATCH 224/299] 8066662: Fix include after 8065993: Merge
 OneContigSpaceCardGeneration with TenuredGeneration

Reviewed-by: mgerdin, brutisso
---
 .../share/vm/gc_implementation/parNew/parOopClosures.inline.hpp  | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp
index 2a3e3207195..9658d59e1e4 100644
--- a/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parOopClosures.inline.hpp
@@ -28,6 +28,7 @@
 #include "gc_implementation/parNew/parNewGeneration.hpp"
 #include "gc_implementation/parNew/parOopClosures.hpp"
 #include "memory/cardTableRS.hpp"
+#include "memory/genCollectedHeap.hpp"
 
 template <class T> inline void ParScanWeakRefClosure::do_oop_work(T* p) {
   assert (!oopDesc::is_null(*p), "null weak reference?");

From 949112fab25835e9be3e12894f97fd322d4bad5f Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan <sundar@openjdk.org>
Date: Thu, 4 Dec 2014 20:40:48 +0530
Subject: [PATCH 225/299] 8066683: nashorn test failures after modular image
 changes

Reviewed-by: attila, jlaskey
---
 nashorn/make/build.xml                        |  4 ++--
 .../internal/runtime/AstDeserializer.java     | 22 +++++++++++++------
 .../runtime/linker/BrowserJSObjectLinker.java | 12 ++++++++--
 .../linker/JavaAdapterClassLoader.java        |  2 +-
 nashorn/test/script/basic/JDK-8066232.js      |  2 ++
 5 files changed, 30 insertions(+), 12 deletions(-)

diff --git a/nashorn/make/build.xml b/nashorn/make/build.xml
index 97d89546720..20fcedb4e94 100644
--- a/nashorn/make/build.xml
+++ b/nashorn/make/build.xml
@@ -36,9 +36,9 @@
          <pathelement location="${dist.dir}"/>
     </path>
     <path id="nashorn.boot.prefix.path">
-      <pathelement location="${dist.dir}"/>
+      <pathelement location="${dist.jar}"/>
     </path>
-    <property name="boot.class.path" value="-Xbootclasspath/a:=&quot;${toString:nashorn.boot.prefix.path}&quot;"/>
+    <property name="boot.class.path" value="-Xbootclasspath/p:&quot;${toString:nashorn.boot.prefix.path}&quot;"/>
     <condition property="svn.executable" value="/usr/local/bin/svn" else="svn">
       <available file="/usr/local/bin/svn"/>
     </condition>
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AstDeserializer.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AstDeserializer.java
index 8f2766145d4..9a557cf0438 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AstDeserializer.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/AstDeserializer.java
@@ -27,6 +27,8 @@ package jdk.nashorn.internal.runtime;
 import java.io.ByteArrayInputStream;
 import java.io.IOException;
 import java.io.ObjectInputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
 import java.util.zip.InflaterInputStream;
 import jdk.nashorn.internal.ir.FunctionNode;
 
@@ -36,12 +38,18 @@ import jdk.nashorn.internal.ir.FunctionNode;
  */
 final class AstDeserializer {
     static FunctionNode deserialize(final byte[] serializedAst) {
-        try {
-            return (FunctionNode)new ObjectInputStream(new InflaterInputStream(new ByteArrayInputStream(
-                    serializedAst))).readObject();
-        } catch (final ClassNotFoundException | IOException e) {
-            // This is internal, can't happen
-            throw new AssertionError("Unexpected exception deserializing function", e);
-        }
+        // FIXME: do we need this doPrivileged block at all?
+        return AccessController.doPrivileged(new PrivilegedAction<FunctionNode>() {
+            @Override
+            public FunctionNode run() {
+                try {
+                    return (FunctionNode)new ObjectInputStream(new InflaterInputStream(
+                        new ByteArrayInputStream(serializedAst))).readObject();
+                } catch (final ClassNotFoundException | IOException e) {
+                    // This is internal, can't happen
+                    throw new AssertionError("Unexpected exception deserializing function", e);
+                }
+            }
+        });
     }
 }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java
index fa43e4c8438..60f639a7d9c 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java
@@ -45,7 +45,15 @@ import jdk.nashorn.internal.runtime.JSType;
  * A Dynalink linker to handle web browser built-in JS (DOM etc.) objects.
  */
 final class BrowserJSObjectLinker implements TypeBasedGuardingDynamicLinker {
-    private static final ClassLoader myLoader = BrowserJSObjectLinker.class.getClassLoader();
+    private static ClassLoader extLoader;
+    static {
+        extLoader = BrowserJSObjectLinker.class.getClassLoader();
+        // in case nashorn is loaded as bootstrap!
+        if (extLoader == null) {
+            extLoader = ClassLoader.getSystemClassLoader().getParent();
+        }
+    }
+
     private static final String JSOBJECT_CLASS = "netscape.javascript.JSObject";
     // not final because this is lazily initialized
     // when we hit a subclass for the first time.
@@ -69,7 +77,7 @@ final class BrowserJSObjectLinker implements TypeBasedGuardingDynamicLinker {
         // check if this class is a subclass of JSObject
         Class<?> clazz = type;
         while (clazz != null) {
-            if (clazz.getClassLoader() == myLoader &&
+            if (clazz.getClassLoader() == extLoader &&
                 clazz.getName().equals(JSOBJECT_CLASS)) {
                 jsObjectClass = clazz;
                 return true;
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java
index 77004978eb7..df8c61a701a 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/JavaAdapterClassLoader.java
@@ -104,7 +104,7 @@ final class JavaAdapterClassLoader {
                     // SecurityException for nashorn's classes!. For adapter's to work, we
                     // should be able to refer to the few classes it needs in its implementation.
                     if(VISIBLE_INTERNAL_CLASS_NAMES.contains(name)) {
-                        return myLoader.loadClass(name);
+                        return myLoader != null? myLoader.loadClass(name) : Class.forName(name, false, myLoader);
                     }
                     throw se;
                 }
diff --git a/nashorn/test/script/basic/JDK-8066232.js b/nashorn/test/script/basic/JDK-8066232.js
index 364426860e1..cbd481bb524 100644
--- a/nashorn/test/script/basic/JDK-8066232.js
+++ b/nashorn/test/script/basic/JDK-8066232.js
@@ -34,3 +34,5 @@
     } catch(e if 1) {
     }
 })()
+
+print("SUCCESS");

From ea89dad13c66dd74e24676324470354914e080c7 Mon Sep 17 00:00:00 2001
From: Vladimir Ivanov <vlivanov@openjdk.org>
Date: Thu, 4 Dec 2014 07:15:37 -0800
Subject: [PATCH 226/299] 8057020: LambdaForm caches should support eviction

Reviewed-by: psandoz, jrose, shade
---
 .../classes/java/lang/invoke/LambdaForm.java  |  2 +-
 .../java/lang/invoke/LambdaFormBuffer.java    | 15 +++---
 .../java/lang/invoke/LambdaFormEditor.java    | 52 +++++++++++++++----
 .../java/lang/invoke/MethodTypeForm.java      | 43 +++++++++------
 .../invoke/LFCaching/LFCachingTestCase.java   | 17 +++---
 .../invoke/LFCaching/LambdaFormTestCase.java  | 20 ++++++-
 6 files changed, 106 insertions(+), 43 deletions(-)

diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
index e1791719c0d..2129f8618bd 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaForm.java
@@ -125,7 +125,7 @@ class LambdaForm {
     MemberName vmentry;   // low-level behavior, or null if not yet prepared
     private boolean isCompiled;
 
-    Object transformCache;  // managed by LambdaFormEditor
+    volatile Object transformCache;  // managed by LambdaFormEditor
 
     public static final int VOID_RESULT = -1, LAST_RESULT = -2;
 
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java
index 872a2a59921..cdc88be3250 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormBuffer.java
@@ -46,19 +46,16 @@ final class LambdaFormBuffer {
     private static final int F_TRANS = 0x10, F_OWNED = 0x03;
 
     LambdaFormBuffer(LambdaForm lf) {
-        this(lf.arity, lf.names, lf.result);
+        this.arity = lf.arity;
+        setNames(lf.names);
+        int result = lf.result;
+        if (result == LAST_RESULT)  result = length - 1;
+        if (result >= 0 && lf.names[result].type != V_TYPE)
+            resultName = lf.names[result];
         debugName = lf.debugName;
         assert(lf.nameRefsAreLegal());
     }
 
-    private LambdaFormBuffer(int arity, Name[] names, int result) {
-        this.arity = arity;
-        setNames(names);
-        if (result == LAST_RESULT)  result = length - 1;
-        if (result >= 0 && names[result].type != V_TYPE)
-            resultName = names[result];
-    }
-
     private LambdaForm lambdaForm() {
         assert(!inTrans());  // need endEdit call to tidy things up
         return new LambdaForm(debugName, arity, nameArray(), resultIndex());
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java
index 1c29d73b4cc..1c23e94995a 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/LambdaFormEditor.java
@@ -25,6 +25,7 @@
 
 package java.lang.invoke;
 
+import java.lang.ref.SoftReference;
 import java.util.Arrays;
 import static java.lang.invoke.LambdaForm.*;
 import static java.lang.invoke.LambdaForm.BasicType.*;
@@ -58,10 +59,9 @@ class LambdaFormEditor {
      *  The sequence is unterminated, ending with an indefinite number of zero bytes.
      *  Sequences that are simple (short enough and with small enough values) pack into a 64-bit long.
      */
-    private static final class Transform {
+    private static final class Transform extends SoftReference<LambdaForm> {
         final long packedBytes;
         final byte[] fullBytes;
-        final LambdaForm result;  // result of transform, or null, if there is none available
 
         private enum Kind {
             NO_KIND,  // necessary because ordinal must be greater than zero
@@ -140,9 +140,9 @@ class LambdaFormEditor {
         Kind kind() { return Kind.values()[byteAt(0)]; }
 
         private Transform(long packedBytes, byte[] fullBytes, LambdaForm result) {
+            super(result);
             this.packedBytes = packedBytes;
             this.fullBytes = fullBytes;
-            this.result = result;
         }
         private Transform(long packedBytes) {
             this(packedBytes, null, null);
@@ -243,6 +243,7 @@ class LambdaFormEditor {
                 buf.append("unpacked");
                 buf.append(Arrays.toString(fullBytes));
             }
+            LambdaForm result = get();
             if (result != null) {
                 buf.append(" result=");
                 buf.append(result);
@@ -253,7 +254,7 @@ class LambdaFormEditor {
 
     /** Find a previously cached transform equivalent to the given one, and return its result. */
     private LambdaForm getInCache(Transform key) {
-        assert(key.result == null);
+        assert(key.get() == null);
         // The transformCache is one of null, Transform, Transform[], or ConcurrentHashMap.
         Object c = lambdaForm.transformCache;
         Transform k = null;
@@ -276,7 +277,7 @@ class LambdaFormEditor {
             }
         }
         assert(k == null || key.equals(k));
-        return k == null ? null : k.result;
+        return (k != null) ? k.get() : null;
     }
 
     /** Arbitrary but reasonable limits on Transform[] size for cache. */
@@ -293,7 +294,17 @@ class LambdaFormEditor {
                 @SuppressWarnings("unchecked")
                 ConcurrentHashMap<Transform,Transform> m = (ConcurrentHashMap<Transform,Transform>) c;
                 Transform k = m.putIfAbsent(key, key);
-                return k != null ? k.result : form;
+                if (k == null) return form;
+                LambdaForm result = k.get();
+                if (result != null) {
+                    return result;
+                } else {
+                    if (m.replace(key, k, key)) {
+                        return form;
+                    } else {
+                        continue;
+                    }
+                }
             }
             assert(pass == 0);
             synchronized (lambdaForm) {
@@ -308,17 +319,27 @@ class LambdaFormEditor {
                 if (c instanceof Transform) {
                     Transform k = (Transform)c;
                     if (k.equals(key)) {
-                        return k.result;
+                        LambdaForm result = k.get();
+                        if (result == null) {
+                            lambdaForm.transformCache = key;
+                            return form;
+                        } else {
+                            return result;
+                        }
+                    } else if (k.get() == null) { // overwrite stale entry
+                        lambdaForm.transformCache = key;
+                        return form;
                     }
                     // expand one-element cache to small array
                     ta = new Transform[MIN_CACHE_ARRAY_SIZE];
                     ta[0] = k;
-                    lambdaForm.transformCache = c = ta;
+                    lambdaForm.transformCache = ta;
                 } else {
                     // it is already expanded
                     ta = (Transform[])c;
                 }
                 int len = ta.length;
+                int stale = -1;
                 int i;
                 for (i = 0; i < len; i++) {
                     Transform k = ta[i];
@@ -326,10 +347,18 @@ class LambdaFormEditor {
                         break;
                     }
                     if (k.equals(key)) {
-                        return k.result;
+                        LambdaForm result = k.get();
+                        if (result == null) {
+                            ta[i] = key;
+                            return form;
+                        } else {
+                            return result;
+                        }
+                    } else if (stale < 0 && k.get() == null) {
+                        stale = i; // remember 1st stale entry index
                     }
                 }
-                if (i < len) {
+                if (i < len || stale >= 0) {
                     // just fall through to cache update
                 } else if (len < MAX_CACHE_ARRAY_SIZE) {
                     len = Math.min(len * 2, MAX_CACHE_ARRAY_SIZE);
@@ -344,7 +373,8 @@ class LambdaFormEditor {
                     // The second iteration will update for this query, concurrently.
                     continue;
                 }
-                ta[i] = key;
+                int idx = (stale >= 0) ? stale : i;
+                ta[idx] = key;
                 return form;
             }
         }
diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java
index 6733e29ef93..bcf16dba9db 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java
@@ -26,9 +26,8 @@
 package java.lang.invoke;
 
 import sun.invoke.util.Wrapper;
+import java.lang.ref.SoftReference;
 import static java.lang.invoke.MethodHandleStatics.*;
-import static java.lang.invoke.MethodHandleNatives.Constants.*;
- import static java.lang.invoke.MethodHandles.Lookup.IMPL_LOOKUP;
 
 /**
  * Shared information for a group of method types, which differ
@@ -51,7 +50,7 @@ final class MethodTypeForm {
     final MethodType basicType;         // the canonical erasure, with primitives simplified
 
     // Cached adapter information:
-    @Stable final MethodHandle[] methodHandles;
+    @Stable final SoftReference<MethodHandle>[] methodHandles;
     // Indexes into methodHandles:
     static final int
             MH_BASIC_INV      =  0,  // cached instance of MH.invokeBasic
@@ -60,7 +59,7 @@ final class MethodTypeForm {
             MH_LIMIT          =  3;
 
     // Cached lambda form information, for basic types only:
-    final @Stable LambdaForm[] lambdaForms;
+    final @Stable SoftReference<LambdaForm>[] lambdaForms;
     // Indexes into lambdaForms:
     static final int
             LF_INVVIRTUAL              =  0,  // DMH invokeVirtual
@@ -108,26 +107,40 @@ final class MethodTypeForm {
 
     public MethodHandle cachedMethodHandle(int which) {
         assert(assertIsBasicType());
-        return methodHandles[which];
+        SoftReference<MethodHandle> entry = methodHandles[which];
+        return (entry != null) ? entry.get() : null;
     }
 
     synchronized public MethodHandle setCachedMethodHandle(int which, MethodHandle mh) {
         // Simulate a CAS, to avoid racy duplication of results.
-        MethodHandle prev = methodHandles[which];
-        if (prev != null)  return prev;
-        return methodHandles[which] = mh;
+        SoftReference<MethodHandle> entry = methodHandles[which];
+        if (entry != null) {
+            MethodHandle prev = entry.get();
+            if (prev != null) {
+                return prev;
+            }
+        }
+        methodHandles[which] = new SoftReference<>(mh);
+        return mh;
     }
 
     public LambdaForm cachedLambdaForm(int which) {
         assert(assertIsBasicType());
-        return lambdaForms[which];
+        SoftReference<LambdaForm> entry = lambdaForms[which];
+        return (entry != null) ? entry.get() : null;
     }
 
     synchronized public LambdaForm setCachedLambdaForm(int which, LambdaForm form) {
         // Simulate a CAS, to avoid racy duplication of results.
-        LambdaForm prev = lambdaForms[which];
-        if (prev != null) return prev;
-        return lambdaForms[which] = form;
+        SoftReference<LambdaForm> entry = lambdaForms[which];
+        if (entry != null) {
+            LambdaForm prev = entry.get();
+            if (prev != null) {
+                return prev;
+            }
+        }
+        lambdaForms[which] = new SoftReference<>(form);
+        return form;
     }
 
     /**
@@ -135,6 +148,7 @@ final class MethodTypeForm {
      * This MTF will stand for that type and all un-erased variations.
      * Eagerly compute some basic properties of the type, common to all variations.
      */
+    @SuppressWarnings({"rawtypes", "unchecked"})
     protected MethodTypeForm(MethodType erasedType) {
         this.erasedType = erasedType;
 
@@ -234,8 +248,8 @@ final class MethodTypeForm {
 
         // Initialize caches, but only for basic types
         assert(basicType == erasedType);
-        this.lambdaForms = new LambdaForm[LF_LIMIT];
-        this.methodHandles = new MethodHandle[MH_LIMIT];
+        this.lambdaForms   = new SoftReference[LF_LIMIT];
+        this.methodHandles = new SoftReference[MH_LIMIT];
     }
 
     private static long pack(int a, int b, int c, int d) {
@@ -409,5 +423,4 @@ final class MethodTypeForm {
     public String toString() {
         return "Form"+erasedType;
     }
-
 }
diff --git a/jdk/test/java/lang/invoke/LFCaching/LFCachingTestCase.java b/jdk/test/java/lang/invoke/LFCaching/LFCachingTestCase.java
index 30ba39ac2e0..50a57e40c67 100644
--- a/jdk/test/java/lang/invoke/LFCaching/LFCachingTestCase.java
+++ b/jdk/test/java/lang/invoke/LFCaching/LFCachingTestCase.java
@@ -63,12 +63,17 @@ public abstract class LFCachingTestCase extends LambdaFormTestCase {
             }
 
             if (lambdaForm0 != lambdaForm1) {
-                System.err.println("Lambda form 0 toString is:");
-                System.err.println(lambdaForm0);
-                System.err.println("Lambda form 1 toString is:");
-                System.err.println(lambdaForm1);
-                throw new AssertionError("Error: Lambda forms of the two method handles"
-                        + " are not the same. LF cahing does not work");
+                // Since LambdaForm caches are based on SoftReferences, GC can cause element eviction.
+                if (noGCHappened()) {
+                    System.err.println("Lambda form 0 toString is:");
+                    System.err.println(lambdaForm0);
+                    System.err.println("Lambda form 1 toString is:");
+                    System.err.println(lambdaForm1);
+                    throw new AssertionError("Error: Lambda forms of the two method handles"
+                            + " are not the same. LF cahing does not work");
+                } else {
+                    System.err.println("LambdaForms differ, but there was a GC in between. Ignore the failure.");
+                }
             }
         } catch (IllegalAccessException | IllegalArgumentException |
                 SecurityException | InvocationTargetException ex) {
diff --git a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
index a1821fa696f..94722cf72df 100644
--- a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
+++ b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
@@ -23,9 +23,12 @@
 
 import com.oracle.testlibrary.jsr292.Helper;
 import com.sun.management.HotSpotDiagnosticMXBean;
+
+import java.lang.management.GarbageCollectorMXBean;
 import java.lang.management.ManagementFactory;
 import java.lang.reflect.Method;
 import java.util.Collection;
+import java.util.List;
 import java.util.function.Function;
 import jdk.testlibrary.Utils;
 
@@ -49,6 +52,11 @@ public abstract class LambdaFormTestCase {
      * used to get a lambda form from a method handle.
      */
     protected final static Method INTERNAL_FORM;
+    private static final List<GarbageCollectorMXBean> gcInfo;
+
+    private static long gcCount() {
+        return gcInfo.stream().mapToLong(GarbageCollectorMXBean::getCollectionCount).sum();
+    }
 
     static {
         try {
@@ -58,10 +66,15 @@ public abstract class LambdaFormTestCase {
         } catch (Exception ex) {
             throw new Error("Unexpected exception: ", ex);
         }
+
+        gcInfo = ManagementFactory.getGarbageCollectorMXBeans();
+        if (gcInfo.size() == 0)  {
+            throw new Error("No GarbageCollectorMXBeans found.");
+        }
     }
 
     private final TestMethods testMethod;
-
+    private long gcCountAtStart;
     /**
      * Test case constructor. Generates test cases with random method types for
      * given methods form {@code j.l.i.MethodHandles} class.
@@ -71,12 +84,17 @@ public abstract class LambdaFormTestCase {
      */
     protected LambdaFormTestCase(TestMethods testMethod) {
         this.testMethod = testMethod;
+        this.gcCountAtStart = gcCount();
     }
 
     public TestMethods getTestMethod() {
         return testMethod;
     }
 
+    protected boolean noGCHappened() {
+        return gcCount() == gcCountAtStart;
+    }
+
     /**
      * Routine that executes a test case.
      */

From 369861355d09f5424e495de1d27aaba76d9a3b14 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan <sundar@openjdk.org>
Date: Thu, 4 Dec 2014 21:52:58 +0530
Subject: [PATCH 227/299] 8066696: test/script/nosecurity/JDK-8055034.js
 -Xbootclasspath option is wrong

Reviewed-by: attila, lagergren
---
 nashorn/test/script/nosecurity/JDK-8055034.js | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/nashorn/test/script/nosecurity/JDK-8055034.js b/nashorn/test/script/nosecurity/JDK-8055034.js
index 6bd59542d85..55a3b0385e8 100644
--- a/nashorn/test/script/nosecurity/JDK-8055034.js
+++ b/nashorn/test/script/nosecurity/JDK-8055034.js
@@ -43,7 +43,6 @@ var nashornJar = new File(System.getProperty("nashorn.jar"));
 if (! nashornJar.isAbsolute()) {
     nashornJar = new File(".", nashornJar);
 }
-var nashornJarDir = nashornJar.parentFile.absolutePath;
 
 // we want to use nashorn.jar passed and not the one that comes with JRE
 var jjsCmd = javahome + "/../bin/jjs";
@@ -52,7 +51,7 @@ if (! new File(jjsCmd).isFile()) {
     jjsCmd = javahome + "/bin/jjs";
     jjsCmd = jjsCmd.toString().replaceAll(/\//g, File.separater);
 }
-jjsCmd += " -J-Xbootclasspath/a:" + nashornJarDir;
+jjsCmd += " -J-Xbootclasspath/p:" + nashornJar;
 
 $ENV.PWD=System.getProperty("user.dir") // to avoid RE on Cygwin
 $EXEC(jjsCmd, "var x = Object.create(null);\nx;\nprint('PASSED');\nexit(0)");

From a7f3e3cfde56649370c6148061822c6f981c57f1 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 4 Dec 2014 12:58:11 -0800
Subject: [PATCH 228/299] Added tag jdk9-b41 for changeset adc258b13e2c

---
 .hgtags-top-repo | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index c82cee08402..3bd77e9484b 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -283,3 +283,4 @@ c173ba994245380fb11ef077d1e59823386840eb jdk9-b35
 d42c0a90afc3c66ca87543076ec9aafd4b4680de jdk9-b38
 512dbbeb1730edcebfec873fc3f1455660b32000 jdk9-b39
 cf136458ee747e151a27aa9ea0c1492ea55ef3e7 jdk9-b40
+67395f7ca2db3b52e3a62a84888487de5cb9210a jdk9-b41

From 3fa0b9cdc0d4b8c540ce68c1f2242af6eca1c0aa Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 4 Dec 2014 12:58:12 -0800
Subject: [PATCH 229/299] Added tag jdk9-b41 for changeset 55efe677dc75

---
 corba/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/corba/.hgtags b/corba/.hgtags
index ee710f70e9f..88827d2782a 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -283,3 +283,4 @@ ffd90c81d4ef9d94d880fc852e2fc482ecd9b374 jdk9-b36
 8acf056126e819cf536eef02aee0f61f207a6b52 jdk9-b38
 53bf36cb722db50815712258a77cb6bbe25a2f5f jdk9-b39
 e27c725d6c9d155667b35255f442d4ceb8c3c084 jdk9-b40
+1908b886ba1eda46fa725cf1160fe5d30fd1a7e5 jdk9-b41

From 7ef6f7a8689f1343635778c2f0e9be9b927d6ba5 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 4 Dec 2014 12:58:13 -0800
Subject: [PATCH 230/299] Added tag jdk9-b41 for changeset 47f369e3c69c

---
 hotspot/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index acafa28f373..159c2223842 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -443,3 +443,4 @@ b1c2dd843f247a1db19e1e85eb62ca405f72dc26 jdk9-b37
 c363a8b87e477ee45d6d3cb2a36cb365141bc596 jdk9-b38
 9cb75e5e394827ccbaf2e15524108a412dc4ddc5 jdk9-b39
 6b09b3193d731e3288e2a240c504a20d0a06c766 jdk9-b40
+1d29b13e8a515a7ea3b882f140576d5d675bc11f jdk9-b41

From e904b317d524ce5abbd4e7fa19f43ce7601671eb Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 4 Dec 2014 12:58:16 -0800
Subject: [PATCH 231/299] Added tag jdk9-b41 for changeset 0db747c09110

---
 jaxws/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index ed8c8533695..65daeb64249 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -286,3 +286,4 @@ afe0c89e2edbdfb1a7ceff3d9b3ff46c4186202f jdk9-b35
 dd4ba422dba858b1c3c4b38f49a3e514be4e2790 jdk9-b38
 381bad1174c7c27352bee604535332da4ee2c556 jdk9-b39
 5455969de31f3083bcfd779b7acc3ab758ecb308 jdk9-b40
+4f785187377fe4c7ff388a7026dd72fcccdcfe7a jdk9-b41

From 6b93b9c07f652aaece419644a868896b58208ed4 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 4 Dec 2014 12:58:16 -0800
Subject: [PATCH 232/299] Added tag jdk9-b41 for changeset 2e8afdf5c6fb

---
 jaxp/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index 1439963c082..c9d9de60c63 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -283,3 +283,4 @@ b9370464572fc663a38956047aa612d6e7854c3d jdk9-b35
 6c6b34477e93e6fb350035f73ed7c02266b78380 jdk9-b38
 a12d347f84176200593999f4da91ae2bb86865b2 jdk9-b39
 3f46e2196498de33e7c65efa7b372e46f1faba01 jdk9-b40
+71dd8f7649428efd3a56ca5fefc80e59d37b8434 jdk9-b41

From c64dd540f965dbc602e157328474643e0b65f7f7 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 4 Dec 2014 12:58:17 -0800
Subject: [PATCH 233/299] Added tag jdk9-b41 for changeset 729f9700483a

---
 jdk/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/jdk/.hgtags b/jdk/.hgtags
index 06eb73ce7da..ce5d84d50b5 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -283,3 +283,4 @@ cdcf2e599e42935c2d1d19a24bb19e808aeb43b5 jdk9-b36
 d2d745313c81d1fc01f426983b9f784ab1f750e8 jdk9-b38
 ca6edf957fe1c6ea818530b503578e872cea7239 jdk9-b39
 f1ed1540da70a066527fd043413107e47721edbf jdk9-b40
+e336cbd8b15e959e70ed02f0f5e93fa76ebd4c07 jdk9-b41

From 712feea533abb5f96a2adfcc0fe652bf653c3d06 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 4 Dec 2014 12:58:21 -0800
Subject: [PATCH 234/299] Added tag jdk9-b41 for changeset d1a63c99cdd5

---
 langtools/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/langtools/.hgtags b/langtools/.hgtags
index d42b3d90ecc..700d0f2b95e 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -283,3 +283,4 @@ c536541235e566701ff772700c15de14b75e2979 jdk9-b36
 5ad591bc3ef6d1b30b215cb9c228bf94aac6dc7c jdk9-b38
 5ff1cd07bd9297e82cfea5ec01249d162260fe4e jdk9-b39
 c286272a81dd8f6005e22fed0238c4a3f75188c7 jdk9-b40
+f7ce2cfa4cdbec0ae0f46080484eace66be7987a jdk9-b41

From bd075b7eb81c265a1337781104b36190735a348f Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 4 Dec 2014 12:58:22 -0800
Subject: [PATCH 235/299] Added tag jdk9-b41 for changeset 08ef93eaca80

---
 nashorn/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index 28429a6832f..98ecf3cba2a 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -274,3 +274,4 @@ dd7bbdf81a537106cfa9227d1a9a57849cb26b4d jdk9-b37
 365f55e7b3c45637bf912c88d31b32a127ad7429 jdk9-b38
 900508346b1c2436d7059fe46a621e6ec3ffdaad jdk9-b39
 74dcd8dbef252938d6deb032aefb46b8f452dd9e jdk9-b40
+52340a35aec9955d4aeaaf01d6337284f179b31c jdk9-b41

From 4edac8c9d28e82272c29946d8ac1a7acff3a84f1 Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Thu, 4 Dec 2014 12:59:43 -0800
Subject: [PATCH 236/299] 8066617: Suppress deprecation warnings in java.base
 module

Reviewed-by: lancea
---
 .../classes/com/sun/crypto/provider/PBES2Parameters.java  | 3 +++
 .../share/classes/com/sun/crypto/provider/RSACipher.java  | 2 ++
 .../com/sun/crypto/provider/TlsKeyMaterialGenerator.java  | 3 +++
 .../com/sun/crypto/provider/TlsMasterSecretGenerator.java | 5 ++++-
 .../classes/com/sun/crypto/provider/TlsPrfGenerator.java  | 2 ++
 .../crypto/provider/TlsRsaPremasterSecretGenerator.java   | 2 ++
 .../share/classes/com/sun/net/ssl/SSLSecurity.java        | 8 ++++++++
 .../www/protocol/https/DelegateHttpsURLConnection.java    | 5 ++++-
 .../www/protocol/https/HttpsURLConnectionOldImpl.java     | 1 +
 .../java.base/share/classes/java/util/jar/Attributes.java | 3 +++
 .../java.base/share/classes/java/util/jar/Manifest.java   | 1 +
 jdk/src/java.base/share/classes/java/util/zip/CRC32C.java | 1 +
 .../share/classes/sun/net/idn/UCharacterDirection.java    | 1 +
 .../share/classes/sun/security/ssl/HandshakeMessage.java  | 1 +
 .../share/classes/sun/security/ssl/Handshaker.java        | 2 ++
 .../classes/sun/security/ssl/RSAClientKeyExchange.java    | 2 ++
 .../share/classes/sun/security/ssl/RSASignature.java      | 3 +++
 .../sun/text/normalizer/RuleCharacterIterator.java        | 1 +
 .../share/classes/sun/text/normalizer/UnicodeSet.java     | 1 +
 19 files changed, 45 insertions(+), 2 deletions(-)

diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Parameters.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Parameters.java
index fd6abe3f0bd..946df0c3bc3 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Parameters.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/PBES2Parameters.java
@@ -253,6 +253,7 @@ abstract class PBES2Parameters extends AlgorithmParametersSpi {
        this.cipherParam = ((PBEParameterSpec)paramSpec).getParameterSpec();
     }
 
+    @SuppressWarnings("deprecation")
     protected void engineInit(byte[] encoded)
         throws IOException
     {
@@ -290,6 +291,7 @@ abstract class PBES2Parameters extends AlgorithmParametersSpi {
             .append(kdfAlgo).append("And").append(cipherAlgo).toString();
     }
 
+    @SuppressWarnings("deprecation")
     private String parseKDF(DerValue keyDerivationFunc) throws IOException {
         String kdfAlgo = null;
 
@@ -351,6 +353,7 @@ abstract class PBES2Parameters extends AlgorithmParametersSpi {
         return kdfAlgo;
     }
 
+    @SuppressWarnings("deprecation")
     private String parseES(DerValue encryptionScheme) throws IOException {
         String cipherAlgo = null;
 
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java
index d1d8cf3ef23..0ce3358aaad 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java
@@ -243,6 +243,7 @@ public final class RSACipher extends CipherSpi {
     }
 
     // initialize this cipher
+    @SuppressWarnings("deprecation")
     private void init(int opmode, Key key, SecureRandom random,
             AlgorithmParameterSpec params)
             throws InvalidKeyException, InvalidAlgorithmParameterException {
@@ -424,6 +425,7 @@ public final class RSACipher extends CipherSpi {
     }
 
     // see JCE spec
+    @SuppressWarnings("deprecation")
     protected Key engineUnwrap(byte[] wrappedKey, String algorithm,
             int type) throws InvalidKeyException, NoSuchAlgorithmException {
         if (wrappedKey.length > buffer.length) {
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java
index 61990d3bf2b..bd08e710bee 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java
@@ -46,6 +46,7 @@ public final class TlsKeyMaterialGenerator extends KeyGeneratorSpi {
     private final static String MSG = "TlsKeyMaterialGenerator must be "
         + "initialized using a TlsKeyMaterialParameterSpec";
 
+    @SuppressWarnings("deprecation")
     private TlsKeyMaterialParameterSpec spec;
 
     private int protocolVersion;
@@ -57,6 +58,7 @@ public final class TlsKeyMaterialGenerator extends KeyGeneratorSpi {
         throw new InvalidParameterException(MSG);
     }
 
+    @SuppressWarnings("deprecation")
     protected void engineInit(AlgorithmParameterSpec params,
             SecureRandom random) throws InvalidAlgorithmParameterException {
         if (params instanceof TlsKeyMaterialParameterSpec == false) {
@@ -91,6 +93,7 @@ public final class TlsKeyMaterialGenerator extends KeyGeneratorSpi {
         }
     }
 
+    @SuppressWarnings("deprecation")
     private SecretKey engineGenerateKey0() throws GeneralSecurityException {
         byte[] masterSecret = spec.getMasterSecret().getEncoded();
 
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java
index 0efa0aef9bf..b0527026757 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java
@@ -46,6 +46,7 @@ public final class TlsMasterSecretGenerator extends KeyGeneratorSpi {
     private final static String MSG = "TlsMasterSecretGenerator must be "
         + "initialized using a TlsMasterSecretParameterSpec";
 
+    @SuppressWarnings("deprecation")
     private TlsMasterSecretParameterSpec spec;
 
     private int protocolVersion;
@@ -57,6 +58,7 @@ public final class TlsMasterSecretGenerator extends KeyGeneratorSpi {
         throw new InvalidParameterException(MSG);
     }
 
+    @SuppressWarnings("deprecation")
     protected void engineInit(AlgorithmParameterSpec params,
             SecureRandom random) throws InvalidAlgorithmParameterException {
         if (params instanceof TlsMasterSecretParameterSpec == false) {
@@ -139,7 +141,8 @@ public final class TlsMasterSecretGenerator extends KeyGeneratorSpi {
         }
     }
 
-    private static final class TlsMasterSecretKey implements TlsMasterSecret {
+   @SuppressWarnings("deprecation")
+   private static final class TlsMasterSecretKey implements TlsMasterSecret {
         private static final long serialVersionUID = 1019571680375368880L;
 
         private byte[] key;
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java
index f09b7d875de..0461523dec3 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java
@@ -112,6 +112,7 @@ abstract class TlsPrfGenerator extends KeyGeneratorSpi {
     private final static String MSG = "TlsPrfGenerator must be "
         + "initialized using a TlsPrfParameterSpec";
 
+    @SuppressWarnings("deprecation")
     private TlsPrfParameterSpec spec;
 
     public TlsPrfGenerator() {
@@ -121,6 +122,7 @@ abstract class TlsPrfGenerator extends KeyGeneratorSpi {
         throw new InvalidParameterException(MSG);
     }
 
+    @SuppressWarnings("deprecation")
     protected void engineInit(AlgorithmParameterSpec params,
             SecureRandom random) throws InvalidAlgorithmParameterException {
         if (params instanceof TlsPrfParameterSpec == false) {
diff --git a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java
index 2a25cb64d5c..c4fc8364584 100644
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java
@@ -44,6 +44,7 @@ public final class TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi {
     private final static String MSG = "TlsRsaPremasterSecretGenerator must be "
         + "initialized using a TlsRsaPremasterSecretParameterSpec";
 
+    @SuppressWarnings("deprecation")
     private TlsRsaPremasterSecretParameterSpec spec;
     private SecureRandom random;
 
@@ -54,6 +55,7 @@ public final class TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi {
         throw new InvalidParameterException(MSG);
     }
 
+    @SuppressWarnings("deprecation")
     protected void engineInit(AlgorithmParameterSpec params,
             SecureRandom random) throws InvalidAlgorithmParameterException {
         if (!(params instanceof TlsRsaPremasterSecretParameterSpec)) {
diff --git a/jdk/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java b/jdk/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java
index dd7320b394c..664b53e0489 100644
--- a/jdk/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java
+++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/SSLSecurity.java
@@ -276,6 +276,7 @@ final class SSLSecurity {
  * object.  This also mean that anything going down into the SPI
  * needs to be wrapped, as well as anything coming back up.
  */
+@SuppressWarnings("deprecation")
 final class SSLContextSpiWrapper extends SSLContextSpi {
 
     private javax.net.ssl.SSLContext theSSLContext;
@@ -285,6 +286,7 @@ final class SSLContextSpiWrapper extends SSLContextSpi {
         theSSLContext = javax.net.ssl.SSLContext.getInstance(algName, prov);
     }
 
+    @SuppressWarnings("deprecation")
     protected void engineInit(KeyManager[] kma, TrustManager[] tma,
             SecureRandom sr) throws KeyManagementException {
 
@@ -387,6 +389,7 @@ final class SSLContextSpiWrapper extends SSLContextSpi {
 
 }
 
+@SuppressWarnings("deprecation")
 final class TrustManagerFactorySpiWrapper extends TrustManagerFactorySpi {
 
     private javax.net.ssl.TrustManagerFactory theTrustManagerFactory;
@@ -438,6 +441,7 @@ final class TrustManagerFactorySpiWrapper extends TrustManagerFactorySpi {
 
 }
 
+@SuppressWarnings("deprecation")
 final class KeyManagerFactorySpiWrapper extends KeyManagerFactorySpi {
 
     private javax.net.ssl.KeyManagerFactory theKeyManagerFactory;
@@ -493,6 +497,7 @@ final class KeyManagerFactorySpiWrapper extends KeyManagerFactorySpi {
 
 // =================================
 
+@SuppressWarnings("deprecation")
 final class X509KeyManagerJavaxWrapper implements
         javax.net.ssl.X509KeyManager {
 
@@ -590,6 +595,7 @@ final class X509KeyManagerJavaxWrapper implements
     }
 }
 
+@SuppressWarnings("deprecation")
 final class X509TrustManagerJavaxWrapper implements
         javax.net.ssl.X509TrustManager {
 
@@ -622,6 +628,7 @@ final class X509TrustManagerJavaxWrapper implements
     }
 }
 
+@SuppressWarnings("deprecation")
 final class X509KeyManagerComSunWrapper implements X509KeyManager {
 
     private javax.net.ssl.X509KeyManager theX509KeyManager;
@@ -657,6 +664,7 @@ final class X509KeyManagerComSunWrapper implements X509KeyManager {
     }
 }
 
+@SuppressWarnings("deprecation")
 final class X509TrustManagerComSunWrapper implements X509TrustManager {
 
     private javax.net.ssl.X509TrustManager theX509TrustManager;
diff --git a/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/DelegateHttpsURLConnection.java b/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/DelegateHttpsURLConnection.java
index a068367f343..3c05c37a037 100644
--- a/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/DelegateHttpsURLConnection.java
+++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/DelegateHttpsURLConnection.java
@@ -53,6 +53,7 @@ import sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection;
  * com.sun.net.ssl.HttpURLConnection is used in the com.sun version.
  *
  */
+@SuppressWarnings("deprecation") // HttpsURLConnection is deprecated
 public class DelegateHttpsURLConnection extends AbstractDelegateHttpsURLConnection {
 
     // we need a reference to the HttpsURLConnection to get
@@ -62,6 +63,7 @@ public class DelegateHttpsURLConnection extends AbstractDelegateHttpsURLConnecti
     // this is for ResponseCache.put(URI, URLConnection)
     // second parameter needs to be cast to javax.net.ssl.HttpsURLConnection
     // instead of AbstractDelegateHttpsURLConnection
+
     public com.sun.net.ssl.HttpsURLConnection httpsURLConnection;
 
     DelegateHttpsURLConnection(URL url,
@@ -98,9 +100,10 @@ public class DelegateHttpsURLConnection extends AbstractDelegateHttpsURLConnecti
 }
 
 class VerifierWrapper implements javax.net.ssl.HostnameVerifier {
-
+    @SuppressWarnings("deprecation")
     private com.sun.net.ssl.HostnameVerifier verifier;
 
+    @SuppressWarnings("deprecation")
     VerifierWrapper(com.sun.net.ssl.HostnameVerifier verifier) {
         this.verifier = verifier;
     }
diff --git a/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java b/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java
index 07237569fbe..fba0b3befce 100644
--- a/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java
+++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/internal/www/protocol/https/HttpsURLConnectionOldImpl.java
@@ -64,6 +64,7 @@ import sun.net.www.http.HttpClient;
 // For both copies of the file, uncomment one line and comment the other
 // public class HttpsURLConnectionImpl
 //      extends javax.net.ssl.HttpsURLConnection {
+@SuppressWarnings("deprecation") // HttpsURLConnection is deprecated
 public class HttpsURLConnectionOldImpl
         extends com.sun.net.ssl.HttpsURLConnection {
 
diff --git a/jdk/src/java.base/share/classes/java/util/jar/Attributes.java b/jdk/src/java.base/share/classes/java/util/jar/Attributes.java
index 3140deef6a9..655f5df9e78 100644
--- a/jdk/src/java.base/share/classes/java/util/jar/Attributes.java
+++ b/jdk/src/java.base/share/classes/java/util/jar/Attributes.java
@@ -298,6 +298,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
      * Writes the current attributes to the specified data output stream.
      * XXX Need to handle UTF8 values and break up lines longer than 72 bytes
      */
+     @SuppressWarnings("deprecation")
      void write(DataOutputStream os) throws IOException {
          for (Entry<Object, Object> e : entrySet()) {
              StringBuffer buffer = new StringBuffer(
@@ -325,6 +326,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
      *
      * XXX Need to handle UTF8 values and break up lines longer than 72 bytes
      */
+    @SuppressWarnings("deprecation")
     void writeMain(DataOutputStream out) throws IOException
     {
         // write out the *-Version header first, if it exists
@@ -367,6 +369,7 @@ public class Attributes implements Map<Object,Object>, Cloneable {
      * Reads attributes from the specified input stream.
      * XXX Need to handle UTF8 values.
      */
+    @SuppressWarnings("deprecation")
     void read(Manifest.FastInputStream is, byte[] lbuf) throws IOException {
         String name = null, value = null;
         byte[] lastline = null;
diff --git a/jdk/src/java.base/share/classes/java/util/jar/Manifest.java b/jdk/src/java.base/share/classes/java/util/jar/Manifest.java
index 75a7512945e..90c9e99595f 100644
--- a/jdk/src/java.base/share/classes/java/util/jar/Manifest.java
+++ b/jdk/src/java.base/share/classes/java/util/jar/Manifest.java
@@ -143,6 +143,7 @@ public class Manifest implements Cloneable {
      * @exception IOException if an I/O error has occurred
      * @see #getMainAttributes
      */
+    @SuppressWarnings("deprecation")
     public void write(OutputStream out) throws IOException {
         DataOutputStream dos = new DataOutputStream(out);
         // Write out the main attributes for the manifest
diff --git a/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java
index 251e3042800..f7e9773e0ea 100644
--- a/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java
+++ b/jdk/src/java.base/share/classes/java/util/zip/CRC32C.java
@@ -204,6 +204,7 @@ public final class CRC32C implements Checksum {
     /**
      * Updates the CRC-32C checksum with the specified array of bytes.
      */
+    @SuppressWarnings("deprecation") // Unsafe.{getInt, getLong}
     private static int updateBytes(int crc, byte[] b, int off, int end) {
 
         // Do only byte reads for arrays so short they can't be aligned
diff --git a/jdk/src/java.base/share/classes/sun/net/idn/UCharacterDirection.java b/jdk/src/java.base/share/classes/sun/net/idn/UCharacterDirection.java
index 4b55bab7618..957cfdbed81 100644
--- a/jdk/src/java.base/share/classes/sun/net/idn/UCharacterDirection.java
+++ b/jdk/src/java.base/share/classes/sun/net/idn/UCharacterDirection.java
@@ -46,6 +46,7 @@ package sun.net.idn;
  * @stable ICU 2.1
  */
 
+@SuppressWarnings("deprecation")
 final class UCharacterDirection implements UCharacterEnums.ECharacterDirection {
 
     // private constructor =========================================
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java
index f9926b3ab66..c7257e52e9c 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java
@@ -1963,6 +1963,7 @@ static final class Finished extends HandshakeMessage {
                  * algorithm.  If we ever run across a different
                  * length, this call will need to be updated.
                  */
+                @SuppressWarnings("deprecation")
                 TlsPrfParameterSpec spec = new TlsPrfParameterSpec(
                     masterKey, tlsLabel, seed, 12,
                     prfHashAlg, prfHashLength, prfBlockSize);
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java b/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java
index 80c2a518c1b..12d3247cf44 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java
@@ -1122,6 +1122,7 @@ abstract class Handshaker {
         int prfHashLength = prf.getPRFHashLength();
         int prfBlockSize = prf.getPRFBlockSize();
 
+        @SuppressWarnings("deprecation")
         TlsMasterSecretParameterSpec spec = new TlsMasterSecretParameterSpec(
                 preMasterSecret, protocolVersion.major, protocolVersion.minor,
                 clnt_random.random_bytes, svr_random.random_bytes,
@@ -1156,6 +1157,7 @@ abstract class Handshaker {
      * a premaster secret and started a new session) as well as on the
      * "fast handshake" (where we just resumed a pre-existing session).
      */
+    @SuppressWarnings("deprecation")
     void calculateConnectionKeys(SecretKey masterKey) {
         /*
          * For both the read and write sides of the protocol, we use the
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java b/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java
index c1c53def81e..a647cfda785 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/RSAClientKeyExchange.java
@@ -63,6 +63,7 @@ final class RSAClientKeyExchange extends HandshakeMessage {
      * it, using its RSA private key.  Result is the same size as the
      * server's public key, and uses PKCS #1 block format 02.
      */
+    @SuppressWarnings("deprecation")
     RSAClientKeyExchange(ProtocolVersion protocolVersion,
             ProtocolVersion maxVersion,
             SecureRandom generator, PublicKey publicKey) throws IOException {
@@ -92,6 +93,7 @@ final class RSAClientKeyExchange extends HandshakeMessage {
      * Server gets the PKCS #1 (block format 02) data, decrypts
      * it with its private key.
      */
+    @SuppressWarnings("deprecation")
     RSAClientKeyExchange(ProtocolVersion currentVersion,
             ProtocolVersion maxVersion,
             SecureRandom generator, HandshakeInStream input,
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/RSASignature.java b/jdk/src/java.base/share/classes/sun/security/ssl/RSASignature.java
index 94a1e8ecede..5c37e57bdde 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/RSASignature.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/RSASignature.java
@@ -83,6 +83,7 @@ public final class RSASignature extends SignatureSpi {
     /**
      * Set the MD5 and SHA hashes to the provided objects.
      */
+    @SuppressWarnings("deprecation")
     static void setHashes(Signature sig, MessageDigest md5, MessageDigest sha) {
         sig.setParameter("hashes", new MessageDigest[] {md5, sha});
     }
@@ -183,6 +184,7 @@ public final class RSASignature extends SignatureSpi {
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected void engineSetParameter(String param, Object value)
             throws InvalidParameterException {
         if (param.equals("hashes") == false) {
@@ -199,6 +201,7 @@ public final class RSASignature extends SignatureSpi {
     }
 
     @Override
+    @SuppressWarnings("deprecation")
     protected Object engineGetParameter(String param)
             throws InvalidParameterException {
         throw new InvalidParameterException("Parameters not supported");
diff --git a/jdk/src/java.base/share/classes/sun/text/normalizer/RuleCharacterIterator.java b/jdk/src/java.base/share/classes/sun/text/normalizer/RuleCharacterIterator.java
index e0ea1b12513..029ceecb5e5 100644
--- a/jdk/src/java.base/share/classes/sun/text/normalizer/RuleCharacterIterator.java
+++ b/jdk/src/java.base/share/classes/sun/text/normalizer/RuleCharacterIterator.java
@@ -54,6 +54,7 @@ import java.text.ParsePosition;
  * @author Alan Liu
  * @since ICU 2.8
  */
+@SuppressWarnings("deprecation")
 public class RuleCharacterIterator {
 
     // TODO: Ideas for later.  (Do not implement if not needed, lest the
diff --git a/jdk/src/java.base/share/classes/sun/text/normalizer/UnicodeSet.java b/jdk/src/java.base/share/classes/sun/text/normalizer/UnicodeSet.java
index 0243fe3f6f6..a1784652be8 100644
--- a/jdk/src/java.base/share/classes/sun/text/normalizer/UnicodeSet.java
+++ b/jdk/src/java.base/share/classes/sun/text/normalizer/UnicodeSet.java
@@ -273,6 +273,7 @@ import java.util.TreeSet;
  * @stable ICU 2.0
  * @see UnicodeSetIterator
  */
+@SuppressWarnings("deprecation")
 public class UnicodeSet implements UnicodeMatcher {
 
     private static final int LOW = 0x000000; // LOW <= all valid values. ZERO for codepoints

From 36ab0d5c9acfd553442bf7de7d044aa8466a2d6c Mon Sep 17 00:00:00 2001
From: Igor Ignatyev <iignatyev@openjdk.org>
Date: Thu, 4 Dec 2014 14:14:09 -0800
Subject: [PATCH 237/299] 8066713: ignore compiler/types/correctness

Add @ignore to compiler/types/correctness tests

Reviewed-by: kvn
---
 hotspot/test/compiler/types/correctness/CorrectnessTest.java | 1 +
 hotspot/test/compiler/types/correctness/OffTest.java         | 1 +
 2 files changed, 2 insertions(+)

diff --git a/hotspot/test/compiler/types/correctness/CorrectnessTest.java b/hotspot/test/compiler/types/correctness/CorrectnessTest.java
index 3d0bca775dd..3d002c3e660 100644
--- a/hotspot/test/compiler/types/correctness/CorrectnessTest.java
+++ b/hotspot/test/compiler/types/correctness/CorrectnessTest.java
@@ -25,6 +25,7 @@
  * @test CorrectnessTest
  * @bug 8038418
  * @library /testlibrary /testlibrary/whitebox
+ * @ignore 8066173
  * @compile execution/TypeConflict.java execution/TypeProfile.java
  *          execution/MethodHandleDelegate.java
  * @build CorrectnessTest
diff --git a/hotspot/test/compiler/types/correctness/OffTest.java b/hotspot/test/compiler/types/correctness/OffTest.java
index 374db539b80..86221c53c54 100644
--- a/hotspot/test/compiler/types/correctness/OffTest.java
+++ b/hotspot/test/compiler/types/correctness/OffTest.java
@@ -25,6 +25,7 @@
  * @test CorrectnessTest
  * @bug 8038418
  * @library /testlibrary /testlibrary/whitebox
+ * @ignore 8066173
  * @compile execution/TypeConflict.java execution/TypeProfile.java
  *          execution/MethodHandleDelegate.java
  * @build CorrectnessTest

From de3548c4b99231789b53f1f76ac943687c8c491a Mon Sep 17 00:00:00 2001
From: Alan Bateman <alan.bateman@oracle.com>
Date: Thu, 4 Dec 2014 14:57:40 -0800
Subject: [PATCH 238/299] 8066731: javac does not work on exploded image

Reviewed-by: jjg, mchung
---
 .../classes/com/sun/tools/javac/file/JRTIndex.java    | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java
index 975816ded62..889ef82d6a6 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/file/JRTIndex.java
@@ -31,8 +31,10 @@ import java.net.URI;
 import java.nio.file.DirectoryStream;
 import java.nio.file.FileSystem;
 import java.nio.file.FileSystems;
+import java.nio.file.FileSystemNotFoundException;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.ProviderNotFoundException;
 import java.nio.file.spi.FileSystemProvider;
 import java.util.Collections;
 import java.util.HashMap;
@@ -79,11 +81,12 @@ public class JRTIndex {
     }
 
     public static boolean isAvailable() {
-        for (FileSystemProvider p: FileSystemProvider.installedProviders()) {
-            if (p.getScheme().equals("jrt"))
-                return true;
+        try {
+            FileSystems.getFileSystem(URI.create("jrt:/"));
+            return true;
+        } catch (ProviderNotFoundException | FileSystemNotFoundException e) {
+            return false;
         }
-        return false;
     }
 
 

From 61cf03f4f1e93e1a3066fc7571a089e900a6443a Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Thu, 4 Dec 2014 15:04:11 -0800
Subject: [PATCH 239/299] 8066632: Suppress deprecation warnings in java.rmi
 module

Reviewed-by: rriggs
---
 .../java.rmi/share/classes/java/rmi/server/RemoteObject.java   | 3 ++-
 .../java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java  | 3 ++-
 .../share/classes/sun/rmi/server/MarshalOutputStream.java      | 3 ++-
 .../share/classes/sun/rmi/transport/proxy/HttpInputStream.java | 3 ++-
 4 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/jdk/src/java.rmi/share/classes/java/rmi/server/RemoteObject.java b/jdk/src/java.rmi/share/classes/java/rmi/server/RemoteObject.java
index c504692f1bf..86967ebd8da 100644
--- a/jdk/src/java.rmi/share/classes/java/rmi/server/RemoteObject.java
+++ b/jdk/src/java.rmi/share/classes/java/rmi/server/RemoteObject.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, 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
@@ -94,6 +94,7 @@ public abstract class RemoteObject implements Remote, java.io.Serializable {
      * remote object could not be found.
      * @since 1.2
      */
+    @SuppressWarnings("deprecation")
     public static Remote toStub(Remote obj) throws NoSuchObjectException {
         if (obj instanceof RemoteStub ||
             (obj != null &&
diff --git a/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java b/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java
index f8280552071..37451a36eaf 100644
--- a/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/registry/RegistryImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, 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
@@ -336,6 +336,7 @@ public class RegistryImpl extends java.rmi.server.RemoteServer
      * Main program to start a registry. <br>
      * The port number can be specified on the command line.
      */
+    @SuppressWarnings("deprecation")
     public static void main(String args[])
     {
         // Create and install the security manager if one is not installed
diff --git a/jdk/src/java.rmi/share/classes/sun/rmi/server/MarshalOutputStream.java b/jdk/src/java.rmi/share/classes/sun/rmi/server/MarshalOutputStream.java
index 699f1107259..33d216b09a2 100644
--- a/jdk/src/java.rmi/share/classes/sun/rmi/server/MarshalOutputStream.java
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/server/MarshalOutputStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,6 +76,7 @@ public class MarshalOutputStream extends ObjectOutputStream
      * Checks for objects that are instances of java.rmi.Remote
      * that need to be serialized as proxy objects.
      */
+    @SuppressWarnings("deprecation")
     protected final Object replaceObject(Object obj) throws IOException {
         if ((obj instanceof Remote) && !(obj instanceof RemoteStub)) {
             Target target = ObjectTable.getTarget((Remote) obj);
diff --git a/jdk/src/java.rmi/share/classes/sun/rmi/transport/proxy/HttpInputStream.java b/jdk/src/java.rmi/share/classes/sun/rmi/transport/proxy/HttpInputStream.java
index 3a35bb02b25..4b5cad95044 100644
--- a/jdk/src/java.rmi/share/classes/sun/rmi/transport/proxy/HttpInputStream.java
+++ b/jdk/src/java.rmi/share/classes/sun/rmi/transport/proxy/HttpInputStream.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2014, 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
@@ -45,6 +45,7 @@ class HttpInputStream extends FilterInputStream {
      * Create new filter on a given input stream.
      * @param in the InputStream to filter from
      */
+    @SuppressWarnings("deprecation")
     public HttpInputStream(InputStream in) throws IOException
     {
         super(in);

From 765c10de6e60c145231bc67f1b95b9ec7abb8f03 Mon Sep 17 00:00:00 2001
From: Stuart Marks <smarks@openjdk.org>
Date: Thu, 4 Dec 2014 18:54:37 -0800
Subject: [PATCH 240/299] 8035001: TEST_BUG: the retry logic in RMID.start()
 should check that the subprocess hasn't terminated

Reviewed-by: lancea
---
 jdk/test/java/rmi/testlibrary/JavaVM.java | 22 ++++-----
 jdk/test/java/rmi/testlibrary/RMID.java   | 59 +++++++++++++++--------
 2 files changed, 50 insertions(+), 31 deletions(-)

diff --git a/jdk/test/java/rmi/testlibrary/JavaVM.java b/jdk/test/java/rmi/testlibrary/JavaVM.java
index b7137a82872..a4345cb3e88 100644
--- a/jdk/test/java/rmi/testlibrary/JavaVM.java
+++ b/jdk/test/java/rmi/testlibrary/JavaVM.java
@@ -34,6 +34,8 @@ import java.util.concurrent.TimeoutException;
  */
 public class JavaVM {
 
+    public static final long POLLTIME_MS = 100L;
+
     protected Process vm = null;
 
     private String classname = "";
@@ -192,23 +194,21 @@ public class JavaVM {
             throws InterruptedException, TimeoutException {
         if (vm == null)
             throw new IllegalStateException("can't wait for JavaVM that isn't running");
-        long startTime = System.currentTimeMillis();
-        long rem = timeout;
+        long deadline = System.currentTimeMillis() + timeout;
 
-        do {
+        while (true) {
             try {
                 int status = vm.exitValue();
                 outPipe.join();
                 errPipe.join();
                 return status;
-            } catch (IllegalThreadStateException ex) {
-                if (rem > 0) {
-                    Thread.sleep(Math.min(rem, 100));
-                }
-            }
-            rem = timeout - (System.currentTimeMillis() - startTime);
-        } while (rem > 0);
-        throw new TimeoutException();
+            } catch (IllegalThreadStateException ignore) { }
+
+            if (System.currentTimeMillis() > deadline)
+                throw new TimeoutException();
+
+            Thread.sleep(POLLTIME_MS);
+        }
     }
 
     /**
diff --git a/jdk/test/java/rmi/testlibrary/RMID.java b/jdk/test/java/rmi/testlibrary/RMID.java
index 29365e8125f..39e05b034bd 100644
--- a/jdk/test/java/rmi/testlibrary/RMID.java
+++ b/jdk/test/java/rmi/testlibrary/RMID.java
@@ -256,19 +256,28 @@ public class RMID extends JavaVM {
         } catch (NumberFormatException ignore) {}
         waitTime = waitTime * slopFactor;
 
-        // We check several times, for a maximum of waitTime, until we have
-        // verified that rmid is running.
-        do {
+        long startTime = System.currentTimeMillis();
+        long deadline = startTime + waitTime;
+
+        while (true) {
             try {
-                Thread.sleep(Math.min(waitTime, POLLTIME_MS));
+                Thread.sleep(POLLTIME_MS);
             } catch (InterruptedException ie) {
                 Thread.currentThread().interrupt();
-                mesg("Interrupted while starting activation system, giving up.");
+                mesg("Starting rmid interrupted, giving up at " +
+                    (System.currentTimeMillis() - startTime) + "ms.");
                 return;
             }
-            waitTime -= POLLTIME_MS;
 
-            // Checking if rmid is present
+            try {
+                int status = vm.exitValue();
+                TestLibrary.bomb("Rmid process exited with status " + status + " after " +
+                    (System.currentTimeMillis() - startTime) + "ms.");
+            } catch (IllegalThreadStateException ignore) { }
+
+            // The rmid process is alive; check to see whether
+            // it responds to a remote call.
+
             if (lookupSystem(port) != null) {
                 /*
                  * We need to set the java.rmi.activation.port value as the
@@ -278,15 +287,16 @@ public class RMID extends JavaVM {
                  * incorrect value.
                  */
                 System.setProperty("java.rmi.activation.port", Integer.toString(port));
-                mesg("Started successfully.");
+                mesg("Started successfully after " +
+                    (System.currentTimeMillis() - startTime) + "ms.");
                 return;
-            } else {
-                if (waitTime > 0) {
-                    mesg("rmid not started, will retry for " + waitTime + "ms");
-                }
             }
-        } while (waitTime > 0);
-        TestLibrary.bomb("Failed to start rmid, giving up.", null);
+
+            if (System.currentTimeMillis() > deadline) {
+                TestLibrary.bomb("Failed to start rmid, giving up after " +
+                    (System.currentTimeMillis() - startTime) + "ms.", null);
+            }
+        }
     }
 
     /**
@@ -309,9 +319,11 @@ public class RMID extends JavaVM {
      */
     private boolean shutdown() throws InterruptedException {
         mesg("shutdown()");
+        long startTime = System.currentTimeMillis();
         ActivationSystem system = lookupSystem(port);
         if (system == null) {
-            mesg("lookupSystem() returned null");
+            mesg("lookupSystem() returned null after " +
+                (System.currentTimeMillis() - startTime) + "ms.");
             return false;
         }
 
@@ -325,10 +337,12 @@ public class RMID extends JavaVM {
 
         try {
             waitFor(TIMEOUT_SHUTDOWN_MS);
-            mesg("Shutdown successful.");
+            mesg("Shutdown successful after " +
+                (System.currentTimeMillis() - startTime) + "ms.");
             return true;
         } catch (TimeoutException ex) {
-            mesg("Shutdown timed out:");
+            mesg("Shutdown timed out after " +
+                (System.currentTimeMillis() - startTime) + "ms:");
             ex.printStackTrace();
             return false;
         }
@@ -344,6 +358,8 @@ public class RMID extends JavaVM {
             throw new IllegalStateException("can't wait for RMID that isn't running");
         }
 
+        long startTime = System.currentTimeMillis();
+
         // First, attempt graceful shutdown of the activation system.
         try {
             if (! shutdown()) {
@@ -352,14 +368,17 @@ public class RMID extends JavaVM {
                 vm.destroy();
                 try {
                     waitFor(TIMEOUT_DESTROY_MS);
-                    mesg("Destroy successful.");
+                    mesg("Destroy successful after " +
+                        (System.currentTimeMillis() - startTime) + "ms.");
                 } catch (TimeoutException ex) {
-                    mesg("Destroy timed out, giving up.");
+                    mesg("Destroy timed out, giving up after " +
+                        (System.currentTimeMillis() - startTime) + "ms:");
                     ex.printStackTrace();
                 }
             }
         } catch (InterruptedException ie) {
-            mesg("Shutdown/destroy interrupted, giving up.");
+            mesg("Shutdown/destroy interrupted, giving up at " +
+                (System.currentTimeMillis() - startTime) + "ms.");
             ie.printStackTrace();
             Thread.currentThread().interrupt();
             return;

From 78fd11386cbe0318eb03f701651cb7b9ee08b10f Mon Sep 17 00:00:00 2001
From: Jonathan Gibbons <jjg@openjdk.org>
Date: Thu, 4 Dec 2014 19:09:29 -0800
Subject: [PATCH 241/299] 8066737:
 langtools/test/tools/javac/processing/6348193/T6348193.java fails

Reviewed-by: darcy
---
 langtools/test/tools/javac/processing/6348193/T6348193.java | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/langtools/test/tools/javac/processing/6348193/T6348193.java b/langtools/test/tools/javac/processing/6348193/T6348193.java
index 1a631b20a08..4a4cb563d92 100644
--- a/langtools/test/tools/javac/processing/6348193/T6348193.java
+++ b/langtools/test/tools/javac/processing/6348193/T6348193.java
@@ -31,6 +31,7 @@
 
 import java.io.*;
 import java.net.*;
+import java.security.*;
 import java.util.*;
 import javax.annotation.processing.*;
 import javax.lang.model.element.*;
@@ -176,6 +177,7 @@ public class T6348193 extends AbstractProcessor
         public void checkPropertyAccess(String key) { /*OK*/ }
 
         public void checkDelete(String file) { /*OK*/ }
+        public void checkPermission(Permission perm) { /*OK*/ }
         public void checkRead(FileDescriptor fd) { /*OK*/ }
         public void checkRead(String file) { /*OK*/ }
         public void checkRead(String file, Object context) { /*OK*/ }

From f42d5e85e36809033b3df9a32107b08c82149c47 Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan <sundar@openjdk.org>
Date: Fri, 5 Dec 2014 14:35:00 +0530
Subject: [PATCH 242/299] 8066749: jdk9-dev/nashorn ant build fails with jdk9
 modular image build as JAVA_HOME

Reviewed-by: lagergren, hannesw
---
 nashorn/buildtools/nasgen/build.xml           |  2 +-
 nashorn/make/build-nasgen.xml                 |  2 +-
 nashorn/make/build.xml                        |  3 ++-
 nashorn/make/project.properties               |  2 +-
 .../codegen/OptimisticTypesPersistence.java   |  3 +++
 nashorn/test/script/basic/JDK-8059443.js      | 23 +++++++++++++++----
 6 files changed, 27 insertions(+), 8 deletions(-)

diff --git a/nashorn/buildtools/nasgen/build.xml b/nashorn/buildtools/nasgen/build.xml
index 6243bb2f02c..60321430748 100644
--- a/nashorn/buildtools/nasgen/build.xml
+++ b/nashorn/buildtools/nasgen/build.xml
@@ -43,7 +43,7 @@
            classpath="${javac.classpath}"
            debug="${javac.debug}"
            includeantruntime="false" fork="true">
-      <compilerarg value="-J-Djava.ext.dirs="/>
+      <compilerarg value="-J-Xbootclasspath/p:${javac.classpath}"/>
       <compilerarg value="-Xlint:unchecked"/>
       <compilerarg value="-Xlint:deprecation"/>
       <compilerarg value="-XDignore.symbol.file"/>
diff --git a/nashorn/make/build-nasgen.xml b/nashorn/make/build-nasgen.xml
index 862a1999ba0..d98333719bd 100644
--- a/nashorn/make/build-nasgen.xml
+++ b/nashorn/make/build-nasgen.xml
@@ -39,7 +39,7 @@
                 <pathelement location="${dist.dir}/nasgen.jar"/>
                 <pathelement path="${build.dir}/classes"/>
             </classpath>
-            <jvmarg value="-Djava.ext.dirs="/>
+            <jvmarg value="${boot.class.path}"/>
             <arg value="${build.dir}/classes"/>
             <arg value="jdk.nashorn.internal.objects"/>
             <arg value="${build.dir}/classes"/>
diff --git a/nashorn/make/build.xml b/nashorn/make/build.xml
index 20fcedb4e94..732ac5fa0c2 100644
--- a/nashorn/make/build.xml
+++ b/nashorn/make/build.xml
@@ -38,7 +38,7 @@
     <path id="nashorn.boot.prefix.path">
       <pathelement location="${dist.jar}"/>
     </path>
-    <property name="boot.class.path" value="-Xbootclasspath/p:&quot;${toString:nashorn.boot.prefix.path}&quot;"/>
+    <property name="boot.class.path" value="-Xbootclasspath/p:${toString:nashorn.boot.prefix.path}"/>
     <condition property="svn.executable" value="/usr/local/bin/svn" else="svn">
       <available file="/usr/local/bin/svn"/>
     </condition>
@@ -271,6 +271,7 @@
            debug="${javac.debug}"
            encoding="${javac.encoding}"
            includeantruntime="false" fork="true">
+        <compilerarg value="${boot.class.path}"/>
         <compilerarg value="-Xlint:unchecked"/>
         <compilerarg value="-Xlint:deprecation"/>
         <compilerarg value="-Xdiags:verbose"/>
diff --git a/nashorn/make/project.properties b/nashorn/make/project.properties
index 2b49078e137..7180163a67e 100644
--- a/nashorn/make/project.properties
+++ b/nashorn/make/project.properties
@@ -284,7 +284,7 @@ run.test.jvmargs.common=\
   -XX:+HeapDumpOnOutOfMemoryError
 
 # turn on assertions for tests
-run.test.jvmargs.main=${run.test.jvmargs.common} -ea
+run.test.jvmargs.main=${run.test.jvmargs.common} -esa -ea
 
 # Extra jvmargs that might be useful for debugging
 # and performance improvements/monitoring
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
index 53a107e62c6..225169fc577 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
@@ -388,6 +388,9 @@ public final class OptimisticTypesPersistence {
             final File dir = new File(dirStr);
             return "dev-" + new SimpleDateFormat("yyyyMMdd-HHmmss").format(new Date(getLastModifiedClassFile(
                     dir, 0L)));
+        } else if(protocol.equals("jrt")) {
+            // FIXME: revisit this for a better option with jrt
+            return "jrt";
         } else {
             throw new AssertionError();
         }
diff --git a/nashorn/test/script/basic/JDK-8059443.js b/nashorn/test/script/basic/JDK-8059443.js
index e0d2b0f86bb..acd0482b347 100644
--- a/nashorn/test/script/basic/JDK-8059443.js
+++ b/nashorn/test/script/basic/JDK-8059443.js
@@ -33,7 +33,22 @@
 
 var NullProvider = Java.type("jdk.nashorn.test.models.NullProvider");
 
-if (!NullProvider.getBoolean()) { print("yay"); }
-print(NullProvider.getLong() * (1 << 33));
-print(NullProvider.getDouble() / 2.5);
-print(NullProvider.getInteger() << 1);
+try {
+    if (!NullProvider.getBoolean()) { print("yay"); }
+    print(NullProvider.getLong() * (1 << 33));
+    print(NullProvider.getDouble() / 2.5);
+    print(NullProvider.getInteger() << 1);
+} catch (e if e instanceof java.lang.NullPointerException) {
+    var st = e.stackTrace;
+    if (st.length > 0 &&
+        st[0].className.equals("sun.invoke.util.ValueConversions")) {
+        // buggy JVM. ignore NPE and pass vacuously
+        // print to match .EXPECTED output
+        print("yay");
+        print(0);
+        print(0);
+        print(0);
+    } else {
+        throw e;
+    }
+}

From 7e7e10eb420a69f71e1c08411b52336b6436368f Mon Sep 17 00:00:00 2001
From: Daniel Fuchs <dfuchs@openjdk.org>
Date: Fri, 5 Dec 2014 12:20:51 +0100
Subject: [PATCH 243/299] 8065991: LogManager unecessarily calls JavaAWTAccess
 from within a critical section

The call to JavaAWTAccess is moved outside of the critical section

Reviewed-by: mchung
---
 .../classes/java/util/logging/LogManager.java |  10 +-
 .../logging/LogManagerAppContextDeadlock.java | 370 ++++++++++++++++++
 2 files changed, 375 insertions(+), 5 deletions(-)
 create mode 100644 jdk/test/java/util/logging/LogManagerAppContextDeadlock.java

diff --git a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java
index 36cdc3272b4..b852d8ae78c 100644
--- a/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java
+++ b/jdk/src/java.logging/share/classes/java/util/logging/LogManager.java
@@ -458,11 +458,11 @@ public class LogManager {
         JavaAWTAccess javaAwtAccess = SharedSecrets.getJavaAWTAccess();
         if (sm != null && javaAwtAccess != null) {
             // for each applet, it has its own LoggerContext isolated from others
-            synchronized (javaAwtAccess) {
-                // find the AppContext of the applet code
-                // will be null if we are in the main app context.
-                final Object ecx = javaAwtAccess.getAppletContext();
-                if (ecx != null) {
+            final Object ecx = javaAwtAccess.getAppletContext();
+            if (ecx != null) {
+                synchronized (javaAwtAccess) {
+                    // find the AppContext of the applet code
+                    // will be null if we are in the main app context.
                     if (contextsMap == null) {
                         contextsMap = new WeakHashMap<>();
                     }
diff --git a/jdk/test/java/util/logging/LogManagerAppContextDeadlock.java b/jdk/test/java/util/logging/LogManagerAppContextDeadlock.java
new file mode 100644
index 00000000000..3e4918e5fee
--- /dev/null
+++ b/jdk/test/java/util/logging/LogManagerAppContextDeadlock.java
@@ -0,0 +1,370 @@
+/*
+ * Copyright (c) 2013, 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.lang.management.ManagementFactory;
+import java.lang.management.ThreadInfo;
+import java.security.CodeSource;
+import java.security.Permission;
+import java.security.PermissionCollection;
+import java.security.Permissions;
+import java.security.Policy;
+import java.security.ProtectionDomain;
+import java.util.Enumeration;
+import java.util.concurrent.Semaphore;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.logging.LogManager;
+import java.util.logging.Logger;
+
+/**
+ * @test
+ * @bug 8065991
+ * @summary check that when LogManager is initialized, a deadlock similar
+ *          to that described in 8065709 will not occur.
+ * @run main/othervm LogManagerAppContextDeadlock UNSECURE
+ * @run main/othervm LogManagerAppContextDeadlock SECURE
+ *
+ * @author danielfuchs
+ */
+public class LogManagerAppContextDeadlock {
+
+    public static final Semaphore sem = new Semaphore(0);
+    public static final Semaphore sem2 = new Semaphore(0);
+    public static final Semaphore sem3 = new Semaphore(-2);
+    public static volatile boolean goOn = true;
+    public static volatile Exception thrown;
+
+    // Emulate EventQueue
+    static class FakeEventQueue {
+        static final Logger logger = Logger.getLogger("foo");
+    }
+
+    // Emulate AppContext
+    static class FakeAppContext {
+
+        final static AtomicInteger numAppContexts = new AtomicInteger(0);
+        static final class FakeAppContextLock {}
+        static final FakeAppContextLock lock = new FakeAppContextLock();
+        static volatile FakeAppContext appContext;
+
+        final FakeEventQueue queue;
+        FakeAppContext() {
+            appContext = this;
+            numAppContexts.incrementAndGet();
+            // release sem2 to let Thread t2 call Logger.getLogger().
+            sem2.release();
+            try {
+                // Wait until we JavaAWTAccess is called by LogManager.
+                // Thread 2 will call Logger.getLogger() which will
+                // trigger a call to JavaAWTAccess - which will release
+                // sem, thus ensuring that Thread #2 is where we want it.
+                sem.acquire();
+                System.out.println("Sem acquired: Thread #2 has called JavaAWTAccess");
+            } catch(InterruptedException x) {
+                Thread.interrupted();
+            }
+            queue = new FakeEventQueue();
+        }
+
+        static FakeAppContext getAppContext() {
+            synchronized (lock) {
+                if (numAppContexts.get() == 0) {
+                    return new FakeAppContext();
+                }
+                return appContext;
+            }
+        }
+
+        static {
+            sun.misc.SharedSecrets.setJavaAWTAccess(new sun.misc.JavaAWTAccess() {
+                @Override
+                public Object getAppletContext() {
+                    if (numAppContexts.get() == 0) return null;
+                    // We are in JavaAWTAccess, we can release sem and let
+                    // FakeAppContext constructor proceeed.
+                    System.out.println("Releasing Sem");
+                    sem.release();
+                    return getAppContext();
+                }
+
+            });
+        }
+
+    }
+
+
+    // Test with or without a security manager
+    public static enum TestCase {
+        UNSECURE, SECURE;
+        public void run() throws Exception {
+            System.out.println("Running test case: " + name());
+            Configure.setUp(this);
+            test(this);
+        }
+    }
+
+    public static void test(TestCase test) throws Exception {
+        Thread t1 = new Thread() {
+            @Override
+            public void run() {
+                sem3.release();
+                System.out.println("FakeAppContext.getAppContext()");
+                FakeAppContext.getAppContext();
+                System.out.println("Done: FakeAppContext.getAppContext()");
+            }
+        };
+        t1.setDaemon(true);
+        t1.start();
+        Thread t2 = new Thread() {
+            public void run() {
+                sem3.release();
+                try {
+                    // Wait until Thread1 is in FakeAppContext constructor
+                    sem2.acquire();
+                    System.out.println("Sem2 acquired: Thread #1 will be waiting to acquire Sem");
+                } catch (InterruptedException ie) {
+                    Thread.interrupted();
+                }
+                System.out.println("Logger.getLogger(name).info(name)");
+                Logger.getLogger(test.name());//.info(name);
+                System.out.println("Done: Logger.getLogger(name).info(name)");
+            }
+        };
+        t2.setDaemon(true);
+        t2.start();
+        System.out.println("Should exit now...");
+        Thread detector = new DeadlockDetector();
+        detector.start();
+
+        // Wait for the 3 threads to start
+        sem3.acquire();
+
+        // Now wait for t1 & t2 to finish, or for a deadlock to be detected.
+        while (goOn && (t1.isAlive() || t2.isAlive())) {
+            if (t2.isAlive()) t2.join(1000);
+            if (test == TestCase.UNSECURE && System.getSecurityManager() == null) {
+                // if there's no security manager, AppContext.getAppContext() is
+                // not called -  so Thread t2 will not end up calling
+                // sem.release(). In that case we must release the semaphore here
+                // so that t1 can proceed.
+                if (LogManager.getLogManager().getLogger(TestCase.UNSECURE.name()) != null) {
+                    // means Thread t2 has created the logger
+                    sem.release();
+                }
+            }
+            if (t1.isAlive()) t1.join(1000);
+        }
+        if (thrown != null) {
+            throw thrown;
+        }
+    }
+
+    // Thrown by the deadlock detector
+    static final class DeadlockException extends RuntimeException {
+        public DeadlockException(String message) {
+            super(message);
+        }
+        @Override
+        public void printStackTrace() {
+        }
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        if (args.length == 0) {
+            args = new String[] { "SECURE" };
+        }
+
+        // If we don't initialize LogManager here, there will be
+        // a deadlock.
+        // See <https://bugs.openjdk.java.net/browse/JDK-8065709?focusedCommentId=13582038&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13582038>
+        // for more details.
+        Logger.getLogger("main").info("starting...");
+        try {
+            TestCase.valueOf(args[0]).run();
+            System.out.println("Test "+args[0]+" Passed");
+        } catch(Throwable t) {
+            System.err.println("Test " + args[0] +" failed: " + t);
+            t.printStackTrace();
+        }
+    }
+
+    // Called by the deadlock detector when a deadlock is found.
+    static void fail(Exception x) {
+        x.printStackTrace();
+        if (thrown == null) {
+            thrown = x;
+        }
+        goOn = false;
+    }
+
+    // A thread that detect deadlocks.
+    final static class DeadlockDetector extends Thread {
+
+        public DeadlockDetector() {
+            this.setDaemon(true);
+        }
+
+        @Override
+        public void run() {
+            sem3.release();
+            Configure.doPrivileged(this::loop);
+        }
+        public void loop() {
+            while(goOn) {
+                try {
+                    long[] ids = ManagementFactory.getThreadMXBean().findDeadlockedThreads();
+                    ids = ids == null ? new long[0] : ids;
+                    if (ids.length == 1) {
+                        throw new RuntimeException("Found 1 deadlocked thread: "+ids[0]);
+                    } else if (ids.length > 0) {
+                        ThreadInfo[] infos = ManagementFactory.getThreadMXBean().getThreadInfo(ids, Integer.MAX_VALUE);
+                        System.err.println("Found "+ids.length+" deadlocked threads: ");
+                        for (ThreadInfo inf : infos) {
+                            System.err.println(inf);
+                        }
+                        throw new DeadlockException("Found "+ids.length+" deadlocked threads");
+                    }
+                    Thread.sleep(100);
+                } catch(InterruptedException | RuntimeException x) {
+                    fail(x);
+                }
+            }
+        }
+
+    }
+
+    // A helper class to configure the security manager for the test,
+    // and bypass it when needed.
+    static class Configure {
+        static Policy policy = null;
+        static final ThreadLocal<AtomicBoolean> allowAll = new ThreadLocal<AtomicBoolean>() {
+            @Override
+            protected AtomicBoolean initialValue() {
+                return  new AtomicBoolean(false);
+            }
+        };
+        static void setUp(TestCase test) {
+            switch (test) {
+                case SECURE:
+                    if (policy == null && System.getSecurityManager() != null) {
+                        throw new IllegalStateException("SecurityManager already set");
+                    } else if (policy == null) {
+                        policy = new SimplePolicy(TestCase.SECURE, allowAll);
+                        Policy.setPolicy(policy);
+                        System.setSecurityManager(new SecurityManager());
+                    }
+                    if (System.getSecurityManager() == null) {
+                        throw new IllegalStateException("No SecurityManager.");
+                    }
+                    if (policy == null) {
+                        throw new IllegalStateException("policy not configured");
+                    }
+                    break;
+                case UNSECURE:
+                    if (System.getSecurityManager() != null) {
+                        throw new IllegalStateException("SecurityManager already set");
+                    }
+                    break;
+                default:
+                    new InternalError("No such testcase: " + test);
+            }
+        }
+        static void doPrivileged(Runnable run) {
+            allowAll.get().set(true);
+            try {
+                run.run();
+            } finally {
+                allowAll.get().set(false);
+            }
+        }
+    }
+
+    // A Helper class to build a set of permissions.
+    final static class PermissionsBuilder {
+        final Permissions perms;
+        public PermissionsBuilder() {
+            this(new Permissions());
+        }
+        public PermissionsBuilder(Permissions perms) {
+            this.perms = perms;
+        }
+        public PermissionsBuilder add(Permission p) {
+            perms.add(p);
+            return this;
+        }
+        public PermissionsBuilder addAll(PermissionCollection col) {
+            if (col != null) {
+                for (Enumeration<Permission> e = col.elements(); e.hasMoreElements(); ) {
+                    perms.add(e.nextElement());
+                }
+            }
+            return this;
+        }
+        public Permissions toPermissions() {
+            final PermissionsBuilder builder = new PermissionsBuilder();
+            builder.addAll(perms);
+            return builder.perms;
+        }
+    }
+
+    // Policy for the test...
+    public static class SimplePolicy extends Policy {
+
+        final Permissions permissions;
+        final Permissions allPermissions;
+        final ThreadLocal<AtomicBoolean> allowAll; // actually: this should be in a thread locale
+        public SimplePolicy(TestCase test, ThreadLocal<AtomicBoolean> allowAll) {
+            this.allowAll = allowAll;
+            // we don't actually need any permission to create our
+            // FileHandlers because we're passing invalid parameters
+            // which will make the creation fail...
+            permissions = new Permissions();
+            permissions.add(new RuntimePermission("accessClassInPackage.sun.misc"));
+
+            // these are used for configuring the test itself...
+            allPermissions = new Permissions();
+            allPermissions.add(new java.security.AllPermission());
+
+        }
+
+        @Override
+        public boolean implies(ProtectionDomain domain, Permission permission) {
+            if (allowAll.get().get()) return allPermissions.implies(permission);
+            return permissions.implies(permission);
+        }
+
+        @Override
+        public PermissionCollection getPermissions(CodeSource codesource) {
+            return new PermissionsBuilder().addAll(allowAll.get().get()
+                    ? allPermissions : permissions).toPermissions();
+        }
+
+        @Override
+        public PermissionCollection getPermissions(ProtectionDomain domain) {
+            return new PermissionsBuilder().addAll(allowAll.get().get()
+                    ? allPermissions : permissions).toPermissions();
+        }
+    }
+
+}

From b2c1e8a2e75e86a2e6eac392418d72c4c3bc837d Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan <sundar@openjdk.org>
Date: Fri, 5 Dec 2014 19:01:26 +0530
Subject: [PATCH 244/299] 8066753: OptimisticTypePersistence.java should work
 properly with "jrt" URL

Reviewed-by: lagergren, attila
---
 .../codegen/OptimisticTypesPersistence.java   | 49 ++++++++++++++++++-
 1 file changed, 47 insertions(+), 2 deletions(-)

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
index 225169fc577..0dfe1c52c6d 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
@@ -30,13 +30,18 @@ import java.io.DataInputStream;
 import java.io.DataOutputStream;
 import java.io.File;
 import java.io.FileInputStream;
+import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.io.UncheckedIOException;
+import java.net.URI;
 import java.net.URL;
 import java.nio.file.Files;
+import java.nio.file.FileSystem;
+import java.nio.file.FileSystems;
 import java.nio.file.Path;
 import java.security.AccessController;
 import java.security.MessageDigest;
@@ -49,6 +54,7 @@ import java.util.Timer;
 import java.util.TimerTask;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.Consumer;
 import java.util.function.Function;
 import java.util.function.IntFunction;
 import java.util.function.Predicate;
@@ -389,8 +395,7 @@ public final class OptimisticTypesPersistence {
             return "dev-" + new SimpleDateFormat("yyyyMMdd-HHmmss").format(new Date(getLastModifiedClassFile(
                     dir, 0L)));
         } else if(protocol.equals("jrt")) {
-            // FIXME: revisit this for a better option with jrt
-            return "jrt";
+            return getJrtVersionDirName();
         } else {
             throw new AssertionError();
         }
@@ -549,4 +554,44 @@ public final class OptimisticTypesPersistence {
         }
         return Math.max(0, Integer.parseInt(str));
     }
+
+    // version directory name if nashorn is loaded from jrt:/ URL
+    private static String getJrtVersionDirName() throws Exception {
+        final FileSystem fs = getJrtFileSystem();
+        // consider all .class resources under nashorn module to compute checksum
+        final Path nashorn = fs.getPath("/jdk.scripting.nashorn");
+        if (! Files.isDirectory(nashorn)) {
+            throw new FileNotFoundException("missing /jdk.scripting.nashorn dir in jrt fs");
+        }
+        final MessageDigest digest = MessageDigest.getInstance("SHA-1");
+        Files.walk(nashorn).forEach(new Consumer<Path>() {
+            @Override
+            public void accept(Path p) {
+                // take only the .class resources.
+                if (Files.isRegularFile(p) && p.toString().endsWith(".class")) {
+                    try (final InputStream in = Files.newInputStream(p)) {
+                        // get actual (uncompressed) size from file attribute
+                        final int sz = ((Number)Files.getAttribute(p, "size")).intValue();
+                        final byte[] buf = new byte[sz];
+                        in.read(buf);
+                        digest.update(buf);
+                    } catch (final IOException ioe) {
+                        throw new UncheckedIOException(ioe);
+                    }
+                }
+            }
+        });
+        return Base64.getUrlEncoder().withoutPadding().encodeToString(digest.digest());
+    }
+
+    // get the default jrt FileSystem instance
+    private static FileSystem getJrtFileSystem() {
+        return AccessController.doPrivileged(
+            new PrivilegedAction<FileSystem>() {
+                @Override
+                public FileSystem run() {
+                    return FileSystems.getFileSystem(URI.create("jrt:/"));
+                }
+            });
+    }
 }

From 20c4b7ce9de6be35ae5e0b601a333f51d9bdc785 Mon Sep 17 00:00:00 2001
From: Paul Sandoz <paul.sandoz@oracle.com>
Date: Fri, 5 Dec 2014 20:17:51 +0530
Subject: [PATCH 245/299] 8066777: OptimisticTypesPersistence.java should use
 Files.readAllBytes instead of getting size and then read

Reviewed-by: attila, lagergren
---
 .../internal/codegen/OptimisticTypesPersistence.java      | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
index 0dfe1c52c6d..5cbed1bece2 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/OptimisticTypesPersistence.java
@@ -569,12 +569,8 @@ public final class OptimisticTypesPersistence {
             public void accept(Path p) {
                 // take only the .class resources.
                 if (Files.isRegularFile(p) && p.toString().endsWith(".class")) {
-                    try (final InputStream in = Files.newInputStream(p)) {
-                        // get actual (uncompressed) size from file attribute
-                        final int sz = ((Number)Files.getAttribute(p, "size")).intValue();
-                        final byte[] buf = new byte[sz];
-                        in.read(buf);
-                        digest.update(buf);
+                    try {
+                        digest.update(Files.readAllBytes(p));
                     } catch (final IOException ioe) {
                         throw new UncheckedIOException(ioe);
                     }

From 421fc583bedb3bb0ef421a4b752ff200cc3e296a Mon Sep 17 00:00:00 2001
From: Pavel Rappo <prappo@openjdk.org>
Date: Fri, 5 Dec 2014 15:35:15 +0000
Subject: [PATCH 246/299] 8066678: java.nio.channels.Channels cleanup

Reviewed-by: alanb, chegar
---
 .../classes/java/nio/channels/Channels.java   | 211 +++++++++---------
 1 file changed, 103 insertions(+), 108 deletions(-)

diff --git a/jdk/src/java.base/share/classes/java/nio/channels/Channels.java b/jdk/src/java.base/share/classes/java/nio/channels/Channels.java
index 2ab10fa2f7a..1325374755f 100644
--- a/jdk/src/java.base/share/classes/java/nio/channels/Channels.java
+++ b/jdk/src/java.base/share/classes/java/nio/channels/Channels.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -38,6 +38,7 @@ import java.nio.charset.CharsetDecoder;
 import java.nio.charset.CharsetEncoder;
 import java.nio.charset.UnsupportedCharsetException;
 import java.nio.channels.spi.AbstractInterruptibleChannel;
+import java.util.Objects;
 import java.util.concurrent.ExecutionException;
 import sun.nio.ch.ChannelInputStream;
 import sun.nio.cs.StreamDecoder;
@@ -48,8 +49,8 @@ import sun.nio.cs.StreamEncoder;
  * Utility methods for channels and streams.
  *
  * <p> This class defines static methods that support the interoperation of the
- * stream classes of the <tt>{@link java.io}</tt> package with the channel
- * classes of this package.  </p>
+ * stream classes of the {@link java.io} package with the channel classes
+ * of this package.  </p>
  *
  *
  * @author Mark Reinhold
@@ -60,12 +61,7 @@ import sun.nio.cs.StreamEncoder;
 
 public final class Channels {
 
-    private Channels() { }              // No instantiation
-
-    private static void checkNotNull(Object o, String name) {
-        if (o == null)
-            throw new NullPointerException("\"" + name + "\" is null!");
-    }
+    private Channels() { throw new Error("no instances"); }
 
     /**
      * Write all remaining bytes in buffer to the given channel.
@@ -91,7 +87,7 @@ public final class Channels {
         throws IOException
     {
         if (ch instanceof SelectableChannel) {
-            SelectableChannel sc = (SelectableChannel)ch;
+            SelectableChannel sc = (SelectableChannel) ch;
             synchronized (sc.blockingLock()) {
                 if (!sc.isBlocking())
                     throw new IllegalBlockingModeException();
@@ -107,7 +103,7 @@ public final class Channels {
     /**
      * Constructs a stream that reads bytes from the given channel.
      *
-     * <p> The <tt>read</tt> methods of the resulting stream will throw an
+     * <p> The {@code read} methods of the resulting stream will throw an
      * {@link IllegalBlockingModeException} if invoked while the underlying
      * channel is in non-blocking mode.  The stream will not be buffered, and
      * it will not support the {@link InputStream#mark mark} or {@link
@@ -121,14 +117,14 @@ public final class Channels {
      * @return  A new input stream
      */
     public static InputStream newInputStream(ReadableByteChannel ch) {
-        checkNotNull(ch, "ch");
-        return new sun.nio.ch.ChannelInputStream(ch);
+        Objects.requireNonNull(ch, "ch");
+        return new ChannelInputStream(ch);
     }
 
     /**
      * Constructs a stream that writes bytes to the given channel.
      *
-     * <p> The <tt>write</tt> methods of the resulting stream will throw an
+     * <p> The {@code write} methods of the resulting stream will throw an
      * {@link IllegalBlockingModeException} if invoked while the underlying
      * channel is in non-blocking mode.  The stream will not be buffered.  The
      * stream will be safe for access by multiple concurrent threads.  Closing
@@ -139,46 +135,49 @@ public final class Channels {
      *
      * @return  A new output stream
      */
-    public static OutputStream newOutputStream(final WritableByteChannel ch) {
-        checkNotNull(ch, "ch");
+    public static OutputStream newOutputStream(WritableByteChannel ch) {
+        Objects.requireNonNull(ch, "ch");
 
         return new OutputStream() {
 
-                private ByteBuffer bb = null;
-                private byte[] bs = null;       // Invoker's previous array
-                private byte[] b1 = null;
+            private ByteBuffer bb;
+            private byte[] bs;       // Invoker's previous array
+            private byte[] b1;
 
-                public synchronized void write(int b) throws IOException {
-                   if (b1 == null)
-                        b1 = new byte[1];
-                    b1[0] = (byte)b;
-                    this.write(b1);
-                }
+            @Override
+            public synchronized void write(int b) throws IOException {
+                if (b1 == null)
+                    b1 = new byte[1];
+                b1[0] = (byte) b;
+                this.write(b1);
+            }
 
-                public synchronized void write(byte[] bs, int off, int len)
+            @Override
+            public synchronized void write(byte[] bs, int off, int len)
                     throws IOException
-                {
-                    if ((off < 0) || (off > bs.length) || (len < 0) ||
-                        ((off + len) > bs.length) || ((off + len) < 0)) {
-                        throw new IndexOutOfBoundsException();
-                    } else if (len == 0) {
-                        return;
-                    }
-                    ByteBuffer bb = ((this.bs == bs)
-                                     ? this.bb
-                                     : ByteBuffer.wrap(bs));
-                    bb.limit(Math.min(off + len, bb.capacity()));
-                    bb.position(off);
-                    this.bb = bb;
-                    this.bs = bs;
-                    Channels.writeFully(ch, bb);
+            {
+                if ((off < 0) || (off > bs.length) || (len < 0) ||
+                    ((off + len) > bs.length) || ((off + len) < 0)) {
+                    throw new IndexOutOfBoundsException();
+                } else if (len == 0) {
+                    return;
                 }
+                ByteBuffer bb = ((this.bs == bs)
+                                 ? this.bb
+                                 : ByteBuffer.wrap(bs));
+                bb.limit(Math.min(off + len, bb.capacity()));
+                bb.position(off);
+                this.bb = bb;
+                this.bs = bs;
+                Channels.writeFully(ch, bb);
+            }
 
-                public void close() throws IOException {
-                    ch.close();
-                }
+            @Override
+            public void close() throws IOException {
+                ch.close();
+            }
 
-            };
+        };
     }
 
     /**
@@ -196,13 +195,13 @@ public final class Channels {
      *
      * @since 1.7
      */
-    public static InputStream newInputStream(final AsynchronousByteChannel ch) {
-        checkNotNull(ch, "ch");
+    public static InputStream newInputStream(AsynchronousByteChannel ch) {
+        Objects.requireNonNull(ch, "ch");
         return new InputStream() {
 
-            private ByteBuffer bb = null;
-            private byte[] bs = null;           // Invoker's previous array
-            private byte[] b1 = null;
+            private ByteBuffer bb;
+            private byte[] bs;           // Invoker's previous array
+            private byte[] b1;
 
             @Override
             public synchronized int read() throws IOException {
@@ -216,13 +215,14 @@ public final class Channels {
 
             @Override
             public synchronized int read(byte[] bs, int off, int len)
-                throws IOException
+                    throws IOException
             {
                 if ((off < 0) || (off > bs.length) || (len < 0) ||
                     ((off + len) > bs.length) || ((off + len) < 0)) {
                     throw new IndexOutOfBoundsException();
-                } else if (len == 0)
+                } else if (len == 0) {
                     return 0;
+                }
 
                 ByteBuffer bb = ((this.bs == bs)
                                  ? this.bb
@@ -270,25 +270,25 @@ public final class Channels {
      *
      * @since 1.7
      */
-    public static OutputStream newOutputStream(final AsynchronousByteChannel ch) {
-        checkNotNull(ch, "ch");
+    public static OutputStream newOutputStream(AsynchronousByteChannel ch) {
+        Objects.requireNonNull(ch, "ch");
         return new OutputStream() {
 
-            private ByteBuffer bb = null;
-            private byte[] bs = null;   // Invoker's previous array
-            private byte[] b1 = null;
+            private ByteBuffer bb;
+            private byte[] bs;   // Invoker's previous array
+            private byte[] b1;
 
             @Override
             public synchronized void write(int b) throws IOException {
-               if (b1 == null)
+                if (b1 == null)
                     b1 = new byte[1];
-                b1[0] = (byte)b;
+                b1[0] = (byte) b;
                 this.write(b1);
             }
 
             @Override
             public synchronized void write(byte[] bs, int off, int len)
-                throws IOException
+                    throws IOException
             {
                 if ((off < 0) || (off > bs.length) || (len < 0) ||
                     ((off + len) > bs.length) || ((off + len) < 0)) {
@@ -343,12 +343,11 @@ public final class Channels {
      *
      * @return  A new readable byte channel
      */
-    public static ReadableByteChannel newChannel(final InputStream in) {
-        checkNotNull(in, "in");
+    public static ReadableByteChannel newChannel(InputStream in) {
+        Objects.requireNonNull(in, "in");
 
-        if (in instanceof FileInputStream &&
-            FileInputStream.class.equals(in.getClass())) {
-            return ((FileInputStream)in).getChannel();
+        if (in.getClass() == FileInputStream.class) {
+            return ((FileInputStream) in).getChannel();
         }
 
         return new ReadableByteChannelImpl(in);
@@ -358,16 +357,16 @@ public final class Channels {
         extends AbstractInterruptibleChannel    // Not really interruptible
         implements ReadableByteChannel
     {
-        InputStream in;
+        private final InputStream in;
         private static final int TRANSFER_SIZE = 8192;
-        private byte buf[] = new byte[0];
-        private boolean open = true;
-        private Object readLock = new Object();
+        private byte[] buf = new byte[0];
+        private final Object readLock = new Object();
 
         ReadableByteChannelImpl(InputStream in) {
             this.in = in;
         }
 
+        @Override
         public int read(ByteBuffer dst) throws IOException {
             int len = dst.remaining();
             int totalRead = 0;
@@ -399,9 +398,9 @@ public final class Channels {
             }
         }
 
+        @Override
         protected void implCloseChannel() throws IOException {
             in.close();
-            open = false;
         }
     }
 
@@ -418,12 +417,11 @@ public final class Channels {
      *
      * @return  A new writable byte channel
      */
-    public static WritableByteChannel newChannel(final OutputStream out) {
-        checkNotNull(out, "out");
+    public static WritableByteChannel newChannel(OutputStream out) {
+        Objects.requireNonNull(out, "out");
 
-        if (out instanceof FileOutputStream &&
-            FileOutputStream.class.equals(out.getClass())) {
-                return ((FileOutputStream)out).getChannel();
+        if (out.getClass() == FileOutputStream.class) {
+            return ((FileOutputStream) out).getChannel();
         }
 
         return new WritableByteChannelImpl(out);
@@ -433,16 +431,16 @@ public final class Channels {
         extends AbstractInterruptibleChannel    // Not really interruptible
         implements WritableByteChannel
     {
-        OutputStream out;
+        private final OutputStream out;
         private static final int TRANSFER_SIZE = 8192;
-        private byte buf[] = new byte[0];
-        private boolean open = true;
-        private Object writeLock = new Object();
+        private byte[] buf = new byte[0];
+        private final Object writeLock = new Object();
 
         WritableByteChannelImpl(OutputStream out) {
             this.out = out;
         }
 
+        @Override
         public int write(ByteBuffer src) throws IOException {
             int len = src.remaining();
             int totalWritten = 0;
@@ -465,9 +463,9 @@ public final class Channels {
             }
         }
 
+        @Override
         protected void implCloseChannel() throws IOException {
             out.close();
-            open = false;
         }
     }
 
@@ -479,7 +477,7 @@ public final class Channels {
      * given decoder.
      *
      * <p> The resulting stream will contain an internal input buffer of at
-     * least <tt>minBufferCap</tt> bytes.  The stream's <tt>read</tt> methods
+     * least {@code minBufferCap} bytes.  The stream's {@code read} methods
      * will, as needed, fill the buffer by reading bytes from the underlying
      * channel; if the channel is in non-blocking mode when bytes are to be
      * read then an {@link IllegalBlockingModeException} will be thrown.  The
@@ -495,7 +493,7 @@ public final class Channels {
      *
      * @param  minBufferCap
      *         The minimum capacity of the internal byte buffer,
-     *         or <tt>-1</tt> if an implementation-dependent
+     *         or {@code -1} if an implementation-dependent
      *         default capacity is to be used
      *
      * @return  A new reader
@@ -504,7 +502,7 @@ public final class Channels {
                                    CharsetDecoder dec,
                                    int minBufferCap)
     {
-        checkNotNull(ch, "ch");
+        Objects.requireNonNull(ch, "ch");
         return StreamDecoder.forDecoder(ch, dec.reset(), minBufferCap);
     }
 
@@ -514,16 +512,15 @@ public final class Channels {
      *
      * <p> An invocation of this method of the form
      *
-     * <blockquote><pre>
-     * Channels.newReader(ch, csname)</pre></blockquote>
+     * <pre> {@code
+     *     Channels.newReader(ch, csname)
+     * } </pre>
      *
      * behaves in exactly the same way as the expression
      *
-     * <blockquote><pre>
-     * Channels.newReader(ch,
-     *                    Charset.forName(csName)
-     *                        .newDecoder(),
-     *                    -1);</pre></blockquote>
+     * <pre> {@code
+     *     Channels.newReader(ch, Charset.forName(csName).newDecoder(), -1)
+     * } </pre>
      *
      * @param  ch
      *         The channel from which bytes will be read
@@ -540,7 +537,7 @@ public final class Channels {
     public static Reader newReader(ReadableByteChannel ch,
                                    String csName)
     {
-        checkNotNull(csName, "csName");
+        Objects.requireNonNull(csName, "csName");
         return newReader(ch, Charset.forName(csName).newDecoder(), -1);
     }
 
@@ -549,7 +546,7 @@ public final class Channels {
      * writes the resulting bytes to the given channel.
      *
      * <p> The resulting stream will contain an internal output buffer of at
-     * least <tt>minBufferCap</tt> bytes.  The stream's <tt>write</tt> methods
+     * least {@code minBufferCap} bytes.  The stream's {@code write} methods
      * will, as needed, flush the buffer by writing bytes to the underlying
      * channel; if the channel is in non-blocking mode when bytes are to be
      * written then an {@link IllegalBlockingModeException} will be thrown.
@@ -564,16 +561,16 @@ public final class Channels {
      *
      * @param  minBufferCap
      *         The minimum capacity of the internal byte buffer,
-     *         or <tt>-1</tt> if an implementation-dependent
+     *         or {@code -1} if an implementation-dependent
      *         default capacity is to be used
      *
      * @return  A new writer
      */
-    public static Writer newWriter(final WritableByteChannel ch,
-                                   final CharsetEncoder enc,
-                                   final int minBufferCap)
+    public static Writer newWriter(WritableByteChannel ch,
+                                   CharsetEncoder enc,
+                                   int minBufferCap)
     {
-        checkNotNull(ch, "ch");
+        Objects.requireNonNull(ch, "ch");
         return StreamEncoder.forEncoder(ch, enc.reset(), minBufferCap);
     }
 
@@ -582,17 +579,15 @@ public final class Channels {
      * charset and writes the resulting bytes to the given channel.
      *
      * <p> An invocation of this method of the form
-     *
-     * <blockquote><pre>
-     * Channels.newWriter(ch, csname)</pre></blockquote>
-     *
+     * <p>
+     * <pre> {@code
+     *     Channels.newWriter(ch, csname)
+     * } </pre>
      * behaves in exactly the same way as the expression
-     *
-     * <blockquote><pre>
-     * Channels.newWriter(ch,
-     *                    Charset.forName(csName)
-     *                        .newEncoder(),
-     *                    -1);</pre></blockquote>
+     * <p>
+     * <pre> {@code
+     *     Channels.newWriter(ch, Charset.forName(csName).newEncoder(), -1)
+     * } </pre>
      *
      * @param  ch
      *         The channel to which bytes will be written
@@ -609,7 +604,7 @@ public final class Channels {
     public static Writer newWriter(WritableByteChannel ch,
                                    String csName)
     {
-        checkNotNull(csName, "csName");
+        Objects.requireNonNull(csName, "csName");
         return newWriter(ch, Charset.forName(csName).newEncoder(), -1);
     }
 }

From 2570fc54182a4c0e1e2c13ab369f9bd83f975845 Mon Sep 17 00:00:00 2001
From: Volker Simonis <simonis@openjdk.org>
Date: Fri, 5 Dec 2014 19:46:15 +0100
Subject: [PATCH 247/299] 8066766: The commands in the modular images are
 executable by the owner only

Also simplify the 'set executable' step of jspawnhelper in ImageBuilder.java

Reviewed-by: chegar, alanb
---
 .../build/tools/module/ImageBuilder.java        | 17 +----------------
 .../build/tools/module/ModuleArchive.java       |  2 +-
 2 files changed, 2 insertions(+), 17 deletions(-)

diff --git a/jdk/make/src/classes/build/tools/module/ImageBuilder.java b/jdk/make/src/classes/build/tools/module/ImageBuilder.java
index 9f0da161a8f..e9de90b8e5b 100644
--- a/jdk/make/src/classes/build/tools/module/ImageBuilder.java
+++ b/jdk/make/src/classes/build/tools/module/ImageBuilder.java
@@ -349,21 +349,6 @@ class ImageBuilder {
         return (new SimpleResolver(mods, moduleGraph)).resolve();
     }
 
-    /**
-     * chmod ugo+x file
-     */
-    private void setExecutable(Path file) {
-        try {
-            Set<PosixFilePermission> perms = Files.getPosixFilePermissions(file);
-            perms.add(PosixFilePermission.OWNER_EXECUTE);
-            perms.add(PosixFilePermission.GROUP_EXECUTE);
-            perms.add(PosixFilePermission.OTHERS_EXECUTE);
-            Files.setPosixFilePermissions(file, perms);
-        } catch (IOException ioe) {
-            throw new UncheckedIOException(ioe);
-        }
-    }
-
     private void createImage() throws IOException {
         Collection<String> modules = resolve(options.mods);
         log.print(modules.stream().collect(Collectors.joining(" ")));
@@ -377,7 +362,7 @@ class ImageBuilder {
                                      .filter(f -> f.getFileName().equals(jspawnhelper))
                                      .findFirst();
         if (helper.isPresent())
-            setExecutable(helper.get());
+            helper.get().toFile().setExecutable(true, false);
     }
 
     private class ImageFileHelper {
diff --git a/jdk/make/src/classes/build/tools/module/ModuleArchive.java b/jdk/make/src/classes/build/tools/module/ModuleArchive.java
index 41d7ae1c282..f05020b9842 100644
--- a/jdk/make/src/classes/build/tools/module/ModuleArchive.java
+++ b/jdk/make/src/classes/build/tools/module/ModuleArchive.java
@@ -194,7 +194,7 @@ public class ModuleArchive implements Archive {
                         case CMDS:
                             Path path = destFile("bin", filename);
                             writeEntry(in, path);
-                            path.toFile().setExecutable(true);
+                            path.toFile().setExecutable(true, false);
                             break;
                         case CONFIGS:
                             writeEntry(in, destFile("conf", filename));

From 9fa1d1239b85ebaf22d972ef493c258adde81b52 Mon Sep 17 00:00:00 2001
From: Rob McKenna <robm@openjdk.org>
Date: Fri, 5 Dec 2014 20:13:05 +0000
Subject: [PATCH 248/299] 8065238: javax.naming.NamingException after upgrade
 to JDK 8

Reviewed-by: vinnie
---
 .../classes/com/sun/jndi/ldap/Connection.java |   8 +-
 .../com/sun/jndi/ldap/LdapTimeoutTest.java    | 517 +++++++++++++-----
 2 files changed, 400 insertions(+), 125 deletions(-)

diff --git a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java
index 5663126e80a..c50d3f19ddb 100644
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/Connection.java
@@ -111,7 +111,6 @@ public final class Connection implements Runnable {
 
     private static final boolean debug = false;
     private static final int dump = 0; // > 0 r, > 1 rw
-    public static final long DEFAULT_READ_TIMEOUT_MILLIS = 15 * 1000; // 15 second timeout;
 
 
     final private Thread worker;    // Initialized in constructor
@@ -414,10 +413,13 @@ public final class Connection implements Runnable {
                             // will be woken up before readTimeout only if reply is
                             // available
                             ldr.wait(readTimeout);
+                            waited = true;
                         } else {
-                            ldr.wait(DEFAULT_READ_TIMEOUT_MILLIS);
+                            // no timeout is set so we wait infinitely until
+                            // a response is received
+                            // http://docs.oracle.com/javase/8/docs/technotes/guides/jndi/jndi-ldap.html#PROP
+                            ldr.wait();
                         }
-                        waited = true;
                     } else {
                         break;
                     }
diff --git a/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java b/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java
index 092416eff3e..9a5580028a4 100644
--- a/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java
+++ b/jdk/test/com/sun/jndi/ldap/LdapTimeoutTest.java
@@ -28,144 +28,59 @@
  * @summary Timeout tests for ldap
  */
 
-import com.sun.jndi.ldap.Connection;
-
 import java.net.Socket;
 import java.net.ServerSocket;
 import java.net.SocketTimeoutException;
 import java.io.*;
 import javax.naming.*;
 import javax.naming.directory.*;
+import java.util.List;
 import java.util.Hashtable;
+import java.util.ArrayList;
 import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
 import java.util.concurrent.Executors;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.ScheduledFuture;
+import java.util.concurrent.TimeoutException;
+import java.util.concurrent.TimeUnit;
 
 import static java.util.concurrent.TimeUnit.MILLISECONDS;
 import static java.util.concurrent.TimeUnit.NANOSECONDS;
 
-public class LdapTimeoutTest {
 
-    static volatile int passed = 0, failed = 0;
-    static void pass() {passed++;}
-    static void fail() {failed++; Thread.dumpStack();}
+abstract class LdapTest implements Callable {
 
-    public static void main(String[] args) throws Exception {
-        ServerSocket serverSock = new ServerSocket(0);
-        Server s = new Server(serverSock);
-        s.start();
-        Thread.sleep(200);
+    Hashtable env;
+    TestServer server;
+    ScheduledExecutorService killSwitchPool;
+    boolean passed = false;
+    private int HANGING_TEST_TIMEOUT = 20_000;
 
-        Hashtable env = new Hashtable(11);
-        env.put(Context.INITIAL_CONTEXT_FACTORY,
-            "com.sun.jndi.ldap.LdapCtxFactory");
-        env.put(Context.PROVIDER_URL, "ldap://localhost:" +
-            serverSock.getLocalPort());
-
-        env.put(Context.SECURITY_AUTHENTICATION,"simple");
-
-        env.put(Context.SECURITY_PRINCIPAL, "user");
-        env.put(Context.SECURITY_CREDENTIALS, "password");
-
-        InitialContext ctx = null;
-        try {
-            new LdapTimeoutTest().deadServerNoTimeout(env);
-
-            env.put("com.sun.jndi.ldap.connect.timeout", "10");
-            env.put("com.sun.jndi.ldap.read.timeout", "3000");
-            new LdapTimeoutTest().ldapReadTimeoutTest(env, false);
-            new LdapTimeoutTest().ldapReadTimeoutTest(env, true);
-            new LdapTimeoutTest().simpleAuthConnectTest(env);
-        } finally {
-            s.interrupt();
-        }
-
-        System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
-        if (failed > 0) throw new AssertionError("Some tests failed");
+    public LdapTest (TestServer server, Hashtable env) {
+        this.server = server;
+        this.env = env;
     }
 
-    void ldapReadTimeoutTest(Hashtable env, boolean ssl) {
-        InitialContext ctx = null;
-        if (ssl) env.put(Context.SECURITY_PROTOCOL, "ssl");
-        long start = System.nanoTime();
-        try {
-            ctx = new InitialDirContext(env);
-            SearchControls scl = new SearchControls();
-            scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
-            NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx)
-                .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl);
-            // shouldn't reach here
-            fail();
-        } catch (NamingException e) {
-            if (ssl) {
-                if (e.getCause() instanceof SocketTimeoutException) {
-                    pass();
-                } else if (e.getCause() instanceof InterruptedIOException) {
-                    Thread.interrupted();
-                    fail();
-                }
-            } else {
-                pass();
-            }
-        } finally {
-            if (!shutItDown(ctx)) fail();
-        }
+    public LdapTest(TestServer server, Hashtable env,
+            ScheduledExecutorService killSwitchPool)
+    {
+        this(server, env);
+        this.killSwitchPool = killSwitchPool;
     }
 
-    void simpleAuthConnectTest(Hashtable env) {
-        InitialContext ctx = null;
-        long start = System.nanoTime();
-        try {
-            ctx = new InitialDirContext(env);
-            // shouldn't reach here
-            System.err.println("Fail: InitialDirContext succeeded");
-            fail();
-        } catch (NamingException e) {
-            long end = System.nanoTime();
-            if (e.getCause() instanceof SocketTimeoutException) {
-                if (NANOSECONDS.toMillis(end - start) < 2_900) {
-                    pass();
-                } else {
-                    System.err.println("Fail: Waited too long");
-                    fail();
-                }
-            } else if (e.getCause() instanceof InterruptedIOException) {
-                Thread.interrupted();
-                fail();
-            } else {
-                fail();
-            }
-        } finally {
-            if (!shutItDown(ctx)) fail();
-        }
+    public abstract void performOp(InitialContext ctx) throws NamingException;
+    public abstract void handleNamingException(
+        NamingException e, long start, long end);
+
+    public void pass() {
+        this.passed = true;
     }
 
-    void deadServerNoTimeout(Hashtable env) {
-        InitialContext ctx = null;
-        long start = System.currentTimeMillis();
-        try {
-            ctx = new InitialDirContext(env);
-            SearchControls scl = new SearchControls();
-            scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
-            NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx)
-                .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl);
-            // shouldn't reach here
-            fail();
-        } catch (NamingException e) {
-            long elapsed = System.currentTimeMillis() - start;
-            if (elapsed < Connection.DEFAULT_READ_TIMEOUT_MILLIS) {
-                System.err.printf("fail: timeout should be at least %s ms, " +
-                                "actual time is %s ms%n",
-                        Connection.DEFAULT_READ_TIMEOUT_MILLIS, elapsed);
-                e.printStackTrace();
-                fail();
-            } else {
-                pass();
-            }
-        } finally {
-            if (!shutItDown(ctx)) fail();
-        }
+    public void fail() {
+        throw new RuntimeException("Test failed");
     }
 
     boolean shutItDown(InitialContext ctx) {
@@ -177,18 +92,376 @@ public class LdapTimeoutTest {
         }
     }
 
-    static class Server extends Thread {
-        final ServerSocket serverSock;
+    public Boolean call() {
+        InitialContext ctx = null;
+        ScheduledFuture killer = null;
+        long start = System.nanoTime();
 
-        Server(ServerSocket serverSock) {
-            this.serverSock = serverSock;
-        }
+        try {
+            while(!server.accepting())
+                Thread.sleep(200); // allow the server to start up
+            Thread.sleep(200); // to be sure
+
+            // if this is a hanging test, scheduled a thread to
+            // interrupt after a certain time
+            if (killSwitchPool != null) {
+                final Thread current = Thread.currentThread();
+                killer = killSwitchPool.schedule(
+                    new Callable<Void>() {
+                        public Void call() throws Exception {
+                            current.interrupt();
+                            return null;
+                        }
+                    }, HANGING_TEST_TIMEOUT, MILLISECONDS);
+            }
+
+            env.put(Context.PROVIDER_URL, "ldap://localhost:" +
+                    server.getLocalPort());
 
-        public void run() {
             try {
-                Socket socket = serverSock.accept();
-            } catch (IOException e) {}
+                ctx = new InitialDirContext(env);
+                performOp(ctx);
+                fail();
+            } catch (NamingException e) {
+                long end = System.nanoTime();
+                System.out.println(this.getClass().toString() + " - elapsed: "
+                        + NANOSECONDS.toMillis(end - start));
+                handleNamingException(e, start, end);
+            } finally {
+                if (killer != null && !killer.isDone())
+                    killer.cancel(true);
+                shutItDown(ctx);
+                server.close();
+            }
+            return passed;
+        } catch (IOException|InterruptedException e) {
+            throw new RuntimeException(e);
         }
     }
 }
 
+abstract class ReadServerTest extends LdapTest {
+
+    public ReadServerTest(Hashtable env) throws IOException {
+        super(new BindableServer(), env);
+    }
+
+    public ReadServerTest(Hashtable env,
+                          ScheduledExecutorService killSwitchPool)
+            throws IOException
+    {
+        super(new BindableServer(), env, killSwitchPool);
+    }
+
+    public void performOp(InitialContext ctx) throws NamingException {
+        SearchControls scl = new SearchControls();
+        scl.setSearchScope(SearchControls.SUBTREE_SCOPE);
+        NamingEnumeration<SearchResult> answer = ((InitialDirContext)ctx)
+            .search("ou=People,o=JNDITutorial", "(objectClass=*)", scl);
+    }
+}
+
+abstract class DeadServerTest extends LdapTest {
+
+    public DeadServerTest(Hashtable env) throws IOException {
+        super(new DeadServer(), env);
+    }
+
+    public DeadServerTest(Hashtable env,
+                          ScheduledExecutorService killSwitchPool)
+            throws IOException
+    {
+        super(new DeadServer(), env, killSwitchPool);
+    }
+
+    public void performOp(InitialContext ctx) throws NamingException {}
+}
+
+class DeadServerNoTimeoutTest extends DeadServerTest {
+
+    public DeadServerNoTimeoutTest(Hashtable env,
+                                   ScheduledExecutorService killSwitchPool)
+            throws IOException
+    {
+        super(env, killSwitchPool);
+    }
+
+    public void handleNamingException(NamingException e, long start, long end) {
+        if (e instanceof InterruptedNamingException) Thread.interrupted();
+
+        if (NANOSECONDS.toMillis(end - start) < LdapTimeoutTest.MIN_TIMEOUT) {
+            System.err.printf("DeadServerNoTimeoutTest fail: timeout should be " +
+                              "at least %s ms, actual time is %s ms%n",
+                              LdapTimeoutTest.MIN_TIMEOUT,
+                              NANOSECONDS.toMillis(end - start));
+            fail();
+        } else {
+            pass();
+        }
+    }
+}
+
+class DeadServerTimeoutTest extends DeadServerTest {
+
+    public DeadServerTimeoutTest(Hashtable env) throws IOException {
+        super(env);
+    }
+
+    public void handleNamingException(NamingException e, long start, long end)
+    {
+        // non SSL connect will timeout via readReply using connectTimeout
+        if (NANOSECONDS.toMillis(end - start) < 2_900) {
+            pass();
+        } else {
+            System.err.println("Fail: Waited too long");
+            fail();
+        }
+    }
+}
+
+class DeadServerTimeoutSSLTest extends DeadServerTest {
+
+    public DeadServerTimeoutSSLTest(Hashtable env) throws IOException {
+        super(env);
+    }
+
+    public void handleNamingException(NamingException e, long start, long end) {
+        if (e.getCause() instanceof SocketTimeoutException) {
+            // SSL connect will timeout via readReply using
+            // SocketTimeoutException
+            pass();
+        } else {
+            fail();
+        }
+    }
+}
+
+
+class ReadServerNoTimeoutTest extends ReadServerTest {
+
+    public ReadServerNoTimeoutTest(Hashtable env,
+                                   ScheduledExecutorService killSwitchPool)
+            throws IOException
+    {
+        super(env, killSwitchPool);
+    }
+
+    public void handleNamingException(NamingException e, long start, long end) {
+        if (e instanceof InterruptedNamingException) Thread.interrupted();
+
+        if (NANOSECONDS.toMillis(end - start) < LdapTimeoutTest.MIN_TIMEOUT) {
+            System.err.printf("ReadServerNoTimeoutTest fail: timeout should be " +
+                              "at least %s ms, actual time is %s ms%n",
+                              LdapTimeoutTest.MIN_TIMEOUT,
+                              NANOSECONDS.toMillis(end - start));
+            fail();
+        } else {
+            pass();
+        }
+    }
+}
+
+class ReadServerTimeoutTest extends ReadServerTest {
+
+    public ReadServerTimeoutTest(Hashtable env) throws IOException {
+        super(env);
+    }
+
+    public void handleNamingException(NamingException e, long start, long end) {
+        if (NANOSECONDS.toMillis(end - start) < 2_900) {
+            fail();
+        } else {
+            pass();
+        }
+    }
+}
+
+class TestServer extends Thread {
+    ServerSocket serverSock;
+    boolean accepting = false;
+
+    public TestServer() throws IOException {
+        this.serverSock = new ServerSocket(0);
+        start();
+    }
+
+    public int getLocalPort() {
+        return serverSock.getLocalPort();
+    }
+
+    public boolean accepting() {
+        return accepting;
+    }
+
+    public void close() throws IOException {
+        serverSock.close();
+    }
+}
+
+class BindableServer extends TestServer {
+
+    public BindableServer() throws IOException {
+        super();
+    }
+
+    private byte[] bindResponse = {
+        0x30, 0x0C, 0x02, 0x01, 0x01, 0x61, 0x07, 0x0A,
+        0x01, 0x00, 0x04, 0x00, 0x04, 0x00
+    };
+
+    public void run() {
+        try {
+            accepting = true;
+            Socket socket = serverSock.accept();
+            InputStream in = socket.getInputStream();
+            OutputStream out = socket.getOutputStream();
+
+            // Read the LDAP BindRequest
+            while (in.read() != -1) {
+                in.skip(in.available());
+                break;
+            }
+
+            // Write an LDAP BindResponse
+            out.write(bindResponse);
+            out.flush();
+        } catch (IOException e) {
+            // ignore
+        }
+    }
+}
+
+class DeadServer extends TestServer {
+
+    public DeadServer() throws IOException {
+        super();
+    }
+
+    public void run() {
+        while(true) {
+            try {
+                accepting = true;
+                Socket socket = serverSock.accept();
+            } catch (Exception e) {
+                break;
+            }
+        }
+    }
+}
+
+public class LdapTimeoutTest {
+
+    private static final ExecutorService testPool =
+        Executors.newFixedThreadPool(3);
+    private static final ScheduledExecutorService killSwitchPool =
+        Executors.newScheduledThreadPool(3);
+    public static int MIN_TIMEOUT = 18_000;
+
+    static Hashtable createEnv() {
+        Hashtable env = new Hashtable(11);
+        env.put(Context.INITIAL_CONTEXT_FACTORY,
+            "com.sun.jndi.ldap.LdapCtxFactory");
+        return env;
+    }
+
+    public static void main(String[] args) throws Exception {
+
+        InitialContext ctx = null;
+        List<Future> results = new ArrayList<>();
+
+        try {
+            // run the DeadServerTest with no timeouts set
+            // this should get stuck indefinitely, so we need to kill
+            // it after a timeout
+            System.out.println("Running connect timeout test with 20s kill switch");
+            Hashtable env = createEnv();
+            results.add(
+                    testPool.submit(new DeadServerNoTimeoutTest(env, killSwitchPool)));
+
+            // run the ReadServerTest with connect timeout set
+            // this should get stuck indefinitely so we need to kill
+            // it after a timeout
+            System.out.println("Running read timeout test with 10ms connect timeout & 20s kill switch");
+            Hashtable env1 = createEnv();
+            env1.put("com.sun.jndi.ldap.connect.timeout", "10");
+            results.add(testPool.submit(
+                    new ReadServerNoTimeoutTest(env1, killSwitchPool)));
+
+            // run the ReadServerTest with no timeouts set
+            // this should get stuck indefinitely, so we need to kill
+            // it after a timeout
+            System.out.println("Running read timeout test with 20s kill switch");
+            Hashtable env2 = createEnv();
+            results.add(testPool.submit(
+                    new ReadServerNoTimeoutTest(env2, killSwitchPool)));
+
+            // run the DeadServerTest with connect / read timeouts set
+            // this should exit after the connect timeout expires
+            System.out.println("Running connect timeout test with 10ms connect timeout, 3000ms read timeout");
+            Hashtable env3 = createEnv();
+            env3.put("com.sun.jndi.ldap.connect.timeout", "10");
+            env3.put("com.sun.jndi.ldap.read.timeout", "3000");
+            results.add(testPool.submit(new DeadServerTimeoutTest(env3)));
+
+
+            // run the ReadServerTest with connect / read timeouts set
+            // this should exit after the connect timeout expires
+            System.out.println("Running read timeout test with 10ms connect timeout, 3000ms read timeout");
+            Hashtable env4 = createEnv();
+            env4.put("com.sun.jndi.ldap.connect.timeout", "10");
+            env4.put("com.sun.jndi.ldap.read.timeout", "3000");
+            results.add(testPool.submit(new ReadServerTimeoutTest(env4)));
+
+            // run the DeadServerTest with connect timeout set
+            // this should exit after the connect timeout expires
+            System.out.println("Running connect timeout test with 10ms connect timeout");
+            Hashtable env5 = createEnv();
+            env5.put("com.sun.jndi.ldap.connect.timeout", "10");
+            results.add(testPool.submit(new DeadServerTimeoutTest(env5)));
+
+            // 8000487: Java JNDI connection library on ldap conn is
+            // not honoring configured timeout
+            System.out.println("Running simple auth connection test");
+            Hashtable env6 = createEnv();
+            env6.put("com.sun.jndi.ldap.connect.timeout", "10");
+            env6.put("com.sun.jndi.ldap.read.timeout", "3000");
+            env6.put(Context.SECURITY_AUTHENTICATION, "simple");
+            env6.put(Context.SECURITY_PRINCIPAL, "user");
+            env6.put(Context.SECURITY_CREDENTIALS, "password");
+            results.add(testPool.submit(new DeadServerTimeoutTest(env6)));
+
+            boolean testFailed = false;
+            for (Future test : results) {
+                while (!test.isDone()) {
+                    if ((Boolean) test.get() == false)
+                        testFailed = true;
+                }
+            }
+
+            //
+            // Running this test serially as it seems to tickle a problem
+            // on older kernels
+            //
+            // run the DeadServerTest with connect / read timeouts set
+            // and ssl enabled
+            // this should exit with a SocketTimeoutException as the root cause
+            // it should also use the connect timeout instead of the read timeout
+            System.out.println("Running connect timeout test with 10ms connect timeout, 3000ms read timeout & SSL");
+            Hashtable sslenv = createEnv();
+            sslenv.put("com.sun.jndi.ldap.connect.timeout", "10");
+            sslenv.put("com.sun.jndi.ldap.read.timeout", "3000");
+            sslenv.put(Context.SECURITY_PROTOCOL, "ssl");
+            testFailed = (new DeadServerTimeoutSSLTest(sslenv).call()) ? false : true;
+
+            if (testFailed) {
+                throw new AssertionError("some tests failed");
+            }
+
+        } finally {
+            LdapTimeoutTest.killSwitchPool.shutdown();
+            LdapTimeoutTest.testPool.shutdown();
+        }
+    }
+
+}
+

From ac8fc3ff279d3589f064a5d7e36dd9c1558723e7 Mon Sep 17 00:00:00 2001
From: Chris Plummer <cjplummer@openjdk.org>
Date: Fri, 5 Dec 2014 15:44:01 -0800
Subject: [PATCH 249/299] 8066507: JPRT is not capable of running jtreg tests
 located jdk/test

Fixed by copying same fix already in place in hotspot/test/Makefile.

Reviewed-by: dholmes, tbell
---
 jdk/test/Makefile | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/jdk/test/Makefile b/jdk/test/Makefile
index 71053da52fd..52700cd58d0 100644
--- a/jdk/test/Makefile
+++ b/jdk/test/Makefile
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 1995, 2014, 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
@@ -258,6 +258,11 @@ jdk_% core_% svc_%:
 
 # ------------------------------------------------------------------
 
+# When called from JPRT the TESTDIRS variable is set to the jtreg tests to run
+ifdef TESTDIRS
+  TEST_SELECTION = $(TESTDIRS)
+endif
+
 ifdef CONCURRENCY
   EXTRA_JTREG_OPTIONS += -concurrency:$(CONCURRENCY)
 endif

From 34372ab22367167d0f71f773221221263abb797d Mon Sep 17 00:00:00 2001
From: Zaiyao Liu <zaiyao.liu@oracle.com>
Date: Mon, 8 Dec 2014 07:15:49 +0000
Subject: [PATCH 250/299] 8049432: New tests for TLS property
 jdk.tls.client.protocols

Reviewed-by: xuelei
---
 .../net/ssl/TLS/TLSClientPropertyTest.java    | 204 ++++++++++++++++++
 1 file changed, 204 insertions(+)
 create mode 100644 jdk/test/javax/net/ssl/TLS/TLSClientPropertyTest.java

diff --git a/jdk/test/javax/net/ssl/TLS/TLSClientPropertyTest.java b/jdk/test/javax/net/ssl/TLS/TLSClientPropertyTest.java
new file mode 100644
index 00000000000..e3398ae6ee5
--- /dev/null
+++ b/jdk/test/javax/net/ssl/TLS/TLSClientPropertyTest.java
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 2014, 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.security.KeyManagementException;
+import java.security.NoSuchAlgorithmException;
+import java.util.Arrays;
+import java.util.List;
+import javax.net.ssl.SSLContext;
+
+/*
+ * @test
+ * @bug 8049432
+ * @summary New tests for TLS property jdk.tls.client.protocols
+ * @run main/othervm TLSClientPropertyTest NoProperty
+ * @run main/othervm TLSClientPropertyTest SSLv3
+ * @run main/othervm TLSClientPropertyTest TLSv1
+ * @run main/othervm TLSClientPropertyTest TLSv11
+ * @run main/othervm TLSClientPropertyTest TLSv12
+ * @run main/othervm TLSClientPropertyTest WrongProperty
+ */
+
+/**
+ * Sets the property jdk.tls.client.protocols to one of this protocols:
+ * SSLv3,TLSv1,TLSv1.1,TLSv1.2 and TLSV(invalid) or removes this
+ * property (if any),then validates the default, supported and current
+ * protocols in the SSLContext.
+ */
+public class TLSClientPropertyTest {
+    private final String[] expecteSupportedProtos = new String[] {
+            "SSLv2Hello", "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"
+    };
+
+    public static void main(String[] args) throws Exception {
+
+        if (args.length < 1) {
+            throw new RuntimeException(
+                    "Incorrect arguments,expected arguments: testCase");
+        }
+
+        String[] expectedDefaultProtos;
+        String testCase = args[0];
+        String contextProtocol;
+        switch (testCase) {
+        case "NoProperty":
+            if (System.getProperty("jdk.tls.client.protocols") != null) {
+                System.getProperties().remove("jdk.tls.client.protocols");
+            }
+            contextProtocol = null;
+            expectedDefaultProtos = new String[] {
+                    "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"
+            };
+            break;
+        case "SSLv3":
+            contextProtocol = "SSLv3";
+            expectedDefaultProtos = new String[] {
+                    "SSLv3"
+            };
+            break;
+        case "TLSv1":
+            contextProtocol = "TLSv1";
+            expectedDefaultProtos = new String[] {
+                    "SSLv3", "TLSv1"
+            };
+            break;
+        case "TLSv11":
+            contextProtocol = "TLSv1.1";
+            expectedDefaultProtos = new String[] {
+                    "SSLv3", "TLSv1", "TLSv1.1"
+            };
+            break;
+        case "TLSv12":
+            contextProtocol = "TLSv1.2";
+            expectedDefaultProtos = new String[] {
+                    "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2"
+            };
+            break;
+        case "WrongProperty":
+            expectedDefaultProtos = new String[] {};
+            contextProtocol = "TLSV";
+            break;
+        default:
+            throw new RuntimeException("test case is wrong");
+        }
+        if (contextProtocol != null) {
+            System.setProperty("jdk.tls.client.protocols", contextProtocol);
+        }
+        try {
+            TLSClientPropertyTest test = new TLSClientPropertyTest();
+            test.test(contextProtocol, expectedDefaultProtos);
+            if (testCase.equals("WrongProperty")) {
+                throw new RuntimeException(
+                        "Test failed: NoSuchAlgorithmException " +
+                        "is expected when input wrong protocol");
+            } else {
+                System.out.println("Test " + contextProtocol + " passed");
+            }
+        } catch (NoSuchAlgorithmException nsae) {
+            if (testCase.equals("WrongProperty")) {
+                System.out.println("NoSuchAlgorithmException is expected,"
+                        + contextProtocol + " test passed");
+            } else {
+                throw nsae;
+            }
+        }
+
+    }
+
+    /**
+     * The parameter passed is the user enforced protocol. Does not catch
+     * NoSuchAlgorithmException, WrongProperty test will use it.
+     */
+    public void test(String expectedContextProto,
+            String[] expectedDefaultProtos) throws NoSuchAlgorithmException {
+
+        SSLContext context = null;
+        try {
+            if (expectedContextProto != null) {
+                context = SSLContext.getInstance(expectedContextProto);
+                context.init(null, null, null);
+            } else {
+                context = SSLContext.getDefault();
+            }
+            printContextDetails(context);
+        } catch (KeyManagementException ex) {
+            error(null, ex);
+        }
+
+        validateContext(expectedContextProto, expectedDefaultProtos, context);
+    }
+
+    /**
+     * Simple print utility for SSLContext's protocol details.
+     */
+    private void printContextDetails(SSLContext context) {
+        System.out.println("Default   Protocols: "
+                + Arrays.toString(context.getDefaultSSLParameters()
+                        .getProtocols()));
+        System.out.println("Supported Protocols: "
+                + Arrays.toString(context.getSupportedSSLParameters()
+                        .getProtocols()));
+        System.out.println("Current   Protocol : " + context.getProtocol());
+
+    }
+
+    /**
+     * Error handler.
+     */
+    private void error(String msg, Throwable tble) {
+        String finalMsg = "FAILED " + (msg != null ? msg : "");
+        if (tble != null) {
+            throw new RuntimeException(finalMsg, tble);
+        }
+        throw new RuntimeException(finalMsg);
+    }
+
+    /**
+     * Validates the SSLContext's protocols against the user enforced protocol.
+     */
+    private void validateContext(String expectedProto,
+            String[] expectedDefaultProtos, SSLContext context) {
+        if (expectedProto == null) {
+            expectedProto = "Default";
+        }
+        if (!context.getProtocol().equals(expectedProto)) {
+            error("Invalid current protocol:" + context.getProtocol()
+                    + ", Expected:" + expectedProto, null);
+        }
+        List<String> actualDefaultProtos = Arrays.asList(context
+                .getDefaultSSLParameters().getProtocols());
+        for (String p: expectedDefaultProtos) {
+            if (!actualDefaultProtos.contains(p)) {
+                error("Default protocol " + p + "missing", null);
+            }
+        }
+        List<String> actualSupportedProtos = Arrays.asList(context
+                .getSupportedSSLParameters().getProtocols());
+
+        for (String p: expecteSupportedProtos) {
+            if (!actualSupportedProtos.contains(p)) {
+                error("Expected to support protocol:" + p, null);
+            }
+        }
+    }
+}

From 113babff27e41592c1e5c6318e793c73229b8100 Mon Sep 17 00:00:00 2001
From: Jan Lahoda <jlahoda@openjdk.org>
Date: Mon, 8 Dec 2014 11:50:19 +0100
Subject: [PATCH 251/299] 8065753: javac crashing on a html-like file

Avoiding special-case in error recovery for bad token on position 0.

Reviewed-by: jjg
---
 .../com/sun/tools/javac/parser/JavacParser.java |  4 ++--
 .../tools/javac/parser/JavacParserTest.java     | 17 ++++++++++++++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
index 04bdc11e36e..77ee0014b6c 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
@@ -3067,7 +3067,7 @@ public class JavacParser implements Parser {
         boolean checkForImports = true;
         boolean firstTypeDecl = true;
         while (token.kind != EOF) {
-            if (token.pos > 0 && token.pos <= endPosTable.errorEndPos) {
+            if (token.pos <= endPosTable.errorEndPos) {
                 // error recovery
                 skip(checkForImports, false, false, false);
                 if (token.kind == EOF)
@@ -4083,7 +4083,7 @@ public class JavacParser implements Parser {
         /**
          * Store the last error position.
          */
-        protected int errorEndPos;
+        protected int errorEndPos = Position.NOPOS;
 
         public AbstractEndPosTable(JavacParser parser) {
             this.parser = parser;
diff --git a/langtools/test/tools/javac/parser/JavacParserTest.java b/langtools/test/tools/javac/parser/JavacParserTest.java
index e52ea53c607..7f0a620a294 100644
--- a/langtools/test/tools/javac/parser/JavacParserTest.java
+++ b/langtools/test/tools/javac/parser/JavacParserTest.java
@@ -23,7 +23,7 @@
 
 /*
  * @test
- * @bug 7073631 7159445 7156633 8028235
+ * @bug 7073631 7159445 7156633 8028235 8065753
  * @summary tests error and diagnostics positions
  * @author  Jan Lahoda
  */
@@ -49,8 +49,10 @@ import com.sun.source.util.SourcePositions;
 import com.sun.source.util.TreeScanner;
 import com.sun.source.util.Trees;
 import com.sun.tools.javac.api.JavacTaskImpl;
+import com.sun.tools.javac.main.Main;
 import com.sun.tools.javac.tree.JCTree;
 import java.io.IOException;
+import java.io.StringWriter;
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -941,6 +943,19 @@ public class JavacParserTest extends TestCase {
                      TypeKind.VOID);
     }
 
+    @Test //JDK-8065753
+    void testWrongFirstToken() throws IOException {
+        String code = "<";
+        String expectedErrors = "Test.java:1:1: compiler.err.expected3: class, interface, enum\n" +
+                                "1 error\n";
+        StringWriter out = new StringWriter();
+        JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(out, fm, null,
+                Arrays.asList("-XDrawDiagnostics"), null, Arrays.asList(new MyFileObject(code)));
+
+        assertEquals("the error code is not correct", Main.Result.ERROR, ct.doCall());
+        assertEquals("the error message is not correct", expectedErrors, out.toString());
+    }
+
     void run(String[] args) throws Exception {
         int passed = 0, failed = 0;
         final Pattern p = (args != null && args.length > 0)

From 1284542fb327c4afc72e348ffc7e105810b13fb1 Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Mon, 8 Dec 2014 15:13:16 +0100
Subject: [PATCH 252/299] 8066230: Undefined object type assertion when
 computing TypeBounds

Reviewed-by: hannesw, lagergren
---
 .../internal/codegen/CodeGenerator.java       | 25 ++++++++------
 nashorn/test/script/basic/JDK-8066230.js      | 34 +++++++++++++++++++
 .../test/script/basic/JDK-8066230.js.EXPECTED |  1 +
 3 files changed, 50 insertions(+), 10 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8066230.js
 create mode 100644 nashorn/test/script/basic/JDK-8066230.js.EXPECTED

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
index 9869c5257cf..4dec030482f 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -571,9 +571,11 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
 
         // Operands' load type should not be narrower than the narrowest of the individual operand types, nor narrower
         // than the lower explicit bound, but it should also not be wider than
-        final Type narrowestOperandType = Type.narrowest(Type.widest(lhs.getType(), rhs.getType()), explicitOperandBounds.widest);
+        final Type lhsType = undefinedToNumber(lhs.getType());
+        final Type rhsType = undefinedToNumber(rhs.getType());
+        final Type narrowestOperandType = Type.narrowest(Type.widest(lhsType, rhsType), explicitOperandBounds.widest);
         final TypeBounds operandBounds = explicitOperandBounds.notNarrowerThan(narrowestOperandType);
-        if (noToPrimitiveConversion(lhs.getType(), explicitOperandBounds.widest) || rhs.isLocal()) {
+        if (noToPrimitiveConversion(lhsType, explicitOperandBounds.widest) || rhs.isLocal()) {
             // Can reorder. We might still need to separate conversion, but at least we can do it with reordering
             if (forceConversionSeparation) {
                 // Can reorder, but can't move conversion into the operand as the operation depends on operands
@@ -594,10 +596,10 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
             // Can't reorder. Load and convert separately.
             final TypeBounds safeConvertBounds = TypeBounds.UNBOUNDED.notNarrowerThan(narrowestOperandType);
             loadExpression(lhs, safeConvertBounds, baseAlreadyOnStack);
-            final Type lhsType = method.peekType();
+            final Type lhsLoadedType = method.peekType();
             loadExpression(rhs, safeConvertBounds, false);
             final Type convertedLhsType = operandBounds.within(method.peekType());
-            if (convertedLhsType != lhsType) {
+            if (convertedLhsType != lhsLoadedType) {
                 // Do it conditionally, so that if conversion is a no-op we don't introduce a SWAP, SWAP.
                 method.swap().convert(convertedLhsType).swap();
             }
@@ -609,6 +611,10 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
         return method;
     }
 
+    private static final Type undefinedToNumber(final Type type) {
+        return type == Type.UNDEFINED ? Type.NUMBER : type;
+    }
+
     private static final class TypeBounds {
         final Type narrowest;
         final Type widest;
@@ -3151,9 +3157,8 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
         } else {
             final Type identType = identNode.getType();
             if(identType == Type.UNDEFINED) {
-                // The symbol must not be slotted; the initializer is either itself undefined (explicit assignment of
-                // undefined to undefined), or the left hand side is a dead variable.
-                assert !identNode.getSymbol().isScope();
+                // The initializer is either itself undefined (explicit assignment of undefined to undefined),
+                // or the left hand side is a dead variable.
                 assert init.getType() == Type.UNDEFINED || identNode.getSymbol().slotCount() == 0;
                 loadAndDiscard(init);
                 return false;
@@ -3576,9 +3581,9 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
                     operandBounds = new TypeBounds(binaryNode.getType(), Type.OBJECT);
                 } else {
                     // Non-optimistic, non-FP +. Allow it to overflow.
-                    operandBounds = new TypeBounds(Type.narrowest(binaryNode.getWidestOperandType(), resultBounds.widest),
-                            Type.OBJECT);
-                    forceConversionSeparation = binaryNode.getWidestOperationType().narrowerThan(resultBounds.widest);
+                    final Type widestOperationType = binaryNode.getWidestOperationType();
+                    operandBounds = new TypeBounds(Type.narrowest(binaryNode.getWidestOperandType(), resultBounds.widest), widestOperationType);
+                    forceConversionSeparation = widestOperationType.narrowerThan(resultBounds.widest);
                 }
                 loadBinaryOperands(binaryNode.lhs(), binaryNode.rhs(), operandBounds, false, forceConversionSeparation);
             }
diff --git a/nashorn/test/script/basic/JDK-8066230.js b/nashorn/test/script/basic/JDK-8066230.js
new file mode 100644
index 00000000000..c6a3583f394
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066230.js
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2014 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.
+ */
+
+/**
+ * JDK-8066230: Undefined object type assertion when computing TypeBounds
+ *
+ * @test
+ * @run
+ */
+
+(function() { void null + 0; })();
+(function() { var x; x += void x; })();
+(function() { var a = true + x, x; })();
+print("SUCCESS");
diff --git a/nashorn/test/script/basic/JDK-8066230.js.EXPECTED b/nashorn/test/script/basic/JDK-8066230.js.EXPECTED
new file mode 100644
index 00000000000..ff43ca40915
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066230.js.EXPECTED
@@ -0,0 +1 @@
+SUCCESS

From d3b43473309f86022936c0735deafd3c5550b00b Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Mon, 8 Dec 2014 15:14:11 +0100
Subject: [PATCH 253/299] 8066227: CodeGenerator load unitialized slot

Reviewed-by: hannesw, lagergren
---
 .../internal/codegen/CodeGenerator.java       |   3 +-
 .../codegen/LocalVariableTypesCalculator.java | 159 +++++++++++++-----
 .../jdk/nashorn/internal/ir/BinaryNode.java   |   5 +-
 nashorn/test/script/basic/JDK-8066227.js      |  40 +++++
 .../test/script/basic/JDK-8066227.js.EXPECTED |  10 ++
 5 files changed, 173 insertions(+), 44 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8066227.js
 create mode 100644 nashorn/test/script/basic/JDK-8066227.js.EXPECTED

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
index 4dec030482f..a239471906d 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -3698,8 +3698,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
             final Expression lhs = assignNode.lhs();
             final Expression rhs = assignNode.rhs();
             final Type widestOperationType = assignNode.getWidestOperationType();
-            final Type widest = assignNode.isTokenType(TokenType.ASSIGN_ADD) ? Type.OBJECT : widestOperationType;
-            final TypeBounds bounds = new TypeBounds(assignNode.getType(), widest);
+            final TypeBounds bounds = new TypeBounds(assignNode.getType(), widestOperationType);
             new OptimisticOperation(assignNode, bounds) {
                 @Override
                 void loadStack() {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
index 41f5be579f4..91e0c2544bc 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
@@ -28,6 +28,7 @@ package jdk.nashorn.internal.codegen;
 import static jdk.nashorn.internal.codegen.CompilerConstants.RETURN;
 import static jdk.nashorn.internal.ir.Expression.isAlwaysFalse;
 import static jdk.nashorn.internal.ir.Expression.isAlwaysTrue;
+
 import java.util.ArrayDeque;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -82,7 +83,6 @@ import jdk.nashorn.internal.ir.UnaryNode;
 import jdk.nashorn.internal.ir.VarNode;
 import jdk.nashorn.internal.ir.WhileNode;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
-import jdk.nashorn.internal.parser.Token;
 import jdk.nashorn.internal.parser.TokenType;
 
 /**
@@ -398,48 +398,53 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
 
     @Override
     public boolean enterBinaryNode(final BinaryNode binaryNode) {
+        // NOTE: regardless of operator's lexical associativity, lhs is always evaluated first.
         final Expression lhs = binaryNode.lhs();
-        final Expression rhs = binaryNode.rhs();
         final boolean isAssignment = binaryNode.isAssignment();
-
-        final TokenType tokenType = Token.descType(binaryNode.getToken());
-        if(tokenType.isLeftAssociative()) {
-            assert !isAssignment;
-            final boolean isLogical = binaryNode.isLogical();
-            final Label joinLabel = isLogical ? new Label("") : null;
-            lhs.accept(this);
-            if(isLogical) {
-                jumpToLabel((JoinPredecessor)lhs, joinLabel);
-            }
-            rhs.accept(this);
-            if(isLogical) {
-                jumpToLabel((JoinPredecessor)rhs, joinLabel);
-            }
-            joinOnLabel(joinLabel);
-        } else {
-            rhs.accept(this);
-            if(isAssignment) {
-                if(lhs instanceof BaseNode) {
-                    ((BaseNode)lhs).getBase().accept(this);
-                    if(lhs instanceof IndexNode) {
-                        ((IndexNode)lhs).getIndex().accept(this);
-                    } else {
-                        assert lhs instanceof AccessNode;
-                    }
+        LvarType lhsTypeOnLoad = null;
+        if(isAssignment) {
+            if(lhs instanceof BaseNode) {
+                ((BaseNode)lhs).getBase().accept(this);
+                if(lhs instanceof IndexNode) {
+                    ((IndexNode)lhs).getIndex().accept(this);
                 } else {
-                    assert lhs instanceof IdentNode;
-                    if(binaryNode.isSelfModifying()) {
-                        ((IdentNode)lhs).accept(this);
-                    }
+                    assert lhs instanceof AccessNode;
                 }
             } else {
-                lhs.accept(this);
+                assert lhs instanceof IdentNode;
+                if(binaryNode.isSelfModifying()) {
+                    final IdentNode ident = ((IdentNode)lhs);
+                    ident.accept(this);
+                    // Self-assignment can cause a change in the type of the variable. For purposes of evaluating
+                    // the type of the operation, we must use its type as it was when it was loaded. If we didn't
+                    // do this, some awkward expressions would end up being calculated incorrectly, e.g.
+                    // "var x; x += x = 0;". In this case we have undefined+int so the result type is double (NaN).
+                    // However, if we used the type of "x" on LHS after we evaluated RHS, we'd see int+int, so the
+                    // result type would be either optimistic int or pessimistic long, which would be wrong.
+                    lhsTypeOnLoad = getLocalVariableTypeIfBytecode(ident.getSymbol());
+                }
             }
+        } else {
+            lhs.accept(this);
         }
 
+        final boolean isLogical = binaryNode.isLogical();
+        assert !(isAssignment && isLogical); // there are no logical assignment operators in JS
+        final Label joinLabel = isLogical ? new Label("") : null;
+        if(isLogical) {
+            jumpToLabel((JoinPredecessor)lhs, joinLabel);
+        }
+
+        final Expression rhs = binaryNode.rhs();
+        rhs.accept(this);
+        if(isLogical) {
+            jumpToLabel((JoinPredecessor)rhs, joinLabel);
+        }
+        joinOnLabel(joinLabel);
+
         if(isAssignment && lhs instanceof IdentNode) {
             if(binaryNode.isSelfModifying()) {
-                onSelfAssignment((IdentNode)lhs, binaryNode);
+                onSelfAssignment((IdentNode)lhs, binaryNode, lhsTypeOnLoad);
             } else {
                 onAssignment((IdentNode)lhs, rhs);
             }
@@ -919,7 +924,8 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
 
         if(unaryNode.isSelfModifying()) {
             if(expr instanceof IdentNode) {
-                onSelfAssignment((IdentNode)expr, unaryNode);
+                final IdentNode ident = (IdentNode)expr;
+                onSelfAssignment(ident, unaryNode, getLocalVariableTypeIfBytecode(ident.getSymbol()));
             }
         }
         return false;
@@ -973,12 +979,41 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
         return types;
     }
 
+    /**
+     * Returns the current type of the local variable represented by the symbol. This is the most strict of all
+     * {@code getLocalVariableType*} methods, as it will throw an assertion if the type is null. Therefore, it is only
+     * safe to be invoked on symbols known to be bytecode locals, and only after they have been initialized.
+     * Regardless, it is recommended to use this method in majority of cases, as because of its strictness it is the
+     * best suited for catching missing type calculation bugs early.
+     * @param symbol a symbol representing a bytecode local variable.
+     * @return the current type of the local variable represented by the symbol
+     */
     private LvarType getLocalVariableType(final Symbol symbol) {
         final LvarType type = getLocalVariableTypeOrNull(symbol);
         assert type != null;
         return type;
     }
 
+    /**
+     * Gets the type for a local variable if it is a bytecode local, otherwise null. Can be used in circumstances where
+     * the type is irrelevant if the symbol is not a bytecode local. Note that for bytecode locals, it delegates to
+     * {@link #getLocalVariableType(Symbol)}, so it will still assert that the type for such variable is already
+     * defined (that is, not null).
+     * @param symbol the symbol representing the variable.
+     * @return the current variable type, if it is a bytecode local, otherwise null.
+     */
+    private LvarType getLocalVariableTypeIfBytecode(final Symbol symbol) {
+        return symbol.isBytecodeLocal() ? getLocalVariableType(symbol) : null;
+    }
+
+    /**
+     * Gets the type for a variable represented by a symbol, or null if the type is not know. This is the least strict
+     * of all local variable type getters, and as such its use is discouraged except in initialization scenarios (where
+     * a just-defined symbol might still be null).
+     * @param symbol the symbol
+     * @return the current type for the symbol, or null if the type is not known either because the symbol has not been
+     * initialized, or because the symbol does not represent a bytecode local variable.
+     */
     private LvarType getLocalVariableTypeOrNull(final Symbol symbol) {
         return localVariableTypes.get(symbol);
     }
@@ -1358,13 +1393,13 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
         jumpToCatchBlock(identNode);
     }
 
-    private void onSelfAssignment(final IdentNode identNode, final Expression assignment) {
+    private void onSelfAssignment(final IdentNode identNode, final Expression assignment, final LvarType typeOnLoad) {
         final Symbol symbol = identNode.getSymbol();
         assert symbol != null : identNode.getName();
         if(!symbol.isBytecodeLocal()) {
             return;
         }
-        final LvarType type = toLvarType(getType(assignment));
+        final LvarType type = toLvarType(getType(assignment, symbol, typeOnLoad.type));
         // Self-assignment never produce either a boolean or undefined
         assert type != null && type != LvarType.UNDEFINED && type != LvarType.BOOLEAN;
         setType(symbol, type);
@@ -1445,13 +1480,24 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
         symbolIsUsed(symbol, getLocalVariableType(symbol));
     }
 
+    /**
+     * Gets the type of the expression, dependent on the current types of the local variables.
+     *
+     * @param expr the expression
+     * @return the current type of the expression dependent on the current types of the local variables.
+     */
     private Type getType(final Expression expr) {
         return expr.getType(getSymbolToType());
     }
 
+    /**
+     * Returns a function object from symbols to their types, used by the expressions to evaluate their type.
+     * {@link BinaryNode} specifically uses identity of the function to cache type calculations. This method makes
+     * sure to return the same function object while the local variable types don't change, and create a new function
+     * object if the local variable types have been changed.
+     * @return a function object representing a mapping from symbols to their types.
+     */
     private Function<Symbol, Type> getSymbolToType() {
-        // BinaryNode uses identity of the function to cache type calculations. Therefore, we must use different
-        // function instances for different localVariableTypes instances.
         if(symbolToType.isStale()) {
             symbolToType = new SymbolToType();
         }
@@ -1469,4 +1515,41 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
             return boundTypes != localVariableTypes;
         }
     }
+
+    /**
+     * Gets the type of the expression, dependent on the current types of the local variables and a single overridden
+     * symbol type. Used by type calculation on compound operators to ensure the type of the LHS at the time it was
+     * loaded (which can potentially be different after RHS evaluation, e.g. "var x; x += x = 0;") is preserved for
+     * the calculation.
+     *
+     * @param expr the expression
+     * @param overriddenSymbol the overridden symbol
+     * @param overriddenType the overridden type
+     * @return the current type of the expression dependent on the current types of the local variables and the single
+     * potentially overridden type.
+     */
+    private Type getType(final Expression expr, final Symbol overriddenSymbol, final Type overriddenType) {
+        return expr.getType(getSymbolToType(overriddenSymbol, overriddenType));
+    }
+
+    private Function<Symbol, Type> getSymbolToType(final Symbol overriddenSymbol, final Type overriddenType) {
+        return getLocalVariableType(overriddenSymbol).type == overriddenType ? getSymbolToType() :
+            new SymbolToTypeOverride(overriddenSymbol, overriddenType);
+    }
+
+    private class SymbolToTypeOverride implements Function<Symbol, Type> {
+        private final Function<Symbol, Type> originalSymbolToType = getSymbolToType();
+        private final Symbol overriddenSymbol;
+        private final Type overriddenType;
+
+        SymbolToTypeOverride(final Symbol overriddenSymbol, final Type overriddenType) {
+            this.overriddenSymbol = overriddenSymbol;
+            this.overriddenType = overriddenType;
+        }
+
+        @Override
+        public Type apply(final Symbol symbol) {
+            return symbol == overriddenSymbol ? overriddenType : originalSymbolToType.apply(symbol);
+        }
+    }
 }
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java
index cb8cc918cf0..f625fe1a691 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BinaryNode.java
@@ -341,10 +341,7 @@ public final class BinaryNode extends Expression implements Assignment<Expressio
     @Override
     public Node accept(final NodeVisitor<? extends LexicalContext> visitor) {
         if (visitor.enterBinaryNode(this)) {
-            if(tokenType().isLeftAssociative()) {
-                return visitor.leaveBinaryNode(setLHS((Expression)lhs.accept(visitor)).setRHS((Expression)rhs.accept(visitor)));
-            }
-            return visitor.leaveBinaryNode(setRHS((Expression)rhs.accept(visitor)).setLHS((Expression)lhs.accept(visitor)));
+            return visitor.leaveBinaryNode(setLHS((Expression)lhs.accept(visitor)).setRHS((Expression)rhs.accept(visitor)));
         }
 
         return this;
diff --git a/nashorn/test/script/basic/JDK-8066227.js b/nashorn/test/script/basic/JDK-8066227.js
new file mode 100644
index 00000000000..aded343fe33
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066227.js
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2014 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.
+ */
+
+/**
+ * JDK-8066227: CodeGenerator load unitialized slot
+ *
+ * @test
+ * @run
+ */
+
+print((function () { var x; (x += x = 0); return x; })());
+print((function () { var x; (x -= x = 0); return x; })());
+print((function () { var x; (x *= x = 0); return x; })());
+print((function () { var x; (x /= x = 0); return x; })());
+print((function () { var x; (x %= x = 0); return x; })());
+print((function () { var x; (x <<= x = 0); return x; })());
+print((function () { var x; (x >>= x = 0); return x; })());
+print((function () { var x; (x >>>= x = 0); return x; })());
+print((function () { var x; (x |= x = 0); return x; })());
+print((function () { var x; (x &= x = 0); return x; })());
diff --git a/nashorn/test/script/basic/JDK-8066227.js.EXPECTED b/nashorn/test/script/basic/JDK-8066227.js.EXPECTED
new file mode 100644
index 00000000000..1841822181d
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066227.js.EXPECTED
@@ -0,0 +1,10 @@
+NaN
+NaN
+NaN
+NaN
+NaN
+0
+0
+0
+0
+0

From 8732d09ae7f6de828d2b4538b09ac1a88af0e053 Mon Sep 17 00:00:00 2001
From: Kumar Srinivasan <ksrini@openjdk.org>
Date: Mon, 8 Dec 2014 07:51:59 -0800
Subject: [PATCH 254/299] 8066745: tools/pack200/Pack200Props.java failed with
 java.lang.OutOfMemoryError: Java heap space

Reviewed-by: alanb
---
 jdk/test/tools/pack200/Pack200Props.java | 2 ++
 jdk/test/tools/pack200/Pack200Test.java  | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/jdk/test/tools/pack200/Pack200Props.java b/jdk/test/tools/pack200/Pack200Props.java
index e9d14322907..dcb90548be8 100644
--- a/jdk/test/tools/pack200/Pack200Props.java
+++ b/jdk/test/tools/pack200/Pack200Props.java
@@ -62,6 +62,8 @@ public class Pack200Props {
 
         List<String> cmdsList = new ArrayList<>();
         cmdsList.add(Utils.getPack200Cmd());
+        cmdsList.add("-J-Xshare:off");
+        cmdsList.add("-J-Xmx1280m");
         cmdsList.add("--effort=1");
         cmdsList.add("--verbose");
         cmdsList.add("--no-gzip");
diff --git a/jdk/test/tools/pack200/Pack200Test.java b/jdk/test/tools/pack200/Pack200Test.java
index 5d7fc105745..69cec754a07 100644
--- a/jdk/test/tools/pack200/Pack200Test.java
+++ b/jdk/test/tools/pack200/Pack200Test.java
@@ -34,7 +34,7 @@ import java.util.jar.*;
   * @summary check for memory leaks, test general packer/unpacker functionality\
   *          using native and java unpackers
   * @compile -XDignore.symbol.file Utils.java Pack200Test.java
-  * @run main/othervm/timeout=1200 -Xmx512m Pack200Test
+  * @run main/othervm/timeout=1200 -Xmx1280m -Xshare:off Pack200Test
   * @author ksrini
   */
 

From fb05a0309521da2624e3eb1ebe1a5e047aa0fc86 Mon Sep 17 00:00:00 2001
From: Maurizio Cimadamore <mcimadamore@openjdk.org>
Date: Mon, 8 Dec 2014 16:30:43 +0000
Subject: [PATCH 255/299] 8066889: IntelliJ langtools launcher ought to be
 Windows friendly

Fixup file and path separators in project setup stage.

Reviewed-by: jlahoda
---
 langtools/make/build.xml              |  2 ++
 langtools/make/intellij/workspace.xml | 12 ++++++------
 2 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/langtools/make/build.xml b/langtools/make/build.xml
index d2e543a6d56..8eff38083aa 100644
--- a/langtools/make/build.xml
+++ b/langtools/make/build.xml
@@ -422,6 +422,8 @@
             <isset property="jtreg.home"/>
         </condition>
         <replace file=".idea/ant.xml" token="@@@" value="${jtreg.idea.home}"/>
+        <replace file=".idea/workspace.xml" token="@FILE_SEP@" value="${file.separator}"/>
+        <replace file=".idea/workspace.xml" token="@PATH_SEP@" value="${path.separator}"/>
         <mkdir dir=".idea/classes"/>
         <javac srcdir="make/intellij/src"
                destdir=".idea/classes"/>
diff --git a/langtools/make/intellij/workspace.xml b/langtools/make/intellij/workspace.xml
index 6f613f966a6..7783a75f876 100644
--- a/langtools/make/intellij/workspace.xml
+++ b/langtools/make/intellij/workspace.xml
@@ -10,7 +10,7 @@
     <!-- standard tools -->
     <configuration default="false" name="javac" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javac.Main" />
-      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/java.compiler/classes:build/jdk.compiler/classes:build/java.base/classes:build/jdk.javadoc/classes:build/jdk.dev/classes" />
+      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@java.base@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.dev@FILE_SEP@classes" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -29,7 +29,7 @@
     </configuration>
     <configuration default="false" name="javadoc" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javadoc.Main" />
-      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/java.compiler/classes:build/jdk.compiler/classes:build/java.base/classes:build/jdk.javadoc/classes:build/jdk.dev/classes" />
+      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@java.base@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.dev@FILE_SEP@classes" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -48,7 +48,7 @@
     </configuration>
     <configuration default="false" name="javap" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javap.Main" />
-      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/java.compiler/classes:build/jdk.compiler/classes:build/java.base/classes:build/jdk.javadoc/classes:build/jdk.dev/classes" />
+      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@java.base@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.dev@FILE_SEP@classes" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -67,7 +67,7 @@
     </configuration>
     <configuration default="false" name="javah" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javah.Main" />
-      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/java.compiler/classes:build/jdk.compiler/classes:build/java.base/classes:build/jdk.javadoc/classes:build/jdk.dev/classes" />
+      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@java.base@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.dev@FILE_SEP@classes" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -86,7 +86,7 @@
     </configuration>
     <configuration default="false" name="sjavac" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.sjavac.Main" />
-      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/java.compiler/classes:build/jdk.compiler/classes:build/java.base/classes:build/jdk.javadoc/classes:build/jdk.dev/classes" />
+      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@java.base@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@jdk.dev@FILE_SEP@classes" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
@@ -106,7 +106,7 @@
     <!-- bootstrap javac -->
     <configuration default="false" name="javac (bootstrap)" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javac.Main" />
-            <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build/bootstrap/java.compiler/classes:build/bootstrap/jdk.compiler/classes:build/bootstrap/java.base/classes:build/bootstrap/jdk.javadoc/classes:build/bootstrap/jdk.dev/classes" />
+      <option name="VM_PARAMETERS" value="-Xbootclasspath/p:build@FILE_SEP@bootstrap@FILE_SEP@java.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@bootstrap@FILE_SEP@jdk.compiler@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@bootstrap@FILE_SEP@java.base@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@bootstrap@FILE_SEP@jdk.javadoc@FILE_SEP@classes@PATH_SEP@build@FILE_SEP@bootstrap@FILE_SEP@jdk.dev@FILE_SEP@classes" />
       <option name="PROGRAM_PARAMETERS" value="" />
       <option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
       <option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />

From 59b3453845ec1a7160ca727ea149551784ada53c Mon Sep 17 00:00:00 2001
From: Jan Lahoda <jlahoda@openjdk.org>
Date: Mon, 8 Dec 2014 18:02:07 +0100
Subject: [PATCH 256/299] 8061549: Disallow _ as a one-character identifier

Underscore is no longer a one-charater identifier with -source 9

Reviewed-by: mcimadamore, jjg
---
 .../com/sun/tools/javac/code/Source.java      |  3 ++
 .../sun/tools/javac/parser/JavacParser.java   | 11 ++++-
 .../tools/javac/resources/compiler.properties |  6 ++-
 .../testAnchorNames/TestAnchorNames.java      |  1 +
 .../examples/UnderscoreAsIdentifierError.java | 28 +++++++++++
 ...ava => UnderscoreAsIdentifierWarning.java} |  5 +-
 .../tools/javac/lambda/IdentifierTest.java    |  5 +-
 .../tools/javac/lambda/IdentifierTest.out     | 47 -------------------
 .../tools/javac/lambda/IdentifierTest8.out    | 47 +++++++++++++++++++
 .../tools/javac/lambda/IdentifierTest9.out    | 45 ++++++++++++++++++
 ...oreAsIdent.java => UnderscoreAsIdent.java} |  5 +-
 .../tools/javac/lambda/UnderscoreAsIdent8.out | 20 ++++++++
 .../tools/javac/lambda/UnderscoreAsIdent9.out | 18 +++++++
 .../javac/lambda/WarnUnderscoreAsIdent.out    | 20 --------
 .../elements/doccomments/TestDocComments.java | 12 ++---
 .../tools/javac/tree/TreePosRoundsTest.java   |  4 +-
 .../tools/javadoc/6964914/JavacWarning.java   |  4 +-
 .../test/tools/javadoc/6964914/Test.java      |  3 +-
 18 files changed, 197 insertions(+), 87 deletions(-)
 create mode 100644 langtools/test/tools/javac/diags/examples/UnderscoreAsIdentifierError.java
 rename langtools/test/tools/javac/diags/examples/{UnderscoreAsIdentifier.java => UnderscoreAsIdentifierWarning.java} (87%)
 delete mode 100644 langtools/test/tools/javac/lambda/IdentifierTest.out
 create mode 100644 langtools/test/tools/javac/lambda/IdentifierTest8.out
 create mode 100644 langtools/test/tools/javac/lambda/IdentifierTest9.out
 rename langtools/test/tools/javac/lambda/{WarnUnderscoreAsIdent.java => UnderscoreAsIdent.java} (83%)
 create mode 100644 langtools/test/tools/javac/lambda/UnderscoreAsIdent8.out
 create mode 100644 langtools/test/tools/javac/lambda/UnderscoreAsIdent9.out
 delete mode 100644 langtools/test/tools/javac/lambda/WarnUnderscoreAsIdent.out

diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
index 0af7fce16af..eeda9d1ce2e 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/code/Source.java
@@ -209,6 +209,9 @@ public enum Source {
     public boolean allowPrivateSafeVarargs() {
         return compareTo(JDK1_9) >= 0;
     }
+    public boolean allowUnderscoreIdentifier() {
+        return compareTo(JDK1_8) <= 0;
+    }
     public static SourceVersion toSourceVersion(Source source) {
         switch(source) {
         case JDK1_2:
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
index 77ee0014b6c..be15a750dd9 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/parser/JavacParser.java
@@ -157,6 +157,7 @@ public class JavacParser implements Parser {
         this.allowIntersectionTypesInCast = source.allowIntersectionTypesInCast();
         this.allowTypeAnnotations = source.allowTypeAnnotations();
         this.allowAnnotationsAfterTypeParams = source.allowAnnotationsAfterTypeParams();
+        this.allowUnderscoreIdentifier = source.allowUnderscoreIdentifier();
         this.keepDocComments = keepDocComments;
         docComments = newDocCommentTable(keepDocComments, fac);
         this.keepLineMap = keepLineMap;
@@ -230,6 +231,10 @@ public class JavacParser implements Parser {
      */
     boolean allowAnnotationsAfterTypeParams;
 
+    /** Switch: should we allow '_' as an identifier?
+     */
+    boolean allowUnderscoreIdentifier;
+
     /** Switch: is "this" allowed as an identifier?
      * This is needed to parse receiver types.
      */
@@ -595,7 +600,11 @@ public class JavacParser implements Parser {
                 return names.error;
             }
         } else if (token.kind == UNDERSCORE) {
-            warning(token.pos, "underscore.as.identifier");
+            if (allowUnderscoreIdentifier) {
+                warning(token.pos, "underscore.as.identifier");
+            } else {
+                error(token.pos, "underscore.as.identifier");
+            }
             Name name = token.name();
             nextToken();
             return name;
diff --git a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
index 23b6a09d13c..b22e6970567 100644
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties
@@ -2276,8 +2276,10 @@ compiler.err.var.in.try.with.resources.not.supported.in.source=\
     (use -source 9 or higher to enable variables in try-with-resources)
 
 compiler.warn.underscore.as.identifier=\
-    ''_'' used as an identifier\n\
-    (use of ''_'' as an identifier might not be supported in releases after Java SE 8)
+    as of release 9, ''_'' is a keyword, and may not be used as an identifier
+
+compiler.err.underscore.as.identifier=\
+    as of release 9, ''_'' is a keyword, and may not be used as an identifier
 
 compiler.err.underscore.as.identifier.in.lambda=\
     ''_'' used as an identifier\n\
diff --git a/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java b/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java
index 6a3581e82f1..f0c4a138e34 100644
--- a/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java
+++ b/langtools/test/com/sun/javadoc/testAnchorNames/TestAnchorNames.java
@@ -46,6 +46,7 @@ public class TestAnchorNames extends JavadocTester {
     void test() {
         javadoc("-d", "out",
                 "-sourcepath", testSrc,
+                "-source", "8", //so that '_' can be used as an identifier
                 "-use",
                 "pkg1");
         checkExit(Exit.OK);
diff --git a/langtools/test/tools/javac/diags/examples/UnderscoreAsIdentifierError.java b/langtools/test/tools/javac/diags/examples/UnderscoreAsIdentifierError.java
new file mode 100644
index 00000000000..1600d5cc2ca
--- /dev/null
+++ b/langtools/test/tools/javac/diags/examples/UnderscoreAsIdentifierError.java
@@ -0,0 +1,28 @@
+/*
+ * Copyright (c) 2013, 2014, 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.
+ */
+
+// key: compiler.err.underscore.as.identifier
+
+class UnderscoreAsIdentifierError {
+    String _ = null;
+}
diff --git a/langtools/test/tools/javac/diags/examples/UnderscoreAsIdentifier.java b/langtools/test/tools/javac/diags/examples/UnderscoreAsIdentifierWarning.java
similarity index 87%
rename from langtools/test/tools/javac/diags/examples/UnderscoreAsIdentifier.java
rename to langtools/test/tools/javac/diags/examples/UnderscoreAsIdentifierWarning.java
index 91c939cf37f..6a1df9bde7b 100644
--- a/langtools/test/tools/javac/diags/examples/UnderscoreAsIdentifier.java
+++ b/langtools/test/tools/javac/diags/examples/UnderscoreAsIdentifierWarning.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,7 +22,8 @@
  */
 
 // key: compiler.warn.underscore.as.identifier
+// options: -source 8 -Xlint:-options
 
-class UnderscoreAsIdentifier {
+class UnderscoreAsIdentifierWarning {
     String _ = null;
 }
diff --git a/langtools/test/tools/javac/lambda/IdentifierTest.java b/langtools/test/tools/javac/lambda/IdentifierTest.java
index 17e480d9d4e..d4025fff825 100644
--- a/langtools/test/tools/javac/lambda/IdentifierTest.java
+++ b/langtools/test/tools/javac/lambda/IdentifierTest.java
@@ -1,9 +1,10 @@
 /*
  * @test   /nodynamiccopyright/
- * @bug    8007401 8007427
+ * @bug    8007401 8007427 8061549
  * @author sogoel
  * @summary Test generation of warnings when '_' is used an identifier
- * @compile/fail/ref=IdentifierTest.out -Werror -XDrawDiagnostics IdentifierTest.java
+ * @compile/fail/ref=IdentifierTest8.out -source 8 -Xlint:-options -Werror -XDrawDiagnostics IdentifierTest.java
+ * @compile/fail/ref=IdentifierTest9.out -XDrawDiagnostics IdentifierTest.java
  */
 
 import java.util.List;
diff --git a/langtools/test/tools/javac/lambda/IdentifierTest.out b/langtools/test/tools/javac/lambda/IdentifierTest.out
deleted file mode 100644
index d78edb18449..00000000000
--- a/langtools/test/tools/javac/lambda/IdentifierTest.out
+++ /dev/null
@@ -1,47 +0,0 @@
-IdentifierTest.java:40:11: compiler.warn.underscore.as.identifier
-IdentifierTest.java:43:16: compiler.warn.underscore.as.identifier
-IdentifierTest.java:44:20: compiler.warn.underscore.as.identifier
-IdentifierTest.java:45:22: compiler.warn.underscore.as.identifier
-IdentifierTest.java:50:13: compiler.warn.underscore.as.identifier
-IdentifierTest.java:50:15: compiler.warn.underscore.as.identifier
-IdentifierTest.java:50:23: compiler.warn.underscore.as.identifier
-IdentifierTest.java:52:13: compiler.warn.underscore.as.identifier
-IdentifierTest.java:54:13: compiler.warn.underscore.as.identifier
-IdentifierTest.java:60:21: compiler.warn.underscore.as.identifier
-IdentifierTest.java:61:42: compiler.warn.underscore.as.identifier
-IdentifierTest.java:62:67: compiler.warn.underscore.as.identifier
-IdentifierTest.java:69:13: compiler.warn.underscore.as.identifier
-IdentifierTest.java:70:14: compiler.warn.underscore.as.identifier
-IdentifierTest.java:71:18: compiler.warn.underscore.as.identifier
-IdentifierTest.java:76:22: compiler.warn.underscore.as.identifier
-IdentifierTest.java:78:13: compiler.warn.underscore.as.identifier
-IdentifierTest.java:78:15: compiler.warn.underscore.as.identifier
-IdentifierTest.java:80:13: compiler.warn.underscore.as.identifier
-IdentifierTest.java:80:15: compiler.warn.underscore.as.identifier
-IdentifierTest.java:87:10: compiler.warn.underscore.as.identifier
-IdentifierTest.java:87:38: compiler.warn.underscore.as.identifier
-IdentifierTest.java:93:14: compiler.warn.underscore.as.identifier
-IdentifierTest.java:100:17: compiler.warn.underscore.as.identifier
-IdentifierTest.java:100:26: compiler.warn.underscore.as.identifier
-IdentifierTest.java:117:20: compiler.warn.underscore.as.identifier
-IdentifierTest.java:122:10: compiler.warn.underscore.as.identifier
-IdentifierTest.java:127:17: compiler.warn.underscore.as.identifier
-IdentifierTest.java:130:17: compiler.warn.underscore.as.identifier
-IdentifierTest.java:137:17: compiler.warn.underscore.as.identifier
-IdentifierTest.java:137:24: compiler.warn.underscore.as.identifier
-IdentifierTest.java:137:33: compiler.warn.underscore.as.identifier
-IdentifierTest.java:138:39: compiler.warn.underscore.as.identifier
-IdentifierTest.java:142:13: compiler.warn.underscore.as.identifier
-IdentifierTest.java:143:15: compiler.warn.underscore.as.identifier
-IdentifierTest.java:144:13: compiler.warn.underscore.as.identifier
-IdentifierTest.java:149:15: compiler.warn.underscore.as.identifier
-IdentifierTest.java:150:17: compiler.warn.underscore.as.identifier
-IdentifierTest.java:156:16: compiler.warn.underscore.as.identifier
-IdentifierTest.java:158:25: compiler.warn.underscore.as.identifier
-IdentifierTest.java:167:5: compiler.warn.underscore.as.identifier
-IdentifierTest.java:171:26: compiler.warn.underscore.as.identifier
-IdentifierTest.java:173:19: compiler.warn.underscore.as.identifier
-IdentifierTest.java:179:11: compiler.warn.underscore.as.identifier
-- compiler.err.warnings.and.werror
-1 error
-44 warnings
diff --git a/langtools/test/tools/javac/lambda/IdentifierTest8.out b/langtools/test/tools/javac/lambda/IdentifierTest8.out
new file mode 100644
index 00000000000..6d1da256d40
--- /dev/null
+++ b/langtools/test/tools/javac/lambda/IdentifierTest8.out
@@ -0,0 +1,47 @@
+IdentifierTest.java:41:11: compiler.warn.underscore.as.identifier
+IdentifierTest.java:44:16: compiler.warn.underscore.as.identifier
+IdentifierTest.java:45:20: compiler.warn.underscore.as.identifier
+IdentifierTest.java:46:22: compiler.warn.underscore.as.identifier
+IdentifierTest.java:51:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:51:15: compiler.warn.underscore.as.identifier
+IdentifierTest.java:51:23: compiler.warn.underscore.as.identifier
+IdentifierTest.java:53:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:55:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:61:21: compiler.warn.underscore.as.identifier
+IdentifierTest.java:62:42: compiler.warn.underscore.as.identifier
+IdentifierTest.java:63:67: compiler.warn.underscore.as.identifier
+IdentifierTest.java:70:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:71:14: compiler.warn.underscore.as.identifier
+IdentifierTest.java:72:18: compiler.warn.underscore.as.identifier
+IdentifierTest.java:77:22: compiler.warn.underscore.as.identifier
+IdentifierTest.java:79:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:79:15: compiler.warn.underscore.as.identifier
+IdentifierTest.java:81:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:81:15: compiler.warn.underscore.as.identifier
+IdentifierTest.java:88:10: compiler.warn.underscore.as.identifier
+IdentifierTest.java:88:38: compiler.warn.underscore.as.identifier
+IdentifierTest.java:94:14: compiler.warn.underscore.as.identifier
+IdentifierTest.java:101:17: compiler.warn.underscore.as.identifier
+IdentifierTest.java:101:26: compiler.warn.underscore.as.identifier
+IdentifierTest.java:118:20: compiler.warn.underscore.as.identifier
+IdentifierTest.java:123:10: compiler.warn.underscore.as.identifier
+IdentifierTest.java:128:17: compiler.warn.underscore.as.identifier
+IdentifierTest.java:131:17: compiler.warn.underscore.as.identifier
+IdentifierTest.java:138:17: compiler.warn.underscore.as.identifier
+IdentifierTest.java:138:24: compiler.warn.underscore.as.identifier
+IdentifierTest.java:138:33: compiler.warn.underscore.as.identifier
+IdentifierTest.java:139:39: compiler.warn.underscore.as.identifier
+IdentifierTest.java:143:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:144:15: compiler.warn.underscore.as.identifier
+IdentifierTest.java:145:13: compiler.warn.underscore.as.identifier
+IdentifierTest.java:150:15: compiler.warn.underscore.as.identifier
+IdentifierTest.java:151:17: compiler.warn.underscore.as.identifier
+IdentifierTest.java:157:16: compiler.warn.underscore.as.identifier
+IdentifierTest.java:159:25: compiler.warn.underscore.as.identifier
+IdentifierTest.java:168:5: compiler.warn.underscore.as.identifier
+IdentifierTest.java:172:26: compiler.warn.underscore.as.identifier
+IdentifierTest.java:174:19: compiler.warn.underscore.as.identifier
+IdentifierTest.java:180:11: compiler.warn.underscore.as.identifier
+- compiler.err.warnings.and.werror
+1 error
+44 warnings
diff --git a/langtools/test/tools/javac/lambda/IdentifierTest9.out b/langtools/test/tools/javac/lambda/IdentifierTest9.out
new file mode 100644
index 00000000000..6dd260aa8a2
--- /dev/null
+++ b/langtools/test/tools/javac/lambda/IdentifierTest9.out
@@ -0,0 +1,45 @@
+IdentifierTest.java:41:11: compiler.err.underscore.as.identifier
+IdentifierTest.java:44:16: compiler.err.underscore.as.identifier
+IdentifierTest.java:45:20: compiler.err.underscore.as.identifier
+IdentifierTest.java:46:22: compiler.err.underscore.as.identifier
+IdentifierTest.java:51:13: compiler.err.underscore.as.identifier
+IdentifierTest.java:51:15: compiler.err.underscore.as.identifier
+IdentifierTest.java:51:23: compiler.err.underscore.as.identifier
+IdentifierTest.java:53:13: compiler.err.underscore.as.identifier
+IdentifierTest.java:55:13: compiler.err.underscore.as.identifier
+IdentifierTest.java:61:21: compiler.err.underscore.as.identifier
+IdentifierTest.java:62:42: compiler.err.underscore.as.identifier
+IdentifierTest.java:63:67: compiler.err.underscore.as.identifier
+IdentifierTest.java:70:13: compiler.err.underscore.as.identifier
+IdentifierTest.java:71:14: compiler.err.underscore.as.identifier
+IdentifierTest.java:72:18: compiler.err.underscore.as.identifier
+IdentifierTest.java:77:22: compiler.err.underscore.as.identifier
+IdentifierTest.java:79:13: compiler.err.underscore.as.identifier
+IdentifierTest.java:79:15: compiler.err.underscore.as.identifier
+IdentifierTest.java:81:13: compiler.err.underscore.as.identifier
+IdentifierTest.java:81:15: compiler.err.underscore.as.identifier
+IdentifierTest.java:88:10: compiler.err.underscore.as.identifier
+IdentifierTest.java:88:38: compiler.err.underscore.as.identifier
+IdentifierTest.java:94:14: compiler.err.underscore.as.identifier
+IdentifierTest.java:101:17: compiler.err.underscore.as.identifier
+IdentifierTest.java:101:26: compiler.err.underscore.as.identifier
+IdentifierTest.java:118:20: compiler.err.underscore.as.identifier
+IdentifierTest.java:123:10: compiler.err.underscore.as.identifier
+IdentifierTest.java:128:17: compiler.err.underscore.as.identifier
+IdentifierTest.java:131:17: compiler.err.underscore.as.identifier
+IdentifierTest.java:138:17: compiler.err.underscore.as.identifier
+IdentifierTest.java:138:24: compiler.err.underscore.as.identifier
+IdentifierTest.java:138:33: compiler.err.underscore.as.identifier
+IdentifierTest.java:139:39: compiler.err.underscore.as.identifier
+IdentifierTest.java:143:13: compiler.err.underscore.as.identifier
+IdentifierTest.java:144:15: compiler.err.underscore.as.identifier
+IdentifierTest.java:145:13: compiler.err.underscore.as.identifier
+IdentifierTest.java:150:15: compiler.err.underscore.as.identifier
+IdentifierTest.java:151:17: compiler.err.underscore.as.identifier
+IdentifierTest.java:157:16: compiler.err.underscore.as.identifier
+IdentifierTest.java:159:25: compiler.err.underscore.as.identifier
+IdentifierTest.java:168:5: compiler.err.underscore.as.identifier
+IdentifierTest.java:172:26: compiler.err.underscore.as.identifier
+IdentifierTest.java:174:19: compiler.err.underscore.as.identifier
+IdentifierTest.java:180:11: compiler.err.underscore.as.identifier
+44 errors
diff --git a/langtools/test/tools/javac/lambda/WarnUnderscoreAsIdent.java b/langtools/test/tools/javac/lambda/UnderscoreAsIdent.java
similarity index 83%
rename from langtools/test/tools/javac/lambda/WarnUnderscoreAsIdent.java
rename to langtools/test/tools/javac/lambda/UnderscoreAsIdent.java
index 2090e4b4375..dc50aa143e0 100644
--- a/langtools/test/tools/javac/lambda/WarnUnderscoreAsIdent.java
+++ b/langtools/test/tools/javac/lambda/UnderscoreAsIdent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -24,7 +24,8 @@
 /*
  * @test
  * @summary Check usages of underscore as identifier generate warnings
- * @compile/fail/ref=WarnUnderscoreAsIdent.out -XDrawDiagnostics -Werror WarnUnderscoreAsIdent.java
+ * @compile/fail/ref=UnderscoreAsIdent8.out -source 8 -Xlint:-options -XDrawDiagnostics -Werror UnderscoreAsIdent.java
+ * @compile/fail/ref=UnderscoreAsIdent9.out -XDrawDiagnostics -Werror UnderscoreAsIdent.java
  */
 package _._;
 
diff --git a/langtools/test/tools/javac/lambda/UnderscoreAsIdent8.out b/langtools/test/tools/javac/lambda/UnderscoreAsIdent8.out
new file mode 100644
index 00000000000..bc9c9c0ae60
--- /dev/null
+++ b/langtools/test/tools/javac/lambda/UnderscoreAsIdent8.out
@@ -0,0 +1,20 @@
+UnderscoreAsIdent.java:30:9: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:30:11: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:32:8: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:32:10: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:34:7: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:35:12: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:36:10: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:36:19: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:38:16: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:41:18: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:41:25: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:41:33: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:44:34: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:47:9: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:49:19: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:51:9: compiler.warn.underscore.as.identifier
+UnderscoreAsIdent.java:53:22: compiler.warn.underscore.as.identifier
+- compiler.err.warnings.and.werror
+1 error
+17 warnings
diff --git a/langtools/test/tools/javac/lambda/UnderscoreAsIdent9.out b/langtools/test/tools/javac/lambda/UnderscoreAsIdent9.out
new file mode 100644
index 00000000000..420c69c32d6
--- /dev/null
+++ b/langtools/test/tools/javac/lambda/UnderscoreAsIdent9.out
@@ -0,0 +1,18 @@
+UnderscoreAsIdent.java:30:9: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:30:11: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:32:8: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:32:10: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:34:7: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:35:12: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:36:10: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:36:19: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:38:16: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:41:18: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:41:25: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:41:33: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:44:34: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:47:9: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:49:19: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:51:9: compiler.err.underscore.as.identifier
+UnderscoreAsIdent.java:53:22: compiler.err.underscore.as.identifier
+17 errors
diff --git a/langtools/test/tools/javac/lambda/WarnUnderscoreAsIdent.out b/langtools/test/tools/javac/lambda/WarnUnderscoreAsIdent.out
deleted file mode 100644
index 0d1185ff0dc..00000000000
--- a/langtools/test/tools/javac/lambda/WarnUnderscoreAsIdent.out
+++ /dev/null
@@ -1,20 +0,0 @@
-WarnUnderscoreAsIdent.java:29:9: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:29:11: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:31:8: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:31:10: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:33:7: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:34:12: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:35:10: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:35:19: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:37:16: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:40:18: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:40:25: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:40:33: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:43:34: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:46:9: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:48:19: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:50:9: compiler.warn.underscore.as.identifier
-WarnUnderscoreAsIdent.java:52:22: compiler.warn.underscore.as.identifier
-- compiler.err.warnings.and.werror
-1 error
-17 warnings
diff --git a/langtools/test/tools/javac/processing/model/util/elements/doccomments/TestDocComments.java b/langtools/test/tools/javac/processing/model/util/elements/doccomments/TestDocComments.java
index d8d398861f1..681350b3957 100644
--- a/langtools/test/tools/javac/processing/model/util/elements/doccomments/TestDocComments.java
+++ b/langtools/test/tools/javac/processing/model/util/elements/doccomments/TestDocComments.java
@@ -265,19 +265,19 @@ public class TestDocComments extends JavacTestingAbstractProcessor {
 
     class TestElementScanner extends ElementScanner<Void, Void> {
         @Override
-        public Void visitExecutable(ExecutableElement e, Void _) {
+        public Void visitExecutable(ExecutableElement e, Void p) {
             check(e);
-            return super.visitExecutable(e, _);
+            return super.visitExecutable(e, p);
         }
         @Override
-        public Void visitType(TypeElement e, Void _) {
+        public Void visitType(TypeElement e, Void p) {
             check(e);
-            return super.visitType(e, _);
+            return super.visitType(e, p);
         }
         @Override
-        public Void visitVariable(VariableElement e, Void _) {
+        public Void visitVariable(VariableElement e, Void p) {
             check(e);
-            return super.visitVariable(e, _);
+            return super.visitVariable(e, p);
         }
     }
 
diff --git a/langtools/test/tools/javac/tree/TreePosRoundsTest.java b/langtools/test/tools/javac/tree/TreePosRoundsTest.java
index 39304a2ce9c..6a9c764bc15 100644
--- a/langtools/test/tools/javac/tree/TreePosRoundsTest.java
+++ b/langtools/test/tools/javac/tree/TreePosRoundsTest.java
@@ -140,9 +140,9 @@ public class TreePosRoundsTest extends AbstractProcessor {
         }
 
         @Override
-        public Void visitVariable(VariableTree tree, Void _) {
+        public Void visitVariable(VariableTree tree, Void p) {
             check(getCurrentPath());
-            return super.visitVariable(tree, _);
+            return super.visitVariable(tree, p);
         }
 
         void check(TreePath tp) {
diff --git a/langtools/test/tools/javadoc/6964914/JavacWarning.java b/langtools/test/tools/javadoc/6964914/JavacWarning.java
index 241e6ff8128..5bb598dc679 100644
--- a/langtools/test/tools/javadoc/6964914/JavacWarning.java
+++ b/langtools/test/tools/javadoc/6964914/JavacWarning.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -22,5 +22,5 @@
  */
 
 public class JavacWarning {
-    String _ = null; // this will cause a warning.  It may be deprecated in JDK8
+    String _ = null; // this will cause a warning with -source 8 (this is an error as of -source 9)
 }
diff --git a/langtools/test/tools/javadoc/6964914/Test.java b/langtools/test/tools/javadoc/6964914/Test.java
index 609a8e85e45..f8885ca2b88 100644
--- a/langtools/test/tools/javadoc/6964914/Test.java
+++ b/langtools/test/tools/javadoc/6964914/Test.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -46,6 +46,7 @@ public class Test {
         File testSrc = new File(System.getProperty("test.src"));
         String[] args = {
             "-Xdoclint:none",
+            "-source", "8",
             "-bootclasspath", System.getProperty("sun.boot.class.path"),
             "-classpath", ".",
             "-package",

From 220aa4b8385dc15030941c014825a67986290ca6 Mon Sep 17 00:00:00 2001
From: Joe Darcy <darcy@openjdk.org>
Date: Mon, 8 Dec 2014 09:13:08 -0800
Subject: [PATCH 257/299] 8066643: (zipfs) Suppress deprecation warnings in
 jdk.zipfs module 8066634: Suppress deprecation warnings in java.management
 module 8066636: Suppress deprecation warnings in the jdk.jvmstat and jdk.jdi
 modules

Reviewed-by: alanb, lancea, sherman, sla, dfuchs
---
 .../sun/jmx/interceptor/DefaultMBeanServerInterceptor.java   | 5 ++++-
 .../com/sun/tools/example/debug/expr/ExpressionParser.java   | 1 +
 .../sun/jvmstat/perfdata/monitor/PerfDataBufferImpl.java     | 1 +
 .../jdk.jvmstat/share/classes/sun/tools/jstatd/Jstatd.java   | 1 +
 jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipUtils.java  | 2 ++
 5 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/jdk/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java b/jdk/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java
index 47b95927307..a0589f72b05 100644
--- a/jdk/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java
+++ b/jdk/src/java.management/share/classes/com/sun/jmx/interceptor/DefaultMBeanServerInterceptor.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2014, 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
@@ -1707,16 +1707,19 @@ public class DefaultMBeanServerInterceptor implements MBeanServerInterceptor {
         throw new UnsupportedOperationException("Not supported yet.");
     }
 
+    @SuppressWarnings("deprecation")
     public ObjectInputStream deserialize(ObjectName name, byte[] data) throws InstanceNotFoundException,
                                                                               OperationsException {
         throw new UnsupportedOperationException("Not supported yet.");
     }
 
+    @SuppressWarnings("deprecation")
     public ObjectInputStream deserialize(String className, byte[] data) throws OperationsException,
                                                                                ReflectionException {
         throw new UnsupportedOperationException("Not supported yet.");
     }
 
+    @SuppressWarnings("deprecation")
     public ObjectInputStream deserialize(String className, ObjectName loaderName,
             byte[] data) throws InstanceNotFoundException, OperationsException,
                                 ReflectionException {
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java
index 4005adc4262..c0c22e8f3ec 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/ExpressionParser.java
@@ -59,6 +59,7 @@ public class ExpressionParser implements ExpressionParserConstants {
         StackFrame get() throws IncompatibleThreadStateException;
   }
 
+  @SuppressWarnings("deprecation")
   public static Value evaluate(String expr, VirtualMachine vm,
                                GetFrame frameGetter) throws ParseException,
                                             InvocationException,
diff --git a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/PerfDataBufferImpl.java b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/PerfDataBufferImpl.java
index 2bde91cf719..db72e654735 100644
--- a/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/PerfDataBufferImpl.java
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/jvmstat/perfdata/monitor/PerfDataBufferImpl.java
@@ -158,6 +158,7 @@ public abstract class PerfDataBufferImpl {
      * the sun.jvmstat.perfdata.aliasmap file indicates some other
      * file as the source.
      */
+    @SuppressWarnings("deprecation")
     private void buildAliasMap() {
         assert Thread.holdsLock(this);
 
diff --git a/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/Jstatd.java b/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/Jstatd.java
index 22238e70142..09a17803cfa 100644
--- a/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/Jstatd.java
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/Jstatd.java
@@ -76,6 +76,7 @@ public class Jstatd {
         }
     }
 
+    @SuppressWarnings("deprecation") // Use of RMISecurityManager
     public static void main(String[] args) {
         String rminame = null;
         int argc = 0;
diff --git a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipUtils.java b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipUtils.java
index 0e3584e89c9..114dc4523d3 100644
--- a/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipUtils.java
+++ b/jdk/src/jdk.zipfs/share/classes/jdk/nio/zipfs/ZipUtils.java
@@ -103,6 +103,7 @@ class ZipUtils {
     /*
      * Converts DOS time to Java time (number of milliseconds since epoch).
      */
+    @SuppressWarnings("deprecation")
     public static long dosToJavaTime(long dtime) {
         Date d = new Date((int)(((dtime >> 25) & 0x7f) + 80),
                           (int)(((dtime >> 21) & 0x0f) - 1),
@@ -116,6 +117,7 @@ class ZipUtils {
     /*
      * Converts Java time to DOS time.
      */
+    @SuppressWarnings("deprecation")
     public static long javaToDosTime(long time) {
         Date d = new Date(time);
         int year = d.getYear() + 1900;

From 277a0d2dc8f06177bafec014f8acf9f6f9c18fb0 Mon Sep 17 00:00:00 2001
From: Kumar Srinivasan <ksrini@openjdk.org>
Date: Mon, 8 Dec 2014 11:54:17 -0800
Subject: [PATCH 258/299] 8066841: Need to exclude javacpl in
 tools/launcher/VersionCheck.java

Reviewed-by: alanb
---
 jdk/test/tools/launcher/VersionCheck.java | 1 +
 1 file changed, 1 insertion(+)

diff --git a/jdk/test/tools/launcher/VersionCheck.java b/jdk/test/tools/launcher/VersionCheck.java
index 59e0973b468..d7044446588 100644
--- a/jdk/test/tools/launcher/VersionCheck.java
+++ b/jdk/test/tools/launcher/VersionCheck.java
@@ -69,6 +69,7 @@ public class VersionCheck extends TestHelper {
         "java-rmi",
         "java-rmi.cgi",
         "javadoc",
+        "javacpl",
         "javaws",
         "jcmd",
         "jconsole",

From cf476e93028a91782f5c7858aece8041c8f41050 Mon Sep 17 00:00:00 2001
From: Jan Lahoda <jlahoda@openjdk.org>
Date: Mon, 8 Dec 2014 21:26:04 +0100
Subject: [PATCH 259/299] 8066902: JavacParserTest fails on Windows

Normalizing line endings to '\n'.

Reviewed-by: jjg, ksrini
---
 langtools/test/tools/javac/parser/JavacParserTest.java | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/langtools/test/tools/javac/parser/JavacParserTest.java b/langtools/test/tools/javac/parser/JavacParserTest.java
index 7f0a620a294..22a4f3f9275 100644
--- a/langtools/test/tools/javac/parser/JavacParserTest.java
+++ b/langtools/test/tools/javac/parser/JavacParserTest.java
@@ -50,6 +50,7 @@ import com.sun.source.util.TreeScanner;
 import com.sun.source.util.Trees;
 import com.sun.tools.javac.api.JavacTaskImpl;
 import com.sun.tools.javac.main.Main;
+import com.sun.tools.javac.main.Main.Result;
 import com.sun.tools.javac.tree.JCTree;
 import java.io.IOException;
 import java.io.StringWriter;
@@ -952,8 +953,10 @@ public class JavacParserTest extends TestCase {
         JavacTaskImpl ct = (JavacTaskImpl) tool.getTask(out, fm, null,
                 Arrays.asList("-XDrawDiagnostics"), null, Arrays.asList(new MyFileObject(code)));
 
-        assertEquals("the error code is not correct", Main.Result.ERROR, ct.doCall());
-        assertEquals("the error message is not correct", expectedErrors, out.toString());
+        Result errorCode = ct.doCall();
+        assertEquals("the error code is not correct; actual:" + errorCode, Main.Result.ERROR, errorCode);
+        String actualErrors = normalize(out.toString());
+        assertEquals("the error message is not correct, actual: " + actualErrors, expectedErrors, actualErrors);
     }
 
     void run(String[] args) throws Exception {

From b633764a638fcca2afef4fd1be9142e3c71540c4 Mon Sep 17 00:00:00 2001
From: Stuart Marks <smarks@openjdk.org>
Date: Mon, 8 Dec 2014 14:32:31 -0800
Subject: [PATCH 260/299] 8066835: TEST_BUG:
 javax/management/remote/mandatory/connection/RMIConnector_NPETest.java fails

Reviewed-by: lancea
---
 jdk/test/java/rmi/testlibrary/JavaVM.java     | 19 ++++++++++++++++++-
 jdk/test/java/rmi/testlibrary/RMID.java       |  2 +-
 .../connection/RMIConnector_NPETest.java      |  2 +-
 3 files changed, 20 insertions(+), 3 deletions(-)

diff --git a/jdk/test/java/rmi/testlibrary/JavaVM.java b/jdk/test/java/rmi/testlibrary/JavaVM.java
index a4345cb3e88..b304cd25213 100644
--- a/jdk/test/java/rmi/testlibrary/JavaVM.java
+++ b/jdk/test/java/rmi/testlibrary/JavaVM.java
@@ -194,7 +194,7 @@ public class JavaVM {
             throws InterruptedException, TimeoutException {
         if (vm == null)
             throw new IllegalStateException("can't wait for JavaVM that isn't running");
-        long deadline = System.currentTimeMillis() + timeout;
+        long deadline = computeDeadline(System.currentTimeMillis(), timeout);
 
         while (true) {
             try {
@@ -218,4 +218,21 @@ public class JavaVM {
         start();
         return waitFor();
     }
+
+    /**
+     * Computes a deadline from a timestamp and a timeout value.
+     * Maximum timeout (before multipliers are applied) is one hour.
+     */
+    public static long computeDeadline(long timestamp, long timeout) {
+        final long MAX_TIMEOUT_MS = 3_600_000L;
+
+        if (timeout < 0L || timeout > MAX_TIMEOUT_MS) {
+            throw new IllegalArgumentException("timeout " + timeout + "ms out of range");
+        }
+
+        // TODO apply test.timeout.factor (and possibly jcov.sleep.multiplier)
+        // here instead of upstream
+
+        return timestamp + timeout;
+    }
 }
diff --git a/jdk/test/java/rmi/testlibrary/RMID.java b/jdk/test/java/rmi/testlibrary/RMID.java
index 39e05b034bd..48fb49aa4d2 100644
--- a/jdk/test/java/rmi/testlibrary/RMID.java
+++ b/jdk/test/java/rmi/testlibrary/RMID.java
@@ -257,7 +257,7 @@ public class RMID extends JavaVM {
         waitTime = waitTime * slopFactor;
 
         long startTime = System.currentTimeMillis();
-        long deadline = startTime + waitTime;
+        long deadline = computeDeadline(startTime, waitTime);
 
         while (true) {
             try {
diff --git a/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java b/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java
index c672296c11d..54af752e5c3 100644
--- a/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java
+++ b/jdk/test/javax/management/remote/mandatory/connection/RMIConnector_NPETest.java
@@ -38,7 +38,7 @@ import javax.management.remote.rmi.*;
 public class RMIConnector_NPETest {
     public static void main(String argv[]) throws Exception {
         RMID rmid = RMID.createRMID();
-        rmid.start(Long.MAX_VALUE);
+        rmid.start();
         int rmidPort = rmid.getPort();
         Exception failureCause = null;
         RMIConnector agent = null;

From ea81e1bc1f7816875bc4b6b15e6236e1dba6f445 Mon Sep 17 00:00:00 2001
From: Andrei Eremeev <aeremeev@openjdk.org>
Date: Tue, 9 Dec 2014 01:06:11 +0200
Subject: [PATCH 261/299] 8064794: Implement negative tests for cyclic
 dependencies in import statements

Reviewed-by: jlahoda, anazarov
---
 .../NegativeCyclicDependencyTest.java         | 333 ++++++++++++++++++
 .../javac/staticImport/6695838/T6695838.java  |   2 +-
 .../javac/staticImport/6695838/T6695838.out   |   2 +
 3 files changed, 336 insertions(+), 1 deletion(-)
 create mode 100644 langtools/test/tools/javac/importscope/NegativeCyclicDependencyTest.java
 create mode 100644 langtools/test/tools/javac/staticImport/6695838/T6695838.out

diff --git a/langtools/test/tools/javac/importscope/NegativeCyclicDependencyTest.java b/langtools/test/tools/javac/importscope/NegativeCyclicDependencyTest.java
new file mode 100644
index 00000000000..5e17b00dc48
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/NegativeCyclicDependencyTest.java
@@ -0,0 +1,333 @@
+/*
+ * Copyright (c) 2014, 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 8064794
+ * @summary The negative test against cyclic dependencies.
+ * @library /tools/lib
+ * @build ToolBox NegativeCyclicDependencyTest
+ * @run main NegativeCyclicDependencyTest
+ */
+
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * The test generates the following code:
+ *
+ * package pkg;
+ * import pkg.B.InnerB;
+ * class A extends InnerB {
+ *    static class InnerA {}
+ * }
+ *
+ * package pkg;
+ * import pkg.A.InnerA;
+ * class B extends InnerA {
+ *     static class InnerB {}
+ * }
+ *
+ * compiles and checks whether compilation fails with the correct message.
+ * The test generates all possible combination of inheritance:
+ *     1. A extends InnerB, B extends InnerA;
+ *     2. InnerA extends InnerB, InnerB extends InnerA;
+ *     3. A extends InnerB, InnerB extends InnerA;
+ *     4. B extends InnerA, InnerA extends InnerB;
+ *     5. A extends InnerA.
+ * The test checks class, enum and interface as parent class, and checks all
+ * possible import statements.
+ */
+public class NegativeCyclicDependencyTest {
+    private final static String expectedErrorMessage =
+            "\\w+:\\d+:\\d+: compiler.err.cyclic.inheritance: [\\w.]+\n1 error\n";
+
+    private final static String[] sourceTemplatesA = {
+            "package pkg;\n" +
+            "#IMPORT_TYPE\n" +
+            "#OUTER_CLASS A #INHERIT InnerB {#ENUM_SEMI\n" +
+            "    static #INNER_CLASS InnerA {}\n" +
+            "}",
+            "package pkg;\n" +
+            "#IMPORT_TYPE\n" +
+            "#OUTER_CLASS A {#ENUM_SEMI\n" +
+            "    static #INNER_CLASS InnerA #INHERIT InnerB {}\n" +
+            "}"
+    };
+
+    private final static String[] sourceTemplatesB = {
+            "package pkg;\n" +
+            "#IMPORT_TYPE\n" +
+            "#OUTER_CLASS B #INHERIT InnerA {#ENUM_SEMI\n" +
+            "    static #INNER_CLASS InnerB {}\n" +
+            "}",
+            "package pkg;\n" +
+            "#IMPORT_TYPE\n" +
+            "#OUTER_CLASS B {#ENUM_SEMI\n" +
+            "    static #INNER_CLASS InnerB #INHERIT InnerA {}\n" +
+            "}"
+    };
+
+    private final static String sourceTemplate =
+            "package pkg;\n" +
+            "#IMPORT_TYPE\n" +
+            "#OUTER_CLASS A #INHERIT InnerA {#ENUM_SEMI\n" +
+            "    static #INNER_CLASS InnerA {}\n" +
+            "}";
+
+    public static void main(String[] args) {
+        new NegativeCyclicDependencyTest().test();
+    }
+
+    public void test() {
+        int passed = 0;
+        List<TestCase> testCases = generateTestCases();
+        for (TestCase testCase : testCases) {
+            try {
+                String output = compile(testCase.sources);
+                if (!output.matches(testCase.expectedMessage)) {
+                    reportFailure(testCase);
+                    printf(String.format("Message: %s, does not match regexp: %s\n",
+                            output, testCase.expectedMessage));
+                } else {
+                    ++passed;
+                }
+            } catch (RuntimeException e) {
+                reportFailure(testCase);
+                e.printStackTrace();
+            }
+        }
+        if (passed < testCases.size()) {
+            throw new RuntimeException(String.format("Test failed: " +
+                    "passed: %d, failed: %d, total: %d.",
+                    passed, testCases.size() - passed, testCases.size()));
+        }
+    }
+
+    private void reportFailure(TestCase testCase) {
+        echo("Test case failed.");
+        for (ToolBox.JavaSource source : testCase.sources) {
+            echo(source.getCharContent(true));
+            echo();
+        }
+    }
+
+    public List<TestCase> generateTestCases() {
+        List<TestCase> testCases = generateTestCasesWithTwoClasses();
+        testCases.addAll(generateTestCasesWithOneClass());
+        return testCases;
+    }
+
+    private List<TestCase> generateTestCasesWithOneClass() {
+        String importedClassName = "pkg.A.InnerA";
+        List<TestCase> testCases = new ArrayList<>();
+        for (ClassType outerClass : ClassType.values()) {
+            for (ClassType innerClass : ClassType.values()) {
+                if (!outerClass.canInherit(innerClass)) {
+                    continue;
+                }
+                for (ImportType importType : ImportType.values()) {
+                    String source = generateSource(
+                            sourceTemplate,
+                            outerClass,
+                            innerClass,
+                            outerClass.inheritedString(innerClass),
+                            importType,
+                            importedClassName);
+                    testCases.add(new TestCase(expectedErrorMessage,
+                            new ToolBox.JavaSource("A", source)));
+                }
+            }
+        }
+        return testCases;
+    }
+
+    private List<TestCase> generateTestCasesWithTwoClasses() {
+        String importedClassName1 = "pkg.A.InnerA";
+        String importedClassName2 = "pkg.B.InnerB";
+        List<TestCase> testCases = new ArrayList<>();
+        for (int i = 0; i < sourceTemplatesA.length; ++i) {
+            for (int j = 0; j < sourceTemplatesB.length; ++j) {
+                for (ClassType outerClass1 : ClassType.values()) {
+                    for (ClassType outerClass2 : ClassType.values()) {
+                        for (ClassType innerClass1 : ClassType.values()) {
+                            for (ClassType innerClass2 : ClassType.values()) {
+                                ClassType childClass1 = i == 0 ? outerClass1 : innerClass1;
+                                ClassType childClass2 = j == 0 ? outerClass2 : innerClass2;
+                                if (!childClass1.canInherit(innerClass2) ||
+                                        !childClass2.canInherit(innerClass1)) {
+                                    continue;
+                                }
+                                for (ImportType importType1 : ImportType.values()) {
+                                    for (ImportType importType2 : ImportType.values()) {
+                                        String sourceA = generateSource(
+                                                sourceTemplatesA[i],
+                                                outerClass1,
+                                                innerClass1,
+                                                childClass1.inheritedString(innerClass2),
+                                                importType1,
+                                                importedClassName2);
+                                        String sourceB = generateSource(
+                                                sourceTemplatesB[j],
+                                                outerClass2,
+                                                innerClass2,
+                                                childClass2.inheritedString(innerClass1),
+                                                importType2,
+                                                importedClassName1);
+                                        testCases.add(new TestCase(expectedErrorMessage,
+                                                new ToolBox.JavaSource("A", sourceA),
+                                                new ToolBox.JavaSource("B", sourceB)));
+                                        testCases.add(new TestCase(expectedErrorMessage,
+                                                new ToolBox.JavaSource("B", sourceB),
+                                                new ToolBox.JavaSource("A", sourceA)));
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
+        }
+        return testCases;
+    }
+
+    public String generateSource(String template,
+                                 ClassType outerClass,
+                                 ClassType innerClass,
+                                 String inheritString,
+                                 ImportType importType,
+                                 String innerClassName) {
+        return template
+                .replace("#OUTER_CLASS", outerClass.getType())
+                .replace("#INNER_CLASS", innerClass.getType())
+                .replace("#INHERIT", inheritString)
+                .replace("#IMPORT_TYPE", importType.getImport(innerClassName))
+                .replace("#ENUM_SEMI", outerClass == ClassType.ENUM ? ";" : "");
+    }
+
+    /**
+     * Compiles sources with -XDrawDiagnostics flag and
+     * returns the output of compilation.
+     *
+     * @param sources sources
+     * @return the result of compilation
+     */
+    private String compile(ToolBox.JavaSource...sources) {
+        JavaCompiler jc = ToolProvider.getSystemJavaCompiler();
+        StringWriter writer = new StringWriter();
+        JavaCompiler.CompilationTask ct = jc.getTask(writer, null, null,
+                Arrays.asList("-XDrawDiagnostics"),
+                null, Arrays.asList(sources));
+        if (ct.call()) {
+            throw new RuntimeException("Expected compilation failure.");
+        }
+        return writer.toString();
+    }
+
+    public void echo() {
+        echo("");
+    }
+
+    public void echo(CharSequence message) {
+        echo(message.toString());
+    }
+
+    public void echo(String message) {
+        printf(message + "\n");
+    }
+
+    public void printf(String template, Object...args) {
+        System.err.print(String.format(template, args).replace("\n", ToolBox.lineSeparator));
+    }
+
+    /**
+     * The class represents a test case.
+     */
+    public static class TestCase {
+        public final ToolBox.JavaSource[] sources;
+        public final String expectedMessage;
+
+        public TestCase(String expectedMessage, ToolBox.JavaSource...sources) {
+            this.sources = sources;
+            this.expectedMessage = expectedMessage;
+        }
+    }
+
+    /**
+     * The enum represents all possible imports.
+     */
+    public enum ImportType {
+        SINGLE_IMPORT("import %s;"),
+        IMPORT_ON_DEMAND("import %s.*;"),
+        SINGLE_STATIC_IMPORT("import static %s;"),
+        STATIC_IMPORT_ON_DEMAND("import static %s.*;");
+
+        private final String type;
+
+        private ImportType(String type) {
+            this.type = type;
+        }
+
+        public String getImport(String className) {
+            if (this == ImportType.IMPORT_ON_DEMAND || this == ImportType.STATIC_IMPORT_ON_DEMAND) {
+                int lastDot = className.lastIndexOf('.');
+                className = className.substring(0, lastDot);
+            }
+            return String.format(type, className);
+        }
+    }
+
+    /**
+     * The enum represents all possible class types that can be used in
+     * inheritance.
+     */
+    public enum ClassType {
+        CLASS("class"), INTERFACE("interface"), ENUM("enum");
+
+        public boolean canInherit(ClassType innerClass) {
+            return innerClass != ENUM && !(this == ENUM && innerClass == ClassType.CLASS
+                    || this == INTERFACE && innerClass == ClassType.CLASS);
+        }
+
+        public String inheritedString(ClassType innerClass) {
+            if (!canInherit(innerClass)) {
+                throw new IllegalArgumentException(String.format("%s cannot inherit %s", this, innerClass));
+            }
+            return this == innerClass ? "extends" : "implements";
+        }
+
+        private final String type;
+
+        private ClassType(String type) {
+            this.type = type;
+        }
+
+        public String getType() {
+            return type;
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/staticImport/6695838/T6695838.java b/langtools/test/tools/javac/staticImport/6695838/T6695838.java
index 26c9d6a028d..e00b3023c95 100644
--- a/langtools/test/tools/javac/staticImport/6695838/T6695838.java
+++ b/langtools/test/tools/javac/staticImport/6695838/T6695838.java
@@ -27,5 +27,5 @@
  * @summary javac does not detect cyclic inheritance involving static inner classes after import clause
  * @author Maurizio Cimadamore
  *
- * @compile/fail a/FooInterface.java
+ * @compile/fail/ref=T6695838.out -XDrawDiagnostics a/FooInterface.java
  */
diff --git a/langtools/test/tools/javac/staticImport/6695838/T6695838.out b/langtools/test/tools/javac/staticImport/6695838/T6695838.out
new file mode 100644
index 00000000000..b688c1a6c25
--- /dev/null
+++ b/langtools/test/tools/javac/staticImport/6695838/T6695838.out
@@ -0,0 +1,2 @@
+Foo.java:26:1: compiler.err.cyclic.inheritance: a.Foo
+1 error
\ No newline at end of file

From 294a85dbe7f02e98ca4a8abfe08a7d78190cd9a0 Mon Sep 17 00:00:00 2001
From: Erik Joelsson <erikj@openjdk.org>
Date: Tue, 9 Dec 2014 08:43:06 +0100
Subject: [PATCH 262/299] 8066752: Remove space after -L on linker lines

Reviewed-by: ihse
---
 jdk/make/lib/Awt2dLibraries.gmk      | 14 +++++++-------
 jdk/make/lib/Lib-java.instrument.gmk |  4 ++--
 jdk/make/lib/LibCommon.gmk           |  4 +++-
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/jdk/make/lib/Awt2dLibraries.gmk b/jdk/make/lib/Awt2dLibraries.gmk
index 08253f6d660..d4b1e8ce017 100644
--- a/jdk/make/lib/Awt2dLibraries.gmk
+++ b/jdk/make/lib/Awt2dLibraries.gmk
@@ -367,7 +367,7 @@ ifeq ($(findstring $(OPENJDK_TARGET_OS),windows macosx),)
             $(X_LIBS) $(LIBAWT_XAWT_LDFLAGS) \
             $(call SET_SHARED_LIBRARY_ORIGIN) \
             $(call SET_SHARED_LIBRARY_ORIGIN,/..) \
-            -L $(INSTALL_LIBRARIES_HERE), \
+            -L$(INSTALL_LIBRARIES_HERE), \
         LDFLAGS_SUFFIX := $(LIBAWT_XAWT_LDFLAGS_SUFFIX), \
         VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
         RC_FLAGS := $(RC_FLAGS) \
@@ -421,7 +421,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBLCMS, \
     MAPFILE := $(JDK_TOPDIR)/make/mapfiles/liblcms/mapfile-vers, \
     LDFLAGS := $(LDFLAGS_JDKLIB) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
-    LDFLAGS_unix := -L $(INSTALL_LIBRARIES_HERE), \
+    LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
     LDFLAGS_solaris := /usr/lib$(OPENJDK_TARGET_CPU_ISADIR)/libm.so.2, \
     LDFLAGS_windows := $(WIN_AWT_LIB) $(WIN_JAVA_LIB), \
     LDFLAGS_SUFFIX_solaris := -lawt -ljava -ljvm -lc $(LCMS_LIBS), \
@@ -581,7 +581,7 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBFONTMANAGER, \
     MAPFILE := $(BUILD_LIBFONTMANAGER_MAPFILE), \
     LDFLAGS := $(subst -Xlinker -z -Xlinker defs,,$(LDFLAGS_JDKLIB)) $(LDFLAGS_CXX_JDK) \
         $(call SET_SHARED_LIBRARY_ORIGIN), \
-    LDFLAGS_unix := -L $(INSTALL_LIBRARIES_HERE), \
+    LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
     LDFLAGS_SUFFIX := $(BUILD_LIBFONTMANAGER_FONTLIB), \
     LDFLAGS_SUFFIX_linux := -lawt $(LIBM) $(LIBCXX) -ljava -ljvm -lc, \
     LDFLAGS_SUFFIX_solaris := $(filter-out -R%, $(X_LIBS)) \
@@ -698,7 +698,7 @@ else # OPENJDK_TARGET_OS not windows
       MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjawt/mapfile-vers, \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN), \
-      LDFLAGS_unix := -L $(INSTALL_LIBRARIES_HERE), \
+      LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
       LDFLAGS_solaris := $(X_LIBS), \
       LDFLAGS_SUFFIX_linux := $(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX), \
       LDFLAGS_SUFFIX_aix := $(JAWT_LIBS) $(LDFLAGS_JDKLIB_SUFFIX),\
@@ -775,7 +775,7 @@ ifeq ($(BUILD_HEADLESS), true)
         MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libawt_headless/mapfile-vers, \
         LDFLAGS := $(LDFLAGS_JDKLIB) \
             $(call SET_SHARED_LIBRARY_ORIGIN), \
-        LDFLAGS_unix := -L $(INSTALL_LIBRARIES_HERE), \
+        LDFLAGS_unix := -L$(INSTALL_LIBRARIES_HERE), \
         LDFLAGS_linux := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
         LDFLAGS_solaris := $(call SET_SHARED_LIBRARY_ORIGIN,/..), \
         LDFLAGS_macosx := $(call SET_SHARED_LIBRARY_ORIGIN)., \
@@ -954,7 +954,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
           $(LIBAWT_LWAWT_CFLAGS), \
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN) \
-          -L $(INSTALL_LIBRARIES_HERE), \
+          -L$(INSTALL_LIBRARIES_HERE), \
       LDFLAGS_SUFFIX_macosx := -lawt -lmlib_image -losxapp -ljvm $(LIBM) \
           -framework Accelerate \
           -framework ApplicationServices \
@@ -1002,7 +1002,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
       LDFLAGS := $(LDFLAGS_JDKLIB) \
           $(call SET_SHARED_LIBRARY_ORIGIN) \
           -Xlinker -rpath -Xlinker @loader_path \
-          -L $(INSTALL_LIBRARIES_HERE), \
+          -L$(INSTALL_LIBRARIES_HERE), \
       LDFLAGS_SUFFIX_macosx := -lawt -losxapp -lawt_lwawt \
           -framework Cocoa \
           -framework Carbon \
diff --git a/jdk/make/lib/Lib-java.instrument.gmk b/jdk/make/lib/Lib-java.instrument.gmk
index 9799dadc1f6..4aaec5ce5e2 100644
--- a/jdk/make/lib/Lib-java.instrument.gmk
+++ b/jdk/make/lib/Lib-java.instrument.gmk
@@ -72,8 +72,8 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBINSTRUMENT, \
         -framework Cocoa -framework Security -framework ApplicationServices, \
     LDFLAGS_SUFFIX := $(LIBINSTRUMENT_LDFLAGS_SUFFIX), \
     LDFLAGS_SUFFIX_macosx := -liconv $(LIBZ), \
-    LDFLAGS_SUFFIX_solaris := $(LIBZ) -L $(call FindLibDirForModule, java.base)/jli -ljli $(LIBDL) -lc, \
-    LDFLAGS_SUFFIX_linux := $(LIBZ) -L $(call FindLibDirForModule, java.base)/jli -ljli $(LIBDL), \
+    LDFLAGS_SUFFIX_solaris := $(LIBZ) -L$(call FindLibDirForModule, java.base)/jli -ljli $(LIBDL) -lc, \
+    LDFLAGS_SUFFIX_linux := $(LIBZ) -L$(call FindLibDirForModule, java.base)/jli -ljli $(LIBDL), \
     LDFLAGS_SUFFIX_aix := $(LIBZ) -L$(SUPPORT_OUTPUTDIR)/native/java.base -ljli_static $(LIBDL),\
     VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \
     RC_FLAGS := $(RC_FLAGS) \
diff --git a/jdk/make/lib/LibCommon.gmk b/jdk/make/lib/LibCommon.gmk
index e60e4d57d5b..f8eb27a1139 100644
--- a/jdk/make/lib/LibCommon.gmk
+++ b/jdk/make/lib/LibCommon.gmk
@@ -79,7 +79,9 @@ endif
 # Param 2 - library name
 # Param 3 - subdir for library
 define FindLib
-  $(call FindLibDirForModule, $(strip $1))$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(SHARED_LIBRARY_SUFFIX)
+$(strip \
+  $(call FindLibDirForModule, $(strip $1))$(strip $3)/$(LIBRARY_PREFIX)$(strip $2)$(SHARED_LIBRARY_SUFFIX) \
+)
 endef
 
 ################################################################################

From 196d5af55e164c91965b31df3f686b189df204ce Mon Sep 17 00:00:00 2001
From: Erik Joelsson <erikj@openjdk.org>
Date: Tue, 9 Dec 2014 08:49:22 +0100
Subject: [PATCH 263/299] 8066828: configure fails if it's set --with-boot-jdk
 to use JDK 9 modular image

Reviewed-by: ihse
---
 common/autoconf/boot-jdk.m4            |   40 +-
 common/autoconf/generated-configure.sh | 1120 ++++++++++--------------
 2 files changed, 486 insertions(+), 674 deletions(-)

diff --git a/common/autoconf/boot-jdk.m4 b/common/autoconf/boot-jdk.m4
index 7c43fee4f03..c0f0c07b4c8 100644
--- a/common/autoconf/boot-jdk.m4
+++ b/common/autoconf/boot-jdk.m4
@@ -73,31 +73,25 @@ AC_DEFUN([BOOTJDK_DO_CHECK],
           AC_MSG_NOTICE([(This might be an JRE instead of an JDK)])
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring])
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          [FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`]
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
+            AC_MSG_NOTICE([(Your Boot JDK must be version 8 or 9)])
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            [FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`]
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              AC_MSG_NOTICE([Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring])
-              AC_MSG_NOTICE([(Your Boot JDK must be version 8 or 9)])
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
-              BASIC_FIXUP_PATH(BOOT_JDK)
-              AC_MSG_CHECKING([for Boot JDK])
-              AC_MSG_RESULT([$BOOT_JDK])
-              AC_MSG_CHECKING([Boot JDK version])
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              AC_MSG_RESULT([$BOOT_JDK_VERSION])
-            fi # end check jdk version
-          fi # end check rt.jar
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
+            BASIC_FIXUP_PATH(BOOT_JDK)
+            AC_MSG_CHECKING([for Boot JDK])
+            AC_MSG_RESULT([$BOOT_JDK])
+            AC_MSG_CHECKING([Boot JDK version])
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            AC_MSG_RESULT([$BOOT_JDK_VERSION])
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
diff --git a/common/autoconf/generated-configure.sh b/common/autoconf/generated-configure.sh
index 47172bfb91b..0b1567ce0ce 100644
--- a/common/autoconf/generated-configure.sh
+++ b/common/autoconf/generated-configure.sh
@@ -4329,7 +4329,7 @@ TOOLCHAIN_DESCRIPTION_xlc="IBM XL C/C++"
 #CUSTOM_AUTOCONF_INCLUDE
 
 # Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1417630847
+DATE_WHEN_GENERATED=1418036274
 
 ###############################################################################
 #
@@ -20203,26 +20203,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -20345,17 +20339,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -20535,26 +20528,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -20677,17 +20664,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -20729,26 +20715,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -20871,17 +20851,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -20916,26 +20895,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -21058,17 +21031,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -21102,26 +21074,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -21244,17 +21210,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -21288,26 +21253,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -21430,17 +21389,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -21465,26 +21423,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -21607,17 +21559,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -21783,26 +21734,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -21925,17 +21870,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -22111,26 +22055,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -22253,17 +22191,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -22326,26 +22263,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -22468,17 +22399,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -22506,26 +22436,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -22648,17 +22572,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -22714,26 +22637,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -22856,17 +22773,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -22894,26 +22810,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -23036,17 +22946,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -23102,26 +23011,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -23244,17 +23147,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -23282,26 +23184,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -23424,17 +23320,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -23490,26 +23385,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -23632,17 +23521,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -23670,26 +23558,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -23812,17 +23694,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -23865,26 +23746,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -24007,17 +23882,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -24043,26 +23917,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -24185,17 +24053,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -24239,26 +24106,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -24381,17 +24242,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -24417,26 +24277,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -24559,17 +24413,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -24612,26 +24465,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -24754,17 +24601,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -24790,26 +24636,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -24932,17 +24772,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -24986,26 +24825,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -25128,17 +24961,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -25164,26 +24996,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -25306,17 +25132,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found
@@ -25341,26 +25166,20 @@ $as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain bin/java
 $as_echo "$as_me: (This might be an JRE instead of an JDK)" >&6;}
           BOOT_JDK_FOUND=no
         else
-          # Do we have an rt.jar? (On MacOSX it is called classes.jar)
-          if test ! -f "$BOOT_JDK/jre/lib/rt.jar" && test ! -f "$BOOT_JDK/../Classes/classes.jar"; then
-            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK did not contain an rt.jar; ignoring" >&6;}
+          # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
+          BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
+
+          # Extra M4 quote needed to protect [] in grep expression.
+          FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
+          if test "x$FOUND_CORRECT_VERSION" = x; then
+            { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
+$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
+            { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
+$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
             BOOT_JDK_FOUND=no
           else
-            # Oh, this is looking good! We probably have found a proper JDK. Is it the correct version?
-            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | head -n 1`
-
-            # Extra M4 quote needed to protect [] in grep expression.
-            FOUND_CORRECT_VERSION=`echo $BOOT_JDK_VERSION | grep  '\"1\.[89]\.'`
-            if test "x$FOUND_CORRECT_VERSION" = x; then
-              { $as_echo "$as_me:${as_lineno-$LINENO}: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&5
-$as_echo "$as_me: Potential Boot JDK found at $BOOT_JDK is incorrect JDK version ($BOOT_JDK_VERSION); ignoring" >&6;}
-              { $as_echo "$as_me:${as_lineno-$LINENO}: (Your Boot JDK must be version 8 or 9)" >&5
-$as_echo "$as_me: (Your Boot JDK must be version 8 or 9)" >&6;}
-              BOOT_JDK_FOUND=no
-            else
-              # We're done! :-)
-              BOOT_JDK_FOUND=yes
+            # We're done! :-)
+            BOOT_JDK_FOUND=yes
 
   if test "x$OPENJDK_BUILD_OS_ENV" = "xwindows.cygwin"; then
 
@@ -25483,17 +25302,16 @@ $as_echo "$as_me: The path of BOOT_JDK, which resolves as \"$path\", is invalid.
     BOOT_JDK="`cd "$path"; $THEPWDCMD -L`"
   fi
 
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Boot JDK" >&5
 $as_echo_n "checking for Boot JDK... " >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK" >&5
 $as_echo "$BOOT_JDK" >&6; }
-              { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
+            { $as_echo "$as_me:${as_lineno-$LINENO}: checking Boot JDK version" >&5
 $as_echo_n "checking Boot JDK version... " >&6; }
-              BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
-              { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
+            BOOT_JDK_VERSION=`"$BOOT_JDK/bin/java" -version 2>&1 | $TR '\n\r' '  '`
+            { $as_echo "$as_me:${as_lineno-$LINENO}: result: $BOOT_JDK_VERSION" >&5
 $as_echo "$BOOT_JDK_VERSION" >&6; }
-            fi # end check jdk version
-          fi # end check rt.jar
+          fi # end check jdk version
         fi # end check javac
       fi # end check java
     fi # end check boot jdk found

From 56255388c63f1b266ad65e12d998e2f4bdda520f Mon Sep 17 00:00:00 2001
From: Erik Joelsson <erikj@openjdk.org>
Date: Tue, 9 Dec 2014 08:56:44 +0100
Subject: [PATCH 264/299] 8066761: Investigate -sourcepath usage when compiling
 java

Removed all uses of -sourcepath

Reviewed-by: jfranck, alanb, ihse
---
 make/common/JavaCompilation.gmk | 15 +--------------
 1 file changed, 1 insertion(+), 14 deletions(-)

diff --git a/make/common/JavaCompilation.gmk b/make/common/JavaCompilation.gmk
index 2a2383730f7..6c6e515c816 100644
--- a/make/common/JavaCompilation.gmk
+++ b/make/common/JavaCompilation.gmk
@@ -382,10 +382,6 @@ define remove_string
   $2 := $$(subst $1,,$$($2))
 endef
 
-define replace_space_with_pathsep
-  $1:=$(subst $(SPACE),$(PATH_SEP),$(strip $(patsubst %,%,$2)))
-endef
-
 # Setup make rules for compiling Java source code to class files and/or a
 # resulting jar file.
 #
@@ -408,8 +404,6 @@ endef
 #   INCLUDE_FILES:="com/sun/SolarisFoobar.java" means only compile this file!
 #   EXCLUDE_FILES:="com/sun/SolarisFoobar.java" means do not compile this particular file!
 #       "SolarisFoobar.java" means do not compile SolarisFoobar, wherever it is found.
-#   JAVAC_SOURCE_PATH_OVERRIDE:=This forces an explicit -sourcepath to javac instead of the complete
-#       source roots from SRC. This is sometimes needed when compiling specific subsets of the source.
 #   HEADERS:=path to directory where all generated c-headers are written.
 #   DEPENDS:=Extra dependecy
 #   DISABLE_SJAVAC:=Explicitly disable the use of sjavac for this compilation unit.
@@ -523,13 +517,6 @@ define SetupJavaCompilationInner
     endif
   endif
 
-  # Prep the source paths.
-  ifneq ($$($1_JAVAC_SOURCE_PATH_OVERRIDE),)
-    $$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_JAVAC_SOURCE_PATH_OVERRIDE)))
-  else
-    $$(eval $$(call replace_space_with_pathsep,$1_SRCROOTSC,$$($1_SRC)))
-  endif
-
   # Create a sed expression to remove the source roots and to replace / with .
   # and remove .java at the end.
   $1_REWRITE_INTO_CLASSES:=$$(foreach i,$$($1_SRC),-e 's|$$i/||g') -e 's|/|.|g' -e 's|.java$$$$||g'
@@ -612,7 +599,7 @@ define SetupJavaCompilationInner
 	$$(call ListPathsSafely,$1_SRCS,\n, >> $$($1_BIN)/_the.$1_batch.tmp)
 	$(ECHO) Compiling `$(WC) $$($1_BIN)/_the.$1_batch.tmp | $(TR) -s ' ' | $(CUT) -f 2 -d ' '` files for $1
 	($$($1_JVM) $$($1_JAVAC) $$($1_FLAGS) \
-	    -implicit:none -sourcepath "$$($1_SRCROOTSC)" \
+	    -implicit:none \
 	    -d $$($1_BIN) $$($1_HEADERS_ARG) @$$($1_BIN)/_the.$1_batch.tmp && \
 	$(MV) $$($1_BIN)/_the.$1_batch.tmp $$($1_BIN)/_the.$1_batch)
 

From 77e5c6eadf919f96420f36edc1b896cd38bb5434 Mon Sep 17 00:00:00 2001
From: Erik Joelsson <erikj@openjdk.org>
Date: Tue, 9 Dec 2014 08:57:41 +0100
Subject: [PATCH 265/299] 8066761: Investigate -sourcepath usage when compiling
 java

Removed all uses of -sourcepath

Reviewed-by: jfranck, alanb, ihse
---
 jdk/make/CompileInterimRmic.gmk           | 3 +--
 jdk/make/gendata/GendataBreakIterator.gmk | 9 +--------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/jdk/make/CompileInterimRmic.gmk b/jdk/make/CompileInterimRmic.gmk
index 003a4af73e7..f31db8dfd04 100644
--- a/jdk/make/CompileInterimRmic.gmk
+++ b/jdk/make/CompileInterimRmic.gmk
@@ -46,8 +46,7 @@ $(eval $(call SetupJavaCompilation,BUILD_INTERIM_RMIC, \
     SRC := $(JDK_TOPDIR)/src/jdk.rmic/share/classes, \
     INCLUDES := $(RMIC_PKGS), \
     BIN := $(BUILDTOOLS_OUTPUTDIR)/interim_rmic_classes, \
-    COPY := .properties, \
-    JAVAC_SOURCE_PATH_OVERRIDE := $(addprefix $(JDK_TOPDIR)/src/jdk.rmic/share/classes/, $(RMIC_PKGS))))
+    COPY := .properties))
 
 ##########################################################################################
 
diff --git a/jdk/make/gendata/GendataBreakIterator.gmk b/jdk/make/gendata/GendataBreakIterator.gmk
index 1db16158e76..6c60ec26d6b 100644
--- a/jdk/make/gendata/GendataBreakIterator.gmk
+++ b/jdk/make/gendata/GendataBreakIterator.gmk
@@ -44,17 +44,10 @@ TEXT_SOURCES := $(TEXT_PKG)/BreakIteratorRules.java \
 # Generate BreakIteratorData
 BREAK_ITERATOR_CLASSES := $(BUILDTOOLS_OUTPUTDIR)/break_iterator_classes
 
-# JAVAC_SOURCE_PATH_OVERRIDE is set to isolate the compile to just those
-# two files in that directory and not get anything implicit from
-# surrounding directories which aren't jdk N-1 compatible.
-# Because we are targeting jdk N-1, but the surrounding source code is jdk N.
-# These two files should be moved out to a build tool! We have to disable
-# sjavac here as well.
+# These two files should be moved out to a build tool!
 $(eval $(call SetupJavaCompilation,BUILD_BREAKITERATOR, \
     SETUP := GENERATE_OLDBYTECODE, \
     SRC := $(TEXT_SRCDIR), \
-    DISABLE_SJAVAC := true, \
-    JAVAC_SOURCE_PATH_OVERRIDE := $(patsubst %, %/$(TEXT_PKG), $(TEXT_SRCDIR)), \
     INCLUDES := $(TEXT_PKG), \
     INCLUDE_FILES := $(TEXT_SOURCES), \
     BIN := $(BREAK_ITERATOR_CLASSES)))

From 26099e744a05fb6dfd8d73aeeae03ddf53ce1aee Mon Sep 17 00:00:00 2001
From: Weijun Wang <weijun@openjdk.org>
Date: Tue, 9 Dec 2014 18:28:26 +0800
Subject: [PATCH 266/299] 8044500: Add kinit options and krb5.conf flags that
 allow users to obtain renewable tickets and specify ticket lifetimes

Reviewed-by: valeriep
---
 .../classes/sun/security/krb5/Config.java     |  72 +++++++-
 .../sun/security/krb5/Credentials.java        |  19 ++
 .../classes/sun/security/krb5/KrbAsReq.java   |  33 +++-
 .../sun/security/krb5/KrbAsReqBuilder.java    |  10 ++
 .../classes/sun/security/krb5/KrbKdcRep.java  |  38 ++--
 .../classes/sun/security/krb5/KrbTgsReq.java  |   1 -
 .../security/krb5/internal/HostAddresses.java |   4 +
 .../security/krb5/internal/KerberosTime.java  |   9 +
 .../security/krb5/internal/tools/Kinit.java   |  66 +++++--
 .../krb5/internal/tools/KinitOptions.java     |  60 ++++---
 jdk/test/sun/security/krb5/auto/KDC.java      |  27 ++-
 .../security/krb5/auto/LifeTimeInSeconds.java |   2 +-
 jdk/test/sun/security/krb5/auto/Renewal.java  | 164 ++++++++++++++++++
 .../sun/security/krb5/config/Duration.java    |  71 ++++++++
 14 files changed, 494 insertions(+), 82 deletions(-)
 create mode 100644 jdk/test/sun/security/krb5/auto/Renewal.java
 create mode 100644 jdk/test/sun/security/krb5/config/Duration.java

diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
index 26722f2b885..30f5f67ccf2 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Config.java
@@ -30,19 +30,19 @@
  */
 package sun.security.krb5;
 
-import java.io.File;
-import java.io.FilePermission;
+import java.io.*;
 import java.nio.file.DirectoryStream;
 import java.nio.file.Files;
 import java.nio.file.Paths;
 import java.nio.file.Path;
 import java.security.PrivilegedAction;
 import java.util.*;
-import java.io.IOException;
 import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.security.AccessController;
 import java.security.PrivilegedExceptionAction;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import sun.net.dns.ResolverConfiguration;
 import sun.security.krb5.internal.crypto.EType;
@@ -314,6 +314,72 @@ public class Config {
         }
     }
 
+    /**
+     * Translates a duration value into seconds.
+     *
+     * The format can be one of "h:m[:s]", "NdNhNmNs", and "N". See
+     * http://web.mit.edu/kerberos/krb5-devel/doc/basic/date_format.html#duration
+     * for definitions.
+     *
+     * @param s the string duration
+     * @return time in seconds
+     * @throw KrbException if format is illegal
+     */
+    public static int duration(String s) throws KrbException {
+
+        if (s.isEmpty()) {
+            throw new KrbException("Duration cannot be empty");
+        }
+
+        // N
+        if (s.matches("\\d+")) {
+            return Integer.parseInt(s);
+        }
+
+        // h:m[:s]
+        Matcher m = Pattern.compile("(\\d+):(\\d+)(:(\\d+))?").matcher(s);
+        if (m.matches()) {
+            int hr = Integer.parseInt(m.group(1));
+            int min = Integer.parseInt(m.group(2));
+            if (min >= 60) {
+                throw new KrbException("Illegal duration format " + s);
+            }
+            int result = hr * 3600 + min * 60;
+            if (m.group(4) != null) {
+                int sec = Integer.parseInt(m.group(4));
+                if (sec >= 60) {
+                    throw new KrbException("Illegal duration format " + s);
+                }
+                result += sec;
+            }
+            return result;
+        }
+
+        // NdNhNmNs
+        // 120m allowed. Maybe 1h120m is not good, but still allowed
+        m = Pattern.compile(
+                    "((\\d+)d)?\\s*((\\d+)h)?\\s*((\\d+)m)?\\s*((\\d+)s)?",
+                Pattern.CASE_INSENSITIVE).matcher(s);
+        if (m.matches()) {
+            int result = 0;
+            if (m.group(2) != null) {
+                result += 86400 * Integer.parseInt(m.group(2));
+            }
+            if (m.group(4) != null) {
+                result += 3600 * Integer.parseInt(m.group(4));
+            }
+            if (m.group(6) != null) {
+                result += 60 * Integer.parseInt(m.group(6));
+            }
+            if (m.group(8) != null) {
+                result += Integer.parseInt(m.group(8));
+            }
+            return result;
+        }
+
+        throw new KrbException("Illegal duration format " + s);
+    }
+
     /**
      * Gets the int value for the specified keys.
      * @param keys the keys
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Credentials.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Credentials.java
index 25a93772422..4b72f4f01cc 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Credentials.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/Credentials.java
@@ -527,4 +527,23 @@ public class Credentials {
         return sb.toString();
     }
 
+    public sun.security.krb5.internal.ccache.Credentials toCCacheCreds() {
+        return new sun.security.krb5.internal.ccache.Credentials(
+                getClient(), getServer(),
+                getSessionKey(),
+                date2kt(getAuthTime()),
+                date2kt(getStartTime()),
+                date2kt(getEndTime()),
+                date2kt(getRenewTill()),
+                false,
+                flags,
+                new HostAddresses(getClientAddresses()),
+                getAuthzData(),
+                getTicket(),
+                null);
+    }
+
+    private static KerberosTime date2kt(Date d) {
+        return d == null ? null : new KerberosTime(d);
+    }
 }
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsReq.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsReq.java
index 8de29b346ae..01fdb9bbb33 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsReq.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsReq.java
@@ -35,6 +35,7 @@ import sun.security.krb5.internal.*;
 import sun.security.krb5.internal.crypto.Nonce;
 import sun.security.krb5.internal.crypto.KeyUsage;
 import java.io.IOException;
+import java.time.Instant;
 
 /**
  * This class encapsulates the KRB-AS-REQ message that the client
@@ -64,7 +65,6 @@ public class KrbAsReq {
         if (options == null) {
             options = new KDCOptions();
         }
-
         // check if they are valid arguments. The optional fields should be
         // consistent with settings in KDCOptions. Mar 17 2000
         if (options.get(KDCOptions.FORWARDED) ||
@@ -82,12 +82,6 @@ public class KrbAsReq {
         } else {
             if (from != null)  from = null;
         }
-        if (options.get(KDCOptions.RENEWABLE)) {
-            //  if (rtime == null)
-            //          throw new KrbException(Krb5.KRB_AP_ERR_REQ_OPTIONS);
-        } else {
-            if (rtime != null)  rtime = null;
-        }
 
         PAData[] paData = null;
         if (pakey != null) {
@@ -109,8 +103,10 @@ public class KrbAsReq {
             System.out.println(">>> KrbAsReq creating message");
         }
 
+        Config cfg = Config.getInstance();
+
         // check to use addresses in tickets
-        if (addresses == null && Config.getInstance().useAddresses()) {
+        if (addresses == null && cfg.useAddresses()) {
             addresses = HostAddresses.getLocalAddresses();
         }
 
@@ -120,7 +116,26 @@ public class KrbAsReq {
         }
 
         if (till == null) {
-            till = new KerberosTime(0); // Choose KDC maximum allowed
+            String d = cfg.get("libdefaults", "ticket_lifetime");
+            if (d != null) {
+                till = new KerberosTime(Instant.now().plusSeconds(Config.duration(d)));
+            } else {
+                till = new KerberosTime(0); // Choose KDC maximum allowed
+            }
+        }
+
+        if (rtime == null) {
+            String d = cfg.get("libdefaults", "renew_lifetime");
+            if (d != null) {
+                rtime = new KerberosTime(Instant.now().plusSeconds(Config.duration(d)));
+            }
+        }
+
+        if (rtime != null) {
+            options.set(KDCOptions.RENEWABLE, true);
+            if (till.greaterThan(rtime)) {
+                rtime = till;
+            }
         }
 
         // enc-authorization-data and additional-tickets never in AS-REQ
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsReqBuilder.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsReqBuilder.java
index 3c8fb904017..5b6688000f7 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsReqBuilder.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbAsReqBuilder.java
@@ -224,6 +224,16 @@ public final class KrbAsReqBuilder {
         this.options = options;
     }
 
+    public void setTill(KerberosTime till) {
+        checkState(State.INIT, "Cannot specify till");
+        this.till = till;
+    }
+
+    public void setRTime(KerberosTime rtime) {
+        checkState(State.INIT, "Cannot specify rtime");
+        this.rtime = rtime;
+    }
+
     /**
      * Sets or clears target. If cleared, KrbAsReq might choose krbtgt
      * for cname realm
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbKdcRep.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbKdcRep.java
index dd0e951028d..4c63fe1302c 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbKdcRep.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbKdcRep.java
@@ -80,49 +80,41 @@ abstract class KrbKdcRep {
             rep.encKDCRepPart.flags.get(KDCOptions.RENEWABLE)) {
             throw new KrbApErrException(Krb5.KRB_AP_ERR_MODIFIED);
         }
-        if ((req.reqBody.from == null) || req.reqBody.from.isZero())
+
+        if ((req.reqBody.from == null) || req.reqBody.from.isZero()) {
             // verify this is allowed
             if ((rep.encKDCRepPart.starttime != null) &&
-                !rep.encKDCRepPart.starttime.inClockSkew()) {
+                    !rep.encKDCRepPart.starttime.inClockSkew()) {
                 rep.encKDCRepPart.key.destroy();
                 throw new KrbApErrException(Krb5.KRB_AP_ERR_SKEW);
             }
+        }
 
-        if ((req.reqBody.from != null) && !req.reqBody.from.isZero())
+        if ((req.reqBody.from != null) && !req.reqBody.from.isZero()) {
             // verify this is allowed
             if ((rep.encKDCRepPart.starttime != null) &&
-                !req.reqBody.from.equals(rep.encKDCRepPart.starttime)) {
+                    !req.reqBody.from.equals(rep.encKDCRepPart.starttime)) {
                 rep.encKDCRepPart.key.destroy();
                 throw new KrbApErrException(Krb5.KRB_AP_ERR_MODIFIED);
             }
+        }
 
         if (!req.reqBody.till.isZero() &&
-            rep.encKDCRepPart.endtime.greaterThan(req.reqBody.till)) {
+                rep.encKDCRepPart.endtime.greaterThan(req.reqBody.till)) {
             rep.encKDCRepPart.key.destroy();
             throw new KrbApErrException(Krb5.KRB_AP_ERR_MODIFIED);
         }
 
-        if (req.reqBody.kdcOptions.get(KDCOptions.RENEWABLE))
-            if (req.reqBody.rtime != null && !req.reqBody.rtime.isZero())
-                                // verify this is required
+        if (req.reqBody.kdcOptions.get(KDCOptions.RENEWABLE)) {
+            if (req.reqBody.rtime != null && !req.reqBody.rtime.isZero()) {
+                // verify this is required
                 if ((rep.encKDCRepPart.renewTill == null) ||
-                    rep.encKDCRepPart.renewTill.greaterThan(req.reqBody.rtime)
-                    ) {
-                    rep.encKDCRepPart.key.destroy();
-                    throw new KrbApErrException(Krb5.KRB_AP_ERR_MODIFIED);
-                }
-
-        if (req.reqBody.kdcOptions.get(KDCOptions.RENEWABLE_OK) &&
-            rep.encKDCRepPart.flags.get(KDCOptions.RENEWABLE))
-            if (!req.reqBody.till.isZero())
-                                // verify this is required
-                if ((rep.encKDCRepPart.renewTill == null) ||
-                    rep.encKDCRepPart.renewTill.greaterThan(req.reqBody.till)
-                    ) {
+                        rep.encKDCRepPart.renewTill.greaterThan(req.reqBody.rtime)
+                        ) {
                     rep.encKDCRepPart.key.destroy();
                     throw new KrbApErrException(Krb5.KRB_AP_ERR_MODIFIED);
                 }
+            }
+        }
     }
-
-
 }
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsReq.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsReq.java
index 798b78d3e63..45f25e825ce 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsReq.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbTgsReq.java
@@ -35,7 +35,6 @@ import sun.security.krb5.internal.*;
 import sun.security.krb5.internal.crypto.*;
 import java.io.IOException;
 import java.net.UnknownHostException;
-import java.util.Arrays;
 
 /**
  * This class encapsulates a Kerberos TGS-REQ that is sent from the
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddresses.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddresses.java
index 8dc9a2853e1..7f18b98f9c3 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddresses.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/HostAddresses.java
@@ -250,6 +250,10 @@ public class HostAddresses implements Cloneable {
          */
 
     public void writeAddrs(CCacheOutputStream cos) throws IOException {
+        if (addresses == null || addresses.length == 0) {
+            cos.write32(0);
+            return;
+        }
         cos.write32(addresses.length);
         for (int i = 0; i < addresses.length; i++) {
             cos.write16(addresses[i].addrType);
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KerberosTime.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KerberosTime.java
index 264f2e06192..da30f9dc42c 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KerberosTime.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/KerberosTime.java
@@ -38,6 +38,7 @@ import sun.security.util.DerOutputStream;
 import sun.security.util.DerValue;
 
 import java.io.IOException;
+import java.time.Instant;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.TimeZone;
@@ -128,6 +129,14 @@ public class KerberosTime {
         this(time.getTime(), 0);
     }
 
+    /**
+     * Creates a KerberosTime object from an Instant object
+     */
+    public KerberosTime(Instant instant) {
+        this(instant.getEpochSecond()*1000 + instant.getNano()/1000000L,
+                instant.getNano()/1000%1000);
+    }
+
     /**
      * Creates a KerberosTime object for now. It uses System.nanoTime()
      * to get a more precise time than "new Date()".
diff --git a/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Kinit.java b/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Kinit.java
index a436d585cba..5839a5e13e4 100644
--- a/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Kinit.java
+++ b/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/Kinit.java
@@ -36,7 +36,6 @@ import sun.security.krb5.internal.*;
 import sun.security.krb5.internal.ccache.*;
 import java.io.IOException;
 import java.util.Arrays;
-import javax.security.auth.kerberos.KerberosPrincipal;
 import sun.security.util.Password;
 import javax.security.auth.kerberos.KeyTab;
 
@@ -53,22 +52,9 @@ public class Kinit {
 
     /**
      * The main method is used to accept user command line input for ticket
-     * request.
-     * <p>
-     * Usage: kinit [-A] [-f] [-p] [-c cachename] [[-k [-t keytab_file_name]]
-     * [principal] [password]
-     * <ul>
-     * <li>    -A        do not include addresses
-     * <li>    -f        forwardable
-     * <li>    -p        proxiable
-     * <li>    -c        cache name (i.e., FILE://c:\temp\mykrb5cc)
-     * <li>    -k        use keytab
-     * <li>    -t        keytab file name
-     * <li>    principal the principal name (i.e., duke@java.sun.com)
-     * <li>    password  the principal's Kerberos password
-     * </ul>
-     * <p>
-     * Use java sun.security.krb5.tools.Kinit -help to bring up help menu.
+     * request. Read {@link KinitOptions#printHelp} for usages or call
+     *    java sun.security.krb5.internal.tools.Kinit -help
+     * to bring up help menu.
      * <p>
      * We currently support only file-based credentials cache to
      * store the tickets obtained from the KDC.
@@ -146,6 +132,49 @@ public class Kinit {
         } else {
             options = new KinitOptions(args);
         }
+        switch (options.action) {
+            case 1:
+                acquire();
+                break;
+            case 2:
+                renew();
+                break;
+            default:
+                throw new KrbException("kinit does not support action "
+                        + options.action);
+        }
+    }
+
+    private void renew()
+            throws IOException, RealmException, KrbException {
+
+        PrincipalName principal = options.getPrincipal();
+        String realm = principal.getRealmAsString();
+        CredentialsCache cache = CredentialsCache.getInstance(options.cachename);
+
+        if (cache == null) {
+            throw new IOException("Unable to find existing cache file " +
+                    options.cachename);
+        }
+        sun.security.krb5.internal.ccache.Credentials credentials =
+                cache.getCreds(PrincipalName.tgsService(realm, realm));
+
+        credentials = credentials.setKrbCreds()
+                .renew()
+                .toCCacheCreds();
+
+        cache = CredentialsCache.create(principal, options.cachename);
+        if (cache == null) {
+            throw new IOException("Unable to create the cache file " +
+                    options.cachename);
+        }
+        cache.update(credentials);
+        cache.save();
+    }
+
+    private void acquire()
+            throws IOException, RealmException, KrbException {
+
         String princName = null;
         PrincipalName principal = options.getPrincipal();
         if (principal != null) {
@@ -216,6 +245,9 @@ public class Kinit {
         if (options.getAddressOption())
             builder.setAddresses(HostAddresses.getLocalAddresses());
 
+        builder.setTill(options.lifetime);
+        builder.setRTime(options.renewable_lifetime);
+
         builder.action();
 
         sun.security.krb5.internal.ccache.Credentials credentials =
diff --git a/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/KinitOptions.java b/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/KinitOptions.java
index e7507a0a27f..23bfecad837 100644
--- a/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/KinitOptions.java
+++ b/jdk/src/java.security.jgss/windows/classes/sun/security/krb5/internal/tools/KinitOptions.java
@@ -33,12 +33,8 @@ package sun.security.krb5.internal.tools;
 import sun.security.krb5.*;
 import sun.security.krb5.internal.*;
 import sun.security.krb5.internal.ccache.*;
-import java.io.File;
 import java.io.IOException;
-import java.util.StringTokenizer;
-import java.util.Vector;
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
+import java.time.Instant;
 import java.io.FileInputStream;
 
 /**
@@ -49,14 +45,15 @@ import java.io.FileInputStream;
  * @author Ram Marti
  */
 class KinitOptions {
-    public boolean validate = false;
+
+    // 1. acquire, 2. renew, 3. validate
+    public int action = 1;
 
     // forwardable and proxiable flags have two states:
     // -1 - flag set to be not forwardable or proxiable;
     // 1 - flag set to be forwardable or proxiable.
-    public short forwardable = -1;
-    public short proxiable = -1;
-    public boolean renew = false;
+    public short forwardable = 0;
+    public short proxiable = 0;
     public KerberosTime lifetime;
     public KerberosTime renewable_lifetime;
     public String target_service;
@@ -134,6 +131,12 @@ class KinitOptions {
                 }
 
                 useKeytab = true;
+            } else if (args[i].equals("-R")) {
+                action = 2;
+            } else if (args[i].equals("-l")) {
+                lifetime = getTime(Config.duration(args[++i]));
+            } else if (args[i].equals("-r")) {
+                renewable_lifetime = getTime(Config.duration(args[++i]));
             } else if (args[i].equalsIgnoreCase("-help")) {
                 printHelp();
                 System.exit(0);
@@ -223,23 +226,28 @@ class KinitOptions {
 
 
     void printHelp() {
-        System.out.println("Usage: kinit " +
-                           "[-A] [-f] [-p] [-c cachename] " +
-                           "[[-k [-t keytab_file_name]] [principal] " +
+        System.out.println("Usage:\n\n1. Initial ticket request:\n" +
+                "    kinit [-A] [-f] [-p] [-c cachename] " +
+                "[-l lifetime] [-r renewable_time]\n" +
+                "          [[-k [-t keytab_file_name]] [principal] " +
                            "[password]");
-        System.out.println("\tavailable options to " +
+        System.out.println("2. Renew a ticket:\n" +
+                "    kinit -R [-c cachename] [principal]");
+        System.out.println("\nAvailable options to " +
                            "Kerberos 5 ticket request:");
-        System.out.println("\t    -A   do not include addresses");
-        System.out.println("\t    -f   forwardable");
-        System.out.println("\t    -p   proxiable");
-        System.out.println("\t    -c   cache name " +
-                           "(i.e., FILE:\\d:\\myProfiles\\mykrb5cache)");
-        System.out.println("\t    -k   use keytab");
-        System.out.println("\t    -t   keytab file name");
-        System.out.println("\t    principal   the principal name "+
-                           "(i.e., qweadf@ATHENA.MIT.EDU qweadf)");
-        System.out.println("\t    password   " +
-                           "the principal's Kerberos password");
+        System.out.println("\t-A   do not include addresses");
+        System.out.println("\t-f   forwardable");
+        System.out.println("\t-p   proxiable");
+        System.out.println("\t-c   cache name " +
+                "(i.e., FILE:\\d:\\myProfiles\\mykrb5cache)");
+        System.out.println("\t-l   lifetime");
+        System.out.println("\t-r   renewable time " +
+                "(total lifetime a ticket can be renewed)");
+        System.out.println("\t-k   use keytab");
+        System.out.println("\t-t   keytab file name");
+        System.out.println("\tprincipal   the principal name "+
+                "(i.e., qweadf@ATHENA.MIT.EDU qweadf)");
+        System.out.println("\tpassword    the principal's Kerberos password");
     }
 
     public boolean getAddressOption() {
@@ -257,4 +265,8 @@ class KinitOptions {
     public PrincipalName getPrincipal() {
         return principal;
     }
+
+    private KerberosTime getTime(int s) {
+        return new KerberosTime(Instant.now().plusSeconds(s));
+    }
 }
diff --git a/jdk/test/sun/security/krb5/auto/KDC.java b/jdk/test/sun/security/krb5/auto/KDC.java
index 686e238579e..1b2814daf29 100644
--- a/jdk/test/sun/security/krb5/auto/KDC.java
+++ b/jdk/test/sun/security/krb5/auto/KDC.java
@@ -35,6 +35,7 @@ import sun.net.spi.nameservice.NameServiceDescriptor;
 import sun.security.krb5.*;
 import sun.security.krb5.internal.*;
 import sun.security.krb5.internal.ccache.CredentialsCache;
+import sun.security.krb5.internal.crypto.EType;
 import sun.security.krb5.internal.crypto.KeyUsage;
 import sun.security.krb5.internal.ktab.KeyTab;
 import sun.security.util.DerInputStream;
@@ -120,6 +121,9 @@ import sun.security.util.DerValue;
  */
 public class KDC {
 
+    public static final int DEFAULT_LIFETIME = 39600;
+    public static final int DEFAULT_RENEWTIME = 86400;
+
     // Under the hood.
 
     // The random generator to generate random keys (including session keys)
@@ -204,7 +208,8 @@ public class KDC {
      * A standalone KDC server.
      */
     public static void main(String[] args) throws Exception {
-        KDC kdc = create("RABBIT.HOLE", "kdc.rabbit.hole", 0, false);
+        int port = args.length > 0 ? Integer.parseInt(args[0]) : 0;
+        KDC kdc = create("RABBIT.HOLE", "kdc.rabbit.hole", port, false);
         kdc.addPrincipal("dummy", "bogus".toCharArray());
         kdc.addPrincipal("foo", "bar".toCharArray());
         kdc.addPrincipalRandKey("krbtgt/RABBIT.HOLE");
@@ -871,6 +876,14 @@ public class KDC {
             eTypes = KDCReqBodyDotEType(body);
             int eType = eTypes[0];
 
+            // Maybe server does not support aes256, but a kinit does
+            if (!EType.isSupported(eType)) {
+                if (eTypes.length < 2) {
+                    throw new KrbException(Krb5.KDC_ERR_ETYPE_NOSUPP);
+                }
+                eType = eTypes[1];
+            }
+
             EncryptionKey ckey = keyForUser(body.cname, eType, false);
             EncryptionKey skey = keyForUser(service, eType, true);
 
@@ -899,10 +912,16 @@ public class KDC {
             EncryptionKey key = generateRandomKey(eType);
             // Check time, TODO
             KerberosTime till = body.till;
+            KerberosTime rtime = body.rtime;
             if (till == null) {
                 throw new KrbException(Krb5.KDC_ERR_NEVER_VALID); // TODO
             } else if (till.isZero()) {
-                till = new KerberosTime(new Date().getTime() + 1000 * 3600 * 11);
+                till = new KerberosTime(
+                        new Date().getTime() + 1000 * DEFAULT_LIFETIME);
+            }
+            if (rtime == null && body.kdcOptions.get(KDCOptions.RENEWABLE)) {
+                rtime = new KerberosTime(
+                        new Date().getTime() + 1000 * DEFAULT_RENEWTIME);
             }
             //body.from
             boolean[] bFlags = new boolean[Krb5.TKT_OPTS_MAX+1];
@@ -1053,7 +1072,7 @@ public class KDC {
                     new TransitedEncoding(1, new byte[0]),
                     new KerberosTime(new Date()),
                     body.from,
-                    till, body.rtime,
+                    till, rtime,
                     body.addresses,
                     null);
             Ticket t = new Ticket(
@@ -1071,7 +1090,7 @@ public class KDC {
                     tFlags,
                     new KerberosTime(new Date()),
                     body.from,
-                    till, body.rtime,
+                    till, rtime,
                     service,
                     body.addresses
                     );
diff --git a/jdk/test/sun/security/krb5/auto/LifeTimeInSeconds.java b/jdk/test/sun/security/krb5/auto/LifeTimeInSeconds.java
index 9c518ff6cbb..961990bdda7 100644
--- a/jdk/test/sun/security/krb5/auto/LifeTimeInSeconds.java
+++ b/jdk/test/sun/security/krb5/auto/LifeTimeInSeconds.java
@@ -40,7 +40,7 @@ public class LifeTimeInSeconds {
         int time = cred.getRemainingLifetime();
         int time2 = cred.getRemainingInitLifetime(null);
         // The test KDC issues a TGT with a default lifetime of 11 hours
-        int elevenhrs = 11*3600;
+        int elevenhrs = KDC.DEFAULT_LIFETIME;
         if (time > elevenhrs+60 || time < elevenhrs-60) {
             throw new Exception("getRemainingLifetime returns wrong value.");
         }
diff --git a/jdk/test/sun/security/krb5/auto/Renewal.java b/jdk/test/sun/security/krb5/auto/Renewal.java
new file mode 100644
index 00000000000..fc9ab80e0d3
--- /dev/null
+++ b/jdk/test/sun/security/krb5/auto/Renewal.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2012, 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 8044500
+ * @summary Add kinit options and krb5.conf flags that allow users to
+ *          obtain renewable tickets and specify ticket lifetimes
+ * @library ../../../../java/security/testlibrary/
+ * @compile -XDignore.symbol.file Renewal.java
+ * @run main/othervm Renewal
+ */
+
+import sun.security.jgss.GSSUtil;
+import sun.security.krb5.Config;
+import sun.security.krb5.internal.ccache.Credentials;
+import sun.security.krb5.internal.ccache.FileCredentialsCache;
+
+import javax.security.auth.kerberos.KerberosTicket;
+import java.util.Date;
+import java.util.Random;
+import java.util.Set;
+
+// The basic krb5 test skeleton you can copy from
+public class Renewal {
+
+    static OneKDC kdc;
+    static String clazz = "sun.security.krb5.internal.tools.Kinit";
+
+    public static void main(String[] args) throws Exception {
+
+        kdc = new OneKDC(null);
+        kdc.writeJAASConf();
+        kdc.setOption(KDC.Option.PREAUTH_REQUIRED, false);
+
+        checkLogin(null, null, KDC.DEFAULT_LIFETIME, -1);
+        checkLogin("1h", null, 3600, -1);
+        checkLogin(null, "2d", KDC.DEFAULT_LIFETIME, 86400*2);
+        checkLogin("1h", "10h", 3600, 36000);
+        // When rtime is before till, use till as rtime
+        checkLogin("10h", "1h", 36000, 36000);
+
+        try {
+            Class.forName(clazz);
+        } catch (ClassNotFoundException cnfe) {
+            return;
+        }
+
+        checkKinit(null, null, null, null, KDC.DEFAULT_LIFETIME, -1);
+        checkKinit("1h", "10h", null, null, 3600, 36000);
+        checkKinit(null, null, "30m", "5h", 1800, 18000);
+        checkKinit("1h", "10h", "30m", "5h", 1800, 18000);
+
+        checkKinitRenew();
+    }
+
+    static int count = 0;
+
+    static void checkKinit(
+            String s1,      // ticket_lifetime in krb5.conf, null if none
+            String s2,      // renew_lifetime in krb5.conf, null if none
+            String c1,      // -l on kinit, null if none
+            String c2,      // -r on kinit, null if none
+            int t1, int t2  // expected lifetimes, -1 of unexpected
+                ) throws Exception {
+        KDC.saveConfig(OneKDC.KRB5_CONF, kdc,
+                s1 != null ? ("ticket_lifetime = " + s1) : "",
+                s2 != null ? ("renew_lifetime = " + s2) : "");
+        Proc p = Proc.create(clazz);
+        if (c1 != null) {
+            p.args("-l", c1);
+        }
+        if (c2 != null) {
+            p.args("-r", c2);
+        }
+        count++;
+        p.args(OneKDC.USER, new String(OneKDC.PASS))
+                .inheritIO()
+                .prop("sun.net.spi.nameservice.provider.1", "ns,mock")
+                .prop("java.security.krb5.conf", OneKDC.KRB5_CONF)
+                .env("KRB5CCNAME", "ccache" + count)
+                .start();
+        if (p.waitFor() != 0) {
+            throw new Exception();
+        }
+        FileCredentialsCache fcc =
+                FileCredentialsCache.acquireInstance(null, "ccache" + count);
+        Credentials cred = fcc.getDefaultCreds();
+        checkRough(cred.getEndTime().toDate(), t1);
+        if (cred.getRenewTill() == null) {
+            checkRough(null, t2);
+        } else {
+            checkRough(cred.getRenewTill().toDate(), t2);
+        }
+    }
+
+    static void checkKinitRenew() throws Exception {
+        Proc p = Proc.create(clazz)
+                .args("-R")
+                .inheritIO()
+                .prop("sun.net.spi.nameservice.provider.1", "ns,mock")
+                .prop("java.security.krb5.conf", OneKDC.KRB5_CONF)
+                .env("KRB5CCNAME", "ccache" + count)
+                .start();
+        if (p.waitFor() != 0) {
+            throw new Exception();
+        }
+    }
+
+    static void checkLogin(
+            String s1,      // ticket_lifetime in krb5.conf, null if none
+            String s2,      // renew_lifetime in krb5.conf, null if none
+            int t1, int t2  // expected lifetimes, -1 of unexpected
+                ) throws Exception {
+        KDC.saveConfig(OneKDC.KRB5_CONF, kdc,
+                s1 != null ? ("ticket_lifetime = " + s1) : "",
+                s2 != null ? ("renew_lifetime = " + s2) : "");
+        Config.refresh();
+
+        Context c;
+        c = Context.fromJAAS("client");
+
+        Set<KerberosTicket> tickets =
+                c.s().getPrivateCredentials(KerberosTicket.class);
+        if (tickets.size() != 1) {
+            throw new Exception();
+        }
+        KerberosTicket ticket = tickets.iterator().next();
+
+        checkRough(ticket.getEndTime(), t1);
+        checkRough(ticket.getRenewTill(), t2);
+    }
+
+    static void checkRough(Date t, int duration) throws Exception {
+        Date now = new Date();
+        if (t == null && duration == -1) {
+            return;
+        }
+        long change = (t.getTime() - System.currentTimeMillis()) / 1000;
+        if (change > duration + 20 || change < duration - 20) {
+            throw new Exception(t + " is not " + duration);
+        }
+    }
+}
diff --git a/jdk/test/sun/security/krb5/config/Duration.java b/jdk/test/sun/security/krb5/config/Duration.java
new file mode 100644
index 00000000000..d9c0f3961c7
--- /dev/null
+++ b/jdk/test/sun/security/krb5/config/Duration.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 2014, 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 8044500
+ * @summary Add kinit options and krb5.conf flags that allow users to
+ *          obtain renewable tickets and specify ticket lifetimes
+ * @compile -XDignore.symbol.file Duration.java
+ * @run main Duration
+ */
+import sun.security.krb5.Config;
+import sun.security.krb5.KrbException;
+
+public class Duration {
+    public static void main(String[] args) throws Exception {
+        check("123", 123);
+        check("1:1", 3660);
+        check("1:1:1", 3661);
+        check("1d", 86400);
+        check("1h", 3600);
+        check("1h1m", 3660);
+        check("1h 1m", 3660);
+        check("1d 1h 1m 1s", 90061);
+        check("1d1h1m1s", 90061);
+
+        check("", -1);
+        check("abc", -1);
+        check("1ms", -1);
+        check("1d1d", -1);
+        check("1h1d", -1);
+        check("x1h", -1);
+        check("1h x 1m", -1);
+        check(":", -1);
+        check("1:60", -1);
+        check("1:1:1:1", -1);
+        check("1:1:1:", -1);
+    }
+
+    static void check(String s, int ex) throws Exception {
+        System.out.print("\u001b[1;37;41m" +s + " " + ex);
+        System.out.print("\u001b[m\n");
+        try {
+            int result = Config.duration(s);
+            if (result != ex) throw new Exception("for " + s + " is " + result);
+        } catch (KrbException ke) {
+            ke.printStackTrace();
+            if (ex != -1) throw new Exception();
+        }
+    }
+}

From 400505a1f2b30a91d12aad3067565c96dd05d6f0 Mon Sep 17 00:00:00 2001
From: Andrei Eremeev <aeremeev@openjdk.org>
Date: Tue, 9 Dec 2014 11:45:38 +0100
Subject: [PATCH 267/299] 8066961: NegativeCyclicDependencyTest.java fails on
 Windows

Normalizing line endings to '\n'.

Reviewed-by: jlahoda
---
 .../tools/javac/importscope/NegativeCyclicDependencyTest.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/langtools/test/tools/javac/importscope/NegativeCyclicDependencyTest.java b/langtools/test/tools/javac/importscope/NegativeCyclicDependencyTest.java
index 5e17b00dc48..a82ed6e63fb 100644
--- a/langtools/test/tools/javac/importscope/NegativeCyclicDependencyTest.java
+++ b/langtools/test/tools/javac/importscope/NegativeCyclicDependencyTest.java
@@ -245,7 +245,7 @@ public class NegativeCyclicDependencyTest {
         if (ct.call()) {
             throw new RuntimeException("Expected compilation failure.");
         }
-        return writer.toString();
+        return writer.toString().replace(ToolBox.lineSeparator, "\n");
     }
 
     public void echo() {

From a800908e257e3192631f1a03fac62bf479050417 Mon Sep 17 00:00:00 2001
From: Maurizio Cimadamore <mcimadamore@openjdk.org>
Date: Tue, 9 Dec 2014 16:09:07 +0000
Subject: [PATCH 268/299] 8067001: DetectMutableStaticFields fails after
 modular images push

Ignore JRTIndex.sharedInstance

Reviewed-by: jlahoda
---
 .../test/tools/javac/T8003967/DetectMutableStaticFields.java   | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java b/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java
index 5a880681d4a..fdbcee99a83 100644
--- a/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java
+++ b/langtools/test/tools/javac/T8003967/DetectMutableStaticFields.java
@@ -102,6 +102,9 @@ public class DetectMutableStaticFields {
         classFieldsToIgnoreMap.
                 put("com/sun/tools/javac/file/ZipFileIndexCache",
                     Arrays.asList("sharedInstance"));
+        classFieldsToIgnoreMap.
+                put("com/sun/tools/javac/file/JRTIndex",
+                    Arrays.asList("sharedInstance"));
         classFieldsToIgnoreMap.
                 put("com/sun/tools/javac/main/JavaCompiler",
                     Arrays.asList("versionRB"));

From e0eba41e1c3ca7beccd340c5a6bb7b34d4ccd79b Mon Sep 17 00:00:00 2001
From: Vladimir Ivanov <vlivanov@openjdk.org>
Date: Tue, 9 Dec 2014 09:22:07 -0800
Subject: [PATCH 269/299] 8066746: MHs.explicitCastArguments does incorrect
 type checks for VarargsCollector

Reviewed-by: jrose, psandoz
---
 .../java/lang/invoke/MethodHandles.java       |  2 +-
 .../invoke/ExplicitCastArgumentsTest.java     | 21 ++++++++++++++++---
 2 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
index 0fe5a897417..eda6a6d27df 100644
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java
@@ -2028,7 +2028,7 @@ return invoker;
         MethodType oldType = target.type();
         if (oldType == newType)  return target;
         if (oldType.explicitCastEquivalentToAsType(newType)) {
-            return target.asType(newType);
+            return target.asFixedArity().asType(newType);
         }
         return MethodHandleImpl.makePairwiseConvert(target, newType, false);
     }
diff --git a/jdk/test/java/lang/invoke/ExplicitCastArgumentsTest.java b/jdk/test/java/lang/invoke/ExplicitCastArgumentsTest.java
index 06f7a64aabd..045ec15599e 100644
--- a/jdk/test/java/lang/invoke/ExplicitCastArgumentsTest.java
+++ b/jdk/test/java/lang/invoke/ExplicitCastArgumentsTest.java
@@ -32,21 +32,36 @@ import sun.invoke.util.Wrapper;
  */
 public class ExplicitCastArgumentsTest {
     private static final boolean VERBOSE = Boolean.getBoolean("verbose");
+    private static final Class<?> THIS_CLASS = ExplicitCastArgumentsTest.class;
 
     public static void main(String[] args) throws Throwable {
+        testVarargsCollector();
+        testRef2Prim();
+        System.out.println("TEST PASSED");
+    }
+
+    public static String[] f(String... args) { return args; }
+
+    public static void testVarargsCollector() throws Throwable {
+        MethodType mt = MethodType.methodType(String[].class, String[].class);
+        MethodHandle mh = MethodHandles.publicLookup().findStatic(THIS_CLASS, "f", mt);
+        mh = MethodHandles.explicitCastArguments(mh, MethodType.methodType(Object.class, Object.class));
+        mh.invokeWithArguments((Object)(new String[] {"str1", "str2"}));
+    }
+
+    public static void testRef2Prim() throws Throwable {
         for (Wrapper from : Wrapper.values()) {
             for (Wrapper to : Wrapper.values()) {
                 if (from == Wrapper.VOID || to == Wrapper.VOID) continue;
-                testRef2Prim (from, to);
+                testRef2Prim(from, to);
             }
         }
-        System.out.println("TEST PASSED");
     }
 
     public static void testRef2Prim(Wrapper from, Wrapper to) throws Throwable {
         // MHs.eCA javadoc:
         //    If T0 is a reference and T1 a primitive, and if the reference is null at runtime, a zero value is introduced.
-        test(from.wrapperType(), to.primitiveType(),        null, false);
+        test(from.wrapperType(), to.primitiveType(), null, false);
     }
 
     public static void test(Class<?> from, Class<?> to, Object param, boolean failureExpected) throws Throwable {

From da41cfd9f1ea5897635f27e7cdd5ad5a3203b0c7 Mon Sep 17 00:00:00 2001
From: Maurizio Cimadamore <mcimadamore@openjdk.org>
Date: Tue, 9 Dec 2014 17:40:02 +0000
Subject: [PATCH 270/299] 8067006: Tweak IntelliJ langtools project to show
 jtreg report directory

Jtreg test output directory should be allowed to flow into IntelliJ's output

Reviewed-by: jlahoda
---
 langtools/make/intellij/build.xml                    |  4 ++--
 langtools/make/intellij/compiler.xml                 |  2 +-
 langtools/make/intellij/copyright/langtools.xml      |  2 +-
 langtools/make/intellij/misc.xml                     |  2 +-
 .../intellij/src/idea/LangtoolsIdeaAntLogger.java    |  6 ++++--
 langtools/make/intellij/workspace.xml                | 12 ++++++------
 6 files changed, 15 insertions(+), 13 deletions(-)

diff --git a/langtools/make/intellij/build.xml b/langtools/make/intellij/build.xml
index c67b66555d0..3494aec4443 100644
--- a/langtools/make/intellij/build.xml
+++ b/langtools/make/intellij/build.xml
@@ -14,14 +14,14 @@
         <sequential>
             <java classname="org.apache.tools.ant.Main" fork="true" spawn="true">
                 <arg value="-f"/>
-                <arg value="@{antfile}"/>  
+                <arg value="@{antfile}"/>
                 <arg value="-Dboot.java.home=${boot.java.home}"/>
                 <arg value="-Dtarget.java.home=${target.java.home}"/>
                 <arg value="-Djtreg.home=${jtreg.home}"/>
                 <arg value="-Djtreg.tests=${jtreg.tests}"/>
                 <arg value="-Djtreg.jpda.jvmargs=${jtreg.jpda.jvmargs}"/>
                 <arg value="@{target}"/>
-                <classpath>           
+                <classpath>
                     <pathelement path="${java.class.path}"/>
                 </classpath>
             </java>
diff --git a/langtools/make/intellij/compiler.xml b/langtools/make/intellij/compiler.xml
index ad56f326588..552c480a158 100644
--- a/langtools/make/intellij/compiler.xml
+++ b/langtools/make/intellij/compiler.xml
@@ -13,6 +13,6 @@
         <processorPath useClasspath="true" />
       </profile>
     </annotationProcessing>
-  </component>  
+  </component>
 </project>
 
diff --git a/langtools/make/intellij/copyright/langtools.xml b/langtools/make/intellij/copyright/langtools.xml
index d9938bc6a04..b12ea2fb0ee 100644
--- a/langtools/make/intellij/copyright/langtools.xml
+++ b/langtools/make/intellij/copyright/langtools.xml
@@ -6,4 +6,4 @@
     <option name="myName" value="langtools" />
     <option name="myLocal" value="true" />
   </copyright>
-</component>
\ No newline at end of file
+</component>
diff --git a/langtools/make/intellij/misc.xml b/langtools/make/intellij/misc.xml
index 29e17b31890..aec616acb92 100644
--- a/langtools/make/intellij/misc.xml
+++ b/langtools/make/intellij/misc.xml
@@ -3,7 +3,7 @@
   <component name="EntryPointsManager">
     <entry_points version="2.0" />
   </component>
-  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" assert-keyword="true" jdk-15="true">
+  <component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" assert-keyword="true" jdk-15="true">
     <output url="file://$PROJECT_DIR$/build" />
   </component>
 </project>
diff --git a/langtools/make/intellij/src/idea/LangtoolsIdeaAntLogger.java b/langtools/make/intellij/src/idea/LangtoolsIdeaAntLogger.java
index 0e6e9da4d71..759e5bf7c28 100644
--- a/langtools/make/intellij/src/idea/LangtoolsIdeaAntLogger.java
+++ b/langtools/make/intellij/src/idea/LangtoolsIdeaAntLogger.java
@@ -93,7 +93,9 @@ public final class LangtoolsIdeaAntLogger extends DefaultLogger {
         /** jtreg test failure */
         JTREG_TEST_FAILED(StringBinaryPredicate.STARTS_WITH, MSG_ERR, "FAILED: "),
         /** jtreg test error */
-        JTREG_TEST_ERROR(StringBinaryPredicate.STARTS_WITH, MSG_ERR, "Error: ");
+        JTREG_TEST_ERROR(StringBinaryPredicate.STARTS_WITH, MSG_ERR, "Error: "),
+        /** jtreg report */
+        JTREG_TEST_REPORT(StringBinaryPredicate.STARTS_WITH, MSG_INFO, "Report written");
 
         StringBinaryPredicate sbp;
         int priority;
@@ -126,7 +128,7 @@ public final class LangtoolsIdeaAntLogger extends DefaultLogger {
         JAVAC("javac", MessageKind.JAVAC_ERROR, MessageKind.JAVAC_WARNING, MessageKind.JAVAC_NOTE,
                        MessageKind.JAVAC_NESTED_DIAG, MessageKind.JAVAC_CRASH),
         /** jtreg task - invoked during test execution */
-        JTREG("jtreg", MessageKind.JTREG_TEST_PASSED, MessageKind.JTREG_TEST_FAILED, MessageKind.JTREG_TEST_ERROR),
+        JTREG("jtreg", MessageKind.JTREG_TEST_PASSED, MessageKind.JTREG_TEST_FAILED, MessageKind.JTREG_TEST_ERROR, MessageKind.JTREG_TEST_REPORT),
         /** initial synthetic task when the logger is created */
         ROOT("") {
             @Override
diff --git a/langtools/make/intellij/workspace.xml b/langtools/make/intellij/workspace.xml
index 7783a75f876..d7886fd181f 100644
--- a/langtools/make/intellij/workspace.xml
+++ b/langtools/make/intellij/workspace.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<project version="4">  
+<project version="4">
   <component name="ChangeListManager">
     <ignored path=".idea/" />
   </component>
@@ -44,7 +44,7 @@
       <method>
         <option name="Make" enabled="false" />
         <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-all-classes" />
-      </method> 
+      </method>
     </configuration>
     <configuration default="false" name="javap" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javap.Main" />
@@ -63,7 +63,7 @@
       <method>
         <option name="Make" enabled="false" />
         <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-all-classes" />
-      </method> 
+      </method>
     </configuration>
     <configuration default="false" name="javah" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.javah.Main" />
@@ -82,7 +82,7 @@
       <method>
         <option name="Make" enabled="false" />
         <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-all-classes" />
-      </method> 
+      </method>
     </configuration>
     <configuration default="false" name="sjavac" type="Application" factoryName="Application">
       <option name="MAIN_CLASS_NAME" value="com.sun.tools.sjavac.Main" />
@@ -101,7 +101,7 @@
       <method>
         <option name="Make" enabled="false" />
         <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-all-classes" />
-      </method> 
+      </method>
     </configuration>
     <!-- bootstrap javac -->
     <configuration default="false" name="javac (bootstrap)" type="Application" factoryName="Application">
@@ -121,7 +121,7 @@
       <method>
         <option name="Make" enabled="false" />
         <option name="AntTarget" enabled="true" antfile="file://$PROJECT_DIR$/.idea/build.xml" target="build-bootstrap-javac" />
-      </method> 
+      </method>
     </configuration>
     <!-- jtreg debug -->
     <configuration default="false" name="jtreg (debug)" type="Remote" factoryName="Remote" singleton="true">

From 47e744920e7574e2c805c30a256bbcb58b1c1ec7 Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Wed, 10 Dec 2014 11:55:04 +0100
Subject: [PATCH 271/299] 8066225: NPE in MethodEmitter with duplicate integer
 switch cases

Reviewed-by: hannesw, lagergren
---
 .../internal/codegen/AssignSymbols.java       |  2 +-
 .../internal/codegen/CodeGenerator.java       |  2 +-
 .../internal/codegen/FoldConstants.java       | 31 ++++++++++++
 .../codegen/LocalVariableTypesCalculator.java |  2 +-
 .../jdk/nashorn/internal/codegen/Lower.java   |  2 +-
 .../jdk/nashorn/internal/ir/SwitchNode.java   | 47 ++++++++++++-------
 nashorn/test/script/basic/JDK-8066225.js      | 36 ++++++++++++++
 .../test/script/basic/JDK-8066225.js.EXPECTED |  2 +
 8 files changed, 102 insertions(+), 22 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8066225.js
 create mode 100644 nashorn/test/script/basic/JDK-8066225.js.EXPECTED

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java
index 4193139aaaf..f860886054b 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java
@@ -917,7 +917,7 @@ final class AssignSymbols extends NodeVisitor<LexicalContext> implements Loggabl
     @Override
     public Node leaveSwitchNode(final SwitchNode switchNode) {
         // We only need a symbol for the tag if it's not an integer switch node
-        if(!switchNode.isInteger()) {
+        if(!switchNode.isUniqueInteger()) {
             switchNode.setTag(newObjectInternal(SWITCH_TAG_PREFIX));
         }
         return switchNode;
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
index a239471906d..7c2656d106e 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -2817,7 +2817,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
         Label defaultLabel = defaultCase != null ? defaultCase.getEntry() : breakLabel;
         final boolean hasSkipConversion = LocalVariableConversion.hasLiveConversion(switchNode);
 
-        if (switchNode.isInteger()) {
+        if (switchNode.isUniqueInteger()) {
             // Tree for sorting values.
             final TreeMap<Integer, Label> tree = new TreeMap<>();
 
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java
index 79d20ea1d21..72f9fd12c7a 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java
@@ -26,12 +26,16 @@
 package jdk.nashorn.internal.codegen;
 
 import java.util.ArrayList;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Set;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.BinaryNode;
 import jdk.nashorn.internal.ir.Block;
 import jdk.nashorn.internal.ir.BlockStatement;
+import jdk.nashorn.internal.ir.CaseNode;
 import jdk.nashorn.internal.ir.EmptyNode;
+import jdk.nashorn.internal.ir.Expression;
 import jdk.nashorn.internal.ir.FunctionNode;
 import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
 import jdk.nashorn.internal.ir.IfNode;
@@ -40,6 +44,7 @@ import jdk.nashorn.internal.ir.LiteralNode;
 import jdk.nashorn.internal.ir.LiteralNode.ArrayLiteralNode;
 import jdk.nashorn.internal.ir.Node;
 import jdk.nashorn.internal.ir.Statement;
+import jdk.nashorn.internal.ir.SwitchNode;
 import jdk.nashorn.internal.ir.TernaryNode;
 import jdk.nashorn.internal.ir.UnaryNode;
 import jdk.nashorn.internal.ir.VarNode;
@@ -131,6 +136,32 @@ final class FoldConstants extends NodeVisitor<LexicalContext> implements Loggabl
         return ternaryNode;
     }
 
+    @Override
+    public Node leaveSwitchNode(final SwitchNode switchNode) {
+        return switchNode.setUniqueInteger(lc, isUniqueIntegerSwitchNode(switchNode));
+    }
+
+    private static boolean isUniqueIntegerSwitchNode(final SwitchNode switchNode) {
+        final Set<Integer> alreadySeen = new HashSet<>();
+        for (final CaseNode caseNode : switchNode.getCases()) {
+            final Expression test = caseNode.getTest();
+            if (test != null && !isUniqueIntegerLiteral(test, alreadySeen)) {
+                return false;
+            }
+        }
+        return true;
+    }
+
+    private static boolean isUniqueIntegerLiteral(final Expression expr, final Set<Integer> alreadySeen) {
+        if (expr instanceof LiteralNode) {
+            final Object value = ((LiteralNode<?>)expr).getValue();
+            if (value instanceof Integer) {
+                return alreadySeen.add((Integer)value);
+            }
+        }
+        return false;
+    }
+
     /**
      * Helper class to evaluate constant expressions at compile time This is
      * also a simplifier used by BinaryNode visits, UnaryNode visits and
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
index 91e0c2544bc..af1a878612e 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
@@ -709,7 +709,7 @@ final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
 
         // Control flow is different for all-integer cases where we dispatch by switch table, and for all other cases
         // where we do sequential comparison. Note that CaseNode objects act as join points.
-        final boolean isInteger = switchNode.isInteger();
+        final boolean isInteger = switchNode.isUniqueInteger();
         final Label breakLabel = switchNode.getBreakLabel();
         final boolean hasDefault = switchNode.getDefaultCase() != null;
 
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
index b52d39843a3..6f8f3e980cc 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
@@ -275,7 +275,7 @@ final class Lower extends NodeOperatorVisitor<BlockLexicalContext> implements Lo
 
     @Override
     public Node leaveSwitchNode(final SwitchNode switchNode) {
-        if(!switchNode.isInteger()) {
+        if(!switchNode.isUniqueInteger()) {
             // Wrap it in a block so its internally created tag is restricted in scope
             addStatementEnclosedInBlock(switchNode);
         } else {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/SwitchNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/SwitchNode.java
index 8936764c5b4..ca44758743a 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/SwitchNode.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/SwitchNode.java
@@ -48,6 +48,10 @@ public final class SwitchNode extends BreakableStatement {
     /** Switch default index. */
     private final int defaultCaseIndex;
 
+    /** True if all cases are 32-bit signed integer constants, without repetitions. It's a prerequisite for
+     * using a tableswitch/lookupswitch when generating code. */
+    private final boolean uniqueInteger;
+
     /** Tag symbol. */
     private Symbol tag;
 
@@ -66,15 +70,17 @@ public final class SwitchNode extends BreakableStatement {
         this.expression       = expression;
         this.cases            = cases;
         this.defaultCaseIndex = defaultCase == null ? -1 : cases.indexOf(defaultCase);
+        this.uniqueInteger    = false;
     }
 
     private SwitchNode(final SwitchNode switchNode, final Expression expression, final List<CaseNode> cases,
-            final int defaultCaseIndex, final LocalVariableConversion conversion) {
+            final int defaultCaseIndex, final LocalVariableConversion conversion, final boolean uniqueInteger) {
         super(switchNode, conversion);
         this.expression       = expression;
         this.cases            = cases;
         this.defaultCaseIndex = defaultCaseIndex;
-        this.tag              = switchNode.getTag(); //TODO are symbols inhereted as references?
+        this.tag              = switchNode.getTag(); //TODO are symbols inherited as references?
+        this.uniqueInteger    = uniqueInteger;
     }
 
     @Override
@@ -83,7 +89,7 @@ public final class SwitchNode extends BreakableStatement {
         for (final CaseNode caseNode : cases) {
             newCases.add(new CaseNode(caseNode, caseNode.getTest(), caseNode.getBody(), caseNode.getLocalVariableConversion()));
         }
-        return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, newCases, defaultCaseIndex, conversion));
+        return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, newCases, defaultCaseIndex, conversion, uniqueInteger));
     }
 
     @Override
@@ -151,7 +157,7 @@ public final class SwitchNode extends BreakableStatement {
         if (this.cases == cases) {
             return this;
         }
-        return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, cases, defaultCaseIndex, conversion));
+        return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, cases, defaultCaseIndex, conversion, uniqueInteger));
     }
 
     /**
@@ -183,7 +189,7 @@ public final class SwitchNode extends BreakableStatement {
         if (this.expression == expression) {
             return this;
         }
-        return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, cases, defaultCaseIndex, conversion));
+        return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, cases, defaultCaseIndex, conversion, uniqueInteger));
     }
 
     /**
@@ -205,25 +211,30 @@ public final class SwitchNode extends BreakableStatement {
     }
 
     /**
-     * Returns true if all cases of this switch statement are 32-bit signed integer constants.
-     * @return true if all cases of this switch statement are 32-bit signed integer constants.
+     * Returns true if all cases of this switch statement are 32-bit signed integer constants, without repetitions.
+     * @return true if all cases of this switch statement are 32-bit signed integer constants, without repetitions.
      */
-    public boolean isInteger() {
-        for (final CaseNode caseNode : cases) {
-            final Expression test = caseNode.getTest();
-            if (test != null && !isIntegerLiteral(test)) {
-                return false;
-            }
+    public boolean isUniqueInteger() {
+        return uniqueInteger;
+    }
+
+    /**
+     * Sets whether all cases of this switch statement are 32-bit signed integer constants, without repetitions.
+     * @param lc lexical context
+     * @param uniqueInteger if true, all cases of this switch statement have been determined to be 32-bit signed
+     * integer constants, without repetitions.
+     * @return this switch node, if the value didn't change, or a new switch node with the changed value
+     */
+    public SwitchNode setUniqueInteger(final LexicalContext lc, final boolean uniqueInteger) {
+        if(this.uniqueInteger == uniqueInteger) {
+            return this;
         }
-        return true;
+        return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, cases, defaultCaseIndex, conversion, uniqueInteger));
     }
 
     @Override
     JoinPredecessor setLocalVariableConversionChanged(final LexicalContext lc, final LocalVariableConversion conversion) {
-        return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, cases, defaultCaseIndex, conversion));
+        return Node.replaceInLexicalContext(lc, this, new SwitchNode(this, expression, cases, defaultCaseIndex, conversion, uniqueInteger));
     }
 
-    private static boolean isIntegerLiteral(final Expression expr) {
-        return expr instanceof LiteralNode && ((LiteralNode<?>)expr).getValue() instanceof Integer;
-    }
 }
diff --git a/nashorn/test/script/basic/JDK-8066225.js b/nashorn/test/script/basic/JDK-8066225.js
new file mode 100644
index 00000000000..84d56b81910
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066225.js
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2014 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.
+ */
+
+/**
+ * JDK-8066225: NPE in MethodEmitter with duplicate integer switch cases
+ *
+ * @test
+ * @run
+ */
+
+(function (x){
+    switch(x) { 
+       case 44: for (var x in {}) {x}; print("1"); 
+       case 44: print("2");
+    }
+})(44);
diff --git a/nashorn/test/script/basic/JDK-8066225.js.EXPECTED b/nashorn/test/script/basic/JDK-8066225.js.EXPECTED
new file mode 100644
index 00000000000..1191247b6d9
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066225.js.EXPECTED
@@ -0,0 +1,2 @@
+1
+2

From 22573e0db4bed45ce6eebf9ebbc37c46751b8e38 Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Wed, 10 Dec 2014 11:55:25 +0100
Subject: [PATCH 272/299] 8066224: fixes for folding a constant-test ternary
 operator

Reviewed-by: hannesw, lagergren
---
 .../internal/codegen/CodeGenerator.java       | 15 +++++++-
 .../internal/codegen/FoldConstants.java       |  2 +-
 nashorn/test/script/basic/JDK-8066224.js      | 38 +++++++++++++++++++
 .../test/script/basic/JDK-8066224.js.EXPECTED |  1 +
 4 files changed, 54 insertions(+), 2 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8066224.js
 create mode 100644 nashorn/test/script/basic/JDK-8066224.js.EXPECTED

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
index 7c2656d106e..5cc931cb7c3 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -2021,6 +2021,19 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
         final Expression test = ifNode.getTest();
         final Block pass = ifNode.getPass();
         final Block fail = ifNode.getFail();
+
+        if (Expression.isAlwaysTrue(test)) {
+            loadAndDiscard(test);
+            pass.accept(this);
+            return false;
+        } else if (Expression.isAlwaysFalse(test)) {
+            loadAndDiscard(test);
+            if (fail != null) {
+                fail.accept(this);
+            }
+            return false;
+        }
+
         final boolean hasFailConversion = LocalVariableConversion.hasLiveConversion(ifNode);
 
         final Label failLabel  = new Label("if_fail");
@@ -2040,7 +2053,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
             method.beforeJoinPoint(ifNode);
         }
 
-        if(afterLabel != null) {
+        if(afterLabel != null && afterLabel.isReachable()) {
             method.label(afterLabel);
         }
 
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java
index 72f9fd12c7a..092b788f8f2 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/FoldConstants.java
@@ -131,7 +131,7 @@ final class FoldConstants extends NodeVisitor<LexicalContext> implements Loggabl
     public Node leaveTernaryNode(final TernaryNode ternaryNode) {
         final Node test = ternaryNode.getTest();
         if (test instanceof LiteralNode.PrimitiveLiteralNode) {
-            return ((LiteralNode.PrimitiveLiteralNode<?>)test).isTrue() ? ternaryNode.getTrueExpression() : ternaryNode.getFalseExpression();
+            return (((LiteralNode.PrimitiveLiteralNode<?>)test).isTrue() ? ternaryNode.getTrueExpression() : ternaryNode.getFalseExpression()).getExpression();
         }
         return ternaryNode;
     }
diff --git a/nashorn/test/script/basic/JDK-8066224.js b/nashorn/test/script/basic/JDK-8066224.js
new file mode 100644
index 00000000000..b29ba353033
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066224.js
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2014 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.
+ */
+
+/**
+ * JDK-8066224: fixes for folding a constant-test ternary operator
+ *
+ * @test
+ * @run
+ */
+
+print((function(){ 
+    if(false ? 0 : '') {
+        throw false;
+    } else if (x = this) {
+        var x = x; 
+    }
+    return x === this;
+})())
diff --git a/nashorn/test/script/basic/JDK-8066224.js.EXPECTED b/nashorn/test/script/basic/JDK-8066224.js.EXPECTED
new file mode 100644
index 00000000000..27ba77ddaf6
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066224.js.EXPECTED
@@ -0,0 +1 @@
+true

From 3330ff38e9ce0b4d805ee3513b7c21345b1078f1 Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Wed, 10 Dec 2014 12:30:48 +0100
Subject: [PATCH 273/299] 8066236: RuntimeNode forces copy creation on
 visitation

Reviewed-by: hannesw, lagergren
---
 .../codegen/LocalVariableTypesCalculator.java |  7 +++
 .../jdk/nashorn/internal/ir/RuntimeNode.java  |  7 +--
 nashorn/test/script/basic/JDK-8066236.js      | 46 +++++++++++++++++++
 .../test/script/basic/JDK-8066236.js.EXPECTED |  3 ++
 4 files changed, 57 insertions(+), 6 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8066236.js
 create mode 100644 nashorn/test/script/basic/JDK-8066236.js.EXPECTED

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
index af1a878612e..ac3c29349b0 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/LocalVariableTypesCalculator.java
@@ -93,6 +93,13 @@ import jdk.nashorn.internal.parser.TokenType;
  * variable to its widest used type after the join point. That would eliminate some widenings of undefined variables to
  * object, most notably those used only in loops. We need a full liveness analysis for that. Currently, we can establish
  * per-type liveness, which eliminates most of unwanted dead widenings.
+ * NOTE: the way this class is implemented, it actually processes the AST in two passes. The first pass is top-down and
+ * implemented in {@code enterXxx} methods. This pass does not mutate the AST (except for one occurrence, noted below),
+ * as being able to find relevant labels for control flow joins is sensitive to their reference identity, and mutated
+ * label-carrying nodes will create copies of their labels. A second bottom-up pass applying the changes is implemented
+ * in the separate visitor sitting in {@link #leaveFunctionNode(FunctionNode)}. This visitor will also instantiate new
+ * instances of the calculator to be run on nested functions (when not lazy compiling).
+ *
  */
 final class LocalVariableTypesCalculator extends NodeVisitor<LexicalContext>{
 
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/RuntimeNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/RuntimeNode.java
index fd34c3ec901..4eca8ff084b 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/RuntimeNode.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/RuntimeNode.java
@@ -27,7 +27,6 @@ package jdk.nashorn.internal.ir;
 
 import static jdk.nashorn.internal.runtime.UnwarrantedOptimismException.INVALID_PROGRAM_POINT;
 
-import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
@@ -468,11 +467,7 @@ public class RuntimeNode extends Expression implements Optimistic {
     @Override
     public Node accept(final NodeVisitor<? extends LexicalContext> visitor) {
         if (visitor.enterRuntimeNode(this)) {
-            final List<Expression> newArgs = new ArrayList<>();
-            for (final Node arg : args) {
-                newArgs.add((Expression)arg.accept(visitor));
-            }
-            return visitor.leaveRuntimeNode(setArgs(newArgs));
+            return visitor.leaveRuntimeNode(setArgs(Node.accept(visitor, args)));
         }
 
         return this;
diff --git a/nashorn/test/script/basic/JDK-8066236.js b/nashorn/test/script/basic/JDK-8066236.js
new file mode 100644
index 00000000000..760e0f46db8
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066236.js
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2014 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.
+ */
+
+/**
+ * JDK-8066236: RuntimeNode forces copy creation on visitation
+ *
+ * @test
+ * @run
+ */
+
+// Note: we're using Function("code") instead of (function(){ code }) so that
+// we don't trigger parser API validation in JDK-8008448 tests. The test code
+// encapsulated in functions below can't be correctly handled by the parser API
+// currently, as it contains parser-generated REFERENCE_ERROR runtime nodes.
+try {
+    Function("L: {this = x;break L}")();
+} catch (e) {
+   print("threw ReferenceError: " + (e instanceof ReferenceError));
+}
+try {
+    Function("L:with(this--)break L;")();
+} catch (e) {
+   print("threw ReferenceError: " + (e instanceof ReferenceError));
+}
+Function("L:with(Object in Object)break L;")();
+print("SUCCESS");
diff --git a/nashorn/test/script/basic/JDK-8066236.js.EXPECTED b/nashorn/test/script/basic/JDK-8066236.js.EXPECTED
new file mode 100644
index 00000000000..b64a305638b
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066236.js.EXPECTED
@@ -0,0 +1,3 @@
+threw ReferenceError: true
+threw ReferenceError: true
+SUCCESS

From 34673eaf92d31e8fb7ba096180c1915e6b82b20d Mon Sep 17 00:00:00 2001
From: Athijegannathan Sundararajan <sundar@openjdk.org>
Date: Wed, 10 Dec 2014 19:42:01 +0530
Subject: [PATCH 274/299] 8067136: BrowserJSObjectLinker does not handle call
 on JSObjects

Reviewed-by: attila, hannesw, lagergren
---
 nashorn/samples/browser_dom.js                | 91 +++++++++++++++++++
 .../runtime/linker/BrowserJSObjectLinker.java |  9 ++
 nashorn/test/script/basic/JDK-8067136.js      | 69 ++++++++++++++
 .../test/script/basic/JDK-8067136.js.EXPECTED |  1 +
 4 files changed, 170 insertions(+)
 create mode 100644 nashorn/samples/browser_dom.js
 create mode 100644 nashorn/test/script/basic/JDK-8067136.js
 create mode 100644 nashorn/test/script/basic/JDK-8067136.js.EXPECTED

diff --git a/nashorn/samples/browser_dom.js b/nashorn/samples/browser_dom.js
new file mode 100644
index 00000000000..94324c7ad75
--- /dev/null
+++ b/nashorn/samples/browser_dom.js
@@ -0,0 +1,91 @@
+#// Usage: jjs -fx browser.js
+
+/*
+ * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *   - Redistributions of source code must retain the above copyright
+ *     notice, this list of conditions and the following disclaimer.
+ *
+ *   - Redistributions in binary form must reproduce the above copyright
+ *     notice, this list of conditions and the following disclaimer in the
+ *     documentation and/or other materials provided with the distribution.
+ *
+ *   - Neither the name of Oracle nor the names of its
+ *     contributors may be used to endorse or promote products derived
+ *     from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+if (!$OPTIONS._fx) {
+    print("Usage: jjs -fx browser.js");
+    exit(1);
+}
+
+// JavaFX classes used
+var ChangeListener = Java.type("javafx.beans.value.ChangeListener");
+var Scene     = Java.type("javafx.scene.Scene");
+var WebView   = Java.type("javafx.scene.web.WebView");
+var EventListener = Java.type("org.w3c.dom.events.EventListener");
+
+// JavaFX start method
+function start(stage) {
+    start.title = "Web View";
+    var wv = new WebView();
+    wv.engine.loadContent(<<EOF
+<html>
+<head>
+<title>
+This is the title
+</title>
+<script>
+// click count for OK button
+var okCount = 0;
+</script>
+</head>
+<body>
+Button from the input html<br>
+<button type="button" onclick="okCount++">OK</button><br>
+</body>
+</html>
+EOF, "text/html");
+
+    // attach onload handler
+    wv.engine.loadWorker.stateProperty().addListener(
+        new ChangeListener() {
+            changed: function() {
+               // DOM document element
+               var document = wv.engine.document;
+               // DOM manipulation
+               var btn = document.createElement("button");
+               var n = 0;
+               // attach a button handler - nashorn function!
+               btn.onclick = new EventListener(function() {
+                   n++; print("You clicked " + n + " time(s)");
+                   print("you clicked OK " + wv.engine.executeScript("okCount"));
+               });
+               // attach text to button
+               var t = document.createTextNode("Click Me!"); 
+               btn.appendChild(t);
+               // attach button to the document
+               document.body.appendChild(btn); 
+           }
+        }
+    );
+    stage.scene = new Scene(wv, 750, 500);
+    stage.show();
+}
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java
index 60f639a7d9c..0056477c325 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/BrowserJSObjectLinker.java
@@ -29,6 +29,7 @@ import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObject
 import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_GETSLOT;
 import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_SETMEMBER;
 import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_SETSLOT;
+import static jdk.nashorn.internal.runtime.linker.BrowserJSObjectLinker.JSObjectHandles.JSOBJECT_CALL;
 import java.lang.invoke.MethodHandle;
 import java.lang.invoke.MethodHandles;
 import jdk.internal.dynalink.CallSiteDescriptor;
@@ -131,6 +132,8 @@ final class BrowserJSObjectLinker implements TypeBasedGuardingDynamicLinker {
             case "setProp":
             case "setElem":
                 return c > 2 ? findSetMethod(desc) : findSetIndexMethod();
+            case "call":
+                return findCallMethod(desc);
             default:
                 return null;
         }
@@ -156,6 +159,11 @@ final class BrowserJSObjectLinker implements TypeBasedGuardingDynamicLinker {
         return new GuardedInvocation(JSOBJECTLINKER_PUT, IS_JSOBJECT_GUARD);
     }
 
+    private static GuardedInvocation findCallMethod(final CallSiteDescriptor desc) {
+        final MethodHandle call = MH.insertArguments(JSOBJECT_CALL, 1, "call");
+        return new GuardedInvocation(MH.asCollector(call, Object[].class, desc.getMethodType().parameterCount() - 1), IS_JSOBJECT_GUARD);
+    }
+
     @SuppressWarnings("unused")
     private static boolean isJSObject(final Object self) {
         return jsObjectClass.isInstance(self);
@@ -215,6 +223,7 @@ final class BrowserJSObjectLinker implements TypeBasedGuardingDynamicLinker {
         static final MethodHandle JSOBJECT_GETSLOT       = findJSObjectMH_V("getSlot", Object.class, int.class).asType(MH.type(Object.class, Object.class, int.class));
         static final MethodHandle JSOBJECT_SETMEMBER     = findJSObjectMH_V("setMember", Void.TYPE, String.class, Object.class).asType(MH.type(Void.TYPE, Object.class, String.class, Object.class));
         static final MethodHandle JSOBJECT_SETSLOT       = findJSObjectMH_V("setSlot", Void.TYPE, int.class, Object.class).asType(MH.type(Void.TYPE, Object.class, int.class, Object.class));
+        static final MethodHandle JSOBJECT_CALL          = findJSObjectMH_V("call", Object.class, String.class, Object[].class).asType(MH.type(Object.class, Object.class, String.class, Object[].class));
 
         private static MethodHandle findJSObjectMH_V(final String name, final Class<?> rtype, final Class<?>... types) {
             checkJSObjectClass();
diff --git a/nashorn/test/script/basic/JDK-8067136.js b/nashorn/test/script/basic/JDK-8067136.js
new file mode 100644
index 00000000000..1c7c13a201a
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8067136.js
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+/**
+ * JDK-8067136: BrowserJSObjectLinker does not handle call on JSObjects
+ *
+ * @test
+ * @option -scripting
+ * @run
+ */
+
+// call on netscape.javascript.JSObject
+
+function main() {
+    var JSObject;
+    try {
+        JSObject = Java.type("netscape.javascript.JSObject");
+    } catch (e) {
+        if (e instanceof java.lang.ClassNotFoundException) {
+            // pass vacuously by emitting the .EXPECTED file content
+            var str = readFully(__DIR__ + "JDK-8067136.js.EXPECTED");
+            print(str.substring(0, str.length - 1));
+            return;
+        } else{
+            fail("unexpected exception for JSObject", e);
+        }
+    }
+    test(JSObject);
+}
+
+function test(JSObject) {
+    var obj = new (Java.extend(JSObject))() {
+        getMember: function(name) {
+            if (name == "func") {
+                return new (Java.extend(JSObject)) {
+                    call: function(n) {
+                        print("func called");
+                    }
+                }
+            }
+            return name.toUpperCase();
+        },
+
+    };
+
+    obj.func();
+}
+
+main();
diff --git a/nashorn/test/script/basic/JDK-8067136.js.EXPECTED b/nashorn/test/script/basic/JDK-8067136.js.EXPECTED
new file mode 100644
index 00000000000..5897ee65ac3
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8067136.js.EXPECTED
@@ -0,0 +1 @@
+func called

From ccab6bc563e18381de796c7ddebd81f7e561ec5a Mon Sep 17 00:00:00 2001
From: Alan Bateman <alanb@openjdk.org>
Date: Wed, 10 Dec 2014 15:01:26 +0000
Subject: [PATCH 275/299] 8066915: (fs) Files.newByteChannel opens directories
 for cases where subsequent reads may fail

Reviewed-by: chegar
---
 .../classes/sun/nio/fs/UnixChannelFactory.java | 16 ++++++++++++++++
 jdk/test/java/nio/file/Files/SBC.java          | 18 +++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixChannelFactory.java b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixChannelFactory.java
index bc194f960ae..90a9c787ff0 100644
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixChannelFactory.java
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixChannelFactory.java
@@ -270,6 +270,22 @@ class UnixChannelFactory {
             throw x;
         }
 
+        // fail if the file is a directory
+        if (flags.read) {
+            UnixException exc = null;
+            try {
+                if (UnixFileAttributes.get(fd).isDirectory()) {
+                    exc = new UnixException(EISDIR);
+                }
+            } catch (UnixException x) {
+                exc = x;
+            }
+            if (exc != null) {
+                close(fd);
+                throw exc;
+            }
+        }
+
         // unlink file immediately if delete on close. The spec is clear that
         // an implementation cannot guarantee to unlink the correct file when
         // replaced by an attacker after it is opened.
diff --git a/jdk/test/java/nio/file/Files/SBC.java b/jdk/test/java/nio/file/Files/SBC.java
index d26428d5f60..64672d27947 100644
--- a/jdk/test/java/nio/file/Files/SBC.java
+++ b/jdk/test/java/nio/file/Files/SBC.java
@@ -22,7 +22,7 @@
  */
 
 /* @test
- * @bug 4313887
+ * @bug 4313887 8066915
  * @summary Unit test for java.nio.file.Files.newByteChannel
  * @library ..
  */
@@ -59,6 +59,7 @@ public class SBC {
                 dosSharingOptionTests(dir);
 
             // misc. tests
+            directoryOpenTests(dir);
             badCombinations(dir);
             unsupportedOptions(dir);
             nullTests(dir);
@@ -278,6 +279,21 @@ public class SBC {
         }
     }
 
+    // test opening a directory for read or write
+    static void directoryOpenTests(Path dir) throws Exception {
+        try (SeekableByteChannel sbc = Files.newByteChannel(dir, READ)) {
+            throw new RuntimeException("Opened directory for read");
+        } catch (IOException expected) { }
+
+        try (SeekableByteChannel sbc = Files.newByteChannel(dir, WRITE)) {
+            throw new RuntimeException("Opened directory for write");
+        } catch (IOException expected) { }
+
+        try (SeekableByteChannel sbc = Files.newByteChannel(dir, APPEND)) {
+            throw new RuntimeException("Opened directory for append ");
+        } catch (IOException expected) { }
+    }
+
     // Windows specific options for the use by applications that really want
     // to use legacy DOS sharing options
     static void dosSharingOptionTests(Path dir) throws Exception {

From 13c5c044702491ee838a3781022eb9a3ee3ac559 Mon Sep 17 00:00:00 2001
From: Attila Szegedi <attila@openjdk.org>
Date: Wed, 10 Dec 2014 18:28:41 +0100
Subject: [PATCH 276/299] 8066221: anonymous function statement name clashes
 with another symbol

Reviewed-by: lagergren, sundar
---
 .../jdk/nashorn/internal/parser/Parser.java   | 23 ++++++++++++--
 nashorn/test/script/basic/JDK-8066221.js      | 31 +++++++++++++++++++
 2 files changed, 51 insertions(+), 3 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8066221.js

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
index ed078dfdbf8..2806f79b3b6 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java
@@ -53,6 +53,7 @@ import static jdk.nashorn.internal.parser.TokenType.RPAREN;
 import static jdk.nashorn.internal.parser.TokenType.SEMICOLON;
 import static jdk.nashorn.internal.parser.TokenType.TERNARY;
 import static jdk.nashorn.internal.parser.TokenType.WHILE;
+
 import java.io.Serializable;
 import java.util.ArrayDeque;
 import java.util.ArrayList;
@@ -2659,7 +2660,7 @@ loop:
         // name is null, generate anonymous name
         boolean isAnonymous = false;
         if (name == null) {
-            final String tmpName = getDefaultValidFunctionName(functionLine);
+            final String tmpName = getDefaultValidFunctionName(functionLine, isStatement);
             name = new IdentNode(functionToken, Token.descPosition(functionToken), tmpName);
             isAnonymous = true;
         }
@@ -2671,9 +2672,13 @@ loop:
         final ParserContextFunctionNode functionNode = createParserContextFunctionNode(name, functionToken, FunctionNode.Kind.NORMAL, functionLine, parameters);
         lc.push(functionNode);
         Block functionBody = null;
+        // Hide the current default name across function boundaries. E.g. "x3 = function x1() { function() {}}"
+        // If we didn't hide the current default name, then the innermost anonymous function would receive "x3".
+        hideDefaultName();
         try{
             functionBody = functionBody(functionNode);
         } finally {
+            defaultNames.pop();
             lc.pop(functionNode);
         }
 
@@ -2754,9 +2759,17 @@ loop:
         return function;
     }
 
-    private String getDefaultValidFunctionName(final int functionLine) {
+    private String getDefaultValidFunctionName(final int functionLine, final boolean isStatement) {
         final String defaultFunctionName = getDefaultFunctionName();
-        return isValidIdentifier(defaultFunctionName) ? defaultFunctionName : ANON_FUNCTION_PREFIX.symbolName() + functionLine;
+        if (isValidIdentifier(defaultFunctionName)) {
+            if (isStatement) {
+                // The name will be used as the LHS of a symbol assignment. We add the anonymous function
+                // prefix to ensure that it can't clash with another variable.
+                return ANON_FUNCTION_PREFIX.symbolName() + defaultFunctionName;
+            }
+            return defaultFunctionName;
+        }
+        return ANON_FUNCTION_PREFIX.symbolName() + functionLine;
     }
 
     private static boolean isValidIdentifier(final String name) {
@@ -2790,6 +2803,10 @@ loop:
 
     private void markDefaultNameUsed() {
         defaultNames.pop();
+        hideDefaultName();
+    }
+
+    private void hideDefaultName() {
         // Can be any value as long as getDefaultFunctionName doesn't recognize it as something it can extract a value
         // from. Can't be null
         defaultNames.push("");
diff --git a/nashorn/test/script/basic/JDK-8066221.js b/nashorn/test/script/basic/JDK-8066221.js
new file mode 100644
index 00000000000..7af4dfa109e
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066221.js
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2014 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.
+ */
+
+/**
+ * JDK-8066221: anonymous function statement name clashes with another symbol
+ * (compile-only test)
+ *
+ * @test
+ */
+
+x3 = function x1(x3) { function (){} };

From e29325b0d5e971a2fba588782a2cad178bccf219 Mon Sep 17 00:00:00 2001
From: Volker Simonis <simonis@openjdk.org>
Date: Wed, 10 Dec 2014 18:31:24 +0100
Subject: [PATCH 277/299] 8066589: Make importing sa-jdi.jar optional on its
 existance

Also fix the location where libjli_static.a is loaded from on AIX

Reviewed-by: erikj, dsamersoff
---
 jdk/make/Import.gmk                  | 9 +++++++--
 jdk/make/gensrc/Gensrc-jdk.jdi.gmk   | 9 +++++++--
 jdk/make/launcher/LauncherCommon.gmk | 2 +-
 3 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/jdk/make/Import.gmk b/jdk/make/Import.gmk
index 58be77341ca..9e743349437 100644
--- a/jdk/make/Import.gmk
+++ b/jdk/make/Import.gmk
@@ -221,8 +221,13 @@ $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/_the.sa.jar.unpacked: $(HOTSPOT_DIST)
 # even if zip is already unpacked.
 $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services: $(HOTSPOT_DIST)/lib/sa-jdi.jar
 
-SA_TARGETS += $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/_the.sa.jar.unpacked \
-    $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
+# Some platforms don't have the serviceability agent
+ifeq (, $(filter $(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), aix-ppc64))
+  ifneq ($(JVM_VARIANT_ZERO), true)
+    SA_TARGETS += $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/_the.sa.jar.unpacked \
+        $(SUPPORT_OUTPUTDIR)/gensrc/jdk.hotspot.agent/_the.sa.services
+  endif
+endif
 
 ################################################################################
 
diff --git a/jdk/make/gensrc/Gensrc-jdk.jdi.gmk b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk
index d71c5dd6177..7c36f4e6999 100644
--- a/jdk/make/gensrc/Gensrc-jdk.jdi.gmk
+++ b/jdk/make/gensrc/Gensrc-jdk.jdi.gmk
@@ -78,8 +78,13 @@ $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect
     $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector
 	$(install-file)
 
-GENSRC_JDK_JDI += $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector \
-    $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector
+# Some platforms don't have the serviceability agent
+ifeq (, $(filter $(OPENJDK_TARGET_OS)-$(OPENJDK_TARGET_CPU), aix-ppc64))
+  ifneq ($(JVM_VARIANT_ZERO), true)
+    GENSRC_JDK_JDI += $(SUPPORT_OUTPUTDIR)/gensrc/jdk.jdi/META-INF/services/com.sun.jdi.connect.Connector \
+        $(JDK_OUTPUTDIR)/modules/jdk.hotspot.agent/META-INF/services/com.sun.jdi.connect.Connector
+  endif
+endif
 
 ################################################################################
 
diff --git a/jdk/make/launcher/LauncherCommon.gmk b/jdk/make/launcher/LauncherCommon.gmk
index da91a549a41..09ffcffdb34 100644
--- a/jdk/make/launcher/LauncherCommon.gmk
+++ b/jdk/make/launcher/LauncherCommon.gmk
@@ -116,7 +116,7 @@ define SetupLauncher
   endif
 
   ifeq ($(OPENJDK_TARGET_OS), aix)
-    $1_LDFLAGS_SUFFIX += -L$(SUPPORT_OUTPUTDIR)/native/$(MODULE) -ljli_static
+    $1_LDFLAGS_SUFFIX += -L$(SUPPORT_OUTPUTDIR)/native/java.base -ljli_static
   endif
 
   ifeq ($(USE_EXTERNAL_LIBZ), true)

From 7d42a4167f15900773bfbb5e8fc60d06a89c994c Mon Sep 17 00:00:00 2001
From: Volker Simonis <simonis@openjdk.org>
Date: Wed, 10 Dec 2014 19:12:27 +0100
Subject: [PATCH 278/299] 8067015: Implement os::pd_map_memory() on AIX

Reviewed-by: dholmes
---
 hotspot/src/os/aix/vm/os_aix.cpp | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

diff --git a/hotspot/src/os/aix/vm/os_aix.cpp b/hotspot/src/os/aix/vm/os_aix.cpp
index 3f14161d7b0..2a77a9e80f6 100644
--- a/hotspot/src/os/aix/vm/os_aix.cpp
+++ b/hotspot/src/os/aix/vm/os_aix.cpp
@@ -4144,8 +4144,29 @@ int os::available(int fd, jlong *bytes) {
 char* os::pd_map_memory(int fd, const char* file_name, size_t file_offset,
                         char *addr, size_t bytes, bool read_only,
                         bool allow_exec) {
-  Unimplemented();
-  return NULL;
+  int prot;
+  int flags = MAP_PRIVATE;
+
+  if (read_only) {
+    prot = PROT_READ;
+  } else {
+    prot = PROT_READ | PROT_WRITE;
+  }
+
+  if (allow_exec) {
+    prot |= PROT_EXEC;
+  }
+
+  if (addr != NULL) {
+    flags |= MAP_FIXED;
+  }
+
+  char* mapped_address = (char*)mmap(addr, (size_t)bytes, prot, flags,
+                                     fd, file_offset);
+  if (mapped_address == MAP_FAILED) {
+    return NULL;
+  }
+  return mapped_address;
 }
 
 

From 282c9432419b09372454e9f1a5591dfbfb376c92 Mon Sep 17 00:00:00 2001
From: Andrei Eremeev <aeremeev@openjdk.org>
Date: Wed, 10 Dec 2014 21:45:39 +0200
Subject: [PATCH 279/299] 8065360: Implement a test that checks possibilty of
 class members to be imported

Reviewed-by: jlahoda, anazarov
---
 .../importscope/ImportDependenciesTest.java   | 301 ++++++++++++++++
 .../javac/importscope/ImportMembersTest.java  | 330 ++++++++++++++++++
 .../NegativeCyclicDependencyTest.java         |  10 +-
 3 files changed, 637 insertions(+), 4 deletions(-)
 create mode 100644 langtools/test/tools/javac/importscope/ImportDependenciesTest.java
 create mode 100644 langtools/test/tools/javac/importscope/ImportMembersTest.java

diff --git a/langtools/test/tools/javac/importscope/ImportDependenciesTest.java b/langtools/test/tools/javac/importscope/ImportDependenciesTest.java
new file mode 100644
index 00000000000..c00ec549e0e
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/ImportDependenciesTest.java
@@ -0,0 +1,301 @@
+/*
+ * Copyright (c) 2014, 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 8065360
+ * @summary The test checks dependencies through type parameters and implements/extends statements.
+ * @library /tools/lib
+ * @build ToolBox ImportDependenciesTest
+ * @run main ImportDependenciesTest
+ */
+
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+/**
+ * The test checks that code which contains dependencies through type parameters,
+ * implements/extends statements compiles properly. All combinations of
+ * import types are tested. In addition, the test checks various combinations
+ * of classes.
+ */
+public class ImportDependenciesTest {
+
+    private static final String sourceTemplate =
+            "package pkg;\n" +
+            "#IMPORT\n" +
+            "public class Test {\n" +
+            "    static #CLASS_TYPE InnerClass#TYPE_PARAMETER #PARENT {\n" +
+            "        static class Inner1 {\n" +
+            "        }\n" +
+            "        interface Inner2 {\n" +
+            "        }\n" +
+            "        interface Inner3 {\n" +
+            "        }\n" +
+            "    }\n" +
+            "    static class InnerClass1 {\n" +
+            "        static class IInner1 {\n" +
+            "        }\n" +
+            "    }\n" +
+            "    static class InnerInterface1 {\n" +
+            "        interface IInner2 {\n" +
+            "        }\n" +
+            "    }\n" +
+            "    static class InnerInterface2 {\n" +
+            "        interface IInner3 {\n" +
+            "        }\n" +
+            "    }\n" +
+            "}";
+
+    public static void main(String[] args) {
+        new ImportDependenciesTest().test();
+    }
+
+    public void test() {
+        List<List<InnerClass>> typeParameters = InnerClass.getAllCombinationsForTypeParameter();
+        List<List<InnerClass>> parents = InnerClass.getAllCombinationsForInheritance();
+        int passed = 0;
+        int total = 0;
+        for (ClassType classType : ClassType.values()) {
+            for (List<InnerClass> parent : parents) {
+                if (!classType.canBeInherited(parent)) {
+                    continue;
+                }
+                for (List<InnerClass> typeParameter : typeParameters) {
+                    List<InnerClass> innerClasses = new ArrayList<>(typeParameter);
+                    innerClasses.addAll(parent);
+                    for (ImportType importType : ImportType.values()) {
+                        ++total;
+                        String source = sourceTemplate
+                                .replace("#IMPORT", importType.generateImports(innerClasses))
+                                .replace("#CLASS_TYPE", classType.getClassType())
+                                .replace("#TYPE_PARAMETER", generateTypeParameter(typeParameter))
+                                .replace("#PARENT", classType.generateInheritanceString(parent));
+                        CompilationResult result = compile(new ToolBox.JavaSource("pkg/Test.java", source));
+                        if (!result.isSuccessful) {
+                            echo("Compilation failed!");
+                            echo(source);
+                            echo(result.message);
+                            echo();
+                        } else {
+                            ++passed;
+                        }
+                    }
+                }
+            }
+        }
+        String message = String.format(
+                "Total test cases run: %d, passed: %d, failed: %d.",
+                total, passed, total - passed);
+        if (passed != total) {
+            throw new RuntimeException(message);
+        }
+        echo(message);
+    }
+
+    private String generateTypeParameter(List<InnerClass> typeParameters) {
+        if (typeParameters.isEmpty()) {
+            return "";
+        }
+        return String.format("<T extends %s>", typeParameters.stream()
+                .map(InnerClass::getSimpleName)
+                .collect(Collectors.joining(" & ")));
+    }
+
+    private static class CompilationResult {
+        public final boolean isSuccessful;
+        public final String message;
+
+        public CompilationResult(boolean isSuccessful, String message) {
+            this.isSuccessful = isSuccessful;
+            this.message = message;
+        }
+    }
+
+    private CompilationResult compile(ToolBox.JavaSource...sources) {
+        StringWriter writer = new StringWriter();
+        JavaCompiler jc = ToolProvider.getSystemJavaCompiler();
+        Boolean call = jc.getTask(writer, null, null, null, null, Arrays.asList(sources)).call();
+        return new CompilationResult(call, writer.toString().replace(ToolBox.lineSeparator, "\n"));
+    }
+
+    public void echo() {
+        echo("");
+    }
+
+    public void echo(String output) {
+        printf(output + "\n");
+    }
+
+    public void printf(String template, Object...args) {
+        System.err.print(String.format(template, args).replace("\n", ToolBox.lineSeparator));
+    }
+
+    enum ImportType {
+        IMPORT("import"), STATIC_IMPORT("import static"),
+        IMPORT_ON_DEMAND("import"), STATIC_IMPORT_ON_DEMAND("import static");
+
+        private final String importType;
+        private ImportType(String importType) {
+            this.importType = importType;
+        }
+
+        private boolean isOnDemand() {
+            return this == IMPORT_ON_DEMAND || this == STATIC_IMPORT_ON_DEMAND;
+        }
+
+        public String generateImports(List<InnerClass> innerClasses) {
+            return innerClasses.stream()
+                    .map(i -> isOnDemand() ? i.getPackageName() + ".*" : i.getCanonicalName())
+                    .distinct()
+                    .map(s -> String.format("%s %s;", importType, s))
+                    .collect(Collectors.joining("\n"));
+        }
+    }
+
+    enum ClassType {
+        CLASS("class") {
+            @Override
+            public boolean canBeInherited(List<InnerClass> innerClasses) {
+                return true;
+            }
+
+            @Override
+            public String generateInheritanceString(List<InnerClass> innerClasses) {
+                if (innerClasses.isEmpty()) {
+                    return "";
+                }
+                StringBuilder sb = new StringBuilder();
+                InnerClass firstClass = innerClasses.get(0);
+                if (firstClass.isClass()) {
+                    sb.append("extends ").append(firstClass.getSimpleName()).append(" ");
+                }
+                String str = innerClasses.stream()
+                        .filter(x -> !x.isClass())
+                        .map(InnerClass::getSimpleName)
+                        .collect(Collectors.joining(", "));
+                if (!str.isEmpty()) {
+                    sb.append("implements ").append(str);
+                }
+                return sb.toString();
+            }
+        }, INTERFACE("interface") {
+            @Override
+            public boolean canBeInherited(List<InnerClass> innerClasses) {
+                return !innerClasses.stream().anyMatch(InnerClass::isClass);
+            }
+
+            @Override
+            public String generateInheritanceString(List<InnerClass> innerClasses) {
+                if (innerClasses.isEmpty()) {
+                    return "";
+                }
+                return "extends " + innerClasses.stream()
+                        .map(InnerClass::getSimpleName)
+                        .collect(Collectors.joining(", "));
+            }
+        };
+
+        private final String classType;
+        private ClassType(String classType) {
+            this.classType = classType;
+        }
+
+        public String getClassType() {
+            return classType;
+        }
+
+        public abstract boolean canBeInherited(List<InnerClass> innerClasses);
+
+        public abstract String generateInheritanceString(List<InnerClass> innerClasses);
+    }
+
+    enum InnerClass {
+        INNER_1("pkg.Test.InnerClass.Inner1", true),
+        INNER_2("pkg.Test.InnerClass.Inner2", true),
+        INNER_3("pkg.Test.InnerClass.Inner3", true),
+        IINNER_1("pkg.Test.InnerClass1.IInner1", false),
+        IINNER_2("pkg.Test.InnerInterface1.IInner2", false),
+        IINNER_3("pkg.Test.InnerInterface2.IInner3", false);
+
+        private final String canonicalName;
+        private final boolean isForTypeParameter;
+
+        private InnerClass(String canonicalName, boolean isForTypeParameter) {
+            this.canonicalName = canonicalName;
+            this.isForTypeParameter = isForTypeParameter;
+        }
+
+        private static List<List<InnerClass>> getAllCombinations(boolean isTypeParameter) {
+            List<List<InnerClass>> result = new ArrayList<>();
+            List<InnerClass> tmpl = Stream.of(InnerClass.values())
+                    .filter(i -> i.isForTypeParameter() == isTypeParameter)
+                    .collect(Collectors.toCollection(ArrayList::new));
+            result.add(Arrays.asList());
+            for (int i = 0; i < tmpl.size(); ++i) {
+                result.add(Arrays.asList(tmpl.get(i)));
+                for (int j = i + 1; j < tmpl.size(); ++j) {
+                    result.add(Arrays.asList(tmpl.get(i), tmpl.get(j)));
+                }
+            }
+            result.add(tmpl);
+            return result;
+        }
+
+        public static List<List<InnerClass>> getAllCombinationsForTypeParameter() {
+            return getAllCombinations(true);
+        }
+
+        public static List<List<InnerClass>> getAllCombinationsForInheritance() {
+            return getAllCombinations(false);
+        }
+
+        public String getCanonicalName() {
+            return canonicalName;
+        }
+
+        public String getSimpleName() {
+            String cName = getCanonicalName();
+            return cName.substring(cName.lastIndexOf('.') + 1);
+        }
+
+        public String getPackageName() {
+            String cName = getCanonicalName();
+            int dotIndex = cName.lastIndexOf('.');
+            return dotIndex == -1 ? "" : cName.substring(0, dotIndex);
+        }
+
+        public boolean isClass() {
+            return this == INNER_1 || this == IINNER_1;
+        }
+        private boolean isForTypeParameter() {
+            return isForTypeParameter;
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/importscope/ImportMembersTest.java b/langtools/test/tools/javac/importscope/ImportMembersTest.java
new file mode 100644
index 00000000000..9a6eb2e6daf
--- /dev/null
+++ b/langtools/test/tools/javac/importscope/ImportMembersTest.java
@@ -0,0 +1,330 @@
+/*
+ * Copyright (c) 2014, 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 8065360
+ * @summary The test checks possibility of class members to be imported.
+ * @library /tools/lib
+ * @build ToolBox ImportMembersTest
+ * @run main ImportMembersTest
+ */
+
+import javax.tools.JavaCompiler;
+import javax.tools.ToolProvider;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * The test checks that members of a class, an enum, an interface or annotation
+ * can be imported with help of a static import or an import statement.
+ * The tests generates a code, compiles it and checks whether it can be compiled
+ * successfully or fails with a proper message.
+ * The following is the example of a test case:
+ * package pkg;
+ * class ChildA extends A {}
+ *
+ * package pkg;
+ * class A {
+ *     static class Inner {}
+ *     static Object field;
+ *     static void method() {}
+ * }
+ *
+ * package pkg;
+ * import static pkg.ChildA.method;
+ * public class Test {{
+ *     method();
+ * }}
+ *
+ */
+public class ImportMembersTest {
+
+    private static final String[] expectedErrorMessages = {
+            "Test.java:\\d+:\\d+: compiler.err.cant.resolve.location: .*\n1 error\n",
+            "Test.java:\\d+:\\d+: compiler.err.import.requires.canonical: .*\n1 error\n"
+    };
+
+    private static final String sourceTemplate =
+            "package pkg;\n" +
+            "#IMPORT\n" +
+            "public class Test {{\n" +
+            "    #STATEMENT\n" +
+            "}}\n";
+
+    public static void main(String[] args) {
+        new ImportMembersTest().test();
+    }
+
+    public void test() {
+        int passed = 0;
+        int total = 0;
+        for (ClassType classType : ClassType.values()) {
+            for (ImportType importType : ImportType.values()) {
+                for (MemberType memberType : MemberType.values()) {
+                    ++total;
+                    List<ToolBox.JavaSource> sources = classType.getSources();
+                    sources.add(new ToolBox.JavaSource("Test.java",
+                            generateSource(classType, memberType, importType)));
+
+                    CompilationResult compilationResult = compile(sources);
+                    boolean isErrorExpected = importType.hasError(classType, memberType);
+                    if (!compilationResult.isSuccessful) {
+                        if (isErrorExpected) {
+                            String expectedErrorMessage =
+                                    getExpectedErrorMessage(classType, importType, memberType);
+                            if (compilationResult.message.matches(expectedErrorMessage)) {
+                                ++passed;
+                            } else {
+                                reportFailure(sources, String.format("Expected compilation failure message:\n" +
+                                                "%s\ngot message:\n%s",
+                                        expectedErrorMessage, compilationResult.message));
+                            }
+                        } else {
+                            reportFailure(sources, String.format("Unexpected compilation failure:\n%s",
+                                    compilationResult.message));
+                        }
+                    } else {
+                        if (isErrorExpected) {
+                            reportFailure(sources, "Expected compilation failure.");
+                        } else {
+                            ++passed;
+                        }
+                    }
+                }
+            }
+        }
+        String message = String.format(
+                "Total test cases run: %d, passed: %d, failed: %d.",
+                total, passed, total - passed);
+        if (passed != total) {
+            throw new RuntimeException(message);
+        }
+        echo(message);
+    }
+
+    private String getExpectedErrorMessage(ClassType classType, ImportType importType, MemberType memberType) {
+        String expectedErrorMessage;
+        if (importType == ImportType.IMPORT && classType == ClassType.CHILD_A &&
+                memberType == MemberType.CLASS) {
+            expectedErrorMessage = expectedErrorMessages[1];
+        } else {
+            expectedErrorMessage = expectedErrorMessages[0];
+        }
+        return expectedErrorMessage;
+    }
+
+    private void reportFailure(List<ToolBox.JavaSource> sources, String message) {
+        echo("Test case failed!");
+        printSources(sources);
+        echo(message);
+        echo();
+    }
+
+    private String generateSource(ClassType classType, MemberType memberType, ImportType importType) {
+        String importString = importType.generateImport(classType.getClassName(), memberType.getMemberType());
+        String statement;
+        if (importType.hasError(classType, memberType)) {
+            // if the source code has a compilation error, nothing is added.
+            // just to prevent the compiler from appending additional
+            // compilation errors to output
+            statement = "";
+        } else if (memberType == MemberType.STAR) {
+            // in case of import-on-demand, every class member is used
+            if (importType == ImportType.STATIC_IMPORT) {
+                statement = MemberType.CLASS.getStatement() + "\n    "
+                        + MemberType.FIELD.getStatement();
+                // an annotation does not have a static method.
+                if (classType != ClassType.D) {
+                    statement += "\n    " + MemberType.METHOD.getStatement() + "\n";
+                }
+            } else {
+                statement = classType != ClassType.CHILD_A
+                        ? MemberType.CLASS.getStatement() : "";
+            }
+        } else {
+            statement = memberType.getStatement();
+        }
+        return sourceTemplate
+                .replace("#IMPORT", importString)
+                .replace("#STATEMENT", statement);
+    }
+
+    private static class CompilationResult {
+        public final boolean isSuccessful;
+        public final String message;
+
+        public CompilationResult(boolean isSuccessful, String message) {
+            this.isSuccessful = isSuccessful;
+            this.message = message;
+        }
+    }
+
+    private CompilationResult compile(List<ToolBox.JavaSource> sources) {
+        StringWriter writer = new StringWriter();
+        JavaCompiler jc = ToolProvider.getSystemJavaCompiler();
+        Boolean call = jc.getTask(writer, null, null, Arrays.asList("-XDrawDiagnostics"), null, sources).call();
+        return new CompilationResult(call, writer.toString().replace(ToolBox.lineSeparator, "\n"));
+    }
+
+    public void printSources(List<ToolBox.JavaSource> sources) {
+        for (ToolBox.JavaSource javaSource : sources) {
+            echo(javaSource.getCharContent(true).toString());
+        }
+    }
+
+    public void echo() {
+        echo("");
+    }
+
+    public void echo(String output) {
+        printf(output + "\n");
+    }
+
+    public void printf(String template, Object...args) {
+        System.err.print(String.format(template, args).replace("\n", ToolBox.lineSeparator));
+    }
+
+    enum ClassType {
+        A("A",
+        "package pkg;\n" +
+        "class A {\n" +
+        "    static class Inner {}\n" +
+        "    static Object field;\n" +
+        "    static void method() {}\n" +
+        "}\n"
+        ),
+        B("B",
+        "package pkg;\n" +
+        "interface B {\n" +
+        "    static class Inner {}\n" +
+        "    static Object field = null;\n" +
+        "    static void method() {}\n" +
+        "}\n"
+        ),
+        C("C",
+        "package pkg;\n" +
+        "enum C {field;\n" +
+        "    static class Inner {}\n" +
+        "    static void method() {}\n" +
+        "}\n"
+        ),
+        D("D",
+        "package pkg;\n" +
+        "@interface D {\n" +
+        "    static class Inner {}\n" +
+        "    static Object field = null;\n" +
+        "}\n"
+        ),
+        CHILD_A("ChildA",
+        "package pkg;\n" +
+        "class ChildA extends A {}\n",
+        A);
+
+        private final String className;
+        private final String source;
+        private final ClassType parentType;
+
+        private ClassType(String className, String source) {
+            this(className, source, null);
+        }
+
+        private ClassType(String className, String source, ClassType classType) {
+            this.className = className;
+            this.source = source;
+            this.parentType = classType;
+        }
+
+        public String getClassName() {
+            return className;
+        }
+
+        public List<ToolBox.JavaSource> getSources() {
+            List<ToolBox.JavaSource> sourceList = new ArrayList<>();
+            ClassType current = this;
+            while (current != null) {
+                sourceList.add(new ToolBox.JavaSource(current.className, current.source));
+                current = current.parentType;
+            }
+            return sourceList;
+        }
+    }
+
+    enum MemberType {
+        CLASS("Inner", "Inner inner = null;"),
+        FIELD("field", "Object o = field;"),
+        METHOD("method", "method();"),
+        STAR("*", ""),
+        NOT_EXIST("NotExist", "");
+
+        private final String memberType;
+        private final String statement;
+
+        private MemberType(String memberType, String statement) {
+            this.memberType = memberType;
+            this.statement = statement;
+        }
+
+        public String getStatement() {
+            return statement;
+        }
+
+        public String getMemberType() {
+            return memberType;
+        }
+    }
+
+    enum ImportType {
+        IMPORT("import pkg.#CLASS_NAME.#MEMBER_NAME;"),
+        STATIC_IMPORT("import static pkg.#CLASS_NAME.#MEMBER_NAME;");
+
+        private final String importType;
+
+        private ImportType(String importType) {
+            this.importType = importType;
+        }
+
+        public String generateImport(String className, String memberName) {
+            return importType
+                    .replace("#CLASS_NAME", className)
+                    .replace("#MEMBER_NAME", memberName);
+        }
+
+        public boolean hasError(ClassType classType, MemberType memberType) {
+            switch (memberType) {
+                case FIELD:
+                    return this != ImportType.STATIC_IMPORT;
+                case METHOD:
+                    return this != ImportType.STATIC_IMPORT || classType == ClassType.D;
+                case NOT_EXIST:
+                    return true;
+                case CLASS:
+                    return classType.parentType != null && this != STATIC_IMPORT;
+                default:
+                    return false;
+            }
+        }
+    }
+}
diff --git a/langtools/test/tools/javac/importscope/NegativeCyclicDependencyTest.java b/langtools/test/tools/javac/importscope/NegativeCyclicDependencyTest.java
index a82ed6e63fb..339fa2a8cac 100644
--- a/langtools/test/tools/javac/importscope/NegativeCyclicDependencyTest.java
+++ b/langtools/test/tools/javac/importscope/NegativeCyclicDependencyTest.java
@@ -121,11 +121,13 @@ public class NegativeCyclicDependencyTest {
                 e.printStackTrace();
             }
         }
-        if (passed < testCases.size()) {
-            throw new RuntimeException(String.format("Test failed: " +
-                    "passed: %d, failed: %d, total: %d.",
-                    passed, testCases.size() - passed, testCases.size()));
+        String message = String.format(
+                "Total test cases run: %d, passed: %d, failed: %d.",
+                testCases.size(), passed, testCases.size() - passed);
+        if (passed != testCases.size()) {
+            throw new RuntimeException(message);
         }
+        echo(message);
     }
 
     private void reportFailure(TestCase testCase) {

From b41070012be43f4456d8225cdd0d3cab800a7768 Mon Sep 17 00:00:00 2001
From: Xueming Shen <sherman@openjdk.org>
Date: Wed, 10 Dec 2014 14:11:05 -0800
Subject: [PATCH 280/299] 8046219: (str spec) String(byte[], int, int, Charset)
 should be clearer when IndexOutOfBoundsException is thrown

To update the java doc to clarify the existing behavior

Reviewed-by: lancea
---
 .../share/classes/java/lang/String.java       | 23 ++++++++++---------
 1 file changed, 12 insertions(+), 11 deletions(-)

diff --git a/jdk/src/java.base/share/classes/java/lang/String.java b/jdk/src/java.base/share/classes/java/lang/String.java
index 92d381b3259..a44682a5b44 100644
--- a/jdk/src/java.base/share/classes/java/lang/String.java
+++ b/jdk/src/java.base/share/classes/java/lang/String.java
@@ -184,8 +184,8 @@ public final class String
      *         The length
      *
      * @throws  IndexOutOfBoundsException
-     *          If the {@code offset} and {@code count} arguments index
-     *          characters outside the bounds of the {@code value} array
+     *          If {@code offset} is negative, {@code count} is negative, or
+     *          {@code offset} is greater than {@code value.length - count}
      */
     public String(char value[], int offset, int count) {
         if (offset < 0) {
@@ -224,8 +224,8 @@ public final class String
      *          codePoints}
      *
      * @throws  IndexOutOfBoundsException
-     *          If the {@code offset} and {@code count} arguments index
-     *          characters outside the bounds of the {@code codePoints} array
+     *          If {@code offset} is negative, {@code count} is negative, or
+     *          {@code offset} is greater than {@code codePoints.length - count}
      *
      * @since  1.5
      */
@@ -297,7 +297,8 @@ public final class String
      *         The length
      *
      * @throws  IndexOutOfBoundsException
-     *          If the {@code offset} or {@code count} argument is invalid
+     *          If {@code offset} is negative, {@code count} is negative, or
+     *          {@code offset} is greater than {@code ascii.length - count}
      *
      * @see  #String(byte[], int)
      * @see  #String(byte[], int, int, java.lang.String)
@@ -401,8 +402,8 @@ public final class String
      *          If the named charset is not supported
      *
      * @throws  IndexOutOfBoundsException
-     *          If the {@code offset} and {@code length} arguments index
-     *          characters outside the bounds of the {@code bytes} array
+     *          If {@code offset} is negative, {@code length} is negative, or
+     *          {@code offset} is greater than {@code bytes.length - length}
      *
      * @since  1.1
      */
@@ -439,8 +440,8 @@ public final class String
      *         decode the {@code bytes}
      *
      * @throws  IndexOutOfBoundsException
-     *          If the {@code offset} and {@code length} arguments index
-     *          characters outside the bounds of the {@code bytes} array
+     *          If {@code offset} is negative, {@code length} is negative, or
+     *          {@code offset} is greater than {@code bytes.length - length}
      *
      * @since  1.6
      */
@@ -524,8 +525,8 @@ public final class String
      *         The number of bytes to decode
      *
      * @throws  IndexOutOfBoundsException
-     *          If the {@code offset} and the {@code length} arguments index
-     *          characters outside the bounds of the {@code bytes} array
+     *          If {@code offset} is negative, {@code length} is negative, or
+     *          {@code offset} is greater than {@code bytes.length - length}
      *
      * @since  1.1
      */

From bbcd1a03a920b400c6c87d928e36a7daa847c1d2 Mon Sep 17 00:00:00 2001
From: Tristan Yan <tristan.yan@oracle.com>
Date: Wed, 10 Dec 2014 16:38:01 -0800
Subject: [PATCH 281/299] 8067183: TEST_BUG:File locked when processing the
 cleanup on test
 jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java

Reviewed-by: joehw
---
 .../ptests/TransformerFactoryTest.java        | 24 +++++++------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java
index 1c92fd67316..45099ebb19c 100644
--- a/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/transform/ptests/TransformerFactoryTest.java
@@ -61,33 +61,25 @@ public class TransformerFactoryTest {
         String xmlFile = XML_DIR + "TransformerFactoryTest.xml";
         String xmlURI = "file:///" + XML_DIR;
 
-        try {
+        try (FileInputStream fis = new FileInputStream(xmlFile);
+                FileOutputStream fos = new FileOutputStream(outputFile);) {
             DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
 
             DocumentBuilder db = dbf.newDocumentBuilder();
-            Document doc = db.parse(new FileInputStream(xmlFile), xmlURI);
+            Document doc = db.parse(fis, xmlURI);
             DOMSource domSource = new DOMSource(doc);
             domSource.setSystemId(xmlURI);
-            StreamResult streamResult =new StreamResult(
-                new FileOutputStream(outputFile));
+            StreamResult streamResult = new StreamResult(fos);
             TransformerFactory tFactory = TransformerFactory.newInstance();
 
-            Source s = tFactory.getAssociatedStylesheet(domSource,"screen",
-                                           "Modern",null);
+            Source s = tFactory.getAssociatedStylesheet(domSource, "screen",
+                                           "Modern", null);
             Transformer t = tFactory.newTransformer();
-            t.transform(s,streamResult);
+            t.transform(s, streamResult);
             assertTrue(compareWithGold(goldFile, outputFile));
-        }catch (IOException | ParserConfigurationException
+        } catch (IOException | ParserConfigurationException
                 | TransformerException | SAXException ex) {
             failUnexpected(ex);
-        } finally {
-            try {
-                Path outputPath = Paths.get(outputFile);
-                if(Files.exists(outputPath))
-                    Files.delete(outputPath);
-            } catch (IOException ex) {
-                failCleanup(ex, outputFile);
-            }
         }
     }
 }

From 89cec235804a8d5436aec20c0f3c713205f48534 Mon Sep 17 00:00:00 2001
From: Otavio Santana <otaviojava@java.net>
Date: Thu, 11 Dec 2014 15:23:02 +0800
Subject: [PATCH 282/299] 8055723: Replace concat String to append in
 StringBuilder parameters (dev)

Reviewed-by: redestad, ulfzibis, weijun, prappo, igerasim, alanb
---
 .../share/classes/java/text/ChoiceFormat.java |  4 +-
 .../classes/sun/launcher/LauncherHelper.java  |  7 +--
 .../classes/sun/net/www/HeaderParser.java     | 14 +++--
 .../sun/security/ssl/HandshakeMessage.java    |  2 +-
 .../com/sun/jndi/cosnaming/CNNameParser.java  |  2 +-
 .../javax/management/MBeanPermission.java     |  4 +-
 .../modelmbean/RequiredModelMBean.java        | 57 +++++++++----------
 .../javax/management/openmbean/ArrayType.java |  4 +-
 .../share/classes/sun/management/Agent.java   |  2 +-
 .../sun/management/MappedMXBeanType.java      |  4 +-
 .../ldap/sasl/DefaultCallbackHandler.java     |  2 +-
 .../share/classes/javax/naming/NameImpl.java  |  2 +-
 .../sun/security/krb5/KrbException.java       |  9 +--
 .../krb5/internal/crypto/dk/DkCrypto.java     |  3 +-
 .../com/sun/security/sasl/CramMD5Base.java    |  3 +-
 .../security/sasl/digest/DigestMD5Base.java   |  3 +-
 .../encryption/AbstractSerializer.java        |  5 +-
 .../params/InclusiveNamespaces.java           |  2 +-
 .../security/utils/RFC2253Parser.java         |  8 +--
 .../hat/internal/model/JavaValueArray.java    | 20 +++----
 .../com/sun/tools/hat/internal/util/Misc.java |  4 +-
 .../sun/security/tools/jarsigner/Main.java    | 31 +++++-----
 .../share/classes/sun/tools/jps/Jps.java      |  8 +--
 .../sun/tools/jstat/RawOutputFormatter.java   |  2 +-
 .../sun/tools/jstat/SyntaxException.java      | 21 +++----
 .../classes/sun/tools/jconsole/ThreadTab.java |  2 +-
 .../jconsole/inspector/XArrayDataViewer.java  | 26 ++++-----
 .../sun/tools/jconsole/inspector/XTree.java   |  6 +-
 .../example/debug/expr/ParseException.java    |  2 +-
 .../example/debug/expr/TokenMgrError.java     |  2 +-
 .../com/sun/tools/jdi/VirtualMachineImpl.java |  6 +-
 .../sun/tools/jstatd/RemoteHostImpl.java      |  2 +-
 .../spi/nameservice/dns/DNSNameService.java   | 10 ++--
 .../security/tools/policytool/PolicyTool.java |  5 +-
 34 files changed, 140 insertions(+), 144 deletions(-)

diff --git a/jdk/src/java.base/share/classes/java/text/ChoiceFormat.java b/jdk/src/java.base/share/classes/java/text/ChoiceFormat.java
index f8bd9a90b59..601b019e886 100644
--- a/jdk/src/java.base/share/classes/java/text/ChoiceFormat.java
+++ b/jdk/src/java.base/share/classes/java/text/ChoiceFormat.java
@@ -272,7 +272,7 @@ public class ChoiceFormat extends NumberFormat {
             double tryLess = Math.abs(Math.IEEEremainder(less, 1.0d));
 
             if (tryLessOrEqual < tryLess) {
-                result.append(""+choiceLimits[i]);
+                result.append(choiceLimits[i]);
                 result.append('#');
             } else {
                 if (choiceLimits[i] == Double.POSITIVE_INFINITY) {
@@ -280,7 +280,7 @@ public class ChoiceFormat extends NumberFormat {
                 } else if (choiceLimits[i] == Double.NEGATIVE_INFINITY) {
                     result.append("-\u221E");
                 } else {
-                    result.append(""+less);
+                    result.append(less);
                 }
                 result.append('<');
             }
diff --git a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java
index 62c1b19b4c4..456c8120b71 100644
--- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java
+++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java
@@ -369,10 +369,9 @@ public enum LauncherHelper {
     static void appendVmErgoMessage(boolean isServerClass, String vm) {
         outBuf = outBuf.append(getLocalizedMessage("java.launcher.ergo.message1",
                 vm));
-        outBuf = (isServerClass)
-             ? outBuf.append(",\n" +
-                getLocalizedMessage("java.launcher.ergo.message2") + "\n\n")
-             : outBuf.append(".\n\n");
+        outBuf = (isServerClass) ? outBuf.append(",\n")
+                .append(getLocalizedMessage("java.launcher.ergo.message2"))
+                .append("\n\n") : outBuf.append(".\n\n");
     }
 
     /**
diff --git a/jdk/src/java.base/share/classes/sun/net/www/HeaderParser.java b/jdk/src/java.base/share/classes/sun/net/www/HeaderParser.java
index 3f1629fa8c6..f9db1df64de 100644
--- a/jdk/src/java.base/share/classes/sun/net/www/HeaderParser.java
+++ b/jdk/src/java.base/share/classes/sun/net/www/HeaderParser.java
@@ -220,21 +220,23 @@ public class HeaderParser {
 
     public String toString () {
         Iterator<String> k = keys();
-        StringBuffer sbuf = new StringBuffer();
-        sbuf.append ("{size="+asize+" nkeys="+nkeys+" ");
+        StringBuilder sb = new StringBuilder();
+        sb.append("{size=").append(asize).append(" nkeys=").append(nkeys)
+                .append(' ');
         for (int i=0; k.hasNext(); i++) {
             String key = k.next();
             String val = findValue (i);
             if (val != null && "".equals (val)) {
                 val = null;
             }
-            sbuf.append (" {"+key+(val==null?"":","+val)+"}");
+            sb.append(" {").append(key).append(val == null ? "" : "," + val)
+                    .append('}');
             if (k.hasNext()) {
-                sbuf.append (",");
+                sb.append (',');
             }
         }
-        sbuf.append (" }");
-        return new String (sbuf);
+        sb.append (" }");
+        return sb.toString();
     }
 
     public int findInt(String k, int Default) {
diff --git a/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java
index c7257e52e9c..972f540940c 100644
--- a/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java
@@ -1478,7 +1478,7 @@ class CertificateRequest extends HandshakeMessage
                 boolean opened = false;
                 for (SignatureAndHashAlgorithm signAlg : algorithms) {
                     if (opened) {
-                        sb.append(", " + signAlg.getAlgorithmName());
+                        sb.append(", ").append(signAlg.getAlgorithmName());
                     } else {
                         sb.append(signAlg.getAlgorithmName());
                         opened = true;
diff --git a/jdk/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNNameParser.java b/jdk/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNNameParser.java
index ebd0f05e65a..2b416941fc6 100644
--- a/jdk/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNNameParser.java
+++ b/jdk/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNNameParser.java
@@ -256,7 +256,7 @@ final public class CNNameParser implements NameParser {
     private static String stringifyComponent(NameComponent comp) {
         StringBuilder one = new StringBuilder(escape(comp.id));
         if (comp.kind != null && !comp.kind.equals("")) {
-            one.append(kindSeparator + escape(comp.kind));
+            one.append(kindSeparator).append(escape(comp.kind));
         }
         if (one.length() == 0) {
             return ""+kindSeparator;  // if neither id nor kind specified
diff --git a/jdk/src/java.management/share/classes/javax/management/MBeanPermission.java b/jdk/src/java.management/share/classes/javax/management/MBeanPermission.java
index 4a3442511a3..5aa18b70960 100644
--- a/jdk/src/java.management/share/classes/javax/management/MBeanPermission.java
+++ b/jdk/src/java.management/share/classes/javax/management/MBeanPermission.java
@@ -455,11 +455,11 @@ public class MBeanPermission extends Permission {
         name.append(className);
         if (member == null)
             member = "-";
-        name.append("#" + member);
+        name.append('#').append(member);
         if (objectName == null)
             name.append("[-]");
         else
-            name.append("[").append(objectName.getCanonicalName()).append("]");
+            name.append('[').append(objectName.getCanonicalName()).append(']');
 
         /* In the interests of legibility for Permission.toString(), we
            transform the empty string into "*".  */
diff --git a/jdk/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java b/jdk/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java
index d9323203a03..16110614cf6 100644
--- a/jdk/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java
+++ b/jdk/src/java.management/share/classes/javax/management/modelmbean/RequiredModelMBean.java
@@ -716,15 +716,14 @@ public class RequiredModelMBean
         }
 
         retStr.append("\nMBeanInfo for ModelMBean is:");
-        retStr.append("\nCLASSNAME: \t"+ info.getClassName());
-        retStr.append("\nDESCRIPTION: \t"+ info.getDescription());
+        retStr.append("\nCLASSNAME: \t").append(info.getClassName());
+        retStr.append("\nDESCRIPTION: \t").append(info.getDescription());
 
 
         try {
-            retStr.append("\nMBEAN DESCRIPTOR: \t"+
-                          info.getMBeanDescriptor());
+            retStr.append("\nMBEAN DESCRIPTOR: \t").append(info.getMBeanDescriptor());
         } catch (Exception e) {
-            retStr.append("\nMBEAN DESCRIPTOR: \t" + " is invalid");
+            retStr.append("\nMBEAN DESCRIPTOR: \t  is invalid");
         }
 
         retStr.append("\nATTRIBUTES");
@@ -734,13 +733,12 @@ public class RequiredModelMBean
             for (int i=0; i<attrInfo.length; i++) {
                 final ModelMBeanAttributeInfo attInfo =
                     (ModelMBeanAttributeInfo)attrInfo[i];
-                retStr.append(" ** NAME: \t"+ attInfo.getName());
-                retStr.append("    DESCR: \t"+ attInfo.getDescription());
-                retStr.append("    TYPE: \t"+ attInfo.getType() +
-                              "    READ: \t"+ attInfo.isReadable() +
-                              "    WRITE: \t"+ attInfo.isWritable());
-                retStr.append("    DESCRIPTOR: " +
-                              attInfo.getDescriptor().toString());
+                retStr.append(" ** NAME: \t").append(attInfo.getName());
+                retStr.append("    DESCR: \t").append(attInfo.getDescription());
+                retStr.append("    TYPE: \t").append(attInfo.getType())
+                        .append("    READ: \t").append(attInfo.isReadable())
+                        .append("    WRITE: \t").append(attInfo.isWritable());
+                retStr.append("    DESCRIPTOR: ").append(attInfo.getDescriptor());
             }
         } else {
             retStr.append(" ** No attributes **");
@@ -752,14 +750,13 @@ public class RequiredModelMBean
             for (int i=0; i<constrInfo.length; i++) {
                 final ModelMBeanConstructorInfo ctorInfo =
                     (ModelMBeanConstructorInfo)constrInfo[i];
-                retStr.append(" ** NAME: \t"+ ctorInfo.getName());
-                retStr.append("    DESCR: \t"+
-                              ctorInfo.getDescription());
-                retStr.append("    PARAM: \t"+
-                              ctorInfo.getSignature().length +
-                              " parameter(s)");
-                retStr.append("    DESCRIPTOR: " +
-                              ctorInfo.getDescriptor().toString());
+                retStr.append(" ** NAME: \t").append(ctorInfo.getName());
+                retStr.append("    DESCR: \t").append(ctorInfo.getDescription());
+                retStr.append("    PARAM: \t")
+                        .append(ctorInfo.getSignature().length)
+                        .append(" parameter(s)");
+                retStr.append("    DESCRIPTOR: ").append(
+                        ctorInfo.getDescriptor());
             }
         } else {
             retStr.append(" ** No Constructors **");
@@ -771,13 +768,12 @@ public class RequiredModelMBean
             for (int i=0; i<opsInfo.length; i++) {
                 final ModelMBeanOperationInfo operInfo =
                     (ModelMBeanOperationInfo)opsInfo[i];
-                retStr.append(" ** NAME: \t"+ operInfo.getName());
-                retStr.append("    DESCR: \t"+ operInfo.getDescription());
-                retStr.append("    PARAM: \t"+
-                              operInfo.getSignature().length +
-                              " parameter(s)");
-                retStr.append("    DESCRIPTOR: " +
-                              operInfo.getDescriptor().toString());
+                retStr.append(" ** NAME: \t").append(operInfo.getName());
+                retStr.append("    DESCR: \t").append(operInfo.getDescription());
+                retStr.append("    PARAM: \t")
+                        .append(operInfo.getSignature().length)
+                        .append(" parameter(s)");
+                retStr.append("    DESCRIPTOR: ").append(operInfo.getDescriptor());
             }
         } else {
             retStr.append(" ** No operations ** ");
@@ -790,10 +786,9 @@ public class RequiredModelMBean
             for (int i=0; i<notifInfo.length; i++) {
                 final ModelMBeanNotificationInfo nInfo =
                     (ModelMBeanNotificationInfo)notifInfo[i];
-                retStr.append(" ** NAME: \t"+ nInfo.getName());
-                retStr.append("    DESCR: \t"+ nInfo.getDescription());
-                retStr.append("    DESCRIPTOR: " +
-                              nInfo.getDescriptor().toString());
+                retStr.append(" ** NAME: \t").append(nInfo.getName());
+                retStr.append("    DESCR: \t").append(nInfo.getDescription());
+                retStr.append("    DESCRIPTOR: ").append(nInfo.getDescriptor());
             }
         } else {
             retStr.append(" ** No notifications **");
diff --git a/jdk/src/java.management/share/classes/javax/management/openmbean/ArrayType.java b/jdk/src/java.management/share/classes/javax/management/openmbean/ArrayType.java
index c59bd156b97..6c49e09f663 100644
--- a/jdk/src/java.management/share/classes/javax/management/openmbean/ArrayType.java
+++ b/jdk/src/java.management/share/classes/javax/management/openmbean/ArrayType.java
@@ -458,8 +458,8 @@ public class ArrayType<T> extends OpenType<T> {
             elementType = at.getElementOpenType();
             isPrimitiveArray = at.isPrimitiveArray();
         }
-        StringBuilder result =
-            new StringBuilder(dimension + "-dimension array of ");
+        StringBuilder result = new StringBuilder();
+        result.append(dimension).append("-dimension array of ");
         final String elementClassName = elementType.getClassName();
         if (isPrimitiveArray) {
             // Convert from wrapper type to primitive type
diff --git a/jdk/src/java.management/share/classes/sun/management/Agent.java b/jdk/src/java.management/share/classes/sun/management/Agent.java
index 226986be994..3128ca442ea 100644
--- a/jdk/src/java.management/share/classes/sun/management/Agent.java
+++ b/jdk/src/java.management/share/classes/sun/management/Agent.java
@@ -499,7 +499,7 @@ public class Agent {
         } else {
             StringBuilder message = new StringBuilder(params[0]);
             for (int i = 1; i < params.length; i++) {
-                message.append(" " + params[i]);
+                message.append(' ').append(params[i]);
             }
             error(key, message.toString());
         }
diff --git a/jdk/src/java.management/share/classes/sun/management/MappedMXBeanType.java b/jdk/src/java.management/share/classes/sun/management/MappedMXBeanType.java
index 9bfcbd9c682..04ab87153f8 100644
--- a/jdk/src/java.management/share/classes/sun/management/MappedMXBeanType.java
+++ b/jdk/src/java.management/share/classes/sun/management/MappedMXBeanType.java
@@ -289,7 +289,7 @@ public abstract class MappedMXBeanType {
             if (et.isPrimitive()) {
                 className = new StringBuilder(c.getName());
             } else {
-                className.append("L" + baseElementType.getTypeName() + ";");
+                className.append('L').append(baseElementType.getTypeName()).append(';');
             }
             try {
                 mappedTypeClass = Class.forName(className.toString());
@@ -385,7 +385,7 @@ public abstract class MappedMXBeanType {
             if (elementType instanceof Class && ((Class) elementType).isPrimitive()) {
                 className = new StringBuilder(gat.toString());
             } else {
-                className.append("L" + baseElementType.getTypeName() + ";");
+                className.append('L').append(baseElementType.getTypeName()).append(';');
             }
             try {
                 mappedTypeClass = Class.forName(className.toString());
diff --git a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java
index 3e0098eaaa4..a1d53b277f2 100644
--- a/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java
+++ b/jdk/src/java.naming/share/classes/com/sun/jndi/ldap/sasl/DefaultCallbackHandler.java
@@ -90,7 +90,7 @@ final class DefaultCallbackHandler implements CallbackHandler {
                         if (selected == -1) {
                             StringBuilder allChoices = new StringBuilder();
                             for (int j = 0; j <  choices.length; j++) {
-                                allChoices.append(choices[j] + ",");
+                                allChoices.append(choices[j]).append(',');
                             }
                             throw new IOException("Cannot match " +
                                 "'java.naming.security.sasl.realm' property value, '" +
diff --git a/jdk/src/java.naming/share/classes/javax/naming/NameImpl.java b/jdk/src/java.naming/share/classes/javax/naming/NameImpl.java
index 5cc8d59c0fe..8b45c8813ef 100644
--- a/jdk/src/java.naming/share/classes/javax/naming/NameImpl.java
+++ b/jdk/src/java.naming/share/classes/javax/naming/NameImpl.java
@@ -170,7 +170,7 @@ class NameImpl {
                 endQuote = one ? syntaxEndQuote1 : syntaxEndQuote2;
 
                 i += syntaxTypevalSeparator.length();
-                answer.append(syntaxTypevalSeparator+beginQuote); // add back
+                answer.append(syntaxTypevalSeparator).append(beginQuote); // add back
 
                 // consume string until matching quote
                 for (i += beginQuote.length();
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbException.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbException.java
index 0d09e61c470..2690cad54c0 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbException.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/KrbException.java
@@ -96,13 +96,14 @@ public class KrbException extends Exception {
 
 
     public String krbErrorMessage() {
-        StringBuilder strbuf = new StringBuilder("krb_error " + returnCode);
+        StringBuilder sb = new StringBuilder();
+        sb.append("krb_error ").append(returnCode);
         String msg =  getMessage();
         if (msg != null) {
-            strbuf.append(" ");
-            strbuf.append(msg);
+            sb.append(" ");
+            sb.append(msg);
         }
-        return strbuf.toString();
+        return sb.toString();
     }
 
     /**
diff --git a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/DkCrypto.java b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/DkCrypto.java
index 7bc1d650f07..af4b3aaef2c 100644
--- a/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/DkCrypto.java
+++ b/jdk/src/java.security.jgss/share/classes/sun/security/krb5/internal/crypto/dk/DkCrypto.java
@@ -640,8 +640,7 @@ public abstract class DkCrypto {
 
         for (int i = 0; i < digest.length; i++) {
             if ((digest[i] & 0x000000ff) < 0x10) {
-                digestString.append("0" +
-                    Integer.toHexString(digest[i] & 0x000000ff));
+                digestString.append('0').append(Integer.toHexString(digest[i] & 0x000000ff));
             } else {
                 digestString.append(
                     Integer.toHexString(digest[i] & 0x000000ff));
diff --git a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java
index 1b5a653acba..3e0e6ba3d57 100644
--- a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java
+++ b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/CramMD5Base.java
@@ -196,8 +196,7 @@ abstract class CramMD5Base {
 
         for (i = 0; i < digest.length; i++) {
             if ((digest[i] & 0x000000ff) < 0x10) {
-                digestString.append("0" +
-                    Integer.toHexString(digest[i] & 0x000000ff));
+                digestString.append('0').append(Integer.toHexString(digest[i] & 0x000000ff));
             } else {
                 digestString.append(
                     Integer.toHexString(digest[i] & 0x000000ff));
diff --git a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java
index 24262fca0c6..138f21509ae 100644
--- a/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java
+++ b/jdk/src/java.security.sasl/share/classes/com/sun/security/sasl/digest/DigestMD5Base.java
@@ -391,8 +391,7 @@ abstract class DigestMD5Base extends AbstractSaslImpl {
 
         for (int i = 0; i < digest.length; i ++) {
             if ((digest[i] & 0x000000ff) < 0x10) {
-                digestString.append("0"+
-                    Integer.toHexString(digest[i] & 0x000000ff));
+                digestString.append('0').append(Integer.toHexString(digest[i] & 0x000000ff));
             } else {
                 digestString.append(
                     Integer.toHexString(digest[i] & 0x000000ff));
diff --git a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/encryption/AbstractSerializer.java b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/encryption/AbstractSerializer.java
index a21f1488ec7..33c07d73a4c 100644
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/encryption/AbstractSerializer.java
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/encryption/AbstractSerializer.java
@@ -235,14 +235,15 @@ public abstract class AbstractSerializer implements Serializer {
                     String nodeName = att.getNodeName();
                     if ((nodeName.equals("xmlns") || nodeName.startsWith("xmlns:"))
                         && !storedNamespaces.containsKey(att.getNodeName())) {
-                        sb.append(" " + nodeName + "=\"" + att.getNodeValue() + "\"");
+                        sb.append(' ').append(nodeName).append("=\"")
+                                .append(att.getNodeValue()).append('"');
                         storedNamespaces.put(nodeName, att.getNodeValue());
                     }
                 }
             }
             wk = wk.getParentNode();
         }
-        sb.append(">" + source + "</dummy>");
+        sb.append('>').append(source).append("</dummy>");
         return sb.toString();
     }
 
diff --git a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/InclusiveNamespaces.java b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/InclusiveNamespaces.java
index 2b6f5da2f16..4582819afc7 100644
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/InclusiveNamespaces.java
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/transforms/params/InclusiveNamespaces.java
@@ -85,7 +85,7 @@ public class InclusiveNamespaces extends ElementProxy implements TransformParam
             if (prefix.equals("xmlns")) {
                 sb.append("#default ");
             } else {
-                sb.append(prefix + " ");
+                sb.append(prefix).append(' ');
             }
         }
 
diff --git a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/RFC2253Parser.java b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/RFC2253Parser.java
index 1ab91701b6a..803a3e97e52 100644
--- a/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/RFC2253Parser.java
+++ b/jdk/src/java.xml.crypto/share/classes/com/sun/org/apache/xml/internal/security/utils/RFC2253Parser.java
@@ -88,7 +88,7 @@ public class RFC2253Parser {
                 l += countQuotes(DN, j, k);
 
                 if ((k > 0) && (DN.charAt(k - 1) != '\\') && (l % 2) == 0) {
-                    sb.append(parseRDN(DN.substring(i, k).trim(), toXml) + ",");
+                    sb.append(parseRDN(DN.substring(i, k).trim(), toXml)).append(',');
 
                     i = k + 1;
                     l = 0;
@@ -121,7 +121,7 @@ public class RFC2253Parser {
             l += countQuotes(str, j, k);
 
             if ((k > 0) && (str.charAt(k - 1) != '\\') && (l % 2) == 0) {
-                sb.append(parseATAV(trim(str.substring(i, k)), toXml) + "+");
+                sb.append(parseATAV(trim(str.substring(i, k)), toXml)).append('+');
 
                 i = k + 1;
                 l = 0;
@@ -369,7 +369,7 @@ public class RFC2253Parser {
         int k;
 
         for (int j = 0; (k = string.indexOf("\\20", j)) >= 0; j = k + 3) {
-            sb.append(trim(string.substring(i, k)) + "\\ ");
+            sb.append(trim(string.substring(i, k))).append("\\ ");
 
             i = k + 3;
         }
@@ -418,7 +418,7 @@ public class RFC2253Parser {
             l += countQuotes(str, j, k);
 
             if ((k > 0) && (str.charAt(k - 1) != '\\') && (l % 2) == 0) {
-                sb.append(trim(str.substring(i, k)) + replace);
+                sb.append(trim(str.substring(i, k))).append(replace);
 
                 i = k + 1;
                 l = 0;
diff --git a/jdk/src/jdk.dev/share/classes/com/sun/tools/hat/internal/model/JavaValueArray.java b/jdk/src/jdk.dev/share/classes/com/sun/tools/hat/internal/model/JavaValueArray.java
index d1795328773..f03fd68b82a 100644
--- a/jdk/src/jdk.dev/share/classes/com/sun/tools/hat/internal/model/JavaValueArray.java
+++ b/jdk/src/jdk.dev/share/classes/com/sun/tools/hat/internal/model/JavaValueArray.java
@@ -346,12 +346,12 @@ public class JavaValueArray extends JavaLazyReadObject
 
     public String valueString(boolean bigLimit) {
         // Char arrays deserve special treatment
-        StringBuffer result;
+        StringBuilder result;
         byte[] value = getValue();
         int max = value.length;
         byte elementSignature = getElementType();
         if (elementSignature == 'C')  {
-            result = new StringBuffer();
+            result = new StringBuilder();
             for (int i = 0; i < value.length; ) {
                 char val = charAt(i, value);
                 result.append(val);
@@ -362,7 +362,7 @@ public class JavaValueArray extends JavaLazyReadObject
             if (bigLimit) {
                 limit = 1000;
             }
-            result = new StringBuffer("{");
+            result = new StringBuilder("{");
             int num = 0;
             for (int i = 0; i < value.length; ) {
                 if (num > 0) {
@@ -386,37 +386,37 @@ public class JavaValueArray extends JavaLazyReadObject
                     }
                     case 'B': {
                         int val = 0xFF & byteAt(i, value);
-                        result.append("0x" + Integer.toString(val, 16));
+                        result.append("0x").append(Integer.toString(val, 16));
                         i++;
                         break;
                     }
                     case 'S': {
                         short val = shortAt(i, value);
                         i += 2;
-                        result.append("" + val);
+                        result.append(val);
                         break;
                     }
                     case 'I': {
                         int val = intAt(i, value);
                         i += 4;
-                        result.append("" + val);
+                        result.append(val);
                         break;
                     }
                     case 'J': {         // long
                         long val = longAt(i, value);
-                        result.append("" + val);
+                        result.append(val);
                         i += 8;
                         break;
                     }
                     case 'F': {
                         float val = floatAt(i, value);
-                        result.append("" + val);
+                        result.append(val);
                         i += 4;
                         break;
                     }
                     case 'D': {         // double
                         double val = doubleAt(i, value);
-                        result.append("" + val);
+                        result.append(val);
                         i += 8;
                         break;
                     }
@@ -425,7 +425,7 @@ public class JavaValueArray extends JavaLazyReadObject
                     }
                 }
             }
-            result.append("}");
+            result.append('}');
         }
         return result.toString();
     }
diff --git a/jdk/src/jdk.dev/share/classes/com/sun/tools/hat/internal/util/Misc.java b/jdk/src/jdk.dev/share/classes/com/sun/tools/hat/internal/util/Misc.java
index 84a9291003c..943342c7c57 100644
--- a/jdk/src/jdk.dev/share/classes/com/sun/tools/hat/internal/util/Misc.java
+++ b/jdk/src/jdk.dev/share/classes/com/sun/tools/hat/internal/util/Misc.java
@@ -97,11 +97,11 @@ public class Misc {
             } else if (ch == '&') {
                 sb.append("&amp;");
             } else if (ch < ' ') {
-                sb.append("&#" + Integer.toString(ch) + ";");
+                sb.append("&#").append((int)ch).append(';');
             } else {
                 int c = (ch & 0xFFFF);
                 if (c > 127) {
-                    sb.append("&#" + Integer.toString(c) + ";");
+                    sb.append("&#").append(c).append(';');
                 } else {
                     sb.append(ch);
                 }
diff --git a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java b/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java
index 4c4f86e2470..12483c8b357 100644
--- a/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java
+++ b/jdk/src/jdk.dev/share/classes/sun/security/tools/jarsigner/Main.java
@@ -676,14 +676,13 @@ public class Main {
                             ((man.getAttributes(name) != null) ||
                              (man.getAttributes("./"+name) != null) ||
                              (man.getAttributes("/"+name) != null));
-                        sb.append(
-                          (isSigned ? rb.getString("s") : rb.getString("SPACE")) +
-                          (inManifest ? rb.getString("m") : rb.getString("SPACE")) +
-                          (inStore ? rb.getString("k") : rb.getString("SPACE")) +
-                          (inScope ? rb.getString("i") : rb.getString("SPACE")) +
-                          ((inStoreOrScope & NOT_ALIAS) != 0 ?"X":" ") +
-                          rb.getString("SPACE"));
-                        sb.append("|");
+                        sb.append(isSigned ? rb.getString("s") : rb.getString("SPACE"))
+                                .append(inManifest ? rb.getString("m") : rb.getString("SPACE"))
+                                .append(inStore ? rb.getString("k") : rb.getString("SPACE"))
+                                .append(inScope ? rb.getString("i") : rb.getString("SPACE"))
+                                .append((inStoreOrScope & NOT_ALIAS) != 0 ? 'X' : ' ')
+                                .append(rb.getString("SPACE"));
+                        sb.append('|');
                     }
 
                     // When -certs provided, display info has extra empty
@@ -704,11 +703,15 @@ public class Main {
                         // Print no info for unsigned entries when -verbose:all,
                         // to be consistent with old behavior.
                         if (signatureRelated(name)) {
-                            sb.append("\n" + tab + rb.getString(
-                                    ".Signature.related.entries.") + "\n\n");
+                            sb.append('\n')
+                                    .append(tab)
+                                    .append(rb
+                                            .getString(".Signature.related.entries."))
+                                    .append("\n\n");
                         } else {
-                            sb.append("\n" + tab + rb.getString(
-                                    ".Unsigned.entries.") + "\n\n");
+                            sb.append('\n').append(tab)
+                                    .append(rb.getString(".Unsigned.entries."))
+                                    .append("\n\n");
                         }
                     }
 
@@ -1605,8 +1608,8 @@ public class Main {
                 // No more warning, we alreay have hasExpiredCert or notYetValidCert
             } else {
                 chainNotValidated = true;
-                sb.append(tab + rb.getString(".CertPath.not.validated.") +
-                        e.getLocalizedMessage() + "]\n");   // TODO
+                sb.append(tab).append(rb.getString(".CertPath.not.validated."))
+                        .append(e.getLocalizedMessage()).append("]\n"); // TODO
             }
         }
         String result = sb.toString();
diff --git a/jdk/src/jdk.jcmd/share/classes/sun/tools/jps/Jps.java b/jdk/src/jdk.jcmd/share/classes/sun/tools/jps/Jps.java
index 33125516690..67369b7abb7 100644
--- a/jdk/src/jdk.jcmd/share/classes/sun/tools/jps/Jps.java
+++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/jps/Jps.java
@@ -92,28 +92,28 @@ public class Jps {
                     vm = monitoredHost.getMonitoredVm(id, 0);
 
                     errorString = " -- main class information unavailable";
-                    output.append(" " + MonitoredVmUtil.mainClass(vm,
+                    output.append(' ').append(MonitoredVmUtil.mainClass(vm,
                             arguments.showLongPaths()));
 
                     if (arguments.showMainArgs()) {
                         errorString = " -- main args information unavailable";
                         String mainArgs = MonitoredVmUtil.mainArgs(vm);
                         if (mainArgs != null && mainArgs.length() > 0) {
-                            output.append(" " + mainArgs);
+                            output.append(' ').append(mainArgs);
                         }
                     }
                     if (arguments.showVmArgs()) {
                         errorString = " -- jvm args information unavailable";
                         String jvmArgs = MonitoredVmUtil.jvmArgs(vm);
                         if (jvmArgs != null && jvmArgs.length() > 0) {
-                          output.append(" " + jvmArgs);
+                          output.append(' ').append(jvmArgs);
                         }
                     }
                     if (arguments.showVmFlags()) {
                         errorString = " -- jvm flags information unavailable";
                         String jvmFlags = MonitoredVmUtil.jvmFlags(vm);
                         if (jvmFlags != null && jvmFlags.length() > 0) {
-                            output.append(" " + jvmFlags);
+                            output.append(' ').append(jvmFlags);
                         }
                     }
 
diff --git a/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/RawOutputFormatter.java b/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/RawOutputFormatter.java
index 614af446348..cbd129cbe50 100644
--- a/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/RawOutputFormatter.java
+++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/RawOutputFormatter.java
@@ -50,7 +50,7 @@ public class RawOutputFormatter implements OutputFormatter {
             StringBuilder headerBuilder = new StringBuilder();
             for (Iterator<Monitor> i = logged.iterator(); i.hasNext(); /* empty */ ) {
                 Monitor m = i.next();
-                headerBuilder.append(m.getName() + " ");
+                headerBuilder.append(m.getName()).append(' ');
             }
             header = headerBuilder.toString();
         }
diff --git a/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/SyntaxException.java b/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/SyntaxException.java
index 1e1b2a1fe4e..540cb540761 100644
--- a/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/SyntaxException.java
+++ b/jdk/src/jdk.jcmd/share/classes/sun/tools/jstat/SyntaxException.java
@@ -65,24 +65,21 @@ public class SyntaxException extends ParserException {
     public SyntaxException(int lineno, Set<String> expected, Token found) {
         StringBuilder msg = new StringBuilder();
 
-        msg.append("Syntax error at line " + lineno + ": Expected one of \'");
+        msg.append("Syntax error at line ").append(lineno)
+                .append(": Expected one of \'");
 
-        boolean first = true;
-        for (Iterator<String> i = expected.iterator(); i.hasNext(); /* empty */) {
-            String keyWord = i.next();
-            if (first) {
-                msg.append(keyWord);
-                first = false;
-            } else {
-                msg.append("|" + keyWord);
-            }
+        for (String keyWord : expected) {
+            msg.append(keyWord).append('|');
+        }
+        if (!expected.isEmpty()) {
+            msg.setLength(msg.length() - 1);
         }
 
-        msg.append("\', Found " + found.toMessage());
-        message = msg.toString();
+        message = msg.append("\', Found ").append(found.toMessage()).toString();
     }
 
     public String getMessage() {
         return message;
     }
 }
+
diff --git a/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/ThreadTab.java b/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/ThreadTab.java
index a38b9d68408..7f8236d9b2a 100644
--- a/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/ThreadTab.java
+++ b/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/ThreadTab.java
@@ -368,7 +368,7 @@ class ThreadTab extends Tab implements ActionListener, DocumentListener, ListSel
                             sb.append(Messages.STACK_TRACE);
                             int index = 0;
                             for (StackTraceElement e : ti.getStackTrace()) {
-                                sb.append(e.toString()+"\n");
+                                sb.append(e).append('\n');
                                 if (monitors != null) {
                                     for (MonitorInfo mi : monitors) {
                                         if (mi.getLockedStackDepth() == index) {
diff --git a/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XArrayDataViewer.java b/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XArrayDataViewer.java
index 58f795cef21..3c1bfd8f799 100644
--- a/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XArrayDataViewer.java
+++ b/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XArrayDataViewer.java
@@ -79,25 +79,25 @@ class XArrayDataViewer {
             String textColor = String.format("%06x",
                                              foreground.getRGB() & 0xFFFFFF);
             StringBuilder sb = new StringBuilder();
-            sb.append("<html><body text=#"+textColor+"><table width=\"100%\">");
+            sb.append("<html><body text=#").append(textColor).append("><table width=\"100%\">");
             for (int i = 0; i < arr.length; i++) {
                 if (i % 2 == 0) {
-                    sb.append("<tr style=\"background-color: " +
-                            evenRowColorStr + "\"><td><pre>" +
-                            (arr[i] == null ?
-                                arr[i] : htmlize(arr[i].toString())) +
-                            "</pre></td></tr>");
+                    sb.append("<tr style=\"background-color: ")
+                            .append(evenRowColorStr).append("\"><td><pre>")
+                            .append(arr[i] == null ?
+                                    arr[i] : htmlize(arr[i].toString()))
+                      .append("</pre></td></tr>");
                 } else {
-                    sb.append("<tr style=\"background-color: " +
-                            oddRowColorStr + "\"><td><pre>" +
-                            (arr[i] == null ?
-                                arr[i] : htmlize(arr[i].toString())) +
-                            "</pre></td></tr>");
+                    sb.append("<tr style=\"background-color: ")
+                            .append(oddRowColorStr).append("\"><td><pre>")
+                            .append(arr[i] == null ?
+                                    arr[i] : htmlize(arr[i].toString()))
+                            .append("</pre></td></tr>");
                 }
             }
             if (arr.length == 0) {
-                sb.append("<tr style=\"background-color: " +
-                        evenRowColorStr + "\"><td></td></tr>");
+                sb.append("<tr style=\"background-color: ")
+                        .append(evenRowColorStr).append("\"><td></td></tr>");
             }
             sb.append("</table></body></html>");
             arrayEditor.setText(sb.toString());
diff --git a/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XTree.java b/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XTree.java
index ed5658cc9ae..aaa1ab6a6bd 100644
--- a/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XTree.java
+++ b/jdk/src/jdk.jconsole/share/classes/sun/tools/jconsole/inspector/XTree.java
@@ -507,13 +507,13 @@ public class XTree extends JTree {
         // key order defined by the "orderedKeyPropertyList"
         for (String key : orderedKeyPropertyList) {
             if (map.containsKey(key)) {
-                sb.append(key + "=" + map.get(key) + ",");
+                sb.append(key).append('=').append(map.get(key)).append(',');
                 map.remove(key);
             }
         }
         // Add the remaining key/value pairs to the buffer
         for (Map.Entry<String, String> entry : map.entrySet()) {
-            sb.append(entry.getKey() + "=" + entry.getValue() + ",");
+            sb.append(entry.getKey()).append('=').append(entry.getValue()).append(',');
         }
         String orderedKeyPropertyListString = sb.toString();
         orderedKeyPropertyListString = orderedKeyPropertyListString.substring(
@@ -622,7 +622,7 @@ public class XTree extends JTree {
                     //
                     StringBuilder sb = new StringBuilder();
                     for (MBeanParameterInfo mbpi : mboi.getSignature()) {
-                        sb.append(mbpi.getType() + ",");
+                        sb.append(mbpi.getType()).append(',');
                     }
                     String signature = sb.toString();
                     if (signature.length() > 0) {
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/ParseException.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/ParseException.java
index 77b0980c282..7af191a10f7 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/ParseException.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/ParseException.java
@@ -198,7 +198,7 @@ public class ParseException extends Exception {
            default:
               if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
                  String s = "0000" + Integer.toString(ch, 16);
-                 retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+                 retval.append("\\u").append(s.substring(s.length() - 4, s.length()));
               } else {
                  retval.append(ch);
               }
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java
index f6408697b48..675a46be27e 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/example/debug/expr/TokenMgrError.java
@@ -107,7 +107,7 @@ public class TokenMgrError extends Error
         default:
           if ((ch = str.charAt(i)) < 0x20 || ch > 0x7e) {
             String s = "0000" + Integer.toString(ch, 16);
-            retval.append("\\u" + s.substring(s.length() - 4, s.length()));
+            retval.append("\\u").append(s.substring(s.length() - 4, s.length()));
           } else {
             retval.append(ch);
           }
diff --git a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java
index c03ed4de31b..6a0eeb688be 100644
--- a/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java
+++ b/jdk/src/jdk.jdi/share/classes/com/sun/tools/jdi/VirtualMachineImpl.java
@@ -881,12 +881,12 @@ class VirtualMachineImpl extends MirrorImpl
             } else if (tag == JDWP.TypeTag.ARRAY) {
                 sb.append("ArrayType");
             } else {
-                sb.append("UNKNOWN TAG: " + tag);
+                sb.append("UNKNOWN TAG: ").append(tag);
             }
             if (signature != null) {
-                sb.append(", signature='" + signature + "'");
+                sb.append(", signature='").append(signature).append('\'');
             }
-            sb.append(", id=" + id);
+            sb.append(", id=").append(id);
             vm.printTrace(sb.toString());
         }
         if (id == 0) {
diff --git a/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/RemoteHostImpl.java b/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/RemoteHostImpl.java
index a35465fe8af..20368a4cc0d 100644
--- a/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/RemoteHostImpl.java
+++ b/jdk/src/jdk.jvmstat/share/classes/sun/tools/jstatd/RemoteHostImpl.java
@@ -68,7 +68,7 @@ public class RemoteHostImpl implements RemoteHost, HostListener {
 
         sb.append("local://").append(lvmid).append("@localhost");
         if (mode != null) {
-            sb.append("?mode=" + mode);
+            sb.append("?mode=").append(mode);
         }
 
         String vmidStr = sb.toString();
diff --git a/jdk/src/jdk.naming.dns/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java b/jdk/src/jdk.naming.dns/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java
index 2abeddc5d88..647ef007c2f 100644
--- a/jdk/src/jdk.naming.dns/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java
+++ b/jdk/src/jdk.naming.dns/share/classes/sun/net/spi/nameservice/dns/DNSNameService.java
@@ -463,12 +463,12 @@ public final class DNSNameService implements NameService {
 
     // ---------
 
-    private static void appendIfLiteralAddress(String addr, StringBuffer sb) {
+    private static void appendIfLiteralAddress(String addr, StringBuilder sb) {
         if (IPAddressUtil.isIPv4LiteralAddress(addr)) {
-            sb.append("dns://" + addr + " ");
+            sb.append("dns://").append(addr).append(' ');
         } else {
             if (IPAddressUtil.isIPv6LiteralAddress(addr)) {
-                sb.append("dns://[" + addr + "] ");
+                sb.append("dns://[").append(addr).append("] ");
             }
         }
     }
@@ -478,7 +478,7 @@ public final class DNSNameService implements NameService {
      *         corresponding to the supplied List of nameservers.
      */
     private static String createProviderURL(List<String> nsList) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         for (String s: nsList) {
             appendIfLiteralAddress(s, sb);
         }
@@ -491,7 +491,7 @@ public final class DNSNameService implements NameService {
      *         contained in the provided str.
      */
     private static String createProviderURL(String str) {
-        StringBuffer sb = new StringBuffer();
+        StringBuilder sb = new StringBuilder();
         StringTokenizer st = new StringTokenizer(str, ",");
         while (st.hasMoreTokens()) {
             appendIfLiteralAddress(st.nextToken(), sb);
diff --git a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/PolicyTool.java b/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/PolicyTool.java
index ad5603d2eb8..fde04357822 100644
--- a/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/PolicyTool.java
+++ b/jdk/src/jdk.runtime/share/classes/sun/security/tools/policytool/PolicyTool.java
@@ -980,8 +980,9 @@ class PolicyEntry {
                                 grantEntry.principals.listIterator();
             while (list.hasNext()) {
                 PolicyParser.PrincipalEntry pppe = list.next();
-                sb.append(" Principal " + pppe.getDisplayClass() + " " +
-                    pppe.getDisplayName(true));
+                sb.append(" Principal ").append(pppe.getDisplayClass())
+                        .append(' ')
+                        .append(pppe.getDisplayName(true));
                 if (list.hasNext()) sb.append(", ");
             }
             result = sb.toString();

From 7d75c8da1af934bac60a64670c14a96bfa0c8b1d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= <hannesw@openjdk.org>
Date: Thu, 11 Dec 2014 12:01:17 +0100
Subject: [PATCH 283/299] 8066932: __noSuchMethod__ binds to this-object
 without proper guard

Reviewed-by: attila, lagergren
---
 .../internal/runtime/ScriptObject.java        |  9 ++--
 nashorn/test/script/basic/JDK-8066932.js      | 48 +++++++++++++++++++
 2 files changed, 53 insertions(+), 4 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8066932.js

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
index 3f605910248..c47497de1af 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
@@ -2333,8 +2333,9 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
         }
 
         final ScriptFunction func = (ScriptFunction)value;
-        final Object         thiz = scopeCall && func.isStrict() ? ScriptRuntime.UNDEFINED : this;
+        final Object         thiz = scopeCall && func.isStrict() ? UNDEFINED : this;
         // TODO: It'd be awesome if we could bind "name" without binding "this".
+        // Since we're binding this we must use an identity guard here.
         return new GuardedInvocation(
                 MH.dropArguments(
                         MH.constant(
@@ -2342,9 +2343,9 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
                                 func.makeBoundFunction(thiz, new Object[] { name })),
                         0,
                         Object.class),
-                NashornGuards.getMapGuard(getMap(), explicitInstanceOfCheck),
-                (SwitchPoint)null,
-                explicitInstanceOfCheck ? null : ClassCastException.class);
+                NashornGuards.combineGuards(
+                        NashornGuards.getIdentityGuard(this),
+                        NashornGuards.getMapGuard(getMap(), true)));
     }
 
     /**
diff --git a/nashorn/test/script/basic/JDK-8066932.js b/nashorn/test/script/basic/JDK-8066932.js
new file mode 100644
index 00000000000..6dda1e09365
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066932.js
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * JDK-8066932: __noSuchMethod__ binds to this-object without proper guard
+ *
+ * @test
+ * @run
+ */
+
+function C(id) {
+    this.id = id;
+}
+
+C.prototype.__noSuchMethod__ = function(name, args) {
+    return this.id;
+};
+
+function test(id) {
+    var c = new C(id);
+    return c.nonExistingMethod();
+}
+
+for (var i = 0; i < 30; i++) {
+    if (test(i) !== i) {
+        throw new Error("Wrong result from noSuchMethod in iteration " + i);
+    }
+}

From cb8bd7875b57e46254a2823adffdfc7aad4f2367 Mon Sep 17 00:00:00 2001
From: Konstantin Shefov <kshefov@openjdk.org>
Date: Thu, 11 Dec 2014 15:10:35 +0300
Subject: [PATCH 284/299] 8066798: [TEST] Make java/lang/invoke/LFCaching tests
 use lib/testlibrary/jdk/testlibrary/TimeLimitedRunner.java to define their
 number of iterations

Reviewed-by: iignatyev, vlivanov
---
 .../LFCaching/LFGarbageCollectedTest.java     |   1 -
 .../invoke/LFCaching/LambdaFormTestCase.java  | 164 +++++++++++-------
 2 files changed, 97 insertions(+), 68 deletions(-)

diff --git a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
index f0f6b034dbb..89a1ecf8e91 100644
--- a/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
+++ b/jdk/test/java/lang/invoke/LFCaching/LFGarbageCollectedTest.java
@@ -26,7 +26,6 @@
  * @bug 8046703
  * @summary Test verifies that lambda forms are garbage collected
  * @author kshefov
- * @ignore 8057020
  * @library /lib/testlibrary/jsr292 /lib/testlibrary
  * @build TestMethods
  * @build LambdaFormTestCase
diff --git a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
index 94722cf72df..9fcc45eae3f 100644
--- a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
+++ b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java
@@ -31,6 +31,7 @@ import java.util.Collection;
 import java.util.List;
 import java.util.function.Function;
 import jdk.testlibrary.Utils;
+import jdk.testlibrary.TimeLimitedRunner;
 
 /**
  * Lambda forms caching test case class. Contains all necessary test routines to
@@ -45,7 +46,7 @@ public abstract class LambdaFormTestCase {
     private final static String INTERNAL_FORM_METHOD_NAME = "internalForm";
     private static final double ITERATIONS_TO_CODE_CACHE_SIZE_RATIO
             = 45 / (128.0 * 1024 * 1024);
-    private static final long TIMEOUT = Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT);
+    private static final long TIMEOUT = Helper.IS_THOROUGH ? 0L : (long) (Utils.adjustTimeout(Utils.DEFAULT_TEST_TIMEOUT) * 0.9);
 
     /**
      * Reflection link to {@code j.l.i.MethodHandle.internalForm} method. It is
@@ -68,13 +69,98 @@ public abstract class LambdaFormTestCase {
         }
 
         gcInfo = ManagementFactory.getGarbageCollectorMXBeans();
-        if (gcInfo.size() == 0)  {
+        if (gcInfo.size() == 0) {
             throw new Error("No GarbageCollectorMXBeans found.");
         }
     }
 
     private final TestMethods testMethod;
     private long gcCountAtStart;
+
+    private static class TestRun {
+
+        final Function<TestMethods, LambdaFormTestCase> ctor;
+        final Collection<TestMethods> testMethods;
+        final long totalIterations;
+        long doneIterations;
+        long testCounter;
+        long failCounter;
+        boolean passed;
+
+        TestRun(Function<TestMethods, LambdaFormTestCase> ctor, Collection<TestMethods> testMethods) {
+            this.ctor = ctor;
+            this.testMethods = testMethods;
+            long testCaseNum = testMethods.size();
+            long iterations = Math.max(1, Helper.TEST_LIMIT / testCaseNum);
+            System.out.printf("Number of iterations according to -DtestLimit is %d (%d cases)%n",
+                    iterations, iterations * testCaseNum);
+            HotSpotDiagnosticMXBean hsDiagBean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
+            long codeCacheSize = Long.parseLong(
+                    hsDiagBean.getVMOption("ReservedCodeCacheSize").getValue());
+            System.out.printf("Code cache size is %d bytes%n", codeCacheSize);
+            long iterationsByCodeCacheSize = (long) (codeCacheSize
+                    * ITERATIONS_TO_CODE_CACHE_SIZE_RATIO);
+            long nonProfiledCodeCacheSize = Long.parseLong(
+                    hsDiagBean.getVMOption("NonProfiledCodeHeapSize").getValue());
+            System.out.printf("Non-profiled code cache size is %d bytes%n", nonProfiledCodeCacheSize);
+            long iterationsByNonProfiledCodeCacheSize = (long) (nonProfiledCodeCacheSize
+                    * ITERATIONS_TO_CODE_CACHE_SIZE_RATIO);
+            System.out.printf("Number of iterations limited by code cache size is %d (%d cases)%n",
+                    iterationsByCodeCacheSize, iterationsByCodeCacheSize * testCaseNum);
+            System.out.printf("Number of iterations limited by non-profiled code cache size is %d (%d cases)%n",
+                    iterationsByNonProfiledCodeCacheSize, iterationsByNonProfiledCodeCacheSize * testCaseNum);
+            iterations = Math.min(iterationsByCodeCacheSize,
+                    Math.min(iterations, iterationsByNonProfiledCodeCacheSize));
+            if (iterations == 0) {
+                System.out.println("Warning: code cache size is too small to provide at"
+                        + " least one iteration! Test will try to do one iteration.");
+                iterations = 1;
+            }
+            System.out.printf("Number of iterations is set to %d (%d cases)%n",
+                    iterations, iterations * testCaseNum);
+            System.out.flush();
+            totalIterations = iterations;
+            doneIterations = 0L;
+            testCounter = 0L;
+            failCounter = 0L;
+            passed = true;
+        }
+
+        Boolean doIteration() {
+            if (doneIterations >= totalIterations) {
+                return false;
+            }
+            System.err.println(String.format("Iteration %d:", doneIterations));
+            for (TestMethods testMethod : testMethods) {
+                LambdaFormTestCase testCase = ctor.apply(testMethod);
+                try {
+                    System.err.printf("Tested LF caching feature with MethodHandles.%s method.%n",
+                            testCase.getTestMethod().name);
+                    testCase.doTest();
+                    System.err.println("PASSED");
+                } catch (Throwable t) {
+                    t.printStackTrace();
+                    System.err.printf("FAILED. Caused by %s%n", t.getMessage());
+                    passed = false;
+                    failCounter++;
+                }
+                    testCounter++;
+                }
+            doneIterations++;
+            return true;
+        }
+
+        void checkPassed() {
+            if (!passed) {
+                throw new Error(String.format("%d of %d test cases FAILED! %n"
+                        + "Rerun the test with the same \"-Dseed=\" option as in the log file!",
+                        failCounter, testCounter));
+            } else {
+                System.err.printf("All %d test cases PASSED!%n", testCounter);
+            }
+        }
+    }
+
     /**
      * Test case constructor. Generates test cases with random method types for
      * given methods form {@code j.l.i.MethodHandles} class.
@@ -108,71 +194,15 @@ public abstract class LambdaFormTestCase {
      * @param testMethods list of test methods
      */
     public static void runTests(Function<TestMethods, LambdaFormTestCase> ctor, Collection<TestMethods> testMethods) {
-        boolean passed = true;
-        int testCounter = 0;
-        int failCounter = 0;
-        long testCaseNum = testMethods.size();
-        long iterations = Math.max(1, Helper.TEST_LIMIT / testCaseNum);
-        System.out.printf("Number of iterations according to -DtestLimit is %d (%d cases)%n",
-                iterations, iterations * testCaseNum);
-        HotSpotDiagnosticMXBean hsDiagBean = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class);
-        long codeCacheSize = Long.parseLong(
-                hsDiagBean.getVMOption("ReservedCodeCacheSize").getValue());
-        System.out.printf("Code cache size is %d bytes%n", codeCacheSize);
-        long iterationsByCodeCacheSize = (long) (codeCacheSize
-                * ITERATIONS_TO_CODE_CACHE_SIZE_RATIO);
-        long nonProfiledCodeCacheSize = Long.parseLong(
-                hsDiagBean.getVMOption("NonProfiledCodeHeapSize").getValue());
-        System.out.printf("Non-profiled code cache size is %d bytes%n", nonProfiledCodeCacheSize);
-        long iterationsByNonProfiledCodeCacheSize = (long) (nonProfiledCodeCacheSize
-                * ITERATIONS_TO_CODE_CACHE_SIZE_RATIO);
-        System.out.printf("Number of iterations limited by code cache size is %d (%d cases)%n",
-                iterationsByCodeCacheSize, iterationsByCodeCacheSize * testCaseNum);
-        System.out.printf("Number of iterations limited by non-profiled code cache size is %d (%d cases)%n",
-                iterationsByNonProfiledCodeCacheSize, iterationsByNonProfiledCodeCacheSize * testCaseNum);
-        iterations = Math.min(iterationsByCodeCacheSize,
-                Math.min(iterations, iterationsByNonProfiledCodeCacheSize));
-        if (iterations == 0) {
-            System.out.println("Warning: code cache size is too small to provide at"
-                    + " least one iteration! Test will try to do one iteration.");
-            iterations = 1;
-        }
-        System.out.printf("Number of iterations is set to %d (%d cases)%n",
-                iterations, iterations * testCaseNum);
-        System.out.flush();
-        long startTime = System.currentTimeMillis();
-        for (long i = 0; i < iterations; i++) {
-            System.err.println(String.format("Iteration %d:", i));
-            for (TestMethods testMethod : testMethods) {
-                LambdaFormTestCase testCase = ctor.apply(testMethod);
-                try {
-                    System.err.printf("Tested LF caching feature with MethodHandles.%s method.%n",
-                            testCase.getTestMethod().name);
-                    testCase.doTest();
-                    System.err.println("PASSED");
-                } catch (Throwable t) {
-                    t.printStackTrace();
-                    System.err.println("FAILED");
-                    passed = false;
-                    failCounter++;
-                }
-                testCounter++;
-            }
-            long passedTime = System.currentTimeMillis() - startTime;
-            long avgIterTime = passedTime / (i + 1);
-            long remainTime = TIMEOUT - passedTime;
-            if (avgIterTime > 2 * remainTime) {
-                System.err.printf("Stopping iterations because of lack of time.%n"
-                        + "Increase timeout factor for more iterations.%n");
-                break;
-            }
-        }
-        if (!passed) {
-            throw new Error(String.format("%d of %d test cases FAILED! %n"
-                    + "Rerun the test with the same \"-Dseed=\" option as in the log file!",
-                    failCounter, testCounter));
-        } else {
-            System.err.println(String.format("All %d test cases PASSED!", testCounter));
+        LambdaFormTestCase.TestRun run =
+                new LambdaFormTestCase.TestRun(ctor, testMethods);
+        TimeLimitedRunner runner = new TimeLimitedRunner(TIMEOUT, 4.0d, run::doIteration);
+        try {
+            runner.call();
+        } catch (Exception ex) {
+            System.err.println("FAILED");
+            throw new Error("Unexpected error!", ex);
         }
+        run.checkPassed();
     }
 }

From c2cd1906ded7b1804e8362b986a5bc5cdb0e479e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= <hannesw@openjdk.org>
Date: Thu, 11 Dec 2014 15:39:58 +0100
Subject: [PATCH 285/299] 8066669: dust.js performance regression caused by
 primitive field conversion

Reviewed-by: attila, sundar
---
 .../internal/codegen/CodeGenerator.java       | 22 +++----
 .../jdk/nashorn/internal/codegen/Lower.java   | 31 +++++++++-
 .../internal/codegen/MethodEmitter.java       | 28 ++++++---
 .../internal/codegen/SharedScopeCall.java     |  2 +-
 .../jdk/nashorn/internal/ir/AccessNode.java   | 10 ++++
 .../internal/runtime/ScriptObject.java        |  3 +-
 nashorn/test/script/basic/JDK-8066669.js      | 58 +++++++++++++++++++
 .../test/script/basic/JDK-8066669.js.EXPECTED | 13 +++++
 nashorn/test/script/basic/list.js.EXPECTED    |  2 +-
 9 files changed, 146 insertions(+), 23 deletions(-)
 create mode 100644 nashorn/test/script/basic/JDK-8066669.js
 create mode 100644 nashorn/test/script/basic/JDK-8066669.js.EXPECTED

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
index 5cc931cb7c3..4a583f7842e 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -465,10 +465,10 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
             // If this is either __FILE__, __DIR__, or __LINE__ then load the property initially as Object as we'd convert
             // it anyway for replaceLocationPropertyPlaceholder.
             if(identNode.isCompileTimePropertyName()) {
-                method.dynamicGet(Type.OBJECT, identNode.getSymbol().getName(), flags, identNode.isFunction());
+                method.dynamicGet(Type.OBJECT, identNode.getSymbol().getName(), flags, identNode.isFunction(), false);
                 replaceCompileTimeProperty();
             } else {
-                dynamicGet(identNode.getSymbol().getName(), flags, identNode.isFunction());
+                dynamicGet(identNode.getSymbol().getName(), flags, identNode.isFunction(), false);
             }
         }
     }
@@ -486,7 +486,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
 
     private MethodEmitter storeFastScopeVar(final Symbol symbol, final int flags) {
         loadFastScopeProto(symbol, true);
-        method.dynamicSet(symbol.getName(), flags | CALLSITE_FAST_SCOPE);
+        method.dynamicSet(symbol.getName(), flags | CALLSITE_FAST_SCOPE, false);
         return method;
     }
 
@@ -745,7 +745,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
                     @Override
                     void consumeStack() {
                         final int flags = getCallSiteFlags();
-                        dynamicGet(accessNode.getProperty(), flags, accessNode.isFunction());
+                        dynamicGet(accessNode.getProperty(), flags, accessNode.isFunction(), accessNode.isIndex());
                     }
                 }.emit(baseAlreadyOnStack ? 1 : 0);
                 return false;
@@ -1449,7 +1449,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
                         // NOTE: not using a nested OptimisticOperation on this dynamicGet, as we expect to get back
                         // a callable object. Nobody in their right mind would optimistically type this call site.
                         assert !node.isOptimistic();
-                        method.dynamicGet(node.getType(), node.getProperty(), flags, true);
+                        method.dynamicGet(node.getType(), node.getProperty(), flags, true, node.isIndex());
                         method.swap();
                         argCount = loadArgs(args);
                     }
@@ -3165,7 +3165,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
             if (isFastScope(identSymbol)) {
                 storeFastScopeVar(identSymbol, flags);
             } else {
-                method.dynamicSet(identNode.getName(), flags);
+                method.dynamicSet(identNode.getName(), flags, false);
             }
         } else {
             final Type identType = identNode.getType();
@@ -4269,7 +4269,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
                         if (isFastScope(symbol)) {
                             storeFastScopeVar(symbol, flags);
                         } else {
-                            method.dynamicSet(node.getName(), flags);
+                            method.dynamicSet(node.getName(), flags, false);
                         }
                     } else {
                         final Type storeType = assignNode.getType();
@@ -4286,7 +4286,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
 
                 @Override
                 public boolean enterAccessNode(final AccessNode node) {
-                    method.dynamicSet(node.getProperty(), getCallSiteFlags());
+                    method.dynamicSet(node.getProperty(), getCallSiteFlags(), node.isIndex());
                     return false;
                 }
 
@@ -4624,11 +4624,11 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
          * @param isMethod whether we're preferrably retrieving a function
          * @return the current method emitter
          */
-        MethodEmitter dynamicGet(final String name, final int flags, final boolean isMethod) {
+        MethodEmitter dynamicGet(final String name, final int flags, final boolean isMethod, final boolean isIndex) {
             if(isOptimistic) {
-                return method.dynamicGet(getOptimisticCoercedType(), name, getOptimisticFlags(flags), isMethod);
+                return method.dynamicGet(getOptimisticCoercedType(), name, getOptimisticFlags(flags), isMethod, isIndex);
             }
-            return method.dynamicGet(resultBounds.within(expression.getType()), name, nonOptimisticFlags(flags), isMethod);
+            return method.dynamicGet(resultBounds.within(expression.getType()), name, nonOptimisticFlags(flags), isMethod, isIndex);
         }
 
         MethodEmitter dynamicGetIndex(final int flags, final boolean isMethod) {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
index 6f8f3e980cc..a30e79a49d4 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java
@@ -34,6 +34,8 @@ import java.util.Arrays;
 import java.util.Collections;
 import java.util.List;
 import java.util.ListIterator;
+import java.util.regex.Pattern;
+import jdk.nashorn.internal.ir.AccessNode;
 import jdk.nashorn.internal.ir.BaseNode;
 import jdk.nashorn.internal.ir.BinaryNode;
 import jdk.nashorn.internal.ir.Block;
@@ -52,6 +54,7 @@ import jdk.nashorn.internal.ir.FunctionNode;
 import jdk.nashorn.internal.ir.FunctionNode.CompilationState;
 import jdk.nashorn.internal.ir.IdentNode;
 import jdk.nashorn.internal.ir.IfNode;
+import jdk.nashorn.internal.ir.IndexNode;
 import jdk.nashorn.internal.ir.JumpStatement;
 import jdk.nashorn.internal.ir.LabelNode;
 import jdk.nashorn.internal.ir.LexicalContext;
@@ -93,6 +96,10 @@ final class Lower extends NodeOperatorVisitor<BlockLexicalContext> implements Lo
 
     private final DebugLogger log;
 
+    // Conservative pattern to test if element names consist of characters valid for identifiers.
+    // This matches any non-zero length alphanumeric string including _ and $ and not starting with a digit.
+    private static Pattern SAFE_PROPERTY_NAME = Pattern.compile("[a-zA-Z_$][\\w$]*");
+
     /**
      * Constructor.
      */
@@ -140,7 +147,7 @@ final class Lower extends NodeOperatorVisitor<BlockLexicalContext> implements Lo
             }
         });
 
-        this.log       = initLogger(compiler.getContext());
+        this.log = initLogger(compiler.getContext());
     }
 
     @Override
@@ -180,6 +187,28 @@ final class Lower extends NodeOperatorVisitor<BlockLexicalContext> implements Lo
         return false;
     }
 
+    @Override
+    public Node leaveIndexNode(final IndexNode indexNode) {
+        final String name = getConstantPropertyName(indexNode.getIndex());
+        if (name != null) {
+            // If index node is a constant property name convert index node to access node.
+            assert Token.descType(indexNode.getToken()) == TokenType.LBRACKET;
+            return new AccessNode(indexNode.getToken(), indexNode.getFinish(), indexNode.getBase(), name);
+        }
+        return super.leaveIndexNode(indexNode);
+    }
+
+    // If expression is a primitive literal that is not an array index and does return its string value. Else return null.
+    private static String getConstantPropertyName(final Expression expression) {
+        if (expression instanceof LiteralNode.PrimitiveLiteralNode) {
+            final Object value = ((LiteralNode) expression).getValue();
+            if (value instanceof String && SAFE_PROPERTY_NAME.matcher((String) value).matches()) {
+                return (String) value;
+            }
+        }
+        return null;
+    }
+
     @Override
     public Node leaveExpressionStatement(final ExpressionStatement expressionStatement) {
         final Expression expr = expressionStatement.getExpression();
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java
index 962687c946f..ffeb59934c9 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java
@@ -2213,10 +2213,10 @@ public class MethodEmitter implements Emitter {
      * @param name      name of property
      * @param flags     call site flags
      * @param isMethod  should it prefer retrieving methods
-     *
+     * @param isIndex   is this an index operation?
      * @return the method emitter
      */
-    MethodEmitter dynamicGet(final Type valueType, final String name, final int flags, final boolean isMethod) {
+    MethodEmitter dynamicGet(final Type valueType, final String name, final int flags, final boolean isMethod, final boolean isIndex) {
         if (name.length() > LARGE_STRING_THRESHOLD) { // use getIndex for extremely long names
             return load(name).dynamicGetIndex(valueType, flags, isMethod);
         }
@@ -2229,8 +2229,8 @@ public class MethodEmitter implements Emitter {
         }
 
         popType(Type.SCOPE);
-        method.visitInvokeDynamicInsn((isMethod ? "dyn:getMethod|getProp|getElem:" : "dyn:getProp|getElem|getMethod:") +
-                NameCodec.encode(name), Type.getMethodDescriptor(type, Type.OBJECT), LINKERBOOTSTRAP, flags);
+        method.visitInvokeDynamicInsn(dynGetOperation(isMethod, isIndex) + ':' + NameCodec.encode(name),
+                Type.getMethodDescriptor(type, Type.OBJECT), LINKERBOOTSTRAP, flags);
 
         pushType(type);
         convert(valueType); //most probably a nop
@@ -2243,8 +2243,9 @@ public class MethodEmitter implements Emitter {
      *
      * @param name  name of property
      * @param flags call site flags
+     * @param isIndex is this an index operation?
      */
-    void dynamicSet(final String name, final int flags) {
+    void dynamicSet(final String name, final int flags, final boolean isIndex) {
         if (name.length() > LARGE_STRING_THRESHOLD) { // use setIndex for extremely long names
             load(name).swap().dynamicSetIndex(flags);
             return;
@@ -2261,7 +2262,8 @@ public class MethodEmitter implements Emitter {
         popType(type);
         popType(Type.SCOPE);
 
-        method.visitInvokeDynamicInsn("dyn:setProp|setElem:" + NameCodec.encode(name), methodDescriptor(void.class, Object.class, type.getTypeClass()), LINKERBOOTSTRAP, flags);
+        method.visitInvokeDynamicInsn(dynSetOperation(isIndex) + ':' + NameCodec.encode(name),
+                methodDescriptor(void.class, Object.class, type.getTypeClass()), LINKERBOOTSTRAP, flags);
     }
 
      /**
@@ -2294,7 +2296,7 @@ public class MethodEmitter implements Emitter {
 
         final String signature = Type.getMethodDescriptor(resultType, Type.OBJECT /*e.g STRING->OBJECT*/, index);
 
-        method.visitInvokeDynamicInsn(isMethod ? "dyn:getMethod|getElem|getProp" : "dyn:getElem|getProp|getMethod", signature, LINKERBOOTSTRAP, flags);
+        method.visitInvokeDynamicInsn(dynGetOperation(isMethod, true), signature, LINKERBOOTSTRAP, flags);
         pushType(resultType);
 
         if (result.isBoolean()) {
@@ -2508,6 +2510,18 @@ public class MethodEmitter implements Emitter {
         }
     }
 
+    private static String dynGetOperation(final boolean isMethod, final boolean isIndex) {
+        if (isMethod) {
+            return isIndex ? "dyn:getMethod|getElem|getProp" : "dyn:getMethod|getProp|getElem";
+        } else {
+            return isIndex ? "dyn:getElem|getProp|getMethod" : "dyn:getProp|getElem|getMethod";
+        }
+    }
+
+    private static String dynSetOperation(final boolean isIndex) {
+        return isIndex ? "dyn:setElem|setProp" : "dyn:setProp|setElem";
+    }
+
     private Type emitLocalVariableConversion(final LocalVariableConversion conversion, final boolean onlySymbolLiveValue) {
         final Type from = conversion.getFrom();
         final Type to = conversion.getTo();
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SharedScopeCall.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SharedScopeCall.java
index 56da4e00384..078324ccfba 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SharedScopeCall.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/SharedScopeCall.java
@@ -156,7 +156,7 @@ class SharedScopeCall {
         assert !isCall || valueType.isObject(); // Callables are always objects
         // If flags are optimistic, but we're doing a call, remove optimistic flags from the getter, as they obviously
         // only apply to the call.
-        method.dynamicGet(valueType, symbol.getName(), isCall ? CodeGenerator.nonOptimisticFlags(flags) : flags, isCall);
+        method.dynamicGet(valueType, symbol.getName(), isCall ? CodeGenerator.nonOptimisticFlags(flags) : flags, isCall, false);
 
         // If this is a get we're done, otherwise call the value as function.
         if (isCall) {
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/AccessNode.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/AccessNode.java
index 315ee395b92..b8b648202d3 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/AccessNode.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/AccessNode.java
@@ -28,6 +28,8 @@ package jdk.nashorn.internal.ir;
 import jdk.nashorn.internal.codegen.types.Type;
 import jdk.nashorn.internal.ir.annotations.Immutable;
 import jdk.nashorn.internal.ir.visitor.NodeVisitor;
+import jdk.nashorn.internal.parser.Token;
+import jdk.nashorn.internal.parser.TokenType;
 
 /**
  * IR representation of a property access (period operator.)
@@ -101,6 +103,14 @@ public final class AccessNode extends BaseNode {
         return property;
     }
 
+    /**
+     * Return true if this node represents an index operation normally represented as {@link IndexNode}.
+     * @return true if an index access.
+     */
+    public boolean isIndex() {
+        return Token.descType(getToken()) == TokenType.LBRACKET;
+    }
+
     private AccessNode setBase(final Expression base) {
         if (this.base == base) {
             return this;
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
index c47497de1af..90244bc06d7 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
@@ -2001,12 +2001,11 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
 
         if (find == null) {
             switch (operator) {
+            case "getElem": // getElem only gets here if element name is constant, so treat it like a property access
             case "getProp":
                 return noSuchProperty(desc, request);
             case "getMethod":
                 return noSuchMethod(desc, request);
-            case "getElem":
-                return createEmptyGetter(desc, explicitInstanceOfCheck, name);
             default:
                 throw new AssertionError(operator); // never invoked with any other operation
             }
diff --git a/nashorn/test/script/basic/JDK-8066669.js b/nashorn/test/script/basic/JDK-8066669.js
new file mode 100644
index 00000000000..ea5a2860cac
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066669.js
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * JDK-8066669: dust.js performance regression caused by primitive field conversion
+ *
+ * @test
+ * @run
+ */
+
+// Make sure index access on Java objects is working as expected.
+var map = new java.util.HashMap();
+
+map["foo"] = "bar";
+map[1] = 2;
+map[false] = true;
+map[null] = 0;
+
+print(map);
+
+var keys =  map.keySet().iterator();
+
+while(keys.hasNext()) {
+    var key = keys.next();
+    print(typeof key, key);
+}
+
+print(typeof map["foo"], map["foo"]);
+print(typeof map[1], map[1]);
+print(typeof map[false], map[false]);
+print(typeof map[null], map[null]);
+
+print(map.foo);
+print(map.false);
+print(map.null);
+
+map.foo = "baz";
+print(map);
diff --git a/nashorn/test/script/basic/JDK-8066669.js.EXPECTED b/nashorn/test/script/basic/JDK-8066669.js.EXPECTED
new file mode 100644
index 00000000000..4af5381706a
--- /dev/null
+++ b/nashorn/test/script/basic/JDK-8066669.js.EXPECTED
@@ -0,0 +1,13 @@
+{null=0, 1=2, false=true, foo=bar}
+object null
+number 1
+boolean false
+string foo
+string bar
+number 2
+boolean true
+number 0
+bar
+null
+null
+{null=0, 1=2, false=true, foo=baz}
diff --git a/nashorn/test/script/basic/list.js.EXPECTED b/nashorn/test/script/basic/list.js.EXPECTED
index 47f3bd4fec1..3e4109828aa 100644
--- a/nashorn/test/script/basic/list.js.EXPECTED
+++ b/nashorn/test/script/basic/list.js.EXPECTED
@@ -10,7 +10,7 @@ bar
 l[0]=foo
 l[1]=a
 l[0.9]=null
-l['blah']=null
+l['blah']=undefined
 l[size_name]()=2
 java.lang.IndexOutOfBoundsException: Index: 2, Size: 2
 java.lang.IndexOutOfBoundsException: Index: Infinity, Size: 2

From a36baa5d156c3714a8ff2238808dddedbe13ca70 Mon Sep 17 00:00:00 2001
From: Dmitry Samersoff <dsamersoff@openjdk.org>
Date: Thu, 11 Dec 2014 06:49:12 -0800
Subject: [PATCH 286/299] 8067030: JDWP crash in transport_startTransport on
 OOM

Check for result of jvmtiAllocate

Reviewed-by: jbachorik, sspitsyn
---
 .../share/native/libjdwp/transport.c          | 24 ++++++++++++++-----
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/transport.c b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/transport.c
index c05d39c4267..b8e47acdf41 100644
--- a/jdk/src/jdk.jdwp.agent/share/native/libjdwp/transport.c
+++ b/jdk/src/jdk.jdwp.agent/share/native/libjdwp/transport.c
@@ -66,8 +66,10 @@ printLastError(jdwpTransportEnv *t, jdwpTransportError err)
         len = (int)strlen(msg);
         maxlen = len+len/2+2; /* Should allow for plenty of room */
         utf8msg = (jbyte*)jvmtiAllocate(maxlen+1);
-        (void)utf8FromPlatform(msg, len, utf8msg, maxlen);
-        utf8msg[maxlen] = 0;
+        if (utf8msg != NULL) {
+           (void)utf8FromPlatform(msg, len, utf8msg, maxlen);
+           utf8msg[maxlen] = 0;
+        }
     }
     if (rv == JDWPTRANSPORT_ERROR_NONE) {
         ERROR_MESSAGE(("transport error %d: %s",err, utf8msg));
@@ -391,6 +393,10 @@ launch(char *command, char *name, char *address)
     /* Convert commandLine from UTF-8 to platform encoding */
     len = (int)strlen(commandLine);
     buf = jvmtiAllocate(len*3+3);
+    if (buf == NULL) {
+        jvmtiDeallocate(commandLine);
+        return JDWP_ERROR(OUT_OF_MEMORY);
+    }
     (void)utf8ToPlatform((jbyte*)commandLine, len, buf, len*3+3);
 
     /* Exec commandLine */
@@ -447,21 +453,23 @@ transport_startTransport(jboolean isServer, char *name, char *address,
         if (info == NULL) {
             return JDWP_ERROR(OUT_OF_MEMORY);
         }
-        info->name = jvmtiAllocate((int)strlen(name)+1);
-        (void)strcpy(info->name, name);
-        info->address = NULL;
         info->timeout = timeout;
+
+        info->name = jvmtiAllocate((int)strlen(name)+1);
         if (info->name == NULL) {
             serror = JDWP_ERROR(OUT_OF_MEMORY);
             goto handleError;
         }
+        (void)strcpy(info->name, name);
+
+        info->address = NULL;
         if (address != NULL) {
             info->address = jvmtiAllocate((int)strlen(address)+1);
-            (void)strcpy(info->address, address);
             if (info->address == NULL) {
                 serror = JDWP_ERROR(OUT_OF_MEMORY);
                 goto handleError;
             }
+            (void)strcpy(info->address, address);
         }
 
         info->transport = trans;
@@ -478,6 +486,10 @@ transport_startTransport(jboolean isServer, char *name, char *address,
          */
         len = (int)strlen(name) + (int)strlen(retAddress) + 2; /* ':' and '\0' */
         prop_value = (char*)jvmtiAllocate(len);
+        if (prop_value == NULL) {
+            serror = JDWP_ERROR(OUT_OF_MEMORY);
+            goto handleError;
+        }
         strcpy(prop_value, name);
         strcat(prop_value, ":");
         strcat(prop_value, retAddress);

From a7a2c827801a1cf64a66395c987577e77383849c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hannes=20Walln=C3=B6fer?= <hannesw@openjdk.org>
Date: Thu, 11 Dec 2014 19:15:47 +0100
Subject: [PATCH 287/299] 8067219: NPE in ScriptObject.clone() when running
 with object fields

Reviewed-by: attila, lagergren
---
 .../internal/codegen/CodeGenerator.java       |  2 +-
 .../internal/runtime/ScriptObject.java        |  4 +-
 .../script/basic/es6/for-let-object-fields.js | 81 +++++++++++++++++++
 .../es6/for-let-object-fields.js.EXPECTED     | 33 ++++++++
 nashorn/test/script/basic/es6/for-let.js      |  3 +-
 5 files changed, 120 insertions(+), 3 deletions(-)
 create mode 100644 nashorn/test/script/basic/es6/for-let-object-fields.js
 create mode 100644 nashorn/test/script/basic/es6/for-let-object-fields.js.EXPECTED

diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
index 4a583f7842e..32173a6c543 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java
@@ -3283,7 +3283,7 @@ final class CodeGenerator extends NodeOperatorVisitor<CodeGeneratorLexicalContex
             emitContinueLabel(continueLabel, liveLocalsOnContinue);
         }
 
-        if (loopNode.hasPerIterationScope() && lc.getParentBlock().needsScope()) {
+        if (loopNode.hasPerIterationScope() && lc.getCurrentBlock().needsScope()) {
             // ES6 for loops with LET init need a new scope for each iteration. We just create a shallow copy here.
             method.loadCompilerConstant(SCOPE);
             method.invoke(virtualCallNoLookup(ScriptObject.class, "copy", ScriptObject.class));
diff --git a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
index 90244bc06d7..c3eca18fee1 100644
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java
@@ -3710,7 +3710,9 @@ public abstract class ScriptObject implements PropertyAccess, Cloneable {
         final ScriptObject clone = (ScriptObject) super.clone();
         if (objectSpill != null) {
             clone.objectSpill = objectSpill.clone();
-            clone.primitiveSpill = primitiveSpill.clone();
+            if (primitiveSpill != null) {
+                clone.primitiveSpill = primitiveSpill.clone();
+            }
         }
         clone.arrayData = arrayData.copy();
         return clone;
diff --git a/nashorn/test/script/basic/es6/for-let-object-fields.js b/nashorn/test/script/basic/es6/for-let-object-fields.js
new file mode 100644
index 00000000000..fe44eda551b
--- /dev/null
+++ b/nashorn/test/script/basic/es6/for-let-object-fields.js
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2010, 2014, 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.
+ */
+
+/**
+ * JDK-8067219: NPE in ScriptObject.clone() when running with object fields
+ *
+ * @test
+ * @run
+ * @fork
+ * @option -Dnashorn.fields.objects=true
+ * @option --language=es6
+ */
+
+"use strict";
+
+for (let i = 0; i < 10; i++) {
+    print(i);
+}
+
+try {
+    print(i);
+} catch (e) {
+    print(e);
+}
+
+let a = [];
+
+for (let i = 0; i < 10; i++) {
+    a.push(function() { print(i); });
+}
+
+a.forEach(function(f) { f(); });
+
+a = [];
+
+for (let i = 0; i < 10; i++) {
+    if (i == 5) {
+        i = "foo";
+    }
+    a.push(function() { print(i); });
+}
+
+a.forEach(function(f) { f(); });
+
+try {
+    print(i);
+} catch (e) {
+    print(e);
+}
+
+a = [];
+
+for (let i = 0; i < 20; i++) {
+    if (i % 2 == 1) {
+        i += 2;
+        continue;
+    }
+    a.push(function() { print(i); });
+}
+
+a.forEach(function(f) { f(); });
diff --git a/nashorn/test/script/basic/es6/for-let-object-fields.js.EXPECTED b/nashorn/test/script/basic/es6/for-let-object-fields.js.EXPECTED
new file mode 100644
index 00000000000..21787adb64b
--- /dev/null
+++ b/nashorn/test/script/basic/es6/for-let-object-fields.js.EXPECTED
@@ -0,0 +1,33 @@
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+ReferenceError: "i" is not defined
+0
+1
+2
+3
+4
+5
+6
+7
+8
+9
+0
+1
+2
+3
+4
+foo
+ReferenceError: "i" is not defined
+0
+4
+8
+12
+16
diff --git a/nashorn/test/script/basic/es6/for-let.js b/nashorn/test/script/basic/es6/for-let.js
index 848dc3ce061..2ad38e57ff8 100644
--- a/nashorn/test/script/basic/es6/for-let.js
+++ b/nashorn/test/script/basic/es6/for-let.js
@@ -26,7 +26,8 @@
  *
  * @test
  * @run
- * @option --language=es6 */
+ * @option --language=es6
+ */
 
 "use strict";
 

From da7812489bbd3a0416329f9b9ec0a9792edf5236 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 11 Dec 2014 11:43:58 -0800
Subject: [PATCH 288/299] Added tag jdk9-b42 for changeset 87571251fb93

---
 .hgtags-top-repo | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.hgtags-top-repo b/.hgtags-top-repo
index 3bd77e9484b..9cbf0f90d4e 100644
--- a/.hgtags-top-repo
+++ b/.hgtags-top-repo
@@ -284,3 +284,4 @@ d42c0a90afc3c66ca87543076ec9aafd4b4680de jdk9-b38
 512dbbeb1730edcebfec873fc3f1455660b32000 jdk9-b39
 cf136458ee747e151a27aa9ea0c1492ea55ef3e7 jdk9-b40
 67395f7ca2db3b52e3a62a84888487de5cb9210a jdk9-b41
+f7c11da0b0481d49cc7a65a453336c108191e821 jdk9-b42

From c12ade4fa2d8d7d10a2e700c295790e6ce11541d Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 11 Dec 2014 11:44:00 -0800
Subject: [PATCH 289/299] Added tag jdk9-b42 for changeset b1cf5f128493

---
 hotspot/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/hotspot/.hgtags b/hotspot/.hgtags
index 159c2223842..ae7d006d45b 100644
--- a/hotspot/.hgtags
+++ b/hotspot/.hgtags
@@ -444,3 +444,4 @@ c363a8b87e477ee45d6d3cb2a36cb365141bc596 jdk9-b38
 9cb75e5e394827ccbaf2e15524108a412dc4ddc5 jdk9-b39
 6b09b3193d731e3288e2a240c504a20d0a06c766 jdk9-b40
 1d29b13e8a515a7ea3b882f140576d5d675bc11f jdk9-b41
+38cb4fbd47e3472bd1b5ebac83bda96fe4869c4f jdk9-b42

From 01553da997a7d5ec33847aef8a0656e9252d80c4 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 11 Dec 2014 11:44:00 -0800
Subject: [PATCH 290/299] Added tag jdk9-b42 for changeset b4926bbdbad8

---
 corba/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/corba/.hgtags b/corba/.hgtags
index 88827d2782a..26c65ed70d5 100644
--- a/corba/.hgtags
+++ b/corba/.hgtags
@@ -284,3 +284,4 @@ ffd90c81d4ef9d94d880fc852e2fc482ecd9b374 jdk9-b36
 53bf36cb722db50815712258a77cb6bbe25a2f5f jdk9-b39
 e27c725d6c9d155667b35255f442d4ceb8c3c084 jdk9-b40
 1908b886ba1eda46fa725cf1160fe5d30fd1a7e5 jdk9-b41
+078bb11af876fe528d4b516f33ad4dd9bb60549e jdk9-b42

From 5dfce592268bddf4af76becf4d673b454c80aa42 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 11 Dec 2014 11:44:02 -0800
Subject: [PATCH 291/299] Added tag jdk9-b42 for changeset 0a96e0cdbae5

---
 jaxp/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/jaxp/.hgtags b/jaxp/.hgtags
index c9d9de60c63..87019760616 100644
--- a/jaxp/.hgtags
+++ b/jaxp/.hgtags
@@ -284,3 +284,4 @@ b9370464572fc663a38956047aa612d6e7854c3d jdk9-b35
 a12d347f84176200593999f4da91ae2bb86865b2 jdk9-b39
 3f46e2196498de33e7c65efa7b372e46f1faba01 jdk9-b40
 71dd8f7649428efd3a56ca5fefc80e59d37b8434 jdk9-b41
+47b0d3fa4118b9d56870cf4004987438c501f5c0 jdk9-b42

From b2f770c75ccaa9387881893206e60caa8a37dcd7 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 11 Dec 2014 11:44:03 -0800
Subject: [PATCH 292/299] Added tag jdk9-b42 for changeset 1a0a8d89a6d7

---
 jdk/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/jdk/.hgtags b/jdk/.hgtags
index ce5d84d50b5..fa59d457917 100644
--- a/jdk/.hgtags
+++ b/jdk/.hgtags
@@ -284,3 +284,4 @@ d2d745313c81d1fc01f426983b9f784ab1f750e8 jdk9-b38
 ca6edf957fe1c6ea818530b503578e872cea7239 jdk9-b39
 f1ed1540da70a066527fd043413107e47721edbf jdk9-b40
 e336cbd8b15e959e70ed02f0f5e93fa76ebd4c07 jdk9-b41
+6b2314173433467245261364a52fb8e347fe6342 jdk9-b42

From 40f0855cb34df045b5bc93ce425207d3c5905b02 Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 11 Dec 2014 11:44:03 -0800
Subject: [PATCH 293/299] Added tag jdk9-b42 for changeset f65d79186283

---
 jaxws/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/jaxws/.hgtags b/jaxws/.hgtags
index 65daeb64249..defa79ac988 100644
--- a/jaxws/.hgtags
+++ b/jaxws/.hgtags
@@ -287,3 +287,4 @@ dd4ba422dba858b1c3c4b38f49a3e514be4e2790 jdk9-b38
 381bad1174c7c27352bee604535332da4ee2c556 jdk9-b39
 5455969de31f3083bcfd779b7acc3ab758ecb308 jdk9-b40
 4f785187377fe4c7ff388a7026dd72fcccdcfe7a jdk9-b41
+301ddb4478fb36d1f025d14e7e48c2a434e9e6ff jdk9-b42

From e2239dc2bbd73378fc95fe2bf6ac096276ea785b Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 11 Dec 2014 11:44:07 -0800
Subject: [PATCH 294/299] Added tag jdk9-b42 for changeset a48998a1fc72

---
 langtools/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/langtools/.hgtags b/langtools/.hgtags
index 700d0f2b95e..7bd86ea5a39 100644
--- a/langtools/.hgtags
+++ b/langtools/.hgtags
@@ -284,3 +284,4 @@ c536541235e566701ff772700c15de14b75e2979 jdk9-b36
 5ff1cd07bd9297e82cfea5ec01249d162260fe4e jdk9-b39
 c286272a81dd8f6005e22fed0238c4a3f75188c7 jdk9-b40
 f7ce2cfa4cdbec0ae0f46080484eace66be7987a jdk9-b41
+23a3a063a906a91ba696d792f0eeabf157cd2f86 jdk9-b42

From 0be1ef4bd84196a0510491e660c8c7e9938565eb Mon Sep 17 00:00:00 2001
From: David Katleman <katleman@openjdk.org>
Date: Thu, 11 Dec 2014 11:44:07 -0800
Subject: [PATCH 295/299] Added tag jdk9-b42 for changeset 5e4ae56d68ac

---
 nashorn/.hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/nashorn/.hgtags b/nashorn/.hgtags
index 98ecf3cba2a..e5dd9ffa61b 100644
--- a/nashorn/.hgtags
+++ b/nashorn/.hgtags
@@ -275,3 +275,4 @@ dd7bbdf81a537106cfa9227d1a9a57849cb26b4d jdk9-b37
 900508346b1c2436d7059fe46a621e6ec3ffdaad jdk9-b39
 74dcd8dbef252938d6deb032aefb46b8f452dd9e jdk9-b40
 52340a35aec9955d4aeaaf01d6337284f179b31c jdk9-b41
+498d1d6c4219086143b764b3bf61afe65dcece47 jdk9-b42

From b82fd80a361aa8b23202d75dd4da2ee521820b50 Mon Sep 17 00:00:00 2001
From: Frank Yuan <frank.yuan@oracle.com>
Date: Thu, 11 Dec 2014 13:08:14 -0800
Subject: [PATCH 296/299] 8051536: Convert JAXP function tests:
 javax.xml.parsers to jtreg(testng) tests

Reviewed-by: lancea, joehw
---
 .../xml/parsers/ptests/DBFNamespaceTest.java  | 104 ++++
 .../ptests/DocumentBuilderFactory01.java      | 451 ++++++++++++++
 .../ptests/DocumentBuilderFactory02.java      |  87 +++
 .../parsers/ptests/DocumentBuilderImpl01.java | 132 +++++
 .../parsers/ptests/FactoryConfErrorTest.java  |  77 +++
 .../xml/parsers/ptests/SAXParserFactTest.java | 268 +++++++++
 .../xml/parsers/ptests/SAXParserTest.java     | 559 ++++++++++++++++++
 .../xml/parsers/ptests/SAXParserTest02.java   | 283 +++++++++
 .../xml/parsers/ptests/SAXParserTest03.java   | 109 ++++
 .../javax/xml/parsers/ptests/TestUtils.java   | 200 +++++++
 .../xmlfiles/DocumentBuilderFactory01.xml     |   4 +
 .../xmlfiles/DocumentBuilderFactory02.xml     |   9 +
 .../xmlfiles/DocumentBuilderFactory03.xml     |   9 +
 .../xmlfiles/DocumentBuilderFactory04.xml     |  19 +
 .../xmlfiles/DocumentBuilderFactory05.xml     |  16 +
 .../xmlfiles/DocumentBuilderFactory06.xml     |  29 +
 .../xmlfiles/DocumentBuilderFactory07.xml     |   9 +
 .../xmlfiles/DocumentBuilderFactory08.xml     |   5 +
 .../xmlfiles/DocumentBuilderImpl01.xml        |   4 +
 .../xmlfiles/DocumentBuilderImpl02.dtd        |  12 +
 .../xmlfiles/DocumentBuilderImpl02.xml        |  28 +
 .../javax/xml/parsers/xmlfiles/correct.xml    |  23 +
 .../javax/xml/parsers/xmlfiles/dbf10.xml      |  13 +
 .../javax/xml/parsers/xmlfiles/dbf10.xsl      |  21 +
 .../xml/parsers/xmlfiles/dbf10import.xsl      |   5 +
 .../xml/parsers/xmlfiles/dbf10include.xsl     |   5 +
 .../javax/xml/parsers/xmlfiles/firstdtd.dtd   |  13 +
 .../javax/xml/parsers/xmlfiles/invalid.xml    |  24 +
 .../javax/xml/parsers/xmlfiles/invalidns.xml  |  16 +
 .../javax/xml/parsers/xmlfiles/namespace1.xml |  15 +
 .../javax/xml/parsers/xmlfiles/ns4.xml        |   8 +
 .../parsers/xmlfiles/out/dbfactory02GF.out    |  83 +++
 .../parsers/xmlfiles/out/dbfnstest01GF.out    |  79 +++
 .../parsers/xmlfiles/out/dbfnstest02GF.out    |  79 +++
 .../javax/xml/parsers/xmlfiles/parsertest.xml |  25 +
 .../javax/xml/parsers/xmlfiles/test.xml       |   5 +
 .../javax/xml/parsers/xmlfiles/test.xsd       |  11 +
 .../javax/xml/parsers/xmlfiles/test1.xml      |   5 +
 .../javax/xml/parsers/xmlfiles/valid.xml      |  24 +
 .../javax/xml/parsers/xmlfiles/validns.xml    |  14 +
 40 files changed, 2882 insertions(+)
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory01.java
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory02.java
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/TestUtils.java
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory01.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory02.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory03.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory04.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory05.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory06.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory07.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory08.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl01.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl02.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl02.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/correct.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10import.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10include.xsl
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/firstdtd.dtd
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/invalid.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/invalidns.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/namespace1.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/ns4.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/out/dbfactory02GF.out
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/out/dbfnstest01GF.out
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/out/dbfnstest02GF.out
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/parsertest.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test.xsd
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test1.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/valid.xml
 create mode 100644 jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/validns.xml

diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java
new file mode 100644
index 00000000000..930ef818341
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DBFNamespaceTest.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.FILE_SEP;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.TransformerFactoryConfigurationError;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXResult;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/**
+ * This tests DocumentBuilderFactory for namespace processing and no-namespace
+ * processing.
+ */
+public class DBFNamespaceTest {
+
+    /**
+     * Provide input for the cases that supporting namespace or not.
+     */
+    @DataProvider(name = "input-provider")
+    public Object[][] getInput() {
+        DocumentBuilderFactory dbf1 = DocumentBuilderFactory.newInstance();
+        String outputfile1 = USER_DIR + FILE_SEP + "dbfnstest01.out";
+        String goldfile1 = TestUtils.GOLDEN_DIR + FILE_SEP + "dbfnstest01GF.out";
+
+        DocumentBuilderFactory dbf2 = DocumentBuilderFactory.newInstance();
+        dbf2.setNamespaceAware(true);
+        String outputfile2 = USER_DIR + FILE_SEP + "dbfnstest02.out";
+        String goldfile2 = TestUtils.GOLDEN_DIR + FILE_SEP + "dbfnstest02GF.out";
+        return new Object[][] { { dbf1, outputfile1, goldfile1 }, { dbf2, outputfile2, goldfile2 } };
+    }
+
+    /**
+     * Test to parse and transform a document without supporting namespace and
+     * with supporting namespace.
+     */
+    @Test(dataProvider = "input-provider")
+    public void testNamespaceTest(DocumentBuilderFactory dbf, String outputfile, String goldfile) {
+        try {
+            Document doc = dbf.newDocumentBuilder().parse(new File(TestUtils.XML_DIR, "namespace1.xml"));
+            dummyTransform(doc, outputfile);
+            assertTrue(compareWithGold(goldfile, outputfile));
+        } catch (SAXException | IOException | ParserConfigurationException | TransformerFactoryConfigurationError | TransformerException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * This method transforms a Node without any xsl file and uses SAXResult to
+     * invoke the callbacks through a ContentHandler. If namespace processing is
+     * not chosen, namespaceURI in callbacks should be an empty string otherwise
+     * it should be namespaceURI.
+     *
+     * @throws TransformerFactoryConfigurationError
+     * @throws TransformerException
+     * @throws IOException
+     */
+    private void dummyTransform(Document document, String fileName) throws TransformerFactoryConfigurationError, TransformerException, IOException {
+        DOMSource domSource = new DOMSource(document);
+        Transformer transformer = TransformerFactory.newInstance().newTransformer();
+        File file = new File(fileName);
+        System.out.println("The fileName is " + file.getAbsolutePath());
+        transformer.transform(domSource, new SAXResult(MyCHandler.newInstance(file)));
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory01.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory01.java
new file mode 100644
index 00000000000..fddfaaa89b1
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory01.java
@@ -0,0 +1,451 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.FILE_SEP;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileReader;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * This checks the methods of DocumentBuilderFactoryImpl
+ */
+public class DocumentBuilderFactory01 {
+    /**
+     * Testcase to test the default functionality of schema support method.
+     */
+    @Test
+    public void testCheckSchemaSupport1() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setValidating(true);
+            dbf.setNamespaceAware(true);
+            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+            MyErrorHandler eh = MyErrorHandler.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            db.setErrorHandler(eh);
+            Document doc = db.parse(new File(TestUtils.XML_DIR, "test.xml"));
+            assertFalse(eh.errorOccured);
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the default functionality of schema support method. In
+     * this case the schema source property is set.
+     */
+    @Test
+    public void testCheckSchemaSupport2() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setValidating(true);
+            dbf.setNamespaceAware(true);
+            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+            dbf.setAttribute("http://java.sun.com/xml/jaxp/properties/schemaSource", new InputSource(new FileInputStream(
+                    new File(TestUtils.XML_DIR, "test.xsd"))));
+            MyErrorHandler eh = MyErrorHandler.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            db.setErrorHandler(eh);
+            Document doc = db.parse(new File(TestUtils.XML_DIR, "test1.xml"));
+            assertFalse(eh.errorOccured);
+        } catch (IllegalArgumentException | ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Testcase to test the default functionality of schema support method. In
+     * this case the schema source property is set.
+     */
+    @Test
+    public void testCheckSchemaSupport3() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            spf.setValidating(true);
+            spf.setNamespaceAware(true);
+            SAXParser sp = spf.newSAXParser();
+            sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaLanguage", "http://www.w3.org/2001/XMLSchema");
+            sp.setProperty("http://java.sun.com/xml/jaxp/properties/schemaSource",
+                    new InputSource(new FileInputStream(new File(TestUtils.XML_DIR, "test.xsd"))));
+            DefaultHandler dh = new DefaultHandler();
+            sp.parse(new File(TestUtils.XML_DIR, "test1.xml"), dh);
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the default functionality of newInstance method. To test
+     * the isCoalescing method and setCoalescing This checks to see if the CDATA
+     * and text nodes got combined In that case it will print "&lt;xml&gt;This
+     * is not parsed&lt;/xml&gt; yet".
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory02() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setCoalescing(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory01.xml"));
+            Element e = (Element) doc.getElementsByTagName("html").item(0);
+            NodeList nl = e.getChildNodes();
+            assertEquals(nl.item(0).getNodeValue().trim(), "<xml>This is not parsed</xml> yet");
+        } catch (IOException | SAXException | ParserConfigurationException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the isIgnoringComments. By default it is false.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory03() {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        assertFalse(dbf.isIgnoringComments());
+    }
+
+    /**
+     * Testcase to test the isValidating. By default it is false, set it to true
+     * and then use a document which is not valid. It should throw a warning or
+     * an error at least. The test passes in case retval 0 is set in the error
+     * method .
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory04() {
+        try {
+            MyErrorHandler eh = MyErrorHandler.newInstance();
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setValidating(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            db.setErrorHandler(eh);
+            Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory05.xml"));
+            assertTrue(eh.errorOccured);
+        } catch (ParserConfigurationException | IOException | SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the setValidating. By default it is false, use a
+     * document which is not valid. It should not throw a warning or an error.
+     * The test passes in case the retval equals 1 .
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory16() {
+        try {
+            MyErrorHandler eh = MyErrorHandler.newInstance();
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            db.setErrorHandler(eh);
+            Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory05.xml"));
+            assertFalse(eh.errorOccured);
+        } catch (ParserConfigurationException | IOException | SAXException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Testcase to test the setValidating. By default it is false, use a
+     * document which is valid. It should not throw a warning or an error. The
+     * test passes in case the retval equals 1.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory17() {
+        try {
+            MyErrorHandler eh = MyErrorHandler.newInstance();
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            db.setErrorHandler(eh);
+            Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory04.xml"));
+            assertFalse(eh.errorOccured);
+        } catch (ParserConfigurationException | IOException | SAXException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * To test the isExpandEntityReferences. By default it is true.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory05() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory02.xml")));
+            Element e = (Element) doc.getElementsByTagName("title").item(0);
+            NodeList nl = e.getChildNodes();
+            assertTrue(dbf.isExpandEntityReferences());
+            assertEquals(nl.item(0).getNodeValue().trim().charAt(0), 'W');
+        } catch (ParserConfigurationException | IOException | SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the default functionality of setValidating method. The
+     * xml file has a DTD which has namespaces defined. The parser takes care to
+     * check if the namespaces using elements and defined attributes are there
+     * or not.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory06() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setValidating(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            MyErrorHandler eh = MyErrorHandler.newInstance();
+            db.setErrorHandler(eh);
+            Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory04.xml"));
+            assertTrue(doc instanceof Document);
+            assertFalse(eh.errorOccured);
+        } catch (ParserConfigurationException | IOException | SAXException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Testcase to test the setExpandEntityReferences.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory07() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setExpandEntityReferences(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory02.xml")));
+            Element e = (Element) doc.getElementsByTagName("title").item(0);
+            NodeList nl = e.getChildNodes();
+            assertTrue(dbf.isExpandEntityReferences());
+            assertEquals(nl.item(0).getNodeValue().trim().charAt(0), 'W');
+        } catch (ParserConfigurationException | IOException | SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the setExpandEntityReferences.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory08() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setExpandEntityReferences(false);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory02.xml")));
+            Element e = (Element) doc.getElementsByTagName("title").item(0);
+            NodeList nl = e.getChildNodes();
+            assertNull(nl.item(0).getNodeValue());
+        } catch (ParserConfigurationException | IOException | SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the setIgnoringComments. By default it is set to false.
+     * explicitly setting it to false, it recognizes the comment which is in
+     * Element Node Hence the Element's child node is not null.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory09() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setIgnoringComments(false);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory07.xml")));
+            Element e = (Element) doc.getElementsByTagName("body").item(0);
+            NodeList nl = e.getChildNodes();
+            assertNotNull(nl.item(0).getNodeValue());
+        } catch (ParserConfigurationException | IOException | SAXException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * This tests for the parse(InputSource).
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory10() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(new InputSource(new BufferedReader(new FileReader(new File(TestUtils.XML_DIR, "DocumentBuilderFactory07.xml")))));
+            assertTrue(doc instanceof Document);
+        } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * This tests for the parse InputStream with SystemID as a second parameter.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory11() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "dbf10import.xsl")), new File(TestUtils.XML_DIR).toURI()
+                    .toASCIIString());
+            assertTrue(doc instanceof Document);
+        } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * This tests for the parse InputStream with empty SystemID as a second
+     * parameter.
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory12() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "dbf10import.xsl")), " ");
+            assertTrue(doc instanceof Document);
+        } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * This tests for the parse(uri).
+     */
+    @Test
+    public void testCheckDocumentBuilderFactory13() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(new File(TestUtils.XML_DIR + FILE_SEP + "dbf10import.xsl").toURI().toASCIIString());
+            assertTrue(doc instanceof Document);
+        } catch (IllegalArgumentException | ParserConfigurationException | IOException | SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * This tests for the parse (uri) with empty string as parameter should
+     * throw Sax Exception.
+     *
+     * @throws SAXException
+     *             If any parse errors occur.
+     */
+    @Test(expectedExceptions = SAXException.class)
+    public void testCheckDocumentBuilderFactory14() throws SAXException {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            docBuilder.parse("");
+        } catch (ParserConfigurationException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * This tests for the parse (uri) with null uri as parameter should throw
+     * IllegalArgumentException.
+     *
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class)
+    public void testCheckDocumentBuilderFactory15() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            String uri = null;
+            docBuilder.parse(uri);
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the setIgnoringComments. By default it is set to false,
+     * setting this to true, It does not recognize the comment, Here the
+     * nodelist has a length 0 because the ignoring comments is true.
+     */
+    @Test
+    public void testCheckIgnoringComments() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setIgnoringComments(true);
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory08.xml")));
+            Element e = (Element) doc.getElementsByTagName("body").item(0);
+            NodeList nl = e.getChildNodes();
+            assertEquals(nl.getLength(), 0);
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Testcase to test the default behaviour of setIgnoringComments. By default
+     * it is set to false, this is similar to case 9 but not setIgnoringComments
+     * explicitly, it does not recognize the comment.
+     */
+    @Test
+    public void testCheckIgnoringComments1() {
+        try {
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderFactory07.xml")));
+            Element e = (Element) doc.getElementsByTagName("body").item(0);
+            NodeList nl = e.getChildNodes();
+            assertFalse(dbf.isIgnoringComments());
+            assertNotNull(nl.item(0).getNodeValue());
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory02.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory02.java
new file mode 100644
index 00000000000..68722085ba2
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderFactory02.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.FILE_SEP;
+import static jaxp.library.JAXPTestUtilities.USER_DIR;
+import static jaxp.library.JAXPTestUtilities.compareWithGold;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Transformer;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
+import javax.xml.transform.dom.DOMSource;
+import javax.xml.transform.sax.SAXResult;
+
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+
+/**
+ * This tests the setIgnoringElementWhitespace and setIgnoringComments of
+ * DocumentBuilderFactory
+ */
+public class DocumentBuilderFactory02 {
+
+    /**
+     * This testcase tests for the isIgnoringElementContentWhitespace and the
+     * setIgnoringElementContentWhitespace. The xml file has all kinds of
+     * whitespace,tab and newline characters, it uses the MyNSContentHandler
+     * which does not invoke the characters callback when this
+     * setIgnoringElementContentWhitespace is set to true.
+     */
+    @Test
+    public void testCheckElementContentWhitespace() {
+        try {
+            String goldFile = TestUtils.GOLDEN_DIR + FILE_SEP + "dbfactory02GF.out";
+            String outputFile = USER_DIR + FILE_SEP + "dbfactory02.out";
+            MyErrorHandler eh = MyErrorHandler.newInstance();
+            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+            dbf.setValidating(true);
+            assertFalse(dbf.isIgnoringElementContentWhitespace());
+            dbf.setIgnoringElementContentWhitespace(true);
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            db.setErrorHandler(eh);
+            Document doc = db.parse(new File(TestUtils.XML_DIR, "DocumentBuilderFactory06.xml"));
+            assertFalse(eh.errorOccured);
+            DOMSource domSource = new DOMSource(doc);
+            TransformerFactory tfactory = TransformerFactory.newInstance();
+            Transformer transformer = tfactory.newTransformer();
+            SAXResult saxResult = new SAXResult();
+            saxResult.setHandler(MyCHandler.newInstance(new File(outputFile)));
+            transformer.transform(domSource, saxResult);
+            assertTrue(compareWithGold(goldFile, outputFile));
+        } catch (ParserConfigurationException | SAXException | IOException | TransformerException e) {
+            failUnexpected(e);
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java
new file mode 100644
index 00000000000..d565748c37a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/DocumentBuilderImpl01.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.FILE_SEP;
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertFalse;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.w3c.dom.Document;
+import org.xml.sax.EntityResolver;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+/**
+ * This checks for the methods of DocumentBuilder
+ */
+public class DocumentBuilderImpl01 implements EntityResolver {
+
+    /**
+     * Provide DocumentBuilder.
+     *
+     * @throws ParserConfigurationException
+     */
+    @DataProvider(name = "builder-provider")
+    public Object[][] getBuilder() throws ParserConfigurationException {
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        DocumentBuilder docBuilder = dbf.newDocumentBuilder();
+        return new Object[][] { { docBuilder } };
+    }
+
+    /**
+     * Testcase to test the default functionality of isValidation method. Expect
+     * to return false because not setting the validation.
+     */
+    @Test(dataProvider = "builder-provider")
+    public void testCheckDocumentBuilderImpl01(DocumentBuilder docBuilder) {
+        assertFalse(docBuilder.isValidating());
+
+    }
+
+    /**
+     * Testcase to test the default functionality of isNamespaceAware method.
+     */
+    @Test(dataProvider = "builder-provider")
+    public void testCheckDocumentBuilderImpl02(DocumentBuilder docBuilder) {
+        assertFalse(docBuilder.isNamespaceAware());
+    }
+
+    /**
+     * Testcase to test the parse(InputStream).
+     */
+    @Test(dataProvider = "builder-provider")
+    public void testCheckDocumentBuilderImpl04(DocumentBuilder docBuilder) {
+        try {
+            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderImpl01.xml")));
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the parse(File).
+     */
+    @Test(dataProvider = "builder-provider")
+    public void testCheckDocumentBuilderImpl05(DocumentBuilder docBuilder) {
+        try {
+            Document doc = docBuilder.parse(new File(TestUtils.XML_DIR, "DocumentBuilderImpl01.xml"));
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the parse(InputStream,systemId).
+     */
+    @Test(dataProvider = "builder-provider")
+    public void testCheckDocumentBuilderImpl06(DocumentBuilder docBuilder) {
+        try {
+            Document doc = docBuilder.parse(new FileInputStream(new File(TestUtils.XML_DIR, "DocumentBuilderImpl02.xml")), new File(TestUtils.XML_DIR).toURI()
+                    .toASCIIString() + FILE_SEP);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the setEntityResolver.
+     */
+    @Test(dataProvider = "builder-provider")
+    public void testCheckDocumentBuilderImpl07(DocumentBuilder docBuilder) {
+        docBuilder.setEntityResolver(this);
+        resolveEntity("publicId", "http://www.myhost.com/today");
+    }
+
+    public InputSource resolveEntity(String publicId, String systemId) {
+        if (systemId.equals("http://www.myhost.com/today"))
+            return new InputSource(systemId);
+        else
+            return null;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java
new file mode 100644
index 00000000000..947d6d8dd7d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/FactoryConfErrorTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.AfterTest;
+import org.testng.annotations.BeforeTest;
+import org.testng.annotations.Test;
+
+/**
+ * Class containing the test cases for SAXParserFactory/DocumentBuilderFactory
+ * newInstance methods.
+ */
+public class FactoryConfErrorTest {
+
+    /**
+     * Set properties DocumentBuilderFactory and SAXParserFactory to invalid
+     * value before any test run.
+     */
+    @BeforeTest
+    public void setup() {
+        System.setProperty("javax.xml.parsers.DocumentBuilderFactory", "xx");
+        System.setProperty("javax.xml.parsers.SAXParserFactory", "xx");
+    }
+
+    /**
+     * Restore properties DocumentBuilderFactory and SAXParserFactory to default
+     * value after all tests run.
+     */
+    @AfterTest
+    public void cleanup() {
+        System.clearProperty("javax.xml.parsers.DocumentBuilderFactory");
+        System.clearProperty("javax.xml.parsers.SAXParserFactory");
+    }
+
+    /**
+     * To test exception thrown if javax.xml.parsers.SAXParserFactory property
+     * is invalid.
+     */
+    @Test(expectedExceptions = FactoryConfigurationError.class)
+    public void testNewInstance01() {
+        SAXParserFactory.newInstance();
+    }
+
+    /**
+     * To test exeception thrown if javax.xml.parsers.DocumentBuilderFactory is
+     * invalid.
+     */
+    @Test(expectedExceptions = FactoryConfigurationError.class)
+    public void testNewInstance02() {
+        DocumentBuilderFactory.newInstance();
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java
new file mode 100644
index 00000000000..da87e006f58
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserFactTest.java
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+
+/**
+ * Class containing the test cases for SAXParserFactory API
+ */
+public class SAXParserFactTest {
+
+    private static final String NAMESPACES = "http://xml.org/sax/features/namespaces";
+    private static final String NAMESPACE_PREFIXES = "http://xml.org/sax/features/namespace-prefixes";
+    private static final String STRING_INTERNING = "http://xml.org/sax/features/string-interning";
+    private static final String VALIDATION = "http://xml.org/sax/features/validation";
+    private static final String EXTERNAL_G_ENTITIES = "http://xml.org/sax/features/external-general-entities";
+    private static final String EXTERNAL_P_ENTITIES = "http://xml.org/sax/features/external-parameter-entities";
+
+    /**
+     * Testcase to test if newSAXParser() method returns SAXParser.
+     */
+    @Test
+    public void testParser01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            SAXParser saxparser = spf.newSAXParser();
+        } catch (ParserConfigurationException | SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the default functionality (No validation) of the parser.
+     */
+    @Test
+    public void testValidate01() {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        assertFalse(spf.isValidating());
+    }
+
+    /**
+     * Testcase to test the functionality of setValidating and isvalidating
+     * methods.
+     */
+    @Test
+    public void testValidate02() {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setValidating(true);
+        assertTrue(spf.isValidating());
+    }
+
+    /**
+     * Parser should not be namespaceaware by default.
+     */
+    @Test
+    public void testNamespace01() {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        assertFalse(spf.isNamespaceAware());
+    }
+
+    /**
+     * Testcase to test the functionality of setNamespaceAware and
+     * isNamespaceAware methods.
+     */
+    @Test
+    public void testNamespace02() {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setNamespaceAware(true);
+        assertTrue(spf.isNamespaceAware());
+    }
+
+    /**
+     * Testcase to test the functionality of setNamespaceAware and getFeature()
+     * methods for namespaces property.
+     */
+    @Test
+    public void testFeature01() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            assertFalse(spf.getFeature(NAMESPACES));
+
+            spf.setNamespaceAware(true);
+            assertTrue(spf.getFeature(NAMESPACES));
+        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the functionality of setFeature and getFeature methods
+     * for namespaces property.
+     */
+    @Test
+    public void testFeature02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+
+            spf.setFeature(NAMESPACES, true);
+            assertTrue(spf.getFeature(NAMESPACES));
+
+            spf.setFeature(NAMESPACES, false);
+            assertFalse(spf.getFeature(NAMESPACES));
+        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the functionality of setFeature and getFeature methods
+     * for namespace-prefixes property.
+     */
+    @Test
+    public void testFeature03() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+
+            spf.setFeature(NAMESPACE_PREFIXES, true);
+            assertTrue(spf.getFeature(NAMESPACE_PREFIXES));
+
+            spf.setFeature(NAMESPACE_PREFIXES, false);
+            assertFalse(spf.getFeature(NAMESPACE_PREFIXES));
+        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the functionality of getFeature method for
+     * string-interning property.
+     */
+    @Test
+    public void testFeature04() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            assertTrue(spf.getFeature(STRING_INTERNING));
+        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the functionality of getFeature and setValidating
+     * methods for validation property.
+     */
+    @Test
+    public void testFeature05() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            assertFalse(spf.getFeature(VALIDATION));
+            spf.setValidating(true);
+            assertTrue(spf.getFeature(VALIDATION));
+        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Testcase to test the functionality of setFeature and getFeature methods
+     * for validation property.
+     */
+    @Test
+    public void testFeature06() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+
+            spf.setFeature(VALIDATION, true);
+            assertTrue(spf.getFeature(VALIDATION));
+
+            spf.setFeature(VALIDATION, false);
+            assertFalse(spf.getFeature(VALIDATION));
+        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Testcase to test the functionality of getFeature method for
+     * external-general-entities property.
+     */
+    @Test
+    public void testFeature07() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            assertTrue(spf.getFeature(EXTERNAL_G_ENTITIES));
+        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Testcase to test the functionality of setFeature and getFeature methods
+     * for external-general-entities property.
+     */
+    @Test
+    public void testFeature08() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setFeature(EXTERNAL_G_ENTITIES, false);
+            assertFalse(spf.getFeature(EXTERNAL_G_ENTITIES));
+        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the functionality of getFeature method for
+     * external-parameter-entities property.
+     */
+    @Test
+    public void testFeature09() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            assertTrue(spf.getFeature(EXTERNAL_P_ENTITIES));
+        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase to test the functionality of setFeature method for
+     * external-parameter-entitie property.
+     */
+    @Test
+    public void testFeature10() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setFeature(EXTERNAL_P_ENTITIES, false);
+        } catch (ParserConfigurationException | SAXNotRecognizedException | SAXNotSupportedException e) {
+            failUnexpected(e);
+        }
+
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java
new file mode 100644
index 00000000000..af2c5a683b7
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest.java
@@ -0,0 +1,559 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.xml.sax.HandlerBase;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.DefaultHandler;
+
+/**
+ * Class contains the test cases for SAXParser API
+ */
+public class SAXParserTest {
+
+    /**
+     * Provide SAXParser.
+     *
+     * @throws SAXException
+     * @throws ParserConfigurationException
+     */
+    @DataProvider(name = "parser-provider")
+    public Object[][] getParser() throws ParserConfigurationException, SAXException {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        SAXParser saxparser = spf.newSAXParser();
+        return new Object[][] { { saxparser } };
+    }
+
+    /**
+     * Test case with FileInputStream null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @throws IllegalArgumentException
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+    public void testParse01(SAXParser saxparser) throws IllegalArgumentException {
+        try {
+            FileInputStream instream = null;
+            HandlerBase handler = new HandlerBase();
+            saxparser.parse(instream, handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with an error in xml file, parsing should fail and throw
+     * SAXException.
+     *
+     * @throws SAXException
+     */
+    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+    public void testParse02(SAXParser saxparser) throws SAXException {
+        try {
+            HandlerBase handler = new HandlerBase();
+            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
+            saxparser.parse(instream, handler);
+        } catch (IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with a valid in xml file, parser should parse the xml document.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testParse03(SAXParser saxparser) {
+        try {
+            HandlerBase handler = new HandlerBase();
+            saxparser.parse(new File(TestUtils.XML_DIR, "parsertest.xml"), handler);
+        } catch (IOException | SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with valid input stream, parser should parse the xml document
+     * successfully.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testParse04(SAXParser saxparser) {
+        try {
+            HandlerBase handler = new HandlerBase();
+            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
+            saxparser.parse(instream, handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with valid input source, parser should parse the xml document
+     * successfully.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testParse05(SAXParser saxparser) {
+        try {
+            HandlerBase handler = new HandlerBase();
+            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "parsertest.xml"));
+            saxparser.parse(instream, handler, new File(TestUtils.XML_DIR).toURI().toASCIIString());
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with uri null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @throws IllegalArgumentException
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+    public void testParse07(SAXParser saxparser) throws IllegalArgumentException {
+        try {
+            String uri = null;
+            HandlerBase handler = new HandlerBase();
+            saxparser.parse(uri, handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with non-existant uri, parsing should fail and throw
+     * IOException.
+     *
+     * @throws SAXException
+     * @throws IOException
+     */
+    @Test(expectedExceptions = { SAXException.class, IOException.class }, dataProvider = "parser-provider")
+    public void testParse08(SAXParser saxparser) throws SAXException, IOException {
+        String uri = " ";
+
+        HandlerBase handler = new HandlerBase();
+        saxparser.parse(uri, handler);
+
+    }
+
+    /**
+     * Testcase with proper uri, parser should parse successfully.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testParse09(SAXParser saxparser) {
+        try {
+            File file = new File(TestUtils.XML_DIR, "correct.xml");
+            HandlerBase handler = new HandlerBase();
+            saxparser.parse(file.toURI().toASCIIString(), handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with File null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @throws IllegalArgumentException
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+    public void testParse10(SAXParser saxparser) throws IllegalArgumentException {
+        try {
+            File file = null;
+            HandlerBase handler = new HandlerBase();
+            saxparser.parse(file, handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with empty string as File, parsing should fail and throw
+     * SAXException.
+     *
+     * @throws SAXException
+     */
+    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+    public void testParse11(SAXParser saxparser) throws SAXException {
+        try {
+            HandlerBase handler = new HandlerBase();
+            File file = new File("");
+            saxparser.parse(file, handler);
+        } catch (IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with xml file that has errors parsing should fail and throw
+     * SAXException.
+     *
+     * @throws SAXException
+     */
+    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+    public void testParse12(SAXParser saxparser) throws SAXException {
+        try {
+            HandlerBase handler = new HandlerBase();
+            File file = new File(TestUtils.XML_DIR, "valid.xml");
+            saxparser.parse(file, handler);
+        } catch (IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with xml file that has no errors Parser should successfully
+     * parse the xml document.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testParse13(SAXParser saxparser) {
+        try {
+            HandlerBase handler = new HandlerBase();
+            File file = new File(TestUtils.XML_DIR, "correct.xml");
+            saxparser.parse(file, handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Testcase with input source null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @throws IllegalArgumentException
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+    public void testParse14(SAXParser saxparser) throws IllegalArgumentException {
+        try {
+            InputSource is = null;
+            HandlerBase handler = new HandlerBase();
+            saxparser.parse(is, handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with input source attached an invaild xml, parsing should fail
+     * and throw SAXException.
+     *
+     * @throws SAXException
+     */
+    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+    public void testParse15(SAXParser saxparser) throws SAXException {
+        try {
+            HandlerBase handler = new HandlerBase();
+            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
+            InputSource is = new InputSource(instream);
+            saxparser.parse(is, handler);
+        } catch (IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with input source attached an vaild xml, parser should
+     * successfully parse the xml document.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testParse16(SAXParser saxparser) {
+        try {
+            HandlerBase handler = new HandlerBase();
+            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
+            InputSource is = new InputSource(instream);
+            saxparser.parse(is, handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with FileInputStream null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @throws IllegalArgumentException
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+    public void testParse17(SAXParser saxparser) throws IllegalArgumentException {
+        try {
+            FileInputStream instream = null;
+            DefaultHandler handler = new DefaultHandler();
+            saxparser.parse(instream, handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with an error in xml file, parsing should fail and throw
+     * SAXException.
+     *
+     * @throws SAXException
+     */
+    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+    public void testParse18(SAXParser saxparser) throws SAXException {
+        try {
+            DefaultHandler handler = new DefaultHandler();
+            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
+            saxparser.parse(instream, handler);
+        } catch (IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with valid input stream, parser should parse the xml document
+     * successfully.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testParse19(SAXParser saxparser) {
+        try {
+            DefaultHandler handler = new DefaultHandler();
+            saxparser.parse(new File(TestUtils.XML_DIR, "parsertest.xml"), handler);
+        } catch (IOException | SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with valid input stream, parser should parse the xml document
+     * successfully.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testParse20(SAXParser saxparser) {
+        try {
+            DefaultHandler handler = new DefaultHandler();
+            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
+            saxparser.parse(instream, handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with valid input source, parser should parse the xml document
+     * successfully.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testParse21(SAXParser saxparser) {
+        try {
+            DefaultHandler handler = new DefaultHandler();
+            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "parsertest.xml"));
+            saxparser.parse(instream, handler, new File(TestUtils.XML_DIR).toURI().toASCIIString());
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Testcase with uri null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @throws IllegalArgumentException
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+    public void testParse23(SAXParser saxparser) throws IllegalArgumentException {
+        try {
+            String uri = null;
+            DefaultHandler handler = new DefaultHandler();
+            saxparser.parse(uri, handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with non-existant uri, parsing should fail and throw
+     * SAXException or IOException.
+     *
+     * @throws SAXException
+     * @throws IOException
+     */
+    @Test(expectedExceptions = { SAXException.class, IOException.class }, dataProvider = "parser-provider")
+    public void testParse24(SAXParser saxparser) throws SAXException, IOException {
+        String uri = " ";
+        DefaultHandler handler = new DefaultHandler();
+        saxparser.parse(uri, handler);
+
+    }
+
+    /**
+     * Testcase with proper uri, parser should parse successfully.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testParse25(SAXParser saxparser) {
+        try {
+            File file = new File(TestUtils.XML_DIR, "correct.xml");
+
+            DefaultHandler handler = new DefaultHandler();
+            saxparser.parse(file.toURI().toASCIIString(), handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with File null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @throws IllegalArgumentException
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+    public void testParse26(SAXParser saxparser) throws IllegalArgumentException {
+        try {
+            DefaultHandler handler = new DefaultHandler();
+            saxparser.parse((File) null, handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with empty string as File, parsing should fail and throw
+     * SAXException.
+     *
+     * @throws SAXException
+     */
+    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+    public void testParse27(SAXParser saxparser) throws SAXException {
+        try {
+            DefaultHandler handler = new DefaultHandler();
+            File file = new File("");
+            saxparser.parse(file, handler);
+        } catch (IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with xml file that has errors, parsing should fail and throw
+     * SAXException.
+     *
+     * @throws SAXException
+     */
+    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+    public void testParse28(SAXParser saxparser) throws SAXException {
+        try {
+            DefaultHandler handler = new DefaultHandler();
+            File file = new File(TestUtils.XML_DIR, "valid.xml");
+            saxparser.parse(file, handler);
+        } catch (IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with xml file that has no errors, parser should successfully
+     * parse the xml document.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testParse29(SAXParser saxparser) {
+        try {
+            DefaultHandler handler = new DefaultHandler();
+            File file = new File(TestUtils.XML_DIR, "correct.xml");
+            saxparser.parse(file, handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with input source null, parsing should fail and throw
+     * IllegalArgumentException.
+     *
+     * @throws IllegalArgumentException
+     */
+    @Test(expectedExceptions = IllegalArgumentException.class, dataProvider = "parser-provider")
+    public void testParse30(SAXParser saxparser) throws IllegalArgumentException {
+        try {
+            InputSource is = null;
+            DefaultHandler handler = new DefaultHandler();
+            saxparser.parse(is, handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Testcase with an invalid xml file, parser should throw SAXException.
+     *
+     * @throws SAXException
+     */
+    @Test(expectedExceptions = SAXException.class, dataProvider = "parser-provider")
+    public void testParse31(SAXParser saxparser) throws SAXException {
+        try {
+            DefaultHandler handler = new DefaultHandler();
+            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "invalid.xml"));
+            InputSource is = new InputSource(instream);
+            saxparser.parse(is, handler);
+        } catch (IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Test case to parse an xml file that not use namespaces.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testParse32(SAXParser saxparser) {
+        try {
+            DefaultHandler handler = new DefaultHandler();
+            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "correct.xml"));
+            InputSource is = new InputSource(instream);
+            saxparser.parse(is, handler);
+        } catch (SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Test case to parse an xml file that uses namespaces.
+     */
+    @Test
+    public void testParse33() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            SAXParser saxparser = spf.newSAXParser();
+            HandlerBase handler = new HandlerBase();
+            FileInputStream instream = new FileInputStream(new File(TestUtils.XML_DIR, "ns4.xml"));
+            saxparser.parse(instream, handler);
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java
new file mode 100644
index 00000000000..9bfd3ef4c4e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest02.java
@@ -0,0 +1,283 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
+
+import javax.xml.parsers.FactoryConfigurationError;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.xml.sax.Parser;
+import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.XMLReader;
+import org.xml.sax.ext.DeclHandler;
+import org.xml.sax.ext.LexicalHandler;
+
+/**
+ * Class contains the test cases for SAXParser API
+ */
+public class SAXParserTest02 {
+    final String DOM_NODE = "http://xml.org/sax/properties/dom-node";
+    final String XML_STRING = "http://xml.org/sax/properties/xml-string";
+    final String DECL_HANDLER = "http://xml.org/sax/properties/declaration-handler";
+    final String LEXICAL_HANDLER = "http://xml.org/sax/properties/lexical-handler";
+
+    /**
+     * Provide SAXParser.
+     *
+     * @throws SAXException
+     * @throws ParserConfigurationException
+     */
+    @DataProvider(name = "parser-provider")
+    public Object[][] getParser() throws ParserConfigurationException, SAXException {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        SAXParser saxparser = spf.newSAXParser();
+        return new Object[][] { { saxparser } };
+    }
+
+    /**
+     * Testcase to test the default functionality (No validation) of the parser.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testValidate01(SAXParser saxparser) {
+        try {
+            assertFalse(saxparser.isValidating());
+        } catch (FactoryConfigurationError e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Testcase to test the functionality of setValidating and isvalidating
+     * methods.
+     */
+    @Test
+    public void testValidate02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setValidating(true);
+            spf.newSAXParser();
+            assertTrue(spf.isValidating());
+        } catch (FactoryConfigurationError | ParserConfigurationException | SAXException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Test case to test isNamespaceAware() method. By default, namespaces are
+     * not supported.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testNamespace01(SAXParser saxparser) {
+        try {
+            assertFalse(saxparser.isNamespaceAware());
+        } catch (FactoryConfigurationError e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Test case to test setnamespaceAware() method.
+     */
+    @Test
+    public void testNamespace02() {
+        try {
+            SAXParserFactory spf = SAXParserFactory.newInstance();
+            spf.setNamespaceAware(true);
+            SAXParser saxparser = spf.newSAXParser();
+            assertTrue(saxparser.isNamespaceAware());
+        } catch (FactoryConfigurationError | ParserConfigurationException | SAXException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Test case to test if the getParser() method returns instance of Parser.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testParser01(SAXParser saxparser) {
+        try {
+            Parser parser = saxparser.getParser();
+        } catch (FactoryConfigurationError | SAXException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Test case to test if the getXMLReader() method returns instance of
+     * XMLReader.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testXmlReader01(SAXParser saxparser) {
+        try {
+            XMLReader xmlReader = saxparser.getXMLReader();
+        } catch (FactoryConfigurationError | SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Test whether the xml-string property is not supported.
+     *
+     * @throws SAXNotSupportedException
+     */
+    @Test(expectedExceptions = SAXNotSupportedException.class, dataProvider = "parser-provider")
+    public void testProperty01(SAXParser saxparser) throws SAXNotSupportedException {
+        try {
+            Object object = saxparser.getProperty(XML_STRING);
+        } catch (SAXNotRecognizedException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Test whether the dom-node property is not supported.
+     *
+     * @throws SAXNotSupportedException
+     */
+    @Test(expectedExceptions = SAXNotSupportedException.class, dataProvider = "parser-provider")
+    public void testProperty02(SAXParser saxparser) throws SAXNotSupportedException {
+        try {
+            Object object = saxparser.getProperty(DOM_NODE);
+        } catch (SAXNotRecognizedException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Test the default lexical-handler not exists.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testProperty03(SAXParser saxparser) {
+        try {
+            assertNull(saxparser.getProperty(LEXICAL_HANDLER));
+        } catch (SAXException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Test the default declaration-handler not exists.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testProperty04(SAXParser saxparser) {
+
+        try {
+            assertNull(saxparser.getProperty(DECL_HANDLER));
+        } catch (SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Test to set and get the lexical-handler.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testProperty05(SAXParser saxparser) {
+        try {
+            MyLexicalHandler myLexicalHandler = new MyLexicalHandler();
+            saxparser.setProperty(LEXICAL_HANDLER, myLexicalHandler);
+            Object object = saxparser.getProperty(LEXICAL_HANDLER);
+            assertTrue(object instanceof LexicalHandler);
+        } catch (SAXException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * Test to set and get the declaration-handler.
+     */
+    @Test(dataProvider = "parser-provider")
+    public void testProperty06(SAXParser saxparser) {
+        try {
+            MyDeclHandler myDeclHandler = new MyDeclHandler();
+            saxparser.setProperty(DECL_HANDLER, myDeclHandler);
+            Object object = saxparser.getProperty(DECL_HANDLER);
+            assertTrue(object instanceof DeclHandler);
+        } catch (SAXException e) {
+            failUnexpected(e);
+        }
+
+    }
+
+    /**
+     * Customized LexicalHandler used for test.
+     */
+    private class MyLexicalHandler implements LexicalHandler {
+
+        public void comment(char[] ch, int start, int length) {
+        }
+
+        public void endCDATA() {
+        }
+
+        public void endDTD() {
+        }
+
+        public void endEntity(String name) {
+        }
+
+        public void startCDATA() {
+        }
+
+        public void startDTD(String name, String publicId, String systemId) {
+        }
+
+        public void startEntity(String name) {
+        }
+    }
+
+    /**
+     * Customized DeclHandler used for test.
+     */
+    private class MyDeclHandler implements DeclHandler {
+
+        public void attributeDecl(String eName, String aName, String type, String valueDefault, String value) {
+        }
+
+        public void elementDecl(String name, String model) {
+        }
+
+        public void externalEntityDecl(String name, String publicId, String systemId) {
+        }
+
+        public void internalEntityDecl(String name, String value) {
+        }
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java
new file mode 100644
index 00000000000..efe12c595d6
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/SAXParserTest03.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.failUnexpected;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.io.IOException;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.parsers.SAXParser;
+import javax.xml.parsers.SAXParserFactory;
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+import org.xml.sax.SAXException;
+
+/**
+ * Class contains the test cases for SAXParser API
+ */
+public class SAXParserTest03 {
+
+    /**
+     * Provide SAXParserFactory.
+     *
+     * @throws Exception
+     */
+    @DataProvider(name = "input-provider")
+    public Object[][] getFactory() {
+        SAXParserFactory spf = SAXParserFactory.newInstance();
+        spf.setValidating(true);
+        MyErrorHandler handler = MyErrorHandler.newInstance();
+        return new Object[][] { { spf, handler } };
+    }
+
+    /**
+     * parsertest.xml holds a valid document. This method tests the validating
+     * parser.
+     */
+    @Test(dataProvider = "input-provider")
+    public void testParseValidate01(SAXParserFactory spf, MyErrorHandler handler) {
+        try {
+            SAXParser saxparser = spf.newSAXParser();
+            saxparser.parse(new File(TestUtils.XML_DIR, "parsertest.xml"), handler);
+            assertFalse(handler.errorOccured);
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * validns.xml holds a valid document with XML namespaces in it. This method
+     * tests the Validating parser with namespace processing on.
+     */
+    @Test(dataProvider = "input-provider")
+    public void testParseValidate02(SAXParserFactory spf, MyErrorHandler handler) {
+        try {
+            spf.setNamespaceAware(true);
+            SAXParser saxparser = spf.newSAXParser();
+            saxparser.parse(new File(TestUtils.XML_DIR, "validns.xml"), handler);
+            assertFalse(handler.errorOccured);
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            failUnexpected(e);
+        }
+    }
+
+    /**
+     * invalidns.xml holds an invalid document with XML namespaces in it. This
+     * method tests the validating parser with namespace processing on. It
+     * should throw validation error.
+     */
+    @Test(dataProvider = "input-provider")
+    public void testParseValidate03(SAXParserFactory spf, MyErrorHandler handler) {
+        try {
+            spf.setNamespaceAware(true);
+            SAXParser saxparser = spf.newSAXParser();
+            saxparser.parse(new File(TestUtils.XML_DIR, "invalidns.xml"), handler);
+            failUnexpected(new RuntimeException());
+        } catch (ParserConfigurationException | SAXException | IOException e) {
+            if (e instanceof SAXException) {
+                assertTrue(handler.errorOccured);
+            }
+        }
+    }
+
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/TestUtils.java b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/TestUtils.java
new file mode 100644
index 00000000000..9f8dc355333
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/ptests/TestUtils.java
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2014, 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.
+ */
+package javax.xml.parsers.ptests;
+
+import static jaxp.library.JAXPTestUtilities.ERROR_MSG_HEADER;
+import static jaxp.library.JAXPTestUtilities.FILE_SEP;
+
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.nio.file.Files;
+import java.nio.file.StandardCopyOption;
+
+import org.xml.sax.Attributes;
+import org.xml.sax.Locator;
+import org.xml.sax.SAXParseException;
+import org.xml.sax.helpers.DefaultHandler;
+import org.xml.sax.helpers.LocatorImpl;
+
+/**
+ * Utility interface which includes final variables of xml, golden file
+ * directories.
+ */
+interface TestUtils {
+    final String XML_DIR = System.getProperty("test.src", ".") + FILE_SEP + "javax/xml/parsers/xmlfiles";
+    final String GOLDEN_DIR = XML_DIR + FILE_SEP + "out";
+}
+
+/**
+ * Customized DefaultHandler which writes output document when methods are
+ * called by Transformer. Test may use output document to compare with golden
+ * file for verification.
+ */
+class MyCHandler extends DefaultHandler {
+
+    private final BufferedWriter bWriter;
+    private final Locator locator = new LocatorImpl();
+
+    private MyCHandler(File file) throws IOException {
+        bWriter = new BufferedWriter(new FileWriter(file));
+    }
+
+    public static MyCHandler newInstance(File file) throws IOException {
+        MyCHandler handler = new MyCHandler(file);
+        return handler;
+    }
+
+    public void characters(char[] ch, int start, int length) {
+        String s = new String(ch, start, length);
+        String str = String.format("characters...length is:%d\n<%s>", s.length(), s);
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    public void endDocument() {
+        String str = "endDocument...";
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+            bWriter.flush();
+            bWriter.close();
+
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    public void endElement(String namespaceURI, String localName, String qName) {
+        String str = String.format("endElement...\nnamespaceURI: <%s> localName: <%s> qName: <%s>", namespaceURI, localName, qName);
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    public void endPrefixMapping(String prefix) {
+        String str = String.format("endPrefixMapping...\nprefix: <%s>", prefix);
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    public void ignorableWhitespace(char[] ch, int start, int length) {
+        String s = new String(ch, start, length);
+        String str = String.format("ignorableWhitespace...\n%s ignorable white space string length: %d", s, s.length());
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    public void processingInstruction(String target, String data) {
+        String str = String.format("processingInstruction...target:<%s> data: <%s>", target, data);
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    public void skippedEntity(String name) {
+        String str = String.format("skippedEntity...\nname: <%s>", name);
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    public void startDocument() {
+        String str = "startDocument...";
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    public void startElement(String namespaceURI, String localName, String qName, Attributes atts) {
+        String str = String.format("startElement...\nnamespaceURI: <%s> localName: <%s> qName: <%s> Number of Attributes: <%d> Line# <%d>", namespaceURI,
+                localName, qName, atts.getLength(), locator.getLineNumber());
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+
+    public void startPrefixMapping(String prefix, String uri) {
+        String str = String.format("startPrefixMapping...\nprefix: <%s> uri: <%s>", prefix, uri);
+        try {
+            bWriter.write(str, 0, str.length());
+            bWriter.newLine();
+        } catch (IOException e) {
+            throw new RuntimeException(ERROR_MSG_HEADER, e);
+        }
+    }
+}
+
+/**
+ * Customized DefaultHandler used for SAXParseException testing.
+ */
+class MyErrorHandler extends DefaultHandler {
+    boolean errorOccured = false;
+
+    private MyErrorHandler() {
+    }
+
+    public static MyErrorHandler newInstance() {
+        return new MyErrorHandler();
+    }
+
+    public void error(SAXParseException e) {
+        errorOccured = true;
+    }
+
+    public void warning(SAXParseException e) {
+        errorOccured = true;
+    }
+
+    public void fatalError(SAXParseException e) {
+        errorOccured = true;
+    }
+}
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory01.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory01.xml
new file mode 100644
index 00000000000..fbd395050da
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory01.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<html>
+<![CDATA[ <xml>This is not parsed</xml>]]> yet
+</html>
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory02.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory02.xml
new file mode 100644
index 00000000000..df31079b448
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory02.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!DOCTYPE document [
+	<!ENTITY ws "Wiliam SHAkespeare">
+	<!ELEMENT document (title)>
+	<!ELEMENT title (#PCDATA)>
+]>
+<document>
+	<title>&ws;</title>
+</document> 
\ No newline at end of file
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory03.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory03.xml
new file mode 100644
index 00000000000..6b46e0066cc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory03.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!DOCTYPE document [
+	<!ENTITY ws "Wiliam SHAkespeare">
+	<!ELEMENT document (name)>
+	<!ELEMENT title (#PCDATA)>
+]>
+<document>
+	<title>&ws;</title>
+</document>
\ No newline at end of file
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory04.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory04.xml
new file mode 100644
index 00000000000..febbd6e4498
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory04.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<!DOCTYPE note [
+<!ELEMENT note    (#PCDATA|to|ar:from|br:from|heading|body)*>
+<!ELEMENT to      (#PCDATA)>
+<!ELEMENT ar:from    (#PCDATA)>
+<!ELEMENT br:from    (#PCDATA)>
+<!ELEMENT heading (#PCDATA)>
+<!ELEMENT body    (#PCDATA)>
+<!ATTLIST note xmlns:ar CDATA #IMPLIED>
+<!ATTLIST note xmlns:br CDATA #IMPLIED>
+]>
+<note xmlns:ar="http://www.xml.com/books">
+      xmlns:br="http://www.abc.com">
+<to>Tove</to>
+<ar:from>Jani</ar:from>
+<br:from>Next</br:from>
+<heading>Reminder</heading>
+<body> weekend!</body>
+</note> 
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory05.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory05.xml
new file mode 100644
index 00000000000..29ff804df9b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory05.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<!DOCTYPE note [
+<!ELEMENT note    (to,from,heading,body)>
+<!ELEMENT to      (#PCDATA)>
+<!ELEMENT from    (#PCDATA)>
+<!ELEMENT heading (#PCDATA)>
+<!ELEMENT body    (#PCDATA)>
+]>
+<note xmlns:ar="http://www.xml.com/books">
+      xmlns:br="http://www.abc.com">
+<to>Tove</to>
+<ar:from>Jani</ar:from>
+<br:from>Next</br:from>
+<heading>Reminder</heading>
+<body> weekend!</body>
+</note> 
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory06.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory06.xml
new file mode 100644
index 00000000000..8774a5ac5f5
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory06.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0"?>
+<!DOCTYPE note [
+<!ELEMENT note    (#PCDATA|to|with|ar:from|br:from|heading|body)*>
+<!ELEMENT to      (sender)>
+<!ELEMENT sender (#PCDATA)>
+<!ELEMENT with      (message)>
+<!ELEMENT message (#PCDATA)>
+<!ELEMENT ar:from    (tab)>
+<!ELEMENT tab (#PCDATA)>
+<!ELEMENT br:from    (#PCDATA)>
+<!ELEMENT heading (#PCDATA)>
+<!ELEMENT body    (#PCDATA)>
+<!ATTLIST note xmlns:ar CDATA #IMPLIED>
+<!ATTLIST note xmlns:br CDATA #IMPLIED>
+]>
+<note xmlns:ar="http://www.xml.com/books"
+      xmlns:br="http://www.abc.com">
+<to>
+
+<!--This is with whitespace-->
+<sender>John</sender>
+
+</to>
+<with>   <message>with whitespace</message>   </with>
+<ar:from>	<tab>Jani</tab></ar:from>
+<br:from>Next</br:from>
+<heading>Reminder</heading>
+<body> weekend!</body>
+</note> 
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory07.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory07.xml
new file mode 100644
index 00000000000..a0c5f387d00
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory07.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<!DOCTYPE note [
+<!ELEMENT note    (to|heading|body)*>
+<!ELEMENT body    (#PCDATA)>
+]>
+<note>
+<to>Tove</to>
+<body><!--hello--></body>
+</note> 
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory08.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory08.xml
new file mode 100644
index 00000000000..8bc74d7ad8d
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderFactory08.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0"?>
+<note>
+<to>Tove</to>
+<body><!--hello--></body>
+</note> 
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl01.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl01.xml
new file mode 100644
index 00000000000..fbd395050da
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl01.xml
@@ -0,0 +1,4 @@
+<?xml version="1.0"?>
+<html>
+<![CDATA[ <xml>This is not parsed</xml>]]> yet
+</html>
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl02.dtd b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl02.dtd
new file mode 100644
index 00000000000..28b8a7b586a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl02.dtd
@@ -0,0 +1,12 @@
+<!ELEMENT document ANY>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT publisher (#PCDATA)>
+<!ELEMENT book (#PCDATA)>
+<!ELEMENT bookurn (#PCDATA)>
+<!ATTLIST book price CDATA "$100">
+<!ATTLIST book author CDATA "Herold">
+<!ATTLIST book number ID #REQUIRED>
+<!ATTLIST bookurn xmlns CDATA "10">
+<!ATTLIST bookurn xmlns:isbn CDATA "10">
+<!ENTITY w "William">
+<!ENTITY s "Shakespeare">
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl02.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl02.xml
new file mode 100644
index 00000000000..89e09643844
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/DocumentBuilderImpl02.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE document SYSTEM "DocumentBuilderImpl02.dtd">
+<document>
+
+        Publishers of the Music of New York Women Composers
+
+        <title>The Publishers </title>
+
+        <publisher>
+        Alfred Publishing
+        &w;
+        15535 Morrison
+        South Oaks CA 91403
+        </publisher>
+
+        <book price="$100" author = "Herold" number = "no_11">
+                eXtensible Markup Language
+        </book>
+
+        <bookurn xmlns='urn:loc.gov:books'
+                   xmlns:isbn='urn:ISBN:0-395-36341-6'/>
+       
+
+        Publishers are not noted in report by time.
+
+</document>
+
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/correct.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/correct.xml
new file mode 100644
index 00000000000..5c137300c85
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/correct.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" standalone="yes"?>
+<document>
+	Publishers of the Music of New York Women Composers
+
+	<title>The Publishers </title>
+	
+	<publisher>
+	Alfred Publishing 
+	15535 Morrison
+	South Oaks CA 91403
+	</publisher>
+
+	<book price="$100" author = "Herold" number = "no_11"> 
+		eXtensible Markup Language 
+	</book>
+
+  	<bookurn xmlns='urn:loc.gov:books'
+        	   xmlns:isbn='urn:ISBN:0-395-36341-6'/> 
+	<xmlns:pages />
+
+	Publishers are not noted in report by time.
+
+</document>
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10.xml
new file mode 100644
index 00000000000..f73db963097
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10.xml
@@ -0,0 +1,13 @@
+<?xml version="1.0" standalone="yes" ?>
+<cities>
+	<city name="Paris" country="France"/>
+	<city name="Roma" country="Italia"/>
+	<city name="Nice" country="France"/>
+	<city name="Madrid" country="Espana"/>
+	<city name="Milano" country="Italia"/>
+	<city name="Firenze" country="Italia"/>
+	<city name="Napoli" country="Italia"/>
+	<city name="Lyon" country="France"/>
+	<city name="Barcelona" country="Espana"/>
+</cities>
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10.xsl b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10.xsl
new file mode 100644
index 00000000000..b8b354d8afe
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10.xsl
@@ -0,0 +1,21 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+<xsl:output method="xml" indent="yes"/>
+<xsl:template match="/">
+<xsl:variable name="unique-countries"
+	select="/cities
+		/city[not(@country=preceding-sibling::city/@country)]
+		/@country"
+/>
+    <countries>
+	<xsl:for-each select="$unique-countries">
+	  <country name="{.}">
+		<xsl:for-each select="//city[@country=current()]">
+		  <city><xsl:value-of select="@name"/></city>
+		</xsl:for-each>
+	  </country> 
+	</xsl:for-each>
+    </countries>
+</xsl:template>
+</xsl:stylesheet>
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10import.xsl b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10import.xsl
new file mode 100644
index 00000000000..4a72677c638
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10import.xsl
@@ -0,0 +1,5 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+	<xsl:import href="temp/cities.xsl"/>
+</xsl:stylesheet>
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10include.xsl b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10include.xsl
new file mode 100644
index 00000000000..690055f8c22
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/dbf10include.xsl
@@ -0,0 +1,5 @@
+<?xml version="1.0" ?>
+<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
+	<xsl:include href="temp/cities.xsl"/>
+</xsl:stylesheet>
+
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/firstdtd.dtd b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/firstdtd.dtd
new file mode 100644
index 00000000000..6fbfdfeb67b
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/firstdtd.dtd
@@ -0,0 +1,13 @@
+<!ELEMENT document ANY>
+<!ELEMENT title (#PCDATA)>
+<!ELEMENT publisher (#PCDATA)>
+<!ELEMENT book (#PCDATA)>
+<!ELEMENT bookurn (#PCDATA)>
+<!ELEMENT xmlns:pages (#PCDATA)>
+<!ATTLIST book price CDATA "$100">
+<!ATTLIST book author CDATA "Herold">
+<!ATTLIST book number ID #REQUIRED>
+<!ATTLIST bookurn xmlns CDATA "10">
+<!ATTLIST bookurn xmlns:isbn CDATA "10">
+<!ENTITY mkm "I am Krishna">
+<!ENTITY km "I am KrishnaMohan">
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/invalid.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/invalid.xml
new file mode 100644
index 00000000000..18b1e6175bc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/invalid.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" standalone="yes"?>
+<document>
+	Publishers of the Music of New York Women Composers
+
+	<title>The Publishers </title>
+	
+	<publisher>
+	Alfred Publishing 
+	&mkm; 
+	15535 Morrison
+	South Oaks CA 91403
+	</publisher>
+
+	<book price="$100" author = "Herold" number = "no_11"> 
+		eXtensible Markup Language 
+	</book>
+
+  	<bookurn xmlns='urn:loc.gov:books'
+        	   xmlns:isbn='urn:ISBN:0-395-36341-6'/> 
+	<xmlns:pages />
+
+	Publishers are not noted in report by time.
+
+</document>
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/invalidns.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/invalidns.xml
new file mode 100644
index 00000000000..5ce64b9733a
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/invalidns.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<!DOCTYPE book [
+<!ELEMENT book (#PCDATA | ar:rating | fr:rating | zr:rating)* >
+<!ATTLIST ar:rating 
+	  xmlns:ar CDATA #FIXED "http://www.amazon.com/">
+<!ATTLIST fr:rating 
+	  xmlns:fr CDATA #FIXED "http://www.fatbrain.com/">
+<!ELEMENT ar:rating (#PCDATA)>
+<!ELEMENT fr:rating (#PCDATA)>
+<!ELEMENT zr:rating (#PCDATA)>
+]>
+<book> 
+   <ar:rating>4star</ar:rating>
+   <fr:rating>3star</fr:rating>
+   <zr:rating>2star</zr:rating>
+</book> 
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/namespace1.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/namespace1.xml
new file mode 100644
index 00000000000..580e279c407
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/namespace1.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0"?>
+<html xmlns="http://www.w3.org/TR/REC-html40"
+      xmlns:b="urn:BooksAreUs.org:BookInfo">
+  <head>
+    <title>Typography</title>
+  </head>
+
+  <body>
+    <p> Welcome to the world of typography! Here is a book that you may find useful.</p>
+    <b:title style="font-family: sans-serif;">Digital Typography</b:title> 
+    <b:author>Donald Knuth</b:author>
+    <?netscape http://www.hotmail.com?>
+  </body>
+
+</html>
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/ns4.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/ns4.xml
new file mode 100644
index 00000000000..0cfb9b5c38c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/ns4.xml
@@ -0,0 +1,8 @@
+<section><title>Book-Signing Event</title>
+  <signing>
+    <author title="Mr" name="Vikram Seth" />
+    <book title="A Suitable Boy" price="$22.95" /></signing>
+  <signing>
+    <author title="Dr" name="Oliver Sacks" />
+    <book title="The Island of the Color-Blind" price="$12.95" /></signing>
+  </section>
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/out/dbfactory02GF.out b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/out/dbfactory02GF.out
new file mode 100644
index 00000000000..6a628236b62
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/out/dbfactory02GF.out
@@ -0,0 +1,83 @@
+startDocument...
+startPrefixMapping...
+prefix: <ar> uri: <http://www.xml.com/books>
+startPrefixMapping...
+prefix: <br> uri: <http://www.abc.com>
+startElement...
+namespaceURI: <> localName: <note> qName: <note> Number of Attributes: <2> Line# <0>
+characters...length is:1
+<
+>
+startElement...
+namespaceURI: <> localName: <to> qName: <to> Number of Attributes: <0> Line# <0>
+startElement...
+namespaceURI: <> localName: <sender> qName: <sender> Number of Attributes: <0> Line# <0>
+characters...length is:4
+<John>
+endElement...
+namespaceURI: <> localName: <sender> qName: <sender>
+endElement...
+namespaceURI: <> localName: <to> qName: <to>
+characters...length is:1
+<
+>
+startElement...
+namespaceURI: <> localName: <with> qName: <with> Number of Attributes: <0> Line# <0>
+startElement...
+namespaceURI: <> localName: <message> qName: <message> Number of Attributes: <0> Line# <0>
+characters...length is:15
+<with whitespace>
+endElement...
+namespaceURI: <> localName: <message> qName: <message>
+endElement...
+namespaceURI: <> localName: <with> qName: <with>
+characters...length is:1
+<
+>
+startElement...
+namespaceURI: <http://www.xml.com/books> localName: <from> qName: <ar:from> Number of Attributes: <0> Line# <0>
+startElement...
+namespaceURI: <> localName: <tab> qName: <tab> Number of Attributes: <0> Line# <0>
+characters...length is:4
+<Jani>
+endElement...
+namespaceURI: <> localName: <tab> qName: <tab>
+endElement...
+namespaceURI: <http://www.xml.com/books> localName: <from> qName: <ar:from>
+characters...length is:1
+<
+>
+startElement...
+namespaceURI: <http://www.abc.com> localName: <from> qName: <br:from> Number of Attributes: <0> Line# <0>
+characters...length is:4
+<Next>
+endElement...
+namespaceURI: <http://www.abc.com> localName: <from> qName: <br:from>
+characters...length is:1
+<
+>
+startElement...
+namespaceURI: <> localName: <heading> qName: <heading> Number of Attributes: <0> Line# <0>
+characters...length is:8
+<Reminder>
+endElement...
+namespaceURI: <> localName: <heading> qName: <heading>
+characters...length is:1
+<
+>
+startElement...
+namespaceURI: <> localName: <body> qName: <body> Number of Attributes: <0> Line# <0>
+characters...length is:9
+< weekend!>
+endElement...
+namespaceURI: <> localName: <body> qName: <body>
+characters...length is:1
+<
+>
+endElement...
+namespaceURI: <> localName: <note> qName: <note>
+endPrefixMapping...
+prefix: <br>
+endPrefixMapping...
+prefix: <ar>
+endDocument...
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/out/dbfnstest01GF.out b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/out/dbfnstest01GF.out
new file mode 100644
index 00000000000..1ec64f52eef
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/out/dbfnstest01GF.out
@@ -0,0 +1,79 @@
+startDocument...
+startPrefixMapping...
+prefix: <> uri: <http://www.w3.org/TR/REC-html40>
+startPrefixMapping...
+prefix: <b> uri: <urn:BooksAreUs.org:BookInfo>
+startElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <html> qName: <html> Number of Attributes: <2> Line# <0>
+characters...length is:3
+<
+  >
+startElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <head> qName: <head> Number of Attributes: <0> Line# <0>
+characters...length is:5
+<
+    >
+startElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <title> qName: <title> Number of Attributes: <0> Line# <0>
+characters...length is:10
+<Typography>
+endElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <title> qName: <title>
+characters...length is:3
+<
+  >
+endElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <head> qName: <head>
+characters...length is:4
+<
+
+  >
+startElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <body> qName: <body> Number of Attributes: <0> Line# <0>
+characters...length is:5
+<
+    >
+startElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <p> qName: <p> Number of Attributes: <0> Line# <0>
+characters...length is:77
+< Welcome to the world of typography! Here is a book that you may find useful.>
+endElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <p> qName: <p>
+characters...length is:5
+<
+    >
+startElement...
+namespaceURI: <urn:BooksAreUs.org:BookInfo> localName: <title> qName: <b:title> Number of Attributes: <1> Line# <0>
+characters...length is:18
+<Digital Typography>
+endElement...
+namespaceURI: <urn:BooksAreUs.org:BookInfo> localName: <title> qName: <b:title>
+characters...length is:6
+< 
+    >
+startElement...
+namespaceURI: <urn:BooksAreUs.org:BookInfo> localName: <author> qName: <b:author> Number of Attributes: <0> Line# <0>
+characters...length is:12
+<Donald Knuth>
+endElement...
+namespaceURI: <urn:BooksAreUs.org:BookInfo> localName: <author> qName: <b:author>
+characters...length is:5
+<
+    >
+processingInstruction...target:<netscape> data: <http://www.hotmail.com>
+characters...length is:3
+<
+  >
+endElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <body> qName: <body>
+characters...length is:2
+<
+
+>
+endElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <html> qName: <html>
+endPrefixMapping...
+prefix: <b>
+endPrefixMapping...
+prefix: <>
+endDocument...
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/out/dbfnstest02GF.out b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/out/dbfnstest02GF.out
new file mode 100644
index 00000000000..1ec64f52eef
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/out/dbfnstest02GF.out
@@ -0,0 +1,79 @@
+startDocument...
+startPrefixMapping...
+prefix: <> uri: <http://www.w3.org/TR/REC-html40>
+startPrefixMapping...
+prefix: <b> uri: <urn:BooksAreUs.org:BookInfo>
+startElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <html> qName: <html> Number of Attributes: <2> Line# <0>
+characters...length is:3
+<
+  >
+startElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <head> qName: <head> Number of Attributes: <0> Line# <0>
+characters...length is:5
+<
+    >
+startElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <title> qName: <title> Number of Attributes: <0> Line# <0>
+characters...length is:10
+<Typography>
+endElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <title> qName: <title>
+characters...length is:3
+<
+  >
+endElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <head> qName: <head>
+characters...length is:4
+<
+
+  >
+startElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <body> qName: <body> Number of Attributes: <0> Line# <0>
+characters...length is:5
+<
+    >
+startElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <p> qName: <p> Number of Attributes: <0> Line# <0>
+characters...length is:77
+< Welcome to the world of typography! Here is a book that you may find useful.>
+endElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <p> qName: <p>
+characters...length is:5
+<
+    >
+startElement...
+namespaceURI: <urn:BooksAreUs.org:BookInfo> localName: <title> qName: <b:title> Number of Attributes: <1> Line# <0>
+characters...length is:18
+<Digital Typography>
+endElement...
+namespaceURI: <urn:BooksAreUs.org:BookInfo> localName: <title> qName: <b:title>
+characters...length is:6
+< 
+    >
+startElement...
+namespaceURI: <urn:BooksAreUs.org:BookInfo> localName: <author> qName: <b:author> Number of Attributes: <0> Line# <0>
+characters...length is:12
+<Donald Knuth>
+endElement...
+namespaceURI: <urn:BooksAreUs.org:BookInfo> localName: <author> qName: <b:author>
+characters...length is:5
+<
+    >
+processingInstruction...target:<netscape> data: <http://www.hotmail.com>
+characters...length is:3
+<
+  >
+endElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <body> qName: <body>
+characters...length is:2
+<
+
+>
+endElement...
+namespaceURI: <http://www.w3.org/TR/REC-html40> localName: <html> qName: <html>
+endPrefixMapping...
+prefix: <b>
+endPrefixMapping...
+prefix: <>
+endDocument...
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/parsertest.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/parsertest.xml
new file mode 100644
index 00000000000..3d3192f4045
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/parsertest.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE document SYSTEM "firstdtd.dtd">
+<document>
+	Publishers of the Music of New York Women Composers
+
+	<title>The Publishers </title>
+	
+	<publisher>
+	Alfred Publishing 
+	&mkm; 
+	15535 Morrison
+	South Oaks CA 91403
+	</publisher>
+
+	<book price="$100" author = "Herold" number = "no_11"> 
+		eXtensible Markup Language 
+	</book>
+
+  	<bookurn xmlns='urn:loc.gov:books'
+        	   xmlns:isbn='urn:ISBN:0-395-36341-6'/> 
+	<xmlns:pages />
+
+	Publishers are not noted in report by time.
+
+</document>
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test.xml
new file mode 100644
index 00000000000..8ad28618d01
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+ <contact xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="test.xsd">
+<name> John </name>
+<phone>444-121-3434</phone>
+</contact>
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test.xsd b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test.xsd
new file mode 100644
index 00000000000..1671283691c
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test.xsd
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+ <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
+<xs:element name="contact">
+<xs:complexType>
+<xs:sequence>
+  <xs:element name="name" type="xs:string"/>
+  <xs:element name="phone" type="xs:string"/>
+</xs:sequence>
+</xs:complexType>
+</xs:element>
+</xs:schema>
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test1.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test1.xml
new file mode 100644
index 00000000000..45de38a3bce
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/test1.xml
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+ <contact xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="junk.xsd">
+<name> John </name>
+<phone>444-121-3434</phone>
+</contact>
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/valid.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/valid.xml
new file mode 100644
index 00000000000..18b1e6175bc
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/valid.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" standalone="yes"?>
+<document>
+	Publishers of the Music of New York Women Composers
+
+	<title>The Publishers </title>
+	
+	<publisher>
+	Alfred Publishing 
+	&mkm; 
+	15535 Morrison
+	South Oaks CA 91403
+	</publisher>
+
+	<book price="$100" author = "Herold" number = "no_11"> 
+		eXtensible Markup Language 
+	</book>
+
+  	<bookurn xmlns='urn:loc.gov:books'
+        	   xmlns:isbn='urn:ISBN:0-395-36341-6'/> 
+	<xmlns:pages />
+
+	Publishers are not noted in report by time.
+
+</document>
diff --git a/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/validns.xml b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/validns.xml
new file mode 100644
index 00000000000..805b468e74e
--- /dev/null
+++ b/jaxp/test/javax/xml/jaxp/functional/javax/xml/parsers/xmlfiles/validns.xml
@@ -0,0 +1,14 @@
+<?xml version="1.0"?>
+<!DOCTYPE book [
+<!ELEMENT book (#PCDATA| ar:rating| fr:rating)* >
+<!ATTLIST ar:rating 
+	  xmlns:ar CDATA #FIXED "http://www.amazon.com/">
+<!ATTLIST fr:rating 
+	  xmlns:fr CDATA #FIXED "http://www.fatbrain.com/">
+<!ELEMENT ar:rating (#PCDATA)>
+<!ELEMENT fr:rating (#PCDATA)>
+]>
+<book> 
+   <ar:rating>4star</ar:rating>
+   <fr:rating>3star</fr:rating>
+</book> 

From e5ca45cb6a3ef0a621f9a95275040618eb631d96 Mon Sep 17 00:00:00 2001
From: "J. Duke" <duke@openjdk.org>
Date: Wed, 5 Jul 2017 20:07:56 +0200
Subject: [PATCH 297/299] Added tag jdk9-b40 for changeset 82f4cb44b2d7

---
 .hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.hgtags b/.hgtags
index f011034848d..a943fbc8d8a 100644
--- a/.hgtags
+++ b/.hgtags
@@ -282,3 +282,4 @@ a137992d750c72f6f944f341aa19b0d0d96afe0c jdk9-b35
 b409bc51bc23cfd51f2bd04ea919ec83535af9d0 jdk9-b37
 948cceef81ba4cb34bc233e7cc5952951ff04e88 jdk9-b38
 4e7c4d692e934cb9023af8201e7c2b510e9c4ee1 jdk9-b39
+82f4cb44b2d7af2352f48568a64b7b6a5ae960cd jdk9-b40

From 1e89746cb2e9dfe85849ab25a09ade365599027e Mon Sep 17 00:00:00 2001
From: "J. Duke" <duke@openjdk.org>
Date: Wed, 5 Jul 2017 20:08:43 +0200
Subject: [PATCH 298/299] Added tag jdk9-b41 for changeset 9fffb959eb41

---
 .hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.hgtags b/.hgtags
index a943fbc8d8a..cfd1432dae0 100644
--- a/.hgtags
+++ b/.hgtags
@@ -283,3 +283,4 @@ b409bc51bc23cfd51f2bd04ea919ec83535af9d0 jdk9-b37
 948cceef81ba4cb34bc233e7cc5952951ff04e88 jdk9-b38
 4e7c4d692e934cb9023af8201e7c2b510e9c4ee1 jdk9-b39
 82f4cb44b2d7af2352f48568a64b7b6a5ae960cd jdk9-b40
+9fffb959eb4197ff806e4ac12244761815b4deee jdk9-b41

From c587b06be28fa736941e58da907184ab4de3414e Mon Sep 17 00:00:00 2001
From: "J. Duke" <duke@openjdk.org>
Date: Wed, 5 Jul 2017 20:10:08 +0200
Subject: [PATCH 299/299] Added tag jdk9-b42 for changeset 3107be2ba9c6

---
 .hgtags | 1 +
 1 file changed, 1 insertion(+)

diff --git a/.hgtags b/.hgtags
index cfd1432dae0..aaf78d35e9c 100644
--- a/.hgtags
+++ b/.hgtags
@@ -284,3 +284,4 @@ b409bc51bc23cfd51f2bd04ea919ec83535af9d0 jdk9-b37
 4e7c4d692e934cb9023af8201e7c2b510e9c4ee1 jdk9-b39
 82f4cb44b2d7af2352f48568a64b7b6a5ae960cd jdk9-b40
 9fffb959eb4197ff806e4ac12244761815b4deee jdk9-b41
+3107be2ba9c6e208a0b86bc7100a141abbc5b5fb jdk9-b42